diff --git a/assets/main-3dc8345a.js b/assets/main-3dc8345a.js new file mode 100644 index 0000000..a36fb64 --- /dev/null +++ b/assets/main-3dc8345a.js @@ -0,0 +1,642 @@ +var RL=Object.defineProperty;var NL=(e,t,n)=>t in e?RL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var mi=(e,t,n)=>(NL(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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function ge(){}function OL(e,t){for(const n in t)e[n]=t[n];return e}function zL(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function qS(e){return e()}function Qb(){return Object.create(null)}function Ni(e){e.forEach(qS)}function gy(e){return typeof e=="function"}function je(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let og;function wo(e,t){return e===t?!0:(og||(og=document.createElement("a")),og.href=t,e===og.href)}function FL(e){return Object.keys(e).length===0}function jS(e,...t){if(e==null){for(const r of t)r(void 0);return ge}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function WS(e){let t;return jS(e,n=>t=n)(),t}function Pe(e,t,n){e.$$.on_destroy.push(jS(t,n))}function ei(e,t,n,r){if(e){const i=HS(e,t,n,r);return e[0](i)}}function HS(e,t,n,r){return e[1]&&r?OL(n.ctx.slice(),e[1](r(t))):n.ctx}function ni(e,t,n,r){if(e[2]&&r){const i=e[2](r(n));if(t.dirty===void 0)return i;if(typeof i=="object"){const a=[],h=Math.max(t.dirty.length,i.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let r=0;re.removeEventListener(t,n,r)}function UL(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Z_(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Ut(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function GL(e){return e===""?null:+e}function qL(e){return Array.from(e.childNodes)}function $n(e,t){t=""+t,e.data!==t&&(e.data=t)}function Go(e,t){e.value=t??""}function Si(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Rg(e,t,n){for(let r=0;r{const i=e.$$.callbacks[t];if(i){const a=jL(t,n,{cancelable:r});return i.slice().forEach(h=>{h.call(e,a)}),!a.defaultPrevented}return!0}}function _v(e,t){return Ff().$$.context.set(e,t),t}function vv(e){return Ff().$$.context.get(e)}function En(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(r=>r.call(this,t))}const tf=[],Jn=[];let af=[];const I0=[],XS=Promise.resolve();let C0=!1;function YS(){C0||(C0=!0,XS.then(bv))}function KS(){return YS(),XS}function vd(e){af.push(e)}function So(e){I0.push(e)}const X_=new Set;let Zh=0;function bv(){if(Zh!==0)return;const e=_d;do{try{for(;Zhe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),af=t}const vg=new Set;let wc;function zn(){wc={r:0,c:[],p:wc}}function Fn(){wc.r||Ni(wc.c),wc=wc.p}function bt(e,t){e&&e.i&&(vg.delete(e),e.i(t))}function Lt(e,t,n,r){if(e&&e.o){if(vg.has(e))return;vg.add(e),wc.c.push(()=>{vg.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function $b(e,t){const n=t.token={};function r(i,a,h,u){if(t.token!==n)return;t.resolved=u;let g=t.ctx;h!==void 0&&(g=g.slice(),g[h]=u);const w=i&&(t.current=i)(g);let S=!1;t.block&&(t.blocks?t.blocks.forEach((I,P)=>{P!==a&&I&&(zn(),Lt(I,1,1,()=>{t.blocks[P]===I&&(t.blocks[P]=null)}),Fn())}):t.block.d(1),w.c(),bt(w,1),w.m(t.mount(),t.anchor),S=!0),t.block=w,t.blocks&&(t.blocks[a]=w),S&&bv()}if(zL(e)){const i=Ff();if(e.then(a=>{Vl(i),r(t.then,1,t.value,a),Vl(null)},a=>{if(Vl(i),r(t.catch,2,t.error,a),Vl(null),!t.hasCatch)throw a}),t.current!==t.pending)return r(t.pending,0),!0}else{if(t.current!==t.then)return r(t.then,1,t.value,e),!0;t.resolved=e}}function ZL(e,t,n){const r=t.slice(),{resolved:i}=e;e.current===e.then&&(r[e.value]=i),e.current===e.catch&&(r[e.error]=i),e.block.p(r,n)}function ti(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function XL(e,t){Lt(e,1,1,()=>{t.delete(e.key)})}function YL(e,t,n,r,i,a,h,u,g,w,S,I){let P=e.length,D=a.length,N=P;const G={};for(;N--;)G[e[N].key]=N;const Y=[],et=new Map,V=new Map,j=[];for(N=D;N--;){const st=I(i,a,N),ct=n(st);let mt=h.get(ct);mt?r&&j.push(()=>mt.p(st,t)):(mt=w(ct,st),mt.c()),et.set(ct,Y[N]=mt),ct in G&&V.set(ct,Math.abs(N-G[ct]))}const X=new Set,ot=new Set;function _t(st){bt(st,1),st.m(u,S),h.set(st.key,st),S=st.first,D--}for(;P&&D;){const st=Y[D-1],ct=e[P-1],mt=st.key,Ct=ct.key;st===ct?(S=st.first,P--,D--):et.has(Ct)?!h.has(mt)||X.has(mt)?_t(st):ot.has(Ct)?P--:V.get(mt)>V.get(Ct)?(ot.add(mt),_t(st)):(X.add(Ct),P--):(g(ct,h),P--)}for(;P--;){const st=e[P];et.has(st.key)||g(st,h)}for(;D;)_t(Y[D-1]);return Ni(j),Y}function Eo(e,t,n){const r=e.$$.props[t];r!==void 0&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function le(e){e&&e.c()}function se(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),vd(()=>{const a=e.$$.on_mount.map(qS).filter(gy);e.$$.on_destroy?e.$$.on_destroy.push(...a):Ni(a),e.$$.on_mount=[]}),i.forEach(vd)}function ae(e,t){const n=e.$$;n.fragment!==null&&(HL(n.after_update),Ni(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function KL(e,t){e.$$.dirty[0]===-1&&(tf.push(e),YS(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const N=D.length?D[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=N)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](N),S&&KL(e,I)),P}):[],w.update(),S=!0,Ni(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const I=qL(t.target);w.fragment&&w.fragment.l(I),I.forEach(Dt)}else w.fragment&&w.fragment.c();t.intro&&bt(e.$$.fragment),se(e,t.target,t.anchor),bv()}Vl(g)}class tn{constructor(){mi(this,"$$");mi(this,"$$set")}$destroy(){ae(this,1),this.$destroy=ge}$on(t,n){if(!gy(n))return ge;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!FL(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const JL="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(JL);const QL="/15m/assets/logo_dark-ed08d841.svg";const $L=e=>({dialog:e&1}),tx=e=>({dialog:e[0]});function tP(e){let t,n,r,i,a;const h=e[4].default,u=ei(h,e,e[3],tx);return{c(){t=Ot("dialog"),n=Ot("article"),u&&u.c(),t.open=!0},m(g,w){Rt(g,t,w),kt(t,n),u&&u.m(n,null),e[6](t),r=!0,i||(a=[Ze(window,"click",e[1]),Ze(window,"keydown",e[2]),Ze(t,"close",e[5])],i=!0)},p(g,[w]){u&&u.p&&(!r||w&9)&&ri(u,h,g,g[3],r?ni(h,g[3],w,$L):ii(g[3]),tx)},i(g){r||(bt(u,g),r=!0)},o(g){Lt(u,g),r=!1},d(g){g&&Dt(t),u&&u.d(g),e[6](null),i=!1,Ni(a)}}}function eP(e,t,n){let{$$slots:r={},$$scope:i}=t,a;function h(S){a.open&&S.target==a&&a.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function g(S){En.call(this,e,S)}function w(S){Jn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return e.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,h,u,i,r,g,w]}class JS extends tn{constructor(t){super(),$e(this,t,eP,tP,je,{})}}function ex(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function nx(e){let t,n,r=e[1]+"",i,a,h,u=e[2]+"",g,w;return{c(){t=Ot("tr"),n=Ot("td"),i=De(r),a=fe(),h=Ot("td"),g=De(u),w=fe()},m(S,I){Rt(S,t,I),kt(t,n),kt(n,i),kt(t,a),kt(t,h),kt(h,g),kt(t,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&$n(i,r),I&1&&u!==(u=S[2]+"")&&$n(g,u)},d(S){S&&Dt(t)}}}function nP(e){let t,n,r=ti(Object.entries(e[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class xv extends tn{constructor(t){super(),$e(this,t,rP,nP,je,{properties:0})}}function rx(e,t,n){const r=e.slice();return r[3]=t[n],r}function ix(e,t,n){const r=e.slice();return r[6]=t[n],r}function ox(e){let t,n;return{c(){t=Ot("span"),n=De(`  + `),Si(t,"background",e[6]),Si(t,"width","100%"),Si(t,"border","1px solid black")},m(r,i){Rt(r,t,i),kt(t,n)},p(r,i){i&1&&Si(t,"background",r[6])},d(r){r&&Dt(t)}}}function iP(e){let t,n=e[3]+"",r;return{c(){t=Ot("span"),r=De(n)},m(i,a){Rt(i,t,a),kt(t,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&$n(r,n)},d(i){i&&Dt(t)}}}function oP(e){let t,n=e[3].toFixed(e[2])+"",r;return{c(){t=Ot("span"),r=De(n)},m(i,a){Rt(i,t,a),kt(t,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&$n(r,n)},d(i){i&&Dt(t)}}}function sx(e){let t;function n(a,h){return a[2]>0?oP:iP}let r=n(e),i=r(e);return{c(){i.c(),t=oi()},m(a,h){i.m(a,h),Rt(a,t,h)},p(a,h){r===(r=n(a))&&i?i.p(a,h):(i.d(1),i=r(a),i&&(i.c(),i.m(t.parentNode,t)))},d(a){a&&Dt(t),i.d(a)}}}function sP(e){let t,n,r,i=ti(e[0]),a=[];for(let g=0;g{"colorScale"in h&&n(0,r=h.colorScale),"limits"in h&&n(1,i=h.limits),"decimalPlaces"in h&&n(2,a=h.decimalPlaces)},[r,i,a]}class QS extends tn{constructor(t){super(),$e(this,t,aP,sP,je,{colorScale:0,limits:1,decimalPlaces:2})}}function Hl(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}const Xh=[];function Y_(e,t){return{subscribe:or(e,t).subscribe}}function or(e,t=ge){let n;const r=new Set;function i(u){if(je(e,u)&&(e=u,n)){const g=!Xh.length;for(const w of r)w[1](),Xh.push(w,e);if(g){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:h}}/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const $S=Symbol("Comlink.proxy"),lP=Symbol("Comlink.endpoint"),uP=Symbol("Comlink.releaseProxy"),K_=Symbol("Comlink.finalizer"),bg=Symbol("Comlink.thrown"),tE=e=>typeof e=="object"&&e!==null||typeof e=="function",cP={canHandle:e=>tE(e)&&e[$S],serialize(e){const{port1:t,port2:n}=new MessageChannel;return wv(e,t),[n,[n]]},deserialize(e){return e.start(),rE(e)}},hP={canHandle:e=>tE(e)&&bg in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},eE=new Map([["proxy",cP],["throw",hP]]);function fP(e,t){for(const n of e)if(t===n||n==="*"||n instanceof RegExp&&n.test(t))return!0;return!1}function wv(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(i){if(!i||!i.data)return;if(!fP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:h,path:u}=Object.assign({path:[]},i.data),g=(i.data.argumentList||[]).map(xc);let w;try{const S=u.slice(0,-1).reduce((P,D)=>P[D],e),I=u.reduce((P,D)=>P[D],e);switch(h){case"GET":w=I;break;case"SET":S[u.slice(-1)[0]]=xc(i.data.value),w=!0;break;case"APPLY":w=I.apply(S,g);break;case"CONSTRUCT":{const P=new I(...g);w=sE(P)}break;case"ENDPOINT":{const{port1:P,port2:D}=new MessageChannel;wv(e,D),w=yP(P,[P])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[bg]:0}}Promise.resolve(w).catch(S=>({value:S,[bg]:0})).then(S=>{const[I,P]=zg(S);t.postMessage(Object.assign(Object.assign({},I),{id:a}),P),h==="RELEASE"&&(t.removeEventListener("message",r),nE(t),K_ in e&&typeof e[K_]=="function"&&e[K_]())}).catch(S=>{const[I,P]=zg({value:new TypeError("Unserializable return value"),[bg]:0});t.postMessage(Object.assign(Object.assign({},I),{id:a}),P)})}),t.start&&t.start()}function pP(e){return e.constructor.name==="MessagePort"}function nE(e){pP(e)&&e.close()}function rE(e,t){return T0(e,[],t)}function sg(e){if(e)throw new Error("Proxy has been released and is not useable")}function iE(e){return ef(e,{type:"RELEASE"}).then(()=>{nE(e)})}const Ng=new WeakMap,Og="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(Ng.get(e)||0)-1;Ng.set(e,t),t===0&&iE(e)});function dP(e,t){const n=(Ng.get(t)||0)+1;Ng.set(t,n),Og&&Og.register(e,t,e)}function mP(e){Og&&Og.unregister(e)}function T0(e,t=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,h){if(sg(r),h===uP)return()=>{mP(i),iE(e),r=!0};if(h==="then"){if(t.length===0)return{then:()=>i};const u=ef(e,{type:"GET",path:t.map(g=>g.toString())}).then(xc);return u.then.bind(u)}return T0(e,[...t,h])},set(a,h,u){sg(r);const[g,w]=zg(u);return ef(e,{type:"SET",path:[...t,h].map(S=>S.toString()),value:g},w).then(xc)},apply(a,h,u){sg(r);const g=t[t.length-1];if(g===lP)return ef(e,{type:"ENDPOINT"}).then(xc);if(g==="bind")return T0(e,t.slice(0,-1));const[w,S]=ax(u);return ef(e,{type:"APPLY",path:t.map(I=>I.toString()),argumentList:w},S).then(xc)},construct(a,h){sg(r);const[u,g]=ax(h);return ef(e,{type:"CONSTRUCT",path:t.map(w=>w.toString()),argumentList:u},g).then(xc)}});return dP(i,e),i}function gP(e){return Array.prototype.concat.apply([],e)}function ax(e){const t=e.map(zg);return[t.map(n=>n[0]),gP(t.map(n=>n[1]))]}const oE=new WeakMap;function yP(e,t){return oE.set(e,t),e}function sE(e){return Object.assign(e,{[$S]:!0})}function zg(e){for(const[t,n]of eE)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},oE.get(e)||[]]}function xc(e){switch(e.type){case"HANDLER":return eE.get(e.name).deserialize(e.value);case"RAW":return e.value}}function ef(e,t,n){return new Promise(r=>{const i=_P();e.addEventListener("message",function a(h){!h.data||!h.data.id||h.data.id!==i||(e.removeEventListener("message",a),r(h.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)})}function _P(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let cn;const Bl=new Array(128).fill(void 0);Bl.push(void 0,null,!0,!1);function On(e){return Bl[e]}let hd=Bl.length;function vP(e){e<132||(Bl[e]=hd,hd=e)}function bc(e){const t=On(e);return vP(e),t}let Sc=0,od=null;function fd(){return(od===null||od.byteLength===0)&&(od=new Uint8Array(cn.memory.buffer)),od}const xg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},bP=typeof xg.encodeInto=="function"?function(e,t){return xg.encodeInto(e,t)}:function(e,t){const n=xg.encode(e);return t.set(n),{read:e.length,written:n.length}};function J_(e,t,n){if(n===void 0){const u=xg.encode(e),g=t(u.length,1)>>>0;return fd().subarray(g,g+u.length).set(u),Sc=u.length,g}let r=e.length,i=t(r,1)>>>0;const a=fd();let h=0;for(;h127)break;a[i+h]=u}if(h!==r){h!==0&&(e=e.slice(h)),i=n(i,r,r=h+e.length*3,1)>>>0;const u=fd().subarray(i+h,i+r),g=bP(e,u);h+=g.written,i=n(i,r,h,1)>>>0}return Sc=h,i}function wg(e){return e==null}let sd=null;function qn(){return(sd===null||sd.byteLength===0)&&(sd=new Int32Array(cn.memory.buffer)),sd}const aE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&aE.decode();function il(e,t){return e=e>>>0,aE.decode(fd().subarray(e,e+t))}function bi(e){hd===Bl.length&&Bl.push(Bl.length+1);const t=hd;return hd=Bl[t],Bl[t]=e,t}let ad=null;function lE(){return(ad===null||ad.byteLength===0)&&(ad=new Float64Array(cn.memory.buffer)),ad}function L0(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){const i=e.length;let a="[";i>0&&(a+=L0(e[0]));for(let h=1;h1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} +${e.stack}`:r}function xP(e,t){const n=t(e.length*1,1)>>>0;return fd().set(e,n/1),Sc=e.length,n}function wP(e,t){return e=e>>>0,lE().subarray(e/8,e/8+t)}function Yh(e,t){try{return e.apply(this,t)}catch(n){cn.__wbindgen_exn_store(bi(n))}}const SP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>cn.__wbg_mapmodel_free(e>>>0));class lx{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,SP.unregister(this),t}free(){const t=this.__destroy_into_raw();cn.__wbg_mapmodel_free(t)}constructor(t,n,r){try{const u=cn.__wbindgen_add_to_stack_pointer(-16),g=xP(t,cn.__wbindgen_malloc),w=Sc;cn.mapmodel_new(u,g,w,n,wg(r)?0:bi(r));var i=qn()[u/4+0],a=qn()[u/4+1],h=qn()[u/4+2];if(h)throw bc(a);return this.__wbg_ptr=i>>>0,this}finally{cn.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let t,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_renderDebug(w,this.__wbg_ptr);var r=qn()[w/4+0],i=qn()[w/4+1],a=qn()[w/4+2],h=qn()[w/4+3],u=r,g=i;if(h)throw u=0,g=0,bc(a);return t=u,n=g,il(u,g)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(t,n,1)}}getInvertedBoundary(){let t,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=qn()[w/4+0],i=qn()[w/4+1],a=qn()[w/4+2],h=qn()[w/4+3],u=r,g=i;if(h)throw u=0,g=0,bc(a);return t=u,n=g,il(u,g)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(t,n,1)}}getBounds(){try{const i=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getBounds(i,this.__wbg_ptr);var t=qn()[i/4+0],n=qn()[i/4+1],r=wP(t,n).slice();return cn.__wbindgen_free(t,n*8,8),r}finally{cn.__wbindgen_add_to_stack_pointer(16)}}isochrone(t){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_isochrone(S,this.__wbg_ptr,bi(t));var i=qn()[S/4+0],a=qn()[S/4+1],h=qn()[S/4+2],u=qn()[S/4+3],g=i,w=a;if(u)throw g=0,w=0,bc(h);return n=g,r=w,il(g,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}route(t){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_route(S,this.__wbg_ptr,bi(t));var i=qn()[S/4+0],a=qn()[S/4+1],h=qn()[S/4+2],u=qn()[S/4+3],g=i,w=a;if(u)throw g=0,w=0,bc(h);return n=g,r=w,il(g,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}score(){let t,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_score(w,this.__wbg_ptr);var r=qn()[w/4+0],i=qn()[w/4+1],a=qn()[w/4+2],h=qn()[w/4+3],u=r,g=i;if(h)throw u=0,g=0,bc(a);return t=u,n=g,il(u,g)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(t,n,1)}}}async function EP(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){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",r);else throw r}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 IP(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){bc(t)},e.wbg.__wbindgen_boolean_get=function(t){const n=On(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_string_get=function(t,n){const r=On(n),i=typeof r=="string"?r:void 0;var a=wg(i)?0:J_(i,cn.__wbindgen_malloc,cn.__wbindgen_realloc),h=Sc;qn()[t/4+1]=h,qn()[t/4+0]=a},e.wbg.__wbindgen_string_new=function(t,n){const r=il(t,n);return bi(r)},e.wbg.__wbindgen_error_new=function(t,n){const r=new Error(il(t,n));return bi(r)},e.wbg.__wbindgen_is_object=function(t){const n=On(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return On(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return On(t)in On(n)},e.wbg.__wbindgen_number_get=function(t,n){const r=On(n),i=typeof r=="number"?r:void 0;lE()[t/8+1]=wg(i)?0:i,qn()[t/4+0]=!wg(i)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return On(t)==On(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const r=On(t)[On(n)];return bi(r)},e.wbg.__wbindgen_object_clone_ref=function(t){const n=On(t);return bi(n)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(On(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(On(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(On(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(On(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(On(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return bi(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const r=On(n).stack,i=J_(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Sc;qn()[t/4+1]=a,qn()[t/4+0]=i},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let r,i;try{r=t,i=n,console.error(il(t,n))}finally{cn.__wbindgen_free(r,i,1)}},e.wbg.__wbg_performance_a1b8bde2ee512264=function(t){const n=On(t).performance;return bi(n)},e.wbg.__wbg_now_abd80e969af37148=function(t){return On(t).now()},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,n){const r=new Function(il(t,n));return bi(r)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return Yh(function(t,n){const r=On(t).call(On(n));return bi(r)},arguments)},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Yh(function(){const t=self.self;return bi(t)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return Yh(function(){const t=window.window;return bi(t)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Yh(function(){const t=globalThis.globalThis;return bi(t)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return Yh(function(){const t=global.global;return bi(t)},arguments)},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let n;try{n=On(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Yh(function(t,n,r){const i=On(t).call(On(n),On(r));return bi(i)},arguments)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const n=On(t).buffer;return bi(n)},e.wbg.__wbg_new_63b92bc8671ed464=function(t){const n=new Uint8Array(On(t));return bi(n)},e.wbg.__wbg_set_a47bac70306a19a7=function(t,n,r){On(t).set(On(n),r>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(t){return On(t).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let n;try{n=On(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const r=L0(On(n)),i=J_(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Sc;qn()[t/4+1]=a,qn()[t/4+0]=i},e.wbg.__wbindgen_throw=function(t,n){throw new Error(il(t,n))},e.wbg.__wbindgen_memory=function(){const t=cn.memory;return bi(t)},e}function CP(e,t){return cn=e.exports,P0.__wbindgen_wasm_module=t,ad=null,sd=null,od=null,cn}async function P0(e){if(cn!==void 0)return cn;typeof e>"u"&&(e="/15m/assets/backend_bg.wasm");const t=IP();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:r}=await EP(await e,t);return CP(n,r)}class TP{constructor(){mi(this,"inner");this.inner=null}async loadOsmFile(t,n){await P0(),this.inner=new lx(t,!0,n)}async loadGraphFile(t){await P0(),this.inner=new lx(t,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:t.start.lng,y:t.start.lat,mode:t.mode,contours:t.contours,start_time:t.startTime}))}route(t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:t.start.lng,y1:t.start.lat,x2:t.end[0],y2:t.end[1],mode:t.mode,debug_search:t.debugSearch,use_heuristic:t.useHeuristic,start_time:t.startTime}))}score(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score())}}wv(TP);let uE="MZEJTanw3WpxRvt7qDfo",Ys=or({kind:"title"}),yy=or(null),Fg=or(!0);function ux(e){return["!=",["get",`access_${e}`],"None"]}let hf=or("foot"),Bg=or("07:00"),Ec=or(null),ff=or(null),cx=or(!0),Au=or(null),lf=or(!1);function hx(e){let t,n;return t=new JS({props:{$$slots:{default:[LP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function LP(e){let t,n,r,i,a,h,u,g,w,S;function I(){return e[1](e[3])}return{c(){t=Ot("h1"),t.textContent="15-minute neighborhood tool",n=fe(),r=Ot("p"),r.textContent="TODO. Extremely early in development.",i=fe(),a=Ot("p"),a.innerHTML=`This open source + tool is created by + Dustin Carlino + and relies heavily on + OpenStreetMap data.`,h=fe(),u=Ot("center"),g=Ot("button"),g.textContent="Start!"},m(P,D){Rt(P,t,D),Rt(P,n,D),Rt(P,r,D),Rt(P,i,D),Rt(P,a,D),Rt(P,h,D),Rt(P,u,D),kt(u,g),w||(S=Ze(g,"click",I),w=!0)},p(P,D){e=P},d(P){P&&(Dt(t),Dt(n),Dt(r),Dt(i),Dt(a),Dt(h),Dt(u)),w=!1,S()}}}function PP(e){let t,n,r=e[0]&&hx(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&bt(r,1)):(r=hx(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function MP(e,t,n){let r;return Pe(e,Fg,h=>n(0,r=h)),[r,h=>Hl(h).close(),()=>Wn(Fg,r=!1,r)]}class AP extends tn{constructor(t){super(),$e(this,t,MP,PP,je,{})}}var Ud=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _y(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?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(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var fx=Object.prototype.toString,cE=function(t){var n=fx.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&fx.call(t.callee)==="[object Function]"),r},Q_,px;function kP(){if(px)return Q_;px=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=cE,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),h=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=function(P){var D=P.constructor;return D&&D.prototype===P},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var P in window)try{if(!w["$"+P]&&t.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{g(window[P])}catch{return!0}}catch{return!0}return!1}(),I=function(P){if(typeof window>"u"||!S)return g(P);try{return g(P)}catch{return!1}};e=function(D){var N=D!==null&&typeof D=="object",G=n.call(D)==="[object Function]",Y=r(D),et=N&&n.call(D)==="[object String]",V=[];if(!N&&!G&&!Y)throw new TypeError("Object.keys called on a non-object");var j=h&&G;if(et&&D.length>0&&!t.call(D,0))for(var X=0;X0)for(var ot=0;ot"u"||!Vi?Rn:Vi(Uint8Array),Cc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Rn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Rn:ArrayBuffer,"%ArrayIteratorPrototype%":Kh&&Vi?Vi([][Symbol.iterator]()):Rn,"%AsyncFromSyncIteratorPrototype%":Rn,"%AsyncFunction%":nf,"%AsyncGenerator%":nf,"%AsyncGeneratorFunction%":nf,"%AsyncIteratorPrototype%":nf,"%Atomics%":typeof Atomics>"u"?Rn:Atomics,"%BigInt%":typeof BigInt>"u"?Rn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Rn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Rn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Rn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":tM,"%eval%":eval,"%EvalError%":eM,"%Float32Array%":typeof Float32Array>"u"?Rn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Rn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Rn:FinalizationRegistry,"%Function%":pE,"%GeneratorFunction%":nf,"%Int8Array%":typeof Int8Array>"u"?Rn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Rn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Rn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Kh&&Vi?Vi(Vi([][Symbol.iterator]())):Rn,"%JSON%":typeof JSON=="object"?JSON:Rn,"%Map%":typeof Map>"u"?Rn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Kh||!Vi?Rn:Vi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Rn:Promise,"%Proxy%":typeof Proxy>"u"?Rn:Proxy,"%RangeError%":nM,"%ReferenceError%":rM,"%Reflect%":typeof Reflect>"u"?Rn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Rn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Kh||!Vi?Rn:Vi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Rn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Kh&&Vi?Vi(""[Symbol.iterator]()):Rn,"%Symbol%":Kh?Symbol:Rn,"%SyntaxError%":pf,"%ThrowTypeError%":oM,"%TypedArray%":aM,"%TypeError%":uf,"%Uint8Array%":typeof Uint8Array>"u"?Rn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Rn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Rn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Rn:Uint32Array,"%URIError%":iM,"%WeakMap%":typeof WeakMap>"u"?Rn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Rn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Rn:WeakSet};if(Vi)try{null.error}catch(e){var lM=Vi(Vi(e));Cc["%Error.prototype%"]=lM}var uM=function e(t){var n;if(t==="%AsyncFunction%")n=t0("async function () {}");else if(t==="%GeneratorFunction%")n=t0("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=t0("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Vi&&(n=Vi(i.prototype))}return Cc[t]=n,n},_x={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Gd=Cv,Vg=fE,cM=Gd.call(Function.call,Array.prototype.concat),hM=Gd.call(Function.apply,Array.prototype.splice),vx=Gd.call(Function.call,String.prototype.replace),Ug=Gd.call(Function.call,String.prototype.slice),fM=Gd.call(Function.call,RegExp.prototype.exec),pM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,dM=/\\(\\)?/g,mM=function(t){var n=Ug(t,0,1),r=Ug(t,-1);if(n==="%"&&r!=="%")throw new pf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new pf("invalid intrinsic syntax, expected opening `%`");var i=[];return vx(t,pM,function(a,h,u,g){i[i.length]=u?vx(g,dM,"$1"):h||a}),i},gM=function(t,n){var r=t,i;if(Vg(_x,r)&&(i=_x[r],r="%"+i[0]+"%"),Vg(Cc,r)){var a=Cc[r];if(a===nf&&(a=uM(r)),typeof a>"u"&&!n)throw new uf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new pf("intrinsic "+t+" does not exist!")},gl=function(t,n){if(typeof t!="string"||t.length===0)throw new uf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new uf('"allowMissing" argument must be a boolean');if(fM(/^%?[^%]*%?$/,t)===null)throw new pf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=mM(t),i=r.length>0?r[0]:"",a=gM("%"+i+"%",n),h=a.name,u=a.value,g=!1,w=a.alias;w&&(i=w[0],hM(r,cM([0,1],w)));for(var S=1,I=!0;S=r.length){var G=Ic(u,P);I=!!G,I&&"get"in G&&!("originalValue"in G.get)?u=G.get:u=u[P]}else I=Vg(u,P),u=u[P];I&&!g&&(Cc[h]=u)}}return u},n0,bx;function Tv(){if(bx)return n0;bx=1;var e=gl,t=e("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return n0=t,n0}var yM=gl,Eg=yM("%Object.getOwnPropertyDescriptor%",!0);if(Eg)try{Eg([],"length")}catch{Eg=null}var Lv=Eg,xx=Tv(),_M=hE,Jh=ju,wx=Lv,Pv=function(t,n,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Jh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Jh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Jh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Jh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Jh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Jh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,g=!!wx&&wx(t,n);if(xx)xx(t,n,{configurable:h===null&&g?g.configurable:!h,enumerable:i===null&&g?g.enumerable:!i,value:r,writable:a===null&&g?g.writable:!a});else if(u||!i&&!a&&!h)t[n]=r;else throw new _M("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},M0=Tv(),dE=function(){return!!M0};dE.hasArrayLengthDefineBug=function(){if(!M0)return null;try{return M0([],"length",{value:1}).length!==1}catch{return!0}};var Mv=dE,vM=Ev,bM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",xM=Object.prototype.toString,wM=Array.prototype.concat,Sx=Pv,SM=function(e){return typeof e=="function"&&xM.call(e)==="[object Function]"},mE=Mv(),EM=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!SM(r)||!r())return}mE?Sx(e,t,n,!0):Sx(e,t,n)},gE=function(e,t){var n=arguments.length>2?arguments[2]:{},r=vM(t);bM&&(r=wM.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i4294967295||TM(n)!==n)throw new Cx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in t&&Ix){var h=Ix(t,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(a=!1)}return(i||a||!r)&&(CM?Ex(t,"length",n,!0,!0):Ex(t,"length",n)),t};(function(e){var t=Cv,n=gl,r=LM,i=ju,a=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||t.call(h,a),g=Tv(),w=n("%Math.max%");e.exports=function(P){if(typeof P!="function")throw new i("a function is required");var D=u(t,h,arguments);return r(D,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(t,a,arguments)};g?g(e.exports,"apply",{value:S}):e.exports.apply=S})(yE);var Bf=yE.exports,_E=gl,vE=Bf,PM=vE(_E("String.prototype.indexOf")),fa=function(t,n){var r=_E(t,!!n);return typeof r=="function"&&PM(t,".prototype.")>-1?vE(r):r},MM=Ev,bE=vy(),xE=fa,Tx=Object,AM=xE("Array.prototype.push"),Lx=xE("Object.prototype.propertyIsEnumerable"),kM=bE?Object.getOwnPropertySymbols:null,wE=function(t,n){if(t==null)throw new TypeError("target must be an object");var r=Tx(t);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||ZM)&&(HM?Px(t,"name",n,!0,!0):Px(t,"name",n)),t},KM=YM,JM=ju,QM=Object,CE=KM(function(){if(this==null||this!==QM(this))throw new JM("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),$M=CE,tA=Gc.supportsDescriptors,eA=Object.getOwnPropertyDescriptor,TE=function(){if(tA&&/a/mig.flags==="gim"){var t=eA(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return t.get}}return $M},nA=Gc.supportsDescriptors,rA=TE,iA=Object.getOwnPropertyDescriptor,oA=Object.defineProperty,sA=TypeError,Mx=Object.getPrototypeOf,aA=/a/,lA=function(){if(!nA||!Mx)throw new sA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=rA(),n=Mx(aA),r=iA(n,"flags");return(!r||r.get!==t)&&oA(n,"flags",{configurable:!0,enumerable:!1,get:t}),t},uA=Gc,cA=Bf,hA=CE,LE=TE,fA=lA,PE=cA(LE());uA(PE,{getPolyfill:LE,implementation:hA,shim:fA});var pA=PE,Ig={exports:{}},dA=vy,qc=function(){return dA()&&!!Symbol.toStringTag},mA=qc(),gA=fa,A0=gA("Object.prototype.toString"),by=function(t){return mA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:A0(t)==="[object Arguments]"},ME=function(t){return by(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&A0(t)!=="[object Array]"&&A0(t.callee)==="[object Function]"},yA=function(){return by(arguments)}();by.isLegacyArguments=ME;var AE=yA?by:ME;const _A={},vA=Object.freeze(Object.defineProperty({__proto__:null,default:_A},Symbol.toStringTag,{value:"Module"})),bA=_y(vA);var Av=typeof Map=="function"&&Map.prototype,i0=Object.getOwnPropertyDescriptor&&Av?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gg=Av&&i0&&typeof i0.get=="function"?i0.get:null,Ax=Av&&Map.prototype.forEach,kv=typeof Set=="function"&&Set.prototype,o0=Object.getOwnPropertyDescriptor&&kv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,qg=kv&&o0&&typeof o0.get=="function"?o0.get:null,kx=kv&&Set.prototype.forEach,xA=typeof WeakMap=="function"&&WeakMap.prototype,dd=xA?WeakMap.prototype.has:null,wA=typeof WeakSet=="function"&&WeakSet.prototype,md=wA?WeakSet.prototype.has:null,SA=typeof WeakRef=="function"&&WeakRef.prototype,Dx=SA?WeakRef.prototype.deref:null,EA=Boolean.prototype.valueOf,IA=Object.prototype.toString,CA=Function.prototype.toString,TA=String.prototype.match,Dv=String.prototype.slice,Tu=String.prototype.replace,LA=String.prototype.toUpperCase,Rx=String.prototype.toLowerCase,kE=RegExp.prototype.test,Nx=Array.prototype.concat,rl=Array.prototype.join,PA=Array.prototype.slice,Ox=Math.floor,k0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,s0=Object.getOwnPropertySymbols,D0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,df=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Io=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===df||"symbol")?Symbol.toStringTag:null,DE=Object.prototype.propertyIsEnumerable,zx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function Fx(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||kE.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var r=e<0?-Ox(-e):Ox(e);if(r!==e){var i=String(r),a=Dv.call(t,i.length+1);return Tu.call(i,n,"$&_")+"."+Tu.call(Tu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Tu.call(t,n,"$&_")}var R0=bA,Bx=R0.custom,Vx=NE(Bx)?Bx:null,MA=function e(t,n,r,i){var a=n||{};if(Iu(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Iu(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=Iu(a,"customInspect")?a.customInspect:!0;if(typeof h!="boolean"&&h!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Iu(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Iu(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return zE(t,a);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var g=String(t);return u?Fx(t,g):g}if(typeof t=="bigint"){var w=String(t)+"n";return u?Fx(t,w):w}var S=typeof a.depth>"u"?5:a.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof t=="object")return N0(t)?"[Array]":"[Object]";var I=XA(a,r);if(typeof i>"u")i=[];else if(OE(i,t)>=0)return"[Circular]";function P(Kt,St,Zt){if(St&&(i=PA.call(i),i.push(St)),Zt){var ee={depth:a.depth};return Iu(a,"quoteStyle")&&(ee.quoteStyle=a.quoteStyle),e(Kt,ee,r+1,i)}return e(Kt,a,r+1,i)}if(typeof t=="function"&&!Ux(t)){var D=BA(t),N=ag(t,P);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(N.length>0?" { "+rl.call(N,", ")+" }":"")}if(NE(t)){var G=df?Tu.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):D0.call(t);return typeof t=="object"&&!df?Jp(G):G}if(WA(t)){for(var Y="<"+Rx.call(String(t.nodeName)),et=t.attributes||[],V=0;V",Y}if(N0(t)){if(t.length===0)return"[]";var j=ag(t,P);return I&&!ZA(j)?"["+O0(j,I)+"]":"[ "+rl.call(j,", ")+" ]"}if(DA(t)){var X=ag(t,P);return!("cause"in Error.prototype)&&"cause"in t&&!DE.call(t,"cause")?"{ ["+String(t)+"] "+rl.call(Nx.call("[cause]: "+P(t.cause),X),", ")+" }":X.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+rl.call(X,", ")+" }"}if(typeof t=="object"&&h){if(Vx&&typeof t[Vx]=="function"&&R0)return R0(t,{depth:S-r});if(h!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(VA(t)){var ot=[];return Ax&&Ax.call(t,function(Kt,St){ot.push(P(St,t,!0)+" => "+P(Kt,t))}),Gx("Map",Gg.call(t),ot,I)}if(qA(t)){var _t=[];return kx&&kx.call(t,function(Kt){_t.push(P(Kt,t))}),Gx("Set",qg.call(t),_t,I)}if(UA(t))return a0("WeakMap");if(jA(t))return a0("WeakSet");if(GA(t))return a0("WeakRef");if(NA(t))return Jp(P(Number(t)));if(zA(t))return Jp(P(k0.call(t)));if(OA(t))return Jp(EA.call(t));if(RA(t))return Jp(P(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Ud)return"{ [object globalThis] }";if(!kA(t)&&!Ux(t)){var st=ag(t,P),ct=zx?zx(t)===Object.prototype:t instanceof Object||t.constructor===Object,mt=t instanceof Object?"":"null prototype",Ct=!ct&&Io&&Object(t)===t&&Io in t?Dv.call(Wu(t),8,-1):mt?"Object":"",H=ct||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",ft=H+(Ct||mt?"["+rl.call(Nx.call([],Ct||[],mt||[]),": ")+"] ":"");return st.length===0?ft+"{}":I?ft+"{"+O0(st,I)+"}":ft+"{ "+rl.call(st,", ")+" }"}return String(t)};function RE(e,t,n){var r=(n.quoteStyle||t)==="double"?'"':"'";return r+e+r}function AA(e){return Tu.call(String(e),/"/g,""")}function N0(e){return Wu(e)==="[object Array]"&&(!Io||!(typeof e=="object"&&Io in e))}function kA(e){return Wu(e)==="[object Date]"&&(!Io||!(typeof e=="object"&&Io in e))}function Ux(e){return Wu(e)==="[object RegExp]"&&(!Io||!(typeof e=="object"&&Io in e))}function DA(e){return Wu(e)==="[object Error]"&&(!Io||!(typeof e=="object"&&Io in e))}function RA(e){return Wu(e)==="[object String]"&&(!Io||!(typeof e=="object"&&Io in e))}function NA(e){return Wu(e)==="[object Number]"&&(!Io||!(typeof e=="object"&&Io in e))}function OA(e){return Wu(e)==="[object Boolean]"&&(!Io||!(typeof e=="object"&&Io in e))}function NE(e){if(df)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!D0)return!1;try{return D0.call(e),!0}catch{}return!1}function zA(e){if(!e||typeof e!="object"||!k0)return!1;try{return k0.call(e),!0}catch{}return!1}var FA=Object.prototype.hasOwnProperty||function(e){return e in this};function Iu(e,t){return FA.call(e,t)}function Wu(e){return IA.call(e)}function BA(e){if(e.name)return e.name;var t=TA.call(CA.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function OE(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return zE(Dv.call(e,0,t.maxStringLength),t)+r}var i=Tu.call(Tu.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,HA);return RE(i,"single",t)}function HA(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+LA.call(t.toString(16))}function Jp(e){return"Object("+e+")"}function a0(e){return e+" { ? }"}function Gx(e,t,n,r){var i=r?O0(n,r):rl.call(n,", ");return e+" ("+t+") {"+i+"}"}function ZA(e){for(var t=0;t=0)return!1;return!0}function XA(e,t){var n;if(e.indent===" ")n=" ";else if(typeof e.indent=="number"&&e.indent>0)n=rl.call(Array(e.indent+1)," ");else return null;return{base:n,prev:rl.call(Array(t+1),n)}}function O0(e,t){if(e.length===0)return"";var n=` +`+t.prev+t.base;return n+rl.call(e,","+n)+` +`+t.prev}function ag(e,t){var n=N0(e),r=[];if(n){r.length=e.length;for(var i=0;i=r)return n+1;var i=Kx(t,n);if(i<55296||i>56319)return n+1;var a=Kx(t,n+1);return a<56320||a>57343?n+1:n+2},u0=function(t){var n=0;return{next:function(){var i=n>=t.length,a;return i||(a=t[n],n+=1),{done:i,value:a}}}},Jx=function(t,n){if(_k(t)||Hx(t))return u0(t);if(vk(t)){var r=0;return{next:function(){var a=Sk(t,r),h=wk(t,r,a);return r=a,{done:a>t.length,value:h}}}}if(n&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!bk&&!xk)Ig.exports=function(t){if(t!=null)return Jx(t,!0)};else{var Ek=qE,Ik=WE,Qx=Sa("Map.prototype.forEach",!0),$x=Sa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var tw=Sa("Map.prototype.iterator",!0),ew=Sa("Set.prototype.iterator",!0);var nw=Sa("Map.prototype.@@iterator",!0)||Sa("Map.prototype._es6-shim iterator_",!0),rw=Sa("Set.prototype.@@iterator",!0)||Sa("Set.prototype._es6-shim iterator_",!0),Ck=function(t){if(Ek(t)){if(tw)return Zx(tw(t));if(nw)return nw(t);if(Qx){var n=[];return Qx(t,function(i,a){Yx(n,[a,i])}),u0(n)}}if(Ik(t)){if(ew)return Zx(ew(t));if(rw)return rw(t);if($x){var r=[];return $x(t,function(i){Yx(r,i)}),u0(r)}}};Ig.exports=function(t){return Ck(t)||Jx(t)}}}var Tk=Ig.exports,iw=function(e){return e!==e},HE=function(t,n){return t===0&&n===0?1/t===1/n:!!(t===n||iw(t)&&iw(n))},Lk=HE,ZE=function(){return typeof Object.is=="function"?Object.is:Lk},Pk=ZE,Mk=Gc,Ak=function(){var t=Pk();return Mk(Object,{is:t},{is:function(){return Object.is!==t}}),t},kk=Gc,Dk=Bf,Rk=HE,XE=ZE,Nk=Ak,YE=Dk(XE(),Object);kk(YE,{getPolyfill:XE,implementation:Rk,shim:Nk});var Ok=YE,zk=Bf,KE=fa,Fk=gl,z0=Fk("%ArrayBuffer%",!0),Cg=KE("ArrayBuffer.prototype.byteLength",!0),Bk=KE("Object.prototype.toString"),ow=!!z0&&!Cg&&new z0(0).slice,sw=!!ow&&zk(ow),JE=Cg||sw?function(t){if(!t||typeof t!="object")return!1;try{return Cg?Cg(t):sw(t,0),!0}catch{return!1}}:z0?function(t){return Bk(t)==="[object ArrayBuffer]"}:function(t){return!1},Vk=Date.prototype.getDay,Uk=function(t){try{return Vk.call(t),!0}catch{return!1}},Gk=Object.prototype.toString,qk="[object Date]",jk=qc(),Wk=function(t){return typeof t!="object"||t===null?!1:jk?Uk(t):Gk.call(t)===qk},F0=fa,QE=qc(),$E,tI,B0,V0;if(QE){$E=F0("Object.prototype.hasOwnProperty"),tI=F0("RegExp.prototype.exec"),B0={};var c0=function(){throw B0};V0={toString:c0,valueOf:c0},typeof Symbol.toPrimitive=="symbol"&&(V0[Symbol.toPrimitive]=c0)}var Hk=F0("Object.prototype.toString"),Zk=Object.getOwnPropertyDescriptor,Xk="[object RegExp]",Yk=QE?function(t){if(!t||typeof t!="object")return!1;var n=Zk(t,"lastIndex"),r=n&&$E(n,"value");if(!r)return!1;try{tI(t,V0)}catch(i){return i===B0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Hk(t)===Xk},Kk=fa,aw=Kk("SharedArrayBuffer.prototype.byteLength",!0),Jk=aw?function(t){if(!t||typeof t!="object")return!1;try{return aw(t),!0}catch{return!1}}:function(t){return!1},Qk=Number.prototype.toString,$k=function(t){try{return Qk.call(t),!0}catch{return!1}},t3=Object.prototype.toString,e3="[object Number]",n3=qc(),r3=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:n3?$k(t):t3.call(t)===e3},eI=fa,i3=eI("Boolean.prototype.toString"),o3=eI("Object.prototype.toString"),s3=function(t){try{return i3(t),!0}catch{return!1}},a3="[object Boolean]",l3=qc(),u3=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:l3&&Symbol.toStringTag in t?s3(t):o3(t)===a3},U0={exports:{}},c3=Object.prototype.toString,h3=Iv();if(h3){var f3=Symbol.prototype.toString,p3=/^Symbol\(.*\)$/,d3=function(t){return typeof t.valueOf()!="symbol"?!1:p3.test(f3.call(t))};U0.exports=function(t){if(typeof t=="symbol")return!0;if(c3.call(t)!=="[object Symbol]")return!1;try{return d3(t)}catch{return!1}}}else U0.exports=function(t){return!1};var m3=U0.exports,G0={exports:{}},lw=typeof BigInt<"u"&&BigInt,g3=function(){return typeof lw=="function"&&typeof BigInt=="function"&&typeof lw(42)=="bigint"&&typeof BigInt(42)=="bigint"},y3=g3();if(y3){var _3=BigInt.prototype.valueOf,v3=function(t){try{return _3.call(t),!0}catch{}return!1};G0.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:v3(t)}}else G0.exports=function(t){return!1};var b3=G0.exports,x3=UE,w3=r3,S3=u3,E3=m3,I3=b3,C3=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(x3(t))return"String";if(w3(t))return"Number";if(S3(t))return"Boolean";if(E3(t))return"Symbol";if(I3(t))return"BigInt"},Hg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,uw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Zg;Hg||(Zg=function(t){return!1});var q0=Hg?Hg.prototype.has:null,h0=uw?uw.prototype.has:null;!Zg&&!q0&&(Zg=function(t){return!1});var T3=Zg||function(t){if(!t||typeof t!="object")return!1;try{if(q0.call(t,q0),h0)try{h0.call(t,h0)}catch{return!0}return t instanceof Hg}catch{}return!1},j0={exports:{}},L3=gl,nI=fa,P3=L3("%WeakSet%",!0),f0=nI("WeakSet.prototype.has",!0);if(f0){var p0=nI("WeakMap.prototype.has",!0);j0.exports=function(t){if(!t||typeof t!="object")return!1;try{if(f0(t,f0),p0)try{p0(t,p0)}catch{return!0}return t instanceof P3}catch{}return!1}}else j0.exports=function(t){return!1};var M3=j0.exports,A3=qE,k3=WE,D3=T3,R3=M3,N3=function(t){if(t&&typeof t=="object"){if(A3(t))return"Map";if(k3(t))return"Set";if(D3(t))return"WeakMap";if(R3(t))return"WeakSet"}return!1},rI=Function.prototype.toString,of=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,W0,Tg;if(typeof of=="function"&&typeof Object.defineProperty=="function")try{W0=Object.defineProperty({},"length",{get:function(){throw Tg}}),Tg={},of(function(){throw 42},null,W0)}catch(e){e!==Tg&&(of=null)}else of=null;var O3=/^\s*class\b/,H0=function(t){try{var n=rI.call(t);return O3.test(n)}catch{return!1}},d0=function(t){try{return H0(t)?!1:(rI.call(t),!0)}catch{return!1}},Lg=Object.prototype.toString,z3="[object Object]",F3="[object Function]",B3="[object GeneratorFunction]",V3="[object HTMLAllCollection]",U3="[object HTML document.all class]",G3="[object HTMLCollection]",q3=typeof Symbol=="function"&&!!Symbol.toStringTag,j3=!(0 in[,]),Z0=function(){return!1};if(typeof document=="object"){var W3=document.all;Lg.call(W3)===Lg.call(document.all)&&(Z0=function(t){if((j3||!t)&&(typeof t>"u"||typeof t=="object"))try{var n=Lg.call(t);return(n===V3||n===U3||n===G3||n===z3)&&t("")==null}catch{}return!1})}var H3=of?function(t){if(Z0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{of(t,null,W0)}catch(n){if(n!==Tg)return!1}return!H0(t)&&d0(t)}:function(t){if(Z0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(q3)return d0(t);if(H0(t))return!1;var n=Lg.call(t);return n!==F3&&n!==B3&&!/^\[object HTML/.test(n)?!1:d0(t)},Z3=H3,X3=Object.prototype.toString,iI=Object.prototype.hasOwnProperty,Y3=function(t,n,r){for(var i=0,a=t.length;i=3&&(i=r),X3.call(t)==="[object Array]"?Y3(t,n,i):typeof t=="string"?K3(t,n,i):J3(t,n,i)},$3=Q3,t4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],m0=t4,e4=typeof globalThis>"u"?Ud:globalThis,n4=function(){for(var t=[],n=0;n"u"?Ud:globalThis,X0=r4(),Bv=Fv("String.prototype.slice"),g0=Object.getPrototypeOf,o4=Fv("Array.prototype.indexOf",!0)||function(t,n){for(var r=0;r-1?n:n!=="Object"?!1:a4(t)}return Pg?s4(t):null},u4=fa,fw=u4("ArrayBuffer.prototype.byteLength",!0),c4=JE,h4=function(t){return c4(t)?fw?fw(t):t.byteLength:NaN},sI=qM,yl=fa,pw=pA,f4=gl,mf=Tk,p4=BE,dw=Ok,mw=AE,gw=VE,yw=JE,_w=Wk,vw=Yk,bw=Jk,xw=Ev,ww=C3,Sw=N3,Ew=l4,Iw=h4,Cw=yl("SharedArrayBuffer.prototype.byteLength",!0),Tw=yl("Date.prototype.getTime"),y0=Object.getPrototypeOf,Lw=yl("Object.prototype.toString"),Kg=f4("%Set%",!0),Y0=yl("Map.prototype.has",!0),Jg=yl("Map.prototype.get",!0),Pw=yl("Map.prototype.size",!0),Qg=yl("Set.prototype.add",!0),aI=yl("Set.prototype.delete",!0),$g=yl("Set.prototype.has",!0),Mg=yl("Set.prototype.size",!0);function Mw(e,t,n,r){for(var i=mf(e),a;(a=i.next())&&!a.done;)if(Ca(t,a.value,n,r))return aI(e,a.value),!0;return!1}function lI(e){if(typeof e>"u")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}function d4(e,t,n,r,i,a){var h=lI(n);if(h!=null)return h;var u=Jg(t,h),g=sI({},i,{strict:!1});return typeof u>"u"&&!Y0(t,h)||!Ca(r,u,g,a)?!1:!Y0(e,h)&&Ca(r,u,g,a)}function m4(e,t,n){var r=lI(n);return r??($g(t,r)&&!$g(e,r))}function Aw(e,t,n,r,i,a){for(var h=mf(e),u,g;(u=h.next())&&!u.done;)if(g=u.value,Ca(n,g,i,a)&&Ca(r,Jg(t,g),i,a))return aI(e,g),!0;return!1}function Ca(e,t,n,r){var i=n||{};if(i.strict?dw(e,t):e===t)return!0;var a=ww(e),h=ww(t);if(a!==h)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return i.strict?dw(e,t):e==t;var u=r.has(e),g=r.has(t),w;if(u&&g){if(r.get(e)===r.get(t))return!0}else w={};return u||r.set(e,w),g||r.set(t,w),_4(e,t,i,r)}function kw(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function g4(e,t,n,r){if(Mg(e)!==Mg(t))return!1;for(var i=mf(e),a=mf(t),h,u,g;(h=i.next())&&!h.done;)if(h.value&&typeof h.value=="object")g||(g=new Kg),Qg(g,h.value);else if(!$g(t,h.value)){if(n.strict||!m4(e,t,h.value))return!1;g||(g=new Kg),Qg(g,h.value)}if(g){for(;(u=a.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!Mw(g,u.value,n.strict,r))return!1}else if(!n.strict&&!$g(e,u.value)&&!Mw(g,u.value,n.strict,r))return!1;return Mg(g)===0}return!0}function y4(e,t,n,r){if(Pw(e)!==Pw(t))return!1;for(var i=mf(e),a=mf(t),h,u,g,w,S,I;(h=i.next())&&!h.done;)if(w=h.value[0],S=h.value[1],w&&typeof w=="object")g||(g=new Kg),Qg(g,w);else if(I=Jg(t,w),typeof I>"u"&&!Y0(t,w)||!Ca(S,I,n,r)){if(n.strict||!d4(e,t,w,S,n,r))return!1;g||(g=new Kg),Qg(g,w)}if(g){for(;(u=a.next())&&!u.done;)if(w=u.value[0],I=u.value[1],w&&typeof w=="object"){if(!Aw(g,e,w,I,n,r))return!1}else if(!n.strict&&(!e.has(w)||!Ca(Jg(e,w),I,n,r))&&!Aw(g,e,w,I,sI({},n,{strict:!1}),r))return!1;return Mg(g)===0}return!0}function _4(e,t,n,r){var i,a;if(typeof e!=typeof t||e==null||t==null||Lw(e)!==Lw(t)||mw(e)!==mw(t))return!1;var h=gw(e),u=gw(t);if(h!==u)return!1;var g=e instanceof Error,w=t instanceof Error;if(g!==w||(g||w)&&(e.name!==t.name||e.message!==t.message))return!1;var S=vw(e),I=vw(t);if(S!==I||(S||I)&&(e.source!==t.source||pw(e)!==pw(t)))return!1;var P=_w(e),D=_w(t);if(P!==D||(P||D)&&Tw(e)!==Tw(t)||n.strict&&y0&&y0(e)!==y0(t))return!1;var N=Ew(e),G=Ew(t);if(N!==G)return!1;if(N||G){if(e.length!==t.length)return!1;for(i=0;i=0;i--)if(_t[i]!=st[i])return!1;for(i=_t.length-1;i>=0;i--)if(a=_t[i],!Ca(e[a],t[a],n,r))return!1;var ct=Sw(e),mt=Sw(t);return ct!==mt?!1:ct==="Set"||mt==="Set"?g4(e,t,n,r):ct==="Map"?y4(e,t,n,r):!0}var v4=function(t,n,r){return Ca(t,n,r,p4())};const b4=Sv(v4);var x4=Object.defineProperty,nr=(e,t)=>x4(e,"name",{value:t,configurable:!0}),w4=class{constructor(t){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=t==null?void 0:t.precision)!=null?n:17),this.direction=(r=t==null?void 0:t.direction)!=null?r:!1,this.compareProperties=(i=t==null?void 0:t.compareProperties)!=null?i:!0}compare(t,n){if(t.type!==n.type||!ld(t,n))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,n.coordinates);case"LineString":return this.compareLine(t.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(t,n);case"GeometryCollection":return this.compareGeometryCollection(t,n);case"Feature":return this.compareFeature(t,n);case"FeatureCollection":return this.compareFeatureCollection(t,n);default:if(t.type.startsWith("Multi")){const r=K0(t),i=K0(n);return r.every(a=>i.some(h=>this.compare(a,h)))}}return!1}compareCoord(t,n){return t.length===n.length&&t.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(t.slice(i,t.length),t.slice(1,i+1))),r}comparePath(t,n){return t.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(t,n){if(this.compareLine(t.coordinates[0],n.coordinates[0],1,!0)){const r=t.coordinates.slice(1,t.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(a=>i.some(h=>this.compareLine(a,h,1,!0)))}return!1}compareGeometryCollection(t,n){return ld(t.geometries,n.geometries)&&this.compareBBox(t,n)&&t.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(t,n){return t.id===n.id&&(this.compareProperties?b4(t.properties,n.properties):!0)&&this.compareBBox(t,n)&&this.compare(t.geometry,n.geometry)}compareFeatureCollection(t,n){return ld(t.features,n.features)&&this.compareBBox(t,n)&&t.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(t,n){return!t.bbox&&!n.bbox||(t.bbox&&n.bbox?this.compareCoord(t.bbox,n.bbox):!1)}};nr(w4,"GeojsonEquality");function ld(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}nr(ld,"sameLength");function K0(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}nr(K0,"explode");var Ss=63710088e-1,uI={centimeters:Ss*100,centimetres:Ss*100,degrees:360/(2*Math.PI),feet:Ss*3.28084,inches:Ss*39.37,kilometers:Ss/1e3,kilometres:Ss/1e3,meters:Ss,metres:Ss,miles:Ss/1609.344,millimeters:Ss*1e3,millimetres:Ss*1e3,nauticalmiles:Ss/1852,radians:1,yards:Ss*1.0936},Dw={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ul(e,t,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}nr(ul,"feature");function S4(e,t,n={}){switch(e){case"Point":return Fl(t).geometry;case"LineString":return Ul(t).geometry;case"Polygon":return Vv(t).geometry;case"MultiPoint":return hI(t).geometry;case"MultiLineString":return cI(t).geometry;case"MultiPolygon":return fI(t).geometry;default:throw new Error(e+" is invalid")}}nr(S4,"geometry");function Fl(e,t,n={}){if(!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(!ty(e[0])||!ty(e[1]))throw new Error("coordinates must contain numbers");return ul({type:"Point",coordinates:e},t,n)}nr(Fl,"point");function E4(e,t,n={}){return xy(e.map(r=>Fl(r,t)),n)}nr(E4,"points");function Vv(e,t,n={}){for(const i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let a=0;aVv(r,t)),n)}nr(I4,"polygons");function Ul(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return ul({type:"LineString",coordinates:e},t,n)}nr(Ul,"lineString");function C4(e,t,n={}){return xy(e.map(r=>Ul(r,t)),n)}nr(C4,"lineStrings");function xy(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}nr(xy,"featureCollection");function cI(e,t,n={}){return ul({type:"MultiLineString",coordinates:e},t,n)}nr(cI,"multiLineString");function hI(e,t,n={}){return ul({type:"MultiPoint",coordinates:e},t,n)}nr(hI,"multiPoint");function fI(e,t,n={}){return ul({type:"MultiPolygon",coordinates:e},t,n)}nr(fI,"multiPolygon");function T4(e,t,n={}){return ul({type:"GeometryCollection",geometries:e},t,n)}nr(T4,"geometryCollection");function L4(e,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,t||0);return Math.round(e*n)/n}nr(L4,"round");function pI(e,t="kilometers"){const n=uI[t];if(!n)throw new Error(t+" units is invalid");return e*n}nr(pI,"radiansToLength");function Uv(e,t="kilometers"){const n=uI[t];if(!n)throw new Error(t+" units is invalid");return e/n}nr(Uv,"lengthToRadians");function P4(e,t){return dI(Uv(e,t))}nr(P4,"lengthToDegrees");function M4(e){let t=e%360;return t<0&&(t+=360),t}nr(M4,"bearingToAzimuth");function dI(e){return e%(2*Math.PI)*180/Math.PI}nr(dI,"radiansToDegrees");function A4(e){return e%360*Math.PI/180}nr(A4,"degreesToRadians");function k4(e,t="kilometers",n="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return pI(Uv(e,t),n)}nr(k4,"convertLength");function D4(e,t="meters",n="kilometers"){if(!(e>=0))throw new Error("area must be a positive number");const r=Dw[t];if(!r)throw new Error("invalid original units");const i=Dw[n];if(!i)throw new Error("invalid final units");return e/r*i}nr(D4,"convertArea");function ty(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}nr(ty,"isNumber");function Gv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}nr(Gv,"isObject");function R4(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(t=>{if(!ty(t))throw new Error("bbox must only contain numbers")})}nr(R4,"validateBBox");function N4(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")}nr(N4,"validateId");var O4=Object.defineProperty,uo=(e,t)=>O4(e,"name",{value:t,configurable:!0});function Uf(e,t,n){if(e!==null)for(var r,i,a,h,u,g,w,S=0,I=0,P,D=e.type,N=D==="FeatureCollection",G=D==="Feature",Y=N?e.features.length:1,et=0;etg||N>w||G>S){u=I,g=r,w=N,S=G,a=0;return}var Y=Ul([u,I],n.properties);if(t(Y,r,i,G,a)===!1)return!1;a++,u=I})===!1)return!1}}})}uo(yI,"segmentEach");function q4(e,t,n){var r=n,i=!1;return yI(e,function(a,h,u,g,w){i===!1&&n===void 0?r=a:r=t(r,a,h,u,g,w),i=!0}),r}uo(q4,"segmentReduce");function _I(e,t){if(!e)throw new Error("geojson is required");wy(e,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,h=n.geometry.coordinates;switch(a){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uZ4(e,"name",{value:t,configurable:!0});function jv(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const n=[1/0,1/0,-1/0,-1/0];return Uf(e,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]1)return 1;for(var c=l,p=0;p<8;p++){var y=this.sampleCurveX(c)-l;if(Math.abs(y)y?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var N=g(P);let G,Y;function et(){return G==null&&(G=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),G}function V(){if(Y==null&&(Y=!1,et())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const y=4*p;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){Y=!0;break}}}return Y||!1}function j(l,o,c,p){const y=new N(l,o,c,p);return function(b){return y.solve(b)}}const X=j(.25,.1,.25,1);function ot(l,o,c){return Math.min(c,Math.max(o,l))}function _t(l,o,c){const p=c-o,y=((l-o)%p+p)%p+o;return y===o?c:y}function st(l,...o){for(const c of o)for(const p in c)l[p]=c[p];return l}let ct=1;function mt(l,o,c){const p={};for(const y in l)p[y]=o.call(c||this,l[y],y,l);return p}function Ct(l,o,c){const p={};for(const y in l)o.call(c||this,l[y],y,l)&&(p[y]=l[y]);return p}function H(l){return Array.isArray(l)?l.map(H):typeof l=="object"&&l?mt(l,H):l}const ft={};function Kt(l){ft[l]||(typeof console<"u"&&console.warn(l),ft[l]=!0)}function St(l,o,c){return(c.y-l.y)*(o.x-l.x)>(o.y-l.y)*(c.x-l.x)}function Zt(l){let o=0;for(let c,p,y=0,b=l.length,x=b-1;y"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(l,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),L=new Uint8ClampedArray(p*y*4);if(yield b.copyTo(L,function(A,R,O,U,W){const K=4*Math.max(-R,0),tt=(Math.max(0,O)-O)*U*4+K,at=4*U,pt=Math.max(0,R),Mt=Math.max(0,O);return{rect:{x:pt,y:Mt,width:Math.min(A.width,R+U)-pt,height:Math.min(A.height,O+W)-Mt},layout:[{offset:tt,stride:at}]}}(l,o,c,p,y)),E)for(let A=0;Aee(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,wr=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){const p=yn(l.url);if(p)return p(l,o);if(ee(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:An},o)}if(!(/^file:/.test(c=l.url)||/^file:/.test(Ar())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,y){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Ar(),signal:y.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new xr(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const L=yield E;if(y.signal.aborted)throw Cn();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(l,o);if(ee(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:An},o)}var c;return function(p,y){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const L in p.headers)E.setRequestHeader(L,p.headers[L]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!y.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let L=E.response;if(p.type==="json")try{L=JSON.parse(E.response)}catch(A){return void x(A)}b({data:L,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const L=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new xr(E.status,E.statusText,p.url,L))}},y.signal.addEventListener("abort",()=>{E.abort(),x(Cn())}),E.send(p.body)})}(l,o)};function pr(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 Qt(l,o,c){c[l]&&c[l].indexOf(o)!==-1||(c[l]=c[l]||[],c[l].push(o))}function gt(l,o,c){if(c&&c[l]){const p=c[l].indexOf(o);p!==-1&&c[l].splice(p,1)}}class Tt{constructor(o,c={}){st(this,c),this.type=o}}class Ie extends Tt{constructor(o,c={}){super("error",st({error:o},c))}}class kn{on(o,c){return this._listeners=this._listeners||{},Qt(o,c,this._listeners),this}off(o,c){return gt(o,c,this._listeners),gt(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Qt(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new Tt(o,c||{}));const p=o.type;if(this.listens(p)){o.target=this;const y=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of y)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)gt(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(st(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.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 Nt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Ye=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function kr(l,o){const c={};for(const p in l)p!=="ref"&&(c[p]=l[p]);return Ye.forEach(p=>{p in o&&(c[p]=o[p])}),c}function ln(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 xt=[Zr,ce,en,Je,Dr,Fr,Jo,J(Ke),lt,B,q];function Q(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(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 xt)if(!Q(c,o))return null}}return`Expected ${nt(l)} but found ${nt(o)} instead.`}function wt(l,o){return o.some(c=>c.kind===l.kind)}function dt(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 Pt(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const Vt=.96422,Wt=.82521,Xt=4/29,Te=6/29,ke=3*Te*Te,We=Te*Te*Te,He=Math.PI/180,bn=180/Math.PI;function Hn(l){return(l%=360)<0&&(l+=360),l}function ar([l,o,c,p]){let y,b;const x=sn((.2225045*(l=Xr(l))+.7168786*(o=Xr(o))+.0606169*(c=Xr(c)))/1);l===o&&o===c?y=b=x:(y=sn((.4360747*l+.3850649*o+.1430804*c)/Vt),b=sn((.0139322*l+.0971045*o+.7141733*c)/Wt));const E=116*x-16;return[E<0?0:E,500*(y-x),200*(x-b),p]}function Xr(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function sn(l){return l>We?Math.pow(l,1/3):l/ke+Xt}function Sr([l,o,c,p]){let y=(l+16)/116,b=isNaN(o)?y:y+o/500,x=isNaN(c)?y:y-c/200;return y=1*Ji(y),b=Vt*Ji(b),x=Wt*Ji(x),[si(3.1338561*b-1.6168667*y-.4906146*x),si(-.9787684*b+1.9161415*y+.033454*x),si(.0719453*b-.2289914*y+1.4052427*x),p]}function si(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Ji(l){return l>Te?l*l*l:ke*(l-Xt)}function co(l){return parseInt(l.padEnd(2,l),16)/255}function vi(l,o){return zs(o?l/100:l,0,1)}function zs(l,o,c){return Math.min(Math.max(o,l),c)}function tm(l){return!l.some(Number.isNaN)}const Gy={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 Vn{constructor(o,c,p,y=1,b=!0){this.r=o,this.g=c,this.b=p,this.a=y,b||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,c,p,y]))}static parse(o){if(o instanceof Vn)return o;if(typeof o!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Gy[p];if(y){const[x,E,L]=y;return[x/255,E/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,L,A,R,O,U,W,K,tt,at,pt,Mt]=x,yt=[R||" ",W||" ",at].join("");if(yt===" "||yt===" /"||yt===",,"||yt===",,,"){const Et=[A,U,tt].join(""),Yt=Et==="%%%"?100:Et===""?255:0;if(Yt){const Jt=[zs(+L/Yt,0,1),zs(+O/Yt,0,1),zs(+K/Yt,0,1),pt?vi(+pt,Mt):1];if(tm(Jt))return Jt}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,L,A,R,O,U,W,K]=b,tt=[L||" ",R||" ",U].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const at=[+E,zs(+A,0,100),zs(+O,0,100),W?vi(+W,K):1];if(tm(at))return function([pt,Mt,yt,Et]){function Yt(Jt){const be=(Jt+pt/30)%12,Ce=Mt*Math.min(yt,1-yt);return yt-Ce*Math.max(-1,Math.min(be-3,9-be,1))}return pt=Hn(pt),Mt/=100,yt/=100,[Yt(0),Yt(8),Yt(4),Et]}(at)}}}(o);return c?new Vn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:p,a:y}=this,b=y||1/0;return this.overwriteGetter("rgb",[o/b,c/b,p/b,y])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,p,y,b]=ar(o),x=Math.sqrt(p*p+y*y);return[Math.round(1e4*x)?Hn(Math.atan2(y,p)*bn):NaN,x,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ar(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,p,y]=this.rgb;return`rgba(${[o,c,p].map(b=>Math.round(255*b)).join(",")},${y})`}}Vn.black=new Vn(0,0,0,1),Vn.white=new Vn(1,1,1,1),Vn.transparent=new Vn(0,0,0,0),Vn.red=new Vn(1,0,0,1);class Jf{constructor(o,c,p){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=p,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 Qf{constructor(o,c,p,y,b){this.text=o,this.image=c,this.scale=p,this.fontStack=y,this.textColor=b}}class Ao{constructor(o){this.sections=o}static fromString(o){return new Ao([new Qf(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 Ao?o:Ao.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class ho{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof ho)return o;if(typeof o=="number")return new ho([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 ho(o)}}toString(){return JSON.stringify(this.values)}}const Xu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Qo)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?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[l,o,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[l,o,c,p]:[l,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Kc(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Vn||l instanceof Jf||l instanceof Ao||l instanceof ho||l instanceof Qo||l instanceof $o)return!0;if(Array.isArray(l)){for(const o of l)if(!Kc(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!Kc(l[o]))return!1;return!0}return!1}function Yr(l){if(l===null)return Zr;if(typeof l=="string")return en;if(typeof l=="boolean")return Je;if(typeof l=="number")return ce;if(l instanceof Vn)return Dr;if(l instanceof Jf)return ga;if(l instanceof Ao)return Fr;if(l instanceof ho)return lt;if(l instanceof Qo)return q;if(l instanceof $o)return B;if(Array.isArray(l)){const o=l.length;let c;for(const p of l){const y=Yr(p);if(c){if(c===y)continue;c=Ke;break}c=y}return J(c||Ke,o)}return Jo}function Yu(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Vn||l instanceof Ao||l instanceof ho||l instanceof Qo||l instanceof $o?l.toString():JSON.stringify(l)}class Va{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(!Kc(o[1]))return c.error("invalid value");const p=o[1];let y=Yr(p);const b=c.expectedType;return y.kind!=="array"||y.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(y=b),new Va(y,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class dr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Jc={string:en,number:ce,boolean:Je,object:Jo};class ko{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 p,y=1;const b=o[0];if(b==="array"){let E,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Jc)||A==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Jc[A],y++}else E=Ke;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);L=o[2],y++}p=J(E,L)}else{if(!Jc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Jc[b]}const x=[];for(;yo.outputDefined())}}const Qc={"to-boolean":Je,"to-color":Dr,"to-number":ce,"to-string":en};class Fs{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 p=o[0];if(!Qc[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return c.error("Expected one argument.");const y=Qc[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:ru(c[0],c[1],c[2],c[3]),!p))return new Vn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new dr(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(o);const y=ho.parse(c);if(y)return y}throw new dr(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(o);const y=Qo.parse(c);if(y)return y}throw new dr(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(o),c===null)return 0;const y=Number(c);if(!isNaN(y))return y}throw new dr(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Ao.fromString(Yu(this.args[0].evaluate(o)));case"resolvedImage":return $o.fromString(Yu(this.args[0].evaluate(o)));default:return Yu(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Ku=["Unknown","Point","LineString","Polygon"];class Un{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"?Ku[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]=Vn.parse(o)),c}}class $c{constructor(o,c,p=[],y,b=new xl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=y,this._isConstant=c}parse(o,c,p,y,b={}){return c?this.concat(c,p,y)._parse(o,b):this._parse(o,b)}_parse(o,c){function p(y,b,x){return x==="assert"?new ko(b,[y]):x==="coerce"?new Fs(b,[y]):y}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 y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[y];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,L=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||L.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(E.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(E,L))return null}else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"assert")}if(!(x instanceof Va)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new Un;try{x=new Va(x.type,x.evaluate(E))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${y}". 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,p){const y=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new $c(this.registry,this._isConstant,y,c||null,b,this.errors)}error(o,...c){const p=`${this.key}${c.map(y=>`[${y}]`).join("")}`;this.errors.push(new Ki(p,o))}checkSubtype(o,c){const p=Q(o,c);return p&&this.error(p),p}}class iu{constructor(o,c,p){this.type=ga,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const y=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Je);if(!y)return null;const b=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Je);if(!b)return null;let x=null;return p.locale&&(x=c.parse(p.locale,1,en),!x)?null:new iu(y,b,x)}evaluate(o){return new Jf(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 Ua=8192;function th(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 Ju(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function qy(l,o){const c=(180+l[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,y=Math.pow(2,o.z);return[Math.round(c*y*Ua),Math.round(p*y*Ua)]}function em(l,o,c){const p=l[0]-o[0],y=l[1]-o[1],b=l[0]-c[0],x=l[1]-c[1];return p*x-b*y==0&&p*b<=0&&y*x<=0}function eh(l,o){let c=!1;for(let x=0,E=o.length;x(p=l)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-y[0])*(p[1]-y[1])/(b[1]-y[1])+y[0]&&(c=!c)}}var p,y,b;return c}function jy(l,o){for(let c=0;c0&&E<0||x<0&&E>0}function Wy(l,o,c){for(const A of c)for(let R=0;Rc[2]){const y=.5*p;let b=l[0]-c[0]>y?-p:c[0]-l[0]>y?p:0;b===0&&(b=l[0]-c[2]>y?-p:c[2]-l[0]>y?p:0),l[0]+=b}th(o,l)}function rh(l,o,c,p){const y=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const E of l)for(const L of E){const A=[L.x+b[0],L.y+b[1]];sm(A,o,c,y),x.push(A)}return x}function am(l,o,c,p){const y=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const L of l){const A=[];for(const R of L){const O=[R.x+b[0],R.y+b[1]];th(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=y/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const L of x)for(const A of L)sm(A,o,c,y)}var E;return x}class wl{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(Kc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const y=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&y.push(E),x==="MultiPolygon"&&y.push(...E)}if(y.length)return new wl(p,{type:"MultiPolygon",coordinates:y})}else if(p.type==="Feature"){const y=p.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new wl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new wl(p,p)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(c,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=nh(p.coordinates,b,x),L=rh(c.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!eh(A,E))return!1}if(p.type==="MultiPolygon"){const E=om(p.coordinates,b,x),L=rh(c.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!jy(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(c,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=nh(p.coordinates,b,x),L=am(c.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!rm(A,E))return!1}if(p.type==="MultiPolygon"){const E=om(p.coordinates,b,x),L=am(c.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!im(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ih{constructor(o,c){this.type=c.type,this.name=o,this.boundExpression=c}static parse(o,c){if(o.length!==2||typeof o[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const p=o[1];return c.scope.has(p)?new ih(p,c.scope.get(p)):c.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Do{constructor(o,c,p,y){this.name=o,this.type=c,this._evaluate=p,this.args=y}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,c){const p=o[0],y=Do.definitions[p];if(!y)return c.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(y)?y[0]:y.type,x=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,R]of E){L=new $c(c.registry,Qu,c.path,null,c.scope);const O=[];let U=!1;for(let W=1;W{return U=O,Array.isArray(U)?`(${U.map(nt).join(", ")})`:`(${nt(U.type)}...)`;var U}).join(" | "),R=[];for(let O=1;O{c=o?c&&Qu(p):c&&p instanceof Va}),!!c&&oh(l)&&tc(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function oh(l){if(l instanceof Do&&(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 wl)return!1;let o=!0;return l.eachChild(c=>{o&&!oh(c)&&(o=!1)}),o}function $u(l){if(l instanceof Do&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(c=>{o&&!$u(c)&&(o=!1)}),o}function tc(l,o){if(l instanceof Do&&o.indexOf(l.name)>=0)return!1;let c=!0;return l.eachChild(p=>{c&&!tc(p,o)&&(c=!1)}),c}function ec(l,o){const c=l.length-1;let p,y,b=0,x=c,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=l[E],y=l[E+1],p<=o){if(E===c||oo))throw new dr("Input is not a number.");x=E-1}return 0}class nc{constructor(o,c,p){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[y,b]of p)this.labels.push(y),this.outputs.push(b)}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 p=c.parse(o[1],1,ce);if(!p)return null;const y=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let x=1;x=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=c.parse(L,R,b);if(!O)return null;b=b||O.type,y.push([E,O])}return new nc(b,p,y)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=c[0])return p[0].evaluate(o);const b=c.length;return y>=c[b-1]?p[b-1].evaluate(o):p[ec(c,y)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Hy(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Zy=lm;function lm(l,o,c,p){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*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=p}lm.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,p=0;p<8;p++){var y=this.sampleCurveX(c)-l;if(Math.abs(y)y?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Xy=Hy(Zy);function Sl(l,o,c){return l+c*(o-l)}function sh(l,o,c){return l.map((p,y)=>Sl(p,o[y],c))}const Qi={number:Sl,color:function(l,o,c,p="rgb"){switch(p){case"rgb":{const[y,b,x,E]=sh(l.rgb,o.rgb,c);return new Vn(y,b,x,E,!1)}case"hcl":{const[y,b,x,E]=l.hcl,[L,A,R,O]=o.hcl;let U,W;if(isNaN(y)||isNaN(L))isNaN(y)?isNaN(L)?U=NaN:(U=L,x!==1&&x!==0||(W=A)):(U=y,R!==1&&R!==0||(W=b));else{let Mt=L-y;L>y&&Mt>180?Mt-=360:L180&&(Mt+=360),U=y+c*Mt}const[K,tt,at,pt]=function([Mt,yt,Et,Yt]){return Mt=isNaN(Mt)?0:Mt*He,Sr([Et,Math.cos(Mt)*yt,Math.sin(Mt)*yt,Yt])}([U,W??Sl(b,A,c),Sl(x,R,c),Sl(E,O,c)]);return new Vn(K,tt,at,pt,!1)}case"lab":{const[y,b,x,E]=Sr(sh(l.lab,o.lab,c));return new Vn(y,b,x,E,!1)}}},array:sh,padding:function(l,o,c){return new ho(sh(l.values,o.values,c))},variableAnchorOffsetCollection:function(l,o,c){const p=l.values,y=o.values;if(p.length!==y.length)throw new dr(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof R!="number"||R<0||R>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:A}}}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(b=c.parse(b,2,ce),!b)return null;const E=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Dr:c.expectedType&&c.expectedType.kind!=="value"&&(L=c.expectedType);for(let A=0;A=R)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const K=c.parse(O,W,L);if(!K)return null;L=L||K.type,E.push([R,K])}return Pt(L,ce)||Pt(L,Dr)||Pt(L,lt)||Pt(L,q)||Pt(L,J(ce))?new Oi(L,p,y,b,E):c.error(`Type ${nt(L)} is not interpolatable.`)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=c[0])return p[0].evaluate(o);const b=c.length;if(y>=c[b-1])return p[b-1].evaluate(o);const x=ec(c,y),E=Oi.interpolationFactor(this.interpolation,y,c[x],c[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return Qi[this.type.kind](L,A,E);case"interpolate-hcl":return Qi.color(L,A,E,"hcl");case"interpolate-lab":return Qi.color(L,A,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Dn(l,o,c,p){const y=p-c,b=l-c;return y===0?0:o===1?b/y:(Math.pow(o,b)-1)/(Math.pow(o,y)-1)}class ah{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 p=null;const y=c.expectedType;y&&y.kind!=="value"&&(p=y);const b=[];for(const E of o.slice(1)){const L=c.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=y&&b.some(E=>Q(y,E.type));return new ah(x?Ke:p,b)}evaluate(o){let c,p=null,y=0;for(const b of this.args)if(y++,p=b.evaluate(o),p&&p instanceof $o&&!p.available&&(c||(c=p.name),p=null,y===this.args.length&&(p=c)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class lh{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 p=[];for(let b=1;b=p.length)throw new dr(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new dr(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class tp{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 p=c.parse(o[1],1,Ke),y=c.parse(o[2],2,Ke);return p&&y?wt(p.type,[Je,en,ce,Zr,Ke])?new tp(p,y):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(p.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!dt(c,["boolean","string","number","null"]))throw new dr(`Expected first argument to be of type boolean, string, number or null, but found ${nt(Yr(c))} instead.`);if(!dt(p,["string","array"]))throw new dr(`Expected second argument to be of type array or string, but found ${nt(Yr(p))} instead.`);return p.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class uh{constructor(o,c,p){this.type=ce,this.needle=o,this.haystack=c,this.fromIndex=p}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 p=c.parse(o[1],1,Ke),y=c.parse(o[2],2,Ke);if(!p||!y)return null;if(!wt(p.type,[Je,en,ce,Zr,Ke]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,ce);return b?new uh(p,y,b):null}return new uh(p,y)}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!dt(c,["boolean","string","number","null"]))throw new dr(`Expected first argument to be of type boolean, string, number or null, but found ${nt(Yr(c))} instead.`);if(!dt(p,["string","array"]))throw new dr(`Expected second argument to be of type array or string, but found ${nt(Yr(p))} instead.`);if(this.fromIndex){const y=this.fromIndex.evaluate(o);return p.indexOf(c,y)}return p.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class ep{constructor(o,c,p,y,b,x){this.inputType=o,this.type=c,this.input=p,this.cases=y,this.outputs=b,this.otherwise=x}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 p,y;c.expectedType&&c.expectedType.kind!=="value"&&(y=c.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return U.error("Numeric branch labels must be integer values.");if(p){if(U.checkSubtype(p,Yr(K)))return null}else p=Yr(K);if(b[String(K)]!==void 0)return U.error("Branch labels must be unique.");b[String(K)]=x.length}const W=c.parse(O,A,y);if(!W)return null;y=y||W.type,x.push(W)}const E=c.parse(o[1],1,Ke);if(!E)return null;const L=c.parse(o[o.length-1],o.length-1,y);return L?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new ep(p,y,E,b,x,L):null}evaluate(o){const c=this.input.evaluate(o);return(Yr(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 np{constructor(o,c,p){this.type=o,this.branches=c,this.otherwise=p}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 p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const y=[];for(let x=1;xc.outputDefined())&&this.otherwise.outputDefined()}}class ch{constructor(o,c,p,y){this.type=o,this.input=c,this.beginIndex=p,this.endIndex=y}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 p=c.parse(o[1],1,Ke),y=c.parse(o[2],2,ce);if(!p||!y)return null;if(!wt(p.type,[J(Ke),en,Ke]))return c.error(`Expected first argument to be of type array or string, but found ${nt(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,ce);return b?new ch(p.type,p,y,b):null}return new ch(p.type,p,y)}evaluate(o){const c=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!dt(c,["string","array"]))throw new dr(`Expected first argument to be of type array or string, but found ${nt(Yr(c))} instead.`);if(this.endIndex){const y=this.endIndex.evaluate(o);return c.slice(p,y)}return c.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function um(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 cm(l,o,c,p){return p.compare(o,c)===0}function ou(l,o,c){const p=l!=="=="&&l!=="!=";return class bI{constructor(b,x,E){this.type=Je,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let L=x.parse(b[1],1,Ke);if(!L)return null;if(!um(E,L.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${nt(L.type)}'.`);let A=x.parse(b[2],2,Ke);if(!A)return null;if(!um(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${nt(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${nt(L.type)}' and '${nt(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new ko(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new ko(L.type,[A])));let R=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(R=x.parse(b[3],3,ga),!R)return null}return new bI(L,A,R)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=Yr(x),A=Yr(E);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new dr(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=Yr(x),A=Yr(E);if(L.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?c(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Yy=ou("==",function(l,o,c){return o===c},cm),Ky=ou("!=",function(l,o,c){return o!==c},function(l,o,c,p){return!cm(0,o,c,p)}),Jy=ou("<",function(l,o,c){return o",function(l,o,c){return o>c},function(l,o,c,p){return p.compare(o,c)>0}),$y=ou("<=",function(l,o,c){return o<=c},function(l,o,c,p){return p.compare(o,c)<=0}),t_=ou(">=",function(l,o,c){return o>=c},function(l,o,c,p){return p.compare(o,c)>=0});class rp{constructor(o,c,p,y,b){this.type=en,this.number=o,this.locale=c,this.currency=p,this.minFractionDigits=y,this.maxFractionDigits=b}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ce);if(!p)return null;const y=o[2];if(typeof y!="object"||Array.isArray(y))return c.error("NumberFormat options argument must be an object.");let b=null;if(y.locale&&(b=c.parse(y.locale,1,en),!b))return null;let x=null;if(y.currency&&(x=c.parse(y.currency,1,en),!x))return null;let E=null;if(y["min-fraction-digits"]&&(E=c.parse(y["min-fraction-digits"],1,ce),!E))return null;let L=null;return y["max-fraction-digits"]&&(L=c.parse(y["max-fraction-digits"],1,ce),!L)?null:new rp(p,b,x,E,L)}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 hh{constructor(o){this.type=Fr,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const y=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let L=null;if(E["font-scale"]&&(L=c.parse(E["font-scale"],1,ce),!L))return null;let A=null;if(E["text-font"]&&(A=c.parse(E["text-font"],1,J(en)),!A))return null;let R=null;if(E["text-color"]&&(R=c.parse(E["text-color"],1,Dr),!R))return null;const O=y[y.length-1];O.scale=L,O.font=A,O.textColor=R}else{const L=c.parse(o[x],1,Ke);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,y.push({content:L,scale:null,font:null,textColor:null})}}return new hh(y)}evaluate(o){return new Ao(this.sections.map(c=>{const p=c.content.evaluate(o);return Yr(p)===B?new Qf("",p,null,null,null):new Qf(Yu(p),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 ip{constructor(o){this.type=B,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const p=c.parse(o[1],1,en);return p?new ip(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=$o.fromString(c);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(c)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class op{constructor(o){this.type=ce,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=c.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${nt(p.type)} instead.`):new op(p):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new dr(`Expected value to be of type string or array, but found ${nt(Yr(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const su={"==":Yy,"!=":Ky,">":Qy,"<":Jy,">=":t_,"<=":$y,array:ko,at:$f,boolean:ko,case:np,coalesce:ah,collator:iu,format:hh,image:ip,in:tp,"index-of":uh,interpolate:Oi,"interpolate-hcl":Oi,"interpolate-lab":Oi,length:op,let:lh,literal:Va,match:ep,number:ko,"number-format":rp,object:ko,slice:ch,step:nc,string:ko,"to-boolean":Fs,"to-color":Fs,"to-number":Fs,"to-string":Fs,var:ih,within:wl};function hm(l,[o,c,p,y]){o=o.evaluate(l),c=c.evaluate(l),p=p.evaluate(l);const b=y?y.evaluate(l):1,x=ru(o,c,p,b);if(x)throw new dr(x);return new Vn(o/255,c/255,p/255,b,!1)}function fm(l,o){return l in o}function sp(l,o){const c=o[l];return c===void 0?null:c}function El(l){return{type:l}}function pm(l){return{result:"success",value:l}}function au(l){return{result:"error",value:l}}function lu(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function dm(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function ap(l){return!!l.expression&&l.expression.interpolated}function In(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function fh(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function e_(l){return l}function mm(l,o){const c=o.type==="color",p=l.stops&&typeof l.stops[0][0]=="object",y=p||!(p||l.property!==void 0),b=l.type||(ap(o)?"exponential":"interval");if(c||o.type==="padding"){const R=c?Vn.parse:ho.parse;(l=Ko({},l)).stops&&(l.stops=l.stops.map(O=>[O[0],R(O[1])])),l.default=R(l.default?l.default:o.default)}if(l.colorSpace&&(x=l.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var x;let E,L,A;if(b==="exponential")E=xn;else if(b==="interval")E=n_;else if(b==="categorical"){E=Br,L=Object.create(null);for(const R of l.stops)L[R[0]]=R[1];A=typeof l.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=lp}if(p){const R={},O=[];for(let K=0;KK[0]),evaluate:({zoom:K},tt)=>xn({stops:U,base:l.base},o,K).evaluate(K,tt)}}if(y){const R=b==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:Oi.interpolationFactor.bind(void 0,R),zoomStops:l.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(l,o,O,L,A)}}return{kind:"source",evaluate(R,O){const U=O&&O.properties?O.properties[l.property]:void 0;return U===void 0?rc(l.default,o.default):E(l,o,U,L,A)}}}function rc(l,o,c){return l!==void 0?l:o!==void 0?o:c!==void 0?c:void 0}function Br(l,o,c,p,y){return rc(typeof c===y?p[c]:void 0,l.default,o.default)}function n_(l,o,c){if(In(c)!=="number")return rc(l.default,o.default);const p=l.stops.length;if(p===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[p-1][0])return l.stops[p-1][1];const y=ec(l.stops.map(b=>b[0]),c);return l.stops[y][1]}function xn(l,o,c){const p=l.base!==void 0?l.base:1;if(In(c)!=="number")return rc(l.default,o.default);const y=l.stops.length;if(y===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[y-1][0])return l.stops[y-1][1];const b=ec(l.stops.map(R=>R[0]),c),x=function(R,O,U,W){const K=W-U,tt=R-U;return K===0?0:O===1?tt/K:(Math.pow(O,tt)-1)/(Math.pow(O,K)-1)}(c,p,l.stops[b][0],l.stops[b+1][0]),E=l.stops[b][1],L=l.stops[b+1][1],A=Qi[o.type]||e_;return typeof E.evaluate=="function"?{evaluate(...R){const O=E.evaluate.apply(void 0,R),U=L.evaluate.apply(void 0,R);if(O!==void 0&&U!==void 0)return A(O,U,x,l.colorSpace)}}:A(E,L,x,l.colorSpace)}function lp(l,o,c){switch(o.type){case"color":c=Vn.parse(c);break;case"formatted":c=Ao.fromString(c.toString());break;case"resolvedImage":c=$o.fromString(c.toString());break;case"padding":c=ho.parse(c);break;default:In(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return rc(c,l.default,o.default)}Do.register(su,{error:[{kind:"error"},[en],(l,[o])=>{throw new dr(o.evaluate(l))}],typeof:[en,[Ke],(l,[o])=>nt(Yr(o.evaluate(l)))],"to-rgba":[J(ce,4),[Dr],(l,[o])=>{const[c,p,y,b]=o.evaluate(l).rgb;return[255*c,255*p,255*y,b]}],rgb:[Dr,[ce,ce,ce],hm],rgba:[Dr,[ce,ce,ce,ce],hm],has:{type:Je,overloads:[[[en],(l,[o])=>fm(o.evaluate(l),l.properties())],[[en,Jo],(l,[o,c])=>fm(o.evaluate(l),c.evaluate(l))]]},get:{type:Ke,overloads:[[[en],(l,[o])=>sp(o.evaluate(l),l.properties())],[[en,Jo],(l,[o,c])=>sp(o.evaluate(l),c.evaluate(l))]]},"feature-state":[Ke,[en],(l,[o])=>sp(o.evaluate(l),l.featureState||{})],properties:[Jo,[],l=>l.properties()],"geometry-type":[en,[],l=>l.geometryType()],id:[Ke,[],l=>l.id()],zoom:[ce,[],l=>l.globals.zoom],"heatmap-density":[ce,[],l=>l.globals.heatmapDensity||0],"line-progress":[ce,[],l=>l.globals.lineProgress||0],accumulated:[Ke,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[ce,El(ce),(l,o)=>{let c=0;for(const p of o)c+=p.evaluate(l);return c}],"*":[ce,El(ce),(l,o)=>{let c=1;for(const p of o)c*=p.evaluate(l);return c}],"-":{type:ce,overloads:[[[ce,ce],(l,[o,c])=>o.evaluate(l)-c.evaluate(l)],[[ce],(l,[o])=>-o.evaluate(l)]]},"/":[ce,[ce,ce],(l,[o,c])=>o.evaluate(l)/c.evaluate(l)],"%":[ce,[ce,ce],(l,[o,c])=>o.evaluate(l)%c.evaluate(l)],ln2:[ce,[],()=>Math.LN2],pi:[ce,[],()=>Math.PI],e:[ce,[],()=>Math.E],"^":[ce,[ce,ce],(l,[o,c])=>Math.pow(o.evaluate(l),c.evaluate(l))],sqrt:[ce,[ce],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[ce,[ce],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[ce,[ce],(l,[o])=>Math.log(o.evaluate(l))],log2:[ce,[ce],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[ce,[ce],(l,[o])=>Math.sin(o.evaluate(l))],cos:[ce,[ce],(l,[o])=>Math.cos(o.evaluate(l))],tan:[ce,[ce],(l,[o])=>Math.tan(o.evaluate(l))],asin:[ce,[ce],(l,[o])=>Math.asin(o.evaluate(l))],acos:[ce,[ce],(l,[o])=>Math.acos(o.evaluate(l))],atan:[ce,[ce],(l,[o])=>Math.atan(o.evaluate(l))],min:[ce,El(ce),(l,o)=>Math.min(...o.map(c=>c.evaluate(l)))],max:[ce,El(ce),(l,o)=>Math.max(...o.map(c=>c.evaluate(l)))],abs:[ce,[ce],(l,[o])=>Math.abs(o.evaluate(l))],round:[ce,[ce],(l,[o])=>{const c=o.evaluate(l);return c<0?-Math.round(-c):Math.round(c)}],floor:[ce,[ce],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[ce,[ce],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Je,[en,Ke],(l,[o,c])=>l.properties()[o.value]===c.value],"filter-id-==":[Je,[Ke],(l,[o])=>l.id()===o.value],"filter-type-==":[Je,[en],(l,[o])=>l.geometryType()===o.value],"filter-<":[Je,[en,Ke],(l,[o,c])=>{const p=l.properties()[o.value],y=c.value;return typeof p==typeof y&&p{const c=l.id(),p=o.value;return typeof c==typeof p&&c":[Je,[en,Ke],(l,[o,c])=>{const p=l.properties()[o.value],y=c.value;return typeof p==typeof y&&p>y}],"filter-id->":[Je,[Ke],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Je,[en,Ke],(l,[o,c])=>{const p=l.properties()[o.value],y=c.value;return typeof p==typeof y&&p<=y}],"filter-id-<=":[Je,[Ke],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Je,[en,Ke],(l,[o,c])=>{const p=l.properties()[o.value],y=c.value;return typeof p==typeof y&&p>=y}],"filter-id->=":[Je,[Ke],(l,[o])=>{const c=l.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Je,[Ke],(l,[o])=>o.value in l.properties()],"filter-has-id":[Je,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Je,[J(en)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Je,[J(Ke)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Je,[en,J(Ke)],(l,[o,c])=>c.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Je,[en,J(Ke)],(l,[o,c])=>function(p,y,b,x){for(;b<=x;){const E=b+x>>1;if(y[E]===p)return!0;y[E]>p?x=E-1:b=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,[en],(l,[o])=>{const c=l.globals&&l.globals.isSupportedScript;return!c||c(o.evaluate(l))}],upcase:[en,[en],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[en,[en],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[en,El(Ke),(l,o)=>o.map(c=>Yu(c.evaluate(l))).join("")],"resolved-locale":[en,[ga],(l,[o])=>o.evaluate(l).resolvedLocale()]});class rr{constructor(o,c){var p;this.expression=o,this._warningHistory={},this._evaluator=new Un,this._defaultValue=c?(p=c).type==="color"&&fh(p.default)?new Vn(0,0,0,0):p.type==="color"?Vn.parse(p.default)||null:p.type==="padding"?ho.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Qo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,p,y,b,x){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,c,p,y,b,x){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||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 dr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).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 Qn(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in su}function Il(l,o){const c=new $c(su,Qu,[],o?function(y){const b={color:Dr,string:en,number:ce,enum:en,boolean:Je,formatted:Fr,padding:lt,resolvedImage:B,variableAnchorOffsetCollection:q};return y.type==="array"?J(b[y.value]||Ke,y.length):b[y.type]}(o):void 0),p=c.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?pm(new rr(p,o)):au(c.errors)}class ph{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!$u(c.expression)}evaluateWithoutErrorHandling(o,c,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,y,b,x)}evaluate(o,c,p,y,b,x){return this._styleExpression.evaluate(o,c,p,y,b,x)}}class up{constructor(o,c,p,y){this.kind=o,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!$u(c.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,c,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,y,b,x)}evaluate(o,c,p,y,b,x){return this._styleExpression.evaluate(o,c,p,y,b,x)}interpolationFactor(o,c,p){return this.interpolationType?Oi.interpolationFactor(this.interpolationType,o,c,p):0}}function gm(l,o){const c=Il(l,o);if(c.result==="error")return c;const p=c.value.expression,y=oh(p);if(!y&&!lu(o))return au([new Ki("","data expressions not supported")]);const b=tc(p,["zoom"]);if(!b&&!dm(o))return au([new Ki("","zoom expressions not supported")]);const x=mh(p);return x||b?x instanceof Ki?au([x]):x instanceof Oi&&!ap(o)?au([new Ki("",'"interpolate" expressions cannot be used with this property')]):pm(x?new up(y?"camera":"composite",c.value,x.labels,x instanceof Oi?x.interpolation:void 0):new ph(y?"constant":"source",c.value)):au([new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class dh{constructor(o,c){this._parameters=o,this._specification=c,Ko(this,mm(this._parameters,this._specification))}static deserialize(o){return new dh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function mh(l){let o=null;if(l instanceof lh)o=mh(l.result);else if(l instanceof ah){for(const c of l.args)if(o=mh(c),o)break}else(l instanceof nc||l instanceof Oi)&&l.input instanceof Do&&l.input.name==="zoom"&&(o=l);return o instanceof Ki||l.eachChild(c=>{const p=mh(c);p instanceof Ki?o=p:!o&&p?o=new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Ki("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function gh(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(!gh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const ym={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yh(l){if(l==null)return{filter:()=>!0,needGeometry:!1};gh(l)||(l=vh(l));const o=Il(l,ym);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,y)=>o.value.evaluate(c,p,{},y),needGeometry:_h(l)}}function _m(l,o){return lo?1:0}function _h(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?cp(l[1],l[2],o):o==="any"?(c=l.slice(1),["any"].concat(c.map(vh))):o==="all"?["all"].concat(l.slice(1).map(vh)):o==="none"?["all"].concat(l.slice(1).map(vh).map(bh)):o==="in"?vm(l[1],l.slice(2)):o==="!in"?bh(vm(l[1],l.slice(2))):o==="has"?bm(l[1]):o==="!has"?bh(bm(l[1])):o!=="within"||l;var c}function cp(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 vm(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(_m)]]:["filter-in-small",l,["literal",o]]}}function bm(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function bh(l){return["!",l]}function hp(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let y="[";for(const b of l)y+=`${hp(b)},`;return`${y}]`}const c=Object.keys(l).sort();let p="{";for(let y=0;yp.maximum?[new re(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function wm(l){const o=l.valueSpec,c=Er(l.value.type);let p,y,b,x={};const E=c!=="categorical"&&l.value.property===void 0,L=!E,A=In(l.value.stops)==="array"&&In(l.value.stops[0])==="array"&&In(l.value.stops[0][0])==="object",R=$i({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 re(W.key,W.value,'identity function may not have a "stops" property')];let K=[];const tt=W.value;return K=K.concat(fp({key:W.key,value:tt,valueSpec:W.valueSpec,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:O})),In(tt)==="array"&&tt.length===0&&K.push(new re(W.key,tt,"array must have at least one stop")),K},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&&R.push(new re(l.key,l.value,'missing required property "property"')),c==="identity"||l.value.stops||R.push(new re(l.key,l.value,'missing required property "stops"')),c==="exponential"&&l.valueSpec.expression&&!ap(l.valueSpec)&&R.push(new re(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(L&&!lu(l.valueSpec)?R.push(new re(l.key,l.value,"property functions not supported")):E&&!dm(l.valueSpec)&&R.push(new re(l.key,l.value,"zoom functions not supported"))),c!=="categorical"&&!A||l.value.property!==void 0||R.push(new re(l.key,l.value,'"property" property is required')),R;function O(W){let K=[];const tt=W.value,at=W.key;if(In(tt)!=="array")return[new re(at,tt,`array expected, ${In(tt)} found`)];if(tt.length!==2)return[new re(at,tt,`array length 2 expected, length ${tt.length} found`)];if(A){if(In(tt[0])!=="object")return[new re(at,tt,`object expected, ${In(tt[0])} found`)];if(tt[0].zoom===void 0)return[new re(at,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new re(at,tt,"object stop key must have value")];if(b&&b>Er(tt[0].zoom))return[new re(at,tt[0].zoom,"stop zoom values must appear in ascending order")];Er(tt[0].zoom)!==b&&(b=Er(tt[0].zoom),y=void 0,x={}),K=K.concat($i({key:`${at}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{zoom:xh,value:U}}))}else K=K.concat(U({key:`${at}[0]`,value:tt[0],valueSpec:{},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec},tt));return Qn(Ga(tt[1]))?K.concat([new re(`${at}[1]`,tt[1],"expressions are not allowed in function stops.")]):K.concat(W.validateSpec({key:`${at}[1]`,value:tt[1],valueSpec:o,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec}))}function U(W,K){const tt=In(W.value),at=Er(W.value),pt=W.value!==null?W.value:K;if(p){if(tt!==p)return[new re(W.key,pt,`${tt} stop domain type must match previous stop domain type ${p}`)]}else p=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new re(W.key,pt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let Mt=`number expected, ${tt} found`;return lu(o)&&c===void 0&&(Mt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new re(W.key,pt,Mt)]}return c!=="categorical"||tt!=="number"||isFinite(at)&&Math.floor(at)===at?c!=="categorical"&&tt==="number"&&y!==void 0&&atnew re(`${l.key}${p.key}`,l.value,p.message));const c=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!c.outputDefined())return[new re(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"&&!$u(c))return[new re(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!$u(c))return[new re(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!tc(c,["zoom","feature-state"]))return[new re(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!oh(c))return[new re(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ja(l){const o=l.key,c=l.value,p=l.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(Er(c))===-1&&y.push(new re(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(Er(c))===-1&&y.push(new re(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),y}function uu(l){return gh(Ga(l.value))?qa(Ko({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):pp(l)}function pp(l){const o=l.value,c=l.key;if(In(o)!=="array")return[new re(c,o,`array expected, ${In(o)} found`)];const p=l.styleSpec;let y,b=[];if(o.length<1)return[new re(c,o,"filter array must have at least 1 element")];switch(b=b.concat(ja({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:l.style,styleSpec:l.styleSpec})),Er(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Er(o[1])==="$type"&&b.push(new re(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new re(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(y=In(o[1]),y!=="string"&&b.push(new re(`${c}[1]`,o[1],`string expected, ${y} found`)));for(let x=2;x{A in c&&o.push(new re(p,c[A],`"${A}" is prohibited for ref layers`))}),y.layers.forEach(A=>{Er(A.id)===E&&(L=A)}),L?L.ref?o.push(new re(p,c.ref,"ref cannot reference another ref layer")):x=Er(L.type):o.push(new re(p,c.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(c.source){const L=y.sources&&y.sources[c.source],A=L&&Er(L.type);L?A==="vector"&&x==="raster"?o.push(new re(p,c.source,`layer "${c.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new re(p,c.source,`layer "${c.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new re(p,c.source,`layer "${c.id}" requires a vector source`)):A!=="vector"||c["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new re(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||o.push(new re(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new re(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new re(p,c.source,`source "${c.source}" not found`))}else o.push(new re(p,c,'missing required property "source"'));return o=o.concat($i({key:p,value:c,valueSpec:b.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${p}.type`,value:c.type,valueSpec:b.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:c,objectKey:"type"}),filter:uu,layout:L=>$i({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>mp(Ko({layerType:x},A))}}),paint:L=>$i({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>dp(Ko({layerType:x},A))}})}})),o}function Cl(l){const o=l.value,c=l.key,p=In(o);return p!=="string"?[new re(c,o,`string expected, ${p} found`)]:[]}const Sm={promoteId:function({key:l,value:o}){if(In(o)==="string")return Cl({key:l,value:o});{const c=[];for(const p in o)c.push(...Cl({key:`${l}.${p}`,value:o[p]}));return c}}};function Em(l){const o=l.value,c=l.key,p=l.styleSpec,y=l.style,b=l.validateSpec;if(!o.type)return[new re(c,o,'"type" is required')];const x=Er(o.type);let E;switch(x){case"vector":case"raster":return E=$i({key:c,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:l.style,styleSpec:p,objectElementValidators:Sm,validateSpec:b}),E;case"raster-dem":return E=function(L){var A;const R=(A=L.sourceName)!==null&&A!==void 0?A:"",O=L.value,U=L.styleSpec,W=U.source_raster_dem,K=L.style;let tt=[];const at=In(O);if(O===void 0)return tt;if(at!=="object")return tt.push(new re("source_raster_dem",O,`object expected, ${at} found`)),tt;const pt=Er(O.encoding)==="custom",Mt=["redFactor","greenFactor","blueFactor","baseShift"],yt=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const Et in O)!pt&&Mt.includes(Et)?tt.push(new re(Et,O[Et],`In "${R}": "${Et}" is only valid when "encoding" is set to "custom". ${yt} encoding found`)):W[Et]?tt=tt.concat(L.validateSpec({key:Et,value:O[Et],valueSpec:W[Et],validateSpec:L.validateSpec,style:K,styleSpec:U})):tt.push(new re(Et,O[Et],`unknown property "${Et}"`));return tt}({sourceName:c,value:o,style:l.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=$i({key:c,value:o,valueSpec:p.source_geojson,style:y,styleSpec:p,validateSpec:b,objectElementValidators:Sm}),o.cluster)for(const L in o.clusterProperties){const[A,R]=o.clusterProperties[L],O=typeof A=="string"?[A,["accumulated"],["get",L]]:A;E.push(...qa({key:`${c}.${L}.map`,value:R,validateSpec:b,expressionContext:"cluster-map"})),E.push(...qa({key:`${c}.${L}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return $i({key:c,value:o,valueSpec:p.source_video,style:y,validateSpec:b,styleSpec:p});case"image":return $i({key:c,value:o,valueSpec:p.source_image,style:y,validateSpec:b,styleSpec:p});case"canvas":return[new re(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ja({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:b,styleSpec:p})}}function Im(l){const o=l.value,c=l.styleSpec,p=c.light,y=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new re("light",o,`object expected, ${x} found`)]),b;for(const E in o){const L=E.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?l.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:l.validateSpec,style:y,styleSpec:c}):p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:y,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)])}return b}function Cm(l){const o=l.value,c=l.styleSpec,p=c.sky,y=l.style,b=In(o);if(o===void 0)return[];if(b!=="object")return[new re("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Bs({key:E,value:o[E],valueSpec:p[E],style:y,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)]);return x}function oc(l){const o=l.value,c=l.styleSpec,p=c.terrain,y=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new re("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:y,styleSpec:c}):[new re(E,o[E],`unknown property "${E}"`)]);return b}function sc(l){let o=[];const c=l.value,p=l.key;if(Array.isArray(c)){const y=[],b=[];for(const x in c)c[x].id&&y.includes(c[x].id)&&o.push(new re(p,c,`all the sprites' ids must be unique, but ${c[x].id} is duplicated`)),y.push(c[x].id),c[x].url&&b.includes(c[x].url)&&o.push(new re(p,c,`all the sprites' URLs must be unique, but ${c[x].url} is duplicated`)),b.push(c[x].url),o=o.concat($i({key:`${p}[${x}]`,value:c[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return Cl({key:p,value:c})}const fo={"*":()=>[],array:fp,boolean:function(l){const o=l.value,c=l.key,p=In(o);return p!=="boolean"?[new re(c,o,`boolean expected, ${p} found`)]:[]},number:xh,color:function(l){const o=l.key,c=l.value,p=In(c);return p!=="string"?[new re(o,c,`color expected, ${p} found`)]:Vn.parse(String(c))?[]:[new re(o,c,`color expected, "${c}" found`)]},constants:xm,enum:ja,filter:uu,function:wm,layer:ic,object:$i,source:Em,light:Im,sky:Cm,terrain:oc,string:Cl,formatted:function(l){return Cl(l).length===0?[]:qa(l)},resolvedImage:function(l){return Cl(l).length===0?[]:qa(l)},padding:function(l){const o=l.key,c=l.value;if(In(c)==="array"){if(c.length<1||c.length>4)return[new re(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let y=[];for(let b=0;b[]}})),l.constants&&(c=c.concat(xm({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Bs}))),cu(c)}function Vs(l){return function(o){return l({...o,validateSpec:Bs})}}function cu(l){return[].concat(l).sort((o,c)=>o.line-c.line)}function gs(l){return function(...o){return cu(l.apply(this,o))}}ms.source=gs(Vs(Em)),ms.sprite=gs(Vs(sc)),ms.glyphs=gs(Vs(gp)),ms.light=gs(Vs(Im)),ms.sky=gs(Vs(Cm)),ms.terrain=gs(Vs(oc)),ms.layer=gs(Vs(ic)),ms.filter=gs(Vs(uu)),ms.paintProperty=gs(Vs(dp)),ms.layoutProperty=gs(Vs(mp));const Tl=ms,i_=Tl.light,yp=Tl.paintProperty,o_=Tl.layoutProperty;function hu(l,o){let c=!1;if(o&&o.length)for(const p of o)l.fire(new Ie(new Error(p.message))),c=!0;return c}class ac{constructor(o,c,p){const y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(c=x[1])+2*(p=x[2]);for(let L=0;L=O[K+0]&&y>=O[K+1])?(E[W]=!0,x.push(R[W])):E[W]=!1}}}}_forEachCell(o,c,p,y,b,x,E,L){const A=this._convertToCellCoord(o),R=this._convertToCellCoord(c),O=this._convertToCellCoord(p),U=this._convertToCellCoord(y);for(let W=A;W<=O;W++)for(let K=R;K<=U;K++){const tt=this.d*K+W;if((!L||L(this._convertFromCellCoord(W),this._convertFromCellCoord(K),this._convertFromCellCoord(W+1),this._convertFromCellCoord(K+1)))&&b.call(this,o,c,p,y,tt,x,E,L))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 p=0;for(let x=0;x=0)continue;const x=l[b];y[b]=Us[p].shallow.indexOf(b)>=0?x:fu(x,o)}l instanceof Error&&(y.message=l.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(y.$name=p),y}throw new Error("can't serialize object of type "+typeof l)}function pu(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||l instanceof Error||Sh(l)||Oe(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(pu);if(typeof l=="object"){const o=l.$name||"Object";if(!Us[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=Us[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(l);const p=Object.create(c.prototype);for(const y of Object.keys(l)){if(y==="$name")continue;const b=l[y];p[y]=Us[o].shallow.indexOf(y)>=0?b:pu(b)}return p}throw new Error("can't deserialize object of type "+typeof l)}class Tm{constructor(){this.first=!0}update(o,c){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+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 du(l){for(const o of l)if(Eh(o.charCodeAt(0)))return!0;return!1}function Lm(l){for(const o of l)if(!Pm(o.charCodeAt(0)))return!1;return!0}function Pm(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 Eh(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 _p(l){return!(Eh(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 Ih(l){return l>=1424&&l<=2303||_e["Arabic Presentation Forms-A"](l)||_e["Arabic Presentation Forms-B"](l)}function Mm(l,o){return!(!o&&Ih(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||_e.Khmer(l))}function s_(l){for(const o of l)if(Ih(o.charCodeAt(0)))return!0;return!1}const Wa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class lr{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 Tm,this.transition={})}isSupportedScript(o){return function(c,p){for(const y of c)if(!Mm(y.charCodeAt(0),p))return!1;return!0}(o,Wa.getRTLTextPluginStatus()==="loaded")}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),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class lc{constructor(o,c){this.property=o,this.value=c,this.expression=function(p,y){if(fh(p))return new dh(p,y);if(Qn(p)){const b=gm(p,y);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return y.type==="color"&&typeof p=="string"?b=Vn.parse(p):y.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Qo.parse(p)):b=ho.parse(p),{kind:"constant",evaluate:()=>b}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,p){return this.property.possiblyEvaluate(this,o,c,p)}}class Ch{constructor(o){this.property=o,this.value=new lc(o,void 0)}transitioned(o,c){return new Am(this.property,this.value,c,st({},o.transition,this.transition),o.now)}untransitioned(){return new Am(this.property,this.value,null,{},0)}}class vp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return H(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Ch(this._values[o].property)),this._values[o].value=new lc(this._values[o].property,c===null?void 0:H(c))}getTransition(o){return H(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Ch(this._values[o].property)),this._values[o].transition=H(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p);const y=this.getTransition(c);y!==void 0&&(o[`${c}-transition`]=y)}return o}transitioned(o,c){const p=new km(this._properties);for(const y of Object.keys(this._values))p._values[y]=this._values[y].transitioned(o,c._values[y]);return p}untransitioned(){const o=new km(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class Am{constructor(o,c,p,y,b){this.property=o,this.value=c,this.begin=b+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=p)}possiblyEvaluate(o,c,p){const y=o.now||0,b=this.value.possiblyEvaluate(o,c,p),x=this.prior;if(x){if(y>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(y=1)return 1;const A=L*L,R=A*L;return 4*(L<.5?R:3*(L-A)+R-.75)}(E))}}return b}}class km{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,p){const y=new uc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,c,p);return y}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Dm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return H(this._values[o].value)}setValue(o,c){this._values[o]=new lc(this._values[o].property,c===null?void 0:H(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p)}return o}possiblyEvaluate(o,c,p){const y=new uc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,c,p);return y}}class ys{constructor(o,c,p){this.property=o,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,p,y){return this.property.evaluate(this.value,this.parameters,o,c,p,y)}}class uc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Ae{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,p){const y=Qi[this.specification.type];return y?y(o,c,p):o}}class Fe{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,p,y){return new ys(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},p,y)}:o.expression,c)}interpolate(o,c,p){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new ys(this,{kind:"constant",value:void 0},o.parameters);const y=Qi[this.specification.type];if(y){const b=y(o.value.value,c.value.value,p);return new ys(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,c,p,y,b,x){return o.kind==="constant"?o.value:o.evaluate(c,p,y,b,x)}}class Th extends Fe{possiblyEvaluate(o,c,p,y){if(o.value===void 0)return new ys(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,y),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,c);return new ys(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const b=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 ys(this,{kind:"constant",value:b},c)}return new ys(this,o.expression,c)}evaluate(o,c,p,y,b,x){if(o.kind==="source"){const E=o.evaluate(c,p,y,b,x);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},p,y),o.evaluate({zoom:Math.floor(c.zoom)},p,y),o.evaluate({zoom:Math.floor(c.zoom)+1},p,y),c):o.value}_calculate(o,c,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class cc{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,y){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,y);return this._calculate(b,b,b,c)}return this._calculate(o.expression.evaluate(new lr(Math.floor(c.zoom-1),c)),o.expression.evaluate(new lr(Math.floor(c.zoom),c)),o.expression.evaluate(new lr(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class bp{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,y){return!!o.expression.evaluate(c,null,{},p,y)}interpolate(){return!1}}class po{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const p=o[c];p.specification.overridable&&this.overridableProperties.push(c);const y=this.defaultPropertyValues[c]=new lc(p,void 0),b=this.defaultTransitionablePropertyValues[c]=new Ch(p);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=y.possiblyEvaluate({})}}}Se("DataDrivenProperty",Fe),Se("DataConstantProperty",Ae),Se("CrossFadedDataDrivenProperty",Th),Se("CrossFadedProperty",cc),Se("ColorRampProperty",bp);const xp="-transition";class _s extends kn{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 Dm(c.layout)),c.paint)){this._transitionablePaint=new vp(c.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new uc(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,p={}){c!=null&&this._validate(o_,`layers.${this.id}.layout.${o}`,o,c,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(xp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,p={}){if(c!=null&&this._validate(yp,`layers.${this.id}.paint.${o}`,o,c,p))return!1;if(o.endsWith(xp))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const y=this._transitionablePaint._values[o],b=y.property.specification["property-type"]==="cross-faded-data-driven",x=y.value.isDataDriven(),E=y.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,p){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),Ct(o,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(o,c,p,y,b={}){return(!b||b.validate!==!1)&&hu(this,o.call(Tl,{key:c,layerType:this.type,objectKey:p,value:y,styleSpec:Nt,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 ys&&lu(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 hc{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 Ir{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 Vr(l,o=1){let c=0,p=0;return{members:l.map(y=>{const b=Rm[y.type].BYTES_PER_ELEMENT,x=c=Nm(c,Math.max(o,b)),E=y.components||1;return p=Math.max(p,b),c+=b*E,{name:y.name,type:y.type,components:E,offset:x}}),size:Nm(c,Math.max(p,o)),alignment:o}}function Nm(l,o){return Math.ceil(l/o)*o}class fc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const y=2*o;return this.int16[y+0]=c,this.int16[y+1]=p,o}}fc.prototype.bytesPerElement=4,Se("StructArrayLayout2i4",fc);class ya extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,c,p)}emplace(o,c,p,y){const b=3*o;return this.int16[b+0]=c,this.int16[b+1]=p,this.int16[b+2]=y,o}}ya.prototype.bytesPerElement=6,Se("StructArrayLayout3i6",ya);class wp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,y)}emplace(o,c,p,y,b){const x=4*o;return this.int16[x+0]=c,this.int16[x+1]=p,this.int16[x+2]=y,this.int16[x+3]=b,o}}wp.prototype.bytesPerElement=8,Se("StructArrayLayout4i8",wp);class Sp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,y,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,y,b,x)}emplace(o,c,p,y,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}Sp.prototype.bytesPerElement=12,Se("StructArrayLayout2i4i12",Sp);class Ep extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,y,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,y,b,x)}emplace(o,c,p,y,b,x,E){const L=4*o,A=8*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.uint8[A+4]=y,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}Ep.prototype.bytesPerElement=8,Se("StructArrayLayout2i4ub8",Ep);class pc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const y=2*o;return this.float32[y+0]=c,this.float32[y+1]=p,o}}pc.prototype.bytesPerElement=8,Se("StructArrayLayout2f8",pc);class Lh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,y,b,x,E,L,A,R){const O=this.length;return this.resize(O+1),this.emplace(O,o,c,p,y,b,x,E,L,A,R)}emplace(o,c,p,y,b,x,E,L,A,R,O){const U=10*o;return this.uint16[U+0]=c,this.uint16[U+1]=p,this.uint16[U+2]=y,this.uint16[U+3]=b,this.uint16[U+4]=x,this.uint16[U+5]=E,this.uint16[U+6]=L,this.uint16[U+7]=A,this.uint16[U+8]=R,this.uint16[U+9]=O,o}}Lh.prototype.bytesPerElement=20,Se("StructArrayLayout10ui20",Lh);class Ip extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,y,b,x,E,L,A,R,O,U){const W=this.length;return this.resize(W+1),this.emplace(W,o,c,p,y,b,x,E,L,A,R,O,U)}emplace(o,c,p,y,b,x,E,L,A,R,O,U,W){const K=12*o;return this.int16[K+0]=c,this.int16[K+1]=p,this.int16[K+2]=y,this.int16[K+3]=b,this.uint16[K+4]=x,this.uint16[K+5]=E,this.uint16[K+6]=L,this.uint16[K+7]=A,this.int16[K+8]=R,this.int16[K+9]=O,this.int16[K+10]=U,this.int16[K+11]=W,o}}Ip.prototype.bytesPerElement=24,Se("StructArrayLayout4i4ui4i24",Ip);class Cp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,c,p)}emplace(o,c,p,y){const b=3*o;return this.float32[b+0]=c,this.float32[b+1]=p,this.float32[b+2]=y,o}}Cp.prototype.bytesPerElement=12,Se("StructArrayLayout3f12",Cp);class _a extends Ir{_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}}_a.prototype.bytesPerElement=4,Se("StructArrayLayout1ul4",_a);class Ph extends Ir{_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,p,y,b,x,E,L,A){const R=this.length;return this.resize(R+1),this.emplace(R,o,c,p,y,b,x,E,L,A)}emplace(o,c,p,y,b,x,E,L,A,R){const O=10*o,U=5*o;return this.int16[O+0]=c,this.int16[O+1]=p,this.int16[O+2]=y,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[U+3]=L,this.uint16[O+8]=A,this.uint16[O+9]=R,o}}Ph.prototype.bytesPerElement=20,Se("StructArrayLayout6i1ul2ui20",Ph);class dc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,y,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,y,b,x)}emplace(o,c,p,y,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}dc.prototype.bytesPerElement=12,Se("StructArrayLayout2i2i2i12",dc);class Mh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,y,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,c,p,y,b)}emplace(o,c,p,y,b,x){const E=4*o,L=8*o;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=y,this.int16[L+6]=b,this.int16[L+7]=x,o}}Mh.prototype.bytesPerElement=16,Se("StructArrayLayout2f1f2i16",Mh);class mc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,y)}emplace(o,c,p,y,b){const x=12*o,E=3*o;return this.uint8[x+0]=c,this.uint8[x+1]=p,this.float32[E+1]=y,this.float32[E+2]=b,o}}mc.prototype.bytesPerElement=12,Se("StructArrayLayout2ub2f12",mc);class Ah extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,c,p)}emplace(o,c,p,y){const b=3*o;return this.uint16[b+0]=c,this.uint16[b+1]=p,this.uint16[b+2]=y,o}}Ah.prototype.bytesPerElement=6,Se("StructArrayLayout3ui6",Ah);class mu extends Ir{_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,p,y,b,x,E,L,A,R,O,U,W,K,tt,at,pt){const Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,o,c,p,y,b,x,E,L,A,R,O,U,W,K,tt,at,pt)}emplace(o,c,p,y,b,x,E,L,A,R,O,U,W,K,tt,at,pt,Mt){const yt=24*o,Et=12*o,Yt=48*o;return this.int16[yt+0]=c,this.int16[yt+1]=p,this.uint16[yt+2]=y,this.uint16[yt+3]=b,this.uint32[Et+2]=x,this.uint32[Et+3]=E,this.uint32[Et+4]=L,this.uint16[yt+10]=A,this.uint16[yt+11]=R,this.uint16[yt+12]=O,this.float32[Et+7]=U,this.float32[Et+8]=W,this.uint8[Yt+36]=K,this.uint8[Yt+37]=tt,this.uint8[Yt+38]=at,this.uint32[Et+10]=pt,this.int16[yt+22]=Mt,o}}mu.prototype.bytesPerElement=48,Se("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",mu);class Ll extends Ir{_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,p,y,b,x,E,L,A,R,O,U,W,K,tt,at,pt,Mt,yt,Et,Yt,Jt,be,Ce,ve,ye,ue,Ee){const de=this.length;return this.resize(de+1),this.emplace(de,o,c,p,y,b,x,E,L,A,R,O,U,W,K,tt,at,pt,Mt,yt,Et,Yt,Jt,be,Ce,ve,ye,ue,Ee)}emplace(o,c,p,y,b,x,E,L,A,R,O,U,W,K,tt,at,pt,Mt,yt,Et,Yt,Jt,be,Ce,ve,ye,ue,Ee,de){const ne=32*o,ze=16*o;return this.int16[ne+0]=c,this.int16[ne+1]=p,this.int16[ne+2]=y,this.int16[ne+3]=b,this.int16[ne+4]=x,this.int16[ne+5]=E,this.int16[ne+6]=L,this.int16[ne+7]=A,this.uint16[ne+8]=R,this.uint16[ne+9]=O,this.uint16[ne+10]=U,this.uint16[ne+11]=W,this.uint16[ne+12]=K,this.uint16[ne+13]=tt,this.uint16[ne+14]=at,this.uint16[ne+15]=pt,this.uint16[ne+16]=Mt,this.uint16[ne+17]=yt,this.uint16[ne+18]=Et,this.uint16[ne+19]=Yt,this.uint16[ne+20]=Jt,this.uint16[ne+21]=be,this.uint16[ne+22]=Ce,this.uint32[ze+12]=ve,this.float32[ze+13]=ye,this.float32[ze+14]=ue,this.uint16[ne+30]=Ee,this.uint16[ne+31]=de,o}}Ll.prototype.bytesPerElement=64,Se("StructArrayLayout8i15ui1ul2f2ui64",Ll);class kh extends Ir{_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}}kh.prototype.bytesPerElement=4,Se("StructArrayLayout1f4",kh);class Dh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,c,p)}emplace(o,c,p,y){const b=3*o;return this.uint16[6*o+0]=c,this.float32[b+1]=p,this.float32[b+2]=y,o}}Dh.prototype.bytesPerElement=12,Se("StructArrayLayout1ui2f12",Dh);class Pl extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,c,p)}emplace(o,c,p,y){const b=4*o;return this.uint32[2*o+0]=c,this.uint16[b+2]=p,this.uint16[b+3]=y,o}}Pl.prototype.bytesPerElement=8,Se("StructArrayLayout1ul2ui8",Pl);class Tp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const y=2*o;return this.uint16[y+0]=c,this.uint16[y+1]=p,o}}Tp.prototype.bytesPerElement=4,Se("StructArrayLayout2ui4",Tp);class Lp extends Ir{_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}}Lp.prototype.bytesPerElement=2,Se("StructArrayLayout1ui2",Lp);class Rh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,y)}emplace(o,c,p,y,b){const x=4*o;return this.float32[x+0]=c,this.float32[x+1]=p,this.float32[x+2]=y,this.float32[x+3]=b,o}}Rh.prototype.bytesPerElement=16,Se("StructArrayLayout4f16",Rh);class Om extends hc{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 I(this.anchorPointX,this.anchorPointY)}}Om.prototype.size=20;class _ extends Ph{get(o){return new Om(this,o)}}Se("CollisionBoxArray",_);class s extends hc{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]}}s.prototype.size=48;class f extends mu{get(o){return new s(this,o)}}Se("PlacedSymbolArray",f);class d extends hc{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]}}d.prototype.size=64;class m extends Ll{get(o){return new d(this,o)}}Se("SymbolInstanceArray",m);class v extends kh{getoffsetX(o){return this.float32[1*o+0]}}Se("GlyphOffsetArray",v);class C extends ya{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}Se("SymbolLineVertexArray",C);class T extends hc{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]}}T.prototype.size=12;class M extends Dh{get(o){return new T(this,o)}}Se("TextAnchorOffsetArray",M);class k extends hc{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]}}k.prototype.size=8;class z extends Pl{get(o){return new k(this,o)}}Se("FeatureIndexArray",z);class F extends fc{}class Z extends fc{}class it extends fc{}class rt extends Sp{}class ut extends Ep{}class $ extends pc{}class vt extends Lh{}class Ft extends Ip{}class ht extends Cp{}class It extends _a{}class Bt extends dc{}class Gt extends mc{}class Ht extends Ah{}class te extends Tp{}const $t=Vr([{name:"a_pos",components:2,type:"Int16"}],4),{members:oe}=$t;class he{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,y){let b=this.segments[this.segments.length-1];return o>he.MAX_VERTEX_ARRAY_LENGTH&&Kt(`Max vertices per segment is ${he.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>he.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==y)&&(b={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},y!==void 0&&(b.sortKey=y),this.segments.push(b)),b}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,p,y){return new he([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:y,vaos:{},sortKey:0}])}}function nn(l,o){return 256*(l=ot(Math.floor(l),0,255))+ot(Math.floor(o),0,255)}he.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Se("SegmentVector",he);const pe=Vr([{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 Be={exports:{}},rn={exports:{}};rn.exports=function(l,o){var c,p,y,b,x,E,L,A;for(p=l.length-(c=3&l.length),y=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,c){case 3:L^=(255&l.charCodeAt(A+2))<<16;case 2:L^=(255&l.charCodeAt(A+1))<<8;case 1:y^=L=(65535&(L=(L=(65535&(L^=255&l.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295}return y^=l.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var wn=rn.exports,qe={exports:{}};qe.exports=function(l,o){for(var c,p=l.length,y=o^p,b=0;p>=4;)c=1540483477*(65535&(c=255&l.charCodeAt(b)|(255&l.charCodeAt(++b))<<8|(255&l.charCodeAt(++b))<<16|(255&l.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:y^=(255&l.charCodeAt(b+2))<<16;case 2:y^=(255&l.charCodeAt(b+1))<<8;case 1:y=1540483477*(65535&(y^=255&l.charCodeAt(b)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var an=wn,fn=qe.exports;Be.exports=an,Be.exports.murmur3=an,Be.exports.murmur2=fn;var Cr=g(Be.exports);class Gn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,p,y){this.ids.push(Ro(o)),this.positions.push(c,p,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=Ro(o);let p=0,y=this.ids.length-1;for(;p>1;this.ids[x]>=c?y=x:p=x+1}const b=[];for(;this.ids[p]===c;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,c){const p=new Float64Array(o.ids),y=new Uint32Array(o.positions);return ai(p,y,0,p.length-1),c&&c.push(p.buffer,y.buffer),{ids:p,positions:y}}static deserialize(o){const c=new Gn;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function Ro(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Cr(String(l))}function ai(l,o,c,p){for(;c>1];let b=c-1,x=p+1;for(;;){do b++;while(l[b]y);if(b>=x)break;mr(l,b,x),mr(o,3*b,3*x),mr(o,3*b+1,3*x+1),mr(o,3*b+2,3*x+2)}x-c`u_${y}`),this.type=p}setUniform(o,c,p){o.set(p.constantOr(this.value))}getBinding(o,c,p){return this.type==="color"?new Ha(o,c):new No(o,c)}}class Kr{constructor(o,c){this.uniformNames=c.map(p=>`u_${p}`),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,p,y){const b=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,c,p){return p.substr(0,9)==="u_pattern"?new Gs(o,c):new No(o,c)}}class gr{constructor(o,c,p,y){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,c,p,y,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new lr(0),c,{},y,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,c,p,y){const b=this.expression.evaluate({zoom:0},p,y);this._setPaintValue(o,c,b)}_setPaintValue(o,c,p){if(this.type==="color"){const y=Za(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=y,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,c,p,y,b){const x=this.expression.evaluate(new lr(this.zoom),c,{},y,[],b),E=this.expression.evaluate(new lr(this.zoom+1),c,{},y,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,E)}updatePaintArray(o,c,p,y){const b=this.expression.evaluate({zoom:this.zoom},p,y),x=this.expression.evaluate({zoom:this.zoom+1},p,y);this._setPaintValue(o,c,b,x)}_setPaintValue(o,c,p,y){if(this.type==="color"){const b=Za(p),x=Za(y);for(let E=o;E`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof gr||p instanceof ur)for(let y=0;y!0){this.programConfigurations={};for(const y of o)this.programConfigurations[y.id]=new Jr(y,c,p);this.needsUpload=!1,this._featureMap=new Gn,this._bufferOffset=0}populatePaintArrays(o,c,p,y,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,y,b,x);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,p,y){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,c,b,y)||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 es(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 Qr(l,o,c){const p={color:{source:pc,composite:Rh},number:{source:kh,composite:pc}},y=function(b){return{"line-pattern":{source:vt,composite:vt},"fill-pattern":{source:vt,composite:vt},"fill-extrusion-pattern":{source:vt,composite:vt}}[b]}(l);return y&&y[c]||p[o][c]}Se("ConstantBinder",qs),Se("CrossFadedConstantBinder",Kr),Se("SourceExpressionBinder",gr),Se("CrossFadedCompositeBinder",ts),Se("CompositeExpressionBinder",ur),Se("ProgramConfiguration",Jr,{omit:["_buffers"]}),Se("ProgramConfigurationSet",yr);const Rr=8192,Pp=Math.pow(2,14)-1,zm=-Pp-1;function Ml(l){const o=Rr/l.extent,c=l.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Kt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function Al(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?Ml(l):[]}}function Nh(l,o,c,p,y){l.emplaceBack(2*o+(p+1)/2,2*c+(y+1)/2)}class Xa{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 Z,this.indexArray=new Ht,this.segments=new he,this.programConfigurations=new yr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){const y=this.layers[0],b=[];let x=null,E=!1;y.type==="circle"&&(x=y.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:L,id:A,index:R,sourceLayerIndex:O}of o){const U=this.layers[0]._featureFilter.needGeometry,W=Al(L,U);if(!this.layers[0]._featureFilter.filter(new lr(this.zoom),W,p))continue;const K=E?x.evaluate(W,{},p):void 0,tt={id:A,properties:L.properties,type:L.type,sourceLayerIndex:O,index:R,geometry:U?W.geometry:Ml(L),patterns:{},sortKey:K};b.push(tt)}E&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:R,sourceLayerIndex:O}=L,U=o[R].feature;this.addFeature(L,A,R,p),c.featureIndex.insert(U,A,R,O,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,oe),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,p,y){for(const b of c)for(const x of b){const E=x.x,L=x.y;if(E<0||E>=Rr||L<0||L>=Rr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),R=A.vertexLength;Nh(this.layoutVertexArray,E,L,-1,-1),Nh(this.layoutVertexArray,E,L,1,-1),Nh(this.layoutVertexArray,E,L,1,1),Nh(this.layoutVertexArray,E,L,-1,1),this.indexArray.emplaceBack(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},y)}}function Mp(l,o){for(let c=0;c1){if(Oh(l,o))return!0;for(let p=0;p1?c:c.sub(o)._mult(y)._add(o))}function E1(l,o){let c,p,y,b=!1;for(let x=0;xo.y!=y.y>o.y&&o.x<(y.x-p.x)*(o.y-p.y)/(y.y-p.y)+p.x&&(b=!b)}return b}function zh(l,o){let c=!1;for(let p=0,y=l.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(c=!c)}return c}function jC(l,o,c){const p=c[0],y=c[2];if(l.xy.x&&o.x>y.x||l.yy.y&&o.y>y.y)return!1;const b=St(l,o,c[0]);return b!==St(l,o,c[1])||b!==St(l,o,c[2])||b!==St(l,o,c[3])}function Rp(l,o,c){const p=o.paint.get(l).value;return p.kind==="constant"?p.value:c.programConfigurations.get(o.id).getMaxValue(l)}function Bm(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function Vm(l,o,c,p,y){if(!o[0]&&!o[1])return l;const b=I.convert(o)._mult(y);c==="viewport"&&b._rotate(-p);const x=[];for(let E=0;EL1(at,tt))}(A,L),W=O?R*E:R;for(const K of y)for(const tt of K){const at=O?tt:L1(tt,L);let pt=W;const Mt=Um([],[tt.x,tt.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=Mt[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=x.cameraToCenterDistance/Mt[3]),Fm(U,at,pt))return!0}return!1}}function L1(l,o){const c=Um([],[l.x,l.y,0,1],o);return new I(c[0]/c[3],c[1]/c[3])}class P1 extends Xa{}let M1;Se("HeatmapBucket",P1,{omit:["layers"]});var XC={get paint(){return M1=M1||new po({"heatmap-radius":new Fe(Nt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Fe(Nt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ae(Nt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bp(Nt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ae(Nt.paint_heatmap["heatmap-opacity"])})}};function u_(l,{width:o,height:c},p,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*c*p)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*c*p}`)}else y=new Uint8Array(o*c*p);return l.width=o,l.height=c,l.data=y,l}function A1(l,{width:o,height:c},p){if(o===l.width&&c===l.height)return;const y=u_({},{width:o,height:c},p);c_(l,y,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,c)},p),l.width=o,l.height=c,l.data=y.data}function c_(l,o,c,p,y,b){if(y.width===0||y.height===0)return o;if(y.width>l.width||y.height>l.height||c.x>l.width-y.width||c.y>l.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||p.x>o.width-y.width||p.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const x=l.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[l.evaluationKey]=L;const A=l.expression.evaluate(o);y.data[x+E+0]=Math.floor(255*A.r/A.a),y.data[x+E+1]=Math.floor(255*A.g/A.a),y.data[x+E+2]=Math.floor(255*A.b/A.a),y.data[x+E+3]=Math.floor(255*A.a)};if(l.clips)for(let x=0,E=0;x80*c){p=b=l[0],y=x=l[1];for(var K=c;Kb&&(b=E),L>x&&(x=L);A=(A=Math.max(b-p,x-y))!==0?32767/A:0}return zp(U,W,c,p,y,A,0),W}function R1(l,o,c,p,y){var b,x;if(y===d_(l,o,c,p)>0)for(b=o;b=o;b-=p)x=z1(b,l[b],l[b+1],x);return x&&qm(x,x.next)&&(Bp(x),x=x.next),x}function yc(l,o){if(!l)return l;o||(o=l);var c,p=l;do if(c=!1,p.steiner||!qm(p,p.next)&&Ur(p.prev,p,p.next)!==0)p=p.next;else{if(Bp(p),(p=o=p.prev)===p.next)break;c=!0}while(c||p!==o);return o}function zp(l,o,c,p,y,b,x){if(l){!x&&b&&function(R,O,U,W){var K=R;do K.z===0&&(K.z=f_(K.x,K.y,O,U,W)),K.prevZ=K.prev,K.nextZ=K.next,K=K.next;while(K!==R);K.prevZ.nextZ=null,K.prevZ=null,function(tt){var at,pt,Mt,yt,Et,Yt,Jt,be,Ce=1;do{for(pt=tt,tt=null,Et=null,Yt=0;pt;){for(Yt++,Mt=pt,Jt=0,at=0;at0||be>0&&Mt;)Jt!==0&&(be===0||!Mt||pt.z<=Mt.z)?(yt=pt,pt=pt.nextZ,Jt--):(yt=Mt,Mt=Mt.nextZ,be--),Et?Et.nextZ=yt:tt=yt,yt.prevZ=Et,Et=yt;pt=Mt}Et.nextZ=null,Ce*=2}while(Yt>1)}(K)}(l,p,y,b);for(var E,L,A=l;l.prev!==l.next;)if(E=l.prev,L=l.next,b?eT(l,p,y,b):tT(l))o.push(E.i/c|0),o.push(l.i/c|0),o.push(L.i/c|0),Bp(l),l=L.next,A=L.next;else if((l=L)===A){x?x===1?zp(l=nT(yc(l),o,c),o,c,p,y,b,2):x===2&&rT(l,o,c,p,y,b):zp(yc(l),o,c,p,y,b,1);break}}}function tT(l){var o=l.prev,c=l,p=l.next;if(Ur(o,c,p)>=0)return!1;for(var y=o.x,b=c.x,x=p.x,E=o.y,L=c.y,A=p.y,R=yb?y>x?y:x:b>x?b:x,W=E>L?E>A?E:A:L>A?L:A,K=p.next;K!==o;){if(K.x>=R&&K.x<=U&&K.y>=O&&K.y<=W&&Bh(y,E,b,L,x,A,K.x,K.y)&&Ur(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function eT(l,o,c,p){var y=l.prev,b=l,x=l.next;if(Ur(y,b,x)>=0)return!1;for(var E=y.x,L=b.x,A=x.x,R=y.y,O=b.y,U=x.y,W=EL?E>A?E:A:L>A?L:A,at=R>O?R>U?R:U:O>U?O:U,pt=f_(W,K,o,c,p),Mt=f_(tt,at,o,c,p),yt=l.prevZ,Et=l.nextZ;yt&&yt.z>=pt&&Et&&Et.z<=Mt;){if(yt.x>=W&&yt.x<=tt&&yt.y>=K&&yt.y<=at&&yt!==y&&yt!==x&&Bh(E,R,L,O,A,U,yt.x,yt.y)&&Ur(yt.prev,yt,yt.next)>=0||(yt=yt.prevZ,Et.x>=W&&Et.x<=tt&&Et.y>=K&&Et.y<=at&&Et!==y&&Et!==x&&Bh(E,R,L,O,A,U,Et.x,Et.y)&&Ur(Et.prev,Et,Et.next)>=0))return!1;Et=Et.nextZ}for(;yt&&yt.z>=pt;){if(yt.x>=W&&yt.x<=tt&&yt.y>=K&&yt.y<=at&&yt!==y&&yt!==x&&Bh(E,R,L,O,A,U,yt.x,yt.y)&&Ur(yt.prev,yt,yt.next)>=0)return!1;yt=yt.prevZ}for(;Et&&Et.z<=Mt;){if(Et.x>=W&&Et.x<=tt&&Et.y>=K&&Et.y<=at&&Et!==y&&Et!==x&&Bh(E,R,L,O,A,U,Et.x,Et.y)&&Ur(Et.prev,Et,Et.next)>=0)return!1;Et=Et.nextZ}return!0}function nT(l,o,c){var p=l;do{var y=p.prev,b=p.next.next;!qm(y,b)&&N1(y,p,p.next,b)&&Fp(y,b)&&Fp(b,y)&&(o.push(y.i/c|0),o.push(p.i/c|0),o.push(b.i/c|0),Bp(p),Bp(p.next),p=l=b),p=p.next}while(p!==l);return yc(p)}function rT(l,o,c,p,y,b){var x=l;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&lT(x,E)){var L=O1(x,E);return x=yc(x,x.next),L=yc(L,L.next),zp(x,o,c,p,y,b,0),void zp(L,o,c,p,y,b,0)}E=E.next}x=x.next}while(x!==l)}function iT(l,o){return l.x-o.x}function oT(l,o){var c=function(y,b){var x,E=b,L=y.x,A=y.y,R=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var O=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(O<=L&&O>R&&(R=O,x=E.x=E.x&&E.x>=K&&L!==E.x&&Bh(Ax.x||E.x===x.x&&sT(x,E)))&&(x=E,at=U)),E=E.next;while(E!==W);return x}(l,o);if(!c)return o;var p=O1(c,l);return yc(p,p.next),yc(c,c.next)}function sT(l,o){return Ur(l.prev,l,o.prev)<0&&Ur(o.next,l,l.next)<0}function f_(l,o,c,p,y){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-c)*y|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function aT(l){var o=l,c=l;do(o.x=(l-x)*(b-E)&&(l-x)*(p-E)>=(c-x)*(o-E)&&(c-x)*(b-E)>=(y-x)*(p-E)}function lT(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(c,p){var y=c;do{if(y.i!==c.i&&y.next.i!==c.i&&y.i!==p.i&&y.next.i!==p.i&&N1(y,y.next,c,p))return!0;y=y.next}while(y!==c);return!1}(l,o)&&(Fp(l,o)&&Fp(o,l)&&function(c,p){var y=c,b=!1,x=(c.x+p.x)/2,E=(c.y+p.y)/2;do y.y>E!=y.next.y>E&&y.next.y!==y.y&&x<(y.next.x-y.x)*(E-y.y)/(y.next.y-y.y)+y.x&&(b=!b),y=y.next;while(y!==c);return b}(l,o)&&(Ur(l.prev,l,o.prev)||Ur(l,o.prev,o))||qm(l,o)&&Ur(l.prev,l,l.next)>0&&Ur(o.prev,o,o.next)>0)}function Ur(l,o,c){return(o.y-l.y)*(c.x-o.x)-(o.x-l.x)*(c.y-o.y)}function qm(l,o){return l.x===o.x&&l.y===o.y}function N1(l,o,c,p){var y=Wm(Ur(l,o,c)),b=Wm(Ur(l,o,p)),x=Wm(Ur(c,p,l)),E=Wm(Ur(c,p,o));return y!==b&&x!==E||!(y!==0||!jm(l,c,o))||!(b!==0||!jm(l,p,o))||!(x!==0||!jm(c,l,p))||!(E!==0||!jm(c,o,p))}function jm(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 Wm(l){return l>0?1:l<0?-1:0}function Fp(l,o){return Ur(l.prev,l,l.next)<0?Ur(l,o,l.next)>=0&&Ur(l,l.prev,o)>=0:Ur(l,o,l.prev)<0||Ur(l,l.next,o)<0}function O1(l,o){var c=new p_(l.i,l.x,l.y),p=new p_(o.i,o.x,o.y),y=l.next,b=o.prev;return l.next=o,o.prev=l,c.next=y,y.prev=c,p.next=c,c.prev=p,b.next=p,p.prev=b,p}function z1(l,o,c,p){var y=new p_(l,o,c);return p?(y.next=p.next,y.prev=p,p.next.prev=y,p.next=y):(y.prev=y,y.next=y),y}function Bp(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 p_(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 d_(l,o,c,p){for(var y=0,b=o,x=c-p;b0&&c.holes.push(p+=l[y-1].length)}return c};var F1=g(h_.exports);function uT(l,o,c,p,y){B1(l,o,c||0,p||l.length-1,y||cT)}function B1(l,o,c,p,y){for(;p>c;){if(p-c>600){var b=p-c+1,x=o-c+1,E=Math.log(b),L=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*L*(b-L)/b)*(x-b/2<0?-1:1);B1(l,o,Math.max(c,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),y)}var R=l[o],O=c,U=p;for(Vp(l,c,o),y(l[p],R)>0&&Vp(l,c,p);O0;)U--}y(l[c],R)===0?Vp(l,c,U):Vp(l,++U,p),U<=o&&(c=U+1),o<=U&&(p=U-1)}}function Vp(l,o,c){var p=l[o];l[o]=l[c],l[c]=p}function cT(l,o){return lo?1:0}function m_(l,o){const c=l.length;if(c<=1)return[l];const p=[];let y,b;for(let x=0;x1)for(let x=0;xc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new it,this.indexArray=new Ht,this.indexArray2=new te,this.programConfigurations=new yr(o.layers,o.zoom),this.segments=new he,this.segments2=new he,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=g_("fill",this.layers,c);const y=this.layers[0].layout.get("fill-sort-key"),b=!y.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:R}of o){const O=this.layers[0]._featureFilter.needGeometry,U=Al(E,O);if(!this.layers[0]._featureFilter.filter(new lr(this.zoom),U,p))continue;const W=b?y.evaluate(U,{},p,c.availableImages):void 0,K={id:L,properties:E.properties,type:E.type,sourceLayerIndex:R,index:A,geometry:O?U.geometry:Ml(E),patterns:{},sortKey:W};x.push(K)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:R}=E;if(this.hasPattern){const O=y_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,R,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,$C),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,p,y,b){for(const x of m_(c,500)){let E=0;for(const W of x)E+=W.length;const L=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=L.vertexLength,R=[],O=[];for(const W of x){if(W.length===0)continue;W!==x[0]&&O.push(R.length/2);const K=this.segments2.prepareSegment(W.length,this.layoutVertexArray,this.indexArray2),tt=K.vertexLength;this.layoutVertexArray.emplaceBack(W[0].x,W[0].y),this.indexArray2.emplaceBack(tt+W.length-1,tt),R.push(W[0].x),R.push(W[0].y);for(let at=1;at>3}if(y--,p===1||p===2)b+=l.readSVarint(),x+=l.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new yT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},Vh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,c=1,p=0,y=0,b=0,x=1/0,E=-1/0,L=1/0,A=-1/0;l.pos>3}if(p--,c===1||c===2)(y+=l.readSVarint())E&&(E=y),(b+=l.readSVarint())A&&(A=b);else if(c!==7)throw new Error("unknown command "+c)}return[x,L,E,A]},Vh.prototype.toGeoJSON=function(l,o,c){var p,y,b=this.extent*Math.pow(2,c),x=this.extent*l,E=this.extent*o,L=this.loadGeometry(),A=Vh.types[this.type];function R(W){for(var K=0;K>3;y=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return y}(c))}j1.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 bT(this._pbf,o,this.extent,this._keys,this._values)};var wT=q1;function ST(l,o,c){if(l===3){var p=new wT(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}gu.VectorTile=function(l,o){this.layers=l.readFields(ST,{},o)},gu.VectorTileFeature=G1,gu.VectorTileLayer=q1;const ET=gu.VectorTileFeature.types,v_=Math.pow(2,13);function Up(l,o,c,p,y,b,x,E){l.emplaceBack(o,c,2*Math.floor(p*v_)+x,y*v_*2,b*v_*2,Math.round(E))}class b_{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 rt,this.centroidVertexArray=new F,this.indexArray=new Ht,this.programConfigurations=new yr(o.layers,o.zoom),this.segments=new he,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.features=[],this.hasPattern=g_("fill-extrusion",this.layers,c);for(const{feature:y,id:b,index:x,sourceLayerIndex:E}of o){const L=this.layers[0]._featureFilter.needGeometry,A=Al(y,L);if(!this.layers[0]._featureFilter.filter(new lr(this.zoom),A,p))continue;const R={id:b,sourceLayerIndex:E,index:x,geometry:L?A.geometry:Ml(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(y_("fill-extrusion",this.layers,R,this.zoom,c)):this.addFeature(R,R.geometry,x,p,{}),c.featureIndex.insert(y,R.geometry,x,E,this.index,!0)}}addFeatures(o,c,p){for(const y of this.features){const{geometry:b}=y;this.addFeature(y,b,y.index,c,p)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}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,gT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,mT.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,p,y,b){const x={x:0,y:0,vertexCount:0};for(const E of m_(c,500)){let L=0;for(const K of E)L+=K.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of E){if(K.length===0||CT(K))continue;let tt=0;for(let at=0;at=1){const Mt=K[at-1];if(!IT(pt,Mt)){A.vertexLength+4>he.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const yt=pt.sub(Mt)._perp()._unit(),Et=Mt.dist(pt);tt+Et>32768&&(tt=0),Up(this.layoutVertexArray,pt.x,pt.y,yt.x,yt.y,0,0,tt),Up(this.layoutVertexArray,pt.x,pt.y,yt.x,yt.y,0,1,tt),x.x+=2*pt.x,x.y+=2*pt.y,x.vertexCount+=2,tt+=Et,Up(this.layoutVertexArray,Mt.x,Mt.y,yt.x,yt.y,0,0,tt),Up(this.layoutVertexArray,Mt.x,Mt.y,yt.x,yt.y,0,1,tt),x.x+=2*Mt.x,x.y+=2*Mt.y,x.vertexCount+=2;const Yt=A.vertexLength;this.indexArray.emplaceBack(Yt,Yt+2,Yt+1),this.indexArray.emplaceBack(Yt+1,Yt+2,Yt+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>he.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),ET[o.type]!=="Polygon")continue;const R=[],O=[],U=A.vertexLength;for(const K of E)if(K.length!==0){K!==E[0]&&O.push(R.length/2);for(let tt=0;ttRr)||l.y===o.y&&(l.y<0||l.y>Rr)}function CT(l){return l.every(o=>o.x<0)||l.every(o=>o.x>Rr)||l.every(o=>o.y<0)||l.every(o=>o.y>Rr)}let W1;Se("FillExtrusionBucket",b_,{omit:["layers","features"]});var TT={get paint(){return W1=W1||new po({"fill-extrusion-opacity":new Ae(Nt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Fe(Nt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ae(Nt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ae(Nt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Th(Nt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Fe(Nt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Fe(Nt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ae(Nt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class LT extends _s{constructor(o){super(o,TT)}createBucket(o){return new b_(o)}queryRadius(){return Bm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,p,y,b,x,E,L){const A=Vm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),R=this.paint.get("fill-extrusion-height").evaluate(c,p),O=this.paint.get("fill-extrusion-base").evaluate(c,p),U=function(K,tt,at,pt){const Mt=[];for(const yt of K){const Et=[yt.x,yt.y,0,1];Um(Et,Et,tt),Mt.push(new I(Et[0]/Et[3],Et[1]/Et[3]))}return Mt}(A,L),W=function(K,tt,at,pt){const Mt=[],yt=[],Et=pt[8]*tt,Yt=pt[9]*tt,Jt=pt[10]*tt,be=pt[11]*tt,Ce=pt[8]*at,ve=pt[9]*at,ye=pt[10]*at,ue=pt[11]*at;for(const Ee of K){const de=[],ne=[];for(const ze of Ee){const Le=ze.x,pn=ze.y,ir=pt[0]*Le+pt[4]*pn+pt[12],cr=pt[1]*Le+pt[5]*pn+pt[13],ci=pt[2]*Le+pt[6]*pn+pt[14],ns=pt[3]*Le+pt[7]*pn+pt[15],go=ci+Jt,$r=ns+be,Mi=ir+Ce,Fi=cr+ve,yo=ci+ye,_o=ns+ue,hi=new I((ir+Et)/$r,(cr+Yt)/$r);hi.z=go/$r,de.push(hi);const fi=new I(Mi/_o,Fi/_o);fi.z=yo/_o,ne.push(fi)}Mt.push(de),yt.push(ne)}return[Mt,yt]}(y,O,R,L);return function(K,tt,at){let pt=1/0;Ap(at,tt)&&(pt=H1(at,tt[0]));for(let Mt=0;Mtc.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 ut,this.layoutVertexArray2=new $,this.indexArray=new Ht,this.programConfigurations=new yr(o.layers,o.zoom),this.segments=new he,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=g_("line",this.layers,c);const y=this.layers[0].layout.get("line-sort-key"),b=!y.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:R}of o){const O=this.layers[0]._featureFilter.needGeometry,U=Al(E,O);if(!this.layers[0]._featureFilter.filter(new lr(this.zoom),U,p))continue;const W=b?y.evaluate(U,{},p):void 0,K={id:L,properties:E.properties,type:E.type,sourceLayerIndex:R,index:A,geometry:O?U.geometry:Ml(E),patterns:{},sortKey:W};x.push(K)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:R}=E;if(this.hasPattern){const O=y_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,R,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,c,p)}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,kT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,MT),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,p,y,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),L=x.get("line-cap"),A=x.get("line-miter-limit"),R=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of c)this.addLine(O,o,E,L,A,R);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,y)}addLine(o,c,p,y,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pt=0;pt=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(be&&pt>A){const ue=U.dist(W);if(ue>2*R){const Ee=U.sub(U.sub(W)._mult(R/ue)._round());this.updateDistance(W,Ee),this.addCurrentVertex(Ee,tt,0,0,O),W=Ee}}const ve=W&&K;let ye=ve?p:E?"butt":y;if(ve&&ye==="round"&&(Ytb&&(ye="bevel"),ye==="bevel"&&(Yt>2&&(ye="flipbevel"),Yt100)Mt=at.mult(-1);else{const ue=Yt*tt.add(at).mag()/tt.sub(at).mag();Mt._perp()._mult(ue*(Ce?-1:1))}this.addCurrentVertex(U,Mt,0,0,O),this.addCurrentVertex(U,Mt.mult(-1),0,0,O)}else if(ye==="bevel"||ye==="fakeround"){const ue=-Math.sqrt(Yt*Yt-1),Ee=Ce?ue:0,de=Ce?0:ue;if(W&&this.addCurrentVertex(U,tt,Ee,de,O),ye==="fakeround"){const ne=Math.round(180*Jt/Math.PI/20);for(let ze=1;ze2*R){const Ee=U.add(K.sub(U)._mult(R/ue)._round());this.updateDistance(U,Ee),this.addCurrentVertex(Ee,at,0,0,O),U=Ee}}}}addCurrentVertex(o,c,p,y,b,x=!1){const E=c.y*y-c.x,L=-c.y-c.x*y;this.addHalfVertex(o,c.x+c.y*p,c.y-c.x*p,x,!1,p,b),this.addHalfVertex(o,E,L,x,!0,-y,b),this.distance>Z1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,p,y,b,x))}addHalfVertex({x:o,y:c},p,y,b,x,E,L){const A=.5*(this.lineClips?this.scaledDistance*(Z1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(c<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*y)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const R=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),L.primitiveLength++),x?this.e2=R:this.e1=R}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 X1,Y1;Se("LineBucket",x_,{omit:["layers","patternFeatures"]});var K1={get paint(){return Y1=Y1||new po({"line-opacity":new Fe(Nt.paint_line["line-opacity"]),"line-color":new Fe(Nt.paint_line["line-color"]),"line-translate":new Ae(Nt.paint_line["line-translate"]),"line-translate-anchor":new Ae(Nt.paint_line["line-translate-anchor"]),"line-width":new Fe(Nt.paint_line["line-width"]),"line-gap-width":new Fe(Nt.paint_line["line-gap-width"]),"line-offset":new Fe(Nt.paint_line["line-offset"]),"line-blur":new Fe(Nt.paint_line["line-blur"]),"line-dasharray":new cc(Nt.paint_line["line-dasharray"]),"line-pattern":new Th(Nt.paint_line["line-pattern"]),"line-gradient":new bp(Nt.paint_line["line-gradient"])})},get layout(){return X1=X1||new po({"line-cap":new Ae(Nt.layout_line["line-cap"]),"line-join":new Fe(Nt.layout_line["line-join"]),"line-miter-limit":new Ae(Nt.layout_line["line-miter-limit"]),"line-round-limit":new Ae(Nt.layout_line["line-round-limit"]),"line-sort-key":new Fe(Nt.layout_line["line-sort-key"])})}};class NT extends Fe{possiblyEvaluate(o,c){return c=new lr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,p,y){return c=st({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,p,y)}}let Hm;class OT extends _s{constructor(o){super(o,K1),this.gradientVersion=0,Hm||(Hm=new NT(K1.paint.properties["line-width"].specification),Hm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof nc,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"]=Hm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new x_(o)}queryRadius(o){const c=o,p=J1(Rp("line-width",this,c),Rp("line-gap-width",this,c)),y=Rp("line-offset",this,c);return p/2+Math.abs(y)+Bm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,p,y,b,x,E){const L=Vm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*J1(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),R=this.paint.get("line-offset").evaluate(c,p);return R&&(y=function(O,U){const W=[];for(let K=0;K=3){for(let at=0;at0?o+2*l:l}const zT=Vr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),FT=Vr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Vr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const BT=Vr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Vr([{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 Q1=Vr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),VT=Vr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function UT(l,o,c){return l.sections.forEach(p=>{p.text=function(y,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?y=y.toLocaleUpperCase():E==="lowercase"&&(y=y.toLocaleLowerCase()),Wa.applyArabicShaping&&(y=Wa.applyArabicShaping(y)),y}(p.text,o,c)}),l}Vr([{name:"triangle",components:3,type:"Uint16"}]),Vr([{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"}]),Vr([{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"}]),Vr([{type:"Float32",name:"offsetX"}]),Vr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Vr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const qp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ui=24,$1=Zn,tb=function(l,o,c,p,y){var b,x,E=8*y-p-1,L=(1<>1,R=-7,O=c?y-1:0,U=c?-1:1,W=l[o+O];for(O+=U,b=W&(1<<-R)-1,W>>=-R,R+=E;R>0;b=256*b+l[o+O],O+=U,R-=8);for(x=b&(1<<-R)-1,b>>=-R,R+=p;R>0;x=256*x+l[o+O],O+=U,R-=8);if(b===0)b=1-A;else{if(b===L)return x?NaN:1/0*(W?-1:1);x+=Math.pow(2,p),b-=A}return(W?-1:1)*x*Math.pow(2,b-p)},eb=function(l,o,c,p,y,b){var x,E,L,A=8*b-y-1,R=(1<>1,U=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,W=p?0:b-1,K=p?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,x=R):(x=Math.floor(Math.log(o)/Math.LN2),o*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+O>=1?U/L:U*Math.pow(2,1-O))*L>=2&&(x++,L/=2),x+O>=R?(E=0,x=R):x+O>=1?(E=(o*L-1)*Math.pow(2,y),x+=O):(E=o*Math.pow(2,O-1)*Math.pow(2,y),x=0));y>=8;l[c+W]=255&E,W+=K,E/=256,y-=8);for(x=x<0;l[c+W]=255&x,W+=K,x/=256,A-=8);l[c+W-K]|=128*tt};function Zn(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Zn.Varint=0,Zn.Fixed64=1,Zn.Bytes=2,Zn.Fixed32=5;var w_=4294967296,nb=1/w_,rb=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function kl(l){return l.type===Zn.Bytes?l.readVarint()+l.pos:l.pos+1}function Uh(l,o,c){return c?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function ib(l,o,c){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(p);for(var y=c.pos-1;y>=l;y--)c.buf[y+p]=c.buf[y]}function GT(l,o){for(var c=0;c>>8,l[c+2]=o>>>16,l[c+3]=o>>>24}function ob(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Zn.prototype={destroy:function(){this.buf=null},readFields:function(l,o,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&p,l(y,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=Zm(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=ob(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=Zm(this.buf,this.pos)+Zm(this.buf,this.pos+4)*w_;return this.pos+=8,l},readSFixed64:function(){var l=Zm(this.buf,this.pos)+ob(this.buf,this.pos+4)*w_;return this.pos+=8,l},readFloat:function(){var l=tb(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=tb(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,c,p=this.buf;return o=127&(c=p[this.pos++]),c<128?o:(o|=(127&(c=p[this.pos++]))<<7,c<128?o:(o|=(127&(c=p[this.pos++]))<<14,c<128?o:(o|=(127&(c=p[this.pos++]))<<21,c<128?o:function(y,b,x){var E,L,A=x.buf;if(E=(112&(L=A[x.pos++]))>>4,L<128||(E|=(127&(L=A[x.pos++]))<<3,L<128)||(E|=(127&(L=A[x.pos++]))<<10,L<128)||(E|=(127&(L=A[x.pos++]))<<17,L<128)||(E|=(127&(L=A[x.pos++]))<<24,L<128)||(E|=(1&(L=A[x.pos++]))<<31,L<128))return Uh(y,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=p[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&&rb?function(c,p,y){return rb.decode(c.subarray(p,y))}(this.buf,o,l):function(c,p,y){for(var b="",x=p;x239?4:R>223?3:R>191?2:1;if(x+U>y)break;U===1?R<128&&(O=R):U===2?(192&(E=c[x+1]))==128&&(O=(31&R)<<6|63&E)<=127&&(O=null):U===3?(L=c[x+2],(192&(E=c[x+1]))==128&&(192&L)==128&&((O=(15&R)<<12|(63&E)<<6|63&L)<=2047||O>=55296&&O<=57343)&&(O=null)):U===4&&(L=c[x+2],A=c[x+3],(192&(E=c[x+1]))==128&&(192&L)==128&&(192&A)==128&&((O=(15&R)<<18|(63&E)<<12|(63&L)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,U=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=U}return b}(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!==Zn.Bytes)return l.push(this.readVarint(o));var c=kl(this);for(l=l||[];this.pos127;);else if(o===Zn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Zn.Fixed32)this.pos+=4;else{if(o!==Zn.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 p,y;if(o>=0?(p=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,c),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(y,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(p,y,b){for(var x,E,L=0;L55295&&x<57344){if(!E){x>56319||L+1===y.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,l,this.pos);var c=this.pos-o;c>=128&&ib(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(l){this.realloc(4),eb(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),eb(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&&ib(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(l,o,c){this.writeTag(l,Zn.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,GT,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,qT,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,HT,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,jT,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,WT,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,ZT,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,XT,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,YT,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,KT,o)},writeBytesField:function(l,o){this.writeTag(l,Zn.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Zn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Zn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Zn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Zn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Zn.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Zn.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Zn.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Zn.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Zn.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var S_=g($1);const E_=3;function JT(l,o,c){l===1&&c.readMessage(QT,o)}function QT(l,o,c){if(l===3){const{id:p,bitmap:y,width:b,height:x,left:E,top:L,advance:A}=c.readMessage($T,{});o.push({id:p,bitmap:new Op({width:b+2*E_,height:x+2*E_},y),metrics:{width:b,height:x,left:E,top:L,advance:A}})}}function $T(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 sb=E_;function ab(l){let o=0,c=0;for(const x of l)o+=x.w*x.h,c=Math.max(c,x.w);l.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let y=0,b=0;for(const x of l)for(let E=p.length-1;E>=0;E--){const L=p[E];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),y=Math.max(y,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();E=0&&p>=o&&Ym[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const p=new qh;return p.text=this.text.substring(o,c),p.sectionIndex=this.sectionIndex.slice(o,c),p.sections=this.sections,p}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(Wp.forText(o.scale,o.fontStack||c));const p=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Xm(l,o,c,p,y,b,x,E,L,A,R,O,U,W,K,tt){const at=qh.fromFeature(l,y);let pt;O===h.ah.vertical&&at.verticalizePunctuation();const{processBidirectionalText:Mt,processStyledBidirectionalText:yt}=Wa;if(Mt&&at.sections.length===1){pt=[];const Jt=Mt(at.toString(),C_(at,A,b,o,p,W,K));for(const be of Jt){const Ce=new qh;Ce.text=be,Ce.sections=at.sections;for(let ve=0;ve0&&Rl>zo&&(zo=Rl)}else{const xs=Ce[_n.fontStack],Bo=xs&&xs[Bi];if(Bo&&Bo.rect)va=Bo.rect,js=Bo.metrics;else{const Rl=be[_n.fontStack],Kp=Rl&&Rl[Bi];if(!Kp)continue;js=Kp.metrics}di=(fi-_n.scale)*ui}Ws?(Jt.verticalizable=!0,eo.push({glyph:Bi,imageName:ba,x:ir,y:cr+di,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:va}),ir+=Dl*_n.scale+ze):(eo.push({glyph:Bi,imageName:ba,x:ir,y:cr+di,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:va}),ir+=js.advance*_n.scale+ze)}eo.length!==0&&(ci=Math.max(ir-ze,ci),nL(eo,0,eo.length-1,go,zo)),ir=0;const Fo=ue*fi+zo;vo.lineOffset=Math.max(zo,to),cr+=Fo,ns=Math.max(Fo,ns),++$r}var Mi;const Fi=cr-jp,{horizontalAlign:yo,verticalAlign:_o}=T_(Ee);(function(hi,fi,to,vo,eo,zo,Fo,pi,_n){const no=(fi-to)*eo;let Bi=0;Bi=zo!==Fo?-pi*vo-jp:(-vo*_n+.5)*Fo;for(const di of hi)for(const js of di.positionedGlyphs)js.x+=no,js.y+=Bi})(Jt.positionedLines,go,yo,_o,ci,ns,ue,Fi,ye.length),Jt.top+=-_o*Fi,Jt.bottom=Jt.top+Fi,Jt.left+=-yo*ci,Jt.right=Jt.left+ci}(Yt,o,c,p,pt,x,E,L,O,A,U,tt),!function(Jt){for(const be of Jt)if(be.positionedGlyphs.length!==0)return!1;return!0}(Et)&&Yt}const Ym={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},tL={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 ub(l,o,c,p,y,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ui/b+y:0}{const x=c[o.fontStack],E=x&&x[l];return E?E.metrics.advance*o.scale+y:0}}function cb(l,o,c,p){const y=Math.pow(l-o,2);return p?l=0;let R=0;for(let U=0;Ux.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=l_([]),this.placementViewportMatrix=l_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=db(this.zoom,c["text-size"]),this.iconSizeData=db(this.zoom,c["icon-size"]);const p=this.layers[0].layout,y=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=L_(p,"text-overlap","text-allow-overlap")!=="never"||L_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>h.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new M_(new yr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new M_(new yr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new m,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,c,p,y,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),R=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!R)return;const U=c.iconDependencies,W=c.glyphDependencies,K=c.availableImages,tt=new lr(this.zoom);for(const{feature:at,id:pt,index:Mt,sourceLayerIndex:yt}of o){const Et=y._featureFilter.needGeometry,Yt=Al(at,Et);if(!y._featureFilter.filter(tt,Yt,p))continue;let Jt,be;if(Et||(Yt.geometry=Ml(at)),A){const ve=y.getValueAndResolveTokens("text-field",Yt,p,K),ye=Ao.factory(ve),ue=this.hasRTLText=this.hasRTLText||sL(ye);(!ue||Wa.getRTLTextPluginStatus()==="unavailable"||ue&&Wa.isParsed())&&(Jt=UT(ye,y,Yt))}if(R){const ve=y.getValueAndResolveTokens("icon-image",Yt,p,K);be=ve instanceof $o?ve:$o.fromString(ve)}if(!Jt&&!be)continue;const Ce=this.sortFeaturesByKey?O.evaluate(Yt,{},p):void 0;if(this.features.push({id:pt,text:Jt,icon:be,index:Mt,sourceLayerIndex:yt,geometry:Yt.geometry,properties:at.properties,type:iL[at.type],sortKey:Ce}),be&&(U[be.name]=!0),Jt){const ve=x.evaluate(Yt,{},p).join(","),ye=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.ah.vertical)>=0;for(const ue of Jt.sections)if(ue.image)U[ue.image.name]=!0;else{const Ee=du(Jt.toString()),de=ue.fontStack||ve,ne=W[de]=W[de]||{};this.calculateGlyphDependencies(ue.text,ne,ye,this.allowVerticalPlacement,Ee)}}}b.get("symbol-placement")==="line"&&(this.features=function(at){const pt={},Mt={},yt=[];let Et=0;function Yt(ve){yt.push(at[ve]),Et++}function Jt(ve,ye,ue){const Ee=Mt[ve];return delete Mt[ve],Mt[ye]=Ee,yt[Ee].geometry[0].pop(),yt[Ee].geometry[0]=yt[Ee].geometry[0].concat(ue[0]),Ee}function be(ve,ye,ue){const Ee=pt[ye];return delete pt[ye],pt[ve]=Ee,yt[Ee].geometry[0].shift(),yt[Ee].geometry[0]=ue[0].concat(yt[Ee].geometry[0]),Ee}function Ce(ve,ye,ue){const Ee=ue?ye[0][ye[0].length-1]:ye[0][0];return`${ve}:${Ee.x}:${Ee.y}`}for(let ve=0;veve.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((at,pt)=>at.sortKey-pt.sortKey)}update(o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,p))}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 p=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(c[o.segment+1]),b=o.dist(c[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=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 p=o.placedSymbolArray.get(c),y=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;by[E]-y[L]||b[L]-b[E]),x}addToSortKeyRanges(o,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.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 p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((y,b,x)=>{y>=0&&x.indexOf(y)===b&&this.addIndicesForPlacedSymbol(this.text,y)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let mb,gb;Se("SymbolBucket",jh,{omit:["layers","collisionBoxArray","features","compareText"]}),jh.MAX_GLYPHS=65535,jh.addDynamicAttributes=P_;var k_={get paint(){return gb=gb||new po({"icon-opacity":new Fe(Nt.paint_symbol["icon-opacity"]),"icon-color":new Fe(Nt.paint_symbol["icon-color"]),"icon-halo-color":new Fe(Nt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Fe(Nt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Fe(Nt.paint_symbol["icon-halo-blur"]),"icon-translate":new Ae(Nt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ae(Nt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Fe(Nt.paint_symbol["text-opacity"]),"text-color":new Fe(Nt.paint_symbol["text-color"],{runtimeType:Dr,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Fe(Nt.paint_symbol["text-halo-color"]),"text-halo-width":new Fe(Nt.paint_symbol["text-halo-width"]),"text-halo-blur":new Fe(Nt.paint_symbol["text-halo-blur"]),"text-translate":new Ae(Nt.paint_symbol["text-translate"]),"text-translate-anchor":new Ae(Nt.paint_symbol["text-translate-anchor"])})},get layout(){return mb=mb||new po({"symbol-placement":new Ae(Nt.layout_symbol["symbol-placement"]),"symbol-spacing":new Ae(Nt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ae(Nt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Fe(Nt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ae(Nt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ae(Nt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ae(Nt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ae(Nt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ae(Nt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ae(Nt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Fe(Nt.layout_symbol["icon-size"]),"icon-text-fit":new Ae(Nt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ae(Nt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Fe(Nt.layout_symbol["icon-image"]),"icon-rotate":new Fe(Nt.layout_symbol["icon-rotate"]),"icon-padding":new Fe(Nt.layout_symbol["icon-padding"]),"icon-keep-upright":new Ae(Nt.layout_symbol["icon-keep-upright"]),"icon-offset":new Fe(Nt.layout_symbol["icon-offset"]),"icon-anchor":new Fe(Nt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ae(Nt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ae(Nt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ae(Nt.layout_symbol["text-rotation-alignment"]),"text-field":new Fe(Nt.layout_symbol["text-field"]),"text-font":new Fe(Nt.layout_symbol["text-font"]),"text-size":new Fe(Nt.layout_symbol["text-size"]),"text-max-width":new Fe(Nt.layout_symbol["text-max-width"]),"text-line-height":new Ae(Nt.layout_symbol["text-line-height"]),"text-letter-spacing":new Fe(Nt.layout_symbol["text-letter-spacing"]),"text-justify":new Fe(Nt.layout_symbol["text-justify"]),"text-radial-offset":new Fe(Nt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ae(Nt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Fe(Nt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Fe(Nt.layout_symbol["text-anchor"]),"text-max-angle":new Ae(Nt.layout_symbol["text-max-angle"]),"text-writing-mode":new Ae(Nt.layout_symbol["text-writing-mode"]),"text-rotate":new Fe(Nt.layout_symbol["text-rotate"]),"text-padding":new Ae(Nt.layout_symbol["text-padding"]),"text-keep-upright":new Ae(Nt.layout_symbol["text-keep-upright"]),"text-transform":new Fe(Nt.layout_symbol["text-transform"]),"text-offset":new Fe(Nt.layout_symbol["text-offset"]),"text-allow-overlap":new Ae(Nt.layout_symbol["text-allow-overlap"]),"text-overlap":new Ae(Nt.layout_symbol["text-overlap"]),"text-ignore-placement":new Ae(Nt.layout_symbol["text-ignore-placement"]),"text-optional":new Ae(Nt.layout_symbol["text-optional"])})}};class yb{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:Zr,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}}Se("FormatSectionOverride",yb,{omit:["defaultValue"]});class Jm extends _s{constructor(o){super(o,k_)}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 p=this.layout.get("text-writing-mode");if(p){const y=[];for(const b of p)y.indexOf(b)<0&&y.push(b);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,p,y){const b=this.layout.get(o).evaluate(c,{},p,y),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||Qn(x.value)||!b?b:function(E,L){return L.replace(/{([^{}]+)}/g,(A,R)=>E&&R in E?String(E[R]):"")}(c.properties,b)}createBucket(o){return new jh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of k_.paint.overridableProperties){if(!Jm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),p=new yb(c),y=new rr(p,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new ph("source",y):new up("composite",y,c.value.zoomStops),this.paint._values[o]=new ys(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&Jm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const p=o.get("text-field"),y=k_.paint.properties[c];let b=!1;const x=E=>{for(const L of E)if(y.overrides&&y.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ao)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Va&&Yr(A.value)===Fr?x(A.value.sections):A instanceof hh?x(A.sections):A.eachChild(E))},L=p.value;L._styleExpression&&E(L._styleExpression.expression)}return b}}let _b;var aL={get paint(){return _b=_b||new po({"background-color":new Ae(Nt.paint_background["background-color"]),"background-pattern":new cc(Nt.paint_background["background-pattern"]),"background-opacity":new Ae(Nt.paint_background["background-opacity"])})}};class lL extends _s{constructor(o){super(o,aL)}}let vb;var uL={get paint(){return vb=vb||new po({"raster-opacity":new Ae(Nt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ae(Nt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ae(Nt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ae(Nt.paint_raster["raster-brightness-max"]),"raster-saturation":new Ae(Nt.paint_raster["raster-saturation"]),"raster-contrast":new Ae(Nt.paint_raster["raster-contrast"]),"raster-resampling":new Ae(Nt.paint_raster["raster-resampling"]),"raster-fade-duration":new Ae(Nt.paint_raster["raster-fade-duration"])})}};class cL extends _s{constructor(o){super(o,uL)}}class hL extends _s{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 fL{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const D_=63710088e-1;class vu{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 vu(_t(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,p=this.lat*c,y=o.lat*c,b=Math.sin(p)*Math.sin(y)+Math.cos(p)*Math.cos(y)*Math.cos((o.lng-this.lng)*c);return D_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof vu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new vu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new vu(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 bb=2*Math.PI*D_;function xb(l){return bb*Math.cos(l*Math.PI/180)}function wb(l){return(180+l)/360}function Sb(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function Eb(l,o){return l/xb(o)}function R_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class Qm{constructor(o,c,p=0){this.x=+o,this.y=+c,this.z=+p}static fromLngLat(o,c=0){const p=vu.convert(o);return new Qm(wb(p.lng),Sb(p.lat),Eb(c,p.lat))}toLngLat(){return new vu(360*this.x-180,R_(this.y))}toAltitude(){return this.z*xb(R_(this.y))}meterInMercatorCoordinateUnits(){return 1/bb*(o=R_(this.y),1/Math.cos(o*Math.PI/180));var o}}function Ib(l,o,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[l*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class N_{constructor(o,c,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${p}, 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=p,this.key=Zp(0,o,o,c,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,p){const y=(x=this.y,E=this.z,L=Ib(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=Ib(256*(b+1),256*(x+1),E),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,E,L,A;const R=function(O,U,W){let K,tt="";for(let at=O;at>0;at--)K=1<1?"@2x":"").replace(/{quadkey}/g,R).replace(/{bbox-epsg-3857}/g,y)}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 I((o.x*c-this.x)*Rr,(o.y*c-this.y)*Rr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Cb{constructor(o,c){this.wrap=o,this.canonical=c,this.key=Zp(o,c.z,c.z,c.x,c.y)}}class bs{constructor(o,c,p,y,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=c,this.canonical=new N_(p,+y,+b),this.key=Zp(c,o,p,y,b)}clone(){return new bs(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 bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(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 p=this.canonical.z-o;return o>this.canonical.z?Zp(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):Zp(this.wrap*+c,o,o,this.canonical.x>>p,this.canonical.y>>p)}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 bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,y=2*this.canonical.y;return[new bs(c,this.wrap,c,p,y),new bs(c,this.wrap,c,p+1,y),new bs(c,this.wrap,c,p,y+1),new bs(c,this.wrap,c,p+1,y+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=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,p){return o*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=c*this.dim,b=c*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:y=b-1;break;case 1:b=y+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const L=-c*this.dim,A=-p*this.dim;for(let R=x;R=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 Pb{constructor(o,c,p,y,b){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=p,o._y=y,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(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 Mb{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new ac(Rr,16,0),this.grid3D=new ac(Rr,16,0),this.featureIndexArray=new z,this.promoteId=c}insert(o,c,p,y,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,y,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&L.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new gu.VectorTile(new S_(this.rawTileData)).layers,this.sourceLayerCoder=new Lb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,p,y){this.loadVTLayers();const b=o.params||{},x=Rr/o.tileSize/o.scale,E=yh(b.filter),L=o.queryGeometry,A=o.queryPadding*x,R=kb(L),O=this.grid.query(R.minX-A,R.minY-A,R.maxX+A,R.maxY+A),U=kb(o.cameraQueryGeometry),W=this.grid3D.query(U.minX-A,U.minY-A,U.maxX+A,U.maxY+A,(at,pt,Mt,yt)=>function(Et,Yt,Jt,be,Ce){for(const ye of Et)if(Yt<=ye.x&&Jt<=ye.y&&be>=ye.x&&Ce>=ye.y)return!0;const ve=[new I(Yt,Jt),new I(Yt,Ce),new I(be,Ce),new I(be,Jt)];if(Et.length>2){for(const ye of ve)if(zh(Et,ye))return!0}for(let ye=0;ye(yt||(yt=Ml(Et)),Yt.queryIntersectsFeature(L,Et,Jt,yt,this.z,o.transform,x,o.pixelPosMatrix)))}return K}loadMatchingFeature(o,c,p,y,b,x,E,L,A,R,O){const U=this.bucketLayerIDs[c];if(x&&!function(at,pt){for(let Mt=0;Mt=0)return!0;return!1}(x,U))return;const W=this.sourceLayerCoder.decode(p),K=this.vtLayers[W].feature(y);if(b.needGeometry){const at=Al(K,!0);if(!b.filter(new lr(this.tileID.overscaledZ),at,this.tileID.canonical))return}else if(!b.filter(new lr(this.tileID.overscaledZ),K))return;const tt=this.getId(K,W);for(let at=0;at{const E=o instanceof uc?o.get(x):null;return E&&E.evaluate?E.evaluate(c,p,y):E})}function kb(l){let o=1/0,c=1/0,p=-1/0,y=-1/0;for(const b of l)o=Math.min(o,b.x),c=Math.min(c,b.y),p=Math.max(p,b.x),y=Math.max(y,b.y);return{minX:o,minY:c,maxX:p,maxY:y}}function pL(l,o){return o-l}function Db(l,o,c,p,y){const b=[];for(let x=0;x=p&&O.x>=p||(R.x>=p?R=new I(p,R.y+(p-R.x)/(O.x-R.x)*(O.y-R.y))._round():O.x>=p&&(O=new I(p,R.y+(p-R.x)/(O.x-R.x)*(O.y-R.y))._round()),R.y>=y&&O.y>=y||(R.y>=y?R=new I(R.x+(y-R.y)/(O.y-R.y)*(O.x-R.x),y)._round():O.y>=y&&(O=new I(R.x+(y-R.y)/(O.y-R.y)*(O.x-R.x),y)._round()),L&&R.equals(L[L.length-1])||(L=[R],b.push(L)),L.push(O)))))}}return b}Se("FeatureIndex",Mb,{omit:["rawTileData","sourceLayerCoder"]});class bu extends I{constructor(o,c,p,y){super(o,c),this.angle=p,y!==void 0&&(this.segment=y)}clone(){return new bu(this.x,this.y,this.angle,this.segment)}}function Rb(l,o,c,p,y){if(o.segment===void 0||c===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-c/2;){if(x--,x<0)return!1;E-=l[x].dist(b),b=l[x]}E+=l[x].dist(l[x+1]),x++;const L=[];let A=0;for(;Ep;)A-=L.shift().angleDelta;if(A>y)return!1;x++,E+=R.dist(O)}return!0}function Nb(l){let o=0;for(let c=0;cA){const K=(A-L)/W,tt=Qi.number(O.x,U.x,K),at=Qi.number(O.y,U.y,K),pt=new bu(tt,at,U.angleTo(O),R);return pt._round(),!x||Rb(l,pt,E,x,o)?pt:void 0}L+=W}}function mL(l,o,c,p,y,b,x,E,L){const A=Ob(p,b,x),R=zb(p,y),O=R*x,U=l[0].x===0||l[0].x===L||l[0].y===0||l[0].y===L;return o-O=0&&Et=0&&Yt=0&&U+A<=R){const Jt=new bu(Et,Yt,Mt,K);Jt._round(),p&&!Rb(l,Jt,b,p,y)||W.push(Jt)}}O+=pt}return E||W.length||x||(W=Fb(l,O/2,c,p,y,b,x,!0,L)),W}Se("Anchor",bu);const Wh=Oo;function Bb(l,o,c,p){const y=[],b=l.image,x=b.pixelRatio,E=b.paddedRect.w-2*Wh,L=b.paddedRect.h-2*Wh,A=l.right-l.left,R=l.bottom-l.top,O=b.stretchX||[[0,E]],U=b.stretchY||[[0,L]],W=(ue,Ee)=>ue+Ee[1]-Ee[0],K=O.reduce(W,0),tt=U.reduce(W,0),at=E-K,pt=L-tt;let Mt=0,yt=K,Et=0,Yt=tt,Jt=0,be=at,Ce=0,ve=pt;if(b.content&&p){const ue=b.content;Mt=$m(O,0,ue[0]),Et=$m(U,0,ue[1]),yt=$m(O,ue[0],ue[2]),Yt=$m(U,ue[1],ue[3]),Jt=ue[0]-Mt,Ce=ue[1]-Et,be=ue[2]-ue[0]-yt,ve=ue[3]-ue[1]-Yt}const ye=(ue,Ee,de,ne)=>{const ze=tg(ue.stretch-Mt,yt,A,l.left),Le=eg(ue.fixed-Jt,be,ue.stretch,K),pn=tg(Ee.stretch-Et,Yt,R,l.top),ir=eg(Ee.fixed-Ce,ve,Ee.stretch,tt),cr=tg(de.stretch-Mt,yt,A,l.left),ci=eg(de.fixed-Jt,be,de.stretch,K),ns=tg(ne.stretch-Et,Yt,R,l.top),go=eg(ne.fixed-Ce,ve,ne.stretch,tt),$r=new I(ze,pn),Mi=new I(cr,pn),Fi=new I(cr,ns),yo=new I(ze,ns),_o=new I(Le/x,ir/x),hi=new I(ci/x,go/x),fi=o*Math.PI/180;if(fi){const eo=Math.sin(fi),zo=Math.cos(fi),Fo=[zo,-eo,eo,zo];$r._matMult(Fo),Mi._matMult(Fo),yo._matMult(Fo),Fi._matMult(Fo)}const to=ue.stretch+ue.fixed,vo=Ee.stretch+Ee.fixed;return{tl:$r,tr:Mi,bl:yo,br:Fi,tex:{x:b.paddedRect.x+Wh+to,y:b.paddedRect.y+Wh+vo,w:de.stretch+de.fixed-to,h:ne.stretch+ne.fixed-vo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:_o,pixelOffsetBR:hi,minFontScaleX:be/x/A,minFontScaleY:ve/x/R,isSDF:c}};if(p&&(b.stretchX||b.stretchY)){const ue=Vb(O,at,K),Ee=Vb(U,pt,tt);for(let de=0;de0&&(K=Math.max(10,K),this.circleDiameter=K)}else{let O=x.top*E-L[0],U=x.bottom*E+L[2],W=x.left*E-L[3],K=x.right*E+L[1];const tt=x.collisionPadding;if(tt&&(W-=tt[0]*E,O-=tt[1]*E,K+=tt[2]*E,U+=tt[3]*E),R){const at=new I(W,O),pt=new I(K,O),Mt=new I(W,U),yt=new I(K,U),Et=R*Math.PI/180;at._rotate(Et),pt._rotate(Et),Mt._rotate(Et),yt._rotate(Et),W=Math.min(at.x,pt.x,Mt.x,yt.x),K=Math.max(at.x,pt.x,Mt.x,yt.x),O=Math.min(at.y,pt.y,Mt.y,yt.y),U=Math.max(at.y,pt.y,Mt.y,yt.y)}o.emplaceBack(c.x,c.y,W,O,K,U,p,y,b)}this.boxEndIndex=o.length}}class gL{constructor(o=[],c=yL){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}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:p}=this,y=c[o];for(;o>0;){const b=o-1>>1,x=c[b];if(p(y,x)>=0)break;c[o]=x,o=b}c[o]=y}_down(o){const{data:c,compare:p}=this,y=this.length>>1,b=c[o];for(;o=0)break;c[o]=E,o=x}c[o]=b}}function yL(l,o){return lo?1:0}function _L(l,o=1,c=!1){let p=1/0,y=1/0,b=-1/0,x=-1/0;const E=l[0];for(let W=0;Wb)&&(b=K.x),(!W||K.y>x)&&(x=K.y)}const L=Math.min(b-p,x-y);let A=L/2;const R=new gL([],vL);if(L===0)return new I(p,y);for(let W=p;WO.d||!O.d)&&(O=W,c&&console.log("found best %d after %d probes",Math.round(1e4*W.d)/1e4,U)),W.max-O.d<=o||(A=W.h/2,R.push(new Hh(W.p.x-A,W.p.y-A,A,l)),R.push(new Hh(W.p.x+A,W.p.y-A,A,l)),R.push(new Hh(W.p.x-A,W.p.y+A,A,l)),R.push(new Hh(W.p.x+A,W.p.y+A,A,l)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${O.d}`)),O.p}function vL(l,o){return o.max-l.max}function Hh(l,o,c,p){this.p=new I(l,o),this.h=c,this.d=function(y,b){let x=!1,E=1/0;for(let L=0;Ly.y!=K.y>y.y&&y.x<(K.x-W.x)*(y.y-W.y)/(K.y-W.y)+W.x&&(x=!x),E=Math.min(E,S1(y,W,K))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var zi;h.ap=void 0,(zi=h.ap||(h.ap={}))[zi.center=1]="center",zi[zi.left=2]="left",zi[zi.right=3]="right",zi[zi.top=4]="top",zi[zi.bottom=5]="bottom",zi[zi["top-left"]=6]="top-left",zi[zi["top-right"]=7]="top-right",zi[zi["bottom-left"]=8]="bottom-left",zi[zi["bottom-right"]=9]="bottom-right";const xu=7,O_=Number.POSITIVE_INFINITY;function Ub(l,o){return o[1]!==O_?function(c,p,y){let b=0,x=0;switch(p=Math.abs(p),y=Math.abs(y),c){case"top-right":case"top-left":case"top":x=y-xu;break;case"bottom-right":case"bottom-left":case"bottom":x=-y+xu}switch(c){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(l,o[0],o[1]):function(c,p){let y=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(c){case"top-right":case"top-left":b=x-xu;break;case"bottom-right":case"bottom-left":b=-x+xu;break;case"bottom":b=-p+xu;break;case"top":b=p-xu}switch(c){case"top-right":case"bottom-right":y=-x;break;case"top-left":case"bottom-left":y=x;break;case"left":y=p;break;case"right":y=-p}return[y,b]}(l,o[0])}function Gb(l,o,c){var p;const y=l.layout,b=(p=y.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},c);if(b){const E=b.values,L=[];for(let A=0;AU*ui);R.startsWith("top")?O[1]-=xu:R.startsWith("bottom")&&(O[1]+=xu),L[A+1]=O}return new Qo(L)}const x=y.get("text-variable-anchor");if(x){let E;E=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},c)*ui,O_]:y.get("text-offset").evaluate(o,{},c).map(A=>A*ui);const L=[];for(const A of x)L.push(A,Ub(A,E));return new Qo(L)}return null}function z_(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 bL(l,o,c,p,y,b,x,E,L,A,R){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const U=l.layers[0].layout,W=U.get("icon-offset").evaluate(o,{},R),K=jb(c.horizontal),tt=x/24,at=l.tilePixelRatio*tt,pt=l.tilePixelRatio*O/24,Mt=l.tilePixelRatio*E,yt=l.tilePixelRatio*U.get("symbol-spacing"),Et=U.get("text-padding")*l.tilePixelRatio,Yt=function(ne,ze,Le,pn=1){const ir=ne.get("icon-padding").evaluate(ze,{},Le),cr=ir&&ir.values;return[cr[0]*pn,cr[1]*pn,cr[2]*pn,cr[3]*pn]}(U,o,R,l.tilePixelRatio),Jt=U.get("text-max-angle")/180*Math.PI,be=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Ce=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",ve=U.get("symbol-placement"),ye=yt/2,ue=U.get("icon-text-fit");let Ee;p&&ue!=="none"&&(l.allowVerticalPlacement&&c.vertical&&(Ee=pb(p,c.vertical,ue,U.get("icon-text-fit-padding"),W,tt)),K&&(p=pb(p,K,ue,U.get("icon-text-fit-padding"),W,tt)));const de=(ne,ze)=>{ze.x<0||ze.x>=Rr||ze.y<0||ze.y>=Rr||function(Le,pn,ir,cr,ci,ns,go,$r,Mi,Fi,yo,_o,hi,fi,to,vo,eo,zo,Fo,pi,_n,no,Bi,di,js){const va=Le.addToLineVertexArray(pn,ir);let ba,Dl,Ws,xs,Bo=0,Rl=0,Kp=0,Xb=0,W_=-1,H_=-1;const Nl={};let Yb=Cr("");if(Le.allowVerticalPlacement&&cr.vertical){const ro=$r.layout.get("text-rotate").evaluate(_n,{},di)+90;Ws=new ng(Mi,pn,Fi,yo,_o,cr.vertical,hi,fi,to,ro),go&&(xs=new ng(Mi,pn,Fi,yo,_o,go,eo,zo,to,ro))}if(ci){const ro=$r.layout.get("icon-rotate").evaluate(_n,{}),ws=$r.layout.get("icon-text-fit")!=="none",_c=Bb(ci,ro,Bi,ws),wa=go?Bb(go,ro,Bi,ws):void 0;Dl=new ng(Mi,pn,Fi,yo,_o,ci,eo,zo,!1,ro),Bo=4*_c.length;const vc=Le.iconSizeData;let Ka=null;vc.kind==="source"?(Ka=[Ya*$r.layout.get("icon-size").evaluate(_n,{})],Ka[0]>_u&&Kt(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Hp}. Reduce your "icon-size".`)):vc.kind==="composite"&&(Ka=[Ya*no.compositeIconSizes[0].evaluate(_n,{},di),Ya*no.compositeIconSizes[1].evaluate(_n,{},di)],(Ka[0]>_u||Ka[1]>_u)&&Kt(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Hp}. Reduce your "icon-size".`)),Le.addSymbols(Le.icon,_c,Ka,pi,Fo,_n,h.ah.none,pn,va.lineStartIndex,va.lineLength,-1,di),W_=Le.icon.placedSymbolArray.length-1,wa&&(Rl=4*wa.length,Le.addSymbols(Le.icon,wa,Ka,pi,Fo,_n,h.ah.vertical,pn,va.lineStartIndex,va.lineLength,-1,di),H_=Le.icon.placedSymbolArray.length-1)}const Kb=Object.keys(cr.horizontal);for(const ro of Kb){const ws=cr.horizontal[ro];if(!ba){Yb=Cr(ws.text);const wa=$r.layout.get("text-rotate").evaluate(_n,{},di);ba=new ng(Mi,pn,Fi,yo,_o,ws,hi,fi,to,wa)}const _c=ws.positionedLines.length===1;if(Kp+=qb(Le,pn,ws,ns,$r,to,_n,vo,va,cr.vertical?h.ah.horizontal:h.ah.horizontalOnly,_c?Kb:[ro],Nl,W_,no,di),_c)break}cr.vertical&&(Xb+=qb(Le,pn,cr.vertical,ns,$r,to,_n,vo,va,h.ah.vertical,["vertical"],Nl,H_,no,di));const SL=ba?ba.boxStartIndex:Le.collisionBoxArray.length,EL=ba?ba.boxEndIndex:Le.collisionBoxArray.length,IL=Ws?Ws.boxStartIndex:Le.collisionBoxArray.length,CL=Ws?Ws.boxEndIndex:Le.collisionBoxArray.length,TL=Dl?Dl.boxStartIndex:Le.collisionBoxArray.length,LL=Dl?Dl.boxEndIndex:Le.collisionBoxArray.length,PL=xs?xs.boxStartIndex:Le.collisionBoxArray.length,ML=xs?xs.boxEndIndex:Le.collisionBoxArray.length;let xa=-1;const ig=(ro,ws)=>ro&&ro.circleDiameter?Math.max(ro.circleDiameter,ws):ws;xa=ig(ba,xa),xa=ig(Ws,xa),xa=ig(Dl,xa),xa=ig(xs,xa);const Jb=xa>-1?1:0;Jb&&(xa*=js/ui),Le.glyphOffsetArray.length>=jh.MAX_GLYPHS&&Kt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_n.sortKey!==void 0&&Le.addToSortKeyRanges(Le.symbolInstances.length,_n.sortKey);const AL=Gb($r,_n,di),[kL,DL]=function(ro,ws){const _c=ro.length,wa=ws==null?void 0:ws.values;if((wa==null?void 0:wa.length)>0)for(let vc=0;vc=0?Nl.right:-1,Nl.center>=0?Nl.center:-1,Nl.left>=0?Nl.left:-1,Nl.vertical||-1,W_,H_,Yb,SL,EL,IL,CL,TL,LL,PL,ML,Fi,Kp,Xb,Bo,Rl,Jb,0,hi,xa,kL,DL)}(l,ze,ne,c,p,y,Ee,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,at,[Et,Et,Et,Et],be,L,Mt,Yt,Ce,W,o,b,A,R,x)};if(ve==="line")for(const ne of Db(o.geometry,0,0,Rr,Rr)){const ze=mL(ne,yt,Jt,c.vertical||K,p,24,pt,l.overscaling,Rr);for(const Le of ze)K&&xL(l,K.text,ye,Le)||de(ne,Le)}else if(ve==="line-center"){for(const ne of o.geometry)if(ne.length>1){const ze=dL(ne,Jt,c.vertical||K,p,24,pt);ze&&de(ne,ze)}}else if(o.type==="Polygon")for(const ne of m_(o.geometry,0)){const ze=_L(ne,16);de(ne[0],new bu(ze.x,ze.y,0))}else if(o.type==="LineString")for(const ne of o.geometry)de(ne,new bu(ne[0].x,ne[0].y,0));else if(o.type==="Point")for(const ne of o.geometry)for(const ze of ne)de([ze],new bu(ze.x,ze.y,0))}function qb(l,o,c,p,y,b,x,E,L,A,R,O,U,W,K){const tt=function(Mt,yt,Et,Yt,Jt,be,Ce,ve){const ye=Yt.layout.get("text-rotate").evaluate(be,{})*Math.PI/180,ue=[];for(const Ee of yt.positionedLines)for(const de of Ee.positionedGlyphs){if(!de.rect)continue;const ne=de.rect||{};let ze=sb+1,Le=!0,pn=1,ir=0;const cr=(Jt||ve)&&de.vertical,ci=de.metrics.advance*de.scale/2;if(ve&&yt.verticalizable&&(ir=Ee.lineOffset/2-(de.imageName?-(ui-de.metrics.width*de.scale)/2:(de.scale-1)*ui)),de.imageName){const pi=Ce[de.imageName];Le=pi.sdf,pn=pi.pixelRatio,ze=Oo/pn}const ns=Jt?[de.x+ci,de.y]:[0,0];let go=Jt?[0,0]:[de.x+ci+Et[0],de.y+Et[1]-ir],$r=[0,0];cr&&($r=go,go=[0,0]);const Mi=de.metrics.isDoubleResolution?2:1,Fi=(de.metrics.left-ze)*de.scale-ci+go[0],yo=(-de.metrics.top-ze)*de.scale+go[1],_o=Fi+ne.w/Mi*de.scale/pn,hi=yo+ne.h/Mi*de.scale/pn,fi=new I(Fi,yo),to=new I(_o,yo),vo=new I(Fi,hi),eo=new I(_o,hi);if(cr){const pi=new I(-ci,ci-jp),_n=-Math.PI/2,no=ui/2-ci,Bi=new I(5-jp-no,-(de.imageName?no:0)),di=new I(...$r);fi._rotateAround(_n,pi)._add(Bi)._add(di),to._rotateAround(_n,pi)._add(Bi)._add(di),vo._rotateAround(_n,pi)._add(Bi)._add(di),eo._rotateAround(_n,pi)._add(Bi)._add(di)}if(ye){const pi=Math.sin(ye),_n=Math.cos(ye),no=[_n,-pi,pi,_n];fi._matMult(no),to._matMult(no),vo._matMult(no),eo._matMult(no)}const zo=new I(0,0),Fo=new I(0,0);ue.push({tl:fi,tr:to,bl:vo,br:eo,tex:ne,writingMode:yt.writingMode,glyphOffset:ns,sectionIndex:de.sectionIndex,isSDF:Le,pixelOffsetTL:zo,pixelOffsetBR:Fo,minFontScaleX:0,minFontScaleY:0})}return ue}(0,c,E,y,b,x,p,l.allowVerticalPlacement),at=l.textSizeData;let pt=null;at.kind==="source"?(pt=[Ya*y.layout.get("text-size").evaluate(x,{})],pt[0]>_u&&Kt(`${l.layerIds[0]}: Value for "text-size" is >= ${Hp}. Reduce your "text-size".`)):at.kind==="composite"&&(pt=[Ya*W.compositeTextSizes[0].evaluate(x,{},K),Ya*W.compositeTextSizes[1].evaluate(x,{},K)],(pt[0]>_u||pt[1]>_u)&&Kt(`${l.layerIds[0]}: Value for "text-size" is >= ${Hp}. Reduce your "text-size".`)),l.addSymbols(l.text,tt,pt,E,b,x,A,o,L.lineStartIndex,L.lineLength,U,K);for(const Mt of R)O[Mt]=l.text.placedSymbolArray.length-1;return 4*tt.length}function jb(l){for(const o in l)return l[o];return null}function xL(l,o,c,p){const y=l.compareText;if(o in y){const b=y[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const b=Wb[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new F_(E,x,b,o)}constructor(o,c=64,p=Float64Array,y){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=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=Wb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=c,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return B_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,p,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const R=L.pop()||0,O=L.pop()||0,U=L.pop()||0;if(O-U<=E){for(let at=U;at<=O;at++){const pt=x[2*at],Mt=x[2*at+1];pt>=o&&pt<=p&&Mt>=c&&Mt<=y&&A.push(b[at])}continue}const W=U+O>>1,K=x[2*W],tt=x[2*W+1];K>=o&&K<=p&&tt>=c&&tt<=y&&A.push(b[W]),(R===0?o<=K:c<=tt)&&(L.push(U),L.push(W-1),L.push(1-R)),(R===0?p>=K:y>=tt)&&(L.push(W+1),L.push(O),L.push(1-R))}return A}within(o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:b,nodeSize:x}=this,E=[0,y.length-1,0],L=[],A=p*p;for(;E.length;){const R=E.pop()||0,O=E.pop()||0,U=E.pop()||0;if(O-U<=x){for(let at=U;at<=O;at++)Zb(b[2*at],b[2*at+1],o,c)<=A&&L.push(y[at]);continue}const W=U+O>>1,K=b[2*W],tt=b[2*W+1];Zb(K,tt,o,c)<=A&&L.push(y[W]),(R===0?o-p<=K:c-p<=tt)&&(E.push(U),E.push(W-1),E.push(1-R)),(R===0?o+p>=K:c+p>=tt)&&(E.push(W+1),E.push(O),E.push(1-R))}return L}}function B_(l,o,c,p,y,b){if(y-p<=c)return;const x=p+y>>1;Hb(l,o,x,p,y,b),B_(l,o,c,p,x-1,1-b),B_(l,o,c,x+1,y,1-b)}function Hb(l,o,c,p,y,b){for(;y>p;){if(y-p>600){const A=y-p+1,R=c-p+1,O=Math.log(A),U=.5*Math.exp(2*O/3),W=.5*Math.sqrt(O*U*(A-U)/A)*(R-A/2<0?-1:1);Hb(l,o,c,Math.max(p,Math.floor(c-R*U/A+W)),Math.min(y,Math.floor(c+(A-R)*U/A+W)),b)}const x=o[2*c+b];let E=p,L=y;for(Xp(l,o,p,c),o[2*y+b]>x&&Xp(l,o,p,y);Ex;)L--}o[2*p+b]===x?Xp(l,o,p,L):(L++,Xp(l,o,L,y)),L<=c&&(p=L+1),c<=L&&(y=L-1)}}function Xp(l,o,c,p){V_(l,c,p),V_(o,2*c,2*p),V_(o,2*c+1,2*p+1)}function V_(l,o,c){const p=l[o];l[o]=l[c],l[c]=p}function Zb(l,o,c,p){const y=l-c,b=o-p;return y*y+b*b}var U_;h.bd=void 0,(U_=h.bd||(h.bd={})).create="create",U_.load="load",U_.fullLoad="fullLoad";let rg=null,Yp=[];const G_=1e3/60,q_="loadTime",j_="fullLoadTime",wL={mark(l){performance.mark(l)},frame(l){const o=l;rg!=null&&Yp.push(o-rg),rg=o},clearMetrics(){rg=null,Yp=[],performance.clearMeasures(q_),performance.clearMeasures(j_);for(const l in h.bd)performance.clearMarks(h.bd[l])},getPerformanceMetrics(){performance.measure(q_,h.bd.create,h.bd.load),performance.measure(j_,h.bd.create,h.bd.fullLoad);const l=performance.getEntriesByName(q_)[0].duration,o=performance.getEntriesByName(j_)[0].duration,c=Yp.length,p=1/(Yp.reduce((b,x)=>b+x,0)/c/1e3),y=Yp.filter(b=>b>G_).reduce((b,x)=>b+(x-G_)/G_,0);return{loadTime:l,fullLoadTime:o,fps:p,percentDroppedFrames:y/(c+y)*100,totalFrames:c}}};h.$=he,h.A=Fh,h.B=function(l){if(qt==null){const o=l.navigator?l.navigator.userAgent:null;qt=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return qt},h.C=class{constructor(l,o){this.target=l,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new fL(()=>this.process()),this.subscription=function(c,p,y,b){return c.addEventListener(p,y,!1),{unsubscribe:()=>{c.removeEventListener(p,y,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=ee(self)?l:window}registerMessageHandler(l,o){this.messageHandlers[l]=o}sendAsync(l,o){return new Promise((c,p)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:c,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const E={id:y,type:"",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},l),{id:y,sourceMapId:this.mapId,origin:location.origin,data:fu(l.data,b)});this.target.postMessage(x,{transfer:b})})}receive(l){const o=l.data,c=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[c];const p=this.abortControllers[c];return delete this.abortControllers[c],void(p&&p.abort())}if(ee(self)||o.mustQueue)return this.tasks[c]=o,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,o)}}process(){if(this.taskQueue.length===0)return;const l=this.taskQueue.shift(),o=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(l,o)}processTask(l,o){return u(this,void 0,void 0,function*(){if(o.type===""){const y=this.resolveRejects[l];return delete this.resolveRejects[l],y?void(o.error?y.reject(pu(o.error)):y.resolve(pu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=pu(o.data),p=new AbortController;this.abortControllers[l]=p;try{const y=yield this.messageHandlers[o.type](o.sourceMapId,c,p);this.completeTask(l,null,y)}catch(y){this.completeTask(l,y)}})}completeTask(l,o,c){const p=[];delete this.abortControllers[l];const y={id:l,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?fu(o):null,data:fu(c,p)};this.target.postMessage(y,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},h.D=Ae,h.E=kn,h.F=function(){var l=new Fh(16);return Fh!=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},h.G=An,h.H=function(l,o,c){var p,y,b,x,E,L,A,R,O,U,W,K,tt=c[0],at=c[1],pt=c[2];return o===l?(l[12]=o[0]*tt+o[4]*at+o[8]*pt+o[12],l[13]=o[1]*tt+o[5]*at+o[9]*pt+o[13],l[14]=o[2]*tt+o[6]*at+o[10]*pt+o[14],l[15]=o[3]*tt+o[7]*at+o[11]*pt+o[15]):(y=o[1],b=o[2],x=o[3],E=o[4],L=o[5],A=o[6],R=o[7],O=o[8],U=o[9],W=o[10],K=o[11],l[0]=p=o[0],l[1]=y,l[2]=b,l[3]=x,l[4]=E,l[5]=L,l[6]=A,l[7]=R,l[8]=O,l[9]=U,l[10]=W,l[11]=K,l[12]=p*tt+E*at+O*pt+o[12],l[13]=y*tt+L*at+U*pt+o[13],l[14]=b*tt+A*at+W*pt+o[14],l[15]=x*tt+R*at+K*pt+o[15]),l},h.I=I_,h.J=function(l,o,c){var p=c[0],y=c[1],b=c[2];return l[0]=o[0]*p,l[1]=o[1]*p,l[2]=o[2]*p,l[3]=o[3]*p,l[4]=o[4]*y,l[5]=o[5]*y,l[6]=o[6]*y,l[7]=o[7]*y,l[8]=o[8]*b,l[9]=o[9]*b,l[10]=o[10]*b,l[11]=o[11]*b,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},h.K=T1,h.L=function(l,o){const c={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(c=>{o.onloadstart=()=>{c(o)};for(const p of l){const y=window.document.createElement("source");pr(p)||(o.crossOrigin="Anonymous"),y.src=p,o.appendChild(y)}})},h.a3=function(){return ct++},h.a4=_,h.a5=jh,h.a6=yh,h.a7=Al,h.a8=lr,h.a9=Pb,h.aA=H,h.aB=function(l,o){if(!l)return[{command:"setStyle",args:[o]}];let c=[];try{if(!ln(l.version,o.version))return[{command:"setStyle",args:[o]}];ln(l.center,o.center)||c.push({command:"setCenter",args:[o.center]}),ln(l.zoom,o.zoom)||c.push({command:"setZoom",args:[o.zoom]}),ln(l.bearing,o.bearing)||c.push({command:"setBearing",args:[o.bearing]}),ln(l.pitch,o.pitch)||c.push({command:"setPitch",args:[o.pitch]}),ln(l.sprite,o.sprite)||c.push({command:"setSprite",args:[o.sprite]}),ln(l.glyphs,o.glyphs)||c.push({command:"setGlyphs",args:[o.glyphs]}),ln(l.transition,o.transition)||c.push({command:"setTransition",args:[o.transition]}),ln(l.light,o.light)||c.push({command:"setLight",args:[o.light]}),ln(l.terrain,o.terrain)||c.push({command:"setTerrain",args:[o.terrain]}),ln(l.sky,o.sky)||c.push({command:"setSky",args:[o.sky]});const p={},y=[];(function(x,E,L,A){let R;for(R in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,R)&&(Object.prototype.hasOwnProperty.call(E,R)||ps(R,L,A));for(R in E)Object.prototype.hasOwnProperty.call(E,R)&&(Object.prototype.hasOwnProperty.call(x,R)?ln(x[R],E[R])||(x[R].type==="geojson"&&E[R].type==="geojson"&&Ba(x,E,R)?tr(L,{command:"setGeoJSONSourceData",args:[R,E[R].data]}):Os(R,E,L,A)):Mo(R,E,L))})(l.sources,o.sources,y,p);const b=[];l.layers&&l.layers.forEach(x=>{"source"in x&&p[x.source]?c.push({command:"removeLayer",args:[x.id]}):b.push(x)}),c=c.concat(y),function(x,E,L){E=E||[];const A=(x=x||[]).map(bl),R=E.map(bl),O=x.reduce(ds,{}),U=E.reduce(ds,{}),W=A.slice(),K=Object.create(null);let tt,at,pt,Mt,yt;for(let Et=0,Yt=0;Et@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,y,b)=>{const x=y||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},h.ab=function(l,o){const c=[];for(const p in l)p in o||c.push(p);return c},h.ac=ot,h.ad=function(l,o,c){var p=Math.sin(c),y=Math.cos(c),b=o[0],x=o[1],E=o[2],L=o[3],A=o[4],R=o[5],O=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]=b*y+A*p,l[1]=x*y+R*p,l[2]=E*y+O*p,l[3]=L*y+U*p,l[4]=A*y-b*p,l[5]=R*y-x*p,l[6]=O*y-E*p,l[7]=U*y-L*p,l},h.ae=function(l){var o=new Fh(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},h.af=Um,h.ag=function(l,o){let c=0,p=0;if(l.kind==="constant")p=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:y,minZoom:b,maxZoom:x}=l,E=y?ot(Oi.interpolationFactor(y,o,b,x),0,1):0;l.kind==="camera"?p=Qi.number(l.minSize,l.maxSize,E):c=E}return{uSizeT:c,uSize:p}},h.ai=function(l,{uSize:o,uSizeT:c},{lowerSize:p,upperSize:y}){return l.kind==="source"?p/Ya:l.kind==="composite"?Qi.number(p/Ya,y/Ya,c):o},h.aj=P_,h.ak=function(l,o,c,p){const y=o.y-l.y,b=o.x-l.x,x=p.y-c.y,E=p.x-c.x,L=x*b-E*y;if(L===0)return null;const A=(E*(l.y-c.y)-x*(l.x-c.x))/L;return new I(l.x+A*b,l.y+A*y)},h.al=Db,h.am=Mp,h.an=l_,h.ao=ui,h.aq=L_,h.ar=function(l,o){var c=o[0],p=o[1],y=o[2],b=o[3],x=o[4],E=o[5],L=o[6],A=o[7],R=o[8],O=o[9],U=o[10],W=o[11],K=o[12],tt=o[13],at=o[14],pt=o[15],Mt=c*E-p*x,yt=c*L-y*x,Et=c*A-b*x,Yt=p*L-y*E,Jt=p*A-b*E,be=y*A-b*L,Ce=R*tt-O*K,ve=R*at-U*K,ye=R*pt-W*K,ue=O*at-U*tt,Ee=O*pt-W*tt,de=U*pt-W*at,ne=Mt*de-yt*Ee+Et*ue+Yt*ye-Jt*ve+be*Ce;return ne?(l[0]=(E*de-L*Ee+A*ue)*(ne=1/ne),l[1]=(y*Ee-p*de-b*ue)*ne,l[2]=(tt*be-at*Jt+pt*Yt)*ne,l[3]=(U*Jt-O*be-W*Yt)*ne,l[4]=(L*ye-x*de-A*ve)*ne,l[5]=(c*de-y*ye+b*ve)*ne,l[6]=(at*Et-K*be-pt*yt)*ne,l[7]=(R*be-U*Et+W*yt)*ne,l[8]=(x*Ee-E*ye+A*Ce)*ne,l[9]=(p*ye-c*Ee-b*Ce)*ne,l[10]=(K*Jt-tt*Et+pt*Mt)*ne,l[11]=(O*Et-R*Jt-W*Mt)*ne,l[12]=(E*ve-x*ue-L*Ce)*ne,l[13]=(c*ue-p*ve+y*Ce)*ne,l[14]=(tt*yt-K*Yt-at*Mt)*ne,l[15]=(R*Yt-O*yt+U*Mt)*ne,l):null},h.as=z_,h.at=T_,h.au=F_,h.av=function(){const l={},o=Nt.$version;for(const c in Nt.$root){const p=Nt.$root[c];if(p.required){let y=null;y=c==="version"?o:p.type==="array"?[]:{},y!=null&&(l[c]=y)}}return l},h.aw=Tm,h.ax=Ar,h.ay=function(l){l=l.slice();const o=Object.create(null);for(let c=0;cne*ui)}let ve=x?"center":c.get("text-justify").evaluate(A,{},l.canonical);const ye=c.get("symbol-placement"),ue=ye==="point"?c.get("text-max-width").evaluate(A,{},l.canonical)*ui:0,Ee=()=>{l.bucket.allowVerticalPlacement&&du(Et)&&(K.vertical=Xm(tt,l.glyphMap,l.glyphPositions,l.imagePositions,R,ue,b,be,"left",Jt,pt,h.ah.vertical,!0,ye,U,O))};if(!x&&Ce){const de=new Set;if(ve==="auto")for(let ze=0;zeu(void 0,void 0,void 0,function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(o)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),h.e=st,h.f=l=>new Promise((o,c)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=we})},p.onerror=()=>c(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const y=new Blob([new Uint8Array(l)],{type:"image/png"});p.src=l.byteLength?URL.createObjectURL(y):we}),h.g=yn,h.h=(l,o)=>wr(st(l,{type:"json"}),o),h.i=ee,h.j=Ie,h.k=Tt,h.l=(l,o)=>wr(st(l,{type:"arrayBuffer"}),o),h.m=wr,h.n=function(l){return new S_(l).readFields(JT,[])},h.o=Op,h.p=ab,h.q=po,h.r=i_,h.s=pr,h.t=hu,h.u=_e,h.v=Nt,h.w=Kt,h.x=Tl,h.y=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)}},h.z=Qi}),i("worker",["./shared"],function(h){class u{constructor(B){this.keyCache={},B&&this.replace(B)}replace(B){this._layerConfigs={},this._layers={},this.update(B,[])}update(B,q){for(const nt of B){this._layerConfigs[nt.id]=nt;const xt=this._layers[nt.id]=h.az(nt);xt._featureFilter=h.a6(xt.filter),this.keyCache[nt.id]&&delete this.keyCache[nt.id]}for(const nt of q)delete this.keyCache[nt],delete this._layerConfigs[nt],delete this._layers[nt];this.familiesBySource={};const J=h.bh(Object.values(this._layerConfigs),this.keyCache);for(const nt of J){const xt=nt.map(Wt=>this._layers[Wt.id]),Q=xt[0];if(Q.visibility==="none")continue;const wt=Q.source||"";let dt=this.familiesBySource[wt];dt||(dt=this.familiesBySource[wt]={});const Pt=Q.sourceLayer||"_geojsonTileLayer";let Vt=dt[Pt];Vt||(Vt=dt[Pt]=[]),Vt.push(xt)}}}class g{constructor(B){const q={},J=[];for(const wt in B){const dt=B[wt],Pt=q[wt]={};for(const Vt in dt){const Wt=dt[+Vt];if(!Wt||Wt.bitmap.width===0||Wt.bitmap.height===0)continue;const Xt={x:0,y:0,w:Wt.bitmap.width+2,h:Wt.bitmap.height+2};J.push(Xt),Pt[Vt]={rect:Xt,metrics:Wt.metrics}}}const{w:nt,h:xt}=h.p(J),Q=new h.o({width:nt||1,height:xt||1});for(const wt in B){const dt=B[wt];for(const Pt in dt){const Vt=dt[+Pt];if(!Vt||Vt.bitmap.width===0||Vt.bitmap.height===0)continue;const Wt=q[wt][Pt].rect;h.o.copy(Vt.bitmap,Q,{x:0,y:0},{x:Wt.x+1,y:Wt.y+1},Vt.bitmap)}}this.image=Q,this.positions=q}}h.bi("GlyphAtlas",g);class w{constructor(B){this.tileID=new h.Q(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=[]}parse(B,q,J,nt){return h._(this,void 0,void 0,function*(){this.status="parsing",this.data=B,this.collisionBoxArray=new h.a4;const xt=new h.bj(Object.keys(B.layers).sort()),Q=new h.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const wt={},dt={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Pt=q.familiesBySource[this.source];for(const sn in Pt){const Sr=B.layers[sn];if(!Sr)continue;Sr.version===1&&h.w(`Vector tile source "${this.source}" layer "${sn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const si=xt.encode(sn),Ji=[];for(let co=0;co=vi.maxzoom||vi.visibility!=="none"&&(S(co,this.zoom,J),(wt[vi.id]=vi.createBucket({index:Q.bucketLayerIDs.length,layers:co,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:si,sourceID:this.source})).populate(Ji,dt,this.tileID.canonical),Q.bucketLayerIDs.push(co.map(zs=>zs.id)))}}const Vt=h.aE(dt.glyphDependencies,sn=>Object.keys(sn).map(Number));this.inFlightDependencies.forEach(sn=>sn==null?void 0:sn.abort()),this.inFlightDependencies=[];let Wt=Promise.resolve({});if(Object.keys(Vt).length){const sn=new AbortController;this.inFlightDependencies.push(sn),Wt=nt.sendAsync({type:"GG",data:{stacks:Vt,source:this.source,tileID:this.tileID,type:"glyphs"}},sn)}const Xt=Object.keys(dt.iconDependencies);let Te=Promise.resolve({});if(Xt.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Te=nt.sendAsync({type:"GI",data:{icons:Xt,source:this.source,tileID:this.tileID,type:"icons"}},sn)}const ke=Object.keys(dt.patternDependencies);let We=Promise.resolve({});if(ke.length){const sn=new AbortController;this.inFlightDependencies.push(sn),We=nt.sendAsync({type:"GI",data:{icons:ke,source:this.source,tileID:this.tileID,type:"patterns"}},sn)}const[He,bn,Hn]=yield Promise.all([Wt,Te,We]),ar=new g(He),Xr=new h.bl(bn,Hn);for(const sn in wt){const Sr=wt[sn];Sr instanceof h.a5?(S(Sr.layers,this.zoom,J),h.bm({bucket:Sr,glyphMap:He,glyphPositions:ar.positions,imageMap:bn,imagePositions:Xr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Sr.hasPattern&&(Sr instanceof h.bn||Sr instanceof h.bo||Sr instanceof h.bp)&&(S(Sr.layers,this.zoom,J),Sr.addFeatures(dt,this.tileID.canonical,Xr.patternPositions))}return this.status="done",{buckets:Object.values(wt).filter(sn=>!sn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ar.image,imageAtlas:Xr,glyphMap:this.returnDependencies?He:null,iconMap:this.returnDependencies?bn:null,glyphPositions:this.returnDependencies?ar.positions:null}})}}function S(lt,B,q){const J=new h.a8(B);for(const nt of lt)nt.recalculate(J,q)}class I{constructor(B,q,J){this.actor=B,this.layerIndex=q,this.availableImages=J,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(B,q){return h._(this,void 0,void 0,function*(){const J=yield h.l(B.request,q);try{return{vectorTile:new h.bq.VectorTile(new h.br(J.data)),rawData:J.data,cacheControl:J.cacheControl,expires:J.expires}}catch(nt){const xt=new Uint8Array(J.data);let Q=`Unable to parse the tile at ${B.request.url}, `;throw Q+=xt[0]===31&&xt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${nt.messge}`,new Error(Q)}})}loadTile(B){return h._(this,void 0,void 0,function*(){const q=B.uid,J=!!(B&&B.request&&B.request.collectResourceTiming)&&new h.bs(B.request),nt=new w(B);this.loading[q]=nt;const xt=new AbortController;nt.abort=xt;try{const Q=yield this.loadVectorTile(B,xt);if(delete this.loading[q],!Q)return null;const wt=Q.rawData,dt={};Q.expires&&(dt.expires=Q.expires),Q.cacheControl&&(dt.cacheControl=Q.cacheControl);const Pt={};if(J){const Wt=J.finish();Wt&&(Pt.resourceTiming=JSON.parse(JSON.stringify(Wt)))}nt.vectorTile=Q.vectorTile;const Vt=nt.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[q]=nt,this.fetching[q]={rawTileData:wt,cacheControl:dt,resourceTiming:Pt};try{const Wt=yield Vt;return h.e({rawTileData:wt.slice(0)},Wt,dt,Pt)}finally{delete this.fetching[q]}}catch(Q){throw delete this.loading[q],nt.status="done",this.loaded[q]=nt,Q}})}reloadTile(B){return h._(this,void 0,void 0,function*(){const q=B.uid;if(!this.loaded||!this.loaded[q])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const J=this.loaded[q];if(J.showCollisionBoxes=B.showCollisionBoxes,J.status==="parsing"){const nt=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);let xt;if(this.fetching[q]){const{rawTileData:Q,cacheControl:wt,resourceTiming:dt}=this.fetching[q];delete this.fetching[q],xt=h.e({rawTileData:Q.slice(0)},nt,wt,dt)}else xt=nt;return xt}if(J.status==="done"&&J.vectorTile)return J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(B){return h._(this,void 0,void 0,function*(){const q=this.loading,J=B.uid;q&&q[J]&&q[J].abort&&(q[J].abort.abort(),delete q[J])})}removeTile(B){return h._(this,void 0,void 0,function*(){this.loaded&&this.loaded[B.uid]&&delete this.loaded[B.uid]})}}class P{constructor(){this.loaded={}}loadTile(B){return h._(this,void 0,void 0,function*(){const{uid:q,encoding:J,rawImageData:nt,redFactor:xt,greenFactor:Q,blueFactor:wt,baseShift:dt}=B,Pt=nt.width+2,Vt=nt.height+2,Wt=h.b(nt)?new h.R({width:Pt,height:Vt},yield h.bt(nt,-1,-1,Pt,Vt)):nt,Xt=new h.bu(q,Wt,J,xt,Q,wt,dt);return this.loaded=this.loaded||{},this.loaded[q]=Xt,Xt})}removeTile(B){const q=this.loaded,J=B.uid;q&&q[J]&&delete q[J]}}function D(lt,B){if(lt.length!==0){N(lt[0],B);for(var q=1;q=Math.abs(wt)?q-dt+wt:wt-dt+q,q=dt}q+J>=0!=!!B&<.reverse()}var G=h.bv(function lt(B,q){var J,nt=B&&B.type;if(nt==="FeatureCollection")for(J=0;J>31}function Zt(lt,B){for(var q=lt.loadGeometry(),J=lt.type,nt=0,xt=0,Q=q.length,wt=0;wtlt},we=Math.fround||(un=new Float32Array(1),lt=>(un[0]=+lt,un[0]));var un;const Ge=3,Me=5,hn=6;class Cn{constructor(B){this.options=Object.assign(Object.create(Oe),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:q,minZoom:J,maxZoom:nt}=this.options;q&&console.time("total time");const xt=`prepare ${B.length} points`;q&&console.time(xt),this.points=B;const Q=[];for(let dt=0;dt=J;dt--){const Pt=+Date.now();wt=this.trees[dt]=this._createTree(this._cluster(wt,dt)),q&&console.log("z%d: %d clusters in %dms",dt,wt.numItems,+Date.now()-Pt)}return q&&console.timeEnd("total time"),this}getClusters(B,q){let J=((B[0]+180)%360+360)%360-180;const nt=Math.max(-90,Math.min(90,B[1]));let xt=B[2]===180?180:((B[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)J=-180,xt=180;else if(J>xt){const Wt=this.getClusters([J,nt,180,Q],q),Xt=this.getClusters([-180,nt,xt,Q],q);return Wt.concat(Xt)}const wt=this.trees[this._limitZoom(q)],dt=wt.range(An(J),xr(Q),An(xt),xr(nt)),Pt=wt.data,Vt=[];for(const Wt of dt){const Xt=this.stride*Wt;Vt.push(Pt[Xt+Me]>1?gn(Pt,Xt,this.clusterProps):this.points[Pt[Xt+Ge]])}return Vt}getChildren(B){const q=this._getOriginId(B),J=this._getOriginZoom(B),nt="No cluster with the specified id.",xt=this.trees[J];if(!xt)throw new Error(nt);const Q=xt.data;if(q*this.stride>=Q.length)throw new Error(nt);const wt=this.options.radius/(this.options.extent*Math.pow(2,J-1)),dt=xt.within(Q[q*this.stride],Q[q*this.stride+1],wt),Pt=[];for(const Vt of dt){const Wt=Vt*this.stride;Q[Wt+4]===B&&Pt.push(Q[Wt+Me]>1?gn(Q,Wt,this.clusterProps):this.points[Q[Wt+Ge]])}if(Pt.length===0)throw new Error(nt);return Pt}getLeaves(B,q,J){const nt=[];return this._appendLeaves(nt,B,q=q||10,J=J||0,0),nt}getTile(B,q,J){const nt=this.trees[this._limitZoom(B)],xt=Math.pow(2,B),{extent:Q,radius:wt}=this.options,dt=wt/Q,Pt=(J-dt)/xt,Vt=(J+1+dt)/xt,Wt={features:[]};return this._addTileFeatures(nt.range((q-dt)/xt,Pt,(q+1+dt)/xt,Vt),nt.data,q,J,xt,Wt),q===0&&this._addTileFeatures(nt.range(1-dt/xt,Pt,1,Vt),nt.data,xt,J,xt,Wt),q===xt-1&&this._addTileFeatures(nt.range(0,Pt,dt/xt,Vt),nt.data,-1,J,xt,Wt),Wt.features.length?Wt:null}getClusterExpansionZoom(B){let q=this._getOriginZoom(B)-1;for(;q<=this.options.maxZoom;){const J=this.getChildren(B);if(q++,J.length!==1)break;B=J[0].properties.cluster_id}return q}_appendLeaves(B,q,J,nt,xt){const Q=this.getChildren(q);for(const wt of Q){const dt=wt.properties;if(dt&&dt.cluster?xt+dt.point_count<=nt?xt+=dt.point_count:xt=this._appendLeaves(B,dt.cluster_id,J,nt,xt):xt1;let Vt,Wt,Xt;if(Pt)Vt=yn(q,dt,this.clusterProps),Wt=q[dt],Xt=q[dt+1];else{const We=this.points[q[dt+Ge]];Vt=We.properties;const[He,bn]=We.geometry.coordinates;Wt=An(He),Xt=xr(bn)}const Te={type:1,geometry:[[Math.round(this.options.extent*(Wt*xt-J)),Math.round(this.options.extent*(Xt*xt-nt))]],tags:Vt};let ke;ke=Pt||this.options.generateId?q[dt+Ge]:this.points[q[dt+Ge]].id,ke!==void 0&&(Te.id=ke),Q.features.push(Te)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,q){const{radius:J,extent:nt,reduce:xt,minPoints:Q}=this.options,wt=J/(nt*Math.pow(2,q)),dt=B.data,Pt=[],Vt=this.stride;for(let Wt=0;Wtq&&(He+=dt[Hn+Me])}if(He>We&&He>=Q){let bn,Hn=Xt*We,ar=Te*We,Xr=-1;const sn=((Wt/Vt|0)<<5)+(q+1)+this.points.length;for(const Sr of ke){const si=Sr*Vt;if(dt[si+2]<=q)continue;dt[si+2]=q;const Ji=dt[si+Me];Hn+=dt[si]*Ji,ar+=dt[si+1]*Ji,dt[si+4]=sn,xt&&(bn||(bn=this._map(dt,Wt,!0),Xr=this.clusterProps.length,this.clusterProps.push(bn)),xt(bn,this._map(dt,si)))}dt[Wt+4]=sn,Pt.push(Hn/He,ar/He,1/0,sn,-1,He),xt&&Pt.push(Xr)}else{for(let bn=0;bn1)for(const bn of ke){const Hn=bn*Vt;if(!(dt[Hn+2]<=q)){dt[Hn+2]=q;for(let ar=0;ar>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,q,J){if(B[q+Me]>1){const Q=this.clusterProps[B[q+hn]];return J?Object.assign({},Q):Q}const nt=this.points[B[q+Ge]].properties,xt=this.options.map(nt);return J&&xt===nt?Object.assign({},xt):xt}}function gn(lt,B,q){return{type:"Feature",id:lt[B+Ge],properties:yn(lt,B,q),geometry:{type:"Point",coordinates:[(J=lt[B],360*(J-.5)),Ar(lt[B+1])]}};var J}function yn(lt,B,q){const J=lt[B+Me],nt=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,xt=lt[B+hn],Q=xt===-1?{}:Object.assign({},q[xt]);return Object.assign(Q,{cluster:!0,cluster_id:lt[B+Ge],point_count:J,point_count_abbreviated:nt})}function An(lt){return lt/360+.5}function xr(lt){const B=Math.sin(lt*Math.PI/180),q=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return q<0?0:q>1?1:q}function Ar(lt){const B=(180-360*lt)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function wr(lt,B,q,J){for(var nt,xt=J,Q=q-B>>1,wt=q-B,dt=lt[B],Pt=lt[B+1],Vt=lt[q],Wt=lt[q+1],Xt=B+3;Xtxt)nt=Xt,xt=Te;else if(Te===xt){var ke=Math.abs(Xt-Q);keJ&&(nt-B>3&&wr(lt,B,nt,J),lt[nt+2]=xt,q-nt>3&&wr(lt,nt,q,J))}function pr(lt,B,q,J,nt,xt){var Q=nt-q,wt=xt-J;if(Q!==0||wt!==0){var dt=((lt-q)*Q+(B-J)*wt)/(Q*Q+wt*wt);dt>1?(q=nt,J=xt):dt>0&&(q+=Q*dt,J+=wt*dt)}return(Q=lt-q)*Q+(wt=B-J)*wt}function Qt(lt,B,q,J){var nt={id:lt===void 0?null:lt,type:B,geometry:q,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xt){var Q=xt.geometry,wt=xt.type;if(wt==="Point"||wt==="MultiPoint"||wt==="LineString")gt(xt,Q);else if(wt==="Polygon"||wt==="MultiLineString")for(var dt=0;dt0&&(Q+=J?(nt*Pt-dt*xt)/2:Math.sqrt(Math.pow(dt-nt,2)+Math.pow(Pt-xt,2))),nt=dt,xt=Pt}var Vt=B.length-3;B[2]=1,wr(B,0,Vt,q),B[Vt+2]=1,B.size=Math.abs(Q),B.start=0,B.end=B.size}function Nt(lt,B,q,J){for(var nt=0;nt1?1:q}function ln(lt,B,q,J,nt,xt,Q,wt){if(J/=B,xt>=(q/=B)&&Q=J)return null;for(var dt=[],Pt=0;Pt=q&&ke=J)){var We=[];if(Xt==="Point"||Xt==="MultiPoint")tr(Wt,We,q,J,nt);else if(Xt==="LineString")Mo(Wt,We,q,J,nt,!1,wt.lineMetrics);else if(Xt==="MultiLineString")Os(Wt,We,q,J,nt,!1);else if(Xt==="Polygon")Os(Wt,We,q,J,nt,!0);else if(Xt==="MultiPolygon")for(var He=0;He=q&&Q<=J&&(B.push(lt[xt]),B.push(lt[xt+1]),B.push(lt[xt+2]))}}function Mo(lt,B,q,J,nt,xt,Q){for(var wt,dt,Pt=ps(lt),Vt=nt===0?Pi:bl,Wt=lt.start,Xt=0;Xtq&&(dt=Vt(Pt,Te,ke,He,bn,q),Q&&(Pt.start=Wt+wt*dt)):Hn>J?ar=q&&(dt=Vt(Pt,Te,ke,He,bn,q),Xr=!0),ar>J&&Hn<=J&&(dt=Vt(Pt,Te,ke,He,bn,J),Xr=!0),!xt&&Xr&&(Q&&(Pt.end=Wt+wt*dt),B.push(Pt),Pt=ps(lt)),Q&&(Wt+=wt)}var sn=lt.length-3;Te=lt[sn],ke=lt[sn+1],We=lt[sn+2],(Hn=nt===0?Te:ke)>=q&&Hn<=J&&Ba(Pt,Te,ke,We),sn=Pt.length-3,xt&&sn>=3&&(Pt[sn]!==Pt[0]||Pt[sn+1]!==Pt[1])&&Ba(Pt,Pt[0],Pt[1],Pt[2]),Pt.length&&B.push(Pt)}function ps(lt){var B=[];return B.size=lt.size,B.start=lt.start,B.end=lt.end,B}function Os(lt,B,q,J,nt,xt){for(var Q=0;QQ.maxX&&(Q.maxX=Vt),Wt>Q.maxY&&(Q.maxY=Wt)}return Q}function Zr(lt,B,q,J){var nt=B.geometry,xt=B.type,Q=[];if(xt==="Point"||xt==="MultiPoint")for(var wt=0;wt0&&B.size<(nt?Q:J))q.numPoints+=B.length/3;else{for(var wt=[],dt=0;dtQ)&&(q.numSimplified++,wt.push(B[dt]),wt.push(B[dt+1])),q.numPoints++;nt&&function(Pt,Vt){for(var Wt=0,Xt=0,Te=Pt.length,ke=Te-2;Xt0===Vt)for(Xt=0,Te=Pt.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(nt,xt){var Q=[];if(nt.type==="FeatureCollection")for(var wt=0;wt1&&console.time("creation"),Xt=this.tiles[Wt]=xl(lt,B,q,J,dt),this.tileCoords.push({z:B,x:q,y:J}),Pt)){Pt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,q,J,Xt.numFeatures,Xt.numPoints,Xt.numSimplified),console.timeEnd("creation"));var Te="z"+B;this.stats[Te]=(this.stats[Te]||0)+1,this.total++}if(Xt.source=lt,nt){if(B===dt.maxZoom||B===nt)continue;var ke=1<1&&console.time("clipping");var We,He,bn,Hn,ar,Xr,sn=.5*dt.buffer/dt.extent,Sr=.5-sn,si=.5+sn,Ji=1+sn;We=He=bn=Hn=null,ar=ln(lt,Vt,q-sn,q+si,0,Xt.minX,Xt.maxX,dt),Xr=ln(lt,Vt,q+Sr,q+Ji,0,Xt.minX,Xt.maxX,dt),lt=null,ar&&(We=ln(ar,Vt,J-sn,J+si,1,Xt.minY,Xt.maxY,dt),He=ln(ar,Vt,J+Sr,J+Ji,1,Xt.minY,Xt.maxY,dt),ar=null),Xr&&(bn=ln(Xr,Vt,J-sn,J+si,1,Xt.minY,Xt.maxY,dt),Hn=ln(Xr,Vt,J+Sr,J+Ji,1,Xt.minY,Xt.maxY,dt),Xr=null),Pt>1&&console.timeEnd("clipping"),wt.push(We||[],B+1,2*q,2*J),wt.push(He||[],B+1,2*q,2*J+1),wt.push(bn||[],B+1,2*q+1,2*J),wt.push(Hn||[],B+1,2*q+1,2*J+1)}}},en.prototype.getTile=function(lt,B,q){var J=this.options,nt=J.extent,xt=J.debug;if(lt<0||lt>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",lt,B,q);for(var dt,Pt=lt,Vt=B,Wt=q;!dt&&Pt>0;)Pt--,Vt=Math.floor(Vt/2),Wt=Math.floor(Wt/2),dt=this.tiles[Je(Pt,Vt,Wt)];return dt&&dt.source?(xt>1&&console.log("found parent tile z%d-%d-%d",Pt,Vt,Wt),xt>1&&console.time("drilling down"),this.splitTile(dt.source,Pt,Vt,Wt,lt,B,q),xt>1&&console.timeEnd("drilling down"),this.tiles[wt]?Ko(this.tiles[wt],nt):null):null};class ga extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(B,q){return h._(this,void 0,void 0,function*(){const J=B.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const nt=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!nt)return null;const xt=new class{constructor(wt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.W,this.length=wt.length,this._features=wt}feature(wt){return new class{constructor(dt){this._feature=dt,this.extent=h.W,this.type=dt.type,this.properties=dt.tags,"id"in dt&&!isNaN(dt.id)&&(this.id=parseInt(dt.id,10))}loadGeometry(){if(this._feature.type===1){const dt=[];for(const Pt of this._feature.geometry)dt.push([new h.P(Pt[0],Pt[1])]);return dt}{const dt=[];for(const Pt of this._feature.geometry){const Vt=[];for(const Wt of Pt)Vt.push(new h.P(Wt[0],Wt[1]));dt.push(Vt)}return dt}}toGeoJSON(dt,Pt,Vt){return Y.call(this,dt,Pt,Vt)}}(this._features[wt])}}(nt.features);let Q=qt(xt);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:xt,rawData:Q.buffer}})}loadData(B){return h._(this,void 0,void 0,function*(){var q;(q=this._pendingRequest)===null||q===void 0||q.abort();const J=!!(B&&B.request&&B.request.collectResourceTiming)&&new h.bs(B.request);this._pendingRequest=new AbortController;try{let nt=yield this.loadGeoJSON(B,this._pendingRequest);if(delete this._pendingRequest,typeof nt!="object")throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(G(nt,!0),B.filter){const Q=h.by(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(dt=>`${dt.key}: ${dt.message}`).join(", "));nt={type:"FeatureCollection",features:nt.features.filter(dt=>Q.value.evaluate({zoom:0},dt))}}this._geoJSONIndex=B.cluster?new Cn(function({superclusterOptions:Q,clusterProperties:wt}){if(!wt||!Q)return Q;const dt={},Pt={},Vt={accumulated:null,zoom:0},Wt={properties:null},Xt=Object.keys(wt);for(const Te of Xt){const[ke,We]=wt[Te],He=h.by(We),bn=h.by(typeof ke=="string"?[ke,["accumulated"],["get",Te]]:ke);dt[Te]=He.value,Pt[Te]=bn.value}return Q.map=Te=>{Wt.properties=Te;const ke={};for(const We of Xt)ke[We]=dt[We].evaluate(Vt,Wt);return ke},Q.reduce=(Te,ke)=>{Wt.properties=ke;for(const We of Xt)Vt.accumulated=Te[We],Te[We]=Pt[We].evaluate(Vt,Wt)},Q}(B)).load(nt.features):function(Q,wt){return new en(Q,wt)}(nt,B.geojsonVtOptions),this.loaded={};const xt={};if(J){const Q=J.finish();Q&&(xt.resourceTiming={},xt.resourceTiming[B.source]=JSON.parse(JSON.stringify(Q)))}return xt}catch(nt){if(delete this._pendingRequest,h.bz(nt))return{abandoned:!0};throw nt}})}reloadTile(B){const q=this.loaded;return q&&q[B.uid]?super.reloadTile(B):this.loadTile(B)}loadGeoJSON(B,q){return h._(this,void 0,void 0,function*(){const{promoteId:J}=B;if(B.request){const nt=yield h.h(B.request,q);return this._dataUpdateable=Jo(nt.data,J)?Ke(nt.data,J):void 0,nt.data}if(typeof B.data=="string")try{const nt=JSON.parse(B.data);return this._dataUpdateable=Jo(nt,J)?Ke(nt,J):void 0,nt}catch{throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`)}if(!B.dataDiff)throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${B.source}`);return function(nt,xt,Q){var wt,dt,Pt,Vt;if(xt.removeAll&&nt.clear(),xt.remove)for(const Wt of xt.remove)nt.delete(Wt);if(xt.add)for(const Wt of xt.add){const Xt=Dr(Wt,Q);Xt!=null&&nt.set(Xt,Wt)}if(xt.update)for(const Wt of xt.update){let Xt=nt.get(Wt.id);if(Xt==null)continue;const Te=!Wt.removeAllProperties&&(((wt=Wt.removeProperties)===null||wt===void 0?void 0:wt.length)>0||((dt=Wt.addOrUpdateProperties)===null||dt===void 0?void 0:dt.length)>0);if((Wt.newGeometry||Wt.removeAllProperties||Te)&&(Xt=Object.assign({},Xt),nt.set(Wt.id,Xt),Te&&(Xt.properties=Object.assign({},Xt.properties))),Wt.newGeometry&&(Xt.geometry=Wt.newGeometry),Wt.removeAllProperties)Xt.properties={};else if(((Pt=Wt.removeProperties)===null||Pt===void 0?void 0:Pt.length)>0)for(const ke of Wt.removeProperties)Object.prototype.hasOwnProperty.call(Xt.properties,ke)&&delete Xt.properties[ke];if(((Vt=Wt.addOrUpdateProperties)===null||Vt===void 0?void 0:Vt.length)>0)for(const{key:ke,value:We}of Wt.addOrUpdateProperties)Xt.properties[ke]=We}}(this._dataUpdateable,B.dataDiff,J),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(B){return h._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(B){return this._geoJSONIndex.getClusterExpansionZoom(B.clusterId)}getClusterChildren(B){return this._geoJSONIndex.getChildren(B.clusterId)}getClusterLeaves(B){return this._geoJSONIndex.getLeaves(B.clusterId,B.limit,B.offset)}}class Fr{constructor(B){this.self=B,this.actor=new h.C(B),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(q,J)=>{if(this.externalWorkerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.externalWorkerSourceTypes[q]=J},this.self.addProtocol=h.bf,this.self.removeProtocol=h.bg,this.self.registerRTLTextPlugin=q=>{if(h.bA.isParsed())throw new Error("RTL text plugin already registered.");h.bA.setMethods(q)},this.actor.registerMessageHandler("LDT",(q,J)=>this._getDEMWorkerSource(q,J.source).loadTile(J)),this.actor.registerMessageHandler("RDT",(q,J)=>h._(this,void 0,void 0,function*(){this._getDEMWorkerSource(q,J.source).removeTile(J)})),this.actor.registerMessageHandler("GCEZ",(q,J)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterExpansionZoom(J)})),this.actor.registerMessageHandler("GCC",(q,J)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterChildren(J)})),this.actor.registerMessageHandler("GCL",(q,J)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterLeaves(J)})),this.actor.registerMessageHandler("LD",(q,J)=>this._getWorkerSource(q,J.type,J.source).loadData(J)),this.actor.registerMessageHandler("LT",(q,J)=>this._getWorkerSource(q,J.type,J.source).loadTile(J)),this.actor.registerMessageHandler("RT",(q,J)=>this._getWorkerSource(q,J.type,J.source).reloadTile(J)),this.actor.registerMessageHandler("AT",(q,J)=>this._getWorkerSource(q,J.type,J.source).abortTile(J)),this.actor.registerMessageHandler("RMT",(q,J)=>this._getWorkerSource(q,J.type,J.source).removeTile(J)),this.actor.registerMessageHandler("RS",(q,J)=>h._(this,void 0,void 0,function*(){if(!this.workerSources[q]||!this.workerSources[q][J.type]||!this.workerSources[q][J.type][J.source])return;const nt=this.workerSources[q][J.type][J.source];delete this.workerSources[q][J.type][J.source],nt.removeSource!==void 0&&nt.removeSource(J)})),this.actor.registerMessageHandler("RM",q=>h._(this,void 0,void 0,function*(){delete this.layerIndexes[q],delete this.availableImages[q],delete this.workerSources[q],delete this.demWorkerSources[q]})),this.actor.registerMessageHandler("SR",(q,J)=>h._(this,void 0,void 0,function*(){this.referrer=J})),this.actor.registerMessageHandler("SRPS",(q,J)=>this._syncRTLPluginState(q,J)),this.actor.registerMessageHandler("IS",(q,J)=>h._(this,void 0,void 0,function*(){this.self.importScripts(J)})),this.actor.registerMessageHandler("SI",(q,J)=>this._setImages(q,J)),this.actor.registerMessageHandler("UL",(q,J)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(q).update(J.layers,J.removedIds)})),this.actor.registerMessageHandler("SL",(q,J)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(q).replace(J)}))}_setImages(B,q){return h._(this,void 0,void 0,function*(){this.availableImages[B]=q;for(const J in this.workerSources[B]){const nt=this.workerSources[B][J];for(const xt in nt)nt[xt].availableImages=q}})}_syncRTLPluginState(B,q){return h._(this,void 0,void 0,function*(){if(h.bA.isParsed())return h.bA.getState();if(q.pluginStatus!=="loading")return h.bA.setState(q),q;const J=q.pluginURL;if(this.self.importScripts(J),h.bA.isParsed()){const nt={pluginStatus:"loaded",pluginURL:J};return h.bA.setState(nt),nt}throw h.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${J}`)})}_getAvailableImages(B){let q=this.availableImages[B];return q||(q=[]),q}_getLayerIndex(B){let q=this.layerIndexes[B];return q||(q=this.layerIndexes[B]=new u),q}_getWorkerSource(B,q,J){if(this.workerSources[B]||(this.workerSources[B]={}),this.workerSources[B][q]||(this.workerSources[B][q]={}),!this.workerSources[B][q][J]){const nt={sendAsync:(xt,Q)=>(xt.targetMapId=B,this.actor.sendAsync(xt,Q))};switch(q){case"vector":this.workerSources[B][q][J]=new I(nt,this._getLayerIndex(B),this._getAvailableImages(B));break;case"geojson":this.workerSources[B][q][J]=new ga(nt,this._getLayerIndex(B),this._getAvailableImages(B));break;default:this.workerSources[B][q][J]=new this.externalWorkerSourceTypes[q](nt,this._getLayerIndex(B),this._getAvailableImages(B))}}return this.workerSources[B][q][J]}_getDEMWorkerSource(B,q){return this.demWorkerSources[B]||(this.demWorkerSources[B]={}),this.demWorkerSources[B][q]||(this.demWorkerSources[B][q]=new P),this.demWorkerSources[B][q]}}return h.i(self)&&(self.worker=new Fr(self)),Fr}),i("index",["exports","./shared"],function(h,u){var g="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const m=f.boundingClientRect;return new u.P((d.clientX-m.left)/f.x-s.clientLeft,(d.clientY-m.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],m=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,m={}},_.addThrottleControl=M=>{const k=d++;return m[k]=M,k},_.removeThrottleControl=M=>{delete m[M],C()},_.getImage=(M,k,z=!0)=>new Promise((F,Z)=>{D.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:k,requestParameters:M,supportImageRefresh:z,state:"queued",onError:it=>{Z(it)},onSuccess:it=>{F(it)}}),C()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:k,supportImageRefresh:z,onError:F,onSuccess:Z,abortController:it}=M,rt=z===!1&&!u.i(self)&&!u.g(k.url)&&(!k.headers||Object.keys(k.headers).reduce((vt,Ft)=>vt&&Ft==="accept",!0));f++;const ut=rt?T(k,it):u.m(k,it);try{const vt=yield ut;delete M.abortController,M.state="completed",vt.data instanceof HTMLImageElement||u.b(vt.data)?Z(vt):vt.data&&Z({data:yield($=vt.data,typeof createImageBitmap=="function"?u.d($):u.f($)),cacheControl:vt.cacheControl,expires:vt.expires})}catch(vt){delete M.abortController,F(vt)}finally{f--,C()}var $}),C=()=>{const M=(()=>{for(const k of Object.keys(m))if(m[k]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let k=f;k0;k++){const z=s.shift();z.abortController.signal.aborted?k--:v(z)}},T=(M,k)=>new Promise((z,F)=>{const Z=new Image,it=M.url,rt=M.credentials;rt&&rt==="include"?Z.crossOrigin="use-credentials":(rt&&rt==="same-origin"||!u.s(it))&&(Z.crossOrigin="anonymous"),k.signal.addEventListener("abort",()=>{Z.src="",F(u.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,z({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,k.signal.aborted||F(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.src=it})}(j||(j={})),j.resetRequestQueue();class X{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const m=function(v){const C=v.match(ot);if(!C)throw new Error(`Unable to parse URL "${v}"`);return{protocol:C[1],authority:C[2],path:C[3]||"/",params:C[4]?C[4].split("&"):[]}}(s);return m.path+=`${f}${d}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(m)}setTransformRequest(s){this._transformRequestFn=s}}const ot=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _t(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var st,ct=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};st=new u.A(3),u.A!=Float32Array&&(st[0]=0,st[1]=0,st[2]=0);var mt=function(_){var s=_[0],f=_[1];return s*s+f*f};function Ct(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:m}of _){const v=`${d}${m}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:m}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class H{constructor(s,f,d,m){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,m)}update(s,f,d){const{width:m,height:v}=s,C=!(this.size&&this.size[0]===m&&this.size[1]===v||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[m,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,m,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:z}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,z,m,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),d!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,d||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,f),this.wrap=f)}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 ft(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Kt extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.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:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const m=f.data||f.spriteData;return this._validateStretch(f.stretchX,m&&m.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,m&&m.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const m of s){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(m=!1);this.isLoaded()||m?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let m=this.getImage(d);m||(this.fire(new u.k("styleimagemissing",{id:d})),m=this.getImage(d)),m?f[d]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:u.w(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const m={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.I(m,d);this.patterns[s]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new H(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),m=this.atlasImage;m.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],T=C.x+1,M=C.y+1,k=this.getImage(v).data,z=k.width,F=k.height;u.R.copy(k,m,{x:0,y:0},{x:T,y:M},{width:z,height:F}),u.R.copy(k,m,{x:0,y:F-1},{x:T,y:M-1},{width:z,height:1}),u.R.copy(k,m,{x:0,y:0},{x:T,y:M+F},{width:z,height:1}),u.R.copy(k,m,{x:z-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(k,m,{x:0,y:0},{x:T+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),ft(d)&&this.updateImage(f,d)}}}const St=1e20;function Zt(_,s,f,d,m,v,C,T,M){for(let k=s;k-1);M++,v[M]=T,C[M]=k,C[M+1]=St}for(let T=0,M=0;T65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const T=qt.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const C=yield d.requests[v];for(const T in C)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=C[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new qt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:T})}const C=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}qt.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const m=256*s,v=m+255,C=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${m}-${v}`),"Glyphs"),T=yield u.l(C,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${v}`);const M={};for(const k of u.n(T.data))M[k.id]=k;return M})},qt.TinySDF=class{constructor({fontSize:_=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const T=this.size=_+4*s,M=this._createCanvas(T),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${C} ${v} ${_}px ${m}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(_),C=Math.ceil(f),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),M=Math.min(this.size-this.buffer,C+Math.ceil(d)),k=T+2*this.buffer,z=M+2*this.buffer,F=Math.max(k*z,0),Z=new Uint8ClampedArray(F),it={data:Z,width:k,height:z,glyphWidth:T,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return it;const{ctx:rt,buffer:ut,gridInner:$,gridOuter:vt}=this;rt.clearRect(ut,ut,T,M),rt.fillText(_,ut,ut+C);const Ft=rt.getImageData(ut,ut,T,M);vt.fill(St,0,F),$.fill(0,0,F);for(let ht=0;ht0?Ht*Ht:0,$[Gt]=Ht<0?Ht*Ht:0}}Zt(vt,0,0,k,z,k,this.f,this.v,this.z),Zt($,ut,ut,T,M,k,this.f,this.v,this.z);for(let ht=0;ht1&&(M=s[++T]);const z=Math.abs(k-M.left),F=Math.abs(k-M.right),Z=Math.min(z,F);let it;const rt=v/d*(m+1);if(M.isDash){const ut=m-Math.abs(rt);it=Math.sqrt(Z*Z+ut*ut)}else it=m-Math.sqrt(Z*Z+rt*rt);this.data[C+k]=Math.max(0,Math.min(255,it+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],k=s[T+1];M.zeroLength?s.splice(T,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const m=this.width*this.nextRow;let v=0,C=s[v];for(let T=0;T1&&(C=s[++v]);const M=Math.abs(T-C.left),k=Math.abs(T-C.right),z=Math.min(M,k);this.data[m+T]=Math.max(0,Math.min(255,(C.isDash?z:-z)+128))}}addDash(s,f){const d=f?7:0,m=2*d+1;if(this.nextRow+m>this.height)return u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Me]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(I.hardwareConcurrency/2);let gn,yn;function An(){return gn||(gn=new hn),gn}hn.workerCount=u.B(globalThis)?Math.max(Math.min(Cn,3),1):1;class xr{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let m=0;m{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function Ar(){return yn||(yn=new xr(An(),u.G),yn.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),yn}function wr(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function pr(_,s,f,d,m,v){const C=function(F,Z,it){if(F)for(const rt of F){const ut=Z[rt];if(ut&&ut.source===it&&ut.type==="fill-extrusion")return!0}else for(const rt in Z){const ut=Z[rt];if(ut.source===it&&ut.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,C);M.sort(Qt);const k=[];for(const F of M)k.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,v,T,wr(_.transform,F.tileID))});const z=function(F){const Z={},it={};for(const rt of F){const ut=rt.queryResults,$=rt.wrappedTileID,vt=it[$]=it[$]||{};for(const Ft in ut){const ht=ut[Ft],It=vt[Ft]=vt[Ft]||{},Bt=Z[Ft]=Z[Ft]||[];for(const Gt of ht)It[Gt.featureIndex]||(It[Gt.featureIndex]=!0,Bt.push(Gt))}}return Z}(k);for(const F in z)z[F].forEach(Z=>{const it=Z.feature,rt=_.getFeatureState(it.layer["source-layer"],it.id);it.source=it.layer.source,it.layer["source-layer"]&&(it.sourceLayer=it.layer["source-layer"]),it.state=rt});return z}function Qt(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function gt(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield I.frameAsync(f),!d)return null;const m=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(m.vectorLayerIds=d.vector_layers.map(v=>v.id)),m})}class Tt{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):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 u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let m,v;if(s instanceof u.M)m=s,v=s;else{if(!(s instanceof Tt))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Tt.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(m=s._sw,v=s._ne,!m||!v)return this}return f||d?(f.lng=Math.min(m.lng,f.lng),f.lat=Math.min(m.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new u.M(m.lng,m.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:d}=u.M.convert(s);let m=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&m}static convert(s){return s instanceof Tt?s:s&&new Tt(s)}static fromLngLat(s,f=0){const d=360*f/40075017,m=d/Math.cos(Math.PI/180*s.lat);return new Tt(new u.M(s.lng-m,s.lat-d),new u.M(s.lng+m,s.lat+d))}}class Ie{constructor(s,f,d){this.bounds=Tt.convert(this.validateBounds(s)),this.minzoom=f||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 f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),m=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),C=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=m&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"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};d.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,C)=>{s.reloadPromise={resolve:v,reject:C}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:m,data:d},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const d=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(d.resolve).catch(d.reject)}}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Nt extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield gt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new Ie(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),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}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield j.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&s.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const m=this.map.painter.context,v=m.gl,C=d.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new H(m,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(d){if(delete s.abortController,s.aborted)s.state="unloaded";else if(d)throw s.state="errored",d}})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class Ye extends Nt{constructor(s,f,d,m){super(s,f,d,m),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield j.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const C=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),m=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+d)%d,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,m,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,m,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:m}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={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.abortController=new AbortController;const m=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,f==="RT")})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ln=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class tr extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=f}load(s){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield j.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(m){let v=1/0,C=1/0,T=-1/0,M=-1/0;for(const Z of m)v=Math.min(v,Z.x),C=Math.min(C,Z.y),T=Math.max(T,Z.x),M=Math.max(M,Z.y);const k=Math.max(T-v,M-C),z=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),F=Math.pow(2,z);return new u.a0(z,Math.floor((v+T)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new H(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Mo extends tr{constructor(s,f,d,m){super(s,f,d,m),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new H(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ps extends tr{constructor(s,f,d,m){super(s,f,d,m),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(C=>typeof C!="number"))||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`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 u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new H(f,this.canvas,d.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,m=!0)}m&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}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 Os={},Ba=_=>{switch(_){case"geojson":return kr;case"image":return tr;case"raster":return Nt;case"raster-dem":return Ye;case"vector":return kn;case"video":return Mo;case"canvas":return ps}return Os[_]},Pi="RTLPluginLoaded";class bl extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ar()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=I.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Pi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ds=null;function re(){return ds||(ds=new bl),ds}class Ko{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.a3(),this.uses=0,this.tileSize=f,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 f=s+this.timeAdded;fv.getLayer(k)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(k=>M.filter(z=>z.id===k)[0]));for(const k of M)C[k.id]=T}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5&&v.hasRTLText){this.hasRTLText=!0,re().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(m).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}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 m=this.buckets[d];m.uploadPending()&&m.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new H(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new H(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,d,m,v,C,T,M,k,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:T,queryPadding:this.queryPadding*k},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const m=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=m._geojsonTileLayer||m[v];if(!C)return;const T=u.a6(f&&f.filter),{z:M,x:k,y:z}=this.tileID.canonical,F={z:M,x:k,y:z};for(let Z=0;Zd)m=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}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 f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const d=s.wrapped().key,m=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][m];return this.data[d].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const d in this.data)for(const m of this.data[d])s(m.value)||f.push(m);for(const d of f)this.remove(d.value.tileID,d)}}class xl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const m=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},u.e(this.stateChanges[s][m],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==m&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const v in this.state[s][m])d[v]||(this.deletedStates[s][m][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][v]===null&&delete this.deletedStates[s][m][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const m=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(d in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][d]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),m=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete m[C]}return m}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const C in this.stateChanges[m])this.state[m][C]||(this.state[m][C]={}),u.e(this.state[m][C],this.stateChanges[m][C]),v[C]=this.state[m][C];d[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const C in this.state[m])v[C]={},this.state[m][C]={};else for(const C in this.deletedStates[m]){if(this.deletedStates[m][C]===null)this.state[m][C]={};else for(const T of Object.keys(this.deletedStates[m][C]))delete this.state[m][C][T];v[C]=this.state[m][C]}d[m]=d[m]||{},u.e(d[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const m in s)s[m].setFeatureState(d,f)}}class Zr extends u.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,C,T)=>{const M=new(Ba(v.type))(m,v,C,T);if(M.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new Ki(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new xl,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 f=this._tiles[s];if(f.state!=="loaded"&&f.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,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(m){s.state="errored",m.status!==404?this._source.fire(new u.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new u.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 f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ce).map(s=>s.key)}getRenderableIds(s){const f=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&f.push(this._tiles[d]);return s?f.sort((d,m)=>{const v=d.tileID,C=m.tileID,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(ce).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!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,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=I.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,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 u.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let m=0;m1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,C,T),m.neighboringTiles&&m.neighboringTiles[k]&&(m.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,m){for(const v in this._tiles){let C=this._tiles[v];if(m[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>d)continue;let T=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const k=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[k.key],C&&C.hasData()&&(T=k)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){m[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const m=s.scaledTo(d),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const d={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let d;this.transform=s,this.terrain=f,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(z=>new u.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.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:f}),this._source.hasTile&&(d=d.filter(z=>this._source.hasTile(z)))):d=[];const m=s.coveringZoomLevel(this._source),v=Math.max(m-Zr.maxOverzooming,this._source.minzoom),C=Math.max(m+Zr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of d)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);z[Z.key]=Z;const it=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[it.key]=it}d=d.concat(Object.values(z))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,m);if(en(this._source.type)){const z={},F={},Z=Object.keys(M),it=I.now();for(const rt of Z){const ut=M[rt],$=this._tiles[rt];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=it)continue;const vt=this.findLoadedParent(ut,v);vt&&(this._addTile(vt.tileID),z[vt.tileID.key]=vt.tileID),F[rt]=ut}this._retainLoadedChildren(F,m,C,M);for(const rt in z)M[rt]||(this._coveredTiles[rt]=!0,M[rt]=z[rt]);if(f){const rt={},ut={};for(const $ of d)this._tiles[$.key].hasData()?rt[$.key]=$:ut[$.key]=$;for(const $ in ut){const vt=ut[$].children(this._source.maxzoom);this._tiles[vt[0].key]&&this._tiles[vt[1].key]&&this._tiles[vt[2].key]&&this._tiles[vt[3].key]&&(rt[vt[0].key]=M[vt[0].key]=vt[0],rt[vt[1].key]=M[vt[1].key]=vt[1],rt[vt[2].key]=M[vt[2].key]=vt[2],rt[vt[3].key]=M[vt[3].key]=vt[3],delete ut[$])}for(const $ in ut){const vt=this.findLoadedParent(ut[$],this._source.minzoom);if(vt){rt[vt.tileID.key]=M[vt.tileID.key]=vt.tileID;for(const Ft in rt)rt[Ft].isChildOf(vt.tileID)&&delete rt[Ft]}}for(const $ in this._tiles)rt[$]||(this._coveredTiles[$]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const k=u.ab(this._tiles,M);for(const z of k){const F=this._tiles[z];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const d={},m={},v=Math.max(f-Zr.maxOverzooming,this._source.minzoom),C=Math.max(f+Zr.maxUnderzooming,this._source.minzoom),T={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],Z=this.getTile(F);if(Z&&Z.hasData()){d[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(d[F[0].key]&&d[F[1].key]&&d[F[2].key]&&d[F[3].key])continue}let z=k.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const Z=M.scaledTo(F);if(m[Z.key])break;if(m[Z.key]=!0,k=this.getTile(Z),!k&&z&&(k=this._addTile(Z)),k){const it=k.hasData();if((z||it)&&(d[Z.key]=Z),z=k.wasRequested(),it)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){d=this._loadedParentTiles[m.key];break}f.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;m=v}for(const v of f)this._loadedParentTiles[v]=d}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const d=f;return f||(f=new Ko(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const m=[],v=this.transform;if(!v)return m;const C=d?v.getCameraQueryGeometry(s):s,T=s.map(rt=>v.pointCoordinate(rt,this.terrain)),M=C.map(rt=>v.pointCoordinate(rt,this.terrain)),k=this.getIds();let z=1/0,F=1/0,Z=-1/0,it=-1/0;for(const rt of M)z=Math.min(z,rt.x),F=Math.min(F,rt.y),Z=Math.max(Z,rt.x),it=Math.max(it,rt.y);for(let rt=0;rt=0&&ht[1].y+Ft>=0){const It=T.map(Gt=>$.getTilePoint(Gt)),Bt=M.map(Gt=>$.getTilePoint(Gt));m.push({tile:ut,tileID:$,queryGeometry:It,cameraQueryGeometry:Bt,scale:vt})}}return m}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of f)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(en(this._source.type)){const s=I.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,d){this._state.updateState(s=s||"_geojsonTileLayer",f,d)}removeFeatureState(s,f,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,d)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,d){const m=this._tiles[s];m&&m.setDependencies(f,d)}reloadTilesForDependencies(s,f){for(const d in this._tiles)this._tiles[d].hasDependency(s,f)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,f))}}function ce(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function en(_){return _==="raster"||_==="image"||_==="video"}Zr.maxOverzooming=10,Zr.maxUnderzooming=3;class Je{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(m-C)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Dr(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Jo{constructor(s,f,d){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let C=0;Cthis.width||m<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=m){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:m}];for(let k=0;k0}hitTestCircle(s,f,d,m,v){const C=s-d,T=s+d,M=f-d,k=f+d;if(T<0||C>this.width||k<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,T,k,this._queryCellCircle,z,{hitTest:!0,overlapMode:m,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,d,m,v,C,T,M){const{seenUids:k,hitTest:z,overlapMode:F}=T,Z=this.boxCells[v];if(Z!==null){const rt=this.bboxes;for(const ut of Z)if(!k.box[ut]){k.box[ut]=!0;const $=4*ut,vt=this.boxKeys[ut];if(s<=rt[$+2]&&f<=rt[$+3]&&d>=rt[$+0]&&m>=rt[$+1]&&(!M||M(vt))&&(!z||!Dr(F,vt.overlapMode))&&(C.push({key:vt,x1:rt[$],y1:rt[$+1],x2:rt[$+2],y2:rt[$+3]}),z))return!0}}const it=this.circleCells[v];if(it!==null){const rt=this.circles;for(const ut of it)if(!k.circle[ut]){k.circle[ut]=!0;const $=3*ut,vt=this.circleKeys[ut];if(this._circleAndRectCollide(rt[$],rt[$+1],rt[$+2],s,f,d,m)&&(!M||M(vt))&&(!z||!Dr(F,vt.overlapMode))){const Ft=rt[$],ht=rt[$+1],It=rt[$+2];if(C.push({key:vt,x1:Ft-It,y1:ht-It,x2:Ft+It,y2:ht+It}),z)return!0}}}return!1}_queryCellCircle(s,f,d,m,v,C,T,M){const{circle:k,seenUids:z,overlapMode:F}=T,Z=this.boxCells[v];if(Z!==null){const rt=this.bboxes;for(const ut of Z)if(!z.box[ut]){z.box[ut]=!0;const $=4*ut,vt=this.boxKeys[ut];if(this._circleAndRectCollide(k.x,k.y,k.radius,rt[$+0],rt[$+1],rt[$+2],rt[$+3])&&(!M||M(vt))&&!Dr(F,vt.overlapMode))return C.push(!0),!0}}const it=this.circleCells[v];if(it!==null){const rt=this.circles;for(const ut of it)if(!z.circle[ut]){z.circle[ut]=!0;const $=3*ut,vt=this.circleKeys[ut];if(this._circlesCollide(rt[$],rt[$+1],rt[$+2],k.x,k.y,k.radius)&&(!M||M(vt))&&!Dr(F,vt.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,m,v,C,T,M){const k=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),Z=this._convertToYCellCoord(m);for(let it=k;it<=F;it++)for(let rt=z;rt<=Z;rt++)if(v.call(this,s,f,d,m,this.xCellCount*rt+it,C,T,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,f,d,m,v,C){const T=m-s,M=v-f,k=d+C;return k*k>T*T+M*M}_circleAndRectCollide(s,f,d,m,v,C,T){const M=(C-m)/2,k=Math.abs(s-(m+M));if(k>M+d)return!1;const z=(T-v)/2,F=Math.abs(f-(v+z));if(F>z+d)return!1;if(k<=M||F<=z)return!0;const Z=k-M,it=F-z;return Z*Z+it*it<=d*d}}function Ke(_,s,f,d,m){const v=u.F();return s?(u.J(v,v,[1/m,1/m,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ga(_,s,f,d,m){if(s){const v=u.ae(_);return u.J(v,v,[m,m,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Fr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],Te(d,d,s));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m}}function lt(_,s){return .5+_/s*.5}function B(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function q(_,s,f,d,m,v,C,T,M,k){const z=d?_.textSizeData:_.iconSizeData,F=u.ag(z,f.transform.zoom),Z=[256/f.width*2+1,256/f.height*2+1],it=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;it.clear();const rt=_.lineVertexArray,ut=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,$=f.transform.width/f.transform.height;let vt=!1;for(let Ft=0;FtMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function xt(_,s,f,d,m,v,C,T,M,k,z,F,Z,it,rt,ut){const $=s/24,vt=_.lineOffsetX*$,Ft=_.lineOffsetY*$;let ht;if(_.numGlyphs>1){const It=_.glyphStartIndex+_.numGlyphs,Bt=_.lineStartIndex,Gt=_.lineStartIndex+_.lineLength,Ht=J($,T,vt,Ft,f,z,F,_,M,v,Z,rt,ut);if(!Ht)return{notEnoughRoom:!0};const te=Fr(Ht.first.point,C,ut).point,$t=Fr(Ht.last.point,C,ut).point;if(d&&!f){const oe=nt(_.writingMode,te,$t,it);if(oe)return oe}ht=[Ht.first];for(let oe=_.glyphStartIndex+1;oe0?te.point:Q(F,Ht,Bt,1,m,ut),oe=nt(_.writingMode,Bt,$t,it);if(oe)return oe}const It=Vt($*T.getoffsetX(_.glyphStartIndex),vt,Ft,f,z,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,Z,rt,ut);if(!It)return{notEnoughRoom:!0};ht=[It]}for(const It of ht)u.aj(k,It.point,It.angle);return{}}function Q(_,s,f,d,m,v){const C=Fr(_.add(_.sub(s)._unit()),m,v).point,T=f.sub(C);return f.add(T._mult(d/T.mag()))}function wt(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:T,previousVertex:M,direction:k,absOffsetX:z}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),Z=Fr(F,m,T);if(Z.signedDistanceFromCamera>0)return f.projections[_]=Z.point,Z.point;const it=_-k;return Q(C===0?v:new u.P(d.getx(it),d.gety(it)),F,M,z-C+1,m,T)}function dt(_,s,f){return _._unit()._perp()._mult(s*f)}function Pt(_,s,f,d,m,v,C,T){const{projectionCache:M,direction:k}=T;if(M.offsets[_])return M.offsets[_];const z=f.add(s);if(_+k=m)return M.offsets[_]=z,z;const F=wt(_+k,T),Z=dt(F.sub(f),C,k),it=f.add(Z),rt=F.add(Z);return M.offsets[_]=u.ak(v,z,it,rt)||z,M.offsets[_]}function Vt(_,s,f,d,m,v,C,T,M,k,z,F,Z,it){const rt=d?_-s:_+s;let ut=rt>0?1:-1,$=0;d&&(ut*=-1,$=Math.PI),ut<0&&($+=Math.PI);let vt,Ft,ht=ut>0?T+C:T+C+1,It=m,Bt=m,Gt=0,Ht=0;const te=Math.abs(rt),$t=[];let oe;for(;Gt+Ht<=te;){if(ht+=ut,ht=M)return null;Gt+=Ht,Bt=It,Ft=vt;const pe={projectionCache:F,lineVertexArray:k,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:Gt,getElevation:it,previousVertex:Bt,direction:ut,absOffsetX:te};if(It=wt(ht,pe),f===0)$t.push(Bt),oe=It.sub(Bt);else{let Be;const rn=It.sub(Bt);Be=rn.mag()===0?dt(wt(ht+ut,pe).sub(It),f,ut):dt(rn,f,ut),Ft||(Ft=Bt.add(Be)),vt=Pt(ht,Be,It,T,M,Ft,f,pe),$t.push(Ft),oe=vt.sub(Ft)}Ht=oe.mag()}const he=oe._mult((te-Gt)/Ht)._add(Ft||Bt),nn=$+Math.atan2(It.y-Bt.y,It.x-Bt.x);return $t.push(he),{point:he,angle:Z?nn:0,path:$t}}const Wt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(Wt,3*d)}}function Te(_,s,f){const d=s[0],m=s[1];return _[0]=f[0]*d+f[4]*m+f[12],_[1]=f[1]*d+f[5]*m+f[13],_[3]=f[3]*d+f[7]*m+f[15],_}const ke=100;class We{constructor(s,f=new Jo(s.width+200,s.height+200,25),d=new Jo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+ke,this.screenBottomBoundary=s.height+ke,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,m,v,C){const T=this.projectAndGetPerspectiveRatio(m,s.anchorPointX,s.anchorPointY,C),M=d*T.perspectiveRatio,k=s.x1*M+T.point.x,z=s.y1*M+T.point.y,F=s.x2*M+T.point.x,Z=s.y2*M+T.point.y;return!this.isInsideGrid(k,z,F,Z)||f!=="always"&&this.grid.hitTest(k,z,F,Z,f,v)||T.perspectiveRatio=1;an--)rn.push(pe.path[an]);for(let an=1;anFr(fn,M,rt));rn=an.some(fn=>fn.signedDistanceFromCamera<=0)?[]:an.map(fn=>fn.point)}let qe=[];if(rn.length>0){const an=rn[0].clone(),fn=rn[0].clone();for(let Cr=1;Cr=oe.x&&fn.x<=he.x&&an.y>=oe.y&&fn.y<=he.y?[rn]:fn.xhe.x||fn.yhe.y?[]:u.al([rn],oe.x,oe.y,he.x,he.y)}for(const an of qe){nn.reset(an,.25*$t);let fn=0;fn=nn.length<=.5*$t?1:Math.ceil(nn.paddedLength/wn)+1;for(let Cr=0;Cr=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(s,f,d,m){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function si(_,s,f,d,m){const{horizontalAlign:v,verticalAlign:C}=u.at(_);return new u.P(-(v-.5)*s+d[0]*m,-(C-.5)*f+d[1]*m)}function Ji(_,s,f,d,m,v){const{x1:C,x2:T,y1:M,y2:k,anchorPointX:z,anchorPointY:F}=_,Z=new u.P(s,f);return d&&Z._rotate(m?v:-v),{x1:C+Z.x,y1:M+Z.y,x2:T+Z.x,y2:k+Z.y,anchorPointX:z,anchorPointY:F}}class co{constructor(s,f,d,m,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new We(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Sr(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,m){const v=d.getBucket(f),C=d.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const T=d.collisionBoxArray,M=v.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),z=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),Z=M.get("text-pitch-alignment")==="map",it=M.get("text-rotation-alignment")==="map",rt=He(d,1,this.transform.zoom),ut=Ke(F,Z,it,this.transform,rt);let $=null;if(Z){const Ft=ga(F,Z,it,this.transform,rt);$=u.K([],this.transform.labelPlaneMatrix,Ft)}this.retainedQueryData[v.bucketInstanceId]=new sn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const vt={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:ut,labelToScreenMatrix:$,scale:k,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const Ft of v.sortKeyRanges){const{sortKey:ht,symbolInstanceStart:It,symbolInstanceEnd:Bt}=Ft;s.push({sortKey:ht,symbolInstanceStart:It,symbolInstanceEnd:Bt,parameters:vt})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:vt})}attemptAnchorPlacement(s,f,d,m,v,C,T,M,k,z,F,Z,it,rt,ut,$){const vt=u.ap[s.textAnchor],Ft=[s.textOffset0,s.textOffset1],ht=si(vt,d,m,Ft,v),It=this.collisionIndex.placeCollisionBox(Ji(f,ht.x,ht.y,C,T,this.transform.angle),F,M,k,z.predicate,$);if((!ut||this.collisionIndex.placeCollisionBox(Ji(ut,ht.x,ht.y,C,T,this.transform.angle),F,M,k,z.predicate,$).box.length!==0)&&It.box.length>0){let Bt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Bt=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:Ft,width:d,height:m,anchor:vt,textBoxScale:v,prevAnchor:Bt},this.markUsedJustification(it,vt,Z,rt),it.allowVerticalPlacement&&(this.markUsedOrientation(it,rt,Z),this.placedOrientations[Z.crossTileID]=rt),{shift:ht,placedGlyphBoxes:It}}}placeLayerBucketPart(s,f,d){const{bucket:m,layout:v,posMatrix:C,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:Z,collisionGroup:it}=s.parameters,rt=v.get("text-optional"),ut=v.get("icon-optional"),$=u.aq(v,"text-overlap","text-allow-overlap"),vt=$==="always",Ft=u.aq(v,"icon-overlap","icon-allow-overlap"),ht=Ft==="always",It=v.get("text-rotation-alignment")==="map",Bt=v.get("text-pitch-alignment")==="map",Gt=v.get("icon-text-fit")!=="none",Ht=v.get("symbol-z-order")==="viewport-y",te=vt&&(ht||!m.hasIconData()||ut),$t=ht&&(vt||!m.hasTextData()||rt);!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F);const oe=this.retainedQueryData[m.bucketInstanceId].tileID,he=this.terrain?(pe,Be)=>this.terrain.getElevation(oe,pe,Be):null,nn=(pe,Be)=>{var rn,wn;if(f[pe.crossTileID])return;if(z)return void(this.placements[pe.crossTileID]=new ar(!1,!1,!1));let qe=!1,an=!1,fn=!0,Cr=null,Gn={box:null,offscreen:null},Ro={box:null,offscreen:null},ai=null,mr=null,li=null,No=0,Gs=0,Ha=0;Be.textFeatureIndex?No=Be.textFeatureIndex:pe.useRuntimeCollisionCircles&&(No=pe.featureIndex),Be.verticalTextFeatureIndex&&(Gs=Be.verticalTextFeatureIndex);const gc=Be.textBox;if(gc){const Kr=Jr=>{let yr=u.ah.horizontal;if(m.allowVerticalPlacement&&!Jr&&this.prevPlacement){const es=this.prevPlacement.placedOrientations[pe.crossTileID];es&&(this.placedOrientations[pe.crossTileID]=es,yr=es,this.markUsedOrientation(m,yr,pe))}return yr},gr=(Jr,yr)=>{if(m.allowVerticalPlacement&&pe.numVerticalGlyphVertices>0&&Be.verticalTextBox){for(const es of m.writingModes)if(es===u.ah.vertical?(Gn=yr(),Ro=Gn):Gn=Jr(),Gn&&Gn.box&&Gn.box.length)break}else Gn=Jr()},ur=pe.textAnchorOffsetStartIndex,ts=pe.textAnchorOffsetEndIndex;if(ts===ur){const Jr=(yr,es)=>{const Qr=this.collisionIndex.placeCollisionBox(yr,$,k,C,it.predicate,he);return Qr&&Qr.box&&Qr.box.length&&(this.markUsedOrientation(m,es,pe),this.placedOrientations[pe.crossTileID]=es),Qr};gr(()=>Jr(gc,u.ah.horizontal),()=>{const yr=Be.verticalTextBox;return m.allowVerticalPlacement&&pe.numVerticalGlyphVertices>0&&yr?Jr(yr,u.ah.vertical):{box:null,offscreen:null}}),Kr(Gn&&Gn.box&&Gn.box.length)}else{let Jr=u.ap[(wn=(rn=this.prevPlacement)===null||rn===void 0?void 0:rn.variableOffsets[pe.crossTileID])===null||wn===void 0?void 0:wn.anchor];const yr=(Qr,Rr,Pp)=>{const zm=Qr.x2-Qr.x1,Ml=Qr.y2-Qr.y1,Al=pe.textBoxScale,Nh=Gt&&Ft==="never"?Rr:null;let Xa={box:[],offscreen:!1},Mp=$==="never"?1:2,Fm="never";Jr&&Mp++;for(let Ap=0;Apyr(gc,Be.iconBox,u.ah.horizontal),()=>{const Qr=Be.verticalTextBox;return m.allowVerticalPlacement&&!(Gn&&Gn.box&&Gn.box.length)&&pe.numVerticalGlyphVertices>0&&Qr?yr(Qr,Be.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Gn&&(qe=Gn.box,fn=Gn.offscreen);const es=Kr(Gn&&Gn.box);if(!qe&&this.prevPlacement){const Qr=this.prevPlacement.variableOffsets[pe.crossTileID];Qr&&(this.variableOffsets[pe.crossTileID]=Qr,this.markUsedJustification(m,Qr.anchor,pe,es))}}}if(ai=Gn,qe=ai&&ai.box&&ai.box.length>0,fn=ai&&ai.offscreen,pe.useRuntimeCollisionCircles){const Kr=m.text.placedSymbolArray.get(pe.centerJustifiedTextSymbolIndex),gr=u.ai(m.textSizeData,Z,Kr),ur=v.get("text-padding");mr=this.collisionIndex.placeCollisionCircles($,Kr,m.lineVertexArray,m.glyphOffsetArray,gr,C,T,M,d,Bt,it.predicate,pe.collisionCircleDiameter,ur,he),mr.circles.length&&mr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),qe=vt||mr.circles.length>0&&!mr.collisionDetected,fn=fn&&mr.offscreen}if(Be.iconFeatureIndex&&(Ha=Be.iconFeatureIndex),Be.iconBox){const Kr=gr=>{const ur=Gt&&Cr?Ji(gr,Cr.x,Cr.y,It,Bt,this.transform.angle):gr;return this.collisionIndex.placeCollisionBox(ur,Ft,k,C,it.predicate,he)};Ro&&Ro.box&&Ro.box.length&&Be.verticalIconBox?(li=Kr(Be.verticalIconBox),an=li.box.length>0):(li=Kr(Be.iconBox),an=li.box.length>0),fn=fn&&li.offscreen}const Za=rt||pe.numHorizontalGlyphVertices===0&&pe.numVerticalGlyphVertices===0,qs=ut||pe.numIconVertices===0;if(Za||qs?qs?Za||(an=an&&qe):qe=an&&qe:an=qe=an&&qe,qe&&ai&&ai.box&&this.collisionIndex.insertCollisionBox(ai.box,$,v.get("text-ignore-placement"),m.bucketInstanceId,Ro&&Ro.box&&Gs?Gs:No,it.ID),an&&li&&this.collisionIndex.insertCollisionBox(li.box,Ft,v.get("icon-ignore-placement"),m.bucketInstanceId,Ha,it.ID),mr&&(qe&&this.collisionIndex.insertCollisionCircles(mr.circles,$,v.get("text-ignore-placement"),m.bucketInstanceId,No,it.ID),d)){const Kr=m.bucketInstanceId;let gr=this.collisionCircleArrays[Kr];gr===void 0&&(gr=this.collisionCircleArrays[Kr]=new Xr);for(let ur=0;ur=0;--Be){const rn=pe[Be];nn(m.symbolInstances.get(rn),m.collisionArrays[rn])}}else for(let pe=s.symbolInstanceStart;pe=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const m=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,C=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of C)s.text.placedSymbolArray.get(T).placedOrientation=m;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let d=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const m=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},T=f?f.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],z=v[M];z?(this.opacities[M]=new Hn(z,m,k.text,k.icon),d=d||k.text!==z.text.placed||k.icon!==z.icon.placed):(this.opacities[M]=new Hn(null,m,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in v){const k=v[M];if(!this.opacities[M]){const z=new Hn(k,m,!1,!1);z.isHidden()||(this.opacities[M]=z,d=d||k.text.placed||k.icon.placed)}}for(const M in C)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=C[M]);for(const M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.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=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const m of f){const v=m.getBucket(s);v&&m.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,m.collisionBoxArray)}}updateBucketOpacities(s,f,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 m=s.layers[0],v=m.layout,C=new Hn(null,0,!1,!1,!0),T=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",Z=v.get("icon-text-fit")!=="none",it=new Hn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const rt=(ut,$,vt)=>{for(let Ft=0;Ft<$/4;Ft++)ut.opacityVertexArray.emplaceBack(vt);ut.hasVisibleVertices=ut.hasVisibleVertices||vt!==Xu};for(let ut=0;ut0,Gt=this.placedOrientations[$.crossTileID],Ht=Gt===u.ah.vertical,te=Gt===u.ah.horizontal||Gt===u.ah.horizontalOnly;if(vt>0||Ft>0){const $t=ho(It.text);rt(s.text,vt,Ht?Xu:$t),rt(s.text,Ft,te?Xu:$t);const oe=It.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(pe=>{pe>=0&&(s.text.placedSymbolArray.get(pe).hidden=oe||Ht?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=oe||te?1:0);const he=this.variableOffsets[$.crossTileID];he&&this.markUsedJustification(s,he.anchor,$,Gt);const nn=this.placedOrientations[$.crossTileID];nn&&(this.markUsedJustification(s,"left",$,nn),this.markUsedOrientation(s,nn,$))}if(Bt){const $t=ho(It.icon),oe=!(Z&&$.verticalPlacedIconSymbolIndex&&Ht);$.placedIconSymbolIndex>=0&&(rt(s.icon,$.numIconVertices,oe?$t:Xu),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=It.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(rt(s.icon,$.numVerticalIconVertices,oe?Xu:$t),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=It.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $t=s.collisionArrays[ut];if($t){let oe=new u.P(0,0);if($t.textBox||$t.verticalTextBox){let nn=!0;if(k){const pe=this.variableOffsets[ht];pe?(oe=si(pe.anchor,pe.width,pe.height,pe.textOffset,pe.textBoxScale),z&&oe._rotate(F?this.transform.angle:-this.transform.angle)):nn=!1}$t.textBox&&vi(s.textCollisionBox.collisionVertexArray,It.text.placed,!nn||Ht,oe.x,oe.y),$t.verticalTextBox&&vi(s.textCollisionBox.collisionVertexArray,It.text.placed,!nn||te,oe.x,oe.y)}const he=!!(!te&&$t.verticalIconBox);$t.iconBox&&vi(s.iconCollisionBox.collisionVertexArray,It.icon.placed,he,Z?oe.x:0,Z?oe.y:0),$t.verticalIconBox&&vi(s.iconCollisionBox.collisionVertexArray,It.icon.placed,!he,Z?oe.x:0,Z?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 ut=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ut.invProjMatrix,s.placementViewportMatrix=ut.viewportMatrix,s.collisionCircleArray=ut.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 vi(_,s,f,d,m){_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0)}const zs=Math.pow(2,25),tm=Math.pow(2,24),Gy=Math.pow(2,17),Vn=Math.pow(2,16),Jf=Math.pow(2,9),Qf=Math.pow(2,8),Ao=Math.pow(2,1);function ho(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*zs+s*tm+f*Gy+s*Vn+f*Jf+s*Qf+f*Ao+s}const Xu=0;class Qo{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,f,d,m,v){const C=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-m>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=T)&&(!C.maxzoom||C.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Qo(C)),this._inProgressLayer.continuePlacement(d[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const ru=512/u.W/2;class Kc{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(M.anchorX*ru),y:Math.floor(M.anchorY*ru)})),crossTileIDs:C.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:k,y:z}of T.positions)M.add(k,z);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:m,z:v}=this.tileID.canonical,{x:C,y:T,z:M}=f.canonical,k=ru/Math.pow(2,M-v),z=(T*u.W+s.anchorY)*k,F=m*u.W*ru;return{x:Math.floor((C*u.W+s.anchorX)*k-d*u.W*ru),y:Math.floor(z-F)}}findMatches(s,f,d){const m=this.tileID.canonical.zs)}}class Yr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const d in this.indexes){const m=this.indexes[d],v={};for(const C in m){const T=m[C];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in C){const M=C[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,m)}else{const T=C[s.scaledTo(Number(v)).key];T&&T.findMatches(f.symbolInstances,s,m)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const dr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Jc=u.av();class ko extends u.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const m=this.sourceCaches[d].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new xr(An(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,m)=>this.getGlyphs(d,m)),this.dispatcher.registerMessageHandler("GI",(d,m)=>this.getImages(d,m)),this.imageManager=new Kt,this.imageManager.setEventedParent(this),this.glyphManager=new qt(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ge(256,512),this.crossTileSymbolIndex=new Va,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),re().on(Pi,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.sourceCaches[d.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const T=this._layers[C];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Jc,{validate:!1})}_load(s,f,d){var m;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!dr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new un(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,T,M){return u._(this,void 0,void 0,function*(){const k=Ct(v),z=T>1?"@2x":"",F={},Z={};for(const{id:it,url:rt}of k){const ut=C.transformRequest(C.normalizeSpriteURL(rt,z,".json"),"SpriteJSON");F[it]=u.h(ut,M);const $=C.transformRequest(C.normalizeSpriteURL(rt,z,".png"),"SpriteImage");Z[it]=j.getImage($,M)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(it,rt){return u._(this,void 0,void 0,function*(){const ut={};for(const $ in it){ut[$]={};const vt=I.getImageCanvasContext((yield rt[$]).data),Ft=(yield it[$]).data;for(const ht in Ft){const{width:It,height:Bt,x:Gt,y:Ht,sdf:te,pixelRatio:$t,stretchX:oe,stretchY:he,content:nn}=Ft[ht];ut[$][ht]={data:null,pixelRatio:$t,sdf:te,stretchX:oe,stretchY:he,content:nn,spriteData:{width:It,height:Bt,x:Gt,y:Ht,context:vt}}}}return ut})}(F,Z)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const T=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const k=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,v[C][M],!1):this.imageManager.addImage(k,v[C][M]),f&&(this._changedImages[k]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new u.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(m)})}_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("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const m=f.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${m.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 f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const m of s)f[m]&&d.push(f[m]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const d of f){const m=this._layers[d];m.type!=="custom"&&(s[d]=m.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 f=this._changed;if(f){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const C in this._updatedSources){const T=this._updatedSources[C];if(T==="reload")this._reloadSource(C);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];d[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in d){const v=this.sourceCaches[m];!!d[m]!=!!v.used&&v.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].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,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const m=this.serialize();if(s=f.transformStyle?f.transformStyle(m,s):s,((d=f.validate)===null||d===void 0||d)&&dr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.aB(m,s),C=this._getOperationsToPerform(v);if(C.unimplemented.length>0)throw new Error(`Unimplemented: ${C.unimplemented.join(", ")}.`);if(C.operations.length===0)return!1;for(const T of C.operations)T();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":f.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":f.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":f.push(()=>{});break;default:d.push(m.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.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("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Zr(s,f,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.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 u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){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(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new u.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(s.type==="custom"){if(dr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=u.aA(s),s=u.e(s,{source:m})),this._validate(u.x.layer,`layers.${m}`,s,{arrayIndex:-1},d))return;v=u.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new u.j(new Error(`Cannot add layer "${m}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const T=this._removedLayers[m];delete this._removedLayers[m],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const m=f?this._order.indexOf(f):this._order.length;f&&m===-1?this.fire(new u.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===f&&m.maxzoom===d||(f!=null&&(m.minzoom=f),d!=null&&(m.maxzoom=d),this._updateLayer(m)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!u.aD(m.filter,f))return f==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(u.x.filter,`layers.${m.id}.filter`,f,null,d)||(m.filter=u.aA(f),this._updateLayer(m)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,m),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,m=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&m?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||m?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,m=this.sourceCaches[d];if(m===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=m.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(C,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,m=this.sourceCaches[f];if(m!==void 0)return m.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,m=this.stylesheet;return u.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:f,terrain:d},v=>v!==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 f=C=>this._layers[C].type==="fill-extrusion",d={},m=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T)){d[T]=C;for(const M of s){const k=M[T];if(k)for(const z of k)m.push(z)}}}m.sort((C,T)=>T.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T))for(let M=m.length-1;M>=0;M--){const k=m[M].feature;if(d[k.layer.id]{const te=vt.featureSortOrder;if(te){const $t=te.indexOf(Gt.featureIndex);return te.indexOf(Ht.featureIndex)-$t}return Ht.featureIndex-Gt.featureIndex});for(const Gt of Bt)It.push(Gt)}}for(const vt in rt)rt[vt].forEach(Ft=>{const ht=Ft.feature,It=k[T[vt].source].getFeatureState(ht.layer["source-layer"],ht.id);ht.source=ht.layer.source,ht.layer["source-layer"]&&(ht.sourceLayer=ht.layer["source-layer"]),ht.state=It});return rt}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(m,v){const C=m.getRenderableIds().map(k=>m.getTileByID(k)),T=[],M={};for(let k=0;kZ.getTileByID(it)).sort((it,rt)=>rt.tileID.overscaledZ-it.tileID.overscaledZ||(it.tileID.isLessThan(rt.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(z,M[z.source],s.center.lng);C=C||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new $o(s,this.map.terrain,this._order,v,f,d,m,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(I.now()),T=!0),C&&this.pauseablePlacement.placement.setStale()),T||C)for(const k of this._order){const z=this._layers[k];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(I.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},m){this._checkLoaded();const v=[{id:s,url:f}],C=[...Ct(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",C,null,d)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,m))}removeSprite(s){this._checkLoaded();const f=Ct(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ct(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var Qc=u.X([{name:"a_pos",type:"Int16",components:2}]),Fs="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 Ku={prelude:Un(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 +);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} +#ifdef TERRAIN3D +uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; +#endif +const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { +#ifdef TERRAIN3D +highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; +#else +return 0.0; +#endif +}`),background:Un(`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:Un(`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:Un(`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 +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;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 +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#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:Un("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:Un(`uniform highp float u_intensity;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +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:Un(`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:Un("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:Un("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:Un("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:Un(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Un(`varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +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:Un(`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 +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;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 +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#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:Un(`#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; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#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:Un(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#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:Un(`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 +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +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 +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#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;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#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);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:Un(`#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:Un(`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:Un(`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 +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +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:Un(`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() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +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:Un(`#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; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +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:Un(`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 +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;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 +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +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:Un(`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:Un(`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 +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +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:Un(`#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 +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#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:Un(`#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; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#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:Un("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Fs),terrainDepth:Un("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);}",Fs),terrainCoords:Un("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);}",Fs)};function Un(_,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),m=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(m):m,T={};return{fragmentSource:_=_.replace(f,(M,k,z,F,Z)=>(T[Z]=!0,k==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +varying ${z} ${F} ${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${Z} + ${z} ${F} ${Z} = u_${Z}; +#endif +`)),vertexSource:s=s.replace(f,(M,k,z,F,Z)=>{const it=F==="float"?"vec2":"vec4",rt=Z.match(/color/)?"color":it;return T[Z]?k==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +uniform lowp float u_${Z}_t; +attribute ${z} ${it} a_${Z}; +varying ${z} ${F} ${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:rt==="vec4"?` +#ifndef HAS_UNIFORM_u_${Z} + ${Z} = a_${Z}; +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Z} + ${Z} = unpack_mix_${rt}(a_${Z}, u_${Z}_t); +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:k==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +uniform lowp float u_${Z}_t; +attribute ${z} ${it} a_${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:rt==="vec4"?` +#ifndef HAS_UNIFORM_u_${Z} + ${z} ${F} ${Z} = a_${Z}; +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Z} + ${z} ${F} ${Z} = unpack_mix_${rt}(a_${Z}, u_${Z}_t); +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`}),staticAttributes:d,staticUniforms:C}}class $c{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,d,m,v,C,T,M,k){this.context=s;let z=this.boundPaintVertexBuffers.length!==m.length;for(let F=0;!z&&F({u_depth:new u.aG(Gt,Ht.u_depth),u_terrain:new u.aG(Gt,Ht.u_terrain),u_terrain_dim:new u.aH(Gt,Ht.u_terrain_dim),u_terrain_matrix:new u.aI(Gt,Ht.u_terrain_matrix),u_terrain_unpack:new u.aJ(Gt,Ht.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Gt,Ht.u_terrain_exaggeration)}))(s,Bt),this.binderUniforms=d?d.getUniforms(s,Bt):[]}draw(s,f,d,m,v,C,T,M,k,z,F,Z,it,rt,ut,$,vt,Ft){const ht=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(m),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(ht.TEXTURE2),ht.bindTexture(ht.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ht.TEXTURE3),ht.bindTexture(ht.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(T[Bt]);ut&&ut.setUniforms(s,this.binderUniforms,it,{zoom:rt});let It=0;switch(f){case ht.LINES:It=2;break;case ht.TRIANGLES:It=3;break;case ht.LINE_STRIP:It=1}for(const Bt of Z.get()){const Gt=Bt.vaos||(Bt.vaos={});(Gt[k]||(Gt[k]=new $c)).bind(s,this,z,ut?ut.getPaintVertexBuffers():[],F,Bt.vertexOffset,$,vt,Ft),ht.drawElements(f,Bt.primitiveLength*It,ht.UNSIGNED_SHORT,Bt.primitiveOffset*It*2)}}}function th(_,s,f){const d=1/He(f,1,s.transform.tileZoom),m=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/m,C=v*(f.tileID.canonical.x+f.tileID.wrap*m),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[C>>16,T>>16],u_pixel_coord_lower:[65535&C,65535&T]}}const Ju=(_,s,f,d)=>{const m=s.style.light,v=m.properties.get("position"),C=[v.x,v.y,v.z],T=function(){var k=new u.A(9);return u.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}();m.properties.get("anchor")==="viewport"&&function(k,z){var F=Math.sin(z),Z=Math.cos(z);k[0]=Z,k[1]=F,k[2]=0,k[3]=-F,k[4]=Z,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(T,-s.transform.angle),function(k,z,F){var Z=z[0],it=z[1],rt=z[2];k[0]=Z*F[0]+it*F[3]+rt*F[6],k[1]=Z*F[1]+it*F[4]+rt*F[7],k[2]=Z*F[2]+it*F[5]+rt*F[8]}(C,C,T);const M=m.properties.get("color");return{u_matrix:_,u_lightpos:C,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},qy=(_,s,f,d,m,v,C)=>u.e(Ju(_,s,f,d),th(v,s,C),{u_height_factor:-Math.pow(2,m.overscaledZ)/C.tileSize/8}),em=_=>({u_matrix:_}),eh=(_,s,f,d)=>u.e(em(_),th(f,s,d)),jy=(_,s)=>({u_matrix:_,u_world:s}),nm=(_,s,f,d,m)=>u.e(eh(_,s,f,d),{u_world:m}),Wy=(_,s,f,d)=>{const m=_.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const T=He(f,1,m.zoom);v=!0,C=[T,T]}else v=!1,C=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:C}},rm=(_,s,f)=>{const d=He(f,1,s.zoom),m=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*m),s.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:v}},im=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),nh=_=>({u_matrix:_}),om=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:He(s,1,f),u_intensity:d});function sm(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const rh=(_,s,f,d)=>{const m=_.transform;return{u_matrix:Qu(_,s,f,d),u_ratio:1/He(s,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},am=(_,s,f,d,m)=>u.e(rh(_,s,f,m),{u_image:0,u_image_height:d}),wl=(_,s,f,d,m)=>{const v=_.transform,C=Do(s,v);return{u_matrix:Qu(_,s,f,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/He(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[C,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},ih=(_,s,f,d,m,v)=>{const C=_.lineAtlas,T=Do(s,_.transform),M=f.layout.get("line-cap")==="round",k=C.getDash(d.from,M),z=C.getDash(d.to,M),F=k.width*m.fromScale,Z=z.width*m.toScale;return u.e(rh(_,s,f,v),{u_patternscale_a:[T/F,-k.height/2],u_patternscale_b:[T/Z,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,Z)*_.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:z.y,u_mix:m.t})};function Do(_,s){return 1/He(_,1,s.tileZoom)}function Qu(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const oh=(_,s,f,d,m)=>{return{u_matrix:_,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(C=m.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:$u(m.paint.get("raster-hue-rotate"))};var v,C};function $u(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const tc=(_,s,f,d,m,v,C,T,M,k)=>{const z=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},ec=(_,s,f,d,m,v,C,T,M,k,z)=>{const F=m.transform;return u.e(tc(_,s,f,d,m,v,C,T,M,k),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+z})},nc=(_,s,f,d,m,v,C,T,M,k)=>u.e(ec(_,s,f,d,m,v,C,T,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),Hy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),Zy=(_,s,f,d,m,v)=>u.e(function(C,T,M,k){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:Z,height:it}=M.imageManager.getPixelSize(),rt=Math.pow(2,k.tileID.overscaledZ),ut=k.tileSize*Math.pow(2,M.transform.tileZoom)/rt,$=ut*(k.tileID.canonical.x+k.tileID.wrap*rt),vt=ut*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[Z,it],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/He(k,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,vt>>16],u_pixel_coord_lower:[65535&$,65535&vt]}}(d,v,f,m),{u_matrix:_,u_opacity:s}),lm={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Xy{constructor(s,f,d){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Sl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class sh{constructor(s,f,d,m){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=m,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.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 f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let d=0;d0){const oe=u.F(),he=Ht;u.aP(oe,Gt.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(oe,oe,Gt.placementViewportMatrix),z.push({circleArray:$t,circleOffset:Z,transform:he,invTransform:oe,coord:It}),F+=$t.length/4,Z=F}te&&k.draw(T,M.LINES,xn.disabled,rr.disabled,_.colorModeForRenderPass(),Qn.disabled,rm(Ht,_.transform,Bt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(It),f.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,_.transform.zoom,null,null,te.collisionVertexBuffer)}if(!C||!z.length)return;const it=_.useProgram("collisionCircle"),rt=new u.aQ;rt.resize(4*F),rt._trim();let ut=0;for(const ht of z)for(let It=0;It=0&&(rt[$.associatedIconIndex]={shiftedAnchor:nn,angle:pe})}else Xt($.numGlyphs,Z)}if(k){it.clear();const ut=_.icon.placedSymbolArray;for(let $=0;$_.style.map.terrain.getElevation(te,es,Qr):null,yr=f.layout.get("text-rotation-alignment")==="map";q(oe,te.posMatrix,_,m,No,Gs,$,k,yr,Jr)}const Za=_.translatePosMatrix(te.posMatrix,$t,v,C),qs=vt||m&&Gt||gc?up:No,Kr=_.translatePosMatrix(Gs,$t,v,C,!0),gr=pe&&f.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ur;ur=pe?oe.iconsInText?nc(Be.kind,qe,Ft,$,_,Za,qs,Kr,fn,ai):ec(Be.kind,qe,Ft,$,_,Za,qs,Kr,m,fn,!0):tc(Be.kind,qe,Ft,$,_,Za,qs,Kr,m,fn);const ts={program:wn,buffers:he,uniformValues:ur,atlasTexture:Cr,atlasTextureIcon:mr,atlasInterpolation:Gn,atlasInterpolationIcon:Ro,isSDF:pe,hasHalo:gr};if(ht&&oe.canOverlap){It=!0;const Jr=he.segments.get();for(const yr of Jr)Ht.push({segments:new u.$([yr]),sortKey:yr.sortKey,state:ts,terrainData:an})}else Ht.push({segments:he.segments,sortKey:0,state:ts,terrainData:an})}It&&Ht.sort((te,$t)=>te.sortKey-$t.sortKey);for(const te of Ht){const $t=te.state;if(Z.activeTexture.set(it.TEXTURE0),$t.atlasTexture.bind($t.atlasInterpolation,it.CLAMP_TO_EDGE),$t.atlasTextureIcon&&(Z.activeTexture.set(it.TEXTURE1),$t.atlasTextureIcon&&$t.atlasTextureIcon.bind($t.atlasInterpolationIcon,it.CLAMP_TO_EDGE)),$t.isSDF){const oe=$t.uniformValues;$t.hasHalo&&(oe.u_is_halo=1,ym($t.buffers,te.segments,f,_,$t.program,Bt,z,F,oe,te.terrainData)),oe.u_is_halo=0}ym($t.buffers,te.segments,f,_,$t.program,Bt,z,F,$t.uniformValues,te.terrainData)}}function ym(_,s,f,d,m,v,C,T,M,k){const z=d.context;m.draw(z,z.gl.TRIANGLES,v,C,T,Qn.disabled,M,k,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function yh(_,s,f,d,m){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],T=v[f.from.toString()];if(!C&&T&&(C=T),!T&&C&&(T=C),!C||!T){const M=m.getPaintProperty(s);C=v[M],T=v[M]}C&&T&&_.setConstantPatternPositions(C,T)}function _m(_,s,f,d,m,v,C){const T=_.context.gl,M="fill-pattern",k=f.paint.get(M),z=k&&k.constantOr(1),F=f.getCrossfadeParameters();let Z,it,rt,ut,$;C?(it=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=T.LINES):(it=z?"fillPattern":"fill",Z=T.TRIANGLES);const vt=k.constantOr(null);for(const Ft of d){const ht=s.getTile(Ft);if(z&&!ht.patternsLoaded())continue;const It=ht.getBucket(f);if(!It)continue;const Bt=It.programConfigurations.get(f.id),Gt=_.useProgram(it,Bt),Ht=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Ft);z&&(_.context.activeTexture.set(T.TEXTURE0),ht.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Bt.updatePaintBuffers(F)),yh(Bt,M,vt,ht,f);const te=Ht?Ft:null,$t=_.translatePosMatrix(te?te.posMatrix:Ft.posMatrix,ht,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){ut=It.indexBuffer2,$=It.segments2;const oe=[T.drawingBufferWidth,T.drawingBufferHeight];rt=it==="fillOutlinePattern"&&z?nm($t,_,F,ht,oe):jy($t,oe)}else ut=It.indexBuffer,$=It.segments,rt=z?eh($t,_,F,ht):em($t);Gt.draw(_.context,Z,m,_.stencilModeForClipping(Ft),v,Qn.disabled,rt,Ht,f.id,It.layoutVertexBuffer,ut,$,f.paint,_.transform.zoom,Bt)}}function _h(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k="fill-extrusion-pattern",z=f.paint.get(k),F=z.constantOr(1),Z=f.getCrossfadeParameters(),it=f.paint.get("fill-extrusion-opacity"),rt=z.constantOr(null);for(const ut of d){const $=s.getTile(ut),vt=$.getBucket(f);if(!vt)continue;const Ft=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ut),ht=vt.programConfigurations.get(f.id),It=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ht);F&&(_.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ht.updatePaintBuffers(Z)),yh(ht,k,rt,$,f);const Bt=_.translatePosMatrix(ut.posMatrix,$,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Gt=f.paint.get("fill-extrusion-vertical-gradient"),Ht=F?qy(Bt,_,Gt,it,ut,Z,$):Ju(Bt,_,Gt,it);It.draw(T,T.gl.TRIANGLES,m,v,C,Qn.backCCW,Ht,Ft,f.id,vt.layoutVertexBuffer,vt.indexBuffer,vt.segments,f.paint,_.transform.zoom,ht,_.style.map.terrain&&vt.centroidVertexBuffer)}}function vh(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k=f.fbo;if(!k)return;const z=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),z.draw(T,M.TRIANGLES,m,v,C,Qn.disabled,((Z,it,rt,ut)=>{const $=rt.paint.get("hillshade-shadow-color"),vt=rt.paint.get("hillshade-highlight-color"),Ft=rt.paint.get("hillshade-accent-color");let ht=rt.paint.get("hillshade-illumination-direction")*(Math.PI/180);rt.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=Z.transform.angle);const It=!Z.options.moving;return{u_matrix:ut?ut.posMatrix:Z.transform.calculatePosMatrix(it.tileID.toUnwrapped(),It),u_image:0,u_latrange:sm(0,it.tileID),u_light:[rt.paint.get("hillshade-exaggeration"),ht],u_shadow:$,u_highlight:vt,u_accent:Ft}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function cp(_,s,f,d,m,v){const C=_.context,T=C.gl,M=s.dem;if(M&&M.data){const k=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(T.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(z),s.demTexture){const it=s.demTexture;it.update(F,{premultiply:!1}),it.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new H(C,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);C.activeTexture.set(T.TEXTURE0);let Z=s.fbo;if(!Z){const it=new H(C,{width:k,height:k,data:null},T.RGBA);it.bind(T.LINEAR,T.CLAMP_TO_EDGE),Z=s.fbo=C.createFramebuffer(k,k,!0,!1),Z.colorAttachment.set(it.texture)}C.bindFramebuffer.set(Z.framebuffer),C.viewport.set([0,0,k,k]),_.useProgram("hillshadePrepare").draw(C,T.TRIANGLES,d,m,v,Qn.disabled,((it,rt)=>{const ut=rt.stride,$=u.F();return u.aN($,0,u.W,-u.W,0,0,1),u.H($,$,[0,-u.W,0]),{u_matrix:$,u_image:1,u_dimension:[ut,ut],u_zoom:it.overscaledZ,u_unpack:rt.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function vm(_,s,f,d,m,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const T=I.now(),M=(T-_.timeAdded)/C,k=s?(T-s.timeAdded)/C:-1,z=f.getSource(),F=m.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),Z=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),it=Z&&_.refreshedUponExpiration?1:u.ac(Z?M:1-k,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-it}:{opacity:it,mix:0}}return{opacity:1,mix:0}}const bm=new u.aO(1,0,0,1),bh=new u.aO(0,1,0,1),hp=new u.aO(0,0,1,1),r_=new u.aO(1,0,1,1),xm=new u.aO(0,1,1,1);function Er(_,s,f,d){$i(_,0,s+f/2,_.transform.width,f,d)}function Ga(_,s,f,d){$i(_,s-f/2,0,f,_.transform.height,d)}function $i(_,s,f,d,m,v){const C=_.context,T=C.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),C.clear({color:v}),T.disable(T.SCISSOR_TEST)}function fp(_,s,f){const d=_.context,m=d.gl,v=f.posMatrix,C=_.useProgram("debug"),T=xn.disabled,M=rr.disabled,k=_.colorModeForRenderPass(),z="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(m.TEXTURE0);const Z=s.getTileByID(f.key).latestRawTileData,it=Math.floor((Z&&Z.byteLength||0)/1024),rt=s.getTile(f).tileSize,ut=512/Math.min(rt,512)*(f.overscaledZ/_.transform.zoom)*.5;let $=f.canonical.toString();f.overscaledZ!==f.canonical.z&&($+=` => ${f.overscaledZ}`),function(vt,Ft){vt.initDebugOverlayCanvas();const ht=vt.debugOverlayCanvas,It=vt.context.gl,Bt=vt.debugOverlayCanvas.getContext("2d");Bt.clearRect(0,0,ht.width,ht.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(Ft,5,5),Bt.strokeText(Ft,5,5),vt.debugOverlayTexture.update(ht),vt.debugOverlayTexture.bind(It.LINEAR,It.CLAMP_TO_EDGE)}(_,`${$} ${it}kB`),C.draw(d,m.TRIANGLES,T,M,Br.alphaBlended,Qn.disabled,im(v,u.aO.transparent,ut),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),C.draw(d,m.LINE_STRIP,T,M,k,Qn.disabled,im(v,u.aO.red),F,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function xh(_,s,f){const d=_.context,m=d.gl,v=_.colorModeForRenderPass(),C=new xn(m.LEQUAL,xn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const k of f){const z=_.renderToTexture.getTexture(k),F=s.getTerrainData(k.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,z.texture);const Z={u_matrix:_.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,m.TRIANGLES,C,rr.disabled,v,Qn.backCCW,Z,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class wm{constructor(s,f){this.context=new n_(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Zr.maxUnderzooming+Zr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Va}resize(s,f,d){if(this.width=Math.floor(s*d),this.height=Math.floor(f*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,f=new u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,Qc.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,Qc.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const m=new u.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(u.W,0,u.W,0),m.emplaceBack(0,u.W,0,u.W),m.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(m,ln.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Qc.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const C=new u.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new rr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,xn.disabled,this.stencilClearMode,Br.disabled,Qn.disabled,nh(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const d=this.context,m=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Br.disabled),d.setDepthMode(xn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const T=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,m.TRIANGLES,xn.disabled,new rr({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),Br.disabled,Qn.disabled,nh(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new rr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new rr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((C,T)=>T.overscaledZ-C.overscaledZ),m=d[d.length-1].overscaledZ,v=d[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let T=0;T=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=m[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,k,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(z)?[k.sourceCaches[$.source]]:[]),it=Z.filter($=>$.getSource().type==="vector"),rt=Z.filter($=>$.getSource().type!=="vector"),ut=$=>{(!F||F.getSource().maxzoom<$.getSource().maxzoom)&&(F=$)};return it.forEach($=>ut($)),F||rt.forEach($=>ut($)),F}(this.style,this.transform.zoom);M&&function(k,z,F){for(let Z=0;Z0),m&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const T=v.context,M=T.gl,k=Br.unblended,z=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.sourceCache.getRenderableTiles(),it=v.useProgram("terrainDepth");T.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const rt of Z){const ut=C.getTerrainData(rt.tileID),$={u_matrix:v.transform.calculatePosMatrix(rt.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};it.draw(T,M.TRIANGLES,z,rr.disabled,k,Qn.backCCW,$,ut,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const T=v.context,M=T.gl,k=Br.unblended,z=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.getCoordsTexture(),it=C.sourceCache.getRenderableTiles(),rt=v.useProgram("terrainCoords");T.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),C.coordsIndex=[];for(const ut of it){const $=C.getTerrainData(ut.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,Z.texture);const vt={u_matrix:v.transform.calculatePosMatrix(ut.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};rt.draw(T,M.TRIANGLES,z,rr.disabled,k,Qn.backCCW,vt,$,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(ut.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,C,T,M,k){if(v.renderPass!=="translucent")return;const z=rr.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,it,rt,ut,$,vt,Ft){const ht=it.transform,It=$==="map",Bt=vt==="map";for(const Gt of Z){const Ht=ut.getTile(Gt),te=Ht.getBucket(rt);if(!te||!te.text||!te.text.segments.get().length)continue;const $t=u.ag(te.textSizeData,ht.zoom),oe=He(Ht,1,it.transform.zoom),he=Ke(Gt.posMatrix,Bt,It,it.transform,oe),nn=rt.layout.get("icon-text-fit")!=="none"&&te.hasIconData();if($t){const pe=Math.pow(2,ht.zoom-Ht.tileID.overscaledZ);dh(te,It,Bt,Ft,ht,he,Gt.posMatrix,pe,$t,nn,it.style.map.terrain?(Be,rn)=>it.style.map.terrain.getElevation(Gt,Be,rn):null)}}}(M,v,T,C,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),k),T.paint.get("icon-opacity").constantOr(1)!==0&&gh(v,C,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),z,F),T.paint.get("text-opacity").constantOr(1)!==0&&gh(v,C,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(ph(v,C,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),ph(v,C,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,m,this.style.placement.variableOffsets);break;case"circle":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("circle-opacity"),z=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),Z=!T.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const it=v.context,rt=it.gl,ut=v.depthModeForSublayer(0,xn.ReadOnly),$=rr.disabled,vt=v.colorModeForRenderPass(),Ft=[];for(let ht=0;htht.sortKey-It.sortKey);for(const ht of Ft){const{programConfiguration:It,program:Bt,layoutVertexBuffer:Gt,indexBuffer:Ht,uniformValues:te,terrainData:$t}=ht.state;Bt.draw(it,rt.TRIANGLES,ut,$,vt,Qn.disabled,te,$t,T.id,Gt,Ht,ht.segments,T.paint,v.transform.zoom,It)}})(s,f,d,m);break;case"heatmap":(function(v,C,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const k=v.context,z=k.gl,F=rr.disabled,Z=new Br([z.ONE,z.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(it,rt,ut){const $=it.gl;it.activeTexture.set($.TEXTURE1),it.viewport.set([0,0,rt.width/4,rt.height/4]);let vt=ut.heatmapFbo;if(vt)$.bindTexture($.TEXTURE_2D,vt.colorAttachment.get()),it.bindFramebuffer.set(vt.framebuffer);else{const Ft=$.createTexture();$.bindTexture($.TEXTURE_2D,Ft),$.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),vt=ut.heatmapFbo=it.createFramebuffer(rt.width/4,rt.height/4,!1,!1),function(ht,It,Bt,Gt){var Ht,te;const $t=ht.gl,oe=(Ht=ht.HALF_FLOAT)!==null&&Ht!==void 0?Ht:$t.UNSIGNED_BYTE,he=(te=ht.RGBA16F)!==null&&te!==void 0?te:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,he,It.width/4,It.height/4,0,$t.RGBA,oe,null),Gt.colorAttachment.set(Bt)}(it,rt,Ft,vt)}})(k,v,T),k.clear({color:u.aO.transparent});for(let it=0;it{const ht=u.F();u.aN(ht,0,ut.width,ut.height,0,0,1);const It=ut.context.gl;return{u_matrix:ht,u_world:[It.drawingBufferWidth,It.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(k,z),null,z.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,z.paint,k.transform.zoom)}(v,T))})(s,f,d,m);break;case"line":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("line-opacity"),z=T.paint.get("line-width");if(k.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,xn.ReadOnly),Z=v.colorModeForRenderPass(),it=T.paint.get("line-dasharray"),rt=T.paint.get("line-pattern"),ut=rt.constantOr(1),$=T.paint.get("line-gradient"),vt=T.getCrossfadeParameters(),Ft=ut?"linePattern":it?"lineSDF":$?"lineGradient":"line",ht=v.context,It=ht.gl;let Bt=!0;for(const Gt of M){const Ht=C.getTile(Gt);if(ut&&!Ht.patternsLoaded())continue;const te=Ht.getBucket(T);if(!te)continue;const $t=te.programConfigurations.get(T.id),oe=v.context.program.get(),he=v.useProgram(Ft,$t),nn=Bt||he.program!==oe,pe=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Gt),Be=rt.constantOr(null);if(Be&&Ht.imageAtlas){const qe=Ht.imageAtlas,an=qe.patternPositions[Be.to.toString()],fn=qe.patternPositions[Be.from.toString()];an&&fn&&$t.setConstantPatternPositions(an,fn)}const rn=pe?Gt:null,wn=ut?wl(v,Ht,T,vt,rn):it?ih(v,Ht,T,it,vt,rn):$?am(v,Ht,T,te.lineClipsArray.length,rn):rh(v,Ht,T,rn);if(ut)ht.activeTexture.set(It.TEXTURE0),Ht.imageAtlasTexture.bind(It.LINEAR,It.CLAMP_TO_EDGE),$t.updatePaintBuffers(vt);else if(it&&(nn||v.lineAtlas.dirty))ht.activeTexture.set(It.TEXTURE0),v.lineAtlas.bind(ht);else if($){const qe=te.gradients[T.id];let an=qe.texture;if(T.gradientVersion!==qe.version){let fn=256;if(T.stepInterpolant){const Cr=C.getSource().maxzoom,Gn=Gt.canonical.z===Cr?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!f||!d}useProgram(s,f){this.cache=this.cache||{};const d=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Ua(this.context,Ku[s],f,lm[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 H(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class qa{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const m=Math.pow(2,d),v=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(T=>{const M=1/(T=u.af([],T,s))[3]/f*m;return u.a$(T,T,[M,M,1/T[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(Z,it){var rt=it[0],ut=it[1],$=it[2],vt=rt*rt+ut*ut+$*$;return vt>0&&(vt=1/Math.sqrt(vt)),Z[0]=it[0]*vt,Z[1]=it[1]*vt,Z[2]=it[2]*vt,Z}([],function(Z,it,rt){var ut=it[0],$=it[1],vt=it[2],Ft=rt[0],ht=rt[1],It=rt[2];return Z[0]=$*It-vt*ht,Z[1]=vt*Ft-ut*It,Z[2]=ut*ht-$*Ft,Z}([],ct([],v[T[0]],v[T[1]]),ct([],v[T[2]],v[T[1]]))),k=-((z=M)[0]*(F=v[T[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(k)});return new qa(v,C)}}class ja{constructor(s,f){this.min=s,this.max=f,this.center=function(d,m,v){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,v){return d[0]=m[0]+v[0],d[1]=m[1]+v[1],d[2]=m[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=_t(this.min),m=_t(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let T=0;Tthis.max[m]-this.min[m])return 0}return 1}}class uu{constructor(s=0,f=0,d=0,m=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=m}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),m=u.ac((this.top+f-this.bottom)/2,0,f);return new u.P(d,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new uu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const pp=85.051129;class wh{constructor(s,f,d,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new uu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new wh(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.minElevationForCurrentTile=s.minElevationForCurrentTile,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 u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,v){var C=m[0],T=m[1],M=m[2],k=m[3],z=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*z,d[1]=T*F+k*z,d[2]=C*-z+M*F,d[3]=T*-z+k*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,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 f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),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,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),m=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),C=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,m.x,v.x,C.x)),M=Math.floor(Math.max(d.x,m.x,v.x,C.x)),k=1;for(let z=T-k;z<=M+k;z++)z!==0&&f.push(new u.b2(z,s))}return f}coveringTiles(s){var f,d;let m=this.coveringZoomLevel(s);const v=m;if(s.minzoom!==void 0&&ms.maxzoom&&(m=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,m),k=[M*C.x,M*C.y,0],z=[M*T.x,M*T.y,0],F=qa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let Z=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=m);const it=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,rt=ht=>({aabb:new ja([ht*M,0,0],[(ht+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ht,fullyVisible:!1}),ut=[],$=[],vt=m,Ft=s.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let ht=1;ht<=3;ht++)ut.push(rt(-ht)),ut.push(rt(ht));for(ut.push(rt(0));ut.length>0;){const ht=ut.pop(),It=ht.x,Bt=ht.y;let Gt=ht.fullyVisible;if(!Gt){const he=ht.aabb.intersects(F);if(he===0)continue;Gt=he===2}const Ht=s.terrain?k:z,te=ht.aabb.distanceX(Ht),$t=ht.aabb.distanceY(Ht),oe=Math.max(Math.abs(te),Math.abs($t));if(ht.zoom===vt||oe>it+(1<=Z){const he=vt-ht.zoom,nn=k[0]-.5-(It<>1),Be=ht.zoom+1;let rn=ht.aabb.quadrant(he);if(s.terrain){const wn=new u.Q(Be,ht.wrap,Be,nn,pe),qe=s.terrain.getMinMaxElevation(wn),an=(f=qe.minElevation)!==null&&f!==void 0?f:this.elevation,fn=(d=qe.maxElevation)!==null&&d!==void 0?d:this.elevation;rn=new ja([rn.min[0],rn.min[1],an],[rn.max[0],rn.max[1],fn])}ut.push({aabb:rn,zoom:Be,x:nn,y:pe,wrap:ht.wrap,fullyVisible:Gt})}}return $.sort((ht,It)=>ht.distanceSq-It.distanceSq).map(ht=>ht.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],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 f=u.ac(s.lat,-85.051129,pp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(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 f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const C=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/C/u.b3(1,m.lat),M=this.scaleZoom(T/this.tileSize);this._elevation=v,this._center=m,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new u.Y(v.x-(d.x-m.x),v.y-(d.y-m.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const Z=f.pointCoordinate(s);if(Z!=null)return Z}const d=[s.x,s.y,0,1],m=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(m,m,this.pixelMatrixInverse);const v=d[3],C=m[3],T=d[1]/v,M=m[1]/C,k=d[2]/v,z=m[2]/C,F=k===z?0:(0-k)/(z-k);return new u.Y(u.z.number(d[0]/v,m[0]/C,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(m,m,d),new u.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Tt().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Tt([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=[-85.051129,pp])}calculatePosMatrix(s,f=!1){const d=s.key,m=f?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*C,v.y*C,0]),u.J(M,M,[C/u.W,C/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),m[d]=new Float32Array(M),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ht=179.9999999999;m=[-ht,ht]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,T=v,M=0,k=v,z=0,F=0;const{x:Z,y:it}=this.size;if(this.latRange){const ht=this.latRange;C=u.O(ht[1])*v,T=u.O(ht[0])*v,T-CT&&(vt=T-ht)}if(m){const ht=(M+k)/2;let It=rt;this._renderWorldCopies&&(It=u.b1(rt,ht-v/2,ht+v/2));const Bt=Z/2;It-Btk&&($=k-Bt)}if($!==void 0||vt!==void 0){const ht=new u.P($??rt,vt??ut);d.center=this.unproject.call({worldSize:v},ht).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let m=u.an(new Float64Array(16));u.J(m,m,[this.width/2,-this.height/2,1]),u.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=u.an(new Float64Array(16)),u.J(m,m,[1,-1,1]),u.H(m,m,[-1,-1,0]),u.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),T=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?T:v,k=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(u.ac(Math.PI-k-z,.01,Math.PI-.01)),Z=this.getHorizon(),it=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+s.y/(2*Z)),rt=Math.sin(it)*M/Math.sin(u.ac(Math.PI-k-it,.01,Math.PI-.01)),ut=Math.min(F,rt),$=1.01*(Math.cos(Math.PI/2-this._pitch)*ut+M),vt=this.height/50;m=new Float64Array(16),u.b4(m,this._fov,this.width/this.height,vt,$),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,u.J(m,m,[1,-1,1]),u.H(m,m,[0,0,-this.cameraToCenterDistance]),u.b5(m,m,this._pitch),u.ad(m,m,this.angle),u.H(m,m,[-f,-d,0]),this.mercatorMatrix=u.J([],m,[this.worldSize,this.worldSize,this.worldSize]),u.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,m),u.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=u.ar([],m),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,m);const Ft=this.width%2/2,ht=this.height%2/2,It=Math.cos(this.angle),Bt=Math.sin(this.angle),Gt=f-Math.round(f)+It*Ft+Bt*ht,Ht=d-Math.round(d)+It*ht+Bt*Ft,te=new Float64Array(m);if(u.H(te,te,[Gt>.5?Gt-1:Gt,Ht>.5?Ht-1:Ht,0]),this.alignedProjMatrix=te,m=u.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,m=f.y,v=f.x,C=f.y;for(const T of s)d=Math.min(d,T.x),m=Math.min(m,T.y),v=Math.max(v,T.x),C=Math.max(C,T.y);return[new u.P(d,m),new u.P(v,m),new u.P(v,C),new u.P(d,C),new u.P(d,m)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),m=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(m,m,this.projMatrix),m[2]/m[3]}}function dp(_,s){let f,d=!1,m=null,v=null;const C=()=>{m=null,d&&(_.apply(v,f),m=setTimeout(C,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,m||C(),m)}class mp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:d,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=dp(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 f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),C=Math.round(f.lng*v)/v,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),k=this._map.getPitch();let z="";if(z+=s?`/${C}/${T}/${d}`:`${d}/${T}/${C}`,(M||k)&&(z+="/"+Math.round(10*M)/10),k&&(z+=`/${Math.round(k)}`),this._hashName){const F=this._hashName;let Z=!1;const it=window.location.hash.slice(1).split("&").map(rt=>{const ut=rt.split("=")[0];return ut===F?(Z=!0,`${ut}=${z}`):rt}).filter(rt=>rt);return Z||it.push(`${F}=${z}`),`#${it.join("&")}`}return`#${z}`}}const ic={linearity:.3,easing:u.b6(0,0,.3,1)},Cl=u.e({deceleration:2500,maxSpeed:1400},ic),Sm=u.e({deceleration:20,maxSpeed:1400},ic),Em=u.e({deceleration:1e3,maxSpeed:360},ic),Im=u.e({deceleration:1e3,maxSpeed:90},ic);class Cm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:I.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=I.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(f.pan.mag()){const v=sc(f.pan.mag(),d,u.e({},Cl,s||{}));m.offset=f.pan.mult(v.amount/f.pan.mag()),m.center=this._map.transform.center,oc(m,v)}if(f.zoom){const v=sc(f.zoom,d,Sm);m.zoom=this._map.transform.zoom+v.amount,oc(m,v)}if(f.bearing){const v=sc(f.bearing,d,Em);m.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),oc(m,v)}if(f.pitch){const v=sc(f.pitch,d,Im);m.pitch=this._map.transform.pitch+v.amount,oc(m,v)}if(m.zoom||m.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),u.e(m,{noMoveStart:!0})}}function oc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,k,z,F)=>M.add(k.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:C,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class gp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ms{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new gp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new fo(s.type,this._map,s))}mouseup(s){this._map.fire(new fo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new fo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new fo(s.type,this._map,s))}mouseover(s){this._map.fire(new fo(s.type,this._map,s))}mouseout(s){this._map.fire(new fo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Bs(s.type,this._map,s))}touchmove(s){this._map.fire(new Bs(s.type,this._map,s))}touchend(s){this._map.fire(new Bs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Bs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new fo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new fo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new fo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cu{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(u.P.convert(s),this._map.terrain)}}class gs{constructor(s,f){this._map=s,this._tr=new cu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,m,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&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function Tl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class i_{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const v=new u.P(0,0);for(const C of m)v._add(C);return v.div(m.length)}(f),this.touches=Tl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const m=Tl(d,f);for(const v in this.touches){const C=m[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class yp{constructor(s){this.singleTap=new i_(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,d){this.singleTap.touchstart(s,f,d)}touchmove(s,f,d){this.singleTap.touchmove(s,f,d)}touchend(s,f,d){const m=this.singleTap.touchend(s,f,d);if(m){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(m)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class o_{constructor(s){this._tr=new cu(s),this._zoomIn=new yp({numTouches:1,numTaps:2}),this._zoomOut=new yp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const m=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),C=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(m)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{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 hu{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 f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=f.length?f[0]:f;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},fu=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new hu({clickTolerance:s,move:(m,v)=>({bearingDelta:(v.x-m.x)*f}),moveStateManager:d,enable:_,assignEvents:Sh})},pu=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new hu({clickTolerance:s,move:(m,v)=>({pitchDelta:(v.y-m.y)*f}),moveStateManager:d,enable:_,assignEvents:Sh})};class Tm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const m=Tl(d,f),v=new u.P(0,0),C=new u.P(0,0);let T=0;for(const k in m){const z=m[k],F=this._touches[k];F&&(v._add(z),C._add(z.sub(F)),T++,m[k]=z)}if(this._touches=m,TMath.abs(_.x)}class Mm extends _e{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Ih(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,v=f.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return Ih(s)&&Ih(f)&&C}}const s_={panStep:100,bearingStep:15,pitchStep:10};class Wa{constructor(s){this._tr=new cu(s);const f=s_;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,d=0,m=0,v=0,C=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:lr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+m*this._pitchStep,offset:[-v*this._panStep,-C*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 lr(_){return _*(2-_)}const lc=4.000244140625;class Ch{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new cu(s),this._triggerRenderFrame=f,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()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=I.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%lc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,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 f=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),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 T=this._type==="wheel"&&Math.abs(this._delta)>lc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));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 f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,m=this._easing;let v,C=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=m(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,m=(I.now()-d.start)/d.duration,v=d.easing(m+.01)-d.easing(m),C=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-C*C);f=u.b6(C,T,.25,1)}return this._prevEase={start:I.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class vp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}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 Am{constructor(s){this._tr=new cu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class km{constructor(){this._tap=new yp({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,f,d){if(!this._swipePoint)if(this._tapTime){const m=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(m)<30;v&&C?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,f,d)}touchmove(s,f,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=f[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,d)}touchend(s,f,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(s,f,d);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dm{constructor(s,f,d){this._el=s,this._mousePan=f,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 ys{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,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 uc{constructor(s,f,d,m){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=m,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()}}class Ae{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=f,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=d,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(P.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Fe=_=>_.zoom||_.drag||_.pitch||_.rotate;class Th extends u.k{}function cc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class bp{constructor(s,f){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=m.type==="renderFrame"?void 0:m,T={needsRenderFrame:!1},M={},k={},z=m.touches,F=z?this._getMapTouches(z):void 0,Z=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),m);for(const{handlerName:ut,handler:$,allowed:vt}of this._handlers){if(!$.isEnabled())continue;let Ft;this._blockedByActive(k,vt,ut)?$.reset():$[v||m.type]&&(Ft=$[v||m.type](m,Z,F),this.mergeHandlerResult(T,M,Ft,ut,C),Ft&&Ft.needsRenderFrame&&this._triggerRenderFrame()),(Ft||$.isActive())&&(k[ut]=$)}const it={};for(const ut in this._previousActiveHandlers)k[ut]||(it[ut]=C);this._previousActiveHandlers=k,(Object.keys(it).length||cc(T))&&(this._changes.push([T,M,it]),this._triggerRenderFrame()),(Object.keys(k).length||cc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:rt}=T;rt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],rt(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Cm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);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[m,v,C]of this._listeners)P.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ms(f,s));const m=f.boxZoom=new gs(f,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const v=f.cooperativeGestures=new Ae(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new o_(f),T=new Am(f);f.doubleClickZoom=new vp(T,C),this._add("tapZoom",C),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new km;this._add("tapDragZoom",M);const k=f.touchPitch=new Mm(f);this._add("touchPitch",k),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=fu(s),F=pu(s);f.dragRotate=new ys(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const Z=(({enable:Ft,clickTolerance:ht})=>{const It=new Us({checkCorrectEvent:Bt=>P.mouseButton(Bt)===0&&!Bt.ctrlKey});return new hu({clickTolerance:ht,move:(Bt,Gt)=>({around:Gt,panDelta:Gt.sub(Bt)}),activateOnStart:!0,moveStateManager:It,enable:Ft,assignEvents:Sh})})(s),it=new Tm(s,f);f.dragPan=new Dm(d,Z,it),this._add("mousePan",Z),this._add("touchPan",it,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const rt=new _p,ut=new Pm;f.touchZoomRotate=new uc(d,ut,rt,M),this._add("touchRotate",rt,["touchPan","touchZoom"]),this._add("touchZoom",ut,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const $=f.scrollZoom=new Ch(f,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const vt=f.keyboard=new Wa(f);this._add("keyboard",vt),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Vs(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.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!!Fe(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const m in s)if(m!==d&&(!f||f.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const d of s)this._el.contains(d.target)&&f.push(d);return f}mergeHandlerResult(s,f,d,m,v){if(!d)return;u.e(s,d);const C={handlerName:m,originalEvent:d.originalEvent||v};d.zoomDelta!==void 0&&(f.zoom=C),d.panDelta!==void 0&&(f.drag=C),d.pitchDelta!==void 0&&(f.pitch=C),d.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},d={};for(const[m,v,C]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new u.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),u.e(f,v),u.e(d,C);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const m=this._map,v=m._getTransformForUpdate(),C=m.terrain;if(!(cc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:k,pitchDelta:z,around:F,pinchAround:Z}=s;Z!==void 0&&(F=Z),m._stop(!0),F=F||m.transform.centerPoint;const it=v.pointLocation(T?F.sub(T):F);k&&(v.bearing+=k),z&&(v.pitch+=z),M&&(v.zoom+=M),C?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(T)):v.setLocationAtPoint(it,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(it,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(it,F),m._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const m=Fe(this._eventsInProgress),v=Fe(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const z in C)this._fireEvent(z,C[z]);v&&this._fireEvent("move",v.originalEvent);for(const z in s){const{originalEvent:F}=s[z];this._fireEvent(z,F)}const T={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:Z}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||Z,T[`${z}end`]=M)}for(const z in T)this._fireEvent(z,T[z]);const k=Fe(this._eventsInProgress);if(d&&(m||v)&&!k){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=Z=>Z!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Th("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class po extends u.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((I.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=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=u.z.number(v,$,Ht)),this._rotating&&(m.bearing=u.z.number(C,k,Ht)),this._pitching&&(m.pitch=u.z.number(T,z,Ht)),this._padding&&(m.interpolatePadding(M,F,Ht),it=m.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ht),It)m.setLocationAtPoint(It,Bt);else{const te=m.zoomScale(m.zoom-v),$t=$>v?Math.min(2,ht):Math.max(.5,ht),oe=Math.pow($t,1-Ht),he=m.unproject(vt.add(Ft.mult(Ht*oe)).mult(te));m.setLocationAtPoint(m.renderWorldCopies?he.wrap():he,it)}this._applyUpdatedTransform(m),this._fireMoveEvents(f)},Ht=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ht)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.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.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.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 f=s.clone(),{center:d,zoom:m,pitch:v,bearing:C,elevation:T}=this.transformCameraUpdate(f);d&&(f.center=d),m!==void 0&&(f.zoom=m),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",s)),m&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&I.prefersReducedMotion){const wn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(wn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const m=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),T=this.getPitch(),M=this.getPadding(),k="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:m.padding,Z=u.P.convert(s.offset);let it=m.centerPoint.add(Z);const rt=m.pointLocation(it),{center:ut,zoom:$}=m.getConstrained(u.M.convert(s.center||rt),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(ut);const vt=m.zoomScale($-v),Ft=m.project(rt),ht=m.project(ut).sub(Ft);let It=s.curve;const Bt=Math.max(m.width,m.height),Gt=Bt/vt,Ht=ht.mag();if("minZoom"in s){const wn=u.ac(Math.min(s.minZoom,v,$),m.minZoom,m.maxZoom),qe=Bt/m.zoomScale(wn-v);It=Math.sqrt(qe/Ht*2)}const te=It*It;function $t(wn){const qe=(Gt*Gt-Bt*Bt+(wn?-1:1)*te*te*Ht*Ht)/(2*(wn?Gt:Bt)*te*Ht);return Math.log(Math.sqrt(qe*qe+1)-qe)}function oe(wn){return(Math.exp(wn)-Math.exp(-wn))/2}function he(wn){return(Math.exp(wn)+Math.exp(-wn))/2}const nn=$t(!1);let pe=function(wn){return he(nn)/he(nn+It*wn)},Be=function(wn){return Bt*((he(nn)*(oe(qe=nn+It*wn)/he(qe))-oe(nn))/te)/Ht;var qe},rn=($t(!0)-nn)/It;if(Math.abs(Ht)<1e-6||!isFinite(rn)){if(Math.abs(Bt-Gt)<1e-6)return this.easeTo(s,f);const wn=Gts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==k,this._pitching=z!==T,this._padding=!m.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(ut),this._ease(wn=>{const qe=wn*rn,an=1/pe(qe);m.zoom=wn===1?$:v+m.scaleZoom(an),this._rotating&&(m.bearing=u.z.number(C,k,wn)),this._pitching&&(m.pitch=u.z.number(T,z,wn)),this._padding&&(m.interpolatePadding(M,F,wn),it=m.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(wn);const fn=wn===1?ut:m.unproject(Ft.add(ht.mult(Be(qe))).mult(an));m.setLocationAtPoint(m.renderWorldCopies?fn.wrap():fn,it),this._applyUpdatedTransform(m),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){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,f)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,f,d){d.animate===!1||d.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const xp={compact:!0,customAttribution:'MapLibre'};class _s{constructor(s=xp){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=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.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.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.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(){P.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,f){const d=this._map._getUIString(`AttributionControl.${f}`);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(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const f=this._map.style.sourceCaches;for(const m in f){const v=f[m];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,v)=>m.length-v.length),s=s.filter((m,v)=>{for(let C=v+1;C=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 Rm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[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=P.create("div","maplibregl-ctrl");const f=P.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class hc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,d=f?this._queue.concat(f):this._queue;for(const m of d)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const d of f)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ir=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class Vr extends u.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,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),u.aN(m.posMatrix,0,u.W,0,u.W,0,1),this._tiles[m.key]=new Ko(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(s){for(const f in this._tiles){const d=this._tiles[f];(!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 f={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),u.aN(v.posMatrix,0,u.W,0,u.W,0,1),f[d]=v}else if(m.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=m.canonical.z-s.canonical.z,T=m.canonical.x-(m.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,k,0,k,0,1),u.H(v.posMatrix,v.posMatrix,[-T*k,-M*k,0]),f[d]=v}else if(s.canonical.isChildOf(m.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-m.canonical.z,T=s.canonical.x-(s.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*k,M*k,0]),u.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(m--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class Nm{constructor(s,f,d){this.painter=s,this.sourceCache=new Vr(f),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,f,d,m=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=m?v=s.canonical.z-m:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),m=new H(s,d,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,m=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,T-C-1,1,1,m.RGBA,m.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),k=f[1]+((15&f[2])<<8),z=this.coordsIndex[255-f[3]],F=z&&this.sourceCache.getTileByID(z);if(!F)return null;const Z=this._coordsTextureSize,it=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];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 ya={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class wp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new fc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(f)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const m=s.sourceCaches[d].getVisibleCoordinates();for(const v of m){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const T in C)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(C[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const m=s._layers[d],v=m.source;if(ya[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][d.tileID.key];v&&v!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(ya[f]&&(this._prevType&&ya[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(ya[this._prevType]||ya[f]&&m){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(xh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const k=this.pool.getObjectForId(T.rtt[v].id);if(k.stamp===T.rtt[v].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Ip={showCompass:!0,showZoom:!0,visualizePitch:!1};class Cp{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(u.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),P.mousePos(this.element,C)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,P.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=fu({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const k=new Se;return new hu({clickTolerance:T,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:k,enable:C,assignEvents:Lh})})({clickTolerance:m,enable:!0}),this.map=s,d&&(this.mousePitch=pu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new Se;return new hu({clickTolerance:T,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:k,enable:C,assignEvents:Lh})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let _a;function Ph(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const m=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),C=f.locationPoint(_).distSqr(s);f.locationPoint(m).distSqr(s)180;){const m=f.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=f.width&&m.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const dc={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 Mh(_,s,f){const d=_.classList;for(const m in dc)d.remove(`maplibregl-${f}-anchor-${m}`);d.add(`maplibregl-${f}-anchor-${s}`)}class mc extends u.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,m=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ph(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${dc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),I.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=f.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 u.k("dragstart"))),this.fire(new u.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 u.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.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,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${m}px`),f.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const v=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=P.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.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 vt of M){const Ft=P.createNS("http://www.w3.org/2000/svg","ellipse");Ft.setAttributeNS(null,"opacity","0.04"),Ft.setAttributeNS(null,"cx","10.5"),Ft.setAttributeNS(null,"cy","5.80029008"),Ft.setAttributeNS(null,"rx",vt.rx),Ft.setAttributeNS(null,"ry",vt.ry),T.appendChild(Ft)}const k=P.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const z=P.createNS("http://www.w3.org/2000/svg","path");z.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(z);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Z=P.createNS("http://www.w3.org/2000/svg","path");Z.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"),F.appendChild(Z);const it=P.createNS("http://www.w3.org/2000/svg","g");it.setAttributeNS(null,"transform","translate(6.0, 7.0)"),it.setAttributeNS(null,"fill","#FFFFFF");const rt=P.createNS("http://www.w3.org/2000/svg","g");rt.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ut=P.createNS("http://www.w3.org/2000/svg","circle");ut.setAttributeNS(null,"fill","#000000"),ut.setAttributeNS(null,"opacity","0.25"),ut.setAttributeNS(null,"cx","5.5"),ut.setAttributeNS(null,"cy","5.5"),ut.setAttributeNS(null,"r","5.4999962");const $=P.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"),rt.appendChild(ut),rt.appendChild($),C.appendChild(T),C.appendChild(k),C.appendChild(F),C.appendChild(it),C.appendChild(rt),f.appendChild(C),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(f),this._offset=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Mh(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);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),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.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 m=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":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,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 this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,d;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),C=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/m.transform._pixelPerMeter,M=Math.sin(m.getPitch()*Math.PI/180)*T,k=m.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),z=m.transform.lngLatToCameraDepth(this._lngLat,C+M)-k>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=u.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}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Ah={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let mu=0,Ll=!1;const kh={maxWidth:100,unit:"metric"};function Dh(_,s,f){const d=f&&f.maxWidth||100,m=_._container.clientHeight/2,v=_.unproject([0,m]),C=_.unproject([d,m]),T=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Pl(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Pl(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Pl(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Pl(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Pl(s,d,T,_._getUIString("ScaleControl.Meters"))}function Pl(_,s,f,d){const m=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/C;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(T),C*T}(f);_.style.width=s*(m/f)+"px",_.innerHTML=`${m} ${d}`}const Tp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Lp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Rh(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);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:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Rh(new u.P(0,0))}const Om=g;h.AJAXError=u.be,h.Evented=u.E,h.LngLat=u.M,h.MercatorCoordinate=u.Y,h.Point=u.P,h.addProtocol=u.bf,h.config=u.a,h.removeProtocol=u.bg,h.AttributionControl=_s,h.BoxZoomHandler=gs,h.CanvasSource=ps,h.CooperativeGesturesHandler=Ae,h.DoubleClickZoomHandler=vp,h.DragPanHandler=Dm,h.DragRotateHandler=ys,h.EdgeInsets=uu,h.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_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 u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},h.GeoJSONSource=kr,h.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.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 u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,m=this._map.getBearing(),v=u.e({bearing:m},this.options.fitBoundsOptions),C=Tt.fromLngLat(f,d);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).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 f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Ll)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.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",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new mc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new mc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.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 u.k("trackuserlocationend")))})}},this.options=u.e({},Ah,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(_a!==void 0&&!s)return _a;if(window.navigator.permissions===void 0)return _a=!!window.navigator.geolocation,_a;try{_a=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_a=!!window.navigator.geolocation}return _a})}().then(s=>this._setupUI(s)),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(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,mu=0,Ll=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.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 _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return u.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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mu--,Ll=!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 u.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 u.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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mu++,mu>1?(_={maximumAge:6e5,timeout:0},Ll=!0):(_=this.options.positionOptions,Ll=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},h.Hash=mp,h.ImageSource=tr,h.KeyboardHandler=Wa,h.LngLatBounds=Tt,h.LogoControl=Rm,h.Map=class extends po{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},pc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new wh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.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=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new hc,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},Sp,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new X(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.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 f=dp(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bp(this,_),this._hash=_.hash&&new mp(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new _s(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Rm,_.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 u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],m=f[1],v=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,v),this.painter.resize(d,m,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.drawingBufferHeight];const M=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,M),this.painter.resize(d,m,M)}this.transform.resize(d,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,m);const C=!this._moving;return C&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),C&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),v=_*m,C=s*m;return Math.min(v>f?f/v:1,C>d?d/C:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Tt.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?d||(d=!0,f.call(this,new fo(_,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))}}}}{const d=m=>{const v=this.getLayer(s)?this.queryRenderedFeatures(m.point,{layers:[s]}):[];v.length&&(m.features=v,f.call(this,m),delete m.features)};return{layer:s,listener:f,delegates:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new ko(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ko(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.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 Nm(this.painter,s,_),this.painter.renderToTexture=new wp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const m=f[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:v,stretchY:C,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.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:z}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:k},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:k,data:z}=I.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:k},z),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.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||u.b(s)?I.getImageData(s):s,{width:m,height:v,data:C}=d;if(m===void 0||v===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(C,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return j.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.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 f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const m=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=P.create("div",`maplibregl-ctrl-${C} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={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:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new wm(f,this.transform),D.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=I.now();this.style.zoomHistory.update(m,v);const C=new u.a8(m,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=C.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,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 u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(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 u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.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),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Ep}getCameraTargetElevation(){return this.transform.elevation}},h.MapMouseEvent=fo,h.MapTouchEvent=Bs,h.MapWheelEvent=gp,h.Marker=mc,h.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.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,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},Ip,_),this._container=P.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})),P.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})),P.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=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,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 Cp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.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(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},h.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.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=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Ph(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const d=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Rh(this.options.offset);if(!m){const T=this._container.offsetWidth,M=this._container.offsetHeight;let k;k=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-T/2&&k.push("right"),m=k.length===0?"bottom":k.join("-")}let C=d.add(v[m]);this.options.subpixelPositioning||(C=C.round()),P.setTransform(this._container,`${dc[m]} translate(${C.x}px,${C.y}px)`),Mh(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Tp),_)}addTo(_){return this._map&&this.remove(),this._map=_,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 u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.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 _=this._container.querySelector(Lp);_&&_.focus()}},h.RasterDEMTileSource=Ye,h.RasterTileSource=Nt,h.ScaleControl=class{constructor(_){this._onMove=()=>{Dh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Dh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},kh),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},h.ScrollZoomHandler=Ch,h.Style=ko,h.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.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(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},h.TwoFingersTouchPitchHandler=Mm,h.TwoFingersTouchRotateHandler=_p,h.TwoFingersTouchZoomHandler=Pm,h.TwoFingersTouchZoomRotateHandler=uc,h.VectorTileSource=kn,h.VideoSource=Mo,h.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Ba(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{Os[f]=d})(_,s)}),h.clearPrewarmedResources=function(){const _=gn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Me),gn=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()"))},h.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},h.getRTLTextPluginStatus=function(){return re().getRTLTextPluginStatus()},h.getVersion=function(){return Om},h.getWorkerCount=function(){return hn.workerCount},h.getWorkerUrl=function(){return u.a.WORKER_URL},h.importScriptInWorkers=function(_){return Ar().broadcast("IS",_)},h.prewarm=function(){An().acquire(Me)},h.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},h.setRTLTextPlugin=function(_,s){return re().setRTLTextPlugin(_,s)},h.setWorkerCount=function(_){hn.workerCount=_},h.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var a=n;return a})})(vI);var J4=vI.exports;const Es=Sv(J4);var Q4=Object.defineProperty,$4=(e,t,n)=>t in e?Q4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rw=(e,t,n)=>($4(e,typeof t!="symbol"?t+"":t,n),n);function xd(){}function xI(e){return e()}function Nw(){return Object.create(null)}function Sy(e){e.forEach(xI)}function wI(e){return typeof e=="function"}function tD(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function eD(e){return Object.keys(e).length===0}function nD(e,t){e.appendChild(t)}function rD(e,t,n){e.insertBefore(t,n||null)}function SI(e){e.parentNode&&e.parentNode.removeChild(e)}function Ow(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function wu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function iD(e){return Array.from(e.childNodes)}function cg(e,t,n){e.classList.toggle(t,!!n)}let Wv;function gd(e){Wv=e}const rf=[],zw=[];let cf=[];const Fw=[],oD=Promise.resolve();let J0=!1;function sD(){J0||(J0=!0,oD.then(EI))}function Q0(e){cf.push(e)}const _0=new Set;let Qh=0;function EI(){if(Qh!==0)return;const e=Wv;do{try{for(;Qhe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),cf=t}const uD=new Set;function cD(e,t){e&&e.i&&(uD.delete(e),e.i(t))}function hD(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),Q0(()=>{const a=e.$$.on_mount.map(xI).filter(wI);e.$$.on_destroy?e.$$.on_destroy.push(...a):Sy(a),e.$$.on_mount=[]}),i.forEach(Q0)}function fD(e,t){const n=e.$$;n.fragment!==null&&(lD(n.after_update),Sy(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function pD(e,t){e.$$.dirty[0]===-1&&(rf.push(e),sD(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const N=D.length?D[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=N)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](N),S&&pD(e,I)),P}):[],w.update(),S=!0,Sy(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const I=iD(t.target);w.fragment&&w.fragment.l(I),I.forEach(SI)}else w.fragment&&w.fragment.c();t.intro&&cD(e.$$.fragment),hD(e,t.target,t.anchor),EI()}gd(g)}class mD{constructor(){Rw(this,"$$"),Rw(this,"$$set")}$destroy(){fD(this,1),this.$destroy=xd}$on(t,n){if(!wI(n))return xd;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!eD(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const gD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(gD);function yD(e){let t,n,r;return{c(){t=Ow("svg"),n=Ow("path"),wu(n,"stroke-width","4"),wu(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"),wu(n,"class","svelte-gzo3ar"),wu(t,"width",r=e[0]==="list"?20:void 0),wu(t,"viewBox","0 0 70 85"),wu(t,"fill","none"),wu(t,"class","svelte-gzo3ar"),cg(t,"in-map",e[0]!=="list"),cg(t,"list-icon",e[0]==="list")},m(i,a){rD(i,t,a),nD(t,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&wu(t,"width",r),a&1&&cg(t,"in-map",i[0]!=="list"),a&1&&cg(t,"list-icon",i[0]==="list")},i:xd,o:xd,d(i){i&&SI(t)}}}function _D(e,t,n){let{displayIn:r}=t;return e.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class vD extends mD{constructor(t){super(),dD(this,t,_D,yD,tD,{displayIn:0})}}const bD=[{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"}],xD={decimalLatitude:40.123,decimalLongitude:-74.123},wD=[{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}],SD=[{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 ED(){const e=[];return bD.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...xD})}),[...e,...wD,...SD]}const ID=ED();ID.map(e=>e.verbatimCoordinates);/** + * splaytree v3.1.2 + * Fast Splay tree for Node and browser + * + * @author Alexander Milevski + * @license MIT + * @preserve + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */function CD(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,h;return h={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function u(w){return function(S){return g([w,S])}}function g(w){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=w[0]&2?i.return:w[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,w[1])).done)return a;switch(i=0,a&&(w=[w[0]&2,a.value]),w[0]){case 0:case 1:a=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,i=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!a||w[1]>a[0]&&w[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var u=t.right;if(t.right=u.left,u.left=t,t=u,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,a.left=t.right,t.left=r.right,t.right=r.left,t}function v0(e,t,n,r){var i=new ku(e,t);if(n===null)return i.left=i.right=null,i;n=Cu(e,n,r);var a=r(e,n.key);return a<0?(i.left=n.left,i.right=n,n.left=null):a>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Bw(e,t,n){var r=null,i=null;if(t){t=Cu(e,t,n);var a=n(t.key,e);a===0?(r=t.left,i=t.right):a<0?(i=t.right,t.right=null,r=t):(r=t.left,t.left=null,i=t)}return{left:r,right:i}}function LD(e,t,n){return t===null?e:(e===null||(t=Cu(e.key,t,n),t.left=e),t)}function $0(e,t,n,r,i){if(e){r(""+t+(n?"└── ":"├── ")+i(e)+` +`);var a=t+(n?" ":"│ ");e.left&&$0(e.left,a,!1,r,i),e.right&&$0(e.right,a,!0,r,i)}}var Hv=function(){function e(t){t===void 0&&(t=TD),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=v0(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var r=new ku(t,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=Cu(t,this._root,i),h=i(t,a.key);return h===0?this._root=a:(h<0?(r.left=a.left,r.right=a,a.left=null):h>0&&(r.right=a.right,r.left=a,a.right=null),this._size++,this._root=r),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,r){var i;if(n===null)return null;n=Cu(t,n,r);var a=r(t,n.key);return a===0?(n.left===null?i=n.right:(i=Cu(t,n.left,r),i.right=n.right),this._size--,i):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Cu(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,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Cu(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,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),t.call(n,r),r=r.right):a=!0;return this},e.prototype.range=function(t,n,r,i){for(var a=[],h=this._comparator,u=this._root,g;a.length!==0||u;)if(u)a.push(u),u=u.left;else{if(u=a.pop(),g=h(u.key,n),g>0)break;if(h(u.key,t)>=0&&r.call(i,u))return this;u=u.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var r=n.key;return t.push(r)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var r=n.data;return t.push(r)}),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,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===t)return n;i++,n=n.right}else r=!0;return null},e.prototype.next=function(t){var n=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(t.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},e.prototype.prev=function(t){var n=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(t.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return MD(this._root)},e.prototype.load=function(t,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=t.length,a=this._comparator;if(r&&nv(t,n,0,i-1,a),this._root===null)this._root=tv(t,n,0,i),this._size=i;else{var h=AD(this.toList(),PD(t,n),a);i=this._size+i,this._root=ev({head:h},0,i)}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(r){return String(r.key)});var n=[];return $0(this._root,"",!0,function(r){return n.push(r)},t),n.join("")},e.prototype.update=function(t,n,r){var i=this._comparator,a=Bw(t,this._root,i),h=a.left,u=a.right;i(t,n)<0?u=v0(n,r,u,i):h=v0(n,r,h,i),this._root=LD(h,u,i)},e.prototype.split=function(t){return Bw(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,r;return CD(this,function(i){switch(i.label){case 0:t=this._root,n=[],r=!1,i.label=1;case 1:return r?[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 i.sent(),t=t.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function tv(e,t,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),h=e[a],u=t[a],g=new ku(h,u);return g.left=tv(e,t,n,a),g.right=tv(e,t,a+1,r),g}return null}function PD(e,t){for(var n=new ku(null,null),r=n,i=0;i0?(t=a=a.next=n.pop(),t=t.right):r=!0;return a.next=null,i.next}function ev(e,t,n){var r=n-t;if(r>0){var i=t+Math.floor(r/2),a=ev(e,t,i),h=e.head;return h.left=a,e.head=e.head.next,h.right=ev(e,i+1,n),h}return null}function AD(e,t,n){for(var r=new ku(null,null),i=r,a=e,h=t;a!==null&&h!==null;)n(a.key,h.key)<0?(i.next=a,a=a.next):(i.next=h,h=h.next),i=i.next;return a!==null?i.next=a:h!==null&&(i.next=h),r.next}function nv(e,t,n,r,i){if(!(n>=r)){for(var a=e[n+r>>1],h=n-1,u=r+1;;){do h++;while(i(e[h],a)<0);do u--;while(i(e[u],a)>0);if(h>=u)break;var g=e[h];e[h]=e[u],e[u]=g,g=t[h],t[h]=t[u],t[u]=g}nv(e,t,n,u,i),nv(e,t,u+1,r,i)}}function pa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vw(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){pa(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return jo(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,r=0,i=n.length;r=0&&I>=0?wP?-1:0:g<0&&I<0?wP?1:0:Ig?1:0}}}]),e}(),zD=0,ny=function(){jo(e,null,[{key:"compare",value:function(t,n){var r=t.leftSE.point.x,i=n.leftSE.point.x,a=t.rightSE.point.x,h=n.rightSE.point.x;if(hu&&g>w)return-1;var I=t.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var P=n.comparePoint(t.rightSE.point);return P!==0?P:-1}if(r>i){if(ug&&u>S)return 1;var D=n.comparePoint(t.leftSE.point);if(D!==0)return D;var N=t.comparePoint(n.rightSE.point);return N<0?1:N>0?-1:1}if(ug)return 1;if(ah){var Y=t.comparePoint(n.rightSE.point);if(Y<0)return 1;if(Y>0)return-1}if(a!==h){var et=w-u,V=a-r,j=S-g,X=h-i;if(et>V&&jX)return-1}return a>h?1:aS?1:t.idn.id?1:0}}]);function e(t,n,r,i){pa(this,e),this.id=++zD,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=r,this.windings=i}return jo(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,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return t.x===n.x?0:t.x0&&u.swapEvents(),el.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.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,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var h=n;n=r,r=h}for(var u=0,g=r.rings.length;u0)i=n,a=t,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var g=new el(i,!0),w=new el(a,!1);return new e(g,w,[r],[h])}}]),e}(),Ww=function(){function e(t,n,r){if(pa(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=r,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 i=wd.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,h=1,u=t.length;hthis.bbox.ur.x&&(this.bbox.ur.x=g.x),g.y>this.bbox.ur.y&&(this.bbox.ur.y=g.y),a=g)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(ny.fromRing(a,i,this))}return jo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return jo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return jo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.polys.length;n0&&(t=i)}for(var a=t.segment.prevInResult(),h=a?a.prevInResult():null;;){if(!a)return null;if(!h)return a.ringOut;if(h.ringOut!==a.ringOut)return h.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=h.prevInResult(),h=a?a.prevInResult():null}}}]),e}(),Zw=function(){function e(t){pa(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return jo(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,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:ny.compare;pa(this,e),this.queue=t,this.tree=new Hv(n),this.segments=[]}return jo(e,[{key:"process",value:function(t){var n=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),r;var i=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)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 a=i,h=i,u=void 0,g=void 0;u===void 0;)a=this.tree.prev(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);for(;g===void 0;)h=this.tree.next(h),h===null?g=null:h.key.consumedBy===void 0&&(g=h.key);if(t.isLeft){var w=null;if(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var I=this._splitSafely(u,S),P=0,D=I.length;P0?(this.tree.remove(n),r.push(t)):(this.segments.push(n),n.prev=u)}else{if(u&&g){var ct=u.getIntersection(g);if(ct!==null){if(!u.isAnEndpoint(ct))for(var mt=this._splitSafely(u,ct),Ct=0,H=mt.length;CtXw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var X=new UD(N),ot=N.size,_t=N.pop();_t;){var st=_t.key;if(N.size===ot){var ct=st.segment;throw new Error("Unable to pop() ".concat(st.isLeft?"left":"right"," SweepEvent ")+"[".concat(st.point.x,", ").concat(st.point.y,"] from segment #").concat(ct.id," ")+"[".concat(ct.leftSE.point.x,", ").concat(ct.leftSE.point.y,"] -> ")+"[".concat(ct.rightSE.point.x,", ").concat(ct.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(N.size>Xw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(X.segments.length>GD)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var mt=X.process(st),Ct=0,H=mt.length;Ct1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rn[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,r=this.z-e.z;return Math.sqrt(t*t+n*n+r*r)};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[hs,Iy,fs]};At.prototype.getClass=function(){return At};At.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=Xe.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};jc.DimensionalComparator.get=function(){return Gl};jc.serialVersionUID.get=function(){return 6683108902428367e3};jc.NULL_ORDINATE.get=function(){return Xe.NaN};jc.X.get=function(){return 0};jc.Y.get=function(){return 1};jc.Z.get=function(){return 2};Object.defineProperties(At,jc);var Gl=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new sr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};Gl.prototype.compare=function(e,t){var n=e,r=t,i=Gl.compare(n.x,r.x);if(i!==0)return i;var a=Gl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var h=Gl.compare(n.z,r.z);return h};Gl.prototype.interfaces_=function(){return[gf]};Gl.prototype.getClass=function(){return Gl};Gl.compare=function(e,t){return et?1:Xe.isNaN(e)?Xe.isNaN(t)?0:-1:Xe.isNaN(t)?1:0};var yf=function(){};yf.prototype.create=function(){};yf.prototype.interfaces_=function(){return[]};yf.prototype.getClass=function(){return yf};var zt=function(){},qd={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 sr("Unknown location value: "+e)};qd.INTERIOR.get=function(){return 0};qd.BOUNDARY.get=function(){return 1};qd.EXTERIOR.get=function(){return 2};qd.NONE.get=function(){return-1};Object.defineProperties(zt,qd);var Ue=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Wo=function(){},DI={LOG_10:{configurable:!0}};Wo.prototype.interfaces_=function(){return[]};Wo.prototype.getClass=function(){return Wo};Wo.log10=function(e){var t=Math.log(e);return Xe.isInfinite(t)||Xe.isNaN(t)?t:t/Wo.LOG_10};Wo.min=function(e,t,n,r){var i=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};Wo.wrap=function(e,t){return e<0?t- -e%t:e%t};Wo.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],r=e;return t>r&&(r=t),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3],g=i;return a>g&&(g=a),h>g&&(g=h),u>g&&(g=u),g}};Wo.average=function(e,t){return(e+t)/2};DI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Wo,DI);var da=function(e){this.str=e};da.prototype.append=function(e){this.str+=e};da.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};da.prototype.toString=function(e){return this.str};var ea=function(e){this.value=e};ea.prototype.intValue=function(){return this.value};ea.prototype.compareTo=function(e){return this.valuee?1:0};ea.isNaN=function(e){return Number.isNaN(e)};var Sd=function(){};Sd.isWhitespace=function(e){return e<=32&&e>=0||e===127};Sd.toUpperCase=function(e){return e.toUpperCase()};var jt=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 r=arguments[0];e.call(this,e.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},Rs={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}};jt.prototype.le=function(e){return(this._hi9?(S=!0,I="9"):I="0"+w,h.append(I),n=n.subtract(jt.valueOf(w)).multiply(jt.TEN),S&&n.selfAdd(jt.TEN);var P=!0,D=jt.magnitude(n._hi);if(D<0&&Math.abs(D)>=u-g&&(P=!1),!P)break}return t[0]=r,h.toString()};jt.prototype.sqr=function(){return this.multiply(this)};jt.prototype.doubleValue=function(){return this._hi+this._lo};jt.prototype.subtract=function(){if(arguments[0]instanceof jt){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};jt.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};jt.prototype.isZero=function(){return this._hi===0&&this._lo===0};jt.prototype.selfSubtract=function(){if(arguments[0]instanceof jt){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)}};jt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};jt.prototype.min=function(e){return this.le(e)?this:e};jt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof jt){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],r=arguments[1],i=null,a=null,h=null,u=null,g=null,w=null,S=null,I=null;return g=this._hi/n,w=jt.SPLIT*g,i=w-g,I=jt.SPLIT*n,i=w-i,a=g-i,h=I-n,S=g*n,h=I-h,u=n-h,I=i*h-S+i*u+a*h+a*u,w=(this._hi-S-I+this._lo-g*r)/n,I=g+w,this._hi=I,this._lo=g-I+w,this}};jt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};jt.prototype.divide=function(){if(arguments[0]instanceof jt){var e=arguments[0],t=null,n=null,r=null,i=null,a=null,h=null,u=null,g=null;a=this._hi/e._hi,h=jt.SPLIT*a,t=h-a,g=jt.SPLIT*e._hi,t=h-t,n=a-t,r=g-e._hi,u=a*e._hi,r=g-r,i=e._hi-r,g=t*r-u+t*i+n*r+n*i,h=(this._hi-u-g+this._lo-a*e._lo)/e._hi,g=a+h;var w=g,S=a-g+h;return new jt(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return Xe.isNaN(I)?jt.createNaN():jt.copy(this).selfDivide(I,0)}};jt.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};jt.prototype.pow=function(e){if(e===0)return jt.valueOf(1);var t=new jt(this),n=jt.valueOf(1),r=Math.abs(e);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(t),r/=2,r>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};jt.prototype.ceil=function(){if(this.isNaN())return jt.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new jt(e,t)};jt.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};jt.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};jt.prototype.setValue=function(){if(arguments[0]instanceof jt){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};jt.prototype.max=function(e){return this.ge(e)?this:e};jt.prototype.sqrt=function(){if(this.isZero())return jt.valueOf(0);if(this.isNegative())return jt.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=jt.valueOf(t),r=this.subtract(n.sqr()),i=r._hi*(e*.5);return n.add(i)};jt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof jt){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,r=null,i=null,a=null,h=null,u=null;return i=this._hi+t,h=i-this._hi,a=i-h,a=t-h+(this._hi-a),u=a+this._lo,n=i+u,r=u+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var g=arguments[0],w=arguments[1],S=null,I=null,P=null,D=null,N=null,G=null,Y=null,et=null;N=this._hi+g,P=this._lo+w,Y=N-this._hi,et=P-this._lo,G=N-Y,D=P-et,G=g-Y+(this._hi-G),D=w-et+(this._lo-D),Y=G+P,S=N+Y,I=Y+(N-S),Y=D+I;var V=S+Y,j=Y+(S-V);return this._hi=V,this._lo=j,this}};jt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof jt){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],r=arguments[1],i=null,a=null,h=null,u=null,g=null,w=null;g=jt.SPLIT*this._hi,i=g-this._hi,w=jt.SPLIT*n,i=g-i,a=this._hi-i,h=w-n,g=this._hi*n,h=w-h,u=n-h,w=i*h-g+i*u+a*h+a*u+(this._hi*r+this._lo*n);var S=g+w;i=g-S;var I=w+i;return this._hi=S,this._lo=I,this}};jt.prototype.selfSqr=function(){return this.selfMultiply(this)};jt.prototype.floor=function(){if(this.isNaN())return jt.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new jt(e,t)};jt.prototype.negate=function(){return this.isNaN()?this:new jt(-this._hi,-this._lo)};jt.prototype.clone=function(){};jt.prototype.multiply=function(){if(arguments[0]instanceof jt){var e=arguments[0];return e.isNaN()?jt.createNaN():jt.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return Xe.isNaN(t)?jt.createNaN():jt.copy(this).selfMultiply(t,0)}};jt.prototype.isNaN=function(){return Xe.isNaN(this._hi)};jt.prototype.intValue=function(){return Math.trunc(this._hi)};jt.prototype.toString=function(){var e=jt.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};jt.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),r=t[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+jt.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,h=jt.stringOfChar("0",a);i=n+h+".0"}return this.isNegative()?"-"+i:i};jt.prototype.reciprocal=function(){var e=null,t=null,n=null,r=null,i=null,a=null,h=null,u=null;i=1/this._hi,a=jt.SPLIT*i,e=a-i,u=jt.SPLIT*this._hi,e=a-e,t=i-e,n=u-this._hi,h=i*this._hi,n=u-n,r=this._hi-n,u=e*n-h+e*r+t*n+t*r,a=(1-h-u-i*this._lo)/this._hi;var g=i+a,w=i-g+a;return new jt(g,w)};jt.prototype.toSciNotation=function(){if(this.isZero())return jt.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),r=jt.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};jt.prototype.abs=function(){return this.isNaN()?jt.NaN:this.isNegative()?this.negate():new jt(this)};jt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};jt.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};jt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};jt.prototype.trunc=function(){return this.isNaN()?jt.NaN:this.isPositive()?this.floor():this.ceil()};jt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};jt.prototype.interfaces_=function(){return[fs,hs,Iy]};jt.prototype.getClass=function(){return jt};jt.sqr=function(e){return jt.valueOf(e).selfMultiply(e)};jt.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return jt.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new jt(t)}};jt.sqrt=function(e){return jt.valueOf(e).sqrt()};jt.parse=function(e){for(var t=0,n=e.length;Sd.isWhitespace(e.charAt(t));)t++;var r=!1;if(t=n);){var w=e.charAt(t);if(t++,Sd.isDigit(w)){var S=w-"0";a.selfMultiply(jt.TEN),a.selfAdd(S),h++;continue}if(w==="."){u=h;continue}if(w==="e"||w==="E"){var I=e.substring(t);try{g=ea.parseInt(I)}catch(Y){throw Y instanceof Error?new Error("Invalid exponent "+I+" in string "+e):Y}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+t+" in string "+e)}var P=a,D=h-u-g;if(D===0)P=a;else if(D>0){var N=jt.TEN.pow(D);P=a.divide(N)}else if(D<0){var G=jt.TEN.pow(-D);P=a.multiply(G)}return r?P.negate():P};jt.createNaN=function(){return new jt(Xe.NaN,Xe.NaN)};jt.copy=function(e){return new jt(e)};jt.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=t&&(r+=1),r};jt.stringOfChar=function(e,t){for(var n=new da,r=0;r0){if(a<=0)return oo.signum(h);r=i+a}else if(i<0){if(a>=0)return oo.signum(h);r=-i-a}else return oo.signum(h);var u=oo.DP_SAFE_EPSILON*r;return h>=u||-h>=u?oo.signum(h):2};oo.signum=function(e){return e>0?1:e<0?-1:0};RI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(oo,RI);var Sn=function(){},jd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};jd.X.get=function(){return 0};jd.Y.get=function(){return 1};jd.Z.get=function(){return 2};jd.M.get=function(){return 3};Sn.prototype.setOrdinate=function(e,t,n){};Sn.prototype.size=function(){};Sn.prototype.getOrdinate=function(e,t){};Sn.prototype.getCoordinate=function(){};Sn.prototype.getCoordinateCopy=function(e){};Sn.prototype.getDimension=function(){};Sn.prototype.getX=function(e){};Sn.prototype.clone=function(){};Sn.prototype.expandEnvelope=function(e){};Sn.prototype.copy=function(){};Sn.prototype.getY=function(e){};Sn.prototype.toCoordinateArray=function(){};Sn.prototype.interfaces_=function(){return[Iy]};Sn.prototype.getClass=function(){return Sn};Object.defineProperties(Sn,jd);var NI=function(){},Gf=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}(NI),Ii=function(){};Ii.arraycopy=function(e,t,n,r,i){for(var a=0,h=t;he._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,r=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],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=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||rthis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};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],r=arguments[1];return this.covers(n,r)}};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],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3];ie._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[hs,fs]};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 r=arguments[0],i=arguments[1],a=arguments[2],h=arguments[3],u=Math.min(a.x,h.x),g=Math.max(a.x,h.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>g||Sg)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};hr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};hr.prototype.setPrecisionModel=function(e){this._precisionModel=e};hr.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;ni?a=r:a=i;else{var h=Math.abs(e.x-t.x),u=Math.abs(e.y-t.y);r>i?a=h:a=u,a===0&&!e.equals(t)&&(a=Math.max(h,u))}return on.isTrue(!(a===0&&!e.equals(t)),"Bad distance calculation"),a};hr.nonRobustComputeEdgeDistance=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=Math.sqrt(r*r+i*i);return on.isTrue(!(a===0&&!e.equals(t)),"Invalid distance calculation"),a};Wc.DONT_INTERSECT.get=function(){return 0};Wc.DO_INTERSECT.get=function(){return 1};Wc.COLLINEAR.get=function(){return 2};Wc.NO_INTERSECTION.get=function(){return 0};Wc.POINT_INTERSECTION.get=function(){return 1};Wc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(hr,Wc);var Hu=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 r=new Re(this._inputLines[0][0],this._inputLines[0][1]),i=new Re(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Re.intersects(r,i,n)&&xe.orientationIndex(r,i,n)===0&&xe.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(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,r,i,a,h){h.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),h.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=h.x,n.y-=h.y,r.x-=h.x,r.y-=h.y,i.x-=h.x,i.y-=h.y,a.x-=h.x,a.y-=h.y},t.prototype.safeHCoordinateIntersection=function(n,r,i,a){var h=null;try{h=Is.intersection(n,r,i,a)}catch(u){if(u instanceof Gf)h=t.nearestEndpoint(n,r,i,a);else throw u}finally{}return h},t.prototype.intersection=function(n,r,i,a){var h=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(h)||(h=new At(t.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(h),h},t.prototype.smallestInAbsValue=function(n,r,i,a){var h=n,u=Math.abs(h);return Math.abs(r)1e-4&&Ii.out.println("Distance = "+h.distance(u))},t.prototype.intersectionWithNormalization=function(n,r,i,a){var h=new At(n),u=new At(r),g=new At(i),w=new At(a),S=new At;this.normalizeToEnvCentre(h,u,g,w,S);var I=this.safeHCoordinateIntersection(h,u,g,w);return I.x+=S.x,I.y+=S.y,I},t.prototype.computeCollinearIntersection=function(n,r,i,a){var h=Re.intersects(n,r,i),u=Re.intersects(n,r,a),g=Re.intersects(i,a,n),w=Re.intersects(i,a,r);return h&&u?(this._intPt[0]=i,this._intPt[1]=a,e.COLLINEAR_INTERSECTION):g&&w?(this._intPt[0]=n,this._intPt[1]=r,e.COLLINEAR_INTERSECTION):h&&g?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!u&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):h&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!u&&!g?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&g?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!h&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!h&&!g?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,r,i,a,h){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,N=i.y>a.y?i.y:a.y,G=u>I?u:I,Y=wP?g:P,V=S0&&u>0||h<0&&u<0)return e.NO_INTERSECTION;var g=xe.orientationIndex(i,a,n),w=xe.orientationIndex(i,a,r);if(g>0&&w>0||g<0&&w<0)return e.NO_INTERSECTION;var S=h===0&&u===0&&g===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(h===0||u===0||g===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(a)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(a)?this._intPt[0]=r:h===0?this._intPt[0]=new At(i):u===0?this._intPt[0]=new At(a):g===0?this._intPt[0]=new At(n):w===0&&(this._intPt[0]=new At(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,r,i,a){var h=n,u=xe.distancePointLine(n,i,a),g=xe.distancePointLine(r,i,a);return g0?n>0?-i:i:n>0?i:-i;if(t===0||n===0)return r>0?e>0?i:-i:e>0?-i:i;if(t>0?r>0?t<=r||(i=-i,a=e,e=n,n=a,a=t,t=r,r=a):t<=-r?(i=-i,n=-n,r=-r):(a=e,e=-n,n=a,a=t,t=-r,r=a):r>0?-t<=r?(i=-i,e=-e,t=-t):(a=-e,e=n,n=a,a=-t,t=r,r=a):t>=r?(e=-e,t=-t,n=-n,r=-r):(i=-i,a=-e,e=-n,n=a,a=-t,t=-r,r=a),e>0)if(n>0){if(!(e<=n))return i}else return i;else{if(n>0)return-i;if(e>=n)i=-i,e=-e,n=-n;else return-i}for(;;){if(h=Math.floor(n/e),n=n-h*e,r=r-h*t,r<0)return-i;if(r>t)return i;if(e>n+n){if(tr+r)return-i;n=e-n,r=t-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(h=Math.floor(e/n),e=e-h*n,t=t-h*r,t<0))return i;if(t>r)return-i;if(n>e+e){if(rt+t)return i;e=n-e,t=r-t,i=-i}if(t===0)return e===0?0:i;if(e===0)return-i}};var $s=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};$s.prototype.countSegment=function(e,t){if(e.xr&&(n=t.x,r=e.x),this._p.x>=n&&this._p.x<=r&&(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 i=e.x-this._p.x,a=e.y-this._p.y,h=t.x-this._p.x,u=t.y-this._p.y,g=Lc.signOfDet2x2(i,a,h,u);if(g===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};$s.prototype.isPointInPolygon=function(){return this.getLocation()!==zt.EXTERIOR};$s.prototype.getLocation=function(){return this._isPointOnSegment?zt.BOUNDARY:this._crossingCount%2===1?zt.INTERIOR:zt.EXTERIOR};$s.prototype.isOnSegment=function(){return this._isPointOnSegment};$s.prototype.interfaces_=function(){return[]};$s.prototype.getClass=function(){return $s};$s.locatePointInRing=function(){if(arguments[0]instanceof At&&Ue(arguments[1],Sn)){for(var e=arguments[0],t=arguments[1],n=new $s(e),r=new At,i=new At,a=1;a1||g<0||g>1)&&(i=!0)}}return i?Wo.min(xe.distancePointLine(e,n,r),xe.distancePointLine(t,n,r),xe.distancePointLine(n,e,t),xe.distancePointLine(r,e,t)):0};xe.isPointInRing=function(e,t){return xe.locatePointInRing(e,t)!==zt.EXTERIOR};xe.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,r=new At;e.getCoordinate(0,r);for(var i=r.x,a=r.y,h=1;hn.y&&(n=a,r=i)}var h=r;do h=h-1,h<0&&(h=t);while(e[h].equals2D(n)&&h!==r);var u=r;do u=(u+1)%t;while(e[u].equals2D(n)&&u!==r);var g=e[h],w=e[u];if(g.equals2D(n)||w.equals2D(n)||g.equals2D(w))return!1;var S=xe.computeOrientation(g,n,w),I=!1;return S===0?I=g.x>w.x:I=S>0,I};xe.locatePointInRing=function(e,t){return $s.locatePointInRing(e,t)};xe.distancePointLinePerpendicular=function(e,t,n){var r=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),i=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/r;return Math.abs(i)*Math.sqrt(r)};xe.computeOrientation=function(e,t,n){return xe.orientationIndex(e,t,n)};xe.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new sr("Line array must contain at least one vertex");for(var n=e.distance(t[0]),r=0;r=1)return a.distance(u);var S=((h.y-a.y)*(u.x-h.x)-(h.x-a.x)*(u.y-h.y))/g;return Math.abs(S)*Math.sqrt(g)}};xe.isOnLine=function(e,t){for(var n=new Hu,r=1;r0};vf.prototype.interfaces_=function(){return[ls]};vf.prototype.getClass=function(){return vf};var bf=function(){};bf.prototype.isInBoundary=function(e){return e>1};bf.prototype.interfaces_=function(){return[ls]};bf.prototype.getClass=function(){return bf};var xf=function(){};xf.prototype.isInBoundary=function(e){return e===1};xf.prototype.interfaces_=function(){return[ls]};xf.prototype.getClass=function(){return xf};var Gr=function(){};Gr.prototype.add=function(){};Gr.prototype.addAll=function(){};Gr.prototype.isEmpty=function(){};Gr.prototype.iterator=function(){};Gr.prototype.size=function(){};Gr.prototype.toArray=function(){};Gr.prototype.remove=function(){};function Xv(e){this.message=e||""}Xv.prototype=new Error;Xv.prototype.name="IndexOutOfBoundsException";var qf=function(){};qf.prototype.hasNext=function(){};qf.prototype.next=function(){};qf.prototype.remove=function(){};var Cs=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}(Gr);function jf(e){this.message=e||""}jf.prototype=new Error;jf.prototype.name="NoSuchElementException";var me=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Gr&&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,Gr]},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 r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},t.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},t.prototype.iterator=function(){return new $D(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Xv;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,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}e.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],I=arguments[1];return this.add(S,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var P=arguments[0],D=arguments[1],N=arguments[2];if(N)for(var G=0;G=0;Y--)r.add(P[Y],D);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof At){var et=arguments[0],V=arguments[1],j=arguments[2];if(!j){var X=this.size();if(X>0){if(et>0){var ot=this.get(et-1);if(ot.equals2D(V))return null}if(etCt&&(H=-1);for(var ft=mt;ft!==Ct;ft+=H)r.add(st[ft],ct);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}(me),mn=function(){},Ty={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Ty.ForwardComparator.get=function(){return Ed};Ty.BidirectionalComparator.get=function(){return wf};Ty.coordArrayType.get=function(){return new Array(0).fill(null)};mn.prototype.interfaces_=function(){return[]};mn.prototype.getClass=function(){return mn};mn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};mn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};mn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};mn.extract=function(e,t,n){t=Wo.clamp(t,0,e.length),n=Wo.clamp(n,-1,e.length);var r=n-t+1;n<0&&(r=0),t>=e.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=mn.compare(n,r),a=mn.isEqualReversed(n,r);return a?0:i};wf.prototype.OLDcompare=function(e,t){var n=e,r=t;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=mn.increasingDirection(n),a=mn.increasingDirection(r),h=i>0?0:n.length-1,u=a>0?0:n.length-1,g=0;g0)t=t.right;else return t.value}return null};ki.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=e.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var a=n.value;return n.value=t,a}while(n!==null);var h={key:e,left:null,right:null,value:t,parent:r,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=h:r.right=h,this.fixAfterInsertion(h),this.size_++,null};ki.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=Su;e!=null&&e!==this.root_&&e.parent.color===Su;)if(Xn(e)===b0(Xn(Xn(e)))){var n=Qw(Xn(Xn(e)));Jw(n)===Su?(Ja(Xn(e),nl),Ja(n,nl),Ja(Xn(Xn(e)),Su),e=Xn(Xn(e))):(e===Qw(Xn(e))&&(e=Xn(e),t.rotateLeft(e)),Ja(Xn(e),nl),Ja(Xn(Xn(e)),Su),t.rotateRight(Xn(Xn(e))))}else{var r=b0(Xn(Xn(e)));Jw(r)===Su?(Ja(Xn(e),nl),Ja(r,nl),Ja(Xn(Xn(e)),Su),e=Xn(Xn(e))):(e===b0(Xn(e))&&(e=Xn(e),t.rotateRight(e)),Ja(Xn(e),nl),Ja(Xn(Xn(e)),Su),t.rotateLeft(Xn(Xn(e))))}this.root_.color=nl};ki.prototype.values=function(){var e=new me,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=ki.successor(t))!==null;)e.add(t.value);return e};ki.prototype.entrySet=function(){var e=new Yv,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=ki.successor(t))!==null;)e.add(t);return e};ki.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}};ki.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}};ki.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};ki.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,r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}};ki.prototype.size=function(){return this.size_};var Id=function(){};Id.prototype.interfaces_=function(){return[]};Id.prototype.getClass=function(){return Id};function zI(){}zI.prototype=new Ly;function na(){this.array_=[],arguments[0]instanceof Gr&&this.addAll(arguments[0])}na.prototype=new zI;na.prototype.contains=function(e){for(var t=this,n=0,r=this.array_.length;n=0;){var h=i.substring(0,a);r.add(h),i=i.substring(a+n),a=i.indexOf(t)}i.length>0&&r.add(i);for(var u=new Array(r.size()).fill(null),g=0;g0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(os.toString(e.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Pr.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Pr.createClosedRing(e,t,4);var r=t.getOrdinate(0,Sn.X)===t.getOrdinate(n-1,Sn.X)&&t.getOrdinate(0,Sn.Y)===t.getOrdinate(n-1,Sn.Y);return r?t:Pr.createClosedRing(e,t,n+1)};Pr.createClosedRing=function(e,t,n){var r=e.create(n,t.getDimension()),i=t.size();Pr.copy(t,0,r,0,i);for(var a=i;a0&&Pr.reverse(r._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?Tn.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 xe.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var r=this._points.copy();Pr.reverse(r);var i=this.getFactory().createLineString(r);return i},t.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,h=0,u=0;h= 2)");this._points=r},t.prototype.isCoordinate=function(r){for(var i=this,a=0;a=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}(vr),Ta=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 Ve.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?e.prototype.equalsExact.call(this,r,i):!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 r=this,i=this._geometries.length,a=new Array(i).fill(null),h=0;h0?t.createPoint(n[0]):t.createPoint():e};Ld.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Ld.prototype.getClass=function(){return Ld};var Pd=function(){};Pd.prototype.edit=function(e,t){return e instanceof Ma?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof vr?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Co?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Pd.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Pd.prototype.getClass=function(){return Pd};var Tr=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 da(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Tr(n):new Tr(n,r)}};Aa.prototype.interfaces_=function(){return[yf,fs]};Aa.prototype.getClass=function(){return Aa};Aa.instance=function(){return Aa.instanceObject};Jv.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Jv.instanceObject.get=function(){return new Aa};Object.defineProperties(Aa,Jv);var BI=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,r){return this.map_.set(n,r),r},t.prototype.values=function(){for(var n=new me,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},t.prototype.entrySet=function(){var n=new Yv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},t.prototype.size=function(){return this.map_.size()},t}(Zc),Pn=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 ia){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 r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},Qv={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Pn.prototype.equals=function(e){if(!(e instanceof Pn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Pn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),r=t.getMaximumSignificantDigits();return new ea(n).compareTo(new ea(r))};Pn.prototype.getScale=function(){return this._scale};Pn.prototype.isFloating=function(){return this._modelType===Pn.FLOATING||this._modelType===Pn.FLOATING_SINGLE};Pn.prototype.getType=function(){return this._modelType};Pn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Pn.FLOATING?e="Floating":this._modelType===Pn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Pn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Pn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(Xe.isNaN(e))return e;if(this._modelType===Pn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Pn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof At){var n=arguments[0];if(this._modelType===Pn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Pn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Pn.FLOATING?e=16:this._modelType===Pn.FLOATING_SINGLE?e=6:this._modelType===Pn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Pn.prototype.setScale=function(e){this._scale=Math.abs(e)};Pn.prototype.interfaces_=function(){return[fs,hs]};Pn.prototype.getClass=function(){return Pn};Pn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};Qv.serialVersionUID.get=function(){return 7777263578777804e3};Qv.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Pn,Qv);var ia=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},$v={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ia.prototype.readResolve=function(){return ia.nameToTypeMap.get(this._name)};ia.prototype.toString=function(){return this._name};ia.prototype.interfaces_=function(){return[fs]};ia.prototype.getClass=function(){return ia};$v.serialVersionUID.get=function(){return-552860263173159e4};$v.nameToTypeMap.get=function(){return new BI};Object.defineProperties(ia,$v);Pn.Type=ia;Pn.FIXED=new ia("FIXED");Pn.FLOATING=new ia("FLOATING");Pn.FLOATING_SINGLE=new ia("FLOATING SINGLE");var dn=function e(){this._precisionModel=new Pn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ue(arguments[0],yf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Pn&&(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]))},VI={serialVersionUID:{configurable:!0}};dn.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)};dn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new vr(this.getCoordinateSequenceFactory().create(e),this);if(Ue(e,Sn))return new vr(e,this)}else return new vr(this.getCoordinateSequenceFactory().create([]),this)};dn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Du(null,this);if(arguments.length===1){var e=arguments[0];return new Du(e,this)}};dn.prototype.buildGeometry=function(e){for(var t=null,n=!1,r=!1,i=e.iterator();i.hasNext();){var a=i.next(),h=a.getClass();t===null&&(t=h),h!==t&&(n=!0),a.isGeometryCollectionOrDerived()&&(r=!0)}if(t===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(dn.toGeometryArray(e));var u=e.iterator().next(),g=e.size()>1;if(g){if(u instanceof Hr)return this.createMultiPolygon(dn.toPolygonArray(e));if(u instanceof vr)return this.createMultiLineString(dn.toLineStringArray(e));if(u instanceof Co)return this.createMultiPoint(dn.toPointArray(e));on.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};dn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};dn.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(Ue(arguments[0],Sn)){var t=arguments[0];return new Co(t,this)}}};dn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};dn.prototype.createPolygon=function(){if(arguments.length===0)return new Hr(null,null,this);if(arguments.length===1){if(Ue(arguments[0],Sn)){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 Ma){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Hr(r,i,this)}};dn.prototype.getSRID=function(){return this._SRID};dn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hi(null,this);if(arguments.length===1){var e=arguments[0];return new Hi(e,this)}};dn.prototype.createGeometry=function(e){var t=new us(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};dn.prototype.getPrecisionModel=function(){return this._precisionModel};dn.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(Ue(arguments[0],Sn)){var t=arguments[0];return new Ma(t,this)}}};dn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ta(null,this);if(arguments.length===1){var e=arguments[0];return new Ta(e,this)}};dn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new Sf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Sf(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ue(arguments[0],Sn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[e]};ma.prototype.push=function(e){return this.array_.push(e),e};ma.prototype.pop=function(e){if(this.array_.length===0)throw new Dy;return this.array_.pop()};ma.prototype.peek=function(){if(this.array_.length===0)throw new Dy;return this.array_[this.array_.length-1]};ma.prototype.empty=function(){return this.array_.length===0};ma.prototype.isEmpty=function(){return this.empty()};ma.prototype.search=function(e){return this.array_.indexOf(e)};ma.prototype.size=function(){return this.array_.length};ma.prototype.toArray=function(){for(var e=this,t=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===xe.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};oa.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),r=n.getCoordinates();if(t<0||t+1>=r.length||r[t].y===r[t+1].y)return-1;var i=ie.LEFT;return r[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=r,t._minCoord=n[r])};oa.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)};oa.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var r=n.next();r.isForward()&&t.checkForRightmostCoordinate(r)}on.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 i=this.getRightmostSide(this._minDe,this._minIndex);i===ie.LEFT&&(this._orientedDe=this._minDe.getSym())};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};var fl=function(e){function t(n,r){e.call(this,t.msgWithCoord(n,r)),this.pt=r?new At(r):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,r){return r?n:n+" [ "+r+" ]"},t}(cl),Ry=function(){this.array_=[]};Ry.prototype.addLast=function(e){this.array_.push(e)};Ry.prototype.removeFirst=function(){return this.array_.shift()};Ry.prototype.isEmpty=function(){return this.array_.length===0};var Zi=function(){this._finder=null,this._dirEdgeList=new me,this._nodes=new me,this._rightMostCoord=null,this._env=null,this._finder=new oa};Zi.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};Zi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Zi.prototype.computeNodeDepth=function(e){for(var t=this,n=null,r=e.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new fl("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var a=e.getEdges().iterator();a.hasNext();){var h=a.next();h.setVisited(!0),t.copySymDepths(h)}};Zi.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(ie.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};Zi.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Zi.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(ie.RIGHT)>=1&&t.getDepth(ie.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};Zi.prototype.computeDepths=function(e){var t=this,n=new Yv,r=new Ry,i=e.getNode();for(r.addLast(i),n.add(i),e.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),t.computeNodeDepth(a);for(var h=a.getEdges().iterator();h.hasNext();){var u=h.next(),g=u.getSym();if(!g.isVisited()){var w=g.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Zi.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};Zi.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Re,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ie.ON]=this.location[ie.ON],n[ie.LEFT]=zt.NONE,n[ie.RIGHT]=zt.NONE,this.location=n}for(var r=0;r1&&e.append(zt.toLocationSymbol(this.location[ie.LEFT])),e.append(zt.toLocationSymbol(this.location[ie.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[ie.RIGHT])),e.toString()};Yn.prototype.setLocations=function(e,t,n){this.location[ie.ON]=e,this.location[ie.LEFT]=t,this.location[ie.RIGHT]=n};Yn.prototype.get=function(e){return e1};Yn.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=r),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};zr.prototype.addPoints=function(e,t,n){var r=this,i=e.getCoordinates();if(t){var a=1;n&&(a=0);for(var h=a;h=0;g--)r._pts.add(i[g])}};zr.prototype.isHole=function(){return this._isHole};zr.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};zr.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!xe.isPointInRing(e,t.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(e))return!1}return!0};zr.prototype.addHole=function(e){this._holes.add(e)};zr.prototype.isShell=function(){return this._shell===null};zr.prototype.getLabel=function(){return this._label};zr.prototype.getEdges=function(){return this._edges};zr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};zr.prototype.getShell=function(){return this._shell};zr.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],r=t.getLocation(n,ie.RIGHT);if(r===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,r),null}};zr.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};zr.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(e)};Ho.prototype.isInResult=function(){return this._isInResult};Ho.prototype.isVisited=function(){return this._isVisited};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};var Ny=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Nn(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 r=n.next();if(r.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,r){var i=zt.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==zt.BOUNDARY&&(i=a)}return i},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Nn(n,r):this._label.setLocation(n,r)}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 r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Nn)for(var i=arguments[0],a=0;a<2;a++){var h=n.computeMergedLocation(i,a),u=n._label.getLocation(a);u===zt.NONE&&n._label.setLocation(a,h)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=zt.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case zt.BOUNDARY:i=zt.INTERIOR;break;case zt.INTERIOR:i=zt.BOUNDARY;break;default:i=zt.BOUNDARY;break}this._label.setLocation(n,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ho),sa=function(){this.nodeMap=new ki,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};sa.prototype.find=function(e){return this.nodeMap.get(e)};sa.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 Ny){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};sa.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};sa.prototype.iterator=function(){return this.nodeMap.values().iterator()};sa.prototype.values=function(){return this.nodeMap.values()};sa.prototype.getBoundaryNodes=function(e){for(var t=new me,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(e)===zt.BOUNDARY&&t.add(r)}return t};sa.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};sa.prototype.interfaces_=function(){return[]};sa.prototype.getClass=function(){return sa};var Bn=function(){},Zd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Bn.prototype.interfaces_=function(){return[]};Bn.prototype.getClass=function(){return Bn};Bn.isNorthern=function(e){return e===Bn.NE||e===Bn.NW};Bn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Bn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var r=et?e:t;return r===0&&i===3?3:r};Bn.isInHalfPlane=function(e,t){return t===Bn.SE?e===Bn.SE||e===Bn.SW:e===t||e===t+1};Bn.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 sr("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Bn.NE:Bn.SE:t>=0?Bn.NW:Bn.SW}else if(arguments[0]instanceof At&&arguments[1]instanceof At){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new sr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Bn.NE:Bn.SE:r.y>=n.y?Bn.NW:Bn.SW}};Zd.NE.get=function(){return 0};Zd.NW.get=function(){return 1};Zd.SW.get=function(){return 2};Zd.SE.get=function(){return 3};Object.defineProperties(Bn,Zd);var Di=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],r=arguments[2],i=null;this._edge=t,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],h=arguments[1],u=arguments[2],g=arguments[3];this._edge=a,this.init(h,u),this._label=g}};Di.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){h.linkDirectedEdgesForMinimalEdgeRings();var u=h.buildMinimalRings(),g=r.findShell(u);g!==null?(r.placePolygonHoles(g,u),t.add(g)):n.addAll(u)}else i.add(h)}return i};To.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};To.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new me,r=e.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new cR(i,t._geometryFactory);n.add(a),a.setInResult()}}return n};To.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(e)}};To.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};To.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,h=null,u=t.iterator();u.hasNext();){var g=u.next(),w=g.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(h=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&xe.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||h.contains(S))&&(a=g)}return a};To.prototype.findShell=function(e){for(var t=0,n=null,r=e.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,t++)}return on.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};To.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];fr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(t),i=new me,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};To.prototype.interfaces_=function(){return[]};To.prototype.getClass=function(){return To};var If=function(){};If.prototype.getBounds=function(){};If.prototype.interfaces_=function(){return[]};If.prototype.getClass=function(){return If};var Ps=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Ps.prototype.getItem=function(){return this._item};Ps.prototype.getBounds=function(){return this._bounds};Ps.prototype.interfaces_=function(){return[If,fs]};Ps.prototype.getClass=function(){return Ps};var pl=function(){this._size=null,this._items=null,this._size=0,this._items=new me,this._items.add(null)};pl.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};pl.prototype.size=function(){return this._size};pl.prototype.reorder=function(e){for(var t=this,n=null,r=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(r)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,r)};pl.prototype.clear=function(){this._size=0,this._items.clear()};pl.prototype.isEmpty=function(){return this._size===0};pl.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)};pl.prototype.interfaces_=function(){return[]};pl.prototype.getClass=function(){return pl};var Xl=function(){};Xl.prototype.visitItem=function(e){};Xl.prototype.interfaces_=function(){return[]};Xl.prototype.getClass=function(){return Xl};var Pc=function(){};Pc.prototype.insert=function(e,t){};Pc.prototype.remove=function(e,t){};Pc.prototype.query=function(){};Pc.prototype.interfaces_=function(){return[]};Pc.prototype.getClass=function(){return Pc};var Wr=function(){if(this._childBoundables=new me,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},GI={serialVersionUID:{configurable:!0}};Wr.prototype.getLevel=function(){return this._level};Wr.prototype.size=function(){return this._childBoundables.size()};Wr.prototype.getChildBoundables=function(){return this._childBoundables};Wr.prototype.addChildBoundable=function(e){on.isTrue(this._bounds===null),this._childBoundables.add(e)};Wr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Wr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Wr.prototype.interfaces_=function(){return[If,fs]};Wr.prototype.getClass=function(){return Wr};GI.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Wr,GI);var Ms=function(){};Ms.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Ms.min=function(e){return Ms.sort(e),e.get(0)};Ms.sort=function(e,t){var n=e.toArray();t?Pu.sort(n,t):Pu.sort(n);for(var r=e.iterator(),i=0,a=n.length;iNr.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(r)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new sr("neither boundable is composite")};Nr.prototype.isLeaves=function(){return!(Nr.isComposite(this._boundable1)||Nr.isComposite(this._boundable2))};Nr.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Nr.prototype.expand=function(e,t,n,r){for(var i=this,a=e.getChildBoundables(),h=a.iterator();h.hasNext();){var u=h.next(),g=new Nr(u,t,i._itemDistance);g.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Oy={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};gi.prototype.getNodeCapacity=function(){return this._nodeCapacity};gi.prototype.lastNode=function(e){return e.get(e.size()-1)};gi.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,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Wr?n+=e.size(i):i instanceof Ps&&(n+=1)}return n}};gi.prototype.removeItem=function(e,t){for(var n=null,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ps&&i.getItem()===t&&(n=i)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};gi.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new me:t}else if(arguments.length===1){for(var n=arguments[0],r=new me,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Wr){var h=e.itemsTree(a);h!==null&&r.add(h)}else a instanceof Ps?r.add(a.getItem()):on.shouldNeverReachHere()}return r.size()<=0?null:r}};gi.prototype.insert=function(e,t){on.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ps(e,t))};gi.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new me;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(on.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var h=i.getChildBoundables().iterator();h.hasNext();){var u=h.next();u instanceof Wr?e.boundablesAtLevel(r,u,a):(on.isTrue(u instanceof Ps),r===-1&&a.add(u))}return null}};gi.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new me;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Ue(arguments[2],Xl)&&arguments[0]instanceof Object&&arguments[1]instanceof Wr)for(var a=arguments[0],h=arguments[1],u=arguments[2],g=h.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};gi.prototype.createParentBoundables=function(e,t){var n=this;on.isTrue(!e.isEmpty());var r=new me;r.add(this.createNode(t));var i=new me(e);Ms.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var h=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(t)),n.lastNode(r).addChildBoundable(h)}return r};gi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};gi.prototype.interfaces_=function(){return[fs]};gi.prototype.getClass=function(){return gi};gi.compareDoubles=function(e,t){return e>t?1:e0);for(var h=new me,u=0;u0;){var N=D.poll(),G=N.getDistance();if(G>=I)break;N.isLeaves()?(I=G,P=N):N.expandToQueue(D,I)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var Y=arguments[0],et=arguments[1],V=arguments[2],j=new Ps(Y,et),X=new Nr(this.getRoot(),j,V);return this.nearestNeighbour(X)[0]}},t.prototype.interfaces_=function(){return[Pc,fs]},t.prototype.getClass=function(){return t},t.centreX=function(r){return t.avg(r.getMinX(),r.getMaxX())},t.avg=function(r,i){return(r+i)/2},t.centreY=function(r){return t.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return $w},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[gf]},compare:function(r,i){return e.compareDoubles(t.centreX(r.getBounds()),t.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[gf]},compare:function(r,i){return e.compareDoubles(t.centreY(r.getBounds()),t.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(gi),$w=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,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Re(i.getBounds()):n.expandToInclude(i.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Wr),io=function(){};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};io.relativeSign=function(e,t){return et?1:0};io.compare=function(e,t,n){if(t.equals2D(n))return 0;var r=io.relativeSign(t.x,n.x),i=io.relativeSign(t.y,n.y);switch(e){case 0:return io.compareValue(r,i);case 1:return io.compareValue(i,r);case 2:return io.compareValue(i,-r);case 3:return io.compareValue(-r,i);case 4:return io.compareValue(-r,-i);case 5:return io.compareValue(-i,-r);case 6:return io.compareValue(-i,r);case 7:return io.compareValue(r,-i)}return on.shouldNeverReachHere("invalid octant value"),0};io.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Yl=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],r=arguments[3];this._segString=e,this.coord=new At(t),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!t.equals2D(e.getCoordinate(n))};Yl.prototype.getCoordinate=function(){return this.coord};Yl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Yl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:io.compare(this._segmentOctant,this.coord,t.coord)};Yl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Yl.prototype.isInterior=function(){return this._isInterior};Yl.prototype.interfaces_=function(){return[hs]};Yl.prototype.getClass=function(){return Yl};var Xi=function(){this._nodeMap=new ki,this._edge=null;var e=arguments[0];this._edge=e};Xi.prototype.getSplitCoordinates=function(){var e=this,t=new Wd;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();e.addEdgeCoordinates(r,i,t),r=i}return t.toCoordinateArray()};Xi.prototype.addCollapsedNodes=function(){var e=this,t=new me;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var r=n.next().intValue();e.add(e._edge.getCoordinate(r),r)}};Xi.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};Xi.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=r?0:1:n>=r?7:6:t>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof At&&arguments[1]instanceof At){var i=arguments[0],a=arguments[1],h=a.x-i.x,u=a.y-i.y;if(h===0&&u===0)throw new sr("Cannot compute the octant for two identical points "+i);return Mc.octant(h,u)}};var ka=function(){};ka.prototype.getCoordinates=function(){};ka.prototype.size=function(){};ka.prototype.getCoordinate=function(e){};ka.prototype.isClosed=function(){};ka.prototype.setData=function(e){};ka.prototype.getData=function(){};ka.prototype.interfaces_=function(){return[]};ka.prototype.getClass=function(){return ka};var Md=function(){};Md.prototype.addIntersection=function(e,t){};Md.prototype.interfaces_=function(){return[ka]};Md.prototype.getClass=function(){return Md};var Mr=function(){this._nodeList=new Xi(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Mr.prototype.getCoordinates=function(){return this._pts};Mr.prototype.size=function(){return this._pts.length};Mr.prototype.getCoordinate=function(e){return this._pts[e]};Mr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Mr.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Mr.prototype.setData=function(e){this._data=e};Mr.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Mc.octant(e,t)};Mr.prototype.getData=function(){return this._data};Mr.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],r=arguments[1],i=arguments[3],a=new At(n.getIntersection(i));this.addIntersection(a,r)}};Mr.prototype.toString=function(){return Ts.toLineString(new Tr(this._pts))};Mr.prototype.getNodeList=function(){return this._nodeList};Mr.prototype.addIntersectionNode=function(e,t){var n=t,r=n+1;if(r=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof At){var r=arguments[0];return xe.orientationIndex(this.p0,this.p1,r)}};Ne.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Ne.prototype.isVertical=function(){return this.p0.x===this.p1.x};Ne.prototype.equals=function(e){if(!(e instanceof Ne))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Ne.prototype.intersection=function(e){var t=new Hu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Ne.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 Ne){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var h=this.project(r.p0);i<0&&(h=this.p0),i>1&&(h=this.p1);var u=this.project(r.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new Ne(h,u)}};Ne.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Ne.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Ne.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Ne.prototype.distancePerpendicular=function(e){return xe.distancePointLinePerpendicular(e,this.p0,this.p1)};Ne.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Ne.prototype.midPoint=function(){return Ne.midPoint(this.p0,this.p1)};Ne.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,r=t*t+n*n;if(r<=0)return Xe.NaN;var i=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/r;return i};Ne.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),r=Xe.MAX_VALUE,i=null,a=this.closestPoint(e.p0);r=a.distance(e.p0),n[0]=a,n[1]=e.p0;var h=this.closestPoint(e.p1);i=h.distance(e.p1),i0&&t<1)return this.project(e);var n=this.p0.distance(e),r=this.p1.distance(e);return n1||Xe.isNaN(t))&&(t=1),t};Ne.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Ne.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Ne.prototype.distance=function(){if(arguments[0]instanceof Ne){var e=arguments[0];return xe.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof At){var t=arguments[0];return xe.distancePointLine(t,this.p0,this.p1)}};Ne.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};Ne.prototype.hashCode=function(){var e=Xe.doubleToLongBits(this.p0.x);e^=Xe.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=Xe.doubleToLongBits(this.p1.x);n^=Xe.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return t^r};Ne.prototype.interfaces_=function(){return[hs,fs]};Ne.prototype.getClass=function(){return Ne};Ne.midPoint=function(e,t){return new At((e.x+t.x)/2,(e.y+t.y)/2)};jI.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Ne,jI);var Ad=function(){this.tempEnv1=new Re,this.tempEnv2=new Re,this._overlapSeg1=new Ne,this._overlapSeg2=new Ne};Ad.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Ad.prototype.interfaces_=function(){return[]};Ad.prototype.getClass=function(){return Ad};var Lo=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],r=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=r};Lo.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Lo.prototype.computeSelect=function(e,t,n,r){var i=this._pts[t],a=this._pts[n];if(r.tempEnv1.init(i,a),n-t===1)return r.select(this,t),null;if(!e.intersects(r.tempEnv1))return null;var h=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var r=Bn.quadrant(e[n],e[n+1]),i=t+1;ih.getId()&&(h.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return t2},Object.defineProperties(t,n),t}(kd),t2=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],r=arguments[1],i=arguments[2],a=arguments[3],h=n.getContext(),u=i.getContext();this._si.processIntersections(h,r,u,a)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ad),Ln=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],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],h=arguments[2],u=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(h),this.setMitreLimit(u)}}},vl={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}};Ln.prototype.getEndCapStyle=function(){return this._endCapStyle};Ln.prototype.isSingleSided=function(){return this._isSingleSided};Ln.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Ln.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ln.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Ln.JOIN_ROUND&&(this._quadrantSegments=Ln.DEFAULT_QUADRANT_SEGMENTS)};Ln.prototype.getJoinStyle=function(){return this._joinStyle};Ln.prototype.setJoinStyle=function(e){this._joinStyle=e};Ln.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Ln.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Ln.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Ln.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Ln.prototype.getMitreLimit=function(){return this._mitreLimit};Ln.prototype.setMitreLimit=function(e){this._mitreLimit=e};Ln.prototype.setSingleSided=function(e){this._isSingleSided=e};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};vl.CAP_ROUND.get=function(){return 1};vl.CAP_FLAT.get=function(){return 2};vl.CAP_SQUARE.get=function(){return 3};vl.JOIN_ROUND.get=function(){return 1};vl.JOIN_MITRE.get=function(){return 2};vl.JOIN_BEVEL.get=function(){return 3};vl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};vl.DEFAULT_MITRE_LIMIT.get=function(){return 5};vl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Ln,vl);var br=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=xe.COUNTERCLOCKWISE,this._inputLine=e||null},Xd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};br.prototype.isDeletable=function(e,t,n,r){var i=this._inputLine[e],a=this._inputLine[t],h=this._inputLine[n];return!this.isConcave(i,a,h)||!this.isShallow(i,a,h,r)?!1:this.isShallowSampled(i,a,e,n,r)};br.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(e[i])};Zo.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-=vn.PI_TIMES_2;for(;e<=-Math.PI;)e+=vn.PI_TIMES_2;return e};vn.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],r=n.x-t.x,i=n.y-t.y;return Math.atan2(i,r)}};vn.isAcute=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,h=n.y-t.y,u=r*a+i*h;return u>0};vn.isObtuse=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,h=n.y-t.y,u=r*a+i*h;return u<0};vn.interiorAngle=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n);return Math.abs(i-r)};vn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=vn.PI_TIMES_2;e>=vn.PI_TIMES_2&&(e=0)}else{for(;e>=vn.PI_TIMES_2;)e-=vn.PI_TIMES_2;e<0&&(e=0)}return e};vn.angleBetween=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n);return vn.diff(r,i)};vn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};vn.toRadians=function(e){return e*Math.PI/180};vn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?vn.COUNTERCLOCKWISE:n<0?vn.CLOCKWISE:vn.NONE};vn.angleBetweenOriented=function(e,t,n){var r=vn.angle(t,e),i=vn.angle(t,n),a=i-r;return a<=-Math.PI?a+vn.PI_TIMES_2:a>Math.PI?a-vn.PI_TIMES_2:a};Xc.PI_TIMES_2.get=function(){return 2*Math.PI};Xc.PI_OVER_2.get=function(){return Math.PI/2};Xc.PI_OVER_4.get=function(){return Math.PI/4};Xc.COUNTERCLOCKWISE.get=function(){return xe.COUNTERCLOCKWISE};Xc.CLOCKWISE.get=function(){return xe.CLOCKWISE};Xc.NONE.get=function(){return xe.COLLINEAR};Object.defineProperties(vn,Xc);var er=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 Ne,this._seg1=new Ne,this._offset0=new Ne,this._offset1=new Ne,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Hu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Ln.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Yd={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}};er.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=xe.computeOrientation(this._s0,this._s1,this._s2),r=n===xe.CLOCKWISE&&this._side===ie.LEFT||n===xe.COUNTERCLOCKWISE&&this._side===ie.RIGHT;n===0?this.addCollinear(t):r?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};er.prototype.addLineEndCap=function(e,t){var n=new Ne(e,t),r=new Ne;this.computeOffsetSegment(n,ie.LEFT,this._distance,r);var i=new Ne;this.computeOffsetSegment(n,ie.RIGHT,this._distance,i);var a=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,a);switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(t,u+Math.PI/2,u-Math.PI/2,xe.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Ln.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Ln.CAP_SQUARE:var g=new At;g.x=Math.abs(this._distance)*Math.cos(u),g.y=Math.abs(this._distance)*Math.sin(u);var w=new At(r.p1.x+g.x,r.p1.y+g.y),S=new At(i.p1.x+g.x,i.p1.y+g.y);this._segList.addPt(w),this._segList.addPt(S);break}};er.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};er.prototype.addMitreJoin=function(e,t,n,r){var i=!0,a=null;try{a=Is.intersection(t.p0,t.p1,n.p0,n.p1);var h=r<=0?1:a.distance(e)/Math.abs(r);h>this._bufParams.getMitreLimit()&&(i=!1)}catch(u){if(u instanceof Gf)a=new At(0,0),i=!1;else throw u}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(t,n,r,this._bufParams.getMitreLimit())};er.prototype.addFilletCorner=function(e,t,n,r,i){var a=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,a),g=n.x-e.x,w=n.y-e.y,S=Math.atan2(w,g);r===xe.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,u,S,r,i),this._segList.addPt(n)};er.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 r=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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};er.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()};er.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};er.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Zo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*er.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};er.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()===Ln.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ln.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,xe.CLOCKWISE,this._distance))};er.prototype.closeRing=function(){this._segList.closeRing()};er.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};er.prototype.interfaces_=function(){return[]};er.prototype.getClass=function(){return er};Yd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Yd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Yd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Yd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(er,Yd);var so=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};so.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,r=Math.abs(t),i=this.getSegGen(r);e.length<=1?this.computePointCurve(e[0],i):this.computeOffsetCurve(e,n,i);var a=i.getCoordinates();return n&&mn.reverse(a),a};so.prototype.computeSingleSidedBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var i=br.simplify(e,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ie.LEFT),n.addFirstSegment();for(var h=a-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{n.addSegments(e,!1);var u=br.simplify(e,r),g=u.length-1;n.initSideSegments(u[0],u[1],ie.LEFT),n.addFirstSegment();for(var w=2;w<=g;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};so.prototype.computeRingBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);t===ie.RIGHT&&(r=-r);var i=br.simplify(e,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],t);for(var h=1;h<=a;h++){var u=h!==1;n.addNextSegment(i[h],u)}n.closeRing()};so.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),r=br.simplify(e,n),i=r.length-1;t.initSideSegments(r[0],r[1],ie.LEFT);for(var a=2;a<=i;a++)t.addNextSegment(r[a],!0);t.addLastSegment(),t.addLineEndCap(r[i-1],r[i]);var h=br.simplify(e,-n),u=h.length-1;t.initSideSegments(h[u],h[u-1],ie.LEFT);for(var g=u-2;g>=0;g--)t.addNextSegment(h[g],!0);t.addLastSegment(),t.addLineEndCap(h[1],h[0]),t.closeRing()};so.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:t.createCircle(e);break;case Ln.CAP_SQUARE:t.createSquare(e);break}};so.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),r=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],r);else if(this._bufParams.isSingleSided()){var i=t<0;this.computeSingleSidedBufferCurve(e,i,r)}else this.computeLineBufferCurve(e,r);var a=r.getCoordinates();return a};so.prototype.getBufferParameters=function(){return this._bufParams};so.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};so.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return so.copyCoordinates(e);var r=this.getSegGen(n);return this.computeRingBufferCurve(e,t,r),r.getCoordinates()};so.prototype.computeOffsetCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){var i=br.simplify(e,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ie.LEFT),n.addFirstSegment();for(var h=a-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{var u=br.simplify(e,r),g=u.length-1;n.initSideSegments(u[0],u[1],ie.LEFT),n.addFirstSegment();for(var w=2;w<=g;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};so.prototype.getSegGen=function(e){return new er(this._precisionModel,this._bufParams,e)};so.prototype.interfaces_=function(){return[]};so.prototype.getClass=function(){return so};so.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;na.getMaxY()||e.findStabbedSegments(t,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ue(arguments[2],Cs)&&arguments[0]instanceof At&&arguments[1]instanceof av)for(var h=arguments[0],u=arguments[1],g=arguments[2],w=u.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var I=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Ie._seg.p1.y)&&xe.computeOrientation(e._seg.p0,e._seg.p1,h)!==xe.RIGHT){var P=u.getDepth(ie.LEFT);e._seg.p0.equals(w[S])||(P=u.getDepth(ie.RIGHT));var D=new Nu(e._seg,P);g.add(D)}}else if(Ue(arguments[2],Cs)&&arguments[0]instanceof At&&Ue(arguments[1],Cs))for(var N=arguments[0],G=arguments[1],Y=arguments[2],et=G.iterator();et.hasNext();){var V=et.next();V.isForward()&&e.findStabbedSegments(N,V,Y)}}};Ac.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Ms.min(t);return n._leftDepth};Ac.prototype.interfaces_=function(){return[]};Ac.prototype.getClass=function(){return Ac};HI.DepthSegment.get=function(){return Nu};Object.defineProperties(Ac,HI);var Nu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Ne(e),this._leftDepth=t};Nu.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)};Nu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Nu.prototype.toString=function(){return this._upwardSeg.toString()};Nu.prototype.interfaces_=function(){return[hs]};Nu.prototype.getClass=function(){return Nu};var Mn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Mn.prototype.area=function(){return Mn.area(this.p0,this.p1,this.p2)};Mn.prototype.signedArea=function(){return Mn.signedArea(this.p0,this.p1,this.p2)};Mn.prototype.interpolateZ=function(e){if(e===null)throw new sr("Supplied point is null.");return Mn.interpolateZ(e,this.p0,this.p1,this.p2)};Mn.prototype.longestSideLength=function(){return Mn.longestSideLength(this.p0,this.p1,this.p2)};Mn.prototype.isAcute=function(){return Mn.isAcute(this.p0,this.p1,this.p2)};Mn.prototype.circumcentre=function(){return Mn.circumcentre(this.p0,this.p1,this.p2)};Mn.prototype.area3D=function(){return Mn.area3D(this.p0,this.p1,this.p2)};Mn.prototype.centroid=function(){return Mn.centroid(this.p0,this.p1,this.p2)};Mn.prototype.inCentre=function(){return Mn.inCentre(this.p0,this.p1,this.p2)};Mn.prototype.interfaces_=function(){return[]};Mn.prototype.getClass=function(){return Mn};Mn.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)};Mn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Mn.det=function(e,t,n,r){return e*r-t*n};Mn.interpolateZ=function(e,t,n,r){var i=t.x,a=t.y,h=n.x-i,u=r.x-i,g=n.y-a,w=r.y-a,S=h*w-u*g,I=e.x-i,P=e.y-a,D=(w*I-u*P)/S,N=(-g*I+h*P)/S,G=t.z+D*(n.z-t.z)+N*(r.z-t.z);return G};Mn.longestSideLength=function(e,t,n){var r=e.distance(t),i=t.distance(n),a=n.distance(e),h=r;return i>h&&(h=i),a>h&&(h=a),h};Mn.isAcute=function(e,t,n){return!(!vn.isAcute(e,t,n)||!vn.isAcute(t,n,e)||!vn.isAcute(n,e,t))};Mn.circumcentre=function(e,t,n){var r=n.x,i=n.y,a=e.x-r,h=e.y-i,u=t.x-r,g=t.y-i,w=2*Mn.det(a,h,u,g),S=Mn.det(h,a*a+h*h,g,u*u+g*g),I=Mn.det(a,a*a+h*h,u,u*u+g*g),P=r-S/w,D=i+I/w;return new At(P,D)};Mn.perpendicularBisector=function(e,t){var n=t.x-e.x,r=t.y-e.y,i=new Is(e.x+n/2,e.y+r/2,1),a=new Is(e.x-r+n/2,e.y+n+r/2,1);return new Is(i,a)};Mn.angleBisector=function(e,t,n){var r=t.distance(e),i=t.distance(n),a=r/(r+i),h=n.x-e.x,u=n.y-e.y,g=new At(e.x+a*h,e.y+a*u);return g};Mn.area3D=function(e,t,n){var r=t.x-e.x,i=t.y-e.y,a=t.z-e.z,h=n.x-e.x,u=n.y-e.y,g=n.z-e.z,w=i*g-a*u,S=a*h-r*g,I=r*u-i*h,P=w*w+S*S+I*I,D=Math.sqrt(P)/2;return D};Mn.centroid=function(e,t,n){var r=(e.x+t.x+n.x)/3,i=(e.y+t.y+n.y)/3;return new At(r,i)};Mn.inCentre=function(e,t,n){var r=t.distance(n),i=e.distance(n),a=e.distance(t),h=r+i+a,u=(r*e.x+i*t.x+a*n.x)/h,g=(r*e.y+i*t.y+a*n.y)/h;return new At(u,g)};var cs=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new me;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};cs.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)};cs.prototype.addPolygon=function(e){var t=this,n=this._distance,r=ie.LEFT;this._distance<0&&(n=-this._distance,r=ie.RIGHT);var i=e.getExteriorRing(),a=mn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,zt.EXTERIOR,zt.INTERIOR);for(var h=0;h0&&t.isErodedCompletely(u,-t._distance)||t.addPolygonRing(g,n,ie.opposite(r),zt.INTERIOR,zt.EXTERIOR)}};cs.prototype.isTriangleErodedCompletely=function(e,t){var n=new Mn(e[0],e[1],e[2]),r=n.inCentre(),i=xe.distancePointLine(r,n.p0,n.p1);return i=Ma.MINIMUM_VALID_SIZE&&xe.isCCW(e)&&(a=i,h=r,n=ie.opposite(n));var u=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(u,a,h)};cs.prototype.add=function(e){if(e.isEmpty())return null;e instanceof Hr?this.addPolygon(e):e instanceof vr?this.addLineString(e):e instanceof Co?this.addPoint(e):e instanceof Sf?this.addCollection(e):e instanceof Du?this.addCollection(e):e instanceof Ta?this.addCollection(e):e instanceof Hi&&this.addCollection(e)};cs.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 r=e.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return t<0&&2*Math.abs(t)>i};cs.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new jf;var e=this._parent.getGeometryN(this._index++);return e instanceof Hi?(this._subcollectionIterator=new La(e),this._subcollectionIterator.next()):e};La.prototype.remove=function(){throw new Error(this.getClass().getName())};La.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)};La.prototype.interfaces_=function(){return[qf]};La.prototype.getClass=function(){return La};La.isAtomic=function(e){return!(e instanceof Hi)};var qo=function(){this._geom=null;var e=arguments[0];this._geom=e};qo.prototype.locate=function(e){return qo.locate(e,this._geom)};qo.prototype.interfaces_=function(){return[Tf]};qo.prototype.getClass=function(){return qo};qo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?xe.isPointInRing(e,t.getCoordinates()):!1};qo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!qo.isPointInRing(e,n))return!1;for(var r=0;r=0;a--){var h=n._edgeList.get(a),u=h.getSym();i===null&&(i=u),r!==null&&u.setNext(r),r=h}i.setNext(r)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(ie.LEFT),h=r.getDepth(ie.RIGHT),u=this.computeDepths(i+1,this._edgeList.size(),a),g=this.computeDepths(0,i,u);if(g!==h)throw new fl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],P=I,D=w;D=0;u--){var g=r._resultAreaEdgeList.get(u),w=g.getSym();switch(i===null&&g.getEdgeRing()===n&&(i=g),h){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;a=w,h=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(g.getEdgeRing()!==n)continue;a.setNextMin(g),h=r._SCANNING_FOR_INCOMING;break}}h===this._LINKING_TO_OUTGOING&&(on.isTrue(i!==null,"found null for first outgoing dirEdge"),on.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],h=0,u=this.iterator();u.hasNext();){var g=u.next();g.getEdgeRing()===a&&h++}return h}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=zt.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=zt.INTERIOR;break}if(a.isInResult()){n=zt.EXTERIOR;break}}}if(n===zt.NONE)return null;for(var h=n,u=this.iterator();u.hasNext();){var g=u.next(),w=g.getSym();g.isLineEdge()?g.getEdge().setCovered(h===zt.INTERIOR):(g.isInResult()&&(h=zt.EXTERIOR),w.isInResult()&&(h=zt.INTERIOR))}},t.prototype.computeLabelling=function(n){var r=this;e.prototype.computeLabelling.call(this,n),this._label=new Nn(zt.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),h=a.getEdge(),u=h.getLabel(),g=0;g<2;g++){var w=u.getLocation(g);(w===zt.INTERIOR||w===zt.BOUNDARY)&&r._label.setLocation(g,zt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ri),ZI=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 Ny(n,new fR)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ef),Kl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Kl.prototype.compareTo=function(e){var t=e,n=Kl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Kl.prototype.interfaces_=function(){return[hs]};Kl.prototype.getClass=function(){return Kl};Kl.orientation=function(e){return mn.increasingDirection(e)===1};Kl.compareOriented=function(e,t,n,r){for(var i=t?1:-1,a=r?1:-1,h=t?e.length:-1,u=r?n.length:-1,g=t?0:e.length-1,w=r?0:n.length-1;;){var S=e[g].compareTo(n[w]);if(S!==0)return S;g+=i,w+=a;var I=g===h,P=w===u;if(I&&!P)return-1;if(!I&&P)return 1;if(I&&P)return 0}};var As=function(){this._edges=new me,this._ocaMap=new ki};As.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var i=r.getCoordinates(),a=0;a0&&e.print(","),e.print(i[a].x+" "+i[a].y);e.println(")")}e.print(") ")};As.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};As.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(i);a||r--;var h=new Array(r).fill(null),u=0;h[u++]=new At(e.coord);for(var g=e.segmentIndex+1;g<=t.segmentIndex;g++)h[u++]=n.edge.pts[g];return a&&(h[u]=t.coord),new sy(h,new Nn(this.edge._label))};Da.prototype.add=function(e,t,n){var r=new aa(e,t,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Da.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};var zu=function(){};zu.prototype.getChainStartIndices=function(e){var t=this,n=0,r=new me;r.add(new ea(n));do{var i=t.findChainEnd(e,n);r.add(new ea(i)),n=i}while(nn?t:n};dl.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(i=1),e._depth[t][r]=i}}};Ei.prototype.getDelta=function(e){return this._depth[e][ie.RIGHT]-this._depth[e][ie.LEFT]};Ei.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Ei.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ei.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=t.getLocation(n,r);(i===zt.EXTERIOR||i===zt.INTERIOR)&&(e.isNull(n,r)?e._depth[n][r]=Ei.depthAtLocation(i):e._depth[n][r]+=Ei.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],h=arguments[1],u=arguments[2];u===zt.INTERIOR&&this._depth[a][h]++}};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Ei.NULL_VALUE};XI.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ei,XI);var sy=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new Da(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ei,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}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 r=new t(n,Nn.toLineLabel(this._label));return r},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 r=this;if(!(n instanceof t))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,h=!0,u=this.pts.length,g=0;g0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].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 r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new dl(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Re;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},t.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(h)return!1;var u=this.intersectsToleranceSquare(e,t);return on.isTrue(!(h&&u),"Found bad envelope test"),u};ao.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)};ao.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))};ao.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};ao.prototype.getCoordinate=function(){return this._originalPt};ao.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};ao.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=ao.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};ao.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()))};ao.prototype.intersectsToleranceSquare=function(e,t){var n=!1,r=!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()&&(r=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||e.equals(this._pt)||t.equals(this._pt))};ao.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),r=e.getCoordinate(t+1);return this.intersects(n,r)?(e.addIntersection(this.getCoordinate(),t),!0):!1};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};KI.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(ao,KI);var Dd=function(){this.tempEnv1=new Re,this.selectedSegment=new Ne};Dd.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)}};Dd.prototype.interfaces_=function(){return[]};Dd.prototype.getClass=function(){return Dd};var Lf=function(){this._index=null;var e=arguments[0];this._index=e},JI={HotPixelSnapAction:{configurable:!0}};Lf.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],r=arguments[2],i=t.getSafeEnvelope(),a=new QI(t,n,r);return this._index.query(i,{interfaces_:function(){return[Xl]},visitItem:function(h){var u=h;u.select(i,a)}}),a.isNodeAdded()}};Lf.prototype.interfaces_=function(){return[]};Lf.prototype.getClass=function(){return Lf};JI.HotPixelSnapAction.get=function(){return QI};Object.defineProperties(Lf,JI);var QI=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}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],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Dd),kc=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new me};kc.prototype.processIntersections=function(e,t,n,r){var i=this;if(e===n&&t===r)return null;var a=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],g=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,h,u,g),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;t--){try{e.bufferReducedPrecision(t)}catch(a){if(a instanceof fl)e._saveException=a;else throw a}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=wi.precisionScaleFactor(this._argGeom,this._distance,n),i=new Pn(r);this.bufferFixedPrecision(i)}};wi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Pn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};wi.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};wi.prototype.bufferOriginalPrecision=function(){try{var e=new Wi(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof cl)this._saveException=t;else throw t}finally{}};wi.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};wi.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};wi.prototype.interfaces_=function(){return[]};wi.prototype.getClass=function(){return wi};wi.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new wi(e),r=n.getResultGeometry(t);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ve&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],h=arguments[2],u=new wi(i);u.setQuadrantSegments(h);var g=u.getResultGeometry(a);return g}else if(arguments[2]instanceof Ln&&arguments[0]instanceof Ve&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],P=new wi(w,I),D=P.getResultGeometry(S);return D}}else if(arguments.length===4){var N=arguments[0],G=arguments[1],Y=arguments[2],et=arguments[3],V=new wi(N);V.setQuadrantSegments(Y),V.setEndCapStyle(et);var j=V.getResultGeometry(G);return j}};wi.precisionScaleFactor=function(e,t,n){var r=e.getEnvelopeInternal(),i=Wo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=t>0?t:0,h=i+2*a,u=Math.trunc(Math.log(h)/Math.log(10)+1),g=n-u,w=Math.pow(10,g);return w};Wf.CAP_ROUND.get=function(){return Ln.CAP_ROUND};Wf.CAP_BUTT.get=function(){return Ln.CAP_FLAT};Wf.CAP_FLAT.get=function(){return Ln.CAP_FLAT};Wf.CAP_SQUARE.get=function(){return Ln.CAP_SQUARE};Wf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(wi,Wf);var Gi=function(){this._pt=[new At,new At],this._distance=Xe.NaN,this._isNull=!0};Gi.prototype.getCoordinates=function(){return this._pt};Gi.prototype.getCoordinate=function(e){return this._pt[e]};Gi.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 r=t.distance(n);rthis._distance&&this.initialize(t,n,r)}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};var Ea=function(){};Ea.prototype.interfaces_=function(){return[]};Ea.prototype.getClass=function(){return Ea};Ea.computeDistance=function(){if(arguments[2]instanceof Gi&&arguments[0]instanceof vr&&arguments[1]instanceof At)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=e.getCoordinates(),i=new Ne,a=0;a0||this._isIn?zt.INTERIOR:zt.EXTERIOR)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var qi=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 r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},$I={INSIDE_AREA:{configurable:!0}};qi.prototype.isInsideArea=function(){return this._segIndex===qi.INSIDE_AREA};qi.prototype.getCoordinate=function(){return this._pt};qi.prototype.getGeometryComponent=function(){return this._component};qi.prototype.getSegmentIndex=function(){return this._segIndex};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};$I.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,$I);var jl=function(e){this._pts=e||null};jl.prototype.filter=function(e){e instanceof Co&&this._pts.add(e)};jl.prototype.interfaces_=function(){return[ra]};jl.prototype.getClass=function(){return jl};jl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Co?Ms.singletonList(e):jl.getPoints(e,new me)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Co?n.add(t):t instanceof Hi&&t.apply(new jl(n)),n}};var Rc=function(){this._locations=null;var e=arguments[0];this._locations=e};Rc.prototype.filter=function(e){(e instanceof Co||e instanceof vr||e instanceof Hr)&&this._locations.add(new qi(e,0,e.getCoordinate()))};Rc.prototype.interfaces_=function(){return[ra]};Rc.prototype.getClass=function(){return Rc};Rc.getLocations=function(e){var t=new me;return e.apply(new Rc(t)),t};var Ci=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ks,this._minDistanceLocation=null,this._minDistance=Xe.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],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ci.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],r=arguments[1],i=1-n,a=al.getPolygons(this._geom[n]);if(a.size()>0){var h=Rc.getLocations(this._geom[i]);if(this.computeContainmentDistance(h,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ue(arguments[0],Cs)&&Ue(arguments[1],Cs)){for(var u=arguments[0],g=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=t.getCoordinates(),a=n.getCoordinate(),h=0;hthis._minDistance)return null;for(var D=S.getCoordinates(),N=I.getCoordinates(),G=0;Gthis._distance&&this.initialize(t,n,r)}};Ai.prototype.interfaces_=function(){return[]};Ai.prototype.getClass=function(){return Ai};var Ks=function(){};Ks.prototype.interfaces_=function(){return[]};Ks.prototype.getClass=function(){return Ks};Ks.computeDistance=function(){if(arguments[2]instanceof Ai&&arguments[0]instanceof vr&&arguments[1]instanceof At)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=new Ne,i=e.getCoordinates(),a=0;a1||e<=0)throw new sr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ss.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ss.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ss.prototype.computeOrientedDistance=function(e,t,n){var r=new Nc(t);if(e.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new $l(t,this._densifyFrac);e.apply(i),n.setMaximum(i.getMaxPointDistance())}};ss.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ss(e,t);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],h=new ss(r,i);return h.setDensifyFraction(a),h.distance()}};r1.MaxPointDistanceFilter.get=function(){return Nc};r1.MaxDensifiedByFractionDistanceFilter.get=function(){return $l};Object.defineProperties(ss,r1);var Nc=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._euclideanDist=new Ks,this._geom=null;var e=arguments[0];this._geom=e};Nc.prototype.filter=function(e){this._minPtDist.initialize(),Ks.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Nc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Nc.prototype.interfaces_=function(){return[Pa]};Nc.prototype.getClass=function(){return Nc};var $l=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};$l.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var r=e.getCoordinate(t-1),i=e.getCoordinate(t),a=(i.x-r.x)/this._numSubSegs,h=(i.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=e.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ts.toLineString(i[0],i[1])+")"}};xo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=xo.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(),xo.VERBOSE&&Ii.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};xo.prototype.checkNegativeValid=function(){if(!(this._input instanceof Hr||this._input instanceof Ta||this._input instanceof Hi))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)};xo.prototype.getErrorIndicator=function(){return this._errorIndicator};xo.prototype.checkMinimumDistance=function(e,t,n){var r=new Ci(e,t,n);if(this._minDistanceFound=r.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")};Ti.prototype.report=function(e){if(!Ti.VERBOSE)return null;Ii.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Ti.prototype.getErrorMessage=function(){return this._errorMsg};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};Ti.isValidMsg=function(e,t,n){var r=new Ti(e,t,n);return r.isValid()?null:r.getErrorMessage()};Ti.isValid=function(e,t,n){var r=new Ti(e,t,n);return!!r.isValid()};o1.VERBOSE.get=function(){return!1};o1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ti,o1);var ua=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};ua.prototype.getCoordinates=function(){return this._pts};ua.prototype.size=function(){return this._pts.length};ua.prototype.getCoordinate=function(e){return this._pts[e]};ua.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ua.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Mc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};ua.prototype.setData=function(e){this._data=e};ua.prototype.getData=function(){return this._data};ua.prototype.toString=function(){return Ts.toLineString(new Tr(this._pts))};ua.prototype.interfaces_=function(){return[ka]};ua.prototype.getClass=function(){return ua};var yi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new me,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};yi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};yi.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};yi.prototype.getIntersectionSegments=function(){return this._intSegments};yi.prototype.count=function(){return this._intersectionCount};yi.prototype.getIntersections=function(){return this._intersections};yi.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};yi.prototype.setKeepIntersections=function(e){this._keepIntersections=e};yi.prototype.processIntersections=function(e,t,n,r){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(e,t)||this.isEndSegment(n,r);if(!i)return null}var a=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],g=n.getCoordinates()[r+1];this._li.computeIntersection(a,h,u,g),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=h,this._intSegments[2]=u,this._intSegments[3]=g,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};yi.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};yi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};yi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};yi.prototype.interfaces_=function(){return[Ou]};yi.prototype.getClass=function(){return yi};yi.createAllIntersectionsFinder=function(e){var t=new yi(e);return t.setFindAllIntersections(!0),t};yi.createAnyIntersectionFinder=function(e){return new yi(e)};yi.createIntersectionCounter=function(e){var t=new yi(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Ds=function(){this._li=new Hu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Ds.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ds.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ds.prototype.isValid=function(){return this.execute(),this._isValid};Ds.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Ds.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new yi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new e1;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ds.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new fl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ds.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ts.toLineString(e[0],e[1])+" and "+Ts.toLineString(e[2],e[3])};Ds.prototype.interfaces_=function(){return[]};Ds.prototype.getClass=function(){return Ds};Ds.computeIntersections=function(e){var t=new Ds(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var Bu=function e(){this._nv=null;var t=arguments[0];this._nv=new Ds(e.toSegmentStrings(t))};Bu.prototype.checkValid=function(){this._nv.checkValid()};Bu.prototype.interfaces_=function(){return[]};Bu.prototype.getClass=function(){return Bu};Bu.toSegmentStrings=function(e){for(var t=new me,n=e.iterator();n.hasNext();){var r=n.next();t.add(new ua(r.getCoordinates(),r))}return t};Bu.checkValid=function(e){var t=new Bu(e);t.checkValid()};var Oc=function(e){this._mapOp=e};Oc.prototype.map=function(e){for(var t=this,n=new me,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};var Na=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ne,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof vr&&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 r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=e.isClosed(r),this._snapTolerance=i}};Na.prototype.snapVertices=function(e,t){for(var n=this,r=this._isClosed?e.size()-1:e.size(),i=0;i=0&&e.add(h+1,new At(a),!1)}};Na.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,r=Xe.MAX_VALUE,i=-1,a=0;at&&(t=r)}return t}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Lr.computeOverlaySnapTolerance(i),Lr.computeOverlaySnapTolerance(a))}};Lr.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),r=n*Lr.SNAP_PRECISION_FACTOR;return r};Lr.snapToSelf=function(e,t,n){var r=new Lr(e);return r.snapToSelf(t,n)};tC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Lr,tC);var eC=function(e){function t(n,r,i){e.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,r){var i=new Na(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},t.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),a=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lo),Ui=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Ui.prototype.getCommon=function(){return Xe.longBitsToDouble(this._commonBits)};Ui.prototype.add=function(e){var t=Xe.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Ui.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Ui.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Ui.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Ui.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Ui.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=Xe.longBitsToDouble(e),n=Xe.toBinaryString(e),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+t+" ]";return a}};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.getBit=function(e,t){var n=1<>52};Ui.zeroLowerBits=function(e,t){var n=(1<=0;r--){if(Ui.getBit(e,r)!==Ui.getBit(t,r))return n;n++}return 52};var tu=function(){this._commonCoord=null,this._ccFilter=new Fc},s1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tu.prototype.addCommonBits=function(e){var t=new eu(this._commonCoord);e.apply(t),e.geometryChanged()};tu.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 eu(t);return e.apply(n),e.geometryChanged(),e};tu.prototype.getCommonCoordinate=function(){return this._commonCoord};tu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};tu.prototype.interfaces_=function(){return[]};tu.prototype.getClass=function(){return tu};s1.CommonCoordinateFilter.get=function(){return Fc};s1.Translater.get=function(){return eu};Object.defineProperties(tu,s1);var Fc=function(){this._commonBitsX=new Ui,this._commonBitsY=new Ui};Fc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Fc.prototype.getCommonCoordinate=function(){return new At(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Fc.prototype.interfaces_=function(){return[Pa]};Fc.prototype.getClass=function(){return Fc};var eu=function(){this.trans=null;var e=arguments[0];this.trans=e};eu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,r=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,r)};eu.prototype.isDone=function(){return!1};eu.prototype.isGeometryChanged=function(){return!0};eu.prototype.interfaces_=function(){return[Ls]};eu.prototype.getClass=function(){return eu};var _i=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()};_i.prototype.selfSnap=function(e){var t=new Lr(e),n=t.snapTo(e,this._snapTolerance);return n};_i.prototype.removeCommonBits=function(e){this._cbr=new tu,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};_i.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};_i.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=Qe.overlayOp(t[0],t[1],e);return this.prepareResult(n)};_i.prototype.checkValid=function(e){e.isValid()||Ii.out.println("Snapped geometry is invalid")};_i.prototype.computeSnapTolerance=function(){this._snapTolerance=Lr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};_i.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Lr.snap(t[0],t[1],this._snapTolerance);return n};_i.prototype.interfaces_=function(){return[]};_i.prototype.getClass=function(){return _i};_i.overlayOp=function(e,t,n){var r=new _i(e,t);return r.getResultGeometry(n)};_i.union=function(e,t){return _i.overlayOp(e,t,Qe.UNION)};_i.intersection=function(e,t){return _i.overlayOp(e,t,Qe.INTERSECTION)};_i.symDifference=function(e,t){return _i.overlayOp(e,t,Qe.SYMDIFFERENCE)};_i.difference=function(e,t){return _i.overlayOp(e,t,Qe.DIFFERENCE)};var Yi=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};Yi.prototype.getResultGeometry=function(e){var t=null,n=!1,r=null;try{t=Qe.overlayOp(this._geom[0],this._geom[1],e);var i=!0;i&&(n=!0)}catch(a){if(a instanceof cl)r=a;else throw a}finally{}if(!n)try{t=_i.overlayOp(this._geom[0],this._geom[1],e)}catch(a){throw a instanceof cl?r:a}finally{}return t};Yi.prototype.interfaces_=function(){return[]};Yi.prototype.getClass=function(){return Yi};Yi.overlayOp=function(e,t,n){var r=new Yi(e,t);return r.getResultGeometry(n)};Yi.union=function(e,t){return Yi.overlayOp(e,t,Qe.UNION)};Yi.intersection=function(e,t){return Yi.overlayOp(e,t,Qe.INTERSECTION)};Yi.symDifference=function(e,t){return Yi.overlayOp(e,t,Qe.SYMDIFFERENCE)};Yi.difference=function(e,t){return Yi.overlayOp(e,t,Qe.DIFFERENCE)};var Rd=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};Rd.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};Rd.prototype.interfaces_=function(){return[]};Rd.prototype.getClass=function(){return Rd};var Po=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 r=arguments[0],i=arguments[1],a=arguments[2];this._eventType=e.INSERT,this._label=r,this._xValue=i,this._obj=a}},a1={INSERT:{configurable:!0},DELETE:{configurable:!0}};Po.prototype.isDelete=function(){return this._eventType===Po.DELETE};Po.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};Po.prototype.getObject=function(){return this._obj};Po.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};Po.prototype.getInsertEvent=function(){return this._insertEvent};Po.prototype.isInsert=function(){return this._eventType===Po.INSERT};Po.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};Po.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Po.prototype.interfaces_=function(){return[hs]};Po.prototype.getClass=function(){return Po};a1.INSERT.get=function(){return 1};a1.DELETE.get=function(){return 2};Object.defineProperties(Po,a1);var ay=function(){};ay.prototype.interfaces_=function(){return[]};ay.prototype.getClass=function(){return ay};var Li=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};Li.prototype.isTrivialIntersection=function(e,t,n,r){if(e===n&&this._li.getIntersectionNum()===1){if(Li.isAdjacentSegments(t,r))return!0;if(e.isClosed()){var i=e.getNumPoints()-1;if(t===0&&r===i||r===0&&t===i)return!0}}return!1};Li.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Li.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Li.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Li.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(e.isIntersection(i))return!0}return!1};Li.prototype.hasProperIntersection=function(){return this._hasProper};Li.prototype.hasIntersection=function(){return this._hasIntersection};Li.prototype.isDone=function(){return this._isDone};Li.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Li.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Li.prototype.addIntersections=function(e,t,n,r){if(e===n&&t===r)return null;this.numTests++;var i=e.getCoordinates()[t],a=e.getCoordinates()[t+1],h=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,h,u),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,r,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))))};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var pR=function(e){function t(){e.call(this),this.events=new me,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;Ms.sort(this.events);for(var r=0;rt||this._maxa?1:0};Nd.prototype.interfaces_=function(){return[gf]};Nd.prototype.getClass=function(){return Nd};var dR=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Oa),mR=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,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,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Oa),za=function(){this._leaves=new me,this._root=null,this._level=0};za.prototype.buildTree=function(){var e=this;Ms.sort(this._leaves,new Oa.NodeComparator);for(var t=this._leaves,n=null,r=new me;;){if(e.buildLevel(t,r),r.size()===1)return r.get(0);n=t,t=r,r=n}};za.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 dR(e,t,n))};za.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};za.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};za.prototype.printNode=function(e){Ii.out.println(Ts.toLineString(new At(e._min,this._level),new At(e._max,this._level)))};za.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};za.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,a=n.iterator();a.hasNext();){var h=a.next();r[i++]=h.getCoordinate().copy()}return r},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===zt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},t.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var a=mn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var h=r,u=i;xe.isCCW(a)&&(h=i,u=r);var g=new sy(a,new Nn(this._argIndex,zt.BOUNDARY,h,u));this._lineEdgeMap.put(n,g),this.insertEdge(g),this.insertPoint(this._argIndex,a[0],zt.BOUNDARY)},t.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),h=a.getLabel();h===null?a._label=new Nn(n,i):h.setLocation(n,i)},t.prototype.createEdgeSetIntersector=function(){return new pR},t.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),h=a.getLabel().getLocation(n),u=a.eiList.iterator();u.hasNext();){var g=u.next();r.addSelfIntersectionNode(n,g.coord,h)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ta&&(this._useBoundaryDeterminationRule=!1),n instanceof Hr)this.addPolygon(n);else if(n instanceof vr)this.addLineString(n);else if(n instanceof Co)this.addPoint(n);else if(n instanceof Sf)this.addCollection(n);else if(n instanceof Du)this.addCollection(n);else if(n instanceof Ta)this.addCollection(n);else if(n instanceof Hi)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 r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Mf(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,r){return n.isInBoundary(r)?zt.BOUNDARY:zt.INTERIOR},t}(fr),kf=function(){if(this._li=new Hu,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 ed(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=ls.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 ed(0,t,r),this._arg[1]=new ed(1,n,r)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],h=arguments[2];i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ed(0,i,h),this._arg[1]=new ed(1,a,h)}};kf.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};kf.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};kf.prototype.interfaces_=function(){return[]};kf.prototype.getClass=function(){return kf};var Mu=function(){};Mu.prototype.interfaces_=function(){return[]};Mu.prototype.getClass=function(){return Mu};Mu.map=function(){if(arguments[0]instanceof Ve&&Ue(arguments[1],Mu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new me,r=0;r=e.size()?null:e.get(t)};Or.union=function(e){var t=new Or(e);return t.union()};iC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Or,iC);var ly=function(){};ly.prototype.interfaces_=function(){return[]};ly.prototype.getClass=function(){return ly};ly.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return Qe.createEmptyResult(Qe.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),Yi.overlayOp(e,t,Qe.UNION)};function Zu(){return new uy}function uy(){this.reset()}uy.prototype={constructor:uy,reset:function(){this.s=this.t=0},add:function(e){e2(hg,e,this.t),e2(this,hg.s,this.s),this.s?this.t+=hg.t:this.s=hg.t},valueOf:function(){return this.s}};var hg=new uy;function e2(e,t,n){var r=e.s=t+n,i=r-t,a=r-i;e.t=t-a+(n-i)}var _r=1e-6,jn=Math.PI,sl=jn/2,n2=jn/4,ml=jn*2,Eu=180/jn,Zs=jn/180,ji=Math.abs,gR=Math.atan,Rf=Math.atan2,qr=Math.cos,jr=Math.sin,Hf=Math.sqrt;function oC(e){return e>1?0:e<-1?jn:Math.acos(e)}function Bc(e){return e>1?sl:e<-1?-sl:Math.asin(e)}function ud(){}function cy(e,t){e&&i2.hasOwnProperty(e.type)&&i2[e.type](e,t)}var r2={Feature:function(e,t){cy(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rjn?e-ml:e<-jn?e+ml:e,t]}hv.invert=hv;function _R(e,t,n){return(e%=ml)?t||n?sC(a2(e),l2(t,n)):a2(e):t||n?l2(t,n):hv}function s2(e){return function(t,n){return t+=e,[t>jn?t-ml:t<-jn?t+ml:t,n]}}function a2(e){var t=s2(e);return t.invert=s2(-e),t}function l2(e,t){var n=qr(e),r=jr(e),i=qr(t),a=jr(t);function h(u,g){var w=qr(g),S=qr(u)*w,I=jr(u)*w,P=jr(g),D=P*n+S*r;return[Rf(I*i-D*a,S*n-P*r),Bc(D*i+I*a)]}return h.invert=function(u,g){var w=qr(g),S=qr(u)*w,I=jr(u)*w,P=jr(g),D=P*i-I*a;return[Rf(I*i+P*a,S*n+D*r),Bc(D*n-S*r)]},h}function vR(e,t,n,r,i,a){if(n){var h=qr(t),u=jr(t),g=r*n;i==null?(i=t+r*ml,a=t-g/2):(i=u2(h,i),a=u2(h,a),(r>0?ia)&&(i+=r*ml));for(var w,S=i;r>0?S>a:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function bR(e,t,n,r,i,a){var h=e[0],u=e[1],g=t[0],w=t[1],S=0,I=1,P=g-h,D=w-u,N;if(N=n-h,!(!P&&N>0)){if(N/=P,P<0){if(N0){if(N>I)return;N>S&&(S=N)}if(N=i-h,!(!P&&N<0)){if(N/=P,P<0){if(N>I)return;N>S&&(S=N)}else if(P>0){if(N0)){if(N/=D,D<0){if(N0){if(N>I)return;N>S&&(S=N)}if(N=a-u,!(!D&&N<0)){if(N/=D,D<0){if(N>I)return;N>S&&(S=N)}else if(D>0){if(N0&&(e[0]=h+S*P,e[1]=u+S*D),I<1&&(t[0]=h+I*P,t[1]=u+I*D),!0}}}}}function Ag(e,t){return ji(e[0]-t[0])<_r&&ji(e[1]-t[1])<_r}function dg(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function lC(e,t,n,r,i){var a=[],h=[],u,g;if(e.forEach(function(N){if(!((G=N.length-1)<=0)){var G,Y=N[0],et=N[G],V;if(Ag(Y,et)){for(i.lineStart(),u=0;u=0;--u)i.point((I=S[u])[0],I[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,D=!D}while(!P.v);i.lineEnd()}}}function c2(e){if(t=e.length){for(var t,n=0,r=e[0],i;++nt?1:e>=t?0:NaN}function xR(e){return e.length===1&&(e=wR(e)),{left:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[a],n)<0?r=a+1:i=a}return r},right:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[a],n)>0?i=a:r=a+1}return r}}}function wR(e){return function(t,n){return uC(e(t),n)}}xR(uC);function cC(e){for(var t=e.length,n,r=-1,i=0,a,h;++r=0;)for(h=e[t],n=h.length;--n>=0;)a[--i]=h[n];return a}var cd=1e9,mg=-cd;function SR(e,t,n,r){function i(w,S){return e<=w&&w<=n&&t<=S&&S<=r}function a(w,S,I,P){var D=0,N=0;if(w==null||(D=h(w,I))!==(N=h(S,I))||g(w,S)<0^I>0)do P.point(D===0||D===3?e:n,D>1?r:t);while((D=(D+I+4)%4)!==N);else P.point(S[0],S[1])}function h(w,S){return ji(w[0]-e)<_r?S>0?0:3:ji(w[0]-n)<_r?S>0?2:1:ji(w[1]-t)<_r?S>0?1:0:S>0?3:2}function u(w,S){return g(w.x,S.x)}function g(w,S){var I=h(w,1),P=h(S,1);return I!==P?I-P:I===0?S[1]-w[1]:I===1?w[0]-S[0]:I===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,I=aC(),P,D,N,G,Y,et,V,j,X,ot,_t,st={point:ct,lineStart:ft,lineEnd:Kt,polygonStart:Ct,polygonEnd:H};function ct(Zt,ee){i(Zt,ee)&&S.point(Zt,ee)}function mt(){for(var Zt=0,ee=0,qt=D.length;eer&&(Cn-Me)*(r-hn)>(gn-hn)*(e-Me)&&++Zt:gn<=r&&(Cn-Me)*(r-hn)<(gn-hn)*(e-Me)&&--Zt;return Zt}function Ct(){S=I,P=[],D=[],_t=!0}function H(){var Zt=mt(),ee=_t&&Zt,qt=(P=cC(P)).length;(ee||qt)&&(w.polygonStart(),ee&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),qt&&lC(P,u,Zt,a,w),w.polygonEnd()),S=w,P=D=N=null}function ft(){st.point=St,D&&D.push(N=[]),ot=!0,X=!1,V=j=NaN}function Kt(){P&&(St(G,Y),et&&X&&I.rejoin(),P.push(I.result())),st.point=ct,X&&S.lineEnd()}function St(Zt,ee){var qt=i(Zt,ee);if(D&&N.push([Zt,ee]),ot)G=Zt,Y=ee,et=qt,ot=!1,qt&&(S.lineStart(),S.point(Zt,ee));else if(qt&&X)S.point(Zt,ee);else{var Oe=[V=Math.max(mg,Math.min(cd,V)),j=Math.max(mg,Math.min(cd,j))],we=[Zt=Math.max(mg,Math.min(cd,Zt)),ee=Math.max(mg,Math.min(cd,ee))];bR(Oe,we,e,t,n,r)?(X||(S.lineStart(),S.point(Oe[0],Oe[1])),S.point(we[0],we[1]),qt||S.lineEnd(),_t=!1):qt&&(S.lineStart(),S.point(Zt,ee),_t=!1)}V=Zt,j=ee,X=qt}return st}}var w0=Zu();function ER(e,t){var n=t[0],r=t[1],i=[jr(n),-qr(n),0],a=0,h=0;w0.reset();for(var u=0,g=e.length;u=0?1:-1,ct=st*_t,mt=ct>jn,Ct=N*X;if(w0.add(Rf(Ct*st*jr(ct),G*ot+Ct*qr(ct))),a+=mt?_t+st*ml:_t,mt^P>=n^V>=n){var H=hy(Nf(I),Nf(et));cv(H);var ft=hy(i,H);cv(ft);var Kt=(mt^_t>=0?-1:1)*Bc(ft[2]);(r>Kt||r===Kt&&(H[0]||H[1]))&&(h+=mt^_t>=0?1:-1)}}return(a<-_r||a<_r&&w0<-_r)^h&1}Zu();function h2(e){return e}Zu();Zu();var Of=1/0,fy=Of,Od=-Of,py=Od,f2={point:IR,lineStart:ud,lineEnd:ud,polygonStart:ud,polygonEnd:ud,result:function(){var e=[[Of,fy],[Od,py]];return Od=py=-(fy=Of=1/0),e}};function IR(e,t){eOd&&(Od=e),tpy&&(py=t)}Zu();function hC(e,t,n,r){return function(i,a){var h=t(a),u=i.invert(r[0],r[1]),g=aC(),w=t(g),S=!1,I,P,D,N={point:G,lineStart:et,lineEnd:V,polygonStart:function(){N.point=j,N.lineStart=X,N.lineEnd=ot,P=[],I=[]},polygonEnd:function(){N.point=G,N.lineStart=et,N.lineEnd=V,P=cC(P);var _t=ER(I,u);P.length?(S||(a.polygonStart(),S=!0),lC(P,TR,_t,n,a)):_t&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),P=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function G(_t,st){var ct=i(_t,st);e(_t=ct[0],st=ct[1])&&a.point(_t,st)}function Y(_t,st){var ct=i(_t,st);h.point(ct[0],ct[1])}function et(){N.point=Y,h.lineStart()}function V(){N.point=G,h.lineEnd()}function j(_t,st){D.push([_t,st]);var ct=i(_t,st);w.point(ct[0],ct[1])}function X(){w.lineStart(),D=[]}function ot(){j(D[0][0],D[0][1]),w.lineEnd();var _t=w.clean(),st=g.result(),ct,mt=st.length,Ct,H,ft;if(D.pop(),I.push(D),D=null,!!mt){if(_t&1){if(H=st[0],(Ct=H.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),ct=0;ct1&&_t&2&&st.push(st.pop().concat(st.shift())),P.push(st.filter(CR))}}return N}}function CR(e){return e.length>1}function TR(e,t){return((e=e.x)[0]<0?e[1]-sl-_r:sl-e[1])-((t=t.x)[0]<0?t[1]-sl-_r:sl-t[1])}const p2=hC(function(){return!0},LR,MR,[-jn,-sl]);function LR(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,h){var u=a>0?jn:-jn,g=ji(a-t);ji(g-jn)<_r?(e.point(t,n=(n+h)/2>0?sl:-sl),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),e.point(a,n),i=0):r!==u&&g>=jn&&(ji(t-r)<_r&&(t-=r*_r),ji(a-u)<_r&&(a-=u*_r),n=PR(t,n,a,h),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),i=0),e.point(t=a,n=h),r=u},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function PR(e,t,n,r){var i,a,h=jr(e-n);return ji(h)>_r?gR((jr(t)*(a=qr(r))*jr(n)-jr(r)*(i=qr(t))*jr(e))/(i*a*h)):(t+r)/2}function MR(e,t,n,r){var i;if(e==null)i=n*sl,r.point(-jn,i),r.point(0,i),r.point(jn,i),r.point(jn,0),r.point(jn,-i),r.point(0,-i),r.point(-jn,-i),r.point(-jn,0),r.point(-jn,i);else if(ji(e[0]-t[0])>_r){var a=e[0]0,i=ji(n)>_r;function a(S,I,P,D){vR(D,e,t,P,S,I)}function h(S,I){return qr(S)*qr(I)>n}function u(S){var I,P,D,N,G;return{lineStart:function(){N=D=!1,G=1},point:function(Y,et){var V=[Y,et],j,X=h(Y,et),ot=r?X?0:w(Y,et):X?w(Y+(Y<0?jn:-jn),et):0;if(!I&&(N=D=X)&&S.lineStart(),X!==D&&(j=g(I,V),(!j||Ag(I,j)||Ag(V,j))&&(V[0]+=_r,V[1]+=_r,X=h(V[0],V[1]))),X!==D)G=0,X?(S.lineStart(),j=g(V,I),S.point(j[0],j[1])):(j=g(I,V),S.point(j[0],j[1]),S.lineEnd()),I=j;else if(i&&I&&r^X){var _t;!(ot&P)&&(_t=g(V,I,!0))&&(G=0,r?(S.lineStart(),S.point(_t[0][0],_t[0][1]),S.point(_t[1][0],_t[1][1]),S.lineEnd()):(S.point(_t[1][0],_t[1][1]),S.lineEnd(),S.lineStart(),S.point(_t[0][0],_t[0][1])))}X&&(!I||!Ag(I,V))&&S.point(V[0],V[1]),I=V,D=X,P=ot},lineEnd:function(){D&&S.lineEnd(),I=null},clean:function(){return G|(N&&D)<<1}}}function g(S,I,P){var D=Nf(S),N=Nf(I),G=[1,0,0],Y=hy(D,N),et=fg(Y,Y),V=Y[0],j=et-V*V;if(!j)return!P&&S;var X=n*et/j,ot=-n*V/j,_t=hy(G,Y),st=pg(G,X),ct=pg(Y,ot);x0(st,ct);var mt=_t,Ct=fg(st,mt),H=fg(mt,mt),ft=Ct*Ct-H*(fg(st,st)-1);if(!(ft<0)){var Kt=Hf(ft),St=pg(mt,(-Ct-Kt)/H);if(x0(St,st),St=uv(St),!P)return St;var Zt=S[0],ee=I[0],qt=S[1],Oe=I[1],we;ee0^St[1]<(ji(St[0]-Zt)<_r?qt:Oe):qt<=St[1]&&St[1]<=Oe:un>jn^(Zt<=St[0]&&St[0]<=ee)){var hn=pg(mt,(-Ct+Kt)/H);return x0(hn,st),[St,uv(hn)]}}}function w(S,I){var P=r?e:jn-e,D=0;return S<-P?D|=1:S>P&&(D|=2),I<-P?D|=4:I>P&&(D|=8),D}return hC(h,u,a,r?[0,-e]:[-jn,e-jn])}function fC(e){return function(t){var n=new fv;for(var r in e)n[r]=e[r];return n.stream=t,n}}function fv(){}fv.prototype={constructor:fv,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 pC(e,t,n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),a!=null&&e.clipExtent(null),yR(n,e.stream(f2));var h=f2.result(),u=Math.min(r/(h[1][0]-h[0][0]),i/(h[1][1]-h[0][1])),g=+t[0][0]+(r-u*(h[1][0]+h[0][0]))/2,w=+t[0][1]+(i-u*(h[1][1]+h[0][1]))/2;return a!=null&&e.clipExtent(a),e.scale(u*150).translate([g,w])}function kR(e,t,n){return pC(e,[[0,0],t],n)}var d2=16,DR=qr(30*Zs);function m2(e,t){return+t?NR(e,t):RR(e)}function RR(e){return fC({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function NR(e,t){function n(r,i,a,h,u,g,w,S,I,P,D,N,G,Y){var et=w-r,V=S-i,j=et*et+V*V;if(j>4*t&&G--){var X=h+P,ot=u+D,_t=g+N,st=Hf(X*X+ot*ot+_t*_t),ct=Bc(_t/=st),mt=ji(ji(_t)-1)<_r||ji(a-I)<_r?(a+I)/2:Rf(ot,X),Ct=e(mt,ct),H=Ct[0],ft=Ct[1],Kt=H-r,St=ft-i,Zt=V*Kt-et*St;(Zt*Zt/j>t||ji((et*Kt+V*St)/j-.5)>.3||h*P+u*D+g*N2?St[2]%360*Zs:0,ft()):[w*Eu,S*Eu,I*Eu]},mt.precision=function(St){return arguments.length?(_t=m2(H,ot=St*St),Kt()):Hf(ot)},mt.fitExtent=function(St,Zt){return pC(mt,St,Zt)},mt.fitSize=function(St,Zt){return kR(mt,St,Zt)};function ft(){D=sC(P=_R(w,S,I),t);var St=t(u,g);return a=r-St[0]*n,h=i+St[1]*n,Kt()}function Kt(){return st=ct=null,mt}return function(){return t=e.apply(this,arguments),mt.invert=t.invert&&Ct,ft()}}function dC(e){return function(t,n){var r=qr(t),i=qr(n),a=e(r*i);return[a*i*jr(t),a*jr(n)]}}function mC(e){return function(t,n){var r=Hf(t*t+n*n),i=e(r),a=jr(i),h=qr(i);return[Rf(t*a,r*h),Bc(r&&n*a/r)]}}var BR=dC(function(e){return Hf(2/(1+e))});BR.invert=mC(function(e){return 2*Bc(e/2)});var gC=dC(function(e){return(e=oC(e))&&e/jr(e)});gC.invert=mC(function(e){return e});function VR(){return zR(gC).scale(79.4188).clipAngle(180-.001)}function g2(e,t){return[e,t]}g2.invert=g2;function UR(e,t,n){n=n||{};var r=n.units||"kilometers",i=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 i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var a=[];switch(e.type){case"GeometryCollection":return AI(e,function(h){var u=kg(h,t,r,i);u&&a.push(u)}),ov(a);case"FeatureCollection":return Kw(e,function(h){var u=kg(h,t,r,i);u&&Kw(u,function(g){g&&a.push(g)})}),ov(a)}return kg(e,t,r,i)}function kg(e,t,n,r){var i=e.properties||{},a=e.type==="Feature"?e.geometry:e;if(a.type==="GeometryCollection"){var h=[];return AI(e,function(G){var Y=kg(G,t,n,r);Y&&h.push(Y)}),ov(h)}var u=GR(a),g={type:a.type,coordinates:_C(a.coordinates,u)},w=new t1,S=w.read(g),I=YD(KD(t,n),"meters"),P=wi.bufferOp(S,I,r),D=new UI;if(P=D.write(P),!yC(P.coordinates)){var N={type:P.type,coordinates:vC(P.coordinates,u)};return Ey(N,i)}}function yC(e){return Array.isArray(e[0])?yC(e[0]):isNaN(e[0])}function _C(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return _C(n,t)})}function vC(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return vC(n,t)})}function GR(e){var t=QD(e).geometry.coordinates,n=[-t[0],-t[1]];return VR().rotate(n).scale(Vo)}function qR(e,t){var n=ry(e),r=ry(t),i=e.properties||{},a=CI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?LI(a[0],i):PI(a,i)}function y2(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 _2(e,t){const n=qR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const r=UR(e,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)y2(i);else for(const i of r.geometry.coordinates)for(const a of i)y2(a);t({type:"FeatureCollection",features:[r,n]})}let v2={type:"FeatureCollection",features:[]};function jR(e,t,n=!0,r=!0,i={},a={},h={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 u,g=[],w,S;function I(){(h!=null&&h.fill||h!=null&&h.line)&&e.addSource("full-geom",{type:"geojson",data:v2}),h!=null&&h.fill&&e.addLayer({...h==null?void 0:h.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),h!=null&&h.line&&e.addLayer({...h==null?void 0:h.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?I():e.once("load",()=>{I()});const P=N=>{u==null||u({type:"mapClick",coordinates:[N.lngLat.lng,N.lngLat.lat]})};function D(N=!1){if(!t)throw new Error;const G=document.createElement("div");return N&&G.classList.add("marker-interactive"),new vD({props:{displayIn:"maplibre"},target:G}),new t.Marker({element:G,offset:[1,-13]})}return{setEventHandler(N){N?(u=N,e.on("click",P)):(u=void 0,e.off("click",P))},flyTo(N,G){e.flyTo({center:N,zoom:G,...i})},fitBounds(N,G,Y){e.fitBounds([[N[0],N[1]],[N[2],N[3]]],{padding:G,maxZoom:Y,...a})},indicateReverse(N){e.getCanvasContainer().style.cursor=N?"crosshair":""},setReverseMarker(N){!t||!n||(S?N?S.setLngLat(N):(S.remove(),S=void 0):N&&(S=(typeof n=="object"?new t.Marker(n):D()).setLngLat(N).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(N,G){if(!n)return;function Y(et){var V;(V=e.getSource("full-geom"))==null||V.setData(et)}for(const et of g)et.remove();if(g.length=0,Y(v2),!!t){if(G){let et=!1;if(G.geometry.type==="GeometryCollection"){const V=G.geometry.geometries.filter(j=>j.type==="Polygon"||j.type==="MultiPolygon");if(V.length>0){let j=V.pop();for(const X of V)j=JD(j,X);_2({...G,geometry:j},Y),et=!0}else{const j=G.geometry.geometries.filter(X=>X.type==="LineString"||X.type==="MultiLineString");j.length>0&&(Y({...G,geometry:{type:"GeometryCollection",geometries:j}}),et=!0)}}if(!et){if(G.geometry.type==="Polygon"||G.geometry.type==="MultiPolygon")_2(G,Y);else if(G.geometry.type==="LineString"||G.geometry.type==="MultiLineString"){Y(G);return}}n&&g.push((typeof n=="object"?new t.Marker(n):D()).setLngLat(G.center).addTo(e))}if(r)for(const et of N??[]){if(et===G)continue;const V=(typeof r=="object"?new t.Marker(r):D(!0)).setLngLat(et.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(et.place_type[0]==="reverse"?et.place_name:et.place_name.replace(/,.*/,""))).addTo(e),j=V.getElement();j.addEventListener("click",X=>{X.stopPropagation(),u==null||u({type:"markerClick",id:et.id})}),j.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:et.id}),V.togglePopup()}),j.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:et.id}),V.togglePopup()}),g.push(V)}}},setSelectedMarker(N){w&&w.getElement().classList.toggle("marker-selected",!1),w=N>-1?g[N]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const N=e.getCenter();return[e.getZoom(),N.lng,N.lat]}}}function WR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Ut(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"),Ut(t,"viewBox","0 0 14 14"),Ut(t,"width","13"),Ut(t,"height","13"),Ut(t,"class","svelte-en2qvf")},m(r,i){Rt(r,t,i),kt(t,n)},p:ge,i:ge,o:ge,d(r){r&&Dt(t)}}}class bC extends tn{constructor(t){super(),$e(this,t,null,WR,je,{})}}function HR(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Ut(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"),Ut(t,"viewBox","0 0 30 30"),Ut(t,"fill","none"),Ut(t,"xmlns","http://www.w3.org/2000/svg"),Ut(t,"class","svelte-d2loi5")},m(r,i){Rt(r,t,i),kt(t,n)},p:ge,i:ge,o:ge,d(r){r&&Dt(t)}}}class xC extends tn{constructor(t){super(),$e(this,t,null,HR,je,{})}}function ZR(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"area.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"area.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function XR(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"reverse.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"reverse.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function YR(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"poi.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"poi.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function KR(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"postal_code.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"postal_code.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function JR(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"street.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"street.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function QR(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"road.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"road.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function $R(e){let t,n;return{c(){t=Ot("img"),wo(t.src,n=e[3]+"housenumber.svg")||Ut(t,"src",n),Ut(t,"alt",e[6]),Ut(t,"class","svelte-ltkwvy")},m(r,i){Rt(r,t,i)},p(r,i){i&8&&!wo(t.src,n=r[3]+"housenumber.svg")&&Ut(t,"src",n),i&64&&Ut(t,"alt",r[6])},d(r){r&&Dt(t)}}}function tN(e){let t,n,r,i;return{c(){t=Ot("img"),wo(t.src,n=e[5])||Ut(t,"src",n),Ut(t,"alt",e[4]),Ut(t,"class","svelte-ltkwvy")},m(a,h){Rt(a,t,h),r||(i=Ze(t,"error",e[14]),r=!0)},p(a,h){h&32&&!wo(t.src,n=a[5])&&Ut(t,"src",n),h&16&&Ut(t,"alt",a[4])},d(a){a&&Dt(t),r=!1,i()}}}function b2(e){let t,n;return{c(){t=Ot("span"),n=De(e[6]),Ut(t,"class","secondary svelte-ltkwvy")},m(r,i){Rt(r,t,i),kt(t,n)},p(r,i){i&64&&$n(n,r[6])},d(r){r&&Dt(t)}}}function eN(e){var st,ct;let t,n,r,i,a,h,u,g,w=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,I,P=e[2]==="always"||e[2]&&!e[0].address&&((st=e[0].properties)==null?void 0:st.kind)!=="road"&&((ct=e[0].properties)==null?void 0:ct.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],D,N,G=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",Y,et,V;function j(mt,Ct){var H,ft;return Ct&1&&(n=null),Ct&1&&(r=null),Ct&1&&(i=null),mt[5]?tN:mt[0].address?$R:((H=mt[0].properties)==null?void 0:H.kind)==="road"||((ft=mt[0].properties)==null?void 0:ft.kind)==="road_relation"?QR:(n==null&&(n=!!mt[0].id.startsWith("address.")),n?JR:(r==null&&(r=!!mt[0].id.startsWith("postal_code.")),r?KR:(i==null&&(i=!!mt[0].id.startsWith("poi.")),i?YR:mt[7]?XR:ZR)))}let X=j(e,-1),ot=X(e),_t=P&&b2(e);return{c(){t=Ot("li"),ot.c(),a=fe(),h=Ot("span"),u=Ot("span"),g=Ot("span"),S=De(w),I=fe(),_t&&_t.c(),D=fe(),N=Ot("span"),Y=De(G),Ut(g,"class","primary svelte-ltkwvy"),Ut(u,"class","svelte-ltkwvy"),Ut(N,"class","line2 svelte-ltkwvy"),Ut(h,"class","texts svelte-ltkwvy"),Ut(t,"tabindex","0"),Ut(t,"data-selected",e[1]),Ut(t,"class","svelte-ltkwvy"),ol(t,"selected",e[1])},m(mt,Ct){Rt(mt,t,Ct),ot.m(t,null),kt(t,a),kt(t,h),kt(h,u),kt(u,g),kt(g,S),kt(u,I),_t&&_t.m(u,null),kt(h,D),kt(h,N),kt(N,Y),et||(V=[Ze(t,"mouseenter",e[12]),Ze(t,"focus",e[13])],et=!0)},p(mt,[Ct]){var H,ft;X===(X=j(mt,Ct))&&ot?ot.p(mt,Ct):(ot.d(1),ot=X(mt),ot&&(ot.c(),ot.m(t,a))),Ct&1&&w!==(w=(mt[7]?mt[0].place_name:mt[0].place_name.replace(/,.*/,""))+"")&&$n(S,w),Ct&37&&(P=mt[2]==="always"||mt[2]&&!mt[0].address&&((H=mt[0].properties)==null?void 0:H.kind)!=="road"&&((ft=mt[0].properties)==null?void 0:ft.kind)!=="road_relation"&&!mt[0].id.startsWith("address.")&&!mt[0].id.startsWith("postal_code.")&&(!mt[0].id.startsWith("poi.")||!mt[5])&&!mt[7]),P?_t?_t.p(mt,Ct):(_t=b2(mt),_t.c(),_t.m(u,null)):_t&&(_t.d(1),_t=null),Ct&1&&G!==(G=(mt[7]?"":mt[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&$n(Y,G),Ct&2&&Ut(t,"data-selected",mt[1]),Ct&2&&ol(t,"selected",mt[1])},i:ge,o:ge,d(mt){mt&&Dt(t),ot.d(),_t&&_t.d(),et=!1,Ni(V)}}}function nN(e,t,n){var j;let r,i,{feature:a}=t,{selected:h=!1}=t,{showPlaceType:u}=t,{missingIconsCache:g}=t,{iconsBaseUrl:w}=t;const S=(j=a.properties)==null?void 0:j.categories;let I,P,D=0,N=a.place_type[0]==="reverse";function G(X){P&&g.add(P),n(10,D++,D)}function Y(X){En.call(this,e,X)}function et(X){En.call(this,e,X)}const V=X=>G(X.currentTarget);return e.$$set=X=>{"feature"in X&&n(0,a=X.feature),"selected"in X&&n(1,h=X.selected),"showPlaceType"in X&&n(2,u=X.showPlaceType),"missingIconsCache"in X&&n(9,g=X.missingIconsCache),"iconsBaseUrl"in X&&n(3,w=X.iconsBaseUrl)},e.$$.update=()=>{var X,ot,_t,st;if(e.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,P=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||g.has(P)));e.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(ot=(X=a.properties)==null?void 0:X.categories)==null?void 0:ot.join(", "):((st=(_t=a.properties)==null?void 0:_t.place_type_name)==null?void 0:st[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,h,u,w,I,P,i,N,G,g,D,r,Y,et,V]}class rN extends tn{constructor(t){super(),$e(this,t,nN,eN,je,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function iN(e){let t;return{c(){t=Ot("div"),t.innerHTML='',Ut(t,"class","svelte-7cmwmc")},m(n,r){Rt(n,t,r)},p:ge,i:ge,o:ge,d(n){n&&Dt(t)}}}class oN extends tn{constructor(t){super(),$e(this,t,null,iN,je,{})}}function sN(e){let t,n;return{c(){t=ql("svg"),n=ql("path"),Ut(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"),Ut(t,"viewBox","0 0 60.006 21.412"),Ut(t,"width","14"),Ut(t,"height","20"),Ut(t,"class","svelte-en2qvf")},m(r,i){Rt(r,t,i),kt(t,n)},p:ge,i:ge,o:ge,d(r){r&&Dt(t)}}}class aN extends tn{constructor(t){super(),$e(this,t,null,sN,je,{})}}function lN(e){let t,n,r;return{c(){t=ql("svg"),n=ql("circle"),r=ql("path"),Ut(n,"cx","4.789"),Ut(n,"cy","4.787"),Ut(n,"r","3.85"),Si(n,"stroke-width","1.875"),Si(n,"fill","none"),Ut(r,"d","M12.063 12.063 7.635 7.635"),Si(r,"stroke-width","1.875"),Si(r,"stroke-linecap","round"),Ut(t,"xmlns","http://www.w3.org/2000/svg"),Ut(t,"width","13"),Ut(t,"height","13"),Ut(t,"viewBox","0 0 13 13"),Ut(t,"class","svelte-1bpbt60")},m(i,a){Rt(i,t,a),kt(t,n),kt(t,r)},p:ge,i:ge,o:ge,d(i){i&&Dt(t)}}}class uN extends tn{constructor(t){super(),$e(this,t,null,lN,je,{})}}function cN(e,t,n){const r=t[1],i=t[0],a=r-i;return e===r&&n?e:((e-i)%a+a)%a+i}function x2(e){const t=[...e];return t[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!nd.coords)break t;return nd.coords}let a;try{return a=await new Promise((h,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(g=>{h([g.coords.longitude,g.coords.latitude].map(w=>w.toFixed(6)).join(","))},g=>{u(g)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(nd={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const w2=/(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,S2=/(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,E2=/(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,I2=/(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 fN(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(h=>Number(h.trim()));let n=C2(t[0],e),r=C2(t[1],e);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=t[0]>=0?" N":" S",a=t[1]>=0?" E":" W";return`${n+i}, ${r+a}`}else throw new Error("no decimal coordinates to convert")}function C2(e,t){const n=Math.abs(e),r=Math.floor(n),i=(n-r)*60;if(t=="DM"){let u=pN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let a=Math.floor(i),h=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${h}"`}function pN(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function u1(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",h=[],u=!1;if(w2.test(e))if(h=w2.exec(e),u=gg(h),u){if(n=h[2],r=h[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");h[1]?(i=h[1],a=h[5]):h[4]&&(i=h[4],a=h[8])}else throw new Error("invalid decimal coordinate format");else if(S2.test(e))if(h=S2.exec(e),u=gg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6].replace(",",".")/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[9])),h[11]&&(r+=h[11]/60),h[13]&&(r+=h[13].replace(",",".")/3600),parseInt(h[9])<0&&(r=-1*r),h[1]?(i=h[1],a=h[8]):h[7]&&(i=h[7],a=h[14]);else throw new Error("invalid DMS coordinates format");else if(E2.test(e))if(h=E2.exec(e),u=gg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],a=h[9]):h[8]&&(i=h[8],a=h[16]);else throw new Error("invalid DMS coordinates format");else if(I2.test(e))if(h=I2.exec(e),u=gg(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],a=h[9]):h[8]&&(i=h[8],a=h[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let g=/S|SOUTH/i;g.test(i)&&n>0&&(n=-1*n),g=/W|WEST/i,g.test(a)&&r>0&&(r=-1*r);const w=h[0].trim();let S,I;const P=/[,/;\u0020]/g,D=w.match(P);if(D==null){const Y=Math.floor(e.length/2);S=w.substring(0,Y).trim(),I=w.substring(Y).trim()}else{let Y;D.length%2==1?Y=Math.floor(D.length/2):Y=D.length/2-1;let et=0;if(Y==0)et=w.indexOf(D[0]),S=w.substring(0,et).trim(),I=w.substring(et+1).trim();else{let V=0,j=0;for(;V<=Y;)et=w.indexOf(D[V],j),j=et+1,V++;S=w.substring(0,et).trim(),I=w.substring(et+1).trim()}}const N=S.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const G=I.split(".");if(G.length==2&&G[1]==0&&G[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(I))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(t)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:I,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:dN,toCoordinateFormat:fN})}else throw new Error("coordinates pattern match failed")}function gg(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=t.length/2;for(let a=0;a{t.decimalLatitude?e.push(t):e.push({...t,...yN})}),[...e,..._N,...vN]}const xN=bN();u1.formats=xN.map(e=>e.verbatimCoordinates);const wN=u1;function L2(e,t,n){const r=e.slice();return r[81]=t[n],r[83]=n,r}function P2(e){let t,n;return t=new oN({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function M2(e){let t,n,r,i,a;return n=new aN({}),{c(){t=Ot("button"),le(n.$$.fragment),Ut(t,"type","button"),Ut(t,"title",e[9]),Ut(t,"class","svelte-zh3kmv"),ol(t,"active",e[0])},m(h,u){Rt(h,t,u),se(n,t,null),r=!0,i||(a=Ze(t,"click",e[67]),i=!0)},p(h,u){(!r||u[0]&512)&&Ut(t,"title",h[9]),(!r||u[0]&1)&&ol(t,"active",h[0])},i(h){r||(bt(n.$$.fragment,h),r=!0)},o(h){Lt(n.$$.fragment,h),r=!1},d(h){h&&Dt(t),ae(n),i=!1,a()}}}function SN(e){let t,n=[],r=new Map,i,a,h,u=ti(e[14]);const g=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{st=null}),Fn()),(!j||Zt[0]&2)&&ol(w,"displayable",St[1]!==""),St[5]===!0?ct?(ct.p(St,Zt),Zt[0]&32&&bt(ct,1)):(ct=M2(St),ct.c(),bt(ct,1),ct.m(r,N)):ct&&(zn(),Lt(ct,1,1,()=>{ct=null}),Fn()),Ct&&Ct.p&&(!j||Zt[1]&134217728)&&ri(Ct,mt,St,St[58],j?ni(mt,St[58],Zt,null):ii(St[58]),null);let ee=Y;Y=Kt(St),Y===ee?~Y&&ft[Y].p(St,Zt):(et&&(zn(),Lt(ft[ee],1,1,()=>{ft[ee]=null}),Fn()),~Y?(et=ft[Y],et?et.p(St,Zt):(et=ft[Y]=H[Y](St),et.c()),bt(et,1),et.m(n,null)):et=null),(!j||Zt[0]&4&&V!==(V=Dg(St[2])+" svelte-zh3kmv"))&&Ut(n,"class",V),(!j||Zt[0]&22)&&ol(n,"can-collapse",St[4]&&St[1]==="")},i(St){j||(bt(_t),bt(a.$$.fragment,St),bt(I.$$.fragment,St),bt(st),bt(ct),bt(Ct,St),bt(et),j=!0)},o(St){Lt(_t),Lt(a.$$.fragment,St),Lt(I.$$.fragment,St),Lt(st),Lt(ct),Lt(Ct,St),Lt(et),j=!1},d(St){St&&(Dt(t),Dt(n)),ae(a),e[61](null),ae(I),st&&st.d(),ct&&ct.d(),Ct&&Ct.d(St),~Y&&ft[Y].d(),X=!1,Ni(ot)}}}function LN(e,t,n){let r,{$$slots:i={},$$scope:a}=t,{class:h=void 0}=t,{apiKey:u}=t,{bbox:g=void 0}=t,{clearButtonTitle:w="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:I=!1}=t,{country:P=void 0}=t,{debounceSearch:D=200}=t,{enableReverse:N=!1}=t,{errorMessage:G="Something went wrong…"}=t,{filter:Y=()=>!0}=t,{flyTo:et=!0}=t,{fuzzyMatch:V=!0}=t,{language:j=void 0}=t,{limit:X=void 0}=t,{mapController:ot=void 0}=t,{minLength:_t=2}=t,{noResultsMessage:st="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:ct="Search"}=t,{proximity:mt=[{type:"server-geolocation"}]}=t,{reverseActive:Ct=N==="always"}=t,{reverseButtonTitle:H="toggle reverse geocoding"}=t,{searchValue:ft=""}=t,{showFullGeometry:Kt=!0}=t,{showPlaceType:St="ifNeeded"}=t,{showResultsWhileTyping:Zt=!0}=t,{selectFirst:ee=!0}=t,{flyToSelected:qt=!1}=t,{markerOnSelected:Oe=!0}=t,{types:we=void 0}=t,{excludeTypes:un=!1}=t,{zoom:Ge=16}=t,{maxZoom:Me=18}=t,{apiUrl:hn="https://api.maptiler.com/geocoding"}=t,{fetchParameters:Cn={}}=t,{iconsBaseUrl:gn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=t,{adjustUrlQuery:yn=Q=>{}}=t;function An(){Nt.focus()}function xr(){Nt.blur()}function Ar(Q,wt=!0){n(1,ft=Q),wt?(n(15,Ye=-1),bl()):(Zr(),setTimeout(()=>{Nt.focus(),Nt.select()}))}function wr(){n(14,gt=void 0),n(55,Ie=void 0),n(15,Ye=-1)}function pr(){n(54,Tt=[]),n(55,Ie=void 0)}let Qt=!1,gt,Tt,Ie,kn="",Nt,Ye=-1,kr,ln=[],tr,Mo,ps,Os;const Ba=new Set,Pi=qu();as(()=>{ot&&(ot.setEventHandler(void 0),ot.indicateReverse(!1),ot.setSelectedMarker(-1),ot.setMarkers(void 0,void 0))});function bl(Q){if(Mo&&(clearTimeout(Mo),Mo=void 0),Ye>-1&>)n(55,Ie=gt[Ye]),n(1,ft=Ie.place_type[0]==="reverse"?Ie.place_name:Ie.place_name.replace(/,.*/,"")),n(18,kr=void 0),n(54,Tt=void 0),n(15,Ye=-1);else if(ft){const wt=Q||!ds(ft);re(ft,{exact:!0}).then(()=>{n(54,Tt=gt),n(55,Ie=void 0),wt&&Ko()}).catch(dt=>n(18,kr=dt))}}function ds(Q){try{return wN(Q,6)}catch{return!1}}async function re(Q,{byId:wt=!1,exact:dt=!1}={}){n(18,kr=void 0),tr==null||tr.abort();const Pt=new AbortController;n(19,tr=Pt);try{const Vt=ds(Q),Wt=new URLSearchParams;if(j!==void 0&&Wt.set("language",Array.isArray(j)?j.join(","):j??""),we&&Wt.set("types",we.join(",")),un&&Wt.set("excludeTypes",String(un)),g&&Wt.set("bbox",g.map(We=>We.toFixed(6)).join(",")),P&&Wt.set("country",Array.isArray(P)?P.join(","):P),!wt&&!Vt){const We=await hN(ot,mt,Pt);We&&Wt.set("proximity",We),(dt||!Zt)&&Wt.set("autocomplete","false"),Wt.set("fuzzyMatch",String(V))}X!==void 0&&(!Vt||(we==null?void 0:we.length)===1)&&Wt.set("limit",String(X)),Wt.set("key",u),yn(Wt);const Xt=hn+"/"+encodeURIComponent(Vt?Vt.decimalLongitude+","+Vt.decimalLatitude:Q)+".json?"+Wt.toString();if(Xt===kn){wt?(n(14,gt=void 0),n(55,Ie=ln[0])):n(14,gt=ln);return}kn=Xt;const Te=await fetch(Xt,{signal:Pt.signal,...Cn});if(!Te.ok)throw new Error(await Te.text());const ke=await Te.json();Pi("response",{url:Xt,featureCollection:ke}),wt?(n(14,gt=void 0),n(55,Ie=ke.features[0]),ln=[Ie]):(n(14,gt=ke.features.filter(Y)),Vt&>.unshift({type:"Feature",properties:{},id:"reverse_"+Vt.decimalLongitude+"_"+Vt.decimalLatitude,text:Vt.decimalLatitude+", "+Vt.decimalLongitude,place_name:Vt.decimalLatitude+", "+Vt.decimalLongitude,place_type:["reverse"],center:[Vt.decimalLongitude,Vt.decimalLatitude],bbox:[Vt.decimalLongitude,Vt.decimalLatitude,Vt.decimalLongitude,Vt.decimalLatitude],geometry:{type:"Point",coordinates:[Vt.decimalLongitude,Vt.decimalLatitude]}}),ln=gt,Vt&&Nt.focus())}catch(Vt){if(Vt&&typeof Vt=="object"&&"name"in Vt&&Vt.name==="AbortError")return;throw Vt}finally{Pt===tr&&n(19,tr=void 0)}}function Ko(){var dt;if(!(Tt!=null&&Tt.length)||!et)return;const Q=[180,90,-180,-90],wt=!Tt.some(Pt=>!Pt.matching_text);for(const Pt of Tt)if(wt||!Pt.matching_text)for(const Vt of[0,1,2,3])Q[Vt]=Math[Vt<2?"min":"max"](Q[Vt],((dt=Pt.bbox)==null?void 0:dt[Vt])??Pt.center[Vt%2]);ot&&Tt.length>0&&(Ie&&Q[0]===Q[2]&&Q[1]===Q[3]?ot.flyTo(Ie.center,Ge):ot.fitBounds(x2(Q),50,Me))}function Ki(Q){n(0,Ct=N==="always"),n(14,gt=void 0),n(55,Ie=void 0),n(15,Ye=-1),Ar(Q[1].toFixed(6)+", "+cN(Q[0],[-180,180],!0).toFixed(6),!1)}function xl(Q){if(!gt)return;let wt=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;wt&&(Ye===(ee?0:-1)&&wt===-1&&n(15,Ye=gt.length),n(15,Ye+=wt),Ye>=gt.length&&n(15,Ye=-1),Ye<0&&ee&&n(15,Ye=0),Q.preventDefault())}function Zr(Q=!0){if(n(18,kr=void 0),Zt){if(Mo&&clearTimeout(Mo),ft.length<_t)return;const wt=ft;Mo=window.setTimeout(()=>{re(wt).catch(dt=>n(18,kr=dt))},Q?D:0)}else n(14,gt=void 0),n(18,kr=void 0)}function ce(Q){n(55,Ie=Q),n(1,ft=Q.place_name),n(15,Ye=-1)}const en=()=>Nt.focus();function Je(Q){Jn[Q?"unshift":"push"](()=>{Nt=Q,n(17,Nt)})}function Dr(){ft=this.value,n(1,ft),n(13,Qt),n(27,S)}const Jo=()=>n(13,Qt=!0),Ke=()=>n(13,Qt=!1),ga=()=>Zr(),Fr=()=>{n(1,ft=""),Nt.focus()},lt=()=>n(0,Ct=!Ct),B=()=>n(18,kr=void 0),q=Q=>n(15,Ye=Q),J=Q=>ce(Q),nt=()=>{ee||n(15,Ye=-1)},xt=()=>{};return e.$$set=Q=>{"class"in Q&&n(2,h=Q.class),"apiKey"in Q&&n(25,u=Q.apiKey),"bbox"in Q&&n(26,g=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,I=Q.collapsed),"country"in Q&&n(28,P=Q.country),"debounceSearch"in Q&&n(29,D=Q.debounceSearch),"enableReverse"in Q&&n(5,N=Q.enableReverse),"errorMessage"in Q&&n(6,G=Q.errorMessage),"filter"in Q&&n(30,Y=Q.filter),"flyTo"in Q&&n(31,et=Q.flyTo),"fuzzyMatch"in Q&&n(32,V=Q.fuzzyMatch),"language"in Q&&n(33,j=Q.language),"limit"in Q&&n(34,X=Q.limit),"mapController"in Q&&n(35,ot=Q.mapController),"minLength"in Q&&n(36,_t=Q.minLength),"noResultsMessage"in Q&&n(7,st=Q.noResultsMessage),"placeholder"in Q&&n(8,ct=Q.placeholder),"proximity"in Q&&n(37,mt=Q.proximity),"reverseActive"in Q&&n(0,Ct=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,H=Q.reverseButtonTitle),"searchValue"in Q&&n(1,ft=Q.searchValue),"showFullGeometry"in Q&&n(38,Kt=Q.showFullGeometry),"showPlaceType"in Q&&n(10,St=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,Zt=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,ee=Q.selectFirst),"flyToSelected"in Q&&n(40,qt=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Oe=Q.markerOnSelected),"types"in Q&&n(42,we=Q.types),"excludeTypes"in Q&&n(43,un=Q.excludeTypes),"zoom"in Q&&n(44,Ge=Q.zoom),"maxZoom"in Q&&n(45,Me=Q.maxZoom),"apiUrl"in Q&&n(46,hn=Q.apiUrl),"fetchParameters"in Q&&n(47,Cn=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,gn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,yn=Q.adjustUrlQuery),"$$scope"in Q&&n(58,a=Q.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ps=Qt),S&&!Qt&&n(1,ft="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&ft.length<_t&&(n(55,Ie=void 0),n(14,gt=void 0),n(18,kr=void 0),n(54,Tt=gt)),e.$$.dirty[1]&16777344&&Kt&&Ie&&!Ie.address&&Ie.geometry.type==="Point"&&Ie.place_type[0]!=="reverse"&&re(Ie.id,{byId:!0}).catch(Q=>n(18,kr=Q)),e.$$.dirty[1]&50356241&&(ot&&Ie&&Ie.id!==Os&&et&&(!Ie.bbox||Ie.bbox[0]===Ie.bbox[2]&&Ie.bbox[1]===Ie.bbox[3]?ot.flyTo(Ie.center,Ie.id.startsWith("poi.")||Ie.id.startsWith("address.")?Me:Ge):ot.fitBounds(x2(Ie.bbox),50,Me),n(14,gt=void 0),n(54,Tt=void 0),n(15,Ye=-1)),n(56,Os=Ie==null?void 0:Ie.id)),e.$$.dirty[0]&18432&&ee&>!=null&>.length&&n(15,Ye=0),e.$$.dirty[0]&2050&&(ee||n(15,Ye=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Tt!==gt&&n(54,Tt=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&ot&&ot.setEventHandler(Q=>{switch(Q.type){case"mapClick":Ct&&Ki(Q.coordinates);break;case"markerClick":{const wt=gt==null?void 0:gt.find(dt=>dt.id===Q.id);wt&&ce(wt)}break;case"markerMouseEnter":Tt&&n(15,Ye=ps?(gt==null?void 0:gt.findIndex(wt=>wt.id===Q.id))??-1:-1);break;case"markerMouseLeave":Tt&&n(15,Ye=-1);break}}),e.$$.dirty[0]&49152&&n(57,r=gt==null?void 0:gt[Ye]),e.$$.dirty[1]&67133969&&ot&&r&&et&&qt&&ot.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Me:Ge),e.$$.dirty[1]&1040&&(Oe||ot==null||ot.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&ot&&Oe&&!Tt&&(ot.setMarkers(r?[r]:void 0,void 0),ot.setSelectedMarker(r?0:-1)),e.$$.dirty[1]&25165840&&ot&&ot.setMarkers(Tt,Ie),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Tt&&ot&&ot.setSelectedMarker(Ye),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&ot){const Q=ds(ft);ot.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&Pi("select",r),e.$$.dirty[1]&16777216&&Pi("pick",Ie),e.$$.dirty[0]&81920&&Pi("optionsVisibilityChange",ps&&!!gt),e.$$.dirty[0]&16384&&Pi("featuresListed",gt),e.$$.dirty[1]&8388608&&Pi("featuresMarked",Tt),e.$$.dirty[0]&1&&Pi("reverseToggle",Ct),e.$$.dirty[0]&2&&Pi("queryChange",ft),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&ot&&ot.indicateReverse(Ct)},[Ct,ft,h,w,I,N,G,st,ct,H,St,ee,gn,Qt,gt,Ye,ps,Nt,kr,tr,Ba,bl,xl,Zr,ce,u,g,S,P,D,Y,et,V,j,X,ot,_t,mt,Kt,Zt,qt,Oe,we,un,Ge,Me,hn,Cn,yn,An,xr,Ar,wr,pr,Tt,Ie,Os,r,a,i,en,Je,Dr,Jo,Ke,ga,Fr,lt,B,q,J,nt,xt]}class PN extends tn{constructor(t){super(),$e(this,t,LN,TN,je,{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 k2(e){let t,n,r;return n=new PN({props:{mapController:e[1],apiKey:e[0]}}),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"class","svelte-ixhnie")},m(i,a){Rt(i,t,a),se(n,t,null),r=!0},p(i,a){const h={};a&2&&(h.mapController=i[1]),a&1&&(h.apiKey=i[0]),n.$set(h)},i(i){r||(bt(n.$$.fragment,i),r=!0)},o(i){Lt(n.$$.fragment,i),r=!1},d(i){i&&Dt(t),ae(n)}}}function MN(e){let t,n,r=e[1]&&k2(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&bt(r,1)):(r=k2(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function AN(e,t,n){let r,{apiKey:i}=t,{map:a}=t;return e.$$set=h=>{"apiKey"in h&&n(0,i=h.apiKey),"map"in h&&n(2,a=h.map)},e.$$.update=()=>{e.$$.dirty&4&&n(1,r=a?jR(a,Es):null)},[i,r,a]}class kN extends tn{constructor(t){super(),$e(this,t,AN,MN,je,{apiKey:0,map:2})}}const DN=Symbol.for("svelte-maplibre");function RN(){return vv(DN)}function NN(e){return"layerType"in e&&e.layerType==="deckgl"}var Vc=ON;function ON(e){var t,n,r;if(e){if(Array.isArray(e)){for(t=[],n=e.length,r=0;r({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),R2=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function N2(e){let t,n,r=(e[4]||e[3]instanceof Es.Marker)&&O2(e);return{c(){t=Ot("div"),r&&r.c()},m(i,a){Rt(i,t,a),r&&r.m(t,null),e[32](t),n=!0},p(i,a){i[4]||i[3]instanceof Es.Marker?r?(r.p(i,a),a[0]&24&&bt(r,1)):(r=O2(i),r.c(),bt(r,1),r.m(t,null)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(),e[32](null)}}}function O2(e){let t;const n=e[30].default,r=ei(n,e,e[29],R2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[0]&536870933)&&ri(r,n,i,i[29],t?ni(n,i[29],a,BN):ii(i[29]),R2)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function VN(e){let t,n,r=e[9].default&&N2(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&bt(r,1)):(r=N2(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function UN(e,t,n){let r,i,a,h,u,g,{$$slots:w={},$$scope:S}=t;const I=BL(w);let{closeButton:P=void 0}=t,{closeOnClickOutside:D=!0}=t,{closeOnClickInside:N=!1}=t,{closeOnMove:G=!1}=t,{openOn:Y="click"}=t,{openIfTopMost:et=!0}=t,{focusAfterOpen:V=!0}=t,{anchor:j=void 0}=t,{offset:X=void 0}=t,{popupClass:ot=void 0}=t,{maxWidth:_t=void 0}=t,{lngLat:st=void 0}=t,{html:ct=void 0}=t,{open:mt=!1}=t;const Ct=qu(),{map:H,popupTarget:ft,layerEvent:Kt,layer:St,eventTopMost:Zt}=RN();Pe(e,H,Tt=>n(2,a=Tt)),Pe(e,ft,Tt=>n(3,u=Tt)),Pe(e,Kt,Tt=>n(28,h=Tt)),Pe(e,St,Tt=>n(35,g=Tt));const ee=["click","dblclick","contextmenu"];let qt,Oe=!1,we;function un(){if(!qt)return;let Tt=qt.getElement();!Tt||Tt===we||(we=Tt,Y==="hover"&&(we.style.pointerEvents="none"),we.addEventListener("mouseenter",()=>{n(24,Oe=!0)},{passive:!0}),we.addEventListener("mouseleave",()=>{n(24,Oe=!1)},{passive:!0}),we.addEventListener("click",()=>{N&&n(0,mt=!1)},{passive:!0}))}Gu(()=>{if(a)return a.on("click",wr),a.on("contextmenu",wr),typeof u=="string"&&(a.on("click",u,Cn),a.on("dblclick",u,Cn),a.on("contextmenu",u,Cn),a.on("mousemove",u,Ar),a.on("mouseleave",u,xr),a.on("touchstart",u,yn),a.on("touchend",u,An)),()=>{a!=null&&a.loaded()&&(qt==null||qt.remove(),a.off("click",wr),a.off("contextmenu",wr),u instanceof Es.Marker?u.getPopup()===qt&&u.setPopup(void 0):typeof u=="string"&&(a.off("click",u,Cn),a.off("dblclick",u,Cn),a.off("contextmenu",u,Cn),a.off("mousemove",u,Ar),a.off("mouseleave",u,xr),a.off("touchstart",u,yn),a.off("touchend",u,An)))}});function Ge(Tt){return et?!("marker"in Tt)&&!NN(Tt)&&Zt(Tt)!==g:!1}let Me=null,hn="normal";function Cn(Tt){Tt.type===Y&&(Ge(Tt)||("layerType"in Tt?Tt.layerType==="deckgl"?(n(10,st=Tt.coordinate),n(4,Me=Tt.object?[Tt.object]:null)):(n(10,st=Tt.lngLat),n(4,Me=Tt.features??[])):(n(10,st=Tt.lngLat),n(4,Me=Tt.features??[])),setTimeout(()=>n(0,mt=!0))))}let gn=null;function yn(Tt){gn=Tt.point}function An(Tt){if(!gn||Y!=="hover")return;let Ie=gn.dist(Tt.point);gn=null,Ie<3&&(n(10,st=Tt.lngLat),n(4,Me=Tt.features??[]),qt.isOpen()?n(25,hn="justOpened"):(n(25,hn="opening"),n(0,mt=!0)))}function xr(Tt){Y!=="hover"||gn||hn!=="normal"||(n(0,mt=!1),n(4,Me=null))}function Ar(Tt){if(!(Y!=="hover"||gn||hn!=="normal")){if(Ge(Tt)){n(0,mt=!1),n(4,Me=null);return}n(0,mt=!0),n(4,Me=Tt.features??[]),n(10,st=Tt.lngLat)}}function wr(Tt){if(hn==="justOpened"){n(25,hn="normal");return}if(!D)return;let Ie=[we,u instanceof Es.Marker?u==null?void 0:u.getElement():null];mt&&qt.isOpen()&&!Ie.some(kn=>kn==null?void 0:kn.contains(Tt.originalEvent.target))&&(Tt.type==="contextmenu"&&Y==="contextmenu"||Tt.type!=="contextmenu")&&n(0,mt=!1)}as(()=>{a&&(qt!=null&&qt.isOpen())&&qt.remove()});let pr;const Qt=()=>n(0,mt=!1);function gt(Tt){Jn[Tt?"unshift":"push"](()=>{pr=Tt,n(1,pr)})}return e.$$set=Tt=>{"closeButton"in Tt&&n(11,P=Tt.closeButton),"closeOnClickOutside"in Tt&&n(12,D=Tt.closeOnClickOutside),"closeOnClickInside"in Tt&&n(13,N=Tt.closeOnClickInside),"closeOnMove"in Tt&&n(14,G=Tt.closeOnMove),"openOn"in Tt&&n(15,Y=Tt.openOn),"openIfTopMost"in Tt&&n(16,et=Tt.openIfTopMost),"focusAfterOpen"in Tt&&n(17,V=Tt.focusAfterOpen),"anchor"in Tt&&n(18,j=Tt.anchor),"offset"in Tt&&n(19,X=Tt.offset),"popupClass"in Tt&&n(20,ot=Tt.popupClass),"maxWidth"in Tt&&n(21,_t=Tt.maxWidth),"lngLat"in Tt&&n(10,st=Tt.lngLat),"html"in Tt&&n(22,ct=Tt.html),"open"in Tt&&n(0,mt=Tt.open),"$$scope"in Tt&&n(29,S=Tt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,r=P??(!D&&!N)),e.$$.dirty[0]&146685952&&(qt||(n(23,qt=new Es.Popup({closeButton:r,closeOnClick:!1,closeOnMove:G,focusAfterOpen:V,maxWidth:_t,className:ot,anchor:j,offset:X})),we=qt.getElement(),qt.on("open",()=>{n(0,mt=!0),un(),Ct("open",qt)}),qt.on("close",()=>{n(0,mt=!1),Ct("close",qt)}),qt.on("hover",()=>{Ct("hover",qt)}))),e.$$.dirty[0]&8421384&&qt&&u instanceof Es.Marker&&(Y==="click"?u.setPopup(qt):u.getPopup()===qt&&u.setPopup(void 0)),e.$$.dirty[0]&268468224&&ee.includes(Y)&&(h==null?void 0:h.type)===Y&&(Cn(h),Wn(Kt,h=null,h)),e.$$.dirty[0]&268468224&&n(26,i=Y==="hover"&&((h==null?void 0:h.type)==="mousemove"||(h==null?void 0:h.type)==="mouseenter")),e.$$.dirty[0]&352354304&&Y==="hover"&&Kt&&(i&&h&&(h.layerType==="deckgl"?(n(10,st=h.coordinate),n(4,Me=h.object?[h.object]:null)):(n(10,st=h.lngLat),n(4,Me=h.features??[]))),n(0,mt=(i||Oe)??!1)),e.$$.dirty[0]&12582914&&(pr?qt.setDOMContent(pr):ct&&qt.setHTML(ct)),e.$$.dirty[0]&8389632&&st&&qt.setLngLat(st),e.$$.dirty[0]&41943045&&a){let Tt=qt.isOpen();mt&&!Tt?(qt.addTo(a),hn==="opening"&&n(25,hn="justOpened")):!mt&&Tt&&qt.remove()}},[mt,pr,a,u,Me,H,ft,Kt,St,I,st,P,D,N,G,Y,et,V,j,X,ot,_t,ct,qt,Oe,hn,i,r,h,S,w,Qt,gt]}class GN extends tn{constructor(t){super(),$e(this,t,UN,VN,je,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var Kd=Uint8Array,wC=Uint16Array,qN=Int32Array,jN=new Kd([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]),WN=new Kd([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]),SC=function(e,t){for(var n=new wC(31),r=0;r<31;++r)n[r]=t+=1<>1|(Kn&21845)<<1,zl=(zl&52428)>>2|(zl&13107)<<2,zl=(zl&61680)>>4|(zl&3855)<<4,XN[Kn]=((zl&65280)>>8|(zl&255)<<8)>>1;var zl,Kn,zy=new Kd(288);for(Kn=0;Kn<144;++Kn)zy[Kn]=8;var Kn;for(Kn=144;Kn<256;++Kn)zy[Kn]=9;var Kn;for(Kn=256;Kn<280;++Kn)zy[Kn]=7;var Kn;for(Kn=280;Kn<288;++Kn)zy[Kn]=8;var Kn,YN=new Kd(32);for(Kn=0;Kn<32;++Kn)YN[Kn]=5;var Kn,KN=new Kd(0),JN=typeof TextDecoder<"u"&&new TextDecoder,QN=0;try{JN.decode(KN,{stream:!0}),QN=1}catch{}const $N=e=>({props:e&8}),z2=e=>({props:nO(e[3])});function tO(e){let t;const n=e[1].default,r=ei(n,e,e[2],z2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&12)&&ri(r,n,i,i[2],t?ni(n,i[2],a,$N):ii(i[2]),z2)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function eO(e){let t,n;return t=new GN({props:{openOn:e[0],$$slots:{default:[tO,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function nO(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function rO(e,t,n){let{$$slots:r={},$$scope:i}=t,{openOn:a="hover"}=t;return e.$$set=h=>{"openOn"in h&&n(0,a=h.openOn),"$$scope"in h&&n(2,i=h.$$scope)},[a,r,i]}class Zf extends tn{constructor(t){super(),$e(this,t,rO,eO,je,{openOn:0})}}const iO=["==",["geometry-type"],"Polygon"],oO=["==",["geometry-type"],"LineString"];function h1(e,t,n){let r=["match",e];for(let[i,a]of Object.entries(t))r.push(i),r.push(a);return r.push(n),r}function pv(e,t,n){let r=["step",e];for(let i=1;i{var h;let r=t.get(n.originalEvent);if(r!==void 0)return r;let a=(h=n.target.queryRenderedFeatures(n.point).find(u=>{var g;return(g=e.get(u.layer.id))==null?void 0:g.interactive}))==null?void 0:h.layer.id;return t.set(n.originalEvent,a),a}}function lO(){let e=new Map;return _v(f1,{map:or(null),source:Y_(null),layer:Y_(null),popupTarget:Y_(null),cluster:or(),loadedImages:or(new Set),minzoom:or(0),maxzoom:or(24),layerEvent:or(null),layerInfo:e,eventTopMost:aO(e)})}function F2(e){return{subscribe:e.subscribe}}function p1({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Xf(),a=or(null),h=F2(a),u={...i,[e]:F2(a)};if(t&&(u.popupTarget=h),r){let g=or(null);u.layerEvent=g,i.layerEvent=g}return n&&(u.cluster=or()),_v(f1,u),{...i,self:a}}function uO(){return p1({key:"source",setCluster:!0})}function cO(e=!0){return p1({key:"layer",setPopupTarget:e,setMouseEvent:e})}function hO(){return p1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function B2(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],a=n[r];i!==a&&e(r,a,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function fO(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function pO(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function Fy(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}function V2(e){let t=e[0],n,r,i=U2(e);return{c(){i.c(),n=oi()},m(a,h){i.m(a,h),Rt(a,n,h),r=!0},p(a,h){h[0]&1&&je(t,t=a[0])?(zn(),Lt(i,1,1,ge),Fn(),i=U2(a),i.c(),bt(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(bt(i),r=!0)},o(a){Lt(i),r=!1},d(a){a&&Dt(n),i.d(a)}}}function U2(e){let t;const n=e[36].default,r=ei(n,e,e[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[1]&16)&&ri(r,n,i,i[35],t?ni(n,i[35],a,null):ii(i[35]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function dO(e){let t,n,r=e[0]&&V2(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&bt(r,1)):(r=V2(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function mO(e,t,n){let r,i,a,h,u,g,w,S,I,P,D,N,{$$slots:G={},$$scope:Y}=t,{id:et=Jd("layer")}=t,{source:V=void 0}=t,{sourceLayer:j=void 0}=t,{beforeId:X=void 0}=t,{beforeLayerType:ot=void 0}=t,{type:_t}=t,{paint:st=void 0}=t,{layout:ct=void 0}=t,{filter:mt=void 0}=t,{applyToClusters:Ct=void 0}=t,{minzoom:H=void 0}=t,{maxzoom:ft=void 0}=t,{manageHoverState:Kt=!1}=t,{hovered:St=null}=t,{interactive:Zt=!0}=t,{hoverCursor:ee=void 0}=t,{eventsIfTopMost:qt=!1}=t;const Oe=qu(),{map:we,source:un,self:Ge,minzoom:Me,maxzoom:hn,eventTopMost:Cn,layerInfo:gn}=cO();Pe(e,we,gt=>n(31,I=gt)),Pe(e,un,gt=>n(32,P=gt)),Pe(e,Ge,gt=>n(0,S=gt)),Pe(e,Me,gt=>n(34,N=gt)),Pe(e,hn,gt=>n(33,D=gt)),as(()=>{S&&I&&(gn.delete(S),I==null||I.removeLayer(S))});let yn;function An(gt){var Nt,Ye;if(!Zt||!S||!I||qt&&Cn(gt)!==S)return;let Tt=gt.features??[],Ie=(Ye=(Nt=Tt[0])==null?void 0:Nt.properties)==null?void 0:Ye.cluster_id,kn={event:gt,map:I,clusterId:Ie,layer:S,source:u,features:Tt};Oe(gt.type,kn)}function xr(gt){var Nt,Ye;if(!Zt||!S||!I||qt&&Cn(gt)!==S)return;ee&&(I.getCanvas().style.cursor=ee);let Tt=gt.features??[];n(6,St=Tt[0]??null);let Ie=(Ye=(Nt=Tt[0])==null?void 0:Nt.properties)==null?void 0:Ye.cluster_id;Oe("mouseenter",{event:gt,map:I,clusterId:Ie,layer:S,source:u,features:Tt})}function Ar(gt){var Nt,Ye,kr;if(!Zt||!I)return;if(qt&&Cn(gt)!==S){n(6,St=null),Kt&&yn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:j,id:yn},{hover:!1}),yn=void 0);return}I.getCanvas().style.cursor=ee;let Tt=gt.features??[],Ie=(Ye=(Nt=Tt[0])==null?void 0:Nt.properties)==null?void 0:Ye.cluster_id,kn=(kr=Tt[0])==null?void 0:kr.id;kn!==yn&&(Kt&&(yn!==void 0&&(I==null||I.setFeatureState({source:u,id:yn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:j},{hover:!0})),yn=kn,n(6,St=Tt[0]??null)),Oe("mousemove",{event:gt,map:I,clusterId:Ie,layer:S,source:u,features:Tt})}function wr(gt){if(!(!Zt||!S||!I)){if(ee&&(I.getCanvas().style.cursor=""),n(6,St=null),Kt&&yn!==void 0){const Tt={source:u,id:yn,sourceLayer:j};I==null||I.setFeatureState(Tt,{hover:!1}),yn=void 0}Oe("mouseleave",{map:I,layer:S,source:u})}}let pr=!0;function Qt(gt){I&&(I.off("click",gt,An),I.off("dblclick",gt,An),I.off("contextmenu",gt,An),I.off("mouseenter",gt,xr),I.off("mousemove",gt,Ar),I.off("mouseleave",gt,wr))}return as(()=>{I&&S&&Qt(S)}),e.$$set=gt=>{"id"in gt&&n(7,et=gt.id),"source"in gt&&n(8,V=gt.source),"sourceLayer"in gt&&n(9,j=gt.sourceLayer),"beforeId"in gt&&n(10,X=gt.beforeId),"beforeLayerType"in gt&&n(11,ot=gt.beforeLayerType),"type"in gt&&n(12,_t=gt.type),"paint"in gt&&n(13,st=gt.paint),"layout"in gt&&n(14,ct=gt.layout),"filter"in gt&&n(15,mt=gt.filter),"applyToClusters"in gt&&n(16,Ct=gt.applyToClusters),"minzoom"in gt&&n(17,H=gt.minzoom),"maxzoom"in gt&&n(18,ft=gt.maxzoom),"manageHoverState"in gt&&n(19,Kt=gt.manageHoverState),"hovered"in gt&&n(6,St=gt.hovered),"interactive"in gt&&n(20,Zt=gt.interactive),"hoverCursor"in gt&&n(21,ee=gt.hoverCursor),"eventsIfTopMost"in gt&&n(22,qt=gt.eventsIfTopMost),"$$scope"in gt&&n(35,Y=gt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=pO(Ct)),e.$$.dirty[0]&1073774592&&n(24,i=fO("all",r,mt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,a=H??N),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=ft??D),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=V||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&I&&S!==et&&u){S&&(Qt(S),gn.delete(S));let gt=X;if(!X&&ot){let Tt=I.getStyle().layers,Ie=typeof ot=="function"?ot:Nt=>Nt.type===ot,kn=Tt==null?void 0:Tt.find(Ie);kn&&(gt=kn.id)}Wn(Ge,S=et,S),I.addLayer(Vc({id:S,type:_t,source:u,"source-layer":j,filter:i,paint:st,layout:ct,minzoom:a,maxzoom:h}),gt),n(23,pr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,xr),I.on("mousemove",S,Ar),I.on("mouseleave",S,wr)}e.$$.dirty[0]&1048577&&S&&gn.set(S,{interactive:Zt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,g=S?B2((gt,Tt)=>I==null?void 0:I.setPaintProperty(S,gt,Tt)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?B2((gt,Tt)=>I==null?void 0:I.setLayoutProperty(S,gt,Tt)):void 0),e.$$.dirty[0]&268443648&&(g==null||g(st)),e.$$.dirty[0]&134234112&&(w==null||w(ct)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(pr?n(23,pr=!1):I==null||I.setFilter(S,i))},[S,we,un,Ge,Me,hn,St,et,V,j,X,ot,_t,st,ct,mt,Ct,H,ft,Kt,Zt,ee,qt,pr,i,h,a,w,g,u,r,I,P,D,N,Y,G]}let d1=class extends tn{constructor(t){super(),$e(this,t,mO,dO,je,{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 gO(e){let t;const n=e[16].default,r=ei(n,e,e[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16777216)&&ri(r,n,i,i[24],t?ni(n,i[24],a,null):ii(i[24]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function yO(e){let t,n,r;function i(h){e[17](h)}let a={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:[gO]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new d1({props:a}),Jn.push(()=>Eo(t,"hovered",i)),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(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&2&&(g.id=h[1]),u&4&&(g.source=h[2]),u&8&&(g.sourceLayer=h[3]),u&16&&(g.beforeId=h[4]),u&32&&(g.beforeLayerType=h[5]),u&64&&(g.paint=h[6]),u&128&&(g.layout=h[7]),u&256&&(g.filter=h[8]),u&512&&(g.applyToClusters=h[9]),u&1024&&(g.minzoom=h[10]),u&2048&&(g.maxzoom=h[11]),u&4096&&(g.hoverCursor=h[12]),u&8192&&(g.manageHoverState=h[13]),u&16384&&(g.eventsIfTopMost=h[14]),u&32768&&(g.interactive=h[15]),u&16777216&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function _O(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Jd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:g=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{applyToClusters:D=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:G=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:et=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:j=!1}=t,{interactive:X=!0}=t;function ot(ft){V=ft,n(0,V)}function _t(ft){En.call(this,e,ft)}function st(ft){En.call(this,e,ft)}function ct(ft){En.call(this,e,ft)}function mt(ft){En.call(this,e,ft)}function Ct(ft){En.call(this,e,ft)}function H(ft){En.call(this,e,ft)}return e.$$set=ft=>{"id"in ft&&n(1,a=ft.id),"source"in ft&&n(2,h=ft.source),"sourceLayer"in ft&&n(3,u=ft.sourceLayer),"beforeId"in ft&&n(4,g=ft.beforeId),"beforeLayerType"in ft&&n(5,w=ft.beforeLayerType),"paint"in ft&&n(6,S=ft.paint),"layout"in ft&&n(7,I=ft.layout),"filter"in ft&&n(8,P=ft.filter),"applyToClusters"in ft&&n(9,D=ft.applyToClusters),"minzoom"in ft&&n(10,N=ft.minzoom),"maxzoom"in ft&&n(11,G=ft.maxzoom),"hoverCursor"in ft&&n(12,Y=ft.hoverCursor),"manageHoverState"in ft&&n(13,et=ft.manageHoverState),"hovered"in ft&&n(0,V=ft.hovered),"eventsIfTopMost"in ft&&n(14,j=ft.eventsIfTopMost),"interactive"in ft&&n(15,X=ft.interactive),"$$scope"in ft&&n(24,i=ft.$$scope)},[V,a,h,u,g,w,S,I,P,D,N,G,Y,et,j,X,r,ot,_t,st,ct,mt,Ct,H,i]}let By=class extends tn{constructor(t){super(),$e(this,t,_O,yO,je,{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 vO(e){let t;const n=e[15].default,r=ei(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&ri(r,n,i,i[23],t?ni(n,i[23],a,null):ii(i[23]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function bO(e){let t,n,r;function i(h){e[16](h)}let a={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:[vO]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new d1({props:a}),Jn.push(()=>Eo(t,"hovered",i)),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(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&2&&(g.id=h[1]),u&4&&(g.source=h[2]),u&8&&(g.sourceLayer=h[3]),u&16&&(g.beforeId=h[4]),u&32&&(g.beforeLayerType=h[5]),u&64&&(g.paint=h[6]),u&128&&(g.layout=h[7]),u&256&&(g.filter=h[8]),u&512&&(g.minzoom=h[9]),u&1024&&(g.maxzoom=h[10]),u&2048&&(g.hoverCursor=h[11]),u&4096&&(g.manageHoverState=h[12]),u&8192&&(g.eventsIfTopMost=h[13]),u&16384&&(g.interactive=h[14]),u&8388608&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function xO(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Jd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:g=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:G=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:j=!0}=t;function X(H){et=H,n(0,et)}function ot(H){En.call(this,e,H)}function _t(H){En.call(this,e,H)}function st(H){En.call(this,e,H)}function ct(H){En.call(this,e,H)}function mt(H){En.call(this,e,H)}function Ct(H){En.call(this,e,H)}return e.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,h=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,G=H.hoverCursor),"manageHoverState"in H&&n(12,Y=H.manageHoverState),"hovered"in H&&n(0,et=H.hovered),"eventsIfTopMost"in H&&n(13,V=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[et,a,h,u,g,w,S,I,P,D,N,G,Y,V,j,r,X,ot,_t,st,ct,mt,Ct,i]}let IC=class extends tn{constructor(t){super(),$e(this,t,xO,bO,je,{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 wO(e,t,n){let r;const{map:i}=Xf();Pe(e,i,g=>n(4,r=g));let{position:a="top-left"}=t,{container:h=void 0}=t,u=null;return as(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),e.$$set=g=>{"position"in g&&n(1,a=g.position),"container"in g&&n(2,h=g.container)},e.$$.update=()=>{if(e.$$.dirty&30&&r&&!u){let g;typeof h=="string"?g=document.querySelector(h)??void 0:g=h,n(3,u=new Es.FullscreenControl({container:g})),r.addControl(u,a)}},[i,a,h,u,r]}class SO extends tn{constructor(t){super(),$e(this,t,wO,null,je,{position:1,container:2})}}function EO(e,t,n,r,i){let a=!1;e.getSource(t)&&(a=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(a){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function IO(e,t,n){KS().then(()=>{let r=WS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function G2(e){let t=e[0],n,r,i=q2(e);return{c(){i.c(),n=oi()},m(a,h){i.m(a,h),Rt(a,n,h),r=!0},p(a,h){h&1&&je(t,t=a[0])?(zn(),Lt(i,1,1,ge),Fn(),i=q2(a),i.c(),bt(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(bt(i),r=!0)},o(a){Lt(i),r=!1},d(a){a&&Dt(n),i.d(a)}}}function q2(e){let t;const n=e[15].default,r=ei(n,e,e[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16384)&&ri(r,n,i,i[14],t?ni(n,i[14],a,null):ii(i[14]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function CO(e){let t,n,r=e[0]&&G2(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&bt(r,1)):(r=G2(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function TO(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{id:g=Jd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:I=void 0}=t,{filter:P=void 0}=t,{lineMetrics:D=void 0}=t,{cluster:N=void 0}=t;const{map:G,cluster:Y,self:et}=uO();Pe(e,G,X=>n(13,i=X)),Pe(e,Y,X=>n(16,a=X)),Pe(e,et,X=>n(0,r=X));let V,j=!0;return as(()=>{r&&V&&i&&(IO(G,r,V),Wn(et,r=null,r),n(11,V=void 0))}),e.$$set=X=>{"id"in X&&n(4,g=X.id),"data"in X&&n(5,w=X.data),"generateId"in X&&n(6,S=X.generateId),"promoteId"in X&&n(7,I=X.promoteId),"filter"in X&&n(8,P=X.filter),"lineMetrics"in X&&n(9,D=X.lineMetrics),"cluster"in X&&n(10,N=X.cluster),"$$scope"in X&&n(14,u=X.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Wn(Y,a=N,a),e.$$.dirty&12273&&i&&r!==g&&(Wn(et,r=g,r),EO(i,r,Vc({type:"geojson",data:w,filter:P,lineMetrics:D,generateId:S,promoteId:I,cluster:!!N,clusterMinPoints:N==null?void 0:N.minPoints,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius,clusterProperties:N==null?void 0:N.properties}),X=>i&&X===r,()=>{r&&(n(11,V=i==null?void 0:i.getSource(r)),n(12,j=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,V=i==null?void 0:i.getSource(g))})),e.$$.dirty&6176&&V&&(j?n(12,j=!1):V.setData(w)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Vc({cluster:!!N,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius})))},[r,G,Y,et,g,w,S,I,P,D,N,V,j,i,u,h]}let nu=class extends tn{constructor(t){super(),$e(this,t,TO,CO,je,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}};function LO(e,t,n){let r;const{map:i}=Xf();Pe(e,i,P=>n(8,r=P));let{position:a="top-left"}=t,{positionOptions:h=void 0}=t,{fitBoundsOptions:u=void 0}=t,{trackUserLocation:g=!1}=t,{showAccuracyCircle:w=!0}=t,{showUserLocation:S=!0}=t,I=null;return as(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),e.$$set=P=>{"position"in P&&n(1,a=P.position),"positionOptions"in P&&n(2,h=P.positionOptions),"fitBoundsOptions"in P&&n(3,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(4,g=P.trackUserLocation),"showAccuracyCircle"in P&&n(5,w=P.showAccuracyCircle),"showUserLocation"in P&&n(6,S=P.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&r&&!I&&(n(7,I=new Es.GeolocateControl({positionOptions:h,fitBoundsOptions:u,trackUserLocation:g,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,a,h,u,g,w,S,I,r]}class PO extends tn{constructor(t){super(),$e(this,t,LO,null,je,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function MO(e){let t;const n=e[15].default,r=ei(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&ri(r,n,i,i[23],t?ni(n,i[23],a,null):ii(i[23]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function AO(e){let t,n,r;function i(h){e[16](h)}let a={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:[MO]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new d1({props:a}),Jn.push(()=>Eo(t,"hovered",i)),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(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&2&&(g.id=h[1]),u&4&&(g.source=h[2]),u&8&&(g.sourceLayer=h[3]),u&16&&(g.beforeId=h[4]),u&32&&(g.beforeLayerType=h[5]),u&64&&(g.paint=h[6]),u&128&&(g.layout=h[7]),u&256&&(g.filter=h[8]),u&512&&(g.minzoom=h[9]),u&1024&&(g.maxzoom=h[10]),u&2048&&(g.hoverCursor=h[11]),u&4096&&(g.manageHoverState=h[12]),u&8192&&(g.eventsIfTopMost=h[13]),u&16384&&(g.interactive=h[14]),u&8388608&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function kO(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=Jd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:g=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:G=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:j=!0}=t;function X(H){et=H,n(0,et)}function ot(H){En.call(this,e,H)}function _t(H){En.call(this,e,H)}function st(H){En.call(this,e,H)}function ct(H){En.call(this,e,H)}function mt(H){En.call(this,e,H)}function Ct(H){En.call(this,e,H)}return e.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,h=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,G=H.hoverCursor),"manageHoverState"in H&&n(12,Y=H.manageHoverState),"hovered"in H&&n(0,et=H.hovered),"eventsIfTopMost"in H&&n(13,V=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[et,a,h,u,g,w,S,I,P,D,N,G,Y,V,j,r,X,ot,_t,st,ct,mt,Ct,i]}let Yc=class extends tn{constructor(t){super(),$e(this,t,kO,AO,je,{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 DO(e,t,n){let r;const i=qu();let{layer:a=void 0}=t;const{map:h}=Xf();Pe(e,h,S=>n(2,r=S));function u(S){i(S.type,{...S,map:h})}const g=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return as(()=>{if(r)if(a)for(const S of g)r.off(S,a,u);else for(const S of w)r.off(S,u)}),e.$$set=S=>{"layer"in S&&n(1,a=S.layer)},e.$$.update=()=>{if(e.$$.dirty&6&&r)if(a)for(const S of g)r.on(S,a,u);else for(const S of w)r.on(S,u)},[h,a,r]}class RO extends tn{constructor(t){super(),$e(this,t,DO,null,je,{layer:1})}}function NO(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(t.lat*i)/i,h=Math.round(t.lng*i)/i,u=`${n}/${a}/${h}`,g=e.getBearing(),w=e.getPitch();return(g||w)&&(u+=`/${Math.round(g*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function OO(e){return e.replace("#","").split("/").map(parseFloat)}function zO(e,t,n){let r;const{map:i}=Xf();Pe(e,i,S=>n(6,r=S));let{position:a="top-left"}=t,{showCompass:h=!0}=t,{showZoom:u=!0}=t,{visualizePitch:g=!1}=t,w=null;return as(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),e.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,h=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,g=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&r&&!w&&(n(5,w=new Es.NavigationControl({showCompass:h,showZoom:u,visualizePitch:g})),r.addControl(w,a))},[i,a,h,u,g,w,r]}class FO extends tn{constructor(t){super(),$e(this,t,zO,null,je,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function BO(e,t,n){let r;const{map:i}=Xf();Pe(e,i,w=>n(5,r=w));let{position:a="bottom-left"}=t,{maxWidth:h=void 0}=t,{unit:u="metric"}=t,g=null;return as(()=>{r!=null&&r.loaded()&&g&&r.removeControl(g)}),e.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,h=w.maxWidth),"unit"in w&&n(3,u=w.unit)},e.$$.update=()=>{e.$$.dirty&62&&r&&!g&&(n(4,g=new Es.ScaleControl({maxWidth:h,unit:u})),r.addControl(g,a))},[i,a,h,u,g,r]}class VO extends tn{constructor(t){super(),$e(this,t,BO,null,je,{position:1,maxWidth:2,unit:3})}}const{window:UO}=VL,GO=e=>({map:e[0]&16,loadedImages:e[0]&32,allImagesLoaded:e[0]&64}),j2=e=>({map:e[4],loadedImages:e[5],allImagesLoaded:e[6]});function W2(e){let t,n,r=e[3]&&H2(e);const i=e[39].default,a=ei(i,e,e[38],j2);return{c(){r&&r.c(),t=fe(),a&&a.c()},m(h,u){r&&r.m(h,u),Rt(h,t,u),a&&a.m(h,u),n=!0},p(h,u){h[3]?r?(r.p(h,u),u[0]&8&&bt(r,1)):(r=H2(h),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn()),a&&a.p&&(!n||u[0]&112|u[1]&128)&&ri(a,i,h,h[38],n?ni(i,h[38],u,GO):ii(h[38]),j2)},i(h){n||(bt(r),bt(a,h),n=!0)},o(h){Lt(r),Lt(a,h),n=!1},d(h){h&&Dt(t),r&&r.d(h),a&&a.d(h)}}}function H2(e){let t,n,r,i,a,h,u,g;return t=new FO({props:{position:e[7]}}),r=new PO({props:{position:e[7],fitBoundsOptions:{maxZoom:12}}}),a=new SO({props:{position:e[7]}}),u=new VO({props:{position:e[7]}}),{c(){le(t.$$.fragment),n=fe(),le(r.$$.fragment),i=fe(),le(a.$$.fragment),h=fe(),le(u.$$.fragment)},m(w,S){se(t,w,S),Rt(w,n,S),se(r,w,S),Rt(w,i,S),se(a,w,S),Rt(w,h,S),se(u,w,S),g=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),t.$set(I);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const D={};S[0]&128&&(D.position=w[7]),a.$set(D);const N={};S[0]&128&&(N.position=w[7]),u.$set(N)},i(w){g||(bt(t.$$.fragment,w),bt(r.$$.fragment,w),bt(a.$$.fragment,w),bt(u.$$.fragment,w),g=!0)},o(w){Lt(t.$$.fragment,w),Lt(r.$$.fragment,w),Lt(a.$$.fragment,w),Lt(u.$$.fragment,w),g=!1},d(w){w&&(Dt(n),Dt(i),Dt(h)),ae(t,w),ae(r,w),ae(a,w),ae(u,w)}}}function qO(e){let t,n,r,i,a,h=e[4]&&e[0]&&W2(e);return{c(){t=Ot("div"),h&&h.c(),Ut(t,"class",n=Dg(e[2])+" svelte-p00lfq"),Ut(t,"data-testid","map-container"),ol(t,"expand-map",!e[2])},m(u,g){Rt(u,t,g),h&&h.m(t,null),e[40](t),r=!0,i||(a=[Ze(UO,"hashchange",e[11]),E0(e[10].call(null,t))],i=!0)},p(u,g){u[4]&&u[0]?h?(h.p(u,g),g[0]&17&&bt(h,1)):(h=W2(u),h.c(),bt(h,1),h.m(t,null)):h&&(zn(),Lt(h,1,1,()=>{h=null}),Fn()),(!r||g[0]&4&&n!==(n=Dg(u[2])+" svelte-p00lfq"))&&Ut(t,"class",n),(!r||g[0]&4)&&ol(t,"expand-map",!u[2])},i(u){r||(bt(h),r=!0)},o(u){Lt(h),r=!1},d(u){u&&Dt(t),h&&h.d(),e[40](null),i=!1,Ni(a)}}}function jO(e,t,n){let r,i,a,h,{$$slots:u={},$$scope:g}=t,{map:w=null}=t,{mapContainer:S=void 0}=t,{class:I=void 0}=t,{style:P}=t,{diffStyleUpdates:D=!1}=t,{center:N=void 0}=t,{zoom:G=void 0}=t,{pitch:Y=0}=t,{bearing:et=0}=t,{bounds:V=void 0}=t,{hash:j=!1}=t,{loaded:X=!1}=t,{minZoom:ot=0}=t,{maxZoom:_t=22}=t,{antialias:st=void 0}=t,{zoomOnDoubleClick:ct=!0}=t,{locale:mt=void 0}=t,{interactive:Ct=!0}=t,{attributionControl:H=!0}=t,{cooperativeGestures:ft=!1}=t,{preserveDrawingBuffer:Kt=!1}=t,{maxBounds:St=void 0}=t,{images:Zt=[]}=t,{standardControls:ee=!1}=t,{filterLayers:qt=void 0}=t,{transformRequest:Oe=void 0}=t;const we=qu(),{map:un,loadedImages:Ge}=lO();Pe(e,un,Qt=>n(4,a=Qt)),Pe(e,Ge,Qt=>n(5,h=Qt));let Me=new Set;async function hn(Qt,gt=!1){if(a&&!(!a.loaded()&&!gt))if("url"in Qt){Me.add(Qt.id);try{let Tt=await a.loadImage(Qt.url);a==null||a.addImage(Qt.id,Tt.data,Qt.options),h.add(Qt.id),Ge.set(h)}catch(Tt){we("error",Tt)}finally{Me.delete(Qt.id)}}else a.addImage(Qt.id,Qt.data,Qt.options),h.add(Qt.id),Ge.set(h)}let Cn,gn,yn,An;function xr(Qt){return wr(),Wn(un,a=new Es.Map(Vc({container:Qt,style:P,locale:mt,center:N,zoom:G,pitch:Y,bearing:et,minZoom:ot,maxZoom:_t,antialias:st,interactive:Ct,preserveDrawingBuffer:Kt,maxBounds:St,bounds:V,attributionControl:H,transformRequest:Oe,cooperativeGestures:ft})),a),a.on("load",gt=>{gt.target.getContainer().setAttribute("data-testid","map"),gt.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,X=!0),we("load",a)}),a.on("error",gt=>we("error",{...gt,map:a})),a.on("movestart",gt=>we("movestart",{...gt,map:a})),a.on("moveend",gt=>{if(n(12,N=gt.target.getCenter()),n(13,G=gt.target.getZoom()),n(14,V=gt.target.getBounds()),we("moveend",{...gt,map:a}),j){let Tt=window.location.href.replace(/(#.+)?$/,NO(a));window.history.replaceState(window.history.state,"",Tt)}}),a.on("click",gt=>we("click",{...gt,map:a})),a.on("dblclick",gt=>we("dblclick",{...gt,map:a})),a.on("contextmenu",gt=>we("contextmenu",{...gt,map:a})),a.on("zoomstart",gt=>we("zoomstart",{...gt,map:a})),a.on("zoom",gt=>{n(13,G=gt.target.getZoom()),we("zoom",{...gt,map:a})}),a.on("zoomend",gt=>{n(13,G=gt.target.getZoom()),we("zoomend",{...gt,map:a})}),a.on("style.load",()=>{if(a){const gt=a.getStyle();if(n(35,Cn=gt.layers.map(Tt=>Tt.id)),n(36,gn=Object.keys(gt.sources)),An)for(const[Tt,Ie]of Object.entries(An))a.addSource(Tt,Ie);if(yn)for(const Tt of yn)a.addLayer(Tt);for(const Tt of Zt)hn(Tt,!0)}}),a.on("styledata",gt=>{if(a&&qt){const Tt=a.getStyle().layers;if(Tt)for(let Ie of Tt)qt(Ie)||a.setLayoutProperty(Ie.id,"visibility","none")}we("styledata",{...gt,map:a})}),{destroy(){n(0,X=!1),a==null||a.remove(),Wn(un,a=null,a)}}}let Ar=P;function wr(){if(j){let Qt=OO(window.location.hash);Qt.length>=3&&(n(13,G=Qt[0]),n(12,N=[Qt[2],Qt[1]])),Qt.length==5&&(n(17,et=Qt[3]),n(16,Y=Qt[4]))}}function pr(Qt){Jn[Qt?"unshift":"push"](()=>{S=Qt,n(1,S)})}return e.$$set=Qt=>{"map"in Qt&&n(15,w=Qt.map),"mapContainer"in Qt&&n(1,S=Qt.mapContainer),"class"in Qt&&n(2,I=Qt.class),"style"in Qt&&n(18,P=Qt.style),"diffStyleUpdates"in Qt&&n(19,D=Qt.diffStyleUpdates),"center"in Qt&&n(12,N=Qt.center),"zoom"in Qt&&n(13,G=Qt.zoom),"pitch"in Qt&&n(16,Y=Qt.pitch),"bearing"in Qt&&n(17,et=Qt.bearing),"bounds"in Qt&&n(14,V=Qt.bounds),"hash"in Qt&&n(20,j=Qt.hash),"loaded"in Qt&&n(0,X=Qt.loaded),"minZoom"in Qt&&n(21,ot=Qt.minZoom),"maxZoom"in Qt&&n(22,_t=Qt.maxZoom),"antialias"in Qt&&n(23,st=Qt.antialias),"zoomOnDoubleClick"in Qt&&n(24,ct=Qt.zoomOnDoubleClick),"locale"in Qt&&n(25,mt=Qt.locale),"interactive"in Qt&&n(26,Ct=Qt.interactive),"attributionControl"in Qt&&n(27,H=Qt.attributionControl),"cooperativeGestures"in Qt&&n(28,ft=Qt.cooperativeGestures),"preserveDrawingBuffer"in Qt&&n(29,Kt=Qt.preserveDrawingBuffer),"maxBounds"in Qt&&n(30,St=Qt.maxBounds),"images"in Qt&&n(31,Zt=Qt.images),"standardControls"in Qt&&n(3,ee=Qt.standardControls),"filterLayers"in Qt&&n(32,qt=Qt.filterLayers),"transformRequest"in Qt&&n(33,Oe=Qt.transformRequest),"$$scope"in Qt&&n(38,g=Qt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&8&&n(7,r=typeof ee=="boolean"?void 0:ee),e.$$.dirty[0]&16&&n(15,w=a),e.$$.dirty[0]&786448|e.$$.dirty[1]&112&&a&&!yg(P,Ar)){const Qt=a.getStyle();if(Cn&&(yn=Qt.layers.filter(gt=>!Cn.includes(gt.id))),gn){const gt=Object.keys(Qt.sources).filter(Tt=>!gn.includes(Tt));An={};for(const Tt of gt)An[Tt]=Qt.sources[Tt]}n(37,Ar=P),a.setStyle(P,{diff:D}),Wn(Ge,h=new Set,h),n(34,Me=new Set)}if(e.$$.dirty[0]&49|e.$$.dirty[1]&9&&X&&a!=null&&a.loaded())for(let Qt of Zt)!h.has(Qt.id)&&!Me.has(Qt.id)&&!a.hasImage(Qt.id)&&hn(Qt);e.$$.dirty[0]&32|e.$$.dirty[1]&1&&n(6,i=Zt.every(Qt=>h.has(Qt.id))),e.$$.dirty[0]&4112&&N&&!yg(N,a==null?void 0:a.getCenter())&&(a==null||a.panTo(N)),e.$$.dirty[0]&8208&&G&&!yg(G,a==null?void 0:a.getZoom())&&(a==null||a.zoomTo(G)),e.$$.dirty[0]&16400&&V&&!yg(V,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(V)),e.$$.dirty[0]&16777232&&(ct?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[X,S,I,ee,a,h,i,r,un,Ge,xr,wr,N,G,V,w,Y,et,P,D,j,ot,_t,st,ct,mt,Ct,H,ft,Kt,St,Zt,qt,Oe,Me,Cn,gn,Ar,g,u,pr]}class WO extends tn{constructor(t){super(),$e(this,t,jO,qO,je,{map:15,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:16,bearing:17,bounds:14,hash:20,loaded:0,minZoom:21,maxZoom:22,antialias:23,zoomOnDoubleClick:24,locale:25,interactive:26,attributionControl:27,cooperativeGestures:28,preserveDrawingBuffer:29,maxBounds:30,images:31,standardControls:3,filterLayers:32,transformRequest:33},null,[-1,-1])}}const HO=e=>({marker:e&8}),Z2=e=>({marker:e[3]});function ZO(e){let t,n,r,i,a,h,u;const g=e[19].default,w=ei(g,e,e[18],Z2);return{c(){t=Ot("div"),w&&w.c(),Ut(t,"tabindex",n=e[1]?0:void 0),Ut(t,"role",r=e[1]?"button":void 0),Si(t,"z-index",e[2])},m(S,I){Rt(S,t,I),w&&w.m(t,null),a=!0,h||(u=[E0(e[7].call(null,t)),E0(i=XO.call(null,t,e[0])),Ze(t,"click",Z_(e[20])),Ze(t,"dblclick",Z_(e[21])),Ze(t,"contextmenu",Z_(e[22])),Ze(t,"mouseenter",e[23]),Ze(t,"mouseleave",e[24]),Ze(t,"mousemove",e[25]),Ze(t,"keydown",e[8])],h=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&ri(w,g,S,S[18],a?ni(g,S[18],I,HO):ii(S[18]),Z2),(!a||I&2&&n!==(n=S[1]?0:void 0))&&Ut(t,"tabindex",n),(!a||I&2&&r!==(r=S[1]?"button":void 0))&&Ut(t,"role",r),i&&gy(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Si(t,"z-index",S[2])},i(S){a||(bt(w,S),a=!0)},o(S){Lt(w,S),a=!1},d(S){S&&Dt(t),w&&w.d(S),h=!1,Ni(u)}}}function XO(e,t){const n=e.className;function r(i){i?e.className=`${n} ${i}`:e.className=n}return r(t),{update:r}}function YO(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{marker:g=void 0}=t,{lngLat:w}=t,{class:S=void 0}=t,{interactive:I=!0}=t,{asButton:P=!1}=t,{draggable:D=!1}=t,{feature:N=null}=t,{offset:G=void 0}=t,{zIndex:Y=void 0}=t,{rotation:et=0}=t,{opacity:V=1}=t;const j=qu(),{map:X,layerEvent:ot,self:_t}=hO();Pe(e,X,qt=>n(27,a=qt)),Pe(e,ot,qt=>n(26,r=qt)),Pe(e,_t,qt=>n(3,i=qt));function st(qt){Wn(_t,i=new Es.Marker({element:qt,rotation:et,draggable:D,offset:G,opacity:V.toString()}).setLngLat(w).addTo(a),i),n(11,g=i);const Oe=()=>Ct("dragstart"),we=()=>{ct(),Ct("drag")},un=()=>{ct(),Ct("dragend")};return D&&(i.on("dragstart",Oe),i.on("drag",we),i.on("dragend",un)),{destroy(){D&&(i==null||i.off("dragstart",Oe),i==null||i.off("drag",we),i==null||i.off("dragend",un)),n(11,g=void 0),i==null||i.remove()}}}function ct(){let qt=i==null?void 0:i.getLngLat();qt&&(Array.isArray(w)?n(10,w=[qt.lng,qt.lat]):w&&"lon"in w?n(10,w={lon:qt.lng,lat:qt.lat}):n(10,w=qt))}function mt(qt){qt.key===" "&&(qt.preventDefault(),qt.stopPropagation(),Ct("click"))}function Ct(qt){if(!I)return;let Oe=i==null?void 0:i.getLngLat();if(!Oe)return;const we=[Oe.lng,Oe.lat];let un={map:a,marker:i,lngLat:we,features:[{type:"Feature",properties:(N==null?void 0:N.properties)??{},geometry:{type:"Point",coordinates:we}}]};Wn(ot,r={...un,layerType:"marker",type:qt},r),j(qt,un)}const H=()=>Ct("click"),ft=()=>Ct("dblclick"),Kt=()=>Ct("contextmenu"),St=qt=>{Ct("mouseenter")},Zt=()=>{Ct("mouseleave")},ee=()=>Ct("mousemove");return e.$$set=qt=>{"marker"in qt&&n(11,g=qt.marker),"lngLat"in qt&&n(10,w=qt.lngLat),"class"in qt&&n(0,S=qt.class),"interactive"in qt&&n(12,I=qt.interactive),"asButton"in qt&&n(1,P=qt.asButton),"draggable"in qt&&n(13,D=qt.draggable),"feature"in qt&&n(14,N=qt.feature),"offset"in qt&&n(15,G=qt.offset),"zIndex"in qt&&n(2,Y=qt.zIndex),"rotation"in qt&&n(16,et=qt.rotation),"opacity"in qt&&n(17,V=qt.opacity),"$$scope"in qt&&n(18,u=qt.$$scope)},e.$$.update=()=>{e.$$.dirty&1032&&(i==null||i.setLngLat(w)),e.$$.dirty&32776&&(i==null||i.setOffset(G??[0,0])),e.$$.dirty&65544&&(i==null||i.setRotation(et)),e.$$.dirty&131080&&(i==null||i.setOpacity(V.toString()))},[S,P,Y,i,X,ot,_t,st,mt,Ct,w,g,I,D,N,G,et,V,u,h,H,ft,Kt,St,Zt,ee]}class zd extends tn{constructor(t){super(),$e(this,t,YO,ZO,je,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const KO=e=>({}),X2=e=>({}),JO=e=>({}),Y2=e=>({}),QO=e=>({}),K2=e=>({});function $O(e){let t,n,r,i,a,h;const u=e[1].top,g=ei(u,e,e[0],K2),w=e[1].left,S=ei(w,e,e[0],Y2),I=e[1].main,P=ei(I,e,e[0],X2);return{c(){t=Ot("div"),g&&g.c(),n=fe(),r=Ot("div"),S&&S.c(),i=fe(),a=Ot("div"),P&&P.c(),Ut(t,"class","top svelte-mpick2"),Ut(r,"class","left svelte-mpick2"),Ut(a,"class","main svelte-mpick2")},m(D,N){Rt(D,t,N),g&&g.m(t,null),Rt(D,n,N),Rt(D,r,N),S&&S.m(r,null),Rt(D,i,N),Rt(D,a,N),P&&P.m(a,null),h=!0},p(D,[N]){g&&g.p&&(!h||N&1)&&ri(g,u,D,D[0],h?ni(u,D[0],N,QO):ii(D[0]),K2),S&&S.p&&(!h||N&1)&&ri(S,w,D,D[0],h?ni(w,D[0],N,JO):ii(D[0]),Y2),P&&P.p&&(!h||N&1)&&ri(P,I,D,D[0],h?ni(I,D[0],N,KO):ii(D[0]),X2)},i(D){h||(bt(g,D),bt(S,D),bt(P,D),h=!0)},o(D){Lt(g,D),Lt(S,D),Lt(P,D),h=!1},d(D){D&&(Dt(t),Dt(n),Dt(r),Dt(i),Dt(a)),g&&g.d(D),S&&S.d(D),P&&P.d(D)}}}function t5(e,t,n){let{$$slots:r={},$$scope:i}=t;return e.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class e5 extends tn{constructor(t){super(),$e(this,t,t5,$O,je,{})}}const n5=e=>({}),J2=e=>({}),r5=e=>({}),Q2=e=>({}),i5=e=>({}),$2=e=>({});function o5(e){let t,n,r,i,a,h;const u=e[4].top,g=ei(u,e,e[3],$2),w=e[4].sidebar,S=ei(w,e,e[3],Q2),I=e[4].map,P=ei(I,e,e[3],J2);return{c(){t=Ot("div"),g&&g.c(),n=fe(),r=Ot("div"),S&&S.c(),i=fe(),a=Ot("div"),P&&P.c()},m(D,N){Rt(D,t,N),g&&g.m(t,null),e[5](t),Rt(D,n,N),Rt(D,r,N),S&&S.m(r,null),e[6](r),Rt(D,i,N),Rt(D,a,N),P&&P.m(a,null),e[7](a),h=!0},p(D,[N]){g&&g.p&&(!h||N&8)&&ri(g,u,D,D[3],h?ni(u,D[3],N,i5):ii(D[3]),$2),S&&S.p&&(!h||N&8)&&ri(S,w,D,D[3],h?ni(w,D[3],N,r5):ii(D[3]),Q2),P&&P.p&&(!h||N&8)&&ri(P,I,D,D[3],h?ni(I,D[3],N,n5):ii(D[3]),J2)},i(D){h||(bt(g,D),bt(S,D),bt(P,D),h=!0)},o(D){Lt(g,D),Lt(S,D),Lt(P,D),h=!1},d(D){D&&(Dt(t),Dt(n),Dt(r),Dt(i),Dt(a)),g&&g.d(D),e[5](null),S&&S.d(D),e[6](null),P&&P.d(D),e[7](null)}}}function s5(e,t,n){let r,i,a;Pe(e,dv,I=>n(0,r=I)),Pe(e,mv,I=>n(1,i=I)),Pe(e,gv,I=>n(2,a=I));let{$$slots:h={},$$scope:u}=t;function g(I){Jn[I?"unshift":"push"](()=>{r=I,dv.set(r)})}function w(I){Jn[I?"unshift":"push"](()=>{i=I,mv.set(i)})}function S(I){Jn[I?"unshift":"push"](()=>{a=I,gv.set(a)})}return e.$$set=I=>{"$$scope"in I&&n(3,u=I.$$scope)},[r,i,a,u,h,g,w,S]}class Yf extends tn{constructor(t){super(),$e(this,t,s5,o5,je,{})}}let dv=or(null),mv=or(null),gv=or(null);function a5(e){let t,n;return t=new xv({props:{properties:e[3]}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&8&&(a.properties=r[3]),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function l5(e){let t,n;return t=new Zf({props:{openOn:"hover",$$slots:{default:[a5,({props:r})=>({3:r}),({props:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function u5(e){let t,n,r;function i(h){e[1](h)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Fy("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[l5]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new By({props:a}),Jn.push(()=>Eo(t,"hovered",i)),t.$on("click",e[2]),{c(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&16&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function c5(e,t,n){let{hovered:r=null}=t;function i(h){r=h,n(0,r)}const a=h=>window.open(Hl(h.detail.features[0].properties).osm_id,"_blank");return e.$$set=h=>{"hovered"in h&&n(0,r=h.hovered)},[r,i,a]}class CC extends tn{constructor(t){super(),$e(this,t,c5,u5,je,{hovered:0})}}function tS(e,t,n){const r=e.slice();return r[2]=t[n][0],r[3]=t[n][1],r}function eS(e,t,n){const r=e.slice();return r[6]=t[n],r}function nS(e){let t,n,r=oS(e[6])+"",i,a;return{c(){t=Ot("li"),n=Ot("a"),i=De(r),Ut(n,"href",a=e[6].properties.osm_id),Ut(n,"target","_blank")},m(h,u){Rt(h,t,u),kt(t,n),kt(n,i)},p(h,u){u&1&&r!==(r=oS(h[6])+"")&&$n(i,r),u&1&&a!==(a=h[6].properties.osm_id)&&Ut(n,"href",a)},d(h){h&&Dt(t)}}}function rS(e){let t,n,r=e[2]+"",i,a,h=e[3].length+"",u,g,w,S,I,P=ti(e[3]),D=[];for(let N=0;Ni[1].length-r[1].length),n}function oS(e){let t=e.properties.name||`a ${e.properties.amenity_kind}`;return e.properties.brand&&(t+=` (${e.properties.brand})`),e.properties.cuisine&&(t+=` (${e.properties.cuisine})`),t}function f5(e,t,n){let r,{gj:i}=t;return e.$$set=a=>{"gj"in a&&n(1,i=a.gj)},e.$$.update=()=>{e.$$.dirty&2&&n(0,r=i.features.filter(a=>"amenity_kind"in a.properties))},[r,i]}class TC extends tn{constructor(t){super(),$e(this,t,f5,h5,je,{gj:1})}}function p5(e){let t,n,r,i,a,h,u,g,w,S,I,P,D,N,G,Y,et,V,j,X,ot,_t,st,ct,mt,Ct;return{c(){t=Ot("nav"),n=Ot("ul"),r=Ot("li"),i=Ot("button"),i.textContent="Change study area",a=fe(),h=Ot("li"),u=Ot("button"),g=De("Isochrone"),S=fe(),I=Ot("li"),P=Ot("button"),D=De("Route"),G=fe(),Y=Ot("li"),et=Ot("button"),V=De("Score"),X=fe(),ot=Ot("li"),_t=Ot("button"),st=De("Debug network"),u.disabled=w=e[0].kind=="isochrone",P.disabled=N=e[0].kind=="route",et.disabled=j=e[0].kind=="score",_t.disabled=ct=e[0].kind=="debug"},m(H,ft){Rt(H,t,ft),kt(t,n),kt(n,r),kt(r,i),kt(n,a),kt(n,h),kt(h,u),kt(u,g),kt(n,S),kt(n,I),kt(I,P),kt(P,D),kt(n,G),kt(n,Y),kt(Y,et),kt(et,V),kt(n,X),kt(n,ot),kt(ot,_t),kt(_t,st),mt||(Ct=[Ze(i,"click",e[1]),Ze(u,"click",e[2]),Ze(P,"click",e[3]),Ze(et,"click",e[4]),Ze(_t,"click",e[5])],mt=!0)},p(H,[ft]){ft&1&&w!==(w=H[0].kind=="isochrone")&&(u.disabled=w),ft&1&&N!==(N=H[0].kind=="route")&&(P.disabled=N),ft&1&&j!==(j=H[0].kind=="score")&&(et.disabled=j),ft&1&&ct!==(ct=H[0].kind=="debug")&&(_t.disabled=ct)},i:ge,o:ge,d(H){H&&Dt(t),mt=!1,Ni(Ct)}}}function d5(e,t,n){let r;return Pe(e,Ys,w=>n(0,r=w)),[r,()=>Wn(Ys,r={kind:"title"},r),()=>Wn(Ys,r={kind:"isochrone"},r),()=>Wn(Ys,r={kind:"route"},r),()=>Wn(Ys,r={kind:"score"},r),()=>Wn(Ys,r={kind:"debug"},r)]}class Vy extends tn{constructor(t){super(),$e(this,t,d5,p5,je,{})}}function m5(e){let t,n,r,i,a,h,u,g,w;return{c(){t=Ot("label"),n=De(`Mode: + `),r=Ot("select"),i=Ot("option"),i.textContent="Car",a=Ot("option"),a.textContent="Bicycle",h=Ot("option"),h.textContent="Foot",u=Ot("option"),u.textContent="Public transit",i.__value="car",Go(i,i.__value),a.__value="bicycle",Go(a,a.__value),h.__value="foot",Go(h,h.__value),u.__value="transit",Go(u,u.__value),e[0]===void 0&&vd(()=>e[1].call(r))},m(S,I){Rt(S,t,I),kt(t,n),kt(t,r),kt(r,i),kt(r,a),kt(r,h),kt(r,u),Rg(r,e[0],!0),g||(w=Ze(r,"change",e[1]),g=!0)},p(S,[I]){I&1&&Rg(r,S[0])},i:ge,o:ge,d(S){S&&Dt(t),g=!1,w()}}}function g5(e,t,n){let{travelMode:r}=t;function i(){r=ZS(this),n(0,r)}return e.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class m1 extends tn{constructor(t){super(),$e(this,t,g5,m5,je,{travelMode:0})}}function sS(e,t,n){const r=e.slice();return r[3]=t[n],r}function y5(e){let t=e[6].name+"",n,r,i=JSON.parse(e[6].next_steps).length+"",a,h;return{c(){n=De(t),r=De(" has "),a=De(i),h=De(" next steps (arrivals)")},m(u,g){Rt(u,n,g),Rt(u,r,g),Rt(u,a,g),Rt(u,h,g)},p(u,g){g&64&&t!==(t=u[6].name+"")&&$n(n,t),g&64&&i!==(i=JSON.parse(u[6].next_steps).length+"")&&$n(a,i)},d(u){u&&(Dt(n),Dt(r),Dt(a),Dt(h))}}}function _5(e){let t,n;return t=new Zf({props:{openOn:"hover",$$slots:{default:[y5,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function aS(e){let t,n;return t=new JS({props:{$$slots:{default:[v5]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function lS(e){let t,n=JSON.stringify(e[3])+"",r;return{c(){t=Ot("p"),r=De(n)},m(i,a){Rt(i,t,a),kt(t,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&$n(r,n)},d(i){i&&Dt(t)}}}function v5(e){let t,n=ti(e[0]),r=[];for(let i=0;i{a=null}),Fn())},i(h){i||(bt(t.$$.fragment,h),bt(a),i=!0)},o(h){Lt(t.$$.fragment,h),Lt(a),i=!1},d(h){h&&(Dt(n),Dt(r)),ae(t,h),a&&a.d(h)}}}function x5(e,t,n){let r=null;return[r,h=>n(0,r=JSON.parse(Hl(h.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class w5 extends tn{constructor(t){super(),$e(this,t,x5,b5,je,{})}}function S5(e){let t,n,r;return n=new Vy({}),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"slot","top")},m(i,a){Rt(i,t,a),se(n,t,null),r=!0},p:ge,i(i){r||(bt(n.$$.fragment,i),r=!0)},o(i){Lt(n.$$.fragment,i),r=!1},d(i){i&&Dt(t),ae(n)}}}function uS(e){let t,n;return t=new TC({props:{gj:e[0]}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function E5(e){let t,n,r,i,a,h,u,g,w;function S(D){e[3](D)}let I={};e[1]!==void 0&&(I.travelMode=e[1]),h=new m1({props:I}),Jn.push(()=>Eo(h,"travelMode",S));let P=e[0]&&uS(e);return{c(){t=Ot("div"),n=Ot("h2"),n.textContent="Debug mode",r=fe(),i=Ot("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=fe(),le(h.$$.fragment),g=fe(),P&&P.c(),Ut(t,"slot","sidebar")},m(D,N){Rt(D,t,N),kt(t,n),kt(t,r),kt(t,i),kt(t,a),se(h,t,null),kt(t,g),P&&P.m(t,null),w=!0},p(D,N){const G={};!u&&N&2&&(u=!0,G.travelMode=D[1],So(()=>u=!1)),h.$set(G),D[0]?P?(P.p(D,N),N&1&&bt(P,1)):(P=uS(D),P.c(),bt(P,1),P.m(t,null)):P&&(zn(),Lt(P,1,1,()=>{P=null}),Fn())},i(D){w||(bt(h.$$.fragment,D),bt(P),w=!0)},o(D){Lt(h.$$.fragment,D),Lt(P),w=!1},d(D){D&&Dt(t),ae(h),P&&P.d()}}}function cS(e){let t,n;return t=new nu({props:{data:e[0],generateId:!0,$$slots:{default:[T5]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&1&&(a.data=r[0]),i&66&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function I5(e){let t,n;return t=new xv({props:{properties:e[5]}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function C5(e){let t,n;return t=new Zf({props:{openOn:"hover",$$slots:{default:[I5,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function T5(e){let t,n,r,i,a,h;return t=new Yc({props:{id:"network",paint:{"line-width":Fy(5,7),"line-color":"black"},filter:ux(e[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[C5]},$$scope:{ctx:e}}}),t.$on("click",e[2]),r=new CC({}),a=new w5({}),{c(){le(t.$$.fragment),n=fe(),le(r.$$.fragment),i=fe(),le(a.$$.fragment)},m(u,g){se(t,u,g),Rt(u,n,g),se(r,u,g),Rt(u,i,g),se(a,u,g),h=!0},p(u,g){const w={};g&2&&(w.filter=ux(u[1])),g&64&&(w.$$scope={dirty:g,ctx:u}),t.$set(w)},i(u){h||(bt(t.$$.fragment,u),bt(r.$$.fragment,u),bt(a.$$.fragment,u),h=!0)},o(u){Lt(t.$$.fragment,u),Lt(r.$$.fragment,u),Lt(a.$$.fragment,u),h=!1},d(u){u&&(Dt(n),Dt(i)),ae(t,u),ae(r,u),ae(a,u)}}}function L5(e){let t,n,r=e[0]&&cS(e);return{c(){t=Ot("div"),r&&r.c(),Ut(t,"slot","map")},m(i,a){Rt(i,t,a),r&&r.m(t,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&bt(r,1)):(r=cS(i),r.c(),bt(r,1),r.m(t,null)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d()}}}function P5(e){let t,n;return t=new Yf({props:{$$slots:{map:[L5],sidebar:[E5],top:[S5]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function M5(e,t,n){let r,i;Pe(e,Au,g=>n(4,r=g)),Pe(e,hf,g=>n(1,i=g));let a=null;Gu(async()=>{n(0,a=await r.renderDebug())});const h=g=>window.open(Hl(g.detail.features[0].properties).way,"_blank");function u(g){i=g,hf.set(i)}return[a,i,h,u]}class A5 extends tn{constructor(t){super(),$e(this,t,M5,P5,je,{})}}const Fd=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"];function k5(e){let t,n,r;return n=new Vy({}),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"slot","top")},m(i,a){Rt(i,t,a),se(n,t,null),r=!0},p:ge,i(i){r||(bt(n.$$.fragment,i),r=!0)},o(i){Lt(n.$$.fragment,i),r=!1},d(i){i&&Dt(t),ae(n)}}}function hS(e){let t,n;return{c(){t=Ot("p"),n=De(e[7])},m(r,i){Rt(r,t,i),kt(t,n)},p(r,i){i&128&&$n(n,r[7])},d(r){r&&Dt(t)}}}function fS(e){let t,n;return t=new TC({props:{gj:e[5]}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5]),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function D5(e){let t,n,r,i,a,h,u,g,w,S,I,P,D,N,G,Y,et,V,j,X,ot,_t,st;function ct(ft){e[12](ft)}let mt={};e[4]!==void 0&&(mt.travelMode=e[4]),h=new m1({props:mt}),Jn.push(()=>Eo(h,"travelMode",ct)),V=new QS({props:{colorScale:Fd,limits:e[8]}});let Ct=e[7]&&hS(e),H=e[5]&&fS(e);return{c(){t=Ot("div"),n=Ot("h2"),n.textContent="Isochrone mode",r=fe(),i=Ot("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time + in seconds.`,a=fe(),le(h.$$.fragment),g=fe(),w=Ot("label"),S=De(`Start time (PT only) + `),I=Ot("input"),D=fe(),N=Ot("label"),G=Ot("input"),Y=De("Contours"),et=fe(),le(V.$$.fragment),j=fe(),Ct&&Ct.c(),X=fe(),H&&H.c(),Ut(I,"type","time"),I.disabled=P=e[4]!="transit",Ut(G,"type","checkbox"),Ut(t,"slot","sidebar")},m(ft,Kt){Rt(ft,t,Kt),kt(t,n),kt(t,r),kt(t,i),kt(t,a),se(h,t,null),kt(t,g),kt(t,w),kt(w,S),kt(w,I),Go(I,e[3]),kt(t,D),kt(t,N),kt(N,G),G.checked=e[1],kt(N,Y),kt(t,et),se(V,t,null),kt(t,j),Ct&&Ct.m(t,null),kt(t,X),H&&H.m(t,null),ot=!0,_t||(st=[Ze(I,"input",e[13]),Ze(G,"change",e[14])],_t=!0)},p(ft,Kt){const St={};!u&&Kt&16&&(u=!0,St.travelMode=ft[4],So(()=>u=!1)),h.$set(St),(!ot||Kt&16&&P!==(P=ft[4]!="transit"))&&(I.disabled=P),Kt&8&&Go(I,ft[3]),Kt&2&&(G.checked=ft[1]),ft[7]?Ct?Ct.p(ft,Kt):(Ct=hS(ft),Ct.c(),Ct.m(t,X)):Ct&&(Ct.d(1),Ct=null),ft[5]?H?(H.p(ft,Kt),Kt&32&&bt(H,1)):(H=fS(ft),H.c(),bt(H,1),H.m(t,null)):H&&(zn(),Lt(H,1,1,()=>{H=null}),Fn())},i(ft){ot||(bt(h.$$.fragment,ft),bt(V.$$.fragment,ft),bt(H),ot=!0)},o(ft){Lt(h.$$.fragment,ft),Lt(V.$$.fragment,ft),Lt(H),ot=!1},d(ft){ft&&Dt(t),ae(h),ae(V),Ct&&Ct.d(),H&&H.d(),_t=!1,Ni(st)}}}function pS(e){let t,n,r;function i(h){e[10](h)}let a={draggable:!0,$$slots:{default:[R5]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.lngLat=e[0]),t=new zd({props:a}),Jn.push(()=>Eo(t,"lngLat",i)),{c(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,u){const g={};u&524288&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.lngLat=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function R5(e){let t;return{c(){t=Ot("span"),t.textContent="X",Ut(t,"class","dot svelte-1ej0v4r")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function dS(e){let t,n;return t=new nu({props:{data:e[5],$$slots:{default:[z5]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&524292&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function N5(e){let t=(e[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=De(t),r=De(" minutes away")},m(i,a){Rt(i,n,a),Rt(i,r,a)},p(i,a){a&262144&&t!==(t=(i[18].cost_seconds/60).toFixed(1)+"")&&$n(n,t)},d(i){i&&(Dt(n),Dt(r))}}}function O5(e){let t,n;return t=new Zf({props:{openOn:"hover",$$slots:{default:[N5,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&786432&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function z5(e){let t,n,r,i,a,h,u;t=new Yc({props:{id:"isochrone",filter:oO,paint:{"line-width":20,"line-color":pv(["get","cost_seconds"],e[9],Fd),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[O5]},$$scope:{ctx:e}}}),r=new IC({props:{id:"isochrone-contours",filter:iO,paint:{"fill-color":pv(["get","min_seconds"],e[9],Fd),"fill-opacity":.5}}});function g(S){e[11](S)}let w={};return e[2]!==void 0&&(w.hovered=e[2]),a=new CC({props:w}),Jn.push(()=>Eo(a,"hovered",g)),{c(){le(t.$$.fragment),n=fe(),le(r.$$.fragment),i=fe(),le(a.$$.fragment)},m(S,I){se(t,S,I),Rt(S,n,I),se(r,S,I),Rt(S,i,I),se(a,S,I),u=!0},p(S,I){const P={};I&524288&&(P.$$scope={dirty:I,ctx:S}),t.$set(P);const D={};!h&&I&4&&(h=!0,D.hovered=S[2],So(()=>h=!1)),a.$set(D)},i(S){u||(bt(t.$$.fragment,S),bt(r.$$.fragment,S),bt(a.$$.fragment,S),u=!0)},o(S){Lt(t.$$.fragment,S),Lt(r.$$.fragment,S),Lt(a.$$.fragment,S),u=!1},d(S){S&&(Dt(n),Dt(i)),ae(t,S),ae(r,S),ae(a,S)}}}function mS(e){let t,n;return t=new nu({props:{data:e[6],$$slots:{default:[F5]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&524288&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function F5(e){let t,n;return t=new Yc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function B5(e){let t,n,r,i,a=e[0]&&pS(e),h=e[5]&&dS(e),u=e[6]&&mS(e);return{c(){t=Ot("div"),a&&a.c(),n=fe(),h&&h.c(),r=fe(),u&&u.c(),Ut(t,"slot","map")},m(g,w){Rt(g,t,w),a&&a.m(t,null),kt(t,n),h&&h.m(t,null),kt(t,r),u&&u.m(t,null),i=!0},p(g,w){g[0]?a?(a.p(g,w),w&1&&bt(a,1)):(a=pS(g),a.c(),bt(a,1),a.m(t,n)):a&&(zn(),Lt(a,1,1,()=>{a=null}),Fn()),g[5]?h?(h.p(g,w),w&32&&bt(h,1)):(h=dS(g),h.c(),bt(h,1),h.m(t,r)):h&&(zn(),Lt(h,1,1,()=>{h=null}),Fn()),g[6]?u?(u.p(g,w),w&64&&bt(u,1)):(u=mS(g),u.c(),bt(u,1),u.m(t,null)):u&&(zn(),Lt(u,1,1,()=>{u=null}),Fn())},i(g){i||(bt(a),bt(h),bt(u),i=!0)},o(g){Lt(a),Lt(h),Lt(u),i=!1},d(g){g&&Dt(t),a&&a.d(),h&&h.d(),u&&u.d()}}}function V5(e){let t,n;return t=new Yf({props:{$$slots:{map:[B5],sidebar:[D5],top:[k5]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&524543&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function gS(e,t,n){return t+e*(n-t)}function U5(e,t,n){let r,i,a;Pe(e,Bg,ot=>n(3,r=ot)),Pe(e,hf,ot=>n(4,i=ot)),Pe(e,Au,ot=>n(15,a=ot));let h=null;Gu(async()=>{let ot=await a.getBounds();n(0,h={lng:gS(.5,ot[0],ot[2]),lat:gS(.5,ot[1],ot[3])})});let u=!0,g=null,w=null,S="",I;async function P(ot,_t,st,ct){if(h)try{n(5,g=await a.isochrone({start:h,mode:i,contours:u,startTime:r})),n(7,S="")}catch(mt){n(5,g=null),mt=mt.toString()}}async function D(ot,_t,st){if(h&&I)try{n(6,w=await a.route({start:h,end:I.geometry.coordinates,mode:i,debugSearch:!1,useHeuristic:!1,startTime:r})),n(7,S="")}catch(ct){n(6,w=null),ct=ct.toString()}else n(6,w=null)}let N=[0,3,6,9,12,15],G=N.map(ot=>ot*60);function Y(ot){h=ot,n(0,h)}function et(ot){I=ot,n(2,I)}function V(ot){i=ot,hf.set(i)}function j(){r=this.value,Bg.set(r)}function X(){u=this.checked,n(1,u)}return e.$$.update=()=>{e.$$.dirty&27&&P(),e.$$.dirty&13&&D()},[h,u,I,r,i,g,w,S,N,G,Y,et,V,j,X]}class G5 extends tn{constructor(t){super(),$e(this,t,U5,V5,je,{})}}function yS(e,t,n){const r=e.slice();r[18]=t[n];const i=Hl(r[18].properties);return r[17]=i,r}function q5(e){let t,n,r;return n=new Vy({}),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"slot","top")},m(i,a){Rt(i,t,a),se(n,t,null),r=!0},p:ge,i(i){r||(bt(n.$$.fragment,i),r=!0)},o(i){Lt(n.$$.fragment,i),r=!1},d(i){i&&Dt(t),ae(n)}}}function j5(e){let t,n,r,i,a,h=ti(e[5].features),u=[];for(let g=0;gEo(i,"travelMode",_t));function ct(H,ft){if(H[6])return W5;if(H[5])return j5}let mt=ct(e),Ct=mt&&mt(e);return{c(){t=Ot("div"),n=Ot("h2"),n.textContent="Route mode",r=fe(),le(i.$$.fragment),h=fe(),u=Ot("label"),g=Ot("input"),S=De(` + Use heuristic (PT only)`),I=fe(),P=Ot("label"),D=De(`Start time (PT only) + `),N=Ot("input"),Y=fe(),et=Ot("p"),et.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to + set the first pin somewhere.)`,V=fe(),Ct&&Ct.c(),Ut(g,"type","checkbox"),g.disabled=w=e[4]!="transit",Ut(N,"type","time"),N.disabled=G=e[4]!="transit",Ut(t,"slot","sidebar")},m(H,ft){Rt(H,t,ft),kt(t,n),kt(t,r),se(i,t,null),kt(t,h),kt(t,u),kt(u,g),g.checked=e[3],kt(u,S),kt(t,I),kt(t,P),kt(P,D),kt(P,N),Go(N,e[2]),kt(t,Y),kt(t,et),kt(t,V),Ct&&Ct.m(t,null),j=!0,X||(ot=[Ze(g,"change",e[12]),Ze(N,"input",e[13])],X=!0)},p(H,ft){const Kt={};!a&&ft&16&&(a=!0,Kt.travelMode=H[4],So(()=>a=!1)),i.$set(Kt),(!j||ft&16&&w!==(w=H[4]!="transit"))&&(g.disabled=w),ft&8&&(g.checked=H[3]),(!j||ft&16&&G!==(G=H[4]!="transit"))&&(N.disabled=G),ft&4&&Go(N,H[2]),mt===(mt=ct(H))&&Ct?Ct.p(H,ft):(Ct&&Ct.d(1),Ct=mt&&mt(H),Ct&&(Ct.c(),Ct.m(t,null)))},i(H){j||(bt(i.$$.fragment,H),j=!0)},o(H){Lt(i.$$.fragment,H),j=!1},d(H){H&&Dt(t),ae(i),Ct&&Ct.d(),X=!1,Ni(ot)}}}function J5(e){let t;return{c(){t=Ot("span"),t.textContent="A",Ut(t,"class","dot svelte-1ej0v4r")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function Q5(e){let t;return{c(){t=Ot("span"),t.textContent="B",Ut(t,"class","dot svelte-1ej0v4r")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function vS(e){let t,n;return t=new nu({props:{data:e[5],generateId:!0,$$slots:{default:[ez]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function $5(e){let t,n;return t=new xv({props:{properties:e[17]}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&131072&&(a.properties=r[17]),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function tz(e){let t,n;return t=new Zf({props:{openOn:"hover",$$slots:{default:[$5,({props:r})=>({17:r}),({props:r})=>r?131072:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&2228224&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function ez(e){let t,n;return t=new Yc({props:{id:"route",paint:{"line-width":20,"line-color":h1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Fy(.5,1)},manageHoverState:!0,$$slots:{default:[tz]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function nz(e){let t,n,r,i,a,h,u,g,w,S;n=new RO({}),n.$on("contextmenu",e[7]);function I(Y){e[9](Y)}let P={draggable:!0,$$slots:{default:[J5]},$$scope:{ctx:e}};e[1]!==void 0&&(P.lngLat=e[1]),i=new zd({props:P}),Jn.push(()=>Eo(i,"lngLat",I));function D(Y){e[10](Y)}let N={draggable:!0,$$slots:{default:[Q5]},$$scope:{ctx:e}};e[0]!==void 0&&(N.lngLat=e[0]),u=new zd({props:N}),Jn.push(()=>Eo(u,"lngLat",D));let G=e[5]&&vS(e);return{c(){t=Ot("div"),le(n.$$.fragment),r=fe(),le(i.$$.fragment),h=fe(),le(u.$$.fragment),w=fe(),G&&G.c(),Ut(t,"slot","map")},m(Y,et){Rt(Y,t,et),se(n,t,null),kt(t,r),se(i,t,null),kt(t,h),se(u,t,null),kt(t,w),G&&G.m(t,null),S=!0},p(Y,et){const V={};et&2097152&&(V.$$scope={dirty:et,ctx:Y}),!a&&et&2&&(a=!0,V.lngLat=Y[1],So(()=>a=!1)),i.$set(V);const j={};et&2097152&&(j.$$scope={dirty:et,ctx:Y}),!g&&et&1&&(g=!0,j.lngLat=Y[0],So(()=>g=!1)),u.$set(j),Y[5]?G?(G.p(Y,et),et&32&&bt(G,1)):(G=vS(Y),G.c(),bt(G,1),G.m(t,null)):G&&(zn(),Lt(G,1,1,()=>{G=null}),Fn())},i(Y){S||(bt(n.$$.fragment,Y),bt(i.$$.fragment,Y),bt(u.$$.fragment,Y),bt(G),S=!0)},o(Y){Lt(n.$$.fragment,Y),Lt(i.$$.fragment,Y),Lt(u.$$.fragment,Y),Lt(G),S=!1},d(Y){Y&&Dt(t),ae(n),ae(i),ae(u),G&&G.d()}}}function rz(e){let t,n;return t=new Yf({props:{$$slots:{map:[nz],sidebar:[K5],top:[q5]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&2097279&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function iz(e,t,n){let r,i,a,h,u,g,w;Pe(e,ff,X=>n(0,r=X)),Pe(e,Ec,X=>n(1,i=X)),Pe(e,Ys,X=>n(14,a=X)),Pe(e,Bg,X=>n(2,h=X)),Pe(e,cx,X=>n(3,u=X)),Pe(e,hf,X=>n(4,g=X)),Pe(e,Au,X=>n(15,w=X));let S=null,I="";async function P(X,ot,_t,st,ct){try{n(5,S=await w.route({start:X,end:[ot.lng,ot.lat],mode:_t,debugSearch:!1,useHeuristic:u,startTime:h})),n(6,I="")}catch(mt){n(5,S=null),n(6,I=mt.toString())}}function D(X){Wn(Ec,i=X.detail.lngLat,i)}async function N(){try{let X=await w.route({start:i,end:[r.lng,r.lat],mode:g,debugSearch:!0,useHeuristic:u,startTime:h});Wn(Ys,a={kind:"debug-route",debugGj:X,start:i,end:r,routeGj:S},a)}catch(X){n(6,I=X.toString())}}function G(X){i=X,Ec.set(i)}function Y(X){r=X,ff.set(r)}function et(X){g=X,hf.set(g)}function V(){u=this.checked,cx.set(u)}function j(){h=this.value,Bg.set(h)}return e.$$.update=()=>{e.$$.dirty&31&&P(i,r,g)},[r,i,h,u,g,S,I,D,N,G,Y,et,V,j]}class oz extends tn{constructor(t){super(),$e(this,t,iz,rz,je,{})}}function sz(e){let t,n,r,i;return{c(){t=Ot("div"),n=Ot("button"),n.textContent="Back",Ut(t,"slot","top")},m(a,h){Rt(a,t,h),kt(t,n),r||(i=Ze(n,"click",e[10]),r=!0)},p:ge,d(a){a&&Dt(t),r=!1,i()}}}function az(e){let t,n,r,i,a,h,u,g,w,S=Hl(e[4].features[e[4].features.length-1].properties).time+"",I,P,D;return{c(){t=Ot("div"),n=Ot("h2"),n.textContent="Debugging a route",r=fe(),i=Ot("p"),i.textContent=`${e[6]} total nodes searched`,a=fe(),h=Ot("input"),u=fe(),g=Ot("p"),w=De("Search is currently at "),I=De(S),Ut(h,"type","range"),Ut(h,"min","1"),Ut(h,"max",e[6]),Ut(t,"slot","sidebar")},m(N,G){Rt(N,t,G),kt(t,n),kt(t,r),kt(t,i),kt(t,a),kt(t,h),Go(h,e[3]),kt(t,u),kt(t,g),kt(g,w),kt(g,I),P||(D=[Ze(h,"change",e[9]),Ze(h,"input",e[9])],P=!0)},p(N,G){G&8&&Go(h,N[3]),G&16&&S!==(S=Hl(N[4].features[N[4].features.length-1].properties).time+"")&&$n(I,S)},d(N){N&&Dt(t),P=!1,Ni(D)}}}function lz(e){let t;return{c(){t=Ot("span"),t.textContent="A",Ut(t,"class","dot svelte-1ej0v4r")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function uz(e){let t;return{c(){t=Ot("span"),t.textContent="B",Ut(t,"class","dot svelte-1ej0v4r")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function cz(e){let t,n;return t=new Yc({props:{paint:{"line-width":20,"line-color":h1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function hz(e){let t,n,r,i;return t=new By({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new Yc({props:{paint:{"line-width":5,"line-color":h1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){le(t.$$.fragment),n=fe(),le(r.$$.fragment)},m(a,h){se(t,a,h),Rt(a,n,h),se(r,a,h),i=!0},p:ge,i(a){i||(bt(t.$$.fragment,a),bt(r.$$.fragment,a),i=!0)},o(a){Lt(t.$$.fragment,a),Lt(r.$$.fragment,a),i=!1},d(a){a&&Dt(n),ae(t,a),ae(r,a)}}}function fz(e){let t,n,r,i,a,h,u,g,w;return n=new zd({props:{lngLat:e[0],$$slots:{default:[lz]},$$scope:{ctx:e}}}),i=new zd({props:{lngLat:e[1],$$slots:{default:[uz]},$$scope:{ctx:e}}}),h=new nu({props:{data:e[2],$$slots:{default:[cz]},$$scope:{ctx:e}}}),g=new nu({props:{data:e[4],generateId:!0,$$slots:{default:[hz]},$$scope:{ctx:e}}}),{c(){t=Ot("div"),le(n.$$.fragment),r=fe(),le(i.$$.fragment),a=fe(),le(h.$$.fragment),u=fe(),le(g.$$.fragment),Ut(t,"slot","map")},m(S,I){Rt(S,t,I),se(n,t,null),kt(t,r),se(i,t,null),kt(t,a),se(h,t,null),kt(t,u),se(g,t,null),w=!0},p(S,I){const P={};I&1&&(P.lngLat=S[0]),I&4096&&(P.$$scope={dirty:I,ctx:S}),n.$set(P);const D={};I&2&&(D.lngLat=S[1]),I&4096&&(D.$$scope={dirty:I,ctx:S}),i.$set(D);const N={};I&4&&(N.data=S[2]),I&4096&&(N.$$scope={dirty:I,ctx:S}),h.$set(N);const G={};I&16&&(G.data=S[4]),I&4096&&(G.$$scope={dirty:I,ctx:S}),g.$set(G)},i(S){w||(bt(n.$$.fragment,S),bt(i.$$.fragment,S),bt(h.$$.fragment,S),bt(g.$$.fragment,S),w=!0)},o(S){Lt(n.$$.fragment,S),Lt(i.$$.fragment,S),Lt(h.$$.fragment,S),Lt(g.$$.fragment,S),w=!1},d(S){S&&Dt(t),ae(n),ae(i),ae(h),ae(g)}}}function pz(e){let t,n,r,i;return t=new Yf({props:{$$slots:{map:[fz],sidebar:[az],top:[sz]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(a,h){se(t,a,h),n=!0,r||(i=Ze(window,"keydown",e[7]),r=!0)},p(a,[h]){const u={};h&4159&&(u.$$scope={dirty:h,ctx:a}),t.$set(u)},i(a){n||(bt(t.$$.fragment,a),n=!0)},o(a){Lt(t.$$.fragment,a),n=!1},d(a){ae(t,a),r=!1,i()}}}function dz(e,t,n){let r,i,a;Pe(e,yy,G=>n(11,i=G)),Pe(e,Ys,G=>n(5,a=G));let{debugGj:h}=t,{start:u}=t,{end:g}=t,{routeGj:w}=t,S=h.features.length/2,I=1;function P(G){G.key=="ArrowLeft"&&I>1&&(G.stopPropagation(),n(3,I--,I)),G.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),as(()=>{i==null||i.keyboard.enable()});function D(){I=GL(this.value),n(3,I)}const N=()=>Wn(Ys,a={kind:"route"},a);return e.$$set=G=>{"debugGj"in G&&n(8,h=G.debugGj),"start"in G&&n(0,u=G.start),"end"in G&&n(1,g=G.end),"routeGj"in G&&n(2,w=G.routeGj)},e.$$.update=()=>{e.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:h.features.slice(0,2*I)})},[u,g,w,I,r,a,S,P,h,D,N]}class mz extends tn{constructor(t){super(),$e(this,t,dz,pz,je,{debugGj:8,start:0,end:1,routeGj:2})}}function gz(e){let t,n,r;return n=new Vy({}),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"slot","top")},m(i,a){Rt(i,t,a),se(n,t,null),r=!0},p:ge,i(i){r||(bt(n.$$.fragment,i),r=!0)},o(i){Lt(n.$$.fragment,i),r=!1},d(i){i&&Dt(t),ae(n)}}}function yz(e){let t,n,r,i,a,h,u;return h=new QS({props:{colorScale:Fd,limits:e[3]}}),{c(){t=Ot("div"),n=Ot("h2"),n.textContent="Score mode",r=fe(),i=Ot("p"),i.textContent=`This is an early experiment of a mode to show an "access score". Right + now, it's starting from every POI of a few fixed types (cafe, pub, + restaurant, bank, nightclub) and walking up to one minute to the nearest + bicycle parking. This is a simple way of showing POIs without any nearby + parking. Note the granularity of results is poor; the search begins and + ends at the nearest intersection, and the time to walk doesn't take into + account the side of the road or walking partly down some road.`,a=fe(),le(h.$$.fragment),Ut(t,"slot","sidebar")},m(g,w){Rt(g,t,w),kt(t,n),kt(t,r),kt(t,i),kt(t,a),se(h,t,null),u=!0},p:ge,i(g){u||(bt(h.$$.fragment,g),u=!0)},o(g){Lt(h.$$.fragment,g),u=!1},d(g){g&&Dt(t),ae(h)}}}function bS(e){let t,n;return t=new nu({props:{data:e[1],$$slots:{default:[bz]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&2&&(a.data=r[1]),i&257&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function _z(e){let t,n=e[7].poi+"",r,i,a=e[7].cost+"",h,u;return{c(){t=De("From "),r=De(n),i=De(", it's "),h=De(a),u=De(" seconds to the nearest parking")},m(g,w){Rt(g,t,w),Rt(g,r,w),Rt(g,i,w),Rt(g,h,w),Rt(g,u,w)},p(g,w){w&128&&n!==(n=g[7].poi+"")&&$n(r,n),w&128&&a!==(a=g[7].cost+"")&&$n(h,a)},d(g){g&&(Dt(t),Dt(r),Dt(i),Dt(h),Dt(u))}}}function vz(e){let t,n;return t=new Zf({props:{openOn:"hover",$$slots:{default:[_z,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&384&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function bz(e){let t,n,r;function i(h){e[4](h)}let a={paint:{"circle-radius":15,"circle-color":pv(["get","cost"],e[3],Fd)},manageHoverState:!0,eventsIfTopMost:!0,$$slots:{default:[vz]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new By({props:a}),Jn.push(()=>Eo(t,"hovered",i)),{c(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,u){const g={};u&256&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function xS(e){let t,n;return t=new nu({props:{data:e[2],$$slots:{default:[xz]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&4&&(a.data=r[2]),i&256&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function xz(e){let t,n;return t=new Yc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function wz(e){let t,n,r,i=e[1]&&bS(e),a=e[2]&&xS(e);return{c(){t=Ot("div"),i&&i.c(),n=fe(),a&&a.c(),Ut(t,"slot","map")},m(h,u){Rt(h,t,u),i&&i.m(t,null),kt(t,n),a&&a.m(t,null),r=!0},p(h,u){h[1]?i?(i.p(h,u),u&2&&bt(i,1)):(i=bS(h),i.c(),bt(i,1),i.m(t,n)):i&&(zn(),Lt(i,1,1,()=>{i=null}),Fn()),h[2]?a?(a.p(h,u),u&4&&bt(a,1)):(a=xS(h),a.c(),bt(a,1),a.m(t,null)):a&&(zn(),Lt(a,1,1,()=>{a=null}),Fn())},i(h){r||(bt(i),bt(a),r=!0)},o(h){Lt(i),Lt(a),r=!1},d(h){h&&Dt(t),i&&i.d(),a&&a.d()}}}function Sz(e){let t,n;return t=new Yf({props:{$$slots:{map:[wz],sidebar:[yz],top:[gz]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&263&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function Ez(e,t,n){let r;Pe(e,Au,S=>n(5,r=S));let i=null;Gu(async()=>{n(1,i=await r.score())});let a=null,h=Array.from(Array(6).keys()).map(S=>60*10/(6-1)*S),u;async function g(S){if(u)try{n(2,a=await r.route({start:{lng:u.geometry.coordinates[0],lat:u.geometry.coordinates[1]},end:[u.properties.closest_lon,u.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(I){console.log(`No route: ${I}`),n(2,a=null)}else n(2,a=null)}function w(S){u=S,n(0,u)}return e.$$.update=()=>{e.$$.dirty&1&&g()},[u,i,a,h,w]}class Iz extends tn{constructor(t){super(),$e(this,t,Ez,Sz,je,{})}}var bo=63710088e-1,g1={centimeters:bo*100,centimetres:bo*100,degrees:bo/111325,feet:bo*3.28084,inches:bo*39.37,kilometers:bo/1e3,kilometres:bo/1e3,meters:bo,metres:bo,miles:bo/1609.344,millimeters:bo*1e3,millimetres:bo*1e3,nauticalmiles:bo/1852,radians:1,yards:bo*1.0936},Cz={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/bo,yards:1.0936133},yv={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 ha(e,t,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function Tz(e,t,n){switch(e){case"Point":return rs(t).geometry;case"LineString":return Js(t).geometry;case"Polygon":return y1(t).geometry;case"MultiPoint":return PC(t).geometry;case"MultiLineString":return LC(t).geometry;case"MultiPolygon":return MC(t).geometry;default:throw new Error(e+" is invalid")}}function rs(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(!dy(e[0])||!dy(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return ha(r,t,n)}function Lz(e,t,n){return n===void 0&&(n={}),Uc(e.map(function(r){return rs(r,t)}),n)}function y1(e,t,n){n===void 0&&(n={});for(var r=0,i=e;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function _1(e,t){t===void 0&&(t="kilometers");var n=g1[t];if(!n)throw new Error(t+" units is invalid");return e*n}function Uy(e,t){t===void 0&&(t="kilometers");var n=g1[t];if(!n)throw new Error(t+" units is invalid");return e/n}function Dz(e,t){return Bd(Uy(e,t))}function Rz(e){var t=e%360;return t<0&&(t+=360),t}function Bd(e){var t=e%(2*Math.PI);return t*180/Math.PI}function Qs(e){var t=e%360;return t*Math.PI/180}function Nz(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 _1(Uy(e,t),n)}function Oz(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 r=yv[t];if(!r)throw new Error("invalid original units");var i=yv[n];if(!i)throw new Error("invalid final units");return e/r*i}function dy(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function v1(e){return!!e&&e.constructor===Object}function zz(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(!dy(t))throw new Error("bbox must only contain numbers")})}function Fz(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 Bz=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:yv,bearingToAzimuth:Rz,convertArea:Oz,convertLength:Nz,degreesToRadians:Qs,earthRadius:bo,factors:g1,feature:ha,featureCollection:Uc,geometry:Tz,geometryCollection:Az,isNumber:dy,isObject:v1,lengthToDegrees:Dz,lengthToRadians:Uy,lineString:Js,lineStrings:Mz,multiLineString:LC,multiPoint:PC,multiPolygon:MC,point:rs,points:Lz,polygon:y1,polygons:Pz,radiansToDegrees:Bd,radiansToLength:_1,round:kz,unitsFactors:Cz,validateBBox:zz,validateId:Fz},Symbol.toStringTag,{value:"Module"}));function Vd(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 zf(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 AC(e,t,n){if(n===void 0&&(n={}),n.final===!0)return Vz(e,t);var r=Vd(e),i=Vd(t),a=Qs(r[0]),h=Qs(i[0]),u=Qs(r[1]),g=Qs(i[1]),w=Math.sin(h-a)*Math.cos(g),S=Math.cos(u)*Math.sin(g)-Math.sin(u)*Math.cos(g)*Math.cos(h-a);return Bd(Math.atan2(w,S))}function Vz(e,t){var n=AC(t,e);return n=(n+180)%360,n}function rd(e,t,n){n===void 0&&(n={});var r=Vd(e),i=Vd(t),a=Qs(i[1]-r[1]),h=Qs(i[0]-r[0]),u=Qs(r[1]),g=Qs(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(u)*Math.cos(g);return _1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function wS(e,t,n,r){r===void 0&&(r={});var i=Vd(e),a=Qs(i[0]),h=Qs(i[1]),u=Qs(n),g=Uy(t,r.units),w=Math.asin(Math.sin(h)*Math.cos(g)+Math.cos(h)*Math.sin(g)*Math.cos(u)),S=a+Math.atan2(Math.sin(u)*Math.sin(g)*Math.cos(h),Math.cos(g)-Math.sin(h)*Math.sin(w)),I=Bd(S),P=Bd(w);return rs([I,P],r.properties)}function Qd(e,t,n){if(e!==null)for(var r,i,a,h,u,g,w,S=0,I=0,P,D=e.type,N=D==="FeatureCollection",G=D==="Feature",Y=N?e.features.length:1,et=0;etg||N>w||G>S){u=I,g=r,w=N,S=G,a=0;return}var Y=Js([u,I],n.properties);if(t(Y,r,i,G,a)===!1)return!1;a++,u=I})===!1)return!1}}})}function Zz(e,t,n){var r=n,i=!1;return DC(e,function(a,h,u,g,w){i===!1&&n===void 0?r=a:r=t(r,a,h,u,g,w),i=!0}),r}function RC(e,t){if(!e)throw new Error("geojson is required");Kf(e,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,h=n.geometry.coordinates;switch(a){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ui?n:i,w=r>a?r:a;return[h,u,g,w]}var x1={exports:{}},NC={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Ud,function(){function n(V,j,X,ot,_t){(function st(ct,mt,Ct,H,ft){for(;H>Ct;){if(H-Ct>600){var Kt=H-Ct+1,St=mt-Ct+1,Zt=Math.log(Kt),ee=.5*Math.exp(2*Zt/3),qt=.5*Math.sqrt(Zt*ee*(Kt-ee)/Kt)*(St-Kt/2<0?-1:1),Oe=Math.max(Ct,Math.floor(mt-St*ee/Kt+qt)),we=Math.min(H,Math.floor(mt+(Kt-St)*ee/Kt+qt));st(ct,mt,Oe,we,ft)}var un=ct[mt],Ge=Ct,Me=H;for(r(ct,Ct,mt),ft(ct[H],un)>0&&r(ct,Ct,H);Ge0;)Me--}ft(ct[Ct],un)===0?r(ct,Ct,Me):r(ct,++Me,H),Me<=mt&&(Ct=Me+1),mt<=Me&&(H=Me-1)}})(V,j,X||0,ot||V.length-1,_t||i)}function r(V,j,X){var ot=V[j];V[j]=V[X],V[X]=ot}function i(V,j){return Vj?1:0}var a=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 h(V,j,X){if(!X)return j.indexOf(V);for(var ot=0;ot=V.minX&&j.maxY>=V.minY}function Y(V){return{children:V,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function et(V,j,X,ot,_t){for(var st=[j,X];st.length;)if(!((X=st.pop())-(j=st.pop())<=ot)){var ct=j+Math.ceil((X-j)/ot/2)*ot;n(V,ct,j,X,_t),st.push(j,ct,ct,X)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(V){var j=this.data,X=[];if(!G(V,j))return X;for(var ot=this.toBBox,_t=[];j;){for(var st=0;st=0&&_t[j].children.length>this._maxEntries;)this._split(_t,j),j--;this._adjustParentBBoxes(ot,_t,j)},a.prototype._split=function(V,j){var X=V[j],ot=X.children.length,_t=this._minEntries;this._chooseSplitAxis(X,_t,ot);var st=this._chooseSplitIndex(X,_t,ot),ct=Y(X.children.splice(st,X.children.length-st));ct.height=X.height,ct.leaf=X.leaf,u(X,this.toBBox),u(ct,this.toBBox),j?V[j-1].children.push(ct):this._splitRoot(X,ct)},a.prototype._splitRoot=function(V,j){this.data=Y([V,j]),this.data.height=V.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(V,j,X){for(var ot,_t,st,ct,mt,Ct,H,ft=1/0,Kt=1/0,St=j;St<=X-j;St++){var Zt=g(V,0,St,this.toBBox),ee=g(V,St,X,this.toBBox),qt=(_t=Zt,st=ee,ct=void 0,mt=void 0,Ct=void 0,H=void 0,ct=Math.max(_t.minX,st.minX),mt=Math.max(_t.minY,st.minY),Ct=Math.min(_t.maxX,st.maxX),H=Math.min(_t.maxY,st.maxY),Math.max(0,Ct-ct)*Math.max(0,H-mt)),Oe=P(Zt)+P(ee);qt=j;ft--){var Kt=V.children[ft];w(ct,V.leaf?_t(Kt):Kt),mt+=D(ct)}return mt},a.prototype._adjustParentBBoxes=function(V,j,X){for(var ot=X;ot>=0;ot--)w(j[ot],V)},a.prototype._condense=function(V){for(var j=V.length-1,X=void 0;j>=0;j--)V[j].children.length===0?j>0?(X=V[j-1].children).splice(X.indexOf(V[j]),1):this.clear():u(V[j],this.toBBox)},a})})(NC);var eF=NC.exports;const nF=_y(Bz),rF=_y(Jz),iF=_y(K4);var Qa=eF,OC=nF,zC=rF,$h=iF.default,oF=zC.featureEach;zC.coordEach;OC.polygon;var ES=OC.featureCollection;function FC(e){var t=new Qa(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:$h(n),Qa.prototype.insert.call(this,n)},t.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:$h(i),r.push(i)}):oF(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:$h(i),r.push(i)}),Qa.prototype.load.call(this,r)},t.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:$h(n),Qa.prototype.remove.call(this,n,r)},t.clear=function(){return Qa.prototype.clear.call(this)},t.search=function(n){var r=Qa.prototype.search.call(this,this.toBBox(n));return ES(r)},t.collides=function(n){return Qa.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Qa.prototype.all.call(this);return ES(n)},t.toJSON=function(){return Qa.prototype.toJSON.call(this)},t.fromJSON=function(n){return Qa.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=$h(n);else if(n.type==="FeatureCollection")r=$h(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},t}x1.exports=FC;x1.exports.default=FC;var sF=x1.exports;const aF=Sv(sF);function lF(e,t){var n={},r=[];if(e.type==="LineString"&&(e=ha(e)),t.type==="LineString"&&(t=ha(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var i=IS(e,t);return i&&r.push(i),Uc(r)}var a=aF();return a.load(SS(t)),my(SS(e),function(h){my(a.search(h),function(u){var g=IS(h,u);if(g){var w=zf(g).join(",");n[w]||(n[w]=!0,r.push(g))}})}),Uc(r)}function IS(e,t){var n=zf(e),r=zf(t);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],g=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],P=(I-w)*(h-i)-(S-g)*(u-a),D=(S-g)*(a-w)-(I-w)*(i-g),N=(h-i)*(a-w)-(u-a)*(i-g);if(P===0)return null;var G=D/P,Y=N/P;if(G>=0&&G<=1&&Y>=0&&Y<=1){var et=i+G*(h-i),V=a+G*(u-a);return rs([et,V])}return null}function uF(e,t,n){n===void 0&&(n={});var r=rs([1/0,1/0],{dist:1/0}),i=0;return Kf(e,function(a){for(var h=zf(a),u=0;u0&&(Y=G.features[0],Y.properties.dist=rd(t,Y,n),Y.properties.location=i+rd(g,Y,n)),g.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,r=this.dragFrom[1]-t.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});mi(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(CS(this.points).forEach((r,i)=>{n.push([i+1,uF(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}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))});mi(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=S0(t.lngLat.toArray()),this.onClick(t),this.finish())});mi(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});mi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});mi(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});mi(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((i,a)=>{let h=S0(i);h.properties.hover=this.hover==a,h.properties.idx=a,t.features.push(h)}),t.features=t.features.concat(CS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),VC.set(t);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,UC.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=S0(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(BC),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>pF&&this.previousStates.shift()}}function CS(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 mF(e){let t,n,r;return{c(){t=De("Undo ("),n=De(e[1]),r=De(")")},m(i,a){Rt(i,t,a),Rt(i,n,a),Rt(i,r,a)},p(i,a){a&2&&$n(n,i[1])},d(i){i&&(Dt(t),Dt(n),Dt(r))}}}function gF(e){let t;return{c(){t=De("Undo")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function yF(e){let t,n,r,i,a,h,u,g,w,S,I;function P(G,Y){return G[1]==0?gF:mF}let D=P(e),N=D(e);return{c(){t=Ot("div"),n=Ot("button"),n.textContent="Finish",r=fe(),i=Ot("button"),i.textContent="Cancel",a=fe(),h=Ot("button"),N.c(),g=fe(),w=Ot("ul"),w.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 + to undo your last change
  • Press Enter + or + double click + to finish
  • Press Escape + to cancel
  • `,h.disabled=u=e[1]==0,Si(t,"display","flex"),Si(t,"justify-content","space-between")},m(G,Y){Rt(G,t,Y),kt(t,n),kt(t,r),kt(t,i),kt(t,a),kt(t,h),N.m(h,null),Rt(G,g,Y),Rt(G,w,Y),S||(I=[Ze(n,"click",e[2]),Ze(i,"click",e[3]),Ze(h,"click",e[4])],S=!0)},p(G,[Y]){D===(D=P(G))&&N?N.p(G,Y):(N.d(1),N=D(G),N&&(N.c(),N.m(h,null))),Y&2&&u!==(u=G[1]==0)&&(h.disabled=u)},i:ge,o:ge,d(G){G&&(Dt(t),Dt(g),Dt(w)),N.d(),S=!1,Ni(I)}}}function _F(e,t,n){let r;Pe(e,UC,g=>n(1,r=g));let{polygonTool:i}=t;const a=()=>i.finish(),h=()=>i.cancel(),u=()=>i.undo();return e.$$set=g=>{"polygonTool"in g&&n(0,i=g.polygonTool)},[i,r,a,h,u]}class vF extends tn{constructor(t){super(),$e(this,t,_F,yF,je,{polygonTool:0})}}let bF=Date.now();function $d(e){return`${e}-${bF++}`}const GC=Symbol.for("svelte-maplibre");function xF(){return vv(GC)}function TS(e){return{subscribe:e.subscribe}}function qC({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=xF(),a=or(null),h=TS(a),u={...i,[e]:TS(a)};if(t&&(u.popupTarget=h),r){let g=or(null);u.layerEvent=g,i.layerEvent=g}return n&&(u.cluster=or()),_v(GC,u),{...i,self:a}}function wF(){return qC({key:"source",setCluster:!0})}function SF(e=!0){return qC({key:"layer",setPopupTarget:e,setMouseEvent:e})}function LS(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],a=n[r];i!==a&&e(r,a,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function EF(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function IF(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function PS(e){let t=e[0],n,r,i=MS(e);return{c(){i.c(),n=oi()},m(a,h){i.m(a,h),Rt(a,n,h),r=!0},p(a,h){h[0]&1&&je(t,t=a[0])?(zn(),Lt(i,1,1,ge),Fn(),i=MS(a),i.c(),bt(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(bt(i),r=!0)},o(a){Lt(i),r=!1},d(a){a&&Dt(n),i.d(a)}}}function MS(e){let t;const n=e[36].default,r=ei(n,e,e[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a[1]&16)&&ri(r,n,i,i[35],t?ni(n,i[35],a,null):ii(i[35]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function CF(e){let t,n,r=e[0]&&PS(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&bt(r,1)):(r=PS(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function TF(e,t,n){let r,i,a,h,u,g,w,S,I,P,D,N,{$$slots:G={},$$scope:Y}=t,{id:et=$d("layer")}=t,{source:V=void 0}=t,{sourceLayer:j=void 0}=t,{beforeId:X=void 0}=t,{beforeLayerType:ot=void 0}=t,{type:_t}=t,{paint:st=void 0}=t,{layout:ct=void 0}=t,{filter:mt=void 0}=t,{applyToClusters:Ct=void 0}=t,{minzoom:H=void 0}=t,{maxzoom:ft=void 0}=t,{manageHoverState:Kt=!1}=t,{hovered:St=null}=t,{interactive:Zt=!0}=t,{hoverCursor:ee=void 0}=t,{eventsIfTopMost:qt=!1}=t;const Oe=qu(),{map:we,source:un,self:Ge,minzoom:Me,maxzoom:hn,eventTopMost:Cn,layerInfo:gn}=SF();Pe(e,we,gt=>n(31,I=gt)),Pe(e,un,gt=>n(32,P=gt)),Pe(e,Ge,gt=>n(0,S=gt)),Pe(e,Me,gt=>n(34,N=gt)),Pe(e,hn,gt=>n(33,D=gt)),as(()=>{S&&I&&(gn.delete(S),I==null||I.removeLayer(S))});let yn;function An(gt){var Nt,Ye;if(!Zt||!S||!I||qt&&Cn(gt)!==S)return;let Tt=gt.features??[],Ie=(Ye=(Nt=Tt[0])==null?void 0:Nt.properties)==null?void 0:Ye.cluster_id,kn={event:gt,map:I,clusterId:Ie,layer:S,source:u,features:Tt};Oe(gt.type,kn)}function xr(gt){var Nt,Ye;if(!Zt||!S||!I||qt&&Cn(gt)!==S)return;ee&&(I.getCanvas().style.cursor=ee);let Tt=gt.features??[];n(6,St=Tt[0]??null);let Ie=(Ye=(Nt=Tt[0])==null?void 0:Nt.properties)==null?void 0:Ye.cluster_id;Oe("mouseenter",{event:gt,map:I,clusterId:Ie,layer:S,source:u,features:Tt})}function Ar(gt){var Nt,Ye,kr;if(!Zt||!I)return;if(qt&&Cn(gt)!==S){n(6,St=null),Kt&&yn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:j,id:yn},{hover:!1}),yn=void 0);return}I.getCanvas().style.cursor=ee;let Tt=gt.features??[],Ie=(Ye=(Nt=Tt[0])==null?void 0:Nt.properties)==null?void 0:Ye.cluster_id,kn=(kr=Tt[0])==null?void 0:kr.id;kn!==yn&&(Kt&&(yn!==void 0&&(I==null||I.setFeatureState({source:u,id:yn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:j},{hover:!0})),yn=kn,n(6,St=Tt[0]??null)),Oe("mousemove",{event:gt,map:I,clusterId:Ie,layer:S,source:u,features:Tt})}function wr(gt){if(!(!Zt||!S||!I)){if(ee&&(I.getCanvas().style.cursor=""),n(6,St=null),Kt&&yn!==void 0){const Tt={source:u,id:yn,sourceLayer:j};I==null||I.setFeatureState(Tt,{hover:!1}),yn=void 0}Oe("mouseleave",{map:I,layer:S,source:u})}}let pr=!0;function Qt(gt){I&&(I.off("click",gt,An),I.off("dblclick",gt,An),I.off("contextmenu",gt,An),I.off("mouseenter",gt,xr),I.off("mousemove",gt,Ar),I.off("mouseleave",gt,wr))}return as(()=>{I&&S&&Qt(S)}),e.$$set=gt=>{"id"in gt&&n(7,et=gt.id),"source"in gt&&n(8,V=gt.source),"sourceLayer"in gt&&n(9,j=gt.sourceLayer),"beforeId"in gt&&n(10,X=gt.beforeId),"beforeLayerType"in gt&&n(11,ot=gt.beforeLayerType),"type"in gt&&n(12,_t=gt.type),"paint"in gt&&n(13,st=gt.paint),"layout"in gt&&n(14,ct=gt.layout),"filter"in gt&&n(15,mt=gt.filter),"applyToClusters"in gt&&n(16,Ct=gt.applyToClusters),"minzoom"in gt&&n(17,H=gt.minzoom),"maxzoom"in gt&&n(18,ft=gt.maxzoom),"manageHoverState"in gt&&n(19,Kt=gt.manageHoverState),"hovered"in gt&&n(6,St=gt.hovered),"interactive"in gt&&n(20,Zt=gt.interactive),"hoverCursor"in gt&&n(21,ee=gt.hoverCursor),"eventsIfTopMost"in gt&&n(22,qt=gt.eventsIfTopMost),"$$scope"in gt&&n(35,Y=gt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=IF(Ct)),e.$$.dirty[0]&1073774592&&n(24,i=EF("all",r,mt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,a=H??N),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=ft??D),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=V||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&I&&S!==et&&u){S&&(Qt(S),gn.delete(S));let gt=X;if(!X&&ot){let Tt=I.getStyle().layers,Ie=typeof ot=="function"?ot:Nt=>Nt.type===ot,kn=Tt==null?void 0:Tt.find(Ie);kn&&(gt=kn.id)}Wn(Ge,S=et,S),I.addLayer(Vc({id:S,type:_t,source:u,"source-layer":j,filter:i,paint:st,layout:ct,minzoom:a,maxzoom:h}),gt),n(23,pr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,xr),I.on("mousemove",S,Ar),I.on("mouseleave",S,wr)}e.$$.dirty[0]&1048577&&S&&gn.set(S,{interactive:Zt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,g=S?LS((gt,Tt)=>I==null?void 0:I.setPaintProperty(S,gt,Tt)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?LS((gt,Tt)=>I==null?void 0:I.setLayoutProperty(S,gt,Tt)):void 0),e.$$.dirty[0]&268443648&&(g==null||g(st)),e.$$.dirty[0]&134234112&&(w==null||w(ct)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(pr?n(23,pr=!1):I==null||I.setFilter(S,i))},[S,we,un,Ge,Me,hn,St,et,V,j,X,ot,_t,st,ct,mt,Ct,H,ft,Kt,Zt,ee,qt,pr,i,h,a,w,g,u,r,I,P,D,N,Y,G]}class w1 extends tn{constructor(t){super(),$e(this,t,TF,CF,je,{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 LF(e){let t;const n=e[16].default,r=ei(n,e,e[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16777216)&&ri(r,n,i,i[24],t?ni(n,i[24],a,null):ii(i[24]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function PF(e){let t,n,r;function i(h){e[17](h)}let a={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:[LF]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new w1({props:a}),Jn.push(()=>Eo(t,"hovered",i)),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(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&2&&(g.id=h[1]),u&4&&(g.source=h[2]),u&8&&(g.sourceLayer=h[3]),u&16&&(g.beforeId=h[4]),u&32&&(g.beforeLayerType=h[5]),u&64&&(g.paint=h[6]),u&128&&(g.layout=h[7]),u&256&&(g.filter=h[8]),u&512&&(g.applyToClusters=h[9]),u&1024&&(g.minzoom=h[10]),u&2048&&(g.maxzoom=h[11]),u&4096&&(g.hoverCursor=h[12]),u&8192&&(g.manageHoverState=h[13]),u&16384&&(g.eventsIfTopMost=h[14]),u&32768&&(g.interactive=h[15]),u&16777216&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function MF(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=$d("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:g=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{applyToClusters:D=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:G=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:et=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:j=!1}=t,{interactive:X=!0}=t;function ot(ft){V=ft,n(0,V)}function _t(ft){En.call(this,e,ft)}function st(ft){En.call(this,e,ft)}function ct(ft){En.call(this,e,ft)}function mt(ft){En.call(this,e,ft)}function Ct(ft){En.call(this,e,ft)}function H(ft){En.call(this,e,ft)}return e.$$set=ft=>{"id"in ft&&n(1,a=ft.id),"source"in ft&&n(2,h=ft.source),"sourceLayer"in ft&&n(3,u=ft.sourceLayer),"beforeId"in ft&&n(4,g=ft.beforeId),"beforeLayerType"in ft&&n(5,w=ft.beforeLayerType),"paint"in ft&&n(6,S=ft.paint),"layout"in ft&&n(7,I=ft.layout),"filter"in ft&&n(8,P=ft.filter),"applyToClusters"in ft&&n(9,D=ft.applyToClusters),"minzoom"in ft&&n(10,N=ft.minzoom),"maxzoom"in ft&&n(11,G=ft.maxzoom),"hoverCursor"in ft&&n(12,Y=ft.hoverCursor),"manageHoverState"in ft&&n(13,et=ft.manageHoverState),"hovered"in ft&&n(0,V=ft.hovered),"eventsIfTopMost"in ft&&n(14,j=ft.eventsIfTopMost),"interactive"in ft&&n(15,X=ft.interactive),"$$scope"in ft&&n(24,i=ft.$$scope)},[V,a,h,u,g,w,S,I,P,D,N,G,Y,et,j,X,r,ot,_t,st,ct,mt,Ct,H,i]}class AF extends tn{constructor(t){super(),$e(this,t,MF,PF,je,{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 kF(e){let t;const n=e[15].default,r=ei(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&ri(r,n,i,i[23],t?ni(n,i[23],a,null):ii(i[23]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function DF(e){let t,n,r;function i(h){e[16](h)}let a={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:[kF]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new w1({props:a}),Jn.push(()=>Eo(t,"hovered",i)),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(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&2&&(g.id=h[1]),u&4&&(g.source=h[2]),u&8&&(g.sourceLayer=h[3]),u&16&&(g.beforeId=h[4]),u&32&&(g.beforeLayerType=h[5]),u&64&&(g.paint=h[6]),u&128&&(g.layout=h[7]),u&256&&(g.filter=h[8]),u&512&&(g.minzoom=h[9]),u&1024&&(g.maxzoom=h[10]),u&2048&&(g.hoverCursor=h[11]),u&4096&&(g.manageHoverState=h[12]),u&8192&&(g.eventsIfTopMost=h[13]),u&16384&&(g.interactive=h[14]),u&8388608&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function RF(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=$d("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:g=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:G=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:j=!0}=t;function X(H){et=H,n(0,et)}function ot(H){En.call(this,e,H)}function _t(H){En.call(this,e,H)}function st(H){En.call(this,e,H)}function ct(H){En.call(this,e,H)}function mt(H){En.call(this,e,H)}function Ct(H){En.call(this,e,H)}return e.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,h=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,G=H.hoverCursor),"manageHoverState"in H&&n(12,Y=H.manageHoverState),"hovered"in H&&n(0,et=H.hovered),"eventsIfTopMost"in H&&n(13,V=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[et,a,h,u,g,w,S,I,P,D,N,G,Y,V,j,r,X,ot,_t,st,ct,mt,Ct,i]}class NF extends tn{constructor(t){super(),$e(this,t,RF,DF,je,{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 OF(e,t,n,r,i){let a=!1;e.getSource(t)&&(a=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(a){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function zF(e,t,n){KS().then(()=>{let r=WS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function AS(e){let t=e[0],n,r,i=kS(e);return{c(){i.c(),n=oi()},m(a,h){i.m(a,h),Rt(a,n,h),r=!0},p(a,h){h&1&&je(t,t=a[0])?(zn(),Lt(i,1,1,ge),Fn(),i=kS(a),i.c(),bt(i,1),i.m(n.parentNode,n)):i.p(a,h)},i(a){r||(bt(i),r=!0)},o(a){Lt(i),r=!1},d(a){a&&Dt(n),i.d(a)}}}function kS(e){let t;const n=e[15].default,r=ei(n,e,e[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&16384)&&ri(r,n,i,i[14],t?ni(n,i[14],a,null):ii(i[14]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function FF(e){let t,n,r=e[0]&&AS(e);return{c(){r&&r.c(),t=oi()},m(i,a){r&&r.m(i,a),Rt(i,t,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&bt(r,1)):(r=AS(i),r.c(),bt(r,1),r.m(t.parentNode,t)):r&&(zn(),Lt(r,1,1,()=>{r=null}),Fn())},i(i){n||(bt(r),n=!0)},o(i){Lt(r),n=!1},d(i){i&&Dt(t),r&&r.d(i)}}}function BF(e,t,n){let r,i,a,{$$slots:h={},$$scope:u}=t,{id:g=$d("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:I=void 0}=t,{filter:P=void 0}=t,{lineMetrics:D=void 0}=t,{cluster:N=void 0}=t;const{map:G,cluster:Y,self:et}=wF();Pe(e,G,X=>n(13,i=X)),Pe(e,Y,X=>n(16,a=X)),Pe(e,et,X=>n(0,r=X));let V,j=!0;return as(()=>{r&&V&&i&&(zF(G,r,V),Wn(et,r=null,r),n(11,V=void 0))}),e.$$set=X=>{"id"in X&&n(4,g=X.id),"data"in X&&n(5,w=X.data),"generateId"in X&&n(6,S=X.generateId),"promoteId"in X&&n(7,I=X.promoteId),"filter"in X&&n(8,P=X.filter),"lineMetrics"in X&&n(9,D=X.lineMetrics),"cluster"in X&&n(10,N=X.cluster),"$$scope"in X&&n(14,u=X.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Wn(Y,a=N,a),e.$$.dirty&12273&&i&&r!==g&&(Wn(et,r=g,r),OF(i,r,Vc({type:"geojson",data:w,filter:P,lineMetrics:D,generateId:S,promoteId:I,cluster:!!N,clusterMinPoints:N==null?void 0:N.minPoints,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius,clusterProperties:N==null?void 0:N.properties}),X=>i&&X===r,()=>{r&&(n(11,V=i==null?void 0:i.getSource(r)),n(12,j=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,V=i==null?void 0:i.getSource(g))})),e.$$.dirty&6176&&V&&(j?n(12,j=!1):V.setData(w)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Vc({cluster:!!N,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius})))},[r,G,Y,et,g,w,S,I,P,D,N,V,j,i,u,h]}class VF extends tn{constructor(t){super(),$e(this,t,BF,FF,je,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function UF(e){let t;const n=e[15].default,r=ei(n,e,e[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),t=!0},p(i,a){r&&r.p&&(!t||a&8388608)&&ri(r,n,i,i[23],t?ni(n,i[23],a,null):ii(i[23]),null)},i(i){t||(bt(r,i),t=!0)},o(i){Lt(r,i),t=!1},d(i){r&&r.d(i)}}}function GF(e){let t,n,r;function i(h){e[16](h)}let a={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:[UF]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new w1({props:a}),Jn.push(()=>Eo(t,"hovered",i)),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(){le(t.$$.fragment)},m(h,u){se(t,h,u),r=!0},p(h,[u]){const g={};u&2&&(g.id=h[1]),u&4&&(g.source=h[2]),u&8&&(g.sourceLayer=h[3]),u&16&&(g.beforeId=h[4]),u&32&&(g.beforeLayerType=h[5]),u&64&&(g.paint=h[6]),u&128&&(g.layout=h[7]),u&256&&(g.filter=h[8]),u&512&&(g.minzoom=h[9]),u&1024&&(g.maxzoom=h[10]),u&2048&&(g.hoverCursor=h[11]),u&4096&&(g.manageHoverState=h[12]),u&8192&&(g.eventsIfTopMost=h[13]),u&16384&&(g.interactive=h[14]),u&8388608&&(g.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,g.hovered=h[0],So(()=>n=!1)),t.$set(g)},i(h){r||(bt(t.$$.fragment,h),r=!0)},o(h){Lt(t.$$.fragment,h),r=!1},d(h){ae(t,h)}}}function qF(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:a=$d("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:g=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:I=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:G=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:et=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:j=!0}=t;function X(H){et=H,n(0,et)}function ot(H){En.call(this,e,H)}function _t(H){En.call(this,e,H)}function st(H){En.call(this,e,H)}function ct(H){En.call(this,e,H)}function mt(H){En.call(this,e,H)}function Ct(H){En.call(this,e,H)}return e.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,h=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,G=H.hoverCursor),"manageHoverState"in H&&n(12,Y=H.manageHoverState),"hovered"in H&&n(0,et=H.hovered),"eventsIfTopMost"in H&&n(13,V=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[et,a,h,u,g,w,S,I,P,D,N,G,Y,V,j,r,X,ot,_t,st,ct,mt,Ct,i]}class jF extends tn{constructor(t){super(),$e(this,t,qF,GF,je,{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 WF(e){let t,n,r,i,a,h;return t=new NF({props:{id:"edit-polygon-fill",filter:cF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new jF({props:{id:"edit-polygon-lines",filter:hF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new AF({props:{id:"edit-polygon-vertices",filter:fF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){le(t.$$.fragment),n=fe(),le(r.$$.fragment),i=fe(),le(a.$$.fragment)},m(u,g){se(t,u,g),Rt(u,n,g),se(r,u,g),Rt(u,i,g),se(a,u,g),h=!0},p:ge,i(u){h||(bt(t.$$.fragment,u),bt(r.$$.fragment,u),bt(a.$$.fragment,u),h=!0)},o(u){Lt(t.$$.fragment,u),Lt(r.$$.fragment,u),Lt(a.$$.fragment,u),h=!1},d(u){u&&(Dt(n),Dt(i)),ae(t,u),ae(r,u),ae(a,u)}}}function HF(e){let t,n;return t=new VF({props:{data:e[0],$$slots:{default:[WF]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function ZF(e,t,n){let r;return Pe(e,VC,i=>n(0,r=i)),[r]}class XF extends tn{constructor(t){super(),$e(this,t,ZF,HF,je,{})}}function YF(e){let t,n,r,i,a,h,u;return{c(){t=Ot("button"),t.textContent="Import current view",n=fe(),r=Ot("i"),r.textContent="or...",i=fe(),a=Ot("button"),a.textContent="Draw an area to import on the map",Ut(t,"type","button"),Ut(a,"type","button")},m(g,w){Rt(g,t,w),Rt(g,n,w),Rt(g,r,w),Rt(g,i,w),Rt(g,a,w),h||(u=[Ze(t,"click",e[1]),Ze(a,"click",e[2])],h=!0)},p:ge,i:ge,o:ge,d(g){g&&(Dt(t),Dt(n),Dt(r),Dt(i),Dt(a)),h=!1,Ni(u)}}}function KF(e){let t,n;return t=new vF({props:{polygonTool:e[0]}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function JF(e){let t,n,r,i;const a=[KF,YF],h=[];function u(g,w){return g[0]?0:1}return t=u(e),n=h[t]=a[t](e),{c(){n.c(),r=oi()},m(g,w){h[t].m(g,w),Rt(g,r,w),i=!0},p(g,[w]){let S=t;t=u(g),t===S?h[t].p(g,w):(zn(),Lt(h[S],1,1,()=>{h[S]=null}),Fn(),n=h[t],n?n.p(g,w):(n=h[t]=a[t](g),n.c()),bt(n,1),n.m(r.parentNode,r))},i(g){i||(bt(n),i=!0)},o(g){Lt(n),i=!1},d(g){g&&Dt(r),h[t].d(g)}}}function id(e){return[e.lng,e.lat]}function QF(e,t,n){let{map:r}=t;const i=qu();let a=null;async function h(S){try{i("loading","Loading from Overpass");let P=await(await fetch(t6(S))).text();i("gotXml",P)}catch(I){i("error",I.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[id(S.getSouthWest()),id(S.getNorthWest()),id(S.getNorthEast()),id(S.getSouthEast()),id(S.getSouthWest())]],type:"Polygon"}}}async function g(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await h(u())}}function w(){r&&(n(0,a=new dF(r)),a.startNew(),a.addEventListenerSuccess(async S=>{n(0,a=null),await h(S)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}return e.$$set=S=>{"map"in S&&n(3,r=S.map)},[a,g,w,r]}class $F extends tn{constructor(t){super(),$e(this,t,QF,JF,je,{map:3})}}function t6(e){let t='poly:"';for(let[r,i]of e.geometry.coordinates[0])t+=`${i} ${r} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function DS(e,t,n){const r=e.slice();return r[3]=t[n],r}function RS(e){let t,n,r=ti(e[0]),i=[];for(let a=0;a0&&RS(e);return{c(){n&&n.c(),t=oi()},m(r,i){n&&n.m(r,i),Rt(r,t,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=RS(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:ge,o:ge,d(r){r&&Dt(t),n&&n.d(r)}}}function n6(e,t,n){let{loading:r}=t,i;function a(h){Jn[h?"unshift":"push"](()=>{i=h,n(1,i),n(0,r)})}return e.$$set=h=>{"loading"in h&&n(0,r=h.loading)},e.$$.update=()=>{e.$$.dirty&3&&r.length>0&&i&&n(1,i.scrollTop=i.scrollHeight,i)},[r,i,a]}class r6 extends tn{constructor(t){super(),$e(this,t,n6,e6,je,{loading:0})}}function OS(e,t,n){const r=e.slice();return r[21]=t[n][0],r[22]=t[n][1],r}function zS(e,t,n){const r=e.slice();return r[25]=t[n][0],r[26]=t[n][1],r}function FS(e){let t,n=e[26]+"",r,i;return{c(){t=Ot("option"),r=De(n),t.__value=i=e[25],Go(t,t.__value)},m(a,h){Rt(a,t,h),kt(t,r)},p(a,h){h&4&&n!==(n=a[26]+"")&&$n(r,n),h&4&&i!==(i=a[25])&&(t.__value=i,Go(t,t.__value))},d(a){a&&Dt(t)}}}function BS(e){let t,n,r=ti(e[22]),i=[];for(let a=0;ae[9].call(h)),Ut(N,"type","file"),Ut(mt,"type","file")},m(Zt,ee){se(t,Zt,ee),Rt(Zt,n,ee),Rt(Zt,r,ee),kt(r,i),kt(i,a),kt(i,h),kt(h,u);for(let qt=0;qtn(15,r=ct)),Pe(e,Au,ct=>n(16,i=ct)),Pe(e,yy,ct=>n(5,a=ct));let h="",u=[],g=!1,w=[];Gu(async()=>{try{let ct=await fetch("/osm/areas.json");if(ct.ok)g=!0,console.log("Using local cache, not od2net.org"),n(2,w=await ct.json());else{let mt=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await mt.json())}}catch{}});let S;async function I(ct){try{await N(await S.files[0].arrayBuffer()),n(0,h="")}catch(mt){window.alert(`Couldn't open this file: ${mt}`)}n(1,u=[])}let P;async function D(ct){try{n(1,u=["Loading pre-built file"]);let mt=await P.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(mt)),console.timeEnd("load"),Wn(lf,r=!0,r),n(0,h="")}catch(mt){window.alert(`Couldn't open this file: ${mt}`)}n(1,u=[])}async function N(ct){n(1,u=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(ct),sE(G)),console.timeEnd("load"),Wn(lf,r=!0,r)}function G(ct){n(1,u=[...u,ct])}async function Y(ct){try{await N(new TextEncoder().encode(ct.detail)),n(0,h="")}catch(mt){window.alert(`Couldn't import from Overpass: ${mt}`)}n(1,u=[])}async function et(ct){ct!=""&&(g?await V(`/osm/${ct}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${ct}.pbf`))}async function V(ct){try{n(1,u=[`Downloading ${ct}`]);let mt=await fetch(ct);await N(await mt.arrayBuffer())}catch(mt){window.alert(`Couldn't open from URL ${ct}: ${mt}`)}n(1,u=[])}function j(){h=ZS(this),n(0,h),n(2,w)}function X(ct){Jn[ct?"unshift":"push"](()=>{S=ct,n(3,S)})}const ot=ct=>n(1,u=[...u,ct.detail]),_t=ct=>window.alert(ct.detail);function st(ct){Jn[ct?"unshift":"push"](()=>{P=ct,n(4,P)})}return e.$$.update=()=>{e.$$.dirty&1&&et(h)},[h,u,w,S,P,a,I,D,Y,j,X,ot,_t,st]}class s6 extends tn{constructor(t){super(),$e(this,t,o6,i6,je,{})}}function a6(e){let t;return{c(){t=Ot("div"),Ut(t,"slot","top")},m(n,r){Rt(n,t,r)},p:ge,d(n){n&&Dt(t)}}}function l6(e){let t;return{c(){t=Ot("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Rt(n,t,r)},i:ge,o:ge,d(n){n&&Dt(t)}}}function u6(e){let t,n;return t=new s6({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function c6(e){let t,n,r,i,a,h;const u=[u6,l6],g=[];function w(S,I){return S[0]?0:1}return i=w(e),a=g[i]=u[i](e),{c(){t=Ot("div"),n=Ot("h2"),n.textContent="Choose your study area",r=fe(),a.c(),Ut(t,"slot","sidebar")},m(S,I){Rt(S,t,I),kt(t,n),kt(t,r),g[i].m(t,null),h=!0},p(S,I){let P=i;i=w(S),i!==P&&(zn(),Lt(g[P],1,1,()=>{g[P]=null}),Fn(),a=g[i],a||(a=g[i]=u[i](S),a.c()),bt(a,1),a.m(t,null))},i(S){h||(bt(a),h=!0)},o(S){Lt(a),h=!1},d(S){S&&Dt(t),g[i].d()}}}function h6(e){let t,n,r;return n=new XF({}),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"slot","map")},m(i,a){Rt(i,t,a),se(n,t,null),r=!0},p:ge,i(i){r||(bt(n.$$.fragment,i),r=!0)},o(i){Lt(n.$$.fragment,i),r=!1},d(i){i&&Dt(t),ae(n)}}}function f6(e){let t,n;return t=new Yf({props:{$$slots:{map:[h6],sidebar:[c6],top:[a6]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,[i]){const a={};i&33&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function p6(e,t,n){let r,i,a,h,u;return Pe(e,ff,g=>n(1,r=g)),Pe(e,Ec,g=>n(2,i=g)),Pe(e,Au,g=>n(3,a=g)),Pe(e,lf,g=>n(4,h=g)),Pe(e,yy,g=>n(0,u=g)),Gu(async()=>{Wn(lf,h=!1,h),await a.unset(),Wn(Ec,i=null,i),Wn(ff,r=null,r)}),[u]}class d6 extends tn{constructor(t){super(),$e(this,t,p6,f6,je,{})}}function m6(){return new Worker("/15m/assets/worker-b2639931.js")}function g6(e){let t,n,r,i,a,h;return{c(){t=Ot("div"),n=Ot("button"),n.innerHTML=`A/B Street logo`,r=fe(),i=Ot("span"),Ut(n,"class","outline"),Si(i,"width","100%"),Ut(t,"slot","top"),Si(t,"display","flex")},m(u,g){Rt(u,t,g),kt(t,n),kt(t,r),kt(t,i),e[16](i),a||(h=Ze(n,"click",e[15]),a=!0)},p:ge,d(u){u&&Dt(t),e[16](null),a=!1,h()}}}function VS(e){let t,n,r,i,a,h;return{c(){t=Ot("hr"),n=fe(),r=Ot("div"),i=Ot("button"),i.textContent="Zoom to fit"},m(u,g){Rt(u,t,g),Rt(u,n,g),Rt(u,r,g),kt(r,i),a||(h=Ze(i,"click",e[8]),a=!0)},p:ge,d(u){u&&(Dt(t),Dt(n),Dt(r)),a=!1,h()}}}function y6(e){let t,n,r,i,a,h=e[5].kind!="title"&&VS(e);return{c(){t=Ot("div"),n=Ot("h1"),n.textContent="15-minute neighbourhood tool",r=fe(),i=Ot("div"),a=fe(),h&&h.c(),Ut(t,"slot","left")},m(u,g){Rt(u,t,g),kt(t,n),kt(t,r),kt(t,i),e[14](i),kt(t,a),h&&h.m(t,null)},p(u,g){u[5].kind!="title"?h?h.p(u,g):(h=VS(u),h.c(),h.m(t,null)):h&&(h.d(1),h=null)},d(u){u&&Dt(t),e[14](null),h&&h.d()}}}function US(e){let t,n;return t=new d6({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function GS(e){let t,n,r,i,a,h,u={ctx:e,current:null,token:null,hasCatch:!1,pending:x6,then:v6,catch:_6,value:20,blocks:[,,,]};$b(t=Hl(e[6]).getInvertedBoundary(),u);const g=[C6,I6,E6,S6,w6],w=[];function S(I,P){return I[5].kind=="debug"?0:I[5].kind=="isochrone"?1:I[5].kind=="route"?2:I[5].kind=="score"?3:I[5].kind=="debug-route"?4:-1}return~(r=S(e))&&(i=w[r]=g[r](e)),{c(){u.block.c(),n=fe(),i&&i.c(),a=oi()},m(I,P){u.block.m(I,u.anchor=P),u.mount=()=>n.parentNode,u.anchor=n,Rt(I,n,P),~r&&w[r].m(I,P),Rt(I,a,P),h=!0},p(I,P){e=I,u.ctx=e,P&64&&t!==(t=Hl(e[6]).getInvertedBoundary())&&$b(t,u)||ZL(u,e,P);let D=r;r=S(e),r===D?~r&&w[r].p(e,P):(i&&(zn(),Lt(w[D],1,1,()=>{w[D]=null}),Fn()),~r?(i=w[r],i?i.p(e,P):(i=w[r]=g[r](e),i.c()),bt(i,1),i.m(a.parentNode,a)):i=null)},i(I){h||(bt(u.block),bt(i),h=!0)},o(I){for(let P=0;P<3;P+=1){const D=u.blocks[P];Lt(D)}Lt(i),h=!1},d(I){I&&(Dt(n),Dt(a)),u.block.d(I),u.token=null,u=null,~r&&w[r].d(I)}}}function _6(e){return{c:ge,m:ge,p:ge,i:ge,o:ge,d:ge}}function v6(e){let t,n;return t=new nu({props:{data:e[20],$$slots:{default:[b6]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[20]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function b6(e){let t,n;return t=new IC({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function x6(e){return{c:ge,m:ge,p:ge,i:ge,o:ge,d:ge}}function w6(e){let t,n;return t=new mz({props:{debugGj:e[5].debugGj,start:e[5].start,end:e[5].end,routeGj:e[5].routeGj}}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p(r,i){const a={};i&32&&(a.debugGj=r[5].debugGj),i&32&&(a.start=r[5].start),i&32&&(a.end=r[5].end),i&32&&(a.routeGj=r[5].routeGj),t.$set(a)},i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function S6(e){let t,n;return t=new Iz({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function E6(e){let t,n;return t=new oz({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function I6(e){let t,n;return t=new G5({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function C6(e){let t,n;return t=new A5({}),{c(){le(t.$$.fragment)},m(r,i){se(t,r,i),n=!0},p:ge,i(r){n||(bt(t.$$.fragment,r),n=!0)},o(r){Lt(t.$$.fragment,r),n=!1},d(r){ae(t,r)}}}function T6(e){let t,n,r,i,a,h,u;t=new kN({props:{map:e[0],apiKey:uE}});let g=e[5].kind=="title"&&US(),w=e[4]&&GS(e);return{c(){le(t.$$.fragment),n=fe(),r=Ot("div"),i=fe(),g&&g.c(),a=fe(),w&&w.c(),h=oi()},m(S,I){se(t,S,I),Rt(S,n,I),Rt(S,r,I),e[12](r),Rt(S,i,I),g&&g.m(S,I),Rt(S,a,I),w&&w.m(S,I),Rt(S,h,I),u=!0},p(S,I){const P={};I&1&&(P.map=S[0]),t.$set(P),S[5].kind=="title"?g?I&32&&bt(g,1):(g=US(),g.c(),bt(g,1),g.m(a.parentNode,a)):g&&(zn(),Lt(g,1,1,()=>{g=null}),Fn()),S[4]?w?(w.p(S,I),I&16&&bt(w,1)):(w=GS(S),w.c(),bt(w,1),w.m(h.parentNode,h)):w&&(zn(),Lt(w,1,1,()=>{w=null}),Fn())},i(S){u||(bt(t.$$.fragment,S),bt(g),bt(w),u=!0)},o(S){Lt(t.$$.fragment,S),Lt(g),Lt(w),u=!1},d(S){S&&(Dt(n),Dt(r),Dt(i),Dt(a),Dt(h)),ae(t,S),e[12](null),g&&g.d(S),w&&w.d(S)}}}function L6(e){let t,n,r,i;function a(u){e[13](u)}let h={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${uE}`,standardControls:!0,hash:!0,$$slots:{default:[T6]},$$scope:{ctx:e}};return e[0]!==void 0&&(h.map=e[0]),n=new WO({props:h}),Jn.push(()=>Eo(n,"map",a)),{c(){t=Ot("div"),le(n.$$.fragment),Ut(t,"slot","main"),Si(t,"position","relative"),Si(t,"width","100%"),Si(t,"height","100vh")},m(u,g){Rt(u,t,g),se(n,t,null),i=!0},p(u,g){const w={};g&2097273&&(w.$$scope={dirty:g,ctx:u}),!r&&g&1&&(r=!0,w.map=u[0],So(()=>r=!1)),n.$set(w)},i(u){i||(bt(n.$$.fragment,u),i=!0)},o(u){Lt(n.$$.fragment,u),i=!1},d(u){u&&Dt(t),ae(n)}}}function P6(e){let t,n,r,i;return t=new AP({}),r=new e5({props:{$$slots:{main:[L6],left:[y6],top:[g6]},$$scope:{ctx:e}}}),{c(){le(t.$$.fragment),n=fe(),le(r.$$.fragment)},m(a,h){se(t,a,h),Rt(a,n,h),se(r,a,h),i=!0},p(a,[h]){const u={};h&2097407&&(u.$$scope={dirty:h,ctx:a}),r.$set(u)},i(a){i||(bt(t.$$.fragment,a),bt(r.$$.fragment,a),i=!0)},o(a){Lt(t.$$.fragment,a),Lt(r.$$.fragment,a),i=!1},d(a){a&&Dt(n),ae(t,a),ae(r,a)}}}function _g(e,t,n){return t+e*(n-t)}function M6(e,t,n){let r,i,a,h,u,g,w,S,I;Pe(e,gv,st=>n(9,r=st)),Pe(e,mv,st=>n(10,i=st)),Pe(e,dv,st=>n(11,a=st)),Pe(e,lf,st=>n(4,h=st)),Pe(e,Ys,st=>n(5,u=st)),Pe(e,ff,st=>n(17,g=st)),Pe(e,Ec,st=>n(18,w=st)),Pe(e,Au,st=>n(6,S=st)),Pe(e,Fg,st=>n(7,I=st)),Gu(async()=>{const st=rE(new m6);let ct=await new st;Au.set(ct)});let P;async function D(){P&&h&&P.fitBounds(await S.getBounds(),{animate:!1})}async function N(st){if(st){console.log("New map model loaded");let ct=await S.getBounds();Wn(Ec,w={lng:_g(.4,ct[0],ct[2]),lat:_g(.4,ct[1],ct[3])},w),Wn(ff,g={lng:_g(.6,ct[0],ct[2]),lat:_g(.6,ct[1],ct[3])},g),await D(),Wn(Ys,u={kind:"isochrone"},u)}}let G,Y,et;function V(st){Jn[st?"unshift":"push"](()=>{et=st,n(3,et),n(9,r)})}function j(st){P=st,n(0,P)}function X(st){Jn[st?"unshift":"push"](()=>{Y=st,n(2,Y),n(10,i)})}const ot=()=>Wn(Fg,I=!0,I);function _t(st){Jn[st?"unshift":"push"](()=>{G=st,n(1,G),n(11,a)})}return e.$$.update=()=>{e.$$.dirty&1&&P&&yy.set(P),e.$$.dirty&16&&N(h),e.$$.dirty&2050&&G&&a&&(n(1,G.innerHTML="",G),G.appendChild(a)),e.$$.dirty&1028&&Y&&i&&(n(2,Y.innerHTML="",Y),Y.appendChild(i)),e.$$.dirty&520&&et&&r&&(n(3,et.innerHTML="",et),et.appendChild(r))},[P,G,Y,et,h,u,S,I,D,r,i,a,V,j,X,ot,_t]}class A6 extends tn{constructor(t){super(),$e(this,t,M6,P6,je,{})}}new A6({target:document.getElementById("app")}); diff --git a/assets/main-abb66688.js b/assets/main-abb66688.js deleted file mode 100644 index de2d458..0000000 --- a/assets/main-abb66688.js +++ /dev/null @@ -1,642 +0,0 @@ -var RL=Object.defineProperty;var NL=(t,e,n)=>e in t?RL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var mi=(t,e,n)=>(NL(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function gt(){}function OL(t,e){for(const n in e)t[n]=e[n];return t}function zL(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function qS(t){return t()}function Kb(){return Object.create(null)}function Ni(t){t.forEach(qS)}function dy(t){return typeof t=="function"}function jt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let rg;function wo(t,e){return t===e?!0:(rg||(rg=document.createElement("a")),rg.href=e,t===rg.href)}function FL(t){return Object.keys(t).length===0}function jS(t,...e){if(t==null){for(const r of e)r(void 0);return gt}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function WS(t){let e;return jS(t,n=>e=n)(),e}function zt(t,e,n){t.$$.on_destroy.push(jS(e,n))}function ti(t,e,n,r){if(t){const i=HS(t,e,n,r);return t[0](i)}}function HS(t,e,n,r){return t[1]&&r?OL(n.ctx.slice(),t[1](r(e))):n.ctx}function ni(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],c=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function UL(t){return function(e){return e.preventDefault(),t.call(this,e)}}function W_(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Ue(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function GL(t){return t===""?null:+t}function qL(t){return Array.from(t.childNodes)}function Qn(t,e){e=""+e,t.data!==e&&(t.data=e)}function Go(t,e){t.value=e??""}function Si(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function kg(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=jL(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function gv(t,e){return Of().$$.context.set(t,e),e}function yv(t){return Of().$$.context.get(t)}function En(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const $h=[],Kn=[];let sf=[];const S0=[],XS=Promise.resolve();let E0=!1;function YS(){E0||(E0=!0,XS.then(_v))}function KS(){return YS(),XS}function yd(t){sf.push(t)}function Lo(t){S0.push(t)}const H_=new Set;let Hh=0;function _v(){if(Hh!==0)return;const t=gd;do{try{for(;Hh<$h.length;){const e=$h[Hh];Hh++,Vl(e),WL(e.$$)}}catch(e){throw $h.length=0,Hh=0,e}for(Vl(null),$h.length=0,Hh=0;Kn.length;)Kn.pop()();for(let e=0;et.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),sf=e}const yg=new Set;let wc;function Nn(){wc={r:0,c:[],p:wc}}function On(){wc.r||Ni(wc.c),wc=wc.p}function be(t,e){t&&t.i&&(yg.delete(t),t.i(e))}function Te(t,e,n,r){if(t&&t.o){if(yg.has(t))return;yg.add(t),wc.c.push(()=>{yg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function Jb(t,e){const n=e.token={};function r(i,a,c,u){if(e.token!==n)return;e.resolved=u;let g=e.ctx;c!==void 0&&(g=g.slice(),g[c]=u);const w=i&&(e.current=i)(g);let S=!1;e.block&&(e.blocks?e.blocks.forEach((I,P)=>{P!==a&&I&&(Nn(),Te(I,1,1,()=>{e.blocks[P]===I&&(e.blocks[P]=null)}),On())}):e.block.d(1),w.c(),be(w,1),w.m(e.mount(),e.anchor),S=!0),e.block=w,e.blocks&&(e.blocks[a]=w),S&&_v()}if(zL(t)){const i=Of();if(t.then(a=>{Vl(i),r(e.then,1,e.value,a),Vl(null)},a=>{if(Vl(i),r(e.catch,2,e.error,a),Vl(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function ZL(t,e,n){const r=e.slice(),{resolved:i}=t;t.current===t.then&&(r[t.value]=i),t.current===t.catch&&(r[t.error]=i),t.block.p(r,n)}function ei(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function XL(t,e){Te(t,1,1,()=>{e.delete(t.key)})}function YL(t,e,n,r,i,a,c,u,g,w,S,I){let P=t.length,D=a.length,N=P;const q={};for(;N--;)q[t[N].key]=N;const J=[],re=new Map,U=new Map,j=[];for(N=D;N--;){const pe=I(i,a,N),he=n(pe);let me=c.get(he);me?r&&j.push(()=>me.p(pe,e)):(me=w(he,pe),me.c()),re.set(he,J[N]=me),he in q&&U.set(he,Math.abs(N-q[he]))}const Z=new Set,te=new Set;function _e(pe){be(pe,1),pe.m(u,S),c.set(pe.key,pe),S=pe.first,D--}for(;P&&D;){const pe=J[D-1],he=t[P-1],me=pe.key,Ce=he.key;pe===he?(S=pe.first,P--,D--):re.has(Ce)?!c.has(me)||Z.has(me)?_e(pe):te.has(Ce)?P--:U.get(me)>U.get(Ce)?(te.add(me),_e(pe)):(Z.add(Ce),P--):(g(he,c),P--)}for(;P--;){const pe=t[P];re.has(pe.key)||g(pe,c)}for(;D;)_e(J[D-1]);return Ni(j),J}function Po(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function lt(t){t&&t.c()}function st(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),yd(()=>{const a=t.$$.on_mount.map(qS).filter(dy);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ni(a),t.$$.on_mount=[]}),i.forEach(yd)}function at(t,e){const n=t.$$;n.fragment!==null&&(HL(n.after_update),Ni(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function KL(t,e){t.$$.dirty[0]===-1&&($h.push(t),YS(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const N=D.length?D[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=N)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](N),S&&KL(t,I)),P}):[],w.update(),S=!0,Ni(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=qL(e.target);w.fragment&&w.fragment.l(I),I.forEach(De)}else w.fragment&&w.fragment.c();e.intro&&be(t.$$.fragment),st(t,e.target,e.anchor),_v()}Vl(g)}class en{constructor(){mi(this,"$$");mi(this,"$$set")}$destroy(){at(this,1),this.$destroy=gt}$on(e,n){if(!dy(n))return gt;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!FL(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const JL="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(JL);const QL="/15m/assets/logo_dark-ed08d841.svg";const $L=t=>({dialog:t&1}),Qb=t=>({dialog:t[0]});function eP(t){let e,n,r,i,a;const c=t[4].default,u=ti(c,t,t[3],Qb);return{c(){e=Oe("dialog"),n=Oe("article"),u&&u.c(),e.open=!0},m(g,w){Re(g,e,w),ke(e,n),u&&u.m(n,null),t[6](e),r=!0,i||(a=[Zt(window,"click",t[1]),Zt(window,"keydown",t[2]),Zt(e,"close",t[5])],i=!0)},p(g,[w]){u&&u.p&&(!r||w&9)&&ri(u,c,g,g[3],r?ni(c,g[3],w,$L):ii(g[3]),Qb)},i(g){r||(be(u,g),r=!0)},o(g){Te(u,g),r=!1},d(g){g&&De(e),u&&u.d(g),t[6](null),i=!1,Ni(a)}}}function tP(t,e,n){let{$$slots:r={},$$scope:i}=e,a;function c(S){a.open&&S.target==a&&a.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function g(S){En.call(this,t,S)}function w(S){Kn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,c,u,i,r,g,w]}class JS extends en{constructor(e){super(),$t(this,e,tP,eP,jt,{})}}function $b(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function ex(t){let e,n,r=t[1]+"",i,a,c,u=t[2]+"",g,w;return{c(){e=Oe("tr"),n=Oe("td"),i=kt(r),a=ft(),c=Oe("td"),g=kt(u),w=ft()},m(S,I){Re(S,e,I),ke(e,n),ke(n,i),ke(e,a),ke(e,c),ke(c,g),ke(e,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&Qn(i,r),I&1&&u!==(u=S[2]+"")&&Qn(g,u)},d(S){S&&De(e)}}}function nP(t){let e,n,r=ei(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class vv extends en{constructor(e){super(),$t(this,e,rP,nP,jt,{properties:0})}}function tx(t,e,n){const r=t.slice();return r[3]=e[n],r}function nx(t,e,n){const r=t.slice();return r[6]=e[n],r}function rx(t){let e,n;return{c(){e=Oe("span"),n=kt(`  - `),Si(e,"background",t[6]),Si(e,"width","100%"),Si(e,"border","1px solid black")},m(r,i){Re(r,e,i),ke(e,n)},p(r,i){i&1&&Si(e,"background",r[6])},d(r){r&&De(e)}}}function iP(t){let e,n=t[3]+"",r;return{c(){e=Oe("span"),r=kt(n)},m(i,a){Re(i,e,a),ke(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&Qn(r,n)},d(i){i&&De(e)}}}function oP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=Oe("span"),r=kt(n)},m(i,a){Re(i,e,a),ke(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&Qn(r,n)},d(i){i&&De(e)}}}function ix(t){let e;function n(a,c){return a[2]>0?oP:iP}let r=n(t),i=r(t);return{c(){i.c(),e=oi()},m(a,c){i.m(a,c),Re(a,e,c)},p(a,c){r===(r=n(a))&&i?i.p(a,c):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&De(e),i.d(a)}}}function sP(t){let e,n,r,i=ei(t[0]),a=[];for(let g=0;g{"colorScale"in c&&n(0,r=c.colorScale),"limits"in c&&n(1,i=c.limits),"decimalPlaces"in c&&n(2,a=c.decimalPlaces)},[r,i,a]}class QS extends en{constructor(e){super(),$t(this,e,aP,sP,jt,{colorScale:0,limits:1,decimalPlaces:2})}}function Hl(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const Zh=[];function Z_(t,e){return{subscribe:yr(t,e).subscribe}}function yr(t,e=gt){let n;const r=new Set;function i(u){if(jt(t,u)&&(t=u,n)){const g=!Zh.length;for(const w of r)w[1](),Zh.push(w,t);if(g){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:c}}/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */const $S=Symbol("Comlink.proxy"),lP=Symbol("Comlink.endpoint"),uP=Symbol("Comlink.releaseProxy"),X_=Symbol("Comlink.finalizer"),_g=Symbol("Comlink.thrown"),eE=t=>typeof t=="object"&&t!==null||typeof t=="function",cP={canHandle:t=>eE(t)&&t[$S],serialize(t){const{port1:e,port2:n}=new MessageChannel;return bv(t,e),[n,[n]]},deserialize(t){return t.start(),rE(t)}},hP={canHandle:t=>eE(t)&&_g in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},tE=new Map([["proxy",cP],["throw",hP]]);function fP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function bv(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!fP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:c,path:u}=Object.assign({path:[]},i.data),g=(i.data.argumentList||[]).map(xc);let w;try{const S=u.slice(0,-1).reduce((P,D)=>P[D],t),I=u.reduce((P,D)=>P[D],t);switch(c){case"GET":w=I;break;case"SET":S[u.slice(-1)[0]]=xc(i.data.value),w=!0;break;case"APPLY":w=I.apply(S,g);break;case"CONSTRUCT":{const P=new I(...g);w=sE(P)}break;case"ENDPOINT":{const{port1:P,port2:D}=new MessageChannel;bv(t,D),w=yP(P,[P])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[_g]:0}}Promise.resolve(w).catch(S=>({value:S,[_g]:0})).then(S=>{const[I,P]=Ng(S);e.postMessage(Object.assign(Object.assign({},I),{id:a}),P),c==="RELEASE"&&(e.removeEventListener("message",r),nE(e),X_ in t&&typeof t[X_]=="function"&&t[X_]())}).catch(S=>{const[I,P]=Ng({value:new TypeError("Unserializable return value"),[_g]:0});e.postMessage(Object.assign(Object.assign({},I),{id:a}),P)})}),e.start&&e.start()}function pP(t){return t.constructor.name==="MessagePort"}function nE(t){pP(t)&&t.close()}function rE(t,e){return I0(t,[],e)}function ig(t){if(t)throw new Error("Proxy has been released and is not useable")}function iE(t){return ef(t,{type:"RELEASE"}).then(()=>{nE(t)})}const Dg=new WeakMap,Rg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Dg.get(t)||0)-1;Dg.set(t,e),e===0&&iE(t)});function dP(t,e){const n=(Dg.get(e)||0)+1;Dg.set(e,n),Rg&&Rg.register(t,e,t)}function mP(t){Rg&&Rg.unregister(t)}function I0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(ig(r),c===uP)return()=>{mP(i),iE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const u=ef(t,{type:"GET",path:e.map(g=>g.toString())}).then(xc);return u.then.bind(u)}return I0(t,[...e,c])},set(a,c,u){ig(r);const[g,w]=Ng(u);return ef(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:g},w).then(xc)},apply(a,c,u){ig(r);const g=e[e.length-1];if(g===lP)return ef(t,{type:"ENDPOINT"}).then(xc);if(g==="bind")return I0(t,e.slice(0,-1));const[w,S]=ox(u);return ef(t,{type:"APPLY",path:e.map(I=>I.toString()),argumentList:w},S).then(xc)},construct(a,c){ig(r);const[u,g]=ox(c);return ef(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:u},g).then(xc)}});return dP(i,t),i}function gP(t){return Array.prototype.concat.apply([],t)}function ox(t){const e=t.map(Ng);return[e.map(n=>n[0]),gP(e.map(n=>n[1]))]}const oE=new WeakMap;function yP(t,e){return oE.set(t,e),t}function sE(t){return Object.assign(t,{[$S]:!0})}function Ng(t){for(const[e,n]of tE)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},oE.get(t)||[]]}function xc(t){switch(t.type){case"HANDLER":return tE.get(t.name).deserialize(t.value);case"RAW":return t.value}}function ef(t,e,n){return new Promise(r=>{const i=_P();t.addEventListener("message",function a(c){!c.data||!c.data.id||c.data.id!==i||(t.removeEventListener("message",a),r(c.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)})}function _P(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let cn;const Bl=new Array(128).fill(void 0);Bl.push(void 0,null,!0,!1);function Fn(t){return Bl[t]}let ud=Bl.length;function vP(t){t<132||(Bl[t]=ud,ud=t)}function bc(t){const e=Fn(t);return vP(t),e}let Sc=0,rd=null;function cd(){return(rd===null||rd.byteLength===0)&&(rd=new Uint8Array(cn.memory.buffer)),rd}const vg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},bP=typeof vg.encodeInto=="function"?function(t,e){return vg.encodeInto(t,e)}:function(t,e){const n=vg.encode(t);return e.set(n),{read:t.length,written:n.length}};function Y_(t,e,n){if(n===void 0){const u=vg.encode(t),g=e(u.length,1)>>>0;return cd().subarray(g,g+u.length).set(u),Sc=u.length,g}let r=t.length,i=e(r,1)>>>0;const a=cd();let c=0;for(;c127)break;a[i+c]=u}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const u=cd().subarray(i+c,i+r),g=bP(t,u);c+=g.written,i=n(i,r,c,1)>>>0}return Sc=c,i}function bg(t){return t==null}let id=null;function qn(){return(id===null||id.byteLength===0)&&(id=new Int32Array(cn.memory.buffer)),id}const aE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&aE.decode();function il(t,e){return t=t>>>0,aE.decode(cd().subarray(t,t+e))}function bi(t){ud===Bl.length&&Bl.push(Bl.length+1);const e=ud;return ud=Bl[e],Bl[e]=t,e}let od=null;function lE(){return(od===null||od.byteLength===0)&&(od=new Float64Array(cn.memory.buffer)),od}function C0(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let a="[";i>0&&(a+=C0(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:r}function xP(t,e){const n=e(t.length*1,1)>>>0;return cd().set(t,n/1),Sc=t.length,n}function wP(t,e){return t=t>>>0,lE().subarray(t/8,t/8+e)}function Xh(t,e){try{return t.apply(this,e)}catch(n){cn.__wbindgen_exn_store(bi(n))}}const SP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>cn.__wbg_mapmodel_free(t>>>0));class sx{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,SP.unregister(this),e}free(){const e=this.__destroy_into_raw();cn.__wbg_mapmodel_free(e)}constructor(e,n,r){try{const u=cn.__wbindgen_add_to_stack_pointer(-16),g=xP(e,cn.__wbindgen_malloc),w=Sc;cn.mapmodel_new(u,g,w,n,bg(r)?0:bi(r));var i=qn()[u/4+0],a=qn()[u/4+1],c=qn()[u/4+2];if(c)throw bc(a);return this.__wbg_ptr=i>>>0,this}finally{cn.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_renderDebug(w,this.__wbg_ptr);var r=qn()[w/4+0],i=qn()[w/4+1],a=qn()[w/4+2],c=qn()[w/4+3],u=r,g=i;if(c)throw u=0,g=0,bc(a);return e=u,n=g,il(u,g)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=qn()[w/4+0],i=qn()[w/4+1],a=qn()[w/4+2],c=qn()[w/4+3],u=r,g=i;if(c)throw u=0,g=0,bc(a);return e=u,n=g,il(u,g)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}getBounds(){try{const i=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getBounds(i,this.__wbg_ptr);var e=qn()[i/4+0],n=qn()[i/4+1],r=wP(e,n).slice();return cn.__wbindgen_free(e,n*8,8),r}finally{cn.__wbindgen_add_to_stack_pointer(16)}}isochrone(e){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_isochrone(S,this.__wbg_ptr,bi(e));var i=qn()[S/4+0],a=qn()[S/4+1],c=qn()[S/4+2],u=qn()[S/4+3],g=i,w=a;if(u)throw g=0,w=0,bc(c);return n=g,r=w,il(g,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_route(S,this.__wbg_ptr,bi(e));var i=qn()[S/4+0],a=qn()[S/4+1],c=qn()[S/4+2],u=qn()[S/4+3],g=i,w=a;if(u)throw g=0,w=0,bc(c);return n=g,r=w,il(g,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}score(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_score(w,this.__wbg_ptr);var r=qn()[w/4+0],i=qn()[w/4+1],a=qn()[w/4+2],c=qn()[w/4+3],u=r,g=i;if(c)throw u=0,g=0,bc(a);return e=u,n=g,il(u,g)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}}async function EP(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.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",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function IP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){bc(e)},t.wbg.__wbindgen_boolean_get=function(e){const n=Fn(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_string_get=function(e,n){const r=Fn(n),i=typeof r=="string"?r:void 0;var a=bg(i)?0:Y_(i,cn.__wbindgen_malloc,cn.__wbindgen_realloc),c=Sc;qn()[e/4+1]=c,qn()[e/4+0]=a},t.wbg.__wbindgen_string_new=function(e,n){const r=il(e,n);return bi(r)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(il(e,n));return bi(r)},t.wbg.__wbindgen_is_object=function(e){const n=Fn(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return Fn(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return Fn(e)in Fn(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=Fn(n),i=typeof r=="number"?r:void 0;lE()[e/8+1]=bg(i)?0:i,qn()[e/4+0]=!bg(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return Fn(e)==Fn(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=Fn(e)[Fn(n)];return bi(r)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=Fn(e);return bi(n)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(Fn(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(Fn(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(Fn(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(Fn(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(Fn(e))},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return bi(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=Fn(n).stack,i=Y_(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Sc;qn()[e/4+1]=a,qn()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(il(e,n))}finally{cn.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=Fn(e).performance;return bi(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return Fn(e).now()},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(il(e,n));return bi(r)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return Xh(function(e,n){const r=Fn(e).call(Fn(n));return bi(r)},arguments)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Xh(function(){const e=self.self;return bi(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return Xh(function(){const e=window.window;return bi(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Xh(function(){const e=globalThis.globalThis;return bi(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return Xh(function(){const e=global.global;return bi(e)},arguments)},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=Fn(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Xh(function(e,n,r){const i=Fn(e).call(Fn(n),Fn(r));return bi(i)},arguments)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=Fn(e).buffer;return bi(n)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(Fn(e));return bi(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){Fn(e).set(Fn(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return Fn(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=Fn(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const r=C0(Fn(n)),i=Y_(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Sc;qn()[e/4+1]=a,qn()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(il(e,n))},t.wbg.__wbindgen_memory=function(){const e=cn.memory;return bi(e)},t}function CP(t,e){return cn=t.exports,T0.__wbindgen_wasm_module=e,od=null,id=null,rd=null,cn}async function T0(t){if(cn!==void 0)return cn;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=IP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await EP(await t,e);return CP(n,r)}class TP{constructor(){mi(this,"inner");this.inner=null}async loadOsmFile(e,n){await T0(),this.inner=new sx(e,!0,n)}async loadGraphFile(e){await T0(),this.inner=new sx(e,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}score(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score())}}bv(TP);let uE="MZEJTanw3WpxRvt7qDfo",Ys=yr({kind:"title"}),my=yr(null),Og=yr(!0);function ax(t){return["!=",["get",`access_${t}`],"None"]}let cf=yr("foot"),zg=yr("07:00"),lx=yr(!0),ku=yr(null),af=yr(!1);function ux(t){let e,n;return e=new JS({props:{$$slots:{default:[LP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function LP(t){let e,n,r,i,a,c,u,g,w,S;function I(){return t[1](t[3])}return{c(){e=Oe("h1"),e.textContent="15-minute neighborhood tool",n=ft(),r=Oe("p"),r.textContent="TODO. Extremely early in development.",i=ft(),a=Oe("p"),a.innerHTML=`This open source - tool is created by - Dustin Carlino - and relies heavily on - OpenStreetMap data.`,c=ft(),u=Oe("center"),g=Oe("button"),g.textContent="Start!"},m(P,D){Re(P,e,D),Re(P,n,D),Re(P,r,D),Re(P,i,D),Re(P,a,D),Re(P,c,D),Re(P,u,D),ke(u,g),w||(S=Zt(g,"click",I),w=!0)},p(P,D){t=P},d(P){P&&(De(e),De(n),De(r),De(i),De(a),De(c),De(u)),w=!1,S()}}}function PP(t){let e,n,r=t[0]&&ux(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=ux(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function MP(t,e,n){let r;return zt(t,Og,c=>n(0,r=c)),[r,c=>Hl(c).close(),()=>ur(Og,r=!1,r)]}class AP extends en{constructor(e){super(),$t(this,e,MP,PP,jt,{})}}var Bd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function gy(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var cx=Object.prototype.toString,cE=function(e){var n=cx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&cx.call(e.callee)==="[object Function]"),r},K_,hx;function kP(){if(hx)return K_;hx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=cE,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=function(P){var D=P.constructor;return D&&D.prototype===P},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var P in window)try{if(!w["$"+P]&&e.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{g(window[P])}catch{return!0}}catch{return!0}return!1}(),I=function(P){if(typeof window>"u"||!S)return g(P);try{return g(P)}catch{return!1}};t=function(D){var N=D!==null&&typeof D=="object",q=n.call(D)==="[object Function]",J=r(D),re=N&&n.call(D)==="[object String]",U=[];if(!N&&!q&&!J)throw new TypeError("Object.keys called on a non-object");var j=c&&q;if(re&&D.length>0&&!e.call(D,0))for(var Z=0;Z0)for(var te=0;te"u"||!Vi?Rn:Vi(Uint8Array),Ic={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Rn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Rn:ArrayBuffer,"%ArrayIteratorPrototype%":Yh&&Vi?Vi([][Symbol.iterator]()):Rn,"%AsyncFromSyncIteratorPrototype%":Rn,"%AsyncFunction%":tf,"%AsyncGenerator%":tf,"%AsyncGeneratorFunction%":tf,"%AsyncIteratorPrototype%":tf,"%Atomics%":typeof Atomics>"u"?Rn:Atomics,"%BigInt%":typeof BigInt>"u"?Rn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Rn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Rn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Rn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":eM,"%eval%":eval,"%EvalError%":tM,"%Float32Array%":typeof Float32Array>"u"?Rn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Rn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Rn:FinalizationRegistry,"%Function%":pE,"%GeneratorFunction%":tf,"%Int8Array%":typeof Int8Array>"u"?Rn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Rn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Rn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Yh&&Vi?Vi(Vi([][Symbol.iterator]())):Rn,"%JSON%":typeof JSON=="object"?JSON:Rn,"%Map%":typeof Map>"u"?Rn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Yh||!Vi?Rn:Vi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Rn:Promise,"%Proxy%":typeof Proxy>"u"?Rn:Proxy,"%RangeError%":nM,"%ReferenceError%":rM,"%Reflect%":typeof Reflect>"u"?Rn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Rn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Yh||!Vi?Rn:Vi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Rn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Yh&&Vi?Vi(""[Symbol.iterator]()):Rn,"%Symbol%":Yh?Symbol:Rn,"%SyntaxError%":hf,"%ThrowTypeError%":oM,"%TypedArray%":aM,"%TypeError%":lf,"%Uint8Array%":typeof Uint8Array>"u"?Rn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Rn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Rn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Rn:Uint32Array,"%URIError%":iM,"%WeakMap%":typeof WeakMap>"u"?Rn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Rn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Rn:WeakSet};if(Vi)try{null.error}catch(t){var lM=Vi(Vi(t));Ic["%Error.prototype%"]=lM}var uM=function t(e){var n;if(e==="%AsyncFunction%")n=Q_("async function () {}");else if(e==="%GeneratorFunction%")n=Q_("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Q_("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Vi&&(n=Vi(i.prototype))}return Ic[e]=n,n},gx={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Vd=Ev,Fg=fE,cM=Vd.call(Function.call,Array.prototype.concat),hM=Vd.call(Function.apply,Array.prototype.splice),yx=Vd.call(Function.call,String.prototype.replace),Bg=Vd.call(Function.call,String.prototype.slice),fM=Vd.call(Function.call,RegExp.prototype.exec),pM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,dM=/\\(\\)?/g,mM=function(e){var n=Bg(e,0,1),r=Bg(e,-1);if(n==="%"&&r!=="%")throw new hf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new hf("invalid intrinsic syntax, expected opening `%`");var i=[];return yx(e,pM,function(a,c,u,g){i[i.length]=u?yx(g,dM,"$1"):c||a}),i},gM=function(e,n){var r=e,i;if(Fg(gx,r)&&(i=gx[r],r="%"+i[0]+"%"),Fg(Ic,r)){var a=Ic[r];if(a===tf&&(a=uM(r)),typeof a>"u"&&!n)throw new lf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new hf("intrinsic "+e+" does not exist!")},gl=function(e,n){if(typeof e!="string"||e.length===0)throw new lf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new lf('"allowMissing" argument must be a boolean');if(fM(/^%?[^%]*%?$/,e)===null)throw new hf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=mM(e),i=r.length>0?r[0]:"",a=gM("%"+i+"%",n),c=a.name,u=a.value,g=!1,w=a.alias;w&&(i=w[0],hM(r,cM([0,1],w)));for(var S=1,I=!0;S=r.length){var q=Ec(u,P);I=!!q,I&&"get"in q&&!("originalValue"in q.get)?u=q.get:u=u[P]}else I=Fg(u,P),u=u[P];I&&!g&&(Ic[c]=u)}}return u},e0,_x;function Iv(){if(_x)return e0;_x=1;var t=gl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return e0=e,e0}var yM=gl,wg=yM("%Object.getOwnPropertyDescriptor%",!0);if(wg)try{wg([],"length")}catch{wg=null}var Cv=wg,vx=Iv(),_M=hE,Kh=ju,bx=Cv,Tv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Kh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Kh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Kh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Kh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Kh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Kh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,g=!!bx&&bx(e,n);if(vx)vx(e,n,{configurable:c===null&&g?g.configurable:!c,enumerable:i===null&&g?g.enumerable:!i,value:r,writable:a===null&&g?g.writable:!a});else if(u||!i&&!a&&!c)e[n]=r;else throw new _M("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},L0=Iv(),dE=function(){return!!L0};dE.hasArrayLengthDefineBug=function(){if(!L0)return null;try{return L0([],"length",{value:1}).length!==1}catch{return!0}};var Lv=dE,vM=wv,bM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",xM=Object.prototype.toString,wM=Array.prototype.concat,xx=Tv,SM=function(t){return typeof t=="function"&&xM.call(t)==="[object Function]"},mE=Lv(),EM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!SM(r)||!r())return}mE?xx(t,e,n,!0):xx(t,e,n)},gE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=vM(e);bM&&(r=wM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||TM(n)!==n)throw new Ex("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Sx){var c=Sx(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(CM?wx(e,"length",n,!0,!0):wx(e,"length",n)),e};(function(t){var e=Ev,n=gl,r=LM,i=ju,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||e.call(c,a),g=Iv(),w=n("%Math.max%");t.exports=function(P){if(typeof P!="function")throw new i("a function is required");var D=u(e,c,arguments);return r(D,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(e,a,arguments)};g?g(t.exports,"apply",{value:S}):t.exports.apply=S})(yE);var zf=yE.exports,_E=gl,vE=zf,PM=vE(_E("String.prototype.indexOf")),fa=function(e,n){var r=_E(e,!!n);return typeof r=="function"&&PM(e,".prototype.")>-1?vE(r):r},MM=wv,bE=yy(),xE=fa,Ix=Object,AM=xE("Array.prototype.push"),Cx=xE("Object.prototype.propertyIsEnumerable"),kM=bE?Object.getOwnPropertySymbols:null,wE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Ix(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||ZM)&&(HM?Tx(e,"name",n,!0,!0):Tx(e,"name",n)),e},KM=YM,JM=ju,QM=Object,CE=KM(function(){if(this==null||this!==QM(this))throw new JM("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),$M=CE,eA=Uc.supportsDescriptors,tA=Object.getOwnPropertyDescriptor,TE=function(){if(eA&&/a/mig.flags==="gim"){var e=tA(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return $M},nA=Uc.supportsDescriptors,rA=TE,iA=Object.getOwnPropertyDescriptor,oA=Object.defineProperty,sA=TypeError,Lx=Object.getPrototypeOf,aA=/a/,lA=function(){if(!nA||!Lx)throw new sA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=rA(),n=Lx(aA),r=iA(n,"flags");return(!r||r.get!==e)&&oA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},uA=Uc,cA=zf,hA=CE,LE=TE,fA=lA,PE=cA(LE());uA(PE,{getPolyfill:LE,implementation:hA,shim:fA});var pA=PE,Sg={exports:{}},dA=yy,Gc=function(){return dA()&&!!Symbol.toStringTag},mA=Gc(),gA=fa,P0=gA("Object.prototype.toString"),_y=function(e){return mA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:P0(e)==="[object Arguments]"},ME=function(e){return _y(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&P0(e)!=="[object Array]"&&P0(e.callee)==="[object Function]"},yA=function(){return _y(arguments)}();_y.isLegacyArguments=ME;var AE=yA?_y:ME;const _A={},vA=Object.freeze(Object.defineProperty({__proto__:null,default:_A},Symbol.toStringTag,{value:"Module"})),bA=gy(vA);var Pv=typeof Map=="function"&&Map.prototype,n0=Object.getOwnPropertyDescriptor&&Pv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vg=Pv&&n0&&typeof n0.get=="function"?n0.get:null,Px=Pv&&Map.prototype.forEach,Mv=typeof Set=="function"&&Set.prototype,r0=Object.getOwnPropertyDescriptor&&Mv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ug=Mv&&r0&&typeof r0.get=="function"?r0.get:null,Mx=Mv&&Set.prototype.forEach,xA=typeof WeakMap=="function"&&WeakMap.prototype,fd=xA?WeakMap.prototype.has:null,wA=typeof WeakSet=="function"&&WeakSet.prototype,pd=wA?WeakSet.prototype.has:null,SA=typeof WeakRef=="function"&&WeakRef.prototype,Ax=SA?WeakRef.prototype.deref:null,EA=Boolean.prototype.valueOf,IA=Object.prototype.toString,CA=Function.prototype.toString,TA=String.prototype.match,Av=String.prototype.slice,Lu=String.prototype.replace,LA=String.prototype.toUpperCase,kx=String.prototype.toLowerCase,kE=RegExp.prototype.test,Dx=Array.prototype.concat,rl=Array.prototype.join,PA=Array.prototype.slice,Rx=Math.floor,M0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,i0=Object.getOwnPropertySymbols,A0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ff=typeof Symbol=="function"&&typeof Symbol.iterator=="object",So=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ff||"symbol")?Symbol.toStringTag:null,DE=Object.prototype.propertyIsEnumerable,Nx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Ox(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||kE.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Rx(-t):Rx(t);if(r!==t){var i=String(r),a=Av.call(e,i.length+1);return Lu.call(i,n,"$&_")+"."+Lu.call(Lu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Lu.call(e,n,"$&_")}var k0=bA,zx=k0.custom,Fx=NE(zx)?zx:null,MA=function t(e,n,r,i){var a=n||{};if(Cu(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Cu(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=Cu(a,"customInspect")?a.customInspect:!0;if(typeof c!="boolean"&&c!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Cu(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Cu(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return zE(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var g=String(e);return u?Ox(e,g):g}if(typeof e=="bigint"){var w=String(e)+"n";return u?Ox(e,w):w}var S=typeof a.depth>"u"?5:a.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof e=="object")return D0(e)?"[Array]":"[Object]";var I=XA(a,r);if(typeof i>"u")i=[];else if(OE(i,e)>=0)return"[Circular]";function P(Ke,Se,Ze){if(Se&&(i=PA.call(i),i.push(Se)),Ze){var tt={depth:a.depth};return Cu(a,"quoteStyle")&&(tt.quoteStyle=a.quoteStyle),t(Ke,tt,r+1,i)}return t(Ke,a,r+1,i)}if(typeof e=="function"&&!Bx(e)){var D=BA(e),N=og(e,P);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(N.length>0?" { "+rl.call(N,", ")+" }":"")}if(NE(e)){var q=ff?Lu.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):A0.call(e);return typeof e=="object"&&!ff?Yp(q):q}if(WA(e)){for(var J="<"+kx.call(String(e.nodeName)),re=e.attributes||[],U=0;U",J}if(D0(e)){if(e.length===0)return"[]";var j=og(e,P);return I&&!ZA(j)?"["+R0(j,I)+"]":"[ "+rl.call(j,", ")+" ]"}if(DA(e)){var Z=og(e,P);return!("cause"in Error.prototype)&&"cause"in e&&!DE.call(e,"cause")?"{ ["+String(e)+"] "+rl.call(Dx.call("[cause]: "+P(e.cause),Z),", ")+" }":Z.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+rl.call(Z,", ")+" }"}if(typeof e=="object"&&c){if(Fx&&typeof e[Fx]=="function"&&k0)return k0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(VA(e)){var te=[];return Px&&Px.call(e,function(Ke,Se){te.push(P(Se,e,!0)+" => "+P(Ke,e))}),Vx("Map",Vg.call(e),te,I)}if(qA(e)){var _e=[];return Mx&&Mx.call(e,function(Ke){_e.push(P(Ke,e))}),Vx("Set",Ug.call(e),_e,I)}if(UA(e))return o0("WeakMap");if(jA(e))return o0("WeakSet");if(GA(e))return o0("WeakRef");if(NA(e))return Yp(P(Number(e)));if(zA(e))return Yp(P(M0.call(e)));if(OA(e))return Yp(EA.call(e));if(RA(e))return Yp(P(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Bd)return"{ [object globalThis] }";if(!kA(e)&&!Bx(e)){var pe=og(e,P),he=Nx?Nx(e)===Object.prototype:e instanceof Object||e.constructor===Object,me=e instanceof Object?"":"null prototype",Ce=!he&&So&&Object(e)===e&&So in e?Av.call(Wu(e),8,-1):me?"Object":"",H=he||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",ce=H+(Ce||me?"["+rl.call(Dx.call([],Ce||[],me||[]),": ")+"] ":"");return pe.length===0?ce+"{}":I?ce+"{"+R0(pe,I)+"}":ce+"{ "+rl.call(pe,", ")+" }"}return String(e)};function RE(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function AA(t){return Lu.call(String(t),/"/g,""")}function D0(t){return Wu(t)==="[object Array]"&&(!So||!(typeof t=="object"&&So in t))}function kA(t){return Wu(t)==="[object Date]"&&(!So||!(typeof t=="object"&&So in t))}function Bx(t){return Wu(t)==="[object RegExp]"&&(!So||!(typeof t=="object"&&So in t))}function DA(t){return Wu(t)==="[object Error]"&&(!So||!(typeof t=="object"&&So in t))}function RA(t){return Wu(t)==="[object String]"&&(!So||!(typeof t=="object"&&So in t))}function NA(t){return Wu(t)==="[object Number]"&&(!So||!(typeof t=="object"&&So in t))}function OA(t){return Wu(t)==="[object Boolean]"&&(!So||!(typeof t=="object"&&So in t))}function NE(t){if(ff)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!A0)return!1;try{return A0.call(t),!0}catch{}return!1}function zA(t){if(!t||typeof t!="object"||!M0)return!1;try{return M0.call(t),!0}catch{}return!1}var FA=Object.prototype.hasOwnProperty||function(t){return t in this};function Cu(t,e){return FA.call(t,e)}function Wu(t){return IA.call(t)}function BA(t){if(t.name)return t.name;var e=TA.call(CA.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function OE(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return zE(Av.call(t,0,e.maxStringLength),e)+r}var i=Lu.call(Lu.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,HA);return RE(i,"single",e)}function HA(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+LA.call(e.toString(16))}function Yp(t){return"Object("+t+")"}function o0(t){return t+" { ? }"}function Vx(t,e,n,r){var i=r?R0(n,r):rl.call(n,", ");return t+" ("+e+") {"+i+"}"}function ZA(t){for(var e=0;e=0)return!1;return!0}function XA(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=rl.call(Array(t.indent+1)," ");else return null;return{base:n,prev:rl.call(Array(e+1),n)}}function R0(t,e){if(t.length===0)return"";var n=` -`+e.prev+e.base;return n+rl.call(t,","+n)+` -`+e.prev}function og(t,e){var n=D0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=Xx(e,n);if(i<55296||i>56319)return n+1;var a=Xx(e,n+1);return a<56320||a>57343?n+1:n+2},a0=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},Yx=function(e,n){if(_k(e)||jx(e))return a0(e);if(vk(e)){var r=0;return{next:function(){var a=Sk(e,r),c=wk(e,r,a);return r=a,{done:a>e.length,value:c}}}}if(n&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!bk&&!xk)Sg.exports=function(e){if(e!=null)return Yx(e,!0)};else{var Ek=qE,Ik=WE,Kx=Sa("Map.prototype.forEach",!0),Jx=Sa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Qx=Sa("Map.prototype.iterator",!0),$x=Sa("Set.prototype.iterator",!0);var ew=Sa("Map.prototype.@@iterator",!0)||Sa("Map.prototype._es6-shim iterator_",!0),tw=Sa("Set.prototype.@@iterator",!0)||Sa("Set.prototype._es6-shim iterator_",!0),Ck=function(e){if(Ek(e)){if(Qx)return Wx(Qx(e));if(ew)return ew(e);if(Kx){var n=[];return Kx(e,function(i,a){Zx(n,[a,i])}),a0(n)}}if(Ik(e)){if($x)return Wx($x(e));if(tw)return tw(e);if(Jx){var r=[];return Jx(e,function(i){Zx(r,i)}),a0(r)}}};Sg.exports=function(e){return Ck(e)||Yx(e)}}}var Tk=Sg.exports,nw=function(t){return t!==t},HE=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||nw(e)&&nw(n))},Lk=HE,ZE=function(){return typeof Object.is=="function"?Object.is:Lk},Pk=ZE,Mk=Uc,Ak=function(){var e=Pk();return Mk(Object,{is:e},{is:function(){return Object.is!==e}}),e},kk=Uc,Dk=zf,Rk=HE,XE=ZE,Nk=Ak,YE=Dk(XE(),Object);kk(YE,{getPolyfill:XE,implementation:Rk,shim:Nk});var Ok=YE,zk=zf,KE=fa,Fk=gl,N0=Fk("%ArrayBuffer%",!0),Eg=KE("ArrayBuffer.prototype.byteLength",!0),Bk=KE("Object.prototype.toString"),rw=!!N0&&!Eg&&new N0(0).slice,iw=!!rw&&zk(rw),JE=Eg||iw?function(e){if(!e||typeof e!="object")return!1;try{return Eg?Eg(e):iw(e,0),!0}catch{return!1}}:N0?function(e){return Bk(e)==="[object ArrayBuffer]"}:function(e){return!1},Vk=Date.prototype.getDay,Uk=function(e){try{return Vk.call(e),!0}catch{return!1}},Gk=Object.prototype.toString,qk="[object Date]",jk=Gc(),Wk=function(e){return typeof e!="object"||e===null?!1:jk?Uk(e):Gk.call(e)===qk},O0=fa,QE=Gc(),$E,eI,z0,F0;if(QE){$E=O0("Object.prototype.hasOwnProperty"),eI=O0("RegExp.prototype.exec"),z0={};var l0=function(){throw z0};F0={toString:l0,valueOf:l0},typeof Symbol.toPrimitive=="symbol"&&(F0[Symbol.toPrimitive]=l0)}var Hk=O0("Object.prototype.toString"),Zk=Object.getOwnPropertyDescriptor,Xk="[object RegExp]",Yk=QE?function(e){if(!e||typeof e!="object")return!1;var n=Zk(e,"lastIndex"),r=n&&$E(n,"value");if(!r)return!1;try{eI(e,F0)}catch(i){return i===z0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:Hk(e)===Xk},Kk=fa,ow=Kk("SharedArrayBuffer.prototype.byteLength",!0),Jk=ow?function(e){if(!e||typeof e!="object")return!1;try{return ow(e),!0}catch{return!1}}:function(e){return!1},Qk=Number.prototype.toString,$k=function(e){try{return Qk.call(e),!0}catch{return!1}},e3=Object.prototype.toString,t3="[object Number]",n3=Gc(),r3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:n3?$k(e):e3.call(e)===t3},tI=fa,i3=tI("Boolean.prototype.toString"),o3=tI("Object.prototype.toString"),s3=function(e){try{return i3(e),!0}catch{return!1}},a3="[object Boolean]",l3=Gc(),u3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:l3&&Symbol.toStringTag in e?s3(e):o3(e)===a3},B0={exports:{}},c3=Object.prototype.toString,h3=Sv();if(h3){var f3=Symbol.prototype.toString,p3=/^Symbol\(.*\)$/,d3=function(e){return typeof e.valueOf()!="symbol"?!1:p3.test(f3.call(e))};B0.exports=function(e){if(typeof e=="symbol")return!0;if(c3.call(e)!=="[object Symbol]")return!1;try{return d3(e)}catch{return!1}}}else B0.exports=function(e){return!1};var m3=B0.exports,V0={exports:{}},sw=typeof BigInt<"u"&&BigInt,g3=function(){return typeof sw=="function"&&typeof BigInt=="function"&&typeof sw(42)=="bigint"&&typeof BigInt(42)=="bigint"},y3=g3();if(y3){var _3=BigInt.prototype.valueOf,v3=function(e){try{return _3.call(e),!0}catch{}return!1};V0.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:v3(e)}}else V0.exports=function(e){return!1};var b3=V0.exports,x3=UE,w3=r3,S3=u3,E3=m3,I3=b3,C3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(x3(e))return"String";if(w3(e))return"Number";if(S3(e))return"Boolean";if(E3(e))return"Symbol";if(I3(e))return"BigInt"},jg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,aw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Wg;jg||(Wg=function(e){return!1});var U0=jg?jg.prototype.has:null,u0=aw?aw.prototype.has:null;!Wg&&!U0&&(Wg=function(e){return!1});var T3=Wg||function(e){if(!e||typeof e!="object")return!1;try{if(U0.call(e,U0),u0)try{u0.call(e,u0)}catch{return!0}return e instanceof jg}catch{}return!1},G0={exports:{}},L3=gl,nI=fa,P3=L3("%WeakSet%",!0),c0=nI("WeakSet.prototype.has",!0);if(c0){var h0=nI("WeakMap.prototype.has",!0);G0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(c0(e,c0),h0)try{h0(e,h0)}catch{return!0}return e instanceof P3}catch{}return!1}}else G0.exports=function(e){return!1};var M3=G0.exports,A3=qE,k3=WE,D3=T3,R3=M3,N3=function(e){if(e&&typeof e=="object"){if(A3(e))return"Map";if(k3(e))return"Set";if(D3(e))return"WeakMap";if(R3(e))return"WeakSet"}return!1},rI=Function.prototype.toString,rf=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,q0,Ig;if(typeof rf=="function"&&typeof Object.defineProperty=="function")try{q0=Object.defineProperty({},"length",{get:function(){throw Ig}}),Ig={},rf(function(){throw 42},null,q0)}catch(t){t!==Ig&&(rf=null)}else rf=null;var O3=/^\s*class\b/,j0=function(e){try{var n=rI.call(e);return O3.test(n)}catch{return!1}},f0=function(e){try{return j0(e)?!1:(rI.call(e),!0)}catch{return!1}},Cg=Object.prototype.toString,z3="[object Object]",F3="[object Function]",B3="[object GeneratorFunction]",V3="[object HTMLAllCollection]",U3="[object HTML document.all class]",G3="[object HTMLCollection]",q3=typeof Symbol=="function"&&!!Symbol.toStringTag,j3=!(0 in[,]),W0=function(){return!1};if(typeof document=="object"){var W3=document.all;Cg.call(W3)===Cg.call(document.all)&&(W0=function(e){if((j3||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Cg.call(e);return(n===V3||n===U3||n===G3||n===z3)&&e("")==null}catch{}return!1})}var H3=rf?function(e){if(W0(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{rf(e,null,q0)}catch(n){if(n!==Ig)return!1}return!j0(e)&&f0(e)}:function(e){if(W0(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(q3)return f0(e);if(j0(e))return!1;var n=Cg.call(e);return n!==F3&&n!==B3&&!/^\[object HTML/.test(n)?!1:f0(e)},Z3=H3,X3=Object.prototype.toString,iI=Object.prototype.hasOwnProperty,Y3=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),X3.call(e)==="[object Array]"?Y3(e,n,i):typeof e=="string"?K3(e,n,i):J3(e,n,i)},$3=Q3,e4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],p0=e4,t4=typeof globalThis>"u"?Bd:globalThis,n4=function(){for(var e=[],n=0;n"u"?Bd:globalThis,H0=r4(),zv=Ov("String.prototype.slice"),d0=Object.getPrototypeOf,o4=Ov("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:a4(e)}return Tg?s4(e):null},u4=fa,cw=u4("ArrayBuffer.prototype.byteLength",!0),c4=JE,h4=function(e){return c4(e)?cw?cw(e):e.byteLength:NaN},sI=qM,yl=fa,hw=pA,f4=gl,pf=Tk,p4=BE,fw=Ok,pw=AE,dw=VE,mw=JE,gw=Wk,yw=Yk,_w=Jk,vw=wv,bw=C3,xw=N3,ww=l4,Sw=h4,Ew=yl("SharedArrayBuffer.prototype.byteLength",!0),Iw=yl("Date.prototype.getTime"),m0=Object.getPrototypeOf,Cw=yl("Object.prototype.toString"),Xg=f4("%Set%",!0),Z0=yl("Map.prototype.has",!0),Yg=yl("Map.prototype.get",!0),Tw=yl("Map.prototype.size",!0),Kg=yl("Set.prototype.add",!0),aI=yl("Set.prototype.delete",!0),Jg=yl("Set.prototype.has",!0),Lg=yl("Set.prototype.size",!0);function Lw(t,e,n,r){for(var i=pf(t),a;(a=i.next())&&!a.done;)if(Ca(e,a.value,n,r))return aI(t,a.value),!0;return!1}function lI(t){if(typeof t>"u")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function d4(t,e,n,r,i,a){var c=lI(n);if(c!=null)return c;var u=Yg(e,c),g=sI({},i,{strict:!1});return typeof u>"u"&&!Z0(e,c)||!Ca(r,u,g,a)?!1:!Z0(t,c)&&Ca(r,u,g,a)}function m4(t,e,n){var r=lI(n);return r??(Jg(e,r)&&!Jg(t,r))}function Pw(t,e,n,r,i,a){for(var c=pf(t),u,g;(u=c.next())&&!u.done;)if(g=u.value,Ca(n,g,i,a)&&Ca(r,Yg(e,g),i,a))return aI(t,g),!0;return!1}function Ca(t,e,n,r){var i=n||{};if(i.strict?fw(t,e):t===e)return!0;var a=bw(t),c=bw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?fw(t,e):t==e;var u=r.has(t),g=r.has(e),w;if(u&&g){if(r.get(t)===r.get(e))return!0}else w={};return u||r.set(t,w),g||r.set(e,w),_4(t,e,i,r)}function Mw(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function g4(t,e,n,r){if(Lg(t)!==Lg(e))return!1;for(var i=pf(t),a=pf(e),c,u,g;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")g||(g=new Xg),Kg(g,c.value);else if(!Jg(e,c.value)){if(n.strict||!m4(t,e,c.value))return!1;g||(g=new Xg),Kg(g,c.value)}if(g){for(;(u=a.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!Lw(g,u.value,n.strict,r))return!1}else if(!n.strict&&!Jg(t,u.value)&&!Lw(g,u.value,n.strict,r))return!1;return Lg(g)===0}return!0}function y4(t,e,n,r){if(Tw(t)!==Tw(e))return!1;for(var i=pf(t),a=pf(e),c,u,g,w,S,I;(c=i.next())&&!c.done;)if(w=c.value[0],S=c.value[1],w&&typeof w=="object")g||(g=new Xg),Kg(g,w);else if(I=Yg(e,w),typeof I>"u"&&!Z0(e,w)||!Ca(S,I,n,r)){if(n.strict||!d4(t,e,w,S,n,r))return!1;g||(g=new Xg),Kg(g,w)}if(g){for(;(u=a.next())&&!u.done;)if(w=u.value[0],I=u.value[1],w&&typeof w=="object"){if(!Pw(g,t,w,I,n,r))return!1}else if(!n.strict&&(!t.has(w)||!Ca(Yg(t,w),I,n,r))&&!Pw(g,t,w,I,sI({},n,{strict:!1}),r))return!1;return Lg(g)===0}return!0}function _4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||Cw(t)!==Cw(e)||pw(t)!==pw(e))return!1;var c=dw(t),u=dw(e);if(c!==u)return!1;var g=t instanceof Error,w=e instanceof Error;if(g!==w||(g||w)&&(t.name!==e.name||t.message!==e.message))return!1;var S=yw(t),I=yw(e);if(S!==I||(S||I)&&(t.source!==e.source||hw(t)!==hw(e)))return!1;var P=gw(t),D=gw(e);if(P!==D||(P||D)&&Iw(t)!==Iw(e)||n.strict&&m0&&m0(t)!==m0(e))return!1;var N=ww(t),q=ww(e);if(N!==q)return!1;if(N||q){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(_e[i]!=pe[i])return!1;for(i=_e.length-1;i>=0;i--)if(a=_e[i],!Ca(t[a],e[a],n,r))return!1;var he=xw(t),me=xw(e);return he!==me?!1:he==="Set"||me==="Set"?g4(t,e,n,r):he==="Map"?y4(t,e,n,r):!0}var v4=function(e,n,r){return Ca(e,n,r,p4())};const b4=xv(v4);var x4=Object.defineProperty,tr=(t,e)=>x4(t,"name",{value:e,configurable:!0}),w4=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!sd(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=X0(e),i=X0(n);return r.every(a=>i.some(c=>this.compare(a,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(a=>i.some(c=>this.compareLine(a,c,1,!0)))}return!1}compareGeometryCollection(e,n){return sd(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?b4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return sd(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};tr(w4,"GeojsonEquality");function sd(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}tr(sd,"sameLength");function X0(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}tr(X0,"explode");var Ss=63710088e-1,uI={centimeters:Ss*100,centimetres:Ss*100,degrees:360/(2*Math.PI),feet:Ss*3.28084,inches:Ss*39.37,kilometers:Ss/1e3,kilometres:Ss/1e3,meters:Ss,metres:Ss,miles:Ss/1609.344,millimeters:Ss*1e3,millimetres:Ss*1e3,nauticalmiles:Ss/1852,radians:1,yards:Ss*1.0936},Aw={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ul(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}tr(ul,"feature");function S4(t,e,n={}){switch(t){case"Point":return Fl(e).geometry;case"LineString":return Ul(e).geometry;case"Polygon":return Fv(e).geometry;case"MultiPoint":return hI(e).geometry;case"MultiLineString":return cI(e).geometry;case"MultiPolygon":return fI(e).geometry;default:throw new Error(t+" is invalid")}}tr(S4,"geometry");function Fl(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Qg(t[0])||!Qg(t[1]))throw new Error("coordinates must contain numbers");return ul({type:"Point",coordinates:t},e,n)}tr(Fl,"point");function E4(t,e,n={}){return vy(t.map(r=>Fl(r,e)),n)}tr(E4,"points");function Fv(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let a=0;aFv(r,e)),n)}tr(I4,"polygons");function Ul(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ul({type:"LineString",coordinates:t},e,n)}tr(Ul,"lineString");function C4(t,e,n={}){return vy(t.map(r=>Ul(r,e)),n)}tr(C4,"lineStrings");function vy(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}tr(vy,"featureCollection");function cI(t,e,n={}){return ul({type:"MultiLineString",coordinates:t},e,n)}tr(cI,"multiLineString");function hI(t,e,n={}){return ul({type:"MultiPoint",coordinates:t},e,n)}tr(hI,"multiPoint");function fI(t,e,n={}){return ul({type:"MultiPolygon",coordinates:t},e,n)}tr(fI,"multiPolygon");function T4(t,e,n={}){return ul({type:"GeometryCollection",geometries:t},e,n)}tr(T4,"geometryCollection");function L4(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}tr(L4,"round");function pI(t,e="kilometers"){const n=uI[e];if(!n)throw new Error(e+" units is invalid");return t*n}tr(pI,"radiansToLength");function Bv(t,e="kilometers"){const n=uI[e];if(!n)throw new Error(e+" units is invalid");return t/n}tr(Bv,"lengthToRadians");function P4(t,e){return dI(Bv(t,e))}tr(P4,"lengthToDegrees");function M4(t){let e=t%360;return e<0&&(e+=360),e}tr(M4,"bearingToAzimuth");function dI(t){return t%(2*Math.PI)*180/Math.PI}tr(dI,"radiansToDegrees");function A4(t){return t%360*Math.PI/180}tr(A4,"degreesToRadians");function k4(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return pI(Bv(t,e),n)}tr(k4,"convertLength");function D4(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=Aw[e];if(!r)throw new Error("invalid original units");const i=Aw[n];if(!i)throw new Error("invalid final units");return t/r*i}tr(D4,"convertArea");function Qg(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}tr(Qg,"isNumber");function Vv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}tr(Vv,"isObject");function R4(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!Qg(e))throw new Error("bbox must only contain numbers")})}tr(R4,"validateBBox");function N4(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}tr(N4,"validateId");var O4=Object.defineProperty,uo=(t,e)=>O4(t,"name",{value:e,configurable:!0});function Bf(t,e,n){if(t!==null)for(var r,i,a,c,u,g,w,S=0,I=0,P,D=t.type,N=D==="FeatureCollection",q=D==="Feature",J=N?t.features.length:1,re=0;reg||N>w||q>S){u=I,g=r,w=N,S=q,a=0;return}var J=Ul([u,I],n.properties);if(e(J,r,i,q,a)===!1)return!1;a++,u=I})===!1)return!1}}})}uo(yI,"segmentEach");function q4(t,e,n){var r=n,i=!1;return yI(t,function(a,c,u,g,w){i===!1&&n===void 0?r=a:r=e(r,a,c,u,g,w),i=!0}),r}uo(q4,"segmentReduce");function _I(t,e){if(!t)throw new Error("geojson is required");by(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uZ4(t,"name",{value:e,configurable:!0});function Gv(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Bf(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]1)return 1;for(var h=l,p=0;p<8;p++){var y=this.sampleCurveX(h)-l;if(Math.abs(y)y?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var N=g(P);let q,J;function re(){return q==null&&(q=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),q}function U(){if(J==null&&(J=!1,re())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const y=4*p;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){J=!0;break}}}return J||!1}function j(l,o,h,p){const y=new N(l,o,h,p);return function(b){return y.solve(b)}}const Z=j(.25,.1,.25,1);function te(l,o,h){return Math.min(h,Math.max(o,l))}function _e(l,o,h){const p=h-o,y=((l-o)%p+p)%p+o;return y===o?h:y}function pe(l,...o){for(const h of o)for(const p in h)l[p]=h[p];return l}let he=1;function me(l,o,h){const p={};for(const y in l)p[y]=o.call(h||this,l[y],y,l);return p}function Ce(l,o,h){const p={};for(const y in l)o.call(h||this,l[y],y,l)&&(p[y]=l[y]);return p}function H(l){return Array.isArray(l)?l.map(H):typeof l=="object"&&l?me(l,H):l}const ce={};function Ke(l){ce[l]||(typeof console<"u"&&console.warn(l),ce[l]=!0)}function Se(l,o,h){return(h.y-l.y)*(o.x-l.x)>(o.y-l.y)*(h.x-l.x)}function Ze(l){let o=0;for(let h,p,y=0,b=l.length,x=b-1;y"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(l,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),L=new Uint8ClampedArray(p*y*4);if(yield b.copyTo(L,function(A,R,O,V,W){const Y=4*Math.max(-R,0),ee=(Math.max(0,O)-O)*V*4+Y,se=4*V,fe=Math.max(0,R),Me=Math.max(0,O);return{rect:{x:fe,y:Me,width:Math.min(A.width,R+V)-fe,height:Math.min(A.height,O+W)-Me},layout:[{offset:ee,stride:se}]}}(l,o,h,p,y)),E)for(let A=0;Att(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,wr=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){const p=yn(l.url);if(p)return p(l,o);if(tt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:An},o)}if(!(/^file:/.test(h=l.url)||/^file:/.test(Ar())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,y){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Ar(),signal:y.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new xr(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const L=yield E;if(y.signal.aborted)throw Cn();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(l,o);if(tt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:An},o)}var h;return function(p,y){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const L in p.headers)E.setRequestHeader(L,p.headers[L]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!y.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let L=E.response;if(p.type==="json")try{L=JSON.parse(E.response)}catch(A){return void x(A)}b({data:L,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const L=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new xr(E.status,E.statusText,p.url,L))}},y.signal.addEventListener("abort",()=>{E.abort(),x(Cn())}),E.send(p.body)})}(l,o)};function fr(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const o=new URL(l),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function Qe(l,o,h){h[l]&&h[l].indexOf(o)!==-1||(h[l]=h[l]||[],h[l].push(o))}function ge(l,o,h){if(h&&h[l]){const p=h[l].indexOf(o);p!==-1&&h[l].splice(p,1)}}class Le{constructor(o,h={}){pe(this,h),this.type=o}}class It extends Le{constructor(o,h={}){super("error",pe({error:o},h))}}class kn{on(o,h){return this._listeners=this._listeners||{},Qe(o,h,this._listeners),this}off(o,h){return ge(o,h,this._listeners),ge(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Qe(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Le(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const y=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of y)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)ge(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(pe(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof It&&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,h){return this._eventedParent=o,this._eventedParentData=h,this}}var Ne={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Yt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function kr(l,o){const h={};for(const p in l)p!=="ref"&&(h[p]=l[p]);return Yt.forEach(p=>{p in o&&(h[p]=o[p])}),h}function ln(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let h=0;h`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}const xe=[Zr,ct,tn,Jt,Dr,Fr,Jo,K(Kt),ae,B,G];function Q(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(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 h of xe)if(!Q(h,o))return null}}return`Expected ${ne(l)} but found ${ne(o)} instead.`}function we(l,o){return o.some(h=>h.kind===l.kind)}function de(l,o){return o.some(h=>h==="null"?l===null:h==="array"?Array.isArray(l):h==="object"?l&&!Array.isArray(l)&&typeof l=="object":h===typeof l)}function Pe(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const Ve=.96422,We=.82521,Xe=4/29,Tt=6/29,At=3*Tt*Tt,Wt=Tt*Tt*Tt,Ht=Math.PI/180,bn=180/Math.PI;function Wn(l){return(l%=360)<0&&(l+=360),l}function or([l,o,h,p]){let y,b;const x=sn((.2225045*(l=Xr(l))+.7168786*(o=Xr(o))+.0606169*(h=Xr(h)))/1);l===o&&o===h?y=b=x:(y=sn((.4360747*l+.3850649*o+.1430804*h)/Ve),b=sn((.0139322*l+.0971045*o+.7141733*h)/We));const E=116*x-16;return[E<0?0:E,500*(y-x),200*(x-b),p]}function Xr(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function sn(l){return l>Wt?Math.pow(l,1/3):l/At+Xe}function Sr([l,o,h,p]){let y=(l+16)/116,b=isNaN(o)?y:y+o/500,x=isNaN(h)?y:y-h/200;return y=1*Ji(y),b=Ve*Ji(b),x=We*Ji(x),[si(3.1338561*b-1.6168667*y-.4906146*x),si(-.9787684*b+1.9161415*y+.033454*x),si(.0719453*b-.2289914*y+1.4052427*x),p]}function si(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Ji(l){return l>Tt?l*l*l:At*(l-Xe)}function co(l){return parseInt(l.padEnd(2,l),16)/255}function vi(l,o){return zs(o?l/100:l,0,1)}function zs(l,o,h){return Math.min(Math.max(o,l),h)}function Qd(l){return!l.some(Number.isNaN)}const Vy={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 Vn{constructor(o,h,p,y=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=y,b||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,h,p,y]))}static parse(o){if(o instanceof Vn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Vy[p];if(y){const[x,E,L]=y;return[x/255,E/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+=x)),co(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,L,A,R,O,V,W,Y,ee,se,fe,Me]=x,ye=[R||" ",W||" ",se].join("");if(ye===" "||ye===" /"||ye===",,"||ye===",,,"){const Ee=[A,V,ee].join(""),Ye=Ee==="%%%"?100:Ee===""?255:0;if(Ye){const Je=[zs(+L/Ye,0,1),zs(+O/Ye,0,1),zs(+Y/Ye,0,1),fe?vi(+fe,Me):1];if(Qd(Je))return Je}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,L,A,R,O,V,W,Y]=b,ee=[L||" ",R||" ",V].join("");if(ee===" "||ee===" /"||ee===",,"||ee===",,,"){const se=[+E,zs(+A,0,100),zs(+O,0,100),W?vi(+W,Y):1];if(Qd(se))return function([fe,Me,ye,Ee]){function Ye(Je){const bt=(Je+fe/30)%12,Ct=Me*Math.min(ye,1-ye);return ye-Ct*Math.max(-1,Math.min(bt-3,9-bt,1))}return fe=Wn(fe),Me/=100,ye/=100,[Ye(0),Ye(8),Ye(4),Ee]}(se)}}}(o);return h?new Vn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:y}=this,b=y||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,y])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,y,b]=or(o),x=Math.sqrt(p*p+y*y);return[Math.round(1e4*x)?Wn(Math.atan2(y,p)*bn):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",or(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,y]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${y})`}}Vn.black=new Vn(0,0,0,1),Vn.white=new Vn(1,1,1,1),Vn.transparent=new Vn(0,0,0,0),Vn.red=new Vn(1,0,0,1);class Yf{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Kf{constructor(o,h,p,y,b){this.text=o,this.image=h,this.scale=p,this.fontStack=y,this.textColor=b}}class Ao{constructor(o){this.sections=o}static fromString(o){return new Ao([new Kf(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 Ao?o:Ao.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class ho{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof ho)return o;if(typeof o=="number")return new ho([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="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 ho(o)}}toString(){return JSON.stringify(this.values)}}const Xu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Qo)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[l,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[l,o,h,p]:[l,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Yc(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Vn||l instanceof Yf||l instanceof Ao||l instanceof ho||l instanceof Qo||l instanceof $o)return!0;if(Array.isArray(l)){for(const o of l)if(!Yc(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!Yc(l[o]))return!1;return!0}return!1}function Yr(l){if(l===null)return Zr;if(typeof l=="string")return tn;if(typeof l=="boolean")return Jt;if(typeof l=="number")return ct;if(l instanceof Vn)return Dr;if(l instanceof Yf)return ga;if(l instanceof Ao)return Fr;if(l instanceof ho)return ae;if(l instanceof Qo)return G;if(l instanceof $o)return B;if(Array.isArray(l)){const o=l.length;let h;for(const p of l){const y=Yr(p);if(h){if(h===y)continue;h=Kt;break}h=y}return K(h||Kt,o)}return Jo}function Yu(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Vn||l instanceof Ao||l instanceof ho||l instanceof Qo||l instanceof $o?l.toString():JSON.stringify(l)}class Va{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!Yc(o[1]))return h.error("invalid value");const p=o[1];let y=Yr(p);const b=h.expectedType;return y.kind!=="array"||y.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(y=b),new Va(y,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class pr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Kc={string:tn,number:ct,boolean:Jt,object:Jo};class ko{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,y=1;const b=o[0];if(b==="array"){let E,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Kc)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);E=Kc[A],y++}else E=Kt;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);L=o[2],y++}p=K(E,L)}else{if(!Kc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Kc[b]}const x=[];for(;yo.outputDefined())}}const Jc={"to-boolean":Jt,"to-color":Dr,"to-number":ct,"to-string":tn};class Fs{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!Jc[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const y=Jc[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:iu(h[0],h[1],h[2],h[3]),!p))return new Vn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new pr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const y=ho.parse(h);if(y)return y}throw new pr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const y=Qo.parse(h);if(y)return y}throw new pr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const y=Number(h);if(!isNaN(y))return y}throw new pr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ao.fromString(Yu(this.args[0].evaluate(o)));case"resolvedImage":return $o.fromString(Yu(this.args[0].evaluate(o)));default:return Yu(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Ku=["Unknown","Point","LineString","Polygon"];class Un{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"?Ku[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 h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=Vn.parse(o)),h}}class Qc{constructor(o,h,p=[],y,b=new xl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=y,this._isConstant=h}parse(o,h,p,y,b={}){return h?this.concat(h,p,y)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(y,b,x){return x==="assert"?new ko(b,[y]):x==="coerce"?new Fs(b,[y]):y}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 y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[y];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,L=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||L.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(E.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(E,L))return null}else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"assert")}if(!(x instanceof Va)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new Un;try{x=new Va(x.type,x.evaluate(E))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${y}". 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,h,p){const y=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new Qc(this.registry,this._isConstant,y,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(y=>`[${y}]`).join("")}`;this.errors.push(new Ki(p,o))}checkSubtype(o,h){const p=Q(o,h);return p&&this.error(p),p}}class ou{constructor(o,h,p){this.type=ga,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const y=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Jt);if(!y)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Jt);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,tn),!x)?null:new ou(y,b,x)}evaluate(o){return new Yf(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 Ua=8192;function $c(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 Ju(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function Uy(l,o){const h=(180+l[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,y=Math.pow(2,o.z);return[Math.round(h*y*Ua),Math.round(p*y*Ua)]}function $d(l,o,h){const p=l[0]-o[0],y=l[1]-o[1],b=l[0]-h[0],x=l[1]-h[1];return p*x-b*y==0&&p*b<=0&&y*x<=0}function eh(l,o){let h=!1;for(let x=0,E=o.length;x(p=l)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-y[0])*(p[1]-y[1])/(b[1]-y[1])+y[0]&&(h=!h)}}var p,y,b;return h}function Gy(l,o){for(let h=0;h0&&E<0||x<0&&E>0}function qy(l,o,h){for(const A of h)for(let R=0;Rh[2]){const y=.5*p;let b=l[0]-h[0]>y?-p:h[0]-l[0]>y?p:0;b===0&&(b=l[0]-h[2]>y?-p:h[2]-l[0]>y?p:0),l[0]+=b}$c(o,l)}function nh(l,o,h,p){const y=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const E of l)for(const L of E){const A=[L.x+b[0],L.y+b[1]];im(A,o,h,y),x.push(A)}return x}function om(l,o,h,p){const y=Math.pow(2,p.z)*Ua,b=[p.x*Ua,p.y*Ua],x=[];for(const L of l){const A=[];for(const R of L){const O=[R.x+b[0],R.y+b[1]];$c(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=y/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const L of x)for(const A of L)im(A,o,h,y)}var E;return x}class wl{constructor(o,h){this.type=Jt,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Yc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const y=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&y.push(E),x==="MultiPolygon"&&y.push(...E)}if(y.length)return new wl(p,{type:"MultiPolygon",coordinates:y})}else if(p.type==="Feature"){const y=p.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new wl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new wl(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const E=th(p.coordinates,b,x),L=nh(h.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!eh(A,E))return!1}if(p.type==="MultiPolygon"){const E=rm(p.coordinates,b,x),L=nh(h.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!Gy(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const E=th(p.coordinates,b,x),L=om(h.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!tm(A,E))return!1}if(p.type==="MultiPolygon"){const E=rm(p.coordinates,b,x),L=om(h.geometry(),y,b,x);if(!Ju(y,b))return!1;for(const A of L)if(!nm(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class rh{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new rh(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Do{constructor(o,h,p,y){this.name=o,this.type=h,this._evaluate=p,this.args=y}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],y=Do.definitions[p];if(!y)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(y)?y[0]:y.type,x=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,R]of E){L=new Qc(h.registry,Qu,h.path,null,h.scope);const O=[];let V=!1;for(let W=1;W{return V=O,Array.isArray(V)?`(${V.map(ne).join(", ")})`:`(${ne(V.type)}...)`;var V}).join(" | "),R=[];for(let O=1;O{h=o?h&&Qu(p):h&&p instanceof Va}),!!h&&ih(l)&&ec(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ih(l){if(l instanceof Do&&(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 wl)return!1;let o=!0;return l.eachChild(h=>{o&&!ih(h)&&(o=!1)}),o}function $u(l){if(l instanceof Do&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(h=>{o&&!$u(h)&&(o=!1)}),o}function ec(l,o){if(l instanceof Do&&o.indexOf(l.name)>=0)return!1;let h=!0;return l.eachChild(p=>{h&&!ec(p,o)&&(h=!1)}),h}function tc(l,o){const h=l.length-1;let p,y,b=0,x=h,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=l[E],y=l[E+1],p<=o){if(E===h||oo))throw new pr("Input is not a number.");x=E-1}return 0}class nc{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[y,b]of p)this.labels.push(y),this.outputs.push(b)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,ct);if(!p)return null;const y=[];let b=null;h.expectedType&&h.expectedType.kind!=="value"&&(b=h.expectedType);for(let x=1;x=E)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=h.parse(L,R,b);if(!O)return null;b=b||O.type,y.push([E,O])}return new nc(b,p,y)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const b=h.length;return y>=h[b-1]?p[b-1].evaluate(o):p[tc(h,y)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function jy(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Wy=sm;function sm(l,o,h,p){this.cx=3*l,this.bx=3*(h-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=h,this.p2y=p}sm.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 h=l,p=0;p<8;p++){var y=this.sampleCurveX(h)-l;if(Math.abs(y)y?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Hy=jy(Wy);function Sl(l,o,h){return l+h*(o-l)}function oh(l,o,h){return l.map((p,y)=>Sl(p,o[y],h))}const Qi={number:Sl,color:function(l,o,h,p="rgb"){switch(p){case"rgb":{const[y,b,x,E]=oh(l.rgb,o.rgb,h);return new Vn(y,b,x,E,!1)}case"hcl":{const[y,b,x,E]=l.hcl,[L,A,R,O]=o.hcl;let V,W;if(isNaN(y)||isNaN(L))isNaN(y)?isNaN(L)?V=NaN:(V=L,x!==1&&x!==0||(W=A)):(V=y,R!==1&&R!==0||(W=b));else{let Me=L-y;L>y&&Me>180?Me-=360:L180&&(Me+=360),V=y+h*Me}const[Y,ee,se,fe]=function([Me,ye,Ee,Ye]){return Me=isNaN(Me)?0:Me*Ht,Sr([Ee,Math.cos(Me)*ye,Math.sin(Me)*ye,Ye])}([V,W??Sl(b,A,h),Sl(x,R,h),Sl(E,O,h)]);return new Vn(Y,ee,se,fe,!1)}case"lab":{const[y,b,x,E]=Sr(oh(l.lab,o.lab,h));return new Vn(y,b,x,E,!1)}}},array:oh,padding:function(l,o,h){return new ho(oh(l.values,o.values,h))},variableAnchorOffsetCollection:function(l,o,h){const p=l.values,y=o.values;if(p.length!==y.length)throw new pr(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof R!="number"||R<0||R>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(b=h.parse(b,2,ct),!b)return null;const E=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Dr:h.expectedType&&h.expectedType.kind!=="value"&&(L=h.expectedType);for(let A=0;A=R)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',V);const Y=h.parse(O,W,L);if(!Y)return null;L=L||Y.type,E.push([R,Y])}return Pe(L,ct)||Pe(L,Dr)||Pe(L,ae)||Pe(L,G)||Pe(L,K(ct))?new Oi(L,p,y,b,E):h.error(`Type ${ne(L)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const b=h.length;if(y>=h[b-1])return p[b-1].evaluate(o);const x=tc(h,y),E=Oi.interpolationFactor(this.interpolation,y,h[x],h[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return Qi[this.type.kind](L,A,E);case"interpolate-hcl":return Qi.color(L,A,E,"hcl");case"interpolate-lab":return Qi.color(L,A,E,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Dn(l,o,h,p){const y=p-h,b=l-h;return y===0?0:o===1?b/y:(Math.pow(o,b)-1)/(Math.pow(o,y)-1)}class sh{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const y=h.expectedType;y&&y.kind!=="value"&&(p=y);const b=[];for(const E of o.slice(1)){const L=h.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=y&&b.some(E=>Q(y,E.type));return new sh(x?Kt:p,b)}evaluate(o){let h,p=null,y=0;for(const b of this.args)if(y++,p=b.evaluate(o),p&&p instanceof $o&&!p.available&&(h||(h=p.name),p=null,y===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class ah{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new pr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new pr(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Qf{constructor(o,h){this.type=Jt,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Kt),y=h.parse(o[2],2,Kt);return p&&y?we(p.type,[Jt,tn,ct,Zr,Kt])?new Qf(p,y):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ne(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!de(h,["boolean","string","number","null"]))throw new pr(`Expected first argument to be of type boolean, string, number or null, but found ${ne(Yr(h))} instead.`);if(!de(p,["string","array"]))throw new pr(`Expected second argument to be of type array or string, but found ${ne(Yr(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class lh{constructor(o,h,p){this.type=ct,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Kt),y=h.parse(o[2],2,Kt);if(!p||!y)return null;if(!we(p.type,[Jt,tn,ct,Zr,Kt]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ne(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ct);return b?new lh(p,y,b):null}return new lh(p,y)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!de(h,["boolean","string","number","null"]))throw new pr(`Expected first argument to be of type boolean, string, number or null, but found ${ne(Yr(h))} instead.`);if(!de(p,["string","array"]))throw new pr(`Expected second argument to be of type array or string, but found ${ne(Yr(p))} instead.`);if(this.fromIndex){const y=this.fromIndex.evaluate(o);return p.indexOf(h,y)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class $f{constructor(o,h,p,y,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=y,this.outputs=b,this.otherwise=x}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return V.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return V.error("Numeric branch labels must be integer values.");if(p){if(V.checkSubtype(p,Yr(Y)))return null}else p=Yr(Y);if(b[String(Y)]!==void 0)return V.error("Branch labels must be unique.");b[String(Y)]=x.length}const W=h.parse(O,A,y);if(!W)return null;y=y||W.type,x.push(W)}const E=h.parse(o[1],1,Kt);if(!E)return null;const L=h.parse(o[o.length-1],o.length-1,y);return L?E.type.kind!=="value"&&h.concat(1).checkSubtype(p,E.type)?null:new $f(p,y,E,b,x,L):null}evaluate(o){const h=this.input.evaluate(o);return(Yr(h)===this.inputType&&this.outputs[this.cases[h]]||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 ep{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const y=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class uh{constructor(o,h,p,y){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=y}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Kt),y=h.parse(o[2],2,ct);if(!p||!y)return null;if(!we(p.type,[K(Kt),tn,Kt]))return h.error(`Expected first argument to be of type array or string, but found ${ne(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ct);return b?new uh(p.type,p,y,b):null}return new uh(p.type,p,y)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!de(h,["string","array"]))throw new pr(`Expected first argument to be of type array or string, but found ${ne(Yr(h))} instead.`);if(this.endIndex){const y=this.endIndex.evaluate(o);return h.slice(p,y)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function am(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 lm(l,o,h,p){return p.compare(o,h)===0}function su(l,o,h){const p=l!=="=="&&l!=="!=";return class bI{constructor(b,x,E){this.type=Jt,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let L=x.parse(b[1],1,Kt);if(!L)return null;if(!am(E,L.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${ne(L.type)}'.`);let A=x.parse(b[2],2,Kt);if(!A)return null;if(!am(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${ne(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${ne(L.type)}' and '${ne(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new ko(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new ko(L.type,[A])));let R=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(R=x.parse(b[3],3,ga),!R)return null}return new bI(L,A,R)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=Yr(x),A=Yr(E);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new pr(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=Yr(x),A=Yr(E);if(L.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?h(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Zy=su("==",function(l,o,h){return o===h},lm),Xy=su("!=",function(l,o,h){return o!==h},function(l,o,h,p){return!lm(0,o,h,p)}),Yy=su("<",function(l,o,h){return o",function(l,o,h){return o>h},function(l,o,h,p){return p.compare(o,h)>0}),Jy=su("<=",function(l,o,h){return o<=h},function(l,o,h,p){return p.compare(o,h)<=0}),Qy=su(">=",function(l,o,h){return o>=h},function(l,o,h,p){return p.compare(o,h)>=0});class tp{constructor(o,h,p,y,b){this.type=tn,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=y,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ct);if(!p)return null;const y=o[2];if(typeof y!="object"||Array.isArray(y))return h.error("NumberFormat options argument must be an object.");let b=null;if(y.locale&&(b=h.parse(y.locale,1,tn),!b))return null;let x=null;if(y.currency&&(x=h.parse(y.currency,1,tn),!x))return null;let E=null;if(y["min-fraction-digits"]&&(E=h.parse(y["min-fraction-digits"],1,ct),!E))return null;let L=null;return y["max-fraction-digits"]&&(L=h.parse(y["max-fraction-digits"],1,ct),!L)?null:new tp(p,b,x,E,L)}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 ch{constructor(o){this.type=Fr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const y=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let L=null;if(E["font-scale"]&&(L=h.parse(E["font-scale"],1,ct),!L))return null;let A=null;if(E["text-font"]&&(A=h.parse(E["text-font"],1,K(tn)),!A))return null;let R=null;if(E["text-color"]&&(R=h.parse(E["text-color"],1,Dr),!R))return null;const O=y[y.length-1];O.scale=L,O.font=A,O.textColor=R}else{const L=h.parse(o[x],1,Kt);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,y.push({content:L,scale:null,font:null,textColor:null})}}return new ch(y)}evaluate(o){return new Ao(this.sections.map(h=>{const p=h.content.evaluate(o);return Yr(p)===B?new Kf("",p,null,null,null):new Kf(Yu(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class np{constructor(o){this.type=B,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,tn);return p?new np(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=$o.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class rp{constructor(o){this.type=ct,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${ne(p.type)} instead.`):new rp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new pr(`Expected value to be of type string or array, but found ${ne(Yr(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const au={"==":Zy,"!=":Xy,">":Ky,"<":Yy,">=":Qy,"<=":Jy,array:ko,at:Jf,boolean:ko,case:ep,coalesce:sh,collator:ou,format:ch,image:np,in:Qf,"index-of":lh,interpolate:Oi,"interpolate-hcl":Oi,"interpolate-lab":Oi,length:rp,let:ah,literal:Va,match:$f,number:ko,"number-format":tp,object:ko,slice:uh,step:nc,string:ko,"to-boolean":Fs,"to-color":Fs,"to-number":Fs,"to-string":Fs,var:rh,within:wl};function um(l,[o,h,p,y]){o=o.evaluate(l),h=h.evaluate(l),p=p.evaluate(l);const b=y?y.evaluate(l):1,x=iu(o,h,p,b);if(x)throw new pr(x);return new Vn(o/255,h/255,p/255,b,!1)}function cm(l,o){return l in o}function ip(l,o){const h=o[l];return h===void 0?null:h}function El(l){return{type:l}}function hm(l){return{result:"success",value:l}}function lu(l){return{result:"error",value:l}}function uu(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function fm(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function op(l){return!!l.expression&&l.expression.interpolated}function In(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function hh(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function $y(l){return l}function pm(l,o){const h=o.type==="color",p=l.stops&&typeof l.stops[0][0]=="object",y=p||!(p||l.property!==void 0),b=l.type||(op(o)?"exponential":"interval");if(h||o.type==="padding"){const R=h?Vn.parse:ho.parse;(l=Ko({},l)).stops&&(l.stops=l.stops.map(O=>[O[0],R(O[1])])),l.default=R(l.default?l.default:o.default)}if(l.colorSpace&&(x=l.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var x;let E,L,A;if(b==="exponential")E=xn;else if(b==="interval")E=e_;else if(b==="categorical"){E=Br,L=Object.create(null);for(const R of l.stops)L[R[0]]=R[1];A=typeof l.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=sp}if(p){const R={},O=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},ee)=>xn({stops:V,base:l.base},o,Y).evaluate(Y,ee)}}if(y){const R=b==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:Oi.interpolationFactor.bind(void 0,R),zoomStops:l.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(l,o,O,L,A)}}return{kind:"source",evaluate(R,O){const V=O&&O.properties?O.properties[l.property]:void 0;return V===void 0?rc(l.default,o.default):E(l,o,V,L,A)}}}function rc(l,o,h){return l!==void 0?l:o!==void 0?o:h!==void 0?h:void 0}function Br(l,o,h,p,y){return rc(typeof h===y?p[h]:void 0,l.default,o.default)}function e_(l,o,h){if(In(h)!=="number")return rc(l.default,o.default);const p=l.stops.length;if(p===1||h<=l.stops[0][0])return l.stops[0][1];if(h>=l.stops[p-1][0])return l.stops[p-1][1];const y=tc(l.stops.map(b=>b[0]),h);return l.stops[y][1]}function xn(l,o,h){const p=l.base!==void 0?l.base:1;if(In(h)!=="number")return rc(l.default,o.default);const y=l.stops.length;if(y===1||h<=l.stops[0][0])return l.stops[0][1];if(h>=l.stops[y-1][0])return l.stops[y-1][1];const b=tc(l.stops.map(R=>R[0]),h),x=function(R,O,V,W){const Y=W-V,ee=R-V;return Y===0?0:O===1?ee/Y:(Math.pow(O,ee)-1)/(Math.pow(O,Y)-1)}(h,p,l.stops[b][0],l.stops[b+1][0]),E=l.stops[b][1],L=l.stops[b+1][1],A=Qi[o.type]||$y;return typeof E.evaluate=="function"?{evaluate(...R){const O=E.evaluate.apply(void 0,R),V=L.evaluate.apply(void 0,R);if(O!==void 0&&V!==void 0)return A(O,V,x,l.colorSpace)}}:A(E,L,x,l.colorSpace)}function sp(l,o,h){switch(o.type){case"color":h=Vn.parse(h);break;case"formatted":h=Ao.fromString(h.toString());break;case"resolvedImage":h=$o.fromString(h.toString());break;case"padding":h=ho.parse(h);break;default:In(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return rc(h,l.default,o.default)}Do.register(au,{error:[{kind:"error"},[tn],(l,[o])=>{throw new pr(o.evaluate(l))}],typeof:[tn,[Kt],(l,[o])=>ne(Yr(o.evaluate(l)))],"to-rgba":[K(ct,4),[Dr],(l,[o])=>{const[h,p,y,b]=o.evaluate(l).rgb;return[255*h,255*p,255*y,b]}],rgb:[Dr,[ct,ct,ct],um],rgba:[Dr,[ct,ct,ct,ct],um],has:{type:Jt,overloads:[[[tn],(l,[o])=>cm(o.evaluate(l),l.properties())],[[tn,Jo],(l,[o,h])=>cm(o.evaluate(l),h.evaluate(l))]]},get:{type:Kt,overloads:[[[tn],(l,[o])=>ip(o.evaluate(l),l.properties())],[[tn,Jo],(l,[o,h])=>ip(o.evaluate(l),h.evaluate(l))]]},"feature-state":[Kt,[tn],(l,[o])=>ip(o.evaluate(l),l.featureState||{})],properties:[Jo,[],l=>l.properties()],"geometry-type":[tn,[],l=>l.geometryType()],id:[Kt,[],l=>l.id()],zoom:[ct,[],l=>l.globals.zoom],"heatmap-density":[ct,[],l=>l.globals.heatmapDensity||0],"line-progress":[ct,[],l=>l.globals.lineProgress||0],accumulated:[Kt,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[ct,El(ct),(l,o)=>{let h=0;for(const p of o)h+=p.evaluate(l);return h}],"*":[ct,El(ct),(l,o)=>{let h=1;for(const p of o)h*=p.evaluate(l);return h}],"-":{type:ct,overloads:[[[ct,ct],(l,[o,h])=>o.evaluate(l)-h.evaluate(l)],[[ct],(l,[o])=>-o.evaluate(l)]]},"/":[ct,[ct,ct],(l,[o,h])=>o.evaluate(l)/h.evaluate(l)],"%":[ct,[ct,ct],(l,[o,h])=>o.evaluate(l)%h.evaluate(l)],ln2:[ct,[],()=>Math.LN2],pi:[ct,[],()=>Math.PI],e:[ct,[],()=>Math.E],"^":[ct,[ct,ct],(l,[o,h])=>Math.pow(o.evaluate(l),h.evaluate(l))],sqrt:[ct,[ct],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[ct,[ct],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[ct,[ct],(l,[o])=>Math.log(o.evaluate(l))],log2:[ct,[ct],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[ct,[ct],(l,[o])=>Math.sin(o.evaluate(l))],cos:[ct,[ct],(l,[o])=>Math.cos(o.evaluate(l))],tan:[ct,[ct],(l,[o])=>Math.tan(o.evaluate(l))],asin:[ct,[ct],(l,[o])=>Math.asin(o.evaluate(l))],acos:[ct,[ct],(l,[o])=>Math.acos(o.evaluate(l))],atan:[ct,[ct],(l,[o])=>Math.atan(o.evaluate(l))],min:[ct,El(ct),(l,o)=>Math.min(...o.map(h=>h.evaluate(l)))],max:[ct,El(ct),(l,o)=>Math.max(...o.map(h=>h.evaluate(l)))],abs:[ct,[ct],(l,[o])=>Math.abs(o.evaluate(l))],round:[ct,[ct],(l,[o])=>{const h=o.evaluate(l);return h<0?-Math.round(-h):Math.round(h)}],floor:[ct,[ct],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[ct,[ct],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Jt,[tn,Kt],(l,[o,h])=>l.properties()[o.value]===h.value],"filter-id-==":[Jt,[Kt],(l,[o])=>l.id()===o.value],"filter-type-==":[Jt,[tn],(l,[o])=>l.geometryType()===o.value],"filter-<":[Jt,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p{const h=l.id(),p=o.value;return typeof h==typeof p&&h":[Jt,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p>y}],"filter-id->":[Jt,[Kt],(l,[o])=>{const h=l.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[Jt,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p<=y}],"filter-id-<=":[Jt,[Kt],(l,[o])=>{const h=l.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[Jt,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p>=y}],"filter-id->=":[Jt,[Kt],(l,[o])=>{const h=l.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[Jt,[Kt],(l,[o])=>o.value in l.properties()],"filter-has-id":[Jt,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Jt,[K(tn)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Jt,[K(Kt)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Jt,[tn,K(Kt)],(l,[o,h])=>h.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Jt,[tn,K(Kt)],(l,[o,h])=>function(p,y,b,x){for(;b<=x;){const E=b+x>>1;if(y[E]===p)return!0;y[E]>p?x=E-1:b=E+1}return!1}(l.properties()[o.value],h.value,0,h.value.length-1)],all:{type:Jt,overloads:[[[Jt,Jt],(l,[o,h])=>o.evaluate(l)&&h.evaluate(l)],[El(Jt),(l,o)=>{for(const h of o)if(!h.evaluate(l))return!1;return!0}]]},any:{type:Jt,overloads:[[[Jt,Jt],(l,[o,h])=>o.evaluate(l)||h.evaluate(l)],[El(Jt),(l,o)=>{for(const h of o)if(h.evaluate(l))return!0;return!1}]]},"!":[Jt,[Jt],(l,[o])=>!o.evaluate(l)],"is-supported-script":[Jt,[tn],(l,[o])=>{const h=l.globals&&l.globals.isSupportedScript;return!h||h(o.evaluate(l))}],upcase:[tn,[tn],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[tn,[tn],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[tn,El(Kt),(l,o)=>o.map(h=>Yu(h.evaluate(l))).join("")],"resolved-locale":[tn,[ga],(l,[o])=>o.evaluate(l).resolvedLocale()]});class nr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new Un,this._defaultValue=h?(p=h).type==="color"&&hh(p.default)?new Vn(0,0,0,0):p.type==="color"?Vn.parse(p.default)||null:p.type==="padding"?ho.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Qo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,y,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||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 pr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).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 Jn(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in au}function Il(l,o){const h=new Qc(au,Qu,[],o?function(y){const b={color:Dr,string:tn,number:ct,enum:tn,boolean:Jt,formatted:Fr,padding:ae,resolvedImage:B,variableAnchorOffsetCollection:G};return y.type==="array"?K(b[y.value]||Kt,y.length):b[y.type]}(o):void 0),p=h.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?hm(new nr(p,o)):lu(h.errors)}class fh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!$u(h.expression)}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,b,x)}evaluate(o,h,p,y,b,x){return this._styleExpression.evaluate(o,h,p,y,b,x)}}class ap{constructor(o,h,p,y){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!$u(h.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,b,x)}evaluate(o,h,p,y,b,x){return this._styleExpression.evaluate(o,h,p,y,b,x)}interpolationFactor(o,h,p){return this.interpolationType?Oi.interpolationFactor(this.interpolationType,o,h,p):0}}function dm(l,o){const h=Il(l,o);if(h.result==="error")return h;const p=h.value.expression,y=ih(p);if(!y&&!uu(o))return lu([new Ki("","data expressions not supported")]);const b=ec(p,["zoom"]);if(!b&&!fm(o))return lu([new Ki("","zoom expressions not supported")]);const x=dh(p);return x||b?x instanceof Ki?lu([x]):x instanceof Oi&&!op(o)?lu([new Ki("",'"interpolate" expressions cannot be used with this property')]):hm(x?new ap(y?"camera":"composite",h.value,x.labels,x instanceof Oi?x.interpolation:void 0):new fh(y?"constant":"source",h.value)):lu([new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ph{constructor(o,h){this._parameters=o,this._specification=h,Ko(this,pm(this._parameters,this._specification))}static deserialize(o){return new ph(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function dh(l){let o=null;if(l instanceof ah)o=dh(l.result);else if(l instanceof sh){for(const h of l.args)if(o=dh(h),o)break}else(l instanceof nc||l instanceof Oi)&&l.input instanceof Do&&l.input.name==="zoom"&&(o=l);return o instanceof Ki||l.eachChild(h=>{const p=dh(h);p instanceof Ki?o=p:!o&&p?o=new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Ki("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function mh(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(!mh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const mm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function gh(l){if(l==null)return{filter:()=>!0,needGeometry:!1};mh(l)||(l=_h(l));const o=Il(l,mm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,y)=>o.value.evaluate(h,p,{},y),needGeometry:yh(l)}}function gm(l,o){return lo?1:0}function yh(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?lp(l[1],l[2],o):o==="any"?(h=l.slice(1),["any"].concat(h.map(_h))):o==="all"?["all"].concat(l.slice(1).map(_h)):o==="none"?["all"].concat(l.slice(1).map(_h).map(vh)):o==="in"?ym(l[1],l.slice(2)):o==="!in"?vh(ym(l[1],l.slice(2))):o==="has"?_m(l[1]):o==="!has"?vh(_m(l[1])):o!=="within"||l;var h}function lp(l,o,h){switch(l){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,l,o]}}function ym(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(h=>typeof h!=typeof o[0])?["filter-in-large",l,["literal",o.sort(gm)]]:["filter-in-small",l,["literal",o]]}}function _m(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function vh(l){return["!",l]}function up(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let y="[";for(const b of l)y+=`${up(b)},`;return`${y}]`}const h=Object.keys(l).sort();let p="{";for(let y=0;yp.maximum?[new rt(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function bm(l){const o=l.valueSpec,h=Er(l.value.type);let p,y,b,x={};const E=h!=="categorical"&&l.value.property===void 0,L=!E,A=In(l.value.stops)==="array"&&In(l.value.stops[0])==="array"&&In(l.value.stops[0][0])==="object",R=$i({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(W){if(h==="identity")return[new rt(W.key,W.value,'identity function may not have a "stops" property')];let Y=[];const ee=W.value;return Y=Y.concat(cp({key:W.key,value:ee,valueSpec:W.valueSpec,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:O})),In(ee)==="array"&&ee.length===0&&Y.push(new rt(W.key,ee,"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 h==="identity"&&E&&R.push(new rt(l.key,l.value,'missing required property "property"')),h==="identity"||l.value.stops||R.push(new rt(l.key,l.value,'missing required property "stops"')),h==="exponential"&&l.valueSpec.expression&&!op(l.valueSpec)&&R.push(new rt(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(L&&!uu(l.valueSpec)?R.push(new rt(l.key,l.value,"property functions not supported")):E&&!fm(l.valueSpec)&&R.push(new rt(l.key,l.value,"zoom functions not supported"))),h!=="categorical"&&!A||l.value.property!==void 0||R.push(new rt(l.key,l.value,'"property" property is required')),R;function O(W){let Y=[];const ee=W.value,se=W.key;if(In(ee)!=="array")return[new rt(se,ee,`array expected, ${In(ee)} found`)];if(ee.length!==2)return[new rt(se,ee,`array length 2 expected, length ${ee.length} found`)];if(A){if(In(ee[0])!=="object")return[new rt(se,ee,`object expected, ${In(ee[0])} found`)];if(ee[0].zoom===void 0)return[new rt(se,ee,"object stop key must have zoom")];if(ee[0].value===void 0)return[new rt(se,ee,"object stop key must have value")];if(b&&b>Er(ee[0].zoom))return[new rt(se,ee[0].zoom,"stop zoom values must appear in ascending order")];Er(ee[0].zoom)!==b&&(b=Er(ee[0].zoom),y=void 0,x={}),Y=Y.concat($i({key:`${se}[0]`,value:ee[0],valueSpec:{zoom:{}},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{zoom:bh,value:V}}))}else Y=Y.concat(V({key:`${se}[0]`,value:ee[0],valueSpec:{},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec},ee));return Jn(Ga(ee[1]))?Y.concat([new rt(`${se}[1]`,ee[1],"expressions are not allowed in function stops.")]):Y.concat(W.validateSpec({key:`${se}[1]`,value:ee[1],valueSpec:o,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec}))}function V(W,Y){const ee=In(W.value),se=Er(W.value),fe=W.value!==null?W.value:Y;if(p){if(ee!==p)return[new rt(W.key,fe,`${ee} stop domain type must match previous stop domain type ${p}`)]}else p=ee;if(ee!=="number"&&ee!=="string"&&ee!=="boolean")return[new rt(W.key,fe,"stop domain value must be a number, string, or boolean")];if(ee!=="number"&&h!=="categorical"){let Me=`number expected, ${ee} found`;return uu(o)&&h===void 0&&(Me+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new rt(W.key,fe,Me)]}return h!=="categorical"||ee!=="number"||isFinite(se)&&Math.floor(se)===se?h!=="categorical"&&ee==="number"&&y!==void 0&&senew rt(`${l.key}${p.key}`,l.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!h.outputDefined())return[new rt(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"&&!$u(h))return[new rt(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!$u(h))return[new rt(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!ec(h,["zoom","feature-state"]))return[new rt(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!ih(h))return[new rt(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ja(l){const o=l.key,h=l.value,p=l.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(Er(h))===-1&&y.push(new rt(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Er(h))===-1&&y.push(new rt(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),y}function cu(l){return mh(Ga(l.value))?qa(Ko({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):hp(l)}function hp(l){const o=l.value,h=l.key;if(In(o)!=="array")return[new rt(h,o,`array expected, ${In(o)} found`)];const p=l.styleSpec;let y,b=[];if(o.length<1)return[new rt(h,o,"filter array must have at least 1 element")];switch(b=b.concat(ja({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:l.style,styleSpec:l.styleSpec})),Er(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Er(o[1])==="$type"&&b.push(new rt(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new rt(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(y=In(o[1]),y!=="string"&&b.push(new rt(`${h}[1]`,o[1],`string expected, ${y} found`)));for(let x=2;x{A in h&&o.push(new rt(p,h[A],`"${A}" is prohibited for ref layers`))}),y.layers.forEach(A=>{Er(A.id)===E&&(L=A)}),L?L.ref?o.push(new rt(p,h.ref,"ref cannot reference another ref layer")):x=Er(L.type):o.push(new rt(p,h.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(h.source){const L=y.sources&&y.sources[h.source],A=L&&Er(L.type);L?A==="vector"&&x==="raster"?o.push(new rt(p,h.source,`layer "${h.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new rt(p,h.source,`layer "${h.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new rt(p,h.source,`layer "${h.id}" requires a vector source`)):A!=="vector"||h["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new rt(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!h.paint||!h.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||o.push(new rt(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new rt(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new rt(p,h.source,`source "${h.source}" not found`))}else o.push(new rt(p,h,'missing required property "source"'));return o=o.concat($i({key:p,value:h,valueSpec:b.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${p}.type`,value:h.type,valueSpec:b.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:h,objectKey:"type"}),filter:cu,layout:L=>$i({layer:h,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>pp(Ko({layerType:x},A))}}),paint:L=>$i({layer:h,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>fp(Ko({layerType:x},A))}})}})),o}function Cl(l){const o=l.value,h=l.key,p=In(o);return p!=="string"?[new rt(h,o,`string expected, ${p} found`)]:[]}const xm={promoteId:function({key:l,value:o}){if(In(o)==="string")return Cl({key:l,value:o});{const h=[];for(const p in o)h.push(...Cl({key:`${l}.${p}`,value:o[p]}));return h}}};function wm(l){const o=l.value,h=l.key,p=l.styleSpec,y=l.style,b=l.validateSpec;if(!o.type)return[new rt(h,o,'"type" is required')];const x=Er(o.type);let E;switch(x){case"vector":case"raster":return E=$i({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:l.style,styleSpec:p,objectElementValidators:xm,validateSpec:b}),E;case"raster-dem":return E=function(L){var A;const R=(A=L.sourceName)!==null&&A!==void 0?A:"",O=L.value,V=L.styleSpec,W=V.source_raster_dem,Y=L.style;let ee=[];const se=In(O);if(O===void 0)return ee;if(se!=="object")return ee.push(new rt("source_raster_dem",O,`object expected, ${se} found`)),ee;const fe=Er(O.encoding)==="custom",Me=["redFactor","greenFactor","blueFactor","baseShift"],ye=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const Ee in O)!fe&&Me.includes(Ee)?ee.push(new rt(Ee,O[Ee],`In "${R}": "${Ee}" is only valid when "encoding" is set to "custom". ${ye} encoding found`)):W[Ee]?ee=ee.concat(L.validateSpec({key:Ee,value:O[Ee],valueSpec:W[Ee],validateSpec:L.validateSpec,style:Y,styleSpec:V})):ee.push(new rt(Ee,O[Ee],`unknown property "${Ee}"`));return ee}({sourceName:h,value:o,style:l.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=$i({key:h,value:o,valueSpec:p.source_geojson,style:y,styleSpec:p,validateSpec:b,objectElementValidators:xm}),o.cluster)for(const L in o.clusterProperties){const[A,R]=o.clusterProperties[L],O=typeof A=="string"?[A,["accumulated"],["get",L]]:A;E.push(...qa({key:`${h}.${L}.map`,value:R,validateSpec:b,expressionContext:"cluster-map"})),E.push(...qa({key:`${h}.${L}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return $i({key:h,value:o,valueSpec:p.source_video,style:y,validateSpec:b,styleSpec:p});case"image":return $i({key:h,value:o,valueSpec:p.source_image,style:y,validateSpec:b,styleSpec:p});case"canvas":return[new rt(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ja({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:b,styleSpec:p})}}function Sm(l){const o=l.value,h=l.styleSpec,p=h.light,y=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new rt("light",o,`object expected, ${x} found`)]),b;for(const E in o){const L=E.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?l.validateSpec({key:E,value:o[E],valueSpec:h.transition,validateSpec:l.validateSpec,style:y,styleSpec:h}):p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:y,styleSpec:h}):[new rt(E,o[E],`unknown property "${E}"`)])}return b}function Em(l){const o=l.value,h=l.styleSpec,p=h.sky,y=l.style,b=In(o);if(o===void 0)return[];if(b!=="object")return[new rt("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Bs({key:E,value:o[E],valueSpec:p[E],style:y,styleSpec:h}):[new rt(E,o[E],`unknown property "${E}"`)]);return x}function oc(l){const o=l.value,h=l.styleSpec,p=h.terrain,y=l.style;let b=[];const x=In(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new rt("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?l.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:l.validateSpec,style:y,styleSpec:h}):[new rt(E,o[E],`unknown property "${E}"`)]);return b}function sc(l){let o=[];const h=l.value,p=l.key;if(Array.isArray(h)){const y=[],b=[];for(const x in h)h[x].id&&y.includes(h[x].id)&&o.push(new rt(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),y.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new rt(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat($i({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return Cl({key:p,value:h})}const fo={"*":()=>[],array:cp,boolean:function(l){const o=l.value,h=l.key,p=In(o);return p!=="boolean"?[new rt(h,o,`boolean expected, ${p} found`)]:[]},number:bh,color:function(l){const o=l.key,h=l.value,p=In(h);return p!=="string"?[new rt(o,h,`color expected, ${p} found`)]:Vn.parse(String(h))?[]:[new rt(o,h,`color expected, "${h}" found`)]},constants:vm,enum:ja,filter:cu,function:bm,layer:ic,object:$i,source:wm,light:Sm,sky:Em,terrain:oc,string:Cl,formatted:function(l){return Cl(l).length===0?[]:qa(l)},resolvedImage:function(l){return Cl(l).length===0?[]:qa(l)},padding:function(l){const o=l.key,h=l.value;if(In(h)==="array"){if(h.length<1||h.length>4)return[new rt(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let y=[];for(let b=0;b[]}})),l.constants&&(h=h.concat(vm({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Bs}))),hu(h)}function Vs(l){return function(o){return l({...o,validateSpec:Bs})}}function hu(l){return[].concat(l).sort((o,h)=>o.line-h.line)}function gs(l){return function(...o){return hu(l.apply(this,o))}}ms.source=gs(Vs(wm)),ms.sprite=gs(Vs(sc)),ms.glyphs=gs(Vs(dp)),ms.light=gs(Vs(Sm)),ms.sky=gs(Vs(Em)),ms.terrain=gs(Vs(oc)),ms.layer=gs(Vs(ic)),ms.filter=gs(Vs(cu)),ms.paintProperty=gs(Vs(fp)),ms.layoutProperty=gs(Vs(pp));const Tl=ms,n_=Tl.light,mp=Tl.paintProperty,r_=Tl.layoutProperty;function fu(l,o){let h=!1;if(o&&o.length)for(const p of o)l.fire(new It(new Error(p.message))),h=!0;return h}class ac{constructor(o,h,p){const y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(h=x[1])+2*(p=x[2]);for(let L=0;L=O[Y+0]&&y>=O[Y+1])?(E[W]=!0,x.push(R[W])):E[W]=!1}}}}_forEachCell(o,h,p,y,b,x,E,L){const A=this._convertToCellCoord(o),R=this._convertToCellCoord(h),O=this._convertToCellCoord(p),V=this._convertToCellCoord(y);for(let W=A;W<=O;W++)for(let Y=R;Y<=V;Y++){const ee=this.d*Y+W;if((!L||L(this._convertFromCellCoord(W),this._convertFromCellCoord(Y),this._convertFromCellCoord(W+1),this._convertFromCellCoord(Y+1)))&&b.call(this,o,h,p,y,ee,x,E,L))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,h=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=l[b];y[b]=Us[p].shallow.indexOf(b)>=0?x:pu(x,o)}l instanceof Error&&(y.message=l.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(y.$name=p),y}throw new Error("can't serialize object of type "+typeof l)}function du(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||l instanceof Error||wh(l)||Nt(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(du);if(typeof l=="object"){const o=l.$name||"Object";if(!Us[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=Us[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(l);const p=Object.create(h.prototype);for(const y of Object.keys(l)){if(y==="$name")continue;const b=l[y];p[y]=Us[o].shallow.indexOf(y)>=0?b:du(b)}return p}throw new Error("can't deserialize object of type "+typeof l)}class Im{constructor(){this.first=!0}update(o,h){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):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 mu(l){for(const o of l)if(Sh(o.charCodeAt(0)))return!0;return!1}function Cm(l){for(const o of l)if(!Tm(o.charCodeAt(0)))return!1;return!0}function Tm(l){return!(_t.Arabic(l)||_t["Arabic Supplement"](l)||_t["Arabic Extended-A"](l)||_t["Arabic Presentation Forms-A"](l)||_t["Arabic Presentation Forms-B"](l))}function Sh(l){return!(l!==746&&l!==747&&(l<4352||!(_t["Bopomofo Extended"](l)||_t.Bopomofo(l)||_t["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||_t["CJK Compatibility Ideographs"](l)||_t["CJK Compatibility"](l)||_t["CJK Radicals Supplement"](l)||_t["CJK Strokes"](l)||!(!_t["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||_t["CJK Unified Ideographs Extension A"](l)||_t["CJK Unified Ideographs"](l)||_t["Enclosed CJK Letters and Months"](l)||_t["Hangul Compatibility Jamo"](l)||_t["Hangul Jamo Extended-A"](l)||_t["Hangul Jamo Extended-B"](l)||_t["Hangul Jamo"](l)||_t["Hangul Syllables"](l)||_t.Hiragana(l)||_t["Ideographic Description Characters"](l)||_t.Kanbun(l)||_t["Kangxi Radicals"](l)||_t["Katakana Phonetic Extensions"](l)||_t.Katakana(l)&&l!==12540||!(!_t["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)||!(!_t["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||_t["Unified Canadian Aboriginal Syllabics"](l)||_t["Unified Canadian Aboriginal Syllabics Extended"](l)||_t["Vertical Forms"](l)||_t["Yijing Hexagram Symbols"](l)||_t["Yi Syllables"](l)||_t["Yi Radicals"](l))))}function gp(l){return!(Sh(l)||function(o){return!!(_t["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_t["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)||_t["Letterlike Symbols"](o)||_t["Number Forms"](o)||_t["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)||_t["Control Pictures"](o)&&o!==9251||_t["Optical Character Recognition"](o)||_t["Enclosed Alphanumerics"](o)||_t["Geometric Shapes"](o)||_t["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_t["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_t["CJK Symbols and Punctuation"](o)||_t.Katakana(o)||_t["Private Use Area"](o)||_t["CJK Compatibility Forms"](o)||_t["Small Form Variants"](o)||_t["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 Eh(l){return l>=1424&&l<=2303||_t["Arabic Presentation Forms-A"](l)||_t["Arabic Presentation Forms-B"](l)}function Lm(l,o){return!(!o&&Eh(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||_t.Khmer(l))}function i_(l){for(const o of l)if(Eh(o.charCodeAt(0)))return!0;return!1}const Wa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class sr{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Im,this.transition={})}isSupportedScript(o){return function(h,p){for(const y of h)if(!Lm(y.charCodeAt(0),p))return!1;return!0}(o,Wa.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class lc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,y){if(hh(p))return new ph(p,y);if(Jn(p)){const b=dm(p,y);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return y.type==="color"&&typeof p=="string"?b=Vn.parse(p):y.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Qo.parse(p)):b=ho.parse(p),{kind:"constant",evaluate:()=>b}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class Ih{constructor(o){this.property=o,this.value=new lc(o,void 0)}transitioned(o,h){return new Pm(this.property,this.value,h,pe({},o.transition,this.transition),o.now)}untransitioned(){return new Pm(this.property,this.value,null,{},0)}}class yp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return H(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Ih(this._values[o].property)),this._values[o].value=new lc(this._values[o].property,h===null?void 0:H(h))}getTransition(o){return H(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Ih(this._values[o].property)),this._values[o].transition=H(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const y=this.getTransition(h);y!==void 0&&(o[`${h}-transition`]=y)}return o}transitioned(o,h){const p=new Mm(this._properties);for(const y of Object.keys(this._values))p._values[y]=this._values[y].transitioned(o,h._values[y]);return p}untransitioned(){const o=new Mm(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Pm{constructor(o,h,p,y,b){this.property=o,this.value=h,this.begin=b+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const y=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(y>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(y=1)return 1;const A=L*L,R=A*L;return 4*(L<.5?R:3*(L-A)+R-.75)}(E))}}return b}}class Mm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const y=new uc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,h,p);return y}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Am{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return H(this._values[o].value)}setValue(o,h){this._values[o]=new lc(this._values[o].property,h===null?void 0:H(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const y=new uc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,h,p);return y}}class ys{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,y){return this.property.evaluate(this.value,this.parameters,o,h,p,y)}}class uc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Mt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const y=Qi[this.specification.type];return y?y(o,h,p):o}}class Ft{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,y){return new ys(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,y)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new ys(this,{kind:"constant",value:void 0},o.parameters);const y=Qi[this.specification.type];if(y){const b=y(o.value.value,h.value.value,p);return new ys(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,y,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,y,b,x)}}class Ch extends Ft{possiblyEvaluate(o,h,p,y){if(o.value===void 0)return new ys(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,y),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,h);return new ys(this,{kind:"constant",value:E},h)}if(o.expression.kind==="camera"){const b=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new ys(this,{kind:"constant",value:b},h)}return new ys(this,o.expression,h)}evaluate(o,h,p,y,b,x){if(o.kind==="source"){const E=o.evaluate(h,p,y,b,x);return this._calculate(E,E,E,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,y),o.evaluate({zoom:Math.floor(h.zoom)},p,y),o.evaluate({zoom:Math.floor(h.zoom)+1},p,y),h):o.value}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class cc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,y);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new sr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new sr(Math.floor(h.zoom),h)),o.expression.evaluate(new sr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class _p{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){return!!o.expression.evaluate(h,null,{},p,y)}interpolate(){return!1}}class po{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const y=this.defaultPropertyValues[h]=new lc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new Ih(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",Ft),St("DataConstantProperty",Mt),St("CrossFadedDataDrivenProperty",Ch),St("CrossFadedProperty",cc),St("ColorRampProperty",_p);const vp="-transition";class _s extends kn{constructor(o,h){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),h.layout&&(this._unevaluatedLayout=new Am(h.layout)),h.paint)){this._transitionablePaint=new yp(h.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new uc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(r_,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(vp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(mp,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(vp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const y=this._transitionablePaint._values[o],b=y.property.specification["property-type"]==="cross-faded-data-driven",x=y.value.isDataDriven(),E=y.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){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,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}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),Ce(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,y,b={}){return(!b||b.validate!==!1)&&fu(this,o.call(Tl,{key:h,layerType:this.type,objectKey:p,value:y,styleSpec:Ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof ys&&uu(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const km={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class hc{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ir{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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 h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Vr(l,o=1){let h=0,p=0;return{members:l.map(y=>{const b=km[y.type].BYTES_PER_ELEMENT,x=h=Dm(h,Math.max(o,b)),E=y.components||1;return p=Math.max(p,b),h+=b*E,{name:y.name,type:y.type,components:E,offset:x}}),size:Dm(h,Math.max(p,o)),alignment:o}}function Dm(l,o){return Math.ceil(l/o)*o}class fc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.int16[y+0]=h,this.int16[y+1]=p,o}}fc.prototype.bytesPerElement=4,St("StructArrayLayout2i4",fc);class ya extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=y,o}}ya.prototype.bytesPerElement=6,St("StructArrayLayout3i6",ya);class bp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=y,this.int16[x+3]=b,o}}bp.prototype.bytesPerElement=8,St("StructArrayLayout4i8",bp);class xp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,E){const L=6*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}xp.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",xp);class wp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,E){const L=4*o,A=8*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.uint8[A+4]=y,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}wp.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",wp);class pc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.float32[y+0]=h,this.float32[y+1]=p,o}}pc.prototype.bytesPerElement=8,St("StructArrayLayout2f8",pc);class Th extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,E,L,A,R){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,y,b,x,E,L,A,R)}emplace(o,h,p,y,b,x,E,L,A,R,O){const V=10*o;return this.uint16[V+0]=h,this.uint16[V+1]=p,this.uint16[V+2]=y,this.uint16[V+3]=b,this.uint16[V+4]=x,this.uint16[V+5]=E,this.uint16[V+6]=L,this.uint16[V+7]=A,this.uint16[V+8]=R,this.uint16[V+9]=O,o}}Th.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",Th);class Sp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,E,L,A,R,O,V){const W=this.length;return this.resize(W+1),this.emplace(W,o,h,p,y,b,x,E,L,A,R,O,V)}emplace(o,h,p,y,b,x,E,L,A,R,O,V,W){const Y=12*o;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=y,this.int16[Y+3]=b,this.uint16[Y+4]=x,this.uint16[Y+5]=E,this.uint16[Y+6]=L,this.uint16[Y+7]=A,this.int16[Y+8]=R,this.int16[Y+9]=O,this.int16[Y+10]=V,this.int16[Y+11]=W,o}}Sp.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",Sp);class Ep extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=y,o}}Ep.prototype.bytesPerElement=12,St("StructArrayLayout3f12",Ep);class _a extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}_a.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",_a);class Lh extends Ir{_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,h,p,y,b,x,E,L,A){const R=this.length;return this.resize(R+1),this.emplace(R,o,h,p,y,b,x,E,L,A)}emplace(o,h,p,y,b,x,E,L,A,R){const O=10*o,V=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=y,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[V+3]=L,this.uint16[O+8]=A,this.uint16[O+9]=R,o}}Lh.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",Lh);class dc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,E){const L=6*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}dc.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",dc);class Ph extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,y,b)}emplace(o,h,p,y,b,x){const E=4*o,L=8*o;return this.float32[E+0]=h,this.float32[E+1]=p,this.float32[E+2]=y,this.int16[L+6]=b,this.int16[L+7]=x,o}}Ph.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ph);class mc extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=12*o,E=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[E+1]=y,this.float32[E+2]=b,o}}mc.prototype.bytesPerElement=12,St("StructArrayLayout2ub2f12",mc);class Mh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=y,o}}Mh.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",Mh);class gu extends Ir{_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,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee,se,fe){const Me=this.length;return this.resize(Me+1),this.emplace(Me,o,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee,se,fe)}emplace(o,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee,se,fe,Me){const ye=24*o,Ee=12*o,Ye=48*o;return this.int16[ye+0]=h,this.int16[ye+1]=p,this.uint16[ye+2]=y,this.uint16[ye+3]=b,this.uint32[Ee+2]=x,this.uint32[Ee+3]=E,this.uint32[Ee+4]=L,this.uint16[ye+10]=A,this.uint16[ye+11]=R,this.uint16[ye+12]=O,this.float32[Ee+7]=V,this.float32[Ee+8]=W,this.uint8[Ye+36]=Y,this.uint8[Ye+37]=ee,this.uint8[Ye+38]=se,this.uint32[Ee+10]=fe,this.int16[ye+22]=Me,o}}gu.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",gu);class Ll extends Ir{_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,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee,se,fe,Me,ye,Ee,Ye,Je,bt,Ct,vt,yt,ut,Et){const dt=this.length;return this.resize(dt+1),this.emplace(dt,o,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee,se,fe,Me,ye,Ee,Ye,Je,bt,Ct,vt,yt,ut,Et)}emplace(o,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee,se,fe,Me,ye,Ee,Ye,Je,bt,Ct,vt,yt,ut,Et,dt){const nt=32*o,Ot=16*o;return this.int16[nt+0]=h,this.int16[nt+1]=p,this.int16[nt+2]=y,this.int16[nt+3]=b,this.int16[nt+4]=x,this.int16[nt+5]=E,this.int16[nt+6]=L,this.int16[nt+7]=A,this.uint16[nt+8]=R,this.uint16[nt+9]=O,this.uint16[nt+10]=V,this.uint16[nt+11]=W,this.uint16[nt+12]=Y,this.uint16[nt+13]=ee,this.uint16[nt+14]=se,this.uint16[nt+15]=fe,this.uint16[nt+16]=Me,this.uint16[nt+17]=ye,this.uint16[nt+18]=Ee,this.uint16[nt+19]=Ye,this.uint16[nt+20]=Je,this.uint16[nt+21]=bt,this.uint16[nt+22]=Ct,this.uint32[Ot+12]=vt,this.float32[Ot+13]=yt,this.float32[Ot+14]=ut,this.uint16[nt+30]=Et,this.uint16[nt+31]=dt,o}}Ll.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",Ll);class Ah extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Ah.prototype.bytesPerElement=4,St("StructArrayLayout1f4",Ah);class kh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=y,o}}kh.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",kh);class Pl extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=y,o}}Pl.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",Pl);class Ip extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.uint16[y+0]=h,this.uint16[y+1]=p,o}}Ip.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",Ip);class Cp extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}Cp.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Cp);class Dh extends Ir{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=y,this.float32[x+3]=b,o}}Dh.prototype.bytesPerElement=16,St("StructArrayLayout4f16",Dh);class Rm extends hc{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 I(this.anchorPointX,this.anchorPointY)}}Rm.prototype.size=20;class _ extends Lh{get(o){return new Rm(this,o)}}St("CollisionBoxArray",_);class s extends hc{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]}}s.prototype.size=48;class f extends gu{get(o){return new s(this,o)}}St("PlacedSymbolArray",f);class d extends hc{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]}}d.prototype.size=64;class m extends Ll{get(o){return new d(this,o)}}St("SymbolInstanceArray",m);class v extends Ah{getoffsetX(o){return this.float32[1*o+0]}}St("GlyphOffsetArray",v);class C extends ya{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}St("SymbolLineVertexArray",C);class T extends hc{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]}}T.prototype.size=12;class M extends kh{get(o){return new T(this,o)}}St("TextAnchorOffsetArray",M);class k extends hc{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]}}k.prototype.size=8;class z extends Pl{get(o){return new k(this,o)}}St("FeatureIndexArray",z);class F extends fc{}class X extends fc{}class oe extends fc{}class ie extends xp{}class le extends wp{}class $ extends pc{}class ve extends Th{}class Fe extends Sp{}class ue extends Ep{}class Ie extends _a{}class Be extends dc{}class Ge extends mc{}class He extends Mh{}class et extends Ip{}const $e=Vr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ot}=$e;class ht{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,y){let b=this.segments[this.segments.length-1];return o>ht.MAX_VERTEX_ARRAY_LENGTH&&Ke(`Max vertices per segment is ${ht.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>ht.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==y)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},y!==void 0&&(b.sortKey=y),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,y){return new ht([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:y,vaos:{},sortKey:0}])}}function nn(l,o){return 256*(l=te(Math.floor(l),0,255))+te(Math.floor(o),0,255)}ht.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",ht);const pt=Vr([{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 Bt={exports:{}},rn={exports:{}};rn.exports=function(l,o){var h,p,y,b,x,E,L,A;for(p=l.length-(h=3&l.length),y=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,h){case 3:L^=(255&l.charCodeAt(A+2))<<16;case 2:L^=(255&l.charCodeAt(A+1))<<8;case 1:y^=L=(65535&(L=(L=(65535&(L^=255&l.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295}return y^=l.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var wn=rn.exports,qt={exports:{}};qt.exports=function(l,o){for(var h,p=l.length,y=o^p,b=0;p>=4;)h=1540483477*(65535&(h=255&l.charCodeAt(b)|(255&l.charCodeAt(++b))<<8|(255&l.charCodeAt(++b))<<16|(255&l.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:y^=(255&l.charCodeAt(b+2))<<16;case 2:y^=(255&l.charCodeAt(b+1))<<8;case 1:y=1540483477*(65535&(y^=255&l.charCodeAt(b)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var an=wn,fn=qt.exports;Bt.exports=an,Bt.exports.murmur3=an,Bt.exports.murmur2=fn;var Cr=g(Bt.exports);class Gn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,y){this.ids.push(Ro(o)),this.positions.push(h,p,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=Ro(o);let p=0,y=this.ids.length-1;for(;p>1;this.ids[x]>=h?y=x:p=x+1}const b=[];for(;this.ids[p]===h;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,h){const p=new Float64Array(o.ids),y=new Uint32Array(o.positions);return ai(p,y,0,p.length-1),h&&h.push(p.buffer,y.buffer),{ids:p,positions:y}}static deserialize(o){const h=new Gn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function Ro(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Cr(String(l))}function ai(l,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(l[b]y);if(b>=x)break;dr(l,b,x),dr(o,3*b,3*x),dr(o,3*b+1,3*x+1),dr(o,3*b+2,3*x+2)}x-h`u_${y}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new Ha(o,h):new No(o,h)}}class Kr{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,y){const b=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Gs(o,h):new No(o,h)}}class mr{constructor(o,h,p,y){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,h,p,y,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new sr(0),h,{},y,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,h,p,y){const b=this.expression.evaluate({zoom:0},p,y);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const y=Za(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=y,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=h.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,h,p,y,b){const x=this.expression.evaluate(new sr(this.zoom),h,{},y,[],b),E=this.expression.evaluate(new sr(this.zoom+1),h,{},y,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,E)}updatePaintArray(o,h,p,y){const b=this.expression.evaluate({zoom:this.zoom},p,y),x=this.expression.evaluate({zoom:this.zoom+1},p,y);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,y){if(this.type==="color"){const b=Za(p),x=Za(y);for(let E=o;E`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof mr||p instanceof ar)for(let y=0;y!0){this.programConfigurations={};for(const y of o)this.programConfigurations[y.id]=new Jr(y,h,p);this.needsUpload=!1,this._featureMap=new Gn,this._bufferOffset=0}populatePaintArrays(o,h,p,y,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,h,y,b,x);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,y){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,y)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function ts(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 Qr(l,o,h){const p={color:{source:pc,composite:Dh},number:{source:Ah,composite:pc}},y=function(b){return{"line-pattern":{source:ve,composite:ve},"fill-pattern":{source:ve,composite:ve},"fill-extrusion-pattern":{source:ve,composite:ve}}[b]}(l);return y&&y[h]||p[o][h]}St("ConstantBinder",qs),St("CrossFadedConstantBinder",Kr),St("SourceExpressionBinder",mr),St("CrossFadedCompositeBinder",es),St("CompositeExpressionBinder",ar),St("ProgramConfiguration",Jr,{omit:["_buffers"]}),St("ProgramConfigurationSet",gr);const Rr=8192,Tp=Math.pow(2,14)-1,Nm=-Tp-1;function Ml(l){const o=Rr/l.extent,h=l.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Ke("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function Al(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?Ml(l):[]}}function Rh(l,o,h,p,y){l.emplaceBack(2*o+(p+1)/2,2*h+(y+1)/2)}class Xa{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new X,this.indexArray=new He,this.segments=new ht,this.programConfigurations=new gr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const y=this.layers[0],b=[];let x=null,E=!1;y.type==="circle"&&(x=y.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:L,id:A,index:R,sourceLayerIndex:O}of o){const V=this.layers[0]._featureFilter.needGeometry,W=Al(L,V);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),W,p))continue;const Y=E?x.evaluate(W,{},p):void 0,ee={id:A,properties:L.properties,type:L.type,sourceLayerIndex:O,index:R,geometry:V?W.geometry:Ml(L),patterns:{},sortKey:Y};b.push(ee)}E&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:R,sourceLayerIndex:O}=L,V=o[R].feature;this.addFeature(L,A,R,p),h.featureIndex.insert(V,A,R,O,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,ot),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,h,p,y){for(const b of h)for(const x of b){const E=x.x,L=x.y;if(E<0||E>=Rr||L<0||L>=Rr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),R=A.vertexLength;Rh(this.layoutVertexArray,E,L,-1,-1),Rh(this.layoutVertexArray,E,L,1,-1),Rh(this.layoutVertexArray,E,L,1,1),Rh(this.layoutVertexArray,E,L,-1,1),this.indexArray.emplaceBack(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},y)}}function Lp(l,o){for(let h=0;h1){if(Nh(l,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(y)._add(o))}function w1(l,o){let h,p,y,b=!1;for(let x=0;xo.y!=y.y>o.y&&o.x<(y.x-p.x)*(o.y-p.y)/(y.y-p.y)+p.x&&(b=!b)}return b}function Oh(l,o){let h=!1;for(let p=0,y=l.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(h=!h)}return h}function jC(l,o,h){const p=h[0],y=h[2];if(l.xy.x&&o.x>y.x||l.yy.y&&o.y>y.y)return!1;const b=Se(l,o,h[0]);return b!==Se(l,o,h[1])||b!==Se(l,o,h[2])||b!==Se(l,o,h[3])}function kp(l,o,h){const p=o.paint.get(l).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(l)}function zm(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function Fm(l,o,h,p,y){if(!o[0]&&!o[1])return l;const b=I.convert(o)._mult(y);h==="viewport"&&b._rotate(-p);const x=[];for(let E=0;EC1(se,ee))}(A,L),W=O?R*E:R;for(const Y of y)for(const ee of Y){const se=O?ee:C1(ee,L);let fe=W;const Me=Bm([],[ee.x,ee.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=Me[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=x.cameraToCenterDistance/Me[3]),Om(V,se,fe))return!0}return!1}}function C1(l,o){const h=Bm([],[l.x,l.y,0,1],o);return new I(h[0]/h[3],h[1]/h[3])}class T1 extends Xa{}let L1;St("HeatmapBucket",T1,{omit:["layers"]});var XC={get paint(){return L1=L1||new po({"heatmap-radius":new Ft(Ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ft(Ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Mt(Ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new _p(Ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Mt(Ne.paint_heatmap["heatmap-opacity"])})}};function a_(l,{width:o,height:h},p,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*h*p}`)}else y=new Uint8Array(o*h*p);return l.width=o,l.height=h,l.data=y,l}function P1(l,{width:o,height:h},p){if(o===l.width&&h===l.height)return;const y=a_({},{width:o,height:h},p);l_(l,y,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,h)},p),l.width=o,l.height=h,l.data=y.data}function l_(l,o,h,p,y,b){if(y.width===0||y.height===0)return o;if(y.width>l.width||y.height>l.height||h.x>l.width-y.width||h.y>l.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||p.x>o.width-y.width||p.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const x=l.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[l.evaluationKey]=L;const A=l.expression.evaluate(o);y.data[x+E+0]=Math.floor(255*A.r/A.a),y.data[x+E+1]=Math.floor(255*A.g/A.a),y.data[x+E+2]=Math.floor(255*A.b/A.a),y.data[x+E+3]=Math.floor(255*A.a)};if(l.clips)for(let x=0,E=0;x80*h){p=b=l[0],y=x=l[1];for(var Y=h;Yb&&(b=E),L>x&&(x=L);A=(A=Math.max(b-p,x-y))!==0?32767/A:0}return Np(V,W,h,p,y,A,0),W}function k1(l,o,h,p,y){var b,x;if(y===f_(l,o,h,p)>0)for(b=o;b=o;b-=p)x=N1(b,l[b],l[b+1],x);return x&&Um(x,x.next)&&(zp(x),x=x.next),x}function yc(l,o){if(!l)return l;o||(o=l);var h,p=l;do if(h=!1,p.steiner||!Um(p,p.next)&&Ur(p.prev,p,p.next)!==0)p=p.next;else{if(zp(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function Np(l,o,h,p,y,b,x){if(l){!x&&b&&function(R,O,V,W){var Y=R;do Y.z===0&&(Y.z=c_(Y.x,Y.y,O,V,W)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==R);Y.prevZ.nextZ=null,Y.prevZ=null,function(ee){var se,fe,Me,ye,Ee,Ye,Je,bt,Ct=1;do{for(fe=ee,ee=null,Ee=null,Ye=0;fe;){for(Ye++,Me=fe,Je=0,se=0;se0||bt>0&&Me;)Je!==0&&(bt===0||!Me||fe.z<=Me.z)?(ye=fe,fe=fe.nextZ,Je--):(ye=Me,Me=Me.nextZ,bt--),Ee?Ee.nextZ=ye:ee=ye,ye.prevZ=Ee,Ee=ye;fe=Me}Ee.nextZ=null,Ct*=2}while(Ye>1)}(Y)}(l,p,y,b);for(var E,L,A=l;l.prev!==l.next;)if(E=l.prev,L=l.next,b?tT(l,p,y,b):eT(l))o.push(E.i/h|0),o.push(l.i/h|0),o.push(L.i/h|0),zp(l),l=L.next,A=L.next;else if((l=L)===A){x?x===1?Np(l=nT(yc(l),o,h),o,h,p,y,b,2):x===2&&rT(l,o,h,p,y,b):Np(yc(l),o,h,p,y,b,1);break}}}function eT(l){var o=l.prev,h=l,p=l.next;if(Ur(o,h,p)>=0)return!1;for(var y=o.x,b=h.x,x=p.x,E=o.y,L=h.y,A=p.y,R=yb?y>x?y:x:b>x?b:x,W=E>L?E>A?E:A:L>A?L:A,Y=p.next;Y!==o;){if(Y.x>=R&&Y.x<=V&&Y.y>=O&&Y.y<=W&&Fh(y,E,b,L,x,A,Y.x,Y.y)&&Ur(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function tT(l,o,h,p){var y=l.prev,b=l,x=l.next;if(Ur(y,b,x)>=0)return!1;for(var E=y.x,L=b.x,A=x.x,R=y.y,O=b.y,V=x.y,W=EL?E>A?E:A:L>A?L:A,se=R>O?R>V?R:V:O>V?O:V,fe=c_(W,Y,o,h,p),Me=c_(ee,se,o,h,p),ye=l.prevZ,Ee=l.nextZ;ye&&ye.z>=fe&&Ee&&Ee.z<=Me;){if(ye.x>=W&&ye.x<=ee&&ye.y>=Y&&ye.y<=se&&ye!==y&&ye!==x&&Fh(E,R,L,O,A,V,ye.x,ye.y)&&Ur(ye.prev,ye,ye.next)>=0||(ye=ye.prevZ,Ee.x>=W&&Ee.x<=ee&&Ee.y>=Y&&Ee.y<=se&&Ee!==y&&Ee!==x&&Fh(E,R,L,O,A,V,Ee.x,Ee.y)&&Ur(Ee.prev,Ee,Ee.next)>=0))return!1;Ee=Ee.nextZ}for(;ye&&ye.z>=fe;){if(ye.x>=W&&ye.x<=ee&&ye.y>=Y&&ye.y<=se&&ye!==y&&ye!==x&&Fh(E,R,L,O,A,V,ye.x,ye.y)&&Ur(ye.prev,ye,ye.next)>=0)return!1;ye=ye.prevZ}for(;Ee&&Ee.z<=Me;){if(Ee.x>=W&&Ee.x<=ee&&Ee.y>=Y&&Ee.y<=se&&Ee!==y&&Ee!==x&&Fh(E,R,L,O,A,V,Ee.x,Ee.y)&&Ur(Ee.prev,Ee,Ee.next)>=0)return!1;Ee=Ee.nextZ}return!0}function nT(l,o,h){var p=l;do{var y=p.prev,b=p.next.next;!Um(y,b)&&D1(y,p,p.next,b)&&Op(y,b)&&Op(b,y)&&(o.push(y.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),zp(p),zp(p.next),p=l=b),p=p.next}while(p!==l);return yc(p)}function rT(l,o,h,p,y,b){var x=l;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&lT(x,E)){var L=R1(x,E);return x=yc(x,x.next),L=yc(L,L.next),Np(x,o,h,p,y,b,0),void Np(L,o,h,p,y,b,0)}E=E.next}x=x.next}while(x!==l)}function iT(l,o){return l.x-o.x}function oT(l,o){var h=function(y,b){var x,E=b,L=y.x,A=y.y,R=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var O=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(O<=L&&O>R&&(R=O,x=E.x=E.x&&E.x>=Y&&L!==E.x&&Fh(Ax.x||E.x===x.x&&sT(x,E)))&&(x=E,se=V)),E=E.next;while(E!==W);return x}(l,o);if(!h)return o;var p=R1(h,l);return yc(p,p.next),yc(h,h.next)}function sT(l,o){return Ur(l.prev,l,o.prev)<0&&Ur(o.next,l,l.next)<0}function c_(l,o,h,p,y){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-h)*y|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function aT(l){var o=l,h=l;do(o.x=(l-x)*(b-E)&&(l-x)*(p-E)>=(h-x)*(o-E)&&(h-x)*(b-E)>=(y-x)*(p-E)}function lT(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(h,p){var y=h;do{if(y.i!==h.i&&y.next.i!==h.i&&y.i!==p.i&&y.next.i!==p.i&&D1(y,y.next,h,p))return!0;y=y.next}while(y!==h);return!1}(l,o)&&(Op(l,o)&&Op(o,l)&&function(h,p){var y=h,b=!1,x=(h.x+p.x)/2,E=(h.y+p.y)/2;do y.y>E!=y.next.y>E&&y.next.y!==y.y&&x<(y.next.x-y.x)*(E-y.y)/(y.next.y-y.y)+y.x&&(b=!b),y=y.next;while(y!==h);return b}(l,o)&&(Ur(l.prev,l,o.prev)||Ur(l,o.prev,o))||Um(l,o)&&Ur(l.prev,l,l.next)>0&&Ur(o.prev,o,o.next)>0)}function Ur(l,o,h){return(o.y-l.y)*(h.x-o.x)-(o.x-l.x)*(h.y-o.y)}function Um(l,o){return l.x===o.x&&l.y===o.y}function D1(l,o,h,p){var y=qm(Ur(l,o,h)),b=qm(Ur(l,o,p)),x=qm(Ur(h,p,l)),E=qm(Ur(h,p,o));return y!==b&&x!==E||!(y!==0||!Gm(l,h,o))||!(b!==0||!Gm(l,p,o))||!(x!==0||!Gm(h,l,p))||!(E!==0||!Gm(h,o,p))}function Gm(l,o,h){return o.x<=Math.max(l.x,h.x)&&o.x>=Math.min(l.x,h.x)&&o.y<=Math.max(l.y,h.y)&&o.y>=Math.min(l.y,h.y)}function qm(l){return l>0?1:l<0?-1:0}function Op(l,o){return Ur(l.prev,l,l.next)<0?Ur(l,o,l.next)>=0&&Ur(l,l.prev,o)>=0:Ur(l,o,l.prev)<0||Ur(l,l.next,o)<0}function R1(l,o){var h=new h_(l.i,l.x,l.y),p=new h_(o.i,o.x,o.y),y=l.next,b=o.prev;return l.next=o,o.prev=l,h.next=y,y.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function N1(l,o,h,p){var y=new h_(l,o,h);return p?(y.next=p.next,y.prev=p,p.next.prev=y,p.next=y):(y.prev=y,y.next=y),y}function zp(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 h_(l,o,h){this.i=l,this.x=o,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function f_(l,o,h,p){for(var y=0,b=o,x=h-p;b0&&h.holes.push(p+=l[y-1].length)}return h};var O1=g(u_.exports);function uT(l,o,h,p,y){z1(l,o,h||0,p||l.length-1,y||cT)}function z1(l,o,h,p,y){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,E=Math.log(b),L=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*L*(b-L)/b)*(x-b/2<0?-1:1);z1(l,o,Math.max(h,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),y)}var R=l[o],O=h,V=p;for(Fp(l,h,o),y(l[p],R)>0&&Fp(l,h,p);O0;)V--}y(l[h],R)===0?Fp(l,h,V):Fp(l,++V,p),V<=o&&(h=V+1),o<=V&&(p=V-1)}}function Fp(l,o,h){var p=l[o];l[o]=l[h],l[h]=p}function cT(l,o){return lo?1:0}function p_(l,o){const h=l.length;if(h<=1)return[l];const p=[];let y,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new oe,this.indexArray=new He,this.indexArray2=new et,this.programConfigurations=new gr(o.layers,o.zoom),this.segments=new ht,this.segments2=new ht,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=d_("fill",this.layers,h);const y=this.layers[0].layout.get("fill-sort-key"),b=!y.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:R}of o){const O=this.layers[0]._featureFilter.needGeometry,V=Al(E,O);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),V,p))continue;const W=b?y.evaluate(V,{},p,h.availableImages):void 0,Y={id:L,properties:E.properties,type:E.type,sourceLayerIndex:R,index:A,geometry:O?V.geometry:Ml(E),patterns:{},sortKey:W};x.push(Y)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:R}=E;if(this.hasPattern){const O=m_("fill",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});h.featureIndex.insert(o[A].feature,L,A,R,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,$C),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,h,p,y,b){for(const x of p_(h,500)){let E=0;for(const W of x)E+=W.length;const L=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=L.vertexLength,R=[],O=[];for(const W of x){if(W.length===0)continue;W!==x[0]&&O.push(R.length/2);const Y=this.segments2.prepareSegment(W.length,this.layoutVertexArray,this.indexArray2),ee=Y.vertexLength;this.layoutVertexArray.emplaceBack(W[0].x,W[0].y),this.indexArray2.emplaceBack(ee+W.length-1,ee),R.push(W[0].x),R.push(W[0].y);for(let se=1;se>3}if(y--,p===1||p===2)b+=l.readSVarint(),x+=l.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new yT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},Bh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,h=1,p=0,y=0,b=0,x=1/0,E=-1/0,L=1/0,A=-1/0;l.pos>3}if(p--,h===1||h===2)(y+=l.readSVarint())E&&(E=y),(b+=l.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,L,E,A]},Bh.prototype.toGeoJSON=function(l,o,h){var p,y,b=this.extent*Math.pow(2,h),x=this.extent*l,E=this.extent*o,L=this.loadGeometry(),A=Bh.types[this.type];function R(W){for(var Y=0;Y>3;y=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return y}(h))}G1.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 bT(this._pbf,o,this.extent,this._keys,this._values)};var wT=U1;function ST(l,o,h){if(l===3){var p=new wT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}yu.VectorTile=function(l,o){this.layers=l.readFields(ST,{},o)},yu.VectorTileFeature=V1,yu.VectorTileLayer=U1;const ET=yu.VectorTileFeature.types,y_=Math.pow(2,13);function Bp(l,o,h,p,y,b,x,E){l.emplaceBack(o,h,2*Math.floor(p*y_)+x,y*y_*2,b*y_*2,Math.round(E))}class __{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new ie,this.centroidVertexArray=new F,this.indexArray=new He,this.programConfigurations=new gr(o.layers,o.zoom),this.segments=new ht,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=d_("fill-extrusion",this.layers,h);for(const{feature:y,id:b,index:x,sourceLayerIndex:E}of o){const L=this.layers[0]._featureFilter.needGeometry,A=Al(y,L);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),A,p))continue;const R={id:b,sourceLayerIndex:E,index:x,geometry:L?A.geometry:Ml(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(m_("fill-extrusion",this.layers,R,this.zoom,h)):this.addFeature(R,R.geometry,x,p,{}),h.featureIndex.insert(y,R.geometry,x,E,this.index,!0)}}addFeatures(o,h,p){for(const y of this.features){const{geometry:b}=y;this.addFeature(y,b,y.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}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,gT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,mT.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,h,p,y,b){const x={x:0,y:0,vertexCount:0};for(const E of p_(h,500)){let L=0;for(const Y of E)L+=Y.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of E){if(Y.length===0||CT(Y))continue;let ee=0;for(let se=0;se=1){const Me=Y[se-1];if(!IT(fe,Me)){A.vertexLength+4>ht.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ye=fe.sub(Me)._perp()._unit(),Ee=Me.dist(fe);ee+Ee>32768&&(ee=0),Bp(this.layoutVertexArray,fe.x,fe.y,ye.x,ye.y,0,0,ee),Bp(this.layoutVertexArray,fe.x,fe.y,ye.x,ye.y,0,1,ee),x.x+=2*fe.x,x.y+=2*fe.y,x.vertexCount+=2,ee+=Ee,Bp(this.layoutVertexArray,Me.x,Me.y,ye.x,ye.y,0,0,ee),Bp(this.layoutVertexArray,Me.x,Me.y,ye.x,ye.y,0,1,ee),x.x+=2*Me.x,x.y+=2*Me.y,x.vertexCount+=2;const Ye=A.vertexLength;this.indexArray.emplaceBack(Ye,Ye+2,Ye+1),this.indexArray.emplaceBack(Ye+1,Ye+2,Ye+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>ht.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),ET[o.type]!=="Polygon")continue;const R=[],O=[],V=A.vertexLength;for(const Y of E)if(Y.length!==0){Y!==E[0]&&O.push(R.length/2);for(let ee=0;eeRr)||l.y===o.y&&(l.y<0||l.y>Rr)}function CT(l){return l.every(o=>o.x<0)||l.every(o=>o.x>Rr)||l.every(o=>o.y<0)||l.every(o=>o.y>Rr)}let q1;St("FillExtrusionBucket",__,{omit:["layers","features"]});var TT={get paint(){return q1=q1||new po({"fill-extrusion-opacity":new Mt(Ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ft(Ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Mt(Ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Mt(Ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ch(Ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ft(Ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ft(Ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Mt(Ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class LT extends _s{constructor(o){super(o,TT)}createBucket(o){return new __(o)}queryRadius(){return zm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,y,b,x,E,L){const A=Fm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),R=this.paint.get("fill-extrusion-height").evaluate(h,p),O=this.paint.get("fill-extrusion-base").evaluate(h,p),V=function(Y,ee,se,fe){const Me=[];for(const ye of Y){const Ee=[ye.x,ye.y,0,1];Bm(Ee,Ee,ee),Me.push(new I(Ee[0]/Ee[3],Ee[1]/Ee[3]))}return Me}(A,L),W=function(Y,ee,se,fe){const Me=[],ye=[],Ee=fe[8]*ee,Ye=fe[9]*ee,Je=fe[10]*ee,bt=fe[11]*ee,Ct=fe[8]*se,vt=fe[9]*se,yt=fe[10]*se,ut=fe[11]*se;for(const Et of Y){const dt=[],nt=[];for(const Ot of Et){const Lt=Ot.x,pn=Ot.y,rr=fe[0]*Lt+fe[4]*pn+fe[12],lr=fe[1]*Lt+fe[5]*pn+fe[13],ci=fe[2]*Lt+fe[6]*pn+fe[14],ns=fe[3]*Lt+fe[7]*pn+fe[15],go=ci+Je,$r=ns+bt,Mi=rr+Ct,Fi=lr+vt,yo=ci+yt,_o=ns+ut,hi=new I((rr+Ee)/$r,(lr+Ye)/$r);hi.z=go/$r,dt.push(hi);const fi=new I(Mi/_o,Fi/_o);fi.z=yo/_o,nt.push(fi)}Me.push(dt),ye.push(nt)}return[Me,ye]}(y,O,R,L);return function(Y,ee,se){let fe=1/0;Pp(se,ee)&&(fe=j1(se,ee[0]));for(let Me=0;Meh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new le,this.layoutVertexArray2=new $,this.indexArray=new He,this.programConfigurations=new gr(o.layers,o.zoom),this.segments=new ht,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=d_("line",this.layers,h);const y=this.layers[0].layout.get("line-sort-key"),b=!y.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:R}of o){const O=this.layers[0]._featureFilter.needGeometry,V=Al(E,O);if(!this.layers[0]._featureFilter.filter(new sr(this.zoom),V,p))continue;const W=b?y.evaluate(V,{},p):void 0,Y={id:L,properties:E.properties,type:E.type,sourceLayerIndex:R,index:A,geometry:O?V.geometry:Ml(E),patterns:{},sortKey:W};x.push(Y)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:R}=E;if(this.hasPattern){const O=m_("line",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});h.featureIndex.insert(o[A].feature,L,A,R,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}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,kT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,MT),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,h,p,y,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),L=x.get("line-cap"),A=x.get("line-miter-limit"),R=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of h)this.addLine(O,o,E,L,A,R);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,y)}addLine(o,h,p,y,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(bt&&fe>A){const ut=V.dist(W);if(ut>2*R){const Et=V.sub(V.sub(W)._mult(R/ut)._round());this.updateDistance(W,Et),this.addCurrentVertex(Et,ee,0,0,O),W=Et}}const vt=W&&Y;let yt=vt?p:E?"butt":y;if(vt&&yt==="round"&&(Yeb&&(yt="bevel"),yt==="bevel"&&(Ye>2&&(yt="flipbevel"),Ye100)Me=se.mult(-1);else{const ut=Ye*ee.add(se).mag()/ee.sub(se).mag();Me._perp()._mult(ut*(Ct?-1:1))}this.addCurrentVertex(V,Me,0,0,O),this.addCurrentVertex(V,Me.mult(-1),0,0,O)}else if(yt==="bevel"||yt==="fakeround"){const ut=-Math.sqrt(Ye*Ye-1),Et=Ct?ut:0,dt=Ct?0:ut;if(W&&this.addCurrentVertex(V,ee,Et,dt,O),yt==="fakeround"){const nt=Math.round(180*Je/Math.PI/20);for(let Ot=1;Ot2*R){const Et=V.add(Y.sub(V)._mult(R/ut)._round());this.updateDistance(V,Et),this.addCurrentVertex(Et,se,0,0,O),V=Et}}}}addCurrentVertex(o,h,p,y,b,x=!1){const E=h.y*y-h.x,L=-h.y-h.x*y;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,E,L,x,!0,-y,b),this.distance>W1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,y,b,x))}addHalfVertex({x:o,y:h},p,y,b,x,E,L){const A=.5*(this.lineClips?this.scaledDistance*(W1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*y)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const R=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),L.primitiveLength++),x?this.e2=R:this.e1=R}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let H1,Z1;St("LineBucket",v_,{omit:["layers","patternFeatures"]});var X1={get paint(){return Z1=Z1||new po({"line-opacity":new Ft(Ne.paint_line["line-opacity"]),"line-color":new Ft(Ne.paint_line["line-color"]),"line-translate":new Mt(Ne.paint_line["line-translate"]),"line-translate-anchor":new Mt(Ne.paint_line["line-translate-anchor"]),"line-width":new Ft(Ne.paint_line["line-width"]),"line-gap-width":new Ft(Ne.paint_line["line-gap-width"]),"line-offset":new Ft(Ne.paint_line["line-offset"]),"line-blur":new Ft(Ne.paint_line["line-blur"]),"line-dasharray":new cc(Ne.paint_line["line-dasharray"]),"line-pattern":new Ch(Ne.paint_line["line-pattern"]),"line-gradient":new _p(Ne.paint_line["line-gradient"])})},get layout(){return H1=H1||new po({"line-cap":new Mt(Ne.layout_line["line-cap"]),"line-join":new Ft(Ne.layout_line["line-join"]),"line-miter-limit":new Mt(Ne.layout_line["line-miter-limit"]),"line-round-limit":new Mt(Ne.layout_line["line-round-limit"]),"line-sort-key":new Ft(Ne.layout_line["line-sort-key"])})}};class NT extends Ft{possiblyEvaluate(o,h){return h=new sr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,y){return h=pe({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,y)}}let jm;class OT extends _s{constructor(o){super(o,X1),this.gradientVersion=0,jm||(jm=new NT(X1.paint.properties["line-width"].specification),jm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof nc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=jm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new v_(o)}queryRadius(o){const h=o,p=Y1(kp("line-width",this,h),kp("line-gap-width",this,h)),y=kp("line-offset",this,h);return p/2+Math.abs(y)+zm(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,y,b,x,E){const L=Fm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*Y1(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),R=this.paint.get("line-offset").evaluate(h,p);return R&&(y=function(O,V){const W=[];for(let Y=0;Y=3){for(let se=0;se0?o+2*l:l}const zT=Vr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),FT=Vr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Vr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const BT=Vr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Vr([{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 K1=Vr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),VT=Vr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function UT(l,o,h){return l.sections.forEach(p=>{p.text=function(y,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?y=y.toLocaleUpperCase():E==="lowercase"&&(y=y.toLocaleLowerCase()),Wa.applyArabicShaping&&(y=Wa.applyArabicShaping(y)),y}(p.text,o,h)}),l}Vr([{name:"triangle",components:3,type:"Uint16"}]),Vr([{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"}]),Vr([{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"}]),Vr([{type:"Float32",name:"offsetX"}]),Vr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Vr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Up={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ui=24,J1=Hn,Q1=function(l,o,h,p,y){var b,x,E=8*y-p-1,L=(1<>1,R=-7,O=h?y-1:0,V=h?-1:1,W=l[o+O];for(O+=V,b=W&(1<<-R)-1,W>>=-R,R+=E;R>0;b=256*b+l[o+O],O+=V,R-=8);for(x=b&(1<<-R)-1,b>>=-R,R+=p;R>0;x=256*x+l[o+O],O+=V,R-=8);if(b===0)b=1-A;else{if(b===L)return x?NaN:1/0*(W?-1:1);x+=Math.pow(2,p),b-=A}return(W?-1:1)*x*Math.pow(2,b-p)},$1=function(l,o,h,p,y,b){var x,E,L,A=8*b-y-1,R=(1<>1,V=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,W=p?0:b-1,Y=p?1:-1,ee=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,x=R):(x=Math.floor(Math.log(o)/Math.LN2),o*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+O>=1?V/L:V*Math.pow(2,1-O))*L>=2&&(x++,L/=2),x+O>=R?(E=0,x=R):x+O>=1?(E=(o*L-1)*Math.pow(2,y),x+=O):(E=o*Math.pow(2,O-1)*Math.pow(2,y),x=0));y>=8;l[h+W]=255&E,W+=Y,E/=256,y-=8);for(x=x<0;l[h+W]=255&x,W+=Y,x/=256,A-=8);l[h+W-Y]|=128*ee};function Hn(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Hn.Varint=0,Hn.Fixed64=1,Hn.Bytes=2,Hn.Fixed32=5;var b_=4294967296,eb=1/b_,tb=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function kl(l){return l.type===Hn.Bytes?l.readVarint()+l.pos:l.pos+1}function Vh(l,o,h){return h?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function nb(l,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var y=h.pos-1;y>=l;y--)h.buf[y+p]=h.buf[y]}function GT(l,o){for(var h=0;h>>8,l[h+2]=o>>>16,l[h+3]=o>>>24}function rb(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Hn.prototype={destroy:function(){this.buf=null},readFields:function(l,o,h){for(h=h||this.length;this.pos>3,b=this.pos;this.type=7&p,l(y,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=Wm(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=rb(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=Wm(this.buf,this.pos)+Wm(this.buf,this.pos+4)*b_;return this.pos+=8,l},readSFixed64:function(){var l=Wm(this.buf,this.pos)+rb(this.buf,this.pos+4)*b_;return this.pos+=8,l},readFloat:function(){var l=Q1(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=Q1(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(y,b,x){var E,L,A=x.buf;if(E=(112&(L=A[x.pos++]))>>4,L<128||(E|=(127&(L=A[x.pos++]))<<3,L<128)||(E|=(127&(L=A[x.pos++]))<<10,L<128)||(E|=(127&(L=A[x.pos++]))<<17,L<128)||(E|=(127&(L=A[x.pos++]))<<24,L<128)||(E|=(1&(L=A[x.pos++]))<<31,L<128))return Vh(y,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[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&&tb?function(h,p,y){return tb.decode(h.subarray(p,y))}(this.buf,o,l):function(h,p,y){for(var b="",x=p;x239?4:R>223?3:R>191?2:1;if(x+V>y)break;V===1?R<128&&(O=R):V===2?(192&(E=h[x+1]))==128&&(O=(31&R)<<6|63&E)<=127&&(O=null):V===3?(L=h[x+2],(192&(E=h[x+1]))==128&&(192&L)==128&&((O=(15&R)<<12|(63&E)<<6|63&L)<=2047||O>=55296&&O<=57343)&&(O=null)):V===4&&(L=h[x+2],A=h[x+3],(192&(E=h[x+1]))==128&&(192&L)==128&&(192&A)==128&&((O=(15&R)<<18|(63&E)<<12|(63&L)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,V=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=V}return b}(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!==Hn.Bytes)return l.push(this.readVarint(o));var h=kl(this);for(l=l||[];this.pos127;);else if(o===Hn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Hn.Fixed32)this.pos+=4;else{if(o!==Hn.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,h){var p,y;if(o>=0?(p=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,h),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(y,h)}(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(p,y,b){for(var x,E,L=0;L55295&&x<57344){if(!E){x>56319||L+1===y.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,l,this.pos);var h=this.pos-o;h>=128&&nb(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(l){this.realloc(4),$1(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),$1(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 h=0;h=128&&nb(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(l,o,h){this.writeTag(l,Hn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,GT,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,qT,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,HT,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,jT,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,WT,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,ZT,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,XT,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,YT,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,KT,o)},writeBytesField:function(l,o){this.writeTag(l,Hn.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Hn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Hn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Hn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Hn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Hn.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Hn.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Hn.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Hn.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Hn.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var x_=g(J1);const w_=3;function JT(l,o,h){l===1&&h.readMessage(QT,o)}function QT(l,o,h){if(l===3){const{id:p,bitmap:y,width:b,height:x,left:E,top:L,advance:A}=h.readMessage($T,{});o.push({id:p,bitmap:new Rp({width:b+2*w_,height:x+2*w_},y),metrics:{width:b,height:x,left:E,top:L,advance:A}})}}function $T(l,o,h){l===1?o.id=h.readVarint():l===2?o.bitmap=h.readBytes():l===3?o.width=h.readVarint():l===4?o.height=h.readVarint():l===5?o.left=h.readSVarint():l===6?o.top=h.readSVarint():l===7&&(o.advance=h.readVarint())}const ib=w_;function ob(l){let o=0,h=0;for(const x of l)o+=x.w*x.h,h=Math.max(h,x.w);l.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let y=0,b=0;for(const x of l)for(let E=p.length-1;E>=0;E--){const L=p[E];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),y=Math.max(y,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();E=0&&p>=o&&Zm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new Gh;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push(qp.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hm(l,o,h,p,y,b,x,E,L,A,R,O,V,W,Y,ee){const se=Gh.fromFeature(l,y);let fe;O===c.ah.vertical&&se.verticalizePunctuation();const{processBidirectionalText:Me,processStyledBidirectionalText:ye}=Wa;if(Me&&se.sections.length===1){fe=[];const Je=Me(se.toString(),E_(se,A,b,o,p,W,Y));for(const bt of Je){const Ct=new Gh;Ct.text=bt,Ct.sections=se.sections;for(let vt=0;vt0&&Rl>zo&&(zo=Rl)}else{const xs=Ct[_n.fontStack],Bo=xs&&xs[Bi];if(Bo&&Bo.rect)va=Bo.rect,js=Bo.metrics;else{const Rl=bt[_n.fontStack],Xp=Rl&&Rl[Bi];if(!Xp)continue;js=Xp.metrics}di=(fi-_n.scale)*ui}Ws?(Je.verticalizable=!0,to.push({glyph:Bi,imageName:ba,x:rr,y:lr+di,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:va}),rr+=Dl*_n.scale+Ot):(to.push({glyph:Bi,imageName:ba,x:rr,y:lr+di,vertical:Ws,scale:_n.scale,fontStack:_n.fontStack,sectionIndex:no,metrics:js,rect:va}),rr+=js.advance*_n.scale+Ot)}to.length!==0&&(ci=Math.max(rr-Ot,ci),nL(to,0,to.length-1,go,zo)),rr=0;const Fo=ut*fi+zo;vo.lineOffset=Math.max(zo,eo),lr+=Fo,ns=Math.max(Fo,ns),++$r}var Mi;const Fi=lr-Gp,{horizontalAlign:yo,verticalAlign:_o}=I_(Et);(function(hi,fi,eo,vo,to,zo,Fo,pi,_n){const no=(fi-eo)*to;let Bi=0;Bi=zo!==Fo?-pi*vo-Gp:(-vo*_n+.5)*Fo;for(const di of hi)for(const js of di.positionedGlyphs)js.x+=no,js.y+=Bi})(Je.positionedLines,go,yo,_o,ci,ns,ut,Fi,yt.length),Je.top+=-_o*Fi,Je.bottom=Je.top+Fi,Je.left+=-yo*ci,Je.right=Je.left+ci}(Ye,o,h,p,fe,x,E,L,O,A,V,ee),!function(Je){for(const bt of Je)if(bt.positionedGlyphs.length!==0)return!1;return!0}(Ee)&&Ye}const Zm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},eL={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 ab(l,o,h,p,y,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ui/b+y:0}{const x=h[o.fontStack],E=x&&x[l];return E?E.metrics.advance*o.scale+y:0}}function lb(l,o,h,p){const y=Math.pow(l-o,2);return p?l=0;let R=0;for(let V=0;Vx.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=s_([]),this.placementViewportMatrix=s_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=fb(this.zoom,h["text-size"]),this.iconSizeData=fb(this.zoom,h["icon-size"]);const p=this.layers[0].layout,y=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=C_(p,"text-overlap","text-allow-overlap")!=="never"||C_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>c.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new L_(new gr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new L_(new gr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new m,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,h,p,y,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),R=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!R)return;const V=h.iconDependencies,W=h.glyphDependencies,Y=h.availableImages,ee=new sr(this.zoom);for(const{feature:se,id:fe,index:Me,sourceLayerIndex:ye}of o){const Ee=y._featureFilter.needGeometry,Ye=Al(se,Ee);if(!y._featureFilter.filter(ee,Ye,p))continue;let Je,bt;if(Ee||(Ye.geometry=Ml(se)),A){const vt=y.getValueAndResolveTokens("text-field",Ye,p,Y),yt=Ao.factory(vt),ut=this.hasRTLText=this.hasRTLText||sL(yt);(!ut||Wa.getRTLTextPluginStatus()==="unavailable"||ut&&Wa.isParsed())&&(Je=UT(yt,y,Ye))}if(R){const vt=y.getValueAndResolveTokens("icon-image",Ye,p,Y);bt=vt instanceof $o?vt:$o.fromString(vt)}if(!Je&&!bt)continue;const Ct=this.sortFeaturesByKey?O.evaluate(Ye,{},p):void 0;if(this.features.push({id:fe,text:Je,icon:bt,index:Me,sourceLayerIndex:ye,geometry:Ye.geometry,properties:se.properties,type:iL[se.type],sortKey:Ct}),bt&&(V[bt.name]=!0),Je){const vt=x.evaluate(Ye,{},p).join(","),yt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ah.vertical)>=0;for(const ut of Je.sections)if(ut.image)V[ut.image.name]=!0;else{const Et=mu(Je.toString()),dt=ut.fontStack||vt,nt=W[dt]=W[dt]||{};this.calculateGlyphDependencies(ut.text,nt,yt,this.allowVerticalPlacement,Et)}}}b.get("symbol-placement")==="line"&&(this.features=function(se){const fe={},Me={},ye=[];let Ee=0;function Ye(vt){ye.push(se[vt]),Ee++}function Je(vt,yt,ut){const Et=Me[vt];return delete Me[vt],Me[yt]=Et,ye[Et].geometry[0].pop(),ye[Et].geometry[0]=ye[Et].geometry[0].concat(ut[0]),Et}function bt(vt,yt,ut){const Et=fe[yt];return delete fe[yt],fe[vt]=Et,ye[Et].geometry[0].shift(),ye[Et].geometry[0]=ut[0].concat(ye[Et].geometry[0]),Et}function Ct(vt,yt,ut){const Et=ut?yt[0][yt[0].length-1]:yt[0][0];return`${vt}:${Et.x}:${Et.y}`}for(let vt=0;vtvt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((se,fe)=>se.sortKey-fe.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}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,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(h[o.segment+1]),b=o.dist(h[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:h[E].x,y:h[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=h[E-1].dist(h[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,h){const p=o.placedSymbolArray.get(h),y=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;by[E]-y[L]||b[L]-b[E]),x}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,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 h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((y,b,x)=>{y>=0&&x.indexOf(y)===b&&this.addIndicesForPlacedSymbol(this.text,y)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let pb,db;St("SymbolBucket",qh,{omit:["layers","collisionBoxArray","features","compareText"]}),qh.MAX_GLYPHS=65535,qh.addDynamicAttributes=T_;var M_={get paint(){return db=db||new po({"icon-opacity":new Ft(Ne.paint_symbol["icon-opacity"]),"icon-color":new Ft(Ne.paint_symbol["icon-color"]),"icon-halo-color":new Ft(Ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ft(Ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ft(Ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Mt(Ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Mt(Ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ft(Ne.paint_symbol["text-opacity"]),"text-color":new Ft(Ne.paint_symbol["text-color"],{runtimeType:Dr,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Ft(Ne.paint_symbol["text-halo-color"]),"text-halo-width":new Ft(Ne.paint_symbol["text-halo-width"]),"text-halo-blur":new Ft(Ne.paint_symbol["text-halo-blur"]),"text-translate":new Mt(Ne.paint_symbol["text-translate"]),"text-translate-anchor":new Mt(Ne.paint_symbol["text-translate-anchor"])})},get layout(){return pb=pb||new po({"symbol-placement":new Mt(Ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Mt(Ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Mt(Ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ft(Ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Mt(Ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Mt(Ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Mt(Ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Mt(Ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Mt(Ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Mt(Ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ft(Ne.layout_symbol["icon-size"]),"icon-text-fit":new Mt(Ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Mt(Ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ft(Ne.layout_symbol["icon-image"]),"icon-rotate":new Ft(Ne.layout_symbol["icon-rotate"]),"icon-padding":new Ft(Ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Mt(Ne.layout_symbol["icon-keep-upright"]),"icon-offset":new Ft(Ne.layout_symbol["icon-offset"]),"icon-anchor":new Ft(Ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Mt(Ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Mt(Ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Mt(Ne.layout_symbol["text-rotation-alignment"]),"text-field":new Ft(Ne.layout_symbol["text-field"]),"text-font":new Ft(Ne.layout_symbol["text-font"]),"text-size":new Ft(Ne.layout_symbol["text-size"]),"text-max-width":new Ft(Ne.layout_symbol["text-max-width"]),"text-line-height":new Mt(Ne.layout_symbol["text-line-height"]),"text-letter-spacing":new Ft(Ne.layout_symbol["text-letter-spacing"]),"text-justify":new Ft(Ne.layout_symbol["text-justify"]),"text-radial-offset":new Ft(Ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Mt(Ne.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ft(Ne.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ft(Ne.layout_symbol["text-anchor"]),"text-max-angle":new Mt(Ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Mt(Ne.layout_symbol["text-writing-mode"]),"text-rotate":new Ft(Ne.layout_symbol["text-rotate"]),"text-padding":new Mt(Ne.layout_symbol["text-padding"]),"text-keep-upright":new Mt(Ne.layout_symbol["text-keep-upright"]),"text-transform":new Ft(Ne.layout_symbol["text-transform"]),"text-offset":new Ft(Ne.layout_symbol["text-offset"]),"text-allow-overlap":new Mt(Ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Mt(Ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Mt(Ne.layout_symbol["text-ignore-placement"]),"text-optional":new Mt(Ne.layout_symbol["text-optional"])})}};class mb{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:Zr,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.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}}St("FormatSectionOverride",mb,{omit:["defaultValue"]});class Ym extends _s{constructor(o){super(o,M_)}recalculate(o,h){if(super.recalculate(o,h),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 p=this.layout.get("text-writing-mode");if(p){const y=[];for(const b of p)y.indexOf(b)<0&&y.push(b);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,y){const b=this.layout.get(o).evaluate(h,{},p,y),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||Jn(x.value)||!b?b:function(E,L){return L.replace(/{([^{}]+)}/g,(A,R)=>E&&R in E?String(E[R]):"")}(h.properties,b)}createBucket(o){return new qh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of M_.paint.overridableProperties){if(!Ym.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new mb(h),y=new nr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new fh("source",y):new ap("composite",y,h.value.zoomStops),this.paint._values[o]=new ys(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Ym.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),y=M_.paint.properties[h];let b=!1;const x=E=>{for(const L of E)if(y.overrides&&y.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ao)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Va&&Yr(A.value)===Fr?x(A.value.sections):A instanceof ch?x(A.sections):A.eachChild(E))},L=p.value;L._styleExpression&&E(L._styleExpression.expression)}return b}}let gb;var aL={get paint(){return gb=gb||new po({"background-color":new Mt(Ne.paint_background["background-color"]),"background-pattern":new cc(Ne.paint_background["background-pattern"]),"background-opacity":new Mt(Ne.paint_background["background-opacity"])})}};class lL extends _s{constructor(o){super(o,aL)}}let yb;var uL={get paint(){return yb=yb||new po({"raster-opacity":new Mt(Ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Mt(Ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Mt(Ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Mt(Ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Mt(Ne.paint_raster["raster-saturation"]),"raster-contrast":new Mt(Ne.paint_raster["raster-contrast"]),"raster-resampling":new Mt(Ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Mt(Ne.paint_raster["raster-fade-duration"])})}};class cL extends _s{constructor(o){super(o,uL)}}class hL extends _s{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.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 fL{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const A_=63710088e-1;class bu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new bu(_e(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,y=o.lat*h,b=Math.sin(p)*Math.sin(y)+Math.cos(p)*Math.cos(y)*Math.cos((o.lng-this.lng)*h);return A_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof bu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new bu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new bu(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 _b=2*Math.PI*A_;function vb(l){return _b*Math.cos(l*Math.PI/180)}function bb(l){return(180+l)/360}function xb(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function wb(l,o){return l/vb(o)}function k_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class Km{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=bu.convert(o);return new Km(bb(p.lng),xb(p.lat),wb(h,p.lat))}toLngLat(){return new bu(360*this.x-180,k_(this.y))}toAltitude(){return this.z*vb(k_(this.y))}meterInMercatorCoordinateUnits(){return 1/_b*(o=k_(this.y),1/Math.cos(o*Math.PI/180));var o}}function Sb(l,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[l*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class D_{constructor(o,h,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||h<0||h>=Math.pow(2,o))throw new Error(`x=${h}, y=${p}, 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=h,this.y=p,this.key=Wp(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const y=(x=this.y,E=this.z,L=Sb(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=Sb(256*(b+1),256*(x+1),E),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,E,L,A;const R=function(O,V,W){let Y,ee="";for(let se=O;se>0;se--)Y=1<1?"@2x":"").replace(/{quadkey}/g,R).replace(/{bbox-epsg-3857}/g,y)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new I((o.x*h-this.x)*Rr,(o.y*h-this.y)*Rr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Eb{constructor(o,h){this.wrap=o,this.canonical=h,this.key=Wp(o,h.z,h.z,h.x,h.y)}}class bs{constructor(o,h,p,y,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new D_(p,+y,+b),this.key=Wp(h,o,p,y,b)}clone(){return new bs(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 h=this.canonical.z-o;return o>this.canonical.z?new bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Wp(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):Wp(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,y=2*this.canonical.y;return[new bs(h,this.wrap,h,p,y),new bs(h,this.wrap,h,p+1,y),new bs(h,this.wrap,h,p,y+1),new bs(h,this.wrap,h,p+1,y+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(h){case-1:y=b-1;break;case 1:b=y+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const L=-h*this.dim,A=-p*this.dim;for(let R=x;R=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 Tb{constructor(o,h,p,y,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=y,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class Lb{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new ac(Rr,16,0),this.grid3D=new ac(Rr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,y,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,y,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&L.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new yu.VectorTile(new x_(this.rawTileData)).layers,this.sourceLayerCoder=new Cb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,y){this.loadVTLayers();const b=o.params||{},x=Rr/o.tileSize/o.scale,E=gh(b.filter),L=o.queryGeometry,A=o.queryPadding*x,R=Mb(L),O=this.grid.query(R.minX-A,R.minY-A,R.maxX+A,R.maxY+A),V=Mb(o.cameraQueryGeometry),W=this.grid3D.query(V.minX-A,V.minY-A,V.maxX+A,V.maxY+A,(se,fe,Me,ye)=>function(Ee,Ye,Je,bt,Ct){for(const yt of Ee)if(Ye<=yt.x&&Je<=yt.y&&bt>=yt.x&&Ct>=yt.y)return!0;const vt=[new I(Ye,Je),new I(Ye,Ct),new I(bt,Ct),new I(bt,Je)];if(Ee.length>2){for(const yt of vt)if(Oh(Ee,yt))return!0}for(let yt=0;yt(ye||(ye=Ml(Ee)),Ye.queryIntersectsFeature(L,Ee,Je,ye,this.z,o.transform,x,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,h,p,y,b,x,E,L,A,R,O){const V=this.bucketLayerIDs[h];if(x&&!function(se,fe){for(let Me=0;Me=0)return!0;return!1}(x,V))return;const W=this.sourceLayerCoder.decode(p),Y=this.vtLayers[W].feature(y);if(b.needGeometry){const se=Al(Y,!0);if(!b.filter(new sr(this.tileID.overscaledZ),se,this.tileID.canonical))return}else if(!b.filter(new sr(this.tileID.overscaledZ),Y))return;const ee=this.getId(Y,W);for(let se=0;se{const E=o instanceof uc?o.get(x):null;return E&&E.evaluate?E.evaluate(h,p,y):E})}function Mb(l){let o=1/0,h=1/0,p=-1/0,y=-1/0;for(const b of l)o=Math.min(o,b.x),h=Math.min(h,b.y),p=Math.max(p,b.x),y=Math.max(y,b.y);return{minX:o,minY:h,maxX:p,maxY:y}}function pL(l,o){return o-l}function Ab(l,o,h,p,y){const b=[];for(let x=0;x=p&&O.x>=p||(R.x>=p?R=new I(p,R.y+(p-R.x)/(O.x-R.x)*(O.y-R.y))._round():O.x>=p&&(O=new I(p,R.y+(p-R.x)/(O.x-R.x)*(O.y-R.y))._round()),R.y>=y&&O.y>=y||(R.y>=y?R=new I(R.x+(y-R.y)/(O.y-R.y)*(O.x-R.x),y)._round():O.y>=y&&(O=new I(R.x+(y-R.y)/(O.y-R.y)*(O.x-R.x),y)._round()),L&&R.equals(L[L.length-1])||(L=[R],b.push(L)),L.push(O)))))}}return b}St("FeatureIndex",Lb,{omit:["rawTileData","sourceLayerCoder"]});class xu extends I{constructor(o,h,p,y){super(o,h),this.angle=p,y!==void 0&&(this.segment=y)}clone(){return new xu(this.x,this.y,this.angle,this.segment)}}function kb(l,o,h,p,y){if(o.segment===void 0||h===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-h/2;){if(x--,x<0)return!1;E-=l[x].dist(b),b=l[x]}E+=l[x].dist(l[x+1]),x++;const L=[];let A=0;for(;Ep;)A-=L.shift().angleDelta;if(A>y)return!1;x++,E+=R.dist(O)}return!0}function Db(l){let o=0;for(let h=0;hA){const Y=(A-L)/W,ee=Qi.number(O.x,V.x,Y),se=Qi.number(O.y,V.y,Y),fe=new xu(ee,se,V.angleTo(O),R);return fe._round(),!x||kb(l,fe,E,x,o)?fe:void 0}L+=W}}function mL(l,o,h,p,y,b,x,E,L){const A=Rb(p,b,x),R=Nb(p,y),O=R*x,V=l[0].x===0||l[0].x===L||l[0].y===0||l[0].y===L;return o-O=0&&Ee=0&&Ye=0&&V+A<=R){const Je=new xu(Ee,Ye,Me,Y);Je._round(),p&&!kb(l,Je,b,p,y)||W.push(Je)}}O+=fe}return E||W.length||x||(W=Ob(l,O/2,h,p,y,b,x,!0,L)),W}St("Anchor",xu);const jh=Oo;function zb(l,o,h,p){const y=[],b=l.image,x=b.pixelRatio,E=b.paddedRect.w-2*jh,L=b.paddedRect.h-2*jh,A=l.right-l.left,R=l.bottom-l.top,O=b.stretchX||[[0,E]],V=b.stretchY||[[0,L]],W=(ut,Et)=>ut+Et[1]-Et[0],Y=O.reduce(W,0),ee=V.reduce(W,0),se=E-Y,fe=L-ee;let Me=0,ye=Y,Ee=0,Ye=ee,Je=0,bt=se,Ct=0,vt=fe;if(b.content&&p){const ut=b.content;Me=Jm(O,0,ut[0]),Ee=Jm(V,0,ut[1]),ye=Jm(O,ut[0],ut[2]),Ye=Jm(V,ut[1],ut[3]),Je=ut[0]-Me,Ct=ut[1]-Ee,bt=ut[2]-ut[0]-ye,vt=ut[3]-ut[1]-Ye}const yt=(ut,Et,dt,nt)=>{const Ot=Qm(ut.stretch-Me,ye,A,l.left),Lt=$m(ut.fixed-Je,bt,ut.stretch,Y),pn=Qm(Et.stretch-Ee,Ye,R,l.top),rr=$m(Et.fixed-Ct,vt,Et.stretch,ee),lr=Qm(dt.stretch-Me,ye,A,l.left),ci=$m(dt.fixed-Je,bt,dt.stretch,Y),ns=Qm(nt.stretch-Ee,Ye,R,l.top),go=$m(nt.fixed-Ct,vt,nt.stretch,ee),$r=new I(Ot,pn),Mi=new I(lr,pn),Fi=new I(lr,ns),yo=new I(Ot,ns),_o=new I(Lt/x,rr/x),hi=new I(ci/x,go/x),fi=o*Math.PI/180;if(fi){const to=Math.sin(fi),zo=Math.cos(fi),Fo=[zo,-to,to,zo];$r._matMult(Fo),Mi._matMult(Fo),yo._matMult(Fo),Fi._matMult(Fo)}const eo=ut.stretch+ut.fixed,vo=Et.stretch+Et.fixed;return{tl:$r,tr:Mi,bl:yo,br:Fi,tex:{x:b.paddedRect.x+jh+eo,y:b.paddedRect.y+jh+vo,w:dt.stretch+dt.fixed-eo,h:nt.stretch+nt.fixed-vo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:_o,pixelOffsetBR:hi,minFontScaleX:bt/x/A,minFontScaleY:vt/x/R,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ut=Fb(O,se,Y),Et=Fb(V,fe,ee);for(let dt=0;dt0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let O=x.top*E-L[0],V=x.bottom*E+L[2],W=x.left*E-L[3],Y=x.right*E+L[1];const ee=x.collisionPadding;if(ee&&(W-=ee[0]*E,O-=ee[1]*E,Y+=ee[2]*E,V+=ee[3]*E),R){const se=new I(W,O),fe=new I(Y,O),Me=new I(W,V),ye=new I(Y,V),Ee=R*Math.PI/180;se._rotate(Ee),fe._rotate(Ee),Me._rotate(Ee),ye._rotate(Ee),W=Math.min(se.x,fe.x,Me.x,ye.x),Y=Math.max(se.x,fe.x,Me.x,ye.x),O=Math.min(se.y,fe.y,Me.y,ye.y),V=Math.max(se.y,fe.y,Me.y,ye.y)}o.emplaceBack(h.x,h.y,W,O,Y,V,p,y,b)}this.boxEndIndex=o.length}}class gL{constructor(o=[],h=yL){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,y=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(y,x)>=0)break;h[o]=x,o=b}h[o]=y}_down(o){const{data:h,compare:p}=this,y=this.length>>1,b=h[o];for(;o=0)break;h[o]=E,o=x}h[o]=b}}function yL(l,o){return lo?1:0}function _L(l,o=1,h=!1){let p=1/0,y=1/0,b=-1/0,x=-1/0;const E=l[0];for(let W=0;Wb)&&(b=Y.x),(!W||Y.y>x)&&(x=Y.y)}const L=Math.min(b-p,x-y);let A=L/2;const R=new gL([],vL);if(L===0)return new I(p,y);for(let W=p;WO.d||!O.d)&&(O=W,h&&console.log("found best %d after %d probes",Math.round(1e4*W.d)/1e4,V)),W.max-O.d<=o||(A=W.h/2,R.push(new Wh(W.p.x-A,W.p.y-A,A,l)),R.push(new Wh(W.p.x+A,W.p.y-A,A,l)),R.push(new Wh(W.p.x-A,W.p.y+A,A,l)),R.push(new Wh(W.p.x+A,W.p.y+A,A,l)),V+=4)}return h&&(console.log(`num probes: ${V}`),console.log(`best distance: ${O.d}`)),O.p}function vL(l,o){return o.max-l.max}function Wh(l,o,h,p){this.p=new I(l,o),this.h=h,this.d=function(y,b){let x=!1,E=1/0;for(let L=0;Ly.y!=Y.y>y.y&&y.x<(Y.x-W.x)*(y.y-W.y)/(Y.y-W.y)+W.x&&(x=!x),E=Math.min(E,x1(y,W,Y))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var zi;c.ap=void 0,(zi=c.ap||(c.ap={}))[zi.center=1]="center",zi[zi.left=2]="left",zi[zi.right=3]="right",zi[zi.top=4]="top",zi[zi.bottom=5]="bottom",zi[zi["top-left"]=6]="top-left",zi[zi["top-right"]=7]="top-right",zi[zi["bottom-left"]=8]="bottom-left",zi[zi["bottom-right"]=9]="bottom-right";const wu=7,R_=Number.POSITIVE_INFINITY;function Bb(l,o){return o[1]!==R_?function(h,p,y){let b=0,x=0;switch(p=Math.abs(p),y=Math.abs(y),h){case"top-right":case"top-left":case"top":x=y-wu;break;case"bottom-right":case"bottom-left":case"bottom":x=-y+wu}switch(h){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(l,o[0],o[1]):function(h,p){let y=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-wu;break;case"bottom-right":case"bottom-left":b=-x+wu;break;case"bottom":b=-p+wu;break;case"top":b=p-wu}switch(h){case"top-right":case"bottom-right":y=-x;break;case"top-left":case"bottom-left":y=x;break;case"left":y=p;break;case"right":y=-p}return[y,b]}(l,o[0])}function Vb(l,o,h){var p;const y=l.layout,b=(p=y.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const E=b.values,L=[];for(let A=0;AV*ui);R.startsWith("top")?O[1]-=wu:R.startsWith("bottom")&&(O[1]+=wu),L[A+1]=O}return new Qo(L)}const x=y.get("text-variable-anchor");if(x){let E;E=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},h)*ui,R_]:y.get("text-offset").evaluate(o,{},h).map(A=>A*ui);const L=[];for(const A of x)L.push(A,Bb(A,E));return new Qo(L)}return null}function N_(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 bL(l,o,h,p,y,b,x,E,L,A,R){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const V=l.layers[0].layout,W=V.get("icon-offset").evaluate(o,{},R),Y=Gb(h.horizontal),ee=x/24,se=l.tilePixelRatio*ee,fe=l.tilePixelRatio*O/24,Me=l.tilePixelRatio*E,ye=l.tilePixelRatio*V.get("symbol-spacing"),Ee=V.get("text-padding")*l.tilePixelRatio,Ye=function(nt,Ot,Lt,pn=1){const rr=nt.get("icon-padding").evaluate(Ot,{},Lt),lr=rr&&rr.values;return[lr[0]*pn,lr[1]*pn,lr[2]*pn,lr[3]*pn]}(V,o,R,l.tilePixelRatio),Je=V.get("text-max-angle")/180*Math.PI,bt=V.get("text-rotation-alignment")!=="viewport"&&V.get("symbol-placement")!=="point",Ct=V.get("icon-rotation-alignment")==="map"&&V.get("symbol-placement")!=="point",vt=V.get("symbol-placement"),yt=ye/2,ut=V.get("icon-text-fit");let Et;p&&ut!=="none"&&(l.allowVerticalPlacement&&h.vertical&&(Et=hb(p,h.vertical,ut,V.get("icon-text-fit-padding"),W,ee)),Y&&(p=hb(p,Y,ut,V.get("icon-text-fit-padding"),W,ee)));const dt=(nt,Ot)=>{Ot.x<0||Ot.x>=Rr||Ot.y<0||Ot.y>=Rr||function(Lt,pn,rr,lr,ci,ns,go,$r,Mi,Fi,yo,_o,hi,fi,eo,vo,to,zo,Fo,pi,_n,no,Bi,di,js){const va=Lt.addToLineVertexArray(pn,rr);let ba,Dl,Ws,xs,Bo=0,Rl=0,Xp=0,Hb=0,q_=-1,j_=-1;const Nl={};let Zb=Cr("");if(Lt.allowVerticalPlacement&&lr.vertical){const ro=$r.layout.get("text-rotate").evaluate(_n,{},di)+90;Ws=new eg(Mi,pn,Fi,yo,_o,lr.vertical,hi,fi,eo,ro),go&&(xs=new eg(Mi,pn,Fi,yo,_o,go,to,zo,eo,ro))}if(ci){const ro=$r.layout.get("icon-rotate").evaluate(_n,{}),ws=$r.layout.get("icon-text-fit")!=="none",_c=zb(ci,ro,Bi,ws),wa=go?zb(go,ro,Bi,ws):void 0;Dl=new eg(Mi,pn,Fi,yo,_o,ci,to,zo,!1,ro),Bo=4*_c.length;const vc=Lt.iconSizeData;let Ka=null;vc.kind==="source"?(Ka=[Ya*$r.layout.get("icon-size").evaluate(_n,{})],Ka[0]>vu&&Ke(`${Lt.layerIds[0]}: Value for "icon-size" is >= ${jp}. Reduce your "icon-size".`)):vc.kind==="composite"&&(Ka=[Ya*no.compositeIconSizes[0].evaluate(_n,{},di),Ya*no.compositeIconSizes[1].evaluate(_n,{},di)],(Ka[0]>vu||Ka[1]>vu)&&Ke(`${Lt.layerIds[0]}: Value for "icon-size" is >= ${jp}. Reduce your "icon-size".`)),Lt.addSymbols(Lt.icon,_c,Ka,pi,Fo,_n,c.ah.none,pn,va.lineStartIndex,va.lineLength,-1,di),q_=Lt.icon.placedSymbolArray.length-1,wa&&(Rl=4*wa.length,Lt.addSymbols(Lt.icon,wa,Ka,pi,Fo,_n,c.ah.vertical,pn,va.lineStartIndex,va.lineLength,-1,di),j_=Lt.icon.placedSymbolArray.length-1)}const Xb=Object.keys(lr.horizontal);for(const ro of Xb){const ws=lr.horizontal[ro];if(!ba){Zb=Cr(ws.text);const wa=$r.layout.get("text-rotate").evaluate(_n,{},di);ba=new eg(Mi,pn,Fi,yo,_o,ws,hi,fi,eo,wa)}const _c=ws.positionedLines.length===1;if(Xp+=Ub(Lt,pn,ws,ns,$r,eo,_n,vo,va,lr.vertical?c.ah.horizontal:c.ah.horizontalOnly,_c?Xb:[ro],Nl,q_,no,di),_c)break}lr.vertical&&(Hb+=Ub(Lt,pn,lr.vertical,ns,$r,eo,_n,vo,va,c.ah.vertical,["vertical"],Nl,j_,no,di));const SL=ba?ba.boxStartIndex:Lt.collisionBoxArray.length,EL=ba?ba.boxEndIndex:Lt.collisionBoxArray.length,IL=Ws?Ws.boxStartIndex:Lt.collisionBoxArray.length,CL=Ws?Ws.boxEndIndex:Lt.collisionBoxArray.length,TL=Dl?Dl.boxStartIndex:Lt.collisionBoxArray.length,LL=Dl?Dl.boxEndIndex:Lt.collisionBoxArray.length,PL=xs?xs.boxStartIndex:Lt.collisionBoxArray.length,ML=xs?xs.boxEndIndex:Lt.collisionBoxArray.length;let xa=-1;const ng=(ro,ws)=>ro&&ro.circleDiameter?Math.max(ro.circleDiameter,ws):ws;xa=ng(ba,xa),xa=ng(Ws,xa),xa=ng(Dl,xa),xa=ng(xs,xa);const Yb=xa>-1?1:0;Yb&&(xa*=js/ui),Lt.glyphOffsetArray.length>=qh.MAX_GLYPHS&&Ke("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_n.sortKey!==void 0&&Lt.addToSortKeyRanges(Lt.symbolInstances.length,_n.sortKey);const AL=Vb($r,_n,di),[kL,DL]=function(ro,ws){const _c=ro.length,wa=ws==null?void 0:ws.values;if((wa==null?void 0:wa.length)>0)for(let vc=0;vc=0?Nl.right:-1,Nl.center>=0?Nl.center:-1,Nl.left>=0?Nl.left:-1,Nl.vertical||-1,q_,j_,Zb,SL,EL,IL,CL,TL,LL,PL,ML,Fi,Xp,Hb,Bo,Rl,Yb,0,hi,xa,kL,DL)}(l,Ot,nt,h,p,y,Et,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,se,[Ee,Ee,Ee,Ee],bt,L,Me,Ye,Ct,W,o,b,A,R,x)};if(vt==="line")for(const nt of Ab(o.geometry,0,0,Rr,Rr)){const Ot=mL(nt,ye,Je,h.vertical||Y,p,24,fe,l.overscaling,Rr);for(const Lt of Ot)Y&&xL(l,Y.text,yt,Lt)||dt(nt,Lt)}else if(vt==="line-center"){for(const nt of o.geometry)if(nt.length>1){const Ot=dL(nt,Je,h.vertical||Y,p,24,fe);Ot&&dt(nt,Ot)}}else if(o.type==="Polygon")for(const nt of p_(o.geometry,0)){const Ot=_L(nt,16);dt(nt[0],new xu(Ot.x,Ot.y,0))}else if(o.type==="LineString")for(const nt of o.geometry)dt(nt,new xu(nt[0].x,nt[0].y,0));else if(o.type==="Point")for(const nt of o.geometry)for(const Ot of nt)dt([Ot],new xu(Ot.x,Ot.y,0))}function Ub(l,o,h,p,y,b,x,E,L,A,R,O,V,W,Y){const ee=function(Me,ye,Ee,Ye,Je,bt,Ct,vt){const yt=Ye.layout.get("text-rotate").evaluate(bt,{})*Math.PI/180,ut=[];for(const Et of ye.positionedLines)for(const dt of Et.positionedGlyphs){if(!dt.rect)continue;const nt=dt.rect||{};let Ot=ib+1,Lt=!0,pn=1,rr=0;const lr=(Je||vt)&&dt.vertical,ci=dt.metrics.advance*dt.scale/2;if(vt&&ye.verticalizable&&(rr=Et.lineOffset/2-(dt.imageName?-(ui-dt.metrics.width*dt.scale)/2:(dt.scale-1)*ui)),dt.imageName){const pi=Ct[dt.imageName];Lt=pi.sdf,pn=pi.pixelRatio,Ot=Oo/pn}const ns=Je?[dt.x+ci,dt.y]:[0,0];let go=Je?[0,0]:[dt.x+ci+Ee[0],dt.y+Ee[1]-rr],$r=[0,0];lr&&($r=go,go=[0,0]);const Mi=dt.metrics.isDoubleResolution?2:1,Fi=(dt.metrics.left-Ot)*dt.scale-ci+go[0],yo=(-dt.metrics.top-Ot)*dt.scale+go[1],_o=Fi+nt.w/Mi*dt.scale/pn,hi=yo+nt.h/Mi*dt.scale/pn,fi=new I(Fi,yo),eo=new I(_o,yo),vo=new I(Fi,hi),to=new I(_o,hi);if(lr){const pi=new I(-ci,ci-Gp),_n=-Math.PI/2,no=ui/2-ci,Bi=new I(5-Gp-no,-(dt.imageName?no:0)),di=new I(...$r);fi._rotateAround(_n,pi)._add(Bi)._add(di),eo._rotateAround(_n,pi)._add(Bi)._add(di),vo._rotateAround(_n,pi)._add(Bi)._add(di),to._rotateAround(_n,pi)._add(Bi)._add(di)}if(yt){const pi=Math.sin(yt),_n=Math.cos(yt),no=[_n,-pi,pi,_n];fi._matMult(no),eo._matMult(no),vo._matMult(no),to._matMult(no)}const zo=new I(0,0),Fo=new I(0,0);ut.push({tl:fi,tr:eo,bl:vo,br:to,tex:nt,writingMode:ye.writingMode,glyphOffset:ns,sectionIndex:dt.sectionIndex,isSDF:Lt,pixelOffsetTL:zo,pixelOffsetBR:Fo,minFontScaleX:0,minFontScaleY:0})}return ut}(0,h,E,y,b,x,p,l.allowVerticalPlacement),se=l.textSizeData;let fe=null;se.kind==="source"?(fe=[Ya*y.layout.get("text-size").evaluate(x,{})],fe[0]>vu&&Ke(`${l.layerIds[0]}: Value for "text-size" is >= ${jp}. Reduce your "text-size".`)):se.kind==="composite"&&(fe=[Ya*W.compositeTextSizes[0].evaluate(x,{},Y),Ya*W.compositeTextSizes[1].evaluate(x,{},Y)],(fe[0]>vu||fe[1]>vu)&&Ke(`${l.layerIds[0]}: Value for "text-size" is >= ${jp}. Reduce your "text-size".`)),l.addSymbols(l.text,ee,fe,E,b,x,A,o,L.lineStartIndex,L.lineLength,V,Y);for(const Me of R)O[Me]=l.text.placedSymbolArray.length-1;return 4*ee.length}function Gb(l){for(const o in l)return l[o];return null}function xL(l,o,h,p){const y=l.compareText;if(o in y){const b=y[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const b=qb[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new O_(E,x,b,o)}constructor(o,h=64,p=Float64Array,y){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=qb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return z_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const R=L.pop()||0,O=L.pop()||0,V=L.pop()||0;if(O-V<=E){for(let se=V;se<=O;se++){const fe=x[2*se],Me=x[2*se+1];fe>=o&&fe<=p&&Me>=h&&Me<=y&&A.push(b[se])}continue}const W=V+O>>1,Y=x[2*W],ee=x[2*W+1];Y>=o&&Y<=p&&ee>=h&&ee<=y&&A.push(b[W]),(R===0?o<=Y:h<=ee)&&(L.push(V),L.push(W-1),L.push(1-R)),(R===0?p>=Y:y>=ee)&&(L.push(W+1),L.push(O),L.push(1-R))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:b,nodeSize:x}=this,E=[0,y.length-1,0],L=[],A=p*p;for(;E.length;){const R=E.pop()||0,O=E.pop()||0,V=E.pop()||0;if(O-V<=x){for(let se=V;se<=O;se++)Wb(b[2*se],b[2*se+1],o,h)<=A&&L.push(y[se]);continue}const W=V+O>>1,Y=b[2*W],ee=b[2*W+1];Wb(Y,ee,o,h)<=A&&L.push(y[W]),(R===0?o-p<=Y:h-p<=ee)&&(E.push(V),E.push(W-1),E.push(1-R)),(R===0?o+p>=Y:h+p>=ee)&&(E.push(W+1),E.push(O),E.push(1-R))}return L}}function z_(l,o,h,p,y,b){if(y-p<=h)return;const x=p+y>>1;jb(l,o,x,p,y,b),z_(l,o,h,p,x-1,1-b),z_(l,o,h,x+1,y,1-b)}function jb(l,o,h,p,y,b){for(;y>p;){if(y-p>600){const A=y-p+1,R=h-p+1,O=Math.log(A),V=.5*Math.exp(2*O/3),W=.5*Math.sqrt(O*V*(A-V)/A)*(R-A/2<0?-1:1);jb(l,o,h,Math.max(p,Math.floor(h-R*V/A+W)),Math.min(y,Math.floor(h+(A-R)*V/A+W)),b)}const x=o[2*h+b];let E=p,L=y;for(Hp(l,o,p,h),o[2*y+b]>x&&Hp(l,o,p,y);Ex;)L--}o[2*p+b]===x?Hp(l,o,p,L):(L++,Hp(l,o,L,y)),L<=h&&(p=L+1),h<=L&&(y=L-1)}}function Hp(l,o,h,p){F_(l,h,p),F_(o,2*h,2*p),F_(o,2*h+1,2*p+1)}function F_(l,o,h){const p=l[o];l[o]=l[h],l[h]=p}function Wb(l,o,h,p){const y=l-h,b=o-p;return y*y+b*b}var B_;c.bd=void 0,(B_=c.bd||(c.bd={})).create="create",B_.load="load",B_.fullLoad="fullLoad";let tg=null,Zp=[];const V_=1e3/60,U_="loadTime",G_="fullLoadTime",wL={mark(l){performance.mark(l)},frame(l){const o=l;tg!=null&&Zp.push(o-tg),tg=o},clearMetrics(){tg=null,Zp=[],performance.clearMeasures(U_),performance.clearMeasures(G_);for(const l in c.bd)performance.clearMarks(c.bd[l])},getPerformanceMetrics(){performance.measure(U_,c.bd.create,c.bd.load),performance.measure(G_,c.bd.create,c.bd.fullLoad);const l=performance.getEntriesByName(U_)[0].duration,o=performance.getEntriesByName(G_)[0].duration,h=Zp.length,p=1/(Zp.reduce((b,x)=>b+x,0)/h/1e3),y=Zp.filter(b=>b>V_).reduce((b,x)=>b+(x-V_)/V_,0);return{loadTime:l,fullLoadTime:o,fps:p,percentDroppedFrames:y/(h+y)*100,totalFrames:h}}};c.$=ht,c.A=zh,c.B=function(l){if(qe==null){const o=l.navigator?l.navigator.userAgent:null;qe=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return qe},c.C=class{constructor(l,o){this.target=l,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new fL(()=>this.process()),this.subscription=function(h,p,y,b){return h.addEventListener(p,y,!1),{unsubscribe:()=>{h.removeEventListener(p,y,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=tt(self)?l:window}registerMessageHandler(l,o){this.messageHandlers[l]=o}sendAsync(l,o){return new Promise((h,p)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const E={id:y,type:"",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},l),{id:y,sourceMapId:this.mapId,origin:location.origin,data:pu(l.data,b)});this.target.postMessage(x,{transfer:b})})}receive(l){const o=l.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(tt(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const l=this.taskQueue.shift(),o=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(l,o)}processTask(l,o){return u(this,void 0,void 0,function*(){if(o.type===""){const y=this.resolveRejects[l];return delete this.resolveRejects[l],y?void(o.error?y.reject(du(o.error)):y.resolve(du(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=du(o.data),p=new AbortController;this.abortControllers[l]=p;try{const y=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(l,null,y)}catch(y){this.completeTask(l,y)}})}completeTask(l,o,h){const p=[];delete this.abortControllers[l];const y={id:l,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?pu(o):null,data:pu(h,p)};this.target.postMessage(y,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Mt,c.E=kn,c.F=function(){var l=new zh(16);return zh!=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},c.G=An,c.H=function(l,o,h){var p,y,b,x,E,L,A,R,O,V,W,Y,ee=h[0],se=h[1],fe=h[2];return o===l?(l[12]=o[0]*ee+o[4]*se+o[8]*fe+o[12],l[13]=o[1]*ee+o[5]*se+o[9]*fe+o[13],l[14]=o[2]*ee+o[6]*se+o[10]*fe+o[14],l[15]=o[3]*ee+o[7]*se+o[11]*fe+o[15]):(y=o[1],b=o[2],x=o[3],E=o[4],L=o[5],A=o[6],R=o[7],O=o[8],V=o[9],W=o[10],Y=o[11],l[0]=p=o[0],l[1]=y,l[2]=b,l[3]=x,l[4]=E,l[5]=L,l[6]=A,l[7]=R,l[8]=O,l[9]=V,l[10]=W,l[11]=Y,l[12]=p*ee+E*se+O*fe+o[12],l[13]=y*ee+L*se+V*fe+o[13],l[14]=b*ee+A*se+W*fe+o[14],l[15]=x*ee+R*se+Y*fe+o[15]),l},c.I=S_,c.J=function(l,o,h){var p=h[0],y=h[1],b=h[2];return l[0]=o[0]*p,l[1]=o[1]*p,l[2]=o[2]*p,l[3]=o[3]*p,l[4]=o[4]*y,l[5]=o[5]*y,l[6]=o[6]*y,l[7]=o[7]*y,l[8]=o[8]*b,l[9]=o[9]*b,l[10]=o[10]*b,l[11]=o[11]*b,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},c.K=I1,c.L=function(l,o){const h={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of l){const y=window.document.createElement("source");fr(p)||(o.crossOrigin="Anonymous"),y.src=p,o.appendChild(y)}})},c.a3=function(){return he++},c.a4=_,c.a5=qh,c.a6=gh,c.a7=Al,c.a8=sr,c.a9=Tb,c.aA=H,c.aB=function(l,o){if(!l)return[{command:"setStyle",args:[o]}];let h=[];try{if(!ln(l.version,o.version))return[{command:"setStyle",args:[o]}];ln(l.center,o.center)||h.push({command:"setCenter",args:[o.center]}),ln(l.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),ln(l.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),ln(l.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),ln(l.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),ln(l.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),ln(l.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),ln(l.light,o.light)||h.push({command:"setLight",args:[o.light]}),ln(l.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),ln(l.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},y=[];(function(x,E,L,A){let R;for(R in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,R)&&(Object.prototype.hasOwnProperty.call(E,R)||ps(R,L,A));for(R in E)Object.prototype.hasOwnProperty.call(E,R)&&(Object.prototype.hasOwnProperty.call(x,R)?ln(x[R],E[R])||(x[R].type==="geojson"&&E[R].type==="geojson"&&Ba(x,E,R)?$n(L,{command:"setGeoJSONSourceData",args:[R,E[R].data]}):Os(R,E,L,A)):Mo(R,E,L))})(l.sources,o.sources,y,p);const b=[];l.layers&&l.layers.forEach(x=>{"source"in x&&p[x.source]?h.push({command:"removeLayer",args:[x.id]}):b.push(x)}),h=h.concat(y),function(x,E,L){E=E||[];const A=(x=x||[]).map(bl),R=E.map(bl),O=x.reduce(ds,{}),V=E.reduce(ds,{}),W=A.slice(),Y=Object.create(null);let ee,se,fe,Me,ye;for(let Ee=0,Ye=0;Ee@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,y,b)=>{const x=y||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(l,o){const h=[];for(const p in l)p in o||h.push(p);return h},c.ac=te,c.ad=function(l,o,h){var p=Math.sin(h),y=Math.cos(h),b=o[0],x=o[1],E=o[2],L=o[3],A=o[4],R=o[5],O=o[6],V=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]=b*y+A*p,l[1]=x*y+R*p,l[2]=E*y+O*p,l[3]=L*y+V*p,l[4]=A*y-b*p,l[5]=R*y-x*p,l[6]=O*y-E*p,l[7]=V*y-L*p,l},c.ae=function(l){var o=new zh(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},c.af=Bm,c.ag=function(l,o){let h=0,p=0;if(l.kind==="constant")p=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:y,minZoom:b,maxZoom:x}=l,E=y?te(Oi.interpolationFactor(y,o,b,x),0,1):0;l.kind==="camera"?p=Qi.number(l.minSize,l.maxSize,E):h=E}return{uSizeT:h,uSize:p}},c.ai=function(l,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:y}){return l.kind==="source"?p/Ya:l.kind==="composite"?Qi.number(p/Ya,y/Ya,h):o},c.aj=T_,c.ak=function(l,o,h,p){const y=o.y-l.y,b=o.x-l.x,x=p.y-h.y,E=p.x-h.x,L=x*b-E*y;if(L===0)return null;const A=(E*(l.y-h.y)-x*(l.x-h.x))/L;return new I(l.x+A*b,l.y+A*y)},c.al=Ab,c.am=Lp,c.an=s_,c.ao=ui,c.aq=C_,c.ar=function(l,o){var h=o[0],p=o[1],y=o[2],b=o[3],x=o[4],E=o[5],L=o[6],A=o[7],R=o[8],O=o[9],V=o[10],W=o[11],Y=o[12],ee=o[13],se=o[14],fe=o[15],Me=h*E-p*x,ye=h*L-y*x,Ee=h*A-b*x,Ye=p*L-y*E,Je=p*A-b*E,bt=y*A-b*L,Ct=R*ee-O*Y,vt=R*se-V*Y,yt=R*fe-W*Y,ut=O*se-V*ee,Et=O*fe-W*ee,dt=V*fe-W*se,nt=Me*dt-ye*Et+Ee*ut+Ye*yt-Je*vt+bt*Ct;return nt?(l[0]=(E*dt-L*Et+A*ut)*(nt=1/nt),l[1]=(y*Et-p*dt-b*ut)*nt,l[2]=(ee*bt-se*Je+fe*Ye)*nt,l[3]=(V*Je-O*bt-W*Ye)*nt,l[4]=(L*yt-x*dt-A*vt)*nt,l[5]=(h*dt-y*yt+b*vt)*nt,l[6]=(se*Ee-Y*bt-fe*ye)*nt,l[7]=(R*bt-V*Ee+W*ye)*nt,l[8]=(x*Et-E*yt+A*Ct)*nt,l[9]=(p*yt-h*Et-b*Ct)*nt,l[10]=(Y*Je-ee*Ee+fe*Me)*nt,l[11]=(O*Ee-R*Je-W*Me)*nt,l[12]=(E*vt-x*ut-L*Ct)*nt,l[13]=(h*ut-p*vt+y*Ct)*nt,l[14]=(ee*ye-Y*Ye-se*Me)*nt,l[15]=(R*Ye-O*ye+V*Me)*nt,l):null},c.as=N_,c.at=I_,c.au=O_,c.av=function(){const l={},o=Ne.$version;for(const h in Ne.$root){const p=Ne.$root[h];if(p.required){let y=null;y=h==="version"?o:p.type==="array"?[]:{},y!=null&&(l[h]=y)}}return l},c.aw=Im,c.ax=Ar,c.ay=function(l){l=l.slice();const o=Object.create(null);for(let h=0;hnt*ui)}let vt=x?"center":h.get("text-justify").evaluate(A,{},l.canonical);const yt=h.get("symbol-placement"),ut=yt==="point"?h.get("text-max-width").evaluate(A,{},l.canonical)*ui:0,Et=()=>{l.bucket.allowVerticalPlacement&&mu(Ee)&&(Y.vertical=Hm(ee,l.glyphMap,l.glyphPositions,l.imagePositions,R,ut,b,bt,"left",Je,fe,c.ah.vertical,!0,yt,V,O))};if(!x&&Ct){const dt=new Set;if(vt==="auto")for(let Ot=0;Otu(void 0,void 0,void 0,function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=pe,c.f=l=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=wt})},p.onerror=()=>h(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 y=new Blob([new Uint8Array(l)],{type:"image/png"});p.src=l.byteLength?URL.createObjectURL(y):wt}),c.g=yn,c.h=(l,o)=>wr(pe(l,{type:"json"}),o),c.i=tt,c.j=It,c.k=Le,c.l=(l,o)=>wr(pe(l,{type:"arrayBuffer"}),o),c.m=wr,c.n=function(l){return new x_(l).readFields(JT,[])},c.o=Rp,c.p=ob,c.q=po,c.r=n_,c.s=fr,c.t=fu,c.u=_t,c.v=Ne,c.w=Ke,c.x=Tl,c.y=function([l,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(h),y:l*Math.sin(o)*Math.sin(h),z:l*Math.cos(h)}},c.z=Qi}),i("worker",["./shared"],function(c){class u{constructor(B){this.keyCache={},B&&this.replace(B)}replace(B){this._layerConfigs={},this._layers={},this.update(B,[])}update(B,G){for(const ne of B){this._layerConfigs[ne.id]=ne;const xe=this._layers[ne.id]=c.az(ne);xe._featureFilter=c.a6(xe.filter),this.keyCache[ne.id]&&delete this.keyCache[ne.id]}for(const ne of G)delete this.keyCache[ne],delete this._layerConfigs[ne],delete this._layers[ne];this.familiesBySource={};const K=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const ne of K){const xe=ne.map(We=>this._layers[We.id]),Q=xe[0];if(Q.visibility==="none")continue;const we=Q.source||"";let de=this.familiesBySource[we];de||(de=this.familiesBySource[we]={});const Pe=Q.sourceLayer||"_geojsonTileLayer";let Ve=de[Pe];Ve||(Ve=de[Pe]=[]),Ve.push(xe)}}}class g{constructor(B){const G={},K=[];for(const we in B){const de=B[we],Pe=G[we]={};for(const Ve in de){const We=de[+Ve];if(!We||We.bitmap.width===0||We.bitmap.height===0)continue;const Xe={x:0,y:0,w:We.bitmap.width+2,h:We.bitmap.height+2};K.push(Xe),Pe[Ve]={rect:Xe,metrics:We.metrics}}}const{w:ne,h:xe}=c.p(K),Q=new c.o({width:ne||1,height:xe||1});for(const we in B){const de=B[we];for(const Pe in de){const Ve=de[+Pe];if(!Ve||Ve.bitmap.width===0||Ve.bitmap.height===0)continue;const We=G[we][Pe].rect;c.o.copy(Ve.bitmap,Q,{x:0,y:0},{x:We.x+1,y:We.y+1},Ve.bitmap)}}this.image=Q,this.positions=G}}c.bi("GlyphAtlas",g);class w{constructor(B){this.tileID=new c.Q(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=[]}parse(B,G,K,ne){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=B,this.collisionBoxArray=new c.a4;const xe=new c.bj(Object.keys(B.layers).sort()),Q=new c.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const we={},de={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},Pe=G.familiesBySource[this.source];for(const sn in Pe){const Sr=B.layers[sn];if(!Sr)continue;Sr.version===1&&c.w(`Vector tile source "${this.source}" layer "${sn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const si=xe.encode(sn),Ji=[];for(let co=0;co=vi.maxzoom||vi.visibility!=="none"&&(S(co,this.zoom,K),(we[vi.id]=vi.createBucket({index:Q.bucketLayerIDs.length,layers:co,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:si,sourceID:this.source})).populate(Ji,de,this.tileID.canonical),Q.bucketLayerIDs.push(co.map(zs=>zs.id)))}}const Ve=c.aE(de.glyphDependencies,sn=>Object.keys(sn).map(Number));this.inFlightDependencies.forEach(sn=>sn==null?void 0:sn.abort()),this.inFlightDependencies=[];let We=Promise.resolve({});if(Object.keys(Ve).length){const sn=new AbortController;this.inFlightDependencies.push(sn),We=ne.sendAsync({type:"GG",data:{stacks:Ve,source:this.source,tileID:this.tileID,type:"glyphs"}},sn)}const Xe=Object.keys(de.iconDependencies);let Tt=Promise.resolve({});if(Xe.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Tt=ne.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"icons"}},sn)}const At=Object.keys(de.patternDependencies);let Wt=Promise.resolve({});if(At.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Wt=ne.sendAsync({type:"GI",data:{icons:At,source:this.source,tileID:this.tileID,type:"patterns"}},sn)}const[Ht,bn,Wn]=yield Promise.all([We,Tt,Wt]),or=new g(Ht),Xr=new c.bl(bn,Wn);for(const sn in we){const Sr=we[sn];Sr instanceof c.a5?(S(Sr.layers,this.zoom,K),c.bm({bucket:Sr,glyphMap:Ht,glyphPositions:or.positions,imageMap:bn,imagePositions:Xr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Sr.hasPattern&&(Sr instanceof c.bn||Sr instanceof c.bo||Sr instanceof c.bp)&&(S(Sr.layers,this.zoom,K),Sr.addFeatures(de,this.tileID.canonical,Xr.patternPositions))}return this.status="done",{buckets:Object.values(we).filter(sn=>!sn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,imageAtlas:Xr,glyphMap:this.returnDependencies?Ht:null,iconMap:this.returnDependencies?bn:null,glyphPositions:this.returnDependencies?or.positions:null}})}}function S(ae,B,G){const K=new c.a8(B);for(const ne of ae)ne.recalculate(K,G)}class I{constructor(B,G,K){this.actor=B,this.layerIndex=G,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(B,G){return c._(this,void 0,void 0,function*(){const K=yield c.l(B.request,G);try{return{vectorTile:new c.bq.VectorTile(new c.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(ne){const xe=new Uint8Array(K.data);let Q=`Unable to parse the tile at ${B.request.url}, `;throw Q+=xe[0]===31&&xe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ne.messge}`,new Error(Q)}})}loadTile(B){return c._(this,void 0,void 0,function*(){const G=B.uid,K=!!(B&&B.request&&B.request.collectResourceTiming)&&new c.bs(B.request),ne=new w(B);this.loading[G]=ne;const xe=new AbortController;ne.abort=xe;try{const Q=yield this.loadVectorTile(B,xe);if(delete this.loading[G],!Q)return null;const we=Q.rawData,de={};Q.expires&&(de.expires=Q.expires),Q.cacheControl&&(de.cacheControl=Q.cacheControl);const Pe={};if(K){const We=K.finish();We&&(Pe.resourceTiming=JSON.parse(JSON.stringify(We)))}ne.vectorTile=Q.vectorTile;const Ve=ne.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[G]=ne,this.fetching[G]={rawTileData:we,cacheControl:de,resourceTiming:Pe};try{const We=yield Ve;return c.e({rawTileData:we.slice(0)},We,de,Pe)}finally{delete this.fetching[G]}}catch(Q){throw delete this.loading[G],ne.status="done",this.loaded[G]=ne,Q}})}reloadTile(B){return c._(this,void 0,void 0,function*(){const G=B.uid;if(!this.loaded||!this.loaded[G])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[G];if(K.showCollisionBoxes=B.showCollisionBoxes,K.status==="parsing"){const ne=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let xe;if(this.fetching[G]){const{rawTileData:Q,cacheControl:we,resourceTiming:de}=this.fetching[G];delete this.fetching[G],xe=c.e({rawTileData:Q.slice(0)},ne,we,de)}else xe=ne;return xe}if(K.status==="done"&&K.vectorTile)return K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(B){return c._(this,void 0,void 0,function*(){const G=this.loading,K=B.uid;G&&G[K]&&G[K].abort&&(G[K].abort.abort(),delete G[K])})}removeTile(B){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[B.uid]&&delete this.loaded[B.uid]})}}class P{constructor(){this.loaded={}}loadTile(B){return c._(this,void 0,void 0,function*(){const{uid:G,encoding:K,rawImageData:ne,redFactor:xe,greenFactor:Q,blueFactor:we,baseShift:de}=B,Pe=ne.width+2,Ve=ne.height+2,We=c.b(ne)?new c.R({width:Pe,height:Ve},yield c.bt(ne,-1,-1,Pe,Ve)):ne,Xe=new c.bu(G,We,K,xe,Q,we,de);return this.loaded=this.loaded||{},this.loaded[G]=Xe,Xe})}removeTile(B){const G=this.loaded,K=B.uid;G&&G[K]&&delete G[K]}}function D(ae,B){if(ae.length!==0){N(ae[0],B);for(var G=1;G=Math.abs(we)?G-de+we:we-de+G,G=de}G+K>=0!=!!B&&ae.reverse()}var q=c.bv(function ae(B,G){var K,ne=B&&B.type;if(ne==="FeatureCollection")for(K=0;K>31}function Ze(ae,B){for(var G=ae.loadGeometry(),K=ae.type,ne=0,xe=0,Q=G.length,we=0;weae},wt=Math.fround||(un=new Float32Array(1),ae=>(un[0]=+ae,un[0]));var un;const Gt=3,Pt=5,hn=6;class Cn{constructor(B){this.options=Object.assign(Object.create(Nt),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:G,minZoom:K,maxZoom:ne}=this.options;G&&console.time("total time");const xe=`prepare ${B.length} points`;G&&console.time(xe),this.points=B;const Q=[];for(let de=0;de=K;de--){const Pe=+Date.now();we=this.trees[de]=this._createTree(this._cluster(we,de)),G&&console.log("z%d: %d clusters in %dms",de,we.numItems,+Date.now()-Pe)}return G&&console.timeEnd("total time"),this}getClusters(B,G){let K=((B[0]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,B[1]));let xe=B[2]===180?180:((B[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)K=-180,xe=180;else if(K>xe){const We=this.getClusters([K,ne,180,Q],G),Xe=this.getClusters([-180,ne,xe,Q],G);return We.concat(Xe)}const we=this.trees[this._limitZoom(G)],de=we.range(An(K),xr(Q),An(xe),xr(ne)),Pe=we.data,Ve=[];for(const We of de){const Xe=this.stride*We;Ve.push(Pe[Xe+Pt]>1?gn(Pe,Xe,this.clusterProps):this.points[Pe[Xe+Gt]])}return Ve}getChildren(B){const G=this._getOriginId(B),K=this._getOriginZoom(B),ne="No cluster with the specified id.",xe=this.trees[K];if(!xe)throw new Error(ne);const Q=xe.data;if(G*this.stride>=Q.length)throw new Error(ne);const we=this.options.radius/(this.options.extent*Math.pow(2,K-1)),de=xe.within(Q[G*this.stride],Q[G*this.stride+1],we),Pe=[];for(const Ve of de){const We=Ve*this.stride;Q[We+4]===B&&Pe.push(Q[We+Pt]>1?gn(Q,We,this.clusterProps):this.points[Q[We+Gt]])}if(Pe.length===0)throw new Error(ne);return Pe}getLeaves(B,G,K){const ne=[];return this._appendLeaves(ne,B,G=G||10,K=K||0,0),ne}getTile(B,G,K){const ne=this.trees[this._limitZoom(B)],xe=Math.pow(2,B),{extent:Q,radius:we}=this.options,de=we/Q,Pe=(K-de)/xe,Ve=(K+1+de)/xe,We={features:[]};return this._addTileFeatures(ne.range((G-de)/xe,Pe,(G+1+de)/xe,Ve),ne.data,G,K,xe,We),G===0&&this._addTileFeatures(ne.range(1-de/xe,Pe,1,Ve),ne.data,xe,K,xe,We),G===xe-1&&this._addTileFeatures(ne.range(0,Pe,de/xe,Ve),ne.data,-1,K,xe,We),We.features.length?We:null}getClusterExpansionZoom(B){let G=this._getOriginZoom(B)-1;for(;G<=this.options.maxZoom;){const K=this.getChildren(B);if(G++,K.length!==1)break;B=K[0].properties.cluster_id}return G}_appendLeaves(B,G,K,ne,xe){const Q=this.getChildren(G);for(const we of Q){const de=we.properties;if(de&&de.cluster?xe+de.point_count<=ne?xe+=de.point_count:xe=this._appendLeaves(B,de.cluster_id,K,ne,xe):xe1;let Ve,We,Xe;if(Pe)Ve=yn(G,de,this.clusterProps),We=G[de],Xe=G[de+1];else{const Wt=this.points[G[de+Gt]];Ve=Wt.properties;const[Ht,bn]=Wt.geometry.coordinates;We=An(Ht),Xe=xr(bn)}const Tt={type:1,geometry:[[Math.round(this.options.extent*(We*xe-K)),Math.round(this.options.extent*(Xe*xe-ne))]],tags:Ve};let At;At=Pe||this.options.generateId?G[de+Gt]:this.points[G[de+Gt]].id,At!==void 0&&(Tt.id=At),Q.features.push(Tt)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,G){const{radius:K,extent:ne,reduce:xe,minPoints:Q}=this.options,we=K/(ne*Math.pow(2,G)),de=B.data,Pe=[],Ve=this.stride;for(let We=0;WeG&&(Ht+=de[Wn+Pt])}if(Ht>Wt&&Ht>=Q){let bn,Wn=Xe*Wt,or=Tt*Wt,Xr=-1;const sn=((We/Ve|0)<<5)+(G+1)+this.points.length;for(const Sr of At){const si=Sr*Ve;if(de[si+2]<=G)continue;de[si+2]=G;const Ji=de[si+Pt];Wn+=de[si]*Ji,or+=de[si+1]*Ji,de[si+4]=sn,xe&&(bn||(bn=this._map(de,We,!0),Xr=this.clusterProps.length,this.clusterProps.push(bn)),xe(bn,this._map(de,si)))}de[We+4]=sn,Pe.push(Wn/Ht,or/Ht,1/0,sn,-1,Ht),xe&&Pe.push(Xr)}else{for(let bn=0;bn1)for(const bn of At){const Wn=bn*Ve;if(!(de[Wn+2]<=G)){de[Wn+2]=G;for(let or=0;or>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,G,K){if(B[G+Pt]>1){const Q=this.clusterProps[B[G+hn]];return K?Object.assign({},Q):Q}const ne=this.points[B[G+Gt]].properties,xe=this.options.map(ne);return K&&xe===ne?Object.assign({},xe):xe}}function gn(ae,B,G){return{type:"Feature",id:ae[B+Gt],properties:yn(ae,B,G),geometry:{type:"Point",coordinates:[(K=ae[B],360*(K-.5)),Ar(ae[B+1])]}};var K}function yn(ae,B,G){const K=ae[B+Pt],ne=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,xe=ae[B+hn],Q=xe===-1?{}:Object.assign({},G[xe]);return Object.assign(Q,{cluster:!0,cluster_id:ae[B+Gt],point_count:K,point_count_abbreviated:ne})}function An(ae){return ae/360+.5}function xr(ae){const B=Math.sin(ae*Math.PI/180),G=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return G<0?0:G>1?1:G}function Ar(ae){const B=(180-360*ae)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function wr(ae,B,G,K){for(var ne,xe=K,Q=G-B>>1,we=G-B,de=ae[B],Pe=ae[B+1],Ve=ae[G],We=ae[G+1],Xe=B+3;Xexe)ne=Xe,xe=Tt;else if(Tt===xe){var At=Math.abs(Xe-Q);AtK&&(ne-B>3&&wr(ae,B,ne,K),ae[ne+2]=xe,G-ne>3&&wr(ae,ne,G,K))}function fr(ae,B,G,K,ne,xe){var Q=ne-G,we=xe-K;if(Q!==0||we!==0){var de=((ae-G)*Q+(B-K)*we)/(Q*Q+we*we);de>1?(G=ne,K=xe):de>0&&(G+=Q*de,K+=we*de)}return(Q=ae-G)*Q+(we=B-K)*we}function Qe(ae,B,G,K){var ne={id:ae===void 0?null:ae,type:B,geometry:G,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xe){var Q=xe.geometry,we=xe.type;if(we==="Point"||we==="MultiPoint"||we==="LineString")ge(xe,Q);else if(we==="Polygon"||we==="MultiLineString")for(var de=0;de0&&(Q+=K?(ne*Pe-de*xe)/2:Math.sqrt(Math.pow(de-ne,2)+Math.pow(Pe-xe,2))),ne=de,xe=Pe}var Ve=B.length-3;B[2]=1,wr(B,0,Ve,G),B[Ve+2]=1,B.size=Math.abs(Q),B.start=0,B.end=B.size}function Ne(ae,B,G,K){for(var ne=0;ne1?1:G}function ln(ae,B,G,K,ne,xe,Q,we){if(K/=B,xe>=(G/=B)&&Q=K)return null;for(var de=[],Pe=0;Pe=G&&At=K)){var Wt=[];if(Xe==="Point"||Xe==="MultiPoint")$n(We,Wt,G,K,ne);else if(Xe==="LineString")Mo(We,Wt,G,K,ne,!1,we.lineMetrics);else if(Xe==="MultiLineString")Os(We,Wt,G,K,ne,!1);else if(Xe==="Polygon")Os(We,Wt,G,K,ne,!0);else if(Xe==="MultiPolygon")for(var Ht=0;Ht=G&&Q<=K&&(B.push(ae[xe]),B.push(ae[xe+1]),B.push(ae[xe+2]))}}function Mo(ae,B,G,K,ne,xe,Q){for(var we,de,Pe=ps(ae),Ve=ne===0?Pi:bl,We=ae.start,Xe=0;XeG&&(de=Ve(Pe,Tt,At,Ht,bn,G),Q&&(Pe.start=We+we*de)):Wn>K?or=G&&(de=Ve(Pe,Tt,At,Ht,bn,G),Xr=!0),or>K&&Wn<=K&&(de=Ve(Pe,Tt,At,Ht,bn,K),Xr=!0),!xe&&Xr&&(Q&&(Pe.end=We+we*de),B.push(Pe),Pe=ps(ae)),Q&&(We+=we)}var sn=ae.length-3;Tt=ae[sn],At=ae[sn+1],Wt=ae[sn+2],(Wn=ne===0?Tt:At)>=G&&Wn<=K&&Ba(Pe,Tt,At,Wt),sn=Pe.length-3,xe&&sn>=3&&(Pe[sn]!==Pe[0]||Pe[sn+1]!==Pe[1])&&Ba(Pe,Pe[0],Pe[1],Pe[2]),Pe.length&&B.push(Pe)}function ps(ae){var B=[];return B.size=ae.size,B.start=ae.start,B.end=ae.end,B}function Os(ae,B,G,K,ne,xe){for(var Q=0;QQ.maxX&&(Q.maxX=Ve),We>Q.maxY&&(Q.maxY=We)}return Q}function Zr(ae,B,G,K){var ne=B.geometry,xe=B.type,Q=[];if(xe==="Point"||xe==="MultiPoint")for(var we=0;we0&&B.size<(ne?Q:K))G.numPoints+=B.length/3;else{for(var we=[],de=0;deQ)&&(G.numSimplified++,we.push(B[de]),we.push(B[de+1])),G.numPoints++;ne&&function(Pe,Ve){for(var We=0,Xe=0,Tt=Pe.length,At=Tt-2;Xe0===Ve)for(Xe=0,Tt=Pe.length;Xe24)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 K=function(ne,xe){var Q=[];if(ne.type==="FeatureCollection")for(var we=0;we1&&console.time("creation"),Xe=this.tiles[We]=xl(ae,B,G,K,de),this.tileCoords.push({z:B,x:G,y:K}),Pe)){Pe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,G,K,Xe.numFeatures,Xe.numPoints,Xe.numSimplified),console.timeEnd("creation"));var Tt="z"+B;this.stats[Tt]=(this.stats[Tt]||0)+1,this.total++}if(Xe.source=ae,ne){if(B===de.maxZoom||B===ne)continue;var At=1<1&&console.time("clipping");var Wt,Ht,bn,Wn,or,Xr,sn=.5*de.buffer/de.extent,Sr=.5-sn,si=.5+sn,Ji=1+sn;Wt=Ht=bn=Wn=null,or=ln(ae,Ve,G-sn,G+si,0,Xe.minX,Xe.maxX,de),Xr=ln(ae,Ve,G+Sr,G+Ji,0,Xe.minX,Xe.maxX,de),ae=null,or&&(Wt=ln(or,Ve,K-sn,K+si,1,Xe.minY,Xe.maxY,de),Ht=ln(or,Ve,K+Sr,K+Ji,1,Xe.minY,Xe.maxY,de),or=null),Xr&&(bn=ln(Xr,Ve,K-sn,K+si,1,Xe.minY,Xe.maxY,de),Wn=ln(Xr,Ve,K+Sr,K+Ji,1,Xe.minY,Xe.maxY,de),Xr=null),Pe>1&&console.timeEnd("clipping"),we.push(Wt||[],B+1,2*G,2*K),we.push(Ht||[],B+1,2*G,2*K+1),we.push(bn||[],B+1,2*G+1,2*K),we.push(Wn||[],B+1,2*G+1,2*K+1)}}},tn.prototype.getTile=function(ae,B,G){var K=this.options,ne=K.extent,xe=K.debug;if(ae<0||ae>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",ae,B,G);for(var de,Pe=ae,Ve=B,We=G;!de&&Pe>0;)Pe--,Ve=Math.floor(Ve/2),We=Math.floor(We/2),de=this.tiles[Jt(Pe,Ve,We)];return de&&de.source?(xe>1&&console.log("found parent tile z%d-%d-%d",Pe,Ve,We),xe>1&&console.time("drilling down"),this.splitTile(de.source,Pe,Ve,We,ae,B,G),xe>1&&console.timeEnd("drilling down"),this.tiles[we]?Ko(this.tiles[we],ne):null):null};class ga extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(B,G){return c._(this,void 0,void 0,function*(){const K=B.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ne=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!ne)return null;const xe=new class{constructor(we){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=we.length,this._features=we}feature(we){return new class{constructor(de){this._feature=de,this.extent=c.W,this.type=de.type,this.properties=de.tags,"id"in de&&!isNaN(de.id)&&(this.id=parseInt(de.id,10))}loadGeometry(){if(this._feature.type===1){const de=[];for(const Pe of this._feature.geometry)de.push([new c.P(Pe[0],Pe[1])]);return de}{const de=[];for(const Pe of this._feature.geometry){const Ve=[];for(const We of Pe)Ve.push(new c.P(We[0],We[1]));de.push(Ve)}return de}}toGeoJSON(de,Pe,Ve){return J.call(this,de,Pe,Ve)}}(this._features[we])}}(ne.features);let Q=qe(xe);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:xe,rawData:Q.buffer}})}loadData(B){return c._(this,void 0,void 0,function*(){var G;(G=this._pendingRequest)===null||G===void 0||G.abort();const K=!!(B&&B.request&&B.request.collectResourceTiming)&&new c.bs(B.request);this._pendingRequest=new AbortController;try{let ne=yield this.loadGeoJSON(B,this._pendingRequest);if(delete this._pendingRequest,typeof ne!="object")throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(q(ne,!0),B.filter){const Q=c.by(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(de=>`${de.key}: ${de.message}`).join(", "));ne={type:"FeatureCollection",features:ne.features.filter(de=>Q.value.evaluate({zoom:0},de))}}this._geoJSONIndex=B.cluster?new Cn(function({superclusterOptions:Q,clusterProperties:we}){if(!we||!Q)return Q;const de={},Pe={},Ve={accumulated:null,zoom:0},We={properties:null},Xe=Object.keys(we);for(const Tt of Xe){const[At,Wt]=we[Tt],Ht=c.by(Wt),bn=c.by(typeof At=="string"?[At,["accumulated"],["get",Tt]]:At);de[Tt]=Ht.value,Pe[Tt]=bn.value}return Q.map=Tt=>{We.properties=Tt;const At={};for(const Wt of Xe)At[Wt]=de[Wt].evaluate(Ve,We);return At},Q.reduce=(Tt,At)=>{We.properties=At;for(const Wt of Xe)Ve.accumulated=Tt[Wt],Tt[Wt]=Pe[Wt].evaluate(Ve,We)},Q}(B)).load(ne.features):function(Q,we){return new tn(Q,we)}(ne,B.geojsonVtOptions),this.loaded={};const xe={};if(K){const Q=K.finish();Q&&(xe.resourceTiming={},xe.resourceTiming[B.source]=JSON.parse(JSON.stringify(Q)))}return xe}catch(ne){if(delete this._pendingRequest,c.bz(ne))return{abandoned:!0};throw ne}})}reloadTile(B){const G=this.loaded;return G&&G[B.uid]?super.reloadTile(B):this.loadTile(B)}loadGeoJSON(B,G){return c._(this,void 0,void 0,function*(){const{promoteId:K}=B;if(B.request){const ne=yield c.h(B.request,G);return this._dataUpdateable=Jo(ne.data,K)?Kt(ne.data,K):void 0,ne.data}if(typeof B.data=="string")try{const ne=JSON.parse(B.data);return this._dataUpdateable=Jo(ne,K)?Kt(ne,K):void 0,ne}catch{throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`)}if(!B.dataDiff)throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${B.source}`);return function(ne,xe,Q){var we,de,Pe,Ve;if(xe.removeAll&&ne.clear(),xe.remove)for(const We of xe.remove)ne.delete(We);if(xe.add)for(const We of xe.add){const Xe=Dr(We,Q);Xe!=null&&ne.set(Xe,We)}if(xe.update)for(const We of xe.update){let Xe=ne.get(We.id);if(Xe==null)continue;const Tt=!We.removeAllProperties&&(((we=We.removeProperties)===null||we===void 0?void 0:we.length)>0||((de=We.addOrUpdateProperties)===null||de===void 0?void 0:de.length)>0);if((We.newGeometry||We.removeAllProperties||Tt)&&(Xe=Object.assign({},Xe),ne.set(We.id,Xe),Tt&&(Xe.properties=Object.assign({},Xe.properties))),We.newGeometry&&(Xe.geometry=We.newGeometry),We.removeAllProperties)Xe.properties={};else if(((Pe=We.removeProperties)===null||Pe===void 0?void 0:Pe.length)>0)for(const At of We.removeProperties)Object.prototype.hasOwnProperty.call(Xe.properties,At)&&delete Xe.properties[At];if(((Ve=We.addOrUpdateProperties)===null||Ve===void 0?void 0:Ve.length)>0)for(const{key:At,value:Wt}of We.addOrUpdateProperties)Xe.properties[At]=Wt}}(this._dataUpdateable,B.dataDiff,K),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(B){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(B){return this._geoJSONIndex.getClusterExpansionZoom(B.clusterId)}getClusterChildren(B){return this._geoJSONIndex.getChildren(B.clusterId)}getClusterLeaves(B){return this._geoJSONIndex.getLeaves(B.clusterId,B.limit,B.offset)}}class Fr{constructor(B){this.self=B,this.actor=new c.C(B),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(G,K)=>{if(this.externalWorkerSourceTypes[G])throw new Error(`Worker source with name "${G}" already registered.`);this.externalWorkerSourceTypes[G]=K},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=G=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(G)},this.actor.registerMessageHandler("LDT",(G,K)=>this._getDEMWorkerSource(G,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(G,K)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(G,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(G,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(G,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(G,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(G,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(G,K)=>this._getWorkerSource(G,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(G,K)=>this._getWorkerSource(G,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(G,K)=>this._getWorkerSource(G,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(G,K)=>this._getWorkerSource(G,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(G,K)=>this._getWorkerSource(G,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(G,K)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[G]||!this.workerSources[G][K.type]||!this.workerSources[G][K.type][K.source])return;const ne=this.workerSources[G][K.type][K.source];delete this.workerSources[G][K.type][K.source],ne.removeSource!==void 0&&ne.removeSource(K)})),this.actor.registerMessageHandler("RM",G=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[G],delete this.availableImages[G],delete this.workerSources[G],delete this.demWorkerSources[G]})),this.actor.registerMessageHandler("SR",(G,K)=>c._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(G,K)=>this._syncRTLPluginState(G,K)),this.actor.registerMessageHandler("IS",(G,K)=>c._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(G,K)=>this._setImages(G,K)),this.actor.registerMessageHandler("UL",(G,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(G).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(G,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(G).replace(K)}))}_setImages(B,G){return c._(this,void 0,void 0,function*(){this.availableImages[B]=G;for(const K in this.workerSources[B]){const ne=this.workerSources[B][K];for(const xe in ne)ne[xe].availableImages=G}})}_syncRTLPluginState(B,G){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(G.pluginStatus!=="loading")return c.bA.setState(G),G;const K=G.pluginURL;if(this.self.importScripts(K),c.bA.isParsed()){const ne={pluginStatus:"loaded",pluginURL:K};return c.bA.setState(ne),ne}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_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 u),G}_getWorkerSource(B,G,K){if(this.workerSources[B]||(this.workerSources[B]={}),this.workerSources[B][G]||(this.workerSources[B][G]={}),!this.workerSources[B][G][K]){const ne={sendAsync:(xe,Q)=>(xe.targetMapId=B,this.actor.sendAsync(xe,Q))};switch(G){case"vector":this.workerSources[B][G][K]=new I(ne,this._getLayerIndex(B),this._getAvailableImages(B));break;case"geojson":this.workerSources[B][G][K]=new ga(ne,this._getLayerIndex(B),this._getAvailableImages(B));break;default:this.workerSources[B][G][K]=new this.externalWorkerSourceTypes[G](ne,this._getLayerIndex(B),this._getAvailableImages(B))}}return this.workerSources[B][G][K]}_getDEMWorkerSource(B,G){return this.demWorkerSources[B]||(this.demWorkerSources[B]={}),this.demWorkerSources[B][G]||(this.demWorkerSources[B][G]=new P),this.demWorkerSources[B][G]}}return c.i(self)&&(self.worker=new Fr(self)),Fr}),i("index",["exports","./shared"],function(c,u){var g="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const m=f.boundingClientRect;return new u.P((d.clientX-m.left)/f.x-s.clientLeft,(d.clientY-m.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],m=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,m={}},_.addThrottleControl=M=>{const k=d++;return m[k]=M,k},_.removeThrottleControl=M=>{delete m[M],C()},_.getImage=(M,k,z=!0)=>new Promise((F,X)=>{D.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:k,requestParameters:M,supportImageRefresh:z,state:"queued",onError:oe=>{X(oe)},onSuccess:oe=>{F(oe)}}),C()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:k,supportImageRefresh:z,onError:F,onSuccess:X,abortController:oe}=M,ie=z===!1&&!u.i(self)&&!u.g(k.url)&&(!k.headers||Object.keys(k.headers).reduce((ve,Fe)=>ve&&Fe==="accept",!0));f++;const le=ie?T(k,oe):u.m(k,oe);try{const ve=yield le;delete M.abortController,M.state="completed",ve.data instanceof HTMLImageElement||u.b(ve.data)?X(ve):ve.data&&X({data:yield($=ve.data,typeof createImageBitmap=="function"?u.d($):u.f($)),cacheControl:ve.cacheControl,expires:ve.expires})}catch(ve){delete M.abortController,F(ve)}finally{f--,C()}var $}),C=()=>{const M=(()=>{for(const k of Object.keys(m))if(m[k]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let k=f;k0;k++){const z=s.shift();z.abortController.signal.aborted?k--:v(z)}},T=(M,k)=>new Promise((z,F)=>{const X=new Image,oe=M.url,ie=M.credentials;ie&&ie==="include"?X.crossOrigin="use-credentials":(ie&&ie==="same-origin"||!u.s(oe))&&(X.crossOrigin="anonymous"),k.signal.addEventListener("abort",()=>{X.src="",F(u.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,z({data:X})},X.onerror=()=>{X.onerror=X.onload=null,k.signal.aborted||F(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."))},X.src=oe})}(j||(j={})),j.resetRequestQueue();class Z{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const m=function(v){const C=v.match(te);if(!C)throw new Error(`Unable to parse URL "${v}"`);return{protocol:C[1],authority:C[2],path:C[3]||"/",params:C[4]?C[4].split("&"):[]}}(s);return m.path+=`${f}${d}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(m)}setTransformRequest(s){this._transformRequestFn=s}}const te=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _e(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var pe,he=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};pe=new u.A(3),u.A!=Float32Array&&(pe[0]=0,pe[1]=0,pe[2]=0);var me=function(_){var s=_[0],f=_[1];return s*s+f*f};function Ce(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:m}of _){const v=`${d}${m}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:m}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class H{constructor(s,f,d,m){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,m)}update(s,f,d){const{width:m,height:v}=s,C=!(this.size&&this.size[0]===m&&this.size[1]===v||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[m,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,m,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:z}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,z,m,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),d!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,d||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,f),this.wrap=f)}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 ce(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Ke extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.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:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const m=f.data||f.spriteData;return this._validateStretch(f.stretchX,m&&m.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,m&&m.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const m of s){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(m=!1);this.isLoaded()||m?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let m=this.getImage(d);m||(this.fire(new u.k("styleimagemissing",{id:d})),m=this.getImage(d)),m?f[d]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:u.w(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const m={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.I(m,d);this.patterns[s]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new H(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),m=this.atlasImage;m.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],T=C.x+1,M=C.y+1,k=this.getImage(v).data,z=k.width,F=k.height;u.R.copy(k,m,{x:0,y:0},{x:T,y:M},{width:z,height:F}),u.R.copy(k,m,{x:0,y:F-1},{x:T,y:M-1},{width:z,height:1}),u.R.copy(k,m,{x:0,y:0},{x:T,y:M+F},{width:z,height:1}),u.R.copy(k,m,{x:z-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(k,m,{x:0,y:0},{x:T+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),ce(d)&&this.updateImage(f,d)}}}const Se=1e20;function Ze(_,s,f,d,m,v,C,T,M){for(let k=s;k-1);M++,v[M]=T,C[M]=k,C[M+1]=Se}for(let T=0,M=0;T65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const T=qe.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const C=yield d.requests[v];for(const T in C)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=C[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new qe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:T})}const C=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}qe.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const m=256*s,v=m+255,C=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${m}-${v}`),"Glyphs"),T=yield u.l(C,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${v}`);const M={};for(const k of u.n(T.data))M[k.id]=k;return M})},qe.TinySDF=class{constructor({fontSize:_=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const T=this.size=_+4*s,M=this._createCanvas(T),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${C} ${v} ${_}px ${m}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(_),C=Math.ceil(f),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),M=Math.min(this.size-this.buffer,C+Math.ceil(d)),k=T+2*this.buffer,z=M+2*this.buffer,F=Math.max(k*z,0),X=new Uint8ClampedArray(F),oe={data:X,width:k,height:z,glyphWidth:T,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return oe;const{ctx:ie,buffer:le,gridInner:$,gridOuter:ve}=this;ie.clearRect(le,le,T,M),ie.fillText(_,le,le+C);const Fe=ie.getImageData(le,le,T,M);ve.fill(Se,0,F),$.fill(0,0,F);for(let ue=0;ue0?He*He:0,$[Ge]=He<0?He*He:0}}Ze(ve,0,0,k,z,k,this.f,this.v,this.z),Ze($,le,le,T,M,k,this.f,this.v,this.z);for(let ue=0;ue1&&(M=s[++T]);const z=Math.abs(k-M.left),F=Math.abs(k-M.right),X=Math.min(z,F);let oe;const ie=v/d*(m+1);if(M.isDash){const le=m-Math.abs(ie);oe=Math.sqrt(X*X+le*le)}else oe=m-Math.sqrt(X*X+ie*ie);this.data[C+k]=Math.max(0,Math.min(255,oe+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],k=s[T+1];M.zeroLength?s.splice(T,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const m=this.width*this.nextRow;let v=0,C=s[v];for(let T=0;T1&&(C=s[++v]);const M=Math.abs(T-C.left),k=Math.abs(T-C.right),z=Math.min(M,k);this.data[m+T]=Math.max(0,Math.min(255,(C.isDash?z:-z)+128))}}addDash(s,f){const d=f?7:0,m=2*d+1;if(this.nextRow+m>this.height)return u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Pt]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(I.hardwareConcurrency/2);let gn,yn;function An(){return gn||(gn=new hn),gn}hn.workerCount=u.B(globalThis)?Math.max(Math.min(Cn,3),1):1;class xr{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let m=0;m{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function Ar(){return yn||(yn=new xr(An(),u.G),yn.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),yn}function wr(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function fr(_,s,f,d,m,v){const C=function(F,X,oe){if(F)for(const ie of F){const le=X[ie];if(le&&le.source===oe&&le.type==="fill-extrusion")return!0}else for(const ie in X){const le=X[ie];if(le.source===oe&&le.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,C);M.sort(Qe);const k=[];for(const F of M)k.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,v,T,wr(_.transform,F.tileID))});const z=function(F){const X={},oe={};for(const ie of F){const le=ie.queryResults,$=ie.wrappedTileID,ve=oe[$]=oe[$]||{};for(const Fe in le){const ue=le[Fe],Ie=ve[Fe]=ve[Fe]||{},Be=X[Fe]=X[Fe]||[];for(const Ge of ue)Ie[Ge.featureIndex]||(Ie[Ge.featureIndex]=!0,Be.push(Ge))}}return X}(k);for(const F in z)z[F].forEach(X=>{const oe=X.feature,ie=_.getFeatureState(oe.layer["source-layer"],oe.id);oe.source=oe.layer.source,oe.layer["source-layer"]&&(oe.sourceLayer=oe.layer["source-layer"]),oe.state=ie});return z}function Qe(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function ge(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield I.frameAsync(f),!d)return null;const m=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(m.vectorLayerIds=d.vector_layers.map(v=>v.id)),m})}class Le{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):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 u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let m,v;if(s instanceof u.M)m=s,v=s;else{if(!(s instanceof Le))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Le.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(m=s._sw,v=s._ne,!m||!v)return this}return f||d?(f.lng=Math.min(m.lng,f.lng),f.lat=Math.min(m.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new u.M(m.lng,m.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:d}=u.M.convert(s);let m=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&m}static convert(s){return s instanceof Le?s:s&&new Le(s)}static fromLngLat(s,f=0){const d=360*f/40075017,m=d/Math.cos(Math.PI/180*s.lat);return new Le(new u.M(s.lng-m,s.lat-d),new u.M(s.lng+m,s.lat+d))}}class It{constructor(s,f,d){this.bounds=Le.convert(this.validateBounds(s)),this.minzoom=f||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 f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),m=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),C=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=m&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"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};d.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,C)=>{s.reloadPromise={resolve:v,reject:C}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:m,data:d},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const d=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(d.resolve).catch(d.reject)}}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Ne extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ge(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new It(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),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}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield j.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&s.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const m=this.map.painter.context,v=m.gl,C=d.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new H(m,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(d){if(delete s.abortController,s.aborted)s.state="unloaded";else if(d)throw s.state="errored",d}})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class Yt extends Ne{constructor(s,f,d,m){super(s,f,d,m),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield j.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const C=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),m=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+d)%d,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,m,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,m,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:m}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={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.abortController=new AbortController;const m=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,f==="RT")})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ln=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $n extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=f}load(s){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield j.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(m){let v=1/0,C=1/0,T=-1/0,M=-1/0;for(const X of m)v=Math.min(v,X.x),C=Math.min(C,X.y),T=Math.max(T,X.x),M=Math.max(M,X.y);const k=Math.max(T-v,M-C),z=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),F=Math.pow(2,z);return new u.a0(z,Math.floor((v+T)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new H(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Mo extends $n{constructor(s,f,d,m){super(s,f,d,m),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new H(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ps extends $n{constructor(s,f,d,m){super(s,f,d,m),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(C=>typeof C!="number"))||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`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 u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new H(f,this.canvas,d.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,m=!0)}m&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}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 Os={},Ba=_=>{switch(_){case"geojson":return kr;case"image":return $n;case"raster":return Ne;case"raster-dem":return Yt;case"vector":return kn;case"video":return Mo;case"canvas":return ps}return Os[_]},Pi="RTLPluginLoaded";class bl extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ar()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=I.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Pi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ds=null;function rt(){return ds||(ds=new bl),ds}class Ko{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.a3(),this.uses=0,this.tileSize=f,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 f=s+this.timeAdded;fv.getLayer(k)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(k=>M.filter(z=>z.id===k)[0]));for(const k of M)C[k.id]=T}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5&&v.hasRTLText){this.hasRTLText=!0,rt().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(m).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}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 m=this.buckets[d];m.uploadPending()&&m.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new H(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new H(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,d,m,v,C,T,M,k,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:T,queryPadding:this.queryPadding*k},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const m=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=m._geojsonTileLayer||m[v];if(!C)return;const T=u.a6(f&&f.filter),{z:M,x:k,y:z}=this.tileID.canonical,F={z:M,x:k,y:z};for(let X=0;Xd)m=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}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 f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const d=s.wrapped().key,m=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][m];return this.data[d].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const d in this.data)for(const m of this.data[d])s(m.value)||f.push(m);for(const d of f)this.remove(d.value.tileID,d)}}class xl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const m=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},u.e(this.stateChanges[s][m],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==m&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const v in this.state[s][m])d[v]||(this.deletedStates[s][m][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][v]===null&&delete this.deletedStates[s][m][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const m=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(d in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][d]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),m=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete m[C]}return m}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const C in this.stateChanges[m])this.state[m][C]||(this.state[m][C]={}),u.e(this.state[m][C],this.stateChanges[m][C]),v[C]=this.state[m][C];d[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const C in this.state[m])v[C]={},this.state[m][C]={};else for(const C in this.deletedStates[m]){if(this.deletedStates[m][C]===null)this.state[m][C]={};else for(const T of Object.keys(this.deletedStates[m][C]))delete this.state[m][C][T];v[C]=this.state[m][C]}d[m]=d[m]||{},u.e(d[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const m in s)s[m].setFeatureState(d,f)}}class Zr extends u.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,C,T)=>{const M=new(Ba(v.type))(m,v,C,T);if(M.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new Ki(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new xl,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 f=this._tiles[s];if(f.state!=="loaded"&&f.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,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(m){s.state="errored",m.status!==404?this._source.fire(new u.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new u.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 f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ct).map(s=>s.key)}getRenderableIds(s){const f=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&f.push(this._tiles[d]);return s?f.sort((d,m)=>{const v=d.tileID,C=m.tileID,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(ct).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!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,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=I.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,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 u.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let m=0;m1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,C,T),m.neighboringTiles&&m.neighboringTiles[k]&&(m.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,m){for(const v in this._tiles){let C=this._tiles[v];if(m[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>d)continue;let T=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const k=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[k.key],C&&C.hasData()&&(T=k)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){m[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const m=s.scaledTo(d),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const d={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let d;this.transform=s,this.terrain=f,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(z=>new u.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.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:f}),this._source.hasTile&&(d=d.filter(z=>this._source.hasTile(z)))):d=[];const m=s.coveringZoomLevel(this._source),v=Math.max(m-Zr.maxOverzooming,this._source.minzoom),C=Math.max(m+Zr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of d)if(F.canonical.z>this._source.minzoom){const X=F.scaledTo(F.canonical.z-1);z[X.key]=X;const oe=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[oe.key]=oe}d=d.concat(Object.values(z))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,m);if(tn(this._source.type)){const z={},F={},X=Object.keys(M),oe=I.now();for(const ie of X){const le=M[ie],$=this._tiles[ie];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=oe)continue;const ve=this.findLoadedParent(le,v);ve&&(this._addTile(ve.tileID),z[ve.tileID.key]=ve.tileID),F[ie]=le}this._retainLoadedChildren(F,m,C,M);for(const ie in z)M[ie]||(this._coveredTiles[ie]=!0,M[ie]=z[ie]);if(f){const ie={},le={};for(const $ of d)this._tiles[$.key].hasData()?ie[$.key]=$:le[$.key]=$;for(const $ in le){const ve=le[$].children(this._source.maxzoom);this._tiles[ve[0].key]&&this._tiles[ve[1].key]&&this._tiles[ve[2].key]&&this._tiles[ve[3].key]&&(ie[ve[0].key]=M[ve[0].key]=ve[0],ie[ve[1].key]=M[ve[1].key]=ve[1],ie[ve[2].key]=M[ve[2].key]=ve[2],ie[ve[3].key]=M[ve[3].key]=ve[3],delete le[$])}for(const $ in le){const ve=this.findLoadedParent(le[$],this._source.minzoom);if(ve){ie[ve.tileID.key]=M[ve.tileID.key]=ve.tileID;for(const Fe in ie)ie[Fe].isChildOf(ve.tileID)&&delete ie[Fe]}}for(const $ in this._tiles)ie[$]||(this._coveredTiles[$]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const k=u.ab(this._tiles,M);for(const z of k){const F=this._tiles[z];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const d={},m={},v=Math.max(f-Zr.maxOverzooming,this._source.minzoom),C=Math.max(f+Zr.maxUnderzooming,this._source.minzoom),T={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],X=this.getTile(F);if(X&&X.hasData()){d[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(d[F[0].key]&&d[F[1].key]&&d[F[2].key]&&d[F[3].key])continue}let z=k.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const X=M.scaledTo(F);if(m[X.key])break;if(m[X.key]=!0,k=this.getTile(X),!k&&z&&(k=this._addTile(X)),k){const oe=k.hasData();if((z||oe)&&(d[X.key]=X),z=k.wasRequested(),oe)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){d=this._loadedParentTiles[m.key];break}f.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;m=v}for(const v of f)this._loadedParentTiles[v]=d}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const d=f;return f||(f=new Ko(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const m=[],v=this.transform;if(!v)return m;const C=d?v.getCameraQueryGeometry(s):s,T=s.map(ie=>v.pointCoordinate(ie,this.terrain)),M=C.map(ie=>v.pointCoordinate(ie,this.terrain)),k=this.getIds();let z=1/0,F=1/0,X=-1/0,oe=-1/0;for(const ie of M)z=Math.min(z,ie.x),F=Math.min(F,ie.y),X=Math.max(X,ie.x),oe=Math.max(oe,ie.y);for(let ie=0;ie=0&&ue[1].y+Fe>=0){const Ie=T.map(Ge=>$.getTilePoint(Ge)),Be=M.map(Ge=>$.getTilePoint(Ge));m.push({tile:le,tileID:$,queryGeometry:Ie,cameraQueryGeometry:Be,scale:ve})}}return m}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of f)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(tn(this._source.type)){const s=I.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,d){this._state.updateState(s=s||"_geojsonTileLayer",f,d)}removeFeatureState(s,f,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,d)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,d){const m=this._tiles[s];m&&m.setDependencies(f,d)}reloadTilesForDependencies(s,f){for(const d in this._tiles)this._tiles[d].hasDependency(s,f)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,f))}}function ct(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function tn(_){return _==="raster"||_==="image"||_==="video"}Zr.maxOverzooming=10,Zr.maxUnderzooming=3;class Jt{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(m-C)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Dr(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Jo{constructor(s,f,d){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let C=0;Cthis.width||m<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=m){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:m}];for(let k=0;k0}hitTestCircle(s,f,d,m,v){const C=s-d,T=s+d,M=f-d,k=f+d;if(T<0||C>this.width||k<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,T,k,this._queryCellCircle,z,{hitTest:!0,overlapMode:m,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,d,m,v,C,T,M){const{seenUids:k,hitTest:z,overlapMode:F}=T,X=this.boxCells[v];if(X!==null){const ie=this.bboxes;for(const le of X)if(!k.box[le]){k.box[le]=!0;const $=4*le,ve=this.boxKeys[le];if(s<=ie[$+2]&&f<=ie[$+3]&&d>=ie[$+0]&&m>=ie[$+1]&&(!M||M(ve))&&(!z||!Dr(F,ve.overlapMode))&&(C.push({key:ve,x1:ie[$],y1:ie[$+1],x2:ie[$+2],y2:ie[$+3]}),z))return!0}}const oe=this.circleCells[v];if(oe!==null){const ie=this.circles;for(const le of oe)if(!k.circle[le]){k.circle[le]=!0;const $=3*le,ve=this.circleKeys[le];if(this._circleAndRectCollide(ie[$],ie[$+1],ie[$+2],s,f,d,m)&&(!M||M(ve))&&(!z||!Dr(F,ve.overlapMode))){const Fe=ie[$],ue=ie[$+1],Ie=ie[$+2];if(C.push({key:ve,x1:Fe-Ie,y1:ue-Ie,x2:Fe+Ie,y2:ue+Ie}),z)return!0}}}return!1}_queryCellCircle(s,f,d,m,v,C,T,M){const{circle:k,seenUids:z,overlapMode:F}=T,X=this.boxCells[v];if(X!==null){const ie=this.bboxes;for(const le of X)if(!z.box[le]){z.box[le]=!0;const $=4*le,ve=this.boxKeys[le];if(this._circleAndRectCollide(k.x,k.y,k.radius,ie[$+0],ie[$+1],ie[$+2],ie[$+3])&&(!M||M(ve))&&!Dr(F,ve.overlapMode))return C.push(!0),!0}}const oe=this.circleCells[v];if(oe!==null){const ie=this.circles;for(const le of oe)if(!z.circle[le]){z.circle[le]=!0;const $=3*le,ve=this.circleKeys[le];if(this._circlesCollide(ie[$],ie[$+1],ie[$+2],k.x,k.y,k.radius)&&(!M||M(ve))&&!Dr(F,ve.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,m,v,C,T,M){const k=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),X=this._convertToYCellCoord(m);for(let oe=k;oe<=F;oe++)for(let ie=z;ie<=X;ie++)if(v.call(this,s,f,d,m,this.xCellCount*ie+oe,C,T,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,f,d,m,v,C){const T=m-s,M=v-f,k=d+C;return k*k>T*T+M*M}_circleAndRectCollide(s,f,d,m,v,C,T){const M=(C-m)/2,k=Math.abs(s-(m+M));if(k>M+d)return!1;const z=(T-v)/2,F=Math.abs(f-(v+z));if(F>z+d)return!1;if(k<=M||F<=z)return!0;const X=k-M,oe=F-z;return X*X+oe*oe<=d*d}}function Kt(_,s,f,d,m){const v=u.F();return s?(u.J(v,v,[1/m,1/m,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ga(_,s,f,d,m){if(s){const v=u.ae(_);return u.J(v,v,[m,m,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Fr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],Tt(d,d,s));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m}}function ae(_,s){return .5+_/s*.5}function B(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function G(_,s,f,d,m,v,C,T,M,k){const z=d?_.textSizeData:_.iconSizeData,F=u.ag(z,f.transform.zoom),X=[256/f.width*2+1,256/f.height*2+1],oe=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;oe.clear();const ie=_.lineVertexArray,le=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,$=f.transform.width/f.transform.height;let ve=!1;for(let Fe=0;FeMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function xe(_,s,f,d,m,v,C,T,M,k,z,F,X,oe,ie,le){const $=s/24,ve=_.lineOffsetX*$,Fe=_.lineOffsetY*$;let ue;if(_.numGlyphs>1){const Ie=_.glyphStartIndex+_.numGlyphs,Be=_.lineStartIndex,Ge=_.lineStartIndex+_.lineLength,He=K($,T,ve,Fe,f,z,F,_,M,v,X,ie,le);if(!He)return{notEnoughRoom:!0};const et=Fr(He.first.point,C,le).point,$e=Fr(He.last.point,C,le).point;if(d&&!f){const ot=ne(_.writingMode,et,$e,oe);if(ot)return ot}ue=[He.first];for(let ot=_.glyphStartIndex+1;ot0?et.point:Q(F,He,Be,1,m,le),ot=ne(_.writingMode,Be,$e,oe);if(ot)return ot}const Ie=Ve($*T.getoffsetX(_.glyphStartIndex),ve,Fe,f,z,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,X,ie,le);if(!Ie)return{notEnoughRoom:!0};ue=[Ie]}for(const Ie of ue)u.aj(k,Ie.point,Ie.angle);return{}}function Q(_,s,f,d,m,v){const C=Fr(_.add(_.sub(s)._unit()),m,v).point,T=f.sub(C);return f.add(T._mult(d/T.mag()))}function we(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:T,previousVertex:M,direction:k,absOffsetX:z}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),X=Fr(F,m,T);if(X.signedDistanceFromCamera>0)return f.projections[_]=X.point,X.point;const oe=_-k;return Q(C===0?v:new u.P(d.getx(oe),d.gety(oe)),F,M,z-C+1,m,T)}function de(_,s,f){return _._unit()._perp()._mult(s*f)}function Pe(_,s,f,d,m,v,C,T){const{projectionCache:M,direction:k}=T;if(M.offsets[_])return M.offsets[_];const z=f.add(s);if(_+k=m)return M.offsets[_]=z,z;const F=we(_+k,T),X=de(F.sub(f),C,k),oe=f.add(X),ie=F.add(X);return M.offsets[_]=u.ak(v,z,oe,ie)||z,M.offsets[_]}function Ve(_,s,f,d,m,v,C,T,M,k,z,F,X,oe){const ie=d?_-s:_+s;let le=ie>0?1:-1,$=0;d&&(le*=-1,$=Math.PI),le<0&&($+=Math.PI);let ve,Fe,ue=le>0?T+C:T+C+1,Ie=m,Be=m,Ge=0,He=0;const et=Math.abs(ie),$e=[];let ot;for(;Ge+He<=et;){if(ue+=le,ue=M)return null;Ge+=He,Be=Ie,Fe=ve;const pt={projectionCache:F,lineVertexArray:k,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:Ge,getElevation:oe,previousVertex:Be,direction:le,absOffsetX:et};if(Ie=we(ue,pt),f===0)$e.push(Be),ot=Ie.sub(Be);else{let Bt;const rn=Ie.sub(Be);Bt=rn.mag()===0?de(we(ue+le,pt).sub(Ie),f,le):de(rn,f,le),Fe||(Fe=Be.add(Bt)),ve=Pe(ue,Bt,Ie,T,M,Fe,f,pt),$e.push(Fe),ot=ve.sub(Fe)}He=ot.mag()}const ht=ot._mult((et-Ge)/He)._add(Fe||Be),nn=$+Math.atan2(Ie.y-Be.y,Ie.x-Be.x);return $e.push(ht),{point:ht,angle:X?nn:0,path:$e}}const We=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xe(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(We,3*d)}}function Tt(_,s,f){const d=s[0],m=s[1];return _[0]=f[0]*d+f[4]*m+f[12],_[1]=f[1]*d+f[5]*m+f[13],_[3]=f[3]*d+f[7]*m+f[15],_}const At=100;class Wt{constructor(s,f=new Jo(s.width+200,s.height+200,25),d=new Jo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+At,this.screenBottomBoundary=s.height+At,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,m,v,C){const T=this.projectAndGetPerspectiveRatio(m,s.anchorPointX,s.anchorPointY,C),M=d*T.perspectiveRatio,k=s.x1*M+T.point.x,z=s.y1*M+T.point.y,F=s.x2*M+T.point.x,X=s.y2*M+T.point.y;return!this.isInsideGrid(k,z,F,X)||f!=="always"&&this.grid.hitTest(k,z,F,X,f,v)||T.perspectiveRatio=1;an--)rn.push(pt.path[an]);for(let an=1;anFr(fn,M,ie));rn=an.some(fn=>fn.signedDistanceFromCamera<=0)?[]:an.map(fn=>fn.point)}let qt=[];if(rn.length>0){const an=rn[0].clone(),fn=rn[0].clone();for(let Cr=1;Cr=ot.x&&fn.x<=ht.x&&an.y>=ot.y&&fn.y<=ht.y?[rn]:fn.xht.x||fn.yht.y?[]:u.al([rn],ot.x,ot.y,ht.x,ht.y)}for(const an of qt){nn.reset(an,.25*$e);let fn=0;fn=nn.length<=.5*$e?1:Math.ceil(nn.paddedLength/wn)+1;for(let Cr=0;Cr=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(s,f,d,m){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function si(_,s,f,d,m){const{horizontalAlign:v,verticalAlign:C}=u.at(_);return new u.P(-(v-.5)*s+d[0]*m,-(C-.5)*f+d[1]*m)}function Ji(_,s,f,d,m,v){const{x1:C,x2:T,y1:M,y2:k,anchorPointX:z,anchorPointY:F}=_,X=new u.P(s,f);return d&&X._rotate(m?v:-v),{x1:C+X.x,y1:M+X.y,x2:T+X.x,y2:k+X.y,anchorPointX:z,anchorPointY:F}}class co{constructor(s,f,d,m,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Wt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Sr(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,m){const v=d.getBucket(f),C=d.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const T=d.collisionBoxArray,M=v.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),z=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),X=M.get("text-pitch-alignment")==="map",oe=M.get("text-rotation-alignment")==="map",ie=Ht(d,1,this.transform.zoom),le=Kt(F,X,oe,this.transform,ie);let $=null;if(X){const Fe=ga(F,X,oe,this.transform,ie);$=u.K([],this.transform.labelPlaneMatrix,Fe)}this.retainedQueryData[v.bucketInstanceId]=new sn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const ve={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:le,labelToScreenMatrix:$,scale:k,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const Fe of v.sortKeyRanges){const{sortKey:ue,symbolInstanceStart:Ie,symbolInstanceEnd:Be}=Fe;s.push({sortKey:ue,symbolInstanceStart:Ie,symbolInstanceEnd:Be,parameters:ve})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:ve})}attemptAnchorPlacement(s,f,d,m,v,C,T,M,k,z,F,X,oe,ie,le,$){const ve=u.ap[s.textAnchor],Fe=[s.textOffset0,s.textOffset1],ue=si(ve,d,m,Fe,v),Ie=this.collisionIndex.placeCollisionBox(Ji(f,ue.x,ue.y,C,T,this.transform.angle),F,M,k,z.predicate,$);if((!le||this.collisionIndex.placeCollisionBox(Ji(le,ue.x,ue.y,C,T,this.transform.angle),F,M,k,z.predicate,$).box.length!==0)&&Ie.box.length>0){let Be;if(this.prevPlacement&&this.prevPlacement.variableOffsets[X.crossTileID]&&this.prevPlacement.placements[X.crossTileID]&&this.prevPlacement.placements[X.crossTileID].text&&(Be=this.prevPlacement.variableOffsets[X.crossTileID].anchor),X.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[X.crossTileID]={textOffset:Fe,width:d,height:m,anchor:ve,textBoxScale:v,prevAnchor:Be},this.markUsedJustification(oe,ve,X,ie),oe.allowVerticalPlacement&&(this.markUsedOrientation(oe,ie,X),this.placedOrientations[X.crossTileID]=ie),{shift:ue,placedGlyphBoxes:Ie}}}placeLayerBucketPart(s,f,d){const{bucket:m,layout:v,posMatrix:C,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:X,collisionGroup:oe}=s.parameters,ie=v.get("text-optional"),le=v.get("icon-optional"),$=u.aq(v,"text-overlap","text-allow-overlap"),ve=$==="always",Fe=u.aq(v,"icon-overlap","icon-allow-overlap"),ue=Fe==="always",Ie=v.get("text-rotation-alignment")==="map",Be=v.get("text-pitch-alignment")==="map",Ge=v.get("icon-text-fit")!=="none",He=v.get("symbol-z-order")==="viewport-y",et=ve&&(ue||!m.hasIconData()||le),$e=ue&&(ve||!m.hasTextData()||ie);!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F);const ot=this.retainedQueryData[m.bucketInstanceId].tileID,ht=this.terrain?(pt,Bt)=>this.terrain.getElevation(ot,pt,Bt):null,nn=(pt,Bt)=>{var rn,wn;if(f[pt.crossTileID])return;if(z)return void(this.placements[pt.crossTileID]=new or(!1,!1,!1));let qt=!1,an=!1,fn=!0,Cr=null,Gn={box:null,offscreen:null},Ro={box:null,offscreen:null},ai=null,dr=null,li=null,No=0,Gs=0,Ha=0;Bt.textFeatureIndex?No=Bt.textFeatureIndex:pt.useRuntimeCollisionCircles&&(No=pt.featureIndex),Bt.verticalTextFeatureIndex&&(Gs=Bt.verticalTextFeatureIndex);const gc=Bt.textBox;if(gc){const Kr=Jr=>{let gr=u.ah.horizontal;if(m.allowVerticalPlacement&&!Jr&&this.prevPlacement){const ts=this.prevPlacement.placedOrientations[pt.crossTileID];ts&&(this.placedOrientations[pt.crossTileID]=ts,gr=ts,this.markUsedOrientation(m,gr,pt))}return gr},mr=(Jr,gr)=>{if(m.allowVerticalPlacement&&pt.numVerticalGlyphVertices>0&&Bt.verticalTextBox){for(const ts of m.writingModes)if(ts===u.ah.vertical?(Gn=gr(),Ro=Gn):Gn=Jr(),Gn&&Gn.box&&Gn.box.length)break}else Gn=Jr()},ar=pt.textAnchorOffsetStartIndex,es=pt.textAnchorOffsetEndIndex;if(es===ar){const Jr=(gr,ts)=>{const Qr=this.collisionIndex.placeCollisionBox(gr,$,k,C,oe.predicate,ht);return Qr&&Qr.box&&Qr.box.length&&(this.markUsedOrientation(m,ts,pt),this.placedOrientations[pt.crossTileID]=ts),Qr};mr(()=>Jr(gc,u.ah.horizontal),()=>{const gr=Bt.verticalTextBox;return m.allowVerticalPlacement&&pt.numVerticalGlyphVertices>0&&gr?Jr(gr,u.ah.vertical):{box:null,offscreen:null}}),Kr(Gn&&Gn.box&&Gn.box.length)}else{let Jr=u.ap[(wn=(rn=this.prevPlacement)===null||rn===void 0?void 0:rn.variableOffsets[pt.crossTileID])===null||wn===void 0?void 0:wn.anchor];const gr=(Qr,Rr,Tp)=>{const Nm=Qr.x2-Qr.x1,Ml=Qr.y2-Qr.y1,Al=pt.textBoxScale,Rh=Ge&&Fe==="never"?Rr:null;let Xa={box:[],offscreen:!1},Lp=$==="never"?1:2,Om="never";Jr&&Lp++;for(let Pp=0;Ppgr(gc,Bt.iconBox,u.ah.horizontal),()=>{const Qr=Bt.verticalTextBox;return m.allowVerticalPlacement&&!(Gn&&Gn.box&&Gn.box.length)&&pt.numVerticalGlyphVertices>0&&Qr?gr(Qr,Bt.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Gn&&(qt=Gn.box,fn=Gn.offscreen);const ts=Kr(Gn&&Gn.box);if(!qt&&this.prevPlacement){const Qr=this.prevPlacement.variableOffsets[pt.crossTileID];Qr&&(this.variableOffsets[pt.crossTileID]=Qr,this.markUsedJustification(m,Qr.anchor,pt,ts))}}}if(ai=Gn,qt=ai&&ai.box&&ai.box.length>0,fn=ai&&ai.offscreen,pt.useRuntimeCollisionCircles){const Kr=m.text.placedSymbolArray.get(pt.centerJustifiedTextSymbolIndex),mr=u.ai(m.textSizeData,X,Kr),ar=v.get("text-padding");dr=this.collisionIndex.placeCollisionCircles($,Kr,m.lineVertexArray,m.glyphOffsetArray,mr,C,T,M,d,Be,oe.predicate,pt.collisionCircleDiameter,ar,ht),dr.circles.length&&dr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),qt=ve||dr.circles.length>0&&!dr.collisionDetected,fn=fn&&dr.offscreen}if(Bt.iconFeatureIndex&&(Ha=Bt.iconFeatureIndex),Bt.iconBox){const Kr=mr=>{const ar=Ge&&Cr?Ji(mr,Cr.x,Cr.y,Ie,Be,this.transform.angle):mr;return this.collisionIndex.placeCollisionBox(ar,Fe,k,C,oe.predicate,ht)};Ro&&Ro.box&&Ro.box.length&&Bt.verticalIconBox?(li=Kr(Bt.verticalIconBox),an=li.box.length>0):(li=Kr(Bt.iconBox),an=li.box.length>0),fn=fn&&li.offscreen}const Za=ie||pt.numHorizontalGlyphVertices===0&&pt.numVerticalGlyphVertices===0,qs=le||pt.numIconVertices===0;if(Za||qs?qs?Za||(an=an&&qt):qt=an&&qt:an=qt=an&&qt,qt&&ai&&ai.box&&this.collisionIndex.insertCollisionBox(ai.box,$,v.get("text-ignore-placement"),m.bucketInstanceId,Ro&&Ro.box&&Gs?Gs:No,oe.ID),an&&li&&this.collisionIndex.insertCollisionBox(li.box,Fe,v.get("icon-ignore-placement"),m.bucketInstanceId,Ha,oe.ID),dr&&(qt&&this.collisionIndex.insertCollisionCircles(dr.circles,$,v.get("text-ignore-placement"),m.bucketInstanceId,No,oe.ID),d)){const Kr=m.bucketInstanceId;let mr=this.collisionCircleArrays[Kr];mr===void 0&&(mr=this.collisionCircleArrays[Kr]=new Xr);for(let ar=0;ar=0;--Bt){const rn=pt[Bt];nn(m.symbolInstances.get(rn),m.collisionArrays[rn])}}else for(let pt=s.symbolInstanceStart;pt=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const m=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,C=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of C)s.text.placedSymbolArray.get(T).placedOrientation=m;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let d=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const m=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},T=f?f.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],z=v[M];z?(this.opacities[M]=new Wn(z,m,k.text,k.icon),d=d||k.text!==z.text.placed||k.icon!==z.icon.placed):(this.opacities[M]=new Wn(null,m,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in v){const k=v[M];if(!this.opacities[M]){const z=new Wn(k,m,!1,!1);z.isHidden()||(this.opacities[M]=z,d=d||k.text.placed||k.icon.placed)}}for(const M in C)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=C[M]);for(const M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.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=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const m of f){const v=m.getBucket(s);v&&m.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,m.collisionBoxArray)}}updateBucketOpacities(s,f,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 m=s.layers[0],v=m.layout,C=new Wn(null,0,!1,!1,!0),T=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",X=v.get("icon-text-fit")!=="none",oe=new Wn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const ie=(le,$,ve)=>{for(let Fe=0;Fe<$/4;Fe++)le.opacityVertexArray.emplaceBack(ve);le.hasVisibleVertices=le.hasVisibleVertices||ve!==Xu};for(let le=0;le0,Ge=this.placedOrientations[$.crossTileID],He=Ge===u.ah.vertical,et=Ge===u.ah.horizontal||Ge===u.ah.horizontalOnly;if(ve>0||Fe>0){const $e=ho(Ie.text);ie(s.text,ve,He?Xu:$e),ie(s.text,Fe,et?Xu:$e);const ot=Ie.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(pt=>{pt>=0&&(s.text.placedSymbolArray.get(pt).hidden=ot||He?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=ot||et?1:0);const ht=this.variableOffsets[$.crossTileID];ht&&this.markUsedJustification(s,ht.anchor,$,Ge);const nn=this.placedOrientations[$.crossTileID];nn&&(this.markUsedJustification(s,"left",$,nn),this.markUsedOrientation(s,nn,$))}if(Be){const $e=ho(Ie.icon),ot=!(X&&$.verticalPlacedIconSymbolIndex&&He);$.placedIconSymbolIndex>=0&&(ie(s.icon,$.numIconVertices,ot?$e:Xu),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Ie.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(ie(s.icon,$.numVerticalIconVertices,ot?Xu:$e),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Ie.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $e=s.collisionArrays[le];if($e){let ot=new u.P(0,0);if($e.textBox||$e.verticalTextBox){let nn=!0;if(k){const pt=this.variableOffsets[ue];pt?(ot=si(pt.anchor,pt.width,pt.height,pt.textOffset,pt.textBoxScale),z&&ot._rotate(F?this.transform.angle:-this.transform.angle)):nn=!1}$e.textBox&&vi(s.textCollisionBox.collisionVertexArray,Ie.text.placed,!nn||He,ot.x,ot.y),$e.verticalTextBox&&vi(s.textCollisionBox.collisionVertexArray,Ie.text.placed,!nn||et,ot.x,ot.y)}const ht=!!(!et&&$e.verticalIconBox);$e.iconBox&&vi(s.iconCollisionBox.collisionVertexArray,Ie.icon.placed,ht,X?ot.x:0,X?ot.y:0),$e.verticalIconBox&&vi(s.iconCollisionBox.collisionVertexArray,Ie.icon.placed,!ht,X?ot.x:0,X?ot.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 le=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=le.invProjMatrix,s.placementViewportMatrix=le.viewportMatrix,s.collisionCircleArray=le.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 vi(_,s,f,d,m){_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0)}const zs=Math.pow(2,25),Qd=Math.pow(2,24),Vy=Math.pow(2,17),Vn=Math.pow(2,16),Yf=Math.pow(2,9),Kf=Math.pow(2,8),Ao=Math.pow(2,1);function ho(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*zs+s*Qd+f*Vy+s*Vn+f*Yf+s*Kf+f*Ao+s}const Xu=0;class Qo{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,f,d,m,v){const C=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-m>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=T)&&(!C.maxzoom||C.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Qo(C)),this._inProgressLayer.continuePlacement(d[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const iu=512/u.W/2;class Yc{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(M.anchorX*iu),y:Math.floor(M.anchorY*iu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:k,y:z}of T.positions)M.add(k,z);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:m,z:v}=this.tileID.canonical,{x:C,y:T,z:M}=f.canonical,k=iu/Math.pow(2,M-v),z=(T*u.W+s.anchorY)*k,F=m*u.W*iu;return{x:Math.floor((C*u.W+s.anchorX)*k-d*u.W*iu),y:Math.floor(z-F)}}findMatches(s,f,d){const m=this.tileID.canonical.zs)}}class Yr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const d in this.indexes){const m=this.indexes[d],v={};for(const C in m){const T=m[C];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in C){const M=C[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,m)}else{const T=C[s.scaledTo(Number(v)).key];T&&T.findMatches(f.symbolInstances,s,m)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const pr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Kc=u.av();class ko extends u.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const m=this.sourceCaches[d].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new xr(An(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,m)=>this.getGlyphs(d,m)),this.dispatcher.registerMessageHandler("GI",(d,m)=>this.getImages(d,m)),this.imageManager=new Ke,this.imageManager.setEventedParent(this),this.glyphManager=new qe(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Gt(256,512),this.crossTileSymbolIndex=new Va,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),rt().on(Pi,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.sourceCaches[d.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const T=this._layers[C];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Kc,{validate:!1})}_load(s,f,d){var m;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!pr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new un(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,T,M){return u._(this,void 0,void 0,function*(){const k=Ce(v),z=T>1?"@2x":"",F={},X={};for(const{id:oe,url:ie}of k){const le=C.transformRequest(C.normalizeSpriteURL(ie,z,".json"),"SpriteJSON");F[oe]=u.h(le,M);const $=C.transformRequest(C.normalizeSpriteURL(ie,z,".png"),"SpriteImage");X[oe]=j.getImage($,M)}return yield Promise.all([...Object.values(F),...Object.values(X)]),function(oe,ie){return u._(this,void 0,void 0,function*(){const le={};for(const $ in oe){le[$]={};const ve=I.getImageCanvasContext((yield ie[$]).data),Fe=(yield oe[$]).data;for(const ue in Fe){const{width:Ie,height:Be,x:Ge,y:He,sdf:et,pixelRatio:$e,stretchX:ot,stretchY:ht,content:nn}=Fe[ue];le[$][ue]={data:null,pixelRatio:$e,sdf:et,stretchX:ot,stretchY:ht,content:nn,spriteData:{width:Ie,height:Be,x:Ge,y:He,context:ve}}}}return le})}(F,X)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const T=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const k=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,v[C][M],!1):this.imageManager.addImage(k,v[C][M]),f&&(this._changedImages[k]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new u.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(m)})}_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("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const m=f.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${m.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 f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const m of s)f[m]&&d.push(f[m]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const d of f){const m=this._layers[d];m.type!=="custom"&&(s[d]=m.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 f=this._changed;if(f){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const C in this._updatedSources){const T=this._updatedSources[C];if(T==="reload")this._reloadSource(C);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];d[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in d){const v=this.sourceCaches[m];!!d[m]!=!!v.used&&v.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].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,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const m=this.serialize();if(s=f.transformStyle?f.transformStyle(m,s):s,((d=f.validate)===null||d===void 0||d)&&pr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.aB(m,s),C=this._getOperationsToPerform(v);if(C.unimplemented.length>0)throw new Error(`Unimplemented: ${C.unimplemented.join(", ")}.`);if(C.operations.length===0)return!1;for(const T of C.operations)T();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":f.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":f.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":f.push(()=>{});break;default:d.push(m.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.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("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Zr(s,f,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.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 u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){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(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new u.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(s.type==="custom"){if(pr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=u.aA(s),s=u.e(s,{source:m})),this._validate(u.x.layer,`layers.${m}`,s,{arrayIndex:-1},d))return;v=u.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new u.j(new Error(`Cannot add layer "${m}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const T=this._removedLayers[m];delete this._removedLayers[m],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const m=f?this._order.indexOf(f):this._order.length;f&&m===-1?this.fire(new u.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===f&&m.maxzoom===d||(f!=null&&(m.minzoom=f),d!=null&&(m.maxzoom=d),this._updateLayer(m)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!u.aD(m.filter,f))return f==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(u.x.filter,`layers.${m.id}.filter`,f,null,d)||(m.filter=u.aA(f),this._updateLayer(m)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,m),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,m=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&m?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||m?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,m=this.sourceCaches[d];if(m===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=m.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(C,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,m=this.sourceCaches[f];if(m!==void 0)return m.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,m=this.stylesheet;return u.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:f,terrain:d},v=>v!==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 f=C=>this._layers[C].type==="fill-extrusion",d={},m=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T)){d[T]=C;for(const M of s){const k=M[T];if(k)for(const z of k)m.push(z)}}}m.sort((C,T)=>T.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T))for(let M=m.length-1;M>=0;M--){const k=m[M].feature;if(d[k.layer.id]{const et=ve.featureSortOrder;if(et){const $e=et.indexOf(Ge.featureIndex);return et.indexOf(He.featureIndex)-$e}return He.featureIndex-Ge.featureIndex});for(const Ge of Be)Ie.push(Ge)}}for(const ve in ie)ie[ve].forEach(Fe=>{const ue=Fe.feature,Ie=k[T[ve].source].getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=Ie});return ie}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(m,v){const C=m.getRenderableIds().map(k=>m.getTileByID(k)),T=[],M={};for(let k=0;kX.getTileByID(oe)).sort((oe,ie)=>ie.tileID.overscaledZ-oe.tileID.overscaledZ||(oe.tileID.isLessThan(ie.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(z,M[z.source],s.center.lng);C=C||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new $o(s,this.map.terrain,this._order,v,f,d,m,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(I.now()),T=!0),C&&this.pauseablePlacement.placement.setStale()),T||C)for(const k of this._order){const z=this._layers[k];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(I.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},m){this._checkLoaded();const v=[{id:s,url:f}],C=[...Ce(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",C,null,d)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,m))}removeSprite(s){this._checkLoaded();const f=Ce(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ce(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var Jc=u.X([{name:"a_pos",type:"Int16",components:2}]),Fs="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 Ku={prelude:Un(`#ifdef GL_ES -precision mediump float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -`,`#ifdef GL_ES -precision highp float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 -);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} -#ifdef TERRAIN3D -uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; -#endif -const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { -#ifdef TERRAIN3D -highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); -#else -return 1.0; -#endif -}float calculate_visibility(vec4 pos) { -#ifdef TERRAIN3D -vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; -#else -return 1.0; -#endif -}float ele(vec2 pos) { -#ifdef TERRAIN3D -vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; -#else -return 0.0; -#endif -}float get_elevation(vec2 pos) { -#ifdef TERRAIN3D -vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; -#else -return 0.0; -#endif -}`),background:Un(`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:Un(`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:Un(`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 -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;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 -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main(void) { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#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:Un("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:Un(`uniform highp float u_intensity;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#define GAUSS_COEF 0.3989422804014327 -void main() { -#pragma mapbox: initialize highp float weight -float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#pragma mapbox: define mediump float radius -const highp float ZERO=1.0/255.0/16.0; -#define GAUSS_COEF 0.3989422804014327 -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:Un(`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:Un("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:Un("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:Un("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:Un(`#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_FragColor=color*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Un(`varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -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:Un(`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 -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;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 -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#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:Un(`#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; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#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:Un(`varying vec4 v_color;void main() {gl_FragColor=v_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec4 v_color; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -vec3 normal=a_normal_ed.xyz; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#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:Un(`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 -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -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 -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#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;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#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);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:Un(`#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:Un(`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:Un(`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 -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -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:Un(`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() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -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:Un(`#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; -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -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:Un(`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 -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;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 -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -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:Un(`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:Un(`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 -lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -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:Un(`#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 -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#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:Un(`#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; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#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:Un("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Fs),terrainDepth:Un("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);}",Fs),terrainCoords:Un("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);}",Fs)};function Un(_,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),m=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(m):m,T={};return{fragmentSource:_=_.replace(f,(M,k,z,F,X)=>(T[X]=!0,k==="define"?` -#ifndef HAS_UNIFORM_u_${X} -varying ${z} ${F} ${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:` -#ifdef HAS_UNIFORM_u_${X} - ${z} ${F} ${X} = u_${X}; -#endif -`)),vertexSource:s=s.replace(f,(M,k,z,F,X)=>{const oe=F==="float"?"vec2":"vec4",ie=X.match(/color/)?"color":oe;return T[X]?k==="define"?` -#ifndef HAS_UNIFORM_u_${X} -uniform lowp float u_${X}_t; -attribute ${z} ${oe} a_${X}; -varying ${z} ${F} ${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:ie==="vec4"?` -#ifndef HAS_UNIFORM_u_${X} - ${X} = a_${X}; -#else - ${z} ${F} ${X} = u_${X}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${X} - ${X} = unpack_mix_${ie}(a_${X}, u_${X}_t); -#else - ${z} ${F} ${X} = u_${X}; -#endif -`:k==="define"?` -#ifndef HAS_UNIFORM_u_${X} -uniform lowp float u_${X}_t; -attribute ${z} ${oe} a_${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:ie==="vec4"?` -#ifndef HAS_UNIFORM_u_${X} - ${z} ${F} ${X} = a_${X}; -#else - ${z} ${F} ${X} = u_${X}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${X} - ${z} ${F} ${X} = unpack_mix_${ie}(a_${X}, u_${X}_t); -#else - ${z} ${F} ${X} = u_${X}; -#endif -`}),staticAttributes:d,staticUniforms:C}}class Qc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,d,m,v,C,T,M,k){this.context=s;let z=this.boundPaintVertexBuffers.length!==m.length;for(let F=0;!z&&F({u_depth:new u.aG(Ge,He.u_depth),u_terrain:new u.aG(Ge,He.u_terrain),u_terrain_dim:new u.aH(Ge,He.u_terrain_dim),u_terrain_matrix:new u.aI(Ge,He.u_terrain_matrix),u_terrain_unpack:new u.aJ(Ge,He.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Ge,He.u_terrain_exaggeration)}))(s,Be),this.binderUniforms=d?d.getUniforms(s,Be):[]}draw(s,f,d,m,v,C,T,M,k,z,F,X,oe,ie,le,$,ve,Fe){const ue=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(m),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(ue.TEXTURE2),ue.bindTexture(ue.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ue.TEXTURE3),ue.bindTexture(ue.TEXTURE_2D,M.texture);for(const Be in this.terrainUniforms)this.terrainUniforms[Be].set(M[Be])}for(const Be in this.fixedUniforms)this.fixedUniforms[Be].set(T[Be]);le&&le.setUniforms(s,this.binderUniforms,oe,{zoom:ie});let Ie=0;switch(f){case ue.LINES:Ie=2;break;case ue.TRIANGLES:Ie=3;break;case ue.LINE_STRIP:Ie=1}for(const Be of X.get()){const Ge=Be.vaos||(Be.vaos={});(Ge[k]||(Ge[k]=new Qc)).bind(s,this,z,le?le.getPaintVertexBuffers():[],F,Be.vertexOffset,$,ve,Fe),ue.drawElements(f,Be.primitiveLength*Ie,ue.UNSIGNED_SHORT,Be.primitiveOffset*Ie*2)}}}function $c(_,s,f){const d=1/Ht(f,1,s.transform.tileZoom),m=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/m,C=v*(f.tileID.canonical.x+f.tileID.wrap*m),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[C>>16,T>>16],u_pixel_coord_lower:[65535&C,65535&T]}}const Ju=(_,s,f,d)=>{const m=s.style.light,v=m.properties.get("position"),C=[v.x,v.y,v.z],T=function(){var k=new u.A(9);return u.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}();m.properties.get("anchor")==="viewport"&&function(k,z){var F=Math.sin(z),X=Math.cos(z);k[0]=X,k[1]=F,k[2]=0,k[3]=-F,k[4]=X,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(T,-s.transform.angle),function(k,z,F){var X=z[0],oe=z[1],ie=z[2];k[0]=X*F[0]+oe*F[3]+ie*F[6],k[1]=X*F[1]+oe*F[4]+ie*F[7],k[2]=X*F[2]+oe*F[5]+ie*F[8]}(C,C,T);const M=m.properties.get("color");return{u_matrix:_,u_lightpos:C,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},Uy=(_,s,f,d,m,v,C)=>u.e(Ju(_,s,f,d),$c(v,s,C),{u_height_factor:-Math.pow(2,m.overscaledZ)/C.tileSize/8}),$d=_=>({u_matrix:_}),eh=(_,s,f,d)=>u.e($d(_),$c(f,s,d)),Gy=(_,s)=>({u_matrix:_,u_world:s}),em=(_,s,f,d,m)=>u.e(eh(_,s,f,d),{u_world:m}),qy=(_,s,f,d)=>{const m=_.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const T=Ht(f,1,m.zoom);v=!0,C=[T,T]}else v=!1,C=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:C}},tm=(_,s,f)=>{const d=Ht(f,1,s.zoom),m=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*m),s.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:v}},nm=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),th=_=>({u_matrix:_}),rm=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:Ht(s,1,f),u_intensity:d});function im(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const nh=(_,s,f,d)=>{const m=_.transform;return{u_matrix:Qu(_,s,f,d),u_ratio:1/Ht(s,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},om=(_,s,f,d,m)=>u.e(nh(_,s,f,m),{u_image:0,u_image_height:d}),wl=(_,s,f,d,m)=>{const v=_.transform,C=Do(s,v);return{u_matrix:Qu(_,s,f,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Ht(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[C,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},rh=(_,s,f,d,m,v)=>{const C=_.lineAtlas,T=Do(s,_.transform),M=f.layout.get("line-cap")==="round",k=C.getDash(d.from,M),z=C.getDash(d.to,M),F=k.width*m.fromScale,X=z.width*m.toScale;return u.e(nh(_,s,f,v),{u_patternscale_a:[T/F,-k.height/2],u_patternscale_b:[T/X,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,X)*_.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:z.y,u_mix:m.t})};function Do(_,s){return 1/Ht(_,1,s.tileZoom)}function Qu(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const ih=(_,s,f,d,m)=>{return{u_matrix:_,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(C=m.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:$u(m.paint.get("raster-hue-rotate"))};var v,C};function $u(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const ec=(_,s,f,d,m,v,C,T,M,k)=>{const z=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},tc=(_,s,f,d,m,v,C,T,M,k,z)=>{const F=m.transform;return u.e(ec(_,s,f,d,m,v,C,T,M,k),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+z})},nc=(_,s,f,d,m,v,C,T,M,k)=>u.e(tc(_,s,f,d,m,v,C,T,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),jy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),Wy=(_,s,f,d,m,v)=>u.e(function(C,T,M,k){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:X,height:oe}=M.imageManager.getPixelSize(),ie=Math.pow(2,k.tileID.overscaledZ),le=k.tileSize*Math.pow(2,M.transform.tileZoom)/ie,$=le*(k.tileID.canonical.x+k.tileID.wrap*ie),ve=le*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[X,oe],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/Ht(k,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,ve>>16],u_pixel_coord_lower:[65535&$,65535&ve]}}(d,v,f,m),{u_matrix:_,u_opacity:s}),sm={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Hy{constructor(s,f,d){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Sl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class oh{constructor(s,f,d,m){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=m,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.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 f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let d=0;d0){const ot=u.F(),ht=He;u.aP(ot,Ge.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(ot,ot,Ge.placementViewportMatrix),z.push({circleArray:$e,circleOffset:X,transform:ht,invTransform:ot,coord:Ie}),F+=$e.length/4,X=F}et&&k.draw(T,M.LINES,xn.disabled,nr.disabled,_.colorModeForRenderPass(),Jn.disabled,tm(He,_.transform,Be),_.style.map.terrain&&_.style.map.terrain.getTerrainData(Ie),f.id,et.layoutVertexBuffer,et.indexBuffer,et.segments,null,_.transform.zoom,null,null,et.collisionVertexBuffer)}if(!C||!z.length)return;const oe=_.useProgram("collisionCircle"),ie=new u.aQ;ie.resize(4*F),ie._trim();let le=0;for(const ue of z)for(let Ie=0;Ie=0&&(ie[$.associatedIconIndex]={shiftedAnchor:nn,angle:pt})}else Xe($.numGlyphs,X)}if(k){oe.clear();const le=_.icon.placedSymbolArray;for(let $=0;$_.style.map.terrain.getElevation(et,ts,Qr):null,gr=f.layout.get("text-rotation-alignment")==="map";G(ot,et.posMatrix,_,m,No,Gs,$,k,gr,Jr)}const Za=_.translatePosMatrix(et.posMatrix,$e,v,C),qs=ve||m&&Ge||gc?ap:No,Kr=_.translatePosMatrix(Gs,$e,v,C,!0),mr=pt&&f.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ar;ar=pt?ot.iconsInText?nc(Bt.kind,qt,Fe,$,_,Za,qs,Kr,fn,ai):tc(Bt.kind,qt,Fe,$,_,Za,qs,Kr,m,fn,!0):ec(Bt.kind,qt,Fe,$,_,Za,qs,Kr,m,fn);const es={program:wn,buffers:ht,uniformValues:ar,atlasTexture:Cr,atlasTextureIcon:dr,atlasInterpolation:Gn,atlasInterpolationIcon:Ro,isSDF:pt,hasHalo:mr};if(ue&&ot.canOverlap){Ie=!0;const Jr=ht.segments.get();for(const gr of Jr)He.push({segments:new u.$([gr]),sortKey:gr.sortKey,state:es,terrainData:an})}else He.push({segments:ht.segments,sortKey:0,state:es,terrainData:an})}Ie&&He.sort((et,$e)=>et.sortKey-$e.sortKey);for(const et of He){const $e=et.state;if(X.activeTexture.set(oe.TEXTURE0),$e.atlasTexture.bind($e.atlasInterpolation,oe.CLAMP_TO_EDGE),$e.atlasTextureIcon&&(X.activeTexture.set(oe.TEXTURE1),$e.atlasTextureIcon&&$e.atlasTextureIcon.bind($e.atlasInterpolationIcon,oe.CLAMP_TO_EDGE)),$e.isSDF){const ot=$e.uniformValues;$e.hasHalo&&(ot.u_is_halo=1,mm($e.buffers,et.segments,f,_,$e.program,Be,z,F,ot,et.terrainData)),ot.u_is_halo=0}mm($e.buffers,et.segments,f,_,$e.program,Be,z,F,$e.uniformValues,et.terrainData)}}function mm(_,s,f,d,m,v,C,T,M,k){const z=d.context;m.draw(z,z.gl.TRIANGLES,v,C,T,Jn.disabled,M,k,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function gh(_,s,f,d,m){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],T=v[f.from.toString()];if(!C&&T&&(C=T),!T&&C&&(T=C),!C||!T){const M=m.getPaintProperty(s);C=v[M],T=v[M]}C&&T&&_.setConstantPatternPositions(C,T)}function gm(_,s,f,d,m,v,C){const T=_.context.gl,M="fill-pattern",k=f.paint.get(M),z=k&&k.constantOr(1),F=f.getCrossfadeParameters();let X,oe,ie,le,$;C?(oe=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",X=T.LINES):(oe=z?"fillPattern":"fill",X=T.TRIANGLES);const ve=k.constantOr(null);for(const Fe of d){const ue=s.getTile(Fe);if(z&&!ue.patternsLoaded())continue;const Ie=ue.getBucket(f);if(!Ie)continue;const Be=Ie.programConfigurations.get(f.id),Ge=_.useProgram(oe,Be),He=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Fe);z&&(_.context.activeTexture.set(T.TEXTURE0),ue.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Be.updatePaintBuffers(F)),gh(Be,M,ve,ue,f);const et=He?Fe:null,$e=_.translatePosMatrix(et?et.posMatrix:Fe.posMatrix,ue,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){le=Ie.indexBuffer2,$=Ie.segments2;const ot=[T.drawingBufferWidth,T.drawingBufferHeight];ie=oe==="fillOutlinePattern"&&z?em($e,_,F,ue,ot):Gy($e,ot)}else le=Ie.indexBuffer,$=Ie.segments,ie=z?eh($e,_,F,ue):$d($e);Ge.draw(_.context,X,m,_.stencilModeForClipping(Fe),v,Jn.disabled,ie,He,f.id,Ie.layoutVertexBuffer,le,$,f.paint,_.transform.zoom,Be)}}function yh(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k="fill-extrusion-pattern",z=f.paint.get(k),F=z.constantOr(1),X=f.getCrossfadeParameters(),oe=f.paint.get("fill-extrusion-opacity"),ie=z.constantOr(null);for(const le of d){const $=s.getTile(le),ve=$.getBucket(f);if(!ve)continue;const Fe=_.style.map.terrain&&_.style.map.terrain.getTerrainData(le),ue=ve.programConfigurations.get(f.id),Ie=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ue);F&&(_.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ue.updatePaintBuffers(X)),gh(ue,k,ie,$,f);const Be=_.translatePosMatrix(le.posMatrix,$,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ge=f.paint.get("fill-extrusion-vertical-gradient"),He=F?Uy(Be,_,Ge,oe,le,X,$):Ju(Be,_,Ge,oe);Ie.draw(T,T.gl.TRIANGLES,m,v,C,Jn.backCCW,He,Fe,f.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,f.paint,_.transform.zoom,ue,_.style.map.terrain&&ve.centroidVertexBuffer)}}function _h(_,s,f,d,m,v,C){const T=_.context,M=T.gl,k=f.fbo;if(!k)return;const z=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),z.draw(T,M.TRIANGLES,m,v,C,Jn.disabled,((X,oe,ie,le)=>{const $=ie.paint.get("hillshade-shadow-color"),ve=ie.paint.get("hillshade-highlight-color"),Fe=ie.paint.get("hillshade-accent-color");let ue=ie.paint.get("hillshade-illumination-direction")*(Math.PI/180);ie.paint.get("hillshade-illumination-anchor")==="viewport"&&(ue-=X.transform.angle);const Ie=!X.options.moving;return{u_matrix:le?le.posMatrix:X.transform.calculatePosMatrix(oe.tileID.toUnwrapped(),Ie),u_image:0,u_latrange:im(0,oe.tileID),u_light:[ie.paint.get("hillshade-exaggeration"),ue],u_shadow:$,u_highlight:ve,u_accent:Fe}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function lp(_,s,f,d,m,v){const C=_.context,T=C.gl,M=s.dem;if(M&&M.data){const k=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(T.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(z),s.demTexture){const oe=s.demTexture;oe.update(F,{premultiply:!1}),oe.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new H(C,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);C.activeTexture.set(T.TEXTURE0);let X=s.fbo;if(!X){const oe=new H(C,{width:k,height:k,data:null},T.RGBA);oe.bind(T.LINEAR,T.CLAMP_TO_EDGE),X=s.fbo=C.createFramebuffer(k,k,!0,!1),X.colorAttachment.set(oe.texture)}C.bindFramebuffer.set(X.framebuffer),C.viewport.set([0,0,k,k]),_.useProgram("hillshadePrepare").draw(C,T.TRIANGLES,d,m,v,Jn.disabled,((oe,ie)=>{const le=ie.stride,$=u.F();return u.aN($,0,u.W,-u.W,0,0,1),u.H($,$,[0,-u.W,0]),{u_matrix:$,u_image:1,u_dimension:[le,le],u_zoom:oe.overscaledZ,u_unpack:ie.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function ym(_,s,f,d,m,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const T=I.now(),M=(T-_.timeAdded)/C,k=s?(T-s.timeAdded)/C:-1,z=f.getSource(),F=m.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),X=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),oe=X&&_.refreshedUponExpiration?1:u.ac(X?M:1-k,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-oe}:{opacity:oe,mix:0}}return{opacity:1,mix:0}}const _m=new u.aO(1,0,0,1),vh=new u.aO(0,1,0,1),up=new u.aO(0,0,1,1),t_=new u.aO(1,0,1,1),vm=new u.aO(0,1,1,1);function Er(_,s,f,d){$i(_,0,s+f/2,_.transform.width,f,d)}function Ga(_,s,f,d){$i(_,s-f/2,0,f,_.transform.height,d)}function $i(_,s,f,d,m,v){const C=_.context,T=C.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),C.clear({color:v}),T.disable(T.SCISSOR_TEST)}function cp(_,s,f){const d=_.context,m=d.gl,v=f.posMatrix,C=_.useProgram("debug"),T=xn.disabled,M=nr.disabled,k=_.colorModeForRenderPass(),z="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(m.TEXTURE0);const X=s.getTileByID(f.key).latestRawTileData,oe=Math.floor((X&&X.byteLength||0)/1024),ie=s.getTile(f).tileSize,le=512/Math.min(ie,512)*(f.overscaledZ/_.transform.zoom)*.5;let $=f.canonical.toString();f.overscaledZ!==f.canonical.z&&($+=` => ${f.overscaledZ}`),function(ve,Fe){ve.initDebugOverlayCanvas();const ue=ve.debugOverlayCanvas,Ie=ve.context.gl,Be=ve.debugOverlayCanvas.getContext("2d");Be.clearRect(0,0,ue.width,ue.height),Be.shadowColor="white",Be.shadowBlur=2,Be.lineWidth=1.5,Be.strokeStyle="white",Be.textBaseline="top",Be.font="bold 36px Open Sans, sans-serif",Be.fillText(Fe,5,5),Be.strokeText(Fe,5,5),ve.debugOverlayTexture.update(ue),ve.debugOverlayTexture.bind(Ie.LINEAR,Ie.CLAMP_TO_EDGE)}(_,`${$} ${oe}kB`),C.draw(d,m.TRIANGLES,T,M,Br.alphaBlended,Jn.disabled,nm(v,u.aO.transparent,le),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),C.draw(d,m.LINE_STRIP,T,M,k,Jn.disabled,nm(v,u.aO.red),F,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function bh(_,s,f){const d=_.context,m=d.gl,v=_.colorModeForRenderPass(),C=new xn(m.LEQUAL,xn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const k of f){const z=_.renderToTexture.getTexture(k),F=s.getTerrainData(k.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,z.texture);const X={u_matrix:_.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,m.TRIANGLES,C,nr.disabled,v,Jn.backCCW,X,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class bm{constructor(s,f){this.context=new e_(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Zr.maxUnderzooming+Zr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Va}resize(s,f,d){if(this.width=Math.floor(s*d),this.height=Math.floor(f*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,f=new u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,Jc.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,Jc.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const m=new u.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(u.W,0,u.W,0),m.emplaceBack(0,u.W,0,u.W),m.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(m,ln.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Jc.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const C=new u.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new nr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,xn.disabled,this.stencilClearMode,Br.disabled,Jn.disabled,th(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const d=this.context,m=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Br.disabled),d.setDepthMode(xn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const T=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,m.TRIANGLES,xn.disabled,new nr({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),Br.disabled,Jn.disabled,th(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new nr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new nr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((C,T)=>T.overscaledZ-C.overscaledZ),m=d[d.length-1].overscaledZ,v=d[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let T=0;T=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=m[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,k,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(z)?[k.sourceCaches[$.source]]:[]),oe=X.filter($=>$.getSource().type==="vector"),ie=X.filter($=>$.getSource().type!=="vector"),le=$=>{(!F||F.getSource().maxzoom<$.getSource().maxzoom)&&(F=$)};return oe.forEach($=>le($)),F||ie.forEach($=>le($)),F}(this.style,this.transform.zoom);M&&function(k,z,F){for(let X=0;X0),m&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const T=v.context,M=T.gl,k=Br.unblended,z=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),X=C.sourceCache.getRenderableTiles(),oe=v.useProgram("terrainDepth");T.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const ie of X){const le=C.getTerrainData(ie.tileID),$={u_matrix:v.transform.calculatePosMatrix(ie.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};oe.draw(T,M.TRIANGLES,z,nr.disabled,k,Jn.backCCW,$,le,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const T=v.context,M=T.gl,k=Br.unblended,z=new xn(M.LEQUAL,xn.ReadWrite,[0,1]),F=C.getTerrainMesh(),X=C.getCoordsTexture(),oe=C.sourceCache.getRenderableTiles(),ie=v.useProgram("terrainCoords");T.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),C.coordsIndex=[];for(const le of oe){const $=C.getTerrainData(le.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,X.texture);const ve={u_matrix:v.transform.calculatePosMatrix(le.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ie.draw(T,M.TRIANGLES,z,nr.disabled,k,Jn.backCCW,ve,$,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(le.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,C,T,M,k){if(v.renderPass!=="translucent")return;const z=nr.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(X,oe,ie,le,$,ve,Fe){const ue=oe.transform,Ie=$==="map",Be=ve==="map";for(const Ge of X){const He=le.getTile(Ge),et=He.getBucket(ie);if(!et||!et.text||!et.text.segments.get().length)continue;const $e=u.ag(et.textSizeData,ue.zoom),ot=Ht(He,1,oe.transform.zoom),ht=Kt(Ge.posMatrix,Be,Ie,oe.transform,ot),nn=ie.layout.get("icon-text-fit")!=="none"&&et.hasIconData();if($e){const pt=Math.pow(2,ue.zoom-He.tileID.overscaledZ);ph(et,Ie,Be,Fe,ue,ht,Ge.posMatrix,pt,$e,nn,oe.style.map.terrain?(Bt,rn)=>oe.style.map.terrain.getElevation(Ge,Bt,rn):null)}}}(M,v,T,C,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),k),T.paint.get("icon-opacity").constantOr(1)!==0&&mh(v,C,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),z,F),T.paint.get("text-opacity").constantOr(1)!==0&&mh(v,C,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(fh(v,C,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),fh(v,C,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,m,this.style.placement.variableOffsets);break;case"circle":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("circle-opacity"),z=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),X=!T.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const oe=v.context,ie=oe.gl,le=v.depthModeForSublayer(0,xn.ReadOnly),$=nr.disabled,ve=v.colorModeForRenderPass(),Fe=[];for(let ue=0;ueue.sortKey-Ie.sortKey);for(const ue of Fe){const{programConfiguration:Ie,program:Be,layoutVertexBuffer:Ge,indexBuffer:He,uniformValues:et,terrainData:$e}=ue.state;Be.draw(oe,ie.TRIANGLES,le,$,ve,Jn.disabled,et,$e,T.id,Ge,He,ue.segments,T.paint,v.transform.zoom,Ie)}})(s,f,d,m);break;case"heatmap":(function(v,C,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const k=v.context,z=k.gl,F=nr.disabled,X=new Br([z.ONE,z.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(oe,ie,le){const $=oe.gl;oe.activeTexture.set($.TEXTURE1),oe.viewport.set([0,0,ie.width/4,ie.height/4]);let ve=le.heatmapFbo;if(ve)$.bindTexture($.TEXTURE_2D,ve.colorAttachment.get()),oe.bindFramebuffer.set(ve.framebuffer);else{const Fe=$.createTexture();$.bindTexture($.TEXTURE_2D,Fe),$.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),ve=le.heatmapFbo=oe.createFramebuffer(ie.width/4,ie.height/4,!1,!1),function(ue,Ie,Be,Ge){var He,et;const $e=ue.gl,ot=(He=ue.HALF_FLOAT)!==null&&He!==void 0?He:$e.UNSIGNED_BYTE,ht=(et=ue.RGBA16F)!==null&&et!==void 0?et:$e.RGBA;$e.texImage2D($e.TEXTURE_2D,0,ht,Ie.width/4,Ie.height/4,0,$e.RGBA,ot,null),Ge.colorAttachment.set(Be)}(oe,ie,Fe,ve)}})(k,v,T),k.clear({color:u.aO.transparent});for(let oe=0;oe{const ue=u.F();u.aN(ue,0,le.width,le.height,0,0,1);const Ie=le.context.gl;return{u_matrix:ue,u_world:[Ie.drawingBufferWidth,Ie.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(k,z),null,z.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,z.paint,k.transform.zoom)}(v,T))})(s,f,d,m);break;case"line":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("line-opacity"),z=T.paint.get("line-width");if(k.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,xn.ReadOnly),X=v.colorModeForRenderPass(),oe=T.paint.get("line-dasharray"),ie=T.paint.get("line-pattern"),le=ie.constantOr(1),$=T.paint.get("line-gradient"),ve=T.getCrossfadeParameters(),Fe=le?"linePattern":oe?"lineSDF":$?"lineGradient":"line",ue=v.context,Ie=ue.gl;let Be=!0;for(const Ge of M){const He=C.getTile(Ge);if(le&&!He.patternsLoaded())continue;const et=He.getBucket(T);if(!et)continue;const $e=et.programConfigurations.get(T.id),ot=v.context.program.get(),ht=v.useProgram(Fe,$e),nn=Be||ht.program!==ot,pt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ge),Bt=ie.constantOr(null);if(Bt&&He.imageAtlas){const qt=He.imageAtlas,an=qt.patternPositions[Bt.to.toString()],fn=qt.patternPositions[Bt.from.toString()];an&&fn&&$e.setConstantPatternPositions(an,fn)}const rn=pt?Ge:null,wn=le?wl(v,He,T,ve,rn):oe?rh(v,He,T,oe,ve,rn):$?om(v,He,T,et.lineClipsArray.length,rn):nh(v,He,T,rn);if(le)ue.activeTexture.set(Ie.TEXTURE0),He.imageAtlasTexture.bind(Ie.LINEAR,Ie.CLAMP_TO_EDGE),$e.updatePaintBuffers(ve);else if(oe&&(nn||v.lineAtlas.dirty))ue.activeTexture.set(Ie.TEXTURE0),v.lineAtlas.bind(ue);else if($){const qt=et.gradients[T.id];let an=qt.texture;if(T.gradientVersion!==qt.version){let fn=256;if(T.stepInterpolant){const Cr=C.getSource().maxzoom,Gn=Ge.canonical.z===Cr?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!f||!d}useProgram(s,f){this.cache=this.cache||{};const d=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Ua(this.context,Ku[s],f,sm[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 H(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class qa{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const m=Math.pow(2,d),v=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(T=>{const M=1/(T=u.af([],T,s))[3]/f*m;return u.a$(T,T,[M,M,1/T[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(X,oe){var ie=oe[0],le=oe[1],$=oe[2],ve=ie*ie+le*le+$*$;return ve>0&&(ve=1/Math.sqrt(ve)),X[0]=oe[0]*ve,X[1]=oe[1]*ve,X[2]=oe[2]*ve,X}([],function(X,oe,ie){var le=oe[0],$=oe[1],ve=oe[2],Fe=ie[0],ue=ie[1],Ie=ie[2];return X[0]=$*Ie-ve*ue,X[1]=ve*Fe-le*Ie,X[2]=le*ue-$*Fe,X}([],he([],v[T[0]],v[T[1]]),he([],v[T[2]],v[T[1]]))),k=-((z=M)[0]*(F=v[T[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(k)});return new qa(v,C)}}class ja{constructor(s,f){this.min=s,this.max=f,this.center=function(d,m,v){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,v){return d[0]=m[0]+v[0],d[1]=m[1]+v[1],d[2]=m[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=_e(this.min),m=_e(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let T=0;Tthis.max[m]-this.min[m])return 0}return 1}}class cu{constructor(s=0,f=0,d=0,m=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=m}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),m=u.ac((this.top+f-this.bottom)/2,0,f);return new u.P(d,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new cu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const hp=85.051129;class xh{constructor(s,f,d,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new cu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new xh(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.minElevationForCurrentTile=s.minElevationForCurrentTile,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 u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,v){var C=m[0],T=m[1],M=m[2],k=m[3],z=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*z,d[1]=T*F+k*z,d[2]=C*-z+M*F,d[3]=T*-z+k*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,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 f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),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,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),m=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),C=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,m.x,v.x,C.x)),M=Math.floor(Math.max(d.x,m.x,v.x,C.x)),k=1;for(let z=T-k;z<=M+k;z++)z!==0&&f.push(new u.b2(z,s))}return f}coveringTiles(s){var f,d;let m=this.coveringZoomLevel(s);const v=m;if(s.minzoom!==void 0&&ms.maxzoom&&(m=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,m),k=[M*C.x,M*C.y,0],z=[M*T.x,M*T.y,0],F=qa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let X=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(X=m);const oe=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,ie=ue=>({aabb:new ja([ue*M,0,0],[(ue+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ue,fullyVisible:!1}),le=[],$=[],ve=m,Fe=s.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let ue=1;ue<=3;ue++)le.push(ie(-ue)),le.push(ie(ue));for(le.push(ie(0));le.length>0;){const ue=le.pop(),Ie=ue.x,Be=ue.y;let Ge=ue.fullyVisible;if(!Ge){const ht=ue.aabb.intersects(F);if(ht===0)continue;Ge=ht===2}const He=s.terrain?k:z,et=ue.aabb.distanceX(He),$e=ue.aabb.distanceY(He),ot=Math.max(Math.abs(et),Math.abs($e));if(ue.zoom===ve||ot>oe+(1<=X){const ht=ve-ue.zoom,nn=k[0]-.5-(Ie<>1),Bt=ue.zoom+1;let rn=ue.aabb.quadrant(ht);if(s.terrain){const wn=new u.Q(Bt,ue.wrap,Bt,nn,pt),qt=s.terrain.getMinMaxElevation(wn),an=(f=qt.minElevation)!==null&&f!==void 0?f:this.elevation,fn=(d=qt.maxElevation)!==null&&d!==void 0?d:this.elevation;rn=new ja([rn.min[0],rn.min[1],an],[rn.max[0],rn.max[1],fn])}le.push({aabb:rn,zoom:Bt,x:nn,y:pt,wrap:ue.wrap,fullyVisible:Ge})}}return $.sort((ue,Ie)=>ue.distanceSq-Ie.distanceSq).map(ue=>ue.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],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 f=u.ac(s.lat,-85.051129,hp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(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 f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const C=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/C/u.b3(1,m.lat),M=this.scaleZoom(T/this.tileSize);this._elevation=v,this._center=m,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new u.Y(v.x-(d.x-m.x),v.y-(d.y-m.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const X=f.pointCoordinate(s);if(X!=null)return X}const d=[s.x,s.y,0,1],m=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(m,m,this.pixelMatrixInverse);const v=d[3],C=m[3],T=d[1]/v,M=m[1]/C,k=d[2]/v,z=m[2]/C,F=k===z?0:(0-k)/(z-k);return new u.Y(u.z.number(d[0]/v,m[0]/C,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(m,m,d),new u.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Le().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Le([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=[-85.051129,hp])}calculatePosMatrix(s,f=!1){const d=s.key,m=f?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*C,v.y*C,0]),u.J(M,M,[C/u.W,C/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),m[d]=new Float32Array(M),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ue=179.9999999999;m=[-ue,ue]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,T=v,M=0,k=v,z=0,F=0;const{x:X,y:oe}=this.size;if(this.latRange){const ue=this.latRange;C=u.O(ue[1])*v,T=u.O(ue[0])*v,T-CT&&(ve=T-ue)}if(m){const ue=(M+k)/2;let Ie=ie;this._renderWorldCopies&&(Ie=u.b1(ie,ue-v/2,ue+v/2));const Be=X/2;Ie-Bek&&($=k-Be)}if($!==void 0||ve!==void 0){const ue=new u.P($??ie,ve??le);d.center=this.unproject.call({worldSize:v},ue).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let m=u.an(new Float64Array(16));u.J(m,m,[this.width/2,-this.height/2,1]),u.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=u.an(new Float64Array(16)),u.J(m,m,[1,-1,1]),u.H(m,m,[-1,-1,0]),u.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),T=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?T:v,k=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(u.ac(Math.PI-k-z,.01,Math.PI-.01)),X=this.getHorizon(),oe=2*Math.atan(X/this.cameraToCenterDistance)*(.5+s.y/(2*X)),ie=Math.sin(oe)*M/Math.sin(u.ac(Math.PI-k-oe,.01,Math.PI-.01)),le=Math.min(F,ie),$=1.01*(Math.cos(Math.PI/2-this._pitch)*le+M),ve=this.height/50;m=new Float64Array(16),u.b4(m,this._fov,this.width/this.height,ve,$),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,u.J(m,m,[1,-1,1]),u.H(m,m,[0,0,-this.cameraToCenterDistance]),u.b5(m,m,this._pitch),u.ad(m,m,this.angle),u.H(m,m,[-f,-d,0]),this.mercatorMatrix=u.J([],m,[this.worldSize,this.worldSize,this.worldSize]),u.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,m),u.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=u.ar([],m),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,m);const Fe=this.width%2/2,ue=this.height%2/2,Ie=Math.cos(this.angle),Be=Math.sin(this.angle),Ge=f-Math.round(f)+Ie*Fe+Be*ue,He=d-Math.round(d)+Ie*ue+Be*Fe,et=new Float64Array(m);if(u.H(et,et,[Ge>.5?Ge-1:Ge,He>.5?He-1:He,0]),this.alignedProjMatrix=et,m=u.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,m=f.y,v=f.x,C=f.y;for(const T of s)d=Math.min(d,T.x),m=Math.min(m,T.y),v=Math.max(v,T.x),C=Math.max(C,T.y);return[new u.P(d,m),new u.P(v,m),new u.P(v,C),new u.P(d,C),new u.P(d,m)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),m=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(m,m,this.projMatrix),m[2]/m[3]}}function fp(_,s){let f,d=!1,m=null,v=null;const C=()=>{m=null,d&&(_.apply(v,f),m=setTimeout(C,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,m||C(),m)}class pp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:d,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=fp(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 f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),C=Math.round(f.lng*v)/v,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),k=this._map.getPitch();let z="";if(z+=s?`/${C}/${T}/${d}`:`${d}/${T}/${C}`,(M||k)&&(z+="/"+Math.round(10*M)/10),k&&(z+=`/${Math.round(k)}`),this._hashName){const F=this._hashName;let X=!1;const oe=window.location.hash.slice(1).split("&").map(ie=>{const le=ie.split("=")[0];return le===F?(X=!0,`${le}=${z}`):ie}).filter(ie=>ie);return X||oe.push(`${F}=${z}`),`#${oe.join("&")}`}return`#${z}`}}const ic={linearity:.3,easing:u.b6(0,0,.3,1)},Cl=u.e({deceleration:2500,maxSpeed:1400},ic),xm=u.e({deceleration:20,maxSpeed:1400},ic),wm=u.e({deceleration:1e3,maxSpeed:360},ic),Sm=u.e({deceleration:1e3,maxSpeed:90},ic);class Em{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:I.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=I.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(f.pan.mag()){const v=sc(f.pan.mag(),d,u.e({},Cl,s||{}));m.offset=f.pan.mult(v.amount/f.pan.mag()),m.center=this._map.transform.center,oc(m,v)}if(f.zoom){const v=sc(f.zoom,d,xm);m.zoom=this._map.transform.zoom+v.amount,oc(m,v)}if(f.bearing){const v=sc(f.bearing,d,wm);m.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),oc(m,v)}if(f.pitch){const v=sc(f.pitch,d,Sm);m.pitch=this._map.transform.pitch+v.amount,oc(m,v)}if(m.zoom||m.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),u.e(m,{noMoveStart:!0})}}function oc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,k,z,F)=>M.add(k.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:C,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class dp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ms{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new dp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new fo(s.type,this._map,s))}mouseup(s){this._map.fire(new fo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new fo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new fo(s.type,this._map,s))}mouseover(s){this._map.fire(new fo(s.type,this._map,s))}mouseout(s){this._map.fire(new fo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Bs(s.type,this._map,s))}touchmove(s){this._map.fire(new Bs(s.type,this._map,s))}touchend(s){this._map.fire(new Bs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Bs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new fo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new fo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new fo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hu{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(u.P.convert(s),this._map.terrain)}}class gs{constructor(s,f){this._map=s,this._tr=new hu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,m,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&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function Tl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class n_{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const v=new u.P(0,0);for(const C of m)v._add(C);return v.div(m.length)}(f),this.touches=Tl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const m=Tl(d,f);for(const v in this.touches){const C=m[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class mp{constructor(s){this.singleTap=new n_(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,d){this.singleTap.touchstart(s,f,d)}touchmove(s,f,d){this.singleTap.touchmove(s,f,d)}touchend(s,f,d){const m=this.singleTap.touchend(s,f,d);if(m){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(m)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class r_{constructor(s){this._tr=new hu(s),this._zoomIn=new mp({numTouches:1,numTaps:2}),this._zoomOut=new mp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const m=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),C=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(m)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{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 fu{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 f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=f.length?f[0]:f;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},pu=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new fu({clickTolerance:s,move:(m,v)=>({bearingDelta:(v.x-m.x)*f}),moveStateManager:d,enable:_,assignEvents:wh})},du=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Us({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new fu({clickTolerance:s,move:(m,v)=>({pitchDelta:(v.y-m.y)*f}),moveStateManager:d,enable:_,assignEvents:wh})};class Im{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const m=Tl(d,f),v=new u.P(0,0),C=new u.P(0,0);let T=0;for(const k in m){const z=m[k],F=this._touches[k];F&&(v._add(z),C._add(z.sub(F)),T++,m[k]=z)}if(this._touches=m,TMath.abs(_.x)}class Lm extends _t{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Eh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,v=f.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return Eh(s)&&Eh(f)&&C}}const i_={panStep:100,bearingStep:15,pitchStep:10};class Wa{constructor(s){this._tr=new hu(s);const f=i_;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,d=0,m=0,v=0,C=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:sr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+m*this._pitchStep,offset:[-v*this._panStep,-C*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 sr(_){return _*(2-_)}const lc=4.000244140625;class Ih{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new hu(s),this._triggerRenderFrame=f,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()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=I.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%lc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,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 f=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),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 T=this._type==="wheel"&&Math.abs(this._delta)>lc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));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 f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,m=this._easing;let v,C=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=m(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,m=(I.now()-d.start)/d.duration,v=d.easing(m+.01)-d.easing(m),C=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-C*C);f=u.b6(C,T,.25,1)}return this._prevEase={start:I.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class yp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}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 Pm{constructor(s){this._tr=new hu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mm{constructor(){this._tap=new mp({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,f,d){if(!this._swipePoint)if(this._tapTime){const m=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(m)<30;v&&C?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,f,d)}touchmove(s,f,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=f[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,d)}touchend(s,f,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(s,f,d);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Am{constructor(s,f,d){this._el=s,this._mousePan=f,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 ys{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,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 uc{constructor(s,f,d,m){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=m,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()}}class Mt{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=f,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=d,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(P.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ft=_=>_.zoom||_.drag||_.pitch||_.rotate;class Ch extends u.k{}function cc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class _p{constructor(s,f){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=m.type==="renderFrame"?void 0:m,T={needsRenderFrame:!1},M={},k={},z=m.touches,F=z?this._getMapTouches(z):void 0,X=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),m);for(const{handlerName:le,handler:$,allowed:ve}of this._handlers){if(!$.isEnabled())continue;let Fe;this._blockedByActive(k,ve,le)?$.reset():$[v||m.type]&&(Fe=$[v||m.type](m,X,F),this.mergeHandlerResult(T,M,Fe,le,C),Fe&&Fe.needsRenderFrame&&this._triggerRenderFrame()),(Fe||$.isActive())&&(k[le]=$)}const oe={};for(const le in this._previousActiveHandlers)k[le]||(oe[le]=C);this._previousActiveHandlers=k,(Object.keys(oe).length||cc(T))&&(this._changes.push([T,M,oe]),this._triggerRenderFrame()),(Object.keys(k).length||cc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ie}=T;ie&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ie(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Em(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);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[m,v,C]of this._listeners)P.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ms(f,s));const m=f.boxZoom=new gs(f,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const v=f.cooperativeGestures=new Mt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new r_(f),T=new Pm(f);f.doubleClickZoom=new yp(T,C),this._add("tapZoom",C),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Mm;this._add("tapDragZoom",M);const k=f.touchPitch=new Lm(f);this._add("touchPitch",k),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=pu(s),F=du(s);f.dragRotate=new ys(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const X=(({enable:Fe,clickTolerance:ue})=>{const Ie=new Us({checkCorrectEvent:Be=>P.mouseButton(Be)===0&&!Be.ctrlKey});return new fu({clickTolerance:ue,move:(Be,Ge)=>({around:Ge,panDelta:Ge.sub(Be)}),activateOnStart:!0,moveStateManager:Ie,enable:Fe,assignEvents:wh})})(s),oe=new Im(s,f);f.dragPan=new Am(d,X,oe),this._add("mousePan",X),this._add("touchPan",oe,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const ie=new gp,le=new Tm;f.touchZoomRotate=new uc(d,le,ie,M),this._add("touchRotate",ie,["touchPan","touchZoom"]),this._add("touchZoom",le,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const $=f.scrollZoom=new Ih(f,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const ve=f.keyboard=new Wa(f);this._add("keyboard",ve),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Vs(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.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!!Ft(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const m in s)if(m!==d&&(!f||f.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const d of s)this._el.contains(d.target)&&f.push(d);return f}mergeHandlerResult(s,f,d,m,v){if(!d)return;u.e(s,d);const C={handlerName:m,originalEvent:d.originalEvent||v};d.zoomDelta!==void 0&&(f.zoom=C),d.panDelta!==void 0&&(f.drag=C),d.pitchDelta!==void 0&&(f.pitch=C),d.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},d={};for(const[m,v,C]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new u.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),u.e(f,v),u.e(d,C);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const m=this._map,v=m._getTransformForUpdate(),C=m.terrain;if(!(cc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:k,pitchDelta:z,around:F,pinchAround:X}=s;X!==void 0&&(F=X),m._stop(!0),F=F||m.transform.centerPoint;const oe=v.pointLocation(T?F.sub(T):F);k&&(v.bearing+=k),z&&(v.pitch+=z),M&&(v.zoom+=M),C?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(T)):v.setLocationAtPoint(oe,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(oe,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(oe,F),m._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const m=Ft(this._eventsInProgress),v=Ft(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const z in C)this._fireEvent(z,C[z]);v&&this._fireEvent("move",v.originalEvent);for(const z in s){const{originalEvent:F}=s[z];this._fireEvent(z,F)}const T={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:X}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||X,T[`${z}end`]=M)}for(const z in T)this._fireEvent(z,T[z]);const k=Ft(this._eventsInProgress);if(d&&(m||v)&&!k){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=X=>X!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ch("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class po extends u.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((I.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=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=u.z.number(v,$,He)),this._rotating&&(m.bearing=u.z.number(C,k,He)),this._pitching&&(m.pitch=u.z.number(T,z,He)),this._padding&&(m.interpolatePadding(M,F,He),oe=m.centerPoint.add(X)),this.terrain&&!s.freezeElevation&&this._updateElevation(He),Ie)m.setLocationAtPoint(Ie,Be);else{const et=m.zoomScale(m.zoom-v),$e=$>v?Math.min(2,ue):Math.max(.5,ue),ot=Math.pow($e,1-He),ht=m.unproject(ve.add(Fe.mult(He*ot)).mult(et));m.setLocationAtPoint(m.renderWorldCopies?ht.wrap():ht,oe)}this._applyUpdatedTransform(m),this._fireMoveEvents(f)},He=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,He)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.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.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.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 f=s.clone(),{center:d,zoom:m,pitch:v,bearing:C,elevation:T}=this.transformCameraUpdate(f);d&&(f.center=d),m!==void 0&&(f.zoom=m),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",s)),m&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&I.prefersReducedMotion){const wn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(wn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const m=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),T=this.getPitch(),M=this.getPadding(),k="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:m.padding,X=u.P.convert(s.offset);let oe=m.centerPoint.add(X);const ie=m.pointLocation(oe),{center:le,zoom:$}=m.getConstrained(u.M.convert(s.center||ie),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(le);const ve=m.zoomScale($-v),Fe=m.project(ie),ue=m.project(le).sub(Fe);let Ie=s.curve;const Be=Math.max(m.width,m.height),Ge=Be/ve,He=ue.mag();if("minZoom"in s){const wn=u.ac(Math.min(s.minZoom,v,$),m.minZoom,m.maxZoom),qt=Be/m.zoomScale(wn-v);Ie=Math.sqrt(qt/He*2)}const et=Ie*Ie;function $e(wn){const qt=(Ge*Ge-Be*Be+(wn?-1:1)*et*et*He*He)/(2*(wn?Ge:Be)*et*He);return Math.log(Math.sqrt(qt*qt+1)-qt)}function ot(wn){return(Math.exp(wn)-Math.exp(-wn))/2}function ht(wn){return(Math.exp(wn)+Math.exp(-wn))/2}const nn=$e(!1);let pt=function(wn){return ht(nn)/ht(nn+Ie*wn)},Bt=function(wn){return Be*((ht(nn)*(ot(qt=nn+Ie*wn)/ht(qt))-ot(nn))/et)/He;var qt},rn=($e(!0)-nn)/Ie;if(Math.abs(He)<1e-6||!isFinite(rn)){if(Math.abs(Be-Ge)<1e-6)return this.easeTo(s,f);const wn=Ges.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==k,this._pitching=z!==T,this._padding=!m.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(le),this._ease(wn=>{const qt=wn*rn,an=1/pt(qt);m.zoom=wn===1?$:v+m.scaleZoom(an),this._rotating&&(m.bearing=u.z.number(C,k,wn)),this._pitching&&(m.pitch=u.z.number(T,z,wn)),this._padding&&(m.interpolatePadding(M,F,wn),oe=m.centerPoint.add(X)),this.terrain&&!s.freezeElevation&&this._updateElevation(wn);const fn=wn===1?le:m.unproject(Fe.add(ue.mult(Bt(qt))).mult(an));m.setLocationAtPoint(m.renderWorldCopies?fn.wrap():fn,oe),this._applyUpdatedTransform(m),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){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,f)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,f,d){d.animate===!1||d.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const vp={compact:!0,customAttribution:'MapLibre'};class _s{constructor(s=vp){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=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.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.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.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(){P.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,f){const d=this._map._getUIString(`AttributionControl.${f}`);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(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const f=this._map.style.sourceCaches;for(const m in f){const v=f[m];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,v)=>m.length-v.length),s=s.filter((m,v)=>{for(let C=v+1;C=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 km{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[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=P.create("div","maplibregl-ctrl");const f=P.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class hc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,d=f?this._queue.concat(f):this._queue;for(const m of d)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const d of f)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ir=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class Vr extends u.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,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),u.aN(m.posMatrix,0,u.W,0,u.W,0,1),this._tiles[m.key]=new Ko(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(s){for(const f in this._tiles){const d=this._tiles[f];(!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 f={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),u.aN(v.posMatrix,0,u.W,0,u.W,0,1),f[d]=v}else if(m.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=m.canonical.z-s.canonical.z,T=m.canonical.x-(m.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,k,0,k,0,1),u.H(v.posMatrix,v.posMatrix,[-T*k,-M*k,0]),f[d]=v}else if(s.canonical.isChildOf(m.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-m.canonical.z,T=s.canonical.x-(s.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*k,M*k,0]),u.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(m--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class Dm{constructor(s,f,d){this.painter=s,this.sourceCache=new Vr(f),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,f,d,m=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=m?v=s.canonical.z-m:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),m=new H(s,d,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,m=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,T-C-1,1,1,m.RGBA,m.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),k=f[1]+((15&f[2])<<8),z=this.coordsIndex[255-f[3]],F=z&&this.sourceCache.getTileByID(z);if(!F)return null;const X=this._coordsTextureSize,oe=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];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 ya={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class bp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new fc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(f)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const m=s.sourceCaches[d].getVisibleCoordinates();for(const v of m){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const T in C)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(C[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const m=s._layers[d],v=m.source;if(ya[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][d.tileID.key];v&&v!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(ya[f]&&(this._prevType&&ya[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(ya[this._prevType]||ya[f]&&m){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(bh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const k=this.pool.getObjectForId(T.rtt[v].id);if(k.stamp===T.rtt[v].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Sp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ep{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(u.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),P.mousePos(this.element,C)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,P.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=pu({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const k=new St;return new fu({clickTolerance:T,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:k,enable:C,assignEvents:Th})})({clickTolerance:m,enable:!0}),this.map=s,d&&(this.mousePitch=du({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new St;return new fu({clickTolerance:T,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:k,enable:C,assignEvents:Th})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let _a;function Lh(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const m=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),C=f.locationPoint(_).distSqr(s);f.locationPoint(m).distSqr(s)180;){const m=f.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=f.width&&m.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const dc={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 Ph(_,s,f){const d=_.classList;for(const m in dc)d.remove(`maplibregl-${f}-anchor-${m}`);d.add(`maplibregl-${f}-anchor-${s}`)}class mc extends u.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,m=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Lh(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${dc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),I.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=f.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 u.k("dragstart"))),this.fire(new u.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 u.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.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,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${m}px`),f.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const v=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=P.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.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 ve of M){const Fe=P.createNS("http://www.w3.org/2000/svg","ellipse");Fe.setAttributeNS(null,"opacity","0.04"),Fe.setAttributeNS(null,"cx","10.5"),Fe.setAttributeNS(null,"cy","5.80029008"),Fe.setAttributeNS(null,"rx",ve.rx),Fe.setAttributeNS(null,"ry",ve.ry),T.appendChild(Fe)}const k=P.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const z=P.createNS("http://www.w3.org/2000/svg","path");z.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(z);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const X=P.createNS("http://www.w3.org/2000/svg","path");X.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"),F.appendChild(X);const oe=P.createNS("http://www.w3.org/2000/svg","g");oe.setAttributeNS(null,"transform","translate(6.0, 7.0)"),oe.setAttributeNS(null,"fill","#FFFFFF");const ie=P.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"transform","translate(8.0, 8.0)");const le=P.createNS("http://www.w3.org/2000/svg","circle");le.setAttributeNS(null,"fill","#000000"),le.setAttributeNS(null,"opacity","0.25"),le.setAttributeNS(null,"cx","5.5"),le.setAttributeNS(null,"cy","5.5"),le.setAttributeNS(null,"r","5.4999962");const $=P.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"),ie.appendChild(le),ie.appendChild($),C.appendChild(T),C.appendChild(k),C.appendChild(F),C.appendChild(oe),C.appendChild(ie),f.appendChild(C),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(f),this._offset=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Ph(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);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),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.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 m=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":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,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 this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,d;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),C=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/m.transform._pixelPerMeter,M=Math.sin(m.getPitch()*Math.PI/180)*T,k=m.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),z=m.transform.lngLatToCameraDepth(this._lngLat,C+M)-k>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=u.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}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Mh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let gu=0,Ll=!1;const Ah={maxWidth:100,unit:"metric"};function kh(_,s,f){const d=f&&f.maxWidth||100,m=_._container.clientHeight/2,v=_.unproject([0,m]),C=_.unproject([d,m]),T=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Pl(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Pl(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Pl(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Pl(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Pl(s,d,T,_._getUIString("ScaleControl.Meters"))}function Pl(_,s,f,d){const m=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/C;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(T),C*T}(f);_.style.width=s*(m/f)+"px",_.innerHTML=`${m} ${d}`}const Ip={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Cp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Dh(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);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:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Dh(new u.P(0,0))}const Rm=g;c.AJAXError=u.be,c.Evented=u.E,c.LngLat=u.M,c.MercatorCoordinate=u.Y,c.Point=u.P,c.addProtocol=u.bf,c.config=u.a,c.removeProtocol=u.bg,c.AttributionControl=_s,c.BoxZoomHandler=gs,c.CanvasSource=ps,c.CooperativeGesturesHandler=Mt,c.DoubleClickZoomHandler=yp,c.DragPanHandler=Am,c.DragRotateHandler=ys,c.EdgeInsets=cu,c.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_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 u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=kr,c.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.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 u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,m=this._map.getBearing(),v=u.e({bearing:m},this.options.fitBoundsOptions),C=Le.fromLngLat(f,d);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).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 f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Ll)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.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",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new mc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new mc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.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 u.k("trackuserlocationend")))})}},this.options=u.e({},Mh,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(_a!==void 0&&!s)return _a;if(window.navigator.permissions===void 0)return _a=!!window.navigator.geolocation,_a;try{_a=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_a=!!window.navigator.geolocation}return _a})}().then(s=>this._setupUI(s)),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(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,gu=0,Ll=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.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 _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return u.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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":gu--,Ll=!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 u.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 u.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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),gu++,gu>1?(_={maximumAge:6e5,timeout:0},Ll=!0):(_=this.options.positionOptions,Ll=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},c.Hash=pp,c.ImageSource=$n,c.KeyboardHandler=Wa,c.LngLatBounds=Le,c.LogoControl=km,c.Map=class extends po{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},pc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new xh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.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=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new hc,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},xp,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new Z(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.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 f=fp(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _p(this,_),this._hash=_.hash&&new pp(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new _s(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new km,_.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 u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],m=f[1],v=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,v),this.painter.resize(d,m,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.drawingBufferHeight];const M=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,M),this.painter.resize(d,m,M)}this.transform.resize(d,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,m);const C=!this._moving;return C&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),C&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),v=_*m,C=s*m;return Math.min(v>f?f/v:1,C>d?d/C:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Le.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?d||(d=!0,f.call(this,new fo(_,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new fo(_,this,C.originalEvent)))}}}}{const d=m=>{const v=this.getLayer(s)?this.queryRenderedFeatures(m.point,{layers:[s]}):[];v.length&&(m.features=v,f.call(this,m),delete m.features)};return{layer:s,listener:f,delegates:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new ko(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ko(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.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 Dm(this.painter,s,_),this.painter.renderToTexture=new bp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const m=f[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:v,stretchY:C,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.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:z}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:k},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:k,data:z}=I.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:k},z),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:m,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.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||u.b(s)?I.getImageData(s):s,{width:m,height:v,data:C}=d;if(m===void 0||v===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(C,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return j.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.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 f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const m=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=P.create("div",`maplibregl-ctrl-${C} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={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:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new bm(f,this.transform),D.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=I.now();this.style.zoomHistory.update(m,v);const C=new u.a8(m,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=C.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,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 u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(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 u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.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),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return wp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=fo,c.MapTouchEvent=Bs,c.MapWheelEvent=dp,c.Marker=mc,c.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.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,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},Sp,_),this._container=P.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})),P.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})),P.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=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,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 Ep(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.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(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.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=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Lh(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const d=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Dh(this.options.offset);if(!m){const T=this._container.offsetWidth,M=this._container.offsetHeight;let k;k=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-T/2&&k.push("right"),m=k.length===0?"bottom":k.join("-")}let C=d.add(v[m]);this.options.subpixelPositioning||(C=C.round()),P.setTransform(this._container,`${dc[m]} translate(${C.x}px,${C.y}px)`),Ph(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Ip),_)}addTo(_){return this._map&&this.remove(),this._map=_,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 u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.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 _=this._container.querySelector(Cp);_&&_.focus()}},c.RasterDEMTileSource=Yt,c.RasterTileSource=Ne,c.ScaleControl=class{constructor(_){this._onMove=()=>{kh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,kh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ah),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Ih,c.Style=ko,c.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.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(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Lm,c.TwoFingersTouchRotateHandler=gp,c.TwoFingersTouchZoomHandler=Tm,c.TwoFingersTouchZoomRotateHandler=uc,c.VectorTileSource=kn,c.VideoSource=Mo,c.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Ba(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{Os[f]=d})(_,s)}),c.clearPrewarmedResources=function(){const _=gn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Pt),gn=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()"))},c.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return rt().getRTLTextPluginStatus()},c.getVersion=function(){return Rm},c.getWorkerCount=function(){return hn.workerCount},c.getWorkerUrl=function(){return u.a.WORKER_URL},c.importScriptInWorkers=function(_){return Ar().broadcast("IS",_)},c.prewarm=function(){An().acquire(Pt)},c.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},c.setRTLTextPlugin=function(_,s){return rt().setRTLTextPlugin(_,s)},c.setWorkerCount=function(_){hn.workerCount=_},c.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var a=n;return a})})(vI);var J4=vI.exports;const Es=xv(J4);var Q4=Object.defineProperty,$4=(t,e,n)=>e in t?Q4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,kw=(t,e,n)=>($4(t,typeof e!="symbol"?e+"":e,n),n);function vd(){}function xI(t){return t()}function Dw(){return Object.create(null)}function xy(t){t.forEach(xI)}function wI(t){return typeof t=="function"}function eD(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function tD(t){return Object.keys(t).length===0}function nD(t,e){t.appendChild(e)}function rD(t,e,n){t.insertBefore(e,n||null)}function SI(t){t.parentNode&&t.parentNode.removeChild(t)}function Rw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Su(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function iD(t){return Array.from(t.childNodes)}function lg(t,e,n){t.classList.toggle(e,!!n)}let qv;function dd(t){qv=t}const nf=[],Nw=[];let uf=[];const Ow=[],oD=Promise.resolve();let Y0=!1;function sD(){Y0||(Y0=!0,oD.then(EI))}function K0(t){uf.push(t)}const g0=new Set;let Jh=0;function EI(){if(Jh!==0)return;const t=qv;do{try{for(;Jht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),uf=e}const uD=new Set;function cD(t,e){t&&t.i&&(uD.delete(t),t.i(e))}function hD(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),K0(()=>{const a=t.$$.on_mount.map(xI).filter(wI);t.$$.on_destroy?t.$$.on_destroy.push(...a):xy(a),t.$$.on_mount=[]}),i.forEach(K0)}function fD(t,e){const n=t.$$;n.fragment!==null&&(lD(n.after_update),xy(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function pD(t,e){t.$$.dirty[0]===-1&&(nf.push(t),sD(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const N=D.length?D[0]:P;return w.ctx&&i(w.ctx[I],w.ctx[I]=N)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](N),S&&pD(t,I)),P}):[],w.update(),S=!0,xy(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=iD(e.target);w.fragment&&w.fragment.l(I),I.forEach(SI)}else w.fragment&&w.fragment.c();e.intro&&cD(t.$$.fragment),hD(t,e.target,e.anchor),EI()}dd(g)}class mD{constructor(){kw(this,"$$"),kw(this,"$$set")}$destroy(){fD(this,1),this.$destroy=vd}$on(e,n){if(!wI(n))return vd;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!tD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const gD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(gD);function yD(t){let e,n,r;return{c(){e=Rw("svg"),n=Rw("path"),Su(n,"stroke-width","4"),Su(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"),Su(n,"class","svelte-gzo3ar"),Su(e,"width",r=t[0]==="list"?20:void 0),Su(e,"viewBox","0 0 70 85"),Su(e,"fill","none"),Su(e,"class","svelte-gzo3ar"),lg(e,"in-map",t[0]!=="list"),lg(e,"list-icon",t[0]==="list")},m(i,a){rD(i,e,a),nD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Su(e,"width",r),a&1&&lg(e,"in-map",i[0]!=="list"),a&1&&lg(e,"list-icon",i[0]==="list")},i:vd,o:vd,d(i){i&&SI(e)}}}function _D(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class vD extends mD{constructor(e){super(),dD(this,e,_D,yD,eD,{displayIn:0})}}const bD=[{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"}],xD={decimalLatitude:40.123,decimalLongitude:-74.123},wD=[{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}],SD=[{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 ED(){const t=[];return bD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...xD})}),[...t,...wD,...SD]}const ID=ED();ID.map(t=>t.verbatimCoordinates);/** - * splaytree v3.1.2 - * Fast Splay tree for Node and browser - * - * @author Alexander Milevski - * @license MIT - * @preserve - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */function CD(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(w){return function(S){return g([w,S])}}function g(w){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=w[0]&2?i.return:w[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,w[1])).done)return a;switch(i=0,a&&(w=[w[0]&2,a.value]),w[0]){case 0:case 1:a=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,i=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!a||w[1]>a[0]&&w[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var u=e.right;if(e.right=u.left,u.left=e,e=u,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,a.left=e.right,e.left=r.right,e.right=r.left,e}function y0(t,e,n,r){var i=new Du(t,e);if(n===null)return i.left=i.right=null,i;n=Tu(t,n,r);var a=r(t,n.key);return a<0?(i.left=n.left,i.right=n,n.left=null):a>=0&&(i.right=n.right,i.left=n,n.right=null),i}function zw(t,e,n){var r=null,i=null;if(e){e=Tu(t,e,n);var a=n(e.key,t);a===0?(r=e.left,i=e.right):a<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function LD(t,e,n){return e===null?t:(t===null||(e=Tu(t.key,e,n),e.left=t),e)}function J0(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` -`);var a=e+(n?" ":"│ ");t.left&&J0(t.left,a,!1,r,i),t.right&&J0(t.right,a,!0,r,i)}}var jv=function(){function t(e){e===void 0&&(e=TD),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=y0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new Du(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=Tu(e,this._root,i),c=i(e,a.key);return c===0?this._root=a:(c<0?(r.left=a.left,r.right=a,a.left=null):c>0&&(r.right=a.right,r.left=a,a.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=Tu(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=Tu(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=Tu(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=Tu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):a=!0;return this},t.prototype.range=function(e,n,r,i){for(var a=[],c=this._comparator,u=this._root,g;a.length!==0||u;)if(u)a.push(u),u=u.left;else{if(u=a.pop(),g=c(u.key,n),g>0)break;if(c(u.key,e)>=0&&r.call(i,u))return this;u=u.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return MD(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,a=this._comparator;if(r&&ev(e,n,0,i-1,a),this._root===null)this._root=Q0(e,n,0,i),this._size=i;else{var c=AD(this.toList(),PD(e,n),a);i=this._size+i,this._root=$0({head:c},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return J0(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=zw(e,this._root,i),c=a.left,u=a.right;i(e,n)<0?u=y0(n,r,u,i):c=y0(n,r,c,i),this._root=LD(c,u,i)},t.prototype.split=function(e){return zw(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return CD(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function Q0(t,e,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),c=t[a],u=e[a],g=new Du(c,u);return g.left=Q0(t,e,n,a),g.right=Q0(t,e,a+1,r),g}return null}function PD(t,e){for(var n=new Du(null,null),r=n,i=0;i0?(e=a=a.next=n.pop(),e=e.right):r=!0;return a.next=null,i.next}function $0(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=$0(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=$0(t,i+1,n),c}return null}function AD(t,e,n){for(var r=new Du(null,null),i=r,a=t,c=e;a!==null&&c!==null;)n(a.key,c.key)<0?(i.next=a,a=a.next):(i.next=c,c=c.next),i=i.next;return a!==null?i.next=a:c!==null&&(i.next=c),r.next}function ev(t,e,n,r,i){if(!(n>=r)){for(var a=t[n+r>>1],c=n-1,u=r+1;;){do c++;while(i(t[c],a)<0);do u--;while(i(t[u],a)>0);if(c>=u)break;var g=t[c];t[c]=t[u],t[u]=g,g=e[c],e[c]=e[u],e[u]=g}ev(t,e,n,u,i),ev(t,e,u+1,r,i)}}function pa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fw(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){pa(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return jo(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r=0&&I>=0?wP?-1:0:g<0&&I<0?wP?1:0:Ig?1:0}}}]),t}(),zD=0,ey=function(){jo(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,a=e.rightSE.point.x,c=n.rightSE.point.x;if(cu&&g>w)return-1;var I=e.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var P=n.comparePoint(e.rightSE.point);return P!==0?P:-1}if(r>i){if(ug&&u>S)return 1;var D=n.comparePoint(e.leftSE.point);if(D!==0)return D;var N=e.comparePoint(n.rightSE.point);return N<0?1:N>0?-1:1}if(ug)return 1;if(ac){var J=e.comparePoint(n.rightSE.point);if(J<0)return 1;if(J>0)return-1}if(a!==c){var re=w-u,U=a-r,j=S-g,Z=c-i;if(re>U&&jZ)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){pa(this,t),this.id=++zD,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return jo(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e: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(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&u.swapEvents(),tl.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var c=n;n=r,r=c}for(var u=0,g=r.rings.length;u0)i=n,a=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var g=new tl(i,!0),w=new tl(a,!1);return new t(g,w,[r],[c])}}]),t}(),qw=function(){function t(e,n,r){if(pa(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=bd.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,c=1,u=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=g.x),g.y>this.bbox.ur.y&&(this.bbox.ur.y=g.y),a=g)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(ey.fromRing(a,i,this))}return jo(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return jo(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return jo(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n0&&(e=i)}for(var a=e.segment.prevInResult(),c=a?a.prevInResult():null;;){if(!a)return null;if(!c)return a.ringOut;if(c.ringOut!==a.ringOut)return c.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=c.prevInResult(),c=a?a.prevInResult():null}}}]),t}(),Ww=function(){function t(e){pa(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return jo(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:ey.compare;pa(this,t),this.queue=e,this.tree=new jv(n),this.segments=[]}return jo(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)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 a=i,c=i,u=void 0,g=void 0;u===void 0;)a=this.tree.prev(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);for(;g===void 0;)c=this.tree.next(c),c===null?g=null:c.key.consumedBy===void 0&&(g=c.key);if(e.isLeft){var w=null;if(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var I=this._splitSafely(u,S),P=0,D=I.length;P0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=u)}else{if(u&&g){var he=u.getIntersection(g);if(he!==null){if(!u.isAnEndpoint(he))for(var me=this._splitSafely(u,he),Ce=0,H=me.length;CeHw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Z=new UD(N),te=N.size,_e=N.pop();_e;){var pe=_e.key;if(N.size===te){var he=pe.segment;throw new Error("Unable to pop() ".concat(pe.isLeft?"left":"right"," SweepEvent ")+"[".concat(pe.point.x,", ").concat(pe.point.y,"] from segment #").concat(he.id," ")+"[".concat(he.leftSE.point.x,", ").concat(he.leftSE.point.y,"] -> ")+"[".concat(he.rightSE.point.x,", ").concat(he.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(N.size>Hw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Z.segments.length>GD)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var me=Z.process(pe),Ce=0,H=me.length;Ce1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};Ae.prototype.clone=function(){};Ae.prototype.copy=function(){return new Ae(this)};Ae.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Ae.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)};Ae.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};Ae.prototype.hashCode=function(){var t=17;return t=37*t+Ae.hashCode(this.x),t=37*t+Ae.hashCode(this.y),t};Ae.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};Ae.prototype.interfaces_=function(){return[hs,Sy,fs]};Ae.prototype.getClass=function(){return Ae};Ae.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=Xt.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};qc.DimensionalComparator.get=function(){return Gl};qc.serialVersionUID.get=function(){return 6683108902428367e3};qc.NULL_ORDINATE.get=function(){return Xt.NaN};qc.X.get=function(){return 0};qc.Y.get=function(){return 1};qc.Z.get=function(){return 2};Object.defineProperties(Ae,qc);var Gl=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new ir("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Gl.prototype.compare=function(t,e){var n=t,r=e,i=Gl.compare(n.x,r.x);if(i!==0)return i;var a=Gl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=Gl.compare(n.z,r.z);return c};Gl.prototype.interfaces_=function(){return[df]};Gl.prototype.getClass=function(){return Gl};Gl.compare=function(t,e){return te?1:Xt.isNaN(t)?Xt.isNaN(e)?0:-1:Xt.isNaN(e)?1:0};var mf=function(){};mf.prototype.create=function(){};mf.prototype.interfaces_=function(){return[]};mf.prototype.getClass=function(){return mf};var ze=function(){},Ud={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};ze.prototype.interfaces_=function(){return[]};ze.prototype.getClass=function(){return ze};ze.toLocationSymbol=function(t){switch(t){case ze.EXTERIOR:return"e";case ze.BOUNDARY:return"b";case ze.INTERIOR:return"i";case ze.NONE:return"-"}throw new ir("Unknown location value: "+t)};Ud.INTERIOR.get=function(){return 0};Ud.BOUNDARY.get=function(){return 1};Ud.EXTERIOR.get=function(){return 2};Ud.NONE.get=function(){return-1};Object.defineProperties(ze,Ud);var Ut=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Wo=function(){},DI={LOG_10:{configurable:!0}};Wo.prototype.interfaces_=function(){return[]};Wo.prototype.getClass=function(){return Wo};Wo.log10=function(t){var e=Math.log(t);return Xt.isInfinite(e)||Xt.isNaN(e)?e:e/Wo.LOG_10};Wo.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};Wo.wrap=function(t,e){return t<0?e- -t%e:t%e};Wo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],u=arguments[3],g=i;return a>g&&(g=a),c>g&&(g=c),u>g&&(g=u),g}};Wo.average=function(t,e){return(t+e)/2};DI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Wo,DI);var da=function(t){this.str=t};da.prototype.append=function(t){this.str+=t};da.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};da.prototype.toString=function(t){return this.str};var ta=function(t){this.value=t};ta.prototype.intValue=function(){return this.value};ta.prototype.compareTo=function(t){return this.valuet?1:0};ta.isNaN=function(t){return Number.isNaN(t)};var xd=function(){};xd.isWhitespace=function(t){return t<=32&&t>=0||t===127};xd.toUpperCase=function(t){return t.toUpperCase()};var je=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},Rs={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}};je.prototype.le=function(t){return(this._hi9?(S=!0,I="9"):I="0"+w,c.append(I),n=n.subtract(je.valueOf(w)).multiply(je.TEN),S&&n.selfAdd(je.TEN);var P=!0,D=je.magnitude(n._hi);if(D<0&&Math.abs(D)>=u-g&&(P=!1),!P)break}return e[0]=r,c.toString()};je.prototype.sqr=function(){return this.multiply(this)};je.prototype.doubleValue=function(){return this._hi+this._lo};je.prototype.subtract=function(){if(arguments[0]instanceof je){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};je.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};je.prototype.isZero=function(){return this._hi===0&&this._lo===0};je.prototype.selfSubtract=function(){if(arguments[0]instanceof je){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};je.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};je.prototype.min=function(t){return this.le(t)?this:t};je.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof je){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,u=null,g=null,w=null,S=null,I=null;return g=this._hi/n,w=je.SPLIT*g,i=w-g,I=je.SPLIT*n,i=w-i,a=g-i,c=I-n,S=g*n,c=I-c,u=n-c,I=i*c-S+i*u+a*c+a*u,w=(this._hi-S-I+this._lo-g*r)/n,I=g+w,this._hi=I,this._lo=g-I+w,this}};je.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};je.prototype.divide=function(){if(arguments[0]instanceof je){var t=arguments[0],e=null,n=null,r=null,i=null,a=null,c=null,u=null,g=null;a=this._hi/t._hi,c=je.SPLIT*a,e=c-a,g=je.SPLIT*t._hi,e=c-e,n=a-e,r=g-t._hi,u=a*t._hi,r=g-r,i=t._hi-r,g=e*r-u+e*i+n*r+n*i,c=(this._hi-u-g+this._lo-a*t._lo)/t._hi,g=a+c;var w=g,S=a-g+c;return new je(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return Xt.isNaN(I)?je.createNaN():je.copy(this).selfDivide(I,0)}};je.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};je.prototype.pow=function(t){if(t===0)return je.valueOf(1);var e=new je(this),n=je.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(e),r/=2,r>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};je.prototype.ceil=function(){if(this.isNaN())return je.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new je(t,e)};je.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};je.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};je.prototype.setValue=function(){if(arguments[0]instanceof je){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};je.prototype.max=function(t){return this.ge(t)?this:t};je.prototype.sqrt=function(){if(this.isZero())return je.valueOf(0);if(this.isNegative())return je.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=je.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};je.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof je){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,a=null,c=null,u=null;return i=this._hi+e,c=i-this._hi,a=i-c,a=e-c+(this._hi-a),u=a+this._lo,n=i+u,r=u+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var g=arguments[0],w=arguments[1],S=null,I=null,P=null,D=null,N=null,q=null,J=null,re=null;N=this._hi+g,P=this._lo+w,J=N-this._hi,re=P-this._lo,q=N-J,D=P-re,q=g-J+(this._hi-q),D=w-re+(this._lo-D),J=q+P,S=N+J,I=J+(N-S),J=D+I;var U=S+J,j=J+(S-U);return this._hi=U,this._lo=j,this}};je.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof je){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,u=null,g=null,w=null;g=je.SPLIT*this._hi,i=g-this._hi,w=je.SPLIT*n,i=g-i,a=this._hi-i,c=w-n,g=this._hi*n,c=w-c,u=n-c,w=i*c-g+i*u+a*c+a*u+(this._hi*r+this._lo*n);var S=g+w;i=g-S;var I=w+i;return this._hi=S,this._lo=I,this}};je.prototype.selfSqr=function(){return this.selfMultiply(this)};je.prototype.floor=function(){if(this.isNaN())return je.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new je(t,e)};je.prototype.negate=function(){return this.isNaN()?this:new je(-this._hi,-this._lo)};je.prototype.clone=function(){};je.prototype.multiply=function(){if(arguments[0]instanceof je){var t=arguments[0];return t.isNaN()?je.createNaN():je.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return Xt.isNaN(e)?je.createNaN():je.copy(this).selfMultiply(e,0)}};je.prototype.isNaN=function(){return Xt.isNaN(this._hi)};je.prototype.intValue=function(){return Math.trunc(this._hi)};je.prototype.toString=function(){var t=je.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};je.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+je.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=je.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};je.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,a=null,c=null,u=null;i=1/this._hi,a=je.SPLIT*i,t=a-i,u=je.SPLIT*this._hi,t=a-t,e=i-t,n=u-this._hi,c=i*this._hi,n=u-n,r=this._hi-n,u=t*n-c+t*r+e*n+e*r,a=(1-c-u-i*this._lo)/this._hi;var g=i+a,w=i-g+a;return new je(g,w)};je.prototype.toSciNotation=function(){if(this.isZero())return je.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=je.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};je.prototype.abs=function(){return this.isNaN()?je.NaN:this.isNegative()?this.negate():new je(this)};je.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};je.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};je.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};je.prototype.trunc=function(){return this.isNaN()?je.NaN:this.isPositive()?this.floor():this.ceil()};je.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};je.prototype.interfaces_=function(){return[fs,hs,Sy]};je.prototype.getClass=function(){return je};je.sqr=function(t){return je.valueOf(t).selfMultiply(t)};je.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return je.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new je(e)}};je.sqrt=function(t){return je.valueOf(t).sqrt()};je.parse=function(t){for(var e=0,n=t.length;xd.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,xd.isDigit(w)){var S=w-"0";a.selfMultiply(je.TEN),a.selfAdd(S),c++;continue}if(w==="."){u=c;continue}if(w==="e"||w==="E"){var I=t.substring(e);try{g=ta.parseInt(I)}catch(J){throw J instanceof Error?new Error("Invalid exponent "+I+" in string "+t):J}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var P=a,D=c-u-g;if(D===0)P=a;else if(D>0){var N=je.TEN.pow(D);P=a.divide(N)}else if(D<0){var q=je.TEN.pow(-D);P=a.multiply(q)}return r?P.negate():P};je.createNaN=function(){return new je(Xt.NaN,Xt.NaN)};je.copy=function(t){return new je(t)};je.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=e&&(r+=1),r};je.stringOfChar=function(t,e){for(var n=new da,r=0;r0){if(a<=0)return oo.signum(c);r=i+a}else if(i<0){if(a>=0)return oo.signum(c);r=-i-a}else return oo.signum(c);var u=oo.DP_SAFE_EPSILON*r;return c>=u||-c>=u?oo.signum(c):2};oo.signum=function(t){return t>0?1:t<0?-1:0};RI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(oo,RI);var Sn=function(){},Gd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Gd.X.get=function(){return 0};Gd.Y.get=function(){return 1};Gd.Z.get=function(){return 2};Gd.M.get=function(){return 3};Sn.prototype.setOrdinate=function(t,e,n){};Sn.prototype.size=function(){};Sn.prototype.getOrdinate=function(t,e){};Sn.prototype.getCoordinate=function(){};Sn.prototype.getCoordinateCopy=function(t){};Sn.prototype.getDimension=function(){};Sn.prototype.getX=function(t){};Sn.prototype.clone=function(){};Sn.prototype.expandEnvelope=function(t){};Sn.prototype.copy=function(){};Sn.prototype.getY=function(t){};Sn.prototype.toCoordinateArray=function(){};Sn.prototype.interfaces_=function(){return[Sy]};Sn.prototype.getClass=function(){return Sn};Object.defineProperties(Sn,Gd);var NI=function(){},Vf=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(NI),Ii=function(){};Ii.arraycopy=function(t,e,n,r,i){for(var a=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Dt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};Dt.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};Dt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Dt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Dt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Dt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Dt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Dt.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Dt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof Ae){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Dt.prototype.centre=function(){return this.isNull()?null:new Ae((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Dt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Ae){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Dt){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],u=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Dt.prototype.hashCode=function(){var t=17;return t=37*t+Ae.hashCode(this._minx),t=37*t+Ae.hashCode(this._maxx),t=37*t+Ae.hashCode(this._miny),t=37*t+Ae.hashCode(this._maxy),t};Dt.prototype.interfaces_=function(){return[hs,fs]};Dt.prototype.getClass=function(){return Dt};Dt.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3],u=Math.min(a.x,c.x),g=Math.max(a.x,c.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>g||Sg)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};cr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};cr.prototype.setPrecisionModel=function(t){this._precisionModel=t};cr.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ni?a=r:a=i;else{var c=Math.abs(t.x-e.x),u=Math.abs(t.y-e.y);r>i?a=c:a=u,a===0&&!t.equals(e)&&(a=Math.max(c,u))}return on.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};cr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return on.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};jc.DONT_INTERSECT.get=function(){return 0};jc.DO_INTERSECT.get=function(){return 1};jc.COLLINEAR.get=function(){return 2};jc.NO_INTERSECTION.get=function(){return 0};jc.POINT_INTERSECTION.get=function(){return 1};jc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(cr,jc);var Hu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new Dt(this._inputLines[0][0],this._inputLines[0][1]),i=new Dt(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Dt.intersects(r,i,n)&&xt.orientationIndex(r,i,n)===0&&xt.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,a,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,a.x-=c.x,a.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,a){var c=null;try{c=Is.intersection(n,r,i,a)}catch(u){if(u instanceof Vf)c=e.nearestEndpoint(n,r,i,a);else throw u}finally{}return c},e.prototype.intersection=function(n,r,i,a){var c=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(c)||(c=new Ae(e.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c},e.prototype.smallestInAbsValue=function(n,r,i,a){var c=n,u=Math.abs(c);return Math.abs(r)1e-4&&Ii.out.println("Distance = "+c.distance(u))},e.prototype.intersectionWithNormalization=function(n,r,i,a){var c=new Ae(n),u=new Ae(r),g=new Ae(i),w=new Ae(a),S=new Ae;this.normalizeToEnvCentre(c,u,g,w,S);var I=this.safeHCoordinateIntersection(c,u,g,w);return I.x+=S.x,I.y+=S.y,I},e.prototype.computeCollinearIntersection=function(n,r,i,a){var c=Dt.intersects(n,r,i),u=Dt.intersects(n,r,a),g=Dt.intersects(i,a,n),w=Dt.intersects(i,a,r);return c&&u?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):g&&w?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&g?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!u&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!u&&!g?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&g?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!c&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!c&&!g?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,a,c){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,N=i.y>a.y?i.y:a.y,q=u>I?u:I,J=wP?g:P,U=S0&&u>0||c<0&&u<0)return t.NO_INTERSECTION;var g=xt.orientationIndex(i,a,n),w=xt.orientationIndex(i,a,r);if(g>0&&w>0||g<0&&w<0)return t.NO_INTERSECTION;var S=c===0&&u===0&&g===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(c===0||u===0||g===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(a)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(a)?this._intPt[0]=r:c===0?this._intPt[0]=new Ae(i):u===0?this._intPt[0]=new Ae(a):g===0?this._intPt[0]=new Ae(n):w===0&&(this._intPt[0]=new Ae(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,a){var c=n,u=xt.distancePointLine(n,i,a),g=xt.distancePointLine(r,i,a);return g0?n>0?-i:i:n>0?i:-i;if(e===0||n===0)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,a=t,t=n,n=a,a=e,e=r,r=a):e<=-r?(i=-i,n=-n,r=-r):(a=t,t=-n,n=a,a=e,e=-r,r=a):r>0?-e<=r?(i=-i,t=-t,e=-e):(a=-t,t=n,n=a,a=-e,e=r,r=a):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,a=-t,t=-n,n=a,a=-e,e=-r,r=a),t>0)if(n>0){if(!(t<=n))return i}else return i;else{if(n>0)return-i;if(t>=n)i=-i,t=-t,n=-n;else return-i}for(;;){if(c=Math.floor(n/t),n=n-c*t,r=r-c*e,r<0)return-i;if(r>e)return i;if(t>n+n){if(er+r)return-i;n=t-n,r=e-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(c=Math.floor(t/n),t=t-c*n,e=e-c*r,e<0))return i;if(e>r)return-i;if(n>t+t){if(re+e)return i;t=n-t,e=r-e,i=-i}if(e===0)return t===0?0:i;if(t===0)return-i}};var $s=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};$s.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,a=t.y-this._p.y,c=e.x-this._p.x,u=e.y-this._p.y,g=Tc.signOfDet2x2(i,a,c,u);if(g===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};$s.prototype.isPointInPolygon=function(){return this.getLocation()!==ze.EXTERIOR};$s.prototype.getLocation=function(){return this._isPointOnSegment?ze.BOUNDARY:this._crossingCount%2===1?ze.INTERIOR:ze.EXTERIOR};$s.prototype.isOnSegment=function(){return this._isPointOnSegment};$s.prototype.interfaces_=function(){return[]};$s.prototype.getClass=function(){return $s};$s.locatePointInRing=function(){if(arguments[0]instanceof Ae&&Ut(arguments[1],Sn)){for(var t=arguments[0],e=arguments[1],n=new $s(t),r=new Ae,i=new Ae,a=1;a1||g<0||g>1)&&(i=!0)}}return i?Wo.min(xt.distancePointLine(t,n,r),xt.distancePointLine(e,n,r),xt.distancePointLine(n,t,e),xt.distancePointLine(r,t,e)):0};xt.isPointInRing=function(t,e){return xt.locatePointInRing(t,e)!==ze.EXTERIOR};xt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Ae;t.getCoordinate(0,r);for(var i=r.x,a=r.y,c=1;cn.y&&(n=a,r=i)}var c=r;do c=c-1,c<0&&(c=e);while(t[c].equals2D(n)&&c!==r);var u=r;do u=(u+1)%e;while(t[u].equals2D(n)&&u!==r);var g=t[c],w=t[u];if(g.equals2D(n)||w.equals2D(n)||g.equals2D(w))return!1;var S=xt.computeOrientation(g,n,w),I=!1;return S===0?I=g.x>w.x:I=S>0,I};xt.locatePointInRing=function(t,e){return $s.locatePointInRing(t,e)};xt.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};xt.computeOrientation=function(t,e,n){return xt.orientationIndex(t,e,n)};xt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new ir("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return a.distance(u);var S=((c.y-a.y)*(u.x-c.x)-(c.x-a.x)*(u.y-c.y))/g;return Math.abs(S)*Math.sqrt(g)}};xt.isOnLine=function(t,e){for(var n=new Hu,r=1;r0};yf.prototype.interfaces_=function(){return[ls]};yf.prototype.getClass=function(){return yf};var _f=function(){};_f.prototype.isInBoundary=function(t){return t>1};_f.prototype.interfaces_=function(){return[ls]};_f.prototype.getClass=function(){return _f};var vf=function(){};vf.prototype.isInBoundary=function(t){return t===1};vf.prototype.interfaces_=function(){return[ls]};vf.prototype.getClass=function(){return vf};var Gr=function(){};Gr.prototype.add=function(){};Gr.prototype.addAll=function(){};Gr.prototype.isEmpty=function(){};Gr.prototype.iterator=function(){};Gr.prototype.size=function(){};Gr.prototype.toArray=function(){};Gr.prototype.remove=function(){};function Hv(t){this.message=t||""}Hv.prototype=new Error;Hv.prototype.name="IndexOutOfBoundsException";var Uf=function(){};Uf.prototype.hasNext=function(){};Uf.prototype.next=function(){};Uf.prototype.remove=function(){};var Cs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Gr);function Gf(t){this.message=t||""}Gf.prototype=new Error;Gf.prototype.name="NoSuchElementException";var mt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Gr&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Gr]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},e.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},e.prototype.iterator=function(){return new $D(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new Hv;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}t.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],I=arguments[1];return this.add(S,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var P=arguments[0],D=arguments[1],N=arguments[2];if(N)for(var q=0;q=0;J--)r.add(P[J],D);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Ae){var re=arguments[0],U=arguments[1],j=arguments[2];if(!j){var Z=this.size();if(Z>0){if(re>0){var te=this.get(re-1);if(te.equals2D(U))return null}if(reCe&&(H=-1);for(var ce=me;ce!==Ce;ce+=H)r.add(pe[ce],he);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Ae(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(mt),mn=function(){},Iy={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Iy.ForwardComparator.get=function(){return wd};Iy.BidirectionalComparator.get=function(){return bf};Iy.coordArrayType.get=function(){return new Array(0).fill(null)};mn.prototype.interfaces_=function(){return[]};mn.prototype.getClass=function(){return mn};mn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};mn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};mn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};mn.extract=function(t,e,n){e=Wo.clamp(e,0,t.length),n=Wo.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=mn.compare(n,r),a=mn.isEqualReversed(n,r);return a?0:i};bf.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=mn.increasingDirection(n),a=mn.increasingDirection(r),c=i>0?0:n.length-1,u=a>0?0:n.length-1,g=0;g0)e=e.right;else return e.value}return null};ki.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var a=n.value;return n.value=e,a}while(n!==null);var c={key:t,left:null,right:null,value:e,parent:r,color:nl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};ki.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Eu;t!=null&&t!==this.root_&&t.parent.color===Eu;)if(Zn(t)===_0(Zn(Zn(t)))){var n=Kw(Zn(Zn(t)));Yw(n)===Eu?(Ja(Zn(t),nl),Ja(n,nl),Ja(Zn(Zn(t)),Eu),t=Zn(Zn(t))):(t===Kw(Zn(t))&&(t=Zn(t),e.rotateLeft(t)),Ja(Zn(t),nl),Ja(Zn(Zn(t)),Eu),e.rotateRight(Zn(Zn(t))))}else{var r=_0(Zn(Zn(t)));Yw(r)===Eu?(Ja(Zn(t),nl),Ja(r,nl),Ja(Zn(Zn(t)),Eu),t=Zn(Zn(t))):(t===_0(Zn(t))&&(t=Zn(t),e.rotateRight(t)),Ja(Zn(t),nl),Ja(Zn(Zn(t)),Eu),e.rotateLeft(Zn(Zn(t))))}this.root_.color=nl};ki.prototype.values=function(){var t=new mt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=ki.successor(e))!==null;)t.add(e.value);return t};ki.prototype.entrySet=function(){var t=new Zv,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=ki.successor(e))!==null;)t.add(e);return t};ki.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};ki.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};ki.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};ki.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};ki.prototype.size=function(){return this.size_};var Sd=function(){};Sd.prototype.interfaces_=function(){return[]};Sd.prototype.getClass=function(){return Sd};function zI(){}zI.prototype=new Cy;function na(){this.array_=[],arguments[0]instanceof Gr&&this.addAll(arguments[0])}na.prototype=new zI;na.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var c=i.substring(0,a);r.add(c),i=i.substring(a+n),a=i.indexOf(e)}i.length>0&&r.add(i);for(var u=new Array(r.size()).fill(null),g=0;g0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(os.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Pr.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Pr.createClosedRing(t,e,4);var r=e.getOrdinate(0,Sn.X)===e.getOrdinate(n-1,Sn.X)&&e.getOrdinate(0,Sn.Y)===e.getOrdinate(n-1,Sn.Y);return r?e:Pr.createClosedRing(t,e,n+1)};Pr.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Pr.copy(e,0,r,0,i);for(var a=i;a0&&Pr.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Tn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return xt.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Pr.reverse(r);var i=this.getFactory().createLineString(r);return i},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,c=0,u=0;c= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=this,a=0;a=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(vr),Ta=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};Cd.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Cd.prototype.getClass=function(){return Cd};var Td=function(){};Td.prototype.edit=function(t,e){return t instanceof Ma?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof vr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Eo?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Td.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Td.prototype.getClass=function(){return Td};var Tr=function(){var t=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 e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new da(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Tr(n):new Tr(n,r)}};Aa.prototype.interfaces_=function(){return[mf,fs]};Aa.prototype.getClass=function(){return Aa};Aa.instance=function(){return Aa.instanceObject};Yv.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Yv.instanceObject.get=function(){return new Aa};Object.defineProperties(Aa,Yv);var BI=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new mt,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new Zv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Hc),Pn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ia){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},Kv={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Pn.prototype.equals=function(t){if(!(t instanceof Pn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Pn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new ta(n).compareTo(new ta(r))};Pn.prototype.getScale=function(){return this._scale};Pn.prototype.isFloating=function(){return this._modelType===Pn.FLOATING||this._modelType===Pn.FLOATING_SINGLE};Pn.prototype.getType=function(){return this._modelType};Pn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Pn.FLOATING?t="Floating":this._modelType===Pn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Pn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Pn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Xt.isNaN(t))return t;if(this._modelType===Pn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Pn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Ae){var n=arguments[0];if(this._modelType===Pn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Pn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Pn.FLOATING?t=16:this._modelType===Pn.FLOATING_SINGLE?t=6:this._modelType===Pn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Pn.prototype.setScale=function(t){this._scale=Math.abs(t)};Pn.prototype.interfaces_=function(){return[fs,hs]};Pn.prototype.getClass=function(){return Pn};Pn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};Kv.serialVersionUID.get=function(){return 7777263578777804e3};Kv.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Pn,Kv);var ia=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Jv={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ia.prototype.readResolve=function(){return ia.nameToTypeMap.get(this._name)};ia.prototype.toString=function(){return this._name};ia.prototype.interfaces_=function(){return[fs]};ia.prototype.getClass=function(){return ia};Jv.serialVersionUID.get=function(){return-552860263173159e4};Jv.nameToTypeMap.get=function(){return new BI};Object.defineProperties(ia,Jv);Pn.Type=ia;Pn.FIXED=new ia("FIXED");Pn.FLOATING=new ia("FLOATING");Pn.FLOATING_SINGLE=new ia("FLOATING SINGLE");var dn=function t(){this._precisionModel=new Pn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ut(arguments[0],mf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Pn&&(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]))},VI={serialVersionUID:{configurable:!0}};dn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Ae(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Ae(t.getMinX(),t.getMinY()),new Ae(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Ae(t.getMinX(),t.getMinY()),new Ae(t.getMinX(),t.getMaxY()),new Ae(t.getMaxX(),t.getMaxY()),new Ae(t.getMaxX(),t.getMinY()),new Ae(t.getMinX(),t.getMinY())]),null)};dn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new vr(this.getCoordinateSequenceFactory().create(t),this);if(Ut(t,Sn))return new vr(t,this)}else return new vr(this.getCoordinateSequenceFactory().create([]),this)};dn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ru(null,this);if(arguments.length===1){var t=arguments[0];return new Ru(t,this)}};dn.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var a=i.next(),c=a.getClass();e===null&&(e=c),c!==e&&(n=!0),a.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(dn.toGeometryArray(t));var u=t.iterator().next(),g=t.size()>1;if(g){if(u instanceof Hr)return this.createMultiPolygon(dn.toPolygonArray(t));if(u instanceof vr)return this.createMultiLineString(dn.toLineStringArray(t));if(u instanceof Eo)return this.createMultiPoint(dn.toPointArray(t));on.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};dn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};dn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Ae){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Ut(arguments[0],Sn)){var e=arguments[0];return new Eo(e,this)}}};dn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};dn.prototype.createPolygon=function(){if(arguments.length===0)return new Hr(null,null,this);if(arguments.length===1){if(Ut(arguments[0],Sn)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Ma){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Hr(r,i,this)}};dn.prototype.getSRID=function(){return this._SRID};dn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hi(null,this);if(arguments.length===1){var t=arguments[0];return new Hi(t,this)}};dn.prototype.createGeometry=function(t){var e=new us(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};dn.prototype.getPrecisionModel=function(){return this._precisionModel};dn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ut(arguments[0],Sn)){var e=arguments[0];return new Ma(e,this)}}};dn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ta(null,this);if(arguments.length===1){var t=arguments[0];return new Ta(t,this)}};dn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new xf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new xf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ut(arguments[0],Sn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[t]};ma.prototype.push=function(t){return this.array_.push(t),t};ma.prototype.pop=function(t){if(this.array_.length===0)throw new Ay;return this.array_.pop()};ma.prototype.peek=function(){if(this.array_.length===0)throw new Ay;return this.array_[this.array_.length-1]};ma.prototype.empty=function(){return this.array_.length===0};ma.prototype.isEmpty=function(){return this.empty()};ma.prototype.search=function(t){return this.array_.indexOf(t)};ma.prototype.size=function(){return this.array_.length};ma.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===xt.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};oa.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var i=it.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};oa.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};oa.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}on.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 i=this.getRightmostSide(this._minDe,this._minIndex);i===it.LEFT&&(this._orientedDe=this._minDe.getSym())};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};var fl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new Ae(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(cl),ky=function(){this.array_=[]};ky.prototype.addLast=function(t){this.array_.push(t)};ky.prototype.removeFirst=function(){return this.array_.shift()};ky.prototype.isEmpty=function(){return this.array_.length===0};var Zi=function(){this._finder=null,this._dirEdgeList=new mt,this._nodes=new mt,this._rightMostCoord=null,this._env=null,this._finder=new oa};Zi.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Zi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Zi.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new fl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var a=t.getEdges().iterator();a.hasNext();){var c=a.next();c.setVisited(!0),e.copySymDepths(c)}};Zi.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(it.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Zi.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Zi.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(it.RIGHT)>=1&&e.getDepth(it.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Zi.prototype.computeDepths=function(t){var e=this,n=new Zv,r=new ky,i=t.getNode();for(r.addLast(i),n.add(i),t.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),e.computeNodeDepth(a);for(var c=a.getEdges().iterator();c.hasNext();){var u=c.next(),g=u.getSym();if(!g.isVisited()){var w=g.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Zi.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Zi.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Dt,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[it.ON]=this.location[it.ON],n[it.LEFT]=ze.NONE,n[it.RIGHT]=ze.NONE,this.location=n}for(var r=0;r1&&t.append(ze.toLocationSymbol(this.location[it.LEFT])),t.append(ze.toLocationSymbol(this.location[it.ON])),this.location.length>1&&t.append(ze.toLocationSymbol(this.location[it.RIGHT])),t.toString()};Xn.prototype.setLocations=function(t,e,n){this.location[it.ON]=t,this.location[it.LEFT]=e,this.location[it.RIGHT]=n};Xn.prototype.get=function(t){return t1};Xn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};zr.prototype.addPoints=function(t,e,n){var r=this,i=t.getCoordinates();if(e){var a=1;n&&(a=0);for(var c=a;c=0;g--)r._pts.add(i[g])}};zr.prototype.isHole=function(){return this._isHole};zr.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};zr.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!xt.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};zr.prototype.addHole=function(t){this._holes.add(t)};zr.prototype.isShell=function(){return this._shell===null};zr.prototype.getLabel=function(){return this._label};zr.prototype.getEdges=function(){return this._edges};zr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};zr.prototype.getShell=function(){return this._shell};zr.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,it.RIGHT);if(r===ze.NONE)return null;if(this._label.getLocation(n)===ze.NONE)return this._label.setLocation(n,r),null}};zr.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};zr.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};Ho.prototype.isInResult=function(){return this._isInResult};Ho.prototype.isVisited=function(){return this._isVisited};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};var Dy=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new zn(0,ze.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var i=ze.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==ze.BOUNDARY&&(i=a)}return i},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new zn(n,r):this._label.setLocation(n,r)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof zn)for(var i=arguments[0],a=0;a<2;a++){var c=n.computeMergedLocation(i,a),u=n._label.getLocation(a);u===ze.NONE&&n._label.setLocation(a,c)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=ze.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case ze.BOUNDARY:i=ze.INTERIOR;break;case ze.INTERIOR:i=ze.BOUNDARY;break;default:i=ze.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ho),sa=function(){this.nodeMap=new ki,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};sa.prototype.find=function(t){return this.nodeMap.get(t)};sa.prototype.addNode=function(){if(arguments[0]instanceof Ae){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof Dy){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};sa.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};sa.prototype.iterator=function(){return this.nodeMap.values().iterator()};sa.prototype.values=function(){return this.nodeMap.values()};sa.prototype.getBoundaryNodes=function(t){for(var e=new mt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===ze.BOUNDARY&&e.add(r)}return e};sa.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};sa.prototype.interfaces_=function(){return[]};sa.prototype.getClass=function(){return sa};var Bn=function(){},Wd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Bn.prototype.interfaces_=function(){return[]};Bn.prototype.getClass=function(){return Bn};Bn.isNorthern=function(t){return t===Bn.NE||t===Bn.NW};Bn.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Bn.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var r=te?t:e;return r===0&&i===3?3:r};Bn.isInHalfPlane=function(t,e){return e===Bn.SE?t===Bn.SE||t===Bn.SW:t===e||t===e+1};Bn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new ir("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Bn.NE:Bn.SE:e>=0?Bn.NW:Bn.SW}else if(arguments[0]instanceof Ae&&arguments[1]instanceof Ae){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new ir("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Bn.NE:Bn.SE:r.y>=n.y?Bn.NW:Bn.SW}};Wd.NE.get=function(){return 0};Wd.NW.get=function(){return 1};Wd.SW.get=function(){return 2};Wd.SE.get=function(){return 3};Object.defineProperties(Bn,Wd);var Di=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 t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],u=arguments[2],g=arguments[3];this._edge=a,this.init(c,u),this._label=g}};Di.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var u=c.buildMinimalRings(),g=r.findShell(u);g!==null?(r.placePolygonHoles(g,u),e.add(g)):n.addAll(u)}else i.add(c)}return i};Io.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Io.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new mt,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new cR(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};Io.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Io.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Io.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,c=null,u=e.iterator();u.hasNext();){var g=u.next(),w=g.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(c=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&xt.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||c.contains(S))&&(a=g)}return a};Io.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return on.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Io.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];hr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new mt,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Io.prototype.interfaces_=function(){return[]};Io.prototype.getClass=function(){return Io};var Sf=function(){};Sf.prototype.getBounds=function(){};Sf.prototype.interfaces_=function(){return[]};Sf.prototype.getClass=function(){return Sf};var Ps=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ps.prototype.getItem=function(){return this._item};Ps.prototype.getBounds=function(){return this._bounds};Ps.prototype.interfaces_=function(){return[Sf,fs]};Ps.prototype.getClass=function(){return Ps};var pl=function(){this._size=null,this._items=null,this._size=0,this._items=new mt,this._items.add(null)};pl.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};pl.prototype.size=function(){return this._size};pl.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)};pl.prototype.clear=function(){this._size=0,this._items.clear()};pl.prototype.isEmpty=function(){return this._size===0};pl.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)};pl.prototype.interfaces_=function(){return[]};pl.prototype.getClass=function(){return pl};var Xl=function(){};Xl.prototype.visitItem=function(t){};Xl.prototype.interfaces_=function(){return[]};Xl.prototype.getClass=function(){return Xl};var Lc=function(){};Lc.prototype.insert=function(t,e){};Lc.prototype.remove=function(t,e){};Lc.prototype.query=function(){};Lc.prototype.interfaces_=function(){return[]};Lc.prototype.getClass=function(){return Lc};var Wr=function(){if(this._childBoundables=new mt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},GI={serialVersionUID:{configurable:!0}};Wr.prototype.getLevel=function(){return this._level};Wr.prototype.size=function(){return this._childBoundables.size()};Wr.prototype.getChildBoundables=function(){return this._childBoundables};Wr.prototype.addChildBoundable=function(t){on.isTrue(this._bounds===null),this._childBoundables.add(t)};Wr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Wr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Wr.prototype.interfaces_=function(){return[Sf,fs]};Wr.prototype.getClass=function(){return Wr};GI.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Wr,GI);var Ms=function(){};Ms.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ms.min=function(t){return Ms.sort(t),t.get(0)};Ms.sort=function(t,e){var n=t.toArray();e?Mu.sort(n,e):Mu.sort(n);for(var r=t.iterator(),i=0,a=n.length;iNr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new ir("neither boundable is composite")};Nr.prototype.isLeaves=function(){return!(Nr.isComposite(this._boundable1)||Nr.isComposite(this._boundable2))};Nr.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Nr.prototype.expand=function(t,e,n,r){for(var i=this,a=t.getChildBoundables(),c=a.iterator();c.hasNext();){var u=c.next(),g=new Nr(u,e,i._itemDistance);g.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Ry={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};gi.prototype.getNodeCapacity=function(){return this._nodeCapacity};gi.prototype.lastNode=function(t){return t.get(t.size()-1)};gi.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Wr?n+=t.size(i):i instanceof Ps&&(n+=1)}return n}};gi.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ps&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};gi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new mt:e}else if(arguments.length===1){for(var n=arguments[0],r=new mt,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Wr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof Ps?r.add(a.getItem()):on.shouldNeverReachHere()}return r.size()<=0?null:r}};gi.prototype.insert=function(t,e){on.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ps(t,e))};gi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new mt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(on.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var u=c.next();u instanceof Wr?t.boundablesAtLevel(r,u,a):(on.isTrue(u instanceof Ps),r===-1&&a.add(u))}return null}};gi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new mt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Ut(arguments[2],Xl)&&arguments[0]instanceof Object&&arguments[1]instanceof Wr)for(var a=arguments[0],c=arguments[1],u=arguments[2],g=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};gi.prototype.createParentBoundables=function(t,e){var n=this;on.isTrue(!t.isEmpty());var r=new mt;r.add(this.createNode(e));var i=new mt(t);Ms.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var c=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};gi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};gi.prototype.interfaces_=function(){return[fs]};gi.prototype.getClass=function(){return gi};gi.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new mt,u=0;u0;){var N=D.poll(),q=N.getDistance();if(q>=I)break;N.isLeaves()?(I=q,P=N):N.expandToQueue(D,I)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var J=arguments[0],re=arguments[1],U=arguments[2],j=new Ps(J,re),Z=new Nr(this.getRoot(),j,U);return this.nearestNeighbour(Z)[0]}},e.prototype.interfaces_=function(){return[Lc,fs]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return Jw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[df]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[df]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(gi),Jw=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Dt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Wr),io=function(){};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};io.relativeSign=function(t,e){return te?1:0};io.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=io.relativeSign(e.x,n.x),i=io.relativeSign(e.y,n.y);switch(t){case 0:return io.compareValue(r,i);case 1:return io.compareValue(i,r);case 2:return io.compareValue(i,-r);case 3:return io.compareValue(-r,i);case 4:return io.compareValue(-r,-i);case 5:return io.compareValue(-i,-r);case 6:return io.compareValue(-i,r);case 7:return io.compareValue(r,-i)}return on.shouldNeverReachHere("invalid octant value"),0};io.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Yl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new Ae(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};Yl.prototype.getCoordinate=function(){return this.coord};Yl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Yl.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:io.compare(this._segmentOctant,this.coord,e.coord)};Yl.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Yl.prototype.isInterior=function(){return this._isInterior};Yl.prototype.interfaces_=function(){return[hs]};Yl.prototype.getClass=function(){return Yl};var Xi=function(){this._nodeMap=new ki,this._edge=null;var t=arguments[0];this._edge=t};Xi.prototype.getSplitCoordinates=function(){var t=this,e=new qd;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();t.addEdgeCoordinates(r,i,e),r=i}return e.toCoordinateArray()};Xi.prototype.addCollapsedNodes=function(){var t=this,e=new mt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};Xi.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Xi.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Ae&&arguments[1]instanceof Ae){var i=arguments[0],a=arguments[1],c=a.x-i.x,u=a.y-i.y;if(c===0&&u===0)throw new ir("Cannot compute the octant for two identical points "+i);return Pc.octant(c,u)}};var ka=function(){};ka.prototype.getCoordinates=function(){};ka.prototype.size=function(){};ka.prototype.getCoordinate=function(t){};ka.prototype.isClosed=function(){};ka.prototype.setData=function(t){};ka.prototype.getData=function(){};ka.prototype.interfaces_=function(){return[]};ka.prototype.getClass=function(){return ka};var Ld=function(){};Ld.prototype.addIntersection=function(t,e){};Ld.prototype.interfaces_=function(){return[ka]};Ld.prototype.getClass=function(){return Ld};var Mr=function(){this._nodeList=new Xi(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Mr.prototype.getCoordinates=function(){return this._pts};Mr.prototype.size=function(){return this._pts.length};Mr.prototype.getCoordinate=function(t){return this._pts[t]};Mr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Mr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};Mr.prototype.setData=function(t){this._data=t};Mr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Pc.octant(t,e)};Mr.prototype.getData=function(){return this._data};Mr.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],a=new Ae(n.getIntersection(i));this.addIntersection(a,r)}};Mr.prototype.toString=function(){return Ts.toLineString(new Tr(this._pts))};Mr.prototype.getNodeList=function(){return this._nodeList};Mr.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof Ae){var r=arguments[0];return xt.orientationIndex(this.p0,this.p1,r)}};Rt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Rt.prototype.isVertical=function(){return this.p0.x===this.p1.x};Rt.prototype.equals=function(t){if(!(t instanceof Rt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Rt.prototype.intersection=function(t){var e=new Hu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Rt.prototype.project=function(){if(arguments[0]instanceof Ae){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Ae(t);var e=this.projectionFactor(t),n=new Ae;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Rt){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var c=this.project(r.p0);i<0&&(c=this.p0),i>1&&(c=this.p1);var u=this.project(r.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new Rt(c,u)}};Rt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Rt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Rt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Rt.prototype.distancePerpendicular=function(t){return xt.distancePointLinePerpendicular(t,this.p0,this.p1)};Rt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Rt.prototype.midPoint=function(){return Rt.midPoint(this.p0,this.p1)};Rt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return Xt.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};Rt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=Xt.MAX_VALUE,i=null,a=this.closestPoint(t.p0);r=a.distance(t.p0),n[0]=a,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||Xt.isNaN(e))&&(e=1),e};Rt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Rt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Rt.prototype.distance=function(){if(arguments[0]instanceof Rt){var t=arguments[0];return xt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Ae){var e=arguments[0];return xt.distancePointLine(e,this.p0,this.p1)}};Rt.prototype.pointAlong=function(t){var e=new Ae;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};Rt.prototype.hashCode=function(){var t=Xt.doubleToLongBits(this.p0.x);t^=Xt.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Xt.doubleToLongBits(this.p1.x);n^=Xt.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};Rt.prototype.interfaces_=function(){return[hs,fs]};Rt.prototype.getClass=function(){return Rt};Rt.midPoint=function(t,e){return new Ae((t.x+e.x)/2,(t.y+e.y)/2)};jI.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Rt,jI);var Pd=function(){this.tempEnv1=new Dt,this.tempEnv2=new Dt,this._overlapSeg1=new Rt,this._overlapSeg2=new Rt};Pd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Pd.prototype.interfaces_=function(){return[]};Pd.prototype.getClass=function(){return Pd};var Co=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Co.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Co.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],a=this._pts[n];if(r.tempEnv1.init(i,a),n-e===1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var c=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=Bn.quadrant(t[n],t[n+1]),i=e+1;ic.getId()&&(c.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return Qw},Object.defineProperties(e,n),e}(Md),Qw=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3],c=n.getContext(),u=i.getContext();this._si.processIntersections(c,r,u,a)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Pd),Ln=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],u=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(c),this.setMitreLimit(u)}}},vl={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}};Ln.prototype.getEndCapStyle=function(){return this._endCapStyle};Ln.prototype.isSingleSided=function(){return this._isSingleSided};Ln.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Ln.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ln.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Ln.JOIN_ROUND&&(this._quadrantSegments=Ln.DEFAULT_QUADRANT_SEGMENTS)};Ln.prototype.getJoinStyle=function(){return this._joinStyle};Ln.prototype.setJoinStyle=function(t){this._joinStyle=t};Ln.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Ln.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Ln.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Ln.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Ln.prototype.getMitreLimit=function(){return this._mitreLimit};Ln.prototype.setMitreLimit=function(t){this._mitreLimit=t};Ln.prototype.setSingleSided=function(t){this._isSingleSided=t};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};vl.CAP_ROUND.get=function(){return 1};vl.CAP_FLAT.get=function(){return 2};vl.CAP_SQUARE.get=function(){return 3};vl.JOIN_ROUND.get=function(){return 1};vl.JOIN_MITRE.get=function(){return 2};vl.JOIN_BEVEL.get=function(){return 3};vl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};vl.DEFAULT_MITRE_LIMIT.get=function(){return 5};vl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Ln,vl);var br=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=xt.COUNTERCLOCKWISE,this._inputLine=t||null},Hd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};br.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],a=this._inputLine[e],c=this._inputLine[n];return!this.isConcave(i,a,c)||!this.isShallow(i,a,c,r)?!1:this.isShallowSampled(i,a,t,n,r)};br.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};Zo.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=vn.PI_TIMES_2;for(;t<=-Math.PI;)t+=vn.PI_TIMES_2;return t};vn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}};vn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,u=r*a+i*c;return u>0};vn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,u=r*a+i*c;return u<0};vn.interiorAngle=function(t,e,n){var r=vn.angle(e,t),i=vn.angle(e,n);return Math.abs(i-r)};vn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=vn.PI_TIMES_2;t>=vn.PI_TIMES_2&&(t=0)}else{for(;t>=vn.PI_TIMES_2;)t-=vn.PI_TIMES_2;t<0&&(t=0)}return t};vn.angleBetween=function(t,e,n){var r=vn.angle(e,t),i=vn.angle(e,n);return vn.diff(r,i)};vn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};vn.toRadians=function(t){return t*Math.PI/180};vn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?vn.COUNTERCLOCKWISE:n<0?vn.CLOCKWISE:vn.NONE};vn.angleBetweenOriented=function(t,e,n){var r=vn.angle(e,t),i=vn.angle(e,n),a=i-r;return a<=-Math.PI?a+vn.PI_TIMES_2:a>Math.PI?a-vn.PI_TIMES_2:a};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 xt.COUNTERCLOCKWISE};Zc.CLOCKWISE.get=function(){return xt.CLOCKWISE};Zc.NONE.get=function(){return xt.COLLINEAR};Object.defineProperties(vn,Zc);var er=function t(){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 Rt,this._seg1=new Rt,this._offset0=new Rt,this._offset1=new Rt,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new Hu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Ln.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Zd={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}};er.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,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=xt.computeOrientation(this._s0,this._s1,this._s2),r=n===xt.CLOCKWISE&&this._side===it.LEFT||n===xt.COUNTERCLOCKWISE&&this._side===it.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};er.prototype.addLineEndCap=function(t,e){var n=new Rt(t,e),r=new Rt;this.computeOffsetSegment(n,it.LEFT,this._distance,r);var i=new Rt;this.computeOffsetSegment(n,it.RIGHT,this._distance,i);var a=e.x-t.x,c=e.y-t.y,u=Math.atan2(c,a);switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,u+Math.PI/2,u-Math.PI/2,xt.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Ln.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Ln.CAP_SQUARE:var g=new Ae;g.x=Math.abs(this._distance)*Math.cos(u),g.y=Math.abs(this._distance)*Math.sin(u);var w=new Ae(r.p1.x+g.x,r.p1.y+g.y),S=new Ae(i.p1.x+g.x,i.p1.y+g.y);this._segList.addPt(w),this._segList.addPt(S);break}};er.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};er.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Is.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:a.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(u){if(u instanceof Vf)a=new Ae(0,0),i=!1;else throw u}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};er.prototype.addFilletCorner=function(t,e,n,r,i){var a=e.x-t.x,c=e.y-t.y,u=Math.atan2(c,a),g=n.x-t.x,w=n.y-t.y,S=Math.atan2(w,g);r===xt.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,u,S,r,i),this._segList.addPt(n)};er.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Ae((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 r=new Ae((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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};er.prototype.createCircle=function(t){var e=new Ae(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};er.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};er.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Zo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*er.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};er.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===Ln.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ln.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,xt.CLOCKWISE,this._distance))};er.prototype.closeRing=function(){this._segList.closeRing()};er.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};er.prototype.interfaces_=function(){return[]};er.prototype.getClass=function(){return er};Zd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Zd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Zd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Zd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(er,Zd);var so=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};so.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var a=i.getCoordinates();return n&&mn.reverse(a),a};so.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=br.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],it.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var u=br.simplify(t,r),g=u.length-1;n.initSideSegments(u[0],u[1],it.LEFT),n.addFirstSegment();for(var w=2;w<=g;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};so.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===it.RIGHT&&(r=-r);var i=br.simplify(t,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],e);for(var c=1;c<=a;c++){var u=c!==1;n.addNextSegment(i[c],u)}n.closeRing()};so.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=br.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],it.LEFT);for(var a=2;a<=i;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=br.simplify(t,-n),u=c.length-1;e.initSideSegments(c[u],c[u-1],it.LEFT);for(var g=u-2;g>=0;g--)e.addNextSegment(c[g],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};so.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Ln.CAP_ROUND:e.createCircle(t);break;case Ln.CAP_SQUARE:e.createSquare(t);break}};so.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);var a=r.getCoordinates();return a};so.prototype.getBufferParameters=function(){return this._bufParams};so.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};so.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return so.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};so.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=br.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],it.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var u=br.simplify(t,r),g=u.length-1;n.initSideSegments(u[0],u[1],it.LEFT),n.addFirstSegment();for(var w=2;w<=g;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};so.prototype.getSegGen=function(t){return new er(this._precisionModel,this._bufParams,t)};so.prototype.interfaces_=function(){return[]};so.prototype.getClass=function(){return so};so.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;na.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ut(arguments[2],Cs)&&arguments[0]instanceof Ae&&arguments[1]instanceof ov)for(var c=arguments[0],u=arguments[1],g=arguments[2],w=u.getEdge().getCoordinates(),S=0;St._seg.p1.y&&t._seg.reverse();var I=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(It._seg.p1.y)&&xt.computeOrientation(t._seg.p0,t._seg.p1,c)!==xt.RIGHT){var P=u.getDepth(it.LEFT);t._seg.p0.equals(w[S])||(P=u.getDepth(it.RIGHT));var D=new Ou(t._seg,P);g.add(D)}}else if(Ut(arguments[2],Cs)&&arguments[0]instanceof Ae&&Ut(arguments[1],Cs))for(var N=arguments[0],q=arguments[1],J=arguments[2],re=q.iterator();re.hasNext();){var U=re.next();U.isForward()&&t.findStabbedSegments(N,U,J)}}};Mc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ms.min(e);return n._leftDepth};Mc.prototype.interfaces_=function(){return[]};Mc.prototype.getClass=function(){return Mc};HI.DepthSegment.get=function(){return Ou};Object.defineProperties(Mc,HI);var Ou=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Rt(t),this._leftDepth=e};Ou.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};Ou.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Ou.prototype.toString=function(){return this._upwardSeg.toString()};Ou.prototype.interfaces_=function(){return[hs]};Ou.prototype.getClass=function(){return Ou};var Mn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Mn.prototype.area=function(){return Mn.area(this.p0,this.p1,this.p2)};Mn.prototype.signedArea=function(){return Mn.signedArea(this.p0,this.p1,this.p2)};Mn.prototype.interpolateZ=function(t){if(t===null)throw new ir("Supplied point is null.");return Mn.interpolateZ(t,this.p0,this.p1,this.p2)};Mn.prototype.longestSideLength=function(){return Mn.longestSideLength(this.p0,this.p1,this.p2)};Mn.prototype.isAcute=function(){return Mn.isAcute(this.p0,this.p1,this.p2)};Mn.prototype.circumcentre=function(){return Mn.circumcentre(this.p0,this.p1,this.p2)};Mn.prototype.area3D=function(){return Mn.area3D(this.p0,this.p1,this.p2)};Mn.prototype.centroid=function(){return Mn.centroid(this.p0,this.p1,this.p2)};Mn.prototype.inCentre=function(){return Mn.inCentre(this.p0,this.p1,this.p2)};Mn.prototype.interfaces_=function(){return[]};Mn.prototype.getClass=function(){return Mn};Mn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)};Mn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};Mn.det=function(t,e,n,r){return t*r-e*n};Mn.interpolateZ=function(t,e,n,r){var i=e.x,a=e.y,c=n.x-i,u=r.x-i,g=n.y-a,w=r.y-a,S=c*w-u*g,I=t.x-i,P=t.y-a,D=(w*I-u*P)/S,N=(-g*I+c*P)/S,q=e.z+D*(n.z-e.z)+N*(r.z-e.z);return q};Mn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),a=n.distance(t),c=r;return i>c&&(c=i),a>c&&(c=a),c};Mn.isAcute=function(t,e,n){return!(!vn.isAcute(t,e,n)||!vn.isAcute(e,n,t)||!vn.isAcute(n,t,e))};Mn.circumcentre=function(t,e,n){var r=n.x,i=n.y,a=t.x-r,c=t.y-i,u=e.x-r,g=e.y-i,w=2*Mn.det(a,c,u,g),S=Mn.det(c,a*a+c*c,g,u*u+g*g),I=Mn.det(a,a*a+c*c,u,u*u+g*g),P=r-S/w,D=i+I/w;return new Ae(P,D)};Mn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Is(t.x+n/2,t.y+r/2,1),a=new Is(t.x-r+n/2,t.y+n+r/2,1);return new Is(i,a)};Mn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),a=r/(r+i),c=n.x-t.x,u=n.y-t.y,g=new Ae(t.x+a*c,t.y+a*u);return g};Mn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,a=e.z-t.z,c=n.x-t.x,u=n.y-t.y,g=n.z-t.z,w=i*g-a*u,S=a*c-r*g,I=r*u-i*c,P=w*w+S*S+I*I,D=Math.sqrt(P)/2;return D};Mn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Ae(r,i)};Mn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),a=t.distance(e),c=r+i+a,u=(r*t.x+i*e.x+a*n.x)/c,g=(r*t.y+i*e.y+a*n.y)/c;return new Ae(u,g)};var cs=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new mt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};cs.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,ze.EXTERIOR,ze.INTERIOR)};cs.prototype.addPolygon=function(t){var e=this,n=this._distance,r=it.LEFT;this._distance<0&&(n=-this._distance,r=it.RIGHT);var i=t.getExteriorRing(),a=mn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,ze.EXTERIOR,ze.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(u,-e._distance)||e.addPolygonRing(g,n,it.opposite(r),ze.INTERIOR,ze.EXTERIOR)}};cs.prototype.isTriangleErodedCompletely=function(t,e){var n=new Mn(t[0],t[1],t[2]),r=n.inCentre(),i=xt.distancePointLine(r,n.p0,n.p1);return i=Ma.MINIMUM_VALID_SIZE&&xt.isCCW(t)&&(a=i,c=r,n=it.opposite(n));var u=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(u,a,c)};cs.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Hr?this.addPolygon(t):t instanceof vr?this.addLineString(t):t instanceof Eo?this.addPoint(t):t instanceof xf?this.addCollection(t):t instanceof Ru?this.addCollection(t):t instanceof Ta?this.addCollection(t):t instanceof Hi&&this.addCollection(t)};cs.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};cs.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new Gf;var t=this._parent.getGeometryN(this._index++);return t instanceof Hi?(this._subcollectionIterator=new La(t),this._subcollectionIterator.next()):t};La.prototype.remove=function(){throw new Error(this.getClass().getName())};La.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)};La.prototype.interfaces_=function(){return[Uf]};La.prototype.getClass=function(){return La};La.isAtomic=function(t){return!(t instanceof Hi)};var qo=function(){this._geom=null;var t=arguments[0];this._geom=t};qo.prototype.locate=function(t){return qo.locate(t,this._geom)};qo.prototype.interfaces_=function(){return[If]};qo.prototype.getClass=function(){return qo};qo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?xt.isPointInRing(t,e.getCoordinates()):!1};qo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!qo.isPointInRing(t,n))return!1;for(var r=0;r=0;a--){var c=n._edgeList.get(a),u=c.getSym();i===null&&(i=u),r!==null&&u.setNext(r),r=c}i.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(it.LEFT),c=r.getDepth(it.RIGHT),u=this.computeDepths(i+1,this._edgeList.size(),a),g=this.computeDepths(0,i,u);if(g!==c)throw new fl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],P=I,D=w;D=0;u--){var g=r._resultAreaEdgeList.get(u),w=g.getSym();switch(i===null&&g.getEdgeRing()===n&&(i=g),c){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;a=w,c=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(g.getEdgeRing()!==n)continue;a.setNextMin(g),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(on.isTrue(i!==null,"found null for first outgoing dirEdge"),on.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],c=0,u=this.iterator();u.hasNext();){var g=u.next();g.getEdgeRing()===a&&c++}return c}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=ze.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=ze.INTERIOR;break}if(a.isInResult()){n=ze.EXTERIOR;break}}}if(n===ze.NONE)return null;for(var c=n,u=this.iterator();u.hasNext();){var g=u.next(),w=g.getSym();g.isLineEdge()?g.getEdge().setCovered(c===ze.INTERIOR):(g.isInResult()&&(c=ze.EXTERIOR),w.isInResult()&&(c=ze.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new zn(ze.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getEdge(),u=c.getLabel(),g=0;g<2;g++){var w=u.getLocation(g);(w===ze.INTERIOR||w===ze.BOUNDARY)&&r._label.setLocation(g,ze.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ri),ZI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new Dy(n,new fR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wf),Kl=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Kl.prototype.compareTo=function(t){var e=t,n=Kl.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};Kl.prototype.interfaces_=function(){return[hs]};Kl.prototype.getClass=function(){return Kl};Kl.orientation=function(t){return mn.increasingDirection(t)===1};Kl.compareOriented=function(t,e,n,r){for(var i=e?1:-1,a=r?1:-1,c=e?t.length:-1,u=r?n.length:-1,g=e?0:t.length-1,w=r?0:n.length-1;;){var S=t[g].compareTo(n[w]);if(S!==0)return S;g+=i,w+=a;var I=g===c,P=w===u;if(I&&!P)return-1;if(!I&&P)return 1;if(I&&P)return 0}};var As=function(){this._edges=new mt,this._ocaMap=new ki};As.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),a=0;a0&&t.print(","),t.print(i[a].x+" "+i[a].y);t.println(")")}t.print(") ")};As.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};As.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),u=0;c[u++]=new Ae(t.coord);for(var g=t.segmentIndex+1;g<=e.segmentIndex;g++)c[u++]=n.edge.pts[g];return a&&(c[u]=e.coord),new iy(c,new zn(this.edge._label))};Da.prototype.add=function(t,e,n){var r=new aa(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Da.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};var Fu=function(){};Fu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new mt;r.add(new ta(n));do{var i=e.findChainEnd(t,n);r.add(new ta(i)),n=i}while(nn?e:n};dl.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ei.prototype.getDelta=function(t){return this._depth[t][it.RIGHT]-this._depth[t][it.LEFT]};Ei.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?ze.EXTERIOR:ze.INTERIOR};Ei.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ei.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===ze.EXTERIOR||i===ze.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ei.depthAtLocation(i):t._depth[n][r]+=Ei.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],u=arguments[2];u===ze.INTERIOR&&this._depth[a][c]++}};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.depthAtLocation=function(t){return t===ze.EXTERIOR?0:t===ze.INTERIOR?1:Ei.NULL_VALUE};XI.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ei,XI);var iy=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Da(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ei,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,zn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,c=!0,u=this.pts.length,g=0;g0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new dl(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Dt;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(c)return!1;var u=this.intersectsToleranceSquare(t,e);return on.isTrue(!(c&&u),"Found bad envelope test"),u};ao.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new Ae(this._maxx,this._maxy),this._corner[1]=new Ae(this._minx,this._maxy),this._corner[2]=new Ae(this._minx,this._miny),this._corner[3]=new Ae(this._maxx,this._miny)};ao.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};ao.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};ao.prototype.getCoordinate=function(){return this._originalPt};ao.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};ao.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=ao.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Dt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};ao.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};ao.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||t.equals(this._pt)||e.equals(this._pt))};ao.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return this.intersects(n,r)?(t.addIntersection(this.getCoordinate(),e),!0):!1};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};KI.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(ao,KI);var Ad=function(){this.tempEnv1=new Dt,this.selectedSegment=new Rt};Ad.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};Ad.prototype.interfaces_=function(){return[]};Ad.prototype.getClass=function(){return Ad};var Cf=function(){this._index=null;var t=arguments[0];this._index=t},JI={HotPixelSnapAction:{configurable:!0}};Cf.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),a=new QI(e,n,r);return this._index.query(i,{interfaces_:function(){return[Xl]},visitItem:function(c){var u=c;u.select(i,a)}}),a.isNodeAdded()}};Cf.prototype.interfaces_=function(){return[]};Cf.prototype.getClass=function(){return Cf};JI.HotPixelSnapAction.get=function(){return QI};Object.defineProperties(Cf,JI);var QI=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ad),Ac=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new mt};Ac.prototype.processIntersections=function(t,e,n,r){var i=this;if(t===n&&e===r)return null;var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],u=n.getCoordinates()[r],g=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,c,u,g),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(a){if(a instanceof fl)t._saveException=a;else throw a}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=wi.precisionScaleFactor(this._argGeom,this._distance,n),i=new Pn(r);this.bufferFixedPrecision(i)}};wi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Pn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};wi.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};wi.prototype.bufferOriginalPrecision=function(){try{var t=new Wi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof cl)this._saveException=e;else throw e}finally{}};wi.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};wi.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};wi.prototype.interfaces_=function(){return[]};wi.prototype.getClass=function(){return wi};wi.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new wi(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],u=new wi(i);u.setQuadrantSegments(c);var g=u.getResultGeometry(a);return g}else if(arguments[2]instanceof Ln&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],P=new wi(w,I),D=P.getResultGeometry(S);return D}}else if(arguments.length===4){var N=arguments[0],q=arguments[1],J=arguments[2],re=arguments[3],U=new wi(N);U.setQuadrantSegments(J),U.setEndCapStyle(re);var j=U.getResultGeometry(q);return j}};wi.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Wo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=e>0?e:0,c=i+2*a,u=Math.trunc(Math.log(c)/Math.log(10)+1),g=n-u,w=Math.pow(10,g);return w};qf.CAP_ROUND.get=function(){return Ln.CAP_ROUND};qf.CAP_BUTT.get=function(){return Ln.CAP_FLAT};qf.CAP_FLAT.get=function(){return Ln.CAP_FLAT};qf.CAP_SQUARE.get=function(){return Ln.CAP_SQUARE};qf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(wi,qf);var Gi=function(){this._pt=[new Ae,new Ae],this._distance=Xt.NaN,this._isNull=!0};Gi.prototype.getCoordinates=function(){return this._pt};Gi.prototype.getCoordinate=function(t){return this._pt[t]};Gi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};var Ea=function(){};Ea.prototype.interfaces_=function(){return[]};Ea.prototype.getClass=function(){return Ea};Ea.computeDistance=function(){if(arguments[2]instanceof Gi&&arguments[0]instanceof vr&&arguments[1]instanceof Ae)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Rt,a=0;a0||this._isIn?ze.INTERIOR:ze.EXTERIOR)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var qi=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},$I={INSIDE_AREA:{configurable:!0}};qi.prototype.isInsideArea=function(){return this._segIndex===qi.INSIDE_AREA};qi.prototype.getCoordinate=function(){return this._pt};qi.prototype.getGeometryComponent=function(){return this._component};qi.prototype.getSegmentIndex=function(){return this._segIndex};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};$I.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,$I);var jl=function(t){this._pts=t||null};jl.prototype.filter=function(t){t instanceof Eo&&this._pts.add(t)};jl.prototype.interfaces_=function(){return[ra]};jl.prototype.getClass=function(){return jl};jl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Eo?Ms.singletonList(t):jl.getPoints(t,new mt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Eo?n.add(e):e instanceof Hi&&e.apply(new jl(n)),n}};var Dc=function(){this._locations=null;var t=arguments[0];this._locations=t};Dc.prototype.filter=function(t){(t instanceof Eo||t instanceof vr||t instanceof Hr)&&this._locations.add(new qi(t,0,t.getCoordinate()))};Dc.prototype.interfaces_=function(){return[ra]};Dc.prototype.getClass=function(){return Dc};Dc.getLocations=function(t){var e=new mt;return t.apply(new Dc(e)),e};var Ci=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ks,this._minDistanceLocation=null,this._minDistance=Xt.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ci.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=al.getPolygons(this._geom[n]);if(a.size()>0){var c=Dc.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ut(arguments[0],Cs)&&Ut(arguments[1],Cs)){for(var u=arguments[0],g=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=e.getCoordinates(),a=n.getCoordinate(),c=0;cthis._minDistance)return null;for(var D=S.getCoordinates(),N=I.getCoordinates(),q=0;qthis._distance&&this.initialize(e,n,r)}};Ai.prototype.interfaces_=function(){return[]};Ai.prototype.getClass=function(){return Ai};var Ks=function(){};Ks.prototype.interfaces_=function(){return[]};Ks.prototype.getClass=function(){return Ks};Ks.computeDistance=function(){if(arguments[2]instanceof Ai&&arguments[0]instanceof vr&&arguments[1]instanceof Ae)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Rt,i=t.getCoordinates(),a=0;a1||t<=0)throw new ir("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ss.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ss.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ss.prototype.computeOrientedDistance=function(t,e,n){var r=new Rc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new $l(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ss.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ss(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ss(r,i);return c.setDensifyFraction(a),c.distance()}};t1.MaxPointDistanceFilter.get=function(){return Rc};t1.MaxDensifiedByFractionDistanceFilter.get=function(){return $l};Object.defineProperties(ss,t1);var Rc=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._euclideanDist=new Ks,this._geom=null;var t=arguments[0];this._geom=t};Rc.prototype.filter=function(t){this._minPtDist.initialize(),Ks.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Rc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Rc.prototype.interfaces_=function(){return[Pa]};Rc.prototype.getClass=function(){return Rc};var $l=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};$l.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),a=(i.x-r.x)/this._numSubSegs,c=(i.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ts.toLineString(i[0],i[1])+")"}};xo.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=xo.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),xo.VERBOSE&&Ii.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};xo.prototype.checkNegativeValid=function(){if(!(this._input instanceof Hr||this._input instanceof Ta||this._input instanceof Hi))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};xo.prototype.getErrorIndicator=function(){return this._errorIndicator};xo.prototype.checkMinimumDistance=function(t,e,n){var r=new Ci(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=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")};Ti.prototype.report=function(t){if(!Ti.VERBOSE)return null;Ii.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Ti.prototype.getErrorMessage=function(){return this._errorMsg};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};Ti.isValidMsg=function(t,e,n){var r=new Ti(t,e,n);return r.isValid()?null:r.getErrorMessage()};Ti.isValid=function(t,e,n){var r=new Ti(t,e,n);return!!r.isValid()};r1.VERBOSE.get=function(){return!1};r1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ti,r1);var ua=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ua.prototype.getCoordinates=function(){return this._pts};ua.prototype.size=function(){return this._pts.length};ua.prototype.getCoordinate=function(t){return this._pts[t]};ua.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ua.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Pc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};ua.prototype.setData=function(t){this._data=t};ua.prototype.getData=function(){return this._data};ua.prototype.toString=function(){return Ts.toLineString(new Tr(this._pts))};ua.prototype.interfaces_=function(){return[ka]};ua.prototype.getClass=function(){return ua};var yi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new mt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};yi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};yi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};yi.prototype.getIntersectionSegments=function(){return this._intSegments};yi.prototype.count=function(){return this._intersectionCount};yi.prototype.getIntersections=function(){return this._intersections};yi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};yi.prototype.setKeepIntersections=function(t){this._keepIntersections=t};yi.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(t,e)||this.isEndSegment(n,r);if(!i)return null}var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],u=n.getCoordinates()[r],g=n.getCoordinates()[r+1];this._li.computeIntersection(a,c,u,g),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=c,this._intSegments[2]=u,this._intSegments[3]=g,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};yi.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};yi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};yi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};yi.prototype.interfaces_=function(){return[zu]};yi.prototype.getClass=function(){return yi};yi.createAllIntersectionsFinder=function(t){var e=new yi(t);return e.setFindAllIntersections(!0),e};yi.createAnyIntersectionFinder=function(t){return new yi(t)};yi.createIntersectionCounter=function(t){var e=new yi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ds=function(){this._li=new Hu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ds.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ds.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ds.prototype.isValid=function(){return this.execute(),this._isValid};Ds.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ds.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new yi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new $v;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ds.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new fl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ds.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ts.toLineString(t[0],t[1])+" and "+Ts.toLineString(t[2],t[3])};Ds.prototype.interfaces_=function(){return[]};Ds.prototype.getClass=function(){return Ds};Ds.computeIntersections=function(t){var e=new Ds(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Vu=function t(){this._nv=null;var e=arguments[0];this._nv=new Ds(t.toSegmentStrings(e))};Vu.prototype.checkValid=function(){this._nv.checkValid()};Vu.prototype.interfaces_=function(){return[]};Vu.prototype.getClass=function(){return Vu};Vu.toSegmentStrings=function(t){for(var e=new mt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new ua(r.getCoordinates(),r))}return e};Vu.checkValid=function(t){var e=new Vu(t);e.checkValid()};var Nc=function(t){this._mapOp=t};Nc.prototype.map=function(t){for(var e=this,n=new mt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};var Na=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Rt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof vr&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Na.prototype.snapVertices=function(t,e){for(var n=this,r=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(c+1,new Ae(a),!1)}};Na.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=Xt.MAX_VALUE,i=-1,a=0;ae&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Lr.computeOverlaySnapTolerance(i),Lr.computeOverlaySnapTolerance(a))}};Lr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Lr.SNAP_PRECISION_FACTOR;return r};Lr.snapToSelf=function(t,e,n){var r=new Lr(t);return r.snapToSelf(e,n)};eC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Lr,eC);var tC=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var i=new Na(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),a=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lo),Ui=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Ui.prototype.getCommon=function(){return Xt.longBitsToDouble(this._commonBits)};Ui.prototype.add=function(t){var e=Xt.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Ui.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Ui.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Ui.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Ui.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Ui.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Xt.longBitsToDouble(t),n=Xt.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return a}};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.getBit=function(t,e){var n=1<>52};Ui.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Ui.getBit(t,r)!==Ui.getBit(e,r))return n;n++}return 52};var eu=function(){this._commonCoord=null,this._ccFilter=new zc},i1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};eu.prototype.addCommonBits=function(t){var e=new tu(this._commonCoord);t.apply(e),t.geometryChanged()};eu.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new Ae(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new tu(e);return t.apply(n),t.geometryChanged(),t};eu.prototype.getCommonCoordinate=function(){return this._commonCoord};eu.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};eu.prototype.interfaces_=function(){return[]};eu.prototype.getClass=function(){return eu};i1.CommonCoordinateFilter.get=function(){return zc};i1.Translater.get=function(){return tu};Object.defineProperties(eu,i1);var zc=function(){this._commonBitsX=new Ui,this._commonBitsY=new Ui};zc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};zc.prototype.getCommonCoordinate=function(){return new Ae(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};zc.prototype.interfaces_=function(){return[Pa]};zc.prototype.getClass=function(){return zc};var tu=function(){this.trans=null;var t=arguments[0];this.trans=t};tu.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)};tu.prototype.isDone=function(){return!1};tu.prototype.isGeometryChanged=function(){return!0};tu.prototype.interfaces_=function(){return[Ls]};tu.prototype.getClass=function(){return tu};var _i=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};_i.prototype.selfSnap=function(t){var e=new Lr(t),n=e.snapTo(t,this._snapTolerance);return n};_i.prototype.removeCommonBits=function(t){this._cbr=new eu,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};_i.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};_i.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Qt.overlayOp(e[0],e[1],t);return this.prepareResult(n)};_i.prototype.checkValid=function(t){t.isValid()||Ii.out.println("Snapped geometry is invalid")};_i.prototype.computeSnapTolerance=function(){this._snapTolerance=Lr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};_i.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Lr.snap(e[0],e[1],this._snapTolerance);return n};_i.prototype.interfaces_=function(){return[]};_i.prototype.getClass=function(){return _i};_i.overlayOp=function(t,e,n){var r=new _i(t,e);return r.getResultGeometry(n)};_i.union=function(t,e){return _i.overlayOp(t,e,Qt.UNION)};_i.intersection=function(t,e){return _i.overlayOp(t,e,Qt.INTERSECTION)};_i.symDifference=function(t,e){return _i.overlayOp(t,e,Qt.SYMDIFFERENCE)};_i.difference=function(t,e){return _i.overlayOp(t,e,Qt.DIFFERENCE)};var Yi=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Yi.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=Qt.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof cl)r=a;else throw a}finally{}if(!n)try{e=_i.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof cl?r:a}finally{}return e};Yi.prototype.interfaces_=function(){return[]};Yi.prototype.getClass=function(){return Yi};Yi.overlayOp=function(t,e,n){var r=new Yi(t,e);return r.getResultGeometry(n)};Yi.union=function(t,e){return Yi.overlayOp(t,e,Qt.UNION)};Yi.intersection=function(t,e){return Yi.overlayOp(t,e,Qt.INTERSECTION)};Yi.symDifference=function(t,e){return Yi.overlayOp(t,e,Qt.SYMDIFFERENCE)};Yi.difference=function(t,e){return Yi.overlayOp(t,e,Qt.DIFFERENCE)};var kd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};kd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};kd.prototype.interfaces_=function(){return[]};kd.prototype.getClass=function(){return kd};var To=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=a}},o1={INSERT:{configurable:!0},DELETE:{configurable:!0}};To.prototype.isDelete=function(){return this._eventType===To.DELETE};To.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};To.prototype.getObject=function(){return this._obj};To.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};To.prototype.getInsertEvent=function(){return this._insertEvent};To.prototype.isInsert=function(){return this._eventType===To.INSERT};To.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};To.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};To.prototype.interfaces_=function(){return[hs]};To.prototype.getClass=function(){return To};o1.INSERT.get=function(){return 1};o1.DELETE.get=function(){return 2};Object.defineProperties(To,o1);var oy=function(){};oy.prototype.interfaces_=function(){return[]};oy.prototype.getClass=function(){return oy};var Li=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 t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};Li.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Li.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Li.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Li.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Li.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Li.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Li.prototype.hasProperIntersection=function(){return this._hasProper};Li.prototype.hasIntersection=function(){return this._hasIntersection};Li.prototype.isDone=function(){return this._isDone};Li.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Li.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Li.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],a=t.getCoordinates()[e+1],c=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,c,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,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))))};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var pR=function(t){function e(){t.call(this),this.events=new mt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;Ms.sort(this.events);for(var r=0;re||this._maxa?1:0};Dd.prototype.interfaces_=function(){return[df]};Dd.prototype.getClass=function(){return Dd};var dR=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oa),mR=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oa),za=function(){this._leaves=new mt,this._root=null,this._level=0};za.prototype.buildTree=function(){var t=this;Ms.sort(this._leaves,new Oa.NodeComparator);for(var e=this._leaves,n=null,r=new mt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};za.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new dR(t,e,n))};za.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};za.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};za.prototype.printNode=function(t){Ii.out.println(Ts.toLineString(new Ae(t._min,this._level),new Ae(t._max,this._level)))};za.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};za.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,a=n.iterator();a.hasNext();){var c=a.next();r[i++]=c.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===ze.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},e.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var a=mn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,u=i;xt.isCCW(a)&&(c=i,u=r);var g=new iy(a,new zn(this._argIndex,ze.BOUNDARY,c,u));this._lineEdgeMap.put(n,g),this.insertEdge(g),this.insertPoint(this._argIndex,a[0],ze.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),c=a.getLabel();c===null?a._label=new zn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new pR},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),c=a.getLabel().getLocation(n),u=a.eiList.iterator();u.hasNext();){var g=u.next();r.addSelfIntersectionNode(n,g.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ta&&(this._useBoundaryDeterminationRule=!1),n instanceof Hr)this.addPolygon(n);else if(n instanceof vr)this.addLineString(n);else if(n instanceof Eo)this.addPoint(n);else if(n instanceof xf)this.addCollection(n);else if(n instanceof Ru)this.addCollection(n);else if(n instanceof Ta)this.addCollection(n);else if(n instanceof Hi)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Lf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?ze.BOUNDARY:ze.INTERIOR},e}(hr),Mf=function(){if(this._li=new Hu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new $p(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=ls.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new $p(0,e,r),this._arg[1]=new $p(1,n,r)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new $p(0,i,c),this._arg[1]=new $p(1,a,c)}};Mf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Mf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Mf.prototype.interfaces_=function(){return[]};Mf.prototype.getClass=function(){return Mf};var Au=function(){};Au.prototype.interfaces_=function(){return[]};Au.prototype.getClass=function(){return Au};Au.map=function(){if(arguments[0]instanceof Vt&&Ut(arguments[1],Au.MapOp)){for(var t=arguments[0],e=arguments[1],n=new mt,r=0;r=t.size()?null:t.get(e)};Or.union=function(t){var e=new Or(t);return e.union()};iC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Or,iC);var sy=function(){};sy.prototype.interfaces_=function(){return[]};sy.prototype.getClass=function(){return sy};sy.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Qt.createEmptyResult(Qt.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Yi.overlayOp(t,e,Qt.UNION)};function Zu(){return new ay}function ay(){this.reset()}ay.prototype={constructor:ay,reset:function(){this.s=this.t=0},add:function(t){$w(ug,t,this.t),$w(this,ug.s,this.s),this.s?this.t+=ug.t:this.s=ug.t},valueOf:function(){return this.s}};var ug=new ay;function $w(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var _r=1e-6,jn=Math.PI,sl=jn/2,e2=jn/4,ml=jn*2,Iu=180/jn,Zs=jn/180,ji=Math.abs,gR=Math.atan,kf=Math.atan2,qr=Math.cos,jr=Math.sin,jf=Math.sqrt;function oC(t){return t>1?0:t<-1?jn:Math.acos(t)}function Fc(t){return t>1?sl:t<-1?-sl:Math.asin(t)}function ad(){}function ly(t,e){t&&n2.hasOwnProperty(t.type)&&n2[t.type](t,e)}var t2={Feature:function(t,e){ly(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rjn?t-ml:t<-jn?t+ml:t,e]}uv.invert=uv;function _R(t,e,n){return(t%=ml)?e||n?sC(o2(t),s2(e,n)):o2(t):e||n?s2(e,n):uv}function i2(t){return function(e,n){return e+=t,[e>jn?e-ml:e<-jn?e+ml:e,n]}}function o2(t){var e=i2(t);return e.invert=i2(-t),e}function s2(t,e){var n=qr(t),r=jr(t),i=qr(e),a=jr(e);function c(u,g){var w=qr(g),S=qr(u)*w,I=jr(u)*w,P=jr(g),D=P*n+S*r;return[kf(I*i-D*a,S*n-P*r),Fc(D*i+I*a)]}return c.invert=function(u,g){var w=qr(g),S=qr(u)*w,I=jr(u)*w,P=jr(g),D=P*i-I*a;return[kf(I*i+P*a,S*n+D*r),Fc(D*n-S*r)]},c}function vR(t,e,n,r,i,a){if(n){var c=qr(e),u=jr(e),g=r*n;i==null?(i=e+r*ml,a=e-g/2):(i=a2(c,i),a=a2(c,a),(r>0?ia)&&(i+=r*ml));for(var w,S=i;r>0?S>a:S1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function bR(t,e,n,r,i,a){var c=t[0],u=t[1],g=e[0],w=e[1],S=0,I=1,P=g-c,D=w-u,N;if(N=n-c,!(!P&&N>0)){if(N/=P,P<0){if(N0){if(N>I)return;N>S&&(S=N)}if(N=i-c,!(!P&&N<0)){if(N/=P,P<0){if(N>I)return;N>S&&(S=N)}else if(P>0){if(N0)){if(N/=D,D<0){if(N0){if(N>I)return;N>S&&(S=N)}if(N=a-u,!(!D&&N<0)){if(N/=D,D<0){if(N>I)return;N>S&&(S=N)}else if(D>0){if(N0&&(t[0]=c+S*P,t[1]=u+S*D),I<1&&(e[0]=c+I*P,e[1]=u+I*D),!0}}}}}function Pg(t,e){return ji(t[0]-e[0])<_r&&ji(t[1]-e[1])<_r}function fg(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function lC(t,e,n,r,i){var a=[],c=[],u,g;if(t.forEach(function(N){if(!((q=N.length-1)<=0)){var q,J=N[0],re=N[q],U;if(Pg(J,re)){for(i.lineStart(),u=0;u=0;--u)i.point((I=S[u])[0],I[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,D=!D}while(!P.v);i.lineEnd()}}}function l2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function xR(t){return t.length===1&&(t=wR(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function wR(t){return function(e,n){return uC(t(e),n)}}xR(uC);function cC(t){for(var e=t.length,n,r=-1,i=0,a,c;++r=0;)for(c=t[e],n=c.length;--n>=0;)a[--i]=c[n];return a}var ld=1e9,pg=-ld;function SR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,I,P){var D=0,N=0;if(w==null||(D=c(w,I))!==(N=c(S,I))||g(w,S)<0^I>0)do P.point(D===0||D===3?t:n,D>1?r:e);while((D=(D+I+4)%4)!==N);else P.point(S[0],S[1])}function c(w,S){return ji(w[0]-t)<_r?S>0?0:3:ji(w[0]-n)<_r?S>0?2:1:ji(w[1]-e)<_r?S>0?1:0:S>0?3:2}function u(w,S){return g(w.x,S.x)}function g(w,S){var I=c(w,1),P=c(S,1);return I!==P?I-P:I===0?S[1]-w[1]:I===1?w[0]-S[0]:I===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,I=aC(),P,D,N,q,J,re,U,j,Z,te,_e,pe={point:he,lineStart:ce,lineEnd:Ke,polygonStart:Ce,polygonEnd:H};function he(Ze,tt){i(Ze,tt)&&S.point(Ze,tt)}function me(){for(var Ze=0,tt=0,qe=D.length;ttr&&(Cn-Pt)*(r-hn)>(gn-hn)*(t-Pt)&&++Ze:gn<=r&&(Cn-Pt)*(r-hn)<(gn-hn)*(t-Pt)&&--Ze;return Ze}function Ce(){S=I,P=[],D=[],_e=!0}function H(){var Ze=me(),tt=_e&&Ze,qe=(P=cC(P)).length;(tt||qe)&&(w.polygonStart(),tt&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),qe&&lC(P,u,Ze,a,w),w.polygonEnd()),S=w,P=D=N=null}function ce(){pe.point=Se,D&&D.push(N=[]),te=!0,Z=!1,U=j=NaN}function Ke(){P&&(Se(q,J),re&&Z&&I.rejoin(),P.push(I.result())),pe.point=he,Z&&S.lineEnd()}function Se(Ze,tt){var qe=i(Ze,tt);if(D&&N.push([Ze,tt]),te)q=Ze,J=tt,re=qe,te=!1,qe&&(S.lineStart(),S.point(Ze,tt));else if(qe&&Z)S.point(Ze,tt);else{var Nt=[U=Math.max(pg,Math.min(ld,U)),j=Math.max(pg,Math.min(ld,j))],wt=[Ze=Math.max(pg,Math.min(ld,Ze)),tt=Math.max(pg,Math.min(ld,tt))];bR(Nt,wt,t,e,n,r)?(Z||(S.lineStart(),S.point(Nt[0],Nt[1])),S.point(wt[0],wt[1]),qe||S.lineEnd(),_e=!1):qe&&(S.lineStart(),S.point(Ze,tt),_e=!1)}U=Ze,j=tt,Z=qe}return pe}}var b0=Zu();function ER(t,e){var n=e[0],r=e[1],i=[jr(n),-qr(n),0],a=0,c=0;b0.reset();for(var u=0,g=t.length;u=0?1:-1,he=pe*_e,me=he>jn,Ce=N*Z;if(b0.add(kf(Ce*pe*jr(he),q*te+Ce*qr(he))),a+=me?_e+pe*ml:_e,me^P>=n^U>=n){var H=uy(Df(I),Df(re));lv(H);var ce=uy(i,H);lv(ce);var Ke=(me^_e>=0?-1:1)*Fc(ce[2]);(r>Ke||r===Ke&&(H[0]||H[1]))&&(c+=me^_e>=0?1:-1)}}return(a<-_r||a<_r&&b0<-_r)^c&1}Zu();function u2(t){return t}Zu();Zu();var Rf=1/0,cy=Rf,Rd=-Rf,hy=Rd,c2={point:IR,lineStart:ad,lineEnd:ad,polygonStart:ad,polygonEnd:ad,result:function(){var t=[[Rf,cy],[Rd,hy]];return Rd=hy=-(cy=Rf=1/0),t}};function IR(t,e){tRd&&(Rd=t),ehy&&(hy=e)}Zu();function hC(t,e,n,r){return function(i,a){var c=e(a),u=i.invert(r[0],r[1]),g=aC(),w=e(g),S=!1,I,P,D,N={point:q,lineStart:re,lineEnd:U,polygonStart:function(){N.point=j,N.lineStart=Z,N.lineEnd=te,P=[],I=[]},polygonEnd:function(){N.point=q,N.lineStart=re,N.lineEnd=U,P=cC(P);var _e=ER(I,u);P.length?(S||(a.polygonStart(),S=!0),lC(P,TR,_e,n,a)):_e&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),P=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function q(_e,pe){var he=i(_e,pe);t(_e=he[0],pe=he[1])&&a.point(_e,pe)}function J(_e,pe){var he=i(_e,pe);c.point(he[0],he[1])}function re(){N.point=J,c.lineStart()}function U(){N.point=q,c.lineEnd()}function j(_e,pe){D.push([_e,pe]);var he=i(_e,pe);w.point(he[0],he[1])}function Z(){w.lineStart(),D=[]}function te(){j(D[0][0],D[0][1]),w.lineEnd();var _e=w.clean(),pe=g.result(),he,me=pe.length,Ce,H,ce;if(D.pop(),I.push(D),D=null,!!me){if(_e&1){if(H=pe[0],(Ce=H.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),he=0;he1&&_e&2&&pe.push(pe.pop().concat(pe.shift())),P.push(pe.filter(CR))}}return N}}function CR(t){return t.length>1}function TR(t,e){return((t=t.x)[0]<0?t[1]-sl-_r:sl-t[1])-((e=e.x)[0]<0?e[1]-sl-_r:sl-e[1])}const h2=hC(function(){return!0},LR,MR,[-jn,-sl]);function LR(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,c){var u=a>0?jn:-jn,g=ji(a-e);ji(g-jn)<_r?(t.point(e,n=(n+c)/2>0?sl:-sl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(a,n),i=0):r!==u&&g>=jn&&(ji(e-r)<_r&&(e-=r*_r),ji(a-u)<_r&&(a-=u*_r),n=PR(e,n,a,c),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(u,n),i=0),t.point(e=a,n=c),r=u},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-i}}}function PR(t,e,n,r){var i,a,c=jr(t-n);return ji(c)>_r?gR((jr(e)*(a=qr(r))*jr(n)-jr(r)*(i=qr(e))*jr(t))/(i*a*c)):(e+r)/2}function MR(t,e,n,r){var i;if(t==null)i=n*sl,r.point(-jn,i),r.point(0,i),r.point(jn,i),r.point(jn,0),r.point(jn,-i),r.point(0,-i),r.point(-jn,-i),r.point(-jn,0),r.point(-jn,i);else if(ji(t[0]-e[0])>_r){var a=t[0]0,i=ji(n)>_r;function a(S,I,P,D){vR(D,t,e,P,S,I)}function c(S,I){return qr(S)*qr(I)>n}function u(S){var I,P,D,N,q;return{lineStart:function(){N=D=!1,q=1},point:function(J,re){var U=[J,re],j,Z=c(J,re),te=r?Z?0:w(J,re):Z?w(J+(J<0?jn:-jn),re):0;if(!I&&(N=D=Z)&&S.lineStart(),Z!==D&&(j=g(I,U),(!j||Pg(I,j)||Pg(U,j))&&(U[0]+=_r,U[1]+=_r,Z=c(U[0],U[1]))),Z!==D)q=0,Z?(S.lineStart(),j=g(U,I),S.point(j[0],j[1])):(j=g(I,U),S.point(j[0],j[1]),S.lineEnd()),I=j;else if(i&&I&&r^Z){var _e;!(te&P)&&(_e=g(U,I,!0))&&(q=0,r?(S.lineStart(),S.point(_e[0][0],_e[0][1]),S.point(_e[1][0],_e[1][1]),S.lineEnd()):(S.point(_e[1][0],_e[1][1]),S.lineEnd(),S.lineStart(),S.point(_e[0][0],_e[0][1])))}Z&&(!I||!Pg(I,U))&&S.point(U[0],U[1]),I=U,D=Z,P=te},lineEnd:function(){D&&S.lineEnd(),I=null},clean:function(){return q|(N&&D)<<1}}}function g(S,I,P){var D=Df(S),N=Df(I),q=[1,0,0],J=uy(D,N),re=cg(J,J),U=J[0],j=re-U*U;if(!j)return!P&&S;var Z=n*re/j,te=-n*U/j,_e=uy(q,J),pe=hg(q,Z),he=hg(J,te);v0(pe,he);var me=_e,Ce=cg(pe,me),H=cg(me,me),ce=Ce*Ce-H*(cg(pe,pe)-1);if(!(ce<0)){var Ke=jf(ce),Se=hg(me,(-Ce-Ke)/H);if(v0(Se,pe),Se=av(Se),!P)return Se;var Ze=S[0],tt=I[0],qe=S[1],Nt=I[1],wt;tt0^Se[1]<(ji(Se[0]-Ze)<_r?qe:Nt):qe<=Se[1]&&Se[1]<=Nt:un>jn^(Ze<=Se[0]&&Se[0]<=tt)){var hn=hg(me,(-Ce+Ke)/H);return v0(hn,pe),[Se,av(hn)]}}}function w(S,I){var P=r?t:jn-t,D=0;return S<-P?D|=1:S>P&&(D|=2),I<-P?D|=4:I>P&&(D|=8),D}return hC(c,u,a,r?[0,-t]:[-jn,t-jn])}function fC(t){return function(e){var n=new cv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function cv(){}cv.prototype={constructor:cv,point:function(t,e){this.stream.point(t,e)},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 pC(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),a!=null&&t.clipExtent(null),yR(n,t.stream(c2));var c=c2.result(),u=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),g=+e[0][0]+(r-u*(c[1][0]+c[0][0]))/2,w=+e[0][1]+(i-u*(c[1][1]+c[0][1]))/2;return a!=null&&t.clipExtent(a),t.scale(u*150).translate([g,w])}function kR(t,e,n){return pC(t,[[0,0],e],n)}var f2=16,DR=qr(30*Zs);function p2(t,e){return+e?NR(t,e):RR(t)}function RR(t){return fC({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function NR(t,e){function n(r,i,a,c,u,g,w,S,I,P,D,N,q,J){var re=w-r,U=S-i,j=re*re+U*U;if(j>4*e&&q--){var Z=c+P,te=u+D,_e=g+N,pe=jf(Z*Z+te*te+_e*_e),he=Fc(_e/=pe),me=ji(ji(_e)-1)<_r||ji(a-I)<_r?(a+I)/2:kf(te,Z),Ce=t(me,he),H=Ce[0],ce=Ce[1],Ke=H-r,Se=ce-i,Ze=U*Ke-re*Se;(Ze*Ze/j>e||ji((re*Ke+U*Se)/j-.5)>.3||c*P+u*D+g*N2?Se[2]%360*Zs:0,ce()):[w*Iu,S*Iu,I*Iu]},me.precision=function(Se){return arguments.length?(_e=p2(H,te=Se*Se),Ke()):jf(te)},me.fitExtent=function(Se,Ze){return pC(me,Se,Ze)},me.fitSize=function(Se,Ze){return kR(me,Se,Ze)};function ce(){D=sC(P=_R(w,S,I),e);var Se=e(u,g);return a=r-Se[0]*n,c=i+Se[1]*n,Ke()}function Ke(){return pe=he=null,me}return function(){return e=t.apply(this,arguments),me.invert=e.invert&&Ce,ce()}}function dC(t){return function(e,n){var r=qr(e),i=qr(n),a=t(r*i);return[a*i*jr(e),a*jr(n)]}}function mC(t){return function(e,n){var r=jf(e*e+n*n),i=t(r),a=jr(i),c=qr(i);return[kf(e*a,r*c),Fc(r&&n*a/r)]}}var BR=dC(function(t){return jf(2/(1+t))});BR.invert=mC(function(t){return 2*Fc(t/2)});var gC=dC(function(t){return(t=oC(t))&&t/jr(t)});gC.invert=mC(function(t){return t});function VR(){return zR(gC).scale(79.4188).clipAngle(180-.001)}function d2(t,e){return[t,e]}d2.invert=d2;function UR(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var a=[];switch(t.type){case"GeometryCollection":return AI(t,function(c){var u=Mg(c,e,r,i);u&&a.push(u)}),rv(a);case"FeatureCollection":return Xw(t,function(c){var u=Mg(c,e,r,i);u&&Xw(u,function(g){g&&a.push(g)})}),rv(a)}return Mg(t,e,r,i)}function Mg(t,e,n,r){var i=t.properties||{},a=t.type==="Feature"?t.geometry:t;if(a.type==="GeometryCollection"){var c=[];return AI(t,function(q){var J=Mg(q,e,n,r);J&&c.push(J)}),rv(c)}var u=GR(a),g={type:a.type,coordinates:_C(a.coordinates,u)},w=new Qv,S=w.read(g),I=YD(KD(e,n),"meters"),P=wi.bufferOp(S,I,r),D=new UI;if(P=D.write(P),!yC(P.coordinates)){var N={type:P.type,coordinates:vC(P.coordinates,u)};return wy(N,i)}}function yC(t){return Array.isArray(t[0])?yC(t[0]):isNaN(t[0])}function _C(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return _C(n,e)})}function vC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return vC(n,e)})}function GR(t){var e=QD(t).geometry.coordinates,n=[-e[0],-e[1]];return VR().rotate(n).scale(Vo)}function qR(t,e){var n=ty(t),r=ty(e),i=t.properties||{},a=CI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?LI(a[0],i):PI(a,i)}function m2(t){let e;for(const n of t)e&&n[0]-e[0]>=180?n[0]-=360:e&&n[0]-e[0]<-180&&(n[0]+=360),e=n}function g2(t,e){const n=qR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=UR(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)m2(i);else for(const i of r.geometry.coordinates)for(const a of i)m2(a);e({type:"FeatureCollection",features:[r,n]})}let y2={type:"FeatureCollection",features:[]};function jR(t,e,n=!0,r=!0,i={},a={},c={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 u,g=[],w,S;function I(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:y2}),c!=null&&c.fill&&t.addLayer({...c==null?void 0:c.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),c!=null&&c.line&&t.addLayer({...c==null?void 0:c.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?I():t.once("load",()=>{I()});const P=N=>{u==null||u({type:"mapClick",coordinates:[N.lngLat.lng,N.lngLat.lat]})};function D(N=!1){if(!e)throw new Error;const q=document.createElement("div");return N&&q.classList.add("marker-interactive"),new vD({props:{displayIn:"maplibre"},target:q}),new e.Marker({element:q,offset:[1,-13]})}return{setEventHandler(N){N?(u=N,t.on("click",P)):(u=void 0,t.off("click",P))},flyTo(N,q){t.flyTo({center:N,zoom:q,...i})},fitBounds(N,q,J){t.fitBounds([[N[0],N[1]],[N[2],N[3]]],{padding:q,maxZoom:J,...a})},indicateReverse(N){t.getCanvasContainer().style.cursor=N?"crosshair":""},setReverseMarker(N){!e||!n||(S?N?S.setLngLat(N):(S.remove(),S=void 0):N&&(S=(typeof n=="object"?new e.Marker(n):D()).setLngLat(N).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(N,q){if(!n)return;function J(re){var U;(U=t.getSource("full-geom"))==null||U.setData(re)}for(const re of g)re.remove();if(g.length=0,J(y2),!!e){if(q){let re=!1;if(q.geometry.type==="GeometryCollection"){const U=q.geometry.geometries.filter(j=>j.type==="Polygon"||j.type==="MultiPolygon");if(U.length>0){let j=U.pop();for(const Z of U)j=JD(j,Z);g2({...q,geometry:j},J),re=!0}else{const j=q.geometry.geometries.filter(Z=>Z.type==="LineString"||Z.type==="MultiLineString");j.length>0&&(J({...q,geometry:{type:"GeometryCollection",geometries:j}}),re=!0)}}if(!re){if(q.geometry.type==="Polygon"||q.geometry.type==="MultiPolygon")g2(q,J);else if(q.geometry.type==="LineString"||q.geometry.type==="MultiLineString"){J(q);return}}n&&g.push((typeof n=="object"?new e.Marker(n):D()).setLngLat(q.center).addTo(t))}if(r)for(const re of N??[]){if(re===q)continue;const U=(typeof r=="object"?new e.Marker(r):D(!0)).setLngLat(re.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(re.place_type[0]==="reverse"?re.place_name:re.place_name.replace(/,.*/,""))).addTo(t),j=U.getElement();j.addEventListener("click",Z=>{Z.stopPropagation(),u==null||u({type:"markerClick",id:re.id})}),j.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:re.id}),U.togglePopup()}),j.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:re.id}),U.togglePopup()}),g.push(U)}}},setSelectedMarker(N){w&&w.getElement().classList.toggle("marker-selected",!1),w=N>-1?g[N]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const N=t.getCenter();return[t.getZoom(),N.lng,N.lat]}}}function WR(t){let e,n;return{c(){e=ql("svg"),n=ql("path"),Ue(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"),Ue(e,"viewBox","0 0 14 14"),Ue(e,"width","13"),Ue(e,"height","13"),Ue(e,"class","svelte-en2qvf")},m(r,i){Re(r,e,i),ke(e,n)},p:gt,i:gt,o:gt,d(r){r&&De(e)}}}class bC extends en{constructor(e){super(),$t(this,e,null,WR,jt,{})}}function HR(t){let e,n;return{c(){e=ql("svg"),n=ql("path"),Ue(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"),Ue(e,"viewBox","0 0 30 30"),Ue(e,"fill","none"),Ue(e,"xmlns","http://www.w3.org/2000/svg"),Ue(e,"class","svelte-d2loi5")},m(r,i){Re(r,e,i),ke(e,n)},p:gt,i:gt,o:gt,d(r){r&&De(e)}}}class xC extends en{constructor(e){super(),$t(this,e,null,HR,jt,{})}}function ZR(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"area.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"area.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function XR(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"reverse.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"reverse.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function YR(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"poi.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"poi.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function KR(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"postal_code.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"postal_code.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function JR(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"street.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"street.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function QR(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"road.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"road.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function $R(t){let e,n;return{c(){e=Oe("img"),wo(e.src,n=t[3]+"housenumber.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Re(r,e,i)},p(r,i){i&8&&!wo(e.src,n=r[3]+"housenumber.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&De(e)}}}function eN(t){let e,n,r,i;return{c(){e=Oe("img"),wo(e.src,n=t[5])||Ue(e,"src",n),Ue(e,"alt",t[4]),Ue(e,"class","svelte-ltkwvy")},m(a,c){Re(a,e,c),r||(i=Zt(e,"error",t[14]),r=!0)},p(a,c){c&32&&!wo(e.src,n=a[5])&&Ue(e,"src",n),c&16&&Ue(e,"alt",a[4])},d(a){a&&De(e),r=!1,i()}}}function _2(t){let e,n;return{c(){e=Oe("span"),n=kt(t[6]),Ue(e,"class","secondary svelte-ltkwvy")},m(r,i){Re(r,e,i),ke(e,n)},p(r,i){i&64&&Qn(n,r[6])},d(r){r&&De(e)}}}function tN(t){var pe,he;let e,n,r,i,a,c,u,g,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,I,P=t[2]==="always"||t[2]&&!t[0].address&&((pe=t[0].properties)==null?void 0:pe.kind)!=="road"&&((he=t[0].properties)==null?void 0:he.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],D,N,q=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",J,re,U;function j(me,Ce){var H,ce;return Ce&1&&(n=null),Ce&1&&(r=null),Ce&1&&(i=null),me[5]?eN:me[0].address?$R:((H=me[0].properties)==null?void 0:H.kind)==="road"||((ce=me[0].properties)==null?void 0:ce.kind)==="road_relation"?QR:(n==null&&(n=!!me[0].id.startsWith("address.")),n?JR:(r==null&&(r=!!me[0].id.startsWith("postal_code.")),r?KR:(i==null&&(i=!!me[0].id.startsWith("poi.")),i?YR:me[7]?XR:ZR)))}let Z=j(t,-1),te=Z(t),_e=P&&_2(t);return{c(){e=Oe("li"),te.c(),a=ft(),c=Oe("span"),u=Oe("span"),g=Oe("span"),S=kt(w),I=ft(),_e&&_e.c(),D=ft(),N=Oe("span"),J=kt(q),Ue(g,"class","primary svelte-ltkwvy"),Ue(u,"class","svelte-ltkwvy"),Ue(N,"class","line2 svelte-ltkwvy"),Ue(c,"class","texts svelte-ltkwvy"),Ue(e,"tabindex","0"),Ue(e,"data-selected",t[1]),Ue(e,"class","svelte-ltkwvy"),ol(e,"selected",t[1])},m(me,Ce){Re(me,e,Ce),te.m(e,null),ke(e,a),ke(e,c),ke(c,u),ke(u,g),ke(g,S),ke(u,I),_e&&_e.m(u,null),ke(c,D),ke(c,N),ke(N,J),re||(U=[Zt(e,"mouseenter",t[12]),Zt(e,"focus",t[13])],re=!0)},p(me,[Ce]){var H,ce;Z===(Z=j(me,Ce))&&te?te.p(me,Ce):(te.d(1),te=Z(me),te&&(te.c(),te.m(e,a))),Ce&1&&w!==(w=(me[7]?me[0].place_name:me[0].place_name.replace(/,.*/,""))+"")&&Qn(S,w),Ce&37&&(P=me[2]==="always"||me[2]&&!me[0].address&&((H=me[0].properties)==null?void 0:H.kind)!=="road"&&((ce=me[0].properties)==null?void 0:ce.kind)!=="road_relation"&&!me[0].id.startsWith("address.")&&!me[0].id.startsWith("postal_code.")&&(!me[0].id.startsWith("poi.")||!me[5])&&!me[7]),P?_e?_e.p(me,Ce):(_e=_2(me),_e.c(),_e.m(u,null)):_e&&(_e.d(1),_e=null),Ce&1&&q!==(q=(me[7]?"":me[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Qn(J,q),Ce&2&&Ue(e,"data-selected",me[1]),Ce&2&&ol(e,"selected",me[1])},i:gt,o:gt,d(me){me&&De(e),te.d(),_e&&_e.d(),re=!1,Ni(U)}}}function nN(t,e,n){var j;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:u}=e,{missingIconsCache:g}=e,{iconsBaseUrl:w}=e;const S=(j=a.properties)==null?void 0:j.categories;let I,P,D=0,N=a.place_type[0]==="reverse";function q(Z){P&&g.add(P),n(10,D++,D)}function J(Z){En.call(this,t,Z)}function re(Z){En.call(this,t,Z)}const U=Z=>q(Z.currentTarget);return t.$$set=Z=>{"feature"in Z&&n(0,a=Z.feature),"selected"in Z&&n(1,c=Z.selected),"showPlaceType"in Z&&n(2,u=Z.showPlaceType),"missingIconsCache"in Z&&n(9,g=Z.missingIconsCache),"iconsBaseUrl"in Z&&n(3,w=Z.iconsBaseUrl)},t.$$.update=()=>{var Z,te,_e,pe;if(t.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,P=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||g.has(P)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(te=(Z=a.properties)==null?void 0:Z.categories)==null?void 0:te.join(", "):((pe=(_e=a.properties)==null?void 0:_e.place_type_name)==null?void 0:pe[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,c,u,w,I,P,i,N,q,g,D,r,J,re,U]}class rN extends en{constructor(e){super(),$t(this,e,nN,tN,jt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function iN(t){let e;return{c(){e=Oe("div"),e.innerHTML='',Ue(e,"class","svelte-7cmwmc")},m(n,r){Re(n,e,r)},p:gt,i:gt,o:gt,d(n){n&&De(e)}}}class oN extends en{constructor(e){super(),$t(this,e,null,iN,jt,{})}}function sN(t){let e,n;return{c(){e=ql("svg"),n=ql("path"),Ue(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"),Ue(e,"viewBox","0 0 60.006 21.412"),Ue(e,"width","14"),Ue(e,"height","20"),Ue(e,"class","svelte-en2qvf")},m(r,i){Re(r,e,i),ke(e,n)},p:gt,i:gt,o:gt,d(r){r&&De(e)}}}class aN extends en{constructor(e){super(),$t(this,e,null,sN,jt,{})}}function lN(t){let e,n,r;return{c(){e=ql("svg"),n=ql("circle"),r=ql("path"),Ue(n,"cx","4.789"),Ue(n,"cy","4.787"),Ue(n,"r","3.85"),Si(n,"stroke-width","1.875"),Si(n,"fill","none"),Ue(r,"d","M12.063 12.063 7.635 7.635"),Si(r,"stroke-width","1.875"),Si(r,"stroke-linecap","round"),Ue(e,"xmlns","http://www.w3.org/2000/svg"),Ue(e,"width","13"),Ue(e,"height","13"),Ue(e,"viewBox","0 0 13 13"),Ue(e,"class","svelte-1bpbt60")},m(i,a){Re(i,e,a),ke(e,n),ke(e,r)},p:gt,i:gt,o:gt,d(i){i&&De(e)}}}class uN extends en{constructor(e){super(),$t(this,e,null,lN,jt,{})}}function cN(t,e,n){const r=e[1],i=e[0],a=r-i;return t===r&&n?t:((t-i)%a+a)%a+i}function v2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!ed.coords)break e;return ed.coords}let a;try{return a=await new Promise((c,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(g=>{c([g.coords.longitude,g.coords.latitude].map(w=>w.toFixed(6)).join(","))},g=>{u(g)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(ed={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const b2=/(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,x2=/(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,w2=/(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,S2=/(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 fN(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(c=>Number(c.trim()));let n=E2(e[0],t),r=E2(e[1],t);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=e[0]>=0?" N":" S",a=e[1]>=0?" E":" W";return`${n+i}, ${r+a}`}else throw new Error("no decimal coordinates to convert")}function E2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let u=pN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let a=Math.floor(i),c=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${c}"`}function pN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function a1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],u=!1;if(b2.test(t))if(c=b2.exec(t),u=dg(c),u){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(i=c[1],a=c[5]):c[4]&&(i=c[4],a=c[8])}else throw new Error("invalid decimal coordinate format");else if(x2.test(t))if(c=x2.exec(t),u=dg(c),u)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6].replace(",",".")/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(i=c[1],a=c[8]):c[7]&&(i=c[7],a=c[14]);else throw new Error("invalid DMS coordinates format");else if(w2.test(t))if(c=w2.exec(t),u=dg(c),u)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid DMS coordinates format");else if(S2.test(t))if(c=S2.exec(t),u=dg(c),u)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let g=/S|SOUTH/i;g.test(i)&&n>0&&(n=-1*n),g=/W|WEST/i,g.test(a)&&r>0&&(r=-1*r);const w=c[0].trim();let S,I;const P=/[,/;\u0020]/g,D=w.match(P);if(D==null){const J=Math.floor(t.length/2);S=w.substring(0,J).trim(),I=w.substring(J).trim()}else{let J;D.length%2==1?J=Math.floor(D.length/2):J=D.length/2-1;let re=0;if(J==0)re=w.indexOf(D[0]),S=w.substring(0,re).trim(),I=w.substring(re+1).trim();else{let U=0,j=0;for(;U<=J;)re=w.indexOf(D[U],j),j=re+1,U++;S=w.substring(0,re).trim(),I=w.substring(re+1).trim()}}const N=S.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const q=I.split(".");if(q.length==2&&q[1]==0&&q[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(I))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(e)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:I,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:dN,toCoordinateFormat:fN})}else throw new Error("coordinates pattern match failed")}function dg(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=e.length/2;for(let a=0;a{e.decimalLatitude?t.push(e):t.push({...e,...yN})}),[...t,..._N,...vN]}const xN=bN();a1.formats=xN.map(t=>t.verbatimCoordinates);const wN=a1;function C2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function T2(t){let e,n;return e=new oN({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function L2(t){let e,n,r,i,a;return n=new aN({}),{c(){e=Oe("button"),lt(n.$$.fragment),Ue(e,"type","button"),Ue(e,"title",t[9]),Ue(e,"class","svelte-zh3kmv"),ol(e,"active",t[0])},m(c,u){Re(c,e,u),st(n,e,null),r=!0,i||(a=Zt(e,"click",t[67]),i=!0)},p(c,u){(!r||u[0]&512)&&Ue(e,"title",c[9]),(!r||u[0]&1)&&ol(e,"active",c[0])},i(c){r||(be(n.$$.fragment,c),r=!0)},o(c){Te(n.$$.fragment,c),r=!1},d(c){c&&De(e),at(n),i=!1,a()}}}function SN(t){let e,n=[],r=new Map,i,a,c,u=ei(t[14]);const g=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{pe=null}),On()),(!j||Ze[0]&2)&&ol(w,"displayable",Se[1]!==""),Se[5]===!0?he?(he.p(Se,Ze),Ze[0]&32&&be(he,1)):(he=L2(Se),he.c(),be(he,1),he.m(r,N)):he&&(Nn(),Te(he,1,1,()=>{he=null}),On()),Ce&&Ce.p&&(!j||Ze[1]&134217728)&&ri(Ce,me,Se,Se[58],j?ni(me,Se[58],Ze,null):ii(Se[58]),null);let tt=J;J=Ke(Se),J===tt?~J&&ce[J].p(Se,Ze):(re&&(Nn(),Te(ce[tt],1,1,()=>{ce[tt]=null}),On()),~J?(re=ce[J],re?re.p(Se,Ze):(re=ce[J]=H[J](Se),re.c()),be(re,1),re.m(n,null)):re=null),(!j||Ze[0]&4&&U!==(U=Ag(Se[2])+" svelte-zh3kmv"))&&Ue(n,"class",U),(!j||Ze[0]&22)&&ol(n,"can-collapse",Se[4]&&Se[1]==="")},i(Se){j||(be(_e),be(a.$$.fragment,Se),be(I.$$.fragment,Se),be(pe),be(he),be(Ce,Se),be(re),j=!0)},o(Se){Te(_e),Te(a.$$.fragment,Se),Te(I.$$.fragment,Se),Te(pe),Te(he),Te(Ce,Se),Te(re),j=!1},d(Se){Se&&(De(e),De(n)),at(a),t[61](null),at(I),pe&&pe.d(),he&&he.d(),Ce&&Ce.d(Se),~J&&ce[J].d(),Z=!1,Ni(te)}}}function LN(t,e,n){let r,{$$slots:i={},$$scope:a}=e,{class:c=void 0}=e,{apiKey:u}=e,{bbox:g=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:I=!1}=e,{country:P=void 0}=e,{debounceSearch:D=200}=e,{enableReverse:N=!1}=e,{errorMessage:q="Something went wrong…"}=e,{filter:J=()=>!0}=e,{flyTo:re=!0}=e,{fuzzyMatch:U=!0}=e,{language:j=void 0}=e,{limit:Z=void 0}=e,{mapController:te=void 0}=e,{minLength:_e=2}=e,{noResultsMessage:pe="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:he="Search"}=e,{proximity:me=[{type:"server-geolocation"}]}=e,{reverseActive:Ce=N==="always"}=e,{reverseButtonTitle:H="toggle reverse geocoding"}=e,{searchValue:ce=""}=e,{showFullGeometry:Ke=!0}=e,{showPlaceType:Se="ifNeeded"}=e,{showResultsWhileTyping:Ze=!0}=e,{selectFirst:tt=!0}=e,{flyToSelected:qe=!1}=e,{markerOnSelected:Nt=!0}=e,{types:wt=void 0}=e,{excludeTypes:un=!1}=e,{zoom:Gt=16}=e,{maxZoom:Pt=18}=e,{apiUrl:hn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Cn={}}=e,{iconsBaseUrl:gn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:yn=Q=>{}}=e;function An(){Ne.focus()}function xr(){Ne.blur()}function Ar(Q,we=!0){n(1,ce=Q),we?(n(15,Yt=-1),bl()):(Zr(),setTimeout(()=>{Ne.focus(),Ne.select()}))}function wr(){n(14,ge=void 0),n(55,It=void 0),n(15,Yt=-1)}function fr(){n(54,Le=[]),n(55,It=void 0)}let Qe=!1,ge,Le,It,kn="",Ne,Yt=-1,kr,ln=[],$n,Mo,ps,Os;const Ba=new Set,Pi=qu();as(()=>{te&&(te.setEventHandler(void 0),te.indicateReverse(!1),te.setSelectedMarker(-1),te.setMarkers(void 0,void 0))});function bl(Q){if(Mo&&(clearTimeout(Mo),Mo=void 0),Yt>-1&&ge)n(55,It=ge[Yt]),n(1,ce=It.place_type[0]==="reverse"?It.place_name:It.place_name.replace(/,.*/,"")),n(18,kr=void 0),n(54,Le=void 0),n(15,Yt=-1);else if(ce){const we=Q||!ds(ce);rt(ce,{exact:!0}).then(()=>{n(54,Le=ge),n(55,It=void 0),we&&Ko()}).catch(de=>n(18,kr=de))}}function ds(Q){try{return wN(Q,6)}catch{return!1}}async function rt(Q,{byId:we=!1,exact:de=!1}={}){n(18,kr=void 0),$n==null||$n.abort();const Pe=new AbortController;n(19,$n=Pe);try{const Ve=ds(Q),We=new URLSearchParams;if(j!==void 0&&We.set("language",Array.isArray(j)?j.join(","):j??""),wt&&We.set("types",wt.join(",")),un&&We.set("excludeTypes",String(un)),g&&We.set("bbox",g.map(Wt=>Wt.toFixed(6)).join(",")),P&&We.set("country",Array.isArray(P)?P.join(","):P),!we&&!Ve){const Wt=await hN(te,me,Pe);Wt&&We.set("proximity",Wt),(de||!Ze)&&We.set("autocomplete","false"),We.set("fuzzyMatch",String(U))}Z!==void 0&&(!Ve||(wt==null?void 0:wt.length)===1)&&We.set("limit",String(Z)),We.set("key",u),yn(We);const Xe=hn+"/"+encodeURIComponent(Ve?Ve.decimalLongitude+","+Ve.decimalLatitude:Q)+".json?"+We.toString();if(Xe===kn){we?(n(14,ge=void 0),n(55,It=ln[0])):n(14,ge=ln);return}kn=Xe;const Tt=await fetch(Xe,{signal:Pe.signal,...Cn});if(!Tt.ok)throw new Error(await Tt.text());const At=await Tt.json();Pi("response",{url:Xe,featureCollection:At}),we?(n(14,ge=void 0),n(55,It=At.features[0]),ln=[It]):(n(14,ge=At.features.filter(J)),Ve&&ge.unshift({type:"Feature",properties:{},id:"reverse_"+Ve.decimalLongitude+"_"+Ve.decimalLatitude,text:Ve.decimalLatitude+", "+Ve.decimalLongitude,place_name:Ve.decimalLatitude+", "+Ve.decimalLongitude,place_type:["reverse"],center:[Ve.decimalLongitude,Ve.decimalLatitude],bbox:[Ve.decimalLongitude,Ve.decimalLatitude,Ve.decimalLongitude,Ve.decimalLatitude],geometry:{type:"Point",coordinates:[Ve.decimalLongitude,Ve.decimalLatitude]}}),ln=ge,Ve&&Ne.focus())}catch(Ve){if(Ve&&typeof Ve=="object"&&"name"in Ve&&Ve.name==="AbortError")return;throw Ve}finally{Pe===$n&&n(19,$n=void 0)}}function Ko(){var de;if(!(Le!=null&&Le.length)||!re)return;const Q=[180,90,-180,-90],we=!Le.some(Pe=>!Pe.matching_text);for(const Pe of Le)if(we||!Pe.matching_text)for(const Ve of[0,1,2,3])Q[Ve]=Math[Ve<2?"min":"max"](Q[Ve],((de=Pe.bbox)==null?void 0:de[Ve])??Pe.center[Ve%2]);te&&Le.length>0&&(It&&Q[0]===Q[2]&&Q[1]===Q[3]?te.flyTo(It.center,Gt):te.fitBounds(v2(Q),50,Pt))}function Ki(Q){n(0,Ce=N==="always"),n(14,ge=void 0),n(55,It=void 0),n(15,Yt=-1),Ar(Q[1].toFixed(6)+", "+cN(Q[0],[-180,180],!0).toFixed(6),!1)}function xl(Q){if(!ge)return;let we=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;we&&(Yt===(tt?0:-1)&&we===-1&&n(15,Yt=ge.length),n(15,Yt+=we),Yt>=ge.length&&n(15,Yt=-1),Yt<0&&tt&&n(15,Yt=0),Q.preventDefault())}function Zr(Q=!0){if(n(18,kr=void 0),Ze){if(Mo&&clearTimeout(Mo),ce.length<_e)return;const we=ce;Mo=window.setTimeout(()=>{rt(we).catch(de=>n(18,kr=de))},Q?D:0)}else n(14,ge=void 0),n(18,kr=void 0)}function ct(Q){n(55,It=Q),n(1,ce=Q.place_name),n(15,Yt=-1)}const tn=()=>Ne.focus();function Jt(Q){Kn[Q?"unshift":"push"](()=>{Ne=Q,n(17,Ne)})}function Dr(){ce=this.value,n(1,ce),n(13,Qe),n(27,S)}const Jo=()=>n(13,Qe=!0),Kt=()=>n(13,Qe=!1),ga=()=>Zr(),Fr=()=>{n(1,ce=""),Ne.focus()},ae=()=>n(0,Ce=!Ce),B=()=>n(18,kr=void 0),G=Q=>n(15,Yt=Q),K=Q=>ct(Q),ne=()=>{tt||n(15,Yt=-1)},xe=()=>{};return t.$$set=Q=>{"class"in Q&&n(2,c=Q.class),"apiKey"in Q&&n(25,u=Q.apiKey),"bbox"in Q&&n(26,g=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,I=Q.collapsed),"country"in Q&&n(28,P=Q.country),"debounceSearch"in Q&&n(29,D=Q.debounceSearch),"enableReverse"in Q&&n(5,N=Q.enableReverse),"errorMessage"in Q&&n(6,q=Q.errorMessage),"filter"in Q&&n(30,J=Q.filter),"flyTo"in Q&&n(31,re=Q.flyTo),"fuzzyMatch"in Q&&n(32,U=Q.fuzzyMatch),"language"in Q&&n(33,j=Q.language),"limit"in Q&&n(34,Z=Q.limit),"mapController"in Q&&n(35,te=Q.mapController),"minLength"in Q&&n(36,_e=Q.minLength),"noResultsMessage"in Q&&n(7,pe=Q.noResultsMessage),"placeholder"in Q&&n(8,he=Q.placeholder),"proximity"in Q&&n(37,me=Q.proximity),"reverseActive"in Q&&n(0,Ce=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,H=Q.reverseButtonTitle),"searchValue"in Q&&n(1,ce=Q.searchValue),"showFullGeometry"in Q&&n(38,Ke=Q.showFullGeometry),"showPlaceType"in Q&&n(10,Se=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,Ze=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,tt=Q.selectFirst),"flyToSelected"in Q&&n(40,qe=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Nt=Q.markerOnSelected),"types"in Q&&n(42,wt=Q.types),"excludeTypes"in Q&&n(43,un=Q.excludeTypes),"zoom"in Q&&n(44,Gt=Q.zoom),"maxZoom"in Q&&n(45,Pt=Q.maxZoom),"apiUrl"in Q&&n(46,hn=Q.apiUrl),"fetchParameters"in Q&&n(47,Cn=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,gn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,yn=Q.adjustUrlQuery),"$$scope"in Q&&n(58,a=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ps=Qe),S&&!Qe&&n(1,ce="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&ce.length<_e&&(n(55,It=void 0),n(14,ge=void 0),n(18,kr=void 0),n(54,Le=ge)),t.$$.dirty[1]&16777344&&Ke&&It&&!It.address&&It.geometry.type==="Point"&&It.place_type[0]!=="reverse"&&rt(It.id,{byId:!0}).catch(Q=>n(18,kr=Q)),t.$$.dirty[1]&50356241&&(te&&It&&It.id!==Os&&re&&(!It.bbox||It.bbox[0]===It.bbox[2]&&It.bbox[1]===It.bbox[3]?te.flyTo(It.center,It.id.startsWith("poi.")||It.id.startsWith("address.")?Pt:Gt):te.fitBounds(v2(It.bbox),50,Pt),n(14,ge=void 0),n(54,Le=void 0),n(15,Yt=-1)),n(56,Os=It==null?void 0:It.id)),t.$$.dirty[0]&18432&&tt&&ge!=null&&ge.length&&n(15,Yt=0),t.$$.dirty[0]&2050&&(tt||n(15,Yt=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Le!==ge&&n(54,Le=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&te&&te.setEventHandler(Q=>{switch(Q.type){case"mapClick":Ce&&Ki(Q.coordinates);break;case"markerClick":{const we=ge==null?void 0:ge.find(de=>de.id===Q.id);we&&ct(we)}break;case"markerMouseEnter":Le&&n(15,Yt=ps?(ge==null?void 0:ge.findIndex(we=>we.id===Q.id))??-1:-1);break;case"markerMouseLeave":Le&&n(15,Yt=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ge==null?void 0:ge[Yt]),t.$$.dirty[1]&67133969&&te&&r&&re&&qe&&te.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Pt:Gt),t.$$.dirty[1]&1040&&(Nt||te==null||te.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&te&&Nt&&!Le&&(te.setMarkers(r?[r]:void 0,void 0),te.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&te&&te.setMarkers(Le,It),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Le&&te&&te.setSelectedMarker(Yt),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&te){const Q=ds(ce);te.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Pi("select",r),t.$$.dirty[1]&16777216&&Pi("pick",It),t.$$.dirty[0]&81920&&Pi("optionsVisibilityChange",ps&&!!ge),t.$$.dirty[0]&16384&&Pi("featuresListed",ge),t.$$.dirty[1]&8388608&&Pi("featuresMarked",Le),t.$$.dirty[0]&1&&Pi("reverseToggle",Ce),t.$$.dirty[0]&2&&Pi("queryChange",ce),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&te&&te.indicateReverse(Ce)},[Ce,ce,c,w,I,N,q,pe,he,H,Se,tt,gn,Qe,ge,Yt,ps,Ne,kr,$n,Ba,bl,xl,Zr,ct,u,g,S,P,D,J,re,U,j,Z,te,_e,me,Ke,Ze,qe,Nt,wt,un,Gt,Pt,hn,Cn,yn,An,xr,Ar,wr,fr,Le,It,Os,r,a,i,tn,Jt,Dr,Jo,Kt,ga,Fr,ae,B,G,K,ne,xe]}class PN extends en{constructor(e){super(),$t(this,e,LN,TN,jt,{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 M2(t){let e,n,r;return n=new PN({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"class","svelte-ixhnie")},m(i,a){Re(i,e,a),st(n,e,null),r=!0},p(i,a){const c={};a&2&&(c.mapController=i[1]),a&1&&(c.apiKey=i[0]),n.$set(c)},i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&De(e),at(n)}}}function MN(t){let e,n,r=t[1]&&M2(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&be(r,1)):(r=M2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function AN(t,e,n){let r,{apiKey:i}=e,{map:a}=e;return t.$$set=c=>{"apiKey"in c&&n(0,i=c.apiKey),"map"in c&&n(2,a=c.map)},t.$$.update=()=>{t.$$.dirty&4&&n(1,r=a?jR(a,Es):null)},[i,r,a]}class kN extends en{constructor(e){super(),$t(this,e,AN,MN,jt,{apiKey:0,map:2})}}const DN=Symbol.for("svelte-maplibre");function RN(){return yv(DN)}function NN(t){return"layerType"in t&&t.layerType==="deckgl"}var Bc=ON;function ON(t){var e,n,r;if(t){if(Array.isArray(t)){for(e=[],n=t.length,r=0;r({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),k2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function D2(t){let e,n,r=(t[4]||t[3]instanceof Es.Marker)&&R2(t);return{c(){e=Oe("div"),r&&r.c()},m(i,a){Re(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Es.Marker?r?(r.p(i,a),a[0]&24&&be(r,1)):(r=R2(i),r.c(),be(r,1),r.m(e,null)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(),t[32](null)}}}function R2(t){let e;const n=t[30].default,r=ti(n,t,t[29],k2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[0]&536870933)&&ri(r,n,i,i[29],e?ni(n,i[29],a,BN):ii(i[29]),k2)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function VN(t){let e,n,r=t[9].default&&D2(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&be(r,1)):(r=D2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function UN(t,e,n){let r,i,a,c,u,g,{$$slots:w={},$$scope:S}=e;const I=BL(w);let{closeButton:P=void 0}=e,{closeOnClickOutside:D=!0}=e,{closeOnClickInside:N=!1}=e,{closeOnMove:q=!1}=e,{openOn:J="click"}=e,{openIfTopMost:re=!0}=e,{focusAfterOpen:U=!0}=e,{anchor:j=void 0}=e,{offset:Z=void 0}=e,{popupClass:te=void 0}=e,{maxWidth:_e=void 0}=e,{lngLat:pe=void 0}=e,{html:he=void 0}=e,{open:me=!1}=e;const Ce=qu(),{map:H,popupTarget:ce,layerEvent:Ke,layer:Se,eventTopMost:Ze}=RN();zt(t,H,Le=>n(2,a=Le)),zt(t,ce,Le=>n(3,u=Le)),zt(t,Ke,Le=>n(28,c=Le)),zt(t,Se,Le=>n(35,g=Le));const tt=["click","dblclick","contextmenu"];let qe,Nt=!1,wt;function un(){if(!qe)return;let Le=qe.getElement();!Le||Le===wt||(wt=Le,J==="hover"&&(wt.style.pointerEvents="none"),wt.addEventListener("mouseenter",()=>{n(24,Nt=!0)},{passive:!0}),wt.addEventListener("mouseleave",()=>{n(24,Nt=!1)},{passive:!0}),wt.addEventListener("click",()=>{N&&n(0,me=!1)},{passive:!0}))}ru(()=>{if(a)return a.on("click",wr),a.on("contextmenu",wr),typeof u=="string"&&(a.on("click",u,Cn),a.on("dblclick",u,Cn),a.on("contextmenu",u,Cn),a.on("mousemove",u,Ar),a.on("mouseleave",u,xr),a.on("touchstart",u,yn),a.on("touchend",u,An)),()=>{a!=null&&a.loaded()&&(qe==null||qe.remove(),a.off("click",wr),a.off("contextmenu",wr),u instanceof Es.Marker?u.getPopup()===qe&&u.setPopup(void 0):typeof u=="string"&&(a.off("click",u,Cn),a.off("dblclick",u,Cn),a.off("contextmenu",u,Cn),a.off("mousemove",u,Ar),a.off("mouseleave",u,xr),a.off("touchstart",u,yn),a.off("touchend",u,An)))}});function Gt(Le){return re?!("marker"in Le)&&!NN(Le)&&Ze(Le)!==g:!1}let Pt=null,hn="normal";function Cn(Le){Le.type===J&&(Gt(Le)||("layerType"in Le?Le.layerType==="deckgl"?(n(10,pe=Le.coordinate),n(4,Pt=Le.object?[Le.object]:null)):(n(10,pe=Le.lngLat),n(4,Pt=Le.features??[])):(n(10,pe=Le.lngLat),n(4,Pt=Le.features??[])),setTimeout(()=>n(0,me=!0))))}let gn=null;function yn(Le){gn=Le.point}function An(Le){if(!gn||J!=="hover")return;let It=gn.dist(Le.point);gn=null,It<3&&(n(10,pe=Le.lngLat),n(4,Pt=Le.features??[]),qe.isOpen()?n(25,hn="justOpened"):(n(25,hn="opening"),n(0,me=!0)))}function xr(Le){J!=="hover"||gn||hn!=="normal"||(n(0,me=!1),n(4,Pt=null))}function Ar(Le){if(!(J!=="hover"||gn||hn!=="normal")){if(Gt(Le)){n(0,me=!1),n(4,Pt=null);return}n(0,me=!0),n(4,Pt=Le.features??[]),n(10,pe=Le.lngLat)}}function wr(Le){if(hn==="justOpened"){n(25,hn="normal");return}if(!D)return;let It=[wt,u instanceof Es.Marker?u==null?void 0:u.getElement():null];me&&qe.isOpen()&&!It.some(kn=>kn==null?void 0:kn.contains(Le.originalEvent.target))&&(Le.type==="contextmenu"&&J==="contextmenu"||Le.type!=="contextmenu")&&n(0,me=!1)}as(()=>{a&&(qe!=null&&qe.isOpen())&&qe.remove()});let fr;const Qe=()=>n(0,me=!1);function ge(Le){Kn[Le?"unshift":"push"](()=>{fr=Le,n(1,fr)})}return t.$$set=Le=>{"closeButton"in Le&&n(11,P=Le.closeButton),"closeOnClickOutside"in Le&&n(12,D=Le.closeOnClickOutside),"closeOnClickInside"in Le&&n(13,N=Le.closeOnClickInside),"closeOnMove"in Le&&n(14,q=Le.closeOnMove),"openOn"in Le&&n(15,J=Le.openOn),"openIfTopMost"in Le&&n(16,re=Le.openIfTopMost),"focusAfterOpen"in Le&&n(17,U=Le.focusAfterOpen),"anchor"in Le&&n(18,j=Le.anchor),"offset"in Le&&n(19,Z=Le.offset),"popupClass"in Le&&n(20,te=Le.popupClass),"maxWidth"in Le&&n(21,_e=Le.maxWidth),"lngLat"in Le&&n(10,pe=Le.lngLat),"html"in Le&&n(22,he=Le.html),"open"in Le&&n(0,me=Le.open),"$$scope"in Le&&n(29,S=Le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=P??(!D&&!N)),t.$$.dirty[0]&146685952&&(qe||(n(23,qe=new Es.Popup({closeButton:r,closeOnClick:!1,closeOnMove:q,focusAfterOpen:U,maxWidth:_e,className:te,anchor:j,offset:Z})),wt=qe.getElement(),qe.on("open",()=>{n(0,me=!0),un(),Ce("open",qe)}),qe.on("close",()=>{n(0,me=!1),Ce("close",qe)}),qe.on("hover",()=>{Ce("hover",qe)}))),t.$$.dirty[0]&8421384&&qe&&u instanceof Es.Marker&&(J==="click"?u.setPopup(qe):u.getPopup()===qe&&u.setPopup(void 0)),t.$$.dirty[0]&268468224&&tt.includes(J)&&(c==null?void 0:c.type)===J&&(Cn(c),ur(Ke,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=J==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&J==="hover"&&Ke&&(i&&c&&(c.layerType==="deckgl"?(n(10,pe=c.coordinate),n(4,Pt=c.object?[c.object]:null)):(n(10,pe=c.lngLat),n(4,Pt=c.features??[]))),n(0,me=(i||Nt)??!1)),t.$$.dirty[0]&12582914&&(fr?qe.setDOMContent(fr):he&&qe.setHTML(he)),t.$$.dirty[0]&8389632&&pe&&qe.setLngLat(pe),t.$$.dirty[0]&41943045&&a){let Le=qe.isOpen();me&&!Le?(qe.addTo(a),hn==="opening"&&n(25,hn="justOpened")):!me&&Le&&qe.remove()}},[me,fr,a,u,Pt,H,ce,Ke,Se,I,pe,P,D,N,q,J,re,U,j,Z,te,_e,he,qe,Nt,hn,i,r,c,S,w,Qe,ge]}class GN extends en{constructor(e){super(),$t(this,e,UN,VN,jt,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var Xd=Uint8Array,wC=Uint16Array,qN=Int32Array,jN=new Xd([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]),WN=new Xd([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]),SC=function(t,e){for(var n=new wC(31),r=0;r<31;++r)n[r]=e+=1<>1|(Yn&21845)<<1,zl=(zl&52428)>>2|(zl&13107)<<2,zl=(zl&61680)>>4|(zl&3855)<<4,XN[Yn]=((zl&65280)>>8|(zl&255)<<8)>>1;var zl,Yn,Ny=new Xd(288);for(Yn=0;Yn<144;++Yn)Ny[Yn]=8;var Yn;for(Yn=144;Yn<256;++Yn)Ny[Yn]=9;var Yn;for(Yn=256;Yn<280;++Yn)Ny[Yn]=7;var Yn;for(Yn=280;Yn<288;++Yn)Ny[Yn]=8;var Yn,YN=new Xd(32);for(Yn=0;Yn<32;++Yn)YN[Yn]=5;var Yn,KN=new Xd(0),JN=typeof TextDecoder<"u"&&new TextDecoder,QN=0;try{JN.decode(KN,{stream:!0}),QN=1}catch{}const $N=t=>({props:t&8}),N2=t=>({props:nO(t[3])});function eO(t){let e;const n=t[1].default,r=ti(n,t,t[2],N2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&ri(r,n,i,i[2],e?ni(n,i[2],a,$N):ii(i[2]),N2)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function tO(t){let e,n;return e=new GN({props:{openOn:t[0],$$slots:{default:[eO,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function nO(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function rO(t,e,n){let{$$slots:r={},$$scope:i}=e,{openOn:a="hover"}=e;return t.$$set=c=>{"openOn"in c&&n(0,a=c.openOn),"$$scope"in c&&n(2,i=c.$$scope)},[a,r,i]}class Wf extends en{constructor(e){super(),$t(this,e,rO,tO,jt,{openOn:0})}}const iO=["==",["geometry-type"],"Polygon"],oO=["==",["geometry-type"],"LineString"];function u1(t,e,n){let r=["match",t];for(let[i,a]of Object.entries(e))r.push(i),r.push(a);return r.push(n),r}function hv(t,e,n){let r=["step",t];for(let i=1;i{var c;let r=e.get(n.originalEvent);if(r!==void 0)return r;let a=(c=n.target.queryRenderedFeatures(n.point).find(u=>{var g;return(g=t.get(u.layer.id))==null?void 0:g.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,a),a}}function lO(){let t=new Map;return gv(c1,{map:yr(null),source:Z_(null),layer:Z_(null),popupTarget:Z_(null),cluster:yr(),loadedImages:yr(new Set),minzoom:yr(0),maxzoom:yr(24),layerEvent:yr(null),layerInfo:t,eventTopMost:aO(t)})}function O2(t){return{subscribe:t.subscribe}}function h1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Hf(),a=yr(null),c=O2(a),u={...i,[t]:O2(a)};if(e&&(u.popupTarget=c),r){let g=yr(null);u.layerEvent=g,i.layerEvent=g}return n&&(u.cluster=yr()),gv(c1,u),{...i,self:a}}function uO(){return h1({key:"source",setCluster:!0})}function cO(t=!0){return h1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function hO(){return h1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function z2(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],a=n[r];i!==a&&t(r,a,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function fO(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function pO(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Oy(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function F2(t){let e=t[0],n,r,i=B2(t);return{c(){i.c(),n=oi()},m(a,c){i.m(a,c),Re(a,n,c),r=!0},p(a,c){c[0]&1&&jt(e,e=a[0])?(Nn(),Te(i,1,1,gt),On(),i=B2(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&De(n),i.d(a)}}}function B2(t){let e;const n=t[36].default,r=ti(n,t,t[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[1]&16)&&ri(r,n,i,i[35],e?ni(n,i[35],a,null):ii(i[35]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function dO(t){let e,n,r=t[0]&&F2(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&be(r,1)):(r=F2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function mO(t,e,n){let r,i,a,c,u,g,w,S,I,P,D,N,{$$slots:q={},$$scope:J}=e,{id:re=Yd("layer")}=e,{source:U=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:Z=void 0}=e,{beforeLayerType:te=void 0}=e,{type:_e}=e,{paint:pe=void 0}=e,{layout:he=void 0}=e,{filter:me=void 0}=e,{applyToClusters:Ce=void 0}=e,{minzoom:H=void 0}=e,{maxzoom:ce=void 0}=e,{manageHoverState:Ke=!1}=e,{hovered:Se=null}=e,{interactive:Ze=!0}=e,{hoverCursor:tt=void 0}=e,{eventsIfTopMost:qe=!1}=e;const Nt=qu(),{map:wt,source:un,self:Gt,minzoom:Pt,maxzoom:hn,eventTopMost:Cn,layerInfo:gn}=cO();zt(t,wt,ge=>n(31,I=ge)),zt(t,un,ge=>n(32,P=ge)),zt(t,Gt,ge=>n(0,S=ge)),zt(t,Pt,ge=>n(34,N=ge)),zt(t,hn,ge=>n(33,D=ge)),as(()=>{S&&I&&(gn.delete(S),I==null||I.removeLayer(S))});let yn;function An(ge){var Ne,Yt;if(!Ze||!S||!I||qe&&Cn(ge)!==S)return;let Le=ge.features??[],It=(Yt=(Ne=Le[0])==null?void 0:Ne.properties)==null?void 0:Yt.cluster_id,kn={event:ge,map:I,clusterId:It,layer:S,source:u,features:Le};Nt(ge.type,kn)}function xr(ge){var Ne,Yt;if(!Ze||!S||!I||qe&&Cn(ge)!==S)return;tt&&(I.getCanvas().style.cursor=tt);let Le=ge.features??[];n(6,Se=Le[0]??null);let It=(Yt=(Ne=Le[0])==null?void 0:Ne.properties)==null?void 0:Yt.cluster_id;Nt("mouseenter",{event:ge,map:I,clusterId:It,layer:S,source:u,features:Le})}function Ar(ge){var Ne,Yt,kr;if(!Ze||!I)return;if(qe&&Cn(ge)!==S){n(6,Se=null),Ke&&yn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:j,id:yn},{hover:!1}),yn=void 0);return}I.getCanvas().style.cursor=tt;let Le=ge.features??[],It=(Yt=(Ne=Le[0])==null?void 0:Ne.properties)==null?void 0:Yt.cluster_id,kn=(kr=Le[0])==null?void 0:kr.id;kn!==yn&&(Ke&&(yn!==void 0&&(I==null||I.setFeatureState({source:u,id:yn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:j},{hover:!0})),yn=kn,n(6,Se=Le[0]??null)),Nt("mousemove",{event:ge,map:I,clusterId:It,layer:S,source:u,features:Le})}function wr(ge){if(!(!Ze||!S||!I)){if(tt&&(I.getCanvas().style.cursor=""),n(6,Se=null),Ke&&yn!==void 0){const Le={source:u,id:yn,sourceLayer:j};I==null||I.setFeatureState(Le,{hover:!1}),yn=void 0}Nt("mouseleave",{map:I,layer:S,source:u})}}let fr=!0;function Qe(ge){I&&(I.off("click",ge,An),I.off("dblclick",ge,An),I.off("contextmenu",ge,An),I.off("mouseenter",ge,xr),I.off("mousemove",ge,Ar),I.off("mouseleave",ge,wr))}return as(()=>{I&&S&&Qe(S)}),t.$$set=ge=>{"id"in ge&&n(7,re=ge.id),"source"in ge&&n(8,U=ge.source),"sourceLayer"in ge&&n(9,j=ge.sourceLayer),"beforeId"in ge&&n(10,Z=ge.beforeId),"beforeLayerType"in ge&&n(11,te=ge.beforeLayerType),"type"in ge&&n(12,_e=ge.type),"paint"in ge&&n(13,pe=ge.paint),"layout"in ge&&n(14,he=ge.layout),"filter"in ge&&n(15,me=ge.filter),"applyToClusters"in ge&&n(16,Ce=ge.applyToClusters),"minzoom"in ge&&n(17,H=ge.minzoom),"maxzoom"in ge&&n(18,ce=ge.maxzoom),"manageHoverState"in ge&&n(19,Ke=ge.manageHoverState),"hovered"in ge&&n(6,Se=ge.hovered),"interactive"in ge&&n(20,Ze=ge.interactive),"hoverCursor"in ge&&n(21,tt=ge.hoverCursor),"eventsIfTopMost"in ge&&n(22,qe=ge.eventsIfTopMost),"$$scope"in ge&&n(35,J=ge.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=pO(Ce)),t.$$.dirty[0]&1073774592&&n(24,i=fO("all",r,me)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=H??N),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=ce??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,u=U||P),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==re&&u){S&&(Qe(S),gn.delete(S));let ge=Z;if(!Z&&te){let Le=I.getStyle().layers,It=typeof te=="function"?te:Ne=>Ne.type===te,kn=Le==null?void 0:Le.find(It);kn&&(ge=kn.id)}ur(Gt,S=re,S),I.addLayer(Bc({id:S,type:_e,source:u,"source-layer":j,filter:i,paint:pe,layout:he,minzoom:a,maxzoom:c}),ge),n(23,fr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,xr),I.on("mousemove",S,Ar),I.on("mouseleave",S,wr)}t.$$.dirty[0]&1048577&&S&&gn.set(S,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,g=S?z2((ge,Le)=>I==null?void 0:I.setPaintProperty(S,ge,Le)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?z2((ge,Le)=>I==null?void 0:I.setLayoutProperty(S,ge,Le)):void 0),t.$$.dirty[0]&268443648&&(g==null||g(pe)),t.$$.dirty[0]&134234112&&(w==null||w(he)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(fr?n(23,fr=!1):I==null||I.setFilter(S,i))},[S,wt,un,Gt,Pt,hn,Se,re,U,j,Z,te,_e,pe,he,me,Ce,H,ce,Ke,Ze,tt,qe,fr,i,c,a,w,g,u,r,I,P,D,N,J,q]}let f1=class extends en{constructor(e){super(),$t(this,e,mO,dO,jt,{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 gO(t){let e;const n=t[16].default,r=ti(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&ri(r,n,i,i[24],e?ni(n,i[24],a,null):ii(i[24]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function yO(t){let e,n,r;function i(c){t[17](c)}let a={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[gO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new f1({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&2&&(g.id=c[1]),u&4&&(g.source=c[2]),u&8&&(g.sourceLayer=c[3]),u&16&&(g.beforeId=c[4]),u&32&&(g.beforeLayerType=c[5]),u&64&&(g.paint=c[6]),u&128&&(g.layout=c[7]),u&256&&(g.filter=c[8]),u&512&&(g.applyToClusters=c[9]),u&1024&&(g.minzoom=c[10]),u&2048&&(g.maxzoom=c[11]),u&4096&&(g.hoverCursor=c[12]),u&8192&&(g.manageHoverState=c[13]),u&16384&&(g.eventsIfTopMost=c[14]),u&32768&&(g.interactive=c[15]),u&16777216&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function _O(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Yd("circle")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:g=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:N=void 0}=e,{maxzoom:q=void 0}=e,{hoverCursor:J=void 0}=e,{manageHoverState:re=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:Z=!0}=e;function te(ce){U=ce,n(0,U)}function _e(ce){En.call(this,t,ce)}function pe(ce){En.call(this,t,ce)}function he(ce){En.call(this,t,ce)}function me(ce){En.call(this,t,ce)}function Ce(ce){En.call(this,t,ce)}function H(ce){En.call(this,t,ce)}return t.$$set=ce=>{"id"in ce&&n(1,a=ce.id),"source"in ce&&n(2,c=ce.source),"sourceLayer"in ce&&n(3,u=ce.sourceLayer),"beforeId"in ce&&n(4,g=ce.beforeId),"beforeLayerType"in ce&&n(5,w=ce.beforeLayerType),"paint"in ce&&n(6,S=ce.paint),"layout"in ce&&n(7,I=ce.layout),"filter"in ce&&n(8,P=ce.filter),"applyToClusters"in ce&&n(9,D=ce.applyToClusters),"minzoom"in ce&&n(10,N=ce.minzoom),"maxzoom"in ce&&n(11,q=ce.maxzoom),"hoverCursor"in ce&&n(12,J=ce.hoverCursor),"manageHoverState"in ce&&n(13,re=ce.manageHoverState),"hovered"in ce&&n(0,U=ce.hovered),"eventsIfTopMost"in ce&&n(14,j=ce.eventsIfTopMost),"interactive"in ce&&n(15,Z=ce.interactive),"$$scope"in ce&&n(24,i=ce.$$scope)},[U,a,c,u,g,w,S,I,P,D,N,q,J,re,j,Z,r,te,_e,pe,he,me,Ce,H,i]}let zy=class extends en{constructor(e){super(),$t(this,e,_O,yO,jt,{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 vO(t){let e;const n=t[15].default,r=ti(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&ri(r,n,i,i[23],e?ni(n,i[23],a,null):ii(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function bO(t){let e,n,r;function i(c){t[16](c)}let a={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[vO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new f1({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&2&&(g.id=c[1]),u&4&&(g.source=c[2]),u&8&&(g.sourceLayer=c[3]),u&16&&(g.beforeId=c[4]),u&32&&(g.beforeLayerType=c[5]),u&64&&(g.paint=c[6]),u&128&&(g.layout=c[7]),u&256&&(g.filter=c[8]),u&512&&(g.minzoom=c[9]),u&1024&&(g.maxzoom=c[10]),u&2048&&(g.hoverCursor=c[11]),u&4096&&(g.manageHoverState=c[12]),u&8192&&(g.eventsIfTopMost=c[13]),u&16384&&(g.interactive=c[14]),u&8388608&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function xO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Yd("fill")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:g=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:J=!1}=e,{hovered:re=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:j=!0}=e;function Z(H){re=H,n(0,re)}function te(H){En.call(this,t,H)}function _e(H){En.call(this,t,H)}function pe(H){En.call(this,t,H)}function he(H){En.call(this,t,H)}function me(H){En.call(this,t,H)}function Ce(H){En.call(this,t,H)}return t.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,c=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,q=H.hoverCursor),"manageHoverState"in H&&n(12,J=H.manageHoverState),"hovered"in H&&n(0,re=H.hovered),"eventsIfTopMost"in H&&n(13,U=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[re,a,c,u,g,w,S,I,P,D,N,q,J,U,j,r,Z,te,_e,pe,he,me,Ce,i]}let IC=class extends en{constructor(e){super(),$t(this,e,xO,bO,jt,{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 wO(t,e,n){let r;const{map:i}=Hf();zt(t,i,g=>n(4,r=g));let{position:a="top-left"}=e,{container:c=void 0}=e,u=null;return as(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),t.$$set=g=>{"position"in g&&n(1,a=g.position),"container"in g&&n(2,c=g.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!u){let g;typeof c=="string"?g=document.querySelector(c)??void 0:g=c,n(3,u=new Es.FullscreenControl({container:g})),r.addControl(u,a)}},[i,a,c,u,r]}class SO extends en{constructor(e){super(),$t(this,e,wO,null,jt,{position:1,container:2})}}function EO(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const u=()=>{e&&(t.getSource(e)?setTimeout(u,1):c())};u()}else c()}function IO(t,e,n){KS().then(()=>{let r=WS(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function V2(t){let e=t[0],n,r,i=U2(t);return{c(){i.c(),n=oi()},m(a,c){i.m(a,c),Re(a,n,c),r=!0},p(a,c){c&1&&jt(e,e=a[0])?(Nn(),Te(i,1,1,gt),On(),i=U2(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&De(n),i.d(a)}}}function U2(t){let e;const n=t[15].default,r=ti(n,t,t[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16384)&&ri(r,n,i,i[14],e?ni(n,i[14],a,null):ii(i[14]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function CO(t){let e,n,r=t[0]&&V2(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=V2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function TO(t,e,n){let r,i,a,{$$slots:c={},$$scope:u}=e,{id:g=Yd("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:P=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:N=void 0}=e;const{map:q,cluster:J,self:re}=uO();zt(t,q,Z=>n(13,i=Z)),zt(t,J,Z=>n(16,a=Z)),zt(t,re,Z=>n(0,r=Z));let U,j=!0;return as(()=>{r&&U&&i&&(IO(q,r,U),ur(re,r=null,r),n(11,U=void 0))}),t.$$set=Z=>{"id"in Z&&n(4,g=Z.id),"data"in Z&&n(5,w=Z.data),"generateId"in Z&&n(6,S=Z.generateId),"promoteId"in Z&&n(7,I=Z.promoteId),"filter"in Z&&n(8,P=Z.filter),"lineMetrics"in Z&&n(9,D=Z.lineMetrics),"cluster"in Z&&n(10,N=Z.cluster),"$$scope"in Z&&n(14,u=Z.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&ur(J,a=N,a),t.$$.dirty&12273&&i&&r!==g&&(ur(re,r=g,r),EO(i,r,Bc({type:"geojson",data:w,filter:P,lineMetrics:D,generateId:S,promoteId:I,cluster:!!N,clusterMinPoints:N==null?void 0:N.minPoints,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius,clusterProperties:N==null?void 0:N.properties}),Z=>i&&Z===r,()=>{r&&(n(11,U=i==null?void 0:i.getSource(r)),n(12,j=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,U=i==null?void 0:i.getSource(g))})),t.$$.dirty&6176&&U&&(j?n(12,j=!1):U.setData(w)),t.$$.dirty&3072&&(U==null||U.setClusterOptions(Bc({cluster:!!N,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius})))},[r,q,J,re,g,w,S,I,P,D,N,U,j,i,u,c]}let nu=class extends en{constructor(e){super(),$t(this,e,TO,CO,jt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}};function LO(t,e,n){let r;const{map:i}=Hf();zt(t,i,P=>n(8,r=P));let{position:a="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:u=void 0}=e,{trackUserLocation:g=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:S=!0}=e,I=null;return as(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),t.$$set=P=>{"position"in P&&n(1,a=P.position),"positionOptions"in P&&n(2,c=P.positionOptions),"fitBoundsOptions"in P&&n(3,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(4,g=P.trackUserLocation),"showAccuracyCircle"in P&&n(5,w=P.showAccuracyCircle),"showUserLocation"in P&&n(6,S=P.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&r&&!I&&(n(7,I=new Es.GeolocateControl({positionOptions:c,fitBoundsOptions:u,trackUserLocation:g,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,a,c,u,g,w,S,I,r]}class PO extends en{constructor(e){super(),$t(this,e,LO,null,jt,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function MO(t){let e;const n=t[15].default,r=ti(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&ri(r,n,i,i[23],e?ni(n,i[23],a,null):ii(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function AO(t){let e,n,r;function i(c){t[16](c)}let a={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[MO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new f1({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&2&&(g.id=c[1]),u&4&&(g.source=c[2]),u&8&&(g.sourceLayer=c[3]),u&16&&(g.beforeId=c[4]),u&32&&(g.beforeLayerType=c[5]),u&64&&(g.paint=c[6]),u&128&&(g.layout=c[7]),u&256&&(g.filter=c[8]),u&512&&(g.minzoom=c[9]),u&1024&&(g.maxzoom=c[10]),u&2048&&(g.hoverCursor=c[11]),u&4096&&(g.manageHoverState=c[12]),u&8192&&(g.eventsIfTopMost=c[13]),u&16384&&(g.interactive=c[14]),u&8388608&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function kO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Yd("line")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:g=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:J=!1}=e,{hovered:re=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:j=!0}=e;function Z(H){re=H,n(0,re)}function te(H){En.call(this,t,H)}function _e(H){En.call(this,t,H)}function pe(H){En.call(this,t,H)}function he(H){En.call(this,t,H)}function me(H){En.call(this,t,H)}function Ce(H){En.call(this,t,H)}return t.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,c=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,q=H.hoverCursor),"manageHoverState"in H&&n(12,J=H.manageHoverState),"hovered"in H&&n(0,re=H.hovered),"eventsIfTopMost"in H&&n(13,U=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[re,a,c,u,g,w,S,I,P,D,N,q,J,U,j,r,Z,te,_e,pe,he,me,Ce,i]}let Xc=class extends en{constructor(e){super(),$t(this,e,kO,AO,jt,{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 DO(t,e,n){let r;const i=qu();let{layer:a=void 0}=e;const{map:c}=Hf();zt(t,c,S=>n(2,r=S));function u(S){i(S.type,{...S,map:c})}const g=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return as(()=>{if(r)if(a)for(const S of g)r.off(S,a,u);else for(const S of w)r.off(S,u)}),t.$$set=S=>{"layer"in S&&n(1,a=S.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(a)for(const S of g)r.on(S,a,u);else for(const S of w)r.on(S,u)},[c,a,r]}class RO extends en{constructor(e){super(),$t(this,e,DO,null,jt,{layer:1})}}function NO(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(e.lat*i)/i,c=Math.round(e.lng*i)/i,u=`${n}/${a}/${c}`,g=t.getBearing(),w=t.getPitch();return(g||w)&&(u+=`/${Math.round(g*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function OO(t){return t.replace("#","").split("/").map(parseFloat)}function zO(t,e,n){let r;const{map:i}=Hf();zt(t,i,S=>n(6,r=S));let{position:a="top-left"}=e,{showCompass:c=!0}=e,{showZoom:u=!0}=e,{visualizePitch:g=!1}=e,w=null;return as(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),t.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,g=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Es.NavigationControl({showCompass:c,showZoom:u,visualizePitch:g})),r.addControl(w,a))},[i,a,c,u,g,w,r]}class FO extends en{constructor(e){super(),$t(this,e,zO,null,jt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function BO(t,e,n){let r;const{map:i}=Hf();zt(t,i,w=>n(5,r=w));let{position:a="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:u="metric"}=e,g=null;return as(()=>{r!=null&&r.loaded()&&g&&r.removeControl(g)}),t.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,c=w.maxWidth),"unit"in w&&n(3,u=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!g&&(n(4,g=new Es.ScaleControl({maxWidth:c,unit:u})),r.addControl(g,a))},[i,a,c,u,g,r]}class VO extends en{constructor(e){super(),$t(this,e,BO,null,jt,{position:1,maxWidth:2,unit:3})}}const{window:UO}=VL,GO=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),G2=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function q2(t){let e,n,r=t[3]&&j2(t);const i=t[39].default,a=ti(i,t,t[38],G2);return{c(){r&&r.c(),e=ft(),a&&a.c()},m(c,u){r&&r.m(c,u),Re(c,e,u),a&&a.m(c,u),n=!0},p(c,u){c[3]?r?(r.p(c,u),u[0]&8&&be(r,1)):(r=j2(c),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On()),a&&a.p&&(!n||u[0]&112|u[1]&128)&&ri(a,i,c,c[38],n?ni(i,c[38],u,GO):ii(c[38]),G2)},i(c){n||(be(r),be(a,c),n=!0)},o(c){Te(r),Te(a,c),n=!1},d(c){c&&De(e),r&&r.d(c),a&&a.d(c)}}}function j2(t){let e,n,r,i,a,c,u,g;return e=new FO({props:{position:t[7]}}),r=new PO({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new SO({props:{position:t[7]}}),u=new VO({props:{position:t[7]}}),{c(){lt(e.$$.fragment),n=ft(),lt(r.$$.fragment),i=ft(),lt(a.$$.fragment),c=ft(),lt(u.$$.fragment)},m(w,S){st(e,w,S),Re(w,n,S),st(r,w,S),Re(w,i,S),st(a,w,S),Re(w,c,S),st(u,w,S),g=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),e.$set(I);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const D={};S[0]&128&&(D.position=w[7]),a.$set(D);const N={};S[0]&128&&(N.position=w[7]),u.$set(N)},i(w){g||(be(e.$$.fragment,w),be(r.$$.fragment,w),be(a.$$.fragment,w),be(u.$$.fragment,w),g=!0)},o(w){Te(e.$$.fragment,w),Te(r.$$.fragment,w),Te(a.$$.fragment,w),Te(u.$$.fragment,w),g=!1},d(w){w&&(De(n),De(i),De(c)),at(e,w),at(r,w),at(a,w),at(u,w)}}}function qO(t){let e,n,r,i,a,c=t[4]&&t[0]&&q2(t);return{c(){e=Oe("div"),c&&c.c(),Ue(e,"class",n=Ag(t[2])+" svelte-p00lfq"),Ue(e,"data-testid","map-container"),ol(e,"expand-map",!t[2])},m(u,g){Re(u,e,g),c&&c.m(e,null),t[40](e),r=!0,i||(a=[Zt(UO,"hashchange",t[11]),w0(t[10].call(null,e))],i=!0)},p(u,g){u[4]&&u[0]?c?(c.p(u,g),g[0]&17&&be(c,1)):(c=q2(u),c.c(),be(c,1),c.m(e,null)):c&&(Nn(),Te(c,1,1,()=>{c=null}),On()),(!r||g[0]&4&&n!==(n=Ag(u[2])+" svelte-p00lfq"))&&Ue(e,"class",n),(!r||g[0]&4)&&ol(e,"expand-map",!u[2])},i(u){r||(be(c),r=!0)},o(u){Te(c),r=!1},d(u){u&&De(e),c&&c.d(),t[40](null),i=!1,Ni(a)}}}function jO(t,e,n){let r,i,a,c,{$$slots:u={},$$scope:g}=e,{map:w=null}=e,{mapContainer:S=void 0}=e,{class:I=void 0}=e,{style:P}=e,{diffStyleUpdates:D=!1}=e,{center:N=void 0}=e,{zoom:q=void 0}=e,{pitch:J=0}=e,{bearing:re=0}=e,{bounds:U=void 0}=e,{hash:j=!1}=e,{loaded:Z=!1}=e,{minZoom:te=0}=e,{maxZoom:_e=22}=e,{antialias:pe=void 0}=e,{zoomOnDoubleClick:he=!0}=e,{locale:me=void 0}=e,{interactive:Ce=!0}=e,{attributionControl:H=!0}=e,{cooperativeGestures:ce=!1}=e,{preserveDrawingBuffer:Ke=!1}=e,{maxBounds:Se=void 0}=e,{images:Ze=[]}=e,{standardControls:tt=!1}=e,{filterLayers:qe=void 0}=e,{transformRequest:Nt=void 0}=e;const wt=qu(),{map:un,loadedImages:Gt}=lO();zt(t,un,Qe=>n(4,a=Qe)),zt(t,Gt,Qe=>n(5,c=Qe));let Pt=new Set;async function hn(Qe,ge=!1){if(a&&!(!a.loaded()&&!ge))if("url"in Qe){Pt.add(Qe.id);try{let Le=await a.loadImage(Qe.url);a==null||a.addImage(Qe.id,Le.data,Qe.options),c.add(Qe.id),Gt.set(c)}catch(Le){wt("error",Le)}finally{Pt.delete(Qe.id)}}else a.addImage(Qe.id,Qe.data,Qe.options),c.add(Qe.id),Gt.set(c)}let Cn,gn,yn,An;function xr(Qe){return wr(),ur(un,a=new Es.Map(Bc({container:Qe,style:P,locale:me,center:N,zoom:q,pitch:J,bearing:re,minZoom:te,maxZoom:_e,antialias:pe,interactive:Ce,preserveDrawingBuffer:Ke,maxBounds:Se,bounds:U,attributionControl:H,transformRequest:Nt,cooperativeGestures:ce})),a),a.on("load",ge=>{ge.target.getContainer().setAttribute("data-testid","map"),ge.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,Z=!0),wt("load",a)}),a.on("error",ge=>wt("error",{...ge,map:a})),a.on("movestart",ge=>wt("movestart",{...ge,map:a})),a.on("moveend",ge=>{if(n(12,N=ge.target.getCenter()),n(13,q=ge.target.getZoom()),n(14,U=ge.target.getBounds()),wt("moveend",{...ge,map:a}),j){let Le=window.location.href.replace(/(#.+)?$/,NO(a));window.history.replaceState(window.history.state,"",Le)}}),a.on("click",ge=>wt("click",{...ge,map:a})),a.on("dblclick",ge=>wt("dblclick",{...ge,map:a})),a.on("contextmenu",ge=>wt("contextmenu",{...ge,map:a})),a.on("zoomstart",ge=>wt("zoomstart",{...ge,map:a})),a.on("zoom",ge=>{n(13,q=ge.target.getZoom()),wt("zoom",{...ge,map:a})}),a.on("zoomend",ge=>{n(13,q=ge.target.getZoom()),wt("zoomend",{...ge,map:a})}),a.on("style.load",()=>{if(a){const ge=a.getStyle();if(n(35,Cn=ge.layers.map(Le=>Le.id)),n(36,gn=Object.keys(ge.sources)),An)for(const[Le,It]of Object.entries(An))a.addSource(Le,It);if(yn)for(const Le of yn)a.addLayer(Le);for(const Le of Ze)hn(Le,!0)}}),a.on("styledata",ge=>{if(a&&qe){const Le=a.getStyle().layers;if(Le)for(let It of Le)qe(It)||a.setLayoutProperty(It.id,"visibility","none")}wt("styledata",{...ge,map:a})}),{destroy(){n(0,Z=!1),a==null||a.remove(),ur(un,a=null,a)}}}let Ar=P;function wr(){if(j){let Qe=OO(window.location.hash);Qe.length>=3&&(n(13,q=Qe[0]),n(12,N=[Qe[2],Qe[1]])),Qe.length==5&&(n(17,re=Qe[3]),n(16,J=Qe[4]))}}function fr(Qe){Kn[Qe?"unshift":"push"](()=>{S=Qe,n(1,S)})}return t.$$set=Qe=>{"map"in Qe&&n(15,w=Qe.map),"mapContainer"in Qe&&n(1,S=Qe.mapContainer),"class"in Qe&&n(2,I=Qe.class),"style"in Qe&&n(18,P=Qe.style),"diffStyleUpdates"in Qe&&n(19,D=Qe.diffStyleUpdates),"center"in Qe&&n(12,N=Qe.center),"zoom"in Qe&&n(13,q=Qe.zoom),"pitch"in Qe&&n(16,J=Qe.pitch),"bearing"in Qe&&n(17,re=Qe.bearing),"bounds"in Qe&&n(14,U=Qe.bounds),"hash"in Qe&&n(20,j=Qe.hash),"loaded"in Qe&&n(0,Z=Qe.loaded),"minZoom"in Qe&&n(21,te=Qe.minZoom),"maxZoom"in Qe&&n(22,_e=Qe.maxZoom),"antialias"in Qe&&n(23,pe=Qe.antialias),"zoomOnDoubleClick"in Qe&&n(24,he=Qe.zoomOnDoubleClick),"locale"in Qe&&n(25,me=Qe.locale),"interactive"in Qe&&n(26,Ce=Qe.interactive),"attributionControl"in Qe&&n(27,H=Qe.attributionControl),"cooperativeGestures"in Qe&&n(28,ce=Qe.cooperativeGestures),"preserveDrawingBuffer"in Qe&&n(29,Ke=Qe.preserveDrawingBuffer),"maxBounds"in Qe&&n(30,Se=Qe.maxBounds),"images"in Qe&&n(31,Ze=Qe.images),"standardControls"in Qe&&n(3,tt=Qe.standardControls),"filterLayers"in Qe&&n(32,qe=Qe.filterLayers),"transformRequest"in Qe&&n(33,Nt=Qe.transformRequest),"$$scope"in Qe&&n(38,g=Qe.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof tt=="boolean"?void 0:tt),t.$$.dirty[0]&16&&n(15,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&112&&a&&!mg(P,Ar)){const Qe=a.getStyle();if(Cn&&(yn=Qe.layers.filter(ge=>!Cn.includes(ge.id))),gn){const ge=Object.keys(Qe.sources).filter(Le=>!gn.includes(Le));An={};for(const Le of ge)An[Le]=Qe.sources[Le]}n(37,Ar=P),a.setStyle(P,{diff:D}),ur(Gt,c=new Set,c),n(34,Pt=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&9&&Z&&a!=null&&a.loaded())for(let Qe of Ze)!c.has(Qe.id)&&!Pt.has(Qe.id)&&!a.hasImage(Qe.id)&&hn(Qe);t.$$.dirty[0]&32|t.$$.dirty[1]&1&&n(6,i=Ze.every(Qe=>c.has(Qe.id))),t.$$.dirty[0]&4112&&N&&!mg(N,a==null?void 0:a.getCenter())&&(a==null||a.panTo(N)),t.$$.dirty[0]&8208&&q&&!mg(q,a==null?void 0:a.getZoom())&&(a==null||a.zoomTo(q)),t.$$.dirty[0]&16400&&U&&!mg(U,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(U)),t.$$.dirty[0]&16777232&&(he?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[Z,S,I,tt,a,c,i,r,un,Gt,xr,wr,N,q,U,w,J,re,P,D,j,te,_e,pe,he,me,Ce,H,ce,Ke,Se,Ze,qe,Nt,Pt,Cn,gn,Ar,g,u,fr]}class WO extends en{constructor(e){super(),$t(this,e,jO,qO,jt,{map:15,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:16,bearing:17,bounds:14,hash:20,loaded:0,minZoom:21,maxZoom:22,antialias:23,zoomOnDoubleClick:24,locale:25,interactive:26,attributionControl:27,cooperativeGestures:28,preserveDrawingBuffer:29,maxBounds:30,images:31,standardControls:3,filterLayers:32,transformRequest:33},null,[-1,-1])}}const HO=t=>({marker:t&8}),W2=t=>({marker:t[3]});function ZO(t){let e,n,r,i,a,c,u;const g=t[19].default,w=ti(g,t,t[18],W2);return{c(){e=Oe("div"),w&&w.c(),Ue(e,"tabindex",n=t[1]?0:void 0),Ue(e,"role",r=t[1]?"button":void 0),Si(e,"z-index",t[2])},m(S,I){Re(S,e,I),w&&w.m(e,null),a=!0,c||(u=[w0(t[7].call(null,e)),w0(i=XO.call(null,e,t[0])),Zt(e,"click",W_(t[20])),Zt(e,"dblclick",W_(t[21])),Zt(e,"contextmenu",W_(t[22])),Zt(e,"mouseenter",t[23]),Zt(e,"mouseleave",t[24]),Zt(e,"mousemove",t[25]),Zt(e,"keydown",t[8])],c=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&ri(w,g,S,S[18],a?ni(g,S[18],I,HO):ii(S[18]),W2),(!a||I&2&&n!==(n=S[1]?0:void 0))&&Ue(e,"tabindex",n),(!a||I&2&&r!==(r=S[1]?"button":void 0))&&Ue(e,"role",r),i&&dy(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Si(e,"z-index",S[2])},i(S){a||(be(w,S),a=!0)},o(S){Te(w,S),a=!1},d(S){S&&De(e),w&&w.d(S),c=!1,Ni(u)}}}function XO(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function YO(t,e,n){let r,i,a,{$$slots:c={},$$scope:u}=e,{marker:g=void 0}=e,{lngLat:w}=e,{class:S=void 0}=e,{interactive:I=!0}=e,{asButton:P=!1}=e,{draggable:D=!1}=e,{feature:N=null}=e,{offset:q=void 0}=e,{zIndex:J=void 0}=e,{rotation:re=0}=e,{opacity:U=1}=e;const j=qu(),{map:Z,layerEvent:te,self:_e}=hO();zt(t,Z,qe=>n(27,a=qe)),zt(t,te,qe=>n(26,r=qe)),zt(t,_e,qe=>n(3,i=qe));function pe(qe){ur(_e,i=new Es.Marker({element:qe,rotation:re,draggable:D,offset:q,opacity:U.toString()}).setLngLat(w).addTo(a),i),n(11,g=i);const Nt=()=>Ce("dragstart"),wt=()=>{he(),Ce("drag")},un=()=>{he(),Ce("dragend")};return D&&(i.on("dragstart",Nt),i.on("drag",wt),i.on("dragend",un)),{destroy(){D&&(i==null||i.off("dragstart",Nt),i==null||i.off("drag",wt),i==null||i.off("dragend",un)),n(11,g=void 0),i==null||i.remove()}}}function he(){let qe=i==null?void 0:i.getLngLat();qe&&(Array.isArray(w)?n(10,w=[qe.lng,qe.lat]):w&&"lon"in w?n(10,w={lon:qe.lng,lat:qe.lat}):n(10,w=qe))}function me(qe){qe.key===" "&&(qe.preventDefault(),qe.stopPropagation(),Ce("click"))}function Ce(qe){if(!I)return;let Nt=i==null?void 0:i.getLngLat();if(!Nt)return;const wt=[Nt.lng,Nt.lat];let un={map:a,marker:i,lngLat:wt,features:[{type:"Feature",properties:(N==null?void 0:N.properties)??{},geometry:{type:"Point",coordinates:wt}}]};ur(te,r={...un,layerType:"marker",type:qe},r),j(qe,un)}const H=()=>Ce("click"),ce=()=>Ce("dblclick"),Ke=()=>Ce("contextmenu"),Se=qe=>{Ce("mouseenter")},Ze=()=>{Ce("mouseleave")},tt=()=>Ce("mousemove");return t.$$set=qe=>{"marker"in qe&&n(11,g=qe.marker),"lngLat"in qe&&n(10,w=qe.lngLat),"class"in qe&&n(0,S=qe.class),"interactive"in qe&&n(12,I=qe.interactive),"asButton"in qe&&n(1,P=qe.asButton),"draggable"in qe&&n(13,D=qe.draggable),"feature"in qe&&n(14,N=qe.feature),"offset"in qe&&n(15,q=qe.offset),"zIndex"in qe&&n(2,J=qe.zIndex),"rotation"in qe&&n(16,re=qe.rotation),"opacity"in qe&&n(17,U=qe.opacity),"$$scope"in qe&&n(18,u=qe.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(w)),t.$$.dirty&32776&&(i==null||i.setOffset(q??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(re)),t.$$.dirty&131080&&(i==null||i.setOpacity(U.toString()))},[S,P,J,i,Z,te,_e,pe,me,Ce,w,g,I,D,N,q,re,U,u,c,H,ce,Ke,Se,Ze,tt]}class Nd extends en{constructor(e){super(),$t(this,e,YO,ZO,jt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const KO=t=>({}),H2=t=>({}),JO=t=>({}),Z2=t=>({}),QO=t=>({}),X2=t=>({});function $O(t){let e,n,r,i,a,c;const u=t[1].top,g=ti(u,t,t[0],X2),w=t[1].left,S=ti(w,t,t[0],Z2),I=t[1].main,P=ti(I,t,t[0],H2);return{c(){e=Oe("div"),g&&g.c(),n=ft(),r=Oe("div"),S&&S.c(),i=ft(),a=Oe("div"),P&&P.c(),Ue(e,"class","top svelte-mpick2"),Ue(r,"class","left svelte-mpick2"),Ue(a,"class","main svelte-mpick2")},m(D,N){Re(D,e,N),g&&g.m(e,null),Re(D,n,N),Re(D,r,N),S&&S.m(r,null),Re(D,i,N),Re(D,a,N),P&&P.m(a,null),c=!0},p(D,[N]){g&&g.p&&(!c||N&1)&&ri(g,u,D,D[0],c?ni(u,D[0],N,QO):ii(D[0]),X2),S&&S.p&&(!c||N&1)&&ri(S,w,D,D[0],c?ni(w,D[0],N,JO):ii(D[0]),Z2),P&&P.p&&(!c||N&1)&&ri(P,I,D,D[0],c?ni(I,D[0],N,KO):ii(D[0]),H2)},i(D){c||(be(g,D),be(S,D),be(P,D),c=!0)},o(D){Te(g,D),Te(S,D),Te(P,D),c=!1},d(D){D&&(De(e),De(n),De(r),De(i),De(a)),g&&g.d(D),S&&S.d(D),P&&P.d(D)}}}function e5(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class t5 extends en{constructor(e){super(),$t(this,e,e5,$O,jt,{})}}const n5=t=>({}),Y2=t=>({}),r5=t=>({}),K2=t=>({}),i5=t=>({}),J2=t=>({});function o5(t){let e,n,r,i,a,c;const u=t[4].top,g=ti(u,t,t[3],J2),w=t[4].sidebar,S=ti(w,t,t[3],K2),I=t[4].map,P=ti(I,t,t[3],Y2);return{c(){e=Oe("div"),g&&g.c(),n=ft(),r=Oe("div"),S&&S.c(),i=ft(),a=Oe("div"),P&&P.c()},m(D,N){Re(D,e,N),g&&g.m(e,null),t[5](e),Re(D,n,N),Re(D,r,N),S&&S.m(r,null),t[6](r),Re(D,i,N),Re(D,a,N),P&&P.m(a,null),t[7](a),c=!0},p(D,[N]){g&&g.p&&(!c||N&8)&&ri(g,u,D,D[3],c?ni(u,D[3],N,i5):ii(D[3]),J2),S&&S.p&&(!c||N&8)&&ri(S,w,D,D[3],c?ni(w,D[3],N,r5):ii(D[3]),K2),P&&P.p&&(!c||N&8)&&ri(P,I,D,D[3],c?ni(I,D[3],N,n5):ii(D[3]),Y2)},i(D){c||(be(g,D),be(S,D),be(P,D),c=!0)},o(D){Te(g,D),Te(S,D),Te(P,D),c=!1},d(D){D&&(De(e),De(n),De(r),De(i),De(a)),g&&g.d(D),t[5](null),S&&S.d(D),t[6](null),P&&P.d(D),t[7](null)}}}function s5(t,e,n){let r,i,a;zt(t,fv,I=>n(0,r=I)),zt(t,pv,I=>n(1,i=I)),zt(t,dv,I=>n(2,a=I));let{$$slots:c={},$$scope:u}=e;function g(I){Kn[I?"unshift":"push"](()=>{r=I,fv.set(r)})}function w(I){Kn[I?"unshift":"push"](()=>{i=I,pv.set(i)})}function S(I){Kn[I?"unshift":"push"](()=>{a=I,dv.set(a)})}return t.$$set=I=>{"$$scope"in I&&n(3,u=I.$$scope)},[r,i,a,u,c,g,w,S]}class Zf extends en{constructor(e){super(),$t(this,e,s5,o5,jt,{})}}let fv=yr(null),pv=yr(null),dv=yr(null);function a5(t){let e,n;return e=new vv({props:{properties:t[3]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.properties=r[3]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function l5(t){let e,n;return e=new Wf({props:{openOn:"hover",$$slots:{default:[a5,({props:r})=>({3:r}),({props:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function u5(t){let e,n,r;function i(c){t[1](c)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Oy("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[l5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new zy({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[2]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&16&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function c5(t,e,n){let{hovered:r=null}=e;function i(c){r=c,n(0,r)}const a=c=>window.open(Hl(c.detail.features[0].properties).osm_id,"_blank");return t.$$set=c=>{"hovered"in c&&n(0,r=c.hovered)},[r,i,a]}class CC extends en{constructor(e){super(),$t(this,e,c5,u5,jt,{hovered:0})}}function Q2(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function $2(t,e,n){const r=t.slice();return r[6]=e[n],r}function eS(t){let e,n,r=rS(t[6])+"",i,a;return{c(){e=Oe("li"),n=Oe("a"),i=kt(r),Ue(n,"href",a=t[6].properties.osm_id),Ue(n,"target","_blank")},m(c,u){Re(c,e,u),ke(e,n),ke(n,i)},p(c,u){u&1&&r!==(r=rS(c[6])+"")&&Qn(i,r),u&1&&a!==(a=c[6].properties.osm_id)&&Ue(n,"href",a)},d(c){c&&De(e)}}}function tS(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",u,g,w,S,I,P=ei(t[3]),D=[];for(let N=0;Ni[1].length-r[1].length),n}function rS(t){let e=t.properties.name||`a ${t.properties.amenity_kind}`;return t.properties.brand&&(e+=` (${t.properties.brand})`),t.properties.cuisine&&(e+=` (${t.properties.cuisine})`),e}function f5(t,e,n){let r,{gj:i}=e;return t.$$set=a=>{"gj"in a&&n(1,i=a.gj)},t.$$.update=()=>{t.$$.dirty&2&&n(0,r=i.features.filter(a=>"amenity_kind"in a.properties))},[r,i]}class TC extends en{constructor(e){super(),$t(this,e,f5,h5,jt,{gj:1})}}function p5(t){let e,n,r,i,a,c,u,g,w,S,I,P,D,N,q,J,re,U,j,Z,te,_e,pe,he,me,Ce;return{c(){e=Oe("nav"),n=Oe("ul"),r=Oe("li"),i=Oe("button"),i.textContent="Change study area",a=ft(),c=Oe("li"),u=Oe("button"),g=kt("Isochrone"),S=ft(),I=Oe("li"),P=Oe("button"),D=kt("Route"),q=ft(),J=Oe("li"),re=Oe("button"),U=kt("Score"),Z=ft(),te=Oe("li"),_e=Oe("button"),pe=kt("Debug network"),u.disabled=w=t[0].kind=="isochrone",P.disabled=N=t[0].kind=="route",re.disabled=j=t[0].kind=="score",_e.disabled=he=t[0].kind=="debug"},m(H,ce){Re(H,e,ce),ke(e,n),ke(n,r),ke(r,i),ke(n,a),ke(n,c),ke(c,u),ke(u,g),ke(n,S),ke(n,I),ke(I,P),ke(P,D),ke(n,q),ke(n,J),ke(J,re),ke(re,U),ke(n,Z),ke(n,te),ke(te,_e),ke(_e,pe),me||(Ce=[Zt(i,"click",t[1]),Zt(u,"click",t[2]),Zt(P,"click",t[3]),Zt(re,"click",t[4]),Zt(_e,"click",t[5])],me=!0)},p(H,[ce]){ce&1&&w!==(w=H[0].kind=="isochrone")&&(u.disabled=w),ce&1&&N!==(N=H[0].kind=="route")&&(P.disabled=N),ce&1&&j!==(j=H[0].kind=="score")&&(re.disabled=j),ce&1&&he!==(he=H[0].kind=="debug")&&(_e.disabled=he)},i:gt,o:gt,d(H){H&&De(e),me=!1,Ni(Ce)}}}function d5(t,e,n){let r;return zt(t,Ys,w=>n(0,r=w)),[r,()=>ur(Ys,r={kind:"title"},r),()=>ur(Ys,r={kind:"isochrone"},r),()=>ur(Ys,r={kind:"route"},r),()=>ur(Ys,r={kind:"score"},r),()=>ur(Ys,r={kind:"debug"},r)]}class Fy extends en{constructor(e){super(),$t(this,e,d5,p5,jt,{})}}function m5(t){let e,n,r,i,a,c,u,g,w;return{c(){e=Oe("label"),n=kt(`Mode: - `),r=Oe("select"),i=Oe("option"),i.textContent="Car",a=Oe("option"),a.textContent="Bicycle",c=Oe("option"),c.textContent="Foot",u=Oe("option"),u.textContent="Public transit",i.__value="car",Go(i,i.__value),a.__value="bicycle",Go(a,a.__value),c.__value="foot",Go(c,c.__value),u.__value="transit",Go(u,u.__value),t[0]===void 0&&yd(()=>t[1].call(r))},m(S,I){Re(S,e,I),ke(e,n),ke(e,r),ke(r,i),ke(r,a),ke(r,c),ke(r,u),kg(r,t[0],!0),g||(w=Zt(r,"change",t[1]),g=!0)},p(S,[I]){I&1&&kg(r,S[0])},i:gt,o:gt,d(S){S&&De(e),g=!1,w()}}}function g5(t,e,n){let{travelMode:r}=e;function i(){r=ZS(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class p1 extends en{constructor(e){super(),$t(this,e,g5,m5,jt,{travelMode:0})}}function iS(t,e,n){const r=t.slice();return r[3]=e[n],r}function y5(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=kt(e),r=kt(" has "),a=kt(i),c=kt(" next steps (arrivals)")},m(u,g){Re(u,n,g),Re(u,r,g),Re(u,a,g),Re(u,c,g)},p(u,g){g&64&&e!==(e=u[6].name+"")&&Qn(n,e),g&64&&i!==(i=JSON.parse(u[6].next_steps).length+"")&&Qn(a,i)},d(u){u&&(De(n),De(r),De(a),De(c))}}}function _5(t){let e,n;return e=new Wf({props:{openOn:"hover",$$slots:{default:[y5,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function oS(t){let e,n;return e=new JS({props:{$$slots:{default:[v5]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function sS(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=Oe("p"),r=kt(n)},m(i,a){Re(i,e,a),ke(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&Qn(r,n)},d(i){i&&De(e)}}}function v5(t){let e,n=ei(t[0]),r=[];for(let i=0;i{a=null}),On())},i(c){i||(be(e.$$.fragment,c),be(a),i=!0)},o(c){Te(e.$$.fragment,c),Te(a),i=!1},d(c){c&&(De(n),De(r)),at(e,c),a&&a.d(c)}}}function x5(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(Hl(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class w5 extends en{constructor(e){super(),$t(this,e,x5,b5,jt,{})}}function S5(t){let e,n,r;return n=new Fy({}),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Re(i,e,a),st(n,e,null),r=!0},p:gt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&De(e),at(n)}}}function aS(t){let e,n;return e=new TC({props:{gj:t[0]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function E5(t){let e,n,r,i,a,c,u,g,w;function S(D){t[3](D)}let I={};t[1]!==void 0&&(I.travelMode=t[1]),c=new p1({props:I}),Kn.push(()=>Po(c,"travelMode",S));let P=t[0]&&aS(t);return{c(){e=Oe("div"),n=Oe("h2"),n.textContent="Debug mode",r=ft(),i=Oe("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=ft(),lt(c.$$.fragment),g=ft(),P&&P.c(),Ue(e,"slot","sidebar")},m(D,N){Re(D,e,N),ke(e,n),ke(e,r),ke(e,i),ke(e,a),st(c,e,null),ke(e,g),P&&P.m(e,null),w=!0},p(D,N){const q={};!u&&N&2&&(u=!0,q.travelMode=D[1],Lo(()=>u=!1)),c.$set(q),D[0]?P?(P.p(D,N),N&1&&be(P,1)):(P=aS(D),P.c(),be(P,1),P.m(e,null)):P&&(Nn(),Te(P,1,1,()=>{P=null}),On())},i(D){w||(be(c.$$.fragment,D),be(P),w=!0)},o(D){Te(c.$$.fragment,D),Te(P),w=!1},d(D){D&&De(e),at(c),P&&P.d()}}}function lS(t){let e,n;return e=new nu({props:{data:t[0],generateId:!0,$$slots:{default:[T5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.data=r[0]),i&66&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function I5(t){let e,n;return e=new vv({props:{properties:t[5]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function C5(t){let e,n;return e=new Wf({props:{openOn:"hover",$$slots:{default:[I5,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function T5(t){let e,n,r,i,a,c;return e=new Xc({props:{id:"network",paint:{"line-width":Oy(5,7),"line-color":"black"},filter:ax(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[C5]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new CC({}),a=new w5({}),{c(){lt(e.$$.fragment),n=ft(),lt(r.$$.fragment),i=ft(),lt(a.$$.fragment)},m(u,g){st(e,u,g),Re(u,n,g),st(r,u,g),Re(u,i,g),st(a,u,g),c=!0},p(u,g){const w={};g&2&&(w.filter=ax(u[1])),g&64&&(w.$$scope={dirty:g,ctx:u}),e.$set(w)},i(u){c||(be(e.$$.fragment,u),be(r.$$.fragment,u),be(a.$$.fragment,u),c=!0)},o(u){Te(e.$$.fragment,u),Te(r.$$.fragment,u),Te(a.$$.fragment,u),c=!1},d(u){u&&(De(n),De(i)),at(e,u),at(r,u),at(a,u)}}}function L5(t){let e,n,r=t[0]&&lS(t);return{c(){e=Oe("div"),r&&r.c(),Ue(e,"slot","map")},m(i,a){Re(i,e,a),r&&r.m(e,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=lS(i),r.c(),be(r,1),r.m(e,null)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d()}}}function P5(t){let e,n;return e=new Zf({props:{$$slots:{map:[L5],sidebar:[E5],top:[S5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function M5(t,e,n){let r,i;zt(t,ku,g=>n(4,r=g)),zt(t,cf,g=>n(1,i=g));let a=null;ru(async()=>{n(0,a=await r.renderDebug())});const c=g=>window.open(Hl(g.detail.features[0].properties).way,"_blank");function u(g){i=g,cf.set(i)}return[a,i,c,u]}class A5 extends en{constructor(e){super(),$t(this,e,M5,P5,jt,{})}}const Od=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"];function k5(t){let e,n,r;return n=new Fy({}),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Re(i,e,a),st(n,e,null),r=!0},p:gt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&De(e),at(n)}}}function uS(t){let e,n;return{c(){e=Oe("p"),n=kt(t[7])},m(r,i){Re(r,e,i),ke(e,n)},p(r,i){i&128&&Qn(n,r[7])},d(r){r&&De(e)}}}function cS(t){let e,n;return e=new TC({props:{gj:t[5]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function D5(t){let e,n,r,i,a,c,u,g,w,S,I,P,D,N,q,J,re,U,j,Z,te,_e,pe;function he(ce){t[12](ce)}let me={};t[4]!==void 0&&(me.travelMode=t[4]),c=new p1({props:me}),Kn.push(()=>Po(c,"travelMode",he)),U=new QS({props:{colorScale:Od,limits:t[8]}});let Ce=t[7]&&uS(t),H=t[5]&&cS(t);return{c(){e=Oe("div"),n=Oe("h2"),n.textContent="Isochrone mode",r=ft(),i=Oe("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time - in seconds.`,a=ft(),lt(c.$$.fragment),g=ft(),w=Oe("label"),S=kt(`Start time (PT only) - `),I=Oe("input"),D=ft(),N=Oe("label"),q=Oe("input"),J=kt("Contours"),re=ft(),lt(U.$$.fragment),j=ft(),Ce&&Ce.c(),Z=ft(),H&&H.c(),Ue(I,"type","time"),I.disabled=P=t[4]!="transit",Ue(q,"type","checkbox"),Ue(e,"slot","sidebar")},m(ce,Ke){Re(ce,e,Ke),ke(e,n),ke(e,r),ke(e,i),ke(e,a),st(c,e,null),ke(e,g),ke(e,w),ke(w,S),ke(w,I),Go(I,t[3]),ke(e,D),ke(e,N),ke(N,q),q.checked=t[1],ke(N,J),ke(e,re),st(U,e,null),ke(e,j),Ce&&Ce.m(e,null),ke(e,Z),H&&H.m(e,null),te=!0,_e||(pe=[Zt(I,"input",t[13]),Zt(q,"change",t[14])],_e=!0)},p(ce,Ke){const Se={};!u&&Ke&16&&(u=!0,Se.travelMode=ce[4],Lo(()=>u=!1)),c.$set(Se),(!te||Ke&16&&P!==(P=ce[4]!="transit"))&&(I.disabled=P),Ke&8&&Go(I,ce[3]),Ke&2&&(q.checked=ce[1]),ce[7]?Ce?Ce.p(ce,Ke):(Ce=uS(ce),Ce.c(),Ce.m(e,Z)):Ce&&(Ce.d(1),Ce=null),ce[5]?H?(H.p(ce,Ke),Ke&32&&be(H,1)):(H=cS(ce),H.c(),be(H,1),H.m(e,null)):H&&(Nn(),Te(H,1,1,()=>{H=null}),On())},i(ce){te||(be(c.$$.fragment,ce),be(U.$$.fragment,ce),be(H),te=!0)},o(ce){Te(c.$$.fragment,ce),Te(U.$$.fragment,ce),Te(H),te=!1},d(ce){ce&&De(e),at(c),at(U),Ce&&Ce.d(),H&&H.d(),_e=!1,Ni(pe)}}}function hS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[R5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Nd({props:a}),Kn.push(()=>Po(e,"lngLat",i)),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,u){const g={};u&524288&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.lngLat=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function R5(t){let e;return{c(){e=Oe("span"),e.textContent="X",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function fS(t){let e,n;return e=new nu({props:{data:t[5],$$slots:{default:[z5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&524292&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function N5(t){let e=(t[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=kt(e),r=kt(" minutes away")},m(i,a){Re(i,n,a),Re(i,r,a)},p(i,a){a&262144&&e!==(e=(i[18].cost_seconds/60).toFixed(1)+"")&&Qn(n,e)},d(i){i&&(De(n),De(r))}}}function O5(t){let e,n;return e=new Wf({props:{openOn:"hover",$$slots:{default:[N5,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&786432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function z5(t){let e,n,r,i,a,c,u;e=new Xc({props:{id:"isochrone",filter:oO,paint:{"line-width":20,"line-color":hv(["get","cost_seconds"],t[9],Od),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[O5]},$$scope:{ctx:t}}}),r=new IC({props:{id:"isochrone-contours",filter:iO,paint:{"fill-color":hv(["get","min_seconds"],t[9],Od),"fill-opacity":.5}}});function g(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new CC({props:w}),Kn.push(()=>Po(a,"hovered",g)),{c(){lt(e.$$.fragment),n=ft(),lt(r.$$.fragment),i=ft(),lt(a.$$.fragment)},m(S,I){st(e,S,I),Re(S,n,I),st(r,S,I),Re(S,i,I),st(a,S,I),u=!0},p(S,I){const P={};I&524288&&(P.$$scope={dirty:I,ctx:S}),e.$set(P);const D={};!c&&I&4&&(c=!0,D.hovered=S[2],Lo(()=>c=!1)),a.$set(D)},i(S){u||(be(e.$$.fragment,S),be(r.$$.fragment,S),be(a.$$.fragment,S),u=!0)},o(S){Te(e.$$.fragment,S),Te(r.$$.fragment,S),Te(a.$$.fragment,S),u=!1},d(S){S&&(De(n),De(i)),at(e,S),at(r,S),at(a,S)}}}function pS(t){let e,n;return e=new nu({props:{data:t[6],$$slots:{default:[F5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&524288&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function F5(t){let e,n;return e=new Xc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function B5(t){let e,n,r,i,a=t[0]&&hS(t),c=t[5]&&fS(t),u=t[6]&&pS(t);return{c(){e=Oe("div"),a&&a.c(),n=ft(),c&&c.c(),r=ft(),u&&u.c(),Ue(e,"slot","map")},m(g,w){Re(g,e,w),a&&a.m(e,null),ke(e,n),c&&c.m(e,null),ke(e,r),u&&u.m(e,null),i=!0},p(g,w){g[0]?a?(a.p(g,w),w&1&&be(a,1)):(a=hS(g),a.c(),be(a,1),a.m(e,n)):a&&(Nn(),Te(a,1,1,()=>{a=null}),On()),g[5]?c?(c.p(g,w),w&32&&be(c,1)):(c=fS(g),c.c(),be(c,1),c.m(e,r)):c&&(Nn(),Te(c,1,1,()=>{c=null}),On()),g[6]?u?(u.p(g,w),w&64&&be(u,1)):(u=pS(g),u.c(),be(u,1),u.m(e,null)):u&&(Nn(),Te(u,1,1,()=>{u=null}),On())},i(g){i||(be(a),be(c),be(u),i=!0)},o(g){Te(a),Te(c),Te(u),i=!1},d(g){g&&De(e),a&&a.d(),c&&c.d(),u&&u.d()}}}function V5(t){let e,n;return e=new Zf({props:{$$slots:{map:[B5],sidebar:[D5],top:[k5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&524543&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function dS(t,e,n){return e+t*(n-e)}function U5(t,e,n){let r,i,a;zt(t,zg,te=>n(3,r=te)),zt(t,cf,te=>n(4,i=te)),zt(t,ku,te=>n(15,a=te));let c=null;ru(async()=>{let te=await a.getBounds();n(0,c={lng:dS(.5,te[0],te[2]),lat:dS(.5,te[1],te[3])})});let u=!0,g=null,w=null,S="",I;async function P(te,_e,pe,he){if(c)try{n(5,g=await a.isochrone({start:c,mode:i,contours:u,startTime:r})),n(7,S="")}catch(me){n(5,g=null),me=me.toString()}}async function D(te,_e,pe){if(c&&I)try{n(6,w=await a.route({start:c,end:I.geometry.coordinates,mode:i,debugSearch:!1,useHeuristic:!1,startTime:r})),n(7,S="")}catch(he){n(6,w=null),he=he.toString()}else n(6,w=null)}let N=[0,3,6,9,12,15],q=N.map(te=>te*60);function J(te){c=te,n(0,c)}function re(te){I=te,n(2,I)}function U(te){i=te,cf.set(i)}function j(){r=this.value,zg.set(r)}function Z(){u=this.checked,n(1,u)}return t.$$.update=()=>{t.$$.dirty&27&&P(),t.$$.dirty&13&&D()},[c,u,I,r,i,g,w,S,N,q,J,re,U,j,Z]}class G5 extends en{constructor(e){super(),$t(this,e,U5,V5,jt,{})}}function mS(t,e,n){const r=t.slice();r[18]=e[n];const i=Hl(r[18].properties);return r[17]=i,r}function q5(t){let e,n,r;return n=new Fy({}),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Re(i,e,a),st(n,e,null),r=!0},p:gt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&De(e),at(n)}}}function j5(t){let e,n,r,i,a,c=ei(t[5].features),u=[];for(let g=0;gPo(i,"travelMode",_e));function he(H,ce){if(H[6])return W5;if(H[5])return j5}let me=he(t),Ce=me&&me(t);return{c(){e=Oe("div"),n=Oe("h2"),n.textContent="Route mode",r=ft(),lt(i.$$.fragment),c=ft(),u=Oe("label"),g=Oe("input"),S=kt(` - Use heuristic (PT only)`),I=ft(),P=Oe("label"),D=kt(`Start time (PT only) - `),N=Oe("input"),J=ft(),re=Oe("p"),re.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to - set the first pin somewhere.)`,U=ft(),Ce&&Ce.c(),Ue(g,"type","checkbox"),g.disabled=w=t[4]!="transit",Ue(N,"type","time"),N.disabled=q=t[4]!="transit",Ue(e,"slot","sidebar")},m(H,ce){Re(H,e,ce),ke(e,n),ke(e,r),st(i,e,null),ke(e,c),ke(e,u),ke(u,g),g.checked=t[3],ke(u,S),ke(e,I),ke(e,P),ke(P,D),ke(P,N),Go(N,t[2]),ke(e,J),ke(e,re),ke(e,U),Ce&&Ce.m(e,null),j=!0,Z||(te=[Zt(g,"change",t[12]),Zt(N,"input",t[13])],Z=!0)},p(H,ce){const Ke={};!a&&ce&16&&(a=!0,Ke.travelMode=H[4],Lo(()=>a=!1)),i.$set(Ke),(!j||ce&16&&w!==(w=H[4]!="transit"))&&(g.disabled=w),ce&8&&(g.checked=H[3]),(!j||ce&16&&q!==(q=H[4]!="transit"))&&(N.disabled=q),ce&4&&Go(N,H[2]),me===(me=he(H))&&Ce?Ce.p(H,ce):(Ce&&Ce.d(1),Ce=me&&me(H),Ce&&(Ce.c(),Ce.m(e,null)))},i(H){j||(be(i.$$.fragment,H),j=!0)},o(H){Te(i.$$.fragment,H),j=!1},d(H){H&&De(e),at(i),Ce&&Ce.d(),Z=!1,Ni(te)}}}function yS(t){let e,n,r;function i(c){t[9](c)}let a={draggable:!0,$$slots:{default:[J5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Nd({props:a}),Kn.push(()=>Po(e,"lngLat",i)),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,u){const g={};u&2097152&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.lngLat=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function J5(t){let e;return{c(){e=Oe("span"),e.textContent="A",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function _S(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[Q5]},$$scope:{ctx:t}};return t[1]!==void 0&&(a.lngLat=t[1]),e=new Nd({props:a}),Kn.push(()=>Po(e,"lngLat",i)),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,u){const g={};u&2097152&&(g.$$scope={dirty:u,ctx:c}),!n&&u&2&&(n=!0,g.lngLat=c[1],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function Q5(t){let e;return{c(){e=Oe("span"),e.textContent="B",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function vS(t){let e,n;return e=new nu({props:{data:t[5],generateId:!0,$$slots:{default:[tz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function $5(t){let e,n;return e=new vv({props:{properties:t[17]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&131072&&(a.properties=r[17]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function ez(t){let e,n;return e=new Wf({props:{openOn:"hover",$$slots:{default:[$5,({props:r})=>({17:r}),({props:r})=>r?131072:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&2228224&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function tz(t){let e,n;return e=new Xc({props:{id:"route",paint:{"line-width":20,"line-color":u1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Oy(.5,1)},manageHoverState:!0,$$slots:{default:[ez]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function nz(t){let e,n,r,i,a,c;n=new RO({}),n.$on("contextmenu",t[7]);let u=t[0]&&yS(t),g=t[1]&&_S(t),w=t[5]&&vS(t);return{c(){e=Oe("div"),lt(n.$$.fragment),r=ft(),u&&u.c(),i=ft(),g&&g.c(),a=ft(),w&&w.c(),Ue(e,"slot","map")},m(S,I){Re(S,e,I),st(n,e,null),ke(e,r),u&&u.m(e,null),ke(e,i),g&&g.m(e,null),ke(e,a),w&&w.m(e,null),c=!0},p(S,I){S[0]?u?(u.p(S,I),I&1&&be(u,1)):(u=yS(S),u.c(),be(u,1),u.m(e,i)):u&&(Nn(),Te(u,1,1,()=>{u=null}),On()),S[1]?g?(g.p(S,I),I&2&&be(g,1)):(g=_S(S),g.c(),be(g,1),g.m(e,a)):g&&(Nn(),Te(g,1,1,()=>{g=null}),On()),S[5]?w?(w.p(S,I),I&32&&be(w,1)):(w=vS(S),w.c(),be(w,1),w.m(e,null)):w&&(Nn(),Te(w,1,1,()=>{w=null}),On())},i(S){c||(be(n.$$.fragment,S),be(u),be(g),be(w),c=!0)},o(S){Te(n.$$.fragment,S),Te(u),Te(g),Te(w),c=!1},d(S){S&&De(e),at(n),u&&u.d(),g&&g.d(),w&&w.d()}}}function rz(t){let e,n;return e=new Zf({props:{$$slots:{map:[nz],sidebar:[K5],top:[q5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&2097279&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function gg(t,e,n){return e+t*(n-e)}function iz(t,e,n){let r,i,a,c,u;zt(t,Ys,Z=>n(14,r=Z)),zt(t,zg,Z=>n(2,i=Z)),zt(t,lx,Z=>n(3,a=Z)),zt(t,cf,Z=>n(4,c=Z)),zt(t,ku,Z=>n(15,u=Z));let g=null,w=null;ru(async()=>{let Z=await u.getBounds();n(0,g={lng:gg(.4,Z[0],Z[2]),lat:gg(.4,Z[1],Z[3])}),n(1,w={lng:gg(.6,Z[0],Z[2]),lat:gg(.6,Z[1],Z[3])})});let S=null,I="";async function P(Z,te,_e,pe,he){if(g&&w)try{n(5,S=await u.route({start:g,end:[w.lng,w.lat],mode:_e,debugSearch:!1,useHeuristic:a,startTime:i})),n(6,I="")}catch(me){n(5,S=null),n(6,I=me.toString())}}function D(Z){n(0,g=Z.detail.lngLat)}async function N(){try{let Z=await u.route({start:g,end:[w.lng,w.lat],mode:c,debugSearch:!0,useHeuristic:a,startTime:i});ur(Ys,r={kind:"debug-route",debugGj:Z,start:g,end:w,routeGj:S},r)}catch(Z){n(6,I=Z.toString())}}function q(Z){g=Z,n(0,g)}function J(Z){w=Z,n(1,w)}function re(Z){c=Z,cf.set(c)}function U(){a=this.checked,lx.set(a)}function j(){i=this.value,zg.set(i)}return t.$$.update=()=>{t.$$.dirty&31&&P(g,w,c)},[g,w,i,a,c,S,I,D,N,q,J,re,U,j]}class oz extends en{constructor(e){super(),$t(this,e,iz,rz,jt,{})}}function sz(t){let e,n,r,i;return{c(){e=Oe("div"),n=Oe("button"),n.textContent="Back",Ue(e,"slot","top")},m(a,c){Re(a,e,c),ke(e,n),r||(i=Zt(n,"click",t[10]),r=!0)},p:gt,d(a){a&&De(e),r=!1,i()}}}function az(t){let e,n,r,i,a,c,u,g,w,S=Hl(t[4].features[t[4].features.length-1].properties).time+"",I,P,D;return{c(){e=Oe("div"),n=Oe("h2"),n.textContent="Debugging a route",r=ft(),i=Oe("p"),i.textContent=`${t[6]} total nodes searched`,a=ft(),c=Oe("input"),u=ft(),g=Oe("p"),w=kt("Search is currently at "),I=kt(S),Ue(c,"type","range"),Ue(c,"min","1"),Ue(c,"max",t[6]),Ue(e,"slot","sidebar")},m(N,q){Re(N,e,q),ke(e,n),ke(e,r),ke(e,i),ke(e,a),ke(e,c),Go(c,t[3]),ke(e,u),ke(e,g),ke(g,w),ke(g,I),P||(D=[Zt(c,"change",t[9]),Zt(c,"input",t[9])],P=!0)},p(N,q){q&8&&Go(c,N[3]),q&16&&S!==(S=Hl(N[4].features[N[4].features.length-1].properties).time+"")&&Qn(I,S)},d(N){N&&De(e),P=!1,Ni(D)}}}function lz(t){let e;return{c(){e=Oe("span"),e.textContent="A",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function uz(t){let e;return{c(){e=Oe("span"),e.textContent="B",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function cz(t){let e,n;return e=new Xc({props:{paint:{"line-width":20,"line-color":u1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function hz(t){let e,n,r,i;return e=new zy({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new Xc({props:{paint:{"line-width":5,"line-color":u1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){lt(e.$$.fragment),n=ft(),lt(r.$$.fragment)},m(a,c){st(e,a,c),Re(a,n,c),st(r,a,c),i=!0},p:gt,i(a){i||(be(e.$$.fragment,a),be(r.$$.fragment,a),i=!0)},o(a){Te(e.$$.fragment,a),Te(r.$$.fragment,a),i=!1},d(a){a&&De(n),at(e,a),at(r,a)}}}function fz(t){let e,n,r,i,a,c,u,g,w;return n=new Nd({props:{lngLat:t[0],$$slots:{default:[lz]},$$scope:{ctx:t}}}),i=new Nd({props:{lngLat:t[1],$$slots:{default:[uz]},$$scope:{ctx:t}}}),c=new nu({props:{data:t[2],$$slots:{default:[cz]},$$scope:{ctx:t}}}),g=new nu({props:{data:t[4],generateId:!0,$$slots:{default:[hz]},$$scope:{ctx:t}}}),{c(){e=Oe("div"),lt(n.$$.fragment),r=ft(),lt(i.$$.fragment),a=ft(),lt(c.$$.fragment),u=ft(),lt(g.$$.fragment),Ue(e,"slot","map")},m(S,I){Re(S,e,I),st(n,e,null),ke(e,r),st(i,e,null),ke(e,a),st(c,e,null),ke(e,u),st(g,e,null),w=!0},p(S,I){const P={};I&1&&(P.lngLat=S[0]),I&4096&&(P.$$scope={dirty:I,ctx:S}),n.$set(P);const D={};I&2&&(D.lngLat=S[1]),I&4096&&(D.$$scope={dirty:I,ctx:S}),i.$set(D);const N={};I&4&&(N.data=S[2]),I&4096&&(N.$$scope={dirty:I,ctx:S}),c.$set(N);const q={};I&16&&(q.data=S[4]),I&4096&&(q.$$scope={dirty:I,ctx:S}),g.$set(q)},i(S){w||(be(n.$$.fragment,S),be(i.$$.fragment,S),be(c.$$.fragment,S),be(g.$$.fragment,S),w=!0)},o(S){Te(n.$$.fragment,S),Te(i.$$.fragment,S),Te(c.$$.fragment,S),Te(g.$$.fragment,S),w=!1},d(S){S&&De(e),at(n),at(i),at(c),at(g)}}}function pz(t){let e,n,r,i;return e=new Zf({props:{$$slots:{map:[fz],sidebar:[az],top:[sz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(a,c){st(e,a,c),n=!0,r||(i=Zt(window,"keydown",t[7]),r=!0)},p(a,[c]){const u={};c&4159&&(u.$$scope={dirty:c,ctx:a}),e.$set(u)},i(a){n||(be(e.$$.fragment,a),n=!0)},o(a){Te(e.$$.fragment,a),n=!1},d(a){at(e,a),r=!1,i()}}}function dz(t,e,n){let r,i,a;zt(t,my,q=>n(11,i=q)),zt(t,Ys,q=>n(5,a=q));let{debugGj:c}=e,{start:u}=e,{end:g}=e,{routeGj:w}=e,S=c.features.length/2,I=1;function P(q){q.key=="ArrowLeft"&&I>1&&(q.stopPropagation(),n(3,I--,I)),q.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),as(()=>{i==null||i.keyboard.enable()});function D(){I=GL(this.value),n(3,I)}const N=()=>ur(Ys,a={kind:"route"},a);return t.$$set=q=>{"debugGj"in q&&n(8,c=q.debugGj),"start"in q&&n(0,u=q.start),"end"in q&&n(1,g=q.end),"routeGj"in q&&n(2,w=q.routeGj)},t.$$.update=()=>{t.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:c.features.slice(0,2*I)})},[u,g,w,I,r,a,S,P,c,D,N]}class mz extends en{constructor(e){super(),$t(this,e,dz,pz,jt,{debugGj:8,start:0,end:1,routeGj:2})}}function gz(t){let e,n,r;return n=new Fy({}),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Re(i,e,a),st(n,e,null),r=!0},p:gt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&De(e),at(n)}}}function yz(t){let e,n,r,i,a,c,u;return c=new QS({props:{colorScale:Od,limits:t[3]}}),{c(){e=Oe("div"),n=Oe("h2"),n.textContent="Score mode",r=ft(),i=Oe("p"),i.textContent=`This is an early experiment of a mode to show an "access score". Right - now, it's starting from every POI of a few fixed types (cafe, pub, - restaurant, bank, nightclub) and walking up to one minute to the nearest - bicycle parking. This is a simple way of showing POIs without any nearby - parking. Note the granularity of results is poor; the search begins and - ends at the nearest intersection, and the time to walk doesn't take into - account the side of the road or walking partly down some road.`,a=ft(),lt(c.$$.fragment),Ue(e,"slot","sidebar")},m(g,w){Re(g,e,w),ke(e,n),ke(e,r),ke(e,i),ke(e,a),st(c,e,null),u=!0},p:gt,i(g){u||(be(c.$$.fragment,g),u=!0)},o(g){Te(c.$$.fragment,g),u=!1},d(g){g&&De(e),at(c)}}}function bS(t){let e,n;return e=new nu({props:{data:t[1],$$slots:{default:[bz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&2&&(a.data=r[1]),i&257&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function _z(t){let e,n=t[7].poi+"",r,i,a=t[7].cost+"",c,u;return{c(){e=kt("From "),r=kt(n),i=kt(", it's "),c=kt(a),u=kt(" seconds to the nearest parking")},m(g,w){Re(g,e,w),Re(g,r,w),Re(g,i,w),Re(g,c,w),Re(g,u,w)},p(g,w){w&128&&n!==(n=g[7].poi+"")&&Qn(r,n),w&128&&a!==(a=g[7].cost+"")&&Qn(c,a)},d(g){g&&(De(e),De(r),De(i),De(c),De(u))}}}function vz(t){let e,n;return e=new Wf({props:{openOn:"hover",$$slots:{default:[_z,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&384&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function bz(t){let e,n,r;function i(c){t[4](c)}let a={paint:{"circle-radius":15,"circle-color":hv(["get","cost"],t[3],Od)},manageHoverState:!0,eventsIfTopMost:!0,$$slots:{default:[vz]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new zy({props:a}),Kn.push(()=>Po(e,"hovered",i)),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,u){const g={};u&256&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function xS(t){let e,n;return e=new nu({props:{data:t[2],$$slots:{default:[xz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&4&&(a.data=r[2]),i&256&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function xz(t){let e,n;return e=new Xc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function wz(t){let e,n,r,i=t[1]&&bS(t),a=t[2]&&xS(t);return{c(){e=Oe("div"),i&&i.c(),n=ft(),a&&a.c(),Ue(e,"slot","map")},m(c,u){Re(c,e,u),i&&i.m(e,null),ke(e,n),a&&a.m(e,null),r=!0},p(c,u){c[1]?i?(i.p(c,u),u&2&&be(i,1)):(i=bS(c),i.c(),be(i,1),i.m(e,n)):i&&(Nn(),Te(i,1,1,()=>{i=null}),On()),c[2]?a?(a.p(c,u),u&4&&be(a,1)):(a=xS(c),a.c(),be(a,1),a.m(e,null)):a&&(Nn(),Te(a,1,1,()=>{a=null}),On())},i(c){r||(be(i),be(a),r=!0)},o(c){Te(i),Te(a),r=!1},d(c){c&&De(e),i&&i.d(),a&&a.d()}}}function Sz(t){let e,n;return e=new Zf({props:{$$slots:{map:[wz],sidebar:[yz],top:[gz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&263&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function Ez(t,e,n){let r;zt(t,ku,S=>n(5,r=S));let i=null;ru(async()=>{n(1,i=await r.score())});let a=null,c=Array.from(Array(6).keys()).map(S=>60*10/(6-1)*S),u;async function g(S){if(u)try{n(2,a=await r.route({start:{lng:u.geometry.coordinates[0],lat:u.geometry.coordinates[1]},end:[u.properties.closest_lon,u.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(I){console.log(`No route: ${I}`),n(2,a=null)}else n(2,a=null)}function w(S){u=S,n(0,u)}return t.$$.update=()=>{t.$$.dirty&1&&g()},[u,i,a,c,w]}class Iz extends en{constructor(e){super(),$t(this,e,Ez,Sz,jt,{})}}var bo=63710088e-1,d1={centimeters:bo*100,centimetres:bo*100,degrees:bo/111325,feet:bo*3.28084,inches:bo*39.37,kilometers:bo/1e3,kilometres:bo/1e3,meters:bo,metres:bo,miles:bo/1609.344,millimeters:bo*1e3,millimetres:bo*1e3,nauticalmiles:bo/1852,radians:1,yards:bo*1.0936},Cz={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/bo,yards:1.0936133},mv={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 ha(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function Tz(t,e,n){switch(t){case"Point":return rs(e).geometry;case"LineString":return Js(e).geometry;case"Polygon":return m1(e).geometry;case"MultiPoint":return PC(e).geometry;case"MultiLineString":return LC(e).geometry;case"MultiPolygon":return MC(e).geometry;default:throw new Error(t+" is invalid")}}function rs(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!fy(t[0])||!fy(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ha(r,e,n)}function Lz(t,e,n){return n===void 0&&(n={}),Vc(t.map(function(r){return rs(r,e)}),n)}function m1(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function g1(t,e){e===void 0&&(e="kilometers");var n=d1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function By(t,e){e===void 0&&(e="kilometers");var n=d1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function Dz(t,e){return zd(By(t,e))}function Rz(t){var e=t%360;return e<0&&(e+=360),e}function zd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function Qs(t){var e=t%360;return e*Math.PI/180}function Nz(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return g1(By(t,e),n)}function Oz(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=mv[e];if(!r)throw new Error("invalid original units");var i=mv[n];if(!i)throw new Error("invalid final units");return t/r*i}function fy(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function y1(t){return!!t&&t.constructor===Object}function zz(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!fy(e))throw new Error("bbox must only contain numbers")})}function Fz(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const Bz=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:mv,bearingToAzimuth:Rz,convertArea:Oz,convertLength:Nz,degreesToRadians:Qs,earthRadius:bo,factors:d1,feature:ha,featureCollection:Vc,geometry:Tz,geometryCollection:Az,isNumber:fy,isObject:y1,lengthToDegrees:Dz,lengthToRadians:By,lineString:Js,lineStrings:Mz,multiLineString:LC,multiPoint:PC,multiPolygon:MC,point:rs,points:Lz,polygon:m1,polygons:Pz,radiansToDegrees:zd,radiansToLength:g1,round:kz,unitsFactors:Cz,validateBBox:zz,validateId:Fz},Symbol.toStringTag,{value:"Module"}));function Fd(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Nf(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function AC(t,e,n){if(n===void 0&&(n={}),n.final===!0)return Vz(t,e);var r=Fd(t),i=Fd(e),a=Qs(r[0]),c=Qs(i[0]),u=Qs(r[1]),g=Qs(i[1]),w=Math.sin(c-a)*Math.cos(g),S=Math.cos(u)*Math.sin(g)-Math.sin(u)*Math.cos(g)*Math.cos(c-a);return zd(Math.atan2(w,S))}function Vz(t,e){var n=AC(e,t);return n=(n+180)%360,n}function td(t,e,n){n===void 0&&(n={});var r=Fd(t),i=Fd(e),a=Qs(i[1]-r[1]),c=Qs(i[0]-r[0]),u=Qs(r[1]),g=Qs(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(u)*Math.cos(g);return g1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function wS(t,e,n,r){r===void 0&&(r={});var i=Fd(t),a=Qs(i[0]),c=Qs(i[1]),u=Qs(n),g=By(e,r.units),w=Math.asin(Math.sin(c)*Math.cos(g)+Math.cos(c)*Math.sin(g)*Math.cos(u)),S=a+Math.atan2(Math.sin(u)*Math.sin(g)*Math.cos(c),Math.cos(g)-Math.sin(c)*Math.sin(w)),I=zd(S),P=zd(w);return rs([I,P],r.properties)}function Kd(t,e,n){if(t!==null)for(var r,i,a,c,u,g,w,S=0,I=0,P,D=t.type,N=D==="FeatureCollection",q=D==="Feature",J=N?t.features.length:1,re=0;reg||N>w||q>S){u=I,g=r,w=N,S=q,a=0;return}var J=Js([u,I],n.properties);if(e(J,r,i,q,a)===!1)return!1;a++,u=I})===!1)return!1}}})}function Zz(t,e,n){var r=n,i=!1;return DC(t,function(a,c,u,g,w){i===!1&&n===void 0?r=a:r=e(r,a,c,u,g,w),i=!0}),r}function RC(t,e){if(!t)throw new Error("geojson is required");Xf(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ui?n:i,w=r>a?r:a;return[c,u,g,w]}var v1={exports:{}},NC={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Bd,function(){function n(U,j,Z,te,_e){(function pe(he,me,Ce,H,ce){for(;H>Ce;){if(H-Ce>600){var Ke=H-Ce+1,Se=me-Ce+1,Ze=Math.log(Ke),tt=.5*Math.exp(2*Ze/3),qe=.5*Math.sqrt(Ze*tt*(Ke-tt)/Ke)*(Se-Ke/2<0?-1:1),Nt=Math.max(Ce,Math.floor(me-Se*tt/Ke+qe)),wt=Math.min(H,Math.floor(me+(Ke-Se)*tt/Ke+qe));pe(he,me,Nt,wt,ce)}var un=he[me],Gt=Ce,Pt=H;for(r(he,Ce,me),ce(he[H],un)>0&&r(he,Ce,H);Gt0;)Pt--}ce(he[Ce],un)===0?r(he,Ce,Pt):r(he,++Pt,H),Pt<=me&&(Ce=Pt+1),me<=Pt&&(H=Pt-1)}})(U,j,Z||0,te||U.length-1,_e||i)}function r(U,j,Z){var te=U[j];U[j]=U[Z],U[Z]=te}function i(U,j){return Uj?1:0}var a=function(U){U===void 0&&(U=9),this._maxEntries=Math.max(4,U),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(U,j,Z){if(!Z)return j.indexOf(U);for(var te=0;te=U.minX&&j.maxY>=U.minY}function J(U){return{children:U,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function re(U,j,Z,te,_e){for(var pe=[j,Z];pe.length;)if(!((Z=pe.pop())-(j=pe.pop())<=te)){var he=j+Math.ceil((Z-j)/te/2)*te;n(U,he,j,Z,_e),pe.push(j,he,he,Z)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(U){var j=this.data,Z=[];if(!q(U,j))return Z;for(var te=this.toBBox,_e=[];j;){for(var pe=0;pe=0&&_e[j].children.length>this._maxEntries;)this._split(_e,j),j--;this._adjustParentBBoxes(te,_e,j)},a.prototype._split=function(U,j){var Z=U[j],te=Z.children.length,_e=this._minEntries;this._chooseSplitAxis(Z,_e,te);var pe=this._chooseSplitIndex(Z,_e,te),he=J(Z.children.splice(pe,Z.children.length-pe));he.height=Z.height,he.leaf=Z.leaf,u(Z,this.toBBox),u(he,this.toBBox),j?U[j-1].children.push(he):this._splitRoot(Z,he)},a.prototype._splitRoot=function(U,j){this.data=J([U,j]),this.data.height=U.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(U,j,Z){for(var te,_e,pe,he,me,Ce,H,ce=1/0,Ke=1/0,Se=j;Se<=Z-j;Se++){var Ze=g(U,0,Se,this.toBBox),tt=g(U,Se,Z,this.toBBox),qe=(_e=Ze,pe=tt,he=void 0,me=void 0,Ce=void 0,H=void 0,he=Math.max(_e.minX,pe.minX),me=Math.max(_e.minY,pe.minY),Ce=Math.min(_e.maxX,pe.maxX),H=Math.min(_e.maxY,pe.maxY),Math.max(0,Ce-he)*Math.max(0,H-me)),Nt=P(Ze)+P(tt);qe=j;ce--){var Ke=U.children[ce];w(he,U.leaf?_e(Ke):Ke),me+=D(he)}return me},a.prototype._adjustParentBBoxes=function(U,j,Z){for(var te=Z;te>=0;te--)w(j[te],U)},a.prototype._condense=function(U){for(var j=U.length-1,Z=void 0;j>=0;j--)U[j].children.length===0?j>0?(Z=U[j-1].children).splice(Z.indexOf(U[j]),1):this.clear():u(U[j],this.toBBox)},a})})(NC);var tF=NC.exports;const nF=gy(Bz),rF=gy(Jz),iF=gy(K4);var Qa=tF,OC=nF,zC=rF,Qh=iF.default,oF=zC.featureEach;zC.coordEach;OC.polygon;var ES=OC.featureCollection;function FC(t){var e=new Qa(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Qh(n),Qa.prototype.insert.call(this,n)},e.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Qh(i),r.push(i)}):oF(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Qh(i),r.push(i)}),Qa.prototype.load.call(this,r)},e.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Qh(n),Qa.prototype.remove.call(this,n,r)},e.clear=function(){return Qa.prototype.clear.call(this)},e.search=function(n){var r=Qa.prototype.search.call(this,this.toBBox(n));return ES(r)},e.collides=function(n){return Qa.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=Qa.prototype.all.call(this);return ES(n)},e.toJSON=function(){return Qa.prototype.toJSON.call(this)},e.fromJSON=function(n){return Qa.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=Qh(n);else if(n.type==="FeatureCollection")r=Qh(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}v1.exports=FC;v1.exports.default=FC;var sF=v1.exports;const aF=xv(sF);function lF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=ha(t)),e.type==="LineString"&&(e=ha(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=IS(t,e);return i&&r.push(i),Vc(r)}var a=aF();return a.load(SS(e)),py(SS(t),function(c){py(a.search(c),function(u){var g=IS(c,u);if(g){var w=Nf(g).join(",");n[w]||(n[w]=!0,r.push(g))}})}),Vc(r)}function IS(t,e){var n=Nf(t),r=Nf(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],c=n[1][0],u=n[1][1],g=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],P=(I-w)*(c-i)-(S-g)*(u-a),D=(S-g)*(a-w)-(I-w)*(i-g),N=(c-i)*(a-w)-(u-a)*(i-g);if(P===0)return null;var q=D/P,J=N/P;if(q>=0&&q<=1&&J>=0&&J<=1){var re=i+q*(c-i),U=a+q*(u-a);return rs([re,U])}return null}function uF(t,e,n){n===void 0&&(n={});var r=rs([1/0,1/0],{dist:1/0}),i=0;return Xf(t,function(a){for(var c=Nf(a),u=0;u0&&(J=q.features[0],J.properties.dist=td(e,J,n),J.properties.location=i+td(g,J,n)),g.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,r=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});mi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(CS(this.points).forEach((r,i)=>{n.push([i+1,uF(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});mi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=x0(e.lngLat.toArray()),this.onClick(e),this.finish())});mi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});mi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});mi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});mi(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e={type:"FeatureCollection",features:[]};this.points.forEach((i,a)=>{let c=x0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat(CS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),VC.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,UC.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.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=x0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(BC),n=[JSON.parse(JSON.stringify(e))];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>pF&&this.previousStates.shift()}}function CS(t){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[t[t.length-1],t[0]]},properties:{}}),e}function mF(t){let e,n,r;return{c(){e=kt("Undo ("),n=kt(t[1]),r=kt(")")},m(i,a){Re(i,e,a),Re(i,n,a),Re(i,r,a)},p(i,a){a&2&&Qn(n,i[1])},d(i){i&&(De(e),De(n),De(r))}}}function gF(t){let e;return{c(){e=kt("Undo")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function yF(t){let e,n,r,i,a,c,u,g,w,S,I;function P(q,J){return q[1]==0?gF:mF}let D=P(t),N=D(t);return{c(){e=Oe("div"),n=Oe("button"),n.textContent="Finish",r=ft(),i=Oe("button"),i.textContent="Cancel",a=ft(),c=Oe("button"),N.c(),g=ft(),w=Oe("ul"),w.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 - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `,c.disabled=u=t[1]==0,Si(e,"display","flex"),Si(e,"justify-content","space-between")},m(q,J){Re(q,e,J),ke(e,n),ke(e,r),ke(e,i),ke(e,a),ke(e,c),N.m(c,null),Re(q,g,J),Re(q,w,J),S||(I=[Zt(n,"click",t[2]),Zt(i,"click",t[3]),Zt(c,"click",t[4])],S=!0)},p(q,[J]){D===(D=P(q))&&N?N.p(q,J):(N.d(1),N=D(q),N&&(N.c(),N.m(c,null))),J&2&&u!==(u=q[1]==0)&&(c.disabled=u)},i:gt,o:gt,d(q){q&&(De(e),De(g),De(w)),N.d(),S=!1,Ni(I)}}}function _F(t,e,n){let r;zt(t,UC,g=>n(1,r=g));let{polygonTool:i}=e;const a=()=>i.finish(),c=()=>i.cancel(),u=()=>i.undo();return t.$$set=g=>{"polygonTool"in g&&n(0,i=g.polygonTool)},[i,r,a,c,u]}class vF extends en{constructor(e){super(),$t(this,e,_F,yF,jt,{polygonTool:0})}}let bF=Date.now();function Jd(t){return`${t}-${bF++}`}const GC=Symbol.for("svelte-maplibre");function xF(){return yv(GC)}function TS(t){return{subscribe:t.subscribe}}function qC({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=xF(),a=yr(null),c=TS(a),u={...i,[t]:TS(a)};if(e&&(u.popupTarget=c),r){let g=yr(null);u.layerEvent=g,i.layerEvent=g}return n&&(u.cluster=yr()),gv(GC,u),{...i,self:a}}function wF(){return qC({key:"source",setCluster:!0})}function SF(t=!0){return qC({key:"layer",setPopupTarget:t,setMouseEvent:t})}function LS(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],a=n[r];i!==a&&t(r,a,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function EF(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function IF(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function PS(t){let e=t[0],n,r,i=MS(t);return{c(){i.c(),n=oi()},m(a,c){i.m(a,c),Re(a,n,c),r=!0},p(a,c){c[0]&1&&jt(e,e=a[0])?(Nn(),Te(i,1,1,gt),On(),i=MS(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&De(n),i.d(a)}}}function MS(t){let e;const n=t[36].default,r=ti(n,t,t[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[1]&16)&&ri(r,n,i,i[35],e?ni(n,i[35],a,null):ii(i[35]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function CF(t){let e,n,r=t[0]&&PS(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&be(r,1)):(r=PS(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function TF(t,e,n){let r,i,a,c,u,g,w,S,I,P,D,N,{$$slots:q={},$$scope:J}=e,{id:re=Jd("layer")}=e,{source:U=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:Z=void 0}=e,{beforeLayerType:te=void 0}=e,{type:_e}=e,{paint:pe=void 0}=e,{layout:he=void 0}=e,{filter:me=void 0}=e,{applyToClusters:Ce=void 0}=e,{minzoom:H=void 0}=e,{maxzoom:ce=void 0}=e,{manageHoverState:Ke=!1}=e,{hovered:Se=null}=e,{interactive:Ze=!0}=e,{hoverCursor:tt=void 0}=e,{eventsIfTopMost:qe=!1}=e;const Nt=qu(),{map:wt,source:un,self:Gt,minzoom:Pt,maxzoom:hn,eventTopMost:Cn,layerInfo:gn}=SF();zt(t,wt,ge=>n(31,I=ge)),zt(t,un,ge=>n(32,P=ge)),zt(t,Gt,ge=>n(0,S=ge)),zt(t,Pt,ge=>n(34,N=ge)),zt(t,hn,ge=>n(33,D=ge)),as(()=>{S&&I&&(gn.delete(S),I==null||I.removeLayer(S))});let yn;function An(ge){var Ne,Yt;if(!Ze||!S||!I||qe&&Cn(ge)!==S)return;let Le=ge.features??[],It=(Yt=(Ne=Le[0])==null?void 0:Ne.properties)==null?void 0:Yt.cluster_id,kn={event:ge,map:I,clusterId:It,layer:S,source:u,features:Le};Nt(ge.type,kn)}function xr(ge){var Ne,Yt;if(!Ze||!S||!I||qe&&Cn(ge)!==S)return;tt&&(I.getCanvas().style.cursor=tt);let Le=ge.features??[];n(6,Se=Le[0]??null);let It=(Yt=(Ne=Le[0])==null?void 0:Ne.properties)==null?void 0:Yt.cluster_id;Nt("mouseenter",{event:ge,map:I,clusterId:It,layer:S,source:u,features:Le})}function Ar(ge){var Ne,Yt,kr;if(!Ze||!I)return;if(qe&&Cn(ge)!==S){n(6,Se=null),Ke&&yn!==void 0&&(I==null||I.setFeatureState({source:u,sourceLayer:j,id:yn},{hover:!1}),yn=void 0);return}I.getCanvas().style.cursor=tt;let Le=ge.features??[],It=(Yt=(Ne=Le[0])==null?void 0:Ne.properties)==null?void 0:Yt.cluster_id,kn=(kr=Le[0])==null?void 0:kr.id;kn!==yn&&(Ke&&(yn!==void 0&&(I==null||I.setFeatureState({source:u,id:yn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:u,id:kn,sourceLayer:j},{hover:!0})),yn=kn,n(6,Se=Le[0]??null)),Nt("mousemove",{event:ge,map:I,clusterId:It,layer:S,source:u,features:Le})}function wr(ge){if(!(!Ze||!S||!I)){if(tt&&(I.getCanvas().style.cursor=""),n(6,Se=null),Ke&&yn!==void 0){const Le={source:u,id:yn,sourceLayer:j};I==null||I.setFeatureState(Le,{hover:!1}),yn=void 0}Nt("mouseleave",{map:I,layer:S,source:u})}}let fr=!0;function Qe(ge){I&&(I.off("click",ge,An),I.off("dblclick",ge,An),I.off("contextmenu",ge,An),I.off("mouseenter",ge,xr),I.off("mousemove",ge,Ar),I.off("mouseleave",ge,wr))}return as(()=>{I&&S&&Qe(S)}),t.$$set=ge=>{"id"in ge&&n(7,re=ge.id),"source"in ge&&n(8,U=ge.source),"sourceLayer"in ge&&n(9,j=ge.sourceLayer),"beforeId"in ge&&n(10,Z=ge.beforeId),"beforeLayerType"in ge&&n(11,te=ge.beforeLayerType),"type"in ge&&n(12,_e=ge.type),"paint"in ge&&n(13,pe=ge.paint),"layout"in ge&&n(14,he=ge.layout),"filter"in ge&&n(15,me=ge.filter),"applyToClusters"in ge&&n(16,Ce=ge.applyToClusters),"minzoom"in ge&&n(17,H=ge.minzoom),"maxzoom"in ge&&n(18,ce=ge.maxzoom),"manageHoverState"in ge&&n(19,Ke=ge.manageHoverState),"hovered"in ge&&n(6,Se=ge.hovered),"interactive"in ge&&n(20,Ze=ge.interactive),"hoverCursor"in ge&&n(21,tt=ge.hoverCursor),"eventsIfTopMost"in ge&&n(22,qe=ge.eventsIfTopMost),"$$scope"in ge&&n(35,J=ge.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=IF(Ce)),t.$$.dirty[0]&1073774592&&n(24,i=EF("all",r,me)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=H??N),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=ce??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,u=U||P),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==re&&u){S&&(Qe(S),gn.delete(S));let ge=Z;if(!Z&&te){let Le=I.getStyle().layers,It=typeof te=="function"?te:Ne=>Ne.type===te,kn=Le==null?void 0:Le.find(It);kn&&(ge=kn.id)}ur(Gt,S=re,S),I.addLayer(Bc({id:S,type:_e,source:u,"source-layer":j,filter:i,paint:pe,layout:he,minzoom:a,maxzoom:c}),ge),n(23,fr=!0),I.on("click",S,An),I.on("dblclick",S,An),I.on("contextmenu",S,An),I.on("mouseenter",S,xr),I.on("mousemove",S,Ar),I.on("mouseleave",S,wr)}t.$$.dirty[0]&1048577&&S&&gn.set(S,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,g=S?LS((ge,Le)=>I==null?void 0:I.setPaintProperty(S,ge,Le)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?LS((ge,Le)=>I==null?void 0:I.setLayoutProperty(S,ge,Le)):void 0),t.$$.dirty[0]&268443648&&(g==null||g(pe)),t.$$.dirty[0]&134234112&&(w==null||w(he)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(fr?n(23,fr=!1):I==null||I.setFilter(S,i))},[S,wt,un,Gt,Pt,hn,Se,re,U,j,Z,te,_e,pe,he,me,Ce,H,ce,Ke,Ze,tt,qe,fr,i,c,a,w,g,u,r,I,P,D,N,J,q]}class b1 extends en{constructor(e){super(),$t(this,e,TF,CF,jt,{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 LF(t){let e;const n=t[16].default,r=ti(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&ri(r,n,i,i[24],e?ni(n,i[24],a,null):ii(i[24]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function PF(t){let e,n,r;function i(c){t[17](c)}let a={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[LF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new b1({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&2&&(g.id=c[1]),u&4&&(g.source=c[2]),u&8&&(g.sourceLayer=c[3]),u&16&&(g.beforeId=c[4]),u&32&&(g.beforeLayerType=c[5]),u&64&&(g.paint=c[6]),u&128&&(g.layout=c[7]),u&256&&(g.filter=c[8]),u&512&&(g.applyToClusters=c[9]),u&1024&&(g.minzoom=c[10]),u&2048&&(g.maxzoom=c[11]),u&4096&&(g.hoverCursor=c[12]),u&8192&&(g.manageHoverState=c[13]),u&16384&&(g.eventsIfTopMost=c[14]),u&32768&&(g.interactive=c[15]),u&16777216&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function MF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Jd("circle")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:g=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:N=void 0}=e,{maxzoom:q=void 0}=e,{hoverCursor:J=void 0}=e,{manageHoverState:re=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:Z=!0}=e;function te(ce){U=ce,n(0,U)}function _e(ce){En.call(this,t,ce)}function pe(ce){En.call(this,t,ce)}function he(ce){En.call(this,t,ce)}function me(ce){En.call(this,t,ce)}function Ce(ce){En.call(this,t,ce)}function H(ce){En.call(this,t,ce)}return t.$$set=ce=>{"id"in ce&&n(1,a=ce.id),"source"in ce&&n(2,c=ce.source),"sourceLayer"in ce&&n(3,u=ce.sourceLayer),"beforeId"in ce&&n(4,g=ce.beforeId),"beforeLayerType"in ce&&n(5,w=ce.beforeLayerType),"paint"in ce&&n(6,S=ce.paint),"layout"in ce&&n(7,I=ce.layout),"filter"in ce&&n(8,P=ce.filter),"applyToClusters"in ce&&n(9,D=ce.applyToClusters),"minzoom"in ce&&n(10,N=ce.minzoom),"maxzoom"in ce&&n(11,q=ce.maxzoom),"hoverCursor"in ce&&n(12,J=ce.hoverCursor),"manageHoverState"in ce&&n(13,re=ce.manageHoverState),"hovered"in ce&&n(0,U=ce.hovered),"eventsIfTopMost"in ce&&n(14,j=ce.eventsIfTopMost),"interactive"in ce&&n(15,Z=ce.interactive),"$$scope"in ce&&n(24,i=ce.$$scope)},[U,a,c,u,g,w,S,I,P,D,N,q,J,re,j,Z,r,te,_e,pe,he,me,Ce,H,i]}class AF extends en{constructor(e){super(),$t(this,e,MF,PF,jt,{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 kF(t){let e;const n=t[15].default,r=ti(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&ri(r,n,i,i[23],e?ni(n,i[23],a,null):ii(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function DF(t){let e,n,r;function i(c){t[16](c)}let a={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[kF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new b1({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&2&&(g.id=c[1]),u&4&&(g.source=c[2]),u&8&&(g.sourceLayer=c[3]),u&16&&(g.beforeId=c[4]),u&32&&(g.beforeLayerType=c[5]),u&64&&(g.paint=c[6]),u&128&&(g.layout=c[7]),u&256&&(g.filter=c[8]),u&512&&(g.minzoom=c[9]),u&1024&&(g.maxzoom=c[10]),u&2048&&(g.hoverCursor=c[11]),u&4096&&(g.manageHoverState=c[12]),u&8192&&(g.eventsIfTopMost=c[13]),u&16384&&(g.interactive=c[14]),u&8388608&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function RF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Jd("fill")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:g=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:J=!1}=e,{hovered:re=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:j=!0}=e;function Z(H){re=H,n(0,re)}function te(H){En.call(this,t,H)}function _e(H){En.call(this,t,H)}function pe(H){En.call(this,t,H)}function he(H){En.call(this,t,H)}function me(H){En.call(this,t,H)}function Ce(H){En.call(this,t,H)}return t.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,c=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,q=H.hoverCursor),"manageHoverState"in H&&n(12,J=H.manageHoverState),"hovered"in H&&n(0,re=H.hovered),"eventsIfTopMost"in H&&n(13,U=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[re,a,c,u,g,w,S,I,P,D,N,q,J,U,j,r,Z,te,_e,pe,he,me,Ce,i]}class NF extends en{constructor(e){super(),$t(this,e,RF,DF,jt,{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 OF(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const u=()=>{e&&(t.getSource(e)?setTimeout(u,1):c())};u()}else c()}function zF(t,e,n){KS().then(()=>{let r=WS(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function AS(t){let e=t[0],n,r,i=kS(t);return{c(){i.c(),n=oi()},m(a,c){i.m(a,c),Re(a,n,c),r=!0},p(a,c){c&1&&jt(e,e=a[0])?(Nn(),Te(i,1,1,gt),On(),i=kS(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&De(n),i.d(a)}}}function kS(t){let e;const n=t[15].default,r=ti(n,t,t[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16384)&&ri(r,n,i,i[14],e?ni(n,i[14],a,null):ii(i[14]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function FF(t){let e,n,r=t[0]&&AS(t);return{c(){r&&r.c(),e=oi()},m(i,a){r&&r.m(i,a),Re(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=AS(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(Nn(),Te(r,1,1,()=>{r=null}),On())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&De(e),r&&r.d(i)}}}function BF(t,e,n){let r,i,a,{$$slots:c={},$$scope:u}=e,{id:g=Jd("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:P=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:N=void 0}=e;const{map:q,cluster:J,self:re}=wF();zt(t,q,Z=>n(13,i=Z)),zt(t,J,Z=>n(16,a=Z)),zt(t,re,Z=>n(0,r=Z));let U,j=!0;return as(()=>{r&&U&&i&&(zF(q,r,U),ur(re,r=null,r),n(11,U=void 0))}),t.$$set=Z=>{"id"in Z&&n(4,g=Z.id),"data"in Z&&n(5,w=Z.data),"generateId"in Z&&n(6,S=Z.generateId),"promoteId"in Z&&n(7,I=Z.promoteId),"filter"in Z&&n(8,P=Z.filter),"lineMetrics"in Z&&n(9,D=Z.lineMetrics),"cluster"in Z&&n(10,N=Z.cluster),"$$scope"in Z&&n(14,u=Z.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&ur(J,a=N,a),t.$$.dirty&12273&&i&&r!==g&&(ur(re,r=g,r),OF(i,r,Bc({type:"geojson",data:w,filter:P,lineMetrics:D,generateId:S,promoteId:I,cluster:!!N,clusterMinPoints:N==null?void 0:N.minPoints,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius,clusterProperties:N==null?void 0:N.properties}),Z=>i&&Z===r,()=>{r&&(n(11,U=i==null?void 0:i.getSource(r)),n(12,j=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,U=i==null?void 0:i.getSource(g))})),t.$$.dirty&6176&&U&&(j?n(12,j=!1):U.setData(w)),t.$$.dirty&3072&&(U==null||U.setClusterOptions(Bc({cluster:!!N,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius})))},[r,q,J,re,g,w,S,I,P,D,N,U,j,i,u,c]}class VF extends en{constructor(e){super(),$t(this,e,BF,FF,jt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function UF(t){let e;const n=t[15].default,r=ti(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&ri(r,n,i,i[23],e?ni(n,i[23],a,null):ii(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function GF(t){let e,n,r;function i(c){t[16](c)}let a={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[UF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new b1({props:a}),Kn.push(()=>Po(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const g={};u&2&&(g.id=c[1]),u&4&&(g.source=c[2]),u&8&&(g.sourceLayer=c[3]),u&16&&(g.beforeId=c[4]),u&32&&(g.beforeLayerType=c[5]),u&64&&(g.paint=c[6]),u&128&&(g.layout=c[7]),u&256&&(g.filter=c[8]),u&512&&(g.minzoom=c[9]),u&1024&&(g.maxzoom=c[10]),u&2048&&(g.hoverCursor=c[11]),u&4096&&(g.manageHoverState=c[12]),u&8192&&(g.eventsIfTopMost=c[13]),u&16384&&(g.interactive=c[14]),u&8388608&&(g.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,g.hovered=c[0],Lo(()=>n=!1)),e.$set(g)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function qF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Jd("line")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:g=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:J=!1}=e,{hovered:re=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:j=!0}=e;function Z(H){re=H,n(0,re)}function te(H){En.call(this,t,H)}function _e(H){En.call(this,t,H)}function pe(H){En.call(this,t,H)}function he(H){En.call(this,t,H)}function me(H){En.call(this,t,H)}function Ce(H){En.call(this,t,H)}return t.$$set=H=>{"id"in H&&n(1,a=H.id),"source"in H&&n(2,c=H.source),"sourceLayer"in H&&n(3,u=H.sourceLayer),"beforeId"in H&&n(4,g=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,I=H.layout),"filter"in H&&n(8,P=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,N=H.maxzoom),"hoverCursor"in H&&n(11,q=H.hoverCursor),"manageHoverState"in H&&n(12,J=H.manageHoverState),"hovered"in H&&n(0,re=H.hovered),"eventsIfTopMost"in H&&n(13,U=H.eventsIfTopMost),"interactive"in H&&n(14,j=H.interactive),"$$scope"in H&&n(23,i=H.$$scope)},[re,a,c,u,g,w,S,I,P,D,N,q,J,U,j,r,Z,te,_e,pe,he,me,Ce,i]}class jF extends en{constructor(e){super(),$t(this,e,qF,GF,jt,{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 WF(t){let e,n,r,i,a,c;return e=new NF({props:{id:"edit-polygon-fill",filter:cF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new jF({props:{id:"edit-polygon-lines",filter:hF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new AF({props:{id:"edit-polygon-vertices",filter:fF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){lt(e.$$.fragment),n=ft(),lt(r.$$.fragment),i=ft(),lt(a.$$.fragment)},m(u,g){st(e,u,g),Re(u,n,g),st(r,u,g),Re(u,i,g),st(a,u,g),c=!0},p:gt,i(u){c||(be(e.$$.fragment,u),be(r.$$.fragment,u),be(a.$$.fragment,u),c=!0)},o(u){Te(e.$$.fragment,u),Te(r.$$.fragment,u),Te(a.$$.fragment,u),c=!1},d(u){u&&(De(n),De(i)),at(e,u),at(r,u),at(a,u)}}}function HF(t){let e,n;return e=new VF({props:{data:t[0],$$slots:{default:[WF]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function ZF(t,e,n){let r;return zt(t,VC,i=>n(0,r=i)),[r]}class XF extends en{constructor(e){super(),$t(this,e,ZF,HF,jt,{})}}function YF(t){let e,n,r,i,a,c,u;return{c(){e=Oe("button"),e.textContent="Import current view",n=ft(),r=Oe("i"),r.textContent="or...",i=ft(),a=Oe("button"),a.textContent="Draw an area to import on the map",Ue(e,"type","button"),Ue(a,"type","button")},m(g,w){Re(g,e,w),Re(g,n,w),Re(g,r,w),Re(g,i,w),Re(g,a,w),c||(u=[Zt(e,"click",t[1]),Zt(a,"click",t[2])],c=!0)},p:gt,i:gt,o:gt,d(g){g&&(De(e),De(n),De(r),De(i),De(a)),c=!1,Ni(u)}}}function KF(t){let e,n;return e=new vF({props:{polygonTool:t[0]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function JF(t){let e,n,r,i;const a=[KF,YF],c=[];function u(g,w){return g[0]?0:1}return e=u(t),n=c[e]=a[e](t),{c(){n.c(),r=oi()},m(g,w){c[e].m(g,w),Re(g,r,w),i=!0},p(g,[w]){let S=e;e=u(g),e===S?c[e].p(g,w):(Nn(),Te(c[S],1,1,()=>{c[S]=null}),On(),n=c[e],n?n.p(g,w):(n=c[e]=a[e](g),n.c()),be(n,1),n.m(r.parentNode,r))},i(g){i||(be(n),i=!0)},o(g){Te(n),i=!1},d(g){g&&De(r),c[e].d(g)}}}function nd(t){return[t.lng,t.lat]}function QF(t,e,n){let{map:r}=e;const i=qu();let a=null;async function c(S){try{i("loading","Loading from Overpass");let P=await(await fetch(e6(S))).text();i("gotXml",P)}catch(I){i("error",I.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[nd(S.getSouthWest()),nd(S.getNorthWest()),nd(S.getNorthEast()),nd(S.getSouthEast()),nd(S.getSouthWest())]],type:"Polygon"}}}async function g(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await c(u())}}function w(){r&&(n(0,a=new dF(r)),a.startNew(),a.addEventListenerSuccess(async S=>{n(0,a=null),await c(S)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}return t.$$set=S=>{"map"in S&&n(3,r=S.map)},[a,g,w,r]}class $F extends en{constructor(e){super(),$t(this,e,QF,JF,jt,{map:3})}}function e6(t){let e='poly:"';for(let[r,i]of t.geometry.coordinates[0])e+=`${i} ${r} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function DS(t,e,n){const r=t.slice();return r[3]=e[n],r}function RS(t){let e,n,r=ei(t[0]),i=[];for(let a=0;a0&&RS(t);return{c(){n&&n.c(),e=oi()},m(r,i){n&&n.m(r,i),Re(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=RS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:gt,o:gt,d(r){r&&De(e),n&&n.d(r)}}}function n6(t,e,n){let{loading:r}=e,i;function a(c){Kn[c?"unshift":"push"](()=>{i=c,n(1,i),n(0,r)})}return t.$$set=c=>{"loading"in c&&n(0,r=c.loading)},t.$$.update=()=>{t.$$.dirty&3&&r.length>0&&i&&n(1,i.scrollTop=i.scrollHeight,i)},[r,i,a]}class r6 extends en{constructor(e){super(),$t(this,e,n6,t6,jt,{loading:0})}}function OS(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function zS(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function FS(t){let e,n=t[26]+"",r,i;return{c(){e=Oe("option"),r=kt(n),e.__value=i=t[25],Go(e,e.__value)},m(a,c){Re(a,e,c),ke(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&Qn(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,Go(e,e.__value))},d(a){a&&De(e)}}}function BS(t){let e,n,r=ei(t[22]),i=[];for(let a=0;at[9].call(c)),Ue(N,"type","file"),Ue(me,"type","file")},m(Ze,tt){st(e,Ze,tt),Re(Ze,n,tt),Re(Ze,r,tt),ke(r,i),ke(i,a),ke(i,c),ke(c,u);for(let qe=0;qen(15,r=he)),zt(t,ku,he=>n(16,i=he)),zt(t,my,he=>n(5,a=he));let c="",u=[],g=!1,w=[];ru(async()=>{try{let he=await fetch("/osm/areas.json");if(he.ok)g=!0,console.log("Using local cache, not od2net.org"),n(2,w=await he.json());else{let me=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await me.json())}}catch{}});let S;async function I(he){try{await N(await S.files[0].arrayBuffer()),n(0,c="")}catch(me){window.alert(`Couldn't open this file: ${me}`)}n(1,u=[])}let P;async function D(he){try{n(1,u=["Loading pre-built file"]);let me=await P.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(me)),console.timeEnd("load"),ur(af,r=!0,r),n(0,c="")}catch(me){window.alert(`Couldn't open this file: ${me}`)}n(1,u=[])}async function N(he){n(1,u=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(he),sE(q)),console.timeEnd("load"),ur(af,r=!0,r)}function q(he){n(1,u=[...u,he])}async function J(he){try{await N(new TextEncoder().encode(he.detail)),n(0,c="")}catch(me){window.alert(`Couldn't import from Overpass: ${me}`)}n(1,u=[])}async function re(he){he!=""&&(g?await U(`/osm/${he}.pbf`):await U(`https://assets.od2net.org/severance_pbfs/${he}.pbf`))}async function U(he){try{n(1,u=[`Downloading ${he}`]);let me=await fetch(he);await N(await me.arrayBuffer())}catch(me){window.alert(`Couldn't open from URL ${he}: ${me}`)}n(1,u=[])}function j(){c=ZS(this),n(0,c),n(2,w)}function Z(he){Kn[he?"unshift":"push"](()=>{S=he,n(3,S)})}const te=he=>n(1,u=[...u,he.detail]),_e=he=>window.alert(he.detail);function pe(he){Kn[he?"unshift":"push"](()=>{P=he,n(4,P)})}return t.$$.update=()=>{t.$$.dirty&1&&re(c)},[c,u,w,S,P,a,I,D,J,j,Z,te,_e,pe]}class s6 extends en{constructor(e){super(),$t(this,e,o6,i6,jt,{})}}function a6(t){let e;return{c(){e=Oe("div"),Ue(e,"slot","top")},m(n,r){Re(n,e,r)},p:gt,d(n){n&&De(e)}}}function l6(t){let e;return{c(){e=Oe("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Re(n,e,r)},i:gt,o:gt,d(n){n&&De(e)}}}function u6(t){let e,n;return e=new s6({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function c6(t){let e,n,r,i,a,c;const u=[u6,l6],g=[];function w(S,I){return S[0]?0:1}return i=w(t),a=g[i]=u[i](t),{c(){e=Oe("div"),n=Oe("h2"),n.textContent="Choose your study area",r=ft(),a.c(),Ue(e,"slot","sidebar")},m(S,I){Re(S,e,I),ke(e,n),ke(e,r),g[i].m(e,null),c=!0},p(S,I){let P=i;i=w(S),i!==P&&(Nn(),Te(g[P],1,1,()=>{g[P]=null}),On(),a=g[i],a||(a=g[i]=u[i](S),a.c()),be(a,1),a.m(e,null))},i(S){c||(be(a),c=!0)},o(S){Te(a),c=!1},d(S){S&&De(e),g[i].d()}}}function h6(t){let e,n,r;return n=new XF({}),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"slot","map")},m(i,a){Re(i,e,a),st(n,e,null),r=!0},p:gt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&De(e),at(n)}}}function f6(t){let e,n;return e=new Zf({props:{$$slots:{map:[h6],sidebar:[c6],top:[a6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function p6(t,e,n){let r,i,a;return zt(t,ku,c=>n(1,r=c)),zt(t,af,c=>n(2,i=c)),zt(t,my,c=>n(0,a=c)),ru(async()=>{ur(af,i=!1,i),await r.unset()}),[a]}class d6 extends en{constructor(e){super(),$t(this,e,p6,f6,jt,{})}}function m6(){return new Worker("/15m/assets/worker-b2639931.js")}function g6(t){let e,n,r,i,a,c;return{c(){e=Oe("div"),n=Oe("button"),n.innerHTML=`A/B Street logo`,r=ft(),i=Oe("span"),Ue(n,"class","outline"),Si(i,"width","100%"),Ue(e,"slot","top"),Si(e,"display","flex")},m(u,g){Re(u,e,g),ke(e,n),ke(e,r),ke(e,i),t[16](i),a||(c=Zt(n,"click",t[15]),a=!0)},p:gt,d(u){u&&De(e),t[16](null),a=!1,c()}}}function VS(t){let e,n,r,i,a,c;return{c(){e=Oe("hr"),n=ft(),r=Oe("div"),i=Oe("button"),i.textContent="Zoom to fit"},m(u,g){Re(u,e,g),Re(u,n,g),Re(u,r,g),ke(r,i),a||(c=Zt(i,"click",t[8]),a=!0)},p:gt,d(u){u&&(De(e),De(n),De(r)),a=!1,c()}}}function y6(t){let e,n,r,i,a,c=t[5].kind!="title"&&VS(t);return{c(){e=Oe("div"),n=Oe("h1"),n.textContent="15-minute neighbourhood tool",r=ft(),i=Oe("div"),a=ft(),c&&c.c(),Ue(e,"slot","left")},m(u,g){Re(u,e,g),ke(e,n),ke(e,r),ke(e,i),t[14](i),ke(e,a),c&&c.m(e,null)},p(u,g){u[5].kind!="title"?c?c.p(u,g):(c=VS(u),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(u){u&&De(e),t[14](null),c&&c.d()}}}function US(t){let e,n;return e=new d6({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function GS(t){let e,n,r,i,a,c,u={ctx:t,current:null,token:null,hasCatch:!1,pending:x6,then:v6,catch:_6,value:18,blocks:[,,,]};Jb(e=Hl(t[6]).getInvertedBoundary(),u);const g=[C6,I6,E6,S6,w6],w=[];function S(I,P){return I[5].kind=="debug"?0:I[5].kind=="isochrone"?1:I[5].kind=="route"?2:I[5].kind=="score"?3:I[5].kind=="debug-route"?4:-1}return~(r=S(t))&&(i=w[r]=g[r](t)),{c(){u.block.c(),n=ft(),i&&i.c(),a=oi()},m(I,P){u.block.m(I,u.anchor=P),u.mount=()=>n.parentNode,u.anchor=n,Re(I,n,P),~r&&w[r].m(I,P),Re(I,a,P),c=!0},p(I,P){t=I,u.ctx=t,P&64&&e!==(e=Hl(t[6]).getInvertedBoundary())&&Jb(e,u)||ZL(u,t,P);let D=r;r=S(t),r===D?~r&&w[r].p(t,P):(i&&(Nn(),Te(w[D],1,1,()=>{w[D]=null}),On()),~r?(i=w[r],i?i.p(t,P):(i=w[r]=g[r](t),i.c()),be(i,1),i.m(a.parentNode,a)):i=null)},i(I){c||(be(u.block),be(i),c=!0)},o(I){for(let P=0;P<3;P+=1){const D=u.blocks[P];Te(D)}Te(i),c=!1},d(I){I&&(De(n),De(a)),u.block.d(I),u.token=null,u=null,~r&&w[r].d(I)}}}function _6(t){return{c:gt,m:gt,p:gt,i:gt,o:gt,d:gt}}function v6(t){let e,n;return e=new nu({props:{data:t[18],$$slots:{default:[b6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[18]),i&524288&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function b6(t){let e,n;return e=new IC({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function x6(t){return{c:gt,m:gt,p:gt,i:gt,o:gt,d:gt}}function w6(t){let e,n;return e=new mz({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.debugGj=r[5].debugGj),i&32&&(a.start=r[5].start),i&32&&(a.end=r[5].end),i&32&&(a.routeGj=r[5].routeGj),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function S6(t){let e,n;return e=new Iz({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function E6(t){let e,n;return e=new oz({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function I6(t){let e,n;return e=new G5({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function C6(t){let e,n;return e=new A5({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:gt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function T6(t){let e,n,r,i,a,c,u;e=new kN({props:{map:t[0],apiKey:uE}});let g=t[5].kind=="title"&&US(),w=t[4]&&GS(t);return{c(){lt(e.$$.fragment),n=ft(),r=Oe("div"),i=ft(),g&&g.c(),a=ft(),w&&w.c(),c=oi()},m(S,I){st(e,S,I),Re(S,n,I),Re(S,r,I),t[12](r),Re(S,i,I),g&&g.m(S,I),Re(S,a,I),w&&w.m(S,I),Re(S,c,I),u=!0},p(S,I){const P={};I&1&&(P.map=S[0]),e.$set(P),S[5].kind=="title"?g?I&32&&be(g,1):(g=US(),g.c(),be(g,1),g.m(a.parentNode,a)):g&&(Nn(),Te(g,1,1,()=>{g=null}),On()),S[4]?w?(w.p(S,I),I&16&&be(w,1)):(w=GS(S),w.c(),be(w,1),w.m(c.parentNode,c)):w&&(Nn(),Te(w,1,1,()=>{w=null}),On())},i(S){u||(be(e.$$.fragment,S),be(g),be(w),u=!0)},o(S){Te(e.$$.fragment,S),Te(g),Te(w),u=!1},d(S){S&&(De(n),De(r),De(i),De(a),De(c)),at(e,S),t[12](null),g&&g.d(S),w&&w.d(S)}}}function L6(t){let e,n,r,i;function a(u){t[13](u)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${uE}`,standardControls:!0,hash:!0,$$slots:{default:[T6]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new WO({props:c}),Kn.push(()=>Po(n,"map",a)),{c(){e=Oe("div"),lt(n.$$.fragment),Ue(e,"slot","main"),Si(e,"position","relative"),Si(e,"width","100%"),Si(e,"height","100vh")},m(u,g){Re(u,e,g),st(n,e,null),i=!0},p(u,g){const w={};g&524409&&(w.$$scope={dirty:g,ctx:u}),!r&&g&1&&(r=!0,w.map=u[0],Lo(()=>r=!1)),n.$set(w)},i(u){i||(be(n.$$.fragment,u),i=!0)},o(u){Te(n.$$.fragment,u),i=!1},d(u){u&&De(e),at(n)}}}function P6(t){let e,n,r,i;return e=new AP({}),r=new t5({props:{$$slots:{main:[L6],left:[y6],top:[g6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment),n=ft(),lt(r.$$.fragment)},m(a,c){st(e,a,c),Re(a,n,c),st(r,a,c),i=!0},p(a,[c]){const u={};c&524543&&(u.$$scope={dirty:c,ctx:a}),r.$set(u)},i(a){i||(be(e.$$.fragment,a),be(r.$$.fragment,a),i=!0)},o(a){Te(e.$$.fragment,a),Te(r.$$.fragment,a),i=!1},d(a){a&&De(n),at(e,a),at(r,a)}}}function M6(t,e,n){let r,i,a,c,u,g,w;zt(t,dv,te=>n(9,r=te)),zt(t,pv,te=>n(10,i=te)),zt(t,fv,te=>n(11,a=te)),zt(t,af,te=>n(4,c=te)),zt(t,Ys,te=>n(5,u=te)),zt(t,ku,te=>n(6,g=te)),zt(t,Og,te=>n(7,w=te)),ru(async()=>{const te=rE(new m6);let _e=await new te;ku.set(_e)});let S;async function I(){S&&c&&S.fitBounds(await g.getBounds(),{animate:!1})}async function P(te){te&&(console.log("New map model loaded"),await I(),ur(Ys,u={kind:"isochrone"},u))}let D,N,q;function J(te){Kn[te?"unshift":"push"](()=>{q=te,n(3,q),n(9,r)})}function re(te){S=te,n(0,S)}function U(te){Kn[te?"unshift":"push"](()=>{N=te,n(2,N),n(10,i)})}const j=()=>ur(Og,w=!0,w);function Z(te){Kn[te?"unshift":"push"](()=>{D=te,n(1,D),n(11,a)})}return t.$$.update=()=>{t.$$.dirty&1&&S&&my.set(S),t.$$.dirty&16&&P(c),t.$$.dirty&2050&&D&&a&&(n(1,D.innerHTML="",D),D.appendChild(a)),t.$$.dirty&1028&&N&&i&&(n(2,N.innerHTML="",N),N.appendChild(i)),t.$$.dirty&520&&q&&r&&(n(3,q.innerHTML="",q),q.appendChild(r))},[S,D,N,q,c,u,g,w,I,r,i,a,J,re,U,j,Z]}class A6 extends en{constructor(e){super(),$t(this,e,M6,P6,jt,{})}}new A6({target:document.getElementById("app")}); diff --git a/index.html b/index.html index 206ef89..7603e74 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ 15-minute neighborhood tool - +