From 0216dbe997cb50bb9d89636f1e0a47677bafe0c6 Mon Sep 17 00:00:00 2001 From: dabreegster Date: Fri, 16 Aug 2024 13:49:29 +0000 Subject: [PATCH] deploy: d0bf604a68ad2c14135db118b3a2a8eee606fcec --- assets/main-72fb3455.js | 644 --------------------------------------- assets/main-da277cee.js | 645 ++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 3 files changed, 646 insertions(+), 645 deletions(-) delete mode 100644 assets/main-72fb3455.js create mode 100644 assets/main-da277cee.js diff --git a/assets/main-72fb3455.js b/assets/main-72fb3455.js deleted file mode 100644 index cba2c4f..0000000 --- a/assets/main-72fb3455.js +++ /dev/null @@ -1,644 +0,0 @@ -var YL=Object.defineProperty;var KL=(t,e,n)=>e in t?YL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gi=(t,e,n)=>(KL(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 et(){}function JL(t,e){for(const n in e)t[n]=e[n];return t}function QL(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function aE(t){return t()}function ux(){return Object.create(null)}function xi(t){t.forEach(aE)}function E_(t){return typeof t=="function"}function jt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let dg;function To(t,e){return t===e?!0:(dg||(dg=document.createElement("a")),dg.href=e,t===dg.href)}function $L(t){return Object.keys(t).length===0}function lE(t,...e){if(t==null){for(const r of e)r(void 0);return et}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function uE(t){let e;return lE(t,n=>e=n)(),e}function Ct(t,e,n){t.$$.on_destroy.push(lE(e,n))}function Xr(t,e,n,r){if(t){const i=cE(t,e,n,r);return t[0](i)}}function cE(t,e,n,r){return t[1]&&r?JL(n.ctx.slice(),t[1](r(e))):n.ctx}function Yr(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 l=0;l32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function nP(t){return function(e){return e.preventDefault(),t.call(this,e)}}function e0(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Be(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Ev(t){return t===""?null:+t}function rP(t){return Array.from(t.childNodes)}function Pn(t,e){e=""+e,t.data!==e&&(t.data=e)}function co(t,e){t.value=e??""}function Ii(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Ug(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=iP(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function Iv(t,e){return Zf().$$.context.set(t,e),e}function Cv(t){return Zf().$$.context.get(t)}function dn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const af=[],jn=[];let df=[];const A0=[],fE=Promise.resolve();let k0=!1;function pE(){k0||(k0=!0,fE.then(Tv))}function dE(){return pE(),fE}function Ld(t){df.push(t)}function Zi(t){A0.push(t)}const t0=new Set;let $h=0;function Tv(){if($h!==0)return;const t=Td;do{try{for(;$ht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),df=e}const Tg=new Set;let Tc;function Mn(){Tc={r:0,c:[],p:Tc}}function An(){Tc.r||xi(Tc.c),Tc=Tc.p}function _e(t,e){t&&t.i&&(Tg.delete(t),t.i(e))}function Se(t,e,n,r){if(t&&t.o){if(Tg.has(t))return;Tg.add(t),Tc.c.push(()=>{Tg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function yf(t,e){const n=e.token={};function r(i,a,c,l){if(e.token!==n)return;e.resolved=l;let m=e.ctx;c!==void 0&&(m=m.slice(),m[c]=l);const w=i&&(e.current=i)(m);let S=!1;e.block&&(e.blocks?e.blocks.forEach((E,T)=>{T!==a&&E&&(Mn(),Se(E,1,1,()=>{e.blocks[T]===E&&(e.blocks[T]=null)}),An())}):e.block.d(1),w.c(),_e(w,1),w.m(e.mount(),e.anchor),S=!0),e.block=w,e.blocks&&(e.blocks[a]=w),S&&Tv()}if(QL(t)){const i=Zf();if(t.then(a=>{Hl(i),r(e.then,1,e.value,a),Hl(null)},a=>{if(Hl(i),r(e.catch,2,e.error,a),Hl(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 Lv(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 zr(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function aP(t,e){Se(t,1,1,()=>{e.delete(t.key)})}function lP(t,e,n,r,i,a,c,l,m,w,S,E){let T=t.length,D=a.length,k=T;const U={};for(;k--;)U[t[k].key]=k;const q=[],ee=new Map,V=new Map,j=[];for(k=D;k--;){const de=E(i,a,k),re=n(de);let se=c.get(re);se?r&&j.push(()=>se.p(de,e)):(se=w(re,de),se.c()),ee.set(re,q[k]=se),re in U&&V.set(re,Math.abs(k-U[re]))}const Q=new Set,$=new Set;function me(de){_e(de,1),de.m(l,S),c.set(de.key,de),S=de.first,D--}for(;T&&D;){const de=q[D-1],re=t[T-1],se=de.key,Ce=re.key;de===re?(S=de.first,T--,D--):ee.has(Ce)?!c.has(se)||Q.has(se)?me(de):$.has(Ce)?T--:V.get(se)>V.get(Ce)?($.add(se),me(de)):(Q.add(Ce),T--):(m(re,c),T--)}for(;T--;){const de=t[T];ee.has(de.key)||m(de,c)}for(;D;)me(q[D-1]);return xi(j),q}function Xi(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function it(t){t&&t.c()}function tt(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Ld(()=>{const a=t.$$.on_mount.map(aE).filter(E_);t.$$.on_destroy?t.$$.on_destroy.push(...a):xi(a),t.$$.on_mount=[]}),i.forEach(Ld)}function nt(t,e){const n=t.$$;n.fragment!==null&&(sP(n.after_update),xi(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function uP(t,e){t.$$.dirty[0]===-1&&(af.push(t),pE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=D.length?D[0]:T;return w.ctx&&i(w.ctx[E],w.ctx[E]=k)&&(!w.skip_bound&&w.bound[E]&&w.bound[E](k),S&&uP(t,E)),T}):[],w.update(),S=!0,xi(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const E=rP(e.target);w.fragment&&w.fragment.l(E),E.forEach(Pe)}else w.fragment&&w.fragment.c();e.intro&&_e(t.$$.fragment),tt(t,e.target,e.anchor),Tv()}Hl(m)}class Jt{constructor(){gi(this,"$$");gi(this,"$$set")}$destroy(){nt(this,1),this.$destroy=et}$on(e,n){if(!E_(n))return et;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&&!$L(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const cP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(cP);const hP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAAmJLR0QA/4ePzL8AAACgSURBVBjTY2D4D4cvGHoY2BlQwH8U2I4pCQKsDHFg3VglGRjEgazvmJLlQNjIcAnIOobbztcM5piSHUBYzxDNwMfAgMtOGKjHJpnJ8IwhhcGFYREDM6ZkCMMqoPHXGC4zBKEa5cPwBKioAAiXMIQz/GZ4yuCFkHzC4MjgxPCNoZaBjeE+kOXEcB0h+RjIdWG4AGU7w9lg4A0UesBgj8oGAP6nSFElh0b7AAAAAElFTkSuQmCC",fP="/15m/assets/logo_dark-ed08d841.svg";const pP=t=>({dialog:t&1}),cx=t=>({dialog:t[0]});function dP(t){let e,n,r,i,a;const c=t[4].default,l=Xr(c,t,t[3],cx);return{c(){e=ke("dialog"),n=ke("article"),l&&l.c(),e.open=!0},m(m,w){Me(m,e,w),we(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(a=[Gt(window,"click",t[1]),Gt(window,"keydown",t[2]),Gt(e,"close",t[5])],i=!0)},p(m,[w]){l&&l.p&&(!r||w&9)&&Kr(l,c,m,m[3],r?Yr(c,m[3],w,pP):Jr(m[3]),cx)},i(m){r||(_e(l,m),r=!0)},o(m){Se(l,m),r=!1},d(m){m&&Pe(e),l&&l.d(m),t[6](null),i=!1,xi(a)}}}function mP(t,e,n){let{$$slots:r={},$$scope:i}=e,a;function c(S){a.open&&S.target==a&&a.close()}function l(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function m(S){dn.call(this,t,S)}function w(S){jn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,c,l,i,r,m,w]}class Pv extends Jt{constructor(e){super(),Kt(this,e,mP,dP,jt,{})}}function hx(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function fx(t){let e,n,r=t[1]+"",i,a,c,l=t[2]+"",m,w;return{c(){e=ke("tr"),n=ke("td"),i=vt(r),a=ot(),c=ke("td"),m=vt(l),w=ot()},m(S,E){Me(S,e,E),we(e,n),we(n,i),we(e,a),we(e,c),we(c,m),we(e,w)},p(S,E){E&1&&r!==(r=S[1]+"")&&Pn(i,r),E&1&&l!==(l=S[2]+"")&&Pn(m,l)},d(S){S&&Pe(e)}}}function gP(t){let e,n,r=zr(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class Mv extends Jt{constructor(e){super(),Kt(this,e,_P,gP,jt,{properties:0})}}function px(t,e,n){const r=t.slice();return r[3]=e[n],r}function dx(t,e,n){const r=t.slice();return r[6]=e[n],r}function mx(t){let e,n;return{c(){e=ke("span"),n=vt(`  - `),Ii(e,"background",t[6]),Ii(e,"width","100%"),Ii(e,"border","1px solid black")},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&1&&Ii(e,"background",r[6])},d(r){r&&Pe(e)}}}function yP(t){let e,n=t[3]+"",r;return{c(){e=ke("span"),r=vt(n)},m(i,a){Me(i,e,a),we(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&Pn(r,n)},d(i){i&&Pe(e)}}}function vP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=ke("span"),r=vt(n)},m(i,a){Me(i,e,a),we(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&Pn(r,n)},d(i){i&&Pe(e)}}}function gx(t){let e;function n(a,c){return a[2]>0?vP:yP}let r=n(t),i=r(t);return{c(){i.c(),e=Er()},m(a,c){i.m(a,c),Me(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&&Pe(e),i.d(a)}}}function bP(t){let e,n,r,i=zr(t[0]),a=[];for(let m=0;m{"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 Av extends Jt{constructor(e){super(),Kt(this,e,xP,bP,jt,{colorScale:0,limits:1,decimalPlaces:2})}}function cs(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const ef=[];function n0(t,e){return{subscribe:tr(t,e).subscribe}}function tr(t,e=et){let n;const r=new Set;function i(l){if(jt(t,l)&&(t=l,n)){const m=!ef.length;for(const w of r)w[1](),ef.push(w,t);if(m){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 mE=Symbol("Comlink.proxy"),wP=Symbol("Comlink.endpoint"),SP=Symbol("Comlink.releaseProxy"),r0=Symbol("Comlink.finalizer"),Lg=Symbol("Comlink.thrown"),gE=t=>typeof t=="object"&&t!==null||typeof t=="function",EP={canHandle:t=>gE(t)&&t[mE],serialize(t){const{port1:e,port2:n}=new MessageChannel;return kv(t,e),[n,[n]]},deserialize(t){return t.start(),vE(t)}},IP={canHandle:t=>gE(t)&&Lg 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}},_E=new Map([["proxy",EP],["throw",IP]]);function CP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function kv(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!CP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:c,path:l}=Object.assign({path:[]},i.data),m=(i.data.argumentList||[]).map(Cc);let w;try{const S=l.slice(0,-1).reduce((T,D)=>T[D],t),E=l.reduce((T,D)=>T[D],t);switch(c){case"GET":w=E;break;case"SET":S[l.slice(-1)[0]]=Cc(i.data.value),w=!0;break;case"APPLY":w=E.apply(S,m);break;case"CONSTRUCT":{const T=new E(...m);w=Dv(T)}break;case"ENDPOINT":{const{port1:T,port2:D}=new MessageChannel;kv(t,D),w=AP(T,[T])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[Lg]:0}}Promise.resolve(w).catch(S=>({value:S,[Lg]:0})).then(S=>{const[E,T]=qg(S);e.postMessage(Object.assign(Object.assign({},E),{id:a}),T),c==="RELEASE"&&(e.removeEventListener("message",r),yE(e),r0 in t&&typeof t[r0]=="function"&&t[r0]())}).catch(S=>{const[E,T]=qg({value:new TypeError("Unserializable return value"),[Lg]:0});e.postMessage(Object.assign(Object.assign({},E),{id:a}),T)})}),e.start&&e.start()}function TP(t){return t.constructor.name==="MessagePort"}function yE(t){TP(t)&&t.close()}function vE(t,e){return D0(t,[],e)}function mg(t){if(t)throw new Error("Proxy has been released and is not useable")}function bE(t){return lf(t,{type:"RELEASE"}).then(()=>{yE(t)})}const Gg=new WeakMap,jg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Gg.get(t)||0)-1;Gg.set(t,e),e===0&&bE(t)});function LP(t,e){const n=(Gg.get(e)||0)+1;Gg.set(e,n),jg&&jg.register(t,e,t)}function PP(t){jg&&jg.unregister(t)}function D0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(mg(r),c===SP)return()=>{PP(i),bE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const l=lf(t,{type:"GET",path:e.map(m=>m.toString())}).then(Cc);return l.then.bind(l)}return D0(t,[...e,c])},set(a,c,l){mg(r);const[m,w]=qg(l);return lf(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:m},w).then(Cc)},apply(a,c,l){mg(r);const m=e[e.length-1];if(m===wP)return lf(t,{type:"ENDPOINT"}).then(Cc);if(m==="bind")return D0(t,e.slice(0,-1));const[w,S]=_x(l);return lf(t,{type:"APPLY",path:e.map(E=>E.toString()),argumentList:w},S).then(Cc)},construct(a,c){mg(r);const[l,m]=_x(c);return lf(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:l},m).then(Cc)}});return LP(i,t),i}function MP(t){return Array.prototype.concat.apply([],t)}function _x(t){const e=t.map(qg);return[e.map(n=>n[0]),MP(e.map(n=>n[1]))]}const xE=new WeakMap;function AP(t,e){return xE.set(t,e),t}function Dv(t){return Object.assign(t,{[mE]:!0})}function qg(t){for(const[e,n]of _E)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},xE.get(t)||[]]}function Cc(t){switch(t.type){case"HANDLER":return _E.get(t.name).deserialize(t.value);case"RAW":return t.value}}function lf(t,e,n){return new Promise(r=>{const i=kP();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 kP(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let Lt;const Wl=new Array(128).fill(void 0);Wl.push(void 0,null,!0,!1);function ht(t){return Wl[t]}let bd=Wl.length;function DP(t){t<132||(Wl[t]=bd,bd=t)}function Pa(t){const e=ht(t);return DP(t),e}let fl=0,pd=null;function xd(){return(pd===null||pd.byteLength===0)&&(pd=new Uint8Array(Lt.memory.buffer)),pd}const Pg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},RP=typeof Pg.encodeInto=="function"?function(t,e){return Pg.encodeInto(t,e)}:function(t,e){const n=Pg.encode(t);return e.set(n),{read:t.length,written:n.length}};function hf(t,e,n){if(n===void 0){const l=Pg.encode(t),m=e(l.length,1)>>>0;return xd().subarray(m,m+l.length).set(l),fl=l.length,m}let r=t.length,i=e(r,1)>>>0;const a=xd();let c=0;for(;c127)break;a[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=xd().subarray(i+c,i+r),m=RP(t,l);c+=m.written,i=n(i,r,c,1)>>>0}return fl=c,i}function Qs(t){return t==null}let dd=null;function _n(){return(dd===null||dd.byteLength===0)&&(dd=new Int32Array(Lt.memory.buffer)),dd}function Ft(t){bd===Wl.length&&Wl.push(Wl.length+1);const e=bd;return bd=Wl[e],Wl[e]=t,e}const wE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&wE.decode();function lo(t,e){return t=t>>>0,wE.decode(xd().subarray(t,t+e))}let md=null;function SE(){return(md===null||md.byteLength===0)&&(md=new Float64Array(Lt.memory.buffer)),md}let gd=null;function NP(){return(gd===null||gd.byteLength===0)&&(gd=new BigInt64Array(Lt.memory.buffer)),gd}function R0(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+=R0(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}const yx=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{Lt.__wbindgen_export_2.get(t.dtor)(t.a,t.b)});function vx(t,e,n,r){const i={a:t,b:e,cnt:1,dtor:n},a=(...c)=>{i.cnt++;const l=i.a;i.a=0;try{return r(l,i.b,...c)}finally{--i.cnt===0?(Lt.__wbindgen_export_2.get(i.dtor)(l,i.b),yx.unregister(i)):i.a=l}};return a.original=i,yx.register(a,i,i),a}function OP(t,e,n){Lt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha0b106c86a4071f7(t,e,Ft(n))}function zP(t,e,n){Lt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a3a4bb5c4c0b039(t,e,Ft(n))}function FP(t,e){const n=e(t.length*1,1)>>>0;return xd().set(t,n/1),fl=t.length,n}function BP(t,e){return t=t>>>0,SE().subarray(t/8,t/8+e)}function _i(t,e){try{return t.apply(this,e)}catch(n){Lt.__wbindgen_exn_store(Ft(n))}}function VP(t,e,n,r){Lt.wasm_bindgen__convert__closures__invoke2_mut__h5b77cba7b0f68717(t,e,Ft(n),Ft(r))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingbytesource_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingsink_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingsource_free(t>>>0));const bx=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Lt.__wbg_mapmodel_free(t>>>0));class Pd{static __wrap(e){e=e>>>0;const n=Object.create(Pd.prototype);return n.__wbg_ptr=e,bx.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,bx.unregister(this),e}free(){const e=this.__destroy_into_raw();Lt.__wbg_mapmodel_free(e)}constructor(e,n,r,i,a){const c=FP(e,Lt.__wbindgen_malloc),l=fl;var m=Qs(r)?0:hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),w=fl,S=Qs(i)?0:hf(i,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),E=fl;const T=Lt.mapmodel_new(c,l,n,m,w,S,E,Qs(a)?0:Ft(a));return Pa(T)}renderDebug(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderDebug(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,m=i;if(c)throw l=0,m=0,Pa(a);return e=l,n=m,lo(l,m)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}renderAmenities(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderAmenities(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,m=i;if(c)throw l=0,m=0,Pa(a);return e=l,n=m,lo(l,m)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,m=i;if(c)throw l=0,m=0,Pa(a);return e=l,n=m,lo(l,m)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}getBounds(){try{const i=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_getBounds(i,this.__wbg_ptr);var e=_n()[i/4+0],n=_n()[i/4+1],r=BP(e,n).slice();return Lt.__wbindgen_free(e,n*8,8),r}finally{Lt.__wbindgen_add_to_stack_pointer(16)}}renderZones(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderZones(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,m=i;if(c)throw l=0,m=0,Pa(a);return e=l,n=m,lo(l,m)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}isochrone(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_isochrone(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],m=i,w=a;if(l)throw m=0,w=0,Pa(c);return n=m,r=w,lo(m,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_route(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],m=i,w=a;if(l)throw m=0,w=0,Pa(c);return n=m,r=w,lo(m,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}bufferRoute(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_bufferRoute(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],m=i,w=a;if(l)throw m=0,w=0,Pa(c);return n=m,r=w,lo(m,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}score(e,n){let r,i;try{const E=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_score(E,this.__wbg_ptr,Ft(e),Qs(n)?0:Ft(n));var a=_n()[E/4+0],c=_n()[E/4+1],l=_n()[E/4+2],m=_n()[E/4+3],w=a,S=c;if(m)throw w=0,S=0,Pa(l);return r=w,i=S,lo(w,S)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(r,i,1)}}}async function UP(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 GP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){Pa(e)},t.wbg.__wbg_mapmodel_new=function(e){const n=Pd.__wrap(e);return Ft(n)},t.wbg.__wbindgen_string_get=function(e,n){const r=ht(n),i=typeof r=="string"?r:void 0;var a=Qs(i)?0:hf(i,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),c=fl;_n()[e/4+1]=c,_n()[e/4+0]=a},t.wbg.__wbindgen_boolean_get=function(e){const n=ht(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_bigint=function(e){return typeof ht(e)=="bigint"},t.wbg.__wbindgen_bigint_from_u64=function(e){const n=BigInt.asUintN(64,e);return Ft(n)},t.wbg.__wbindgen_jsval_eq=function(e,n){return ht(e)===ht(n)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(lo(e,n));return Ft(r)},t.wbg.__wbindgen_string_new=function(e,n){const r=lo(e,n);return Ft(r)},t.wbg.__wbindgen_is_object=function(e){const n=ht(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return ht(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return ht(e)in ht(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=ht(n),i=typeof r=="number"?r:void 0;SE()[e/8+1]=Qs(i)?0:i,_n()[e/4+0]=!Qs(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return ht(e)==ht(n)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=ht(e);return Ft(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=ht(e)[ht(n)];return Ft(r)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ft(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=ht(n).stack,i=hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(lo(e,n))}finally{Lt.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=ht(e).performance;return Ft(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return ht(e).now()},t.wbg.__wbindgen_cb_drop=function(e){const n=Pa(e).original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){const n=fetch(ht(e));return Ft(n)},t.wbg.__wbg_done_2ffa852272310e47=function(e){return ht(e).done},t.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return _i(function(e){const n=ht(e).getReader();return Ft(n)},arguments)},t.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){const n=ht(e).value;return Ft(n)},t.wbg.__wbg_fetch_1e4e8ed1f64c7e28=function(e){const n=fetch(ht(e));return Ft(n)},t.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){const n=ht(e).queueMicrotask;return Ft(n)},t.wbg.__wbindgen_is_function=function(e){return typeof ht(e)=="function"},t.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(ht(e))},t.wbg.__wbg_fetch_693453ca3f88c055=function(e,n){const r=ht(e).fetch(ht(n));return Ft(r)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(ht(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(ht(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(ht(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(ht(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(ht(e))},t.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03=function(){return _i(function(e,n,r){const i=new Request(lo(e,n),ht(r));return Ft(i)},arguments)},t.wbg.__wbg_instanceof_Response_4c3b1446206114d1=function(e){let n;try{n=ht(e)instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_83a6a4f65f7a2b38=function(e,n){const r=ht(n).url,i=hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_status_d6d47ad2837621eb=function(e){return ht(e).status},t.wbg.__wbg_headers_24def508a7518df9=function(e){const n=ht(e).headers;return Ft(n)},t.wbg.__wbg_body_69be35dff3d68d53=function(e){const n=ht(e).body;return Qs(n)?0:Ft(n)},t.wbg.__wbg_arrayBuffer_5b2688e3dd873fed=function(){return _i(function(e){const n=ht(e).arrayBuffer();return Ft(n)},arguments)},t.wbg.__wbg_signal_3c701f5f40a5f08d=function(e){const n=ht(e).signal;return Ft(n)},t.wbg.__wbg_new_0ae46f44b7485bb2=function(){return _i(function(){const e=new AbortController;return Ft(e)},arguments)},t.wbg.__wbg_abort_2c4fb490d878d2b2=function(e){ht(e).abort()},t.wbg.__wbg_byobRequest_05466bb0cacd89fa=function(e){const n=ht(e).byobRequest;return Qs(n)?0:Ft(n)},t.wbg.__wbg_close_d29a75e8efc5fa94=function(){return _i(function(e){ht(e).close()},arguments)},t.wbg.__wbg_view_1fe68975176283b3=function(e){const n=ht(e).view;return Qs(n)?0:Ft(n)},t.wbg.__wbg_respond_6272b341f88864a2=function(){return _i(function(e,n){ht(e).respond(n>>>0)},arguments)},t.wbg.__wbg_read_79c1f6a58844174c=function(e){const n=ht(e).read();return Ft(n)},t.wbg.__wbg_releaseLock_6eb6fa75435874b8=function(e){ht(e).releaseLock()},t.wbg.__wbg_cancel_ef8b2c6f99da9cde=function(e){const n=ht(e).cancel();return Ft(n)},t.wbg.__wbg_new_7a20246daa6eec7e=function(){return _i(function(){const e=new Headers;return Ft(e)},arguments)},t.wbg.__wbg_append_aa3f462f9e2b5ff2=function(){return _i(function(e,n,r,i,a){ht(e).append(lo(n,r),lo(i,a))},arguments)},t.wbg.__wbg_close_79df9bcee94a607c=function(){return _i(function(e){ht(e).close()},arguments)},t.wbg.__wbg_enqueue_e8019641f9877e27=function(){return _i(function(e,n){ht(e).enqueue(ht(n))},arguments)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,n){const r=ht(e)[n>>>0];return Ft(r)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return ht(e).length},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(lo(e,n));return Ft(r)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const n=ht(e).next;return Ft(n)},t.wbg.__wbg_next_196c84450b364254=function(){return _i(function(e){const n=ht(e).next();return Ft(n)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return ht(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const n=ht(e).value;return Ft(n)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Ft(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return _i(function(e,n){const r=Reflect.get(ht(e),ht(n));return Ft(r)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return _i(function(e,n){const r=ht(e).call(ht(n));return Ft(r)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return Ft(e)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return _i(function(){const e=self.self;return Ft(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return _i(function(){const e=window.window;return Ft(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return _i(function(){const e=globalThis.globalThis;return Ft(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return _i(function(){const e=global.global;return Ft(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(ht(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=ht(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_new_28c511d9baebfa89=function(e,n){const r=new Error(lo(e,n));return Ft(r)},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return _i(function(e,n,r){const i=ht(e).call(ht(n),ht(r));return Ft(i)},arguments)},t.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(ht(e))},t.wbg.__wbg_new_81740750da40724f=function(e,n){try{var r={a:e,b:n},i=(c,l)=>{const m=r.a;r.a=0;try{return VP(m,r.b,c,l)}finally{r.a=m}};const a=new Promise(i);return Ft(a)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_b0083a7967828ec8=function(e){const n=Promise.resolve(ht(e));return Ft(n)},t.wbg.__wbg_catch_0260e338d10f79ae=function(e,n){const r=ht(e).catch(ht(n));return Ft(r)},t.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,n){const r=ht(e).then(ht(n));return Ft(r)},t.wbg.__wbg_then_a73caa9a87991566=function(e,n,r){const i=ht(e).then(ht(n),ht(r));return Ft(i)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=ht(e).buffer;return Ft(n)},t.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,n,r){const i=new Uint8Array(ht(e),n>>>0,r>>>0);return Ft(i)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(ht(e));return Ft(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){ht(e).set(ht(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return ht(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=ht(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){const n=ht(e).buffer;return Ft(n)},t.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return ht(e).byteLength},t.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return ht(e).byteOffset},t.wbg.__wbg_has_0af94d20077affa2=function(){return _i(function(e,n){return Reflect.has(ht(e),ht(n))},arguments)},t.wbg.__wbg_set_1f9b04f170055d33=function(){return _i(function(e,n,r){return Reflect.set(ht(e),ht(n),ht(r))},arguments)},t.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return _i(function(e){const n=JSON.stringify(ht(e));return Ft(n)},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=ht(n),i=typeof r=="bigint"?r:void 0;NP()[e/8+1]=Qs(i)?BigInt(0):i,_n()[e/4+0]=!Qs(i)},t.wbg.__wbindgen_debug_string=function(e,n){const r=R0(ht(n)),i=hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(lo(e,n))},t.wbg.__wbindgen_memory=function(){const e=Lt.memory;return Ft(e)},t.wbg.__wbindgen_closure_wrapper1726=function(e,n,r){const i=vx(e,n,623,OP);return Ft(i)},t.wbg.__wbindgen_closure_wrapper2715=function(e,n,r){const i=vx(e,n,762,zP);return Ft(i)},t}function jP(t,e){return Lt=t.exports,N0.__wbindgen_wasm_module=e,gd=null,md=null,dd=null,pd=null,Lt}async function N0(t){if(Lt!==void 0)return Lt;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=GP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await UP(await t,e);return jP(n,r)}class qP{constructor(){gi(this,"inner");this.inner=null}async loadOsmFile(e,n,r,i){await N0(),this.inner=await new Pd(e,!0,n,r,i)}async loadGraphFile(e){await N0(),this.inner=await new Pd(e,!1,void 0,void 0,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())}renderAmenities(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderAmenities())}renderZones(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderZones())}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}))}bufferRoute(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.bufferRoute({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,use_heuristic:e.useHeuristic,start_time:e.startTime,max_seconds:e.maxSeconds}))}score(e,n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds,max_seconds:e.maxSeconds},n))}}kv(qP);let EE="MZEJTanw3WpxRvt7qDfo",Ts=tr({kind:"title"}),I_=tr(null),Wg=tr(!0),O0=tr(!1);function xx(t){return["!=",["get",`access_${t}`],"None"]}let vf=tr("foot"),Hg=tr("07:00"),Lc=tr(null),bf=tr(null),wx=tr(!0),Ql=tr(null),mf=tr(!1);function Zg(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 Sx(t){let e,n;return e=new Pv({props:{$$slots:{default:[WP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function WP(t){let e,n,r,i,a,c,l,m,w,S;function E(){return t[1](t[3])}return{c(){e=ke("h1"),e.textContent="15-minute neighborhood tool",n=ot(),r=ke("p"),r.textContent="TODO. Extremely early in development.",i=ot(),a=ke("p"),a.innerHTML=`This open source - tool is created by - Dustin Carlino - and relies heavily on - OpenStreetMap data.`,c=ot(),l=ke("center"),m=ke("button"),m.textContent="Start!"},m(T,D){Me(T,e,D),Me(T,n,D),Me(T,r,D),Me(T,i,D),Me(T,a,D),Me(T,c,D),Me(T,l,D),we(l,m),w||(S=Gt(m,"click",E),w=!0)},p(T,D){t=T},d(T){T&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a),Pe(c),Pe(l)),w=!1,S()}}}function HP(t){let e,n,r=t[0]&&Sx(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=Sx(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function ZP(t,e,n){let r;return Ct(t,Wg,c=>n(0,r=c)),[r,c=>cs(c).close(),()=>Gn(Wg,r=!1,r)]}class XP extends Jt{constructor(e){super(),Kt(this,e,ZP,HP,jt,{})}}var Kd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function C_(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 Ex=Object.prototype.toString,IE=function(e){var n=Ex.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ex.call(e.callee)==="[object Function]"),r},i0,Ix;function YP(){if(Ix)return i0;Ix=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=IE,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],m=function(T){var D=T.constructor;return D&&D.prototype===T},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 T in window)try{if(!w["$"+T]&&e.call(window,T)&&window[T]!==null&&typeof window[T]=="object")try{m(window[T])}catch{return!0}}catch{return!0}return!1}(),E=function(T){if(typeof window>"u"||!S)return m(T);try{return m(T)}catch{return!1}};t=function(D){var k=D!==null&&typeof D=="object",U=n.call(D)==="[object Function]",q=r(D),ee=k&&n.call(D)==="[object String]",V=[];if(!k&&!U&&!q)throw new TypeError("Object.keys called on a non-object");var j=c&&U;if(ee&&D.length>0&&!e.call(D,0))for(var Q=0;Q0)for(var $=0;$"u"||!Ui?zn:Ui(Uint8Array),Mc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":tf&&Ui?Ui([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":uf,"%AsyncGenerator%":uf,"%AsyncGeneratorFunction%":uf,"%AsyncIteratorPrototype%":uf,"%Atomics%":typeof Atomics>"u"?zn:Atomics,"%BigInt%":typeof BigInt>"u"?zn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?zn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?zn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?zn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":_M,"%eval%":eval,"%EvalError%":yM,"%Float32Array%":typeof Float32Array>"u"?zn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?zn:FinalizationRegistry,"%Function%":LE,"%GeneratorFunction%":uf,"%Int8Array%":typeof Int8Array>"u"?zn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?zn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tf&&Ui?Ui(Ui([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map>"u"?zn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tf||!Ui?zn:Ui(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?zn:Promise,"%Proxy%":typeof Proxy>"u"?zn:Proxy,"%RangeError%":vM,"%ReferenceError%":bM,"%Reflect%":typeof Reflect>"u"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?zn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tf||!Ui?zn:Ui(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tf&&Ui?Ui(""[Symbol.iterator]()):zn,"%Symbol%":tf?Symbol:zn,"%SyntaxError%":xf,"%ThrowTypeError%":wM,"%TypedArray%":EM,"%TypeError%":gf,"%Uint8Array%":typeof Uint8Array>"u"?zn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?zn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?zn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?zn:Uint32Array,"%URIError%":xM,"%WeakMap%":typeof WeakMap>"u"?zn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?zn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?zn:WeakSet};if(Ui)try{null.error}catch(t){var IM=Ui(Ui(t));Mc["%Error.prototype%"]=IM}var CM=function t(e){var n;if(e==="%AsyncFunction%")n=s0("async function () {}");else if(e==="%GeneratorFunction%")n=s0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=s0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ui&&(n=Ui(i.prototype))}return Mc[e]=n,n},Mx={__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"]},Jd=zv,Xg=TE,TM=Jd.call(Function.call,Array.prototype.concat),LM=Jd.call(Function.apply,Array.prototype.splice),Ax=Jd.call(Function.call,String.prototype.replace),Yg=Jd.call(Function.call,String.prototype.slice),PM=Jd.call(Function.call,RegExp.prototype.exec),MM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,AM=/\\(\\)?/g,kM=function(e){var n=Yg(e,0,1),r=Yg(e,-1);if(n==="%"&&r!=="%")throw new xf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new xf("invalid intrinsic syntax, expected opening `%`");var i=[];return Ax(e,MM,function(a,c,l,m){i[i.length]=l?Ax(m,AM,"$1"):c||a}),i},DM=function(e,n){var r=e,i;if(Xg(Mx,r)&&(i=Mx[r],r="%"+i[0]+"%"),Xg(Mc,r)){var a=Mc[r];if(a===uf&&(a=CM(r)),typeof a>"u"&&!n)throw new gf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new xf("intrinsic "+e+" does not exist!")},wl=function(e,n){if(typeof e!="string"||e.length===0)throw new gf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new gf('"allowMissing" argument must be a boolean');if(PM(/^%?[^%]*%?$/,e)===null)throw new xf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=kM(e),i=r.length>0?r[0]:"",a=DM("%"+i+"%",n),c=a.name,l=a.value,m=!1,w=a.alias;w&&(i=w[0],LM(r,TM([0,1],w)));for(var S=1,E=!0;S=r.length){var U=Pc(l,T);E=!!U,E&&"get"in U&&!("originalValue"in U.get)?l=U.get:l=l[T]}else E=Xg(l,T),l=l[T];E&&!m&&(Mc[c]=l)}}return l},l0,kx;function Fv(){if(kx)return l0;kx=1;var t=wl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return l0=e,l0}var RM=wl,Ag=RM("%Object.getOwnPropertyDescriptor%",!0);if(Ag)try{Ag([],"length")}catch{Ag=null}var Bv=Ag,Dx=Fv(),NM=CE,nf=Ku,Rx=Bv,Vv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new nf("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new nf("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new nf("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new nf("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new nf("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new nf("`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,l=arguments.length>6?arguments[6]:!1,m=!!Rx&&Rx(e,n);if(Dx)Dx(e,n,{configurable:c===null&&m?m.configurable:!c,enumerable:i===null&&m?m.enumerable:!i,value:r,writable:a===null&&m?m.writable:!a});else if(l||!i&&!a&&!c)e[n]=r;else throw new NM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},z0=Fv(),PE=function(){return!!z0};PE.hasArrayLengthDefineBug=function(){if(!z0)return null;try{return z0([],"length",{value:1}).length!==1}catch{return!0}};var Uv=PE,OM=Nv,zM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",FM=Object.prototype.toString,BM=Array.prototype.concat,Nx=Vv,VM=function(t){return typeof t=="function"&&FM.call(t)==="[object Function]"},ME=Uv(),UM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!VM(r)||!r())return}ME?Nx(t,e,n,!0):Nx(t,e,n)},AE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=OM(e);zM&&(r=BM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||qM(n)!==n)throw new Fx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&zx){var c=zx(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(jM?Ox(e,"length",n,!0,!0):Ox(e,"length",n)),e};(function(t){var e=zv,n=wl,r=WM,i=Ku,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,a),m=Fv(),w=n("%Math.max%");t.exports=function(T){if(typeof T!="function")throw new i("a function is required");var D=l(e,c,arguments);return r(D,1+w(0,T.length-(arguments.length-1)),!0)};var S=function(){return l(e,a,arguments)};m?m(t.exports,"apply",{value:S}):t.exports.apply=S})(kE);var Xf=kE.exports,DE=wl,RE=Xf,HM=RE(DE("String.prototype.indexOf")),_a=function(e,n){var r=DE(e,!!n);return typeof r=="function"&&HM(e,".prototype.")>-1?RE(r):r},ZM=Nv,NE=T_(),OE=_a,Bx=Object,XM=OE("Array.prototype.push"),Vx=OE("Object.prototype.propertyIsEnumerable"),YM=NE?Object.getOwnPropertySymbols:null,zE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Bx(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||cA)&&(uA?Ux(e,"name",n,!0,!0):Ux(e,"name",n)),e},pA=fA,dA=Ku,mA=Object,UE=pA(function(){if(this==null||this!==mA(this))throw new dA("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),gA=UE,_A=Zc.supportsDescriptors,yA=Object.getOwnPropertyDescriptor,GE=function(){if(_A&&/a/mig.flags==="gim"){var e=yA(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 gA},vA=Zc.supportsDescriptors,bA=GE,xA=Object.getOwnPropertyDescriptor,wA=Object.defineProperty,SA=TypeError,Gx=Object.getPrototypeOf,EA=/a/,IA=function(){if(!vA||!Gx)throw new SA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=bA(),n=Gx(EA),r=xA(n,"flags");return(!r||r.get!==e)&&wA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},CA=Zc,TA=Xf,LA=UE,jE=GE,PA=IA,qE=TA(jE());CA(qE,{getPolyfill:jE,implementation:LA,shim:PA});var MA=qE,kg={exports:{}},AA=T_,Xc=function(){return AA()&&!!Symbol.toStringTag},kA=Xc(),DA=_a,F0=DA("Object.prototype.toString"),L_=function(e){return kA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:F0(e)==="[object Arguments]"},WE=function(e){return L_(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&F0(e)!=="[object Array]"&&F0(e.callee)==="[object Function]"},RA=function(){return L_(arguments)}();L_.isLegacyArguments=WE;var HE=RA?L_:WE;const NA={},OA=Object.freeze(Object.defineProperty({__proto__:null,default:NA},Symbol.toStringTag,{value:"Module"})),zA=C_(OA);var Gv=typeof Map=="function"&&Map.prototype,c0=Object.getOwnPropertyDescriptor&&Gv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Kg=Gv&&c0&&typeof c0.get=="function"?c0.get:null,jx=Gv&&Map.prototype.forEach,jv=typeof Set=="function"&&Set.prototype,h0=Object.getOwnPropertyDescriptor&&jv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Jg=jv&&h0&&typeof h0.get=="function"?h0.get:null,qx=jv&&Set.prototype.forEach,FA=typeof WeakMap=="function"&&WeakMap.prototype,Sd=FA?WeakMap.prototype.has:null,BA=typeof WeakSet=="function"&&WeakSet.prototype,Ed=BA?WeakSet.prototype.has:null,VA=typeof WeakRef=="function"&&WeakRef.prototype,Wx=VA?WeakRef.prototype.deref:null,UA=Boolean.prototype.valueOf,GA=Object.prototype.toString,jA=Function.prototype.toString,qA=String.prototype.match,qv=String.prototype.slice,Du=String.prototype.replace,WA=String.prototype.toUpperCase,Hx=String.prototype.toLowerCase,ZE=RegExp.prototype.test,Zx=Array.prototype.concat,cl=Array.prototype.join,HA=Array.prototype.slice,Xx=Math.floor,B0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,f0=Object.getOwnPropertySymbols,V0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,wf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Lo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===wf||"symbol")?Symbol.toStringTag:null,XE=Object.prototype.propertyIsEnumerable,Yx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Kx(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||ZE.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Xx(-t):Xx(t);if(r!==t){var i=String(r),a=qv.call(e,i.length+1);return Du.call(i,n,"$&_")+"."+Du.call(Du.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Du.call(e,n,"$&_")}var U0=zA,Jx=U0.custom,Qx=KE(Jx)?Jx:null,ZA=function t(e,n,r,i){var a=n||{};if(Au(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Au(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=Au(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(Au(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(Au(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=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 QE(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var m=String(e);return l?Kx(e,m):m}if(typeof e=="bigint"){var w=String(e)+"n";return l?Kx(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 G0(e)?"[Array]":"[Object]";var E=hk(a,r);if(typeof i>"u")i=[];else if(JE(i,e)>=0)return"[Circular]";function T(Xe,be,Ue){if(be&&(i=HA.call(i),i.push(be)),Ue){var $e={depth:a.depth};return Au(a,"quoteStyle")&&($e.quoteStyle=a.quoteStyle),t(Xe,$e,r+1,i)}return t(Xe,a,r+1,i)}if(typeof e=="function"&&!$x(e)){var D=nk(e),k=gg(e,T);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(k.length>0?" { "+cl.call(k,", ")+" }":"")}if(KE(e)){var U=wf?Du.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):V0.call(e);return typeof e=="object"&&!wf?od(U):U}if(lk(e)){for(var q="<"+Hx.call(String(e.nodeName)),ee=e.attributes||[],V=0;V",q}if(G0(e)){if(e.length===0)return"[]";var j=gg(e,T);return E&&!ck(j)?"["+j0(j,E)+"]":"[ "+cl.call(j,", ")+" ]"}if(KA(e)){var Q=gg(e,T);return!("cause"in Error.prototype)&&"cause"in e&&!XE.call(e,"cause")?"{ ["+String(e)+"] "+cl.call(Zx.call("[cause]: "+T(e.cause),Q),", ")+" }":Q.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+cl.call(Q,", ")+" }"}if(typeof e=="object"&&c){if(Qx&&typeof e[Qx]=="function"&&U0)return U0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(rk(e)){var $=[];return jx&&jx.call(e,function(Xe,be){$.push(T(be,e,!0)+" => "+T(Xe,e))}),ew("Map",Kg.call(e),$,E)}if(sk(e)){var me=[];return qx&&qx.call(e,function(Xe){me.push(T(Xe,e))}),ew("Set",Jg.call(e),me,E)}if(ik(e))return p0("WeakMap");if(ak(e))return p0("WeakSet");if(ok(e))return p0("WeakRef");if(QA(e))return od(T(Number(e)));if(ek(e))return od(T(B0.call(e)));if($A(e))return od(UA.call(e));if(JA(e))return od(T(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Kd)return"{ [object globalThis] }";if(!YA(e)&&!$x(e)){var de=gg(e,T),re=Yx?Yx(e)===Object.prototype:e instanceof Object||e.constructor===Object,se=e instanceof Object?"":"null prototype",Ce=!re&&Lo&&Object(e)===e&&Lo in e?qv.call(Ju(e),8,-1):se?"Object":"",H=re||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",oe=H+(Ce||se?"["+cl.call(Zx.call([],Ce||[],se||[]),": ")+"] ":"");return de.length===0?oe+"{}":E?oe+"{"+j0(de,E)+"}":oe+"{ "+cl.call(de,", ")+" }"}return String(e)};function YE(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function XA(t){return Du.call(String(t),/"/g,""")}function G0(t){return Ju(t)==="[object Array]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function YA(t){return Ju(t)==="[object Date]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function $x(t){return Ju(t)==="[object RegExp]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function KA(t){return Ju(t)==="[object Error]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function JA(t){return Ju(t)==="[object String]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function QA(t){return Ju(t)==="[object Number]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function $A(t){return Ju(t)==="[object Boolean]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function KE(t){if(wf)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!V0)return!1;try{return V0.call(t),!0}catch{}return!1}function ek(t){if(!t||typeof t!="object"||!B0)return!1;try{return B0.call(t),!0}catch{}return!1}var tk=Object.prototype.hasOwnProperty||function(t){return t in this};function Au(t,e){return tk.call(t,e)}function Ju(t){return GA.call(t)}function nk(t){if(t.name)return t.name;var e=qA.call(jA.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function JE(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 QE(qv.call(t,0,e.maxStringLength),e)+r}var i=Du.call(Du.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,uk);return YE(i,"single",e)}function uk(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":"")+WA.call(e.toString(16))}function od(t){return"Object("+t+")"}function p0(t){return t+" { ? }"}function ew(t,e,n,r){var i=r?j0(n,r):cl.call(n,", ");return t+" ("+e+") {"+i+"}"}function ck(t){for(var e=0;e=0)return!1;return!0}function hk(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=cl.call(Array(t.indent+1)," ");else return null;return{base:n,prev:cl.call(Array(e+1),n)}}function j0(t,e){if(t.length===0)return"";var n=` -`+e.prev+e.base;return n+cl.call(t,","+n)+` -`+e.prev}function gg(t,e){var n=G0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=lw(e,n);if(i<55296||i>56319)return n+1;var a=lw(e,n+1);return a<56320||a>57343?n+1:n+2},m0=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}}}},uw=function(e,n){if(Nk(e)||iw(e))return m0(e);if(Ok(e)){var r=0;return{next:function(){var a=Vk(e,r),c=Bk(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(!zk&&!Fk)kg.exports=function(e){if(e!=null)return uw(e,!0)};else{var Uk=iI,Gk=sI,cw=La("Map.prototype.forEach",!0),hw=La("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var fw=La("Map.prototype.iterator",!0),pw=La("Set.prototype.iterator",!0);var dw=La("Map.prototype.@@iterator",!0)||La("Map.prototype._es6-shim iterator_",!0),mw=La("Set.prototype.@@iterator",!0)||La("Set.prototype._es6-shim iterator_",!0),jk=function(e){if(Uk(e)){if(fw)return ow(fw(e));if(dw)return dw(e);if(cw){var n=[];return cw(e,function(i,a){aw(n,[a,i])}),m0(n)}}if(Gk(e)){if(pw)return ow(pw(e));if(mw)return mw(e);if(hw){var r=[];return hw(e,function(i){aw(r,i)}),m0(r)}}};kg.exports=function(e){return jk(e)||uw(e)}}}var qk=kg.exports,gw=function(t){return t!==t},aI=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||gw(e)&&gw(n))},Wk=aI,lI=function(){return typeof Object.is=="function"?Object.is:Wk},Hk=lI,Zk=Zc,Xk=function(){var e=Hk();return Zk(Object,{is:e},{is:function(){return Object.is!==e}}),e},Yk=Zc,Kk=Xf,Jk=aI,uI=lI,Qk=Xk,cI=Kk(uI(),Object);Yk(cI,{getPolyfill:uI,implementation:Jk,shim:Qk});var $k=cI,e3=Xf,hI=_a,t3=wl,q0=t3("%ArrayBuffer%",!0),Dg=hI("ArrayBuffer.prototype.byteLength",!0),n3=hI("Object.prototype.toString"),_w=!!q0&&!Dg&&new q0(0).slice,yw=!!_w&&e3(_w),fI=Dg||yw?function(e){if(!e||typeof e!="object")return!1;try{return Dg?Dg(e):yw(e,0),!0}catch{return!1}}:q0?function(e){return n3(e)==="[object ArrayBuffer]"}:function(e){return!1},r3=Date.prototype.getDay,i3=function(e){try{return r3.call(e),!0}catch{return!1}},o3=Object.prototype.toString,s3="[object Date]",a3=Xc(),l3=function(e){return typeof e!="object"||e===null?!1:a3?i3(e):o3.call(e)===s3},W0=_a,pI=Xc(),dI,mI,H0,Z0;if(pI){dI=W0("Object.prototype.hasOwnProperty"),mI=W0("RegExp.prototype.exec"),H0={};var g0=function(){throw H0};Z0={toString:g0,valueOf:g0},typeof Symbol.toPrimitive=="symbol"&&(Z0[Symbol.toPrimitive]=g0)}var u3=W0("Object.prototype.toString"),c3=Object.getOwnPropertyDescriptor,h3="[object RegExp]",f3=pI?function(e){if(!e||typeof e!="object")return!1;var n=c3(e,"lastIndex"),r=n&&dI(n,"value");if(!r)return!1;try{mI(e,Z0)}catch(i){return i===H0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:u3(e)===h3},p3=_a,vw=p3("SharedArrayBuffer.prototype.byteLength",!0),d3=vw?function(e){if(!e||typeof e!="object")return!1;try{return vw(e),!0}catch{return!1}}:function(e){return!1},m3=Number.prototype.toString,g3=function(e){try{return m3.call(e),!0}catch{return!1}},_3=Object.prototype.toString,y3="[object Number]",v3=Xc(),b3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:v3?g3(e):_3.call(e)===y3},gI=_a,x3=gI("Boolean.prototype.toString"),w3=gI("Object.prototype.toString"),S3=function(e){try{return x3(e),!0}catch{return!1}},E3="[object Boolean]",I3=Xc(),C3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:I3&&Symbol.toStringTag in e?S3(e):w3(e)===E3},X0={exports:{}},T3=Object.prototype.toString,L3=Ov();if(L3){var P3=Symbol.prototype.toString,M3=/^Symbol\(.*\)$/,A3=function(e){return typeof e.valueOf()!="symbol"?!1:M3.test(P3.call(e))};X0.exports=function(e){if(typeof e=="symbol")return!0;if(T3.call(e)!=="[object Symbol]")return!1;try{return A3(e)}catch{return!1}}}else X0.exports=function(e){return!1};var k3=X0.exports,Y0={exports:{}},bw=typeof BigInt<"u"&&BigInt,D3=function(){return typeof bw=="function"&&typeof BigInt=="function"&&typeof bw(42)=="bigint"&&typeof BigInt(42)=="bigint"},R3=D3();if(R3){var N3=BigInt.prototype.valueOf,O3=function(e){try{return N3.call(e),!0}catch{}return!1};Y0.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:O3(e)}}else Y0.exports=function(e){return!1};var z3=Y0.exports,F3=nI,B3=b3,V3=C3,U3=k3,G3=z3,j3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(F3(e))return"String";if(B3(e))return"Number";if(V3(e))return"Boolean";if(U3(e))return"Symbol";if(G3(e))return"BigInt"},e_=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,xw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,t_;e_||(t_=function(e){return!1});var K0=e_?e_.prototype.has:null,_0=xw?xw.prototype.has:null;!t_&&!K0&&(t_=function(e){return!1});var q3=t_||function(e){if(!e||typeof e!="object")return!1;try{if(K0.call(e,K0),_0)try{_0.call(e,_0)}catch{return!0}return e instanceof e_}catch{}return!1},J0={exports:{}},W3=wl,_I=_a,H3=W3("%WeakSet%",!0),y0=_I("WeakSet.prototype.has",!0);if(y0){var v0=_I("WeakMap.prototype.has",!0);J0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(y0(e,y0),v0)try{v0(e,v0)}catch{return!0}return e instanceof H3}catch{}return!1}}else J0.exports=function(e){return!1};var Z3=J0.exports,X3=iI,Y3=sI,K3=q3,J3=Z3,Q3=function(e){if(e&&typeof e=="object"){if(X3(e))return"Map";if(Y3(e))return"Set";if(K3(e))return"WeakMap";if(J3(e))return"WeakSet"}return!1},yI=Function.prototype.toString,ff=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Q0,Rg;if(typeof ff=="function"&&typeof Object.defineProperty=="function")try{Q0=Object.defineProperty({},"length",{get:function(){throw Rg}}),Rg={},ff(function(){throw 42},null,Q0)}catch(t){t!==Rg&&(ff=null)}else ff=null;var $3=/^\s*class\b/,$0=function(e){try{var n=yI.call(e);return $3.test(n)}catch{return!1}},b0=function(e){try{return $0(e)?!1:(yI.call(e),!0)}catch{return!1}},Ng=Object.prototype.toString,e4="[object Object]",t4="[object Function]",n4="[object GeneratorFunction]",r4="[object HTMLAllCollection]",i4="[object HTML document.all class]",o4="[object HTMLCollection]",s4=typeof Symbol=="function"&&!!Symbol.toStringTag,a4=!(0 in[,]),ev=function(){return!1};if(typeof document=="object"){var l4=document.all;Ng.call(l4)===Ng.call(document.all)&&(ev=function(e){if((a4||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Ng.call(e);return(n===r4||n===i4||n===o4||n===e4)&&e("")==null}catch{}return!1})}var u4=ff?function(e){if(ev(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ff(e,null,Q0)}catch(n){if(n!==Rg)return!1}return!$0(e)&&b0(e)}:function(e){if(ev(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(s4)return b0(e);if($0(e))return!1;var n=Ng.call(e);return n!==t4&&n!==n4&&!/^\[object HTML/.test(n)?!1:b0(e)},c4=u4,h4=Object.prototype.toString,vI=Object.prototype.hasOwnProperty,f4=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),h4.call(e)==="[object Array]"?f4(e,n,i):typeof e=="string"?p4(e,n,i):d4(e,n,i)},g4=m4,_4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],x0=_4,y4=typeof globalThis>"u"?Kd:globalThis,v4=function(){for(var e=[],n=0;n"u"?Kd:globalThis,tv=b4(),Kv=Yv("String.prototype.slice"),w0=Object.getPrototypeOf,w4=Yv("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:E4(e)}return Og?S4(e):null},C4=_a,Ew=C4("ArrayBuffer.prototype.byteLength",!0),T4=fI,L4=function(e){return T4(e)?Ew?Ew(e):e.byteLength:NaN},xI=sA,Sl=_a,Iw=MA,P4=wl,Sf=qk,M4=eI,Cw=$k,Tw=HE,Lw=tI,Pw=fI,Mw=l3,Aw=f3,kw=d3,Dw=Nv,Rw=j3,Nw=Q3,Ow=I4,zw=L4,Fw=Sl("SharedArrayBuffer.prototype.byteLength",!0),Bw=Sl("Date.prototype.getTime"),S0=Object.getPrototypeOf,Vw=Sl("Object.prototype.toString"),i_=P4("%Set%",!0),nv=Sl("Map.prototype.has",!0),o_=Sl("Map.prototype.get",!0),Uw=Sl("Map.prototype.size",!0),s_=Sl("Set.prototype.add",!0),wI=Sl("Set.prototype.delete",!0),a_=Sl("Set.prototype.has",!0),zg=Sl("Set.prototype.size",!0);function Gw(t,e,n,r){for(var i=Sf(t),a;(a=i.next())&&!a.done;)if(ka(e,a.value,n,r))return wI(t,a.value),!0;return!1}function SI(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 A4(t,e,n,r,i,a){var c=SI(n);if(c!=null)return c;var l=o_(e,c),m=xI({},i,{strict:!1});return typeof l>"u"&&!nv(e,c)||!ka(r,l,m,a)?!1:!nv(t,c)&&ka(r,l,m,a)}function k4(t,e,n){var r=SI(n);return r??(a_(e,r)&&!a_(t,r))}function jw(t,e,n,r,i,a){for(var c=Sf(t),l,m;(l=c.next())&&!l.done;)if(m=l.value,ka(n,m,i,a)&&ka(r,o_(e,m),i,a))return wI(t,m),!0;return!1}function ka(t,e,n,r){var i=n||{};if(i.strict?Cw(t,e):t===e)return!0;var a=Rw(t),c=Rw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Cw(t,e):t==e;var l=r.has(t),m=r.has(e),w;if(l&&m){if(r.get(t)===r.get(e))return!0}else w={};return l||r.set(t,w),m||r.set(e,w),N4(t,e,i,r)}function qw(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 D4(t,e,n,r){if(zg(t)!==zg(e))return!1;for(var i=Sf(t),a=Sf(e),c,l,m;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")m||(m=new i_),s_(m,c.value);else if(!a_(e,c.value)){if(n.strict||!k4(t,e,c.value))return!1;m||(m=new i_),s_(m,c.value)}if(m){for(;(l=a.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Gw(m,l.value,n.strict,r))return!1}else if(!n.strict&&!a_(t,l.value)&&!Gw(m,l.value,n.strict,r))return!1;return zg(m)===0}return!0}function R4(t,e,n,r){if(Uw(t)!==Uw(e))return!1;for(var i=Sf(t),a=Sf(e),c,l,m,w,S,E;(c=i.next())&&!c.done;)if(w=c.value[0],S=c.value[1],w&&typeof w=="object")m||(m=new i_),s_(m,w);else if(E=o_(e,w),typeof E>"u"&&!nv(e,w)||!ka(S,E,n,r)){if(n.strict||!A4(t,e,w,S,n,r))return!1;m||(m=new i_),s_(m,w)}if(m){for(;(l=a.next())&&!l.done;)if(w=l.value[0],E=l.value[1],w&&typeof w=="object"){if(!jw(m,t,w,E,n,r))return!1}else if(!n.strict&&(!t.has(w)||!ka(o_(t,w),E,n,r))&&!jw(m,t,w,E,xI({},n,{strict:!1}),r))return!1;return zg(m)===0}return!0}function N4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||Vw(t)!==Vw(e)||Tw(t)!==Tw(e))return!1;var c=Lw(t),l=Lw(e);if(c!==l)return!1;var m=t instanceof Error,w=e instanceof Error;if(m!==w||(m||w)&&(t.name!==e.name||t.message!==e.message))return!1;var S=Aw(t),E=Aw(e);if(S!==E||(S||E)&&(t.source!==e.source||Iw(t)!==Iw(e)))return!1;var T=Mw(t),D=Mw(e);if(T!==D||(T||D)&&Bw(t)!==Bw(e)||n.strict&&S0&&S0(t)!==S0(e))return!1;var k=Ow(t),U=Ow(e);if(k!==U)return!1;if(k||U){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(me[i]!=de[i])return!1;for(i=me.length-1;i>=0;i--)if(a=me[i],!ka(t[a],e[a],n,r))return!1;var re=Nw(t),se=Nw(e);return re!==se?!1:re==="Set"||se==="Set"?D4(t,e,n,r):re==="Map"?R4(t,e,n,r):!0}var O4=function(e,n,r){return ka(e,n,r,M4())};const z4=Rv(O4);var F4=Object.defineProperty,rr=(t,e)=>F4(t,"name",{value:e,configurable:!0}),B4=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||!_d(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=rv(e),i=rv(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 _d(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?z4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return _d(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)}};rr(B4,"GeojsonEquality");function _d(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}rr(_d,"sameLength");function rv(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}rr(rv,"explode");var Cs=63710088e-1,EI={centimeters:Cs*100,centimetres:Cs*100,degrees:360/(2*Math.PI),feet:Cs*3.28084,inches:Cs*39.37,kilometers:Cs/1e3,kilometres:Cs/1e3,meters:Cs,metres:Cs,miles:Cs/1609.344,millimeters:Cs*1e3,millimetres:Cs*1e3,nauticalmiles:Cs/1852,radians:1,yards:Cs*1.0936},Ww={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 ml(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}rr(ml,"feature");function V4(t,e,n={}){switch(t){case"Point":return ql(e).geometry;case"LineString":return Zl(e).geometry;case"Polygon":return Jv(e).geometry;case"MultiPoint":return CI(e).geometry;case"MultiLineString":return II(e).geometry;case"MultiPolygon":return TI(e).geometry;default:throw new Error(t+" is invalid")}}rr(V4,"geometry");function ql(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(!l_(t[0])||!l_(t[1]))throw new Error("coordinates must contain numbers");return ml({type:"Point",coordinates:t},e,n)}rr(ql,"point");function U4(t,e,n={}){return P_(t.map(r=>ql(r,e)),n)}rr(U4,"points");function Jv(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;aJv(r,e)),n)}rr(G4,"polygons");function Zl(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ml({type:"LineString",coordinates:t},e,n)}rr(Zl,"lineString");function j4(t,e,n={}){return P_(t.map(r=>Zl(r,e)),n)}rr(j4,"lineStrings");function P_(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}rr(P_,"featureCollection");function II(t,e,n={}){return ml({type:"MultiLineString",coordinates:t},e,n)}rr(II,"multiLineString");function CI(t,e,n={}){return ml({type:"MultiPoint",coordinates:t},e,n)}rr(CI,"multiPoint");function TI(t,e,n={}){return ml({type:"MultiPolygon",coordinates:t},e,n)}rr(TI,"multiPolygon");function q4(t,e,n={}){return ml({type:"GeometryCollection",geometries:t},e,n)}rr(q4,"geometryCollection");function W4(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}rr(W4,"round");function LI(t,e="kilometers"){const n=EI[e];if(!n)throw new Error(e+" units is invalid");return t*n}rr(LI,"radiansToLength");function Qv(t,e="kilometers"){const n=EI[e];if(!n)throw new Error(e+" units is invalid");return t/n}rr(Qv,"lengthToRadians");function H4(t,e){return PI(Qv(t,e))}rr(H4,"lengthToDegrees");function Z4(t){let e=t%360;return e<0&&(e+=360),e}rr(Z4,"bearingToAzimuth");function PI(t){return t%(2*Math.PI)*180/Math.PI}rr(PI,"radiansToDegrees");function X4(t){return t%360*Math.PI/180}rr(X4,"degreesToRadians");function Y4(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return LI(Qv(t,e),n)}rr(Y4,"convertLength");function K4(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=Ww[e];if(!r)throw new Error("invalid original units");const i=Ww[n];if(!i)throw new Error("invalid final units");return t/r*i}rr(K4,"convertArea");function l_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}rr(l_,"isNumber");function $v(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}rr($v,"isObject");function J4(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(!l_(e))throw new Error("bbox must only contain numbers")})}rr(J4,"validateBBox");function Q4(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")}rr(Q4,"validateId");var $4=Object.defineProperty,mo=(t,e)=>$4(t,"name",{value:e,configurable:!0});function Kf(t,e,n){if(t!==null)for(var r,i,a,c,l,m,w,S=0,E=0,T,D=t.type,k=D==="FeatureCollection",U=D==="Feature",q=k?t.features.length:1,ee=0;eem||k>w||U>S){l=E,m=r,w=k,S=U,a=0;return}var q=Zl([l,E],n.properties);if(e(q,r,i,U,a)===!1)return!1;a++,l=E})===!1)return!1}}})}mo(kI,"segmentEach");function sD(t,e,n){var r=n,i=!1;return kI(t,function(a,c,l,m,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,m,w),i=!0}),r}mo(sD,"segmentReduce");function DI(t,e){if(!t)throw new Error("geojson is required");M_(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 l=0;lcD(t,"name",{value:e,configurable:!0});function t1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Kf(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=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:I=h,h=.5*(I-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var k=m(T);let U,q;function ee(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function V(){if(q==null&&(q=!1,ee())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const _=4*p;o.fillStyle=`rgb(${_},${_+1},${_+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){q=!0;break}}}return q||!1}function j(u,o,h,p){const _=new k(u,o,h,p);return function(b){return _.solve(b)}}const Q=j(.25,.1,.25,1);function $(u,o,h){return Math.min(h,Math.max(o,u))}function me(u,o,h){const p=h-o,_=((u-o)%p+p)%p+o;return _===o?h:_}function de(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let re=1;function se(u,o,h){const p={};for(const _ in u)p[_]=o.call(h||this,u[_],_,u);return p}function Ce(u,o,h){const p={};for(const _ in u)o.call(h||this,u[_],_,u)&&(p[_]=u[_]);return p}function H(u){return Array.isArray(u)?u.map(H):typeof u=="object"&&u?se(u,H):u}const oe={};function Xe(u){oe[u]||(typeof console<"u"&&console.warn(u),oe[u]=!0)}function be(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function Ue(u){let o=0;for(let h,p,_=0,b=u.length,x=b-1;_"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(u,{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 I=x.startsWith("BGR"),P=new Uint8ClampedArray(p*_*4);if(yield b.copyTo(P,function(A,N,O,G,Z){const Y=4*Math.max(-N,0),ne=(Math.max(0,O)-O)*G*4+Y,ce=4*G,ge=Math.max(0,N),Re=Math.max(0,O);return{rect:{x:ge,y:Re,width:Math.min(A.width,N+G)-ge,height:Math.min(A.height,O+Z)-Re},layout:[{offset:ne,stride:ce}]}}(u,o,h,p,_)),I)for(let A=0;A$e(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,gr=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=mn(u.url);if(p)return p(u,o);if($e(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Bn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test($r())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(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:$r(),signal:_.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 ir(x.status,x.statusText,p.url,A)}let I;I=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const P=yield I;if(_.signal.aborted)throw Fn();return{data:P,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(u,o);if($e(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Bn},o)}var h;return function(p,_){return new Promise((b,x)=>{const I=new XMLHttpRequest;I.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(I.responseType="arraybuffer");for(const P in p.headers)I.setRequestHeader(P,p.headers[P]);p.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=p.credentials==="include",I.onerror=()=>{x(new Error(I.statusText))},I.onload=()=>{if(!_.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let P=I.response;if(p.type==="json")try{P=JSON.parse(I.response)}catch(A){return void x(A)}b({data:P,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const P=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});x(new ir(I.status,I.statusText,p.url,P))}},_.signal.addEventListener("abort",()=>{I.abort(),x(Fn())}),I.send(p.body)})}(u,o)};function ur(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function or(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function ie(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Te{constructor(o,h={}){de(this,h),this.type=o}}class _t extends Te{constructor(o,h={}){super("error",de({error:o},h))}}class xn{on(o,h){return this._listeners=this._listeners||{},or(o,h,this._listeners),this}off(o,h){return ie(o,h,this._listeners),ie(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},or(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Te(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const I of _)I.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const I of b)ie(p,I,this._oneTimeListeners),I.call(this,o);const x=this._eventedParent;x&&(de(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof _t&&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 Oe={$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 en=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Dr(u,o){const h={};for(const p in u)p!=="ref"&&(h[p]=u[p]);return en.forEach(p=>{p in o&&(h[p]=o[p])}),h}function fn(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let h=0;h`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Ee=[ei,ft,on,nn,Rr,Vr,$o,K(tn),he,B,W];function J(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!J(u.itemType,o.itemType))&&(typeof u.N!="number"||u.N===o.N))return null}else{if(u.kind===o.kind)return null;if(u.kind==="value"){for(const h of Ee)if(!J(h,o))return null}}return`Expected ${ae(u)} but found ${ae(o)} instead.`}function Ie(u,o){return o.some(h=>h.kind===u.kind)}function ye(u,o){return o.some(h=>h==="null"?u===null:h==="array"?Array.isArray(u):h==="object"?u&&!Array.isArray(u)&&typeof u=="object":h===typeof u)}function De(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const Ge=.96422,He=.82521,Ye=4/29,Mt=6/29,Rt=3*Mt*Mt,Yt=Mt*Mt*Mt,Qt=Math.PI/180,En=180/Math.PI;function Xn(u){return(u%=360)<0&&(u+=360),u}function cr([u,o,h,p]){let _,b;const x=cn((.2225045*(u=ti(u))+.7168786*(o=ti(o))+.0606169*(h=ti(h)))/1);u===o&&o===h?_=b=x:(_=cn((.4360747*u+.3850649*o+.1430804*h)/Ge),b=cn((.0139322*u+.0971045*o+.7141733*h)/He));const I=116*x-16;return[I<0?0:I,500*(_-x),200*(x-b),p]}function ti(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function cn(u){return u>Yt?Math.pow(u,1/3):u/Rt+Ye}function Ir([u,o,h,p]){let _=(u+16)/116,b=isNaN(o)?_:_+o/500,x=isNaN(h)?_:_-h/200;return _=1*eo(_),b=Ge*eo(b),x=He*eo(x),[ai(3.1338561*b-1.6168667*_-.4906146*x),ai(-.9787684*b+1.9161415*_+.033454*x),ai(.0719453*b-.2289914*_+1.4052427*x),p]}function ai(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function eo(u){return u>Mt?u*u*u:Rt*(u-Ye)}function go(u){return parseInt(u.padEnd(2,u),16)/255}function wi(u,o){return Us(o?u/100:u,0,1)}function Us(u,o,h){return Math.min(Math.max(o,u),h)}function um(u){return!u.some(Number.isNaN)}const Y_={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 qn{constructor(o,h,p,_=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=_,b||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[o,h,p,_]))}static parse(o){if(o instanceof qn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=Y_[p];if(_){const[x,I,P]=_;return[x/255,I/255,P/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 I=1;return[go(p.slice(I,I+=x)),go(p.slice(I,I+=x)),go(p.slice(I,I+=x)),go(p.slice(I,I+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[I,P,A,N,O,G,Z,Y,ne,ce,ge,Re]=x,ve=[N||" ",Z||" ",ce].join("");if(ve===" "||ve===" /"||ve===",,"||ve===",,,"){const Le=[A,G,ne].join(""),Ke=Le==="%%%"?100:Le===""?255:0;if(Ke){const Je=[Us(+P/Ke,0,1),Us(+O/Ke,0,1),Us(+Y/Ke,0,1),ge?wi(+ge,Re):1];if(um(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,I,P,A,N,O,G,Z,Y]=b,ne=[P||" ",N||" ",G].join("");if(ne===" "||ne===" /"||ne===",,"||ne===",,,"){const ce=[+I,Us(+A,0,100),Us(+O,0,100),Z?wi(+Z,Y):1];if(um(ce))return function([ge,Re,ve,Le]){function Ke(Je){const wt=(Je+ge/30)%12,Tt=Re*Math.min(ve,1-ve);return ve-Tt*Math.max(-1,Math.min(wt-3,9-wt,1))}return ge=Xn(ge),Re/=100,ve/=100,[Ke(0),Ke(8),Ke(4),Le]}(ce)}}}(o);return h?new qn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:_}=this,b=_||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,_])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,_,b]=cr(o),x=Math.sqrt(p*p+_*_);return[Math.round(1e4*x)?Xn(Math.atan2(_,p)*En):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",cr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,_]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${_})`}}qn.black=new qn(0,0,0,1),qn.white=new qn(1,1,1,1),qn.transparent=new qn(0,0,0,0),qn.red=new qn(1,0,0,1);class op{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 sp{constructor(o,h,p,_,b){this.text=o,this.image=h,this.scale=p,this.fontStack=_,this.textColor=b}}class Ro{constructor(o){this.sections=o}static fromString(o){return new Ro([new sp(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 Ro?o:Ro.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class _o{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof _o)return o;if(typeof o=="number")return new _o([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 _o(o)}}toString(){return JSON.stringify(this.values)}}const ec=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class es{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof es)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&u<=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 [${[u,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,h,p]:[u,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function nh(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof qn||u instanceof op||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts)return!0;if(Array.isArray(u)){for(const o of u)if(!nh(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!nh(u[o]))return!1;return!0}return!1}function ni(u){if(u===null)return ei;if(typeof u=="string")return on;if(typeof u=="boolean")return nn;if(typeof u=="number")return ft;if(u instanceof qn)return Rr;if(u instanceof op)return xa;if(u instanceof Ro)return Vr;if(u instanceof _o)return he;if(u instanceof es)return W;if(u instanceof ts)return B;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const _=ni(p);if(h){if(h===_)continue;h=tn;break}h=_}return K(h||tn,o)}return $o}function tc(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof qn||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts?u.toString():JSON.stringify(u)}class Za{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(!nh(o[1]))return h.error("invalid value");const p=o[1];let _=ni(p);const b=h.expectedType;return _.kind!=="array"||_.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(_=b),new Za(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class _r{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const rh={string:on,number:ft,boolean:nn,object:$o};class No{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,_=1;const b=o[0];if(b==="array"){let I,P;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in rh)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);I=rh[A],_++}else I=tn;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);P=o[2],_++}p=K(I,P)}else{if(!rh[b])throw new Error(`Types doesn't contain name = ${b}`);p=rh[b]}const x=[];for(;_o.outputDefined())}}const ih={"to-boolean":nn,"to-color":Rr,"to-number":ft,"to-string":on};class Gs{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(!ih[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 _=ih[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:uu(h[0],h[1],h[2],h[3]),!p))return new qn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new _r(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 _=_o.parse(h);if(_)return _}throw new _r(`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 _=es.parse(h);if(_)return _}throw new _r(`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 _=Number(h);if(!isNaN(_))return _}throw new _r(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ro.fromString(tc(this.args[0].evaluate(o)));case"resolvedImage":return ts.fromString(tc(this.args[0].evaluate(o)));default:return tc(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const nc=["Unknown","Point","LineString","Polygon"];class Wn{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"?nc[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]=qn.parse(o)),h}}class oh{constructor(o,h,p=[],_,b=new Tl,x=[]){this.registry=o,this.path=p,this.key=p.map(I=>`[${I}]`).join(""),this.scope=b,this.errors=x,this.expectedType=_,this._isConstant=h}parse(o,h,p,_,b={}){return h?this.concat(h,p,_)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(_,b,x){return x==="assert"?new No(b,[_]):x==="coerce"?new Gs(b,[_]):_}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 _=o[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[_];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const I=this.expectedType,P=x.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||P.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(I.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(I,P))return null}else x=p(x,I,h.typeAnnotation||"coerce");else x=p(x,I,h.typeAnnotation||"coerce");else x=p(x,I,h.typeAnnotation||"coerce");else x=p(x,I,h.typeAnnotation||"assert")}if(!(x instanceof Za)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const I=new Wn;try{x=new Za(x.type,x.evaluate(I))}catch(P){return this.error(P.message),null}}return x}return this.error(`Unknown expression "${_}". 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 _=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new oh(this.registry,this._isConstant,_,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new $i(p,o))}checkSubtype(o,h){const p=J(o,h);return p&&this.error(p),p}}class cu{constructor(o,h,p){this.type=xa,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 _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,nn);if(!_)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,nn);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,on),!x)?null:new cu(_,b,x)}evaluate(o){return new op(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 Xa=8192;function sh(u,o){u[0]=Math.min(u[0],o[0]),u[1]=Math.min(u[1],o[1]),u[2]=Math.max(u[2],o[0]),u[3]=Math.max(u[3],o[1])}function rc(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function K_(u,o){const h=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,_=Math.pow(2,o.z);return[Math.round(h*_*Xa),Math.round(p*_*Xa)]}function cm(u,o,h){const p=u[0]-o[0],_=u[1]-o[1],b=u[0]-h[0],x=u[1]-h[1];return p*x-b*_==0&&p*b<=0&&_*x<=0}function ah(u,o){let h=!1;for(let x=0,I=o.length;x(p=u)[1]!=(b=P[A+1])[1]>p[1]&&p[0]<(b[0]-_[0])*(p[1]-_[1])/(b[1]-_[1])+_[0]&&(h=!h)}}var p,_,b;return h}function J_(u,o){for(let h=0;h0&&I<0||x<0&&I>0}function Q_(u,o,h){for(const A of h)for(let N=0;Nh[2]){const _=.5*p;let b=u[0]-h[0]>_?-p:h[0]-u[0]>_?p:0;b===0&&(b=u[0]-h[2]>_?-p:h[2]-u[0]>_?p:0),u[0]+=b}sh(o,u)}function uh(u,o,h,p){const _=Math.pow(2,p.z)*Xa,b=[p.x*Xa,p.y*Xa],x=[];for(const I of u)for(const P of I){const A=[P.x+b[0],P.y+b[1]];mm(A,o,h,_),x.push(A)}return x}function gm(u,o,h,p){const _=Math.pow(2,p.z)*Xa,b=[p.x*Xa,p.y*Xa],x=[];for(const P of u){const A=[];for(const N of P){const O=[N.x+b[0],N.y+b[1]];sh(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=_/2){(I=o)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const P of x)for(const A of P)mm(A,o,h,_)}var I;return x}class Ll{constructor(o,h){this.type=nn,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(nh(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const _=[];for(const b of p.features){const{type:x,coordinates:I}=b.geometry;x==="Polygon"&&_.push(I),x==="MultiPolygon"&&_.push(...I)}if(_.length)return new Ll(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Ll(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Ll(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 _=[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 I=lh(p.coordinates,b,x),P=uh(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!ah(A,I))return!1}if(p.type==="MultiPolygon"){const I=dm(p.coordinates,b,x),P=uh(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!J_(A,I))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const _=[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 I=lh(p.coordinates,b,x),P=gm(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!fm(A,I))return!1}if(p.type==="MultiPolygon"){const I=dm(p.coordinates,b,x),P=gm(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!pm(A,I))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ch{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 ch(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 Oo{constructor(o,h,p,_){this.name=o,this.type=h,this._evaluate=p,this.args=_}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],_=Oo.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(_)?_[0]:_.type,x=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,I=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let P=null;for(const[A,N]of I){P=new oh(h.registry,ic,h.path,null,h.scope);const O=[];let G=!1;for(let Z=1;Z{return G=O,Array.isArray(G)?`(${G.map(ae).join(", ")})`:`(${ae(G.type)}...)`;var G}).join(" | "),N=[];for(let O=1;O{h=o?h&&ic(p):h&&p instanceof Za}),!!h&&hh(u)&&sc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function hh(u){if(u instanceof Oo&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof Ll)return!1;let o=!0;return u.eachChild(h=>{o&&!hh(h)&&(o=!1)}),o}function oc(u){if(u instanceof Oo&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!oc(h)&&(o=!1)}),o}function sc(u,o){if(u instanceof Oo&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!sc(p,o)&&(h=!1)}),h}function ac(u,o){const h=u.length-1;let p,_,b=0,x=h,I=0;for(;b<=x;)if(I=Math.floor((b+x)/2),p=u[I],_=u[I+1],p<=o){if(I===h||o<_)return I;b=I+1}else{if(!(p>o))throw new _r("Input is not a number.");x=I-1}return 0}class lc{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,b]of p)this.labels.push(_),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,ft);if(!p)return null;const _=[];let b=null;h.expectedType&&h.expectedType.kind!=="value"&&(b=h.expectedType);for(let x=1;x=I)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=h.parse(P,N,b);if(!O)return null;b=b||O.type,_.push([I,O])}return new lc(b,p,_)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;return _>=h[b-1]?p[b-1].evaluate(o):p[ac(h,_)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function $_(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var ey=_m;function _m(u,o,h,p){this.cx=3*u,this.bx=3*(h-u)-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=u,this.p1y=o,this.p2x=h,this.p2y=p}_m.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,o){if(o===void 0&&(o=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:I=h,h=.5*(I-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var ty=$_(ey);function Pl(u,o,h){return u+h*(o-u)}function fh(u,o,h){return u.map((p,_)=>Pl(p,o[_],h))}const to={number:Pl,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[_,b,x,I]=fh(u.rgb,o.rgb,h);return new qn(_,b,x,I,!1)}case"hcl":{const[_,b,x,I]=u.hcl,[P,A,N,O]=o.hcl;let G,Z;if(isNaN(_)||isNaN(P))isNaN(_)?isNaN(P)?G=NaN:(G=P,x!==1&&x!==0||(Z=A)):(G=_,N!==1&&N!==0||(Z=b));else{let Re=P-_;P>_&&Re>180?Re-=360:P<_&&_-P>180&&(Re+=360),G=_+h*Re}const[Y,ne,ce,ge]=function([Re,ve,Le,Ke]){return Re=isNaN(Re)?0:Re*Qt,Ir([Le,Math.cos(Re)*ve,Math.sin(Re)*ve,Ke])}([G,Z??Pl(b,A,h),Pl(x,N,h),Pl(I,O,h)]);return new qn(Y,ne,ce,ge,!1)}case"lab":{const[_,b,x,I]=Ir(fh(u.lab,o.lab,h));return new qn(_,b,x,I,!1)}}},array:fh,padding:function(u,o,h){return new _o(fh(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,_=o.values;if(p.length!==_.length)throw new _r(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof N!="number"||N<0||N>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={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,ft),!b)return null;const I=[];let P=null;p==="interpolate-hcl"||p==="interpolate-lab"?P=Rr:h.expectedType&&h.expectedType.kind!=="value"&&(P=h.expectedType);for(let A=0;A=N)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',G);const Y=h.parse(O,Z,P);if(!Y)return null;P=P||Y.type,I.push([N,Y])}return De(P,ft)||De(P,Rr)||De(P,he)||De(P,W)||De(P,K(ft))?new zi(P,p,_,b,I):h.error(`Type ${ae(P)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;if(_>=h[b-1])return p[b-1].evaluate(o);const x=ac(h,_),I=zi.interpolationFactor(this.interpolation,_,h[x],h[x+1]),P=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return to[this.type.kind](P,A,I);case"interpolate-hcl":return to.color(P,A,I,"hcl");case"interpolate-lab":return to.color(P,A,I,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function On(u,o,h,p){const _=p-h,b=u-h;return _===0?0:o===1?b/_:(Math.pow(o,b)-1)/(Math.pow(o,_)-1)}class ph{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 _=h.expectedType;_&&_.kind!=="value"&&(p=_);const b=[];for(const I of o.slice(1)){const P=h.parse(I,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!P)return null;p=p||P.type,b.push(P)}if(!p)throw new Error("No output type");const x=_&&b.some(I=>J(_,I.type));return new ph(x?tn:p,b)}evaluate(o){let h,p=null,_=0;for(const b of this.args)if(_++,p=b.evaluate(o),p&&p instanceof ts&&!p.available&&(h||(h=p.name),p=null,_===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 dh{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 _r(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new _r(`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 lp{constructor(o,h){this.type=nn,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,tn),_=h.parse(o[2],2,tn);return p&&_?Ie(p.type,[nn,on,ft,ei,tn])?new lp(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ae(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!ye(h,["boolean","string","number","null"]))throw new _r(`Expected first argument to be of type boolean, string, number or null, but found ${ae(ni(h))} instead.`);if(!ye(p,["string","array"]))throw new _r(`Expected second argument to be of type array or string, but found ${ae(ni(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class mh{constructor(o,h,p){this.type=ft,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,tn),_=h.parse(o[2],2,tn);if(!p||!_)return null;if(!Ie(p.type,[nn,on,ft,ei,tn]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ae(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new mh(p,_,b):null}return new mh(p,_)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!ye(h,["boolean","string","number","null"]))throw new _r(`Expected first argument to be of type boolean, string, number or null, but found ${ae(ni(h))} instead.`);if(!ye(p,["string","array"]))throw new _r(`Expected second argument to be of type array or string, but found ${ae(ni(p))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(o);return p.indexOf(h,_)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class up{constructor(o,h,p,_,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=_,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,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,ni(Y)))return null}else p=ni(Y);if(b[String(Y)]!==void 0)return G.error("Branch labels must be unique.");b[String(Y)]=x.length}const Z=h.parse(O,A,_);if(!Z)return null;_=_||Z.type,x.push(Z)}const I=h.parse(o[1],1,tn);if(!I)return null;const P=h.parse(o[o.length-1],o.length-1,_);return P?I.type.kind!=="value"&&h.concat(1).checkSubtype(p,I.type)?null:new up(p,_,I,b,x,P):null}evaluate(o){const h=this.input.evaluate(o);return(ni(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 cp{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 _=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class gh{constructor(o,h,p,_){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=_}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,tn),_=h.parse(o[2],2,ft);if(!p||!_)return null;if(!Ie(p.type,[K(tn),on,tn]))return h.error(`Expected first argument to be of type array or string, but found ${ae(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new gh(p.type,p,_,b):null}return new gh(p.type,p,_)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!ye(h,["string","array"]))throw new _r(`Expected first argument to be of type array or string, but found ${ae(ni(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(o);return h.slice(p,_)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function ym(u,o){return u==="=="||u==="!="?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 vm(u,o,h,p){return p.compare(o,h)===0}function hu(u,o,h){const p=u!=="=="&&u!=="!=";return class NI{constructor(b,x,I){this.type=nn,this.lhs=b,this.rhs=x,this.collator=I,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 I=b[0];let P=x.parse(b[1],1,tn);if(!P)return null;if(!ym(I,P.type))return x.concat(1).error(`"${I}" comparisons are not supported for type '${ae(P.type)}'.`);let A=x.parse(b[2],2,tn);if(!A)return null;if(!ym(I,A.type))return x.concat(2).error(`"${I}" comparisons are not supported for type '${ae(A.type)}'.`);if(P.type.kind!==A.type.kind&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${ae(P.type)}' and '${ae(A.type)}'.`);p&&(P.type.kind==="value"&&A.type.kind!=="value"?P=new No(A.type,[P]):P.type.kind!=="value"&&A.type.kind==="value"&&(A=new No(P.type,[A])));let N=null;if(b.length===4){if(P.type.kind!=="string"&&A.type.kind!=="string"&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,xa),!N)return null}return new NI(P,A,N)}evaluate(b){const x=this.lhs.evaluate(b),I=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const P=ni(x),A=ni(I);if(P.kind!==A.kind||P.kind!=="string"&&P.kind!=="number")throw new _r(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${P.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const P=ni(x),A=ni(I);if(P.kind!=="string"||A.kind!=="string")return o(b,x,I)}return this.collator?h(b,x,I,this.collator.evaluate(b)):o(b,x,I)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const ny=hu("==",function(u,o,h){return o===h},vm),ry=hu("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!vm(0,o,h,p)}),iy=hu("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),sy=hu("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),ay=hu(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class hp{constructor(o,h,p,_,b){this.type=on,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ft);if(!p)return null;const _=o[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let b=null;if(_.locale&&(b=h.parse(_.locale,1,on),!b))return null;let x=null;if(_.currency&&(x=h.parse(_.currency,1,on),!x))return null;let I=null;if(_["min-fraction-digits"]&&(I=h.parse(_["min-fraction-digits"],1,ft),!I))return null;let P=null;return _["max-fraction-digits"]&&(P=h.parse(_["max-fraction-digits"],1,ft),!P)?null:new hp(p,b,x,I,P)}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 _h{constructor(o){this.type=Vr,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 _=[];let b=!1;for(let x=1;x<=o.length-1;++x){const I=o[x];if(b&&typeof I=="object"&&!Array.isArray(I)){b=!1;let P=null;if(I["font-scale"]&&(P=h.parse(I["font-scale"],1,ft),!P))return null;let A=null;if(I["text-font"]&&(A=h.parse(I["text-font"],1,K(on)),!A))return null;let N=null;if(I["text-color"]&&(N=h.parse(I["text-color"],1,Rr),!N))return null;const O=_[_.length-1];O.scale=P,O.font=A,O.textColor=N}else{const P=h.parse(o[x],1,tn);if(!P)return null;const A=P.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,_.push({content:P,scale:null,font:null,textColor:null})}}return new _h(_)}evaluate(o){return new Ro(this.sections.map(h=>{const p=h.content.evaluate(o);return ni(p)===B?new sp("",p,null,null,null):new sp(tc(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 fp{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,on);return p?new fp(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=ts.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class pp{constructor(o){this.type=ft,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 ${ae(p.type)} instead.`):new pp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new _r(`Expected value to be of type string or array, but found ${ae(ni(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const fu={"==":ny,"!=":ry,">":oy,"<":iy,">=":ay,"<=":sy,array:No,at:ap,boolean:No,case:cp,coalesce:ph,collator:cu,format:_h,image:fp,in:lp,"index-of":mh,interpolate:zi,"interpolate-hcl":zi,"interpolate-lab":zi,length:pp,let:dh,literal:Za,match:up,number:No,"number-format":hp,object:No,slice:gh,step:lc,string:No,"to-boolean":Gs,"to-color":Gs,"to-number":Gs,"to-string":Gs,var:ch,within:Ll};function bm(u,[o,h,p,_]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const b=_?_.evaluate(u):1,x=uu(o,h,p,b);if(x)throw new _r(x);return new qn(o/255,h/255,p/255,b,!1)}function xm(u,o){return u in o}function dp(u,o){const h=o[u];return h===void 0?null:h}function Ml(u){return{type:u}}function wm(u){return{result:"success",value:u}}function pu(u){return{result:"error",value:u}}function du(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function Sm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function mp(u){return!!u.expression&&u.expression.interpolated}function Ln(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function yh(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function ly(u){return u}function Em(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",_=p||!(p||u.property!==void 0),b=u.type||(mp(o)?"exponential":"interval");if(h||o.type==="padding"){const N=h?qn.parse:_o.parse;(u=Qo({},u)).stops&&(u.stops=u.stops.map(O=>[O[0],N(O[1])])),u.default=N(u.default?u.default:o.default)}if(u.colorSpace&&(x=u.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var x;let I,P,A;if(b==="exponential")I=In;else if(b==="interval")I=uy;else if(b==="categorical"){I=Ur,P=Object.create(null);for(const N of u.stops)P[N[0]]=N[1];A=typeof u.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);I=gp}if(p){const N={},O=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},ne)=>In({stops:G,base:u.base},o,Y).evaluate(Y,ne)}}if(_){const N=b==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:zi.interpolationFactor.bind(void 0,N),zoomStops:u.stops.map(O=>O[0]),evaluate:({zoom:O})=>I(u,o,O,P,A)}}return{kind:"source",evaluate(N,O){const G=O&&O.properties?O.properties[u.property]:void 0;return G===void 0?uc(u.default,o.default):I(u,o,G,P,A)}}}function uc(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function Ur(u,o,h,p,_){return uc(typeof h===_?p[h]:void 0,u.default,o.default)}function uy(u,o,h){if(Ln(h)!=="number")return uc(u.default,o.default);const p=u.stops.length;if(p===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[p-1][0])return u.stops[p-1][1];const _=ac(u.stops.map(b=>b[0]),h);return u.stops[_][1]}function In(u,o,h){const p=u.base!==void 0?u.base:1;if(Ln(h)!=="number")return uc(u.default,o.default);const _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];const b=ac(u.stops.map(N=>N[0]),h),x=function(N,O,G,Z){const Y=Z-G,ne=N-G;return Y===0?0:O===1?ne/Y:(Math.pow(O,ne)-1)/(Math.pow(O,Y)-1)}(h,p,u.stops[b][0],u.stops[b+1][0]),I=u.stops[b][1],P=u.stops[b+1][1],A=to[o.type]||ly;return typeof I.evaluate=="function"?{evaluate(...N){const O=I.evaluate.apply(void 0,N),G=P.evaluate.apply(void 0,N);if(O!==void 0&&G!==void 0)return A(O,G,x,u.colorSpace)}}:A(I,P,x,u.colorSpace)}function gp(u,o,h){switch(o.type){case"color":h=qn.parse(h);break;case"formatted":h=Ro.fromString(h.toString());break;case"resolvedImage":h=ts.fromString(h.toString());break;case"padding":h=_o.parse(h);break;default:Ln(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return uc(h,u.default,o.default)}Oo.register(fu,{error:[{kind:"error"},[on],(u,[o])=>{throw new _r(o.evaluate(u))}],typeof:[on,[tn],(u,[o])=>ae(ni(o.evaluate(u)))],"to-rgba":[K(ft,4),[Rr],(u,[o])=>{const[h,p,_,b]=o.evaluate(u).rgb;return[255*h,255*p,255*_,b]}],rgb:[Rr,[ft,ft,ft],bm],rgba:[Rr,[ft,ft,ft,ft],bm],has:{type:nn,overloads:[[[on],(u,[o])=>xm(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>xm(o.evaluate(u),h.evaluate(u))]]},get:{type:tn,overloads:[[[on],(u,[o])=>dp(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>dp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[tn,[on],(u,[o])=>dp(o.evaluate(u),u.featureState||{})],properties:[$o,[],u=>u.properties()],"geometry-type":[on,[],u=>u.geometryType()],id:[tn,[],u=>u.id()],zoom:[ft,[],u=>u.globals.zoom],"heatmap-density":[ft,[],u=>u.globals.heatmapDensity||0],"line-progress":[ft,[],u=>u.globals.lineProgress||0],accumulated:[tn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ft,Ml(ft),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[ft,Ml(ft),(u,o)=>{let h=1;for(const p of o)h*=p.evaluate(u);return h}],"-":{type:ft,overloads:[[[ft,ft],(u,[o,h])=>o.evaluate(u)-h.evaluate(u)],[[ft],(u,[o])=>-o.evaluate(u)]]},"/":[ft,[ft,ft],(u,[o,h])=>o.evaluate(u)/h.evaluate(u)],"%":[ft,[ft,ft],(u,[o,h])=>o.evaluate(u)%h.evaluate(u)],ln2:[ft,[],()=>Math.LN2],pi:[ft,[],()=>Math.PI],e:[ft,[],()=>Math.E],"^":[ft,[ft,ft],(u,[o,h])=>Math.pow(o.evaluate(u),h.evaluate(u))],sqrt:[ft,[ft],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))],log2:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ft,[ft],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ft,[ft],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ft,[ft],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ft,[ft],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ft,[ft],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ft,[ft],(u,[o])=>Math.atan(o.evaluate(u))],min:[ft,Ml(ft),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[ft,Ml(ft),(u,o)=>Math.max(...o.map(h=>h.evaluate(u)))],abs:[ft,[ft],(u,[o])=>Math.abs(o.evaluate(u))],round:[ft,[ft],(u,[o])=>{const h=o.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[ft,[ft],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ft,[ft],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[nn,[on,tn],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[nn,[tn],(u,[o])=>u.id()===o.value],"filter-type-==":[nn,[on],(u,[o])=>u.geometryType()===o.value],"filter-<":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[nn,[tn],(u,[o])=>o.value in u.properties()],"filter-has-id":[nn,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[nn,[K(on)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[nn,[K(tn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[nn,[on,K(tn)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[nn,[on,K(tn)],(u,[o,h])=>function(p,_,b,x){for(;b<=x;){const I=b+x>>1;if(_[I]===p)return!0;_[I]>p?x=I-1:b=I+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Ml(nn),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Ml(nn),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[nn,[nn],(u,[o])=>!o.evaluate(u)],"is-supported-script":[nn,[on],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[on,[on],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[on,[on],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[on,Ml(tn),(u,o)=>o.map(h=>tc(h.evaluate(u))).join("")],"resolved-locale":[on,[xa],(u,[o])=>o.evaluate(u).resolvedLocale()]});class sr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new Wn,this._defaultValue=h?(p=h).type==="color"&&yh(p.default)?new qn(0,0,0,0):p.type==="color"?qn.parse(p.default)||null:p.type==="padding"?_o.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?es.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,_,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,_,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const I=this.expression.evaluate(this._evaluator);if(I==null||typeof I=="number"&&I!=I)return this._defaultValue;if(this._enumValues&&!(I in this._enumValues))throw new _r(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(I)} instead.`);return I}catch(I){return this._warningHistory[I.message]||(this._warningHistory[I.message]=!0,typeof console<"u"&&console.warn(I.message)),this._defaultValue}}}function $n(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in fu}function Al(u,o){const h=new oh(fu,ic,[],o?function(_){const b={color:Rr,string:on,number:ft,enum:on,boolean:nn,formatted:Vr,padding:he,resolvedImage:B,variableAnchorOffsetCollection:W};return _.type==="array"?K(b[_.value]||tn,_.length):b[_.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?wm(new sr(p,o)):pu(h.errors)}class vh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!oc(h.expression)}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}}class _p{constructor(o,h,p,_){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!oc(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}interpolationFactor(o,h,p){return this.interpolationType?zi.interpolationFactor(this.interpolationType,o,h,p):0}}function Im(u,o){const h=Al(u,o);if(h.result==="error")return h;const p=h.value.expression,_=hh(p);if(!_&&!du(o))return pu([new $i("","data expressions not supported")]);const b=sc(p,["zoom"]);if(!b&&!Sm(o))return pu([new $i("","zoom expressions not supported")]);const x=xh(p);return x||b?x instanceof $i?pu([x]):x instanceof zi&&!mp(o)?pu([new $i("",'"interpolate" expressions cannot be used with this property')]):wm(x?new _p(_?"camera":"composite",h.value,x.labels,x instanceof zi?x.interpolation:void 0):new vh(_?"constant":"source",h.value)):pu([new $i("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class bh{constructor(o,h){this._parameters=o,this._specification=h,Qo(this,Em(this._parameters,this._specification))}static deserialize(o){return new bh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function xh(u){let o=null;if(u instanceof dh)o=xh(u.result);else if(u instanceof ph){for(const h of u.args)if(o=xh(h),o)break}else(u instanceof lc||u instanceof zi)&&u.input instanceof Oo&&u.input.name==="zoom"&&(o=u);return o instanceof $i||u.eachChild(h=>{const p=xh(h);p instanceof $i?o=p:!o&&p?o=new $i("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new $i("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function wh(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const o of u.slice(1))if(!wh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Cm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Sh(u){if(u==null)return{filter:()=>!0,needGeometry:!1};wh(u)||(u=Ih(u));const o=Al(u,Cm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>o.value.evaluate(h,p,{},_),needGeometry:Eh(u)}}function Tm(u,o){return uo?1:0}function Eh(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?yp(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(Ih))):o==="all"?["all"].concat(u.slice(1).map(Ih)):o==="none"?["all"].concat(u.slice(1).map(Ih).map(Ch)):o==="in"?Lm(u[1],u.slice(2)):o==="!in"?Ch(Lm(u[1],u.slice(2))):o==="has"?Pm(u[1]):o==="!has"?Ch(Pm(u[1])):o!=="within"||u;var h}function yp(u,o,h){switch(u){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,u,o]}}function Lm(u,o){if(o.length===0)return!1;switch(u){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",u,["literal",o.sort(Tm)]]:["filter-in-small",u,["literal",o]]}}function Pm(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Ch(u){return["!",u]}function vp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let _="[";for(const b of u)_+=`${vp(b)},`;return`${_}]`}const h=Object.keys(u).sort();let p="{";for(let _=0;_p.maximum?[new at(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Am(u){const o=u.valueSpec,h=Cr(u.value.type);let p,_,b,x={};const I=h!=="categorical"&&u.value.property===void 0,P=!I,A=Ln(u.value.stops)==="array"&&Ln(u.value.stops[0])==="array"&&Ln(u.value.stops[0][0])==="object",N=no({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(Z){if(h==="identity")return[new at(Z.key,Z.value,'identity function may not have a "stops" property')];let Y=[];const ne=Z.value;return Y=Y.concat(bp({key:Z.key,value:ne,valueSpec:Z.valueSpec,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,arrayElementValidator:O})),Ln(ne)==="array"&&ne.length===0&&Y.push(new at(Z.key,ne,"array must have at least one stop")),Y},default:function(Z){return Z.validateSpec({key:Z.key,value:Z.value,valueSpec:o,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec})}}});return h==="identity"&&I&&N.push(new at(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||N.push(new at(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!mp(u.valueSpec)&&N.push(new at(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(P&&!du(u.valueSpec)?N.push(new at(u.key,u.value,"property functions not supported")):I&&!Sm(u.valueSpec)&&N.push(new at(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!A||u.value.property!==void 0||N.push(new at(u.key,u.value,'"property" property is required')),N;function O(Z){let Y=[];const ne=Z.value,ce=Z.key;if(Ln(ne)!=="array")return[new at(ce,ne,`array expected, ${Ln(ne)} found`)];if(ne.length!==2)return[new at(ce,ne,`array length 2 expected, length ${ne.length} found`)];if(A){if(Ln(ne[0])!=="object")return[new at(ce,ne,`object expected, ${Ln(ne[0])} found`)];if(ne[0].zoom===void 0)return[new at(ce,ne,"object stop key must have zoom")];if(ne[0].value===void 0)return[new at(ce,ne,"object stop key must have value")];if(b&&b>Cr(ne[0].zoom))return[new at(ce,ne[0].zoom,"stop zoom values must appear in ascending order")];Cr(ne[0].zoom)!==b&&(b=Cr(ne[0].zoom),_=void 0,x={}),Y=Y.concat(no({key:`${ce}[0]`,value:ne[0],valueSpec:{zoom:{}},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{zoom:Th,value:G}}))}else Y=Y.concat(G({key:`${ce}[0]`,value:ne[0],valueSpec:{},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec},ne));return $n(Ya(ne[1]))?Y.concat([new at(`${ce}[1]`,ne[1],"expressions are not allowed in function stops.")]):Y.concat(Z.validateSpec({key:`${ce}[1]`,value:ne[1],valueSpec:o,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec}))}function G(Z,Y){const ne=Ln(Z.value),ce=Cr(Z.value),ge=Z.value!==null?Z.value:Y;if(p){if(ne!==p)return[new at(Z.key,ge,`${ne} stop domain type must match previous stop domain type ${p}`)]}else p=ne;if(ne!=="number"&&ne!=="string"&&ne!=="boolean")return[new at(Z.key,ge,"stop domain value must be a number, string, or boolean")];if(ne!=="number"&&h!=="categorical"){let Re=`number expected, ${ne} found`;return du(o)&&h===void 0&&(Re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(Z.key,ge,Re)]}return h!=="categorical"||ne!=="number"||isFinite(ce)&&Math.floor(ce)===ce?h!=="categorical"&&ne==="number"&&_!==void 0&&ce<_?[new at(Z.key,ge,"stop domain values must appear in ascending order")]:(_=ce,h==="categorical"&&ce in x?[new at(Z.key,ge,"stop domain values must be unique")]:(x[ce]=!0,[])):[new at(Z.key,ge,`integer expected, found ${ce}`)]}}function Ka(u){const o=(u.expressionContext==="property"?Im:Al)(Ya(u.value),u.valueSpec);if(o.result==="error")return o.value.map(p=>new at(`${u.key}${p.key}`,u.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new at(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!oc(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!oc(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!sc(h,["zoom","feature-state"]))return[new at(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!hh(h))return[new at(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ja(u){const o=u.key,h=u.value,p=u.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(Cr(h))===-1&&_.push(new at(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Cr(h))===-1&&_.push(new at(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function mu(u){return wh(Ya(u.value))?Ka(Qo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xp(u)}function xp(u){const o=u.value,h=u.key;if(Ln(o)!=="array")return[new at(h,o,`array expected, ${Ln(o)} found`)];const p=u.styleSpec;let _,b=[];if(o.length<1)return[new at(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:u.style,styleSpec:u.styleSpec})),Cr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Cr(o[1])==="$type"&&b.push(new at(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new at(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(_=Ln(o[1]),_!=="string"&&b.push(new at(`${h}[1]`,o[1],`string expected, ${_} found`)));for(let x=2;x{A in h&&o.push(new at(p,h[A],`"${A}" is prohibited for ref layers`))}),_.layers.forEach(A=>{Cr(A.id)===I&&(P=A)}),P?P.ref?o.push(new at(p,h.ref,"ref cannot reference another ref layer")):x=Cr(P.type):o.push(new at(p,h.ref,`ref layer "${I}" not found`))}else if(x!=="background")if(h.source){const P=_.sources&&_.sources[h.source],A=P&&Cr(P.type);P?A==="vector"&&x==="raster"?o.push(new at(p,h.source,`layer "${h.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new at(p,h.source,`layer "${h.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new at(p,h.source,`layer "${h.id}" requires a vector source`)):A!=="vector"||h["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new at(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!h.paint||!h.paint["line-gradient"]||A==="geojson"&&P.lineMetrics||o.push(new at(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new at(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new at(p,h.source,`source "${h.source}" not found`))}else o.push(new at(p,h,'missing required property "source"'));return o=o.concat(no({key:p,value:h,valueSpec:b.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:h.type,valueSpec:b.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:mu,layout:P=>no({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Sp(Qo({layerType:x},A))}}),paint:P=>no({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>wp(Qo({layerType:x},A))}})}})),o}function kl(u){const o=u.value,h=u.key,p=Ln(o);return p!=="string"?[new at(h,o,`string expected, ${p} found`)]:[]}const km={promoteId:function({key:u,value:o}){if(Ln(o)==="string")return kl({key:u,value:o});{const h=[];for(const p in o)h.push(...kl({key:`${u}.${p}`,value:o[p]}));return h}}};function Dm(u){const o=u.value,h=u.key,p=u.styleSpec,_=u.style,b=u.validateSpec;if(!o.type)return[new at(h,o,'"type" is required')];const x=Cr(o.type);let I;switch(x){case"vector":case"raster":return I=no({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:km,validateSpec:b}),I;case"raster-dem":return I=function(P){var A;const N=(A=P.sourceName)!==null&&A!==void 0?A:"",O=P.value,G=P.styleSpec,Z=G.source_raster_dem,Y=P.style;let ne=[];const ce=Ln(O);if(O===void 0)return ne;if(ce!=="object")return ne.push(new at("source_raster_dem",O,`object expected, ${ce} found`)),ne;const ge=Cr(O.encoding)==="custom",Re=["redFactor","greenFactor","blueFactor","baseShift"],ve=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Le in O)!ge&&Re.includes(Le)?ne.push(new at(Le,O[Le],`In "${N}": "${Le}" is only valid when "encoding" is set to "custom". ${ve} encoding found`)):Z[Le]?ne=ne.concat(P.validateSpec({key:Le,value:O[Le],valueSpec:Z[Le],validateSpec:P.validateSpec,style:Y,styleSpec:G})):ne.push(new at(Le,O[Le],`unknown property "${Le}"`));return ne}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:b}),I;case"geojson":if(I=no({key:h,value:o,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:b,objectElementValidators:km}),o.cluster)for(const P in o.clusterProperties){const[A,N]=o.clusterProperties[P],O=typeof A=="string"?[A,["accumulated"],["get",P]]:A;I.push(...Ka({key:`${h}.${P}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),I.push(...Ka({key:`${h}.${P}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return I;case"video":return no({key:h,value:o,valueSpec:p.source_video,style:_,validateSpec:b,styleSpec:p});case"image":return no({key:h,value:o,valueSpec:p.source_image,style:_,validateSpec:b,styleSpec:p});case"canvas":return[new at(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:_,validateSpec:b,styleSpec:p})}}function Rm(u){const o=u.value,h=u.styleSpec,p=h.light,_=u.style;let b=[];const x=Ln(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new at("light",o,`object expected, ${x} found`)]),b;for(const I in o){const P=I.match(/^(.*)-transition$/);b=b.concat(P&&p[P[1]]&&p[P[1]].transition?u.validateSpec({key:I,value:o[I],valueSpec:h.transition,validateSpec:u.validateSpec,style:_,styleSpec:h}):p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new at(I,o[I],`unknown property "${I}"`)])}return b}function Nm(u){const o=u.value,h=u.styleSpec,p=h.sky,_=u.style,b=Ln(o);if(o===void 0)return[];if(b!=="object")return[new at("sky",o,`object expected, ${b} found`)];let x=[];for(const I in o)x=x.concat(p[I]?js({key:I,value:o[I],valueSpec:p[I],style:_,styleSpec:h}):[new at(I,o[I],`unknown property "${I}"`)]);return x}function hc(u){const o=u.value,h=u.styleSpec,p=h.terrain,_=u.style;let b=[];const x=Ln(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new at("terrain",o,`object expected, ${x} found`)]),b;for(const I in o)b=b.concat(p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new at(I,o[I],`unknown property "${I}"`)]);return b}function fc(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const _=[],b=[];for(const x in h)h[x].id&&_.includes(h[x].id)&&o.push(new at(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),_.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new at(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat(no({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return kl({key:p,value:h})}const yo={"*":()=>[],array:bp,boolean:function(u){const o=u.value,h=u.key,p=Ln(o);return p!=="boolean"?[new at(h,o,`boolean expected, ${p} found`)]:[]},number:Th,color:function(u){const o=u.key,h=u.value,p=Ln(h);return p!=="string"?[new at(o,h,`color expected, ${p} found`)]:qn.parse(String(h))?[]:[new at(o,h,`color expected, "${h}" found`)]},constants:Mm,enum:Ja,filter:mu,function:Am,layer:cc,object:no,source:Dm,light:Rm,sky:Nm,terrain:hc,string:kl,formatted:function(u){return kl(u).length===0?[]:Ka(u)},resolvedImage:function(u){return kl(u).length===0?[]:Ka(u)},padding:function(u){const o=u.key,h=u.value;if(Ln(h)==="array"){if(h.length<1||h.length>4)return[new at(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let b=0;b[]}})),u.constants&&(h=h.concat(Mm({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:js}))),gu(h)}function qs(u){return function(o){return u({...o,validateSpec:js})}}function gu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function vs(u){return function(...o){return gu(u.apply(this,o))}}ys.source=vs(qs(Dm)),ys.sprite=vs(qs(fc)),ys.glyphs=vs(qs(Ep)),ys.light=vs(qs(Rm)),ys.sky=vs(qs(Nm)),ys.terrain=vs(qs(hc)),ys.layer=vs(qs(cc)),ys.filter=vs(qs(mu)),ys.paintProperty=vs(qs(wp)),ys.layoutProperty=vs(qs(Sp));const Dl=ys,hy=Dl.light,Ip=Dl.paintProperty,fy=Dl.layoutProperty;function _u(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new _t(new Error(p.message))),h=!0;return h}class pc{constructor(o,h,p){const _=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 P=0;P=O[Y+0]&&_>=O[Y+1])?(I[Z]=!0,x.push(N[Z])):I[Z]=!1}}}}_forEachCell(o,h,p,_,b,x,I,P){const A=this._convertToCellCoord(o),N=this._convertToCellCoord(h),O=this._convertToCellCoord(p),G=this._convertToCellCoord(_);for(let Z=A;Z<=O;Z++)for(let Y=N;Y<=G;Y++){const ne=this.d*Y+Z;if((!P||P(this._convertFromCellCoord(Z),this._convertFromCellCoord(Y),this._convertFromCellCoord(Z+1),this._convertFromCellCoord(Y+1)))&&b.call(this,o,h,p,_,ne,x,I,P))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=u[b];_[b]=Ws[p].shallow.indexOf(b)>=0?x:yu(x,o)}u instanceof Error&&(_.message=u.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(_.$name=p),_}throw new Error("can't serialize object of type "+typeof u)}function vu(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||u instanceof Error||Ph(u)||zt(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(vu);if(typeof u=="object"){const o=u.$name||"Object";if(!Ws[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=Ws[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const _ of Object.keys(u)){if(_==="$name")continue;const b=u[_];p[_]=Ws[o].shallow.indexOf(_)>=0?b:vu(b)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Om{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.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519};function bu(u){for(const o of u)if(Mh(o.charCodeAt(0)))return!0;return!1}function zm(u){for(const o of u)if(!Fm(o.charCodeAt(0)))return!1;return!0}function Fm(u){return!(bt.Arabic(u)||bt["Arabic Supplement"](u)||bt["Arabic Extended-A"](u)||bt["Arabic Presentation Forms-A"](u)||bt["Arabic Presentation Forms-B"](u))}function Mh(u){return!(u!==746&&u!==747&&(u<4352||!(bt["Bopomofo Extended"](u)||bt.Bopomofo(u)||bt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||bt["CJK Compatibility Ideographs"](u)||bt["CJK Compatibility"](u)||bt["CJK Radicals Supplement"](u)||bt["CJK Strokes"](u)||!(!bt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||bt["CJK Unified Ideographs Extension A"](u)||bt["CJK Unified Ideographs"](u)||bt["Enclosed CJK Letters and Months"](u)||bt["Hangul Compatibility Jamo"](u)||bt["Hangul Jamo Extended-A"](u)||bt["Hangul Jamo Extended-B"](u)||bt["Hangul Jamo"](u)||bt["Hangul Syllables"](u)||bt.Hiragana(u)||bt["Ideographic Description Characters"](u)||bt.Kanbun(u)||bt["Kangxi Radicals"](u)||bt["Katakana Phonetic Extensions"](u)||bt.Katakana(u)&&u!==12540||!(!bt["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!bt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||bt["Unified Canadian Aboriginal Syllabics"](u)||bt["Unified Canadian Aboriginal Syllabics Extended"](u)||bt["Vertical Forms"](u)||bt["Yijing Hexagram Symbols"](u)||bt["Yi Syllables"](u)||bt["Yi Radicals"](u))))}function Cp(u){return!(Mh(u)||function(o){return!!(bt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||bt["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)||bt["Letterlike Symbols"](o)||bt["Number Forms"](o)||bt["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)||bt["Control Pictures"](o)&&o!==9251||bt["Optical Character Recognition"](o)||bt["Enclosed Alphanumerics"](o)||bt["Geometric Shapes"](o)||bt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||bt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||bt["CJK Symbols and Punctuation"](o)||bt.Katakana(o)||bt["Private Use Area"](o)||bt["CJK Compatibility Forms"](o)||bt["Small Form Variants"](o)||bt["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function Ah(u){return u>=1424&&u<=2303||bt["Arabic Presentation Forms-A"](u)||bt["Arabic Presentation Forms-B"](u)}function Bm(u,o){return!(!o&&Ah(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||bt.Khmer(u))}function py(u){for(const o of u)if(Ah(o.charCodeAt(0)))return!0;return!1}const Qa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class hr{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 Om,this.transition={})}isSupportedScript(o){return function(h,p){for(const _ of h)if(!Bm(_.charCodeAt(0),p))return!1;return!0}(o,Qa.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 dc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,_){if(yh(p))return new bh(p,_);if($n(p)){const b=Im(p,_);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return _.type==="color"&&typeof p=="string"?b=qn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=es.parse(p)):b=_o.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 kh{constructor(o){this.property=o,this.value=new dc(o,void 0)}transitioned(o,h){return new Vm(this.property,this.value,h,de({},o.transition,this.transition),o.now)}untransitioned(){return new Vm(this.property,this.value,null,{},0)}}class Tp{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 kh(this._values[o].property)),this._values[o].value=new dc(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 kh(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 _=this.getTransition(h);_!==void 0&&(o[`${h}-transition`]=_)}return o}transitioned(o,h){const p=new Um(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(o,h._values[_]);return p}untransitioned(){const o=new Um(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Vm{constructor(o,h,p,_,b){this.property=o,this.value=h,this.begin=b+_.delay||0,this.end=this.begin+_.duration||0,o.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const _=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(_>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(_=1)return 1;const A=P*P,N=A*P;return 4*(P<.5?N:3*(P-A)+N-.75)}(I))}}return b}}class Um{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const _=new mc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Gm{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 dc(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 _=new mc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}}class bs{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,_){return this.property.evaluate(this.value,this.parameters,o,h,p,_)}}class mc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Dt{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 _=to[this.specification.type];return _?_(o,h,p):o}}class Vt{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,_){return new bs(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,_)}: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 bs(this,{kind:"constant",value:void 0},o.parameters);const _=to[this.specification.type];if(_){const b=_(o.value.value,h.value.value,p);return new bs(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,_,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,_,b,x)}}class Dh extends Vt{possiblyEvaluate(o,h,p,_){if(o.value===void 0)return new bs(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,I=this._calculate(x,x,x,h);return new bs(this,{kind:"constant",value:I},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 bs(this,{kind:"constant",value:b},h)}return new bs(this,o.expression,h)}evaluate(o,h,p,_,b,x){if(o.kind==="source"){const I=o.evaluate(h,p,_,b,x);return this._calculate(I,I,I,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,_),o.evaluate({zoom:Math.floor(h.zoom)},p,_),o.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):o.value}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class gc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new hr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new hr(Math.floor(h.zoom),h)),o.expression.evaluate(new hr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Lp{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){return!!o.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class vo{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 _=this.defaultPropertyValues[h]=new dc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new kh(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}Et("DataDrivenProperty",Vt),Et("DataConstantProperty",Dt),Et("CrossFadedDataDrivenProperty",Dh),Et("CrossFadedProperty",gc),Et("ColorRampProperty",Lp);const Pp="-transition";class xs extends xn{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 Gm(h.layout)),h.paint)){this._transitionablePaint=new Tp(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 mc(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(fy,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(Pp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(Ip,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(Pp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[o],b=_.property.specification["property-type"]==="cross-faded-data-driven",x=_.value.isDataDriven(),I=_.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const P=this._transitionablePaint._values[o].value;return P.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,I,P)}}_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,_,b={}){return(!b||b.validate!==!1)&&_u(this,o.call(Dl,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:Oe,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 bs&&du(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const jm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class _c{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 Tr{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 Gr(u,o=1){let h=0,p=0;return{members:u.map(_=>{const b=jm[_.type].BYTES_PER_ELEMENT,x=h=qm(h,Math.max(o,b)),I=_.components||1;return p=Math.max(p,b),h+=b*I,{name:_.name,type:_.type,components:I,offset:x}}),size:qm(h,Math.max(p,o)),alignment:o}}function qm(u,o){return Math.ceil(u/o)*o}class yc extends Tr{_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 _=2*o;return this.int16[_+0]=h,this.int16[_+1]=p,o}}yc.prototype.bytesPerElement=4,Et("StructArrayLayout2i4",yc);class wa extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=_,o}}wa.prototype.bytesPerElement=6,Et("StructArrayLayout3i6",wa);class Mp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=_,this.int16[x+3]=b,o}}Mp.prototype.bytesPerElement=8,Et("StructArrayLayout4i8",Mp);class Ap extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,I){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=I,o}}Ap.prototype.bytesPerElement=12,Et("StructArrayLayout2i4i12",Ap);class kp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,I){const P=4*o,A=8*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.uint8[A+4]=_,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=I,o}}kp.prototype.bytesPerElement=8,Et("StructArrayLayout2i4ub8",kp);class vc extends Tr{_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 _=2*o;return this.float32[_+0]=h,this.float32[_+1]=p,o}}vc.prototype.bytesPerElement=8,Et("StructArrayLayout2f8",vc);class Rh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,I,P,A,N){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,_,b,x,I,P,A,N)}emplace(o,h,p,_,b,x,I,P,A,N,O){const G=10*o;return this.uint16[G+0]=h,this.uint16[G+1]=p,this.uint16[G+2]=_,this.uint16[G+3]=b,this.uint16[G+4]=x,this.uint16[G+5]=I,this.uint16[G+6]=P,this.uint16[G+7]=A,this.uint16[G+8]=N,this.uint16[G+9]=O,o}}Rh.prototype.bytesPerElement=20,Et("StructArrayLayout10ui20",Rh);class Dp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,I,P,A,N,O,G){const Z=this.length;return this.resize(Z+1),this.emplace(Z,o,h,p,_,b,x,I,P,A,N,O,G)}emplace(o,h,p,_,b,x,I,P,A,N,O,G,Z){const Y=12*o;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=b,this.uint16[Y+4]=x,this.uint16[Y+5]=I,this.uint16[Y+6]=P,this.uint16[Y+7]=A,this.int16[Y+8]=N,this.int16[Y+9]=O,this.int16[Y+10]=G,this.int16[Y+11]=Z,o}}Dp.prototype.bytesPerElement=24,Et("StructArrayLayout4i4ui4i24",Dp);class Rp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Rp.prototype.bytesPerElement=12,Et("StructArrayLayout3f12",Rp);class Sa extends Tr{_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}}Sa.prototype.bytesPerElement=4,Et("StructArrayLayout1ul4",Sa);class Nh extends Tr{_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,_,b,x,I,P,A){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,_,b,x,I,P,A)}emplace(o,h,p,_,b,x,I,P,A,N){const O=10*o,G=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=_,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=I,this.uint32[G+3]=P,this.uint16[O+8]=A,this.uint16[O+9]=N,o}}Nh.prototype.bytesPerElement=20,Et("StructArrayLayout6i1ul2ui20",Nh);class bc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,I){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=I,o}}bc.prototype.bytesPerElement=12,Et("StructArrayLayout2i2i2i12",bc);class Oh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_,b)}emplace(o,h,p,_,b,x){const I=4*o,P=8*o;return this.float32[I+0]=h,this.float32[I+1]=p,this.float32[I+2]=_,this.int16[P+6]=b,this.int16[P+7]=x,o}}Oh.prototype.bytesPerElement=16,Et("StructArrayLayout2f1f2i16",Oh);class xc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=12*o,I=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[I+1]=_,this.float32[I+2]=b,o}}xc.prototype.bytesPerElement=12,Et("StructArrayLayout2ub2f12",xc);class zh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=_,o}}zh.prototype.bytesPerElement=6,Et("StructArrayLayout3ui6",zh);class xu extends Tr{_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,_,b,x,I,P,A,N,O,G,Z,Y,ne,ce,ge){const Re=this.length;return this.resize(Re+1),this.emplace(Re,o,h,p,_,b,x,I,P,A,N,O,G,Z,Y,ne,ce,ge)}emplace(o,h,p,_,b,x,I,P,A,N,O,G,Z,Y,ne,ce,ge,Re){const ve=24*o,Le=12*o,Ke=48*o;return this.int16[ve+0]=h,this.int16[ve+1]=p,this.uint16[ve+2]=_,this.uint16[ve+3]=b,this.uint32[Le+2]=x,this.uint32[Le+3]=I,this.uint32[Le+4]=P,this.uint16[ve+10]=A,this.uint16[ve+11]=N,this.uint16[ve+12]=O,this.float32[Le+7]=G,this.float32[Le+8]=Z,this.uint8[Ke+36]=Y,this.uint8[Ke+37]=ne,this.uint8[Ke+38]=ce,this.uint32[Le+10]=ge,this.int16[ve+22]=Re,o}}xu.prototype.bytesPerElement=48,Et("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xu);class Rl extends Tr{_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,_,b,x,I,P,A,N,O,G,Z,Y,ne,ce,ge,Re,ve,Le,Ke,Je,wt,Tt,xt,yt,ct,It){const mt=this.length;return this.resize(mt+1),this.emplace(mt,o,h,p,_,b,x,I,P,A,N,O,G,Z,Y,ne,ce,ge,Re,ve,Le,Ke,Je,wt,Tt,xt,yt,ct,It)}emplace(o,h,p,_,b,x,I,P,A,N,O,G,Z,Y,ne,ce,ge,Re,ve,Le,Ke,Je,wt,Tt,xt,yt,ct,It,mt){const st=32*o,Bt=16*o;return this.int16[st+0]=h,this.int16[st+1]=p,this.int16[st+2]=_,this.int16[st+3]=b,this.int16[st+4]=x,this.int16[st+5]=I,this.int16[st+6]=P,this.int16[st+7]=A,this.uint16[st+8]=N,this.uint16[st+9]=O,this.uint16[st+10]=G,this.uint16[st+11]=Z,this.uint16[st+12]=Y,this.uint16[st+13]=ne,this.uint16[st+14]=ce,this.uint16[st+15]=ge,this.uint16[st+16]=Re,this.uint16[st+17]=ve,this.uint16[st+18]=Le,this.uint16[st+19]=Ke,this.uint16[st+20]=Je,this.uint16[st+21]=wt,this.uint16[st+22]=Tt,this.uint32[Bt+12]=xt,this.float32[Bt+13]=yt,this.float32[Bt+14]=ct,this.uint16[st+30]=It,this.uint16[st+31]=mt,o}}Rl.prototype.bytesPerElement=64,Et("StructArrayLayout8i15ui1ul2f2ui64",Rl);class Fh extends Tr{_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}}Fh.prototype.bytesPerElement=4,Et("StructArrayLayout1f4",Fh);class Bh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Bh.prototype.bytesPerElement=12,Et("StructArrayLayout1ui2f12",Bh);class Nl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=_,o}}Nl.prototype.bytesPerElement=8,Et("StructArrayLayout1ul2ui8",Nl);class Np extends Tr{_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 _=2*o;return this.uint16[_+0]=h,this.uint16[_+1]=p,o}}Np.prototype.bytesPerElement=4,Et("StructArrayLayout2ui4",Np);class Op extends Tr{_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}}Op.prototype.bytesPerElement=2,Et("StructArrayLayout1ui2",Op);class Vh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,this.float32[x+3]=b,o}}Vh.prototype.bytesPerElement=16,Et("StructArrayLayout4f16",Vh);class Wm extends _c{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 E(this.anchorPointX,this.anchorPointY)}}Wm.prototype.size=20;class y extends Nh{get(o){return new Wm(this,o)}}Et("CollisionBoxArray",y);class s extends _c{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 xu{get(o){return new s(this,o)}}Et("PlacedSymbolArray",f);class d extends _c{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 g extends Rl{get(o){return new d(this,o)}}Et("SymbolInstanceArray",g);class v extends Fh{getoffsetX(o){return this.float32[1*o+0]}}Et("GlyphOffsetArray",v);class C extends wa{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}Et("SymbolLineVertexArray",C);class L extends _c{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]}}L.prototype.size=12;class M extends Bh{get(o){return new L(this,o)}}Et("TextAnchorOffsetArray",M);class R extends _c{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}R.prototype.size=8;class z extends Nl{get(o){return new R(this,o)}}Et("FeatureIndexArray",z);class F extends yc{}class X extends yc{}class ue extends yc{}class le extends Ap{}class fe extends kp{}class te extends vc{}class xe extends Rh{}class Fe extends Dp{}class pe extends Rp{}class Ae extends Sa{}class Ve extends bc{}class je extends xc{}class Ze extends zh{}class rt extends Np{}const Qe=Gr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ut}=Qe;class pt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,_){let b=this.segments[this.segments.length-1];return o>pt.MAX_VERTEX_ARRAY_LENGTH&&Xe(`Max vertices per segment is ${pt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>pt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==_)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(b.sortKey=_),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,_){return new pt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function sn(u,o){return 256*(u=$(Math.floor(u),0,255))+$(Math.floor(o),0,255)}pt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Et("SegmentVector",pt);const dt=Gr([{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 Ut={exports:{}},an={exports:{}};an.exports=function(u,o){var h,p,_,b,x,I,P,A;for(p=u.length-(h=3&u.length),_=o,x=3432918353,I=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*I+(((P>>>16)*I&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(P=0,h){case 3:P^=(255&u.charCodeAt(A+2))<<16;case 2:P^=(255&u.charCodeAt(A+1))<<8;case 1:_^=P=(65535&(P=(P=(65535&(P^=255&u.charCodeAt(A)))*x+(((P>>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*I+(((P>>>16)*I&65535)<<16)&4294967295}return _^=u.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var Cn=an.exports,Ht={exports:{}};Ht.exports=function(u,o){for(var h,p=u.length,_=o^p,b=0;p>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(b)|(255&u.charCodeAt(++b))<<8|(255&u.charCodeAt(++b))<<16|(255&u.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:_^=(255&u.charCodeAt(b+2))<<16;case 2:_^=(255&u.charCodeAt(b+1))<<8;case 1:_=1540483477*(65535&(_^=255&u.charCodeAt(b)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var hn=Cn,pn=Ht.exports;Ut.exports=hn,Ut.exports.murmur3=hn,Ut.exports.murmur2=pn;var Lr=m(Ut.exports);class Hn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,_){this.ids.push(zo(o)),this.positions.push(h,p,_)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zo(o);let p=0,_=this.ids.length-1;for(;p<_;){const x=p+_>>1;this.ids[x]>=h?_=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),_=new Uint32Array(o.positions);return li(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(o){const h=new Hn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function zo(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Lr(String(u))}function li(u,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(u[b]<_);do x--;while(u[x]>_);if(b>=x)break;yr(u,b,x),yr(o,3*b,3*x),yr(o,3*b+1,3*x+1),yr(o,3*b+2,3*x+2)}x-h`u_${_}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new $a(o,h):new Fo(o,h)}}class ri{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,_){const b=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Hs(o,h):new Fo(o,h)}}class vr{constructor(o,h,p,_){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 _}populatePaintArray(o,h,p,_,b){const x=this.paintVertexArray.length,I=this.expression.evaluate(new hr(0),h,{},_,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,I)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const _=el(p);for(let b=o;b`u_${I}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=h.map(I=>({name:`a_${I}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,h,p,_,b){const x=this.expression.evaluate(new hr(this.zoom),h,{},_,[],b),I=this.expression.evaluate(new hr(this.zoom+1),h,{},_,[],b),P=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(P,o,x,I)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:this.zoom},p,_),x=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,_){if(this.type==="color"){const b=el(p),x=el(_);for(let I=o;I`#define HAS_UNIFORM_${_}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof vr||p instanceof fr)for(let _=0;_!0){this.programConfigurations={};for(const _ of o)this.programConfigurations[_.id]=new ii(_,h,p);this.needsUpload=!1,this._featureMap=new Hn,this._bufferOffset=0}populatePaintArrays(o,h,p,_,b,x){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(o,h,_,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,_){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,_)||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 rs(u,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"]}[u]||[u.replace(`${o}-`,"").replace(/-/g,"_")]}function oi(u,o,h){const p={color:{source:vc,composite:Vh},number:{source:Fh,composite:vc}},_=function(b){return{"line-pattern":{source:xe,composite:xe},"fill-pattern":{source:xe,composite:xe},"fill-extrusion-pattern":{source:xe,composite:xe}}[b]}(u);return _&&_[h]||p[o][h]}Et("ConstantBinder",Zs),Et("CrossFadedConstantBinder",ri),Et("SourceExpressionBinder",vr),Et("CrossFadedCompositeBinder",ns),Et("CompositeExpressionBinder",fr),Et("ProgramConfiguration",ii,{omit:["_buffers"]}),Et("ProgramConfigurationSet",br);const Nr=8192,zp=Math.pow(2,14)-1,Hm=-zp-1;function Ol(u){const o=Nr/u.extent,h=u.loadGeometry();for(let p=0;px.x+1||Px.y+1)&&Xe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function zl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?Ol(u):[]}}function Uh(u,o,h,p,_){u.emplaceBack(2*o+(p+1)/2,2*h+(_+1)/2)}class tl{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 Ze,this.segments=new pt,this.programConfigurations=new br(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const _=this.layers[0],b=[];let x=null,I=!1;_.type==="circle"&&(x=_.layout.get("circle-sort-key"),I=!x.isConstant());for(const{feature:P,id:A,index:N,sourceLayerIndex:O}of o){const G=this.layers[0]._featureFilter.needGeometry,Z=zl(P,G);if(!this.layers[0]._featureFilter.filter(new hr(this.zoom),Z,p))continue;const Y=I?x.evaluate(Z,{},p):void 0,ne={id:A,properties:P.properties,type:P.type,sourceLayerIndex:O,index:N,geometry:G?Z.geometry:Ol(P),patterns:{},sortKey:Y};b.push(ne)}I&&b.sort((P,A)=>P.sortKey-A.sortKey);for(const P of b){const{geometry:A,index:N,sourceLayerIndex:O}=P,G=o[N].feature;this.addFeature(P,A,N,p),h.featureIndex.insert(G,A,N,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,ut),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,_){for(const b of h)for(const x of b){const I=x.x,P=x.y;if(I<0||I>=Nr||P<0||P>=Nr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),N=A.vertexLength;Uh(this.layoutVertexArray,I,P,-1,-1),Uh(this.layoutVertexArray,I,P,1,-1),Uh(this.layoutVertexArray,I,P,1,1),Uh(this.layoutVertexArray,I,P,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},_)}}function Fp(u,o){for(let h=0;h1){if(Gh(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(_)._add(o))}function N1(u,o){let h,p,_,b=!1;for(let x=0;xo.y!=_.y>o.y&&o.x<(_.x-p.x)*(o.y-p.y)/(_.y-p.y)+p.x&&(b=!b)}return b}function jh(u,o){let h=!1;for(let p=0,_=u.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 oT(u,o,h){const p=h[0],_=h[2];if(u.x_.x&&o.x>_.x||u.y_.y&&o.y>_.y)return!1;const b=be(u,o,h[0]);return b!==be(u,o,h[1])||b!==be(u,o,h[2])||b!==be(u,o,h[3])}function Gp(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function Xm(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Ym(u,o,h,p,_){if(!o[0]&&!o[1])return u;const b=E.convert(o)._mult(_);h==="viewport"&&b._rotate(-p);const x=[];for(let I=0;IB1(ce,ne))}(A,P),Z=O?N*I:N;for(const Y of _)for(const ne of Y){const ce=O?ne:B1(ne,P);let ge=Z;const Re=Km([],[ne.x,ne.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ge*=Re[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ge*=x.cameraToCenterDistance/Re[3]),Zm(G,ce,ge))return!0}return!1}}function B1(u,o){const h=Km([],[u.x,u.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class V1 extends tl{}let U1;Et("HeatmapBucket",V1,{omit:["layers"]});var uT={get paint(){return U1=U1||new vo({"heatmap-radius":new Vt(Oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vt(Oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Dt(Oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Lp(Oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Dt(Oe.paint_heatmap["heatmap-opacity"])})}};function gy(u,{width:o,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${o*h*p}`)}else _=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=_,u}function G1(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const _=gy({},{width:o,height:h},p);_y(u,_,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,h)},p),u.width=o,u.height=h,u.data=_.data}function _y(u,o,h,p,_,b){if(_.width===0||_.height===0)return o;if(_.width>u.width||_.height>u.height||h.x>u.width-_.width||h.y>u.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>o.width||_.height>o.height||p.x>o.width-_.width||p.y>o.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const x=u.data,I=o.data;if(x===I)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<_.height;P++){const A=((h.y+P)*u.width+h.x)*b,N=((p.y+P)*o.width+p.x)*b;for(let O=0;O<_.width*b;O++)I[N+O]=x[A+O]}return o}class qp{constructor(o,h){gy(this,o,1,h)}resize(o){G1(this,o,1)}clone(){return new qp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){_y(o,h,p,_,b,1)}}class ws{constructor(o,h){gy(this,o,4,h)}resize(o){G1(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new ws({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){_y(o,h,p,_,b,4)}}function j1(u){const o={},h=u.resolution||256,p=u.clips?u.clips.length:1,_=u.image||new ws({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const b=(x,I,P)=>{o[u.evaluationKey]=P;const A=u.expression.evaluate(o);_.data[x+I+0]=Math.floor(255*A.r/A.a),_.data[x+I+1]=Math.floor(255*A.g/A.a),_.data[x+I+2]=Math.floor(255*A.b/A.a),_.data[x+I+3]=Math.floor(255*A.a)};if(u.clips)for(let x=0,I=0;x80*h){p=b=u[0],_=x=u[1];for(var Y=h;Yb&&(b=I),P>x&&(x=P);A=(A=Math.max(b-p,x-_))!==0?32767/A:0}return Wp(G,Z,h,p,_,A,0),Z}function W1(u,o,h,p,_){var b,x;if(_===xy(u,o,h,p)>0)for(b=o;b=o;b-=p)x=X1(b,u[b],u[b+1],x);return x&&Qm(x,x.next)&&(Zp(x),x=x.next),x}function Sc(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!Qm(p,p.next)&&jr(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 Wp(u,o,h,p,_,b,x){if(u){!x&&b&&function(N,O,G,Z){var Y=N;do Y.z===0&&(Y.z=vy(Y.x,Y.y,O,G,Z)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==N);Y.prevZ.nextZ=null,Y.prevZ=null,function(ne){var ce,ge,Re,ve,Le,Ke,Je,wt,Tt=1;do{for(ge=ne,ne=null,Le=null,Ke=0;ge;){for(Ke++,Re=ge,Je=0,ce=0;ce0||wt>0&ℜ)Je!==0&&(wt===0||!Re||ge.z<=Re.z)?(ve=ge,ge=ge.nextZ,Je--):(ve=Re,Re=Re.nextZ,wt--),Le?Le.nextZ=ve:ne=ve,ve.prevZ=Le,Le=ve;ge=Re}Le.nextZ=null,Tt*=2}while(Ke>1)}(Y)}(u,p,_,b);for(var I,P,A=u;u.prev!==u.next;)if(I=u.prev,P=u.next,b?gT(u,p,_,b):mT(u))o.push(I.i/h|0),o.push(u.i/h|0),o.push(P.i/h|0),Zp(u),u=P.next,A=P.next;else if((u=P)===A){x?x===1?Wp(u=_T(Sc(u),o,h),o,h,p,_,b,2):x===2&&yT(u,o,h,p,_,b):Wp(Sc(u),o,h,p,_,b,1);break}}}function mT(u){var o=u.prev,h=u,p=u.next;if(jr(o,h,p)>=0)return!1;for(var _=o.x,b=h.x,x=p.x,I=o.y,P=h.y,A=p.y,N=_b?_>x?_:x:b>x?b:x,Z=I>P?I>A?I:A:P>A?P:A,Y=p.next;Y!==o;){if(Y.x>=N&&Y.x<=G&&Y.y>=O&&Y.y<=Z&&Wh(_,I,b,P,x,A,Y.x,Y.y)&&jr(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function gT(u,o,h,p){var _=u.prev,b=u,x=u.next;if(jr(_,b,x)>=0)return!1;for(var I=_.x,P=b.x,A=x.x,N=_.y,O=b.y,G=x.y,Z=IP?I>A?I:A:P>A?P:A,ce=N>O?N>G?N:G:O>G?O:G,ge=vy(Z,Y,o,h,p),Re=vy(ne,ce,o,h,p),ve=u.prevZ,Le=u.nextZ;ve&&ve.z>=ge&&Le&&Le.z<=Re;){if(ve.x>=Z&&ve.x<=ne&&ve.y>=Y&&ve.y<=ce&&ve!==_&&ve!==x&&Wh(I,N,P,O,A,G,ve.x,ve.y)&&jr(ve.prev,ve,ve.next)>=0||(ve=ve.prevZ,Le.x>=Z&&Le.x<=ne&&Le.y>=Y&&Le.y<=ce&&Le!==_&&Le!==x&&Wh(I,N,P,O,A,G,Le.x,Le.y)&&jr(Le.prev,Le,Le.next)>=0))return!1;Le=Le.nextZ}for(;ve&&ve.z>=ge;){if(ve.x>=Z&&ve.x<=ne&&ve.y>=Y&&ve.y<=ce&&ve!==_&&ve!==x&&Wh(I,N,P,O,A,G,ve.x,ve.y)&&jr(ve.prev,ve,ve.next)>=0)return!1;ve=ve.prevZ}for(;Le&&Le.z<=Re;){if(Le.x>=Z&&Le.x<=ne&&Le.y>=Y&&Le.y<=ce&&Le!==_&&Le!==x&&Wh(I,N,P,O,A,G,Le.x,Le.y)&&jr(Le.prev,Le,Le.next)>=0)return!1;Le=Le.nextZ}return!0}function _T(u,o,h){var p=u;do{var _=p.prev,b=p.next.next;!Qm(_,b)&&H1(_,p,p.next,b)&&Hp(_,b)&&Hp(b,_)&&(o.push(_.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),Zp(p),Zp(p.next),p=u=b),p=p.next}while(p!==u);return Sc(p)}function yT(u,o,h,p,_,b){var x=u;do{for(var I=x.next.next;I!==x.prev;){if(x.i!==I.i&&ST(x,I)){var P=Z1(x,I);return x=Sc(x,x.next),P=Sc(P,P.next),Wp(x,o,h,p,_,b,0),void Wp(P,o,h,p,_,b,0)}I=I.next}x=x.next}while(x!==u)}function vT(u,o){return u.x-o.x}function bT(u,o){var h=function(_,b){var x,I=b,P=_.x,A=_.y,N=-1/0;do{if(A<=I.y&&A>=I.next.y&&I.next.y!==I.y){var O=I.x+(A-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(O<=P&&O>N&&(N=O,x=I.x=I.x&&I.x>=Y&&P!==I.x&&Wh(Ax.x||I.x===x.x&&xT(x,I)))&&(x=I,ce=G)),I=I.next;while(I!==Z);return x}(u,o);if(!h)return o;var p=Z1(h,u);return Sc(p,p.next),Sc(h,h.next)}function xT(u,o){return jr(u.prev,u,o.prev)<0&&jr(o.next,u,u.next)<0}function vy(u,o,h,p,_){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*_|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*_|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function wT(u){var o=u,h=u;do(o.x=(u-x)*(b-I)&&(u-x)*(p-I)>=(h-x)*(o-I)&&(h-x)*(b-I)>=(_-x)*(p-I)}function ST(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&H1(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(u,o)&&(Hp(u,o)&&Hp(o,u)&&function(h,p){var _=h,b=!1,x=(h.x+p.x)/2,I=(h.y+p.y)/2;do _.y>I!=_.next.y>I&&_.next.y!==_.y&&x<(_.next.x-_.x)*(I-_.y)/(_.next.y-_.y)+_.x&&(b=!b),_=_.next;while(_!==h);return b}(u,o)&&(jr(u.prev,u,o.prev)||jr(u,o.prev,o))||Qm(u,o)&&jr(u.prev,u,u.next)>0&&jr(o.prev,o,o.next)>0)}function jr(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function Qm(u,o){return u.x===o.x&&u.y===o.y}function H1(u,o,h,p){var _=eg(jr(u,o,h)),b=eg(jr(u,o,p)),x=eg(jr(h,p,u)),I=eg(jr(h,p,o));return _!==b&&x!==I||!(_!==0||!$m(u,h,o))||!(b!==0||!$m(u,p,o))||!(x!==0||!$m(h,u,p))||!(I!==0||!$m(h,o,p))}function $m(u,o,h){return o.x<=Math.max(u.x,h.x)&&o.x>=Math.min(u.x,h.x)&&o.y<=Math.max(u.y,h.y)&&o.y>=Math.min(u.y,h.y)}function eg(u){return u>0?1:u<0?-1:0}function Hp(u,o){return jr(u.prev,u,u.next)<0?jr(u,o,u.next)>=0&&jr(u,u.prev,o)>=0:jr(u,o,u.prev)<0||jr(u,u.next,o)<0}function Z1(u,o){var h=new by(u.i,u.x,u.y),p=new by(o.i,o.x,o.y),_=u.next,b=o.prev;return u.next=o,o.prev=u,h.next=_,_.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function X1(u,o,h,p){var _=new by(u,o,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function Zp(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function by(u,o,h){this.i=u,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 xy(u,o,h,p){for(var _=0,b=o,x=h-p;b0&&h.holes.push(p+=u[_-1].length)}return h};var Y1=m(yy.exports);function ET(u,o,h,p,_){K1(u,o,h||0,p||u.length-1,_||IT)}function K1(u,o,h,p,_){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,I=Math.log(b),P=.5*Math.exp(2*I/3),A=.5*Math.sqrt(I*P*(b-P)/b)*(x-b/2<0?-1:1);K1(u,o,Math.max(h,Math.floor(o-x*P/b+A)),Math.min(p,Math.floor(o+(b-x)*P/b+A)),_)}var N=u[o],O=h,G=p;for(Xp(u,h,o),_(u[p],N)>0&&Xp(u,h,p);O0;)G--}_(u[h],N)===0?Xp(u,h,G):Xp(u,++G,p),G<=o&&(h=G+1),o<=G&&(p=G-1)}}function Xp(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function IT(u,o){return uo?1:0}function wy(u,o){const h=u.length;if(h<=1)return[u];const p=[];let _,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ue,this.indexArray=new Ze,this.indexArray2=new rt,this.programConfigurations=new br(o.layers,o.zoom),this.segments=new pt,this.segments2=new pt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Sy("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),b=!_.isConstant(),x=[];for(const{feature:I,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=zl(I,O);if(!this.layers[0]._featureFilter.filter(new hr(this.zoom),G,p))continue;const Z=b?_.evaluate(G,{},p,h.availableImages):void 0,Y={id:P,properties:I.properties,type:I.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Ol(I),patterns:{},sortKey:Z};x.push(Y)}b&&x.sort((I,P)=>I.sortKey-P.sortKey);for(const I of x){const{geometry:P,index:A,sourceLayerIndex:N}=I;if(this.hasPattern){const O=Ey("fill",this.layers,I,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(I,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.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,dT),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,_,b){for(const x of wy(h,500)){let I=0;for(const Z of x)I+=Z.length;const P=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),A=P.vertexLength,N=[],O=[];for(const Z of x){if(Z.length===0)continue;Z!==x[0]&&O.push(N.length/2);const Y=this.segments2.prepareSegment(Z.length,this.layoutVertexArray,this.indexArray2),ne=Y.vertexLength;this.layoutVertexArray.emplaceBack(Z[0].x,Z[0].y),this.indexArray2.emplaceBack(ne+Z.length-1,ne),N.push(Z[0].x),N.push(Z[0].y);for(let ce=1;ce>3}if(_--,p===1||p===2)b+=u.readSVarint(),x+=u.readSVarint(),p===1&&(o&&I.push(o),o=[]),o.push(new kT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&I.push(o),I},Hh.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,_=0,b=0,x=1/0,I=-1/0,P=1/0,A=-1/0;u.pos>3}if(p--,h===1||h===2)(_+=u.readSVarint())I&&(I=_),(b+=u.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,P,I,A]},Hh.prototype.toGeoJSON=function(u,o,h){var p,_,b=this.extent*Math.pow(2,h),x=this.extent*u,I=this.extent*o,P=this.loadGeometry(),A=Hh.types[this.type];function N(Z){for(var Y=0;Y>3;_=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 _}(h))}tb.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var o=this._pbf.readVarint()+this._pbf.pos;return new NT(this._pbf,o,this.extent,this._keys,this._values)};var zT=eb;function FT(u,o,h){if(u===3){var p=new zT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}wu.VectorTile=function(u,o){this.layers=u.readFields(FT,{},o)},wu.VectorTileFeature=$1,wu.VectorTileLayer=eb;const BT=wu.VectorTileFeature.types,Cy=Math.pow(2,13);function Yp(u,o,h,p,_,b,x,I){u.emplaceBack(o,h,2*Math.floor(p*Cy)+x,_*Cy*2,b*Cy*2,Math.round(I))}class Ty{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 le,this.centroidVertexArray=new F,this.indexArray=new Ze,this.programConfigurations=new br(o.layers,o.zoom),this.segments=new pt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=Sy("fill-extrusion",this.layers,h);for(const{feature:_,id:b,index:x,sourceLayerIndex:I}of o){const P=this.layers[0]._featureFilter.needGeometry,A=zl(_,P);if(!this.layers[0]._featureFilter.filter(new hr(this.zoom),A,p))continue;const N={id:b,sourceLayerIndex:I,index:x,geometry:P?A.geometry:Ol(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(Ey("fill-extrusion",this.layers,N,this.zoom,h)):this.addFeature(N,N.geometry,x,p,{}),h.featureIndex.insert(_,N.geometry,x,I,this.index,!0)}}addFeatures(o,h,p){for(const _ of this.features){const{geometry:b}=_;this.addFeature(_,b,_.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,AT),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,_,b){const x={x:0,y:0,vertexCount:0};for(const I of wy(h,500)){let P=0;for(const Y of I)P+=Y.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of I){if(Y.length===0||UT(Y))continue;let ne=0;for(let ce=0;ce=1){const Re=Y[ce-1];if(!VT(ge,Re)){A.vertexLength+4>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ve=ge.sub(Re)._perp()._unit(),Le=Re.dist(ge);ne+Le>32768&&(ne=0),Yp(this.layoutVertexArray,ge.x,ge.y,ve.x,ve.y,0,0,ne),Yp(this.layoutVertexArray,ge.x,ge.y,ve.x,ve.y,0,1,ne),x.x+=2*ge.x,x.y+=2*ge.y,x.vertexCount+=2,ne+=Le,Yp(this.layoutVertexArray,Re.x,Re.y,ve.x,ve.y,0,0,ne),Yp(this.layoutVertexArray,Re.x,Re.y,ve.x,ve.y,0,1,ne),x.x+=2*Re.x,x.y+=2*Re.y,x.vertexCount+=2;const Ke=A.vertexLength;this.indexArray.emplaceBack(Ke,Ke+2,Ke+1),this.indexArray.emplaceBack(Ke+1,Ke+2,Ke+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+P>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),BT[o.type]!=="Polygon")continue;const N=[],O=[],G=A.vertexLength;for(const Y of I)if(Y.length!==0){Y!==I[0]&&O.push(N.length/2);for(let ne=0;neNr)||u.y===o.y&&(u.y<0||u.y>Nr)}function UT(u){return u.every(o=>o.x<0)||u.every(o=>o.x>Nr)||u.every(o=>o.y<0)||u.every(o=>o.y>Nr)}let nb;Et("FillExtrusionBucket",Ty,{omit:["layers","features"]});var GT={get paint(){return nb=nb||new vo({"fill-extrusion-opacity":new Dt(Oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vt(Oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Dt(Oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Dt(Oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Dh(Oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vt(Oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vt(Oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Dt(Oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class jT extends xs{constructor(o){super(o,GT)}createBucket(o){return new Ty(o)}queryRadius(){return Xm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,_,b,x,I,P){const A=Ym(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,I),N=this.paint.get("fill-extrusion-height").evaluate(h,p),O=this.paint.get("fill-extrusion-base").evaluate(h,p),G=function(Y,ne,ce,ge){const Re=[];for(const ve of Y){const Le=[ve.x,ve.y,0,1];Km(Le,Le,ne),Re.push(new E(Le[0]/Le[3],Le[1]/Le[3]))}return Re}(A,P),Z=function(Y,ne,ce,ge){const Re=[],ve=[],Le=ge[8]*ne,Ke=ge[9]*ne,Je=ge[10]*ne,wt=ge[11]*ne,Tt=ge[8]*ce,xt=ge[9]*ce,yt=ge[10]*ce,ct=ge[11]*ce;for(const It of Y){const mt=[],st=[];for(const Bt of It){const At=Bt.x,gn=Bt.y,ar=ge[0]*At+ge[4]*gn+ge[12],pr=ge[1]*At+ge[5]*gn+ge[13],hi=ge[2]*At+ge[6]*gn+ge[14],is=ge[3]*At+ge[7]*gn+ge[15],xo=hi+Je,si=is+wt,ki=ar+Tt,Bi=pr+xt,wo=hi+yt,So=is+ct,fi=new E((ar+Le)/si,(pr+Ke)/si);fi.z=xo/si,mt.push(fi);const pi=new E(ki/So,Bi/So);pi.z=wo/So,st.push(pi)}Re.push(mt),ve.push(st)}return[Re,ve]}(_,O,N,P);return function(Y,ne,ce){let ge=1/0;Bp(ce,ne)&&(ge=rb(ce,ne[0]));for(let Re=0;Reh.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 fe,this.layoutVertexArray2=new te,this.indexArray=new Ze,this.programConfigurations=new br(o.layers,o.zoom),this.segments=new pt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Sy("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),b=!_.isConstant(),x=[];for(const{feature:I,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=zl(I,O);if(!this.layers[0]._featureFilter.filter(new hr(this.zoom),G,p))continue;const Z=b?_.evaluate(G,{},p):void 0,Y={id:P,properties:I.properties,type:I.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Ol(I),patterns:{},sortKey:Z};x.push(Y)}b&&x.sort((I,P)=>I.sortKey-P.sortKey);for(const I of x){const{geometry:P,index:A,sourceLayerIndex:N}=I;if(this.hasPattern){const O=Ey("line",this.layers,I,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(I,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.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,ZT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,WT),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,_,b){const x=this.layers[0].layout,I=x.get("line-join").evaluate(o,{}),P=x.get("line-cap"),A=x.get("line-miter-limit"),N=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of h)this.addLine(O,o,I,P,A,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,_)}addLine(o,h,p,_,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ge=0;ge=2&&o[P-1].equals(o[P-2]);)P--;let A=0;for(;A0;if(wt&&ge>A){const ct=G.dist(Z);if(ct>2*N){const It=G.sub(G.sub(Z)._mult(N/ct)._round());this.updateDistance(Z,It),this.addCurrentVertex(It,ne,0,0,O),Z=It}}const xt=Z&&Y;let yt=xt?p:I?"butt":_;if(xt&&yt==="round"&&(Keb&&(yt="bevel"),yt==="bevel"&&(Ke>2&&(yt="flipbevel"),Ke100)Re=ce.mult(-1);else{const ct=Ke*ne.add(ce).mag()/ne.sub(ce).mag();Re._perp()._mult(ct*(Tt?-1:1))}this.addCurrentVertex(G,Re,0,0,O),this.addCurrentVertex(G,Re.mult(-1),0,0,O)}else if(yt==="bevel"||yt==="fakeround"){const ct=-Math.sqrt(Ke*Ke-1),It=Tt?ct:0,mt=Tt?0:ct;if(Z&&this.addCurrentVertex(G,ne,It,mt,O),yt==="fakeround"){const st=Math.round(180*Je/Math.PI/20);for(let Bt=1;Bt2*N){const It=G.add(Y.sub(G)._mult(N/ct)._round());this.updateDistance(G,It),this.addCurrentVertex(It,ce,0,0,O),G=It}}}}addCurrentVertex(o,h,p,_,b,x=!1){const I=h.y*_-h.x,P=-h.y-h.x*_;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,I,P,x,!0,-_,b),this.distance>ib/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,_,b,x))}addHalfVertex({x:o,y:h},p,_,b,x,I,P){const A=.5*(this.lineClips?this.scaledDistance*(ib-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(I===0?0:I<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 N=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),P.primitiveLength++),x?this.e2=N:this.e1=N}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 ob,sb;Et("LineBucket",Ly,{omit:["layers","patternFeatures"]});var ab={get paint(){return sb=sb||new vo({"line-opacity":new Vt(Oe.paint_line["line-opacity"]),"line-color":new Vt(Oe.paint_line["line-color"]),"line-translate":new Dt(Oe.paint_line["line-translate"]),"line-translate-anchor":new Dt(Oe.paint_line["line-translate-anchor"]),"line-width":new Vt(Oe.paint_line["line-width"]),"line-gap-width":new Vt(Oe.paint_line["line-gap-width"]),"line-offset":new Vt(Oe.paint_line["line-offset"]),"line-blur":new Vt(Oe.paint_line["line-blur"]),"line-dasharray":new gc(Oe.paint_line["line-dasharray"]),"line-pattern":new Dh(Oe.paint_line["line-pattern"]),"line-gradient":new Lp(Oe.paint_line["line-gradient"])})},get layout(){return ob=ob||new vo({"line-cap":new Dt(Oe.layout_line["line-cap"]),"line-join":new Vt(Oe.layout_line["line-join"]),"line-miter-limit":new Dt(Oe.layout_line["line-miter-limit"]),"line-round-limit":new Dt(Oe.layout_line["line-round-limit"]),"line-sort-key":new Vt(Oe.layout_line["line-sort-key"])})}};class KT extends Vt{possiblyEvaluate(o,h){return h=new hr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,_){return h=de({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,_)}}let tg;class JT extends xs{constructor(o){super(o,ab),this.gradientVersion=0,tg||(tg=new KT(ab.paint.properties["line-width"].specification),tg.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 lc,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"]=tg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new Ly(o)}queryRadius(o){const h=o,p=lb(Gp("line-width",this,h),Gp("line-gap-width",this,h)),_=Gp("line-offset",this,h);return p/2+Math.abs(_)+Xm(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,_,b,x,I){const P=Ym(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,I),A=I/2*lb(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),N=this.paint.get("line-offset").evaluate(h,p);return N&&(_=function(O,G){const Z=[];for(let Y=0;Y=3){for(let ce=0;ce0?o+2*u:u}const QT=Gr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),$T=Gr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Gr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const eL=Gr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Gr([{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 ub=Gr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tL=Gr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function nL(u,o,h){return u.sections.forEach(p=>{p.text=function(_,b,x){const I=b.layout.get("text-transform").evaluate(x,{});return I==="uppercase"?_=_.toLocaleUpperCase():I==="lowercase"&&(_=_.toLocaleLowerCase()),Qa.applyArabicShaping&&(_=Qa.applyArabicShaping(_)),_}(p.text,o,h)}),u}Gr([{name:"triangle",components:3,type:"Uint16"}]),Gr([{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"}]),Gr([{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"}]),Gr([{type:"Float32",name:"offsetX"}]),Gr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Gr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Jp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ci=24,cb=Yn,hb=function(u,o,h,p,_){var b,x,I=8*_-p-1,P=(1<>1,N=-7,O=h?_-1:0,G=h?-1:1,Z=u[o+O];for(O+=G,b=Z&(1<<-N)-1,Z>>=-N,N+=I;N>0;b=256*b+u[o+O],O+=G,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=p;N>0;x=256*x+u[o+O],O+=G,N-=8);if(b===0)b=1-A;else{if(b===P)return x?NaN:1/0*(Z?-1:1);x+=Math.pow(2,p),b-=A}return(Z?-1:1)*x*Math.pow(2,b-p)},fb=function(u,o,h,p,_,b){var x,I,P,A=8*b-_-1,N=(1<>1,G=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,Z=p?0:b-1,Y=p?1:-1,ne=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(I=isNaN(o)?1:0,x=N):(x=Math.floor(Math.log(o)/Math.LN2),o*(P=Math.pow(2,-x))<1&&(x--,P*=2),(o+=x+O>=1?G/P:G*Math.pow(2,1-O))*P>=2&&(x++,P/=2),x+O>=N?(I=0,x=N):x+O>=1?(I=(o*P-1)*Math.pow(2,_),x+=O):(I=o*Math.pow(2,O-1)*Math.pow(2,_),x=0));_>=8;u[h+Z]=255&I,Z+=Y,I/=256,_-=8);for(x=x<<_|I,A+=_;A>0;u[h+Z]=255&x,Z+=Y,x/=256,A-=8);u[h+Z-Y]|=128*ne};function Yn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}Yn.Varint=0,Yn.Fixed64=1,Yn.Bytes=2,Yn.Fixed32=5;var Py=4294967296,pb=1/Py,db=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Fl(u){return u.type===Yn.Bytes?u.readVarint()+u.pos:u.pos+1}function Zh(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function mb(u,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 _=h.pos-1;_>=u;_--)h.buf[_+p]=h.buf[_]}function rL(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function gb(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}Yn.prototype={destroy:function(){this.buf=null},readFields:function(u,o,h){for(h=h||this.length;this.pos>3,b=this.pos;this.type=7&p,u(_,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=ng(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=gb(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=ng(this.buf,this.pos)+ng(this.buf,this.pos+4)*Py;return this.pos+=8,u},readSFixed64:function(){var u=ng(this.buf,this.pos)+gb(this.buf,this.pos+4)*Py;return this.pos+=8,u},readFloat:function(){var u=hb(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=hb(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){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(_,b,x){var I,P,A=x.buf;if(I=(112&(P=A[x.pos++]))>>4,P<128||(I|=(127&(P=A[x.pos++]))<<3,P<128)||(I|=(127&(P=A[x.pos++]))<<10,P<128)||(I|=(127&(P=A[x.pos++]))<<17,P<128)||(I|=(127&(P=A[x.pos++]))<<24,P<128)||(I|=(1&(P=A[x.pos++]))<<31,P<128))return Zh(_,I,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,o=this.pos;return this.pos=u,u-o>=12&&db?function(h,p,_){return db.decode(h.subarray(p,_))}(this.buf,o,u):function(h,p,_){for(var b="",x=p;x<_;){var I,P,A,N=h[x],O=null,G=N>239?4:N>223?3:N>191?2:1;if(x+G>_)break;G===1?N<128&&(O=N):G===2?(192&(I=h[x+1]))==128&&(O=(31&N)<<6|63&I)<=127&&(O=null):G===3?(P=h[x+2],(192&(I=h[x+1]))==128&&(192&P)==128&&((O=(15&N)<<12|(63&I)<<6|63&P)<=2047||O>=55296&&O<=57343)&&(O=null)):G===4&&(P=h[x+2],A=h[x+3],(192&(I=h[x+1]))==128&&(192&P)==128&&(192&A)==128&&((O=(15&N)<<18|(63&I)<<12|(63&P)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,G=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=G}return b}(this.buf,o,u)},readBytes:function(){var u=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,u);return this.pos=u,o},readPackedVarint:function(u,o){if(this.type!==Yn.Bytes)return u.push(this.readVarint(o));var h=Fl(this);for(u=u||[];this.pos127;);else if(o===Yn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Yn.Fixed32)this.pos+=4;else{if(o!==Yn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(u,o){this.writeVarint(u<<3|o)},realloc:function(u){for(var o=this.length||16;o268435455||u<0?function(o,h){var p,_;if(o>=0?(p=o%4294967296|0,_=o/4294967296|0):(_=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,_=_+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(b,x,I){I.buf[I.pos++]=127&b|128,b>>>=7,I.buf[I.pos++]=127&b|128,b>>>=7,I.buf[I.pos++]=127&b|128,b>>>=7,I.buf[I.pos++]=127&b|128,I.buf[I.pos]=127&(b>>>=7)}(p,0,h),function(b,x){var I=(7&b)<<4;x.buf[x.pos++]|=I|((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)))))}(_,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var o=this.pos;this.pos=function(p,_,b){for(var x,I,P=0;P<_.length;P++){if((x=_.charCodeAt(P))>55295&&x<57344){if(!I){x>56319||P+1===_.length?(p[b++]=239,p[b++]=191,p[b++]=189):I=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,I=x;continue}x=I-55296<<10|x-56320|65536,I=null}else I&&(p[b++]=239,p[b++]=191,p[b++]=189,I=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,u,this.pos);var h=this.pos-o;h>=128&&mb(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),fb(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),fb(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var o=u.length;this.writeVarint(o),this.realloc(o);for(var h=0;h=128&&mb(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,h){this.writeTag(u,Yn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,rL,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,iL,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,aL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,oL,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,sL,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,lL,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,uL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,cL,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,hL,o)},writeBytesField:function(u,o){this.writeTag(u,Yn.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,Yn.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,Yn.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,Yn.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var My=m(cb);const Ay=3;function fL(u,o,h){u===1&&h.readMessage(pL,o)}function pL(u,o,h){if(u===3){const{id:p,bitmap:_,width:b,height:x,left:I,top:P,advance:A}=h.readMessage(dL,{});o.push({id:p,bitmap:new qp({width:b+2*Ay,height:x+2*Ay},_),metrics:{width:b,height:x,left:I,top:P,advance:A}})}}function dL(u,o,h){u===1?o.id=h.readVarint():u===2?o.bitmap=h.readBytes():u===3?o.width=h.readVarint():u===4?o.height=h.readVarint():u===5?o.left=h.readSVarint():u===6?o.top=h.readSVarint():u===7&&(o.advance=h.readVarint())}const _b=Ay;function yb(u){let o=0,h=0;for(const x of u)o+=x.w*x.h,h=Math.max(h,x.w);u.sort((x,I)=>I.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let _=0,b=0;for(const x of u)for(let I=p.length-1;I>=0;I--){const P=p[I];if(!(x.w>P.w||x.h>P.h)){if(x.x=P.x,x.y=P.y,b=Math.max(b,x.y+x.h),_=Math.max(_,x.x+x.w),x.w===P.w&&x.h===P.h){const A=p.pop();I=0&&p>=o&&ig[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 Yh;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($p.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function rg(u,o,h,p,_,b,x,I,P,A,N,O,G,Z,Y,ne){const ce=Yh.fromFeature(u,_);let ge;O===c.ah.vertical&&ce.verticalizePunctuation();const{processBidirectionalText:Re,processStyledBidirectionalText:ve}=Qa;if(Re&&ce.sections.length===1){ge=[];const Je=Re(ce.toString(),Dy(ce,A,b,o,p,Z,Y));for(const wt of Je){const Tt=new Yh;Tt.text=wt,Tt.sections=ce.sections;for(let xt=0;xt0&&Vl>Vo&&(Vo=Vl)}else{const Es=Tt[wn.fontStack],Go=Es&&Es[Vi];if(Go&&Go.rect)Ea=Go.rect,Xs=Go.metrics;else{const Vl=wt[wn.fontStack],id=Vl&&Vl[Vi];if(!id)continue;Xs=id.metrics}mi=(pi-wn.scale)*ci}Ys?(Je.verticalizable=!0,io.push({glyph:Vi,imageName:Ia,x:ar,y:pr+mi,vertical:Ys,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:oo,metrics:Xs,rect:Ea}),ar+=Bl*wn.scale+Bt):(io.push({glyph:Vi,imageName:Ia,x:ar,y:pr+mi,vertical:Ys,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:oo,metrics:Xs,rect:Ea}),ar+=Xs.advance*wn.scale+Bt)}io.length!==0&&(hi=Math.max(ar-Bt,hi),_L(io,0,io.length-1,xo,Vo)),ar=0;const Uo=ct*pi+Vo;Eo.lineOffset=Math.max(Vo,ro),pr+=Uo,is=Math.max(Uo,is),++si}var ki;const Bi=pr-Qp,{horizontalAlign:wo,verticalAlign:So}=Ry(It);(function(fi,pi,ro,Eo,io,Vo,Uo,di,wn){const oo=(pi-ro)*io;let Vi=0;Vi=Vo!==Uo?-di*Eo-Qp:(-Eo*wn+.5)*Uo;for(const mi of fi)for(const Xs of mi.positionedGlyphs)Xs.x+=oo,Xs.y+=Vi})(Je.positionedLines,xo,wo,So,hi,is,ct,Bi,yt.length),Je.top+=-So*Bi,Je.bottom=Je.top+Bi,Je.left+=-wo*hi,Je.right=Je.left+hi}(Ke,o,h,p,ge,x,I,P,O,A,G,ne),!function(Je){for(const wt of Je)if(wt.positionedGlyphs.length!==0)return!1;return!0}(Le)&&Ke}const ig={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},mL={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 bb(u,o,h,p,_,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ci/b+_:0}{const x=h[o.fontStack],I=x&&x[u];return I?I.metrics.advance*o.scale+_:0}}function xb(u,o,h,p){const _=Math.pow(u-o,2);return p?u=0;let N=0;for(let G=0;Gx.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=my([]),this.placementViewportMatrix=my([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ib(this.zoom,h["text-size"]),this.iconSizeData=Ib(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=Ny(p,"text-overlap","text-allow-overlap")!=="never"||Ny(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-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 zy(new br(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new zy(new br(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new g,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,h,p,_,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!N)return;const G=h.iconDependencies,Z=h.glyphDependencies,Y=h.availableImages,ne=new hr(this.zoom);for(const{feature:ce,id:ge,index:Re,sourceLayerIndex:ve}of o){const Le=_._featureFilter.needGeometry,Ke=zl(ce,Le);if(!_._featureFilter.filter(ne,Ke,p))continue;let Je,wt;if(Le||(Ke.geometry=Ol(ce)),A){const xt=_.getValueAndResolveTokens("text-field",Ke,p,Y),yt=Ro.factory(xt),ct=this.hasRTLText=this.hasRTLText||xL(yt);(!ct||Qa.getRTLTextPluginStatus()==="unavailable"||ct&&Qa.isParsed())&&(Je=nL(yt,_,Ke))}if(N){const xt=_.getValueAndResolveTokens("icon-image",Ke,p,Y);wt=xt instanceof ts?xt:ts.fromString(xt)}if(!Je&&!wt)continue;const Tt=this.sortFeaturesByKey?O.evaluate(Ke,{},p):void 0;if(this.features.push({id:ge,text:Je,icon:wt,index:Re,sourceLayerIndex:ve,geometry:Ke.geometry,properties:ce.properties,type:vL[ce.type],sortKey:Tt}),wt&&(G[wt.name]=!0),Je){const xt=x.evaluate(Ke,{},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 ct of Je.sections)if(ct.image)G[ct.image.name]=!0;else{const It=bu(Je.toString()),mt=ct.fontStack||xt,st=Z[mt]=Z[mt]||{};this.calculateGlyphDependencies(ct.text,st,yt,this.allowVerticalPlacement,It)}}}b.get("symbol-placement")==="line"&&(this.features=function(ce){const ge={},Re={},ve=[];let Le=0;function Ke(xt){ve.push(ce[xt]),Le++}function Je(xt,yt,ct){const It=Re[xt];return delete Re[xt],Re[yt]=It,ve[It].geometry[0].pop(),ve[It].geometry[0]=ve[It].geometry[0].concat(ct[0]),It}function wt(xt,yt,ct){const It=ge[yt];return delete ge[yt],ge[xt]=It,ve[It].geometry[0].shift(),ve[It].geometry[0]=ct[0].concat(ve[It].geometry[0]),It}function Tt(xt,yt,ct){const It=ct?yt[0][yt[0].length-1]:yt[0][0];return`${xt}:${It.x}:${It.y}`}for(let xt=0;xtxt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ce,ge)=>ce.sortKey-ge.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 _=o.dist(h[o.segment+1]),b=o.dist(h[o.segment]);const x={};for(let I=o.segment+1;I=0;I--)x[I]={x:h[I].x,y:h[I].y,tileUnitDistanceFromAnchor:b},I>0&&(b+=h[I-1].dist(h[I]));for(let I=0;I0}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),_=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;b<_;b+=4)o.indexArray.emplaceBack(b,b+1,b+2),o.indexArray.emplaceBack(b+1,b+2,b+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),_=[],b=[],x=[];for(let I=0;I_[I]-_[P]||b[P]-b[I]),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((_,b,x)=>{_>=0&&x.indexOf(_)===b&&this.addIndicesForPlacedSymbol(this.text,_)}),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 Cb,Tb;Et("SymbolBucket",Kh,{omit:["layers","collisionBoxArray","features","compareText"]}),Kh.MAX_GLYPHS=65535,Kh.addDynamicAttributes=Oy;var By={get paint(){return Tb=Tb||new vo({"icon-opacity":new Vt(Oe.paint_symbol["icon-opacity"]),"icon-color":new Vt(Oe.paint_symbol["icon-color"]),"icon-halo-color":new Vt(Oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vt(Oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vt(Oe.paint_symbol["icon-halo-blur"]),"icon-translate":new Dt(Oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Dt(Oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vt(Oe.paint_symbol["text-opacity"]),"text-color":new Vt(Oe.paint_symbol["text-color"],{runtimeType:Rr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Vt(Oe.paint_symbol["text-halo-color"]),"text-halo-width":new Vt(Oe.paint_symbol["text-halo-width"]),"text-halo-blur":new Vt(Oe.paint_symbol["text-halo-blur"]),"text-translate":new Dt(Oe.paint_symbol["text-translate"]),"text-translate-anchor":new Dt(Oe.paint_symbol["text-translate-anchor"])})},get layout(){return Cb=Cb||new vo({"symbol-placement":new Dt(Oe.layout_symbol["symbol-placement"]),"symbol-spacing":new Dt(Oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Dt(Oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vt(Oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Dt(Oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Dt(Oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Dt(Oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Dt(Oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Dt(Oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Dt(Oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vt(Oe.layout_symbol["icon-size"]),"icon-text-fit":new Dt(Oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Dt(Oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vt(Oe.layout_symbol["icon-image"]),"icon-rotate":new Vt(Oe.layout_symbol["icon-rotate"]),"icon-padding":new Vt(Oe.layout_symbol["icon-padding"]),"icon-keep-upright":new Dt(Oe.layout_symbol["icon-keep-upright"]),"icon-offset":new Vt(Oe.layout_symbol["icon-offset"]),"icon-anchor":new Vt(Oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Dt(Oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Dt(Oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Dt(Oe.layout_symbol["text-rotation-alignment"]),"text-field":new Vt(Oe.layout_symbol["text-field"]),"text-font":new Vt(Oe.layout_symbol["text-font"]),"text-size":new Vt(Oe.layout_symbol["text-size"]),"text-max-width":new Vt(Oe.layout_symbol["text-max-width"]),"text-line-height":new Dt(Oe.layout_symbol["text-line-height"]),"text-letter-spacing":new Vt(Oe.layout_symbol["text-letter-spacing"]),"text-justify":new Vt(Oe.layout_symbol["text-justify"]),"text-radial-offset":new Vt(Oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Dt(Oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Vt(Oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Vt(Oe.layout_symbol["text-anchor"]),"text-max-angle":new Dt(Oe.layout_symbol["text-max-angle"]),"text-writing-mode":new Dt(Oe.layout_symbol["text-writing-mode"]),"text-rotate":new Vt(Oe.layout_symbol["text-rotate"]),"text-padding":new Dt(Oe.layout_symbol["text-padding"]),"text-keep-upright":new Dt(Oe.layout_symbol["text-keep-upright"]),"text-transform":new Vt(Oe.layout_symbol["text-transform"]),"text-offset":new Vt(Oe.layout_symbol["text-offset"]),"text-allow-overlap":new Dt(Oe.layout_symbol["text-allow-overlap"]),"text-overlap":new Dt(Oe.layout_symbol["text-overlap"]),"text-ignore-placement":new Dt(Oe.layout_symbol["text-ignore-placement"]),"text-optional":new Dt(Oe.layout_symbol["text-optional"])})}};class Lb{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:ei,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}}Et("FormatSectionOverride",Lb,{omit:["defaultValue"]});class sg extends xs{constructor(o){super(o,By)}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 _=[];for(const b of p)_.indexOf(b)<0&&_.push(b);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,_){const b=this.layout.get(o).evaluate(h,{},p,_),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||$n(x.value)||!b?b:function(I,P){return P.replace(/{([^{}]+)}/g,(A,N)=>I&&N in I?String(I[N]):"")}(h.properties,b)}createBucket(o){return new Kh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of By.paint.overridableProperties){if(!sg.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new Lb(h),_=new sr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new vh("source",_):new _p("composite",_,h.value.zoomStops),this.paint._values[o]=new bs(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&sg.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),_=By.paint.properties[h];let b=!1;const x=I=>{for(const P of I)if(_.overrides&&_.overrides.hasOverride(P))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ro)x(p.value.value.sections);else if(p.value.kind==="source"){const I=A=>{b||(A instanceof Za&&ni(A.value)===Vr?x(A.value.sections):A instanceof _h?x(A.sections):A.eachChild(I))},P=p.value;P._styleExpression&&I(P._styleExpression.expression)}return b}}let Pb;var wL={get paint(){return Pb=Pb||new vo({"background-color":new Dt(Oe.paint_background["background-color"]),"background-pattern":new gc(Oe.paint_background["background-pattern"]),"background-opacity":new Dt(Oe.paint_background["background-opacity"])})}};class SL extends xs{constructor(o){super(o,wL)}}let Mb;var EL={get paint(){return Mb=Mb||new vo({"raster-opacity":new Dt(Oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Dt(Oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Dt(Oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Dt(Oe.paint_raster["raster-brightness-max"]),"raster-saturation":new Dt(Oe.paint_raster["raster-saturation"]),"raster-contrast":new Dt(Oe.paint_raster["raster-contrast"]),"raster-resampling":new Dt(Oe.paint_raster["raster-resampling"]),"raster-fade-duration":new Dt(Oe.paint_raster["raster-fade-duration"])})}};class IL extends xs{constructor(o){super(o,EL)}}class CL extends xs{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 TL{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 Vy=63710088e-1;class Iu{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 Iu(me(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,_=o.lat*h,b=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((o.lng-this.lng)*h);return Vy*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof Iu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Iu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Iu(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 Ab=2*Math.PI*Vy;function kb(u){return Ab*Math.cos(u*Math.PI/180)}function Db(u){return(180+u)/360}function Rb(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function Nb(u,o){return u/kb(o)}function Uy(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class ag{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=Iu.convert(o);return new ag(Db(p.lng),Rb(p.lat),Nb(h,p.lat))}toLngLat(){return new Iu(360*this.x-180,Uy(this.y))}toAltitude(){return this.z*kb(Uy(this.y))}meterInMercatorCoordinateUnits(){return 1/Ab*(o=Uy(this.y),1/Math.cos(o*Math.PI/180));var o}}function Ob(u,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class Gy{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=td(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 _=(x=this.y,I=this.z,P=Ob(256*(b=this.x),256*(x=Math.pow(2,I)-x-1),I),A=Ob(256*(b+1),256*(x+1),I),P[0]+","+P[1]+","+A[0]+","+A[1]);var b,x,I,P,A;const N=function(O,G,Z){let Y,ne="";for(let ce=O;ce>0;ce--)Y=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,_)}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 E((o.x*h-this.x)*Nr,(o.y*h-this.y)*Nr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class zb{constructor(o,h){this.wrap=o,this.canonical=h,this.key=td(o,h.z,h.z,h.x,h.y)}}class Ss{constructor(o,h,p,_,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new Gy(p,+_,+b),this.key=td(h,o,p,_,b)}clone(){return new Ss(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 Ss(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(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?td(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):td(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 Ss(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,_=2*this.canonical.y;return[new Ss(h,this.wrap,h,p,_),new Ss(h,this.wrap,h,p+1,_),new Ss(h,this.wrap,h,p,_+1),new Ss(h,this.wrap,h,p+1,_+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 ws({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 _=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,I=p*this.dim+this.dim;switch(h){case-1:_=b-1;break;case 1:b=_+1}switch(p){case-1:x=I-1;break;case 1:I=x+1}const P=-h*this.dim,A=-p*this.dim;for(let N=x;N=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 Vb{constructor(o,h,p,_,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._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 Ub{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new pc(Nr,16,0),this.grid3D=new pc(Nr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,_,b,x){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,b);const P=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&P.insert(I,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new wu.VectorTile(new My(this.rawTileData)).layers,this.sourceLayerCoder=new Bb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,_){this.loadVTLayers();const b=o.params||{},x=Nr/o.tileSize/o.scale,I=Sh(b.filter),P=o.queryGeometry,A=o.queryPadding*x,N=jb(P),O=this.grid.query(N.minX-A,N.minY-A,N.maxX+A,N.maxY+A),G=jb(o.cameraQueryGeometry),Z=this.grid3D.query(G.minX-A,G.minY-A,G.maxX+A,G.maxY+A,(ce,ge,Re,ve)=>function(Le,Ke,Je,wt,Tt){for(const yt of Le)if(Ke<=yt.x&&Je<=yt.y&&wt>=yt.x&&Tt>=yt.y)return!0;const xt=[new E(Ke,Je),new E(Ke,Tt),new E(wt,Tt),new E(wt,Je)];if(Le.length>2){for(const yt of xt)if(jh(Le,yt))return!0}for(let yt=0;yt(ve||(ve=Ol(Le)),Ke.queryIntersectsFeature(P,Le,Je,ve,this.z,o.transform,x,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,h,p,_,b,x,I,P,A,N,O){const G=this.bucketLayerIDs[h];if(x&&!function(ce,ge){for(let Re=0;Re=0)return!0;return!1}(x,G))return;const Z=this.sourceLayerCoder.decode(p),Y=this.vtLayers[Z].feature(_);if(b.needGeometry){const ce=zl(Y,!0);if(!b.filter(new hr(this.tileID.overscaledZ),ce,this.tileID.canonical))return}else if(!b.filter(new hr(this.tileID.overscaledZ),Y))return;const ne=this.getId(Y,Z);for(let ce=0;ce{const I=o instanceof mc?o.get(x):null;return I&&I.evaluate?I.evaluate(h,p,_):I})}function jb(u){let o=1/0,h=1/0,p=-1/0,_=-1/0;for(const b of u)o=Math.min(o,b.x),h=Math.min(h,b.y),p=Math.max(p,b.x),_=Math.max(_,b.y);return{minX:o,minY:h,maxX:p,maxY:_}}function LL(u,o){return o-u}function qb(u,o,h,p,_){const b=[];for(let x=0;x=p&&O.x>=p||(N.x>=p?N=new E(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round():O.x>=p&&(O=new E(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round()),N.y>=_&&O.y>=_||(N.y>=_?N=new E(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round():O.y>=_&&(O=new E(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round()),P&&N.equals(P[P.length-1])||(P=[N],b.push(P)),P.push(O)))))}}return b}Et("FeatureIndex",Ub,{omit:["rawTileData","sourceLayerCoder"]});class Cu extends E{constructor(o,h,p,_){super(o,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new Cu(this.x,this.y,this.angle,this.segment)}}function Wb(u,o,h,p,_){if(o.segment===void 0||h===0)return!0;let b=o,x=o.segment+1,I=0;for(;I>-h/2;){if(x--,x<0)return!1;I-=u[x].dist(b),b=u[x]}I+=u[x].dist(u[x+1]),x++;const P=[];let A=0;for(;Ip;)A-=P.shift().angleDelta;if(A>_)return!1;x++,I+=N.dist(O)}return!0}function Hb(u){let o=0;for(let h=0;hA){const Y=(A-P)/Z,ne=to.number(O.x,G.x,Y),ce=to.number(O.y,G.y,Y),ge=new Cu(ne,ce,G.angleTo(O),N);return ge._round(),!x||Wb(u,ge,I,x,o)?ge:void 0}P+=Z}}function ML(u,o,h,p,_,b,x,I,P){const A=Zb(p,b,x),N=Xb(p,_),O=N*x,G=u[0].x===0||u[0].x===P||u[0].y===0||u[0].y===P;return o-O=0&&Le=0&&Ke=0&&G+A<=N){const Je=new Cu(Le,Ke,Re,Y);Je._round(),p&&!Wb(u,Je,b,p,_)||Z.push(Je)}}O+=ge}return I||Z.length||x||(Z=Yb(u,O/2,h,p,_,b,x,!0,P)),Z}Et("Anchor",Cu);const Jh=Bo;function Kb(u,o,h,p){const _=[],b=u.image,x=b.pixelRatio,I=b.paddedRect.w-2*Jh,P=b.paddedRect.h-2*Jh,A=u.right-u.left,N=u.bottom-u.top,O=b.stretchX||[[0,I]],G=b.stretchY||[[0,P]],Z=(ct,It)=>ct+It[1]-It[0],Y=O.reduce(Z,0),ne=G.reduce(Z,0),ce=I-Y,ge=P-ne;let Re=0,ve=Y,Le=0,Ke=ne,Je=0,wt=ce,Tt=0,xt=ge;if(b.content&&p){const ct=b.content;Re=lg(O,0,ct[0]),Le=lg(G,0,ct[1]),ve=lg(O,ct[0],ct[2]),Ke=lg(G,ct[1],ct[3]),Je=ct[0]-Re,Tt=ct[1]-Le,wt=ct[2]-ct[0]-ve,xt=ct[3]-ct[1]-Ke}const yt=(ct,It,mt,st)=>{const Bt=ug(ct.stretch-Re,ve,A,u.left),At=cg(ct.fixed-Je,wt,ct.stretch,Y),gn=ug(It.stretch-Le,Ke,N,u.top),ar=cg(It.fixed-Tt,xt,It.stretch,ne),pr=ug(mt.stretch-Re,ve,A,u.left),hi=cg(mt.fixed-Je,wt,mt.stretch,Y),is=ug(st.stretch-Le,Ke,N,u.top),xo=cg(st.fixed-Tt,xt,st.stretch,ne),si=new E(Bt,gn),ki=new E(pr,gn),Bi=new E(pr,is),wo=new E(Bt,is),So=new E(At/x,ar/x),fi=new E(hi/x,xo/x),pi=o*Math.PI/180;if(pi){const io=Math.sin(pi),Vo=Math.cos(pi),Uo=[Vo,-io,io,Vo];si._matMult(Uo),ki._matMult(Uo),wo._matMult(Uo),Bi._matMult(Uo)}const ro=ct.stretch+ct.fixed,Eo=It.stretch+It.fixed;return{tl:si,tr:ki,bl:wo,br:Bi,tex:{x:b.paddedRect.x+Jh+ro,y:b.paddedRect.y+Jh+Eo,w:mt.stretch+mt.fixed-ro,h:st.stretch+st.fixed-Eo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:So,pixelOffsetBR:fi,minFontScaleX:wt/x/A,minFontScaleY:xt/x/N,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ct=Jb(O,ce,Y),It=Jb(G,ge,ne);for(let mt=0;mt0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let O=x.top*I-P[0],G=x.bottom*I+P[2],Z=x.left*I-P[3],Y=x.right*I+P[1];const ne=x.collisionPadding;if(ne&&(Z-=ne[0]*I,O-=ne[1]*I,Y+=ne[2]*I,G+=ne[3]*I),N){const ce=new E(Z,O),ge=new E(Y,O),Re=new E(Z,G),ve=new E(Y,G),Le=N*Math.PI/180;ce._rotate(Le),ge._rotate(Le),Re._rotate(Le),ve._rotate(Le),Z=Math.min(ce.x,ge.x,Re.x,ve.x),Y=Math.max(ce.x,ge.x,Re.x,ve.x),O=Math.min(ce.y,ge.y,Re.y,ve.y),G=Math.max(ce.y,ge.y,Re.y,ve.y)}o.emplaceBack(h.x,h.y,Z,O,Y,G,p,_,b)}this.boxEndIndex=o.length}}class AL{constructor(o=[],h=kL){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,_=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(_,x)>=0)break;h[o]=x,o=b}h[o]=_}_down(o){const{data:h,compare:p}=this,_=this.length>>1,b=h[o];for(;o<_;){let x=1+(o<<1),I=h[x];const P=x+1;if(P=0)break;h[o]=I,o=x}h[o]=b}}function kL(u,o){return uo?1:0}function DL(u,o=1,h=!1){let p=1/0,_=1/0,b=-1/0,x=-1/0;const I=u[0];for(let Z=0;Zb)&&(b=Y.x),(!Z||Y.y>x)&&(x=Y.y)}const P=Math.min(b-p,x-_);let A=P/2;const N=new AL([],RL);if(P===0)return new E(p,_);for(let Z=p;ZO.d||!O.d)&&(O=Z,h&&console.log("found best %d after %d probes",Math.round(1e4*Z.d)/1e4,G)),Z.max-O.d<=o||(A=Z.h/2,N.push(new Qh(Z.p.x-A,Z.p.y-A,A,u)),N.push(new Qh(Z.p.x+A,Z.p.y-A,A,u)),N.push(new Qh(Z.p.x-A,Z.p.y+A,A,u)),N.push(new Qh(Z.p.x+A,Z.p.y+A,A,u)),G+=4)}return h&&(console.log(`num probes: ${G}`),console.log(`best distance: ${O.d}`)),O.p}function RL(u,o){return o.max-u.max}function Qh(u,o,h,p){this.p=new E(u,o),this.h=h,this.d=function(_,b){let x=!1,I=1/0;for(let P=0;P_.y!=Y.y>_.y&&_.x<(Y.x-Z.x)*(_.y-Z.y)/(Y.y-Z.y)+Z.x&&(x=!x),I=Math.min(I,R1(_,Z,Y))}}return(x?1:-1)*Math.sqrt(I)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Fi;c.ap=void 0,(Fi=c.ap||(c.ap={}))[Fi.center=1]="center",Fi[Fi.left=2]="left",Fi[Fi.right=3]="right",Fi[Fi.top=4]="top",Fi[Fi.bottom=5]="bottom",Fi[Fi["top-left"]=6]="top-left",Fi[Fi["top-right"]=7]="top-right",Fi[Fi["bottom-left"]=8]="bottom-left",Fi[Fi["bottom-right"]=9]="bottom-right";const Tu=7,jy=Number.POSITIVE_INFINITY;function Qb(u,o){return o[1]!==jy?function(h,p,_){let b=0,x=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":x=_-Tu;break;case"bottom-right":case"bottom-left":case"bottom":x=-_+Tu}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]}(u,o[0],o[1]):function(h,p){let _=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-Tu;break;case"bottom-right":case"bottom-left":b=-x+Tu;break;case"bottom":b=-p+Tu;break;case"top":b=p-Tu}switch(h){case"top-right":case"bottom-right":_=-x;break;case"top-left":case"bottom-left":_=x;break;case"left":_=p;break;case"right":_=-p}return[_,b]}(u,o[0])}function $b(u,o,h){var p;const _=u.layout,b=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const I=b.values,P=[];for(let A=0;AG*ci);N.startsWith("top")?O[1]-=Tu:N.startsWith("bottom")&&(O[1]+=Tu),P[A+1]=O}return new es(P)}const x=_.get("text-variable-anchor");if(x){let I;I=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(o,{},h)*ci,jy]:_.get("text-offset").evaluate(o,{},h).map(A=>A*ci);const P=[];for(const A of x)P.push(A,Qb(A,I));return new es(P)}return null}function qy(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function NL(u,o,h,p,_,b,x,I,P,A,N){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const G=u.layers[0].layout,Z=G.get("icon-offset").evaluate(o,{},N),Y=tx(h.horizontal),ne=x/24,ce=u.tilePixelRatio*ne,ge=u.tilePixelRatio*O/24,Re=u.tilePixelRatio*I,ve=u.tilePixelRatio*G.get("symbol-spacing"),Le=G.get("text-padding")*u.tilePixelRatio,Ke=function(st,Bt,At,gn=1){const ar=st.get("icon-padding").evaluate(Bt,{},At),pr=ar&&ar.values;return[pr[0]*gn,pr[1]*gn,pr[2]*gn,pr[3]*gn]}(G,o,N,u.tilePixelRatio),Je=G.get("text-max-angle")/180*Math.PI,wt=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Tt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",xt=G.get("symbol-placement"),yt=ve/2,ct=G.get("icon-text-fit");let It;p&&ct!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(It=Eb(p,h.vertical,ct,G.get("icon-text-fit-padding"),Z,ne)),Y&&(p=Eb(p,Y,ct,G.get("icon-text-fit-padding"),Z,ne)));const mt=(st,Bt)=>{Bt.x<0||Bt.x>=Nr||Bt.y<0||Bt.y>=Nr||function(At,gn,ar,pr,hi,is,xo,si,ki,Bi,wo,So,fi,pi,ro,Eo,io,Vo,Uo,di,wn,oo,Vi,mi,Xs){const Ea=At.addToLineVertexArray(gn,ar);let Ia,Bl,Ys,Es,Go=0,Vl=0,id=0,ox=0,Qy=-1,$y=-1;const Ul={};let sx=Lr("");if(At.allowVerticalPlacement&&pr.vertical){const so=si.layout.get("text-rotate").evaluate(wn,{},mi)+90;Ys=new hg(ki,gn,Bi,wo,So,pr.vertical,fi,pi,ro,so),xo&&(Es=new hg(ki,gn,Bi,wo,So,xo,io,Vo,ro,so))}if(hi){const so=si.layout.get("icon-rotate").evaluate(wn,{}),Is=si.layout.get("icon-text-fit")!=="none",Ec=Kb(hi,so,Vi,Is),Ta=xo?Kb(xo,so,Vi,Is):void 0;Bl=new hg(ki,gn,Bi,wo,So,hi,io,Vo,!1,so),Go=4*Ec.length;const Ic=At.iconSizeData;let rl=null;Ic.kind==="source"?(rl=[nl*si.layout.get("icon-size").evaluate(wn,{})],rl[0]>Eu&&Xe(`${At.layerIds[0]}: Value for "icon-size" is >= ${ed}. Reduce your "icon-size".`)):Ic.kind==="composite"&&(rl=[nl*oo.compositeIconSizes[0].evaluate(wn,{},mi),nl*oo.compositeIconSizes[1].evaluate(wn,{},mi)],(rl[0]>Eu||rl[1]>Eu)&&Xe(`${At.layerIds[0]}: Value for "icon-size" is >= ${ed}. Reduce your "icon-size".`)),At.addSymbols(At.icon,Ec,rl,di,Uo,wn,c.ah.none,gn,Ea.lineStartIndex,Ea.lineLength,-1,mi),Qy=At.icon.placedSymbolArray.length-1,Ta&&(Vl=4*Ta.length,At.addSymbols(At.icon,Ta,rl,di,Uo,wn,c.ah.vertical,gn,Ea.lineStartIndex,Ea.lineLength,-1,mi),$y=At.icon.placedSymbolArray.length-1)}const ax=Object.keys(pr.horizontal);for(const so of ax){const Is=pr.horizontal[so];if(!Ia){sx=Lr(Is.text);const Ta=si.layout.get("text-rotate").evaluate(wn,{},mi);Ia=new hg(ki,gn,Bi,wo,So,Is,fi,pi,ro,Ta)}const Ec=Is.positionedLines.length===1;if(id+=ex(At,gn,Is,is,si,ro,wn,Eo,Ea,pr.vertical?c.ah.horizontal:c.ah.horizontalOnly,Ec?ax:[so],Ul,Qy,oo,mi),Ec)break}pr.vertical&&(ox+=ex(At,gn,pr.vertical,is,si,ro,wn,Eo,Ea,c.ah.vertical,["vertical"],Ul,$y,oo,mi));const FL=Ia?Ia.boxStartIndex:At.collisionBoxArray.length,BL=Ia?Ia.boxEndIndex:At.collisionBoxArray.length,VL=Ys?Ys.boxStartIndex:At.collisionBoxArray.length,UL=Ys?Ys.boxEndIndex:At.collisionBoxArray.length,GL=Bl?Bl.boxStartIndex:At.collisionBoxArray.length,jL=Bl?Bl.boxEndIndex:At.collisionBoxArray.length,qL=Es?Es.boxStartIndex:At.collisionBoxArray.length,WL=Es?Es.boxEndIndex:At.collisionBoxArray.length;let Ca=-1;const pg=(so,Is)=>so&&so.circleDiameter?Math.max(so.circleDiameter,Is):Is;Ca=pg(Ia,Ca),Ca=pg(Ys,Ca),Ca=pg(Bl,Ca),Ca=pg(Es,Ca);const lx=Ca>-1?1:0;lx&&(Ca*=Xs/ci),At.glyphOffsetArray.length>=Kh.MAX_GLYPHS&&Xe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wn.sortKey!==void 0&&At.addToSortKeyRanges(At.symbolInstances.length,wn.sortKey);const HL=$b(si,wn,mi),[ZL,XL]=function(so,Is){const Ec=so.length,Ta=Is==null?void 0:Is.values;if((Ta==null?void 0:Ta.length)>0)for(let Ic=0;Ic=0?Ul.right:-1,Ul.center>=0?Ul.center:-1,Ul.left>=0?Ul.left:-1,Ul.vertical||-1,Qy,$y,sx,FL,BL,VL,UL,GL,jL,qL,WL,Bi,id,ox,Go,Vl,lx,0,fi,Ca,ZL,XL)}(u,Bt,st,h,p,_,It,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ce,[Le,Le,Le,Le],wt,P,Re,Ke,Tt,Z,o,b,A,N,x)};if(xt==="line")for(const st of qb(o.geometry,0,0,Nr,Nr)){const Bt=ML(st,ve,Je,h.vertical||Y,p,24,ge,u.overscaling,Nr);for(const At of Bt)Y&&OL(u,Y.text,yt,At)||mt(st,At)}else if(xt==="line-center"){for(const st of o.geometry)if(st.length>1){const Bt=PL(st,Je,h.vertical||Y,p,24,ge);Bt&&mt(st,Bt)}}else if(o.type==="Polygon")for(const st of wy(o.geometry,0)){const Bt=DL(st,16);mt(st[0],new Cu(Bt.x,Bt.y,0))}else if(o.type==="LineString")for(const st of o.geometry)mt(st,new Cu(st[0].x,st[0].y,0));else if(o.type==="Point")for(const st of o.geometry)for(const Bt of st)mt([Bt],new Cu(Bt.x,Bt.y,0))}function ex(u,o,h,p,_,b,x,I,P,A,N,O,G,Z,Y){const ne=function(Re,ve,Le,Ke,Je,wt,Tt,xt){const yt=Ke.layout.get("text-rotate").evaluate(wt,{})*Math.PI/180,ct=[];for(const It of ve.positionedLines)for(const mt of It.positionedGlyphs){if(!mt.rect)continue;const st=mt.rect||{};let Bt=_b+1,At=!0,gn=1,ar=0;const pr=(Je||xt)&&mt.vertical,hi=mt.metrics.advance*mt.scale/2;if(xt&&ve.verticalizable&&(ar=It.lineOffset/2-(mt.imageName?-(ci-mt.metrics.width*mt.scale)/2:(mt.scale-1)*ci)),mt.imageName){const di=Tt[mt.imageName];At=di.sdf,gn=di.pixelRatio,Bt=Bo/gn}const is=Je?[mt.x+hi,mt.y]:[0,0];let xo=Je?[0,0]:[mt.x+hi+Le[0],mt.y+Le[1]-ar],si=[0,0];pr&&(si=xo,xo=[0,0]);const ki=mt.metrics.isDoubleResolution?2:1,Bi=(mt.metrics.left-Bt)*mt.scale-hi+xo[0],wo=(-mt.metrics.top-Bt)*mt.scale+xo[1],So=Bi+st.w/ki*mt.scale/gn,fi=wo+st.h/ki*mt.scale/gn,pi=new E(Bi,wo),ro=new E(So,wo),Eo=new E(Bi,fi),io=new E(So,fi);if(pr){const di=new E(-hi,hi-Qp),wn=-Math.PI/2,oo=ci/2-hi,Vi=new E(5-Qp-oo,-(mt.imageName?oo:0)),mi=new E(...si);pi._rotateAround(wn,di)._add(Vi)._add(mi),ro._rotateAround(wn,di)._add(Vi)._add(mi),Eo._rotateAround(wn,di)._add(Vi)._add(mi),io._rotateAround(wn,di)._add(Vi)._add(mi)}if(yt){const di=Math.sin(yt),wn=Math.cos(yt),oo=[wn,-di,di,wn];pi._matMult(oo),ro._matMult(oo),Eo._matMult(oo),io._matMult(oo)}const Vo=new E(0,0),Uo=new E(0,0);ct.push({tl:pi,tr:ro,bl:Eo,br:io,tex:st,writingMode:ve.writingMode,glyphOffset:is,sectionIndex:mt.sectionIndex,isSDF:At,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return ct}(0,h,I,_,b,x,p,u.allowVerticalPlacement),ce=u.textSizeData;let ge=null;ce.kind==="source"?(ge=[nl*_.layout.get("text-size").evaluate(x,{})],ge[0]>Eu&&Xe(`${u.layerIds[0]}: Value for "text-size" is >= ${ed}. Reduce your "text-size".`)):ce.kind==="composite"&&(ge=[nl*Z.compositeTextSizes[0].evaluate(x,{},Y),nl*Z.compositeTextSizes[1].evaluate(x,{},Y)],(ge[0]>Eu||ge[1]>Eu)&&Xe(`${u.layerIds[0]}: Value for "text-size" is >= ${ed}. Reduce your "text-size".`)),u.addSymbols(u.text,ne,ge,I,b,x,A,o,P.lineStartIndex,P.lineLength,G,Y);for(const Re of N)O[Re]=u.text.placedSymbolArray.length-1;return 4*ne.length}function tx(u){for(const o in u)return u[o];return null}function OL(u,o,h,p){const _=u.compareText;if(o in _){const b=_[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const b=nx[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[I]=new Uint32Array(o,4,1);return new Wy(I,x,b,o)}constructor(o,h=64,p=Float64Array,_){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=nx.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,I=o*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-I%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+P,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+I+P),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+P,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 Hy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:I}=this,P=[0,b.length-1,0],A=[];for(;P.length;){const N=P.pop()||0,O=P.pop()||0,G=P.pop()||0;if(O-G<=I){for(let ce=G;ce<=O;ce++){const ge=x[2*ce],Re=x[2*ce+1];ge>=o&&ge<=p&&Re>=h&&Re<=_&&A.push(b[ce])}continue}const Z=G+O>>1,Y=x[2*Z],ne=x[2*Z+1];Y>=o&&Y<=p&&ne>=h&&ne<=_&&A.push(b[Z]),(N===0?o<=Y:h<=ne)&&(P.push(G),P.push(Z-1),P.push(1-N)),(N===0?p>=Y:_>=ne)&&(P.push(Z+1),P.push(O),P.push(1-N))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:b,nodeSize:x}=this,I=[0,_.length-1,0],P=[],A=p*p;for(;I.length;){const N=I.pop()||0,O=I.pop()||0,G=I.pop()||0;if(O-G<=x){for(let ce=G;ce<=O;ce++)ix(b[2*ce],b[2*ce+1],o,h)<=A&&P.push(_[ce]);continue}const Z=G+O>>1,Y=b[2*Z],ne=b[2*Z+1];ix(Y,ne,o,h)<=A&&P.push(_[Z]),(N===0?o-p<=Y:h-p<=ne)&&(I.push(G),I.push(Z-1),I.push(1-N)),(N===0?o+p>=Y:h+p>=ne)&&(I.push(Z+1),I.push(O),I.push(1-N))}return P}}function Hy(u,o,h,p,_,b){if(_-p<=h)return;const x=p+_>>1;rx(u,o,x,p,_,b),Hy(u,o,h,p,x-1,1-b),Hy(u,o,h,x+1,_,1-b)}function rx(u,o,h,p,_,b){for(;_>p;){if(_-p>600){const A=_-p+1,N=h-p+1,O=Math.log(A),G=.5*Math.exp(2*O/3),Z=.5*Math.sqrt(O*G*(A-G)/A)*(N-A/2<0?-1:1);rx(u,o,h,Math.max(p,Math.floor(h-N*G/A+Z)),Math.min(_,Math.floor(h+(A-N)*G/A+Z)),b)}const x=o[2*h+b];let I=p,P=_;for(nd(u,o,p,h),o[2*_+b]>x&&nd(u,o,p,_);Ix;)P--}o[2*p+b]===x?nd(u,o,p,P):(P++,nd(u,o,P,_)),P<=h&&(p=P+1),h<=P&&(_=P-1)}}function nd(u,o,h,p){Zy(u,h,p),Zy(o,2*h,2*p),Zy(o,2*h+1,2*p+1)}function Zy(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function ix(u,o,h,p){const _=u-h,b=o-p;return _*_+b*b}var Xy;c.bd=void 0,(Xy=c.bd||(c.bd={})).create="create",Xy.load="load",Xy.fullLoad="fullLoad";let fg=null,rd=[];const Yy=1e3/60,Ky="loadTime",Jy="fullLoadTime",zL={mark(u){performance.mark(u)},frame(u){const o=u;fg!=null&&rd.push(o-fg),fg=o},clearMetrics(){fg=null,rd=[],performance.clearMeasures(Ky),performance.clearMeasures(Jy);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(Ky,c.bd.create,c.bd.load),performance.measure(Jy,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(Ky)[0].duration,o=performance.getEntriesByName(Jy)[0].duration,h=rd.length,p=1/(rd.reduce((b,x)=>b+x,0)/h/1e3),_=rd.filter(b=>b>Yy).reduce((b,x)=>b+(x-Yy)/Yy,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};c.$=pt,c.A=qh,c.B=function(u){if(qe==null){const o=u.navigator?u.navigator.userAgent:null;qe=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return qe},c.C=class{constructor(u,o){this.target=u,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new TL(()=>this.process()),this.subscription=function(h,p,_,b){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=$e(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const I={id:_,type:"",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(I)},{once:!0});const b=[],x=Object.assign(Object.assign({},u),{id:_,sourceMapId:this.mapId,origin:location.origin,data:yu(u.data,b)});this.target.postMessage(x,{transfer:b})})}receive(u){const o=u.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($e(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 u=this.taskQueue.shift(),o=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(u,o)}processTask(u,o){return l(this,void 0,void 0,function*(){if(o.type===""){const _=this.resolveRejects[u];return delete this.resolveRejects[u],_?void(o.error?_.reject(vu(o.error)):_.resolve(vu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=vu(o.data),p=new AbortController;this.abortControllers[u]=p;try{const _=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,_)}catch(_){this.completeTask(u,_)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const _={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?yu(o):null,data:yu(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Dt,c.E=xn,c.F=function(){var u=new qh(16);return qh!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},c.G=Bn,c.H=function(u,o,h){var p,_,b,x,I,P,A,N,O,G,Z,Y,ne=h[0],ce=h[1],ge=h[2];return o===u?(u[12]=o[0]*ne+o[4]*ce+o[8]*ge+o[12],u[13]=o[1]*ne+o[5]*ce+o[9]*ge+o[13],u[14]=o[2]*ne+o[6]*ce+o[10]*ge+o[14],u[15]=o[3]*ne+o[7]*ce+o[11]*ge+o[15]):(_=o[1],b=o[2],x=o[3],I=o[4],P=o[5],A=o[6],N=o[7],O=o[8],G=o[9],Z=o[10],Y=o[11],u[0]=p=o[0],u[1]=_,u[2]=b,u[3]=x,u[4]=I,u[5]=P,u[6]=A,u[7]=N,u[8]=O,u[9]=G,u[10]=Z,u[11]=Y,u[12]=p*ne+I*ce+O*ge+o[12],u[13]=_*ne+P*ce+G*ge+o[13],u[14]=b*ne+A*ce+Z*ge+o[14],u[15]=x*ne+N*ce+Y*ge+o[15]),u},c.I=ky,c.J=function(u,o,h){var p=h[0],_=h[1],b=h[2];return u[0]=o[0]*p,u[1]=o[1]*p,u[2]=o[2]*p,u[3]=o[3]*p,u[4]=o[4]*_,u[5]=o[5]*_,u[6]=o[6]*_,u[7]=o[7]*_,u[8]=o[8]*b,u[9]=o[9]*b,u[10]=o[10]*b,u[11]=o[11]*b,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},c.K=F1,c.L=function(u,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 u){const _=window.document.createElement("source");ur(p)||(o.crossOrigin="Anonymous"),_.src=p,o.appendChild(_)}})},c.a3=function(){return re++},c.a4=y,c.a5=Kh,c.a6=Sh,c.a7=zl,c.a8=hr,c.a9=Vb,c.aA=H,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!fn(u.version,o.version))return[{command:"setStyle",args:[o]}];fn(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),fn(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),fn(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),fn(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),fn(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),fn(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),fn(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),fn(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),fn(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),fn(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},_=[];(function(x,I,P,A){let N;for(N in I=I||{},x=x||{})Object.prototype.hasOwnProperty.call(x,N)&&(Object.prototype.hasOwnProperty.call(I,N)||gs(N,P,A));for(N in I)Object.prototype.hasOwnProperty.call(I,N)&&(Object.prototype.hasOwnProperty.call(x,N)?fn(x[N],I[N])||(x[N].type==="geojson"&&I[N].type==="geojson"&&Ha(x,I,N)?er(P,{command:"setGeoJSONSourceData",args:[N,I[N].data]}):Vs(N,I,P,A)):Do(N,I,P))})(u.sources,o.sources,_,p);const b=[];u.layers&&u.layers.forEach(x=>{"source"in x&&p[x.source]?h.push({command:"removeLayer",args:[x.id]}):b.push(x)}),h=h.concat(_),function(x,I,P){I=I||[];const A=(x=x||[]).map(Cl),N=I.map(Cl),O=x.reduce(_s,{}),G=I.reduce(_s,{}),Z=A.slice(),Y=Object.create(null);let ne,ce,ge,Re,ve;for(let Le=0,Ke=0;Le@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,b)=>{const x=_||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(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=$,c.ad=function(u,o,h){var p=Math.sin(h),_=Math.cos(h),b=o[0],x=o[1],I=o[2],P=o[3],A=o[4],N=o[5],O=o[6],G=o[7];return o!==u&&(u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[0]=b*_+A*p,u[1]=x*_+N*p,u[2]=I*_+O*p,u[3]=P*_+G*p,u[4]=A*_-b*p,u[5]=N*_-x*p,u[6]=O*_-I*p,u[7]=G*_-P*p,u},c.ae=function(u){var o=new qh(16);return o[0]=u[0],o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=u[6],o[7]=u[7],o[8]=u[8],o[9]=u[9],o[10]=u[10],o[11]=u[11],o[12]=u[12],o[13]=u[13],o[14]=u[14],o[15]=u[15],o},c.af=Km,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:_,minZoom:b,maxZoom:x}=u,I=_?$(zi.interpolationFactor(_,o,b,x),0,1):0;u.kind==="camera"?p=to.number(u.minSize,u.maxSize,I):h=I}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:_}){return u.kind==="source"?p/nl:u.kind==="composite"?to.number(p/nl,_/nl,h):o},c.aj=Oy,c.ak=function(u,o,h,p){const _=o.y-u.y,b=o.x-u.x,x=p.y-h.y,I=p.x-h.x,P=x*b-I*_;if(P===0)return null;const A=(I*(u.y-h.y)-x*(u.x-h.x))/P;return new E(u.x+A*b,u.y+A*_)},c.al=qb,c.am=Fp,c.an=my,c.ao=ci,c.aq=Ny,c.ar=function(u,o){var h=o[0],p=o[1],_=o[2],b=o[3],x=o[4],I=o[5],P=o[6],A=o[7],N=o[8],O=o[9],G=o[10],Z=o[11],Y=o[12],ne=o[13],ce=o[14],ge=o[15],Re=h*I-p*x,ve=h*P-_*x,Le=h*A-b*x,Ke=p*P-_*I,Je=p*A-b*I,wt=_*A-b*P,Tt=N*ne-O*Y,xt=N*ce-G*Y,yt=N*ge-Z*Y,ct=O*ce-G*ne,It=O*ge-Z*ne,mt=G*ge-Z*ce,st=Re*mt-ve*It+Le*ct+Ke*yt-Je*xt+wt*Tt;return st?(u[0]=(I*mt-P*It+A*ct)*(st=1/st),u[1]=(_*It-p*mt-b*ct)*st,u[2]=(ne*wt-ce*Je+ge*Ke)*st,u[3]=(G*Je-O*wt-Z*Ke)*st,u[4]=(P*yt-x*mt-A*xt)*st,u[5]=(h*mt-_*yt+b*xt)*st,u[6]=(ce*Le-Y*wt-ge*ve)*st,u[7]=(N*wt-G*Le+Z*ve)*st,u[8]=(x*It-I*yt+A*Tt)*st,u[9]=(p*yt-h*It-b*Tt)*st,u[10]=(Y*Je-ne*Le+ge*Re)*st,u[11]=(O*Le-N*Je-Z*Re)*st,u[12]=(I*xt-x*ct-P*Tt)*st,u[13]=(h*ct-p*xt+_*Tt)*st,u[14]=(ne*ve-Y*Ke-ce*Re)*st,u[15]=(N*Ke-O*ve+G*Re)*st,u):null},c.as=qy,c.at=Ry,c.au=Wy,c.av=function(){const u={},o=Oe.$version;for(const h in Oe.$root){const p=Oe.$root[h];if(p.required){let _=null;_=h==="version"?o:p.type==="array"?[]:{},_!=null&&(u[h]=_)}}return u},c.aw=Om,c.ax=$r,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hst*ci)}let xt=x?"center":h.get("text-justify").evaluate(A,{},u.canonical);const yt=h.get("symbol-placement"),ct=yt==="point"?h.get("text-max-width").evaluate(A,{},u.canonical)*ci:0,It=()=>{u.bucket.allowVerticalPlacement&&bu(Le)&&(Y.vertical=rg(ne,u.glyphMap,u.glyphPositions,u.imagePositions,N,ct,b,wt,"left",Je,ge,c.ah.vertical,!0,yt,G,O))};if(!x&&Tt){const mt=new Set;if(xt==="auto")for(let Bt=0;Btl(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(u)],{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=de,c.f=u=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Pt})},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 _=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(_):Pt}),c.g=mn,c.h=(u,o)=>gr(de(u,{type:"json"}),o),c.i=$e,c.j=_t,c.k=Te,c.l=(u,o)=>gr(de(u,{type:"arrayBuffer"}),o),c.m=gr,c.n=function(u){return new My(u).readFields(fL,[])},c.o=qp,c.p=yb,c.q=vo,c.r=hy,c.s=ur,c.t=_u,c.u=bt,c.v=Oe,c.w=Xe,c.x=Dl,c.y=function([u,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(h),y:u*Math.sin(o)*Math.sin(h),z:u*Math.cos(h)}},c.z=to}),i("worker",["./shared"],function(c){class l{constructor(B){this.keyCache={},B&&this.replace(B)}replace(B){this._layerConfigs={},this._layers={},this.update(B,[])}update(B,W){for(const ae of B){this._layerConfigs[ae.id]=ae;const Ee=this._layers[ae.id]=c.az(ae);Ee._featureFilter=c.a6(Ee.filter),this.keyCache[ae.id]&&delete this.keyCache[ae.id]}for(const ae of W)delete this.keyCache[ae],delete this._layerConfigs[ae],delete this._layers[ae];this.familiesBySource={};const K=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const ae of K){const Ee=ae.map(He=>this._layers[He.id]),J=Ee[0];if(J.visibility==="none")continue;const Ie=J.source||"";let ye=this.familiesBySource[Ie];ye||(ye=this.familiesBySource[Ie]={});const De=J.sourceLayer||"_geojsonTileLayer";let Ge=ye[De];Ge||(Ge=ye[De]=[]),Ge.push(Ee)}}}class m{constructor(B){const W={},K=[];for(const Ie in B){const ye=B[Ie],De=W[Ie]={};for(const Ge in ye){const He=ye[+Ge];if(!He||He.bitmap.width===0||He.bitmap.height===0)continue;const Ye={x:0,y:0,w:He.bitmap.width+2,h:He.bitmap.height+2};K.push(Ye),De[Ge]={rect:Ye,metrics:He.metrics}}}const{w:ae,h:Ee}=c.p(K),J=new c.o({width:ae||1,height:Ee||1});for(const Ie in B){const ye=B[Ie];for(const De in ye){const Ge=ye[+De];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const He=W[Ie][De].rect;c.o.copy(Ge.bitmap,J,{x:0,y:0},{x:He.x+1,y:He.y+1},Ge.bitmap)}}this.image=J,this.positions=W}}c.bi("GlyphAtlas",m);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,W,K,ae){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=B,this.collisionBoxArray=new c.a4;const Ee=new c.bj(Object.keys(B.layers).sort()),J=new c.bk(this.tileID,this.promoteId);J.bucketLayerIDs=[];const Ie={},ye={featureIndex:J,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},De=W.familiesBySource[this.source];for(const cn in De){const Ir=B.layers[cn];if(!Ir)continue;Ir.version===1&&c.w(`Vector tile source "${this.source}" layer "${cn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ai=Ee.encode(cn),eo=[];for(let go=0;go=wi.maxzoom||wi.visibility!=="none"&&(S(go,this.zoom,K),(Ie[wi.id]=wi.createBucket({index:J.bucketLayerIDs.length,layers:go,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(eo,ye,this.tileID.canonical),J.bucketLayerIDs.push(go.map(Us=>Us.id)))}}const Ge=c.aE(ye.glyphDependencies,cn=>Object.keys(cn).map(Number));this.inFlightDependencies.forEach(cn=>cn==null?void 0:cn.abort()),this.inFlightDependencies=[];let He=Promise.resolve({});if(Object.keys(Ge).length){const cn=new AbortController;this.inFlightDependencies.push(cn),He=ae.sendAsync({type:"GG",data:{stacks:Ge,source:this.source,tileID:this.tileID,type:"glyphs"}},cn)}const Ye=Object.keys(ye.iconDependencies);let Mt=Promise.resolve({});if(Ye.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Mt=ae.sendAsync({type:"GI",data:{icons:Ye,source:this.source,tileID:this.tileID,type:"icons"}},cn)}const Rt=Object.keys(ye.patternDependencies);let Yt=Promise.resolve({});if(Rt.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Yt=ae.sendAsync({type:"GI",data:{icons:Rt,source:this.source,tileID:this.tileID,type:"patterns"}},cn)}const[Qt,En,Xn]=yield Promise.all([He,Mt,Yt]),cr=new m(Qt),ti=new c.bl(En,Xn);for(const cn in Ie){const Ir=Ie[cn];Ir instanceof c.a5?(S(Ir.layers,this.zoom,K),c.bm({bucket:Ir,glyphMap:Qt,glyphPositions:cr.positions,imageMap:En,imagePositions:ti.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ir.hasPattern&&(Ir instanceof c.bn||Ir instanceof c.bo||Ir instanceof c.bp)&&(S(Ir.layers,this.zoom,K),Ir.addFeatures(ye,this.tileID.canonical,ti.patternPositions))}return this.status="done",{buckets:Object.values(Ie).filter(cn=>!cn.isEmpty()),featureIndex:J,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:cr.image,imageAtlas:ti,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?En:null,glyphPositions:this.returnDependencies?cr.positions:null}})}}function S(he,B,W){const K=new c.a8(B);for(const ae of he)ae.recalculate(K,W)}class E{constructor(B,W,K){this.actor=B,this.layerIndex=W,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(B,W){return c._(this,void 0,void 0,function*(){const K=yield c.l(B.request,W);try{return{vectorTile:new c.bq.VectorTile(new c.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(ae){const Ee=new Uint8Array(K.data);let J=`Unable to parse the tile at ${B.request.url}, `;throw J+=Ee[0]===31&&Ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ae.messge}`,new Error(J)}})}loadTile(B){return c._(this,void 0,void 0,function*(){const W=B.uid,K=!!(B&&B.request&&B.request.collectResourceTiming)&&new c.bs(B.request),ae=new w(B);this.loading[W]=ae;const Ee=new AbortController;ae.abort=Ee;try{const J=yield this.loadVectorTile(B,Ee);if(delete this.loading[W],!J)return null;const Ie=J.rawData,ye={};J.expires&&(ye.expires=J.expires),J.cacheControl&&(ye.cacheControl=J.cacheControl);const De={};if(K){const He=K.finish();He&&(De.resourceTiming=JSON.parse(JSON.stringify(He)))}ae.vectorTile=J.vectorTile;const Ge=ae.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=ae,this.fetching[W]={rawTileData:Ie,cacheControl:ye,resourceTiming:De};try{const He=yield Ge;return c.e({rawTileData:Ie.slice(0)},He,ye,De)}finally{delete this.fetching[W]}}catch(J){throw delete this.loading[W],ae.status="done",this.loaded[W]=ae,J}})}reloadTile(B){return c._(this,void 0,void 0,function*(){const W=B.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[W];if(K.showCollisionBoxes=B.showCollisionBoxes,K.status==="parsing"){const ae=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let Ee;if(this.fetching[W]){const{rawTileData:J,cacheControl:Ie,resourceTiming:ye}=this.fetching[W];delete this.fetching[W],Ee=c.e({rawTileData:J.slice(0)},ae,Ie,ye)}else Ee=ae;return Ee}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 W=this.loading,K=B.uid;W&&W[K]&&W[K].abort&&(W[K].abort.abort(),delete W[K])})}removeTile(B){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[B.uid]&&delete this.loaded[B.uid]})}}class T{constructor(){this.loaded={}}loadTile(B){return c._(this,void 0,void 0,function*(){const{uid:W,encoding:K,rawImageData:ae,redFactor:Ee,greenFactor:J,blueFactor:Ie,baseShift:ye}=B,De=ae.width+2,Ge=ae.height+2,He=c.b(ae)?new c.R({width:De,height:Ge},yield c.bt(ae,-1,-1,De,Ge)):ae,Ye=new c.bu(W,He,K,Ee,J,Ie,ye);return this.loaded=this.loaded||{},this.loaded[W]=Ye,Ye})}removeTile(B){const W=this.loaded,K=B.uid;W&&W[K]&&delete W[K]}}function D(he,B){if(he.length!==0){k(he[0],B);for(var W=1;W=Math.abs(Ie)?W-ye+Ie:Ie-ye+W,W=ye}W+K>=0!=!!B&&he.reverse()}var U=c.bv(function he(B,W){var K,ae=B&&B.type;if(ae==="FeatureCollection")for(K=0;K>31}function Ue(he,B){for(var W=he.loadGeometry(),K=he.type,ae=0,Ee=0,J=W.length,Ie=0;Iehe},Pt=Math.fround||(Zt=new Float32Array(1),he=>(Zt[0]=+he,Zt[0]));var Zt;const Xt=3,kt=5,un=6;class Fn{constructor(B){this.options=Object.assign(Object.create(zt),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:W,minZoom:K,maxZoom:ae}=this.options;W&&console.time("total time");const Ee=`prepare ${B.length} points`;W&&console.time(Ee),this.points=B;const J=[];for(let ye=0;ye=K;ye--){const De=+Date.now();Ie=this.trees[ye]=this._createTree(this._cluster(Ie,ye)),W&&console.log("z%d: %d clusters in %dms",ye,Ie.numItems,+Date.now()-De)}return W&&console.timeEnd("total time"),this}getClusters(B,W){let K=((B[0]+180)%360+360)%360-180;const ae=Math.max(-90,Math.min(90,B[1]));let Ee=B[2]===180?180:((B[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)K=-180,Ee=180;else if(K>Ee){const He=this.getClusters([K,ae,180,J],W),Ye=this.getClusters([-180,ae,Ee,J],W);return He.concat(Ye)}const Ie=this.trees[this._limitZoom(W)],ye=Ie.range(Bn(K),ir(J),Bn(Ee),ir(ae)),De=Ie.data,Ge=[];for(const He of ye){const Ye=this.stride*He;Ge.push(De[Ye+kt]>1?bn(De,Ye,this.clusterProps):this.points[De[Ye+Xt]])}return Ge}getChildren(B){const W=this._getOriginId(B),K=this._getOriginZoom(B),ae="No cluster with the specified id.",Ee=this.trees[K];if(!Ee)throw new Error(ae);const J=Ee.data;if(W*this.stride>=J.length)throw new Error(ae);const Ie=this.options.radius/(this.options.extent*Math.pow(2,K-1)),ye=Ee.within(J[W*this.stride],J[W*this.stride+1],Ie),De=[];for(const Ge of ye){const He=Ge*this.stride;J[He+4]===B&&De.push(J[He+kt]>1?bn(J,He,this.clusterProps):this.points[J[He+Xt]])}if(De.length===0)throw new Error(ae);return De}getLeaves(B,W,K){const ae=[];return this._appendLeaves(ae,B,W=W||10,K=K||0,0),ae}getTile(B,W,K){const ae=this.trees[this._limitZoom(B)],Ee=Math.pow(2,B),{extent:J,radius:Ie}=this.options,ye=Ie/J,De=(K-ye)/Ee,Ge=(K+1+ye)/Ee,He={features:[]};return this._addTileFeatures(ae.range((W-ye)/Ee,De,(W+1+ye)/Ee,Ge),ae.data,W,K,Ee,He),W===0&&this._addTileFeatures(ae.range(1-ye/Ee,De,1,Ge),ae.data,Ee,K,Ee,He),W===Ee-1&&this._addTileFeatures(ae.range(0,De,ye/Ee,Ge),ae.data,-1,K,Ee,He),He.features.length?He:null}getClusterExpansionZoom(B){let W=this._getOriginZoom(B)-1;for(;W<=this.options.maxZoom;){const K=this.getChildren(B);if(W++,K.length!==1)break;B=K[0].properties.cluster_id}return W}_appendLeaves(B,W,K,ae,Ee){const J=this.getChildren(W);for(const Ie of J){const ye=Ie.properties;if(ye&&ye.cluster?Ee+ye.point_count<=ae?Ee+=ye.point_count:Ee=this._appendLeaves(B,ye.cluster_id,K,ae,Ee):Ee1;let Ge,He,Ye;if(De)Ge=mn(W,ye,this.clusterProps),He=W[ye],Ye=W[ye+1];else{const Yt=this.points[W[ye+Xt]];Ge=Yt.properties;const[Qt,En]=Yt.geometry.coordinates;He=Bn(Qt),Ye=ir(En)}const Mt={type:1,geometry:[[Math.round(this.options.extent*(He*Ee-K)),Math.round(this.options.extent*(Ye*Ee-ae))]],tags:Ge};let Rt;Rt=De||this.options.generateId?W[ye+Xt]:this.points[W[ye+Xt]].id,Rt!==void 0&&(Mt.id=Rt),J.features.push(Mt)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,W){const{radius:K,extent:ae,reduce:Ee,minPoints:J}=this.options,Ie=K/(ae*Math.pow(2,W)),ye=B.data,De=[],Ge=this.stride;for(let He=0;HeW&&(Qt+=ye[Xn+kt])}if(Qt>Yt&&Qt>=J){let En,Xn=Ye*Yt,cr=Mt*Yt,ti=-1;const cn=((He/Ge|0)<<5)+(W+1)+this.points.length;for(const Ir of Rt){const ai=Ir*Ge;if(ye[ai+2]<=W)continue;ye[ai+2]=W;const eo=ye[ai+kt];Xn+=ye[ai]*eo,cr+=ye[ai+1]*eo,ye[ai+4]=cn,Ee&&(En||(En=this._map(ye,He,!0),ti=this.clusterProps.length,this.clusterProps.push(En)),Ee(En,this._map(ye,ai)))}ye[He+4]=cn,De.push(Xn/Qt,cr/Qt,1/0,cn,-1,Qt),Ee&&De.push(ti)}else{for(let En=0;En1)for(const En of Rt){const Xn=En*Ge;if(!(ye[Xn+2]<=W)){ye[Xn+2]=W;for(let cr=0;cr>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,W,K){if(B[W+kt]>1){const J=this.clusterProps[B[W+un]];return K?Object.assign({},J):J}const ae=this.points[B[W+Xt]].properties,Ee=this.options.map(ae);return K&&Ee===ae?Object.assign({},Ee):Ee}}function bn(he,B,W){return{type:"Feature",id:he[B+Xt],properties:mn(he,B,W),geometry:{type:"Point",coordinates:[(K=he[B],360*(K-.5)),$r(he[B+1])]}};var K}function mn(he,B,W){const K=he[B+kt],ae=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,Ee=he[B+un],J=Ee===-1?{}:Object.assign({},W[Ee]);return Object.assign(J,{cluster:!0,cluster_id:he[B+Xt],point_count:K,point_count_abbreviated:ae})}function Bn(he){return he/360+.5}function ir(he){const B=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return W<0?0:W>1?1:W}function $r(he){const B=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function gr(he,B,W,K){for(var ae,Ee=K,J=W-B>>1,Ie=W-B,ye=he[B],De=he[B+1],Ge=he[W],He=he[W+1],Ye=B+3;YeEe)ae=Ye,Ee=Mt;else if(Mt===Ee){var Rt=Math.abs(Ye-J);RtK&&(ae-B>3&&gr(he,B,ae,K),he[ae+2]=Ee,W-ae>3&&gr(he,ae,W,K))}function ur(he,B,W,K,ae,Ee){var J=ae-W,Ie=Ee-K;if(J!==0||Ie!==0){var ye=((he-W)*J+(B-K)*Ie)/(J*J+Ie*Ie);ye>1?(W=ae,K=Ee):ye>0&&(W+=J*ye,K+=Ie*ye)}return(J=he-W)*J+(Ie=B-K)*Ie}function or(he,B,W,K){var ae={id:he===void 0?null:he,type:B,geometry:W,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ee){var J=Ee.geometry,Ie=Ee.type;if(Ie==="Point"||Ie==="MultiPoint"||Ie==="LineString")ie(Ee,J);else if(Ie==="Polygon"||Ie==="MultiLineString")for(var ye=0;ye0&&(J+=K?(ae*De-ye*Ee)/2:Math.sqrt(Math.pow(ye-ae,2)+Math.pow(De-Ee,2))),ae=ye,Ee=De}var Ge=B.length-3;B[2]=1,gr(B,0,Ge,W),B[Ge+2]=1,B.size=Math.abs(J),B.start=0,B.end=B.size}function Oe(he,B,W,K){for(var ae=0;ae1?1:W}function fn(he,B,W,K,ae,Ee,J,Ie){if(K/=B,Ee>=(W/=B)&&J=K)return null;for(var ye=[],De=0;De=W&&Rt=K)){var Yt=[];if(Ye==="Point"||Ye==="MultiPoint")er(He,Yt,W,K,ae);else if(Ye==="LineString")Do(He,Yt,W,K,ae,!1,Ie.lineMetrics);else if(Ye==="MultiLineString")Vs(He,Yt,W,K,ae,!1);else if(Ye==="Polygon")Vs(He,Yt,W,K,ae,!0);else if(Ye==="MultiPolygon")for(var Qt=0;Qt=W&&J<=K&&(B.push(he[Ee]),B.push(he[Ee+1]),B.push(he[Ee+2]))}}function Do(he,B,W,K,ae,Ee,J){for(var Ie,ye,De=gs(he),Ge=ae===0?Ai:Cl,He=he.start,Ye=0;YeW&&(ye=Ge(De,Mt,Rt,Qt,En,W),J&&(De.start=He+Ie*ye)):Xn>K?cr=W&&(ye=Ge(De,Mt,Rt,Qt,En,W),ti=!0),cr>K&&Xn<=K&&(ye=Ge(De,Mt,Rt,Qt,En,K),ti=!0),!Ee&&ti&&(J&&(De.end=He+Ie*ye),B.push(De),De=gs(he)),J&&(He+=Ie)}var cn=he.length-3;Mt=he[cn],Rt=he[cn+1],Yt=he[cn+2],(Xn=ae===0?Mt:Rt)>=W&&Xn<=K&&Ha(De,Mt,Rt,Yt),cn=De.length-3,Ee&&cn>=3&&(De[cn]!==De[0]||De[cn+1]!==De[1])&&Ha(De,De[0],De[1],De[2]),De.length&&B.push(De)}function gs(he){var B=[];return B.size=he.size,B.start=he.start,B.end=he.end,B}function Vs(he,B,W,K,ae,Ee){for(var J=0;JJ.maxX&&(J.maxX=Ge),He>J.maxY&&(J.maxY=He)}return J}function ei(he,B,W,K){var ae=B.geometry,Ee=B.type,J=[];if(Ee==="Point"||Ee==="MultiPoint")for(var Ie=0;Ie0&&B.size<(ae?J:K))W.numPoints+=B.length/3;else{for(var Ie=[],ye=0;yeJ)&&(W.numSimplified++,Ie.push(B[ye]),Ie.push(B[ye+1])),W.numPoints++;ae&&function(De,Ge){for(var He=0,Ye=0,Mt=De.length,Rt=Mt-2;Ye0===Ge)for(Ye=0,Mt=De.length;Ye24)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(ae,Ee){var J=[];if(ae.type==="FeatureCollection")for(var Ie=0;Ie1&&console.time("creation"),Ye=this.tiles[He]=Tl(he,B,W,K,ye),this.tileCoords.push({z:B,x:W,y:K}),De)){De>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,W,K,Ye.numFeatures,Ye.numPoints,Ye.numSimplified),console.timeEnd("creation"));var Mt="z"+B;this.stats[Mt]=(this.stats[Mt]||0)+1,this.total++}if(Ye.source=he,ae){if(B===ye.maxZoom||B===ae)continue;var Rt=1<1&&console.time("clipping");var Yt,Qt,En,Xn,cr,ti,cn=.5*ye.buffer/ye.extent,Ir=.5-cn,ai=.5+cn,eo=1+cn;Yt=Qt=En=Xn=null,cr=fn(he,Ge,W-cn,W+ai,0,Ye.minX,Ye.maxX,ye),ti=fn(he,Ge,W+Ir,W+eo,0,Ye.minX,Ye.maxX,ye),he=null,cr&&(Yt=fn(cr,Ge,K-cn,K+ai,1,Ye.minY,Ye.maxY,ye),Qt=fn(cr,Ge,K+Ir,K+eo,1,Ye.minY,Ye.maxY,ye),cr=null),ti&&(En=fn(ti,Ge,K-cn,K+ai,1,Ye.minY,Ye.maxY,ye),Xn=fn(ti,Ge,K+Ir,K+eo,1,Ye.minY,Ye.maxY,ye),ti=null),De>1&&console.timeEnd("clipping"),Ie.push(Yt||[],B+1,2*W,2*K),Ie.push(Qt||[],B+1,2*W,2*K+1),Ie.push(En||[],B+1,2*W+1,2*K),Ie.push(Xn||[],B+1,2*W+1,2*K+1)}}},on.prototype.getTile=function(he,B,W){var K=this.options,ae=K.extent,Ee=K.debug;if(he<0||he>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",he,B,W);for(var ye,De=he,Ge=B,He=W;!ye&&De>0;)De--,Ge=Math.floor(Ge/2),He=Math.floor(He/2),ye=this.tiles[nn(De,Ge,He)];return ye&&ye.source?(Ee>1&&console.log("found parent tile z%d-%d-%d",De,Ge,He),Ee>1&&console.time("drilling down"),this.splitTile(ye.source,De,Ge,He,he,B,W),Ee>1&&console.timeEnd("drilling down"),this.tiles[Ie]?Qo(this.tiles[Ie],ae):null):null};class xa extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(B,W){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 ae=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!ae)return null;const Ee=new class{constructor(Ie){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=Ie.length,this._features=Ie}feature(Ie){return new class{constructor(ye){this._feature=ye,this.extent=c.W,this.type=ye.type,this.properties=ye.tags,"id"in ye&&!isNaN(ye.id)&&(this.id=parseInt(ye.id,10))}loadGeometry(){if(this._feature.type===1){const ye=[];for(const De of this._feature.geometry)ye.push([new c.P(De[0],De[1])]);return ye}{const ye=[];for(const De of this._feature.geometry){const Ge=[];for(const He of De)Ge.push(new c.P(He[0],He[1]));ye.push(Ge)}return ye}}toGeoJSON(ye,De,Ge){return q.call(this,ye,De,Ge)}}(this._features[Ie])}}(ae.features);let J=qe(Ee);return J.byteOffset===0&&J.byteLength===J.buffer.byteLength||(J=new Uint8Array(J)),{vectorTile:Ee,rawData:J.buffer}})}loadData(B){return c._(this,void 0,void 0,function*(){var W;(W=this._pendingRequest)===null||W===void 0||W.abort();const K=!!(B&&B.request&&B.request.collectResourceTiming)&&new c.bs(B.request);this._pendingRequest=new AbortController;try{let ae=yield this.loadGeoJSON(B,this._pendingRequest);if(delete this._pendingRequest,typeof ae!="object")throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(U(ae,!0),B.filter){const J=c.by(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));ae={type:"FeatureCollection",features:ae.features.filter(ye=>J.value.evaluate({zoom:0},ye))}}this._geoJSONIndex=B.cluster?new Fn(function({superclusterOptions:J,clusterProperties:Ie}){if(!Ie||!J)return J;const ye={},De={},Ge={accumulated:null,zoom:0},He={properties:null},Ye=Object.keys(Ie);for(const Mt of Ye){const[Rt,Yt]=Ie[Mt],Qt=c.by(Yt),En=c.by(typeof Rt=="string"?[Rt,["accumulated"],["get",Mt]]:Rt);ye[Mt]=Qt.value,De[Mt]=En.value}return J.map=Mt=>{He.properties=Mt;const Rt={};for(const Yt of Ye)Rt[Yt]=ye[Yt].evaluate(Ge,He);return Rt},J.reduce=(Mt,Rt)=>{He.properties=Rt;for(const Yt of Ye)Ge.accumulated=Mt[Yt],Mt[Yt]=De[Yt].evaluate(Ge,He)},J}(B)).load(ae.features):function(J,Ie){return new on(J,Ie)}(ae,B.geojsonVtOptions),this.loaded={};const Ee={};if(K){const J=K.finish();J&&(Ee.resourceTiming={},Ee.resourceTiming[B.source]=JSON.parse(JSON.stringify(J)))}return Ee}catch(ae){if(delete this._pendingRequest,c.bz(ae))return{abandoned:!0};throw ae}})}reloadTile(B){const W=this.loaded;return W&&W[B.uid]?super.reloadTile(B):this.loadTile(B)}loadGeoJSON(B,W){return c._(this,void 0,void 0,function*(){const{promoteId:K}=B;if(B.request){const ae=yield c.h(B.request,W);return this._dataUpdateable=$o(ae.data,K)?tn(ae.data,K):void 0,ae.data}if(typeof B.data=="string")try{const ae=JSON.parse(B.data);return this._dataUpdateable=$o(ae,K)?tn(ae,K):void 0,ae}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(ae,Ee,J){var Ie,ye,De,Ge;if(Ee.removeAll&&ae.clear(),Ee.remove)for(const He of Ee.remove)ae.delete(He);if(Ee.add)for(const He of Ee.add){const Ye=Rr(He,J);Ye!=null&&ae.set(Ye,He)}if(Ee.update)for(const He of Ee.update){let Ye=ae.get(He.id);if(Ye==null)continue;const Mt=!He.removeAllProperties&&(((Ie=He.removeProperties)===null||Ie===void 0?void 0:Ie.length)>0||((ye=He.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0);if((He.newGeometry||He.removeAllProperties||Mt)&&(Ye=Object.assign({},Ye),ae.set(He.id,Ye),Mt&&(Ye.properties=Object.assign({},Ye.properties))),He.newGeometry&&(Ye.geometry=He.newGeometry),He.removeAllProperties)Ye.properties={};else if(((De=He.removeProperties)===null||De===void 0?void 0:De.length)>0)for(const Rt of He.removeProperties)Object.prototype.hasOwnProperty.call(Ye.properties,Rt)&&delete Ye.properties[Rt];if(((Ge=He.addOrUpdateProperties)===null||Ge===void 0?void 0:Ge.length)>0)for(const{key:Rt,value:Yt}of He.addOrUpdateProperties)Ye.properties[Rt]=Yt}}(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 Vr{constructor(B){this.self=B,this.actor=new c.C(B),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,K)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=K},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=W=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,K)=>this._getDEMWorkerSource(W,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(W,K)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(W,K)=>this._getWorkerSource(W,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(W,K)=>this._getWorkerSource(W,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(W,K)=>this._getWorkerSource(W,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(W,K)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][K.type]||!this.workerSources[W][K.type][K.source])return;const ae=this.workerSources[W][K.type][K.source];delete this.workerSources[W][K.type][K.source],ae.removeSource!==void 0&&ae.removeSource(K)})),this.actor.registerMessageHandler("RM",W=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,K)=>c._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(W,K)=>this._syncRTLPluginState(W,K)),this.actor.registerMessageHandler("IS",(W,K)=>c._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(W,K)=>this._setImages(W,K)),this.actor.registerMessageHandler("UL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(K)}))}_setImages(B,W){return c._(this,void 0,void 0,function*(){this.availableImages[B]=W;for(const K in this.workerSources[B]){const ae=this.workerSources[B][K];for(const Ee in ae)ae[Ee].availableImages=W}})}_syncRTLPluginState(B,W){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(W.pluginStatus!=="loading")return c.bA.setState(W),W;const K=W.pluginURL;if(this.self.importScripts(K),c.bA.isParsed()){const ae={pluginStatus:"loaded",pluginURL:K};return c.bA.setState(ae),ae}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_getAvailableImages(B){let W=this.availableImages[B];return W||(W=[]),W}_getLayerIndex(B){let W=this.layerIndexes[B];return W||(W=this.layerIndexes[B]=new l),W}_getWorkerSource(B,W,K){if(this.workerSources[B]||(this.workerSources[B]={}),this.workerSources[B][W]||(this.workerSources[B][W]={}),!this.workerSources[B][W][K]){const ae={sendAsync:(Ee,J)=>(Ee.targetMapId=B,this.actor.sendAsync(Ee,J))};switch(W){case"vector":this.workerSources[B][W][K]=new E(ae,this._getLayerIndex(B),this._getAvailableImages(B));break;case"geojson":this.workerSources[B][W][K]=new xa(ae,this._getLayerIndex(B),this._getAvailableImages(B));break;default:this.workerSources[B][W][K]=new this.externalWorkerSourceTypes[W](ae,this._getLayerIndex(B),this._getAvailableImages(B))}}return this.workerSources[B][W][K]}_getDEMWorkerSource(B,W){return this.demWorkerSources[B]||(this.demWorkerSources[B]={}),this.demWorkerSources[B][W]||(this.demWorkerSources[B][W]=new T),this.demWorkerSources[B][W]}}return c.i(self)&&(self.worker=new Vr(self)),Vr}),i("index",["exports","./shared"],function(c,l){var m="4.1.3";let w,S;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((s,f)=>{const d=requestAnimationFrame(s);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(l.c())})}),getImageData(y,s=0){return this.getImageCanvasContext(y).getImageData(-s,-s,y.width+2*s,y.height+2*s)},getImageCanvasContext(y){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=y.width,s.height=y.height,f.drawImage(y,0,0,y.width,y.height),f},resolveURL:y=>(w||(w=document.createElement("a")),w.href=y,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class T{static testProp(s){if(!T.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",T.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 g=f.boundingClientRect;return new l.P((d.clientX-g.left)/f.x-s.clientLeft,(d.clientY-g.top)/f.y-s.clientTop)}static mousePos(s,f){const d=T.getScale(s);return T.getPoint(s,d,f)}static touchPos(s,f){const d=[],g=T.getScale(s);for(let v=0;v{s=[],f=0,d=0,g={}},y.addThrottleControl=M=>{const R=d++;return g[R]=M,R},y.removeThrottleControl=M=>{delete g[M],C()},y.getImage=(M,R,z=!0)=>new Promise((F,X)=>{D.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),l.e(M,{type:"image"}),s.push({abortController:R,requestParameters:M,supportImageRefresh:z,state:"queued",onError:ue=>{X(ue)},onSuccess:ue=>{F(ue)}}),C()});const v=M=>l._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:R,supportImageRefresh:z,onError:F,onSuccess:X,abortController:ue}=M,le=z===!1&&!l.i(self)&&!l.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((xe,Fe)=>xe&&Fe==="accept",!0));f++;const fe=le?L(R,ue):l.m(R,ue);try{const xe=yield fe;delete M.abortController,M.state="completed",xe.data instanceof HTMLImageElement||l.b(xe.data)?X(xe):xe.data&&X({data:yield(te=xe.data,typeof createImageBitmap=="function"?l.d(te):l.f(te)),cacheControl:xe.cacheControl,expires:xe.expires})}catch(xe){delete M.abortController,F(xe)}finally{f--,C()}var te}),C=()=>{const M=(()=>{for(const R of Object.keys(g))if(g[R]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=f;R0;R++){const z=s.shift();z.abortController.signal.aborted?R--:v(z)}},L=(M,R)=>new Promise((z,F)=>{const X=new Image,ue=M.url,le=M.credentials;le&&le==="include"?X.crossOrigin="use-credentials":(le&&le==="same-origin"||!l.s(ue))&&(X.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{X.src="",F(l.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,z({data:X})},X.onerror=()=>{X.onerror=X.onload=null,R.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=ue})}(j||(j={})),j.resetRequestQueue();class Q{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const g=function(v){const C=v.match($);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 g.path+=`${f}${d}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const $=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function me(y){var s=new l.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var de,re=function(y,s,f){return y[0]=s[0]-f[0],y[1]=s[1]-f[1],y[2]=s[2]-f[2],y};de=new l.A(3),l.A!=Float32Array&&(de[0]=0,de[1]=0,de[2]=0);var se=function(y){var s=y[0],f=y[1];return s*s+f*f};function Ce(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const f=[];for(const{id:d,url:g}of y){const v=`${d}${g}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:g}))}}return s}(function(){var y=new l.A(2);l.A!=Float32Array&&(y[0]=0,y[1]=0)})();class H{constructor(s,f,d,g){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,g)}update(s,f,d){const{width:g,height:v}=s,C=!(this.size&&this.size[0]===g&&this.size[1]===v||d),{context:L}=this,{gl:M}=L;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[g,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:R,y:z}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,R,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,R,z,g,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:g}=this,{gl:v}=g;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 oe(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class Xe extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.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 l.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 g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const g of s){if(g[0]{let g=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(g=!1);this.isLoaded()||g?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let g=this.getImage(d);g||(this.fire(new l.k("styleimagemissing",{id:d})),g=this.getImage(d)),g?f[d]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:l.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 g={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new l.I(g,d);this.patterns[s]={bin:g,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}=l.p(s),g=this.atlasImage;g.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],L=C.x+1,M=C.y+1,R=this.getImage(v).data,z=R.width,F=R.height;l.R.copy(R,g,{x:0,y:0},{x:L,y:M},{width:z,height:F}),l.R.copy(R,g,{x:0,y:F-1},{x:L,y:M-1},{width:z,height:1}),l.R.copy(R,g,{x:0,y:0},{x:L,y:M+F},{width:z,height:1}),l.R.copy(R,g,{x:z-1,y:0},{x:L-1,y:M},{width:1,height:F}),l.R.copy(R,g,{x:0,y:0},{x:L+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||l.w(`Image with ID: "${f}" was not found`),oe(d)&&this.updateImage(f,d)}}}const be=1e20;function Ue(y,s,f,d,g,v,C,L,M){for(let R=s;R-1);M++,v[M]=L,C[M]=R,C[M+1]=be}for(let L=0,M=0;L65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const L=qe.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=L}const C=yield d.requests[v];for(const L in C)this._doesCharSupportLocalGlyph(+L)||(d.glyphs[+L]=C[+L]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](s)||l.u["Hangul Syllables"](s)||l.u.Hiragana(s)||l.u.Katakana(s))}_tinySDF(s,f,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let L="400";/bold/i.test(f)?L="900":/medium/i.test(f)?L="500":/light/i.test(f)&&(L="200"),v=s.tinySDF=new qe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:L})}const C=v.draw(String.fromCharCode(d));return{id:d,bitmap:new l.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(y,s,f,d){return l._(this,void 0,void 0,function*(){const g=256*s,v=g+255,C=d.transformRequest(f.replace("{fontstack}",y).replace("{range}",`${g}-${v}`),"Glyphs"),L=yield l.l(C,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);const M={};for(const R of l.n(L.data))M[R.id]=R;return M})},qe.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const L=this.size=y+4*s,M=this._createCanvas(L),R=this.ctx=M.getContext("2d",{willReadFrequently:!0});R.font=`${C} ${v} ${y}px ${g}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(y),C=Math.ceil(f),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-g))),M=Math.min(this.size-this.buffer,C+Math.ceil(d)),R=L+2*this.buffer,z=M+2*this.buffer,F=Math.max(R*z,0),X=new Uint8ClampedArray(F),ue={data:X,width:R,height:z,glyphWidth:L,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(L===0||M===0)return ue;const{ctx:le,buffer:fe,gridInner:te,gridOuter:xe}=this;le.clearRect(fe,fe,L,M),le.fillText(y,fe,fe+C);const Fe=le.getImageData(fe,fe,L,M);xe.fill(be,0,F),te.fill(0,0,F);for(let pe=0;pe0?Ze*Ze:0,te[je]=Ze<0?Ze*Ze:0}}Ue(xe,0,0,R,z,R,this.f,this.v,this.z),Ue(te,fe,fe,L,M,R,this.f,this.v,this.z);for(let pe=0;pe1&&(M=s[++L]);const z=Math.abs(R-M.left),F=Math.abs(R-M.right),X=Math.min(z,F);let ue;const le=v/d*(g+1);if(M.isDash){const fe=g-Math.abs(le);ue=Math.sqrt(X*X+fe*fe)}else ue=g-Math.sqrt(X*X+le*le);this.data[C+R]=Math.max(0,Math.min(255,ue+128))}}}addRegularDash(s){for(let L=s.length-1;L>=0;--L){const M=s[L],R=s[L+1];M.zeroLength?s.splice(L,1):R&&R.isDash===M.isDash&&(R.left=M.left,s.splice(L,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 g=this.width*this.nextRow;let v=0,C=s[v];for(let L=0;L1&&(C=s[++v]);const M=Math.abs(L-C.left),R=Math.abs(L-C.right),z=Math.min(M,R);this.data[g+L]=Math.max(0,Math.min(255,(C.isDash?z:-z)+128))}}addDash(s,f){const d=f?7:0,g=2*d+1;if(this.nextRow+g>this.height)return l.w("LineAtlas out of space"),null;let v=0;for(let L=0;L{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[kt]}numActive(){return Object.keys(this.active).length}}const Fn=Math.floor(E.hardwareConcurrency/2);let bn,mn;function Bn(){return bn||(bn=new un),bn}un.workerCount=l.B(globalThis)?Math.max(Math.min(Fn,3),1):1;class ir{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let g=0;g{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function $r(){return mn||(mn=new ir(Bn(),l.G),mn.registerMessageHandler("GR",(y,s,f)=>l.m(s,f))),mn}function gr(y,s){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*y.width,.5*y.height,1]),l.K(f,f,y.calculatePosMatrix(s.toUnwrapped()))}function ur(y,s,f,d,g,v){const C=function(F,X,ue){if(F)for(const le of F){const fe=X[le];if(fe&&fe.source===ue&&fe.type==="fill-extrusion")return!0}else for(const le in X){const fe=X[le];if(fe.source===ue&&fe.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),L=v.maxPitchScaleFactor(),M=y.tilesIn(d,L,C);M.sort(or);const R=[];for(const F of M)R.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,y._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,g,v,L,gr(y.transform,F.tileID))});const z=function(F){const X={},ue={};for(const le of F){const fe=le.queryResults,te=le.wrappedTileID,xe=ue[te]=ue[te]||{};for(const Fe in fe){const pe=fe[Fe],Ae=xe[Fe]=xe[Fe]||{},Ve=X[Fe]=X[Fe]||[];for(const je of pe)Ae[je.featureIndex]||(Ae[je.featureIndex]=!0,Ve.push(je))}}return X}(R);for(const F in z)z[F].forEach(X=>{const ue=X.feature,le=y.getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=le});return z}function or(y,s){const f=y.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 ie(y,s,f){return l._(this,void 0,void 0,function*(){let d=y;if(y.url?d=(yield l.h(s.transformRequest(y.url,"Source"),f)).data:yield E.frameAsync(f),!d)return null;const g=l.L(l.e(d,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(g.vectorLayerIds=d.vector_layers.map(v=>v.id)),g})}class Te{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 l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let g,v;if(s instanceof l.M)g=s,v=s;else{if(!(s instanceof Te))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Te.convert(s)):this.extend(l.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(l.M.convert(s)):this;if(g=s._sw,v=s._ne,!g||!v)return this}return f||d?(f.lng=Math.min(g.lng,f.lng),f.lat=Math.min(g.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new l.M(g.lng,g.lat),this._ne=new l.M(v.lng,v.lat)),this}getCenter(){return new l.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 l.M(this.getWest(),this.getNorth())}getSouthEast(){return new l.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}=l.M.convert(s);let g=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(s){return s instanceof Te?s:s&&new Te(s)}static fromLngLat(s,f=0){const d=360*f/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Te(new l.M(s.lng-g,s.lat-d),new l.M(s.lng+g,s.lat+d))}}class _t{constructor(s,f,d){this.bounds=Te.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(l.N(this.bounds.getWest())*f),g=Math.floor(l.O(this.bounds.getNorth())*f),v=Math.ceil(l.N(this.bounds.getEast())*f),C=Math.ceil(l.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=g&&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 l.e({},this._options)}loadTile(s){return l._(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 g="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(),g="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:g,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 l._(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 l._(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 Oe extends l.E{constructor(s,f,d,g){super(),this.id=s,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},f),l.e(this,l.L(f,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ie(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new _t(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.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 l.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return l._(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 g=this.map.painter.context,v=g.gl,C=d.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new H(g,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.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 l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class en extends Oe{constructor(s,f,d,g){super(s,f,d,g),this.type="raster-dem",this.maxzoom=22,this._options=l.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 l._(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 g=yield j.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(g&&g.data){const v=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&s.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const C=l.b(v)&&l.S()?v:yield this.readImageNow(v),L={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:L});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(g){if(delete s.abortController,s.aborted)s.state="unloaded";else if(g)throw s.state="errored",g}})}readImageNow(s){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.U()){const f=s.width+2,d=s.height+2;try{return new l.R({width:f,height:d},yield l.V(s,-1,-1,f,d))}catch{}}return E.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),g=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+d)%d,L=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new l.Q(s.overscaledZ,v,f.z,g,f.y).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new l.Q(s.overscaledZ,v,f.z,g,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&l.e(v,{resourceTiming:g}),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return l._(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 g=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(g,this.map.painter,f==="RT")})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return l._(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 l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var fn=l.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class er extends l.E{constructor(s,f,d,g){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(g),this.options=f}load(s){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.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 l.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 l.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(l.Y.fromLngLat);this.tileID=function(g){let v=1/0,C=1/0,L=-1/0,M=-1/0;for(const X of g)v=Math.min(v,X.x),C=Math.min(C,X.y),L=Math.max(L,X.x),M=Math.max(M,X.y);const R=Math.max(L-v,M-C),z=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),F=Math.pow(2,z);return new l.a0(z,Math.floor((v+L)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new l.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,l.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,l.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,l.W,l.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.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,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.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 g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return l._(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 Do extends er{constructor(s,f,d,g){super(s,f,d,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return l._(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 l.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 l.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 l.j(new l.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,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.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 g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new l.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 gs extends er{constructor(s,f,d,g){super(s,f,d,g),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 l.j(new l.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new l.j(new l.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 l.j(new l.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 l.j(new l.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return l._(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 l.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,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.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 g=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,g=!0)}g&&this.fire(new l.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 Vs={},Ha=y=>{switch(y){case"geojson":return Dr;case"image":return er;case"raster":return Oe;case"raster-dem":return en;case"vector":return xn;case"video":return Do;case"canvas":return gs}return Vs[y]},Ai="RTLPluginLoaded";class Cl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$r()}_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 l._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.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 l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ai))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _s=null;function at(){return _s||(_s=new Cl),_s}class Qo{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=l.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(R)).filter(Boolean);if(M.length!==0){L.layers=M,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(R=>M.filter(z=>z.id===R)[0]));for(const R of M)C[R.id]=L}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5&&v.hasRTLText){this.hasRTLText=!0,at().lazyLoad();break}}this.queryPadding=0;for(const g in this.buckets){const v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(g).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new l.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 g=this.buckets[d];g.uploadPending()&&g.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,g,v,C,L,M,R,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:L,queryPadding:this.queryPadding*R},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=g._geojsonTileLayer||g[v];if(!C)return;const L=l.a6(f&&f.filter),{z:M,x:R,y:z}=this.tileID.canonical,F={z:M,x:R,y:z};for(let X=0;Xd)g=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[g].push(v),this.order.push(g),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,g=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][g];return this.data[d].splice(g,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 g of this.data[d])s(g.value)||f.push(g);for(const d of f)this.remove(d.value.tileID,d)}}class Tl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const g=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},l.e(this.stateChanges[s][g],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==g&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const v in this.state[s][g])d[v]||(this.deletedStates[s][g][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][v]===null&&delete this.deletedStates[s][g][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const g=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(d in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][d]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),g=l.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 g[C]}return g}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const v={};for(const C in this.stateChanges[g])this.state[g][C]||(this.state[g][C]={}),l.e(this.state[g][C],this.stateChanges[g][C]),v[C]=this.state[g][C];d[g]=v}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const v={};if(this.deletedStates[g]===null)for(const C in this.state[g])v[C]={},this.state[g][C]={};else for(const C in this.deletedStates[g]){if(this.deletedStates[g][C]===null)this.state[g][C]={};else for(const L of Object.keys(this.deletedStates[g][C]))delete this.state[g][C][L];v[C]=this.state[g][C]}d[g]=d[g]||{},l.e(d[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in s)s[g].setFeatureState(d,f)}}class ei extends l.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,v,C,L)=>{const M=new(Ha(v.type))(g,v,C,L);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new $i(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Tl,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 l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(g){s.state="errored",g.status!==404?this._source.fire(new l.j(g,{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 l.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(ft).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,g)=>{const v=d.tileID,C=g.tileID,L=new l.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new l.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-L.y||M.x-L.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(ft).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 l._(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=E.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 l.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let g=0;g1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,C,L),g.neighboringTiles&&g.neighboringTiles[R]&&(g.neighboringTiles[R].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,g){for(const v in this._tiles){let C=this._tiles[v];if(g[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>d)continue;let L=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const R=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[R.key],C&&C.hasData()&&(L=R)}let M=L;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[L.key]=L;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 g=s.scaledTo(d),v=this._getLoadedTile(g);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,g=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;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 g in this._tiles){const v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,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 l.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 g=s.coveringZoomLevel(this._source),v=Math.max(g-ei.maxOverzooming,this._source.minzoom),C=Math.max(g+ei.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 ue=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[ue.key]=ue}d=d.concat(Object.values(z))}const L=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(on(this._source.type)){const z={},F={},X=Object.keys(M),ue=E.now();for(const le of X){const fe=M[le],te=this._tiles[le];if(!te||te.fadeEndTime!==0&&te.fadeEndTime<=ue)continue;const xe=this.findLoadedParent(fe,v);xe&&(this._addTile(xe.tileID),z[xe.tileID.key]=xe.tileID),F[le]=fe}this._retainLoadedChildren(F,g,C,M);for(const le in z)M[le]||(this._coveredTiles[le]=!0,M[le]=z[le]);if(f){const le={},fe={};for(const te of d)this._tiles[te.key].hasData()?le[te.key]=te:fe[te.key]=te;for(const te in fe){const xe=fe[te].children(this._source.maxzoom);this._tiles[xe[0].key]&&this._tiles[xe[1].key]&&this._tiles[xe[2].key]&&this._tiles[xe[3].key]&&(le[xe[0].key]=M[xe[0].key]=xe[0],le[xe[1].key]=M[xe[1].key]=xe[1],le[xe[2].key]=M[xe[2].key]=xe[2],le[xe[3].key]=M[xe[3].key]=xe[3],delete fe[te])}for(const te in fe){const xe=this.findLoadedParent(fe[te],this._source.minzoom);if(xe){le[xe.tileID.key]=M[xe.tileID.key]=xe.tileID;for(const Fe in le)le[Fe].isChildOf(xe.tileID)&&delete le[Fe]}}for(const te in this._tiles)le[te]||(this._coveredTiles[te]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const R=l.ab(this._tiles,M);for(const z of R){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={},g={},v=Math.max(f-ei.maxOverzooming,this._source.minzoom),C=Math.max(f+ei.maxUnderzooming,this._source.minzoom),L={};for(const M of s){const R=this._addTile(M);d[M.key]=M,R.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=R.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const X=M.scaledTo(F);if(g[X.key])break;if(g[X.key]=!0,R=this.getTile(X),!R&&z&&(R=this._addTile(X)),R){const ue=R.hasData();if((z||ue)&&(d[X.key]=X),z=R.wasRequested(),ue)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}f.push(g.key);const v=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;g=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 Qo(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 l.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 g=[],v=this.transform;if(!v)return g;const C=d?v.getCameraQueryGeometry(s):s,L=s.map(le=>v.pointCoordinate(le,this.terrain)),M=C.map(le=>v.pointCoordinate(le,this.terrain)),R=this.getIds();let z=1/0,F=1/0,X=-1/0,ue=-1/0;for(const le of M)z=Math.min(z,le.x),F=Math.min(F,le.y),X=Math.max(X,le.x),ue=Math.max(ue,le.y);for(let le=0;le=0&&pe[1].y+Fe>=0){const Ae=L.map(je=>te.getTilePoint(je)),Ve=M.map(je=>te.getTilePoint(je));g.push({tile:fe,tileID:te,queryGeometry:Ae,cameraQueryGeometry:Ve,scale:xe})}}return g}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(on(this._source.type)){const s=E.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 g=this._tiles[s];g&&g.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 ft(y,s){const f=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||d-f||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function on(y){return y==="raster"||y==="image"||y==="video"}ei.maxOverzooming=10,ei.maxUnderzooming=3;class nn{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-C)/L:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Rr(y,s){let f=!0;return y==="always"||y!=="never"&&s!=="never"||(f=!1),f}class $o{constructor(s,f,d){const g=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let C=0;Cthis.width||g<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=g){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:g}];for(let R=0;R0}hitTestCircle(s,f,d,g,v){const C=s-d,L=s+d,M=f-d,R=f+d;if(L<0||C>this.width||R<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,L,R,this._queryCellCircle,z,{hitTest:!0,overlapMode:g,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,d,g,v,C,L,M){const{seenUids:R,hitTest:z,overlapMode:F}=L,X=this.boxCells[v];if(X!==null){const le=this.bboxes;for(const fe of X)if(!R.box[fe]){R.box[fe]=!0;const te=4*fe,xe=this.boxKeys[fe];if(s<=le[te+2]&&f<=le[te+3]&&d>=le[te+0]&&g>=le[te+1]&&(!M||M(xe))&&(!z||!Rr(F,xe.overlapMode))&&(C.push({key:xe,x1:le[te],y1:le[te+1],x2:le[te+2],y2:le[te+3]}),z))return!0}}const ue=this.circleCells[v];if(ue!==null){const le=this.circles;for(const fe of ue)if(!R.circle[fe]){R.circle[fe]=!0;const te=3*fe,xe=this.circleKeys[fe];if(this._circleAndRectCollide(le[te],le[te+1],le[te+2],s,f,d,g)&&(!M||M(xe))&&(!z||!Rr(F,xe.overlapMode))){const Fe=le[te],pe=le[te+1],Ae=le[te+2];if(C.push({key:xe,x1:Fe-Ae,y1:pe-Ae,x2:Fe+Ae,y2:pe+Ae}),z)return!0}}}return!1}_queryCellCircle(s,f,d,g,v,C,L,M){const{circle:R,seenUids:z,overlapMode:F}=L,X=this.boxCells[v];if(X!==null){const le=this.bboxes;for(const fe of X)if(!z.box[fe]){z.box[fe]=!0;const te=4*fe,xe=this.boxKeys[fe];if(this._circleAndRectCollide(R.x,R.y,R.radius,le[te+0],le[te+1],le[te+2],le[te+3])&&(!M||M(xe))&&!Rr(F,xe.overlapMode))return C.push(!0),!0}}const ue=this.circleCells[v];if(ue!==null){const le=this.circles;for(const fe of ue)if(!z.circle[fe]){z.circle[fe]=!0;const te=3*fe,xe=this.circleKeys[fe];if(this._circlesCollide(le[te],le[te+1],le[te+2],R.x,R.y,R.radius)&&(!M||M(xe))&&!Rr(F,xe.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,g,v,C,L,M){const R=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),X=this._convertToYCellCoord(g);for(let ue=R;ue<=F;ue++)for(let le=z;le<=X;le++)if(v.call(this,s,f,d,g,this.xCellCount*le+ue,C,L,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,g,v,C){const L=g-s,M=v-f,R=d+C;return R*R>L*L+M*M}_circleAndRectCollide(s,f,d,g,v,C,L){const M=(C-g)/2,R=Math.abs(s-(g+M));if(R>M+d)return!1;const z=(L-v)/2,F=Math.abs(f-(v+z));if(F>z+d)return!1;if(R<=M||F<=z)return!0;const X=R-M,ue=F-z;return X*X+ue*ue<=d*d}}function tn(y,s,f,d,g){const v=l.F();return s?(l.J(v,v,[1/g,1/g,1]),f||l.ad(v,v,d.angle)):l.K(v,d.labelPlaneMatrix,y),v}function xa(y,s,f,d,g){if(s){const v=l.ae(y);return l.J(v,v,[g,g,1]),f||l.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Vr(y,s,f){let d;f?(d=[y.x,y.y,f(y.x,y.y),1],l.af(d,d,s)):(d=[y.x,y.y,0,1],Mt(d,d,s));const g=d[3];return{point:new l.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function he(y,s){return .5+y/s*.5}function B(y,s){const f=y[0]/y[3],d=y[1]/y[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function W(y,s,f,d,g,v,C,L,M,R){const z=d?y.textSizeData:y.iconSizeData,F=l.ag(z,f.transform.zoom),X=[256/f.width*2+1,256/f.height*2+1],ue=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;ue.clear();const le=y.lineVertexArray,fe=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,te=f.transform.width/f.transform.height;let xe=!1;for(let Fe=0;FeMath.abs(f.x-s.x)*d?{useVertical:!0}:(y===l.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function Ee(y,s,f,d,g,v,C,L,M,R,z,F,X,ue,le,fe){const te=s/24,xe=y.lineOffsetX*te,Fe=y.lineOffsetY*te;let pe;if(y.numGlyphs>1){const Ae=y.glyphStartIndex+y.numGlyphs,Ve=y.lineStartIndex,je=y.lineStartIndex+y.lineLength,Ze=K(te,L,xe,Fe,f,z,F,y,M,v,X,le,fe);if(!Ze)return{notEnoughRoom:!0};const rt=Vr(Ze.first.point,C,fe).point,Qe=Vr(Ze.last.point,C,fe).point;if(d&&!f){const ut=ae(y.writingMode,rt,Qe,ue);if(ut)return ut}pe=[Ze.first];for(let ut=y.glyphStartIndex+1;ut0?rt.point:J(F,Ze,Ve,1,g,fe),ut=ae(y.writingMode,Ve,Qe,ue);if(ut)return ut}const Ae=Ge(te*L.getoffsetX(y.glyphStartIndex),xe,Fe,f,z,F,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,v,X,le,fe);if(!Ae)return{notEnoughRoom:!0};pe=[Ae]}for(const Ae of pe)l.aj(R,Ae.point,Ae.angle);return{}}function J(y,s,f,d,g,v){const C=Vr(y.add(y.sub(s)._unit()),g,v).point,L=f.sub(C);return f.add(L._mult(d/L.mag()))}function Ie(y,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:L,previousVertex:M,direction:R,absOffsetX:z}=s;if(f.projections[y])return f.projections[y];const F=new l.P(d.getx(y),d.gety(y)),X=Vr(F,g,L);if(X.signedDistanceFromCamera>0)return f.projections[y]=X.point,X.point;const ue=y-R;return J(C===0?v:new l.P(d.getx(ue),d.gety(ue)),F,M,z-C+1,g,L)}function ye(y,s,f){return y._unit()._perp()._mult(s*f)}function De(y,s,f,d,g,v,C,L){const{projectionCache:M,direction:R}=L;if(M.offsets[y])return M.offsets[y];const z=f.add(s);if(y+R=g)return M.offsets[y]=z,z;const F=Ie(y+R,L),X=ye(F.sub(f),C,R),ue=f.add(X),le=F.add(X);return M.offsets[y]=l.ak(v,z,ue,le)||z,M.offsets[y]}function Ge(y,s,f,d,g,v,C,L,M,R,z,F,X,ue){const le=d?y-s:y+s;let fe=le>0?1:-1,te=0;d&&(fe*=-1,te=Math.PI),fe<0&&(te+=Math.PI);let xe,Fe,pe=fe>0?L+C:L+C+1,Ae=g,Ve=g,je=0,Ze=0;const rt=Math.abs(le),Qe=[];let ut;for(;je+Ze<=rt;){if(pe+=fe,pe=M)return null;je+=Ze,Ve=Ae,Fe=xe;const dt={projectionCache:F,lineVertexArray:R,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:je,getElevation:ue,previousVertex:Ve,direction:fe,absOffsetX:rt};if(Ae=Ie(pe,dt),f===0)Qe.push(Ve),ut=Ae.sub(Ve);else{let Ut;const an=Ae.sub(Ve);Ut=an.mag()===0?ye(Ie(pe+fe,dt).sub(Ae),f,fe):ye(an,f,fe),Fe||(Fe=Ve.add(Ut)),xe=De(pe,Ut,Ae,L,M,Fe,f,dt),Qe.push(Fe),ut=xe.sub(Fe)}Ze=ut.mag()}const pt=ut._mult((rt-je)/Ze)._add(Fe||Ve),sn=te+Math.atan2(Ae.y-Ve.y,Ae.x-Ve.x);return Qe.push(pt),{point:pt,angle:X?sn:0,path:Qe}}const He=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ye(y,s){for(let f=0;f=1;hn--)an.push(dt.path[hn]);for(let hn=1;hnVr(pn,M,le));an=hn.some(pn=>pn.signedDistanceFromCamera<=0)?[]:hn.map(pn=>pn.point)}let Ht=[];if(an.length>0){const hn=an[0].clone(),pn=an[0].clone();for(let Lr=1;Lr=ut.x&&pn.x<=pt.x&&hn.y>=ut.y&&pn.y<=pt.y?[an]:pn.xpt.x||pn.ypt.y?[]:l.al([an],ut.x,ut.y,pt.x,pt.y)}for(const hn of Ht){sn.reset(hn,.25*Qe);let pn=0;pn=sn.length<=.5*Qe?1:Math.ceil(sn.paddedLength/Cn)+1;for(let Lr=0;Lr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,f,d,g){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function ai(y,s,f,d,g){const{horizontalAlign:v,verticalAlign:C}=l.at(y);return new l.P(-(v-.5)*s+d[0]*g,-(C-.5)*f+d[1]*g)}function eo(y,s,f,d,g,v){const{x1:C,x2:L,y1:M,y2:R,anchorPointX:z,anchorPointY:F}=y,X=new l.P(s,f);return d&&X._rotate(g?v:-v),{x1:C+X.x,y1:M+X.y,x2:L+X.x,y2:R+X.y,anchorPointX:z,anchorPointY:F}}class go{constructor(s,f,d,g,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Yt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Ir(g),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,g){const v=d.getBucket(f),C=d.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const L=d.collisionBoxArray,M=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),z=d.tileSize/l.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),X=M.get("text-pitch-alignment")==="map",ue=M.get("text-rotation-alignment")==="map",le=Qt(d,1,this.transform.zoom),fe=tn(F,X,ue,this.transform,le);let te=null;if(X){const Fe=xa(F,X,ue,this.transform,le);te=l.K([],this.transform.labelPlaneMatrix,Fe)}this.retainedQueryData[v.bucketInstanceId]=new cn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const xe={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:fe,labelToScreenMatrix:te,scale:R,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:l.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(const Fe of v.sortKeyRanges){const{sortKey:pe,symbolInstanceStart:Ae,symbolInstanceEnd:Ve}=Fe;s.push({sortKey:pe,symbolInstanceStart:Ae,symbolInstanceEnd:Ve,parameters:xe})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:xe})}attemptAnchorPlacement(s,f,d,g,v,C,L,M,R,z,F,X,ue,le,fe,te){const xe=l.ap[s.textAnchor],Fe=[s.textOffset0,s.textOffset1],pe=ai(xe,d,g,Fe,v),Ae=this.collisionIndex.placeCollisionBox(eo(f,pe.x,pe.y,C,L,this.transform.angle),F,M,R,z.predicate,te);if((!fe||this.collisionIndex.placeCollisionBox(eo(fe,pe.x,pe.y,C,L,this.transform.angle),F,M,R,z.predicate,te).box.length!==0)&&Ae.box.length>0){let Ve;if(this.prevPlacement&&this.prevPlacement.variableOffsets[X.crossTileID]&&this.prevPlacement.placements[X.crossTileID]&&this.prevPlacement.placements[X.crossTileID].text&&(Ve=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:g,anchor:xe,textBoxScale:v,prevAnchor:Ve},this.markUsedJustification(ue,xe,X,le),ue.allowVerticalPlacement&&(this.markUsedOrientation(ue,le,X),this.placedOrientations[X.crossTileID]=le),{shift:pe,placedGlyphBoxes:Ae}}}placeLayerBucketPart(s,f,d){const{bucket:g,layout:v,posMatrix:C,textLabelPlaneMatrix:L,labelToScreenMatrix:M,textPixelRatio:R,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:X,collisionGroup:ue}=s.parameters,le=v.get("text-optional"),fe=v.get("icon-optional"),te=l.aq(v,"text-overlap","text-allow-overlap"),xe=te==="always",Fe=l.aq(v,"icon-overlap","icon-allow-overlap"),pe=Fe==="always",Ae=v.get("text-rotation-alignment")==="map",Ve=v.get("text-pitch-alignment")==="map",je=v.get("icon-text-fit")!=="none",Ze=v.get("symbol-z-order")==="viewport-y",rt=xe&&(pe||!g.hasIconData()||fe),Qe=pe&&(xe||!g.hasTextData()||le);!g.collisionArrays&&F&&g.deserializeCollisionBoxes(F);const ut=this.retainedQueryData[g.bucketInstanceId].tileID,pt=this.terrain?(dt,Ut)=>this.terrain.getElevation(ut,dt,Ut):null,sn=(dt,Ut)=>{var an,Cn;if(f[dt.crossTileID])return;if(z)return void(this.placements[dt.crossTileID]=new cr(!1,!1,!1));let Ht=!1,hn=!1,pn=!0,Lr=null,Hn={box:null,offscreen:null},zo={box:null,offscreen:null},li=null,yr=null,ui=null,Fo=0,Hs=0,$a=0;Ut.textFeatureIndex?Fo=Ut.textFeatureIndex:dt.useRuntimeCollisionCircles&&(Fo=dt.featureIndex),Ut.verticalTextFeatureIndex&&(Hs=Ut.verticalTextFeatureIndex);const wc=Ut.textBox;if(wc){const ri=ii=>{let br=l.ah.horizontal;if(g.allowVerticalPlacement&&!ii&&this.prevPlacement){const rs=this.prevPlacement.placedOrientations[dt.crossTileID];rs&&(this.placedOrientations[dt.crossTileID]=rs,br=rs,this.markUsedOrientation(g,br,dt))}return br},vr=(ii,br)=>{if(g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&Ut.verticalTextBox){for(const rs of g.writingModes)if(rs===l.ah.vertical?(Hn=br(),zo=Hn):Hn=ii(),Hn&&Hn.box&&Hn.box.length)break}else Hn=ii()},fr=dt.textAnchorOffsetStartIndex,ns=dt.textAnchorOffsetEndIndex;if(ns===fr){const ii=(br,rs)=>{const oi=this.collisionIndex.placeCollisionBox(br,te,R,C,ue.predicate,pt);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(g,rs,dt),this.placedOrientations[dt.crossTileID]=rs),oi};vr(()=>ii(wc,l.ah.horizontal),()=>{const br=Ut.verticalTextBox;return g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&br?ii(br,l.ah.vertical):{box:null,offscreen:null}}),ri(Hn&&Hn.box&&Hn.box.length)}else{let ii=l.ap[(Cn=(an=this.prevPlacement)===null||an===void 0?void 0:an.variableOffsets[dt.crossTileID])===null||Cn===void 0?void 0:Cn.anchor];const br=(oi,Nr,zp)=>{const Hm=oi.x2-oi.x1,Ol=oi.y2-oi.y1,zl=dt.textBoxScale,Uh=je&&Fe==="never"?Nr:null;let tl={box:[],offscreen:!1},Fp=te==="never"?1:2,Zm="never";ii&&Fp++;for(let Bp=0;Bpbr(wc,Ut.iconBox,l.ah.horizontal),()=>{const oi=Ut.verticalTextBox;return g.allowVerticalPlacement&&!(Hn&&Hn.box&&Hn.box.length)&&dt.numVerticalGlyphVertices>0&&oi?br(oi,Ut.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),Hn&&(Ht=Hn.box,pn=Hn.offscreen);const rs=ri(Hn&&Hn.box);if(!Ht&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[dt.crossTileID];oi&&(this.variableOffsets[dt.crossTileID]=oi,this.markUsedJustification(g,oi.anchor,dt,rs))}}}if(li=Hn,Ht=li&&li.box&&li.box.length>0,pn=li&&li.offscreen,dt.useRuntimeCollisionCircles){const ri=g.text.placedSymbolArray.get(dt.centerJustifiedTextSymbolIndex),vr=l.ai(g.textSizeData,X,ri),fr=v.get("text-padding");yr=this.collisionIndex.placeCollisionCircles(te,ri,g.lineVertexArray,g.glyphOffsetArray,vr,C,L,M,d,Ve,ue.predicate,dt.collisionCircleDiameter,fr,pt),yr.circles.length&&yr.collisionDetected&&!d&&l.w("Collisions detected, but collision boxes are not shown"),Ht=xe||yr.circles.length>0&&!yr.collisionDetected,pn=pn&&yr.offscreen}if(Ut.iconFeatureIndex&&($a=Ut.iconFeatureIndex),Ut.iconBox){const ri=vr=>{const fr=je&&Lr?eo(vr,Lr.x,Lr.y,Ae,Ve,this.transform.angle):vr;return this.collisionIndex.placeCollisionBox(fr,Fe,R,C,ue.predicate,pt)};zo&&zo.box&&zo.box.length&&Ut.verticalIconBox?(ui=ri(Ut.verticalIconBox),hn=ui.box.length>0):(ui=ri(Ut.iconBox),hn=ui.box.length>0),pn=pn&&ui.offscreen}const el=le||dt.numHorizontalGlyphVertices===0&&dt.numVerticalGlyphVertices===0,Zs=fe||dt.numIconVertices===0;if(el||Zs?Zs?el||(hn=hn&&Ht):Ht=hn&&Ht:hn=Ht=hn&&Ht,Ht&&li&&li.box&&this.collisionIndex.insertCollisionBox(li.box,te,v.get("text-ignore-placement"),g.bucketInstanceId,zo&&zo.box&&Hs?Hs:Fo,ue.ID),hn&&ui&&this.collisionIndex.insertCollisionBox(ui.box,Fe,v.get("icon-ignore-placement"),g.bucketInstanceId,$a,ue.ID),yr&&(Ht&&this.collisionIndex.insertCollisionCircles(yr.circles,te,v.get("text-ignore-placement"),g.bucketInstanceId,Fo,ue.ID),d)){const ri=g.bucketInstanceId;let vr=this.collisionCircleArrays[ri];vr===void 0&&(vr=this.collisionCircleArrays[ri]=new ti);for(let fr=0;fr=0;--Ut){const an=dt[Ut];sn(g.symbolInstances.get(an),g.collisionArrays[an])}}else for(let dt=s.symbolInstanceStart;dt=0&&(s.text.placedSymbolArray.get(L).crossTileID=v>=0&&L!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const g=f===l.ah.horizontal||f===l.ah.horizontalOnly?f:0,v=f===l.ah.vertical?f:0,C=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const L of C)s.text.placedSymbolArray.get(L).placedOrientation=g;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 g=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},L=f?f.placedOrientations:{};for(const M in this.placements){const R=this.placements[M],z=v[M];z?(this.opacities[M]=new Xn(z,g,R.text,R.icon),d=d||R.text!==z.text.placed||R.icon!==z.icon.placed):(this.opacities[M]=new Xn(null,g,R.text,R.icon,R.skipFade),d=d||R.text||R.icon)}for(const M in v){const R=v[M];if(!this.opacities[M]){const z=new Xn(R,g,!1,!1);z.isHidden()||(this.opacities[M]=z,d=d||R.text.placed||R.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 L)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=L[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 g of f){const v=g.getBucket(s);v&&g.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,g.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 g=s.layers[0],v=g.layout,C=new Xn(null,0,!1,!1,!0),L=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),R=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._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",ue=new Xn(null,0,L&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(L||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const le=(fe,te,xe)=>{for(let Fe=0;Fe0,je=this.placedOrientations[te.crossTileID],Ze=je===l.ah.vertical,rt=je===l.ah.horizontal||je===l.ah.horizontalOnly;if(xe>0||Fe>0){const Qe=_o(Ae.text);le(s.text,xe,Ze?ec:Qe),le(s.text,Fe,rt?ec:Qe);const ut=Ae.text.isHidden();[te.rightJustifiedTextSymbolIndex,te.centerJustifiedTextSymbolIndex,te.leftJustifiedTextSymbolIndex].forEach(dt=>{dt>=0&&(s.text.placedSymbolArray.get(dt).hidden=ut||Ze?1:0)}),te.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(te.verticalPlacedTextSymbolIndex).hidden=ut||rt?1:0);const pt=this.variableOffsets[te.crossTileID];pt&&this.markUsedJustification(s,pt.anchor,te,je);const sn=this.placedOrientations[te.crossTileID];sn&&(this.markUsedJustification(s,"left",te,sn),this.markUsedOrientation(s,sn,te))}if(Ve){const Qe=_o(Ae.icon),ut=!(X&&te.verticalPlacedIconSymbolIndex&&Ze);te.placedIconSymbolIndex>=0&&(le(s.icon,te.numIconVertices,ut?Qe:ec),s.icon.placedSymbolArray.get(te.placedIconSymbolIndex).hidden=Ae.icon.isHidden()),te.verticalPlacedIconSymbolIndex>=0&&(le(s.icon,te.numVerticalIconVertices,ut?ec:Qe),s.icon.placedSymbolArray.get(te.verticalPlacedIconSymbolIndex).hidden=Ae.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Qe=s.collisionArrays[fe];if(Qe){let ut=new l.P(0,0);if(Qe.textBox||Qe.verticalTextBox){let sn=!0;if(R){const dt=this.variableOffsets[pe];dt?(ut=ai(dt.anchor,dt.width,dt.height,dt.textOffset,dt.textBoxScale),z&&ut._rotate(F?this.transform.angle:-this.transform.angle)):sn=!1}Qe.textBox&&wi(s.textCollisionBox.collisionVertexArray,Ae.text.placed,!sn||Ze,ut.x,ut.y),Qe.verticalTextBox&&wi(s.textCollisionBox.collisionVertexArray,Ae.text.placed,!sn||rt,ut.x,ut.y)}const pt=!!(!rt&&Qe.verticalIconBox);Qe.iconBox&&wi(s.iconCollisionBox.collisionVertexArray,Ae.icon.placed,pt,X?ut.x:0,X?ut.y:0),Qe.verticalIconBox&&wi(s.iconCollisionBox.collisionVertexArray,Ae.icon.placed,!pt,X?ut.x:0,X?ut.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 fe=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=fe.invProjMatrix,s.placementViewportMatrix=fe.viewportMatrix,s.collisionCircleArray=fe.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 wi(y,s,f,d,g){y.emplaceBack(s?1:0,f?1:0,d||0,g||0),y.emplaceBack(s?1:0,f?1:0,d||0,g||0),y.emplaceBack(s?1:0,f?1:0,d||0,g||0),y.emplaceBack(s?1:0,f?1:0,d||0,g||0)}const Us=Math.pow(2,25),um=Math.pow(2,24),Y_=Math.pow(2,17),qn=Math.pow(2,16),op=Math.pow(2,9),sp=Math.pow(2,8),Ro=Math.pow(2,1);function _o(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,f=Math.floor(127*y.opacity);return f*Us+s*um+f*Y_+s*qn+f*op+s*sp+f*Ro+s}const ec=0;class es{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,g,v){const C=this._bucketParts;for(;this._currentTileIndexL.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&E.now()-g>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=L)&&(!C.maxzoom||C.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new es(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 uu=512/l.W/2;class nh{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let v=0;v({x:Math.floor(M.anchorX*uu),y:Math.floor(M.anchorY*uu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(L.positions.length>128){const M=new l.au(L.positions.length,16,Uint16Array);for(const{x:R,y:z}of L.positions)M.add(R,z);M.finish(),delete L.positions,L.index=M}this._symbolsByKey[v]=L}}getScaledCoordinates(s,f){const{x:d,y:g,z:v}=this.tileID.canonical,{x:C,y:L,z:M}=f.canonical,R=uu/Math.pow(2,M-v),z=(L*l.W+s.anchorY)*R,F=g*l.W*uu;return{x:Math.floor((C*l.W+s.anchorX)*R-d*l.W*uu),y:Math.floor(z-F)}}findMatches(s,f,d){const g=this.tileID.canonical.zs)}}class ni{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tc{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 g=this.indexes[d],v={};for(const C in g){const L=g[C];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+f),v[L.tileID.key]=L}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 L in C){const M=C[L];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,g)}else{const L=C[s.scaledTo(Number(v)).key];L&&L.findMatches(f.symbolInstances,s,g)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const _r=(y,s)=>l.t(y,s&&s.filter(f=>f.identifier!=="source.canvas")),rh=l.av();class No extends l.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const g=this.sourceCaches[d].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new ir(Bn(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,g)=>this.getGlyphs(d,g)),this.dispatcher.registerMessageHandler("GI",(d,g)=>this.getImages(d,g)),this.imageManager=new Xe,this.imageManager.setEventedParent(this),this.glyphManager=new qe(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Xt(256,512),this.crossTileSymbolIndex=new Za,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ax()),at().on(Ai,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const g=this.sourceCaches[d.sourceId];if(!g)return;const v=g.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const L=this._layers[C];L.source===v.id&&this._validateLayer(L)}})}loadURL(s,f={},d){this.fire(new l.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,l.h(g,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new l.j(v))})}loadJSON(s,f={},d){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(rh,{validate:!1})}_load(s,f,d){var g;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!_r(this,l.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 Zt(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const s=l.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=l.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,L,M){return l._(this,void 0,void 0,function*(){const R=Ce(v),z=L>1?"@2x":"",F={},X={};for(const{id:ue,url:le}of R){const fe=C.transformRequest(C.normalizeSpriteURL(le,z,".json"),"SpriteJSON");F[ue]=l.h(fe,M);const te=C.transformRequest(C.normalizeSpriteURL(le,z,".png"),"SpriteImage");X[ue]=j.getImage(te,M)}return yield Promise.all([...Object.values(F),...Object.values(X)]),function(ue,le){return l._(this,void 0,void 0,function*(){const fe={};for(const te in ue){fe[te]={};const xe=E.getImageCanvasContext((yield le[te]).data),Fe=(yield ue[te]).data;for(const pe in Fe){const{width:Ae,height:Ve,x:je,y:Ze,sdf:rt,pixelRatio:Qe,stretchX:ut,stretchY:pt,content:sn}=Fe[pe];fe[te][pe]={data:null,pixelRatio:Qe,sdf:rt,stretchX:ut,stretchY:pt,content:sn,spriteData:{width:Ae,height:Ve,x:je,y:Ze,context:xe}}}}return fe})}(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 L=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of L)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const R=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,v[C][M],!1):this.imageManager.addImage(R,v[C][M]),f&&(this._changedImages[R]=!0)}}}).catch(v=>{this._spriteRequest=null,g=v,this.fire(new l.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const g=f.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new l.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const g of s)f[g]&&d.push(f[g]);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 g=this._layers[d];g.type!=="custom"&&(s[d]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const g=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(g.length||v.length)&&this._updateWorkerLayers(g,v);for(const C in this._updatedSources){const L=this._updatedSources[C];if(L==="reload")this._reloadSource(C);else{if(L!=="clear")throw new Error(`Invalid action ${L}`);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 g in this.sourceCaches){const v=this.sourceCaches[g];d[g]=v.used,v.used=!1}for(const g of this._order){const v=this._layers[g];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const g in d){const v=this.sourceCaches[g];!!d[g]!=!!v.used&&v.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new l.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 g=this.serialize();if(s=f.transformStyle?f.transformStyle(g,s):s,((d=f.validate)===null||d===void 0||d)&&_r(this,l.x(s)))return!1;(s=l.aA(s)).layers=l.ay(s.layers);const v=l.aB(g,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 L of C.operations)L();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const g of s)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":f.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":f.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":f.push(()=>{});break;default:d.push(g.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new l.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 l.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 l.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(l.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[s]=new ei(s,f,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new l.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 l.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 g=s.id;if(this.getLayer(g))return void this.fire(new l.j(new Error(`Layer "${g}" already exists on this map.`)));let v;if(s.type==="custom"){if(_r(this,l.aC(s)))return;v=l.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=l.aA(s),s=l.e(s,{source:g})),this._validate(l.x.layer,`layers.${g}`,s,{arrayIndex:-1},d))return;v=l.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:g}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new l.j(new Error(`Cannot add layer "${g}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,g),this._layerOrderChanged=!0,this._layers[g]=v,this._removedLayers[g]&&v.source&&v.type!=="custom"){const L=this._removedLayers[g];delete this._removedLayers[g],L.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 l.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 g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new l.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new l.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 g=this.getLayer(s);g?g.minzoom===f&&g.maxzoom===d||(f!=null&&(g.minzoom=f),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!l.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(l.x.filter,`layers.${g.id}.filter`,f,null,d)||(g.filter=l.aA(f),this._updateLayer(g)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return l.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,g),this._updateLayer(v)):this.fire(new l.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 l.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,g)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new l.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,g=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&g?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||g?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(g,s.id,f)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=g.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(C,s.id,f):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,s.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=l.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return l.aF({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers: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={},g=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L)){d[L]=C;for(const M of s){const R=M[L];if(R)for(const z of R)g.push(z)}}}g.sort((C,L)=>L.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L))for(let M=g.length-1;M>=0;M--){const R=g[M].feature;if(d[R.layer.id]{const rt=xe.featureSortOrder;if(rt){const Qe=rt.indexOf(je.featureIndex);return rt.indexOf(Ze.featureIndex)-Qe}return Ze.featureIndex-je.featureIndex});for(const je of Ve)Ae.push(je)}}for(const xe in le)le[xe].forEach(Fe=>{const pe=Fe.feature,Ae=R[L[xe].source].getFeatureState(pe.layer["source-layer"],pe.id);pe.source=pe.layer.source,pe.layer["source-layer"]&&(pe.sourceLayer=pe.layer["source-layer"]),pe.state=Ae});return le}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(l.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(g,v){const C=g.getRenderableIds().map(R=>g.getTileByID(R)),L=[],M={};for(let R=0;RX.getTileByID(ue)).sort((ue,le)=>le.tileID.overscaledZ-ue.tileID.overscaledZ||(ue.tileID.isLessThan(le.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(E.now(),s.zoom))&&(this.pauseablePlacement=new ts(s,this.map.terrain,this._order,v,f,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),L=!0),C&&this.pauseablePlacement.placement.setStale()),L||C)for(const R of this._order){const z=this._layers[R];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return l._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return l._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(l.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},g){this._checkLoaded();const v=[{id:s,url:f}],C=[...Ce(this.stylesheet.sprite),...v];this._validate(l.x.sprite,"sprite",C,null,d)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,g))}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 l.k("data",{dataType:"style"}))}else this.fire(new l.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(l.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var ih=l.X([{name:"a_pos",type:"Int16",components:2}]),Gs="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 nc={prelude:Wn(`#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:Wn(`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:Wn(`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:Wn(`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:Wn("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:Wn(`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:Wn(`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:Wn("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:Wn("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:Wn("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:Wn(`#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:Wn(`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:Wn(`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:Wn(`#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:Wn(`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:Wn(`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:Wn(`#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:Wn(`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:Wn(`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:Wn(`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:Wn(`#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:Wn(`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:Wn(`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:Wn(`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:Wn(`#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:Wn(`#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:Wn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Gs),terrainDepth:Wn("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);}",Gs),terrainCoords:Wn("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);}",Gs)};function Wn(y,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(g):g,L={};return{fragmentSource:y=y.replace(f,(M,R,z,F,X)=>(L[X]=!0,R==="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,R,z,F,X)=>{const ue=F==="float"?"vec2":"vec4",le=X.match(/color/)?"color":ue;return L[X]?R==="define"?` -#ifndef HAS_UNIFORM_u_${X} -uniform lowp float u_${X}_t; -attribute ${z} ${ue} a_${X}; -varying ${z} ${F} ${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:le==="vec4"?` -#ifndef HAS_UNIFORM_u_${X} - ${X} = a_${X}; -#else - ${z} ${F} ${X} = u_${X}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${X} - ${X} = unpack_mix_${le}(a_${X}, u_${X}_t); -#else - ${z} ${F} ${X} = u_${X}; -#endif -`:R==="define"?` -#ifndef HAS_UNIFORM_u_${X} -uniform lowp float u_${X}_t; -attribute ${z} ${ue} a_${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:le==="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_${le}(a_${X}, u_${X}_t); -#else - ${z} ${F} ${X} = u_${X}; -#endif -`}),staticAttributes:d,staticUniforms:C}}class oh{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,g,v,C,L,M,R){this.context=s;let z=this.boundPaintVertexBuffers.length!==g.length;for(let F=0;!z&&F({u_depth:new l.aG(je,Ze.u_depth),u_terrain:new l.aG(je,Ze.u_terrain),u_terrain_dim:new l.aH(je,Ze.u_terrain_dim),u_terrain_matrix:new l.aI(je,Ze.u_terrain_matrix),u_terrain_unpack:new l.aJ(je,Ze.u_terrain_unpack),u_terrain_exaggeration:new l.aH(je,Ze.u_terrain_exaggeration)}))(s,Ve),this.binderUniforms=d?d.getUniforms(s,Ve):[]}draw(s,f,d,g,v,C,L,M,R,z,F,X,ue,le,fe,te,xe,Fe){const pe=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(g),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(pe.TEXTURE2),pe.bindTexture(pe.TEXTURE_2D,M.depthTexture),s.activeTexture.set(pe.TEXTURE3),pe.bindTexture(pe.TEXTURE_2D,M.texture);for(const Ve in this.terrainUniforms)this.terrainUniforms[Ve].set(M[Ve])}for(const Ve in this.fixedUniforms)this.fixedUniforms[Ve].set(L[Ve]);fe&&fe.setUniforms(s,this.binderUniforms,ue,{zoom:le});let Ae=0;switch(f){case pe.LINES:Ae=2;break;case pe.TRIANGLES:Ae=3;break;case pe.LINE_STRIP:Ae=1}for(const Ve of X.get()){const je=Ve.vaos||(Ve.vaos={});(je[R]||(je[R]=new oh)).bind(s,this,z,fe?fe.getPaintVertexBuffers():[],F,Ve.vertexOffset,te,xe,Fe),pe.drawElements(f,Ve.primitiveLength*Ae,pe.UNSIGNED_SHORT,Ve.primitiveOffset*Ae*2)}}}function sh(y,s,f){const d=1/Qt(f,1,s.transform.tileZoom),g=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/g,C=v*(f.tileID.canonical.x+f.tileID.wrap*g),L=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[C>>16,L>>16],u_pixel_coord_lower:[65535&C,65535&L]}}const rc=(y,s,f,d)=>{const g=s.style.light,v=g.properties.get("position"),C=[v.x,v.y,v.z],L=function(){var R=new l.A(9);return l.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();g.properties.get("anchor")==="viewport"&&function(R,z){var F=Math.sin(z),X=Math.cos(z);R[0]=X,R[1]=F,R[2]=0,R[3]=-F,R[4]=X,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(L,-s.transform.angle),function(R,z,F){var X=z[0],ue=z[1],le=z[2];R[0]=X*F[0]+ue*F[3]+le*F[6],R[1]=X*F[1]+ue*F[4]+le*F[7],R[2]=X*F[2]+ue*F[5]+le*F[8]}(C,C,L);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:C,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},K_=(y,s,f,d,g,v,C)=>l.e(rc(y,s,f,d),sh(v,s,C),{u_height_factor:-Math.pow(2,g.overscaledZ)/C.tileSize/8}),cm=y=>({u_matrix:y}),ah=(y,s,f,d)=>l.e(cm(y),sh(f,s,d)),J_=(y,s)=>({u_matrix:y,u_world:s}),hm=(y,s,f,d,g)=>l.e(ah(y,s,f,d),{u_world:g}),Q_=(y,s,f,d)=>{const g=y.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const L=Qt(f,1,g.zoom);v=!0,C=[L,L]}else v=!1,C=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:C}},fm=(y,s,f)=>{const d=Qt(f,1,s.zoom),g=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:v}},pm=(y,s,f=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:f}),lh=y=>({u_matrix:y}),dm=(y,s,f,d)=>({u_matrix:y,u_extrude_scale:Qt(s,1,f),u_intensity:d});function mm(y,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new l.Y(0,d/f).toLngLat().lat,new l.Y(0,(d+1)/f).toLngLat().lat]}const uh=(y,s,f,d)=>{const g=y.transform;return{u_matrix:ic(y,s,f,d),u_ratio:1/Qt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},gm=(y,s,f,d,g)=>l.e(uh(y,s,f,g),{u_image:0,u_image_height:d}),Ll=(y,s,f,d,g)=>{const v=y.transform,C=Oo(s,v);return{u_matrix:ic(y,s,f,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Qt(s,1,v.zoom),u_device_pixel_ratio:y.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]]}},ch=(y,s,f,d,g,v)=>{const C=y.lineAtlas,L=Oo(s,y.transform),M=f.layout.get("line-cap")==="round",R=C.getDash(d.from,M),z=C.getDash(d.to,M),F=R.width*g.fromScale,X=z.width*g.toScale;return l.e(uh(y,s,f,v),{u_patternscale_a:[L/F,-R.height/2],u_patternscale_b:[L/X,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,X)*y.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:z.y,u_mix:g.t})};function Oo(y,s){return 1/Qt(y,1,s.tileZoom)}function ic(y,s,f,d){return y.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const hh=(y,s,f,d,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(C=g.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=g.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:oc(g.paint.get("raster-hue-rotate"))};var v,C};function oc(y){y*=Math.PI/180;const s=Math.sin(y),f=Math.cos(y);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const sc=(y,s,f,d,g,v,C,L,M,R)=>{const z=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:L,u_is_text:+M,u_pitch_with_map:+d,u_texsize:R,u_texture:0}},ac=(y,s,f,d,g,v,C,L,M,R,z)=>{const F=g.transform;return l.e(sc(y,s,f,d,g,v,C,L,M,R),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+z})},lc=(y,s,f,d,g,v,C,L,M,R)=>l.e(ac(y,s,f,d,g,v,C,L,!0,M,!0),{u_texsize_icon:R,u_texture_icon:1}),$_=(y,s,f)=>({u_matrix:y,u_opacity:s,u_color:f}),ey=(y,s,f,d,g,v)=>l.e(function(C,L,M,R){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:X,height:ue}=M.imageManager.getPixelSize(),le=Math.pow(2,R.tileID.overscaledZ),fe=R.tileSize*Math.pow(2,M.transform.tileZoom)/le,te=fe*(R.tileID.canonical.x+R.tileID.wrap*le),xe=fe*R.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,ue],u_mix:L.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Qt(R,1,M.transform.tileZoom),u_pixel_coord_upper:[te>>16,xe>>16],u_pixel_coord_lower:[65535&te,65535&xe]}}(d,v,f,g),{u_matrix:y,u_opacity:s}),_m={fillExtrusion:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_opacity:new l.aH(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_height_factor:new l.aH(y,s.u_height_factor),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade),u_opacity:new l.aH(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_scale_with_map:new l.aG(y,s.u_scale_with_map),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_matrix:new l.aI(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(y,s.u_pixels_to_tile_units),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_overscale_factor:new l.aH(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_inv_matrix:new l.aI(y,s.u_inv_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_viewport_size:new l.aL(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new l.aM(y,s.u_color),u_matrix:new l.aI(y,s.u_matrix),u_overlay:new l.aG(y,s.u_overlay),u_overlay_scale:new l.aH(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new l.aH(y,s.u_extrude_scale),u_intensity:new l.aH(y,s.u_intensity),u_matrix:new l.aI(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_color_ramp:new l.aG(y,s.u_color_ramp),u_opacity:new l.aH(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_latrange:new l.aL(y,s.u_latrange),u_light:new l.aL(y,s.u_light),u_shadow:new l.aM(y,s.u_shadow),u_highlight:new l.aM(y,s.u_highlight),u_accent:new l.aM(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_dimension:new l.aL(y,s.u_dimension),u_zoom:new l.aH(y,s.u_zoom),u_unpack:new l.aJ(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_image:new l.aG(y,s.u_image),u_image_height:new l.aH(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texsize:new l.aL(y,s.u_texsize),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_image:new l.aG(y,s.u_image),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_patternscale_a:new l.aL(y,s.u_patternscale_a),u_patternscale_b:new l.aL(y,s.u_patternscale_b),u_sdfgamma:new l.aH(y,s.u_sdfgamma),u_image:new l.aG(y,s.u_image),u_tex_y_a:new l.aH(y,s.u_tex_y_a),u_tex_y_b:new l.aH(y,s.u_tex_y_b),u_mix:new l.aH(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_tl_parent:new l.aL(y,s.u_tl_parent),u_scale_parent:new l.aH(y,s.u_scale_parent),u_buffer_scale:new l.aH(y,s.u_buffer_scale),u_fade_t:new l.aH(y,s.u_fade_t),u_opacity:new l.aH(y,s.u_opacity),u_image0:new l.aG(y,s.u_image0),u_image1:new l.aG(y,s.u_image1),u_brightness_low:new l.aH(y,s.u_brightness_low),u_brightness_high:new l.aH(y,s.u_brightness_high),u_saturation_factor:new l.aH(y,s.u_saturation_factor),u_contrast_factor:new l.aH(y,s.u_contrast_factor),u_spin_weights:new l.aK(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texsize_icon:new l.aL(y,s.u_texsize_icon),u_texture:new l.aG(y,s.u_texture),u_texture_icon:new l.aG(y,s.u_texture_icon),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_color:new l.aM(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_image:new l.aG(y,s.u_image),u_pattern_tl_a:new l.aL(y,s.u_pattern_tl_a),u_pattern_br_a:new l.aL(y,s.u_pattern_br_a),u_pattern_tl_b:new l.aL(y,s.u_pattern_tl_b),u_pattern_br_b:new l.aL(y,s.u_pattern_br_b),u_texsize:new l.aL(y,s.u_texsize),u_mix:new l.aH(y,s.u_mix),u_pattern_size_a:new l.aL(y,s.u_pattern_size_a),u_pattern_size_b:new l.aL(y,s.u_pattern_size_b),u_scale_a:new l.aH(y,s.u_scale_a),u_scale_b:new l.aH(y,s.u_scale_b),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_terrain_coords_id:new l.aH(y,s.u_terrain_coords_id),u_ele_delta:new l.aH(y,s.u_ele_delta)})};class ty{constructor(s,f,d){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.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 Pl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class fh{constructor(s,f,d,g){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=g,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 ut=l.F(),pt=Ze;l.aP(ut,je.placementInvProjMatrix,y.transform.glCoordMatrix),l.aP(ut,ut,je.placementViewportMatrix),z.push({circleArray:Qe,circleOffset:X,transform:pt,invTransform:ut,coord:Ae}),F+=Qe.length/4,X=F}rt&&R.draw(L,M.LINES,In.disabled,sr.disabled,y.colorModeForRenderPass(),$n.disabled,fm(Ze,y.transform,Ve),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ae),f.id,rt.layoutVertexBuffer,rt.indexBuffer,rt.segments,null,y.transform.zoom,null,null,rt.collisionVertexBuffer)}if(!C||!z.length)return;const ue=y.useProgram("collisionCircle"),le=new l.aQ;le.resize(4*F),le._trim();let fe=0;for(const pe of z)for(let Ae=0;Ae=0&&(le[te.associatedIconIndex]={shiftedAnchor:sn,angle:dt})}else Ye(te.numGlyphs,X)}if(R){ue.clear();const fe=y.icon.placedSymbolArray;for(let te=0;tey.style.map.terrain.getElevation(rt,rs,oi):null,br=f.layout.get("text-rotation-alignment")==="map";W(ut,rt.posMatrix,y,g,Fo,Hs,te,R,br,ii)}const el=y.translatePosMatrix(rt.posMatrix,Qe,v,C),Zs=xe||g&&je||wc?_p:Fo,ri=y.translatePosMatrix(Hs,Qe,v,C,!0),vr=dt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let fr;fr=dt?ut.iconsInText?lc(Ut.kind,Ht,Fe,te,y,el,Zs,ri,pn,li):ac(Ut.kind,Ht,Fe,te,y,el,Zs,ri,g,pn,!0):sc(Ut.kind,Ht,Fe,te,y,el,Zs,ri,g,pn);const ns={program:Cn,buffers:pt,uniformValues:fr,atlasTexture:Lr,atlasTextureIcon:yr,atlasInterpolation:Hn,atlasInterpolationIcon:zo,isSDF:dt,hasHalo:vr};if(pe&&ut.canOverlap){Ae=!0;const ii=pt.segments.get();for(const br of ii)Ze.push({segments:new l.$([br]),sortKey:br.sortKey,state:ns,terrainData:hn})}else Ze.push({segments:pt.segments,sortKey:0,state:ns,terrainData:hn})}Ae&&Ze.sort((rt,Qe)=>rt.sortKey-Qe.sortKey);for(const rt of Ze){const Qe=rt.state;if(X.activeTexture.set(ue.TEXTURE0),Qe.atlasTexture.bind(Qe.atlasInterpolation,ue.CLAMP_TO_EDGE),Qe.atlasTextureIcon&&(X.activeTexture.set(ue.TEXTURE1),Qe.atlasTextureIcon&&Qe.atlasTextureIcon.bind(Qe.atlasInterpolationIcon,ue.CLAMP_TO_EDGE)),Qe.isSDF){const ut=Qe.uniformValues;Qe.hasHalo&&(ut.u_is_halo=1,Cm(Qe.buffers,rt.segments,f,y,Qe.program,Ve,z,F,ut,rt.terrainData)),ut.u_is_halo=0}Cm(Qe.buffers,rt.segments,f,y,Qe.program,Ve,z,F,Qe.uniformValues,rt.terrainData)}}function Cm(y,s,f,d,g,v,C,L,M,R){const z=d.context;g.draw(z,z.gl.TRIANGLES,v,C,L,$n.disabled,M,R,f.id,y.layoutVertexBuffer,y.indexBuffer,s,f.paint,d.transform.zoom,y.programConfigurations.get(f.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Sh(y,s,f,d,g){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],L=v[f.from.toString()];if(!C&&L&&(C=L),!L&&C&&(L=C),!C||!L){const M=g.getPaintProperty(s);C=v[M],L=v[M]}C&&L&&y.setConstantPatternPositions(C,L)}function Tm(y,s,f,d,g,v,C){const L=y.context.gl,M="fill-pattern",R=f.paint.get(M),z=R&&R.constantOr(1),F=f.getCrossfadeParameters();let X,ue,le,fe,te;C?(ue=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",X=L.LINES):(ue=z?"fillPattern":"fill",X=L.TRIANGLES);const xe=R.constantOr(null);for(const Fe of d){const pe=s.getTile(Fe);if(z&&!pe.patternsLoaded())continue;const Ae=pe.getBucket(f);if(!Ae)continue;const Ve=Ae.programConfigurations.get(f.id),je=y.useProgram(ue,Ve),Ze=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Fe);z&&(y.context.activeTexture.set(L.TEXTURE0),pe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ve.updatePaintBuffers(F)),Sh(Ve,M,xe,pe,f);const rt=Ze?Fe:null,Qe=y.translatePosMatrix(rt?rt.posMatrix:Fe.posMatrix,pe,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){fe=Ae.indexBuffer2,te=Ae.segments2;const ut=[L.drawingBufferWidth,L.drawingBufferHeight];le=ue==="fillOutlinePattern"&&z?hm(Qe,y,F,pe,ut):J_(Qe,ut)}else fe=Ae.indexBuffer,te=Ae.segments,le=z?ah(Qe,y,F,pe):cm(Qe);je.draw(y.context,X,g,y.stencilModeForClipping(Fe),v,$n.disabled,le,Ze,f.id,Ae.layoutVertexBuffer,fe,te,f.paint,y.transform.zoom,Ve)}}function Eh(y,s,f,d,g,v,C){const L=y.context,M=L.gl,R="fill-extrusion-pattern",z=f.paint.get(R),F=z.constantOr(1),X=f.getCrossfadeParameters(),ue=f.paint.get("fill-extrusion-opacity"),le=z.constantOr(null);for(const fe of d){const te=s.getTile(fe),xe=te.getBucket(f);if(!xe)continue;const Fe=y.style.map.terrain&&y.style.map.terrain.getTerrainData(fe),pe=xe.programConfigurations.get(f.id),Ae=y.useProgram(F?"fillExtrusionPattern":"fillExtrusion",pe);F&&(y.context.activeTexture.set(M.TEXTURE0),te.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),pe.updatePaintBuffers(X)),Sh(pe,R,le,te,f);const Ve=y.translatePosMatrix(fe.posMatrix,te,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),je=f.paint.get("fill-extrusion-vertical-gradient"),Ze=F?K_(Ve,y,je,ue,fe,X,te):rc(Ve,y,je,ue);Ae.draw(L,L.gl.TRIANGLES,g,v,C,$n.backCCW,Ze,Fe,f.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,f.paint,y.transform.zoom,pe,y.style.map.terrain&&xe.centroidVertexBuffer)}}function Ih(y,s,f,d,g,v,C){const L=y.context,M=L.gl,R=f.fbo;if(!R)return;const z=y.useProgram("hillshade"),F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,R.colorAttachment.get()),z.draw(L,M.TRIANGLES,g,v,C,$n.disabled,((X,ue,le,fe)=>{const te=le.paint.get("hillshade-shadow-color"),xe=le.paint.get("hillshade-highlight-color"),Fe=le.paint.get("hillshade-accent-color");let pe=le.paint.get("hillshade-illumination-direction")*(Math.PI/180);le.paint.get("hillshade-illumination-anchor")==="viewport"&&(pe-=X.transform.angle);const Ae=!X.options.moving;return{u_matrix:fe?fe.posMatrix:X.transform.calculatePosMatrix(ue.tileID.toUnwrapped(),Ae),u_image:0,u_latrange:mm(0,ue.tileID),u_light:[le.paint.get("hillshade-exaggeration"),pe],u_shadow:te,u_highlight:xe,u_accent:Fe}})(y,f,d,F?s:null),F,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function yp(y,s,f,d,g,v){const C=y.context,L=C.gl,M=s.dem;if(M&&M.data){const R=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(L.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(z),s.demTexture){const ue=s.demTexture;ue.update(F,{premultiply:!1}),ue.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else s.demTexture=new H(C,F,L.RGBA,{premultiply:!1}),s.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);C.activeTexture.set(L.TEXTURE0);let X=s.fbo;if(!X){const ue=new H(C,{width:R,height:R,data:null},L.RGBA);ue.bind(L.LINEAR,L.CLAMP_TO_EDGE),X=s.fbo=C.createFramebuffer(R,R,!0,!1),X.colorAttachment.set(ue.texture)}C.bindFramebuffer.set(X.framebuffer),C.viewport.set([0,0,R,R]),y.useProgram("hillshadePrepare").draw(C,L.TRIANGLES,d,g,v,$n.disabled,((ue,le)=>{const fe=le.stride,te=l.F();return l.aN(te,0,l.W,-l.W,0,0,1),l.H(te,te,[0,-l.W,0]),{u_matrix:te,u_image:1,u_dimension:[fe,fe],u_zoom:ue.overscaledZ,u_unpack:le.getUnpackVector()}})(s.tileID,M),null,f.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Lm(y,s,f,d,g,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const L=E.now(),M=(L-y.timeAdded)/C,R=s?(L-s.timeAdded)/C:-1,z=f.getSource(),F=g.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),X=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(y.tileID.overscaledZ-F),ue=X&&y.refreshedUponExpiration?1:l.ac(X?M:1-R,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-ue}:{opacity:ue,mix:0}}return{opacity:1,mix:0}}const Pm=new l.aO(1,0,0,1),Ch=new l.aO(0,1,0,1),vp=new l.aO(0,0,1,1),cy=new l.aO(1,0,1,1),Mm=new l.aO(0,1,1,1);function Cr(y,s,f,d){no(y,0,s+f/2,y.transform.width,f,d)}function Ya(y,s,f,d){no(y,s-f/2,0,f,y.transform.height,d)}function no(y,s,f,d,g,v){const C=y.context,L=C.gl;L.enable(L.SCISSOR_TEST),L.scissor(s*y.pixelRatio,f*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),C.clear({color:v}),L.disable(L.SCISSOR_TEST)}function bp(y,s,f){const d=y.context,g=d.gl,v=f.posMatrix,C=y.useProgram("debug"),L=In.disabled,M=sr.disabled,R=y.colorModeForRenderPass(),z="$debug",F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(f);d.activeTexture.set(g.TEXTURE0);const X=s.getTileByID(f.key).latestRawTileData,ue=Math.floor((X&&X.byteLength||0)/1024),le=s.getTile(f).tileSize,fe=512/Math.min(le,512)*(f.overscaledZ/y.transform.zoom)*.5;let te=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(te+=` => ${f.overscaledZ}`),function(xe,Fe){xe.initDebugOverlayCanvas();const pe=xe.debugOverlayCanvas,Ae=xe.context.gl,Ve=xe.debugOverlayCanvas.getContext("2d");Ve.clearRect(0,0,pe.width,pe.height),Ve.shadowColor="white",Ve.shadowBlur=2,Ve.lineWidth=1.5,Ve.strokeStyle="white",Ve.textBaseline="top",Ve.font="bold 36px Open Sans, sans-serif",Ve.fillText(Fe,5,5),Ve.strokeText(Fe,5,5),xe.debugOverlayTexture.update(pe),xe.debugOverlayTexture.bind(Ae.LINEAR,Ae.CLAMP_TO_EDGE)}(y,`${te} ${ue}kB`),C.draw(d,g.TRIANGLES,L,M,Ur.alphaBlended,$n.disabled,pm(v,l.aO.transparent,fe),null,z,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),C.draw(d,g.LINE_STRIP,L,M,R,$n.disabled,pm(v,l.aO.red),F,z,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Th(y,s,f){const d=y.context,g=d.gl,v=y.colorModeForRenderPass(),C=new In(g.LEQUAL,In.ReadWrite,y.depthRangeFor3D),L=y.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const R of f){const z=y.renderToTexture.getTexture(R),F=s.getTerrainData(R.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,z.texture);const X={u_matrix:y.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};L.draw(d,g.TRIANGLES,C,sr.disabled,v,$n.backCCW,X,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Am{constructor(s,f){this.context=new uy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ei.maxUnderzooming+ei.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Za}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 g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,f=new l.aV;f.emplaceBack(0,0),f.emplaceBack(l.W,0),f.emplaceBack(0,l.W),f.emplaceBack(l.W,l.W),this.tileExtentBuffer=s.createVertexBuffer(f,ih.members),this.tileExtentSegments=l.$.simpleSegment(0,0,4,2);const d=new l.aV;d.emplaceBack(0,0),d.emplaceBack(l.W,0),d.emplaceBack(0,l.W),d.emplaceBack(l.W,l.W),this.debugBuffer=s.createVertexBuffer(d,ih.members),this.debugSegments=l.$.simpleSegment(0,0,4,5);const g=new l.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(l.W,0,l.W,0),g.emplaceBack(0,l.W,0,l.W),g.emplaceBack(l.W,l.W,l.W,l.W),this.rasterBoundsBuffer=s.createVertexBuffer(g,fn.members),this.rasterBoundsSegments=l.$.simpleSegment(0,0,4,2);const v=new l.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,ih.members),this.viewportSegments=l.$.simpleSegment(0,0,4,2);const C=new l.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const L=new l.aX;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(L);const M=this.context.gl;this.stencilClearMode=new sr({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=l.F();l.aN(d,0,this.width,this.height,0,0,1),l.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,In.disabled,this.stencilClearMode,Ur.disabled,$n.disabled,lh(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,g=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Ur.disabled),d.setDepthMode(In.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const L=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,g.TRIANGLES,In.disabled,new sr({func:g.ALWAYS,mask:0},L,255,g.KEEP,g.KEEP,g.REPLACE),Ur.disabled,$n.disabled,lh(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 sr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new sr({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,L)=>L.overscaledZ-C.overscaledZ),g=d[d.length-1].overscaledZ,v=d[0].overscaledZ-g+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let L=0;L=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],R=g[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,R,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerte.source&&!te.isHidden(z)?[R.sourceCaches[te.source]]:[]),ue=X.filter(te=>te.getSource().type==="vector"),le=X.filter(te=>te.getSource().type!=="vector"),fe=te=>{(!F||F.getSource().maxzoomfe(te)),F||le.forEach(te=>fe(te)),F}(this.style,this.transform.zoom);M&&function(R,z,F){for(let X=0;X0),g&&(l.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),X=C.sourceCache.getRenderableTiles(),ue=v.useProgram("terrainDepth");L.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1});for(const le of X){const fe=C.getTerrainData(le.tileID),te={u_matrix:v.transform.calculatePosMatrix(le.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ue.draw(L,M.TRIANGLES,z,sr.disabled,R,$n.backCCW,te,fe,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),X=C.getCoordsTexture(),ue=C.sourceCache.getRenderableTiles(),le=v.useProgram("terrainCoords");L.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1}),C.coordsIndex=[];for(const fe of ue){const te=C.getTerrainData(fe.tileID);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,X.texture);const xe={u_matrix:v.transform.calculatePosMatrix(fe.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};le.draw(L,M.TRIANGLES,z,sr.disabled,R,$n.backCCW,xe,te,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(fe.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,g){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(g||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,C,L,M,R){if(v.renderPass!=="translucent")return;const z=sr.disabled,F=v.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(X,ue,le,fe,te,xe,Fe){const pe=ue.transform,Ae=te==="map",Ve=xe==="map";for(const je of X){const Ze=fe.getTile(je),rt=Ze.getBucket(le);if(!rt||!rt.text||!rt.text.segments.get().length)continue;const Qe=l.ag(rt.textSizeData,pe.zoom),ut=Qt(Ze,1,ue.transform.zoom),pt=tn(je.posMatrix,Ve,Ae,ue.transform,ut),sn=le.layout.get("icon-text-fit")!=="none"&&rt.hasIconData();if(Qe){const dt=Math.pow(2,pe.zoom-Ze.tileID.overscaledZ);bh(rt,Ae,Ve,Fe,pe,pt,je.posMatrix,dt,Qe,sn,ue.style.map.terrain?(Ut,an)=>ue.style.map.terrain.getElevation(je,Ut,an):null)}}}(M,v,L,C,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),R),L.paint.get("icon-opacity").constantOr(1)!==0&&wh(v,C,L,M,!1,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),L.layout.get("icon-rotation-alignment"),L.layout.get("icon-pitch-alignment"),L.layout.get("icon-keep-upright"),z,F),L.paint.get("text-opacity").constantOr(1)!==0&&wh(v,C,L,M,!0,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(vh(v,C,L,M,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),!0),vh(v,C,L,M,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),!1))})(s,f,d,g,this.style.placement.variableOffsets);break;case"circle":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("circle-opacity"),z=L.paint.get("circle-stroke-width"),F=L.paint.get("circle-stroke-opacity"),X=!L.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const ue=v.context,le=ue.gl,fe=v.depthModeForSublayer(0,In.ReadOnly),te=sr.disabled,xe=v.colorModeForRenderPass(),Fe=[];for(let pe=0;pepe.sortKey-Ae.sortKey);for(const pe of Fe){const{programConfiguration:Ae,program:Ve,layoutVertexBuffer:je,indexBuffer:Ze,uniformValues:rt,terrainData:Qe}=pe.state;Ve.draw(ue,le.TRIANGLES,fe,te,xe,$n.disabled,rt,Qe,L.id,je,Ze,pe.segments,L.paint,v.transform.zoom,Ae)}})(s,f,d,g);break;case"heatmap":(function(v,C,L,M){if(L.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,z=R.gl,F=sr.disabled,X=new Ur([z.ONE,z.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(ue,le,fe){const te=ue.gl;ue.activeTexture.set(te.TEXTURE1),ue.viewport.set([0,0,le.width/4,le.height/4]);let xe=fe.heatmapFbo;if(xe)te.bindTexture(te.TEXTURE_2D,xe.colorAttachment.get()),ue.bindFramebuffer.set(xe.framebuffer);else{const Fe=te.createTexture();te.bindTexture(te.TEXTURE_2D,Fe),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_WRAP_S,te.CLAMP_TO_EDGE),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_WRAP_T,te.CLAMP_TO_EDGE),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_MIN_FILTER,te.LINEAR),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_MAG_FILTER,te.LINEAR),xe=fe.heatmapFbo=ue.createFramebuffer(le.width/4,le.height/4,!1,!1),function(pe,Ae,Ve,je){var Ze,rt;const Qe=pe.gl,ut=(Ze=pe.HALF_FLOAT)!==null&&Ze!==void 0?Ze:Qe.UNSIGNED_BYTE,pt=(rt=pe.RGBA16F)!==null&&rt!==void 0?rt:Qe.RGBA;Qe.texImage2D(Qe.TEXTURE_2D,0,pt,Ae.width/4,Ae.height/4,0,Qe.RGBA,ut,null),je.colorAttachment.set(Ve)}(ue,le,Fe,xe)}})(R,v,L),R.clear({color:l.aO.transparent});for(let ue=0;ue{const pe=l.F();l.aN(pe,0,fe.width,fe.height,0,0,1);const Ae=fe.context.gl;return{u_matrix:pe,u_world:[Ae.drawingBufferWidth,Ae.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:te.paint.get("heatmap-opacity")}})(R,z),null,z.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,z.paint,R.transform.zoom)}(v,L))})(s,f,d,g);break;case"line":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("line-opacity"),z=L.paint.get("line-width");if(R.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,In.ReadOnly),X=v.colorModeForRenderPass(),ue=L.paint.get("line-dasharray"),le=L.paint.get("line-pattern"),fe=le.constantOr(1),te=L.paint.get("line-gradient"),xe=L.getCrossfadeParameters(),Fe=fe?"linePattern":ue?"lineSDF":te?"lineGradient":"line",pe=v.context,Ae=pe.gl;let Ve=!0;for(const je of M){const Ze=C.getTile(je);if(fe&&!Ze.patternsLoaded())continue;const rt=Ze.getBucket(L);if(!rt)continue;const Qe=rt.programConfigurations.get(L.id),ut=v.context.program.get(),pt=v.useProgram(Fe,Qe),sn=Ve||pt.program!==ut,dt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(je),Ut=le.constantOr(null);if(Ut&&Ze.imageAtlas){const Ht=Ze.imageAtlas,hn=Ht.patternPositions[Ut.to.toString()],pn=Ht.patternPositions[Ut.from.toString()];hn&&pn&&Qe.setConstantPatternPositions(hn,pn)}const an=dt?je:null,Cn=fe?Ll(v,Ze,L,xe,an):ue?ch(v,Ze,L,ue,xe,an):te?gm(v,Ze,L,rt.lineClipsArray.length,an):uh(v,Ze,L,an);if(fe)pe.activeTexture.set(Ae.TEXTURE0),Ze.imageAtlasTexture.bind(Ae.LINEAR,Ae.CLAMP_TO_EDGE),Qe.updatePaintBuffers(xe);else if(ue&&(sn||v.lineAtlas.dirty))pe.activeTexture.set(Ae.TEXTURE0),v.lineAtlas.bind(pe);else if(te){const Ht=rt.gradients[L.id];let hn=Ht.texture;if(L.gradientVersion!==Ht.version){let pn=256;if(L.stepInterpolant){const Lr=C.getSource().maxzoom,Hn=je.canonical.z===Lr?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 Xa(this.context,nc[s],f,_m[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 Ka{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const g=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(L=>{const M=1/(L=l.af([],L,s))[3]/f*g;return l.a$(L,L,[M,M,1/L[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const M=function(X,ue){var le=ue[0],fe=ue[1],te=ue[2],xe=le*le+fe*fe+te*te;return xe>0&&(xe=1/Math.sqrt(xe)),X[0]=ue[0]*xe,X[1]=ue[1]*xe,X[2]=ue[2]*xe,X}([],function(X,ue,le){var fe=ue[0],te=ue[1],xe=ue[2],Fe=le[0],pe=le[1],Ae=le[2];return X[0]=te*Ae-xe*pe,X[1]=xe*Fe-fe*Ae,X[2]=fe*pe-te*Fe,X}([],re([],v[L[0]],v[L[1]]),re([],v[L[2]],v[L[1]]))),R=-((z=M)[0]*(F=v[L[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(R)});return new Ka(v,C)}}class Ja{constructor(s,f){this.min=s,this.max=f,this.center=function(d,g,v){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,v){return d[0]=g[0]+v[0],d[1]=g[1]+v[1],d[2]=g[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=me(this.min),g=me(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 g=0;g<3;g++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let L=0;Lthis.max[g]-this.min[g])return 0}return 1}}class mu{constructor(s=0,f=0,d=0,g=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=g}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=l.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=l.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=l.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=l.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=l.ac((this.left+s-this.right)/2,0,s),g=l.ac((this.top+f-this.bottom)/2,0,f);return new l.P(d,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new mu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const xp=85.051129;class Lh{constructor(s,f,d,g,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new mu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new Lh(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 l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-l.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new l.A(4);return l.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,v){var C=g[0],L=g[1],M=g[2],R=g[3],z=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*z,d[1]=L*F+R*z,d[2]=C*-z+M*F,d[3]=L*-z+R*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=l.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 l.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new l.P(0,0)),g=this.pointCoordinate(new l.P(this.width,0)),v=this.pointCoordinate(new l.P(this.width,this.height)),C=this.pointCoordinate(new l.P(0,this.height)),L=Math.floor(Math.min(d.x,g.x,v.x,C.x)),M=Math.floor(Math.max(d.x,g.x,v.x,C.x)),R=1;for(let z=L-R;z<=M+R;z++)z!==0&&f.push(new l.b2(z,s))}return f}coveringTiles(s){var f,d;let g=this.coveringZoomLevel(s);const v=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),L=l.Y.fromLngLat(this.center),M=Math.pow(2,g),R=[M*C.x,M*C.y,0],z=[M*L.x,M*L.y,0],F=Ka.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let X=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(X=g);const ue=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,le=pe=>({aabb:new Ja([pe*M,0,0],[(pe+1)*M,M,0]),zoom:0,x:0,y:0,wrap:pe,fullyVisible:!1}),fe=[],te=[],xe=g,Fe=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let pe=1;pe<=3;pe++)fe.push(le(-pe)),fe.push(le(pe));for(fe.push(le(0));fe.length>0;){const pe=fe.pop(),Ae=pe.x,Ve=pe.y;let je=pe.fullyVisible;if(!je){const pt=pe.aabb.intersects(F);if(pt===0)continue;je=pt===2}const Ze=s.terrain?R:z,rt=pe.aabb.distanceX(Ze),Qe=pe.aabb.distanceY(Ze),ut=Math.max(Math.abs(rt),Math.abs(Qe));if(pe.zoom===xe||ut>ue+(1<=X){const pt=xe-pe.zoom,sn=R[0]-.5-(Ae<>1),Ut=pe.zoom+1;let an=pe.aabb.quadrant(pt);if(s.terrain){const Cn=new l.Q(Ut,pe.wrap,Ut,sn,dt),Ht=s.terrain.getMinMaxElevation(Cn),hn=(f=Ht.minElevation)!==null&&f!==void 0?f:this.elevation,pn=(d=Ht.maxElevation)!==null&&d!==void 0?d:this.elevation;an=new Ja([an.min[0],an.min[1],hn],[an.max[0],an.max[1],pn])}fe.push({aabb:an,zoom:Ut,x:sn,y:dt,wrap:pe.wrap,fullyVisible:je})}}return te.sort((pe,Ae)=>pe.distanceSq-Ae.distanceSq).map(pe=>pe.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=l.ac(s.lat,-85.051129,xp);return new l.P(l.N(s.lng)*this.worldSize,l.O(f)*this.worldSize)}unproject(s){return new l.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,g=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-v))return;const C=d+f-v,L=Math.cos(this._pitch)*this.cameraToCenterDistance/C/l.b3(1,g.lat),M=this.scaleZoom(L/this.tileSize);this._elevation=v,this._center=g,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),g=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new l.Y(v.x-(d.x-g.x),v.y-(d.y-g.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 l.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],g=[s.x,s.y,1,1];l.af(d,d,this.pixelMatrixInverse),l.af(g,g,this.pixelMatrixInverse);const v=d[3],C=g[3],L=d[1]/v,M=g[1]/C,R=d[2]/v,z=g[2]/C,F=R===z?0:(0-R)/(z-R);return new l.Y(l.z.number(d[0]/v,g[0]/C,F)/this.worldSize,l.z.number(L,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,f,1];return l.af(g,g,d),new l.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Te().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Te([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,xp])}calculatePosMatrix(s,f=!1){const d=s.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),L=v.x+Math.pow(2,v.z)*s.wrap,M=l.an(new Float64Array(16));return l.H(M,M,[L*C,v.y*C,0]),l.J(M,M,[C/l.W,C/l.W,1]),l.K(M,f?this.alignedProjMatrix:this.projMatrix,M),g[d]=new Float32Array(M),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=l.ac(+f,this.minZoom,this.maxZoom);const d={center:new l.M(s.lng,s.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const pe=179.9999999999;g=[-pe,pe]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,L=v,M=0,R=v,z=0,F=0;const{x:X,y:ue}=this.size;if(this.latRange){const pe=this.latRange;C=l.O(pe[1])*v,L=l.O(pe[0])*v,L-CL&&(xe=L-pe)}if(g){const pe=(M+R)/2;let Ae=le;this._renderWorldCopies&&(Ae=l.b1(le,pe-v/2,pe+v/2));const Ve=X/2;Ae-VeR&&(te=R-Ve)}if(te!==void 0||xe!==void 0){const pe=new l.P(te??le,xe??fe);d.center=this.unproject.call({worldSize:v},pe).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=l.b3(1,this.center.lat)*this.worldSize;let g=l.an(new Float64Array(16));l.J(g,g,[this.width/2,-this.height/2,1]),l.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=l.an(new Float64Array(16)),l.J(g,g,[1,-1,1]),l.H(g,g,[-1,-1,0]),l.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),L=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?L:v,R=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(l.ac(Math.PI-R-z,.01,Math.PI-.01)),X=this.getHorizon(),ue=2*Math.atan(X/this.cameraToCenterDistance)*(.5+s.y/(2*X)),le=Math.sin(ue)*M/Math.sin(l.ac(Math.PI-R-ue,.01,Math.PI-.01)),fe=Math.min(F,le),te=1.01*(Math.cos(Math.PI/2-this._pitch)*fe+M),xe=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,xe,te),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,l.J(g,g,[1,-1,1]),l.H(g,g,[0,0,-this.cameraToCenterDistance]),l.b5(g,g,this._pitch),l.ad(g,g,this.angle),l.H(g,g,[-f,-d,0]),this.mercatorMatrix=l.J([],g,[this.worldSize,this.worldSize,this.worldSize]),l.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.K(new Float64Array(16),this.labelPlaneMatrix,g),l.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=l.ar([],g),this.pixelMatrix3D=l.K(new Float64Array(16),this.labelPlaneMatrix,g);const Fe=this.width%2/2,pe=this.height%2/2,Ae=Math.cos(this.angle),Ve=Math.sin(this.angle),je=f-Math.round(f)+Ae*Fe+Ve*pe,Ze=d-Math.round(d)+Ae*pe+Ve*Fe,rt=new Float64Array(g);if(l.H(rt,rt,[je>.5?je-1:je,Ze>.5?Ze-1:Ze,0]),this.alignedProjMatrix=rt,g=l.ar(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,g=f.y,v=f.x,C=f.y;for(const L of s)d=Math.min(d,L.x),g=Math.min(g,L.y),v=Math.max(v,L.x),C=Math.max(C,L.y);return[new l.P(d,g),new l.P(v,g),new l.P(v,C),new l.P(d,C),new l.P(d,g)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),g=[d.x*this.worldSize,d.y*this.worldSize,f,1];return l.af(g,g,this.projMatrix),g[2]/g[3]}}function wp(y,s){let f,d=!1,g=null,v=null;const C=()=>{g=null,d&&(y.apply(v,f),g=setTimeout(C,s),d=!1)};return(...L)=>(d=!0,v=this,f=L,g||C(),g)}class Sp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(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=wp(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,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,g),C=Math.round(f.lng*v)/v,L=Math.round(f.lat*v)/v,M=this._map.getBearing(),R=this._map.getPitch();let z="";if(z+=s?`/${C}/${L}/${d}`:`${d}/${L}/${C}`,(M||R)&&(z+="/"+Math.round(10*M)/10),R&&(z+=`/${Math.round(R)}`),this._hashName){const F=this._hashName;let X=!1;const ue=window.location.hash.slice(1).split("&").map(le=>{const fe=le.split("=")[0];return fe===F?(X=!0,`${fe}=${z}`):le}).filter(le=>le);return X||ue.push(`${F}=${z}`),`#${ue.join("&")}`}return`#${z}`}}const cc={linearity:.3,easing:l.b6(0,0,.3,1)},kl=l.e({deceleration:2500,maxSpeed:1400},cc),km=l.e({deceleration:20,maxSpeed:1400},cc),Dm=l.e({deceleration:1e3,maxSpeed:360},cc),Rm=l.e({deceleration:1e3,maxSpeed:90},cc);class Nm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=E.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 l.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,g={};if(f.pan.mag()){const v=fc(f.pan.mag(),d,l.e({},kl,s||{}));g.offset=f.pan.mult(v.amount/f.pan.mag()),g.center=this._map.transform.center,hc(g,v)}if(f.zoom){const v=fc(f.zoom,d,km);g.zoom=this._map.transform.zoom+v.amount,hc(g,v)}if(f.bearing){const v=fc(f.bearing,d,Dm);g.bearing=this._map.transform.bearing+l.ac(v.amount,-179,179),hc(g,v)}if(f.pitch){const v=fc(f.pitch,d,Rm);g.pitch=this._map.transform.pitch+v.amount,hc(g,v)}if(g.zoom||g.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;g.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),l.e(g,{noMoveStart:!0})}}function hc(y,s){(!y.duration||y.durationf.unproject(M)),L=v.reduce((M,R,z,F)=>M.add(R.div(F.length)),new l.P(0,0));super(s,{points:v,point:L,lngLats:C,lngLat:f.unproject(L),originalEvent:d}),this._defaultPrevented=!1}}class Ep extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ys{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Ep(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new yo(s.type,this._map,s))}mouseup(s){this._map.fire(new yo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new yo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new yo(s.type,this._map,s))}mouseover(s){this._map.fire(new yo(s.type,this._map,s))}mouseout(s){this._map.fire(new yo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new js(s.type,this._map,s))}touchmove(s){this._map.fire(new js(s.type,this._map,s))}touchend(s){this._map.fire(new js(s.type,this._map,s))}touchcancel(s){this._map.fire(new js(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class qs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new yo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new yo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new yo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{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(l.P.convert(s),this._map.terrain)}}class vs{constructor(s,f){this._map=s,this._tr=new gu(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&&(T.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,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new l.k(s,{originalEvent:f}))}}function Dl(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const f={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const v=new l.P(0,0);for(const C of g)v._add(C);return v.div(g.length)}(f),this.touches=Dl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const g=Dl(d,f);for(const v in this.touches){const C=g[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 g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Ip{constructor(s){this.singleTap=new hy(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 g=this.singleTap.touchend(s,f,d);if(g){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(g)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class fy{constructor(s){this._tr=new gu(s),this._zoomIn=new Ip({numTouches:1,numTaps:2}),this._zoomOut=new Ip({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 g=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),C=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.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 _u{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 g=f.length?f[0]:f;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},yu=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Ws({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new _u({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*f}),moveStateManager:d,enable:y,assignEvents:Ph})},vu=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Ws({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new _u({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*f}),moveStateManager:d,enable:y,assignEvents:Ph})};class Om{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.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 g=Dl(d,f),v=new l.P(0,0),C=new l.P(0,0);let L=0;for(const R in g){const z=g[R],F=this._touches[R];F&&(v._add(z),C._add(z.sub(F)),L++,g[R]=z)}if(this._touches=g,LMath.abs(y.x)}class Bm extends bt{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,Ah(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,v=f.mag()>=2;if(!g&&!v)return;if(!g||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return Ah(s)&&Ah(f)&&C}}const py={panStep:100,bearingStep:15,pitchStep:10};class Qa{constructor(s){this._tr=new gu(s);const f=py;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,g=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?g=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:L=>{const M=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:hr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+g*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 hr(y){return y*(2-y)}const dc=4.000244140625;class kh{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new gu(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=E.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%dc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*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=T.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?l.M.convert(this._aroundCenter?d.center:d.unproject(f)):l.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 L=this._type==="wheel"&&Math.abs(this._delta)>dc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&M!==0&&(M=1/M);const R=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(R*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,g=this._easing;let v,C=!1;if(this._type==="wheel"&&d&&g){const L=Math.min((E.now()-this._lastWheelEventTime)/200,1),M=g(L);v=l.z.number(d,f,M),L<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=l.b7;if(this._prevEase){const d=this._prevEase,g=(E.now()-d.start)/d.duration,v=d.easing(g+.01)-d.easing(g),C=.27/Math.sqrt(v*v+1e-4)*.01,L=Math.sqrt(.0729-C*C);f=l.b6(C,L,.25,1)}return this._prevEase={start:E.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 Tp{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 Vm{constructor(s){this._tr=new gu(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 Um{constructor(){this._tap=new Ip({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 g=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(g)<30;v&&C?d.length>0&&(this._swipePoint=g,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 g=f[0],v=g.y-this._swipePoint.y;return this._swipePoint=g,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 g=this._tap.touchend(s,f,d);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gm{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 bs{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 mc{constructor(s,f,d,g){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Dt{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=T.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"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=f,this._container.appendChild(g);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&&(T.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 Vt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Dh extends l.k{}function gc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Lp{constructor(s,f){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,v)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=g.type==="renderFrame"?void 0:g,L={needsRenderFrame:!1},M={},R={},z=g.touches,F=z?this._getMapTouches(z):void 0,X=F?T.touchPos(this._map.getCanvas(),F):T.mousePos(this._map.getCanvas(),g);for(const{handlerName:fe,handler:te,allowed:xe}of this._handlers){if(!te.isEnabled())continue;let Fe;this._blockedByActive(R,xe,fe)?te.reset():te[v||g.type]&&(Fe=te[v||g.type](g,X,F),this.mergeHandlerResult(L,M,Fe,fe,C),Fe&&Fe.needsRenderFrame&&this._triggerRenderFrame()),(Fe||te.isActive())&&(R[fe]=te)}const ue={};for(const fe in this._previousActiveHandlers)R[fe]||(ue[fe]=C);this._previousActiveHandlers=R,(Object.keys(ue).length||gc(L))&&(this._changes.push([L,M,ue]),this._triggerRenderFrame()),(Object.keys(R).length||gc(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:le}=L;le&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],le(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Nm(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[g,v,C]of this._listeners)T.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)T.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ys(f,s));const g=f.boxZoom=new vs(f,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const v=f.cooperativeGestures=new Dt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new fy(f),L=new Vm(f);f.doubleClickZoom=new Tp(L,C),this._add("tapZoom",C),this._add("clickZoom",L),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Um;this._add("tapDragZoom",M);const R=f.touchPitch=new Bm(f);this._add("touchPitch",R),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=yu(s),F=vu(s);f.dragRotate=new bs(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:pe})=>{const Ae=new Ws({checkCorrectEvent:Ve=>T.mouseButton(Ve)===0&&!Ve.ctrlKey});return new _u({clickTolerance:pe,move:(Ve,je)=>({around:je,panDelta:je.sub(Ve)}),activateOnStart:!0,moveStateManager:Ae,enable:Fe,assignEvents:Ph})})(s),ue=new Om(s,f);f.dragPan=new Gm(d,X,ue),this._add("mousePan",X),this._add("touchPan",ue,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const le=new Cp,fe=new Fm;f.touchZoomRotate=new mc(d,fe,le,M),this._add("touchRotate",le,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const te=f.scrollZoom=new kh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",te,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const xe=f.keyboard=new Qa(f);this._add("keyboard",xe),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new qs(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!!Vt(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const g in s)if(g!==d&&(!f||f.indexOf(g)<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,g,v){if(!d)return;l.e(s,d);const C={handlerName:g,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[g,v,C]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),l.e(f,v),l.e(d,C);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const g=this._map,v=g._getTransformForUpdate(),C=g.terrain;if(!(gc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:L,zoomDelta:M,bearingDelta:R,pitchDelta:z,around:F,pinchAround:X}=s;X!==void 0&&(F=X),g._stop(!0),F=F||g.transform.centerPoint;const ue=v.pointLocation(L?F.sub(L):F);R&&(v.bearing+=R),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(L)):v.setLocationAtPoint(ue,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(ue,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(g.terrain)})):v.setLocationAtPoint(ue,F),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const g=Vt(this._eventsInProgress),v=Vt(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!g&&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 L={};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,L[`${z}end`]=M)}for(const z in L)this._fireEvent(z,L[z]);const R=Vt(this._eventsInProgress);if(d&&(g||v)&&!R){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=X=>X!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Dh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class vo extends l.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((E.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 l.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(l.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(l.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(l.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,l.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=l.z.number(v,te,Ze)),this._rotating&&(g.bearing=l.z.number(C,R,Ze)),this._pitching&&(g.pitch=l.z.number(L,z,Ze)),this._padding&&(g.interpolatePadding(M,F,Ze),ue=g.centerPoint.add(X)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ze),Ae)g.setLocationAtPoint(Ae,Ve);else{const rt=g.zoomScale(g.zoom-v),Qe=te>v?Math.min(2,pe):Math.max(.5,pe),ut=Math.pow(Qe,1-Ze),pt=g.unproject(xe.add(Fe.mult(Ze*ut)).mult(rt));g.setLocationAtPoint(g.renderWorldCopies?pt.wrap():pt,ue)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},Ze=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ze)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new l.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new l.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=l.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:g,pitch:v,bearing:C,elevation:L}=this.transformCameraUpdate(f);d&&(f.center=d),g!==void 0&&(f.zoom=g),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),L!==void 0&&(f.elevation=L),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,g=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new l.k("zoomend",s)),g&&this.fire(new l.k("rotateend",s)),v&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&E.prefersReducedMotion){const Cn=l.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Cn,f)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b7},s);const g=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),L=this.getPitch(),M=this.getPadding(),R="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:L,F="padding"in s?s.padding:g.padding,X=l.P.convert(s.offset);let ue=g.centerPoint.add(X);const le=g.pointLocation(ue),{center:fe,zoom:te}=g.getConstrained(l.M.convert(s.center||le),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(fe);const xe=g.zoomScale(te-v),Fe=g.project(le),pe=g.project(fe).sub(Fe);let Ae=s.curve;const Ve=Math.max(g.width,g.height),je=Ve/xe,Ze=pe.mag();if("minZoom"in s){const Cn=l.ac(Math.min(s.minZoom,v,te),g.minZoom,g.maxZoom),Ht=Ve/g.zoomScale(Cn-v);Ae=Math.sqrt(Ht/Ze*2)}const rt=Ae*Ae;function Qe(Cn){const Ht=(je*je-Ve*Ve+(Cn?-1:1)*rt*rt*Ze*Ze)/(2*(Cn?je:Ve)*rt*Ze);return Math.log(Math.sqrt(Ht*Ht+1)-Ht)}function ut(Cn){return(Math.exp(Cn)-Math.exp(-Cn))/2}function pt(Cn){return(Math.exp(Cn)+Math.exp(-Cn))/2}const sn=Qe(!1);let dt=function(Cn){return pt(sn)/pt(sn+Ae*Cn)},Ut=function(Cn){return Ve*((pt(sn)*(ut(Ht=sn+Ae*Cn)/pt(Ht))-ut(sn))/rt)/Ze;var Ht},an=(Qe(!0)-sn)/Ae;if(Math.abs(Ze)<1e-6||!isFinite(an)){if(Math.abs(Ve-je)<1e-6)return this.easeTo(s,f);const Cn=jes.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==R,this._pitching=z!==L,this._padding=!g.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(fe),this._ease(Cn=>{const Ht=Cn*an,hn=1/dt(Ht);g.zoom=Cn===1?te:v+g.scaleZoom(hn),this._rotating&&(g.bearing=l.z.number(C,R,Cn)),this._pitching&&(g.pitch=l.z.number(L,z,Cn)),this._padding&&(g.interpolatePadding(M,F,Cn),ue=g.centerPoint.add(X)),this.terrain&&!s.freezeElevation&&this._updateElevation(Cn);const pn=Cn===1?fe:g.unproject(Fe.add(pe.mult(Ut(Ht))).mult(hn));g.setLocationAtPoint(g.renderWorldCopies?pn.wrap():pn,ue),this._applyUpdatedTransform(g),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=E.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=l.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(l.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Pp={compact:!0,customAttribution:'MapLibre'};class xs{constructor(s=Pp){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=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.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(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const f=this._map.style.sourceCaches;for(const g in f){const v=f[g];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,v)=>g.length-v.length),s=s.filter((g,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 jm{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=T.create("div","maplibregl-ctrl");const f=T.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(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class _c{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 g of d)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const 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 Tr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class Gr extends l.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 g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),l.aN(g.posMatrix,0,l.W,0,l.W,0,1),this._tiles[g.key]=new Qo(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}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 g=this._tiles[d].tileID;if(g.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),l.aN(v.posMatrix,0,l.W,0,l.W,0,1),f[d]=v}else if(g.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=g.canonical.z-s.canonical.z,L=g.canonical.x-(g.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,R,0,R,0,1),l.H(v.posMatrix,v.posMatrix,[-L*R,-M*R,0]),f[d]=v}else if(s.canonical.isChildOf(g.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-g.canonical.z,L=s.canonical.x-(s.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,l.W,0,l.W,0,1),l.H(v.posMatrix,v.posMatrix,[L*R,M*R,0]),l.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 g=s.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(g--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class qm{constructor(s,f,d){this.painter=s,this.sourceCache=new Gr(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,g=l.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=g?v=s.canonical.z-g:l.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 l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new H(s,d,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,g=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,L-C-1,1,1,g.RGBA,g.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),R=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,ue=(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 wa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new yc(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 g=s.sourceCaches[d].getVisibleCoordinates();for(const v of g){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const L in C)this._coordsDescendingInv[d][L]||(this._coordsDescendingInv[d][L]=[]),this._coordsDescendingInv[d][L].push(C[L])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],v=g.source;if(wa[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(L=>L.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[g][d.tileID.key];v&&v!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(wa[f]&&(this._prevType&&wa[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(wa[this._prevType]||wa[f]&&g){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(Th(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[v]){const R=this.pool.getObjectForId(L.rtt[v].id);if(R.stamp===L.rtt[v].stamp){this.pool.useObject(R);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),L.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:l.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let R=0;R{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Dp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Rp{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(l.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),T.mousePos(this.element,C)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,T.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=T.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=T.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 g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=yu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:L,bearingDegreesPerPixelMoved:M=.8})=>{const R=new Et;return new _u({clickTolerance:L,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:R,enable:C,assignEvents:Rh})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=vu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:L,pitchDegreesPerPixelMoved:M=-.5})=>{const R=new Et;return new _u({clickTolerance:L,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:R,enable:C,assignEvents:Rh})})({clickTolerance:v,enable:!0})),T.addEventListener(f,"mousedown",this.mousedown),T.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),T.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),T.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,f)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,f)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;T.removeEventListener(s,"mousedown",this.mousedown),T.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let Sa;function Nh(y,s,f){const d=new l.M(y.lng,y.lat);if(y=new l.M(y.lng,y.lat),s){const g=new l.M(y.lng-360,y.lat),v=new l.M(y.lng+360,y.lat),C=f.locationPoint(y).distSqr(s);f.locationPoint(g).distSqr(s)180;){const g=f.locationPoint(y);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;y.lng>f.center.lng?y.lng-=360:y.lng+=360}return y.lng!==d.lng&&f.locationPoint(y).y>f.height/2-f.getHorizon()?y:d}const bc={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 Oh(y,s,f){const d=y.classList;for(const g in bc)d.remove(`maplibregl-${f}-anchor-${g}`);d.add(`maplibregl-${f}-anchor-${s}`)}class xc extends l.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,g=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Nh(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()),T.setTransform(this._element,`${bc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),E.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 l.k("dragstart"))),this.fire(new l.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 l.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=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div"),this._element.setAttribute("aria-label","Map marker");const f=T.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${g}px`),f.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const v=T.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=T.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.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 xe of M){const Fe=T.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",xe.rx),Fe.setAttributeNS(null,"ry",xe.ry),L.appendChild(Fe)}const R=T.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const z=T.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"),R.appendChild(z);const F=T.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const X=T.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 ue=T.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ue.setAttributeNS(null,"fill","#FFFFFF");const le=T.createNS("http://www.w3.org/2000/svg","g");le.setAttributeNS(null,"transform","translate(8.0, 8.0)");const fe=T.createNS("http://www.w3.org/2000/svg","circle");fe.setAttributeNS(null,"fill","#000000"),fe.setAttributeNS(null,"opacity","0.25"),fe.setAttributeNS(null,"cx","5.5"),fe.setAttributeNS(null,"cy","5.5"),fe.setAttributeNS(null,"r","5.4999962");const te=T.createNS("http://www.w3.org/2000/svg","circle");te.setAttributeNS(null,"fill","#FFFFFF"),te.setAttributeNS(null,"cx","5.5"),te.setAttributeNS(null,"cy","5.5"),te.setAttributeNS(null,"r","5.4999962"),le.appendChild(fe),le.appendChild(te),C.appendChild(L),C.appendChild(R),C.appendChild(F),C.appendChild(ue),C.appendChild(le),f.appendChild(C),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(f),this._offset=l.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()}),Oh(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),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.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 g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._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 g=this._map,v=g.terrain.depthAtPoint(this._pos),C=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/g.transform._pixelPerMeter,M=Math.sin(g.getPitch()*Math.PI/180)*L,R=g.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),z=g.transform.lngLatToCameraDepth(this._lngLat,C+M)-R>.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=l.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 zh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let xu=0,Rl=!1;const Fh={maxWidth:100,unit:"metric"};function Bh(y,s,f){const d=f&&f.maxWidth||100,g=y._container.clientHeight/2,v=y.unproject([0,g]),C=y.unproject([d,g]),L=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*L;M>5280?Nl(s,d,M/5280,y._getUIString("ScaleControl.Miles")):Nl(s,d,M,y._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Nl(s,d,L/1852,y._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Nl(s,d,L/1e3,y._getUIString("ScaleControl.Kilometers")):Nl(s,d,L,y._getUIString("ScaleControl.Meters"))}function Nl(y,s,f,d){const g=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let L=v/C;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(M){const R=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*R)/R}(L),C*L}(f);y.style.width=s*(g/f)+"px",y.innerHTML=`${g} ${d}`}const Np={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Op=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Vh(y){if(y){if(typeof y=="number"){const s=Math.round(Math.abs(y)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,y),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-y),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(y,0),right:new l.P(-y,0)}}if(y instanceof l.P||Array.isArray(y)){const s=l.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(y.center||[0,0]),top:l.P.convert(y.top||[0,0]),"top-left":l.P.convert(y["top-left"]||[0,0]),"top-right":l.P.convert(y["top-right"]||[0,0]),bottom:l.P.convert(y.bottom||[0,0]),"bottom-left":l.P.convert(y["bottom-left"]||[0,0]),"bottom-right":l.P.convert(y["bottom-right"]||[0,0]),left:l.P.convert(y.left||[0,0]),right:l.P.convert(y.right||[0,0])}}return Vh(new l.P(0,0))}const Wm=m;c.AJAXError=l.be,c.Evented=l.E,c.LngLat=l.M,c.MercatorCoordinate=l.Y,c.Point=l.P,c.addProtocol=l.bf,c.config=l.a,c.removeProtocol=l.bg,c.AttributionControl=xs,c.BoxZoomHandler=vs,c.CanvasSource=gs,c.CooperativeGesturesHandler=Dt,c.DoubleClickZoomHandler=Tp,c.DragPanHandler=Gm,c.DragRotateHandler=bs,c.EdgeInsets=mu,c.FullscreenControl=class extends l.E{constructor(y={}){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,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.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=Dr,c.GeolocateControl=class extends l.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.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 l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new l.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,g=this._map.getBearing(),v=l.e({bearing:g},this.options.fitBoundsOptions),C=Te.fromLngLat(f,d);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new l.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&&Rl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.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=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){l.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=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xc({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xc({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 l.k("trackuserlocationend")))})}},this.options=l.e({},zh,y)}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(s=!1){if(Sa!==void 0&&!s)return Sa;if(window.navigator.permissions===void 0)return Sa=!!window.navigator.geolocation,Sa;try{Sa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Sa=!!window.navigator.geolocation}return Sa})}().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(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xu=0,Rl=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),f=y.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 y=this._map.getBounds(),s=y.getSouthEast(),f=y.getNorthEast(),d=s.distanceTo(f),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return l.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 l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xu--,Rl=!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 l.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 l.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xu++,xu>1?(y={maximumAge:6e5,timeout:0},Rl=!0):(y=this.options.positionOptions,Rl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.Hash=Sp,c.ImageSource=er,c.KeyboardHandler=Qa,c.LngLatBounds=Te,c.LogoControl=jm,c.Map=class extends vo{constructor(y){if(l.bc.mark(l.bd.create),(y=l.e({},vc,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Lh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new _c,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},Ap,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new Q(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=wp(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 Lp(this,y),this._hash=y.hash&&new Sp(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,l.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new xs(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new jm,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new l.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new l.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new l.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=y.onAdd(this);this._controls.push(y);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,f,d)}resize(y){var s;const f=this._containerDimensions(),d=f[0],g=f[1],v=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,v),this.painter.resize(d,g,v),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const M=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,M),this.painter.resize(d,g,M)}this.transform.resize(d,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,g);const C=!this._moving;return C&&(this.stop(),this.fire(new l.k("movestart",y)).fire(new l.k("move",y))),this.fire(new l.k("resize",y)),C&&this.fire(new l.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:f,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),v=y*g,C=s*g;return Math.min(v>f?f/v:1,C>d?d/C:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(Te.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(l.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(l.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,s,f){if(y==="mouseenter"||y==="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 yo(y,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="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 yo(y,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new yo(y,this,C.originalEvent)))}}}}{const d=g=>{const v=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];v.length&&(g.features=v,f.call(this,g),delete g.features)};return{layer:s,listener:f,delegates:{[y]:d}}}}on(y,s,f){if(f===void 0)return super.on(y,s);const d=this._createDelegatedListener(y,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,s,f){if(f===void 0)return super.once(y,s);const d=this._createDelegatedListener(y,s,f);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,s,f){return f===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let v=0;vthis._updateStyle(y,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new No(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,f):this.style.loadJSON(y,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new No(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const f=this._requestManager.transformRequest(y,"Style");l.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new l.j(d))})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&this._update(!0)}catch(f){l.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(y,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(y,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===y.source&&l.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 qm(this.painter,s,y),this.painter.renderToTexture=new Mp(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!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(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 l.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const f=y[s]._tiles;for(const d in f){const g=f[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,f={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:v,stretchY:C,content:L}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.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:R,data:z}=s,F=s;return this.style.addImage(y,{data:new l.R({width:M,height:R},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:C,content:L,sdf:g,version:0,userImage:F}),F.onAdd&&F.onAdd(this,y),this}}{const{width:M,height:R,data:z}=E.getImageData(s);this.style.addImage(y,{data:new l.R({width:M,height:R},z),pixelRatio:d,stretchX:v,stretchY:C,content:L,sdf:g,version:0})}}updateImage(y,s){const f=this.style.getImage(y);if(!f)return this.fire(new l.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||l.b(s)?E.getImageData(s):s,{width:g,height:v,data:C}=d;if(g===void 0||v===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==f.data.width||v!==f.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(s instanceof HTMLImageElement||l.b(s));return f.data.replace(C,L),this.style.updateImage(y,f),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return j.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,s,f){return this.style.setLayerZoomRange(y,s,f),this._update(!0)}setFilter(y,s,f={}){return this.style.setFilter(y,s,f),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,f,d={}){return this.style.setPaintProperty(y,s,f,d),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,f,d={}){return this.style.setLayoutProperty(y,s,f,d),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,f,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,f=>{f||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=T.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=T.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 g=this._controlContainer=T.create("div","maplibregl-control-container",y),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=T.create("div",`maplibregl-ctrl-${C} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,s,f){this._canvas.width=Math.floor(f*y),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:y},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Am(f,this.transform),D.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,v=E.now();this.style.zoomHistory.update(g,v);const C=new l.a8(g,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=C.crossFadingFactor();L===1&&L===this._crossFadingFactor||(f=!0,this._crossFadingFactor=L),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 l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bc.mark(l.bd.load),this.fire(new l.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 l.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,l.bc.mark(l.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const 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),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bc.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(y=>{l.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return kp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=yo,c.MapTouchEvent=js,c.MapWheelEvent=Ep,c.Marker=xc,c.NavigationControl=class{constructor(y){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=l.e({},Dp,y),this._container=T.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})),T.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})),T.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=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,s){const f=T.create("button",y,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends l.E{constructor(y){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.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 l.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=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const L of this.options.className.split(" "))this._container.classList.add(L);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?Nh(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 g=this.options.anchor;const v=Vh(this.options.offset);if(!g){const L=this._container.offsetWidth,M=this._container.offsetHeight;let R;R=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-L/2&&R.push("right"),g=R.length===0?"bottom":R.join("-")}let C=d.add(v[g]);this.options.subpixelPositioning||(C=C.round()),T.setTransform(this._container,`${bc[g]} translate(${C.x}px,${C.y}px)`),Oh(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Np),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=l.M.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=y;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Op);y&&y.focus()}},c.RasterDEMTileSource=en,c.RasterTileSource=Oe,c.ScaleControl=class{constructor(y){this._onMove=()=>{Bh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Bh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Fh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=kh,c.Style=No,c.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Bm,c.TwoFingersTouchRotateHandler=Cp,c.TwoFingersTouchZoomHandler=Fm,c.TwoFingersTouchZoomRotateHandler=mc,c.VectorTileSource=xn,c.VideoSource=Do,c.addSourceType=(y,s)=>l._(void 0,void 0,void 0,function*(){if(Ha(y))throw new Error(`A source type called "${y}" already exists.`);((f,d)=>{Vs[f]=d})(y,s)}),c.clearPrewarmedResources=function(){const y=bn;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(kt),bn=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 l.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return at().getRTLTextPluginStatus()},c.getVersion=function(){return Wm},c.getWorkerCount=function(){return un.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(y){return $r().broadcast("IS",y)},c.prewarm=function(){Bn().acquire(kt)},c.setMaxParallelImageRequests=function(y){l.a.MAX_PARALLEL_IMAGE_REQUESTS=y},c.setRTLTextPlugin=function(y,s){return at().setRTLTextPlugin(y,s)},c.setWorkerCount=function(y){un.workerCount=y},c.setWorkerUrl=function(y){l.a.WORKER_URL=y}});var a=n;return a})})(RI);var dD=RI.exports;const Ls=Rv(dD);var mD=Object.defineProperty,gD=(t,e,n)=>e in t?mD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Hw=(t,e,n)=>(gD(t,typeof e!="symbol"?e+"":e,n),n);function Ad(){}function OI(t){return t()}function Zw(){return Object.create(null)}function A_(t){t.forEach(OI)}function zI(t){return typeof t=="function"}function _D(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function yD(t){return Object.keys(t).length===0}function vD(t,e){t.appendChild(e)}function bD(t,e,n){t.insertBefore(e,n||null)}function FI(t){t.parentNode&&t.parentNode.removeChild(t)}function Xw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Lu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function xD(t){return Array.from(t.childNodes)}function vg(t,e,n){t.classList.toggle(e,!!n)}let n1;function Id(t){n1=t}const cf=[],Yw=[];let _f=[];const Kw=[],wD=Promise.resolve();let iv=!1;function SD(){iv||(iv=!0,wD.then(BI))}function ov(t){_f.push(t)}const E0=new Set;let rf=0;function BI(){if(rf!==0)return;const t=n1;do{try{for(;rft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),_f=e}const CD=new Set;function TD(t,e){t&&t.i&&(CD.delete(t),t.i(e))}function LD(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),ov(()=>{const a=t.$$.on_mount.map(OI).filter(zI);t.$$.on_destroy?t.$$.on_destroy.push(...a):A_(a),t.$$.on_mount=[]}),i.forEach(ov)}function PD(t,e){const n=t.$$;n.fragment!==null&&(ID(n.after_update),A_(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function MD(t,e){t.$$.dirty[0]===-1&&(cf.push(t),SD(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=D.length?D[0]:T;return w.ctx&&i(w.ctx[E],w.ctx[E]=k)&&(!w.skip_bound&&w.bound[E]&&w.bound[E](k),S&&MD(t,E)),T}):[],w.update(),S=!0,A_(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const E=xD(e.target);w.fragment&&w.fragment.l(E),E.forEach(FI)}else w.fragment&&w.fragment.c();e.intro&&TD(t.$$.fragment),LD(t,e.target,e.anchor),BI()}Id(m)}class kD{constructor(){Hw(this,"$$"),Hw(this,"$$set")}$destroy(){PD(this,1),this.$destroy=Ad}$on(e,n){if(!zI(n))return Ad;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&&!yD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const DD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(DD);function RD(t){let e,n,r;return{c(){e=Xw("svg"),n=Xw("path"),Lu(n,"stroke-width","4"),Lu(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"),Lu(n,"class","svelte-gzo3ar"),Lu(e,"width",r=t[0]==="list"?20:void 0),Lu(e,"viewBox","0 0 70 85"),Lu(e,"fill","none"),Lu(e,"class","svelte-gzo3ar"),vg(e,"in-map",t[0]!=="list"),vg(e,"list-icon",t[0]==="list")},m(i,a){bD(i,e,a),vD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Lu(e,"width",r),a&1&&vg(e,"in-map",i[0]!=="list"),a&1&&vg(e,"list-icon",i[0]==="list")},i:Ad,o:Ad,d(i){i&&FI(e)}}}function ND(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class OD extends kD{constructor(e){super(),AD(this,e,ND,RD,_D,{displayIn:0})}}const zD=[{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"}],FD={decimalLatitude:40.123,decimalLongitude:-74.123},BD=[{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}],VD=[{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 UD(){const t=[];return zD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...FD})}),[...t,...BD,...VD]}const GD=UD();GD.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 jD(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:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(w){return function(S){return m([w,S])}}function m(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 l=e.right;if(e.right=l.left,l.left=e,e=l,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 I0(t,e,n,r){var i=new zu(t,e);if(n===null)return i.left=i.right=null,i;n=ku(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 Jw(t,e,n){var r=null,i=null;if(e){e=ku(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 WD(t,e,n){return e===null?t:(t===null||(e=ku(t.key,e,n),e.left=t),e)}function sv(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` -`);var a=e+(n?" ":"│ ");t.left&&sv(t.left,a,!1,r,i),t.right&&sv(t.right,a,!0,r,i)}}var r1=function(){function t(e){e===void 0&&(e=qD),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=I0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new zu(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=ku(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=ku(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=ku(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=ku(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=ku(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,l=this._root,m;a.length!==0||l;)if(l)a.push(l),l=l.left;else{if(l=a.pop(),m=c(l.key,n),m>0)break;if(c(l.key,e)>=0&&r.call(i,l))return this;l=l.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 ZD(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&&uv(e,n,0,i-1,a),this._root===null)this._root=av(e,n,0,i),this._size=i;else{var c=XD(this.toList(),HD(e,n),a);i=this._size+i,this._root=lv({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 sv(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=Jw(e,this._root,i),c=a.left,l=a.right;i(e,n)<0?l=I0(n,r,l,i):c=I0(n,r,c,i),this._root=WD(c,l,i)},t.prototype.split=function(e){return Jw(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return jD(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 av(t,e,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),c=t[a],l=e[a],m=new zu(c,l);return m.left=av(t,e,n,a),m.right=av(t,e,a+1,r),m}return null}function HD(t,e){for(var n=new zu(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 lv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=lv(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=lv(t,i+1,n),c}return null}function XD(t,e,n){for(var r=new zu(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 uv(t,e,n,r,i){if(!(n>=r)){for(var a=t[n+r>>1],c=n-1,l=r+1;;){do c++;while(i(t[c],a)<0);do l--;while(i(t[l],a)>0);if(c>=l)break;var m=t[c];t[c]=t[l],t[l]=m,m=e[c],e[c]=e[l],e[l]=m}uv(t,e,n,l,i),uv(t,e,l+1,r,i)}}function ya(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qw(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){ya(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ho(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&&E>=0?wT?-1:0:m<0&&E<0?wT?1:0:Em?1:0}}}]),t}(),eR=0,c_=function(){Ho(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(cl&&m>w)return-1;var E=e.comparePoint(n.leftSE.point);if(E<0)return 1;if(E>0)return-1;var T=n.comparePoint(e.rightSE.point);return T!==0?T:-1}if(r>i){if(lm&&l>S)return 1;var D=n.comparePoint(e.leftSE.point);if(D!==0)return D;var k=e.comparePoint(n.rightSE.point);return k<0?1:k>0?-1:1}if(lm)return 1;if(ac){var q=e.comparePoint(n.rightSE.point);if(q<0)return 1;if(q>0)return-1}if(a!==c){var ee=w-l,V=a-r,j=S-m,Q=c-i;if(ee>V&&jQ)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){ya(this,t),this.id=++eR,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 Ho(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&&l.swapEvents(),ll.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 l=0,m=r.rings.length;l0)i=n,a=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var m=new ll(i,!0),w=new ll(a,!1);return new t(m,w,[r],[c])}}]),t}(),r2=function(){function t(e,n,r){if(ya(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=kd.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,l=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=m.x),m.y>this.bbox.ur.y&&(this.bbox.ur.y=m.y),a=m)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(c_.fromRing(a,i,this))}return Ho(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 Ho(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 Ho(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}(),o2=function(){function t(e){ya(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ho(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]:c_.compare;ya(this,t),this.queue=e,this.tree=new r1(n),this.segments=[]}return Ho(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,l=void 0,m=void 0;l===void 0;)a=this.tree.prev(a),a===null?l=null:a.key.consumedBy===void 0&&(l=a.key);for(;m===void 0;)c=this.tree.next(c),c===null?m=null:c.key.consumedBy===void 0&&(m=c.key);if(e.isLeft){var w=null;if(l){var S=l.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!l.isAnEndpoint(S)))for(var E=this._splitSafely(l,S),T=0,D=E.length;T0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&m){var re=l.getIntersection(m);if(re!==null){if(!l.isAnEndpoint(re))for(var se=this._splitSafely(l,re),Ce=0,H=se.length;Ces2)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Q=new iR(k),$=k.size,me=k.pop();me;){var de=me.key;if(k.size===$){var re=de.segment;throw new Error("Unable to pop() ".concat(de.isLeft?"left":"right"," SweepEvent ")+"[".concat(de.point.x,", ").concat(de.point.y,"] from segment #").concat(re.id," ")+"[".concat(re.leftSE.point.x,", ").concat(re.leftSE.point.y,"] -> ")+"[".concat(re.rightSE.point.x,", ").concat(re.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(k.size>s2)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Q.segments.length>oR)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var se=Q.process(de),Ce=0,H=se.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};Ne.prototype.clone=function(){};Ne.prototype.copy=function(){return new Ne(this)};Ne.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Ne.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)};Ne.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};Ne.prototype.hashCode=function(){var t=17;return t=37*t+Ne.hashCode(this.x),t=37*t+Ne.hashCode(this.y),t};Ne.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};Ne.prototype.interfaces_=function(){return[ds,D_,ms]};Ne.prototype.getClass=function(){return Ne};Ne.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=$t.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Yc.DimensionalComparator.get=function(){return Xl};Yc.serialVersionUID.get=function(){return 6683108902428367e3};Yc.NULL_ORDINATE.get=function(){return $t.NaN};Yc.X.get=function(){return 0};Yc.Y.get=function(){return 1};Yc.Z.get=function(){return 2};Object.defineProperties(Ne,Yc);var Xl=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new lr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Xl.prototype.compare=function(t,e){var n=t,r=e,i=Xl.compare(n.x,r.x);if(i!==0)return i;var a=Xl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=Xl.compare(n.z,r.z);return c};Xl.prototype.interfaces_=function(){return[Ef]};Xl.prototype.getClass=function(){return Xl};Xl.compare=function(t,e){return te?1:$t.isNaN(t)?$t.isNaN(e)?0:-1:$t.isNaN(e)?1:0};var If=function(){};If.prototype.create=function(){};If.prototype.interfaces_=function(){return[]};If.prototype.getClass=function(){return If};var ze=function(){},Qd={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 lr("Unknown location value: "+t)};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(ze,Qd);var Wt=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Zo=function(){},XI={LOG_10:{configurable:!0}};Zo.prototype.interfaces_=function(){return[]};Zo.prototype.getClass=function(){return Zo};Zo.log10=function(t){var e=Math.log(t);return $t.isInfinite(e)||$t.isNaN(e)?e:e/Zo.LOG_10};Zo.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}};Zo.wrap=function(t,e){return t<0?e- -t%e:t%e};Zo.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],l=arguments[3],m=i;return a>m&&(m=a),c>m&&(m=c),l>m&&(m=l),m}};Zo.average=function(t,e){return(t+e)/2};XI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Zo,XI);var va=function(t){this.str=t};va.prototype.append=function(t){this.str+=t};va.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};va.prototype.toString=function(t){return this.str};var oa=function(t){this.value=t};oa.prototype.intValue=function(){return this.value};oa.prototype.compareTo=function(t){return this.valuet?1:0};oa.isNaN=function(t){return Number.isNaN(t)};var Dd=function(){};Dd.isWhitespace=function(t){return t<=32&&t>=0||t===127};Dd.toUpperCase=function(t){return t.toUpperCase()};var We=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)}},Fs={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}};We.prototype.le=function(t){return(this._hi9?(S=!0,E="9"):E="0"+w,c.append(E),n=n.subtract(We.valueOf(w)).multiply(We.TEN),S&&n.selfAdd(We.TEN);var T=!0,D=We.magnitude(n._hi);if(D<0&&Math.abs(D)>=l-m&&(T=!1),!T)break}return e[0]=r,c.toString()};We.prototype.sqr=function(){return this.multiply(this)};We.prototype.doubleValue=function(){return this._hi+this._lo};We.prototype.subtract=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};We.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};We.prototype.isZero=function(){return this._hi===0&&this._lo===0};We.prototype.selfSubtract=function(){if(arguments[0]instanceof We){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)}};We.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};We.prototype.min=function(t){return this.le(t)?this:t};We.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof We){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,l=null,m=null,w=null,S=null,E=null;return m=this._hi/n,w=We.SPLIT*m,i=w-m,E=We.SPLIT*n,i=w-i,a=m-i,c=E-n,S=m*n,c=E-c,l=n-c,E=i*c-S+i*l+a*c+a*l,w=(this._hi-S-E+this._lo-m*r)/n,E=m+w,this._hi=E,this._lo=m-E+w,this}};We.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};We.prototype.divide=function(){if(arguments[0]instanceof We){var t=arguments[0],e=null,n=null,r=null,i=null,a=null,c=null,l=null,m=null;a=this._hi/t._hi,c=We.SPLIT*a,e=c-a,m=We.SPLIT*t._hi,e=c-e,n=a-e,r=m-t._hi,l=a*t._hi,r=m-r,i=t._hi-r,m=e*r-l+e*i+n*r+n*i,c=(this._hi-l-m+this._lo-a*t._lo)/t._hi,m=a+c;var w=m,S=a-m+c;return new We(w,S)}else if(typeof arguments[0]=="number"){var E=arguments[0];return $t.isNaN(E)?We.createNaN():We.copy(this).selfDivide(E,0)}};We.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};We.prototype.pow=function(t){if(t===0)return We.valueOf(1);var e=new We(this),n=We.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};We.prototype.ceil=function(){if(this.isNaN())return We.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new We(t,e)};We.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};We.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};We.prototype.setValue=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};We.prototype.max=function(t){return this.ge(t)?this:t};We.prototype.sqrt=function(){if(this.isZero())return We.valueOf(0);if(this.isNegative())return We.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=We.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};We.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof We){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,l=null;return i=this._hi+e,c=i-this._hi,a=i-c,a=e-c+(this._hi-a),l=a+this._lo,n=i+l,r=l+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var m=arguments[0],w=arguments[1],S=null,E=null,T=null,D=null,k=null,U=null,q=null,ee=null;k=this._hi+m,T=this._lo+w,q=k-this._hi,ee=T-this._lo,U=k-q,D=T-ee,U=m-q+(this._hi-U),D=w-ee+(this._lo-D),q=U+T,S=k+q,E=q+(k-S),q=D+E;var V=S+q,j=q+(S-V);return this._hi=V,this._lo=j,this}};We.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof We){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,l=null,m=null,w=null;m=We.SPLIT*this._hi,i=m-this._hi,w=We.SPLIT*n,i=m-i,a=this._hi-i,c=w-n,m=this._hi*n,c=w-c,l=n-c,w=i*c-m+i*l+a*c+a*l+(this._hi*r+this._lo*n);var S=m+w;i=m-S;var E=w+i;return this._hi=S,this._lo=E,this}};We.prototype.selfSqr=function(){return this.selfMultiply(this)};We.prototype.floor=function(){if(this.isNaN())return We.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new We(t,e)};We.prototype.negate=function(){return this.isNaN()?this:new We(-this._hi,-this._lo)};We.prototype.clone=function(){};We.prototype.multiply=function(){if(arguments[0]instanceof We){var t=arguments[0];return t.isNaN()?We.createNaN():We.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return $t.isNaN(e)?We.createNaN():We.copy(this).selfMultiply(e,0)}};We.prototype.isNaN=function(){return $t.isNaN(this._hi)};We.prototype.intValue=function(){return Math.trunc(this._hi)};We.prototype.toString=function(){var t=We.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};We.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."+We.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=We.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};We.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,a=null,c=null,l=null;i=1/this._hi,a=We.SPLIT*i,t=a-i,l=We.SPLIT*this._hi,t=a-t,e=i-t,n=l-this._hi,c=i*this._hi,n=l-n,r=this._hi-n,l=t*n-c+t*r+e*n+e*r,a=(1-c-l-i*this._lo)/this._hi;var m=i+a,w=i-m+a;return new We(m,w)};We.prototype.toSciNotation=function(){if(this.isZero())return We.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=We.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};We.prototype.abs=function(){return this.isNaN()?We.NaN:this.isNegative()?this.negate():new We(this)};We.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};We.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};We.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};We.prototype.trunc=function(){return this.isNaN()?We.NaN:this.isPositive()?this.floor():this.ceil()};We.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};We.prototype.interfaces_=function(){return[ms,ds,D_]};We.prototype.getClass=function(){return We};We.sqr=function(t){return We.valueOf(t).selfMultiply(t)};We.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return We.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new We(e)}};We.sqrt=function(t){return We.valueOf(t).sqrt()};We.parse=function(t){for(var e=0,n=t.length;Dd.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,Dd.isDigit(w)){var S=w-"0";a.selfMultiply(We.TEN),a.selfAdd(S),c++;continue}if(w==="."){l=c;continue}if(w==="e"||w==="E"){var E=t.substring(e);try{m=oa.parseInt(E)}catch(q){throw q instanceof Error?new Error("Invalid exponent "+E+" in string "+t):q}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var T=a,D=c-l-m;if(D===0)T=a;else if(D>0){var k=We.TEN.pow(D);T=a.divide(k)}else if(D<0){var U=We.TEN.pow(-D);T=a.multiply(U)}return r?T.negate():T};We.createNaN=function(){return new We($t.NaN,$t.NaN)};We.copy=function(t){return new We(t)};We.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};We.stringOfChar=function(t,e){for(var n=new va,r=0;r0){if(a<=0)return uo.signum(c);r=i+a}else if(i<0){if(a>=0)return uo.signum(c);r=-i-a}else return uo.signum(c);var l=uo.DP_SAFE_EPSILON*r;return c>=l||-c>=l?uo.signum(c):2};uo.signum=function(t){return t>0?1:t<0?-1:0};YI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(uo,YI);var Tn=function(){},$d={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};$d.X.get=function(){return 0};$d.Y.get=function(){return 1};$d.Z.get=function(){return 2};$d.M.get=function(){return 3};Tn.prototype.setOrdinate=function(t,e,n){};Tn.prototype.size=function(){};Tn.prototype.getOrdinate=function(t,e){};Tn.prototype.getCoordinate=function(){};Tn.prototype.getCoordinateCopy=function(t){};Tn.prototype.getDimension=function(){};Tn.prototype.getX=function(t){};Tn.prototype.clone=function(){};Tn.prototype.expandEnvelope=function(t){};Tn.prototype.copy=function(){};Tn.prototype.getY=function(t){};Tn.prototype.toCoordinateArray=function(){};Tn.prototype.interfaces_=function(){return[D_]};Tn.prototype.getClass=function(){return Tn};Object.defineProperties(Tn,$d);var KI=function(){},Jf=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}(KI),Ti=function(){};Ti.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}};Nt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Nt){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))}};Nt.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};Nt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Nt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Nt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Nt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Nt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Nt.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()}};Nt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Nt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof Ne){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)}};Nt.prototype.centre=function(){return this.isNull()?null:new Ne((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Nt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Ne){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Nt){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],l=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)};Nt.prototype.hashCode=function(){var t=17;return t=37*t+Ne.hashCode(this._minx),t=37*t+Ne.hashCode(this._maxx),t=37*t+Ne.hashCode(this._miny),t=37*t+Ne.hashCode(this._maxy),t};Nt.prototype.interfaces_=function(){return[ds,ms]};Nt.prototype.getClass=function(){return Nt};Nt.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],l=Math.min(a.x,c.x),m=Math.max(a.x,c.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>m||Sm)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};dr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};dr.prototype.setPrecisionModel=function(t){this._precisionModel=t};dr.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),l=Math.abs(t.y-e.y);r>i?a=c:a=l,a===0&&!t.equals(e)&&(a=Math.max(c,l))}return ln.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};dr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return ln.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};Kc.DONT_INTERSECT.get=function(){return 0};Kc.DO_INTERSECT.get=function(){return 1};Kc.COLLINEAR.get=function(){return 2};Kc.NO_INTERSECTION.get=function(){return 0};Kc.POINT_INTERSECTION.get=function(){return 1};Kc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(dr,Kc);var Qu=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 Nt(this._inputLines[0][0],this._inputLines[0][1]),i=new Nt(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,Nt.intersects(r,i,n)&&St.orientationIndex(r,i,n)===0&&St.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=Ps.intersection(n,r,i,a)}catch(l){if(l instanceof Jf)c=e.nearestEndpoint(n,r,i,a);else throw l}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 Ne(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,l=Math.abs(c);return Math.abs(r)1e-4&&Ti.out.println("Distance = "+c.distance(l))},e.prototype.intersectionWithNormalization=function(n,r,i,a){var c=new Ne(n),l=new Ne(r),m=new Ne(i),w=new Ne(a),S=new Ne;this.normalizeToEnvCentre(c,l,m,w,S);var E=this.safeHCoordinateIntersection(c,l,m,w);return E.x+=S.x,E.y+=S.y,E},e.prototype.computeCollinearIntersection=function(n,r,i,a){var c=Nt.intersects(n,r,i),l=Nt.intersects(n,r,a),m=Nt.intersects(i,a,n),w=Nt.intersects(i,a,r);return c&&l?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):m&&w?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&m?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!l&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!l&&!m?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&m?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!c&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!c&&!m?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,a,c){var l=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,E=i.xa.x?i.x:a.x,k=i.y>a.y?i.y:a.y,U=l>E?l:E,q=wT?m:T,V=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var m=St.orientationIndex(i,a,n),w=St.orientationIndex(i,a,r);if(m>0&&w>0||m<0&&w<0)return t.NO_INTERSECTION;var S=c===0&&l===0&&m===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(c===0||l===0||m===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 Ne(i):l===0?this._intPt[0]=new Ne(a):m===0?this._intPt[0]=new Ne(n):w===0&&(this._intPt[0]=new Ne(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,l=St.distancePointLine(n,i,a),m=St.distancePointLine(r,i,a);return m0?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 ra=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ra.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,l=e.y-this._p.y,m=kc.signOfDet2x2(i,a,c,l);if(m===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};ra.prototype.isPointInPolygon=function(){return this.getLocation()!==ze.EXTERIOR};ra.prototype.getLocation=function(){return this._isPointOnSegment?ze.BOUNDARY:this._crossingCount%2===1?ze.INTERIOR:ze.EXTERIOR};ra.prototype.isOnSegment=function(){return this._isPointOnSegment};ra.prototype.interfaces_=function(){return[]};ra.prototype.getClass=function(){return ra};ra.locatePointInRing=function(){if(arguments[0]instanceof Ne&&Wt(arguments[1],Tn)){for(var t=arguments[0],e=arguments[1],n=new ra(t),r=new Ne,i=new Ne,a=1;a1||m<0||m>1)&&(i=!0)}}return i?Zo.min(St.distancePointLine(t,n,r),St.distancePointLine(e,n,r),St.distancePointLine(n,t,e),St.distancePointLine(r,t,e)):0};St.isPointInRing=function(t,e){return St.locatePointInRing(t,e)!==ze.EXTERIOR};St.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Ne;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 l=r;do l=(l+1)%e;while(t[l].equals2D(n)&&l!==r);var m=t[c],w=t[l];if(m.equals2D(n)||w.equals2D(n)||m.equals2D(w))return!1;var S=St.computeOrientation(m,n,w),E=!1;return S===0?E=m.x>w.x:E=S>0,E};St.locatePointInRing=function(t,e){return ra.locatePointInRing(t,e)};St.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)};St.computeOrientation=function(t,e,n){return St.orientationIndex(t,e,n)};St.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new lr("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return a.distance(l);var S=((c.y-a.y)*(l.x-c.x)-(c.x-a.x)*(l.y-c.y))/m;return Math.abs(S)*Math.sqrt(m)}};St.isOnLine=function(t,e){for(var n=new Qu,r=1;r0};Tf.prototype.interfaces_=function(){return[hs]};Tf.prototype.getClass=function(){return Tf};var Lf=function(){};Lf.prototype.isInBoundary=function(t){return t>1};Lf.prototype.interfaces_=function(){return[hs]};Lf.prototype.getClass=function(){return Lf};var Pf=function(){};Pf.prototype.isInBoundary=function(t){return t===1};Pf.prototype.interfaces_=function(){return[hs]};Pf.prototype.getClass=function(){return Pf};var qr=function(){};qr.prototype.add=function(){};qr.prototype.addAll=function(){};qr.prototype.isEmpty=function(){};qr.prototype.iterator=function(){};qr.prototype.size=function(){};qr.prototype.toArray=function(){};qr.prototype.remove=function(){};function o1(t){this.message=t||""}o1.prototype=new Error;o1.prototype.name="IndexOutOfBoundsException";var Qf=function(){};Qf.prototype.hasNext=function(){};Qf.prototype.next=function(){};Qf.prototype.remove=function(){};var Ms=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}(qr);function $f(t){this.message=t||""}$f.prototype=new Error;$f.prototype.name="NoSuchElementException";var gt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof qr&&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,qr]},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 gR(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new o1;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(l))return null}t.prototype.add.call(this,l)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],E=arguments[1];return this.add(S,E),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var T=arguments[0],D=arguments[1],k=arguments[2];if(k)for(var U=0;U=0;q--)r.add(T[q],D);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Ne){var ee=arguments[0],V=arguments[1],j=arguments[2];if(!j){var Q=this.size();if(Q>0){if(ee>0){var $=this.get(ee-1);if($.equals2D(V))return null}if(eeCe&&(H=-1);for(var oe=se;oe!==Ce;oe+=H)r.add(de[oe],re);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Ne(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(gt),vn=function(){},N_={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};N_.ForwardComparator.get=function(){return Rd};N_.BidirectionalComparator.get=function(){return Mf};N_.coordArrayType.get=function(){return new Array(0).fill(null)};vn.prototype.interfaces_=function(){return[]};vn.prototype.getClass=function(){return vn};vn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};vn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};vn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};vn.extract=function(t,e,n){e=Zo.clamp(e,0,t.length),n=Zo.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=vn.compare(n,r),a=vn.isEqualReversed(n,r);return a?0:i};Mf.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=vn.increasingDirection(n),a=vn.increasingDirection(r),c=i>0?0:n.length-1,l=a>0?0:n.length-1,m=0;m0)e=e.right;else return e.value}return null};Ri.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,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:ul,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};Ri.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Pu;t!=null&&t!==this.root_&&t.parent.color===Pu;)if(Kn(t)===C0(Kn(Kn(t)))){var n=c2(Kn(Kn(t)));u2(n)===Pu?(il(Kn(t),ul),il(n,ul),il(Kn(Kn(t)),Pu),t=Kn(Kn(t))):(t===c2(Kn(t))&&(t=Kn(t),e.rotateLeft(t)),il(Kn(t),ul),il(Kn(Kn(t)),Pu),e.rotateRight(Kn(Kn(t))))}else{var r=C0(Kn(Kn(t)));u2(r)===Pu?(il(Kn(t),ul),il(r,ul),il(Kn(Kn(t)),Pu),t=Kn(Kn(t))):(t===C0(Kn(t))&&(t=Kn(t),e.rotateRight(t)),il(Kn(t),ul),il(Kn(Kn(t)),Pu),e.rotateLeft(Kn(Kn(t))))}this.root_.color=ul};Ri.prototype.values=function(){var t=new gt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Ri.successor(e))!==null;)t.add(e.value);return t};Ri.prototype.entrySet=function(){var t=new s1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Ri.successor(e))!==null;)t.add(e);return t};Ri.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}};Ri.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}};Ri.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Ri.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}};Ri.prototype.size=function(){return this.size_};var Nd=function(){};Nd.prototype.interfaces_=function(){return[]};Nd.prototype.getClass=function(){return Nd};function QI(){}QI.prototype=new O_;function sa(){this.array_=[],arguments[0]instanceof qr&&this.addAll(arguments[0])}sa.prototype=new QI;sa.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 l=new Array(r.size()).fill(null),m=0;m0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(as.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Ar.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Ar.createClosedRing(t,e,4);var r=e.getOrdinate(0,Tn.X)===e.getOrdinate(n-1,Tn.X)&&e.getOrdinate(0,Tn.Y)===e.getOrdinate(n-1,Tn.Y);return r?e:Ar.createClosedRing(t,e,n+1)};Ar.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Ar.copy(e,0,r,0,i);for(var a=i;a0&&Ar.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?kn.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 St.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Ar.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,l=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}(wr),Da=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 qt.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};Fd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Fd.prototype.getClass=function(){return Fd};var Bd=function(){};Bd.prototype.edit=function(t,e){return t instanceof za?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof wr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Po?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Bd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Bd.prototype.getClass=function(){return Bd};var Pr=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 va(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Pr(n):new Pr(n,r)}};Fa.prototype.interfaces_=function(){return[If,ms]};Fa.prototype.getClass=function(){return Fa};Fa.instance=function(){return Fa.instanceObject};l1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};l1.instanceObject.get=function(){return new Fa};Object.defineProperties(Fa,l1);var eC=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 gt,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 s1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Qc),Rn=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 la){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}}},u1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Rn.prototype.equals=function(t){if(!(t instanceof Rn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Rn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new oa(n).compareTo(new oa(r))};Rn.prototype.getScale=function(){return this._scale};Rn.prototype.isFloating=function(){return this._modelType===Rn.FLOATING||this._modelType===Rn.FLOATING_SINGLE};Rn.prototype.getType=function(){return this._modelType};Rn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Rn.FLOATING?t="Floating":this._modelType===Rn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Rn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Rn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if($t.isNaN(t))return t;if(this._modelType===Rn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Rn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Ne){var n=arguments[0];if(this._modelType===Rn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Rn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Rn.FLOATING?t=16:this._modelType===Rn.FLOATING_SINGLE?t=6:this._modelType===Rn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Rn.prototype.setScale=function(t){this._scale=Math.abs(t)};Rn.prototype.interfaces_=function(){return[ms,ds]};Rn.prototype.getClass=function(){return Rn};Rn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};u1.serialVersionUID.get=function(){return 7777263578777804e3};u1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Rn,u1);var la=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},c1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};la.prototype.readResolve=function(){return la.nameToTypeMap.get(this._name)};la.prototype.toString=function(){return this._name};la.prototype.interfaces_=function(){return[ms]};la.prototype.getClass=function(){return la};c1.serialVersionUID.get=function(){return-552860263173159e4};c1.nameToTypeMap.get=function(){return new eC};Object.defineProperties(la,c1);Rn.Type=la;Rn.FIXED=new la("FIXED");Rn.FLOATING=new la("FLOATING");Rn.FLOATING_SINGLE=new la("FLOATING SINGLE");var yn=function t(){this._precisionModel=new Rn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Wt(arguments[0],If)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Rn&&(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]))},tC={serialVersionUID:{configurable:!0}};yn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Ne(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Ne(t.getMinX(),t.getMinY()),new Ne(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Ne(t.getMinX(),t.getMinY()),new Ne(t.getMinX(),t.getMaxY()),new Ne(t.getMaxX(),t.getMaxY()),new Ne(t.getMaxX(),t.getMinY()),new Ne(t.getMinX(),t.getMinY())]),null)};yn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new wr(this.getCoordinateSequenceFactory().create(t),this);if(Wt(t,Tn))return new wr(t,this)}else return new wr(this.getCoordinateSequenceFactory().create([]),this)};yn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Fu(null,this);if(arguments.length===1){var t=arguments[0];return new Fu(t,this)}};yn.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(yn.toGeometryArray(t));var l=t.iterator().next(),m=t.size()>1;if(m){if(l instanceof Qr)return this.createMultiPolygon(yn.toPolygonArray(t));if(l instanceof wr)return this.createMultiLineString(yn.toLineStringArray(t));if(l instanceof Po)return this.createMultiPoint(yn.toPointArray(t));ln.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};yn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};yn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Ne){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Wt(arguments[0],Tn)){var e=arguments[0];return new Po(e,this)}}};yn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};yn.prototype.createPolygon=function(){if(arguments.length===0)return new Qr(null,null,this);if(arguments.length===1){if(Wt(arguments[0],Tn)){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 za){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Qr(r,i,this)}};yn.prototype.getSRID=function(){return this._SRID};yn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Yi(null,this);if(arguments.length===1){var t=arguments[0];return new Yi(t,this)}};yn.prototype.createGeometry=function(t){var e=new fs(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};yn.prototype.getPrecisionModel=function(){return this._precisionModel};yn.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(Wt(arguments[0],Tn)){var e=arguments[0];return new za(e,this)}}};yn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Da(null,this);if(arguments.length===1){var t=arguments[0];return new Da(t,this)}};yn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Af(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Af(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Wt(arguments[0],Tn)){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]};ba.prototype.push=function(t){return this.array_.push(t),t};ba.prototype.pop=function(t){if(this.array_.length===0)throw new U_;return this.array_.pop()};ba.prototype.peek=function(){if(this.array_.length===0)throw new U_;return this.array_[this.array_.length-1]};ba.prototype.empty=function(){return this.array_.length===0};ba.prototype.isEmpty=function(){return this.empty()};ba.prototype.search=function(t){return this.array_.indexOf(t)};ba.prototype.size=function(){return this.array_.length};ba.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===St.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ua.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=lt.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};ua.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)};ua.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}ln.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===lt.LEFT&&(this._orientedDe=this._minDe.getSym())};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};var yl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new Ne(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}(gl),G_=function(){this.array_=[]};G_.prototype.addLast=function(t){this.array_.push(t)};G_.prototype.removeFirst=function(){return this.array_.shift()};G_.prototype.isEmpty=function(){return this.array_.length===0};var Ki=function(){this._finder=null,this._dirEdgeList=new gt,this._nodes=new gt,this._rightMostCoord=null,this._env=null,this._finder=new ua};Ki.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Ki.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Ki.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 yl("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)}};Ki.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(lt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Ki.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Ki.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(lt.RIGHT)>=1&&e.getDepth(lt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Ki.prototype.computeDepths=function(t){var e=this,n=new s1,r=new G_,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 l=c.next(),m=l.getSym();if(!m.isVisited()){var w=m.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Ki.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Ki.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Nt,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[lt.ON]=this.location[lt.ON],n[lt.LEFT]=ze.NONE,n[lt.RIGHT]=ze.NONE,this.location=n}for(var r=0;r1&&t.append(ze.toLocationSymbol(this.location[lt.LEFT])),t.append(ze.toLocationSymbol(this.location[lt.ON])),this.location.length>1&&t.append(ze.toLocationSymbol(this.location[lt.RIGHT])),t.toString()};Jn.prototype.setLocations=function(t,e,n){this.location[lt.ON]=t,this.location[lt.LEFT]=e,this.location[lt.RIGHT]=n};Jn.prototype.get=function(t){return t1};Jn.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};Br.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;m--)r._pts.add(i[m])}};Br.prototype.isHole=function(){return this._isHole};Br.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Br.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!St.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};Br.prototype.addHole=function(t){this._holes.add(t)};Br.prototype.isShell=function(){return this._shell===null};Br.prototype.getLabel=function(){return this._label};Br.prototype.getEdges=function(){return this._edges};Br.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Br.prototype.getShell=function(){return this._shell};Br.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,lt.RIGHT);if(r===ze.NONE)return null;if(this._label.getLocation(n)===ze.NONE)return this._label.setLocation(n,r),null}};Br.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Br.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)};Xo.prototype.isInResult=function(){return this._isInResult};Xo.prototype.isVisited=function(){return this._isVisited};Xo.prototype.interfaces_=function(){return[]};Xo.prototype.getClass=function(){return Xo};var j_=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 Vn(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 Vn(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 Vn)for(var i=arguments[0],a=0;a<2;a++){var c=n.computeMergedLocation(i,a),l=n._label.getLocation(a);l===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}(Xo),ca=function(){this.nodeMap=new Ri,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ca.prototype.find=function(t){return this.nodeMap.get(t)};ca.prototype.addNode=function(){if(arguments[0]instanceof Ne){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 j_){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ca.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};ca.prototype.iterator=function(){return this.nodeMap.values().iterator()};ca.prototype.values=function(){return this.nodeMap.values()};ca.prototype.getBoundaryNodes=function(t){for(var e=new gt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===ze.BOUNDARY&&e.add(r)}return e};ca.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};var Un=function(){},nm={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Un.prototype.interfaces_=function(){return[]};Un.prototype.getClass=function(){return Un};Un.isNorthern=function(t){return t===Un.NE||t===Un.NW};Un.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Un.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};Un.isInHalfPlane=function(t,e){return e===Un.SE?t===Un.SE||t===Un.SW:t===e||t===e+1};Un.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 lr("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Un.NE:Un.SE:e>=0?Un.NW:Un.SW}else if(arguments[0]instanceof Ne&&arguments[1]instanceof Ne){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new lr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Un.NE:Un.SE:r.y>=n.y?Un.NW:Un.SW}};nm.NE.get=function(){return 0};nm.NW.get=function(){return 1};nm.SW.get=function(){return 2};nm.SE.get=function(){return 3};Object.defineProperties(Un,nm);var Ni=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],l=arguments[2],m=arguments[3];this._edge=a,this.init(c,l),this._label=m}};Ni.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var l=c.buildMinimalRings(),m=r.findShell(l);m!==null?(r.placePolygonHoles(m,l),e.add(m)):n.addAll(l)}else i.add(c)}return i};Mo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Mo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new gt,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new TR(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};Mo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Mo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Mo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,c=null,l=e.iterator();l.hasNext();){var m=l.next(),w=m.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(c=a.getLinearRing().getEnvelopeInternal());var E=!1;S.contains(r)&&St.isPointInRing(i,w.getCoordinates())&&(E=!0),E&&(a===null||c.contains(S))&&(a=m)}return a};Mo.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 ln.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Mo.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];mr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new gt,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Mo.prototype.interfaces_=function(){return[]};Mo.prototype.getClass=function(){return Mo};var Df=function(){};Df.prototype.getBounds=function(){};Df.prototype.interfaces_=function(){return[]};Df.prototype.getClass=function(){return Df};var Ds=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ds.prototype.getItem=function(){return this._item};Ds.prototype.getBounds=function(){return this._bounds};Ds.prototype.interfaces_=function(){return[Df,ms]};Ds.prototype.getClass=function(){return Ds};var vl=function(){this._size=null,this._items=null,this._size=0,this._items=new gt,this._items.add(null)};vl.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};vl.prototype.size=function(){return this._size};vl.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)};vl.prototype.clear=function(){this._size=0,this._items.clear()};vl.prototype.isEmpty=function(){return this._size===0};vl.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)};vl.prototype.interfaces_=function(){return[]};vl.prototype.getClass=function(){return vl};var eu=function(){};eu.prototype.visitItem=function(t){};eu.prototype.interfaces_=function(){return[]};eu.prototype.getClass=function(){return eu};var Dc=function(){};Dc.prototype.insert=function(t,e){};Dc.prototype.remove=function(t,e){};Dc.prototype.query=function(){};Dc.prototype.interfaces_=function(){return[]};Dc.prototype.getClass=function(){return Dc};var Zr=function(){if(this._childBoundables=new gt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},rC={serialVersionUID:{configurable:!0}};Zr.prototype.getLevel=function(){return this._level};Zr.prototype.size=function(){return this._childBoundables.size()};Zr.prototype.getChildBoundables=function(){return this._childBoundables};Zr.prototype.addChildBoundable=function(t){ln.isTrue(this._bounds===null),this._childBoundables.add(t)};Zr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Zr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Zr.prototype.interfaces_=function(){return[Df,ms]};Zr.prototype.getClass=function(){return Zr};rC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Zr,rC);var Rs=function(){};Rs.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Rs.min=function(t){return Rs.sort(t),t.get(0)};Rs.sort=function(t,e){var n=t.toArray();e?Nu.sort(n,e):Nu.sort(n);for(var r=t.iterator(),i=0,a=n.length;iOr.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 lr("neither boundable is composite")};Or.prototype.isLeaves=function(){return!(Or.isComposite(this._boundable1)||Or.isComposite(this._boundable2))};Or.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Or.prototype.expand=function(t,e,n,r){for(var i=this,a=t.getChildBoundables(),c=a.iterator();c.hasNext();){var l=c.next(),m=new Or(l,e,i._itemDistance);m.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},q_={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};yi.prototype.getNodeCapacity=function(){return this._nodeCapacity};yi.prototype.lastNode=function(t){return t.get(t.size()-1)};yi.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 Zr?n+=t.size(i):i instanceof Ds&&(n+=1)}return n}};yi.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ds&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};yi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new gt:e}else if(arguments.length===1){for(var n=arguments[0],r=new gt,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Zr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof Ds?r.add(a.getItem()):ln.shouldNeverReachHere()}return r.size()<=0?null:r}};yi.prototype.insert=function(t,e){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ds(t,e))};yi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new gt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(ln.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var l=c.next();l instanceof Zr?t.boundablesAtLevel(r,l,a):(ln.isTrue(l instanceof Ds),r===-1&&a.add(l))}return null}};yi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new gt;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(Wt(arguments[2],eu)&&arguments[0]instanceof Object&&arguments[1]instanceof Zr)for(var a=arguments[0],c=arguments[1],l=arguments[2],m=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};yi.prototype.createParentBoundables=function(t,e){var n=this;ln.isTrue(!t.isEmpty());var r=new gt;r.add(this.createNode(e));var i=new gt(t);Rs.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};yi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};yi.prototype.interfaces_=function(){return[ms]};yi.prototype.getClass=function(){return yi};yi.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new gt,l=0;l0;){var k=D.poll(),U=k.getDistance();if(U>=E)break;k.isLeaves()?(E=U,T=k):k.expandToQueue(D,E)}return[T.getBoundable(0).getItem(),T.getBoundable(1).getItem()]}}else if(arguments.length===3){var q=arguments[0],ee=arguments[1],V=arguments[2],j=new Ds(q,ee),Q=new Or(this.getRoot(),j,V);return this.nearestNeighbour(Q)[0]}},e.prototype.interfaces_=function(){return[Dc,ms]},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 h2},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Ef]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Ef]},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}(yi),h2=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 Nt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zr),ao=function(){};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};ao.relativeSign=function(t,e){return te?1:0};ao.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=ao.relativeSign(e.x,n.x),i=ao.relativeSign(e.y,n.y);switch(t){case 0:return ao.compareValue(r,i);case 1:return ao.compareValue(i,r);case 2:return ao.compareValue(i,-r);case 3:return ao.compareValue(-r,i);case 4:return ao.compareValue(-r,-i);case 5:return ao.compareValue(-i,-r);case 6:return ao.compareValue(-i,r);case 7:return ao.compareValue(r,-i)}return ln.shouldNeverReachHere("invalid octant value"),0};ao.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var tu=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 Ne(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};tu.prototype.getCoordinate=function(){return this.coord};tu.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};tu.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:ao.compare(this._segmentOctant,this.coord,e.coord)};tu.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};tu.prototype.isInterior=function(){return this._isInterior};tu.prototype.interfaces_=function(){return[ds]};tu.prototype.getClass=function(){return tu};var Ji=function(){this._nodeMap=new Ri,this._edge=null;var t=arguments[0];this._edge=t};Ji.prototype.getSplitCoordinates=function(){var t=this,e=new em;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()};Ji.prototype.addCollapsedNodes=function(){var t=this,e=new gt;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)}};Ji.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Ji.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 Ne&&arguments[1]instanceof Ne){var i=arguments[0],a=arguments[1],c=a.x-i.x,l=a.y-i.y;if(c===0&&l===0)throw new lr("Cannot compute the octant for two identical points "+i);return Rc.octant(c,l)}};var Ba=function(){};Ba.prototype.getCoordinates=function(){};Ba.prototype.size=function(){};Ba.prototype.getCoordinate=function(t){};Ba.prototype.isClosed=function(){};Ba.prototype.setData=function(t){};Ba.prototype.getData=function(){};Ba.prototype.interfaces_=function(){return[]};Ba.prototype.getClass=function(){return Ba};var Vd=function(){};Vd.prototype.addIntersection=function(t,e){};Vd.prototype.interfaces_=function(){return[Ba]};Vd.prototype.getClass=function(){return Vd};var kr=function(){this._nodeList=new Ji(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};kr.prototype.getCoordinates=function(){return this._pts};kr.prototype.size=function(){return this._pts.length};kr.prototype.getCoordinate=function(t){return this._pts[t]};kr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};kr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};kr.prototype.setData=function(t){this._data=t};kr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Rc.octant(t,e)};kr.prototype.getData=function(){return this._data};kr.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 Ne(n.getIntersection(i));this.addIntersection(a,r)}};kr.prototype.toString=function(){return As.toLineString(new Pr(this._pts))};kr.prototype.getNodeList=function(){return this._nodeList};kr.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 Ne){var r=arguments[0];return St.orientationIndex(this.p0,this.p1,r)}};Ot.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Ot.prototype.isVertical=function(){return this.p0.x===this.p1.x};Ot.prototype.equals=function(t){if(!(t instanceof Ot))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Ot.prototype.intersection=function(t){var e=new Qu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Ot.prototype.project=function(){if(arguments[0]instanceof Ne){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Ne(t);var e=this.projectionFactor(t),n=new Ne;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 Ot){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 l=this.project(r.p1);return a<0&&(l=this.p0),a>1&&(l=this.p1),new Ot(c,l)}};Ot.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Ot.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Ot.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Ot.prototype.distancePerpendicular=function(t){return St.distancePointLinePerpendicular(t,this.p0,this.p1)};Ot.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Ot.prototype.midPoint=function(){return Ot.midPoint(this.p0,this.p1)};Ot.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 $t.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};Ot.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=$t.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||$t.isNaN(e))&&(e=1),e};Ot.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Ot.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Ot.prototype.distance=function(){if(arguments[0]instanceof Ot){var t=arguments[0];return St.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Ne){var e=arguments[0];return St.distancePointLine(e,this.p0,this.p1)}};Ot.prototype.pointAlong=function(t){var e=new Ne;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};Ot.prototype.hashCode=function(){var t=$t.doubleToLongBits(this.p0.x);t^=$t.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=$t.doubleToLongBits(this.p1.x);n^=$t.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};Ot.prototype.interfaces_=function(){return[ds,ms]};Ot.prototype.getClass=function(){return Ot};Ot.midPoint=function(t,e){return new Ne((t.x+e.x)/2,(t.y+e.y)/2)};oC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Ot,oC);var Ud=function(){this.tempEnv1=new Nt,this.tempEnv2=new Nt,this._overlapSeg1=new Ot,this._overlapSeg2=new Ot};Ud.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)}};Ud.prototype.interfaces_=function(){return[]};Ud.prototype.getClass=function(){return Ud};var Ao=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};Ao.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Ao.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=Un.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 f2},Object.defineProperties(e,n),e}(Gd),f2=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(),l=i.getContext();this._si.processIntersections(c,r,l,a)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ud),Dn=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],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(c),this.setMitreLimit(l)}}},Il={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}};Dn.prototype.getEndCapStyle=function(){return this._endCapStyle};Dn.prototype.isSingleSided=function(){return this._isSingleSided};Dn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Dn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Dn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Dn.JOIN_ROUND&&(this._quadrantSegments=Dn.DEFAULT_QUADRANT_SEGMENTS)};Dn.prototype.getJoinStyle=function(){return this._joinStyle};Dn.prototype.setJoinStyle=function(t){this._joinStyle=t};Dn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Dn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Dn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Dn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Dn.prototype.getMitreLimit=function(){return this._mitreLimit};Dn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Dn.prototype.setSingleSided=function(t){this._isSingleSided=t};Dn.prototype.interfaces_=function(){return[]};Dn.prototype.getClass=function(){return Dn};Dn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Il.CAP_ROUND.get=function(){return 1};Il.CAP_FLAT.get=function(){return 2};Il.CAP_SQUARE.get=function(){return 3};Il.JOIN_ROUND.get=function(){return 1};Il.JOIN_MITRE.get=function(){return 2};Il.JOIN_BEVEL.get=function(){return 3};Il.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Il.DEFAULT_MITRE_LIMIT.get=function(){return 5};Il.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Dn,Il);var Sr=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=St.COUNTERCLOCKWISE,this._inputLine=t||null},rm={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Sr.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)};Sr.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])};Yo.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-=Sn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Sn.PI_TIMES_2;return t};Sn.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)}};Sn.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,l=r*a+i*c;return l>0};Sn.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,l=r*a+i*c;return l<0};Sn.interiorAngle=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Math.abs(i-r)};Sn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Sn.PI_TIMES_2;t>=Sn.PI_TIMES_2&&(t=0)}else{for(;t>=Sn.PI_TIMES_2;)t-=Sn.PI_TIMES_2;t<0&&(t=0)}return t};Sn.angleBetween=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Sn.diff(r,i)};Sn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Sn.toRadians=function(t){return t*Math.PI/180};Sn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Sn.COUNTERCLOCKWISE:n<0?Sn.CLOCKWISE:Sn.NONE};Sn.angleBetweenOriented=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n),a=i-r;return a<=-Math.PI?a+Sn.PI_TIMES_2:a>Math.PI?a-Sn.PI_TIMES_2:a};$c.PI_TIMES_2.get=function(){return 2*Math.PI};$c.PI_OVER_2.get=function(){return Math.PI/2};$c.PI_OVER_4.get=function(){return Math.PI/4};$c.COUNTERCLOCKWISE.get=function(){return St.COUNTERCLOCKWISE};$c.CLOCKWISE.get=function(){return St.CLOCKWISE};$c.NONE.get=function(){return St.COLLINEAR};Object.defineProperties(Sn,$c);var nr=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 Ot,this._seg1=new Ot,this._offset0=new Ot,this._offset1=new Ot,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 Qu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Dn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},im={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}};nr.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=St.computeOrientation(this._s0,this._s1,this._s2),r=n===St.CLOCKWISE&&this._side===lt.LEFT||n===St.COUNTERCLOCKWISE&&this._side===lt.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};nr.prototype.addLineEndCap=function(t,e){var n=new Ot(t,e),r=new Ot;this.computeOffsetSegment(n,lt.LEFT,this._distance,r);var i=new Ot;this.computeOffsetSegment(n,lt.RIGHT,this._distance,i);var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a);switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,St.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Dn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Dn.CAP_SQUARE:var m=new Ne;m.x=Math.abs(this._distance)*Math.cos(l),m.y=Math.abs(this._distance)*Math.sin(l);var w=new Ne(r.p1.x+m.x,r.p1.y+m.y),S=new Ne(i.p1.x+m.x,i.p1.y+m.y);this._segList.addPt(w),this._segList.addPt(S);break}};nr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};nr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Ps.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(l){if(l instanceof Jf)a=new Ne(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};nr.prototype.addFilletCorner=function(t,e,n,r,i){var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a),m=n.x-t.x,w=n.y-t.y,S=Math.atan2(w,m);r===St.CLOCKWISE?l<=S&&(l+=2*Math.PI):l>=S&&(l-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,l,S,r,i),this._segList.addPt(n)};nr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Ne((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 Ne((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)}};nr.prototype.createCircle=function(t){var e=new Ne(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};nr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};nr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Yo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*nr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};nr.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()===Dn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Dn.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,St.CLOCKWISE,this._distance))};nr.prototype.closeRing=function(){this._segList.closeRing()};nr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};nr.prototype.interfaces_=function(){return[]};nr.prototype.getClass=function(){return nr};im.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};im.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};im.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};im.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(nr,im);var ho=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};ho.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&&vn.reverse(a),a};ho.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Sr.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],lt.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var l=Sr.simplify(t,r),m=l.length-1;n.initSideSegments(l[0],l[1],lt.LEFT),n.addFirstSegment();for(var w=2;w<=m;w++)n.addNextSegment(l[w],!0)}n.addLastSegment(),n.closeRing()};ho.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===lt.RIGHT&&(r=-r);var i=Sr.simplify(t,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],e);for(var c=1;c<=a;c++){var l=c!==1;n.addNextSegment(i[c],l)}n.closeRing()};ho.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Sr.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],lt.LEFT);for(var a=2;a<=i;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=Sr.simplify(t,-n),l=c.length-1;e.initSideSegments(c[l],c[l-1],lt.LEFT);for(var m=l-2;m>=0;m--)e.addNextSegment(c[m],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};ho.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:e.createCircle(t);break;case Dn.CAP_SQUARE:e.createSquare(t);break}};ho.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};ho.prototype.getBufferParameters=function(){return this._bufParams};ho.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};ho.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return ho.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};ho.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Sr.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],lt.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var l=Sr.simplify(t,r),m=l.length-1;n.initSideSegments(l[0],l[1],lt.LEFT),n.addFirstSegment();for(var w=2;w<=m;w++)n.addNextSegment(l[w],!0)}n.addLastSegment()};ho.prototype.getSegGen=function(t){return new nr(this._precisionModel,this._bufParams,t)};ho.prototype.interfaces_=function(){return[]};ho.prototype.getClass=function(){return ho};ho.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(Wt(arguments[2],Ms)&&arguments[0]instanceof Ne&&arguments[1]instanceof dv)for(var c=arguments[0],l=arguments[1],m=arguments[2],w=l.getEdge().getCoordinates(),S=0;St._seg.p1.y&&t._seg.reverse();var E=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Et._seg.p1.y)&&St.computeOrientation(t._seg.p0,t._seg.p1,c)!==St.RIGHT){var T=l.getDepth(lt.LEFT);t._seg.p0.equals(w[S])||(T=l.getDepth(lt.RIGHT));var D=new Vu(t._seg,T);m.add(D)}}else if(Wt(arguments[2],Ms)&&arguments[0]instanceof Ne&&Wt(arguments[1],Ms))for(var k=arguments[0],U=arguments[1],q=arguments[2],ee=U.iterator();ee.hasNext();){var V=ee.next();V.isForward()&&t.findStabbedSegments(k,V,q)}}};Nc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Rs.min(e);return n._leftDepth};Nc.prototype.interfaces_=function(){return[]};Nc.prototype.getClass=function(){return Nc};aC.DepthSegment.get=function(){return Vu};Object.defineProperties(Nc,aC);var Vu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Ot(t),this._leftDepth=e};Vu.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)};Vu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Vu.prototype.toString=function(){return this._upwardSeg.toString()};Vu.prototype.interfaces_=function(){return[ds]};Vu.prototype.getClass=function(){return Vu};var Nn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Nn.prototype.area=function(){return Nn.area(this.p0,this.p1,this.p2)};Nn.prototype.signedArea=function(){return Nn.signedArea(this.p0,this.p1,this.p2)};Nn.prototype.interpolateZ=function(t){if(t===null)throw new lr("Supplied point is null.");return Nn.interpolateZ(t,this.p0,this.p1,this.p2)};Nn.prototype.longestSideLength=function(){return Nn.longestSideLength(this.p0,this.p1,this.p2)};Nn.prototype.isAcute=function(){return Nn.isAcute(this.p0,this.p1,this.p2)};Nn.prototype.circumcentre=function(){return Nn.circumcentre(this.p0,this.p1,this.p2)};Nn.prototype.area3D=function(){return Nn.area3D(this.p0,this.p1,this.p2)};Nn.prototype.centroid=function(){return Nn.centroid(this.p0,this.p1,this.p2)};Nn.prototype.inCentre=function(){return Nn.inCentre(this.p0,this.p1,this.p2)};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.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)};Nn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};Nn.det=function(t,e,n,r){return t*r-e*n};Nn.interpolateZ=function(t,e,n,r){var i=e.x,a=e.y,c=n.x-i,l=r.x-i,m=n.y-a,w=r.y-a,S=c*w-l*m,E=t.x-i,T=t.y-a,D=(w*E-l*T)/S,k=(-m*E+c*T)/S,U=e.z+D*(n.z-e.z)+k*(r.z-e.z);return U};Nn.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};Nn.isAcute=function(t,e,n){return!(!Sn.isAcute(t,e,n)||!Sn.isAcute(e,n,t)||!Sn.isAcute(n,t,e))};Nn.circumcentre=function(t,e,n){var r=n.x,i=n.y,a=t.x-r,c=t.y-i,l=e.x-r,m=e.y-i,w=2*Nn.det(a,c,l,m),S=Nn.det(c,a*a+c*c,m,l*l+m*m),E=Nn.det(a,a*a+c*c,l,l*l+m*m),T=r-S/w,D=i+E/w;return new Ne(T,D)};Nn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Ps(t.x+n/2,t.y+r/2,1),a=new Ps(t.x-r+n/2,t.y+n+r/2,1);return new Ps(i,a)};Nn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),a=r/(r+i),c=n.x-t.x,l=n.y-t.y,m=new Ne(t.x+a*c,t.y+a*l);return m};Nn.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,l=n.y-t.y,m=n.z-t.z,w=i*m-a*l,S=a*c-r*m,E=r*l-i*c,T=w*w+S*S+E*E,D=Math.sqrt(T)/2;return D};Nn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Ne(r,i)};Nn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),a=t.distance(e),c=r+i+a,l=(r*t.x+i*e.x+a*n.x)/c,m=(r*t.y+i*e.y+a*n.y)/c;return new Ne(l,m)};var ps=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new gt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};ps.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)};ps.prototype.addPolygon=function(t){var e=this,n=this._distance,r=lt.LEFT;this._distance<0&&(n=-this._distance,r=lt.RIGHT);var i=t.getExteriorRing(),a=vn.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(l,-e._distance)||e.addPolygonRing(m,n,lt.opposite(r),ze.INTERIOR,ze.EXTERIOR)}};ps.prototype.isTriangleErodedCompletely=function(t,e){var n=new Nn(t[0],t[1],t[2]),r=n.inCentre(),i=St.distancePointLine(r,n.p0,n.p1);return i=za.MINIMUM_VALID_SIZE&&St.isCCW(t)&&(a=i,c=r,n=lt.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,a,c)};ps.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Qr?this.addPolygon(t):t instanceof wr?this.addLineString(t):t instanceof Po?this.addPoint(t):t instanceof Af?this.addCollection(t):t instanceof Fu?this.addCollection(t):t instanceof Da?this.addCollection(t):t instanceof Yi&&this.addCollection(t)};ps.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};ps.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new $f;var t=this._parent.getGeometryN(this._index++);return t instanceof Yi?(this._subcollectionIterator=new Ra(t),this._subcollectionIterator.next()):t};Ra.prototype.remove=function(){throw new Error(this.getClass().getName())};Ra.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)};Ra.prototype.interfaces_=function(){return[Qf]};Ra.prototype.getClass=function(){return Ra};Ra.isAtomic=function(t){return!(t instanceof Yi)};var Wo=function(){this._geom=null;var t=arguments[0];this._geom=t};Wo.prototype.locate=function(t){return Wo.locate(t,this._geom)};Wo.prototype.interfaces_=function(){return[Nf]};Wo.prototype.getClass=function(){return Wo};Wo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?St.isPointInRing(t,e.getCoordinates()):!1};Wo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Wo.isPointInRing(t,n))return!1;for(var r=0;r=0;a--){var c=n._edgeList.get(a),l=c.getSym();i===null&&(i=l),r!==null&&l.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(lt.LEFT),c=r.getDepth(lt.RIGHT),l=this.computeDepths(i+1,this._edgeList.size(),a),m=this.computeDepths(0,i,l);if(m!==c)throw new yl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],E=arguments[2],T=E,D=w;D=0;l--){var m=r._resultAreaEdgeList.get(l),w=m.getSym();switch(i===null&&m.getEdgeRing()===n&&(i=m),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(m.getEdgeRing()!==n)continue;a.setNextMin(m),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(ln.isTrue(i!==null,"found null for first outgoing dirEdge"),ln.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,l=this.iterator();l.hasNext();){var m=l.next();m.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,l=this.iterator();l.hasNext();){var m=l.next(),w=m.getSym();m.isLineEdge()?m.getEdge().setCovered(c===ze.INTERIOR):(m.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 Vn(ze.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getEdge(),l=c.getLabel(),m=0;m<2;m++){var w=l.getLocation(m);(w===ze.INTERIOR||w===ze.BOUNDARY)&&r._label.setLocation(m,ze.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oi),lC=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 j_(n,new PR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kf),nu=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};nu.prototype.compareTo=function(t){var e=t,n=nu.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};nu.prototype.interfaces_=function(){return[ds]};nu.prototype.getClass=function(){return nu};nu.orientation=function(t){return vn.increasingDirection(t)===1};nu.compareOriented=function(t,e,n,r){for(var i=e?1:-1,a=r?1:-1,c=e?t.length:-1,l=r?n.length:-1,m=e?0:t.length-1,w=r?0:n.length-1;;){var S=t[m].compareTo(n[w]);if(S!==0)return S;m+=i,w+=a;var E=m===c,T=w===l;if(E&&!T)return-1;if(!E&&T)return 1;if(E&&T)return 0}};var Ns=function(){this._edges=new gt,this._ocaMap=new Ri};Ns.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(") ")};Ns.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};Ns.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),l=0;c[l++]=new Ne(t.coord);for(var m=t.segmentIndex+1;m<=e.segmentIndex;m++)c[l++]=n.edge.pts[m];return a&&(c[l]=e.coord),new d_(c,new Vn(this.edge._label))};Va.prototype.add=function(t,e,n){var r=new ha(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Va.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Va.prototype.interfaces_=function(){return[]};Va.prototype.getClass=function(){return Va};var Gu=function(){};Gu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new gt;r.add(new oa(n));do{var i=e.findChainEnd(t,n);r.add(new oa(i)),n=i}while(nn?e:n};bl.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}}};Ci.prototype.getDelta=function(t){return this._depth[t][lt.RIGHT]-this._depth[t][lt.LEFT]};Ci.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?ze.EXTERIOR:ze.INTERIOR};Ci.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ci.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]=Ci.depthAtLocation(i):t._depth[n][r]+=Ci.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],l=arguments[2];l===ze.INTERIOR&&this._depth[a][c]++}};Ci.prototype.interfaces_=function(){return[]};Ci.prototype.getClass=function(){return Ci};Ci.depthAtLocation=function(t){return t===ze.EXTERIOR?0:t===ze.INTERIOR?1:Ci.NULL_VALUE};uC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ci,uC);var d_=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Va(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ci,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,Vn.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,l=this.pts.length,m=0;m0?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 bl(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Nt;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 l=this.intersectsToleranceSquare(t,e);return ln.isTrue(!(c&&l),"Found bad envelope test"),l};fo.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 Ne(this._maxx,this._maxy),this._corner[1]=new Ne(this._minx,this._maxy),this._corner[2]=new Ne(this._minx,this._miny),this._corner[3]=new Ne(this._maxx,this._miny)};fo.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))};fo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};fo.prototype.getCoordinate=function(){return this._originalPt};fo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};fo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=fo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Nt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};fo.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()))};fo.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))};fo.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};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};hC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(fo,hC);var jd=function(){this.tempEnv1=new Nt,this.selectedSegment=new Ot};jd.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)}};jd.prototype.interfaces_=function(){return[]};jd.prototype.getClass=function(){return jd};var Of=function(){this._index=null;var t=arguments[0];this._index=t},fC={HotPixelSnapAction:{configurable:!0}};Of.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 pC(e,n,r);return this._index.query(i,{interfaces_:function(){return[eu]},visitItem:function(c){var l=c;l.select(i,a)}}),a.isNodeAdded()}};Of.prototype.interfaces_=function(){return[]};Of.prototype.getClass=function(){return Of};fC.HotPixelSnapAction.get=function(){return pC};Object.defineProperties(Of,fC);var pC=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}(jd),Oc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new gt};Oc.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],l=n.getCoordinates()[r],m=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,c,l,m),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(a){if(a instanceof yl)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=Ei.precisionScaleFactor(this._argGeom,this._distance,n),i=new Rn(r);this.bufferFixedPrecision(i)}};Ei.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Rn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Ei.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Ei.prototype.bufferOriginalPrecision=function(){try{var t=new Hi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof gl)this._saveException=e;else throw e}finally{}};Ei.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Ei.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Ei(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof qt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],l=new Ei(i);l.setQuadrantSegments(c);var m=l.getResultGeometry(a);return m}else if(arguments[2]instanceof Dn&&arguments[0]instanceof qt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],E=arguments[2],T=new Ei(w,E),D=T.getResultGeometry(S);return D}}else if(arguments.length===4){var k=arguments[0],U=arguments[1],q=arguments[2],ee=arguments[3],V=new Ei(k);V.setQuadrantSegments(q),V.setEndCapStyle(ee);var j=V.getResultGeometry(U);return j}};Ei.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Zo.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,l=Math.trunc(Math.log(c)/Math.log(10)+1),m=n-l,w=Math.pow(10,m);return w};ep.CAP_ROUND.get=function(){return Dn.CAP_ROUND};ep.CAP_BUTT.get=function(){return Dn.CAP_FLAT};ep.CAP_FLAT.get=function(){return Dn.CAP_FLAT};ep.CAP_SQUARE.get=function(){return Dn.CAP_SQUARE};ep.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Ei,ep);var ji=function(){this._pt=[new Ne,new Ne],this._distance=$t.NaN,this._isNull=!0};ji.prototype.getCoordinates=function(){return this._pt};ji.prototype.getCoordinate=function(t){return this._pt[t]};ji.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)}};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};var Ma=function(){};Ma.prototype.interfaces_=function(){return[]};Ma.prototype.getClass=function(){return Ma};Ma.computeDistance=function(){if(arguments[2]instanceof ji&&arguments[0]instanceof wr&&arguments[1]instanceof Ne)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Ot,a=0;a0||this._isIn?ze.INTERIOR:ze.EXTERIOR)};Os.prototype.interfaces_=function(){return[]};Os.prototype.getClass=function(){return Os};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}},dC={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};dC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,dC);var Kl=function(t){this._pts=t||null};Kl.prototype.filter=function(t){t instanceof Po&&this._pts.add(t)};Kl.prototype.interfaces_=function(){return[aa]};Kl.prototype.getClass=function(){return Kl};Kl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Po?Rs.singletonList(t):Kl.getPoints(t,new gt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Po?n.add(e):e instanceof Yi&&e.apply(new Kl(n)),n}};var Fc=function(){this._locations=null;var t=arguments[0];this._locations=t};Fc.prototype.filter=function(t){(t instanceof Po||t instanceof wr||t instanceof Qr)&&this._locations.add(new qi(t,0,t.getCoordinate()))};Fc.prototype.interfaces_=function(){return[aa]};Fc.prototype.getClass=function(){return Fc};Fc.getLocations=function(t){var e=new gt;return t.apply(new Fc(e)),e};var Li=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Os,this._minDistanceLocation=null,this._minDistance=$t.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}};Li.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=dl.getPolygons(this._geom[n]);if(a.size()>0){var c=Fc.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&&Wt(arguments[0],Ms)&&Wt(arguments[1],Ms)){for(var l=arguments[0],m=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(),k=E.getCoordinates(),U=0;Uthis._distance&&this.initialize(e,n,r)}};Di.prototype.interfaces_=function(){return[]};Di.prototype.getClass=function(){return Di};var ea=function(){};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};ea.computeDistance=function(){if(arguments[2]instanceof Di&&arguments[0]instanceof wr&&arguments[1]instanceof Ne)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Ot,i=t.getCoordinates(),a=0;a1||t<=0)throw new lr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ls.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ls.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ls.prototype.computeOrientedDistance=function(t,e,n){var r=new Bc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new ou(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ls.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ls.prototype.interfaces_=function(){return[]};ls.prototype.getClass=function(){return ls};ls.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ls(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ls(r,i);return c.setDensifyFraction(a),c.distance()}};d1.MaxPointDistanceFilter.get=function(){return Bc};d1.MaxDensifiedByFractionDistanceFilter.get=function(){return ou};Object.defineProperties(ls,d1);var Bc=function(){this._maxPtDist=new Di,this._minPtDist=new Di,this._euclideanDist=new ea,this._geom=null;var t=arguments[0];this._geom=t};Bc.prototype.filter=function(t){this._minPtDist.initialize(),ea.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Bc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Bc.prototype.interfaces_=function(){return[Oa]};Bc.prototype.getClass=function(){return Bc};var ou=function(){this._maxPtDist=new Di,this._minPtDist=new Di,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};ou.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,l=0;ln){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 "+As.toLineString(i[0],i[1])+")"}};Co.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Co.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(),Co.VERBOSE&&Ti.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Co.prototype.checkNegativeValid=function(){if(!(this._input instanceof Qr||this._input instanceof Da||this._input instanceof Yi))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)};Co.prototype.getErrorIndicator=function(){return this._errorIndicator};Co.prototype.checkMinimumDistance=function(t,e,n){var r=new Li(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")};Pi.prototype.report=function(t){if(!Pi.VERBOSE)return null;Ti.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Pi.prototype.getErrorMessage=function(){return this._errorMsg};Pi.prototype.interfaces_=function(){return[]};Pi.prototype.getClass=function(){return Pi};Pi.isValidMsg=function(t,e,n){var r=new Pi(t,e,n);return r.isValid()?null:r.getErrorMessage()};Pi.isValid=function(t,e,n){var r=new Pi(t,e,n);return!!r.isValid()};g1.VERBOSE.get=function(){return!1};g1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Pi,g1);var pa=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};pa.prototype.getCoordinates=function(){return this._pts};pa.prototype.size=function(){return this._pts.length};pa.prototype.getCoordinate=function(t){return this._pts[t]};pa.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};pa.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Rc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};pa.prototype.setData=function(t){this._data=t};pa.prototype.getData=function(){return this._data};pa.prototype.toString=function(){return As.toLineString(new Pr(this._pts))};pa.prototype.interfaces_=function(){return[Ba]};pa.prototype.getClass=function(){return pa};var vi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new gt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};vi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};vi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};vi.prototype.getIntersectionSegments=function(){return this._intSegments};vi.prototype.count=function(){return this._intersectionCount};vi.prototype.getIntersections=function(){return this._intersections};vi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};vi.prototype.setKeepIntersections=function(t){this._keepIntersections=t};vi.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],l=n.getCoordinates()[r],m=n.getCoordinates()[r+1];this._li.computeIntersection(a,c,l,m),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=c,this._intSegments[2]=l,this._intSegments[3]=m,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};vi.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};vi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};vi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};vi.prototype.interfaces_=function(){return[Uu]};vi.prototype.getClass=function(){return vi};vi.createAllIntersectionsFinder=function(t){var e=new vi(t);return e.setFindAllIntersections(!0),e};vi.createAnyIntersectionFinder=function(t){return new vi(t)};vi.createIntersectionCounter=function(t){var e=new vi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var zs=function(){this._li=new Qu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};zs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};zs.prototype.getIntersections=function(){return this._segInt.getIntersections()};zs.prototype.isValid=function(){return this.execute(),this._isValid};zs.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};zs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new f1;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};zs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new yl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};zs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+As.toLineString(t[0],t[1])+" and "+As.toLineString(t[2],t[3])};zs.prototype.interfaces_=function(){return[]};zs.prototype.getClass=function(){return zs};zs.computeIntersections=function(t){var e=new zs(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var qu=function t(){this._nv=null;var e=arguments[0];this._nv=new zs(t.toSegmentStrings(e))};qu.prototype.checkValid=function(){this._nv.checkValid()};qu.prototype.interfaces_=function(){return[]};qu.prototype.getClass=function(){return qu};qu.toSegmentStrings=function(t){for(var e=new gt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new pa(r.getCoordinates(),r))}return e};qu.checkValid=function(t){var e=new qu(t);e.checkValid()};var Vc=function(t){this._mapOp=t};Vc.prototype.map=function(t){for(var e=this,n=new gt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};po.prototype.interfaces_=function(){return[]};po.prototype.getClass=function(){return po};var Ga=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ot,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof wr&&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}};Ga.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 Ne(a),!1)}};Ga.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=$t.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(Mr.computeOverlaySnapTolerance(i),Mr.computeOverlaySnapTolerance(a))}};Mr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Mr.SNAP_PRECISION_FACTOR;return r};Mr.snapToSelf=function(t,e,n){var r=new Mr(t);return r.snapToSelf(e,n)};mC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Mr,mC);var gC=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 Ga(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}(po),Gi=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Gi.prototype.getCommon=function(){return $t.longBitsToDouble(this._commonBits)};Gi.prototype.add=function(t){var e=$t.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Gi.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Gi.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Gi.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Gi.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Gi.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=$t.longBitsToDouble(t),n=$t.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}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};Gi.getBit=function(t,e){var n=1<>52};Gi.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Gi.getBit(t,r)!==Gi.getBit(e,r))return n;n++}return 52};var su=function(){this._commonCoord=null,this._ccFilter=new Gc},_1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};su.prototype.addCommonBits=function(t){var e=new au(this._commonCoord);t.apply(e),t.geometryChanged()};su.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new Ne(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new au(e);return t.apply(n),t.geometryChanged(),t};su.prototype.getCommonCoordinate=function(){return this._commonCoord};su.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};su.prototype.interfaces_=function(){return[]};su.prototype.getClass=function(){return su};_1.CommonCoordinateFilter.get=function(){return Gc};_1.Translater.get=function(){return au};Object.defineProperties(su,_1);var Gc=function(){this._commonBitsX=new Gi,this._commonBitsY=new Gi};Gc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Gc.prototype.getCommonCoordinate=function(){return new Ne(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Gc.prototype.interfaces_=function(){return[Oa]};Gc.prototype.getClass=function(){return Gc};var au=function(){this.trans=null;var t=arguments[0];this.trans=t};au.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)};au.prototype.isDone=function(){return!1};au.prototype.isGeometryChanged=function(){return!0};au.prototype.interfaces_=function(){return[ks]};au.prototype.getClass=function(){return au};var bi=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()};bi.prototype.selfSnap=function(t){var e=new Mr(t),n=e.snapTo(t,this._snapTolerance);return n};bi.prototype.removeCommonBits=function(t){this._cbr=new su,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};bi.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};bi.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=rn.overlayOp(e[0],e[1],t);return this.prepareResult(n)};bi.prototype.checkValid=function(t){t.isValid()||Ti.out.println("Snapped geometry is invalid")};bi.prototype.computeSnapTolerance=function(){this._snapTolerance=Mr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};bi.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Mr.snap(e[0],e[1],this._snapTolerance);return n};bi.prototype.interfaces_=function(){return[]};bi.prototype.getClass=function(){return bi};bi.overlayOp=function(t,e,n){var r=new bi(t,e);return r.getResultGeometry(n)};bi.union=function(t,e){return bi.overlayOp(t,e,rn.UNION)};bi.intersection=function(t,e){return bi.overlayOp(t,e,rn.INTERSECTION)};bi.symDifference=function(t,e){return bi.overlayOp(t,e,rn.SYMDIFFERENCE)};bi.difference=function(t,e){return bi.overlayOp(t,e,rn.DIFFERENCE)};var Qi=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Qi.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=rn.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof gl)r=a;else throw a}finally{}if(!n)try{e=bi.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof gl?r:a}finally{}return e};Qi.prototype.interfaces_=function(){return[]};Qi.prototype.getClass=function(){return Qi};Qi.overlayOp=function(t,e,n){var r=new Qi(t,e);return r.getResultGeometry(n)};Qi.union=function(t,e){return Qi.overlayOp(t,e,rn.UNION)};Qi.intersection=function(t,e){return Qi.overlayOp(t,e,rn.INTERSECTION)};Qi.symDifference=function(t,e){return Qi.overlayOp(t,e,rn.SYMDIFFERENCE)};Qi.difference=function(t,e){return Qi.overlayOp(t,e,rn.DIFFERENCE)};var qd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};qd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};qd.prototype.interfaces_=function(){return[]};qd.prototype.getClass=function(){return qd};var ko=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}},y1={INSERT:{configurable:!0},DELETE:{configurable:!0}};ko.prototype.isDelete=function(){return this._eventType===ko.DELETE};ko.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};ko.prototype.getObject=function(){return this._obj};ko.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};ko.prototype.getInsertEvent=function(){return this._insertEvent};ko.prototype.isInsert=function(){return this._eventType===ko.INSERT};ko.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};ko.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};ko.prototype.interfaces_=function(){return[ds]};ko.prototype.getClass=function(){return ko};y1.INSERT.get=function(){return 1};y1.DELETE.get=function(){return 2};Object.defineProperties(ko,y1);var m_=function(){};m_.prototype.interfaces_=function(){return[]};m_.prototype.getClass=function(){return m_};var Mi=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};Mi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Mi.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};Mi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Mi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Mi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Mi.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};Mi.prototype.hasProperIntersection=function(){return this._hasProper};Mi.prototype.hasIntersection=function(){return this._hasIntersection};Mi.prototype.isDone=function(){return this._isDone};Mi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Mi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Mi.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],l=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,c,l),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))))};Mi.prototype.interfaces_=function(){return[]};Mi.prototype.getClass=function(){return Mi};Mi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var MR=function(t){function e(){t.call(this),this.events=new gt,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;Rs.sort(this.events);for(var r=0;re||this._maxa?1:0};Wd.prototype.interfaces_=function(){return[Ef]};Wd.prototype.getClass=function(){return Wd};var AR=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}(ja),kR=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}(ja),qa=function(){this._leaves=new gt,this._root=null,this._level=0};qa.prototype.buildTree=function(){var t=this;Rs.sort(this._leaves,new ja.NodeComparator);for(var e=this._leaves,n=null,r=new gt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};qa.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 AR(t,e,n))};qa.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};qa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};qa.prototype.printNode=function(t){Ti.out.println(As.toLineString(new Ne(t._min,this._level),new Ne(t._max,this._level)))};qa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};qa.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=vn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,l=i;St.isCCW(a)&&(c=i,l=r);var m=new d_(a,new Vn(this._argIndex,ze.BOUNDARY,c,l));this._lineEdgeMap.put(n,m),this.insertEdge(m),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 Vn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new MR},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),l=a.eiList.iterator();l.hasNext();){var m=l.next();r.addSelfIntersectionNode(n,m.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Da&&(this._useBoundaryDeterminationRule=!1),n instanceof Qr)this.addPolygon(n);else if(n instanceof wr)this.addLineString(n);else if(n instanceof Po)this.addPoint(n);else if(n instanceof Af)this.addCollection(n);else if(n instanceof Fu)this.addCollection(n);else if(n instanceof Da)this.addCollection(n);else if(n instanceof Yi)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 Ff(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}(mr),Vf=function(){if(this._li=new Qu,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 ud(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=hs.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 ud(0,e,r),this._arg[1]=new ud(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 ud(0,i,c),this._arg[1]=new ud(1,a,c)}};Vf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Vf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Vf.prototype.interfaces_=function(){return[]};Vf.prototype.getClass=function(){return Vf};var Ou=function(){};Ou.prototype.interfaces_=function(){return[]};Ou.prototype.getClass=function(){return Ou};Ou.map=function(){if(arguments[0]instanceof qt&&Wt(arguments[1],Ou.MapOp)){for(var t=arguments[0],e=arguments[1],n=new gt,r=0;r=t.size()?null:t.get(e)};Fr.union=function(t){var e=new Fr(t);return e.union()};vC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Fr,vC);var g_=function(){};g_.prototype.interfaces_=function(){return[]};g_.prototype.getClass=function(){return g_};g_.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return rn.createEmptyResult(rn.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Qi.overlayOp(t,e,rn.UNION)};function $u(){return new __}function __(){this.reset()}__.prototype={constructor:__,reset:function(){this.s=this.t=0},add:function(t){p2(bg,t,this.t),p2(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new __;function p2(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var xr=1e-6,Zn=Math.PI,pl=Zn/2,d2=Zn/4,xl=Zn*2,Mu=180/Zn,Js=Zn/180,Wi=Math.abs,DR=Math.atan,Gf=Math.atan2,Wr=Math.cos,Hr=Math.sin,tp=Math.sqrt;function bC(t){return t>1?0:t<-1?Zn:Math.acos(t)}function jc(t){return t>1?pl:t<-1?-pl:Math.asin(t)}function yd(){}function y_(t,e){t&&g2.hasOwnProperty(t.type)&&g2[t.type](t,e)}var m2={Feature:function(t,e){y_(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rZn?t-xl:t<-Zn?t+xl:t,e]}yv.invert=yv;function NR(t,e,n){return(t%=xl)?e||n?xC(v2(t),b2(e,n)):v2(t):e||n?b2(e,n):yv}function y2(t){return function(e,n){return e+=t,[e>Zn?e-xl:e<-Zn?e+xl:e,n]}}function v2(t){var e=y2(t);return e.invert=y2(-t),e}function b2(t,e){var n=Wr(t),r=Hr(t),i=Wr(e),a=Hr(e);function c(l,m){var w=Wr(m),S=Wr(l)*w,E=Hr(l)*w,T=Hr(m),D=T*n+S*r;return[Gf(E*i-D*a,S*n-T*r),jc(D*i+E*a)]}return c.invert=function(l,m){var w=Wr(m),S=Wr(l)*w,E=Hr(l)*w,T=Hr(m),D=T*i-E*a;return[Gf(E*i+T*a,S*n+D*r),jc(D*n-S*r)]},c}function OR(t,e,n,r,i,a){if(n){var c=Wr(e),l=Hr(e),m=r*n;i==null?(i=e+r*xl,a=e-m/2):(i=x2(c,i),a=x2(c,a),(r>0?ia)&&(i+=r*xl));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 zR(t,e,n,r,i,a){var c=t[0],l=t[1],m=e[0],w=e[1],S=0,E=1,T=m-c,D=w-l,k;if(k=n-c,!(!T&&k>0)){if(k/=T,T<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=i-c,!(!T&&k<0)){if(k/=T,T<0){if(k>E)return;k>S&&(S=k)}else if(T>0){if(k0)){if(k/=D,D<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=a-l,!(!D&&k<0)){if(k/=D,D<0){if(k>E)return;k>S&&(S=k)}else if(D>0){if(k0&&(t[0]=c+S*T,t[1]=l+S*D),E<1&&(e[0]=c+E*T,e[1]=l+E*D),!0}}}}}function Fg(t,e){return Wi(t[0]-e[0])=0;--l)i.point((E=S[l])[0],E[1]);else r(T.x,T.p.x,-1,i);T=T.p}T=T.o,S=T.z,D=!D}while(!T.v);i.lineEnd()}}}function w2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function FR(t){return t.length===1&&(t=BR(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 BR(t){return function(e,n){return EC(t(e),n)}}FR(EC);function IC(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 vd=1e9,Eg=-vd;function VR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,E,T){var D=0,k=0;if(w==null||(D=c(w,E))!==(k=c(S,E))||m(w,S)<0^E>0)do T.point(D===0||D===3?t:n,D>1?r:e);while((D=(D+E+4)%4)!==k);else T.point(S[0],S[1])}function c(w,S){return Wi(w[0]-t)0?0:3:Wi(w[0]-n)0?2:1:Wi(w[1]-e)0?1:0:S>0?3:2}function l(w,S){return m(w.x,S.x)}function m(w,S){var E=c(w,1),T=c(S,1);return E!==T?E-T:E===0?S[1]-w[1]:E===1?w[0]-S[0]:E===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,E=wC(),T,D,k,U,q,ee,V,j,Q,$,me,de={point:re,lineStart:oe,lineEnd:Xe,polygonStart:Ce,polygonEnd:H};function re(Ue,$e){i(Ue,$e)&&S.point(Ue,$e)}function se(){for(var Ue=0,$e=0,qe=D.length;$er&&(Fn-kt)*(r-un)>(bn-un)*(t-kt)&&++Ue:bn<=r&&(Fn-kt)*(r-un)<(bn-un)*(t-kt)&&--Ue;return Ue}function Ce(){S=E,T=[],D=[],me=!0}function H(){var Ue=se(),$e=me&&Ue,qe=(T=IC(T)).length;($e||qe)&&(w.polygonStart(),$e&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),qe&&SC(T,l,Ue,a,w),w.polygonEnd()),S=w,T=D=k=null}function oe(){de.point=be,D&&D.push(k=[]),$=!0,Q=!1,V=j=NaN}function Xe(){T&&(be(U,q),ee&&Q&&E.rejoin(),T.push(E.result())),de.point=re,Q&&S.lineEnd()}function be(Ue,$e){var qe=i(Ue,$e);if(D&&k.push([Ue,$e]),$)U=Ue,q=$e,ee=qe,$=!1,qe&&(S.lineStart(),S.point(Ue,$e));else if(qe&&Q)S.point(Ue,$e);else{var zt=[V=Math.max(Eg,Math.min(vd,V)),j=Math.max(Eg,Math.min(vd,j))],Pt=[Ue=Math.max(Eg,Math.min(vd,Ue)),$e=Math.max(Eg,Math.min(vd,$e))];zR(zt,Pt,t,e,n,r)?(Q||(S.lineStart(),S.point(zt[0],zt[1])),S.point(Pt[0],Pt[1]),qe||S.lineEnd(),me=!1):qe&&(S.lineStart(),S.point(Ue,$e),me=!1)}V=Ue,j=$e,Q=qe}return de}}var L0=$u();function UR(t,e){var n=e[0],r=e[1],i=[Hr(n),-Wr(n),0],a=0,c=0;L0.reset();for(var l=0,m=t.length;l=0?1:-1,re=de*me,se=re>Zn,Ce=k*Q;if(L0.add(Gf(Ce*de*Hr(re),U*$+Ce*Wr(re))),a+=se?me+de*xl:me,se^T>=n^V>=n){var H=v_(jf(E),jf(ee));_v(H);var oe=v_(i,H);_v(oe);var Xe=(se^me>=0?-1:1)*jc(oe[2]);(r>Xe||r===Xe&&(H[0]||H[1]))&&(c+=se^me>=0?1:-1)}}return(a<-xr||aHd&&(Hd=t),ex_&&(x_=e)}$u();function CC(t,e,n,r){return function(i,a){var c=e(a),l=i.invert(r[0],r[1]),m=wC(),w=e(m),S=!1,E,T,D,k={point:U,lineStart:ee,lineEnd:V,polygonStart:function(){k.point=j,k.lineStart=Q,k.lineEnd=$,T=[],E=[]},polygonEnd:function(){k.point=U,k.lineStart=ee,k.lineEnd=V,T=IC(T);var me=UR(E,l);T.length?(S||(a.polygonStart(),S=!0),SC(T,qR,me,n,a)):me&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),T=E=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function U(me,de){var re=i(me,de);t(me=re[0],de=re[1])&&a.point(me,de)}function q(me,de){var re=i(me,de);c.point(re[0],re[1])}function ee(){k.point=q,c.lineStart()}function V(){k.point=U,c.lineEnd()}function j(me,de){D.push([me,de]);var re=i(me,de);w.point(re[0],re[1])}function Q(){w.lineStart(),D=[]}function $(){j(D[0][0],D[0][1]),w.lineEnd();var me=w.clean(),de=m.result(),re,se=de.length,Ce,H,oe;if(D.pop(),E.push(D),D=null,!!se){if(me&1){if(H=de[0],(Ce=H.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),re=0;re1&&me&2&&de.push(de.pop().concat(de.shift())),T.push(de.filter(jR))}}return k}}function jR(t){return t.length>1}function qR(t,e){return((t=t.x)[0]<0?t[1]-pl-xr:pl-t[1])-((e=e.x)[0]<0?e[1]-pl-xr:pl-e[1])}const I2=CC(function(){return!0},WR,ZR,[-Zn,-pl]);function WR(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,c){var l=a>0?Zn:-Zn,m=Wi(a-e);Wi(m-Zn)0?pl:-pl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(a,n),i=0):r!==l&&m>=Zn&&(Wi(e-r)xr?DR((Hr(e)*(a=Wr(r))*Hr(n)-Hr(r)*(i=Wr(e))*Hr(t))/(i*a*c)):(e+r)/2}function ZR(t,e,n,r){var i;if(t==null)i=n*pl,r.point(-Zn,i),r.point(0,i),r.point(Zn,i),r.point(Zn,0),r.point(Zn,-i),r.point(0,-i),r.point(-Zn,-i),r.point(-Zn,0),r.point(-Zn,i);else if(Wi(t[0]-e[0])>xr){var a=t[0]0,i=Wi(n)>xr;function a(S,E,T,D){OR(D,t,e,T,S,E)}function c(S,E){return Wr(S)*Wr(E)>n}function l(S){var E,T,D,k,U;return{lineStart:function(){k=D=!1,U=1},point:function(q,ee){var V=[q,ee],j,Q=c(q,ee),$=r?Q?0:w(q,ee):Q?w(q+(q<0?Zn:-Zn),ee):0;if(!E&&(k=D=Q)&&S.lineStart(),Q!==D&&(j=m(E,V),(!j||Fg(E,j)||Fg(V,j))&&(V[0]+=xr,V[1]+=xr,Q=c(V[0],V[1]))),Q!==D)U=0,Q?(S.lineStart(),j=m(V,E),S.point(j[0],j[1])):(j=m(E,V),S.point(j[0],j[1]),S.lineEnd()),E=j;else if(i&&E&&r^Q){var me;!($&T)&&(me=m(V,E,!0))&&(U=0,r?(S.lineStart(),S.point(me[0][0],me[0][1]),S.point(me[1][0],me[1][1]),S.lineEnd()):(S.point(me[1][0],me[1][1]),S.lineEnd(),S.lineStart(),S.point(me[0][0],me[0][1])))}Q&&(!E||!Fg(E,V))&&S.point(V[0],V[1]),E=V,D=Q,T=$},lineEnd:function(){D&&S.lineEnd(),E=null},clean:function(){return U|(k&&D)<<1}}}function m(S,E,T){var D=jf(S),k=jf(E),U=[1,0,0],q=v_(D,k),ee=xg(q,q),V=q[0],j=ee-V*V;if(!j)return!T&&S;var Q=n*ee/j,$=-n*V/j,me=v_(U,q),de=wg(U,Q),re=wg(q,$);T0(de,re);var se=me,Ce=xg(de,se),H=xg(se,se),oe=Ce*Ce-H*(xg(de,de)-1);if(!(oe<0)){var Xe=tp(oe),be=wg(se,(-Ce-Xe)/H);if(T0(be,de),be=gv(be),!T)return be;var Ue=S[0],$e=E[0],qe=S[1],zt=E[1],Pt;$e0^be[1]<(Wi(be[0]-Ue)Zn^(Ue<=be[0]&&be[0]<=$e)){var un=wg(se,(-Ce+Xe)/H);return T0(un,de),[be,gv(un)]}}}function w(S,E){var T=r?t:Zn-t,D=0;return S<-T?D|=1:S>T&&(D|=2),E<-T?D|=4:E>T&&(D|=8),D}return CC(c,l,a,r?[0,-t]:[-Zn,t-Zn])}function TC(t){return function(e){var n=new vv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function vv(){}vv.prototype={constructor:vv,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 LC(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),RR(n,t.stream(E2));var c=E2.result(),l=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),m=+e[0][0]+(r-l*(c[1][0]+c[0][0]))/2,w=+e[0][1]+(i-l*(c[1][1]+c[0][1]))/2;return a!=null&&t.clipExtent(a),t.scale(l*150).translate([m,w])}function YR(t,e,n){return LC(t,[[0,0],e],n)}var C2=16,KR=Wr(30*Js);function T2(t,e){return+e?QR(t,e):JR(t)}function JR(t){return TC({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function QR(t,e){function n(r,i,a,c,l,m,w,S,E,T,D,k,U,q){var ee=w-r,V=S-i,j=ee*ee+V*V;if(j>4*e&&U--){var Q=c+T,$=l+D,me=m+k,de=tp(Q*Q+$*$+me*me),re=jc(me/=de),se=Wi(Wi(me)-1)e||Wi((ee*Xe+V*be)/j-.5)>.3||c*T+l*D+m*k2?be[2]%360*Js:0,oe()):[w*Mu,S*Mu,E*Mu]},se.precision=function(be){return arguments.length?(me=T2(H,$=be*be),Xe()):tp($)},se.fitExtent=function(be,Ue){return LC(se,be,Ue)},se.fitSize=function(be,Ue){return YR(se,be,Ue)};function oe(){D=xC(T=NR(w,S,E),e);var be=e(l,m);return a=r-be[0]*n,c=i+be[1]*n,Xe()}function Xe(){return de=re=null,se}return function(){return e=t.apply(this,arguments),se.invert=e.invert&&Ce,oe()}}function PC(t){return function(e,n){var r=Wr(e),i=Wr(n),a=t(r*i);return[a*i*Hr(e),a*Hr(n)]}}function MC(t){return function(e,n){var r=tp(e*e+n*n),i=t(r),a=Hr(i),c=Wr(i);return[Gf(e*a,r*c),jc(r&&n*a/r)]}}var nN=PC(function(t){return tp(2/(1+t))});nN.invert=MC(function(t){return 2*jc(t/2)});var AC=PC(function(t){return(t=bC(t))&&t/Hr(t)});AC.invert=MC(function(t){return t});function rN(){return eN(AC).scale(79.4188).clipAngle(180-.001)}function L2(t,e){return[t,e]}L2.invert=L2;function iN(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 HI(t,function(c){var l=Bg(c,e,r,i);l&&a.push(l)}),fv(a);case"FeatureCollection":return l2(t,function(c){var l=Bg(c,e,r,i);l&&l2(l,function(m){m&&a.push(m)})}),fv(a)}return Bg(t,e,r,i)}function Bg(t,e,n,r){var i=t.properties||{},a=t.type==="Feature"?t.geometry:t;if(a.type==="GeometryCollection"){var c=[];return HI(t,function(U){var q=Bg(U,e,n,r);q&&c.push(q)}),fv(c)}var l=oN(a),m={type:a.type,coordinates:DC(a.coordinates,l)},w=new h1,S=w.read(m),E=fR(pR(e,n),"meters"),T=Ei.bufferOp(S,E,r),D=new nC;if(T=D.write(T),!kC(T.coordinates)){var k={type:T.type,coordinates:RC(T.coordinates,l)};return k_(k,i)}}function kC(t){return Array.isArray(t[0])?kC(t[0]):isNaN(t[0])}function DC(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return DC(n,e)})}function RC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return RC(n,e)})}function oN(t){var e=mR(t).geometry.coordinates,n=[-e[0],-e[1]];return rN().rotate(n).scale(jo)}function sN(t,e){var n=h_(t),r=h_(e),i=t.properties||{},a=UI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?jI(a[0],i):qI(a,i)}function P2(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 M2(t,e){const n=sN({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=iN(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)P2(i);else for(const i of r.geometry.coordinates)for(const a of i)P2(a);e({type:"FeatureCollection",features:[r,n]})}let A2={type:"FeatureCollection",features:[]};function aN(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 l,m=[],w,S;function E(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:A2}),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()?E():t.once("load",()=>{E()});const T=k=>{l==null||l({type:"mapClick",coordinates:[k.lngLat.lng,k.lngLat.lat]})};function D(k=!1){if(!e)throw new Error;const U=document.createElement("div");return k&&U.classList.add("marker-interactive"),new OD({props:{displayIn:"maplibre"},target:U}),new e.Marker({element:U,offset:[1,-13]})}return{setEventHandler(k){k?(l=k,t.on("click",T)):(l=void 0,t.off("click",T))},flyTo(k,U){t.flyTo({center:k,zoom:U,...i})},fitBounds(k,U,q){t.fitBounds([[k[0],k[1]],[k[2],k[3]]],{padding:U,maxZoom:q,...a})},indicateReverse(k){t.getCanvasContainer().style.cursor=k?"crosshair":""},setReverseMarker(k){!e||!n||(S?k?S.setLngLat(k):(S.remove(),S=void 0):k&&(S=(typeof n=="object"?new e.Marker(n):D()).setLngLat(k).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(k,U){if(!n)return;function q(ee){var V;(V=t.getSource("full-geom"))==null||V.setData(ee)}for(const ee of m)ee.remove();if(m.length=0,q(A2),!!e){if(U){let ee=!1;if(U.geometry.type==="GeometryCollection"){const V=U.geometry.geometries.filter(j=>j.type==="Polygon"||j.type==="MultiPolygon");if(V.length>0){let j=V.pop();for(const Q of V)j=dR(j,Q);M2({...U,geometry:j},q),ee=!0}else{const j=U.geometry.geometries.filter(Q=>Q.type==="LineString"||Q.type==="MultiLineString");j.length>0&&(q({...U,geometry:{type:"GeometryCollection",geometries:j}}),ee=!0)}}if(!ee){if(U.geometry.type==="Polygon"||U.geometry.type==="MultiPolygon")M2(U,q);else if(U.geometry.type==="LineString"||U.geometry.type==="MultiLineString"){q(U);return}}n&&m.push((typeof n=="object"?new e.Marker(n):D()).setLngLat(U.center).addTo(t))}if(r)for(const ee of k??[]){if(ee===U)continue;const V=(typeof r=="object"?new e.Marker(r):D(!0)).setLngLat(ee.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(ee.place_type[0]==="reverse"?ee.place_name:ee.place_name.replace(/,.*/,""))).addTo(t),j=V.getElement();j.addEventListener("click",Q=>{Q.stopPropagation(),l==null||l({type:"markerClick",id:ee.id})}),j.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:ee.id}),V.togglePopup()}),j.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:ee.id}),V.togglePopup()}),m.push(V)}}},setSelectedMarker(k){w&&w.getElement().classList.toggle("marker-selected",!1),w=k>-1?m[k]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const k=t.getCenter();return[t.getZoom(),k.lng,k.lat]}}}function lN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("path"),Be(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"),Be(e,"viewBox","0 0 14 14"),Be(e,"width","13"),Be(e,"height","13"),Be(e,"class","svelte-en2qvf")},m(r,i){Me(r,e,i),we(e,n)},p:et,i:et,o:et,d(r){r&&Pe(e)}}}class NC extends Jt{constructor(e){super(),Kt(this,e,null,lN,jt,{})}}function uN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("path"),Be(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"),Be(e,"viewBox","0 0 30 30"),Be(e,"fill","none"),Be(e,"xmlns","http://www.w3.org/2000/svg"),Be(e,"class","svelte-d2loi5")},m(r,i){Me(r,e,i),we(e,n)},p:et,i:et,o:et,d(r){r&&Pe(e)}}}class OC extends Jt{constructor(e){super(),Kt(this,e,null,uN,jt,{})}}function cN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"area.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"area.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function hN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"reverse.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"reverse.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function fN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"poi.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"poi.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function pN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"postal_code.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"postal_code.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function dN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"street.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"street.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function mN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"road.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"road.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function gN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"housenumber.svg")||Be(e,"src",n),Be(e,"alt",t[6]),Be(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"housenumber.svg")&&Be(e,"src",n),i&64&&Be(e,"alt",r[6])},d(r){r&&Pe(e)}}}function _N(t){let e,n,r,i;return{c(){e=ke("img"),To(e.src,n=t[5])||Be(e,"src",n),Be(e,"alt",t[4]),Be(e,"class","svelte-ltkwvy")},m(a,c){Me(a,e,c),r||(i=Gt(e,"error",t[14]),r=!0)},p(a,c){c&32&&!To(e.src,n=a[5])&&Be(e,"src",n),c&16&&Be(e,"alt",a[4])},d(a){a&&Pe(e),r=!1,i()}}}function k2(t){let e,n;return{c(){e=ke("span"),n=vt(t[6]),Be(e,"class","secondary svelte-ltkwvy")},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&64&&Pn(n,r[6])},d(r){r&&Pe(e)}}}function yN(t){var de,re;let e,n,r,i,a,c,l,m,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,E,T=t[2]==="always"||t[2]&&!t[0].address&&((de=t[0].properties)==null?void 0:de.kind)!=="road"&&((re=t[0].properties)==null?void 0:re.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],D,k,U=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",q,ee,V;function j(se,Ce){var H,oe;return Ce&1&&(n=null),Ce&1&&(r=null),Ce&1&&(i=null),se[5]?_N:se[0].address?gN:((H=se[0].properties)==null?void 0:H.kind)==="road"||((oe=se[0].properties)==null?void 0:oe.kind)==="road_relation"?mN:(n==null&&(n=!!se[0].id.startsWith("address.")),n?dN:(r==null&&(r=!!se[0].id.startsWith("postal_code.")),r?pN:(i==null&&(i=!!se[0].id.startsWith("poi.")),i?fN:se[7]?hN:cN)))}let Q=j(t,-1),$=Q(t),me=T&&k2(t);return{c(){e=ke("li"),$.c(),a=ot(),c=ke("span"),l=ke("span"),m=ke("span"),S=vt(w),E=ot(),me&&me.c(),D=ot(),k=ke("span"),q=vt(U),Be(m,"class","primary svelte-ltkwvy"),Be(l,"class","svelte-ltkwvy"),Be(k,"class","line2 svelte-ltkwvy"),Be(c,"class","texts svelte-ltkwvy"),Be(e,"tabindex","0"),Be(e,"data-selected",t[1]),Be(e,"class","svelte-ltkwvy"),hl(e,"selected",t[1])},m(se,Ce){Me(se,e,Ce),$.m(e,null),we(e,a),we(e,c),we(c,l),we(l,m),we(m,S),we(l,E),me&&me.m(l,null),we(c,D),we(c,k),we(k,q),ee||(V=[Gt(e,"mouseenter",t[12]),Gt(e,"focus",t[13])],ee=!0)},p(se,[Ce]){var H,oe;Q===(Q=j(se,Ce))&&$?$.p(se,Ce):($.d(1),$=Q(se),$&&($.c(),$.m(e,a))),Ce&1&&w!==(w=(se[7]?se[0].place_name:se[0].place_name.replace(/,.*/,""))+"")&&Pn(S,w),Ce&37&&(T=se[2]==="always"||se[2]&&!se[0].address&&((H=se[0].properties)==null?void 0:H.kind)!=="road"&&((oe=se[0].properties)==null?void 0:oe.kind)!=="road_relation"&&!se[0].id.startsWith("address.")&&!se[0].id.startsWith("postal_code.")&&(!se[0].id.startsWith("poi.")||!se[5])&&!se[7]),T?me?me.p(se,Ce):(me=k2(se),me.c(),me.m(l,null)):me&&(me.d(1),me=null),Ce&1&&U!==(U=(se[7]?"":se[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Pn(q,U),Ce&2&&Be(e,"data-selected",se[1]),Ce&2&&hl(e,"selected",se[1])},i:et,o:et,d(se){se&&Pe(e),$.d(),me&&me.d(),ee=!1,xi(V)}}}function vN(t,e,n){var j;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:m}=e,{iconsBaseUrl:w}=e;const S=(j=a.properties)==null?void 0:j.categories;let E,T,D=0,k=a.place_type[0]==="reverse";function U(Q){T&&m.add(T),n(10,D++,D)}function q(Q){dn.call(this,t,Q)}function ee(Q){dn.call(this,t,Q)}const V=Q=>U(Q.currentTarget);return t.$$set=Q=>{"feature"in Q&&n(0,a=Q.feature),"selected"in Q&&n(1,c=Q.selected),"showPlaceType"in Q&&n(2,l=Q.showPlaceType),"missingIconsCache"in Q&&n(9,m=Q.missingIconsCache),"iconsBaseUrl"in Q&&n(3,w=Q.iconsBaseUrl)},t.$$.update=()=>{var Q,$,me,de;if(t.$$.dirty&3640)do n(11,r--,r),n(4,E=S==null?void 0:S[r]),n(5,T=E?w+E.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!T||m.has(T)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?($=(Q=a.properties)==null?void 0:Q.categories)==null?void 0:$.join(", "):((de=(me=a.properties)==null?void 0:me.place_type_name)==null?void 0:de[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,c,l,w,E,T,i,k,U,m,D,r,q,ee,V]}class bN extends Jt{constructor(e){super(),Kt(this,e,vN,yN,jt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function xN(t){let e;return{c(){e=ke("div"),e.innerHTML='',Be(e,"class","svelte-7cmwmc")},m(n,r){Me(n,e,r)},p:et,i:et,o:et,d(n){n&&Pe(e)}}}class wN extends Jt{constructor(e){super(),Kt(this,e,null,xN,jt,{})}}function SN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("path"),Be(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"),Be(e,"viewBox","0 0 60.006 21.412"),Be(e,"width","14"),Be(e,"height","20"),Be(e,"class","svelte-en2qvf")},m(r,i){Me(r,e,i),we(e,n)},p:et,i:et,o:et,d(r){r&&Pe(e)}}}class EN extends Jt{constructor(e){super(),Kt(this,e,null,SN,jt,{})}}function IN(t){let e,n,r;return{c(){e=Yl("svg"),n=Yl("circle"),r=Yl("path"),Be(n,"cx","4.789"),Be(n,"cy","4.787"),Be(n,"r","3.85"),Ii(n,"stroke-width","1.875"),Ii(n,"fill","none"),Be(r,"d","M12.063 12.063 7.635 7.635"),Ii(r,"stroke-width","1.875"),Ii(r,"stroke-linecap","round"),Be(e,"xmlns","http://www.w3.org/2000/svg"),Be(e,"width","13"),Be(e,"height","13"),Be(e,"viewBox","0 0 13 13"),Be(e,"class","svelte-1bpbt60")},m(i,a){Me(i,e,a),we(e,n),we(e,r)},p:et,i:et,o:et,d(i){i&&Pe(e)}}}class CN extends Jt{constructor(e){super(),Kt(this,e,null,IN,jt,{})}}function TN(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 D2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!cd.coords)break e;return cd.coords}let a;try{return a=await new Promise((c,l)=>{n.signal.addEventListener("abort",()=>{l(Error("aborted"))}),navigator.geolocation.getCurrentPosition(m=>{c([m.coords.longitude,m.coords.latitude].map(w=>w.toFixed(6)).join(","))},m=>{l(m)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(cd={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 R2=/(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,N2=/(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,O2=/(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,z2=/(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 PN(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=F2(e[0],t),r=F2(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 F2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=MN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${l}'`}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 MN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function b1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],l=!1;if(R2.test(t))if(c=R2.exec(t),l=Ig(c),l){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(N2.test(t))if(c=N2.exec(t),l=Ig(c),l)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(O2.test(t))if(c=O2.exec(t),l=Ig(c),l)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(z2.test(t))if(c=z2.exec(t),l=Ig(c),l)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(l){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 m=/S|SOUTH/i;m.test(i)&&n>0&&(n=-1*n),m=/W|WEST/i,m.test(a)&&r>0&&(r=-1*r);const w=c[0].trim();let S,E;const T=/[,/;\u0020]/g,D=w.match(T);if(D==null){const q=Math.floor(t.length/2);S=w.substring(0,q).trim(),E=w.substring(q).trim()}else{let q;D.length%2==1?q=Math.floor(D.length/2):q=D.length/2-1;let ee=0;if(q==0)ee=w.indexOf(D[0]),S=w.substring(0,ee).trim(),E=w.substring(ee+1).trim();else{let V=0,j=0;for(;V<=q;)ee=w.indexOf(D[V],j),j=ee+1,V++;S=w.substring(0,ee).trim(),E=w.substring(ee+1).trim()}}const k=S.split(".");if(k.length==2&&k[1]==0&&k[1].length!=2)throw new Error("invalid coordinates format");const U=E.split(".");if(U.length==2&&U[1]==0&&U[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(E))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:E,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:AN,toCoordinateFormat:PN})}else throw new Error("coordinates pattern match failed")}function Ig(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,...RN})}),[...t,...NN,...ON]}const FN=zN();b1.formats=FN.map(t=>t.verbatimCoordinates);const BN=b1;function V2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function U2(t){let e,n;return e=new wN({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function G2(t){let e,n,r,i,a;return n=new EN({}),{c(){e=ke("button"),it(n.$$.fragment),Be(e,"type","button"),Be(e,"title",t[9]),Be(e,"class","svelte-zh3kmv"),hl(e,"active",t[0])},m(c,l){Me(c,e,l),tt(n,e,null),r=!0,i||(a=Gt(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Be(e,"title",c[9]),(!r||l[0]&1)&&hl(e,"active",c[0])},i(c){r||(_e(n.$$.fragment,c),r=!0)},o(c){Se(n.$$.fragment,c),r=!1},d(c){c&&Pe(e),nt(n),i=!1,a()}}}function VN(t){let e,n=[],r=new Map,i,a,c,l=zr(t[14]);const m=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{de=null}),An()),(!j||Ue[0]&2)&&hl(w,"displayable",be[1]!==""),be[5]===!0?re?(re.p(be,Ue),Ue[0]&32&&_e(re,1)):(re=G2(be),re.c(),_e(re,1),re.m(r,k)):re&&(Mn(),Se(re,1,1,()=>{re=null}),An()),Ce&&Ce.p&&(!j||Ue[1]&134217728)&&Kr(Ce,se,be,be[58],j?Yr(se,be[58],Ue,null):Jr(be[58]),null);let $e=q;q=Xe(be),q===$e?~q&&oe[q].p(be,Ue):(ee&&(Mn(),Se(oe[$e],1,1,()=>{oe[$e]=null}),An()),~q?(ee=oe[q],ee?ee.p(be,Ue):(ee=oe[q]=H[q](be),ee.c()),_e(ee,1),ee.m(n,null)):ee=null),(!j||Ue[0]&4&&V!==(V=Vg(be[2])+" svelte-zh3kmv"))&&Be(n,"class",V),(!j||Ue[0]&22)&&hl(n,"can-collapse",be[4]&&be[1]==="")},i(be){j||(_e(me),_e(a.$$.fragment,be),_e(E.$$.fragment,be),_e(de),_e(re),_e(Ce,be),_e(ee),j=!0)},o(be){Se(me),Se(a.$$.fragment,be),Se(E.$$.fragment,be),Se(de),Se(re),Se(Ce,be),Se(ee),j=!1},d(be){be&&(Pe(e),Pe(n)),nt(a),t[61](null),nt(E),de&&de.d(),re&&re.d(),Ce&&Ce.d(be),~q&&oe[q].d(),Q=!1,xi($)}}}function WN(t,e,n){let r,{$$slots:i={},$$scope:a}=e,{class:c=void 0}=e,{apiKey:l}=e,{bbox:m=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:E=!1}=e,{country:T=void 0}=e,{debounceSearch:D=200}=e,{enableReverse:k=!1}=e,{errorMessage:U="Something went wrong…"}=e,{filter:q=()=>!0}=e,{flyTo:ee=!0}=e,{fuzzyMatch:V=!0}=e,{language:j=void 0}=e,{limit:Q=void 0}=e,{mapController:$=void 0}=e,{minLength:me=2}=e,{noResultsMessage:de="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:re="Search"}=e,{proximity:se=[{type:"server-geolocation"}]}=e,{reverseActive:Ce=k==="always"}=e,{reverseButtonTitle:H="toggle reverse geocoding"}=e,{searchValue:oe=""}=e,{showFullGeometry:Xe=!0}=e,{showPlaceType:be="ifNeeded"}=e,{showResultsWhileTyping:Ue=!0}=e,{selectFirst:$e=!0}=e,{flyToSelected:qe=!1}=e,{markerOnSelected:zt=!0}=e,{types:Pt=void 0}=e,{excludeTypes:Zt=!1}=e,{zoom:Xt=16}=e,{maxZoom:kt=18}=e,{apiUrl:un="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Fn={}}=e,{iconsBaseUrl:bn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:mn=J=>{}}=e;function Bn(){Oe.focus()}function ir(){Oe.blur()}function $r(J,Ie=!0){n(1,oe=J),Ie?(n(15,en=-1),Cl()):(ei(),setTimeout(()=>{Oe.focus(),Oe.select()}))}function gr(){n(14,ie=void 0),n(55,_t=void 0),n(15,en=-1)}function ur(){n(54,Te=[]),n(55,_t=void 0)}let or=!1,ie,Te,_t,xn="",Oe,en=-1,Dr,fn=[],er,Do,gs,Vs;const Ha=new Set,Ai=Yu();us(()=>{$&&($.setEventHandler(void 0),$.indicateReverse(!1),$.setSelectedMarker(-1),$.setMarkers(void 0,void 0))});function Cl(J){if(Do&&(clearTimeout(Do),Do=void 0),en>-1&&ie)n(55,_t=ie[en]),n(1,oe=_t.place_type[0]==="reverse"?_t.place_name:_t.place_name.replace(/,.*/,"")),n(18,Dr=void 0),n(54,Te=void 0),n(15,en=-1);else if(oe){const Ie=J||!_s(oe);at(oe,{exact:!0}).then(()=>{n(54,Te=ie),n(55,_t=void 0),Ie&&Qo()}).catch(ye=>n(18,Dr=ye))}}function _s(J){try{return BN(J,6)}catch{return!1}}async function at(J,{byId:Ie=!1,exact:ye=!1}={}){n(18,Dr=void 0),er==null||er.abort();const De=new AbortController;n(19,er=De);try{const Ge=_s(J),He=new URLSearchParams;if(j!==void 0&&He.set("language",Array.isArray(j)?j.join(","):j??""),Pt&&He.set("types",Pt.join(",")),Zt&&He.set("excludeTypes",String(Zt)),m&&He.set("bbox",m.map(Yt=>Yt.toFixed(6)).join(",")),T&&He.set("country",Array.isArray(T)?T.join(","):T),!Ie&&!Ge){const Yt=await LN($,se,De);Yt&&He.set("proximity",Yt),(ye||!Ue)&&He.set("autocomplete","false"),He.set("fuzzyMatch",String(V))}Q!==void 0&&(!Ge||(Pt==null?void 0:Pt.length)===1)&&He.set("limit",String(Q)),He.set("key",l),mn(He);const Ye=un+"/"+encodeURIComponent(Ge?Ge.decimalLongitude+","+Ge.decimalLatitude:J)+".json?"+He.toString();if(Ye===xn){Ie?(n(14,ie=void 0),n(55,_t=fn[0])):n(14,ie=fn);return}xn=Ye;const Mt=await fetch(Ye,{signal:De.signal,...Fn});if(!Mt.ok)throw new Error(await Mt.text());const Rt=await Mt.json();Ai("response",{url:Ye,featureCollection:Rt}),Ie?(n(14,ie=void 0),n(55,_t=Rt.features[0]),fn=[_t]):(n(14,ie=Rt.features.filter(q)),Ge&&ie.unshift({type:"Feature",properties:{},id:"reverse_"+Ge.decimalLongitude+"_"+Ge.decimalLatitude,text:Ge.decimalLatitude+", "+Ge.decimalLongitude,place_name:Ge.decimalLatitude+", "+Ge.decimalLongitude,place_type:["reverse"],center:[Ge.decimalLongitude,Ge.decimalLatitude],bbox:[Ge.decimalLongitude,Ge.decimalLatitude,Ge.decimalLongitude,Ge.decimalLatitude],geometry:{type:"Point",coordinates:[Ge.decimalLongitude,Ge.decimalLatitude]}}),fn=ie,Ge&&Oe.focus())}catch(Ge){if(Ge&&typeof Ge=="object"&&"name"in Ge&&Ge.name==="AbortError")return;throw Ge}finally{De===er&&n(19,er=void 0)}}function Qo(){var ye;if(!(Te!=null&&Te.length)||!ee)return;const J=[180,90,-180,-90],Ie=!Te.some(De=>!De.matching_text);for(const De of Te)if(Ie||!De.matching_text)for(const Ge of[0,1,2,3])J[Ge]=Math[Ge<2?"min":"max"](J[Ge],((ye=De.bbox)==null?void 0:ye[Ge])??De.center[Ge%2]);$&&Te.length>0&&(_t&&J[0]===J[2]&&J[1]===J[3]?$.flyTo(_t.center,Xt):$.fitBounds(D2(J),50,kt))}function $i(J){n(0,Ce=k==="always"),n(14,ie=void 0),n(55,_t=void 0),n(15,en=-1),$r(J[1].toFixed(6)+", "+TN(J[0],[-180,180],!0).toFixed(6),!1)}function Tl(J){if(!ie)return;let Ie=J.key==="ArrowDown"?1:J.key==="ArrowUp"?-1:0;Ie&&(en===($e?0:-1)&&Ie===-1&&n(15,en=ie.length),n(15,en+=Ie),en>=ie.length&&n(15,en=-1),en<0&&$e&&n(15,en=0),J.preventDefault())}function ei(J=!0){if(n(18,Dr=void 0),Ue){if(Do&&clearTimeout(Do),oe.length{at(Ie).catch(ye=>n(18,Dr=ye))},J?D:0)}else n(14,ie=void 0),n(18,Dr=void 0)}function ft(J){n(55,_t=J),n(1,oe=J.place_name),n(15,en=-1)}const on=()=>Oe.focus();function nn(J){jn[J?"unshift":"push"](()=>{Oe=J,n(17,Oe)})}function Rr(){oe=this.value,n(1,oe),n(13,or),n(27,S)}const $o=()=>n(13,or=!0),tn=()=>n(13,or=!1),xa=()=>ei(),Vr=()=>{n(1,oe=""),Oe.focus()},he=()=>n(0,Ce=!Ce),B=()=>n(18,Dr=void 0),W=J=>n(15,en=J),K=J=>ft(J),ae=()=>{$e||n(15,en=-1)},Ee=()=>{};return t.$$set=J=>{"class"in J&&n(2,c=J.class),"apiKey"in J&&n(25,l=J.apiKey),"bbox"in J&&n(26,m=J.bbox),"clearButtonTitle"in J&&n(3,w=J.clearButtonTitle),"clearOnBlur"in J&&n(27,S=J.clearOnBlur),"collapsed"in J&&n(4,E=J.collapsed),"country"in J&&n(28,T=J.country),"debounceSearch"in J&&n(29,D=J.debounceSearch),"enableReverse"in J&&n(5,k=J.enableReverse),"errorMessage"in J&&n(6,U=J.errorMessage),"filter"in J&&n(30,q=J.filter),"flyTo"in J&&n(31,ee=J.flyTo),"fuzzyMatch"in J&&n(32,V=J.fuzzyMatch),"language"in J&&n(33,j=J.language),"limit"in J&&n(34,Q=J.limit),"mapController"in J&&n(35,$=J.mapController),"minLength"in J&&n(36,me=J.minLength),"noResultsMessage"in J&&n(7,de=J.noResultsMessage),"placeholder"in J&&n(8,re=J.placeholder),"proximity"in J&&n(37,se=J.proximity),"reverseActive"in J&&n(0,Ce=J.reverseActive),"reverseButtonTitle"in J&&n(9,H=J.reverseButtonTitle),"searchValue"in J&&n(1,oe=J.searchValue),"showFullGeometry"in J&&n(38,Xe=J.showFullGeometry),"showPlaceType"in J&&n(10,be=J.showPlaceType),"showResultsWhileTyping"in J&&n(39,Ue=J.showResultsWhileTyping),"selectFirst"in J&&n(11,$e=J.selectFirst),"flyToSelected"in J&&n(40,qe=J.flyToSelected),"markerOnSelected"in J&&n(41,zt=J.markerOnSelected),"types"in J&&n(42,Pt=J.types),"excludeTypes"in J&&n(43,Zt=J.excludeTypes),"zoom"in J&&n(44,Xt=J.zoom),"maxZoom"in J&&n(45,kt=J.maxZoom),"apiUrl"in J&&n(46,un=J.apiUrl),"fetchParameters"in J&&n(47,Fn=J.fetchParameters),"iconsBaseUrl"in J&&n(12,bn=J.iconsBaseUrl),"adjustUrlQuery"in J&&n(48,mn=J.adjustUrlQuery),"$$scope"in J&&n(58,a=J.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,gs=or),S&&!or&&n(1,oe="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&oe.lengthn(18,Dr=J)),t.$$.dirty[1]&50356241&&($&&_t&&_t.id!==Vs&&ee&&(!_t.bbox||_t.bbox[0]===_t.bbox[2]&&_t.bbox[1]===_t.bbox[3]?$.flyTo(_t.center,_t.id.startsWith("poi.")||_t.id.startsWith("address.")?kt:Xt):$.fitBounds(D2(_t.bbox),50,kt),n(14,ie=void 0),n(54,Te=void 0),n(15,en=-1)),n(56,Vs=_t==null?void 0:_t.id)),t.$$.dirty[0]&18432&&$e&&ie!=null&&ie.length&&n(15,en=0),t.$$.dirty[0]&2050&&($e||n(15,en=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Te!==ie&&n(54,Te=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&$&&$.setEventHandler(J=>{switch(J.type){case"mapClick":Ce&&$i(J.coordinates);break;case"markerClick":{const Ie=ie==null?void 0:ie.find(ye=>ye.id===J.id);Ie&&ft(Ie)}break;case"markerMouseEnter":Te&&n(15,en=gs?(ie==null?void 0:ie.findIndex(Ie=>Ie.id===J.id))??-1:-1);break;case"markerMouseLeave":Te&&n(15,en=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ie==null?void 0:ie[en]),t.$$.dirty[1]&67133969&&$&&r&&ee&&qe&&$.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?kt:Xt),t.$$.dirty[1]&1040&&(zt||$==null||$.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&$&&zt&&!Te&&($.setMarkers(r?[r]:void 0,void 0),$.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&$&&$.setMarkers(Te,_t),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Te&&$&&$.setSelectedMarker(en),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&$){const J=_s(oe);$.setReverseMarker(J?[J.decimalLongitude,J.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Ai("select",r),t.$$.dirty[1]&16777216&&Ai("pick",_t),t.$$.dirty[0]&81920&&Ai("optionsVisibilityChange",gs&&!!ie),t.$$.dirty[0]&16384&&Ai("featuresListed",ie),t.$$.dirty[1]&8388608&&Ai("featuresMarked",Te),t.$$.dirty[0]&1&&Ai("reverseToggle",Ce),t.$$.dirty[0]&2&&Ai("queryChange",oe),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&$&&$.indicateReverse(Ce)},[Ce,oe,c,w,E,k,U,de,re,H,be,$e,bn,or,ie,en,gs,Oe,Dr,er,Ha,Cl,Tl,ei,ft,l,m,S,T,D,q,ee,V,j,Q,$,me,se,Xe,Ue,qe,zt,Pt,Zt,Xt,kt,un,Fn,mn,Bn,ir,$r,gr,ur,Te,_t,Vs,r,a,i,on,nn,Rr,$o,tn,xa,Vr,he,B,W,K,ae,Ee]}class HN extends Jt{constructor(e){super(),Kt(this,e,WN,qN,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 q2(t){let e,n,r;return n=new HN({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"class","svelte-ixhnie")},m(i,a){Me(i,e,a),tt(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||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function ZN(t){let e,n,r=t[1]&&q2(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&_e(r,1)):(r=q2(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function XN(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?aN(a,Ls):null)},[i,r,a]}class YN extends Jt{constructor(e){super(),Kt(this,e,XN,ZN,jt,{apiKey:0,map:2})}}const KN=Symbol.for("svelte-maplibre");function JN(){return Cv(KN)}function QN(t){return"layerType"in t&&t.layerType==="deckgl"}var qc=$N;function $N(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}),H2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function Z2(t){let e,n,r=(t[4]||t[3]instanceof Ls.Marker)&&X2(t);return{c(){e=ke("div"),r&&r.c()},m(i,a){Me(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Ls.Marker?r?(r.p(i,a),a[0]&24&&_e(r,1)):(r=X2(i),r.c(),_e(r,1),r.m(e,null)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(),t[32](null)}}}function X2(t){let e;const n=t[30].default,r=Xr(n,t,t[29],H2);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)&&Kr(r,n,i,i[29],e?Yr(n,i[29],a,nO):Jr(i[29]),H2)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function rO(t){let e,n,r=t[9].default&&Z2(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&_e(r,1)):(r=Z2(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function iO(t,e,n){let r,i,a,c,l,m,{$$slots:w={},$$scope:S}=e;const E=eP(w);let{closeButton:T=void 0}=e,{closeOnClickOutside:D=!0}=e,{closeOnClickInside:k=!1}=e,{closeOnMove:U=!1}=e,{openOn:q="click"}=e,{openIfTopMost:ee=!0}=e,{focusAfterOpen:V=!0}=e,{anchor:j=void 0}=e,{offset:Q=void 0}=e,{popupClass:$=void 0}=e,{maxWidth:me=void 0}=e,{lngLat:de=void 0}=e,{html:re=void 0}=e,{open:se=!1}=e;const Ce=Yu(),{map:H,popupTarget:oe,layerEvent:Xe,layer:be,eventTopMost:Ue}=JN();Ct(t,H,Te=>n(2,a=Te)),Ct(t,oe,Te=>n(3,l=Te)),Ct(t,Xe,Te=>n(28,c=Te)),Ct(t,be,Te=>n(35,m=Te));const $e=["click","dblclick","contextmenu"];let qe,zt=!1,Pt;function Zt(){if(!qe)return;let Te=qe.getElement();!Te||Te===Pt||(Pt=Te,q==="hover"&&(Pt.style.pointerEvents="none"),Pt.addEventListener("mouseenter",()=>{n(24,zt=!0)},{passive:!0}),Pt.addEventListener("mouseleave",()=>{n(24,zt=!1)},{passive:!0}),Pt.addEventListener("click",()=>{k&&n(0,se=!1)},{passive:!0}))}Xu(()=>{if(a)return a.on("click",gr),a.on("contextmenu",gr),typeof l=="string"&&(a.on("click",l,Fn),a.on("dblclick",l,Fn),a.on("contextmenu",l,Fn),a.on("mousemove",l,$r),a.on("mouseleave",l,ir),a.on("touchstart",l,mn),a.on("touchend",l,Bn)),()=>{a!=null&&a.loaded()&&(qe==null||qe.remove(),a.off("click",gr),a.off("contextmenu",gr),l instanceof Ls.Marker?l.getPopup()===qe&&l.setPopup(void 0):typeof l=="string"&&(a.off("click",l,Fn),a.off("dblclick",l,Fn),a.off("contextmenu",l,Fn),a.off("mousemove",l,$r),a.off("mouseleave",l,ir),a.off("touchstart",l,mn),a.off("touchend",l,Bn)))}});function Xt(Te){return ee?!("marker"in Te)&&!QN(Te)&&Ue(Te)!==m:!1}let kt=null,un="normal";function Fn(Te){Te.type===q&&(Xt(Te)||("layerType"in Te?Te.layerType==="deckgl"?(n(10,de=Te.coordinate),n(4,kt=Te.object?[Te.object]:null)):(n(10,de=Te.lngLat),n(4,kt=Te.features??[])):(n(10,de=Te.lngLat),n(4,kt=Te.features??[])),setTimeout(()=>n(0,se=!0))))}let bn=null;function mn(Te){bn=Te.point}function Bn(Te){if(!bn||q!=="hover")return;let _t=bn.dist(Te.point);bn=null,_t<3&&(n(10,de=Te.lngLat),n(4,kt=Te.features??[]),qe.isOpen()?n(25,un="justOpened"):(n(25,un="opening"),n(0,se=!0)))}function ir(Te){q!=="hover"||bn||un!=="normal"||(n(0,se=!1),n(4,kt=null))}function $r(Te){if(!(q!=="hover"||bn||un!=="normal")){if(Xt(Te)){n(0,se=!1),n(4,kt=null);return}n(0,se=!0),n(4,kt=Te.features??[]),n(10,de=Te.lngLat)}}function gr(Te){if(un==="justOpened"){n(25,un="normal");return}if(!D)return;let _t=[Pt,l instanceof Ls.Marker?l==null?void 0:l.getElement():null];se&&qe.isOpen()&&!_t.some(xn=>xn==null?void 0:xn.contains(Te.originalEvent.target))&&(Te.type==="contextmenu"&&q==="contextmenu"||Te.type!=="contextmenu")&&n(0,se=!1)}us(()=>{a&&(qe!=null&&qe.isOpen())&&qe.remove()});let ur;const or=()=>n(0,se=!1);function ie(Te){jn[Te?"unshift":"push"](()=>{ur=Te,n(1,ur)})}return t.$$set=Te=>{"closeButton"in Te&&n(11,T=Te.closeButton),"closeOnClickOutside"in Te&&n(12,D=Te.closeOnClickOutside),"closeOnClickInside"in Te&&n(13,k=Te.closeOnClickInside),"closeOnMove"in Te&&n(14,U=Te.closeOnMove),"openOn"in Te&&n(15,q=Te.openOn),"openIfTopMost"in Te&&n(16,ee=Te.openIfTopMost),"focusAfterOpen"in Te&&n(17,V=Te.focusAfterOpen),"anchor"in Te&&n(18,j=Te.anchor),"offset"in Te&&n(19,Q=Te.offset),"popupClass"in Te&&n(20,$=Te.popupClass),"maxWidth"in Te&&n(21,me=Te.maxWidth),"lngLat"in Te&&n(10,de=Te.lngLat),"html"in Te&&n(22,re=Te.html),"open"in Te&&n(0,se=Te.open),"$$scope"in Te&&n(29,S=Te.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=T??(!D&&!k)),t.$$.dirty[0]&146685952&&(qe||(n(23,qe=new Ls.Popup({closeButton:r,closeOnClick:!1,closeOnMove:U,focusAfterOpen:V,maxWidth:me,className:$,anchor:j,offset:Q})),Pt=qe.getElement(),qe.on("open",()=>{n(0,se=!0),Zt(),Ce("open",qe)}),qe.on("close",()=>{n(0,se=!1),Ce("close",qe)}),qe.on("hover",()=>{Ce("hover",qe)}))),t.$$.dirty[0]&8421384&&qe&&l instanceof Ls.Marker&&(q==="click"?l.setPopup(qe):l.getPopup()===qe&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&$e.includes(q)&&(c==null?void 0:c.type)===q&&(Fn(c),Gn(Xe,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=q==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&q==="hover"&&Xe&&(i&&c&&(c.layerType==="deckgl"?(n(10,de=c.coordinate),n(4,kt=c.object?[c.object]:null)):(n(10,de=c.lngLat),n(4,kt=c.features??[]))),n(0,se=(i||zt)??!1)),t.$$.dirty[0]&12582914&&(ur?qe.setDOMContent(ur):re&&qe.setHTML(re)),t.$$.dirty[0]&8389632&&de&&qe.setLngLat(de),t.$$.dirty[0]&41943045&&a){let Te=qe.isOpen();se&&!Te?(qe.addTo(a),un==="opening"&&n(25,un="justOpened")):!se&&Te&&qe.remove()}},[se,ur,a,l,kt,H,oe,Xe,be,E,de,T,D,k,U,q,ee,V,j,Q,$,me,re,qe,zt,un,i,r,c,S,w,or,ie]}class oO extends Jt{constructor(e){super(),Kt(this,e,iO,rO,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 om=Uint8Array,zC=Uint16Array,sO=Int32Array,aO=new om([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]),lO=new om([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]),FC=function(t,e){for(var n=new zC(31),r=0;r<31;++r)n[r]=e+=1<>1|(Qn&21845)<<1,jl=(jl&52428)>>2|(jl&13107)<<2,jl=(jl&61680)>>4|(jl&3855)<<4,hO[Qn]=((jl&65280)>>8|(jl&255)<<8)>>1;var jl,Qn,W_=new om(288);for(Qn=0;Qn<144;++Qn)W_[Qn]=8;var Qn;for(Qn=144;Qn<256;++Qn)W_[Qn]=9;var Qn;for(Qn=256;Qn<280;++Qn)W_[Qn]=7;var Qn;for(Qn=280;Qn<288;++Qn)W_[Qn]=8;var Qn,fO=new om(32);for(Qn=0;Qn<32;++Qn)fO[Qn]=5;var Qn,pO=new om(0),dO=typeof TextDecoder<"u"&&new TextDecoder,mO=0;try{dO.decode(pO,{stream:!0}),mO=1}catch{}const gO=t=>({props:t&8}),Y2=t=>({props:vO(t[3])});function _O(t){let e;const n=t[1].default,r=Xr(n,t,t[2],Y2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&Kr(r,n,i,i[2],e?Yr(n,i[2],a,gO):Jr(i[2]),Y2)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function yO(t){let e,n;return e=new oO({props:{openOn:t[0],$$slots:{default:[_O,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(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||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function vO(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function bO(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 eh extends Jt{constructor(e){super(),Kt(this,e,bO,yO,jt,{openOn:0})}}const xO=["==",["geometry-type"],"Polygon"],wO=["==",["geometry-type"],"LineString"];function w1(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 Wf(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(l=>{var m;return(m=t.get(l.layer.id))==null?void 0:m.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,a),a}}function IO(){let t=new Map;return Iv(S1,{map:tr(null),source:n0(null),layer:n0(null),popupTarget:n0(null),cluster:tr(),loadedImages:tr(new Set),minzoom:tr(0),maxzoom:tr(24),layerEvent:tr(null),layerInfo:t,eventTopMost:EO(t)})}function K2(t){return{subscribe:t.subscribe}}function E1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=rp(),a=tr(null),c=K2(a),l={...i,[t]:K2(a)};if(e&&(l.popupTarget=c),r){let m=tr(null);l.layerEvent=m,i.layerEvent=m}return n&&(l.cluster=tr()),Iv(S1,l),{...i,self:a}}function CO(){return E1({key:"source",setCluster:!0})}function TO(t=!0){return E1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function LO(){return E1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function J2(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 PO(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 MO(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Wc(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function Q2(t){let e=t[0],n,r,i=$2(t);return{c(){i.c(),n=Er()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c[0]&1&&jt(e,e=a[0])?(Mn(),Se(i,1,1,et),An(),i=$2(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function $2(t){let e;const n=t[36].default,r=Xr(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)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function AO(t){let e,n,r=t[0]&&Q2(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&_e(r,1)):(r=Q2(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function kO(t,e,n){let r,i,a,c,l,m,w,S,E,T,D,k,{$$slots:U={},$$scope:q}=e,{id:ee=np("layer")}=e,{source:V=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:Q=void 0}=e,{beforeLayerType:$=void 0}=e,{type:me}=e,{paint:de=void 0}=e,{layout:re=void 0}=e,{filter:se=void 0}=e,{applyToClusters:Ce=void 0}=e,{minzoom:H=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:Xe=!1}=e,{hovered:be=null}=e,{interactive:Ue=!0}=e,{hoverCursor:$e=void 0}=e,{eventsIfTopMost:qe=!1}=e;const zt=Yu(),{map:Pt,source:Zt,self:Xt,minzoom:kt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=TO();Ct(t,Pt,ie=>n(31,E=ie)),Ct(t,Zt,ie=>n(32,T=ie)),Ct(t,Xt,ie=>n(0,S=ie)),Ct(t,kt,ie=>n(34,k=ie)),Ct(t,un,ie=>n(33,D=ie)),us(()=>{S&&E&&(bn.delete(S),E==null||E.removeLayer(S))});let mn;function Bn(ie){var Oe,en;if(!Ue||!S||!E||qe&&Fn(ie)!==S)return;let Te=ie.features??[],_t=(en=(Oe=Te[0])==null?void 0:Oe.properties)==null?void 0:en.cluster_id,xn={event:ie,map:E,clusterId:_t,layer:S,source:l,features:Te};zt(ie.type,xn)}function ir(ie){var Oe,en;if(!Ue||!S||!E||qe&&Fn(ie)!==S)return;$e&&(E.getCanvas().style.cursor=$e);let Te=ie.features??[];n(6,be=Te[0]??null);let _t=(en=(Oe=Te[0])==null?void 0:Oe.properties)==null?void 0:en.cluster_id;zt("mouseenter",{event:ie,map:E,clusterId:_t,layer:S,source:l,features:Te})}function $r(ie){var Oe,en,Dr;if(!Ue||!E)return;if(qe&&Fn(ie)!==S){n(6,be=null),Xe&&mn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:j,id:mn},{hover:!1}),mn=void 0);return}E.getCanvas().style.cursor=$e;let Te=ie.features??[],_t=(en=(Oe=Te[0])==null?void 0:Oe.properties)==null?void 0:en.cluster_id,xn=(Dr=Te[0])==null?void 0:Dr.id;xn!==mn&&(Xe&&(mn!==void 0&&(E==null||E.setFeatureState({source:l,id:mn,sourceLayer:j},{hover:!1})),E==null||E.setFeatureState({source:l,id:xn,sourceLayer:j},{hover:!0})),mn=xn,n(6,be=Te[0]??null)),zt("mousemove",{event:ie,map:E,clusterId:_t,layer:S,source:l,features:Te})}function gr(ie){if(!(!Ue||!S||!E)){if($e&&(E.getCanvas().style.cursor=""),n(6,be=null),Xe&&mn!==void 0){const Te={source:l,id:mn,sourceLayer:j};E==null||E.setFeatureState(Te,{hover:!1}),mn=void 0}zt("mouseleave",{map:E,layer:S,source:l})}}let ur=!0;function or(ie){E&&(E.off("click",ie,Bn),E.off("dblclick",ie,Bn),E.off("contextmenu",ie,Bn),E.off("mouseenter",ie,ir),E.off("mousemove",ie,$r),E.off("mouseleave",ie,gr))}return us(()=>{E&&S&&or(S)}),t.$$set=ie=>{"id"in ie&&n(7,ee=ie.id),"source"in ie&&n(8,V=ie.source),"sourceLayer"in ie&&n(9,j=ie.sourceLayer),"beforeId"in ie&&n(10,Q=ie.beforeId),"beforeLayerType"in ie&&n(11,$=ie.beforeLayerType),"type"in ie&&n(12,me=ie.type),"paint"in ie&&n(13,de=ie.paint),"layout"in ie&&n(14,re=ie.layout),"filter"in ie&&n(15,se=ie.filter),"applyToClusters"in ie&&n(16,Ce=ie.applyToClusters),"minzoom"in ie&&n(17,H=ie.minzoom),"maxzoom"in ie&&n(18,oe=ie.maxzoom),"manageHoverState"in ie&&n(19,Xe=ie.manageHoverState),"hovered"in ie&&n(6,be=ie.hovered),"interactive"in ie&&n(20,Ue=ie.interactive),"hoverCursor"in ie&&n(21,$e=ie.hoverCursor),"eventsIfTopMost"in ie&&n(22,qe=ie.eventsIfTopMost),"$$scope"in ie&&n(35,q=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=MO(Ce)),t.$$.dirty[0]&1073774592&&n(24,i=PO("all",r,se)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=H??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=V||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==ee&&l){S&&(or(S),bn.delete(S));let ie=Q;if(!Q&&$){let Te=E.getStyle().layers,_t=typeof $=="function"?$:Oe=>Oe.type===$,xn=Te==null?void 0:Te.find(_t);xn&&(ie=xn.id)}Gn(Xt,S=ee,S),E.addLayer(qc({id:S,type:me,source:l,"source-layer":j,filter:i,paint:de,layout:re,minzoom:a,maxzoom:c}),ie),n(23,ur=!0),E.on("click",S,Bn),E.on("dblclick",S,Bn),E.on("contextmenu",S,Bn),E.on("mouseenter",S,ir),E.on("mousemove",S,$r),E.on("mouseleave",S,gr)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Ue}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,m=S?J2((ie,Te)=>E==null?void 0:E.setPaintProperty(S,ie,Te)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?J2((ie,Te)=>E==null?void 0:E.setLayoutProperty(S,ie,Te)):void 0),t.$$.dirty[0]&268443648&&(m==null||m(de)),t.$$.dirty[0]&134234112&&(w==null||w(re)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(E==null||E.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(ur?n(23,ur=!1):E==null||E.setFilter(S,i))},[S,Pt,Zt,Xt,kt,un,be,ee,V,j,Q,$,me,de,re,se,Ce,H,oe,Xe,Ue,$e,qe,ur,i,c,a,w,m,l,r,E,T,D,k,q,U]}let H_=class extends Jt{constructor(e){super(),Kt(this,e,kO,AO,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 DO(t){let e;const n=t[16].default,r=Xr(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)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function RO(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:[DO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.applyToClusters=c[9]),l&1024&&(m.minzoom=c[10]),l&2048&&(m.maxzoom=c[11]),l&4096&&(m.hoverCursor=c[12]),l&8192&&(m.manageHoverState=c[13]),l&16384&&(m.eventsIfTopMost=c[14]),l&32768&&(m.interactive=c[15]),l&16777216&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function NO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:V=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:Q=!0}=e;function $(oe){V=oe,n(0,V)}function me(oe){dn.call(this,t,oe)}function de(oe){dn.call(this,t,oe)}function re(oe){dn.call(this,t,oe)}function se(oe){dn.call(this,t,oe)}function Ce(oe){dn.call(this,t,oe)}function H(oe){dn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,a=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,m=oe.beforeId),"beforeLayerType"in oe&&n(5,w=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,T=oe.filter),"applyToClusters"in oe&&n(9,D=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,U=oe.maxzoom),"hoverCursor"in oe&&n(12,q=oe.hoverCursor),"manageHoverState"in oe&&n(13,ee=oe.manageHoverState),"hovered"in oe&&n(0,V=oe.hovered),"eventsIfTopMost"in oe&&n(14,j=oe.eventsIfTopMost),"interactive"in oe&&n(15,Q=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[V,a,c,l,m,w,S,E,T,D,k,U,q,ee,j,Q,r,$,me,de,re,se,Ce,H,i]}let Z_=class extends Jt{constructor(e){super(),Kt(this,e,NO,RO,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 OO(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function zO(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:[OO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.minzoom=c[9]),l&1024&&(m.maxzoom=c[10]),l&2048&&(m.hoverCursor=c[11]),l&4096&&(m.manageHoverState=c[12]),l&8192&&(m.eventsIfTopMost=c[13]),l&16384&&(m.interactive=c[14]),l&8388608&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function FO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:V=!1}=e,{interactive:j=!0}=e;function Q(H){ee=H,n(0,ee)}function $(H){dn.call(this,t,H)}function me(H){dn.call(this,t,H)}function de(H){dn.call(this,t,H)}function re(H){dn.call(this,t,H)}function se(H){dn.call(this,t,H)}function Ce(H){dn.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,l=H.sourceLayer),"beforeId"in H&&n(4,m=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,E=H.layout),"filter"in H&&n(8,T=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,k=H.maxzoom),"hoverCursor"in H&&n(11,U=H.hoverCursor),"manageHoverState"in H&&n(12,q=H.manageHoverState),"hovered"in H&&n(0,ee=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)},[ee,a,c,l,m,w,S,E,T,D,k,U,q,V,j,r,Q,$,me,de,re,se,Ce,i]}let I1=class extends Jt{constructor(e){super(),Kt(this,e,FO,zO,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 BO(t,e,n){let r;const{map:i}=rp();Ct(t,i,m=>n(4,r=m));let{position:a="top-left"}=e,{container:c=void 0}=e,l=null;return us(()=>{r!=null&&r.loaded()&&l&&r.removeControl(l)}),t.$$set=m=>{"position"in m&&n(1,a=m.position),"container"in m&&n(2,c=m.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!l){let m;typeof c=="string"?m=document.querySelector(c)??void 0:m=c,n(3,l=new Ls.FullscreenControl({container:m})),r.addControl(l,a)}},[i,a,c,l,r]}class VO extends Jt{constructor(e){super(),Kt(this,e,BO,null,jt,{position:1,container:2})}}function UO(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 l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function GO(t,e,n){dE().then(()=>{let r=uE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function eS(t){let e=t[0],n,r,i=tS(t);return{c(){i.c(),n=Er()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c&1&&jt(e,e=a[0])?(Mn(),Se(i,1,1,et),An(),i=tS(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function tS(t){let e;const n=t[19].default,r=Xr(n,t,t[18],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&262144)&&Kr(r,n,i,i[18],e?Yr(n,i[18],a,null):Jr(i[18]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function jO(t){let e,n,r=t[0]&&eS(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=eS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function qO(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:m=np("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:T=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:k=void 0}=e,{maxzoom:U=void 0}=e,{attribution:q=void 0}=e,{buffer:ee=void 0}=e,{tolerance:V=void 0}=e;const{map:j,cluster:Q,self:$}=CO();Ct(t,j,re=>n(17,i=re)),Ct(t,Q,re=>n(20,a=re)),Ct(t,$,re=>n(0,r=re));let me,de=!0;return us(()=>{r&&me&&i&&(GO(j,r,me),Gn($,r=null,r),n(15,me=void 0))}),t.$$set=re=>{"id"in re&&n(4,m=re.id),"data"in re&&n(5,w=re.data),"generateId"in re&&n(6,S=re.generateId),"promoteId"in re&&n(7,E=re.promoteId),"filter"in re&&n(8,T=re.filter),"lineMetrics"in re&&n(9,D=re.lineMetrics),"cluster"in re&&n(10,k=re.cluster),"maxzoom"in re&&n(11,U=re.maxzoom),"attribution"in re&&n(12,q=re.attribution),"buffer"in re&&n(13,ee=re.buffer),"tolerance"in re&&n(14,V=re.tolerance),"$$scope"in re&&n(18,l=re.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Gn(Q,a=k,a),t.$$.dirty&196593&&i&&r!==m&&(Gn($,r=m,r),UO(i,r,qc({type:"geojson",data:w,filter:T,lineMetrics:D,generateId:S,promoteId:E,cluster:!!k,clusterMinPoints:k==null?void 0:k.minPoints,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius,clusterProperties:k==null?void 0:k.properties,maxzoom:U,attribution:q,buffer:ee,tolerance:V}),re=>i&&re===r,()=>{r&&(n(15,me=i==null?void 0:i.getSource(r)),n(16,de=!0))})),t.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,me=i==null?void 0:i.getSource(m))})),t.$$.dirty&98336&&me&&(de?n(16,de=!1):me.setData(w)),t.$$.dirty&33792&&(me==null||me.setClusterOptions(qc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,j,Q,$,m,w,S,E,T,D,k,U,q,ee,V,me,de,i,l,c]}let ma=class extends Jt{constructor(e){super(),Kt(this,e,qO,jO,jt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function WO(t,e,n){let r;const{map:i}=rp();Ct(t,i,T=>n(8,r=T));let{position:a="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:l=void 0}=e,{trackUserLocation:m=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:S=!0}=e,{control:E=null}=e;return us(()=>{r!=null&&r.loaded()&&E&&r.removeControl(E)}),t.$$set=T=>{"position"in T&&n(2,a=T.position),"positionOptions"in T&&n(3,c=T.positionOptions),"fitBoundsOptions"in T&&n(4,l=T.fitBoundsOptions),"trackUserLocation"in T&&n(5,m=T.trackUserLocation),"showAccuracyCircle"in T&&n(6,w=T.showAccuracyCircle),"showUserLocation"in T&&n(7,S=T.showUserLocation),"control"in T&&n(1,E=T.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!E&&(n(1,E=new Ls.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:m,showAccuracyCircle:w,showUserLocation:S})),r.addControl(E,a))},[i,E,a,c,l,m,w,S,r]}class HO extends Jt{constructor(e){super(),Kt(this,e,WO,null,jt,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function ZO(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function XO(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:[ZO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.minzoom=c[9]),l&1024&&(m.maxzoom=c[10]),l&2048&&(m.hoverCursor=c[11]),l&4096&&(m.manageHoverState=c[12]),l&8192&&(m.eventsIfTopMost=c[13]),l&16384&&(m.interactive=c[14]),l&8388608&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function YO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:V=!1}=e,{interactive:j=!0}=e;function Q(H){ee=H,n(0,ee)}function $(H){dn.call(this,t,H)}function me(H){dn.call(this,t,H)}function de(H){dn.call(this,t,H)}function re(H){dn.call(this,t,H)}function se(H){dn.call(this,t,H)}function Ce(H){dn.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,l=H.sourceLayer),"beforeId"in H&&n(4,m=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,E=H.layout),"filter"in H&&n(8,T=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,k=H.maxzoom),"hoverCursor"in H&&n(11,U=H.hoverCursor),"manageHoverState"in H&&n(12,q=H.manageHoverState),"hovered"in H&&n(0,ee=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)},[ee,a,c,l,m,w,S,E,T,D,k,U,q,V,j,r,Q,$,me,de,re,se,Ce,i]}let lu=class extends Jt{constructor(e){super(),Kt(this,e,YO,XO,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 KO(t,e,n){let r;const i=Yu();let{layer:a=void 0}=e;const{map:c}=rp();Ct(t,c,S=>n(2,r=S));function l(S){i(S.type,{...S,map:c})}const m=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return us(()=>{if(r)if(a)for(const S of m)r.off(S,a,l);else for(const S of w)r.off(S,l)}),t.$$set=S=>{"layer"in S&&n(1,a=S.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(a)for(const S of m)r.on(S,a,l);else for(const S of w)r.on(S,l)},[c,a,r]}class JO extends Jt{constructor(e){super(),Kt(this,e,KO,null,jt,{layer:1})}}function QO(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,l=`${n}/${a}/${c}`,m=t.getBearing(),w=t.getPitch();return(m||w)&&(l+=`/${Math.round(m*10)/10}`),w&&(l+=`/${Math.round(w)}`),`#${l}`}function $O(t){return t.replace("#","").split("/").map(parseFloat)}function e5(t,e,n){let r;const{map:i}=rp();Ct(t,i,S=>n(6,r=S));let{position:a="top-left"}=e,{showCompass:c=!0}=e,{showZoom:l=!0}=e,{visualizePitch:m=!1}=e,w=null;return us(()=>{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,l=S.showZoom),"visualizePitch"in S&&n(4,m=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Ls.NavigationControl({showCompass:c,showZoom:l,visualizePitch:m})),r.addControl(w,a))},[i,a,c,l,m,w,r]}class t5 extends Jt{constructor(e){super(),Kt(this,e,e5,null,jt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function n5(t,e,n){let r;const{map:i}=rp();Ct(t,i,w=>n(5,r=w));let{position:a="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:l="metric"}=e,m=null;return us(()=>{r!=null&&r.loaded()&&m&&r.removeControl(m)}),t.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,c=w.maxWidth),"unit"in w&&n(3,l=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!m&&(n(4,m=new Ls.ScaleControl({maxWidth:c,unit:l})),r.addControl(m,a))},[i,a,c,l,m,r]}class r5 extends Jt{constructor(e){super(),Kt(this,e,n5,null,jt,{position:1,maxWidth:2,unit:3})}}const{window:i5}=tP,o5=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),nS=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function rS(t){let e,n,r=t[3]&&iS(t);const i=t[40].default,a=Xr(i,t,t[39],nS);return{c(){r&&r.c(),e=ot(),a&&a.c()},m(c,l){r&&r.m(c,l),Me(c,e,l),a&&a.m(c,l),n=!0},p(c,l){c[3]?r?(r.p(c,l),l[0]&8&&_e(r,1)):(r=iS(c),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An()),a&&a.p&&(!n||l[0]&112|l[1]&256)&&Kr(a,i,c,c[39],n?Yr(i,c[39],l,o5):Jr(c[39]),nS)},i(c){n||(_e(r),_e(a,c),n=!0)},o(c){Se(r),Se(a,c),n=!1},d(c){c&&Pe(e),r&&r.d(c),a&&a.d(c)}}}function iS(t){let e,n,r,i,a,c,l,m;return e=new t5({props:{position:t[7]}}),r=new HO({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new VO({props:{position:t[7]}}),l=new r5({props:{position:t[7]}}),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment),i=ot(),it(a.$$.fragment),c=ot(),it(l.$$.fragment)},m(w,S){tt(e,w,S),Me(w,n,S),tt(r,w,S),Me(w,i,S),tt(a,w,S),Me(w,c,S),tt(l,w,S),m=!0},p(w,S){const E={};S[0]&128&&(E.position=w[7]),e.$set(E);const T={};S[0]&128&&(T.position=w[7]),r.$set(T);const D={};S[0]&128&&(D.position=w[7]),a.$set(D);const k={};S[0]&128&&(k.position=w[7]),l.$set(k)},i(w){m||(_e(e.$$.fragment,w),_e(r.$$.fragment,w),_e(a.$$.fragment,w),_e(l.$$.fragment,w),m=!0)},o(w){Se(e.$$.fragment,w),Se(r.$$.fragment,w),Se(a.$$.fragment,w),Se(l.$$.fragment,w),m=!1},d(w){w&&(Pe(n),Pe(i),Pe(c)),nt(e,w),nt(r,w),nt(a,w),nt(l,w)}}}function s5(t){let e,n,r,i,a,c=t[4]&&t[0]&&rS(t);return{c(){e=ke("div"),c&&c.c(),Be(e,"class",n=Vg(t[2])+" svelte-p00lfq"),Be(e,"data-testid","map-container"),hl(e,"expand-map",!t[2])},m(l,m){Me(l,e,m),c&&c.m(e,null),t[41](e),r=!0,i||(a=[Gt(i5,"hashchange",t[11]),M0(t[10].call(null,e))],i=!0)},p(l,m){l[4]&&l[0]?c?(c.p(l,m),m[0]&17&&_e(c,1)):(c=rS(l),c.c(),_e(c,1),c.m(e,null)):c&&(Mn(),Se(c,1,1,()=>{c=null}),An()),(!r||m[0]&4&&n!==(n=Vg(l[2])+" svelte-p00lfq"))&&Be(e,"class",n),(!r||m[0]&4)&&hl(e,"expand-map",!l[2])},i(l){r||(_e(c),r=!0)},o(l){Se(c),r=!1},d(l){l&&Pe(e),c&&c.d(),t[41](null),i=!1,xi(a)}}}function a5(t,e,n){let r,i,a,c,{$$slots:l={},$$scope:m}=e,{map:w=null}=e,{mapContainer:S=void 0}=e,{class:E=void 0}=e,{style:T}=e,{diffStyleUpdates:D=!1}=e,{center:k=void 0}=e,{zoom:U=void 0}=e,{pitch:q=0}=e,{bearing:ee=0}=e,{bounds:V=void 0}=e,{hash:j=!1}=e,{updateHash:Q=ie=>{window.history.replaceState(window.history.state,"",ie)}}=e,{loaded:$=!1}=e,{minZoom:me=0}=e,{maxZoom:de=22}=e,{antialias:re=void 0}=e,{zoomOnDoubleClick:se=!0}=e,{locale:Ce=void 0}=e,{interactive:H=!0}=e,{attributionControl:oe=!0}=e,{cooperativeGestures:Xe=!1}=e,{preserveDrawingBuffer:be=!1}=e,{maxBounds:Ue=void 0}=e,{images:$e=[]}=e,{standardControls:qe=!1}=e,{filterLayers:zt=void 0}=e,{transformRequest:Pt=void 0}=e;const Zt=Yu(),{map:Xt,loadedImages:kt}=IO();Ct(t,Xt,ie=>n(4,a=ie)),Ct(t,kt,ie=>n(5,c=ie));let un=new Set;async function Fn(ie,Te=!1){if(a&&!(!a.loaded()&&!Te))if("url"in ie){un.add(ie.id);try{let _t=await a.loadImage(ie.url);a==null||a.addImage(ie.id,_t.data,ie.options),c.add(ie.id),kt.set(c)}catch(_t){Zt("error",_t)}finally{un.delete(ie.id)}}else a.addImage(ie.id,ie.data,ie.options),c.add(ie.id),kt.set(c)}let bn,mn,Bn,ir;function $r(ie){return ur(),Gn(Xt,a=new Ls.Map(qc({container:ie,style:T,locale:Ce,center:k,zoom:U,pitch:q,bearing:ee,minZoom:me,maxZoom:de,antialias:re,interactive:H,preserveDrawingBuffer:be,maxBounds:Ue,bounds:V,attributionControl:oe,transformRequest:Pt,cooperativeGestures:Xe})),a),a.on("load",Te=>{Te.target.getContainer().setAttribute("data-testid","map"),Te.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,$=!0),Zt("load",a)}),a.on("error",Te=>Zt("error",{...Te,map:a})),a.on("movestart",Te=>Zt("movestart",{...Te,map:a})),a.on("moveend",Te=>{if(n(12,k=Te.target.getCenter()),n(13,U=Te.target.getZoom()),n(14,q=Te.target.getPitch()),n(15,ee=Te.target.getBearing()),n(16,V=Te.target.getBounds()),Zt("moveend",{...Te,map:a}),j){let _t=new URL(window.location.href.replace(/(#.+)?$/,QO(a)));Q(_t)}}),a.on("click",Te=>Zt("click",{...Te,map:a})),a.on("dblclick",Te=>Zt("dblclick",{...Te,map:a})),a.on("contextmenu",Te=>Zt("contextmenu",{...Te,map:a})),a.on("zoomstart",Te=>Zt("zoomstart",{...Te,map:a})),a.on("zoom",Te=>{Zt("zoom",{...Te,map:a})}),a.on("zoomend",Te=>{Zt("zoomend",{...Te,map:a})}),a.on("style.load",()=>{if(a){const Te=a.getStyle();if(n(36,bn=Te.layers.map(_t=>_t.id)),n(37,mn=Object.keys(Te.sources)),ir)for(const[_t,xn]of Object.entries(ir))a.addSource(_t,xn);if(Bn)for(const _t of Bn)a.addLayer(_t);for(const _t of $e)Fn(_t,!0)}}),a.on("styledata",Te=>{if(a&&zt){const _t=a.getStyle().layers;if(_t)for(let xn of _t)zt(xn)||a.setLayoutProperty(xn.id,"visibility","none")}Zt("styledata",{...Te,map:a})}),{destroy(){n(0,$=!1),a==null||a.remove(),Gn(Xt,a=null,a)}}}let gr=T;function ur(){if(j){let ie=$O(window.location.hash);ie.length>=3&&(n(13,U=ie[0]),n(12,k=[ie[2],ie[1]])),ie.length==5&&(n(15,ee=ie[3]),n(14,q=ie[4]))}}function or(ie){jn[ie?"unshift":"push"](()=>{S=ie,n(1,S)})}return t.$$set=ie=>{"map"in ie&&n(17,w=ie.map),"mapContainer"in ie&&n(1,S=ie.mapContainer),"class"in ie&&n(2,E=ie.class),"style"in ie&&n(18,T=ie.style),"diffStyleUpdates"in ie&&n(19,D=ie.diffStyleUpdates),"center"in ie&&n(12,k=ie.center),"zoom"in ie&&n(13,U=ie.zoom),"pitch"in ie&&n(14,q=ie.pitch),"bearing"in ie&&n(15,ee=ie.bearing),"bounds"in ie&&n(16,V=ie.bounds),"hash"in ie&&n(20,j=ie.hash),"updateHash"in ie&&n(21,Q=ie.updateHash),"loaded"in ie&&n(0,$=ie.loaded),"minZoom"in ie&&n(22,me=ie.minZoom),"maxZoom"in ie&&n(23,de=ie.maxZoom),"antialias"in ie&&n(24,re=ie.antialias),"zoomOnDoubleClick"in ie&&n(25,se=ie.zoomOnDoubleClick),"locale"in ie&&n(26,Ce=ie.locale),"interactive"in ie&&n(27,H=ie.interactive),"attributionControl"in ie&&n(28,oe=ie.attributionControl),"cooperativeGestures"in ie&&n(29,Xe=ie.cooperativeGestures),"preserveDrawingBuffer"in ie&&n(30,be=ie.preserveDrawingBuffer),"maxBounds"in ie&&n(31,Ue=ie.maxBounds),"images"in ie&&n(32,$e=ie.images),"standardControls"in ie&&n(3,qe=ie.standardControls),"filterLayers"in ie&&n(33,zt=ie.filterLayers),"transformRequest"in ie&&n(34,Pt=ie.transformRequest),"$$scope"in ie&&n(39,m=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof qe=="boolean"?void 0:qe),t.$$.dirty[0]&16&&n(17,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&a&&!of(T,gr)){const ie=a.getStyle();if(bn&&(Bn=ie.layers.filter(Te=>!bn.includes(Te.id))),mn){const Te=Object.keys(ie.sources).filter(_t=>!mn.includes(_t));ir={};for(const _t of Te)ir[_t]=ie.sources[_t]}n(38,gr=T),a.setStyle(T,{diff:D}),Gn(kt,c=new Set,c),n(35,un=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&$&&a!=null&&a.loaded())for(let ie of $e)!c.has(ie.id)&&!un.has(ie.id)&&!a.hasImage(ie.id)&&Fn(ie);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,i=$e.every(ie=>c.has(ie.id))),t.$$.dirty[0]&61456&&a){let ie={};k!=null&&!of(k,a==null?void 0:a.getCenter())&&(ie.center=k),U!=null&&!of(U,a==null?void 0:a.getZoom())&&(ie.zoom=U),ee!=null&&!of(ee,a==null?void 0:a.getBearing())&&(ie.bearing=ee),q!=null&&!of(q,a==null?void 0:a.getPitch())&&(ie.pitch=q),Object.keys(ie).length&&a.easeTo(ie)}t.$$.dirty[0]&65552&&V&&!of(V,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(V)),t.$$.dirty[0]&33554448&&(se?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[$,S,E,qe,a,c,i,r,Xt,kt,$r,ur,k,U,q,ee,V,w,T,D,j,Q,me,de,re,se,Ce,H,oe,Xe,be,Ue,$e,zt,Pt,un,bn,mn,gr,m,l,or]}class l5 extends Jt{constructor(e){super(),Kt(this,e,a5,s5,jt,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const u5=t=>({marker:t&8}),oS=t=>({marker:t[3]});function c5(t){let e,n,r,i,a,c,l;const m=t[19].default,w=Xr(m,t,t[18],oS);return{c(){e=ke("div"),w&&w.c(),Be(e,"tabindex",n=t[1]?0:void 0),Be(e,"role",r=t[1]?"button":void 0),Ii(e,"z-index",t[2])},m(S,E){Me(S,e,E),w&&w.m(e,null),a=!0,c||(l=[M0(t[7].call(null,e)),M0(i=h5.call(null,e,t[0])),Gt(e,"click",e0(t[20])),Gt(e,"dblclick",e0(t[21])),Gt(e,"contextmenu",e0(t[22])),Gt(e,"mouseenter",t[23]),Gt(e,"mouseleave",t[24]),Gt(e,"mousemove",t[25]),Gt(e,"keydown",t[8])],c=!0)},p(S,[E]){w&&w.p&&(!a||E&262152)&&Kr(w,m,S,S[18],a?Yr(m,S[18],E,u5):Jr(S[18]),oS),(!a||E&2&&n!==(n=S[1]?0:void 0))&&Be(e,"tabindex",n),(!a||E&2&&r!==(r=S[1]?"button":void 0))&&Be(e,"role",r),i&&E_(i.update)&&E&1&&i.update.call(null,S[0]),E&4&&Ii(e,"z-index",S[2])},i(S){a||(_e(w,S),a=!0)},o(S){Se(w,S),a=!1},d(S){S&&Pe(e),w&&w.d(S),c=!1,xi(l)}}}function h5(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function f5(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{marker:m=void 0}=e,{lngLat:w}=e,{class:S=void 0}=e,{interactive:E=!0}=e,{asButton:T=!1}=e,{draggable:D=!1}=e,{feature:k=null}=e,{offset:U=void 0}=e,{zIndex:q=void 0}=e,{rotation:ee=0}=e,{opacity:V=1}=e;const j=Yu(),{map:Q,layerEvent:$,self:me}=LO();Ct(t,Q,qe=>n(27,a=qe)),Ct(t,$,qe=>n(26,r=qe)),Ct(t,me,qe=>n(3,i=qe));function de(qe){Gn(me,i=new Ls.Marker({element:qe,rotation:ee,draggable:D,offset:U,opacity:V.toString()}).setLngLat(w).addTo(a),i),n(11,m=i);const zt=()=>Ce("dragstart"),Pt=()=>{re(),Ce("drag")},Zt=()=>{re(),Ce("dragend")};return D&&(i.on("dragstart",zt),i.on("drag",Pt),i.on("dragend",Zt)),{destroy(){D&&(i==null||i.off("dragstart",zt),i==null||i.off("drag",Pt),i==null||i.off("dragend",Zt)),n(11,m=void 0),i==null||i.remove()}}}function re(){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 se(qe){qe.key===" "&&(qe.preventDefault(),qe.stopPropagation(),Ce("click"))}function Ce(qe){if(!E)return;let zt=i==null?void 0:i.getLngLat();if(!zt)return;const Pt=[zt.lng,zt.lat];let Zt={map:a,marker:i,lngLat:Pt,features:[{type:"Feature",properties:(k==null?void 0:k.properties)??{},geometry:{type:"Point",coordinates:Pt}}]};Gn($,r={...Zt,layerType:"marker",type:qe},r),j(qe,Zt)}const H=()=>Ce("click"),oe=()=>Ce("dblclick"),Xe=()=>Ce("contextmenu"),be=qe=>{Ce("mouseenter")},Ue=()=>{Ce("mouseleave")},$e=()=>Ce("mousemove");return t.$$set=qe=>{"marker"in qe&&n(11,m=qe.marker),"lngLat"in qe&&n(10,w=qe.lngLat),"class"in qe&&n(0,S=qe.class),"interactive"in qe&&n(12,E=qe.interactive),"asButton"in qe&&n(1,T=qe.asButton),"draggable"in qe&&n(13,D=qe.draggable),"feature"in qe&&n(14,k=qe.feature),"offset"in qe&&n(15,U=qe.offset),"zIndex"in qe&&n(2,q=qe.zIndex),"rotation"in qe&&n(16,ee=qe.rotation),"opacity"in qe&&n(17,V=qe.opacity),"$$scope"in qe&&n(18,l=qe.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(w)),t.$$.dirty&32776&&(i==null||i.setOffset(U??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(ee)),t.$$.dirty&131080&&(i==null||i.setOpacity(V.toString()))},[S,T,q,i,Q,$,me,de,se,Ce,w,m,E,D,k,U,ee,V,l,c,H,oe,Xe,be,Ue,$e]}class Zd extends Jt{constructor(e){super(),Kt(this,e,f5,c5,jt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function p5(t){let e;const n=t[16].default,r=Xr(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)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function d5(t){let e,n,r;function i(c){t[17](c)}let a={id:t[1],type:"symbol",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:[p5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.applyToClusters=c[9]),l&1024&&(m.minzoom=c[10]),l&2048&&(m.maxzoom=c[11]),l&4096&&(m.hoverCursor=c[12]),l&8192&&(m.manageHoverState=c[13]),l&16384&&(m.eventsIfTopMost=c[14]),l&32768&&(m.interactive=c[15]),l&16777216&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function m5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("symbol")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S=void 0}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:V=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:Q=!0}=e;function $(oe){V=oe,n(0,V)}function me(oe){dn.call(this,t,oe)}function de(oe){dn.call(this,t,oe)}function re(oe){dn.call(this,t,oe)}function se(oe){dn.call(this,t,oe)}function Ce(oe){dn.call(this,t,oe)}function H(oe){dn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,a=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,m=oe.beforeId),"beforeLayerType"in oe&&n(5,w=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,T=oe.filter),"applyToClusters"in oe&&n(9,D=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,U=oe.maxzoom),"hoverCursor"in oe&&n(12,q=oe.hoverCursor),"manageHoverState"in oe&&n(13,ee=oe.manageHoverState),"hovered"in oe&&n(0,V=oe.hovered),"eventsIfTopMost"in oe&&n(14,j=oe.eventsIfTopMost),"interactive"in oe&&n(15,Q=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[V,a,c,l,m,w,S,E,T,D,k,U,q,ee,j,Q,r,$,me,de,re,se,Ce,H,i]}class g5 extends Jt{constructor(e){super(),Kt(this,e,m5,d5,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})}}const _5=t=>({}),sS=t=>({}),y5=t=>({}),aS=t=>({}),v5=t=>({}),lS=t=>({});function b5(t){let e,n,r,i,a,c;const l=t[1].top,m=Xr(l,t,t[0],lS),w=t[1].left,S=Xr(w,t,t[0],aS),E=t[1].main,T=Xr(E,t,t[0],sS);return{c(){e=ke("div"),m&&m.c(),n=ot(),r=ke("div"),S&&S.c(),i=ot(),a=ke("div"),T&&T.c(),Be(e,"class","top svelte-mpick2"),Be(r,"class","left svelte-mpick2"),Be(a,"class","main svelte-mpick2")},m(D,k){Me(D,e,k),m&&m.m(e,null),Me(D,n,k),Me(D,r,k),S&&S.m(r,null),Me(D,i,k),Me(D,a,k),T&&T.m(a,null),c=!0},p(D,[k]){m&&m.p&&(!c||k&1)&&Kr(m,l,D,D[0],c?Yr(l,D[0],k,v5):Jr(D[0]),lS),S&&S.p&&(!c||k&1)&&Kr(S,w,D,D[0],c?Yr(w,D[0],k,y5):Jr(D[0]),aS),T&&T.p&&(!c||k&1)&&Kr(T,E,D,D[0],c?Yr(E,D[0],k,_5):Jr(D[0]),sS)},i(D){c||(_e(m,D),_e(S,D),_e(T,D),c=!0)},o(D){Se(m,D),Se(S,D),Se(T,D),c=!1},d(D){D&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a)),m&&m.d(D),S&&S.d(D),T&&T.d(D)}}}function x5(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class w5 extends Jt{constructor(e){super(),Kt(this,e,x5,b5,jt,{})}}const S5=t=>({}),uS=t=>({}),E5=t=>({}),cS=t=>({}),I5=t=>({}),hS=t=>({});function C5(t){let e,n,r,i,a,c;const l=t[4].top,m=Xr(l,t,t[3],hS),w=t[4].sidebar,S=Xr(w,t,t[3],cS),E=t[4].map,T=Xr(E,t,t[3],uS);return{c(){e=ke("div"),m&&m.c(),n=ot(),r=ke("div"),S&&S.c(),i=ot(),a=ke("div"),T&&T.c()},m(D,k){Me(D,e,k),m&&m.m(e,null),t[5](e),Me(D,n,k),Me(D,r,k),S&&S.m(r,null),t[6](r),Me(D,i,k),Me(D,a,k),T&&T.m(a,null),t[7](a),c=!0},p(D,[k]){m&&m.p&&(!c||k&8)&&Kr(m,l,D,D[3],c?Yr(l,D[3],k,I5):Jr(D[3]),hS),S&&S.p&&(!c||k&8)&&Kr(S,w,D,D[3],c?Yr(w,D[3],k,E5):Jr(D[3]),cS),T&&T.p&&(!c||k&8)&&Kr(T,E,D,D[3],c?Yr(E,D[3],k,S5):Jr(D[3]),uS)},i(D){c||(_e(m,D),_e(S,D),_e(T,D),c=!0)},o(D){Se(m,D),Se(S,D),Se(T,D),c=!1},d(D){D&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a)),m&&m.d(D),t[5](null),S&&S.d(D),t[6](null),T&&T.d(D),t[7](null)}}}function T5(t,e,n){let r,i,a;Ct(t,bv,E=>n(0,r=E)),Ct(t,xv,E=>n(1,i=E)),Ct(t,wv,E=>n(2,a=E));let{$$slots:c={},$$scope:l}=e;function m(E){jn[E?"unshift":"push"](()=>{r=E,bv.set(r)})}function w(E){jn[E?"unshift":"push"](()=>{i=E,xv.set(i)})}function S(E){jn[E?"unshift":"push"](()=>{a=E,wv.set(a)})}return t.$$set=E=>{"$$scope"in E&&n(3,l=E.$$scope)},[r,i,a,l,c,m,w,S]}class th extends Jt{constructor(e){super(),Kt(this,e,T5,C5,jt,{})}}let bv=tr(null),xv=tr(null),wv=tr(null);function fS(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[L5,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&48&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function L5(t){let e,n;return e=new Mv({props:{properties:t[4]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.properties=r[4]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function P5(t){let e,n,r=t[1]&&fS(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[1]?r?(r.p(i,a),a&2&&_e(r,1)):(r=fS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function M5(t){let e,n,r;function i(c){t[2](c)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Wc("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[P5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Z_({props:a}),jn.push(()=>Xi(e,"hovered",i)),e.$on("click",t[3]),{c(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&34&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function A5(t,e,n){let{hovered:r=null}=e,{popups:i=!1}=e;function a(l){r=l,n(0,r)}const c=l=>window.open(cs(l.detail.features[0].properties).osm_id,"_blank");return t.$$set=l=>{"hovered"in l&&n(0,r=l.hovered),"popups"in l&&n(1,i=l.popups)},[r,i,a,c]}class VC extends Jt{constructor(e){super(),Kt(this,e,A5,M5,jt,{hovered:0,popups:1})}}function pS(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function dS(t,e,n){const r=t.slice();return r[6]=e[n],r}function mS(t){let e,n,r=Zg(t[6])+"",i,a,c;return{c(){e=ke("li"),n=ke("a"),i=vt(r),c=ot(),Be(n,"href",a=t[6].properties.osm_id),Be(n,"target","_blank")},m(l,m){Me(l,e,m),we(e,n),we(n,i),we(e,c)},p(l,m){m&1&&r!==(r=Zg(l[6])+"")&&Pn(i,r),m&1&&a!==(a=l[6].properties.osm_id)&&Be(n,"href",a)},d(l){l&&Pe(e)}}}function gS(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",l,m,w,S,E,T=zr(t[3]),D=[];for(let k=0;ki[1].length-r[1].length),n}function D5(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 UC extends Jt{constructor(e){super(),Kt(this,e,D5,k5,jt,{gj:1})}}function yS(t,e,n){const r=t.slice();return r[3]=e[n],r}function vS(t){let e,n,r=zr(t[0]),i=[];for(let a=0;a0&&vS(t);return{c(){n&&n.c(),e=Er()},m(r,i){n&&n.m(r,i),Me(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=vS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:et,o:et,d(r){r&&Pe(e),n&&n.d(r)}}}function N5(t,e,n){let{loading:r}=e,i;function a(c){jn[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 GC extends Jt{constructor(e){super(),Kt(this,e,N5,R5,jt,{loading:0})}}function O5(t){let e,n,r,i,a,c,l,m,w,S,E,T,D,k,U,q,ee,V,j,Q,$,me,de,re,se,Ce,H,oe,Xe,be;return{c(){e=ke("nav"),n=ke("ul"),r=ke("li"),i=ke("button"),i.textContent="Change study area",a=ot(),c=ke("li"),l=ke("button"),m=vt("Isochrone"),S=ot(),E=ke("li"),T=ke("button"),D=vt("Route"),U=ot(),q=ke("li"),ee=ke("button"),V=vt("Score"),Q=ot(),$=ke("li"),me=ke("button"),de=vt("Debug network"),se=ot(),Ce=ke("label"),H=ke("input"),oe=vt("Population"),l.disabled=w=t[0].kind=="isochrone",T.disabled=k=t[0].kind=="route",ee.disabled=j=t[0].kind=="score",me.disabled=re=t[0].kind=="debug",Be(H,"type","checkbox")},m(Ue,$e){Me(Ue,e,$e),we(e,n),we(n,r),we(r,i),we(n,a),we(n,c),we(c,l),we(l,m),we(n,S),we(n,E),we(E,T),we(T,D),we(n,U),we(n,q),we(q,ee),we(ee,V),we(n,Q),we(n,$),we($,me),we(me,de),we(e,se),we(e,Ce),we(Ce,H),H.checked=t[1],we(Ce,oe),Xe||(be=[Gt(i,"click",t[2]),Gt(l,"click",t[3]),Gt(T,"click",t[4]),Gt(ee,"click",t[5]),Gt(me,"click",t[6]),Gt(H,"change",t[7])],Xe=!0)},p(Ue,[$e]){$e&1&&w!==(w=Ue[0].kind=="isochrone")&&(l.disabled=w),$e&1&&k!==(k=Ue[0].kind=="route")&&(T.disabled=k),$e&1&&j!==(j=Ue[0].kind=="score")&&(ee.disabled=j),$e&1&&re!==(re=Ue[0].kind=="debug")&&(me.disabled=re),$e&2&&(H.checked=Ue[1])},i:et,o:et,d(Ue){Ue&&Pe(e),Xe=!1,xi(be)}}}function z5(t,e,n){let r,i;Ct(t,Ts,E=>n(0,r=E)),Ct(t,O0,E=>n(1,i=E));const a=()=>Gn(Ts,r={kind:"title"},r),c=()=>Gn(Ts,r={kind:"isochrone"},r),l=()=>Gn(Ts,r={kind:"route"},r),m=()=>Gn(Ts,r={kind:"score"},r),w=()=>Gn(Ts,r={kind:"debug"},r);function S(){i=this.checked,O0.set(i)}return[r,i,a,c,l,m,w,S]}class sm extends Jt{constructor(e){super(),Kt(this,e,z5,O5,jt,{})}}function xS(t,e,n){const r=t.slice();return r[10]=e[n][0],r[11]=e[n][1],r[12]=e,r[13]=n,r}function F5(t){let e,n,r=t[0].join(", ")+"",i,a,c,l,m;return{c(){e=ke("p"),n=vt("Amenities: "),i=vt(r),a=ot(),c=ke("button"),c.textContent="Choose"},m(w,S){Me(w,e,S),we(e,n),we(e,i),Me(w,a,S),Me(w,c,S),l||(m=Gt(c,"click",t[6]),l=!0)},p(w,S){S&1&&r!==(r=w[0].join(", ")+"")&&Pn(i,r)},i:et,o:et,d(w){w&&(Pe(e),Pe(a),Pe(c)),l=!1,m()}}}function B5(t){let e,n;return e=new Pv({props:{$$slots:{default:[V5,({dialog:r})=>({9:r}),({dialog:r})=>r?512:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&16898&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function wS(t){let e,n,r,i=t[10]+"",a,c,l=t[11].num+"",m,w,S,E;function T(){t[3].call(n,t[12],t[13])}return{c(){e=ke("label"),n=ke("input"),r=ot(),a=vt(i),c=vt(" ("),m=vt(l),w=vt(`) - `),Be(n,"type","checkbox")},m(D,k){Me(D,e,k),we(e,n),n.checked=t[11].enabled,we(e,r),we(e,a),we(e,c),we(e,m),we(e,w),S||(E=Gt(n,"change",T),S=!0)},p(D,k){t=D,k&2&&(n.checked=t[11].enabled),k&2&&i!==(i=t[10]+"")&&Pn(a,i),k&2&&l!==(l=t[11].num+"")&&Pn(m,l)},d(D){D&&Pe(e),S=!1,E()}}}function V5(t){let e,n,r,i,a,c,l,m,w,S,E=zr(t[1].entries()),T=[];for(let k=0;k{c[S]=null}),An(),n=c[e],n?n.p(m,w):(n=c[e]=a[e](m),n.c()),_e(n,1),n.m(r.parentNode,r))},i(m){i||(_e(n),i=!0)},o(m){Se(n),i=!1},d(m){m&&Pe(r),c[e].d(m)}}}function G5(t,e){let n=[...t.entries()];n.sort((i,a)=>e(a[1])-e(i[1]));let r=new Map;for(let[i,a]of n)r.set(i,a);return r}function j5(t,e,n){let r;Ct(t,Ql,T=>n(7,r=T));let i=new Map,a=!1,{enabled:c}=e;Xu(async()=>{let T=await r.renderAmenities();for(let D of T.features){let k=D.properties.amenity_kind;i.has(k)?i.get(k).num+=1:i.set(k,{enabled:!1,num:1})}n(1,i=G5(i,D=>D.num))});function l(T){return[...i.entries()].filter(D=>D[1].enabled).map(D=>D[0])}function m(T,D){T[D][1].enabled=this.checked,n(1,i)}const w=T=>cs(T).close(),S=()=>n(2,a=!1),E=()=>n(2,a=!0);return t.$$set=T=>{"enabled"in T&&n(0,c=T.enabled)},t.$$.update=()=>{t.$$.dirty&2&&n(0,c=l())},[c,i,a,m,w,S,E]}class q5 extends Jt{constructor(e){super(),Kt(this,e,j5,U5,jt,{enabled:0})}}function W5(t){let e,n,r,i,a,c,l,m,w;return{c(){e=ke("label"),n=vt(`Mode: - `),r=ke("select"),i=ke("option"),i.textContent="Car",a=ke("option"),a.textContent="Bicycle",c=ke("option"),c.textContent="Foot",l=ke("option"),l.textContent="Public transit",i.__value="car",co(i,i.__value),a.__value="bicycle",co(a,a.__value),c.__value="foot",co(c,c.__value),l.__value="transit",co(l,l.__value),t[0]===void 0&&Ld(()=>t[1].call(r))},m(S,E){Me(S,e,E),we(e,n),we(e,r),we(r,i),we(r,a),we(r,c),we(r,l),Ug(r,t[0],!0),m||(w=Gt(r,"change",t[1]),m=!0)},p(S,[E]){E&1&&Ug(r,S[0])},i:et,o:et,d(S){S&&Pe(e),m=!1,w()}}}function H5(t,e,n){let{travelMode:r}=e;function i(){r=hE(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class C1 extends Jt{constructor(e){super(),Kt(this,e,H5,W5,jt,{travelMode:0})}}const Zu=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],Z5=["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"];function X5(t){let e=t[2].population.toLocaleString()+"",n,r,i=Math.round(t[2].density).toLocaleString()+"",a,c;return{c(){n=vt(e),r=vt(" people live here ("),a=vt(i),c=vt(" people / square kilometer)")},m(l,m){Me(l,n,m),Me(l,r,m),Me(l,a,m),Me(l,c,m)},p(l,m){m&4&&e!==(e=l[2].population.toLocaleString()+"")&&Pn(n,e),m&4&&i!==(i=Math.round(l[2].density).toLocaleString()+"")&&Pn(a,i)},d(l){l&&(Pe(n),Pe(r),Pe(a),Pe(c))}}}function Y5(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[X5,({props:r})=>({2:r}),({props:r})=>r?4:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function K5(t){let e,n,r,i;return e=new I1({props:{manageHoverState:!0,paint:{"fill-color":Wf(["get","density"],t[1],Z5),"fill-opacity":Wc(.2,.8)},$$slots:{default:[Y5]},$$scope:{ctx:t}}}),r=new lu({props:{paint:{"line-color":"black","line-width":1}}}),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment)},m(a,c){tt(e,a,c),Me(a,n,c),tt(r,a,c),i=!0},p(a,c){const l={};c&8&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){i||(_e(e.$$.fragment,a),_e(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Pe(n),nt(e,a),nt(r,a)}}}function J5(t){let e,n;return e=new ma({props:{data:t[0],generateId:!0,$$slots:{default:[K5]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&8&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function Q5(t,e,n){let{gj:r}=e,i=Array.from(Array(6).keys()).map(a=>r.max_density/(6-1)*a);return t.$$set=a=>{"gj"in a&&n(0,r=a.gj)},[r,i]}class $5 extends Jt{constructor(e){super(),Kt(this,e,Q5,J5,jt,{gj:0})}}function SS(t,e,n){const r=t.slice();return r[3]=e[n],r}function ez(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=vt(e),r=vt(" has "),a=vt(i),c=vt(" next steps (arrivals)")},m(l,m){Me(l,n,m),Me(l,r,m),Me(l,a,m),Me(l,c,m)},p(l,m){m&64&&e!==(e=l[6].name+"")&&Pn(n,e),m&64&&i!==(i=JSON.parse(l[6].next_steps).length+"")&&Pn(a,i)},d(l){l&&(Pe(n),Pe(r),Pe(a),Pe(c))}}}function tz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[ez,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function ES(t){let e,n;return e=new Pv({props:{$$slots:{default:[nz]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function IS(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=ke("p"),r=vt(n)},m(i,a){Me(i,e,a),we(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&Pn(r,n)},d(i){i&&Pe(e)}}}function nz(t){let e,n=zr(t[0]),r=[];for(let i=0;i{a=null}),An())},i(c){i||(_e(e.$$.fragment,c),_e(a),i=!0)},o(c){Se(e.$$.fragment,c),Se(a),i=!1},d(c){c&&(Pe(n),Pe(r)),nt(e,c),a&&a.d(c)}}}function iz(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(cs(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class oz extends Jt{constructor(e){super(),Kt(this,e,iz,rz,jt,{})}}function sz(t){let e,n,r;return n=new sm({}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","top")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p:et,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function CS(t){let e,n;return e=new UC({props:{gj:t[0]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function az(t){let e,n,r,i,a,c,l,m,w;function S(D){t[3](D)}let E={};t[1]!==void 0&&(E.travelMode=t[1]),c=new C1({props:E}),jn.push(()=>Xi(c,"travelMode",S));let T=t[0]&&CS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debug mode",r=ot(),i=ke("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=ot(),it(c.$$.fragment),m=ot(),T&&T.c(),Be(e,"slot","sidebar")},m(D,k){Me(D,e,k),we(e,n),we(e,r),we(e,i),we(e,a),tt(c,e,null),we(e,m),T&&T.m(e,null),w=!0},p(D,k){const U={};!l&&k&2&&(l=!0,U.travelMode=D[1],Zi(()=>l=!1)),c.$set(U),D[0]?T?(T.p(D,k),k&1&&_e(T,1)):(T=CS(D),T.c(),_e(T,1),T.m(e,null)):T&&(Mn(),Se(T,1,1,()=>{T=null}),An())},i(D){w||(_e(c.$$.fragment,D),_e(T),w=!0)},o(D){Se(c.$$.fragment,D),Se(T),w=!1},d(D){D&&Pe(e),nt(c),T&&T.d()}}}function TS(t){let e,n;return e=new ma({props:{data:t[0],generateId:!0,$$slots:{default:[cz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(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||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function lz(t){let e,n;return e=new Mv({props:{properties:t[5]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function uz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[lz,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function cz(t){let e,n,r,i,a,c;return e=new lu({props:{id:"network",paint:{"line-width":Wc(5,7),"line-color":"black"},filter:xx(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[uz]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new VC({props:{popups:!0}}),a=new oz({}),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment),i=ot(),it(a.$$.fragment)},m(l,m){tt(e,l,m),Me(l,n,m),tt(r,l,m),Me(l,i,m),tt(a,l,m),c=!0},p(l,m){const w={};m&2&&(w.filter=xx(l[1])),m&64&&(w.$$scope={dirty:m,ctx:l}),e.$set(w)},i(l){c||(_e(e.$$.fragment,l),_e(r.$$.fragment,l),_e(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Pe(n),Pe(i)),nt(e,l),nt(r,l),nt(a,l)}}}function hz(t){let e,n,r=t[0]&&TS(t);return{c(){e=ke("div"),r&&r.c(),Be(e,"slot","map")},m(i,a){Me(i,e,a),r&&r.m(e,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=TS(i),r.c(),_e(r,1),r.m(e,null)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d()}}}function fz(t){let e,n;return e=new th({props:{$$slots:{map:[hz],sidebar:[az],top:[sz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function pz(t,e,n){let r,i;Ct(t,Ql,m=>n(4,r=m)),Ct(t,vf,m=>n(1,i=m));let a=null;Xu(async()=>{n(0,a=await r.renderDebug())});const c=m=>window.open(cs(m.detail.features[0].properties).way,"_blank");function l(m){i=m,vf.set(i)}return[a,i,c,l]}class dz extends Jt{constructor(e){super(),Kt(this,e,pz,fz,jt,{})}}function mz(t){let e,n,r;return n=new sm({}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","top")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p:et,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function LS(t){let e,n=Zg(t[2])+"",r,i,a=t[2].properties.amenity_kind+"",c,l;return{c(){e=ke("span"),r=vt(n),i=vt(" ("),c=vt(a),l=vt(")")},m(m,w){Me(m,e,w),we(e,r),we(e,i),we(e,c),we(e,l)},p(m,w){w&4&&n!==(n=Zg(m[2])+"")&&Pn(r,n),w&4&&a!==(a=m[2].properties.amenity_kind+"")&&Pn(c,a)},d(m){m&&Pe(e)}}}function PS(t){let e,n;return{c(){e=ke("p"),n=vt(t[7])},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&128&&Pn(n,r[7])},d(r){r&&Pe(e)}}}function MS(t){let e,n;return e=new UC({props:{gj:t[5]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function gz(t){let e,n,r,i,a,c,l,m,w,S,E,T,D,k,U,q,ee,V,j,Q,$,me,de,re,se=t[2]&&LS(t);function Ce(be){t[12](be)}let H={};t[4]!==void 0&&(H.travelMode=t[4]),l=new C1({props:H}),jn.push(()=>Xi(l,"travelMode",Ce)),j=new Av({props:{colorScale:Zu,limits:t[8]}});let oe=t[7]&&PS(t),Xe=t[5]&&MS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Isochrone mode",r=ot(),i=ke("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time - in seconds.`,a=ot(),se&&se.c(),c=ot(),it(l.$$.fragment),w=ot(),S=ke("label"),E=vt(`Start time (PT only) - `),T=ke("input"),k=ot(),U=ke("label"),q=ke("input"),ee=vt("Contours"),V=ot(),it(j.$$.fragment),Q=ot(),oe&&oe.c(),$=ot(),Xe&&Xe.c(),Be(T,"type","time"),T.disabled=D=t[4]!="transit",Be(q,"type","checkbox"),Be(e,"slot","sidebar")},m(be,Ue){Me(be,e,Ue),we(e,n),we(e,r),we(e,i),we(e,a),se&&se.m(e,null),we(e,c),tt(l,e,null),we(e,w),we(e,S),we(S,E),we(S,T),co(T,t[3]),we(e,k),we(e,U),we(U,q),q.checked=t[1],we(U,ee),we(e,V),tt(j,e,null),we(e,Q),oe&&oe.m(e,null),we(e,$),Xe&&Xe.m(e,null),me=!0,de||(re=[Gt(T,"input",t[13]),Gt(q,"change",t[14])],de=!0)},p(be,Ue){be[2]?se?se.p(be,Ue):(se=LS(be),se.c(),se.m(e,c)):se&&(se.d(1),se=null);const $e={};!m&&Ue&16&&(m=!0,$e.travelMode=be[4],Zi(()=>m=!1)),l.$set($e),(!me||Ue&16&&D!==(D=be[4]!="transit"))&&(T.disabled=D),Ue&8&&co(T,be[3]),Ue&2&&(q.checked=be[1]),be[7]?oe?oe.p(be,Ue):(oe=PS(be),oe.c(),oe.m(e,$)):oe&&(oe.d(1),oe=null),be[5]?Xe?(Xe.p(be,Ue),Ue&32&&_e(Xe,1)):(Xe=MS(be),Xe.c(),_e(Xe,1),Xe.m(e,null)):Xe&&(Mn(),Se(Xe,1,1,()=>{Xe=null}),An())},i(be){me||(_e(l.$$.fragment,be),_e(j.$$.fragment,be),_e(Xe),me=!0)},o(be){Se(l.$$.fragment,be),Se(j.$$.fragment,be),Se(Xe),me=!1},d(be){be&&Pe(e),se&&se.d(),nt(l),nt(j),oe&&oe.d(),Xe&&Xe.d(),de=!1,xi(re)}}}function AS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[_z]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Zd({props:a}),jn.push(()=>Xi(e,"lngLat",i)),{c(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,l){const m={};l&524288&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.lngLat=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function _z(t){let e;return{c(){e=ke("span"),e.textContent="X",Be(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function kS(t){let e,n;return e=new ma({props:{data:t[5],generateId:!0,$$slots:{default:[bz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(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||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function yz(t){let e=(t[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=vt(e),r=vt(" minutes away")},m(i,a){Me(i,n,a),Me(i,r,a)},p(i,a){a&262144&&e!==(e=(i[18].cost_seconds/60).toFixed(1)+"")&&Pn(n,e)},d(i){i&&(Pe(n),Pe(r))}}}function vz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[yz,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&786432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function bz(t){let e,n,r,i,a,c,l;e=new lu({props:{id:"isochrone",filter:wO,paint:{"line-width":2,"line-color":Wf(["get","cost_seconds"],t[9],Zu),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[vz]},$$scope:{ctx:t}}}),r=new I1({props:{id:"isochrone-contours",filter:xO,paint:{"fill-color":Wf(["get","min_seconds"],t[9],Zu),"fill-opacity":.5}}});function m(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new VC({props:w}),jn.push(()=>Xi(a,"hovered",m)),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment),i=ot(),it(a.$$.fragment)},m(S,E){tt(e,S,E),Me(S,n,E),tt(r,S,E),Me(S,i,E),tt(a,S,E),l=!0},p(S,E){const T={};E&524288&&(T.$$scope={dirty:E,ctx:S}),e.$set(T);const D={};!c&&E&4&&(c=!0,D.hovered=S[2],Zi(()=>c=!1)),a.$set(D)},i(S){l||(_e(e.$$.fragment,S),_e(r.$$.fragment,S),_e(a.$$.fragment,S),l=!0)},o(S){Se(e.$$.fragment,S),Se(r.$$.fragment,S),Se(a.$$.fragment,S),l=!1},d(S){S&&(Pe(n),Pe(i)),nt(e,S),nt(r,S),nt(a,S)}}}function DS(t){let e,n;return e=new ma({props:{data:t[6],$$slots:{default:[xz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(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||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function xz(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function wz(t){let e,n,r,i,a=t[0]&&AS(t),c=t[5]&&kS(t),l=t[6]&&DS(t);return{c(){e=ke("div"),a&&a.c(),n=ot(),c&&c.c(),r=ot(),l&&l.c(),Be(e,"slot","map")},m(m,w){Me(m,e,w),a&&a.m(e,null),we(e,n),c&&c.m(e,null),we(e,r),l&&l.m(e,null),i=!0},p(m,w){m[0]?a?(a.p(m,w),w&1&&_e(a,1)):(a=AS(m),a.c(),_e(a,1),a.m(e,n)):a&&(Mn(),Se(a,1,1,()=>{a=null}),An()),m[5]?c?(c.p(m,w),w&32&&_e(c,1)):(c=kS(m),c.c(),_e(c,1),c.m(e,r)):c&&(Mn(),Se(c,1,1,()=>{c=null}),An()),m[6]?l?(l.p(m,w),w&64&&_e(l,1)):(l=DS(m),l.c(),_e(l,1),l.m(e,null)):l&&(Mn(),Se(l,1,1,()=>{l=null}),An())},i(m){i||(_e(a),_e(c),_e(l),i=!0)},o(m){Se(a),Se(c),Se(l),i=!1},d(m){m&&Pe(e),a&&a.d(),c&&c.d(),l&&l.d()}}}function Sz(t){let e,n;return e=new th({props:{$$slots:{map:[wz],sidebar:[gz],top:[mz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,[i]){const a={};i&524543&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function RS(t,e,n){return e+t*(n-e)}function Ez(t,e,n){let r,i,a;Ct(t,Hg,$=>n(3,r=$)),Ct(t,vf,$=>n(4,i=$)),Ct(t,Ql,$=>n(15,a=$));let c=null;Xu(async()=>{let $=await a.getBounds();n(0,c={lng:RS(.5,$[0],$[2]),lat:RS(.5,$[1],$[3])})});let l=!1,m=null,w=null,S="",E;async function T($,me,de,re){if(c)try{n(5,m=await a.isochrone({start:c,mode:i,contours:l,startTime:r})),n(7,S="")}catch(se){n(5,m=null),se=se.toString()}}async function D($,me,de){if(c&&E)try{n(6,w=await a.route({start:c,end:E.geometry.coordinates,mode:i,debugSearch:!1,useHeuristic:!1,startTime:r})),n(7,S="")}catch(re){n(6,w=null),re=re.toString()}else n(6,w=null)}let k=[0,3,6,9,12,15],U=k.map($=>$*60);function q($){c=$,n(0,c)}function ee($){E=$,n(2,E)}function V($){i=$,vf.set(i)}function j(){r=this.value,Hg.set(r)}function Q(){l=this.checked,n(1,l)}return t.$$.update=()=>{t.$$.dirty&27&&T(),t.$$.dirty&13&&D()},[c,l,E,r,i,m,w,S,k,U,q,ee,V,j,Q]}class Iz extends Jt{constructor(e){super(),Kt(this,e,Ez,Sz,jt,{})}}function NS(t,e,n){const r=t.slice();r[19]=e[n];const i=cs(r[19].properties);return r[18]=i,r}function Cz(t){let e,n,r;return n=new sm({}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","top")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p:et,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function Tz(t){let e,n,r,i,a,c,l,m,w,S=zr(t[5].features),E=[];for(let T=0;TXi(i,"travelMode",me));function re(H,oe){if(H[6])return Lz;if(H[5])return Tz}let se=re(t),Ce=se&&se(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Route mode",r=ot(),it(i.$$.fragment),c=ot(),l=ke("label"),m=ke("input"),S=vt(` - Use heuristic (PT only)`),E=ot(),T=ke("label"),D=vt(`Start time (PT only) - `),k=ke("input"),q=ot(),ee=ke("p"),ee.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to - set the first pin somewhere.)`,V=ot(),Ce&&Ce.c(),Be(m,"type","checkbox"),m.disabled=w=t[2]!="transit",Be(k,"type","time"),k.disabled=U=t[2]!="transit",Be(e,"slot","sidebar")},m(H,oe){Me(H,e,oe),we(e,n),we(e,r),tt(i,e,null),we(e,c),we(e,l),we(l,m),m.checked=t[1],we(l,S),we(e,E),we(e,T),we(T,D),we(T,k),co(k,t[0]),we(e,q),we(e,ee),we(e,V),Ce&&Ce.m(e,null),j=!0,Q||($=[Gt(m,"change",t[13]),Gt(k,"input",t[14])],Q=!0)},p(H,oe){const Xe={};!a&&oe&4&&(a=!0,Xe.travelMode=H[2],Zi(()=>a=!1)),i.$set(Xe),(!j||oe&4&&w!==(w=H[2]!="transit"))&&(m.disabled=w),oe&2&&(m.checked=H[1]),(!j||oe&4&&U!==(U=H[2]!="transit"))&&(k.disabled=U),oe&1&&co(k,H[0]),se===(se=re(H))&&Ce?Ce.p(H,oe):(Ce&&Ce.d(1),Ce=se&&se(H),Ce&&(Ce.c(),Ce.m(e,null)))},i(H){j||(_e(i.$$.fragment,H),j=!0)},o(H){Se(i.$$.fragment,H),j=!1},d(H){H&&Pe(e),nt(i),Ce&&Ce.d(),Q=!1,xi($)}}}function Rz(t){let e;return{c(){e=ke("span"),e.textContent="A",Be(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function Nz(t){let e;return{c(){e=ke("span"),e.textContent="B",Be(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function zS(t){let e,n;return e=new ma({props:{data:t[5],generateId:!0,$$slots:{default:[Fz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&4194304&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function Oz(t){let e,n;return e=new Mv({props:{properties:t[18]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&262144&&(a.properties=r[18]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function zz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[Oz,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&4456448&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function Fz(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":20,"line-color":w1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Wc(.5,1)},manageHoverState:!0,$$slots:{default:[zz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&4194304&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function Bz(t){let e,n,r,i,a,c,l,m,w,S;n=new JO({}),n.$on("contextmenu",t[7]);function E(q){t[10](q)}let T={draggable:!0,$$slots:{default:[Rz]},$$scope:{ctx:t}};t[4]!==void 0&&(T.lngLat=t[4]),i=new Zd({props:T}),jn.push(()=>Xi(i,"lngLat",E));function D(q){t[11](q)}let k={draggable:!0,$$slots:{default:[Nz]},$$scope:{ctx:t}};t[3]!==void 0&&(k.lngLat=t[3]),l=new Zd({props:k}),jn.push(()=>Xi(l,"lngLat",D));let U=t[5]&&zS(t);return{c(){e=ke("div"),it(n.$$.fragment),r=ot(),it(i.$$.fragment),c=ot(),it(l.$$.fragment),w=ot(),U&&U.c(),Be(e,"slot","map")},m(q,ee){Me(q,e,ee),tt(n,e,null),we(e,r),tt(i,e,null),we(e,c),tt(l,e,null),we(e,w),U&&U.m(e,null),S=!0},p(q,ee){const V={};ee&4194304&&(V.$$scope={dirty:ee,ctx:q}),!a&&ee&16&&(a=!0,V.lngLat=q[4],Zi(()=>a=!1)),i.$set(V);const j={};ee&4194304&&(j.$$scope={dirty:ee,ctx:q}),!m&&ee&8&&(m=!0,j.lngLat=q[3],Zi(()=>m=!1)),l.$set(j),q[5]?U?(U.p(q,ee),ee&32&&_e(U,1)):(U=zS(q),U.c(),_e(U,1),U.m(e,null)):U&&(Mn(),Se(U,1,1,()=>{U=null}),An())},i(q){S||(_e(n.$$.fragment,q),_e(i.$$.fragment,q),_e(l.$$.fragment,q),_e(U),S=!0)},o(q){Se(n.$$.fragment,q),Se(i.$$.fragment,q),Se(l.$$.fragment,q),Se(U),S=!1},d(q){q&&Pe(e),nt(n),nt(i),nt(l),U&&U.d()}}}function Vz(t){let e,n;return e=new th({props:{$$slots:{map:[Bz],sidebar:[Dz],top:[Cz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,[i]){const a={};i&4194431&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function Uz(t,e,n){let r,i,a,c,l,m,w;Ct(t,Ts,$=>n(15,r=$)),Ct(t,Hg,$=>n(0,i=$)),Ct(t,wx,$=>n(1,a=$)),Ct(t,vf,$=>n(2,c=$)),Ct(t,bf,$=>n(3,l=$)),Ct(t,Lc,$=>n(4,m=$)),Ct(t,Ql,$=>n(16,w=$));let S=null,E="";async function T($,me,de,re,se){try{n(5,S=await w.route({start:$,end:[me.lng,me.lat],mode:de,debugSearch:!1,useHeuristic:a,startTime:i})),n(6,E="")}catch(Ce){n(5,S=null),n(6,E=Ce.toString())}}function D($){Gn(Lc,m=$.detail.lngLat,m)}async function k(){try{let $=await w.route({start:m,end:[l.lng,l.lat],mode:c,debugSearch:!0,useHeuristic:a,startTime:i});Gn(Ts,r={kind:"debug-route",debugGj:$,start:m,end:l,routeGj:S},r)}catch($){n(6,E=$.toString())}}async function U(){try{let $=await w.bufferRoute({start:m,end:[l.lng,l.lat],mode:c,useHeuristic:a,startTime:i,maxSeconds:300});Gn(Ts,r={kind:"buffer-route",gj:$},r)}catch($){n(6,E=$.toString())}}function q($){m=$,Lc.set(m)}function ee($){l=$,bf.set(l)}function V($){c=$,vf.set(c)}function j(){a=this.checked,wx.set(a)}function Q(){i=this.value,Hg.set(i)}return t.$$.update=()=>{t.$$.dirty&31&&T(m,l,c)},[i,a,c,l,m,S,E,D,k,U,q,ee,V,j,Q]}class Gz extends Jt{constructor(e){super(),Kt(this,e,Uz,Vz,jt,{})}}function jz(t){let e,n,r,i;return{c(){e=ke("div"),n=ke("button"),n.textContent="Back",Be(e,"slot","top")},m(a,c){Me(a,e,c),we(e,n),r||(i=Gt(n,"click",t[10]),r=!0)},p:et,d(a){a&&Pe(e),r=!1,i()}}}function qz(t){let e,n,r,i,a,c,l,m,w,S=cs(t[4].features[t[4].features.length-1].properties).time+"",E,T,D;return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debugging a route",r=ot(),i=ke("p"),i.textContent=`${t[6]} total nodes searched`,a=ot(),c=ke("input"),l=ot(),m=ke("p"),w=vt("Search is currently at "),E=vt(S),Be(c,"type","range"),Be(c,"min","1"),Be(c,"max",t[6]),Be(e,"slot","sidebar")},m(k,U){Me(k,e,U),we(e,n),we(e,r),we(e,i),we(e,a),we(e,c),co(c,t[3]),we(e,l),we(e,m),we(m,w),we(m,E),T||(D=[Gt(c,"change",t[9]),Gt(c,"input",t[9])],T=!0)},p(k,U){U&8&&co(c,k[3]),U&16&&S!==(S=cs(k[4].features[k[4].features.length-1].properties).time+"")&&Pn(E,S)},d(k){k&&Pe(e),T=!1,xi(D)}}}function Wz(t){let e;return{c(){e=ke("span"),e.textContent="A",Be(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function Hz(t){let e;return{c(){e=ke("span"),e.textContent="B",Be(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function Zz(t){let e,n;return e=new lu({props:{paint:{"line-width":20,"line-color":w1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function Xz(t){let e,n,r,i;return e=new Z_({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new lu({props:{paint:{"line-width":5,"line-color":w1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment)},m(a,c){tt(e,a,c),Me(a,n,c),tt(r,a,c),i=!0},p:et,i(a){i||(_e(e.$$.fragment,a),_e(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Pe(n),nt(e,a),nt(r,a)}}}function Yz(t){let e,n,r,i,a,c,l,m,w;return n=new Zd({props:{lngLat:t[0],$$slots:{default:[Wz]},$$scope:{ctx:t}}}),i=new Zd({props:{lngLat:t[1],$$slots:{default:[Hz]},$$scope:{ctx:t}}}),c=new ma({props:{data:t[2],$$slots:{default:[Zz]},$$scope:{ctx:t}}}),m=new ma({props:{data:t[4],generateId:!0,$$slots:{default:[Xz]},$$scope:{ctx:t}}}),{c(){e=ke("div"),it(n.$$.fragment),r=ot(),it(i.$$.fragment),a=ot(),it(c.$$.fragment),l=ot(),it(m.$$.fragment),Be(e,"slot","map")},m(S,E){Me(S,e,E),tt(n,e,null),we(e,r),tt(i,e,null),we(e,a),tt(c,e,null),we(e,l),tt(m,e,null),w=!0},p(S,E){const T={};E&1&&(T.lngLat=S[0]),E&4096&&(T.$$scope={dirty:E,ctx:S}),n.$set(T);const D={};E&2&&(D.lngLat=S[1]),E&4096&&(D.$$scope={dirty:E,ctx:S}),i.$set(D);const k={};E&4&&(k.data=S[2]),E&4096&&(k.$$scope={dirty:E,ctx:S}),c.$set(k);const U={};E&16&&(U.data=S[4]),E&4096&&(U.$$scope={dirty:E,ctx:S}),m.$set(U)},i(S){w||(_e(n.$$.fragment,S),_e(i.$$.fragment,S),_e(c.$$.fragment,S),_e(m.$$.fragment,S),w=!0)},o(S){Se(n.$$.fragment,S),Se(i.$$.fragment,S),Se(c.$$.fragment,S),Se(m.$$.fragment,S),w=!1},d(S){S&&Pe(e),nt(n),nt(i),nt(c),nt(m)}}}function Kz(t){let e,n,r,i;return e=new th({props:{$$slots:{map:[Yz],sidebar:[qz],top:[jz]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(a,c){tt(e,a,c),n=!0,r||(i=Gt(window,"keydown",t[7]),r=!0)},p(a,[c]){const l={};c&4159&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){n||(_e(e.$$.fragment,a),n=!0)},o(a){Se(e.$$.fragment,a),n=!1},d(a){nt(e,a),r=!1,i()}}}function Jz(t,e,n){let r,i,a;Ct(t,I_,U=>n(11,i=U)),Ct(t,Ts,U=>n(5,a=U));let{debugGj:c}=e,{start:l}=e,{end:m}=e,{routeGj:w}=e,S=c.features.length/2,E=1;function T(U){U.key=="ArrowLeft"&&E>1&&(U.stopPropagation(),n(3,E--,E)),U.key=="ArrowRight"&&E{i==null||i.keyboard.disable()}),us(()=>{i==null||i.keyboard.enable()});function D(){E=Ev(this.value),n(3,E)}const k=()=>Gn(Ts,a={kind:"route"},a);return t.$$set=U=>{"debugGj"in U&&n(8,c=U.debugGj),"start"in U&&n(0,l=U.start),"end"in U&&n(1,m=U.end),"routeGj"in U&&n(2,w=U.routeGj)},t.$$.update=()=>{t.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:c.features.slice(0,2*E)})},[l,m,w,E,r,a,S,T,c,D,k]}class Qz extends Jt{constructor(e){super(),Kt(this,e,Jz,Kz,jt,{debugGj:8,start:0,end:1,routeGj:2})}}function $z(t){let e,n,r;return n=new sm({}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","top")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p:et,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function e6(t){let e,n,r,i,a;return i=new Av({props:{colorScale:Zu,limits:t[1]}}),{c(){e=ke("div"),n=ke("h2"),n.textContent="Buffer around a route",r=ot(),it(i.$$.fragment),Be(e,"slot","sidebar")},m(c,l){Me(c,e,l),we(e,n),we(e,r),tt(i,e,null),a=!0},p:et,i(c){a||(_e(i.$$.fragment,c),a=!0)},o(c){Se(i.$$.fragment,c),a=!1},d(c){c&&Pe(e),nt(i)}}}function t6(t){let e;return{c(){e=vt("part of the route")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function n6(t){let e=(t[3].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=vt(e),r=vt(" minutes away")},m(i,a){Me(i,n,a),Me(i,r,a)},p(i,a){a&8&&e!==(e=(i[3].cost_seconds/60).toFixed(1)+"")&&Pn(n,e)},d(i){i&&(Pe(n),Pe(r))}}}function r6(t){let e;function n(a,c){return a[3].kind=="buffer"?n6:t6}let r=n(t),i=r(t);return{c(){i.c(),e=Er()},m(a,c){i.m(a,c),Me(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&&Pe(e),i.d(a)}}}function i6(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[r6,({props:r})=>({3:r}),({props:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function o6(t){let e,n;return e=new lu({props:{paint:{"line-width":["case",["==",["get","kind"],"route"],20,3],"line-color":["case",["==",["get","kind"],"route"],"red",Wf(["get","cost_seconds"],t[2],Zu)],"line-opacity":.5},$$slots:{default:[i6]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function s6(t){let e,n,r;return n=new ma({props:{data:t[0],$$slots:{default:[o6]},$$scope:{ctx:t}}}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","map")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p(i,a){const c={};a&1&&(c.data=i[0]),a&16&&(c.$$scope={dirty:a,ctx:i}),n.$set(c)},i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function a6(t){let e,n;return e=new th({props:{$$slots:{map:[s6],sidebar:[e6],top:[$z]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,[i]){const a={};i&17&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function l6(t,e,n){let{gj:r}=e,i=[0,1,2,3,4,5],a=i.map(c=>c*60);return t.$$set=c=>{"gj"in c&&n(0,r=c.gj)},[r,i,a]}class u6 extends Jt{constructor(e){super(),Kt(this,e,l6,a6,jt,{gj:0})}}function FS(t){let e,n;return e=new GC({props:{loading:t[3]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.loading=r[3]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function c6(t){let e,n,r;return n=new sm({}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","top")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p:et,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function BS(t){let e,n,r=t[2].properties.poi+"",i,a,c=t[2].properties.cost+"",l,m;return{c(){e=ke("span"),n=vt("From "),i=vt(r),a=vt(", it's "),l=vt(c),m=vt(" seconds to the nearest parking")},m(w,S){Me(w,e,S),we(e,n),we(e,i),we(e,a),we(e,l),we(e,m)},p(w,S){S&4&&r!==(r=w[2].properties.poi+"")&&Pn(i,r),S&4&&c!==(c=w[2].properties.cost+"")&&Pn(l,c)},d(w){w&&Pe(e)}}}function h6(t){let e,n,r,i,a,c,l,m,w,S,E,T,D,k,U,q,ee,V,j,Q,$,me,de,re=t[2]&&BS(t);function se(H){t[10](H)}let Ce={};return t[1]!==void 0&&(Ce.enabled=t[1]),a=new q5({props:Ce}),jn.push(()=>Xi(a,"enabled",se)),m=new Av({props:{colorScale:Zu,limits:t[7]}}),{c(){e=ke("div"),n=ke("h2"),n.textContent="Score mode",r=ot(),re&&re.c(),i=ot(),it(a.$$.fragment),l=ot(),it(m.$$.fragment),w=ot(),S=ke("label"),E=ke("input"),T=vt(` - Max time (seconds)`),D=ot(),k=ke("label"),U=ke("input"),q=vt(` - Show parking`),ee=ot(),V=ke("p"),V.textContent=`This is an early experiment of a mode to show an "access score". Right - now, it's starting from every POI chosen and walking up to some time 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.`,j=ot(),Q=ke("p"),Q.innerHTML='Parking icon from OpenStreetMap Carto',Be(E,"type","number"),Be(U,"type","checkbox"),Be(e,"slot","sidebar")},m(H,oe){Me(H,e,oe),we(e,n),we(e,r),re&&re.m(e,null),we(e,i),tt(a,e,null),we(e,l),tt(m,e,null),we(e,w),we(e,S),we(S,E),co(E,t[0]),we(S,T),we(e,D),we(e,k),we(k,U),U.checked=t[4],we(k,q),we(e,ee),we(e,V),we(e,j),we(e,Q),$=!0,me||(de=[Gt(E,"input",t[11]),Gt(U,"change",t[12])],me=!0)},p(H,oe){H[2]?re?re.p(H,oe):(re=BS(H),re.c(),re.m(e,i)):re&&(re.d(1),re=null);const Xe={};!c&&oe&2&&(c=!0,Xe.enabled=H[1],Zi(()=>c=!1)),a.$set(Xe);const be={};oe&128&&(be.limits=H[7]),m.$set(be),oe&1&&Ev(E.value)!==H[0]&&co(E,H[0]),oe&16&&(U.checked=H[4])},i(H){$||(_e(a.$$.fragment,H),_e(m.$$.fragment,H),$=!0)},o(H){Se(a.$$.fragment,H),Se(m.$$.fragment,H),$=!1},d(H){H&&Pe(e),re&&re.d(),nt(a),nt(m),me=!1,xi(de)}}}function VS(t){let e,n;return e=new ma({props:{data:t[5],generateId:!0,$$slots:{default:[f6]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&131204&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function f6(t){let e,n,r;function i(c){t[9](c)}let a={paint:{"circle-radius":15,"circle-color":Wf(["get","cost"],t[7],Zu),"circle-stroke-width":Wc(1,3),"circle-stroke-color":"black"},manageHoverState:!0};return t[2]!==void 0&&(a.hovered=t[2]),e=new Z_({props:a}),jn.push(()=>Xi(e,"hovered",i)),{c(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,l){const m={};l&128&&(m.paint={"circle-radius":15,"circle-color":Wf(["get","cost"],c[7],Zu),"circle-stroke-width":Wc(1,3),"circle-stroke-color":"black"}),!n&&l&4&&(n=!0,m.hovered=c[2],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function US(t){let e,n;return e=new ma({props:{data:t[6],$$slots:{default:[p6]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&131072&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function p6(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function d6(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function m6(t){let e,n;return e=new ma({props:{data:t[16],$$slots:{default:[g6]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&256&&(a.data=r[16]),i&131088&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function g6(t){let e,n;return e=new g5({props:{filter:["==",["get","amenity_kind"],"bicycle_parking"],layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:t[4]?"visible":"none"}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.layout={"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[4]?"visible":"none"}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function _6(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function y6(t){let e,n,r,i,a,c=t[5]&&VS(t),l=t[6]&&US(t),m={ctx:t,current:null,token:null,hasCatch:!1,pending:_6,then:m6,catch:d6,value:16,blocks:[,,,]};return yf(i=cs(t[8]).renderAmenities(),m),{c(){e=ke("div"),c&&c.c(),n=ot(),l&&l.c(),r=ot(),m.block.c(),Be(e,"slot","map")},m(w,S){Me(w,e,S),c&&c.m(e,null),we(e,n),l&&l.m(e,null),we(e,r),m.block.m(e,m.anchor=null),m.mount=()=>e,m.anchor=null,a=!0},p(w,S){t=w,t[5]?c?(c.p(t,S),S&32&&_e(c,1)):(c=VS(t),c.c(),_e(c,1),c.m(e,n)):c&&(Mn(),Se(c,1,1,()=>{c=null}),An()),t[6]?l?(l.p(t,S),S&64&&_e(l,1)):(l=US(t),l.c(),_e(l,1),l.m(e,r)):l&&(Mn(),Se(l,1,1,()=>{l=null}),An()),m.ctx=t,S&256&&i!==(i=cs(t[8]).renderAmenities())&&yf(i,m)||Lv(m,t,S)},i(w){a||(_e(c),_e(l),_e(m.block),a=!0)},o(w){Se(c),Se(l);for(let S=0;S<3;S+=1){const E=m.blocks[S];Se(E)}a=!1},d(w){w&&Pe(e),c&&c.d(),l&&l.d(),m.block.d(),m.token=null,m=null}}}function v6(t){let e,n,r,i=t[5]==null&&FS(t);return n=new th({props:{$$slots:{map:[y6],sidebar:[h6],top:[c6]},$$scope:{ctx:t}}}),{c(){i&&i.c(),e=ot(),it(n.$$.fragment)},m(a,c){i&&i.m(a,c),Me(a,e,c),tt(n,a,c),r=!0},p(a,[c]){a[5]==null?i?(i.p(a,c),c&32&&_e(i,1)):(i=FS(a),i.c(),_e(i,1),i.m(e.parentNode,e)):i&&(Mn(),Se(i,1,1,()=>{i=null}),An());const l={};c&131575&&(l.$$scope={dirty:c,ctx:a}),n.$set(l)},i(a){r||(_e(i),_e(n.$$.fragment,a),r=!0)},o(a){Se(i),Se(n.$$.fragment,a),r=!1},d(a){a&&Pe(e),i&&i.d(a),nt(n,a)}}}function b6(t,e,n){let r,i;Ct(t,Ql,j=>n(8,i=j));let a=[],c=600,l=[],m=!0,w=null;async function S(j,Q){n(3,a=[...a,"Calculating scores"]),n(5,w=await i.score({poiKinds:l,maxSeconds:c},Dv(E))),n(3,a=[])}function E(j){n(3,a=[...a,j])}let T=null,D;async function k(j){if(D)try{n(6,T=await i.route({start:{lng:D.geometry.coordinates[0],lat:D.geometry.coordinates[1]},end:[D.properties.closest_lon,D.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(Q){console.log(`No route: ${Q}`),n(6,T=null)}else n(6,T=null)}function U(j){D=j,n(2,D)}function q(j){l=j,n(1,l)}function ee(){c=Ev(this.value),n(0,c)}function V(){m=this.checked,n(4,m)}return t.$$.update=()=>{t.$$.dirty&3&&S(),t.$$.dirty&1&&n(7,r=Array.from(Array(6).keys()).map(j=>c/(6-1)*j)),t.$$.dirty&4&&k()},[c,l,D,a,m,w,T,r,i,U,q,ee,V]}class x6 extends Jt{constructor(e){super(),Kt(this,e,b6,v6,jt,{})}}var Io=63710088e-1,T1={centimeters:Io*100,centimetres:Io*100,degrees:Io/111325,feet:Io*3.28084,inches:Io*39.37,kilometers:Io/1e3,kilometres:Io/1e3,meters:Io,metres:Io,miles:Io/1609.344,millimeters:Io*1e3,millimetres:Io*1e3,nauticalmiles:Io/1852,radians:1,yards:Io*1.0936},w6={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/Io,yards:1.0936133},Sv={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 ga(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 S6(t,e,n){switch(t){case"Point":return os(e).geometry;case"LineString":return ta(e).geometry;case"Polygon":return L1(e).geometry;case"MultiPoint":return qC(e).geometry;case"MultiLineString":return jC(e).geometry;case"MultiPolygon":return WC(e).geometry;default:throw new Error(t+" is invalid")}}function os(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(!w_(t[0])||!w_(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ga(r,e,n)}function E6(t,e,n){return n===void 0&&(n={}),Hc(t.map(function(r){return os(r,e)}),n)}function L1(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 P1(t,e){e===void 0&&(e="kilometers");var n=T1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function X_(t,e){e===void 0&&(e="kilometers");var n=T1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function P6(t,e){return Xd(X_(t,e))}function M6(t){var e=t%360;return e<0&&(e+=360),e}function Xd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function na(t){var e=t%360;return e*Math.PI/180}function A6(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 P1(X_(t,e),n)}function k6(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=Sv[e];if(!r)throw new Error("invalid original units");var i=Sv[n];if(!i)throw new Error("invalid final units");return t/r*i}function w_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function M1(t){return!!t&&t.constructor===Object}function D6(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(!w_(e))throw new Error("bbox must only contain numbers")})}function R6(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 N6=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Sv,bearingToAzimuth:M6,convertArea:k6,convertLength:A6,degreesToRadians:na,earthRadius:Io,factors:T1,feature:ga,featureCollection:Hc,geometry:S6,geometryCollection:T6,isNumber:w_,isObject:M1,lengthToDegrees:P6,lengthToRadians:X_,lineString:ta,lineStrings:C6,multiLineString:jC,multiPoint:qC,multiPolygon:WC,point:os,points:E6,polygon:L1,polygons:I6,radiansToDegrees:Xd,radiansToLength:P1,round:L6,unitsFactors:w6,validateBBox:D6,validateId:R6},Symbol.toStringTag,{value:"Module"}));function Yd(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 Hf(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 HC(t,e,n){if(n===void 0&&(n={}),n.final===!0)return O6(t,e);var r=Yd(t),i=Yd(e),a=na(r[0]),c=na(i[0]),l=na(r[1]),m=na(i[1]),w=Math.sin(c-a)*Math.cos(m),S=Math.cos(l)*Math.sin(m)-Math.sin(l)*Math.cos(m)*Math.cos(c-a);return Xd(Math.atan2(w,S))}function O6(t,e){var n=HC(e,t);return n=(n+180)%360,n}function hd(t,e,n){n===void 0&&(n={});var r=Yd(t),i=Yd(e),a=na(i[1]-r[1]),c=na(i[0]-r[0]),l=na(r[1]),m=na(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(m);return P1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function GS(t,e,n,r){r===void 0&&(r={});var i=Yd(t),a=na(i[0]),c=na(i[1]),l=na(n),m=X_(e,r.units),w=Math.asin(Math.sin(c)*Math.cos(m)+Math.cos(c)*Math.sin(m)*Math.cos(l)),S=a+Math.atan2(Math.sin(l)*Math.sin(m)*Math.cos(c),Math.cos(m)-Math.sin(c)*Math.sin(w)),E=Xd(S),T=Xd(w);return os([E,T],r.properties)}function am(t,e,n){if(t!==null)for(var r,i,a,c,l,m,w,S=0,E=0,T,D=t.type,k=D==="FeatureCollection",U=D==="Feature",q=k?t.features.length:1,ee=0;eem||k>w||U>S){l=E,m=r,w=k,S=U,a=0;return}var q=ta([l,E],n.properties);if(e(q,r,i,U,a)===!1)return!1;a++,l=E})===!1)return!1}}})}function j6(t,e,n){var r=n,i=!1;return XC(t,function(a,c,l,m,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,m,w),i=!0}),r}function YC(t,e){if(!t)throw new Error("geojson is required");ip(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 l=0;li?n:i,w=r>a?r:a;return[c,l,m,w]}var k1={exports:{}},KC={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Kd,function(){function n(V,j,Q,$,me){(function de(re,se,Ce,H,oe){for(;H>Ce;){if(H-Ce>600){var Xe=H-Ce+1,be=se-Ce+1,Ue=Math.log(Xe),$e=.5*Math.exp(2*Ue/3),qe=.5*Math.sqrt(Ue*$e*(Xe-$e)/Xe)*(be-Xe/2<0?-1:1),zt=Math.max(Ce,Math.floor(se-be*$e/Xe+qe)),Pt=Math.min(H,Math.floor(se+(Xe-be)*$e/Xe+qe));de(re,se,zt,Pt,oe)}var Zt=re[se],Xt=Ce,kt=H;for(r(re,Ce,se),oe(re[H],Zt)>0&&r(re,Ce,H);Xt0;)kt--}oe(re[Ce],Zt)===0?r(re,Ce,kt):r(re,++kt,H),kt<=se&&(Ce=kt+1),se<=kt&&(H=kt-1)}})(V,j,Q||0,$||V.length-1,me||i)}function r(V,j,Q){var $=V[j];V[j]=V[Q],V[Q]=$}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 c(V,j,Q){if(!Q)return j.indexOf(V);for(var $=0;$=V.minX&&j.maxY>=V.minY}function q(V){return{children:V,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ee(V,j,Q,$,me){for(var de=[j,Q];de.length;)if(!((Q=de.pop())-(j=de.pop())<=$)){var re=j+Math.ceil((Q-j)/$/2)*$;n(V,re,j,Q,me),de.push(j,re,re,Q)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(V){var j=this.data,Q=[];if(!U(V,j))return Q;for(var $=this.toBBox,me=[];j;){for(var de=0;de=0&&me[j].children.length>this._maxEntries;)this._split(me,j),j--;this._adjustParentBBoxes($,me,j)},a.prototype._split=function(V,j){var Q=V[j],$=Q.children.length,me=this._minEntries;this._chooseSplitAxis(Q,me,$);var de=this._chooseSplitIndex(Q,me,$),re=q(Q.children.splice(de,Q.children.length-de));re.height=Q.height,re.leaf=Q.leaf,l(Q,this.toBBox),l(re,this.toBBox),j?V[j-1].children.push(re):this._splitRoot(Q,re)},a.prototype._splitRoot=function(V,j){this.data=q([V,j]),this.data.height=V.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(V,j,Q){for(var $,me,de,re,se,Ce,H,oe=1/0,Xe=1/0,be=j;be<=Q-j;be++){var Ue=m(V,0,be,this.toBBox),$e=m(V,be,Q,this.toBBox),qe=(me=Ue,de=$e,re=void 0,se=void 0,Ce=void 0,H=void 0,re=Math.max(me.minX,de.minX),se=Math.max(me.minY,de.minY),Ce=Math.min(me.maxX,de.maxX),H=Math.min(me.maxY,de.maxY),Math.max(0,Ce-re)*Math.max(0,H-se)),zt=T(Ue)+T($e);qe=j;oe--){var Xe=V.children[oe];w(re,V.leaf?me(Xe):Xe),se+=D(re)}return se},a.prototype._adjustParentBBoxes=function(V,j,Q){for(var $=Q;$>=0;$--)w(j[$],V)},a.prototype._condense=function(V){for(var j=V.length-1,Q=void 0;j>=0;j--)V[j].children.length===0?j>0?(Q=V[j-1].children).splice(Q.indexOf(V[j]),1):this.clear():l(V[j],this.toBBox)},a})})(KC);var J6=KC.exports;const Q6=C_(N6),$6=C_(Z6),eF=C_(pD);var ol=J6,JC=Q6,QC=$6,sf=eF.default,tF=QC.featureEach;QC.coordEach;JC.polygon;var qS=JC.featureCollection;function $C(t){var e=new ol(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:sf(n),ol.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:sf(i),r.push(i)}):tF(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:sf(i),r.push(i)}),ol.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:sf(n),ol.prototype.remove.call(this,n,r)},e.clear=function(){return ol.prototype.clear.call(this)},e.search=function(n){var r=ol.prototype.search.call(this,this.toBBox(n));return qS(r)},e.collides=function(n){return ol.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=ol.prototype.all.call(this);return qS(n)},e.toJSON=function(){return ol.prototype.toJSON.call(this)},e.fromJSON=function(n){return ol.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=sf(n);else if(n.type==="FeatureCollection")r=sf(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}k1.exports=$C;k1.exports.default=$C;var nF=k1.exports;const rF=Rv(nF);function iF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=ga(t)),e.type==="LineString"&&(e=ga(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=WS(t,e);return i&&r.push(i),Hc(r)}var a=rF();return a.load(jS(e)),S_(jS(t),function(c){S_(a.search(c),function(l){var m=WS(c,l);if(m){var w=Hf(m).join(",");n[w]||(n[w]=!0,r.push(m))}})}),Hc(r)}function WS(t,e){var n=Hf(t),r=Hf(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],l=n[1][1],m=r[0][0],w=r[0][1],S=r[1][0],E=r[1][1],T=(E-w)*(c-i)-(S-m)*(l-a),D=(S-m)*(a-w)-(E-w)*(i-m),k=(c-i)*(a-w)-(l-a)*(i-m);if(T===0)return null;var U=D/T,q=k/T;if(U>=0&&U<=1&&q>=0&&q<=1){var ee=i+U*(c-i),V=a+U*(l-a);return os([ee,V])}return null}function oF(t,e,n){n===void 0&&(n={});var r=os([1/0,1/0],{dist:1/0}),i=0;return ip(t,function(a){for(var c=Hf(a),l=0;l0&&(q=U.features[0],q.properties.dist=hd(e,q,n),q.properties.location=i+hd(m,q,n)),m.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()}});gi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(HS(this.points).forEach((r,i)=>{n.push([i+1,oF(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))});gi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=P0(e.lngLat.toArray()),this.onClick(e),this.finish())});gi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});gi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});gi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});gi(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=P0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat(HS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),tT.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,nT.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=P0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(eT),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>uF&&this.previousStates.shift()}}function HS(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 hF(t){let e,n,r;return{c(){e=vt("Undo ("),n=vt(t[1]),r=vt(")")},m(i,a){Me(i,e,a),Me(i,n,a),Me(i,r,a)},p(i,a){a&2&&Pn(n,i[1])},d(i){i&&(Pe(e),Pe(n),Pe(r))}}}function fF(t){let e;return{c(){e=vt("Undo")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function pF(t){let e,n,r,i,a,c,l,m,w,S,E;function T(U,q){return U[1]==0?fF:hF}let D=T(t),k=D(t);return{c(){e=ke("div"),n=ke("button"),n.textContent="Finish",r=ot(),i=ke("button"),i.textContent="Cancel",a=ot(),c=ke("button"),k.c(),m=ot(),w=ke("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=l=t[1]==0,Ii(e,"display","flex"),Ii(e,"justify-content","space-between")},m(U,q){Me(U,e,q),we(e,n),we(e,r),we(e,i),we(e,a),we(e,c),k.m(c,null),Me(U,m,q),Me(U,w,q),S||(E=[Gt(n,"click",t[2]),Gt(i,"click",t[3]),Gt(c,"click",t[4])],S=!0)},p(U,[q]){D===(D=T(U))&&k?k.p(U,q):(k.d(1),k=D(U),k&&(k.c(),k.m(c,null))),q&2&&l!==(l=U[1]==0)&&(c.disabled=l)},i:et,o:et,d(U){U&&(Pe(e),Pe(m),Pe(w)),k.d(),S=!1,xi(E)}}}function dF(t,e,n){let r;Ct(t,nT,m=>n(1,r=m));let{polygonTool:i}=e;const a=()=>i.finish(),c=()=>i.cancel(),l=()=>i.undo();return t.$$set=m=>{"polygonTool"in m&&n(0,i=m.polygonTool)},[i,r,a,c,l]}class mF extends Jt{constructor(e){super(),Kt(this,e,dF,pF,jt,{polygonTool:0})}}let gF=Date.now();function lm(t){return`${t}-${gF++}`}const rT=Symbol.for("svelte-maplibre");function _F(){return Cv(rT)}function ZS(t){return{subscribe:t.subscribe}}function iT({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=_F(),a=tr(null),c=ZS(a),l={...i,[t]:ZS(a)};if(e&&(l.popupTarget=c),r){let m=tr(null);l.layerEvent=m,i.layerEvent=m}return n&&(l.cluster=tr()),Iv(rT,l),{...i,self:a}}function yF(){return iT({key:"source",setCluster:!0})}function vF(t=!0){return iT({key:"layer",setPopupTarget:t,setMouseEvent:t})}function XS(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 bF(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 xF(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function YS(t){let e=t[0],n,r,i=KS(t);return{c(){i.c(),n=Er()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c[0]&1&&jt(e,e=a[0])?(Mn(),Se(i,1,1,et),An(),i=KS(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function KS(t){let e;const n=t[36].default,r=Xr(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)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function wF(t){let e,n,r=t[0]&&YS(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&_e(r,1)):(r=YS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function SF(t,e,n){let r,i,a,c,l,m,w,S,E,T,D,k,{$$slots:U={},$$scope:q}=e,{id:ee=lm("layer")}=e,{source:V=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:Q=void 0}=e,{beforeLayerType:$=void 0}=e,{type:me}=e,{paint:de=void 0}=e,{layout:re=void 0}=e,{filter:se=void 0}=e,{applyToClusters:Ce=void 0}=e,{minzoom:H=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:Xe=!1}=e,{hovered:be=null}=e,{interactive:Ue=!0}=e,{hoverCursor:$e=void 0}=e,{eventsIfTopMost:qe=!1}=e;const zt=Yu(),{map:Pt,source:Zt,self:Xt,minzoom:kt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=vF();Ct(t,Pt,ie=>n(31,E=ie)),Ct(t,Zt,ie=>n(32,T=ie)),Ct(t,Xt,ie=>n(0,S=ie)),Ct(t,kt,ie=>n(34,k=ie)),Ct(t,un,ie=>n(33,D=ie)),us(()=>{S&&E&&(bn.delete(S),E==null||E.removeLayer(S))});let mn;function Bn(ie){var Oe,en;if(!Ue||!S||!E||qe&&Fn(ie)!==S)return;let Te=ie.features??[],_t=(en=(Oe=Te[0])==null?void 0:Oe.properties)==null?void 0:en.cluster_id,xn={event:ie,map:E,clusterId:_t,layer:S,source:l,features:Te};zt(ie.type,xn)}function ir(ie){var Oe,en;if(!Ue||!S||!E||qe&&Fn(ie)!==S)return;$e&&(E.getCanvas().style.cursor=$e);let Te=ie.features??[];n(6,be=Te[0]??null);let _t=(en=(Oe=Te[0])==null?void 0:Oe.properties)==null?void 0:en.cluster_id;zt("mouseenter",{event:ie,map:E,clusterId:_t,layer:S,source:l,features:Te})}function $r(ie){var Oe,en,Dr;if(!Ue||!E)return;if(qe&&Fn(ie)!==S){n(6,be=null),Xe&&mn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:j,id:mn},{hover:!1}),mn=void 0);return}E.getCanvas().style.cursor=$e;let Te=ie.features??[],_t=(en=(Oe=Te[0])==null?void 0:Oe.properties)==null?void 0:en.cluster_id,xn=(Dr=Te[0])==null?void 0:Dr.id;xn!==mn&&(Xe&&(mn!==void 0&&(E==null||E.setFeatureState({source:l,id:mn,sourceLayer:j},{hover:!1})),E==null||E.setFeatureState({source:l,id:xn,sourceLayer:j},{hover:!0})),mn=xn,n(6,be=Te[0]??null)),zt("mousemove",{event:ie,map:E,clusterId:_t,layer:S,source:l,features:Te})}function gr(ie){if(!(!Ue||!S||!E)){if($e&&(E.getCanvas().style.cursor=""),n(6,be=null),Xe&&mn!==void 0){const Te={source:l,id:mn,sourceLayer:j};E==null||E.setFeatureState(Te,{hover:!1}),mn=void 0}zt("mouseleave",{map:E,layer:S,source:l})}}let ur=!0;function or(ie){E&&(E.off("click",ie,Bn),E.off("dblclick",ie,Bn),E.off("contextmenu",ie,Bn),E.off("mouseenter",ie,ir),E.off("mousemove",ie,$r),E.off("mouseleave",ie,gr))}return us(()=>{E&&S&&or(S)}),t.$$set=ie=>{"id"in ie&&n(7,ee=ie.id),"source"in ie&&n(8,V=ie.source),"sourceLayer"in ie&&n(9,j=ie.sourceLayer),"beforeId"in ie&&n(10,Q=ie.beforeId),"beforeLayerType"in ie&&n(11,$=ie.beforeLayerType),"type"in ie&&n(12,me=ie.type),"paint"in ie&&n(13,de=ie.paint),"layout"in ie&&n(14,re=ie.layout),"filter"in ie&&n(15,se=ie.filter),"applyToClusters"in ie&&n(16,Ce=ie.applyToClusters),"minzoom"in ie&&n(17,H=ie.minzoom),"maxzoom"in ie&&n(18,oe=ie.maxzoom),"manageHoverState"in ie&&n(19,Xe=ie.manageHoverState),"hovered"in ie&&n(6,be=ie.hovered),"interactive"in ie&&n(20,Ue=ie.interactive),"hoverCursor"in ie&&n(21,$e=ie.hoverCursor),"eventsIfTopMost"in ie&&n(22,qe=ie.eventsIfTopMost),"$$scope"in ie&&n(35,q=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=xF(Ce)),t.$$.dirty[0]&1073774592&&n(24,i=bF("all",r,se)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=H??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=V||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==ee&&l){S&&(or(S),bn.delete(S));let ie=Q;if(!Q&&$){let Te=E.getStyle().layers,_t=typeof $=="function"?$:Oe=>Oe.type===$,xn=Te==null?void 0:Te.find(_t);xn&&(ie=xn.id)}Gn(Xt,S=ee,S),E.addLayer(qc({id:S,type:me,source:l,"source-layer":j,filter:i,paint:de,layout:re,minzoom:a,maxzoom:c}),ie),n(23,ur=!0),E.on("click",S,Bn),E.on("dblclick",S,Bn),E.on("contextmenu",S,Bn),E.on("mouseenter",S,ir),E.on("mousemove",S,$r),E.on("mouseleave",S,gr)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Ue}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,m=S?XS((ie,Te)=>E==null?void 0:E.setPaintProperty(S,ie,Te)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?XS((ie,Te)=>E==null?void 0:E.setLayoutProperty(S,ie,Te)):void 0),t.$$.dirty[0]&268443648&&(m==null||m(de)),t.$$.dirty[0]&134234112&&(w==null||w(re)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(E==null||E.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(ur?n(23,ur=!1):E==null||E.setFilter(S,i))},[S,Pt,Zt,Xt,kt,un,be,ee,V,j,Q,$,me,de,re,se,Ce,H,oe,Xe,Ue,$e,qe,ur,i,c,a,w,m,l,r,E,T,D,k,q,U]}class D1 extends Jt{constructor(e){super(),Kt(this,e,SF,wF,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 EF(t){let e;const n=t[16].default,r=Xr(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)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function IF(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:[EF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new D1({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.applyToClusters=c[9]),l&1024&&(m.minzoom=c[10]),l&2048&&(m.maxzoom=c[11]),l&4096&&(m.hoverCursor=c[12]),l&8192&&(m.manageHoverState=c[13]),l&16384&&(m.eventsIfTopMost=c[14]),l&32768&&(m.interactive=c[15]),l&16777216&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function CF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:V=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:Q=!0}=e;function $(oe){V=oe,n(0,V)}function me(oe){dn.call(this,t,oe)}function de(oe){dn.call(this,t,oe)}function re(oe){dn.call(this,t,oe)}function se(oe){dn.call(this,t,oe)}function Ce(oe){dn.call(this,t,oe)}function H(oe){dn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,a=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,m=oe.beforeId),"beforeLayerType"in oe&&n(5,w=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,T=oe.filter),"applyToClusters"in oe&&n(9,D=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,U=oe.maxzoom),"hoverCursor"in oe&&n(12,q=oe.hoverCursor),"manageHoverState"in oe&&n(13,ee=oe.manageHoverState),"hovered"in oe&&n(0,V=oe.hovered),"eventsIfTopMost"in oe&&n(14,j=oe.eventsIfTopMost),"interactive"in oe&&n(15,Q=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[V,a,c,l,m,w,S,E,T,D,k,U,q,ee,j,Q,r,$,me,de,re,se,Ce,H,i]}class TF extends Jt{constructor(e){super(),Kt(this,e,CF,IF,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 LF(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function PF(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:[LF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new D1({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.minzoom=c[9]),l&1024&&(m.maxzoom=c[10]),l&2048&&(m.hoverCursor=c[11]),l&4096&&(m.manageHoverState=c[12]),l&8192&&(m.eventsIfTopMost=c[13]),l&16384&&(m.interactive=c[14]),l&8388608&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function MF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:V=!1}=e,{interactive:j=!0}=e;function Q(H){ee=H,n(0,ee)}function $(H){dn.call(this,t,H)}function me(H){dn.call(this,t,H)}function de(H){dn.call(this,t,H)}function re(H){dn.call(this,t,H)}function se(H){dn.call(this,t,H)}function Ce(H){dn.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,l=H.sourceLayer),"beforeId"in H&&n(4,m=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,E=H.layout),"filter"in H&&n(8,T=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,k=H.maxzoom),"hoverCursor"in H&&n(11,U=H.hoverCursor),"manageHoverState"in H&&n(12,q=H.manageHoverState),"hovered"in H&&n(0,ee=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)},[ee,a,c,l,m,w,S,E,T,D,k,U,q,V,j,r,Q,$,me,de,re,se,Ce,i]}class AF extends Jt{constructor(e){super(),Kt(this,e,MF,PF,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 kF(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 l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function DF(t,e,n){dE().then(()=>{let r=uE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function JS(t){let e=t[0],n,r,i=QS(t);return{c(){i.c(),n=Er()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c&1&&jt(e,e=a[0])?(Mn(),Se(i,1,1,et),An(),i=QS(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function QS(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[14],e?Yr(n,i[14],a,null):Jr(i[14]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function RF(t){let e,n,r=t[0]&&JS(t);return{c(){r&&r.c(),e=Er()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=JS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Mn(),Se(r,1,1,()=>{r=null}),An())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function NF(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:m=lm("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:T=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:k=void 0}=e;const{map:U,cluster:q,self:ee}=yF();Ct(t,U,Q=>n(13,i=Q)),Ct(t,q,Q=>n(16,a=Q)),Ct(t,ee,Q=>n(0,r=Q));let V,j=!0;return us(()=>{r&&V&&i&&(DF(U,r,V),Gn(ee,r=null,r),n(11,V=void 0))}),t.$$set=Q=>{"id"in Q&&n(4,m=Q.id),"data"in Q&&n(5,w=Q.data),"generateId"in Q&&n(6,S=Q.generateId),"promoteId"in Q&&n(7,E=Q.promoteId),"filter"in Q&&n(8,T=Q.filter),"lineMetrics"in Q&&n(9,D=Q.lineMetrics),"cluster"in Q&&n(10,k=Q.cluster),"$$scope"in Q&&n(14,l=Q.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Gn(q,a=k,a),t.$$.dirty&12273&&i&&r!==m&&(Gn(ee,r=m,r),kF(i,r,qc({type:"geojson",data:w,filter:T,lineMetrics:D,generateId:S,promoteId:E,cluster:!!k,clusterMinPoints:k==null?void 0:k.minPoints,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius,clusterProperties:k==null?void 0:k.properties}),Q=>i&&Q===r,()=>{r&&(n(11,V=i==null?void 0:i.getSource(r)),n(12,j=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,V=i==null?void 0:i.getSource(m))})),t.$$.dirty&6176&&V&&(j?n(12,j=!1):V.setData(w)),t.$$.dirty&3072&&(V==null||V.setClusterOptions(qc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,U,q,ee,m,w,S,E,T,D,k,V,j,i,l,c]}class OF extends Jt{constructor(e){super(),Kt(this,e,NF,RF,jt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function zF(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function FF(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:[zF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new D1({props:a}),jn.push(()=>Xi(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(){it(e.$$.fragment)},m(c,l){tt(e,c,l),r=!0},p(c,[l]){const m={};l&2&&(m.id=c[1]),l&4&&(m.source=c[2]),l&8&&(m.sourceLayer=c[3]),l&16&&(m.beforeId=c[4]),l&32&&(m.beforeLayerType=c[5]),l&64&&(m.paint=c[6]),l&128&&(m.layout=c[7]),l&256&&(m.filter=c[8]),l&512&&(m.minzoom=c[9]),l&1024&&(m.maxzoom=c[10]),l&2048&&(m.hoverCursor=c[11]),l&4096&&(m.manageHoverState=c[12]),l&8192&&(m.eventsIfTopMost=c[13]),l&16384&&(m.interactive=c[14]),l&8388608&&(m.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,m.hovered=c[0],Zi(()=>n=!1)),e.$set(m)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){nt(e,c)}}}function BF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:T=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:V=!1}=e,{interactive:j=!0}=e;function Q(H){ee=H,n(0,ee)}function $(H){dn.call(this,t,H)}function me(H){dn.call(this,t,H)}function de(H){dn.call(this,t,H)}function re(H){dn.call(this,t,H)}function se(H){dn.call(this,t,H)}function Ce(H){dn.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,l=H.sourceLayer),"beforeId"in H&&n(4,m=H.beforeId),"beforeLayerType"in H&&n(5,w=H.beforeLayerType),"paint"in H&&n(6,S=H.paint),"layout"in H&&n(7,E=H.layout),"filter"in H&&n(8,T=H.filter),"minzoom"in H&&n(9,D=H.minzoom),"maxzoom"in H&&n(10,k=H.maxzoom),"hoverCursor"in H&&n(11,U=H.hoverCursor),"manageHoverState"in H&&n(12,q=H.manageHoverState),"hovered"in H&&n(0,ee=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)},[ee,a,c,l,m,w,S,E,T,D,k,U,q,V,j,r,Q,$,me,de,re,se,Ce,i]}class VF extends Jt{constructor(e){super(),Kt(this,e,BF,FF,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 UF(t){let e,n,r,i,a,c;return e=new AF({props:{id:"edit-polygon-fill",filter:sF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new VF({props:{id:"edit-polygon-lines",filter:aF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new TF({props:{id:"edit-polygon-vertices",filter:lF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment),i=ot(),it(a.$$.fragment)},m(l,m){tt(e,l,m),Me(l,n,m),tt(r,l,m),Me(l,i,m),tt(a,l,m),c=!0},p:et,i(l){c||(_e(e.$$.fragment,l),_e(r.$$.fragment,l),_e(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Pe(n),Pe(i)),nt(e,l),nt(r,l),nt(a,l)}}}function GF(t){let e,n;return e=new OF({props:{data:t[0],$$slots:{default:[UF]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(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||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function jF(t,e,n){let r;return Ct(t,tT,i=>n(0,r=i)),[r]}class qF extends Jt{constructor(e){super(),Kt(this,e,jF,GF,jt,{})}}function WF(t){let e,n,r,i,a,c,l;return{c(){e=ke("button"),e.textContent="Import current view",n=ot(),r=ke("i"),r.textContent="or...",i=ot(),a=ke("button"),a.textContent="Draw an area to import on the map",Be(e,"type","button"),Be(a,"type","button")},m(m,w){Me(m,e,w),Me(m,n,w),Me(m,r,w),Me(m,i,w),Me(m,a,w),c||(l=[Gt(e,"click",t[1]),Gt(a,"click",t[2])],c=!0)},p:et,i:et,o:et,d(m){m&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a)),c=!1,xi(l)}}}function HF(t){let e,n;return e=new mF({props:{polygonTool:t[0]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function ZF(t){let e,n,r,i;const a=[HF,WF],c=[];function l(m,w){return m[0]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=Er()},m(m,w){c[e].m(m,w),Me(m,r,w),i=!0},p(m,[w]){let S=e;e=l(m),e===S?c[e].p(m,w):(Mn(),Se(c[S],1,1,()=>{c[S]=null}),An(),n=c[e],n?n.p(m,w):(n=c[e]=a[e](m),n.c()),_e(n,1),n.m(r.parentNode,r))},i(m){i||(_e(n),i=!0)},o(m){Se(n),i=!1},d(m){m&&Pe(r),c[e].d(m)}}}function fd(t){return[t.lng,t.lat]}function XF(t,e,n){let{map:r}=e;const i=Yu();let a=null;async function c(S){try{i("loading","Loading from Overpass");let T=await(await fetch(KF(S))).text();i("gotXml",T)}catch(E){i("error",E.toString())}}function l(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[fd(S.getSouthWest()),fd(S.getNorthWest()),fd(S.getNorthEast()),fd(S.getSouthEast()),fd(S.getSouthWest())]],type:"Polygon"}}}async function m(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await c(l())}}function w(){r&&(n(0,a=new cF(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,m,w,r]}class YF extends Jt{constructor(e){super(),Kt(this,e,XF,ZF,jt,{map:3})}}function KF(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 $S(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function eE(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function tE(t){let e,n=t[26]+"",r,i;return{c(){e=ke("option"),r=vt(n),e.__value=i=t[25],co(e,e.__value)},m(a,c){Me(a,e,c),we(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&Pn(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,co(e,e.__value))},d(a){a&&Pe(e)}}}function nE(t){let e,n,r=zr(t[22]),i=[];for(let a=0;at[9].call(c)),Be(k,"type","file"),Be(se,"type","file")},m(Ue,$e){tt(e,Ue,$e),Me(Ue,n,$e),Me(Ue,r,$e),we(r,i),we(i,a),we(i,c),we(c,l);for(let qe=0;qen(15,r=re)),Ct(t,Ql,re=>n(16,i=re)),Ct(t,I_,re=>n(5,a=re));let c="",l=[],m=!1,w=[];Xu(async()=>{try{let re=await fetch("/osm/areas.json");if(re.ok)m=!0,console.log("Using local cache, not od2net.org"),n(2,w=await re.json());else{let se=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await se.json())}}catch{}});let S;async function E(re){try{await k(await S.files[0].arrayBuffer()),n(0,c="")}catch(se){window.alert(`Couldn't open this file: ${se}`)}n(1,l=[])}let T;async function D(re){try{n(1,l=["Loading pre-built file"]);let se=await T.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(se)),console.timeEnd("load"),Gn(mf,r=!0,r),n(0,c="")}catch(se){window.alert(`Couldn't open this file: ${se}`)}n(1,l=[])}async function k(re){let se=m?`http://${window.location.host}/15m/gtfs.gmd`:"https://assets.od2net.org/gtfs.gmd",Ce=m?`http://${window.location.host}/15m/population.fgb`:"https://assets.od2net.org/population.fgb";n(1,l=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(re),se,Ce,Dv(U)),console.timeEnd("load"),Gn(mf,r=!0,r)}function U(re){n(1,l=[...l,re])}async function q(re){try{await k(new TextEncoder().encode(re.detail)),n(0,c="")}catch(se){window.alert(`Couldn't import from Overpass: ${se}`)}n(1,l=[])}async function ee(re){re!=""&&(m?await V(`/osm/${re}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${re}.pbf`))}async function V(re){try{n(1,l=[`Downloading ${re}`]);let se=await fetch(re);await k(await se.arrayBuffer())}catch(se){window.alert(`Couldn't open from URL ${re}: ${se}`)}n(1,l=[])}function j(){c=hE(this),n(0,c),n(2,w)}function Q(re){jn[re?"unshift":"push"](()=>{S=re,n(3,S)})}const $=re=>n(1,l=[...l,re.detail]),me=re=>window.alert(re.detail);function de(re){jn[re?"unshift":"push"](()=>{T=re,n(4,T)})}return t.$$.update=()=>{t.$$.dirty&1&&ee(c)},[c,l,w,S,T,a,E,D,q,j,Q,$,me,de]}class $F extends Jt{constructor(e){super(),Kt(this,e,QF,JF,jt,{})}}function eB(t){let e;return{c(){e=ke("div"),Be(e,"slot","top")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Pe(e)}}}function tB(t){let e;return{c(){e=ke("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Me(n,e,r)},i:et,o:et,d(n){n&&Pe(e)}}}function nB(t){let e,n;return e=new $F({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function rB(t){let e,n,r,i,a,c;const l=[nB,tB],m=[];function w(S,E){return S[0]?0:1}return i=w(t),a=m[i]=l[i](t),{c(){e=ke("div"),n=ke("h2"),n.textContent="Choose your study area",r=ot(),a.c(),Be(e,"slot","sidebar")},m(S,E){Me(S,e,E),we(e,n),we(e,r),m[i].m(e,null),c=!0},p(S,E){let T=i;i=w(S),i!==T&&(Mn(),Se(m[T],1,1,()=>{m[T]=null}),An(),a=m[i],a||(a=m[i]=l[i](S),a.c()),_e(a,1),a.m(e,null))},i(S){c||(_e(a),c=!0)},o(S){Se(a),c=!1},d(S){S&&Pe(e),m[i].d()}}}function iB(t){let e,n,r;return n=new qF({}),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","map")},m(i,a){Me(i,e,a),tt(n,e,null),r=!0},p:et,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),nt(n)}}}function oB(t){let e,n;return e=new th({props:{$$slots:{map:[iB],sidebar:[rB],top:[eB]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,[i]){const a={};i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function sB(t,e,n){let r,i,a,c,l;return Ct(t,bf,m=>n(1,r=m)),Ct(t,Lc,m=>n(2,i=m)),Ct(t,Ql,m=>n(3,a=m)),Ct(t,mf,m=>n(4,c=m)),Ct(t,I_,m=>n(0,l=m)),Xu(async()=>{Gn(mf,c=!1,c),await a.unset(),Gn(Lc,i=null,i),Gn(bf,r=null,r)}),[l]}class aB extends Jt{constructor(e){super(),Kt(this,e,sB,oB,jt,{})}}function lB(){return new Worker("/15m/assets/worker-28b5e3cc.js")}function uB(t){let e,n,r,i,a,c;return{c(){e=ke("div"),n=ke("button"),n.innerHTML=`A/B Street logo`,r=ot(),i=ke("span"),Be(n,"class","outline"),Ii(i,"width","100%"),Be(e,"slot","top"),Ii(e,"display","flex")},m(l,m){Me(l,e,m),we(e,n),we(e,r),we(e,i),t[18](i),a||(c=Gt(n,"click",t[17]),a=!0)},p:et,d(l){l&&Pe(e),t[18](null),a=!1,c()}}}function rE(t){let e,n,r,i,a,c;return{c(){e=ke("hr"),n=ot(),r=ke("div"),i=ke("button"),i.textContent="Zoom to fit"},m(l,m){Me(l,e,m),Me(l,n,m),Me(l,r,m),we(r,i),a||(c=Gt(i,"click",t[9]),a=!0)},p:et,d(l){l&&(Pe(e),Pe(n),Pe(r)),a=!1,c()}}}function cB(t){let e,n,r,i,a,c=t[5].kind!="title"&&rE(t);return{c(){e=ke("div"),n=ke("h1"),n.textContent="15-minute neighbourhood tool",r=ot(),i=ke("div"),a=ot(),c&&c.c(),Be(e,"slot","left")},m(l,m){Me(l,e,m),we(e,n),we(e,r),we(e,i),t[16](i),we(e,a),c&&c.m(e,null)},p(l,m){l[5].kind!="title"?c?c.p(l,m):(c=rE(l),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(l){l&&Pe(e),t[16](null),c&&c.d()}}}function iE(t){let e,n;return e=new aB({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function oE(t){let e,n,r,i,a,c,l,m={ctx:t,current:null,token:null,hasCatch:!1,pending:dB,then:fB,catch:hB,value:23,blocks:[,,,]};yf(e=cs(t[6]).getInvertedBoundary(),m);const w=[bB,vB,yB,_B,gB,mB],S=[];function E(D,k){return D[5].kind=="debug"?0:D[5].kind=="isochrone"?1:D[5].kind=="route"?2:D[5].kind=="score"?3:D[5].kind=="debug-route"?4:D[5].kind=="buffer-route"?5:-1}~(r=E(t))&&(i=S[r]=w[r](t));let T=t[7]&&sE(t);return{c(){m.block.c(),n=ot(),i&&i.c(),a=ot(),T&&T.c(),c=Er()},m(D,k){m.block.m(D,m.anchor=k),m.mount=()=>n.parentNode,m.anchor=n,Me(D,n,k),~r&&S[r].m(D,k),Me(D,a,k),T&&T.m(D,k),Me(D,c,k),l=!0},p(D,k){t=D,m.ctx=t,k&64&&e!==(e=cs(t[6]).getInvertedBoundary())&&yf(e,m)||Lv(m,t,k);let U=r;r=E(t),r===U?~r&&S[r].p(t,k):(i&&(Mn(),Se(S[U],1,1,()=>{S[U]=null}),An()),~r?(i=S[r],i?i.p(t,k):(i=S[r]=w[r](t),i.c()),_e(i,1),i.m(a.parentNode,a)):i=null),t[7]?T?(T.p(t,k),k&128&&_e(T,1)):(T=sE(t),T.c(),_e(T,1),T.m(c.parentNode,c)):T&&(Mn(),Se(T,1,1,()=>{T=null}),An())},i(D){l||(_e(m.block),_e(i),_e(T),l=!0)},o(D){for(let k=0;k<3;k+=1){const U=m.blocks[k];Se(U)}Se(i),Se(T),l=!1},d(D){D&&(Pe(n),Pe(a),Pe(c)),m.block.d(D),m.token=null,m=null,~r&&S[r].d(D),T&&T.d(D)}}}function hB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function fB(t){let e,n;return e=new ma({props:{data:t[23],$$slots:{default:[pB]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[23]),i&16777216&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function pB(t){let e,n;return e=new I1({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function dB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function mB(t){let e,n;return e=new u6({props:{gj:t[5].gj}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5].gj),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function gB(t){let e,n;return e=new Qz({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){it(e.$$.fragment)},m(r,i){tt(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||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function _B(t){let e,n;return e=new x6({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function yB(t){let e,n;return e=new Gz({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function vB(t){let e,n;return e=new Iz({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function bB(t){let e,n;return e=new dz({}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p:et,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function sE(t){let e,n,r,i={ctx:t,current:null,token:null,hasCatch:!1,pending:SB,then:wB,catch:xB,value:22,blocks:[,,,]};return yf(n=cs(t[6]).renderZones(),i),{c(){e=Er(),i.block.c()},m(a,c){Me(a,e,c),i.block.m(a,i.anchor=c),i.mount=()=>e.parentNode,i.anchor=e,r=!0},p(a,c){t=a,i.ctx=t,c&64&&n!==(n=cs(t[6]).renderZones())&&yf(n,i)||Lv(i,t,c)},i(a){r||(_e(i.block),r=!0)},o(a){for(let c=0;c<3;c+=1){const l=i.blocks[c];Se(l)}r=!1},d(a){a&&Pe(e),i.block.d(a),i.token=null,i=null}}}function xB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function wB(t){let e,n;return e=new $5({props:{gj:t[22]}}),{c(){it(e.$$.fragment)},m(r,i){tt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.gj=r[22]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){nt(e,r)}}}function SB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function EB(t){let e,n,r,i,a,c,l;e=new YN({props:{map:t[0],apiKey:EE}});let m=t[5].kind=="title"&&iE(),w=t[4]&&oE(t);return{c(){it(e.$$.fragment),n=ot(),r=ke("div"),i=ot(),m&&m.c(),a=ot(),w&&w.c(),c=Er()},m(S,E){tt(e,S,E),Me(S,n,E),Me(S,r,E),t[13](r),Me(S,i,E),m&&m.m(S,E),Me(S,a,E),w&&w.m(S,E),Me(S,c,E),l=!0},p(S,E){const T={};E&1&&(T.map=S[0]),e.$set(T),S[5].kind=="title"?m?E&32&&_e(m,1):(m=iE(),m.c(),_e(m,1),m.m(a.parentNode,a)):m&&(Mn(),Se(m,1,1,()=>{m=null}),An()),S[4]?w?(w.p(S,E),E&16&&_e(w,1)):(w=oE(S),w.c(),_e(w,1),w.m(c.parentNode,c)):w&&(Mn(),Se(w,1,1,()=>{w=null}),An())},i(S){l||(_e(e.$$.fragment,S),_e(m),_e(w),l=!0)},o(S){Se(e.$$.fragment,S),Se(m),Se(w),l=!1},d(S){S&&(Pe(n),Pe(r),Pe(i),Pe(a),Pe(c)),nt(e,S),t[13](null),m&&m.d(S),w&&w.d(S)}}}function IB(t){let e,n,r,i;function a(l){t[14](l)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${EE}`,standardControls:!0,hash:!0,images:[{id:"cycle_parking",url:hP}],$$slots:{default:[EB]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new l5({props:c}),jn.push(()=>Xi(n,"map",a)),n.$on("error",t[15]),{c(){e=ke("div"),it(n.$$.fragment),Be(e,"slot","main"),Ii(e,"position","relative"),Ii(e,"width","100%"),Ii(e,"height","100vh")},m(l,m){Me(l,e,m),tt(n,e,null),i=!0},p(l,m){const w={};m&16777465&&(w.$$scope={dirty:m,ctx:l}),!r&&m&1&&(r=!0,w.map=l[0],Zi(()=>r=!1)),n.$set(w)},i(l){i||(_e(n.$$.fragment,l),i=!0)},o(l){Se(n.$$.fragment,l),i=!1},d(l){l&&Pe(e),nt(n)}}}function CB(t){let e,n,r,i;return e=new XP({}),r=new w5({props:{$$slots:{main:[IB],left:[cB],top:[uB]},$$scope:{ctx:t}}}),{c(){it(e.$$.fragment),n=ot(),it(r.$$.fragment)},m(a,c){tt(e,a,c),Me(a,n,c),tt(r,a,c),i=!0},p(a,[c]){const l={};c&16777727&&(l.$$scope={dirty:c,ctx:a}),r.$set(l)},i(a){i||(_e(e.$$.fragment,a),_e(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Pe(n),nt(e,a),nt(r,a)}}}function Cg(t,e,n){return e+t*(n-e)}function TB(t,e,n){let r,i,a,c,l,m,w,S,E,T;Ct(t,wv,se=>n(10,r=se)),Ct(t,xv,se=>n(11,i=se)),Ct(t,bv,se=>n(12,a=se)),Ct(t,mf,se=>n(4,c=se)),Ct(t,Ts,se=>n(5,l=se)),Ct(t,bf,se=>n(19,m=se)),Ct(t,Lc,se=>n(20,w=se)),Ct(t,Ql,se=>n(6,S=se)),Ct(t,O0,se=>n(7,E=se)),Ct(t,Wg,se=>n(8,T=se)),Xu(async()=>{const se=vE(new lB);let Ce=await new se;Ql.set(Ce)});let D;async function k(){D&&c&&D.fitBounds(await S.getBounds(),{animate:!1})}async function U(se){if(se){console.log("New map model loaded");let Ce=await S.getBounds();Gn(Lc,w={lng:Cg(.4,Ce[0],Ce[2]),lat:Cg(.4,Ce[1],Ce[3])},w),Gn(bf,m={lng:Cg(.6,Ce[0],Ce[2]),lat:Cg(.6,Ce[1],Ce[3])},m),await k(),Gn(Ts,l={kind:"isochrone"},l)}}let q,ee,V;function j(se){jn[se?"unshift":"push"](()=>{V=se,n(3,V),n(10,r)})}function Q(se){D=se,n(0,D)}const $=se=>{console.log(se.detail.error)};function me(se){jn[se?"unshift":"push"](()=>{ee=se,n(2,ee),n(11,i)})}const de=()=>Gn(Wg,T=!0,T);function re(se){jn[se?"unshift":"push"](()=>{q=se,n(1,q),n(12,a)})}return t.$$.update=()=>{t.$$.dirty&1&&D&&I_.set(D),t.$$.dirty&16&&U(c),t.$$.dirty&4098&&q&&a&&(n(1,q.innerHTML="",q),q.appendChild(a)),t.$$.dirty&2052&&ee&&i&&(n(2,ee.innerHTML="",ee),ee.appendChild(i)),t.$$.dirty&1032&&V&&r&&(n(3,V.innerHTML="",V),V.appendChild(r))},[D,q,ee,V,c,l,S,E,T,k,r,i,a,j,Q,$,me,de,re]}class LB extends Jt{constructor(e){super(),Kt(this,e,TB,CB,jt,{})}}new LB({target:document.getElementById("app")}); diff --git a/assets/main-da277cee.js b/assets/main-da277cee.js new file mode 100644 index 0000000..f5392d1 --- /dev/null +++ b/assets/main-da277cee.js @@ -0,0 +1,645 @@ +var KL=Object.defineProperty;var JL=(t,e,n)=>e in t?KL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gi=(t,e,n)=>(JL(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 et(){}function QL(t,e){for(const n in e)t[n]=e[n];return t}function $L(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function aE(t){return t()}function lx(){return Object.create(null)}function Mi(t){t.forEach(aE)}function S_(t){return typeof t=="function"}function qt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let pg;function To(t,e){return t===e?!0:(pg||(pg=document.createElement("a")),pg.href=e,t===pg.href)}function eP(t){return Object.keys(t).length===0}function lE(t,...e){if(t==null){for(const r of e)r(void 0);return et}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function uE(t){let e;return lE(t,n=>e=n)(),e}function Ct(t,e,n){t.$$.on_destroy.push(lE(e,n))}function Xr(t,e,n,r){if(t){const i=cE(t,e,n,r);return t[0](i)}}function cE(t,e,n,r){return t[1]&&r?QL(n.ctx.slice(),t[1](r(e))):n.ctx}function Yr(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 l=0;l32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function rP(t){return function(e){return e.preventDefault(),t.call(this,e)}}function e0(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 Ev(t){return t===""?null:+t}function iP(t){return Array.from(t.childNodes)}function An(t,e){e=""+e,t.data!==e&&(t.data=e)}function co(t,e){t.value=e??""}function Ei(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Vg(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=oP(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function Iv(t,e){return Hf().$$.context.set(t,e),e}function Cv(t){return Hf().$$.context.get(t)}function dn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const sf=[],Gn=[];let pf=[];const A0=[],fE=Promise.resolve();let k0=!1;function pE(){k0||(k0=!0,fE.then(Tv))}function dE(){return pE(),fE}function Ld(t){pf.push(t)}function Zi(t){A0.push(t)}const t0=new Set;let Qh=0;function Tv(){if(Qh!==0)return;const t=Td;do{try{for(;Qht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),pf=e}const Cg=new Set;let Cc;function Ln(){Cc={r:0,c:[],p:Cc}}function Pn(){Cc.r||Mi(Cc.c),Cc=Cc.p}function ve(t,e){t&&t.i&&(Cg.delete(t),t.i(e))}function Se(t,e,n,r){if(t&&t.o){if(Cg.has(t))return;Cg.add(t),Cc.c.push(()=>{Cg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function _f(t,e){const n=e.token={};function r(i,a,c,l){if(e.token!==n)return;e.resolved=l;let d=e.ctx;c!==void 0&&(d=d.slice(),d[c]=l);const w=i&&(e.current=i)(d);let S=!1;e.block&&(e.blocks?e.blocks.forEach((I,T)=>{T!==a&&I&&(Ln(),Se(I,1,1,()=>{e.blocks[T]===I&&(e.blocks[T]=null)}),Pn())}):e.block.d(1),w.c(),ve(w,1),w.m(e.mount(),e.anchor),S=!0),e.block=w,e.blocks&&(e.blocks[a]=w),S&&Tv()}if($L(t)){const i=Hf();if(t.then(a=>{Hl(i),r(e.then,1,e.value,a),Hl(null)},a=>{if(Hl(i),r(e.catch,2,e.error,a),Hl(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 Lv(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 zr(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function lP(t,e){Se(t,1,1,()=>{e.delete(t.key)})}function uP(t,e,n,r,i,a,c,l,d,w,S,I){let T=t.length,k=a.length,D=T;const U={};for(;D--;)U[t[D].key]=D;const q=[],ee=new Map,B=new Map,j=[];for(D=k;D--;){const pe=I(i,a,D),Q=n(pe);let oe=c.get(Q);oe?r&&j.push(()=>oe.p(pe,e)):(oe=w(Q,pe),oe.c()),ee.set(Q,q[D]=oe),Q in U&&B.set(Q,Math.abs(D-U[Q]))}const $=new Set,ae=new Set;function me(pe){ve(pe,1),pe.m(l,S),c.set(pe.key,pe),S=pe.first,k--}for(;T&&k;){const pe=q[k-1],Q=t[T-1],oe=pe.key,Ae=Q.key;pe===Q?(S=pe.first,T--,k--):ee.has(Ae)?!c.has(oe)||$.has(oe)?me(pe):ae.has(Ae)?T--:B.get(oe)>B.get(Ae)?(ae.add(oe),me(pe)):($.add(Ae),T--):(d(Q,c),T--)}for(;T--;){const pe=t[T];ee.has(pe.key)||d(pe,c)}for(;k;)me(q[k-1]);return Mi(j),q}function Xi(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function ot(t){t&&t.c()}function rt(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Ld(()=>{const a=t.$$.on_mount.map(aE).filter(S_);t.$$.on_destroy?t.$$.on_destroy.push(...a):Mi(a),t.$$.on_mount=[]}),i.forEach(Ld)}function it(t,e){const n=t.$$;n.fragment!==null&&(aP(n.after_update),Mi(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function cP(t,e){t.$$.dirty[0]===-1&&(sf.push(t),pE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const D=k.length?k[0]:T;return w.ctx&&i(w.ctx[I],w.ctx[I]=D)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](D),S&&cP(t,I)),T}):[],w.update(),S=!0,Mi(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=iP(e.target);w.fragment&&w.fragment.l(I),I.forEach(Le)}else w.fragment&&w.fragment.c();e.intro&&ve(t.$$.fragment),rt(t,e.target,e.anchor),Tv()}Hl(d)}class Jt{constructor(){gi(this,"$$");gi(this,"$$set")}$destroy(){it(this,1),this.$destroy=et}$on(e,n){if(!S_(n))return et;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&&!eP(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const hP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(hP);const fP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAAmJLR0QA/4ePzL8AAACgSURBVBjTY2D4D4cvGHoY2BlQwH8U2I4pCQKsDHFg3VglGRjEgazvmJLlQNjIcAnIOobbztcM5piSHUBYzxDNwMfAgMtOGKjHJpnJ8IwhhcGFYREDM6ZkCMMqoPHXGC4zBKEa5cPwBKioAAiXMIQz/GZ4yuCFkHzC4MjgxPCNoZaBjeE+kOXEcB0h+RjIdWG4AGU7w9lg4A0UesBgj8oGAP6nSFElh0b7AAAAAElFTkSuQmCC",pP="/15m/assets/logo_dark-ed08d841.svg";const dP=t=>({dialog:t&1}),ux=t=>({dialog:t[0]});function mP(t){let e,n,r,i,a;const c=t[4].default,l=Xr(c,t,t[3],ux);return{c(){e=ke("dialog"),n=ke("article"),l&&l.c(),e.open=!0},m(d,w){Me(d,e,w),we(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(a=[Gt(window,"click",t[1]),Gt(window,"keydown",t[2]),Gt(e,"close",t[5])],i=!0)},p(d,[w]){l&&l.p&&(!r||w&9)&&Kr(l,c,d,d[3],r?Yr(c,d[3],w,dP):Jr(d[3]),ux)},i(d){r||(ve(l,d),r=!0)},o(d){Se(l,d),r=!1},d(d){d&&Le(e),l&&l.d(d),t[6](null),i=!1,Mi(a)}}}function gP(t,e,n){let{$$slots:r={},$$scope:i}=e,a;function c(S){a.open&&S.target==a&&a.close()}function l(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function d(S){dn.call(this,t,S)}function w(S){Gn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,c,l,i,r,d,w]}class Pv extends Jt{constructor(e){super(),Kt(this,e,gP,mP,qt,{})}}function cx(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function hx(t){let e,n,r=t[1]+"",i,a,c,l=t[2]+"",d,w;return{c(){e=ke("tr"),n=ke("td"),i=vt(r),a=nt(),c=ke("td"),d=vt(l),w=nt()},m(S,I){Me(S,e,I),we(e,n),we(n,i),we(e,a),we(e,c),we(c,d),we(e,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&An(i,r),I&1&&l!==(l=S[2]+"")&&An(d,l)},d(S){S&&Le(e)}}}function _P(t){let e,n,r=zr(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class Mv extends Jt{constructor(e){super(),Kt(this,e,yP,_P,qt,{properties:0})}}function fx(t,e,n){const r=t.slice();return r[3]=e[n],r}function px(t,e,n){const r=t.slice();return r[6]=e[n],r}function dx(t){let e,n;return{c(){e=ke("span"),n=vt(`  + `),Ei(e,"background",t[6]),Ei(e,"width","100%"),Ei(e,"border","1px solid black")},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&1&&Ei(e,"background",r[6])},d(r){r&&Le(e)}}}function vP(t){let e,n=t[3]+"",r;return{c(){e=ke("span"),r=vt(n)},m(i,a){Me(i,e,a),we(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&An(r,n)},d(i){i&&Le(e)}}}function bP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=ke("span"),r=vt(n)},m(i,a){Me(i,e,a),we(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&An(r,n)},d(i){i&&Le(e)}}}function mx(t){let e;function n(a,c){return a[2]>0?bP:vP}let r=n(t),i=r(t);return{c(){i.c(),e=ur()},m(a,c){i.m(a,c),Me(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&&Le(e),i.d(a)}}}function xP(t){let e,n,r,i=zr(t[0]),a=[];for(let d=0;d{"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 mE extends Jt{constructor(e){super(),Kt(this,e,wP,xP,qt,{colorScale:0,limits:1,decimalPlaces:2})}}function cs(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const $h=[];function n0(t,e){return{subscribe:tr(t,e).subscribe}}function tr(t,e=et){let n;const r=new Set;function i(l){if(qt(t,l)&&(t=l,n)){const d=!$h.length;for(const w of r)w[1](),$h.push(w,t);if(d){for(let w=0;w<$h.length;w+=2)$h[w][0]($h[w+1]);$h.length=0}}}function a(l){i(l(t))}function c(l,d=et){const w=[l,d];return r.add(w),r.size===1&&(n=e(i,a)||et),l(t),()=>{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 gE=Symbol("Comlink.proxy"),SP=Symbol("Comlink.endpoint"),EP=Symbol("Comlink.releaseProxy"),r0=Symbol("Comlink.finalizer"),Tg=Symbol("Comlink.thrown"),_E=t=>typeof t=="object"&&t!==null||typeof t=="function",IP={canHandle:t=>_E(t)&&t[gE],serialize(t){const{port1:e,port2:n}=new MessageChannel;return Av(t,e),[n,[n]]},deserialize(t){return t.start(),bE(t)}},CP={canHandle:t=>_E(t)&&Tg 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}},yE=new Map([["proxy",IP],["throw",CP]]);function TP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function Av(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!TP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:c,path:l}=Object.assign({path:[]},i.data),d=(i.data.argumentList||[]).map(Ic);let w;try{const S=l.slice(0,-1).reduce((T,k)=>T[k],t),I=l.reduce((T,k)=>T[k],t);switch(c){case"GET":w=I;break;case"SET":S[l.slice(-1)[0]]=Ic(i.data.value),w=!0;break;case"APPLY":w=I.apply(S,d);break;case"CONSTRUCT":{const T=new I(...d);w=kv(T)}break;case"ENDPOINT":{const{port1:T,port2:k}=new MessageChannel;Av(t,k),w=kP(T,[T])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[Tg]:0}}Promise.resolve(w).catch(S=>({value:S,[Tg]:0})).then(S=>{const[I,T]=jg(S);e.postMessage(Object.assign(Object.assign({},I),{id:a}),T),c==="RELEASE"&&(e.removeEventListener("message",r),vE(e),r0 in t&&typeof t[r0]=="function"&&t[r0]())}).catch(S=>{const[I,T]=jg({value:new TypeError("Unserializable return value"),[Tg]:0});e.postMessage(Object.assign(Object.assign({},I),{id:a}),T)})}),e.start&&e.start()}function LP(t){return t.constructor.name==="MessagePort"}function vE(t){LP(t)&&t.close()}function bE(t,e){return D0(t,[],e)}function dg(t){if(t)throw new Error("Proxy has been released and is not useable")}function xE(t){return af(t,{type:"RELEASE"}).then(()=>{vE(t)})}const Ug=new WeakMap,Gg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Ug.get(t)||0)-1;Ug.set(t,e),e===0&&xE(t)});function PP(t,e){const n=(Ug.get(e)||0)+1;Ug.set(e,n),Gg&&Gg.register(t,e,t)}function MP(t){Gg&&Gg.unregister(t)}function D0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(dg(r),c===EP)return()=>{MP(i),xE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const l=af(t,{type:"GET",path:e.map(d=>d.toString())}).then(Ic);return l.then.bind(l)}return D0(t,[...e,c])},set(a,c,l){dg(r);const[d,w]=jg(l);return af(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:d},w).then(Ic)},apply(a,c,l){dg(r);const d=e[e.length-1];if(d===SP)return af(t,{type:"ENDPOINT"}).then(Ic);if(d==="bind")return D0(t,e.slice(0,-1));const[w,S]=gx(l);return af(t,{type:"APPLY",path:e.map(I=>I.toString()),argumentList:w},S).then(Ic)},construct(a,c){dg(r);const[l,d]=gx(c);return af(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:l},d).then(Ic)}});return PP(i,t),i}function AP(t){return Array.prototype.concat.apply([],t)}function gx(t){const e=t.map(jg);return[e.map(n=>n[0]),AP(e.map(n=>n[1]))]}const wE=new WeakMap;function kP(t,e){return wE.set(t,e),t}function kv(t){return Object.assign(t,{[gE]:!0})}function jg(t){for(const[e,n]of yE)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},wE.get(t)||[]]}function Ic(t){switch(t.type){case"HANDLER":return yE.get(t.name).deserialize(t.value);case"RAW":return t.value}}function af(t,e,n){return new Promise(r=>{const i=DP();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 DP(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let Lt;const Wl=new Array(128).fill(void 0);Wl.push(void 0,null,!0,!1);function ht(t){return Wl[t]}let bd=Wl.length;function RP(t){t<132||(Wl[t]=bd,bd=t)}function La(t){const e=ht(t);return RP(t),e}let fl=0,pd=null;function xd(){return(pd===null||pd.byteLength===0)&&(pd=new Uint8Array(Lt.memory.buffer)),pd}const Lg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},NP=typeof Lg.encodeInto=="function"?function(t,e){return Lg.encodeInto(t,e)}:function(t,e){const n=Lg.encode(t);return e.set(n),{read:t.length,written:n.length}};function cf(t,e,n){if(n===void 0){const l=Lg.encode(t),d=e(l.length,1)>>>0;return xd().subarray(d,d+l.length).set(l),fl=l.length,d}let r=t.length,i=e(r,1)>>>0;const a=xd();let c=0;for(;c127)break;a[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=xd().subarray(i+c,i+r),d=NP(t,l);c+=d.written,i=n(i,r,c,1)>>>0}return fl=c,i}function Js(t){return t==null}let dd=null;function _n(){return(dd===null||dd.byteLength===0)&&(dd=new Int32Array(Lt.memory.buffer)),dd}function Ft(t){bd===Wl.length&&Wl.push(Wl.length+1);const e=bd;return bd=Wl[e],Wl[e]=t,e}const SE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&SE.decode();function lo(t,e){return t=t>>>0,SE.decode(xd().subarray(t,t+e))}let md=null;function EE(){return(md===null||md.byteLength===0)&&(md=new Float64Array(Lt.memory.buffer)),md}let gd=null;function OP(){return(gd===null||gd.byteLength===0)&&(gd=new BigInt64Array(Lt.memory.buffer)),gd}function R0(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+=R0(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}const _x=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{Lt.__wbindgen_export_2.get(t.dtor)(t.a,t.b)});function yx(t,e,n,r){const i={a:t,b:e,cnt:1,dtor:n},a=(...c)=>{i.cnt++;const l=i.a;i.a=0;try{return r(l,i.b,...c)}finally{--i.cnt===0?(Lt.__wbindgen_export_2.get(i.dtor)(l,i.b),_x.unregister(i)):i.a=l}};return a.original=i,_x.register(a,i,i),a}function zP(t,e,n){Lt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha0b106c86a4071f7(t,e,Ft(n))}function FP(t,e,n){Lt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a3a4bb5c4c0b039(t,e,Ft(n))}function BP(t,e){const n=e(t.length*1,1)>>>0;return xd().set(t,n/1),fl=t.length,n}function VP(t,e){return t=t>>>0,EE().subarray(t/8,t/8+e)}function _i(t,e){try{return t.apply(this,e)}catch(n){Lt.__wbindgen_exn_store(Ft(n))}}function UP(t,e,n,r){Lt.wasm_bindgen__convert__closures__invoke2_mut__h5b77cba7b0f68717(t,e,Ft(n),Ft(r))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingbytesource_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingsink_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingsource_free(t>>>0));const vx=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Lt.__wbg_mapmodel_free(t>>>0));class Pd{static __wrap(e){e=e>>>0;const n=Object.create(Pd.prototype);return n.__wbg_ptr=e,vx.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,vx.unregister(this),e}free(){const e=this.__destroy_into_raw();Lt.__wbg_mapmodel_free(e)}constructor(e,n,r,i,a){const c=BP(e,Lt.__wbindgen_malloc),l=fl;var d=Js(r)?0:cf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),w=fl,S=Js(i)?0:cf(i,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),I=fl;const T=Lt.mapmodel_new(c,l,n,d,w,S,I,Js(a)?0:Ft(a));return La(T)}renderDebug(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderDebug(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,lo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}renderAmenities(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderAmenities(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,lo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,lo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}getBounds(){try{const i=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_getBounds(i,this.__wbg_ptr);var e=_n()[i/4+0],n=_n()[i/4+1],r=VP(e,n).slice();return Lt.__wbindgen_free(e,n*8,8),r}finally{Lt.__wbindgen_add_to_stack_pointer(16)}}renderZones(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderZones(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,lo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}isochrone(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_isochrone(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,lo(d,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_route(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,lo(d,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}bufferRoute(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_bufferRoute(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,lo(d,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}score(e,n){let r,i;try{const I=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_score(I,this.__wbg_ptr,Ft(e),Js(n)?0:Ft(n));var a=_n()[I/4+0],c=_n()[I/4+1],l=_n()[I/4+2],d=_n()[I/4+3],w=a,S=c;if(d)throw w=0,S=0,La(l);return r=w,i=S,lo(w,S)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(r,i,1)}}}async function GP(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 jP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){La(e)},t.wbg.__wbg_mapmodel_new=function(e){const n=Pd.__wrap(e);return Ft(n)},t.wbg.__wbindgen_string_get=function(e,n){const r=ht(n),i=typeof r=="string"?r:void 0;var a=Js(i)?0:cf(i,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),c=fl;_n()[e/4+1]=c,_n()[e/4+0]=a},t.wbg.__wbindgen_boolean_get=function(e){const n=ht(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_bigint=function(e){return typeof ht(e)=="bigint"},t.wbg.__wbindgen_bigint_from_u64=function(e){const n=BigInt.asUintN(64,e);return Ft(n)},t.wbg.__wbindgen_jsval_eq=function(e,n){return ht(e)===ht(n)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(lo(e,n));return Ft(r)},t.wbg.__wbindgen_string_new=function(e,n){const r=lo(e,n);return Ft(r)},t.wbg.__wbindgen_is_object=function(e){const n=ht(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return ht(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return ht(e)in ht(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=ht(n),i=typeof r=="number"?r:void 0;EE()[e/8+1]=Js(i)?0:i,_n()[e/4+0]=!Js(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return ht(e)==ht(n)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=ht(e);return Ft(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=ht(e)[ht(n)];return Ft(r)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ft(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=ht(n).stack,i=cf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(lo(e,n))}finally{Lt.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=ht(e).performance;return Ft(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return ht(e).now()},t.wbg.__wbindgen_cb_drop=function(e){const n=La(e).original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){const n=fetch(ht(e));return Ft(n)},t.wbg.__wbg_done_2ffa852272310e47=function(e){return ht(e).done},t.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return _i(function(e){const n=ht(e).getReader();return Ft(n)},arguments)},t.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){const n=ht(e).value;return Ft(n)},t.wbg.__wbg_fetch_1e4e8ed1f64c7e28=function(e){const n=fetch(ht(e));return Ft(n)},t.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){const n=ht(e).queueMicrotask;return Ft(n)},t.wbg.__wbindgen_is_function=function(e){return typeof ht(e)=="function"},t.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(ht(e))},t.wbg.__wbg_fetch_693453ca3f88c055=function(e,n){const r=ht(e).fetch(ht(n));return Ft(r)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(ht(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(ht(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(ht(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(ht(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(ht(e))},t.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03=function(){return _i(function(e,n,r){const i=new Request(lo(e,n),ht(r));return Ft(i)},arguments)},t.wbg.__wbg_instanceof_Response_4c3b1446206114d1=function(e){let n;try{n=ht(e)instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_83a6a4f65f7a2b38=function(e,n){const r=ht(n).url,i=cf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_status_d6d47ad2837621eb=function(e){return ht(e).status},t.wbg.__wbg_headers_24def508a7518df9=function(e){const n=ht(e).headers;return Ft(n)},t.wbg.__wbg_body_69be35dff3d68d53=function(e){const n=ht(e).body;return Js(n)?0:Ft(n)},t.wbg.__wbg_arrayBuffer_5b2688e3dd873fed=function(){return _i(function(e){const n=ht(e).arrayBuffer();return Ft(n)},arguments)},t.wbg.__wbg_signal_3c701f5f40a5f08d=function(e){const n=ht(e).signal;return Ft(n)},t.wbg.__wbg_new_0ae46f44b7485bb2=function(){return _i(function(){const e=new AbortController;return Ft(e)},arguments)},t.wbg.__wbg_abort_2c4fb490d878d2b2=function(e){ht(e).abort()},t.wbg.__wbg_byobRequest_05466bb0cacd89fa=function(e){const n=ht(e).byobRequest;return Js(n)?0:Ft(n)},t.wbg.__wbg_close_d29a75e8efc5fa94=function(){return _i(function(e){ht(e).close()},arguments)},t.wbg.__wbg_view_1fe68975176283b3=function(e){const n=ht(e).view;return Js(n)?0:Ft(n)},t.wbg.__wbg_respond_6272b341f88864a2=function(){return _i(function(e,n){ht(e).respond(n>>>0)},arguments)},t.wbg.__wbg_read_79c1f6a58844174c=function(e){const n=ht(e).read();return Ft(n)},t.wbg.__wbg_releaseLock_6eb6fa75435874b8=function(e){ht(e).releaseLock()},t.wbg.__wbg_cancel_ef8b2c6f99da9cde=function(e){const n=ht(e).cancel();return Ft(n)},t.wbg.__wbg_new_7a20246daa6eec7e=function(){return _i(function(){const e=new Headers;return Ft(e)},arguments)},t.wbg.__wbg_append_aa3f462f9e2b5ff2=function(){return _i(function(e,n,r,i,a){ht(e).append(lo(n,r),lo(i,a))},arguments)},t.wbg.__wbg_close_79df9bcee94a607c=function(){return _i(function(e){ht(e).close()},arguments)},t.wbg.__wbg_enqueue_e8019641f9877e27=function(){return _i(function(e,n){ht(e).enqueue(ht(n))},arguments)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,n){const r=ht(e)[n>>>0];return Ft(r)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return ht(e).length},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(lo(e,n));return Ft(r)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const n=ht(e).next;return Ft(n)},t.wbg.__wbg_next_196c84450b364254=function(){return _i(function(e){const n=ht(e).next();return Ft(n)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return ht(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const n=ht(e).value;return Ft(n)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Ft(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return _i(function(e,n){const r=Reflect.get(ht(e),ht(n));return Ft(r)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return _i(function(e,n){const r=ht(e).call(ht(n));return Ft(r)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return Ft(e)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return _i(function(){const e=self.self;return Ft(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return _i(function(){const e=window.window;return Ft(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return _i(function(){const e=globalThis.globalThis;return Ft(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return _i(function(){const e=global.global;return Ft(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(ht(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=ht(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_new_28c511d9baebfa89=function(e,n){const r=new Error(lo(e,n));return Ft(r)},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return _i(function(e,n,r){const i=ht(e).call(ht(n),ht(r));return Ft(i)},arguments)},t.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(ht(e))},t.wbg.__wbg_new_81740750da40724f=function(e,n){try{var r={a:e,b:n},i=(c,l)=>{const d=r.a;r.a=0;try{return UP(d,r.b,c,l)}finally{r.a=d}};const a=new Promise(i);return Ft(a)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_b0083a7967828ec8=function(e){const n=Promise.resolve(ht(e));return Ft(n)},t.wbg.__wbg_catch_0260e338d10f79ae=function(e,n){const r=ht(e).catch(ht(n));return Ft(r)},t.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,n){const r=ht(e).then(ht(n));return Ft(r)},t.wbg.__wbg_then_a73caa9a87991566=function(e,n,r){const i=ht(e).then(ht(n),ht(r));return Ft(i)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=ht(e).buffer;return Ft(n)},t.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,n,r){const i=new Uint8Array(ht(e),n>>>0,r>>>0);return Ft(i)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(ht(e));return Ft(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){ht(e).set(ht(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return ht(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=ht(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){const n=ht(e).buffer;return Ft(n)},t.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return ht(e).byteLength},t.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return ht(e).byteOffset},t.wbg.__wbg_has_0af94d20077affa2=function(){return _i(function(e,n){return Reflect.has(ht(e),ht(n))},arguments)},t.wbg.__wbg_set_1f9b04f170055d33=function(){return _i(function(e,n,r){return Reflect.set(ht(e),ht(n),ht(r))},arguments)},t.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return _i(function(e){const n=JSON.stringify(ht(e));return Ft(n)},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=ht(n),i=typeof r=="bigint"?r:void 0;OP()[e/8+1]=Js(i)?BigInt(0):i,_n()[e/4+0]=!Js(i)},t.wbg.__wbindgen_debug_string=function(e,n){const r=R0(ht(n)),i=cf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(lo(e,n))},t.wbg.__wbindgen_memory=function(){const e=Lt.memory;return Ft(e)},t.wbg.__wbindgen_closure_wrapper1726=function(e,n,r){const i=yx(e,n,623,zP);return Ft(i)},t.wbg.__wbindgen_closure_wrapper2715=function(e,n,r){const i=yx(e,n,762,FP);return Ft(i)},t}function qP(t,e){return Lt=t.exports,N0.__wbindgen_wasm_module=e,gd=null,md=null,dd=null,pd=null,Lt}async function N0(t){if(Lt!==void 0)return Lt;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=jP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await GP(await t,e);return qP(n,r)}class WP{constructor(){gi(this,"inner");this.inner=null}async loadOsmFile(e,n,r,i){await N0(),this.inner=await new Pd(e,!0,n,r,i)}async loadGraphFile(e){await N0(),this.inner=await new Pd(e,!1,void 0,void 0,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())}renderAmenities(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderAmenities())}renderZones(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderZones())}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}))}bufferRoute(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.bufferRoute({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,use_heuristic:e.useHeuristic,start_time:e.startTime,max_seconds:e.maxSeconds}))}score(e,n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds,max_seconds:e.maxSeconds},n))}}Av(WP);let IE="MZEJTanw3WpxRvt7qDfo",$s=tr({kind:"title"}),E_=tr(null),qg=tr(!0),O0=tr(!1);function bx(t){return["!=",["get",`access_${t}`],"None"]}let yf=tr("foot"),Wg=tr("07:00"),Tc=tr(null),vf=tr(null),xx=tr(!0),Ql=tr(null),df=tr(!1);function Hg(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 wx(t){let e,n;return e=new Pv({props:{$$slots:{default:[HP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function HP(t){let e,n,r,i,a,c,l,d,w,S;function I(){return t[1](t[3])}return{c(){e=ke("h1"),e.textContent="15-minute neighborhood tool",n=nt(),r=ke("p"),r.textContent="TODO. Extremely early in development.",i=nt(),a=ke("p"),a.innerHTML=`This open source + tool is created by + Dustin Carlino + and relies heavily on + OpenStreetMap data.`,c=nt(),l=ke("center"),d=ke("button"),d.textContent="Start!"},m(T,k){Me(T,e,k),Me(T,n,k),Me(T,r,k),Me(T,i,k),Me(T,a,k),Me(T,c,k),Me(T,l,k),we(l,d),w||(S=Gt(d,"click",I),w=!0)},p(T,k){t=T},d(T){T&&(Le(e),Le(n),Le(r),Le(i),Le(a),Le(c),Le(l)),w=!1,S()}}}function ZP(t){let e,n,r=t[0]&&wx(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=wx(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function XP(t,e,n){let r;return Ct(t,qg,c=>n(0,r=c)),[r,c=>cs(c).close(),()=>Zn(qg,r=!1,r)]}class YP extends Jt{constructor(e){super(),Kt(this,e,XP,ZP,qt,{})}}var Kd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function I_(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 Sx=Object.prototype.toString,CE=function(e){var n=Sx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Sx.call(e.callee)==="[object Function]"),r},i0,Ex;function KP(){if(Ex)return i0;Ex=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"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(T){var k=T.constructor;return k&&k.prototype===T},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 T in window)try{if(!w["$"+T]&&e.call(window,T)&&window[T]!==null&&typeof window[T]=="object")try{d(window[T])}catch{return!0}}catch{return!0}return!1}(),I=function(T){if(typeof window>"u"||!S)return d(T);try{return d(T)}catch{return!1}};t=function(k){var D=k!==null&&typeof k=="object",U=n.call(k)==="[object Function]",q=r(k),ee=D&&n.call(k)==="[object String]",B=[];if(!D&&!U&&!q)throw new TypeError("Object.keys called on a non-object");var j=c&&U;if(ee&&k.length>0&&!e.call(k,0))for(var $=0;$0)for(var ae=0;ae"u"||!Ui?zn:Ui(Uint8Array),Pc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":ef&&Ui?Ui([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":lf,"%AsyncGenerator%":lf,"%AsyncGeneratorFunction%":lf,"%AsyncIteratorPrototype%":lf,"%Atomics%":typeof Atomics>"u"?zn:Atomics,"%BigInt%":typeof BigInt>"u"?zn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?zn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?zn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?zn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":yM,"%eval%":eval,"%EvalError%":vM,"%Float32Array%":typeof Float32Array>"u"?zn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?zn:FinalizationRegistry,"%Function%":PE,"%GeneratorFunction%":lf,"%Int8Array%":typeof Int8Array>"u"?zn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?zn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ef&&Ui?Ui(Ui([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map>"u"?zn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ef||!Ui?zn:Ui(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?zn:Promise,"%Proxy%":typeof Proxy>"u"?zn:Proxy,"%RangeError%":bM,"%ReferenceError%":xM,"%Reflect%":typeof Reflect>"u"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?zn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ef||!Ui?zn:Ui(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ef&&Ui?Ui(""[Symbol.iterator]()):zn,"%Symbol%":ef?Symbol:zn,"%SyntaxError%":bf,"%ThrowTypeError%":SM,"%TypedArray%":IM,"%TypeError%":mf,"%Uint8Array%":typeof Uint8Array>"u"?zn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?zn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?zn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?zn:Uint32Array,"%URIError%":wM,"%WeakMap%":typeof WeakMap>"u"?zn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?zn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?zn:WeakSet};if(Ui)try{null.error}catch(t){var CM=Ui(Ui(t));Pc["%Error.prototype%"]=CM}var TM=function t(e){var n;if(e==="%AsyncFunction%")n=s0("async function () {}");else if(e==="%GeneratorFunction%")n=s0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=s0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ui&&(n=Ui(i.prototype))}return Pc[e]=n,n},Px={__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"]},Jd=Ov,Zg=LE,LM=Jd.call(Function.call,Array.prototype.concat),PM=Jd.call(Function.apply,Array.prototype.splice),Mx=Jd.call(Function.call,String.prototype.replace),Xg=Jd.call(Function.call,String.prototype.slice),MM=Jd.call(Function.call,RegExp.prototype.exec),AM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kM=/\\(\\)?/g,DM=function(e){var n=Xg(e,0,1),r=Xg(e,-1);if(n==="%"&&r!=="%")throw new bf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new bf("invalid intrinsic syntax, expected opening `%`");var i=[];return Mx(e,AM,function(a,c,l,d){i[i.length]=l?Mx(d,kM,"$1"):c||a}),i},RM=function(e,n){var r=e,i;if(Zg(Px,r)&&(i=Px[r],r="%"+i[0]+"%"),Zg(Pc,r)){var a=Pc[r];if(a===lf&&(a=TM(r)),typeof a>"u"&&!n)throw new mf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new bf("intrinsic "+e+" does not exist!")},wl=function(e,n){if(typeof e!="string"||e.length===0)throw new mf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new mf('"allowMissing" argument must be a boolean');if(MM(/^%?[^%]*%?$/,e)===null)throw new bf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=DM(e),i=r.length>0?r[0]:"",a=RM("%"+i+"%",n),c=a.name,l=a.value,d=!1,w=a.alias;w&&(i=w[0],PM(r,LM([0,1],w)));for(var S=1,I=!0;S=r.length){var U=Lc(l,T);I=!!U,I&&"get"in U&&!("originalValue"in U.get)?l=U.get:l=l[T]}else I=Zg(l,T),l=l[T];I&&!d&&(Pc[c]=l)}}return l},l0,Ax;function zv(){if(Ax)return l0;Ax=1;var t=wl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return l0=e,l0}var NM=wl,Mg=NM("%Object.getOwnPropertyDescriptor%",!0);if(Mg)try{Mg([],"length")}catch{Mg=null}var Fv=Mg,kx=zv(),OM=TE,tf=Yu,Dx=Fv,Bv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new tf("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new tf("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new tf("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new tf("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new tf("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new tf("`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,l=arguments.length>6?arguments[6]:!1,d=!!Dx&&Dx(e,n);if(kx)kx(e,n,{configurable:c===null&&d?d.configurable:!c,enumerable:i===null&&d?d.enumerable:!i,value:r,writable:a===null&&d?d.writable:!a});else if(l||!i&&!a&&!c)e[n]=r;else throw new OM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},z0=zv(),ME=function(){return!!z0};ME.hasArrayLengthDefineBug=function(){if(!z0)return null;try{return z0([],"length",{value:1}).length!==1}catch{return!0}};var Vv=ME,zM=Rv,FM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",BM=Object.prototype.toString,VM=Array.prototype.concat,Rx=Bv,UM=function(t){return typeof t=="function"&&BM.call(t)==="[object Function]"},AE=Vv(),GM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!UM(r)||!r())return}AE?Rx(t,e,n,!0):Rx(t,e,n)},kE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=zM(e);FM&&(r=VM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||WM(n)!==n)throw new zx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Ox){var c=Ox(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(qM?Nx(e,"length",n,!0,!0):Nx(e,"length",n)),e};(function(t){var e=Ov,n=wl,r=HM,i=Yu,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,a),d=zv(),w=n("%Math.max%");t.exports=function(T){if(typeof T!="function")throw new i("a function is required");var k=l(e,c,arguments);return r(k,1+w(0,T.length-(arguments.length-1)),!0)};var S=function(){return l(e,a,arguments)};d?d(t.exports,"apply",{value:S}):t.exports.apply=S})(DE);var Zf=DE.exports,RE=wl,NE=Zf,ZM=NE(RE("String.prototype.indexOf")),ga=function(e,n){var r=RE(e,!!n);return typeof r=="function"&&ZM(e,".prototype.")>-1?NE(r):r},XM=Rv,OE=C_(),zE=ga,Fx=Object,YM=zE("Array.prototype.push"),Bx=zE("Object.prototype.propertyIsEnumerable"),KM=OE?Object.getOwnPropertySymbols:null,FE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Fx(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||hA)&&(cA?Vx(e,"name",n,!0,!0):Vx(e,"name",n)),e},dA=pA,mA=Yu,gA=Object,GE=dA(function(){if(this==null||this!==gA(this))throw new mA("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),_A=GE,yA=Zc.supportsDescriptors,vA=Object.getOwnPropertyDescriptor,jE=function(){if(yA&&/a/mig.flags==="gim"){var e=vA(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 _A},bA=Zc.supportsDescriptors,xA=jE,wA=Object.getOwnPropertyDescriptor,SA=Object.defineProperty,EA=TypeError,Ux=Object.getPrototypeOf,IA=/a/,CA=function(){if(!bA||!Ux)throw new EA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=xA(),n=Ux(IA),r=wA(n,"flags");return(!r||r.get!==e)&&SA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},TA=Zc,LA=Zf,PA=GE,qE=jE,MA=CA,WE=LA(qE());TA(WE,{getPolyfill:qE,implementation:PA,shim:MA});var AA=WE,Ag={exports:{}},kA=C_,Xc=function(){return kA()&&!!Symbol.toStringTag},DA=Xc(),RA=ga,F0=RA("Object.prototype.toString"),T_=function(e){return DA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:F0(e)==="[object Arguments]"},HE=function(e){return T_(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&F0(e)!=="[object Array]"&&F0(e.callee)==="[object Function]"},NA=function(){return T_(arguments)}();T_.isLegacyArguments=HE;var ZE=NA?T_:HE;const OA={},zA=Object.freeze(Object.defineProperty({__proto__:null,default:OA},Symbol.toStringTag,{value:"Module"})),FA=I_(zA);var Uv=typeof Map=="function"&&Map.prototype,c0=Object.getOwnPropertyDescriptor&&Uv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Yg=Uv&&c0&&typeof c0.get=="function"?c0.get:null,Gx=Uv&&Map.prototype.forEach,Gv=typeof Set=="function"&&Set.prototype,h0=Object.getOwnPropertyDescriptor&&Gv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Kg=Gv&&h0&&typeof h0.get=="function"?h0.get:null,jx=Gv&&Set.prototype.forEach,BA=typeof WeakMap=="function"&&WeakMap.prototype,Sd=BA?WeakMap.prototype.has:null,VA=typeof WeakSet=="function"&&WeakSet.prototype,Ed=VA?WeakSet.prototype.has:null,UA=typeof WeakRef=="function"&&WeakRef.prototype,qx=UA?WeakRef.prototype.deref:null,GA=Boolean.prototype.valueOf,jA=Object.prototype.toString,qA=Function.prototype.toString,WA=String.prototype.match,jv=String.prototype.slice,Du=String.prototype.replace,HA=String.prototype.toUpperCase,Wx=String.prototype.toLowerCase,XE=RegExp.prototype.test,Hx=Array.prototype.concat,cl=Array.prototype.join,ZA=Array.prototype.slice,Zx=Math.floor,B0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,f0=Object.getOwnPropertySymbols,V0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Lo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xf||"symbol")?Symbol.toStringTag:null,YE=Object.prototype.propertyIsEnumerable,Xx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Yx(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||XE.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Zx(-t):Zx(t);if(r!==t){var i=String(r),a=jv.call(e,i.length+1);return Du.call(i,n,"$&_")+"."+Du.call(Du.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Du.call(e,n,"$&_")}var U0=FA,Kx=U0.custom,Jx=JE(Kx)?Kx:null,XA=function t(e,n,r,i){var a=n||{};if(Au(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Au(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=Au(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(Au(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(Au(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=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 $E(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var d=String(e);return l?Yx(e,d):d}if(typeof e=="bigint"){var w=String(e)+"n";return l?Yx(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 G0(e)?"[Array]":"[Object]";var I=fk(a,r);if(typeof i>"u")i=[];else if(QE(i,e)>=0)return"[Circular]";function T(He,ge,Ne){if(ge&&(i=ZA.call(i),i.push(ge)),Ne){var Je={depth:a.depth};return Au(a,"quoteStyle")&&(Je.quoteStyle=a.quoteStyle),t(He,Je,r+1,i)}return t(He,a,r+1,i)}if(typeof e=="function"&&!Qx(e)){var k=rk(e),D=mg(e,T);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(D.length>0?" { "+cl.call(D,", ")+" }":"")}if(JE(e)){var U=xf?Du.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):V0.call(e);return typeof e=="object"&&!xf?od(U):U}if(uk(e)){for(var q="<"+Wx.call(String(e.nodeName)),ee=e.attributes||[],B=0;B",q}if(G0(e)){if(e.length===0)return"[]";var j=mg(e,T);return I&&!hk(j)?"["+j0(j,I)+"]":"[ "+cl.call(j,", ")+" ]"}if(JA(e)){var $=mg(e,T);return!("cause"in Error.prototype)&&"cause"in e&&!YE.call(e,"cause")?"{ ["+String(e)+"] "+cl.call(Hx.call("[cause]: "+T(e.cause),$),", ")+" }":$.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+cl.call($,", ")+" }"}if(typeof e=="object"&&c){if(Jx&&typeof e[Jx]=="function"&&U0)return U0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ik(e)){var ae=[];return Gx&&Gx.call(e,function(He,ge){ae.push(T(ge,e,!0)+" => "+T(He,e))}),$x("Map",Yg.call(e),ae,I)}if(ak(e)){var me=[];return jx&&jx.call(e,function(He){me.push(T(He,e))}),$x("Set",Kg.call(e),me,I)}if(ok(e))return p0("WeakMap");if(lk(e))return p0("WeakSet");if(sk(e))return p0("WeakRef");if($A(e))return od(T(Number(e)));if(tk(e))return od(T(B0.call(e)));if(ek(e))return od(GA.call(e));if(QA(e))return od(T(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Kd)return"{ [object globalThis] }";if(!KA(e)&&!Qx(e)){var pe=mg(e,T),Q=Xx?Xx(e)===Object.prototype:e instanceof Object||e.constructor===Object,oe=e instanceof Object?"":"null prototype",Ae=!Q&&Lo&&Object(e)===e&&Lo in e?jv.call(Ku(e),8,-1):oe?"Object":"",Y=Q||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",ie=Y+(Ae||oe?"["+cl.call(Hx.call([],Ae||[],oe||[]),": ")+"] ":"");return pe.length===0?ie+"{}":I?ie+"{"+j0(pe,I)+"}":ie+"{ "+cl.call(pe,", ")+" }"}return String(e)};function KE(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function YA(t){return Du.call(String(t),/"/g,""")}function G0(t){return Ku(t)==="[object Array]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function KA(t){return Ku(t)==="[object Date]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function Qx(t){return Ku(t)==="[object RegExp]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function JA(t){return Ku(t)==="[object Error]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function QA(t){return Ku(t)==="[object String]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function $A(t){return Ku(t)==="[object Number]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function ek(t){return Ku(t)==="[object Boolean]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function JE(t){if(xf)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!V0)return!1;try{return V0.call(t),!0}catch{}return!1}function tk(t){if(!t||typeof t!="object"||!B0)return!1;try{return B0.call(t),!0}catch{}return!1}var nk=Object.prototype.hasOwnProperty||function(t){return t in this};function Au(t,e){return nk.call(t,e)}function Ku(t){return jA.call(t)}function rk(t){if(t.name)return t.name;var e=WA.call(qA.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function QE(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 $E(jv.call(t,0,e.maxStringLength),e)+r}var i=Du.call(Du.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ck);return KE(i,"single",e)}function ck(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":"")+HA.call(e.toString(16))}function od(t){return"Object("+t+")"}function p0(t){return t+" { ? }"}function $x(t,e,n,r){var i=r?j0(n,r):cl.call(n,", ");return t+" ("+e+") {"+i+"}"}function hk(t){for(var e=0;e=0)return!1;return!0}function fk(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=cl.call(Array(t.indent+1)," ");else return null;return{base:n,prev:cl.call(Array(e+1),n)}}function j0(t,e){if(t.length===0)return"";var n=` +`+e.prev+e.base;return n+cl.call(t,","+n)+` +`+e.prev}function mg(t,e){var n=G0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=aw(e,n);if(i<55296||i>56319)return n+1;var a=aw(e,n+1);return a<56320||a>57343?n+1:n+2},m0=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}}}},lw=function(e,n){if(Ok(e)||rw(e))return m0(e);if(zk(e)){var r=0;return{next:function(){var a=Uk(e,r),c=Vk(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(!Fk&&!Bk)Ag.exports=function(e){if(e!=null)return lw(e,!0)};else{var Gk=oI,jk=aI,uw=Ta("Map.prototype.forEach",!0),cw=Ta("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var hw=Ta("Map.prototype.iterator",!0),fw=Ta("Set.prototype.iterator",!0);var pw=Ta("Map.prototype.@@iterator",!0)||Ta("Map.prototype._es6-shim iterator_",!0),dw=Ta("Set.prototype.@@iterator",!0)||Ta("Set.prototype._es6-shim iterator_",!0),qk=function(e){if(Gk(e)){if(hw)return iw(hw(e));if(pw)return pw(e);if(uw){var n=[];return uw(e,function(i,a){sw(n,[a,i])}),m0(n)}}if(jk(e)){if(fw)return iw(fw(e));if(dw)return dw(e);if(cw){var r=[];return cw(e,function(i){sw(r,i)}),m0(r)}}};Ag.exports=function(e){return qk(e)||lw(e)}}}var Wk=Ag.exports,mw=function(t){return t!==t},lI=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||mw(e)&&mw(n))},Hk=lI,uI=function(){return typeof Object.is=="function"?Object.is:Hk},Zk=uI,Xk=Zc,Yk=function(){var e=Zk();return Xk(Object,{is:e},{is:function(){return Object.is!==e}}),e},Kk=Zc,Jk=Zf,Qk=lI,cI=uI,$k=Yk,hI=Jk(cI(),Object);Kk(hI,{getPolyfill:cI,implementation:Qk,shim:$k});var e3=hI,t3=Zf,fI=ga,n3=wl,q0=n3("%ArrayBuffer%",!0),kg=fI("ArrayBuffer.prototype.byteLength",!0),r3=fI("Object.prototype.toString"),gw=!!q0&&!kg&&new q0(0).slice,_w=!!gw&&t3(gw),pI=kg||_w?function(e){if(!e||typeof e!="object")return!1;try{return kg?kg(e):_w(e,0),!0}catch{return!1}}:q0?function(e){return r3(e)==="[object ArrayBuffer]"}:function(e){return!1},i3=Date.prototype.getDay,o3=function(e){try{return i3.call(e),!0}catch{return!1}},s3=Object.prototype.toString,a3="[object Date]",l3=Xc(),u3=function(e){return typeof e!="object"||e===null?!1:l3?o3(e):s3.call(e)===a3},W0=ga,dI=Xc(),mI,gI,H0,Z0;if(dI){mI=W0("Object.prototype.hasOwnProperty"),gI=W0("RegExp.prototype.exec"),H0={};var g0=function(){throw H0};Z0={toString:g0,valueOf:g0},typeof Symbol.toPrimitive=="symbol"&&(Z0[Symbol.toPrimitive]=g0)}var c3=W0("Object.prototype.toString"),h3=Object.getOwnPropertyDescriptor,f3="[object RegExp]",p3=dI?function(e){if(!e||typeof e!="object")return!1;var n=h3(e,"lastIndex"),r=n&&mI(n,"value");if(!r)return!1;try{gI(e,Z0)}catch(i){return i===H0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:c3(e)===f3},d3=ga,yw=d3("SharedArrayBuffer.prototype.byteLength",!0),m3=yw?function(e){if(!e||typeof e!="object")return!1;try{return yw(e),!0}catch{return!1}}:function(e){return!1},g3=Number.prototype.toString,_3=function(e){try{return g3.call(e),!0}catch{return!1}},y3=Object.prototype.toString,v3="[object Number]",b3=Xc(),x3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:b3?_3(e):y3.call(e)===v3},_I=ga,w3=_I("Boolean.prototype.toString"),S3=_I("Object.prototype.toString"),E3=function(e){try{return w3(e),!0}catch{return!1}},I3="[object Boolean]",C3=Xc(),T3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:C3&&Symbol.toStringTag in e?E3(e):S3(e)===I3},X0={exports:{}},L3=Object.prototype.toString,P3=Nv();if(P3){var M3=Symbol.prototype.toString,A3=/^Symbol\(.*\)$/,k3=function(e){return typeof e.valueOf()!="symbol"?!1:A3.test(M3.call(e))};X0.exports=function(e){if(typeof e=="symbol")return!0;if(L3.call(e)!=="[object Symbol]")return!1;try{return k3(e)}catch{return!1}}}else X0.exports=function(e){return!1};var D3=X0.exports,Y0={exports:{}},vw=typeof BigInt<"u"&&BigInt,R3=function(){return typeof vw=="function"&&typeof BigInt=="function"&&typeof vw(42)=="bigint"&&typeof BigInt(42)=="bigint"},N3=R3();if(N3){var O3=BigInt.prototype.valueOf,z3=function(e){try{return O3.call(e),!0}catch{}return!1};Y0.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:z3(e)}}else Y0.exports=function(e){return!1};var F3=Y0.exports,B3=rI,V3=x3,U3=T3,G3=D3,j3=F3,q3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(B3(e))return"String";if(V3(e))return"Number";if(U3(e))return"Boolean";if(G3(e))return"Symbol";if(j3(e))return"BigInt"},$g=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,bw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,e_;$g||(e_=function(e){return!1});var K0=$g?$g.prototype.has:null,_0=bw?bw.prototype.has:null;!e_&&!K0&&(e_=function(e){return!1});var W3=e_||function(e){if(!e||typeof e!="object")return!1;try{if(K0.call(e,K0),_0)try{_0.call(e,_0)}catch{return!0}return e instanceof $g}catch{}return!1},J0={exports:{}},H3=wl,yI=ga,Z3=H3("%WeakSet%",!0),y0=yI("WeakSet.prototype.has",!0);if(y0){var v0=yI("WeakMap.prototype.has",!0);J0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(y0(e,y0),v0)try{v0(e,v0)}catch{return!0}return e instanceof Z3}catch{}return!1}}else J0.exports=function(e){return!1};var X3=J0.exports,Y3=oI,K3=aI,J3=W3,Q3=X3,$3=function(e){if(e&&typeof e=="object"){if(Y3(e))return"Map";if(K3(e))return"Set";if(J3(e))return"WeakMap";if(Q3(e))return"WeakSet"}return!1},vI=Function.prototype.toString,hf=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Q0,Dg;if(typeof hf=="function"&&typeof Object.defineProperty=="function")try{Q0=Object.defineProperty({},"length",{get:function(){throw Dg}}),Dg={},hf(function(){throw 42},null,Q0)}catch(t){t!==Dg&&(hf=null)}else hf=null;var e4=/^\s*class\b/,$0=function(e){try{var n=vI.call(e);return e4.test(n)}catch{return!1}},b0=function(e){try{return $0(e)?!1:(vI.call(e),!0)}catch{return!1}},Rg=Object.prototype.toString,t4="[object Object]",n4="[object Function]",r4="[object GeneratorFunction]",i4="[object HTMLAllCollection]",o4="[object HTML document.all class]",s4="[object HTMLCollection]",a4=typeof Symbol=="function"&&!!Symbol.toStringTag,l4=!(0 in[,]),ev=function(){return!1};if(typeof document=="object"){var u4=document.all;Rg.call(u4)===Rg.call(document.all)&&(ev=function(e){if((l4||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Rg.call(e);return(n===i4||n===o4||n===s4||n===t4)&&e("")==null}catch{}return!1})}var c4=hf?function(e){if(ev(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{hf(e,null,Q0)}catch(n){if(n!==Dg)return!1}return!$0(e)&&b0(e)}:function(e){if(ev(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(a4)return b0(e);if($0(e))return!1;var n=Rg.call(e);return n!==n4&&n!==r4&&!/^\[object HTML/.test(n)?!1:b0(e)},h4=c4,f4=Object.prototype.toString,bI=Object.prototype.hasOwnProperty,p4=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),f4.call(e)==="[object Array]"?p4(e,n,i):typeof e=="string"?d4(e,n,i):m4(e,n,i)},_4=g4,y4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],x0=y4,v4=typeof globalThis>"u"?Kd:globalThis,b4=function(){for(var e=[],n=0;n"u"?Kd:globalThis,tv=x4(),Yv=Xv("String.prototype.slice"),w0=Object.getPrototypeOf,S4=Xv("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:I4(e)}return Ng?E4(e):null},T4=ga,Sw=T4("ArrayBuffer.prototype.byteLength",!0),L4=pI,P4=function(e){return L4(e)?Sw?Sw(e):e.byteLength:NaN},wI=aA,Sl=ga,Ew=AA,M4=wl,wf=Wk,A4=tI,Iw=e3,Cw=ZE,Tw=nI,Lw=pI,Pw=u3,Mw=p3,Aw=m3,kw=Rv,Dw=q3,Rw=$3,Nw=C4,Ow=P4,zw=Sl("SharedArrayBuffer.prototype.byteLength",!0),Fw=Sl("Date.prototype.getTime"),S0=Object.getPrototypeOf,Bw=Sl("Object.prototype.toString"),r_=M4("%Set%",!0),nv=Sl("Map.prototype.has",!0),i_=Sl("Map.prototype.get",!0),Vw=Sl("Map.prototype.size",!0),o_=Sl("Set.prototype.add",!0),SI=Sl("Set.prototype.delete",!0),s_=Sl("Set.prototype.has",!0),Og=Sl("Set.prototype.size",!0);function Uw(t,e,n,r){for(var i=wf(t),a;(a=i.next())&&!a.done;)if(Aa(e,a.value,n,r))return SI(t,a.value),!0;return!1}function EI(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 k4(t,e,n,r,i,a){var c=EI(n);if(c!=null)return c;var l=i_(e,c),d=wI({},i,{strict:!1});return typeof l>"u"&&!nv(e,c)||!Aa(r,l,d,a)?!1:!nv(t,c)&&Aa(r,l,d,a)}function D4(t,e,n){var r=EI(n);return r??(s_(e,r)&&!s_(t,r))}function Gw(t,e,n,r,i,a){for(var c=wf(t),l,d;(l=c.next())&&!l.done;)if(d=l.value,Aa(n,d,i,a)&&Aa(r,i_(e,d),i,a))return SI(t,d),!0;return!1}function Aa(t,e,n,r){var i=n||{};if(i.strict?Iw(t,e):t===e)return!0;var a=Dw(t),c=Dw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Iw(t,e):t==e;var l=r.has(t),d=r.has(e),w;if(l&&d){if(r.get(t)===r.get(e))return!0}else w={};return l||r.set(t,w),d||r.set(e,w),O4(t,e,i,r)}function jw(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 R4(t,e,n,r){if(Og(t)!==Og(e))return!1;for(var i=wf(t),a=wf(e),c,l,d;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")d||(d=new r_),o_(d,c.value);else if(!s_(e,c.value)){if(n.strict||!D4(t,e,c.value))return!1;d||(d=new r_),o_(d,c.value)}if(d){for(;(l=a.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Uw(d,l.value,n.strict,r))return!1}else if(!n.strict&&!s_(t,l.value)&&!Uw(d,l.value,n.strict,r))return!1;return Og(d)===0}return!0}function N4(t,e,n,r){if(Vw(t)!==Vw(e))return!1;for(var i=wf(t),a=wf(e),c,l,d,w,S,I;(c=i.next())&&!c.done;)if(w=c.value[0],S=c.value[1],w&&typeof w=="object")d||(d=new r_),o_(d,w);else if(I=i_(e,w),typeof I>"u"&&!nv(e,w)||!Aa(S,I,n,r)){if(n.strict||!k4(t,e,w,S,n,r))return!1;d||(d=new r_),o_(d,w)}if(d){for(;(l=a.next())&&!l.done;)if(w=l.value[0],I=l.value[1],w&&typeof w=="object"){if(!Gw(d,t,w,I,n,r))return!1}else if(!n.strict&&(!t.has(w)||!Aa(i_(t,w),I,n,r))&&!Gw(d,t,w,I,wI({},n,{strict:!1}),r))return!1;return Og(d)===0}return!0}function O4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||Bw(t)!==Bw(e)||Cw(t)!==Cw(e))return!1;var c=Tw(t),l=Tw(e);if(c!==l)return!1;var d=t instanceof Error,w=e instanceof Error;if(d!==w||(d||w)&&(t.name!==e.name||t.message!==e.message))return!1;var S=Mw(t),I=Mw(e);if(S!==I||(S||I)&&(t.source!==e.source||Ew(t)!==Ew(e)))return!1;var T=Pw(t),k=Pw(e);if(T!==k||(T||k)&&Fw(t)!==Fw(e)||n.strict&&S0&&S0(t)!==S0(e))return!1;var D=Nw(t),U=Nw(e);if(D!==U)return!1;if(D||U){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(me[i]!=pe[i])return!1;for(i=me.length-1;i>=0;i--)if(a=me[i],!Aa(t[a],e[a],n,r))return!1;var Q=Rw(t),oe=Rw(e);return Q!==oe?!1:Q==="Set"||oe==="Set"?R4(t,e,n,r):Q==="Map"?N4(t,e,n,r):!0}var z4=function(e,n,r){return Aa(e,n,r,A4())};const F4=Dv(z4);var B4=Object.defineProperty,rr=(t,e)=>B4(t,"name",{value:e,configurable:!0}),V4=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||!_d(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=rv(e),i=rv(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 _d(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?F4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return _d(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)}};rr(V4,"GeojsonEquality");function _d(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}rr(_d,"sameLength");function rv(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}rr(rv,"explode");var Cs=63710088e-1,II={centimeters:Cs*100,centimetres:Cs*100,degrees:360/(2*Math.PI),feet:Cs*3.28084,inches:Cs*39.37,kilometers:Cs/1e3,kilometres:Cs/1e3,meters:Cs,metres:Cs,miles:Cs/1609.344,millimeters:Cs*1e3,millimetres:Cs*1e3,nauticalmiles:Cs/1852,radians:1,yards:Cs*1.0936},qw={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 ml(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}rr(ml,"feature");function U4(t,e,n={}){switch(t){case"Point":return ql(e).geometry;case"LineString":return Zl(e).geometry;case"Polygon":return Kv(e).geometry;case"MultiPoint":return TI(e).geometry;case"MultiLineString":return CI(e).geometry;case"MultiPolygon":return LI(e).geometry;default:throw new Error(t+" is invalid")}}rr(U4,"geometry");function ql(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(!a_(t[0])||!a_(t[1]))throw new Error("coordinates must contain numbers");return ml({type:"Point",coordinates:t},e,n)}rr(ql,"point");function G4(t,e,n={}){return L_(t.map(r=>ql(r,e)),n)}rr(G4,"points");function Kv(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;aKv(r,e)),n)}rr(j4,"polygons");function Zl(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ml({type:"LineString",coordinates:t},e,n)}rr(Zl,"lineString");function q4(t,e,n={}){return L_(t.map(r=>Zl(r,e)),n)}rr(q4,"lineStrings");function L_(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}rr(L_,"featureCollection");function CI(t,e,n={}){return ml({type:"MultiLineString",coordinates:t},e,n)}rr(CI,"multiLineString");function TI(t,e,n={}){return ml({type:"MultiPoint",coordinates:t},e,n)}rr(TI,"multiPoint");function LI(t,e,n={}){return ml({type:"MultiPolygon",coordinates:t},e,n)}rr(LI,"multiPolygon");function W4(t,e,n={}){return ml({type:"GeometryCollection",geometries:t},e,n)}rr(W4,"geometryCollection");function H4(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}rr(H4,"round");function PI(t,e="kilometers"){const n=II[e];if(!n)throw new Error(e+" units is invalid");return t*n}rr(PI,"radiansToLength");function Jv(t,e="kilometers"){const n=II[e];if(!n)throw new Error(e+" units is invalid");return t/n}rr(Jv,"lengthToRadians");function Z4(t,e){return MI(Jv(t,e))}rr(Z4,"lengthToDegrees");function X4(t){let e=t%360;return e<0&&(e+=360),e}rr(X4,"bearingToAzimuth");function MI(t){return t%(2*Math.PI)*180/Math.PI}rr(MI,"radiansToDegrees");function Y4(t){return t%360*Math.PI/180}rr(Y4,"degreesToRadians");function K4(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return PI(Jv(t,e),n)}rr(K4,"convertLength");function J4(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=qw[e];if(!r)throw new Error("invalid original units");const i=qw[n];if(!i)throw new Error("invalid final units");return t/r*i}rr(J4,"convertArea");function a_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}rr(a_,"isNumber");function Qv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}rr(Qv,"isObject");function Q4(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(!a_(e))throw new Error("bbox must only contain numbers")})}rr(Q4,"validateBBox");function $4(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")}rr($4,"validateId");var eD=Object.defineProperty,mo=(t,e)=>eD(t,"name",{value:e,configurable:!0});function Yf(t,e,n){if(t!==null)for(var r,i,a,c,l,d,w,S=0,I=0,T,k=t.type,D=k==="FeatureCollection",U=k==="Feature",q=D?t.features.length:1,ee=0;eed||D>w||U>S){l=I,d=r,w=D,S=U,a=0;return}var q=Zl([l,I],n.properties);if(e(q,r,i,U,a)===!1)return!1;a++,l=I})===!1)return!1}}})}mo(DI,"segmentEach");function aD(t,e,n){var r=n,i=!1;return DI(t,function(a,c,l,d,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,d,w),i=!0}),r}mo(aD,"segmentReduce");function RI(t,e){if(!t)throw new Error("geojson is required");P_(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 l=0;lhD(t,"name",{value:e,configurable:!0});function e1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Yf(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=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var D=d(T);let U,q;function ee(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function B(){if(q==null&&(q=!1,ee())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const _=4*p;o.fillStyle=`rgb(${_},${_+1},${_+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){q=!0;break}}}return q||!1}function j(u,o,h,p){const _=new D(u,o,h,p);return function(b){return _.solve(b)}}const $=j(.25,.1,.25,1);function ae(u,o,h){return Math.min(h,Math.max(o,u))}function me(u,o,h){const p=h-o,_=((u-o)%p+p)%p+o;return _===o?h:_}function pe(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let Q=1;function oe(u,o,h){const p={};for(const _ in u)p[_]=o.call(h||this,u[_],_,u);return p}function Ae(u,o,h){const p={};for(const _ in u)o.call(h||this,u[_],_,u)&&(p[_]=u[_]);return p}function Y(u){return Array.isArray(u)?u.map(Y):typeof u=="object"&&u?oe(u,Y):u}const ie={};function He(u){ie[u]||(typeof console<"u"&&console.warn(u),ie[u]=!0)}function ge(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function Ne(u){let o=0;for(let h,p,_=0,b=u.length,x=b-1;_"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(u,{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"),P=new Uint8ClampedArray(p*_*4);if(yield b.copyTo(P,function(A,N,O,G,H){const X=4*Math.max(-N,0),ne=(Math.max(0,O)-O)*G*4+X,ce=4*G,_e=Math.max(0,N),Re=Math.max(0,O);return{rect:{x:_e,y:Re,width:Math.min(A.width,N+G)-_e,height:Math.min(A.height,O+H)-Re},layout:[{offset:ne,stride:ce}]}}(u,o,h,p,_)),E)for(let A=0;AJe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,_r=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=mn(u.url);if(p)return p(u,o);if(Je(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Bn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test($r())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(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:$r(),signal:_.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 ir(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 P=yield E;if(_.signal.aborted)throw Fn();return{data:P,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(u,o);if(Je(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Bn},o)}var h;return function(p,_){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 P in p.headers)E.setRequestHeader(P,p.headers[P]);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(!_.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let P=E.response;if(p.type==="json")try{P=JSON.parse(E.response)}catch(A){return void x(A)}b({data:P,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const P=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new ir(E.status,E.statusText,p.url,P))}},_.signal.addEventListener("abort",()=>{E.abort(),x(Fn())}),E.send(p.body)})}(u,o)};function cr(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function or(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function re(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Ce{constructor(o,h={}){pe(this,h),this.type=o}}class _t extends Ce{constructor(o,h={}){super("error",pe({error:o},h))}}class xn{on(o,h){return this._listeners=this._listeners||{},or(o,h,this._listeners),this}off(o,h){return re(o,h,this._listeners),re(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},or(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Ce(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of _)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)re(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 _t&&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 ze={$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 en=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Dr(u,o){const h={};for(const p in u)p!=="ref"&&(h[p]=u[p]);return en.forEach(p=>{p in o&&(h[p]=o[p])}),h}function fn(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let h=0;h`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Ee=[ei,ft,on,nn,Rr,Vr,$o,K(tn),he,V,W];function J(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!J(u.itemType,o.itemType))&&(typeof u.N!="number"||u.N===o.N))return null}else{if(u.kind===o.kind)return null;if(u.kind==="value"){for(const h of Ee)if(!J(h,o))return null}}return`Expected ${se(u)} but found ${se(o)} instead.`}function Ie(u,o){return o.some(h=>h.kind===u.kind)}function ye(u,o){return o.some(h=>h==="null"?u===null:h==="array"?Array.isArray(u):h==="object"?u&&!Array.isArray(u)&&typeof u=="object":h===typeof u)}function De(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const Ge=.96422,Ze=.82521,Ye=4/29,Mt=6/29,Rt=3*Mt*Mt,Yt=Mt*Mt*Mt,Qt=Math.PI/180,En=180/Math.PI;function Xn(u){return(u%=360)<0&&(u+=360),u}function hr([u,o,h,p]){let _,b;const x=cn((.2225045*(u=ti(u))+.7168786*(o=ti(o))+.0606169*(h=ti(h)))/1);u===o&&o===h?_=b=x:(_=cn((.4360747*u+.3850649*o+.1430804*h)/Ge),b=cn((.0139322*u+.0971045*o+.7141733*h)/Ze));const E=116*x-16;return[E<0?0:E,500*(_-x),200*(x-b),p]}function ti(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function cn(u){return u>Yt?Math.pow(u,1/3):u/Rt+Ye}function Ir([u,o,h,p]){let _=(u+16)/116,b=isNaN(o)?_:_+o/500,x=isNaN(h)?_:_-h/200;return _=1*eo(_),b=Ge*eo(b),x=Ze*eo(x),[ai(3.1338561*b-1.6168667*_-.4906146*x),ai(-.9787684*b+1.9161415*_+.033454*x),ai(.0719453*b-.2289914*_+1.4052427*x),p]}function ai(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function eo(u){return u>Mt?u*u*u:Rt*(u-Ye)}function go(u){return parseInt(u.padEnd(2,u),16)/255}function xi(u,o){return Vs(o?u/100:u,0,1)}function Vs(u,o,h){return Math.min(Math.max(o,u),h)}function lm(u){return!u.some(Number.isNaN)}const Y_={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 jn{constructor(o,h,p,_=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=_,b||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[o,h,p,_]))}static parse(o){if(o instanceof jn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=Y_[p];if(_){const[x,E,P]=_;return[x/255,E/255,P/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[go(p.slice(E,E+=x)),go(p.slice(E,E+=x)),go(p.slice(E,E+=x)),go(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,P,A,N,O,G,H,X,ne,ce,_e,Re]=x,be=[N||" ",H||" ",ce].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Te=[A,G,ne].join(""),Ke=Te==="%%%"?100:Te===""?255:0;if(Ke){const Qe=[Vs(+P/Ke,0,1),Vs(+O/Ke,0,1),Vs(+X/Ke,0,1),_e?xi(+_e,Re):1];if(lm(Qe))return Qe}}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,P,A,N,O,G,H,X]=b,ne=[P||" ",N||" ",G].join("");if(ne===" "||ne===" /"||ne===",,"||ne===",,,"){const ce=[+E,Vs(+A,0,100),Vs(+O,0,100),H?xi(+H,X):1];if(lm(ce))return function([_e,Re,be,Te]){function Ke(Qe){const wt=(Qe+_e/30)%12,Tt=Re*Math.min(be,1-be);return be-Tt*Math.max(-1,Math.min(wt-3,9-wt,1))}return _e=Xn(_e),Re/=100,be/=100,[Ke(0),Ke(8),Ke(4),Te]}(ce)}}}(o);return h?new jn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:_}=this,b=_||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,_])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,_,b]=hr(o),x=Math.sqrt(p*p+_*_);return[Math.round(1e4*x)?Xn(Math.atan2(_,p)*En):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",hr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,_]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${_})`}}jn.black=new jn(0,0,0,1),jn.white=new jn(1,1,1,1),jn.transparent=new jn(0,0,0,0),jn.red=new jn(1,0,0,1);class op{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 sp{constructor(o,h,p,_,b){this.text=o,this.image=h,this.scale=p,this.fontStack=_,this.textColor=b}}class Ro{constructor(o){this.sections=o}static fromString(o){return new Ro([new sp(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 Ro?o:Ro.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class _o{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof _o)return o;if(typeof o=="number")return new _o([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 _o(o)}}toString(){return JSON.stringify(this.values)}}const $u=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class es{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof es)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&u<=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 [${[u,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,h,p]:[u,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function th(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof jn||u instanceof op||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts)return!0;if(Array.isArray(u)){for(const o of u)if(!th(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!th(u[o]))return!1;return!0}return!1}function ni(u){if(u===null)return ei;if(typeof u=="string")return on;if(typeof u=="boolean")return nn;if(typeof u=="number")return ft;if(u instanceof jn)return Rr;if(u instanceof op)return ba;if(u instanceof Ro)return Vr;if(u instanceof _o)return he;if(u instanceof es)return W;if(u instanceof ts)return V;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const _=ni(p);if(h){if(h===_)continue;h=tn;break}h=_}return K(h||tn,o)}return $o}function ec(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof jn||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts?u.toString():JSON.stringify(u)}class Za{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(!th(o[1]))return h.error("invalid value");const p=o[1];let _=ni(p);const b=h.expectedType;return _.kind!=="array"||_.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(_=b),new Za(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class yr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const nh={string:on,number:ft,boolean:nn,object:$o};class No{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,_=1;const b=o[0];if(b==="array"){let E,P;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in nh)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);E=nh[A],_++}else E=tn;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);P=o[2],_++}p=K(E,P)}else{if(!nh[b])throw new Error(`Types doesn't contain name = ${b}`);p=nh[b]}const x=[];for(;_o.outputDefined())}}const rh={"to-boolean":nn,"to-color":Rr,"to-number":ft,"to-string":on};class Us{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(!rh[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 _=rh[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:uu(h[0],h[1],h[2],h[3]),!p))return new jn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new yr(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 _=_o.parse(h);if(_)return _}throw new yr(`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 _=es.parse(h);if(_)return _}throw new yr(`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 _=Number(h);if(!isNaN(_))return _}throw new yr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ro.fromString(ec(this.args[0].evaluate(o)));case"resolvedImage":return ts.fromString(ec(this.args[0].evaluate(o)));default:return ec(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const tc=["Unknown","Point","LineString","Polygon"];class qn{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"?tc[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]=jn.parse(o)),h}}class ih{constructor(o,h,p=[],_,b=new Tl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=_,this._isConstant=h}parse(o,h,p,_,b={}){return h?this.concat(h,p,_)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(_,b,x){return x==="assert"?new No(b,[_]):x==="coerce"?new Us(b,[_]):_}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 _=o[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[_];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,P=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||P.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(E.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(E,P))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 Za)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new qn;try{x=new Za(x.type,x.evaluate(E))}catch(P){return this.error(P.message),null}}return x}return this.error(`Unknown expression "${_}". 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 _=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new ih(this.registry,this._isConstant,_,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new $i(p,o))}checkSubtype(o,h){const p=J(o,h);return p&&this.error(p),p}}class cu{constructor(o,h,p){this.type=ba,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 _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,nn);if(!_)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,nn);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,on),!x)?null:new cu(_,b,x)}evaluate(o){return new op(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 Xa=8192;function oh(u,o){u[0]=Math.min(u[0],o[0]),u[1]=Math.min(u[1],o[1]),u[2]=Math.max(u[2],o[0]),u[3]=Math.max(u[3],o[1])}function nc(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function K_(u,o){const h=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,_=Math.pow(2,o.z);return[Math.round(h*_*Xa),Math.round(p*_*Xa)]}function um(u,o,h){const p=u[0]-o[0],_=u[1]-o[1],b=u[0]-h[0],x=u[1]-h[1];return p*x-b*_==0&&p*b<=0&&_*x<=0}function sh(u,o){let h=!1;for(let x=0,E=o.length;x(p=u)[1]!=(b=P[A+1])[1]>p[1]&&p[0]<(b[0]-_[0])*(p[1]-_[1])/(b[1]-_[1])+_[0]&&(h=!h)}}var p,_,b;return h}function J_(u,o){for(let h=0;h0&&E<0||x<0&&E>0}function Q_(u,o,h){for(const A of h)for(let N=0;Nh[2]){const _=.5*p;let b=u[0]-h[0]>_?-p:h[0]-u[0]>_?p:0;b===0&&(b=u[0]-h[2]>_?-p:h[2]-u[0]>_?p:0),u[0]+=b}oh(o,u)}function lh(u,o,h,p){const _=Math.pow(2,p.z)*Xa,b=[p.x*Xa,p.y*Xa],x=[];for(const E of u)for(const P of E){const A=[P.x+b[0],P.y+b[1]];dm(A,o,h,_),x.push(A)}return x}function mm(u,o,h,p){const _=Math.pow(2,p.z)*Xa,b=[p.x*Xa,p.y*Xa],x=[];for(const P of u){const A=[];for(const N of P){const O=[N.x+b[0],N.y+b[1]];oh(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=_/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const P of x)for(const A of P)dm(A,o,h,_)}var E;return x}class Ll{constructor(o,h){this.type=nn,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(th(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const _=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&_.push(E),x==="MultiPolygon"&&_.push(...E)}if(_.length)return new Ll(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Ll(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Ll(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 _=[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=ah(p.coordinates,b,x),P=lh(h.geometry(),_,b,x);if(!nc(_,b))return!1;for(const A of P)if(!sh(A,E))return!1}if(p.type==="MultiPolygon"){const E=pm(p.coordinates,b,x),P=lh(h.geometry(),_,b,x);if(!nc(_,b))return!1;for(const A of P)if(!J_(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const _=[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=ah(p.coordinates,b,x),P=mm(h.geometry(),_,b,x);if(!nc(_,b))return!1;for(const A of P)if(!hm(A,E))return!1}if(p.type==="MultiPolygon"){const E=pm(p.coordinates,b,x),P=mm(h.geometry(),_,b,x);if(!nc(_,b))return!1;for(const A of P)if(!fm(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class uh{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 uh(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 Oo{constructor(o,h,p,_){this.name=o,this.type=h,this._evaluate=p,this.args=_}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],_=Oo.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(_)?_[0]:_.type,x=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let P=null;for(const[A,N]of E){P=new ih(h.registry,rc,h.path,null,h.scope);const O=[];let G=!1;for(let H=1;H{return G=O,Array.isArray(G)?`(${G.map(se).join(", ")})`:`(${se(G.type)}...)`;var G}).join(" | "),N=[];for(let O=1;O{h=o?h&&rc(p):h&&p instanceof Za}),!!h&&ch(u)&&oc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ch(u){if(u instanceof Oo&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof Ll)return!1;let o=!0;return u.eachChild(h=>{o&&!ch(h)&&(o=!1)}),o}function ic(u){if(u instanceof Oo&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!ic(h)&&(o=!1)}),o}function oc(u,o){if(u instanceof Oo&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!oc(p,o)&&(h=!1)}),h}function sc(u,o){const h=u.length-1;let p,_,b=0,x=h,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=u[E],_=u[E+1],p<=o){if(E===h||o<_)return E;b=E+1}else{if(!(p>o))throw new yr("Input is not a number.");x=E-1}return 0}class ac{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,b]of p)this.labels.push(_),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,ft);if(!p)return null;const _=[];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(P,N,b);if(!O)return null;b=b||O.type,_.push([E,O])}return new ac(b,p,_)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;return _>=h[b-1]?p[b-1].evaluate(o):p[sc(h,_)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function $_(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var ey=gm;function gm(u,o,h,p){this.cx=3*u,this.bx=3*(h-u)-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=u,this.p1y=o,this.p2x=h,this.p2y=p}gm.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,o){if(o===void 0&&(o=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var ty=$_(ey);function Pl(u,o,h){return u+h*(o-u)}function hh(u,o,h){return u.map((p,_)=>Pl(p,o[_],h))}const to={number:Pl,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[_,b,x,E]=hh(u.rgb,o.rgb,h);return new jn(_,b,x,E,!1)}case"hcl":{const[_,b,x,E]=u.hcl,[P,A,N,O]=o.hcl;let G,H;if(isNaN(_)||isNaN(P))isNaN(_)?isNaN(P)?G=NaN:(G=P,x!==1&&x!==0||(H=A)):(G=_,N!==1&&N!==0||(H=b));else{let Re=P-_;P>_&&Re>180?Re-=360:P<_&&_-P>180&&(Re+=360),G=_+h*Re}const[X,ne,ce,_e]=function([Re,be,Te,Ke]){return Re=isNaN(Re)?0:Re*Qt,Ir([Te,Math.cos(Re)*be,Math.sin(Re)*be,Ke])}([G,H??Pl(b,A,h),Pl(x,N,h),Pl(E,O,h)]);return new jn(X,ne,ce,_e,!1)}case"lab":{const[_,b,x,E]=Ir(hh(u.lab,o.lab,h));return new jn(_,b,x,E,!1)}}},array:hh,padding:function(u,o,h){return new _o(hh(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,_=o.values;if(p.length!==_.length)throw new yr(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof N!="number"||N<0||N>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={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,ft),!b)return null;const E=[];let P=null;p==="interpolate-hcl"||p==="interpolate-lab"?P=Rr:h.expectedType&&h.expectedType.kind!=="value"&&(P=h.expectedType);for(let A=0;A=N)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',G);const X=h.parse(O,H,P);if(!X)return null;P=P||X.type,E.push([N,X])}return De(P,ft)||De(P,Rr)||De(P,he)||De(P,W)||De(P,K(ft))?new zi(P,p,_,b,E):h.error(`Type ${se(P)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;if(_>=h[b-1])return p[b-1].evaluate(o);const x=sc(h,_),E=zi.interpolationFactor(this.interpolation,_,h[x],h[x+1]),P=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return to[this.type.kind](P,A,E);case"interpolate-hcl":return to.color(P,A,E,"hcl");case"interpolate-lab":return to.color(P,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 On(u,o,h,p){const _=p-h,b=u-h;return _===0?0:o===1?b/_:(Math.pow(o,b)-1)/(Math.pow(o,_)-1)}class fh{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 _=h.expectedType;_&&_.kind!=="value"&&(p=_);const b=[];for(const E of o.slice(1)){const P=h.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!P)return null;p=p||P.type,b.push(P)}if(!p)throw new Error("No output type");const x=_&&b.some(E=>J(_,E.type));return new fh(x?tn:p,b)}evaluate(o){let h,p=null,_=0;for(const b of this.args)if(_++,p=b.evaluate(o),p&&p instanceof ts&&!p.available&&(h||(h=p.name),p=null,_===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 ph{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 yr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new yr(`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 lp{constructor(o,h){this.type=nn,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,tn),_=h.parse(o[2],2,tn);return p&&_?Ie(p.type,[nn,on,ft,ei,tn])?new lp(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${se(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!ye(h,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${se(ni(h))} instead.`);if(!ye(p,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${se(ni(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class dh{constructor(o,h,p){this.type=ft,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,tn),_=h.parse(o[2],2,tn);if(!p||!_)return null;if(!Ie(p.type,[nn,on,ft,ei,tn]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${se(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new dh(p,_,b):null}return new dh(p,_)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!ye(h,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${se(ni(h))} instead.`);if(!ye(p,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${se(ni(p))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(o);return p.indexOf(h,_)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class up{constructor(o,h,p,_,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=_,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,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof X=="number"&&Math.floor(X)!==X)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,ni(X)))return null}else p=ni(X);if(b[String(X)]!==void 0)return G.error("Branch labels must be unique.");b[String(X)]=x.length}const H=h.parse(O,A,_);if(!H)return null;_=_||H.type,x.push(H)}const E=h.parse(o[1],1,tn);if(!E)return null;const P=h.parse(o[o.length-1],o.length-1,_);return P?E.type.kind!=="value"&&h.concat(1).checkSubtype(p,E.type)?null:new up(p,_,E,b,x,P):null}evaluate(o){const h=this.input.evaluate(o);return(ni(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 cp{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 _=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class mh{constructor(o,h,p,_){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=_}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,tn),_=h.parse(o[2],2,ft);if(!p||!_)return null;if(!Ie(p.type,[K(tn),on,tn]))return h.error(`Expected first argument to be of type array or string, but found ${se(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new mh(p.type,p,_,b):null}return new mh(p.type,p,_)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!ye(h,["string","array"]))throw new yr(`Expected first argument to be of type array or string, but found ${se(ni(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(o);return h.slice(p,_)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function _m(u,o){return u==="=="||u==="!="?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 ym(u,o,h,p){return p.compare(o,h)===0}function hu(u,o,h){const p=u!=="=="&&u!=="!=";return class OI{constructor(b,x,E){this.type=nn,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 P=x.parse(b[1],1,tn);if(!P)return null;if(!_m(E,P.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${se(P.type)}'.`);let A=x.parse(b[2],2,tn);if(!A)return null;if(!_m(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${se(A.type)}'.`);if(P.type.kind!==A.type.kind&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${se(P.type)}' and '${se(A.type)}'.`);p&&(P.type.kind==="value"&&A.type.kind!=="value"?P=new No(A.type,[P]):P.type.kind!=="value"&&A.type.kind==="value"&&(A=new No(P.type,[A])));let N=null;if(b.length===4){if(P.type.kind!=="string"&&A.type.kind!=="string"&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,ba),!N)return null}return new OI(P,A,N)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const P=ni(x),A=ni(E);if(P.kind!==A.kind||P.kind!=="string"&&P.kind!=="number")throw new yr(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${P.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const P=ni(x),A=ni(E);if(P.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 ny=hu("==",function(u,o,h){return o===h},ym),ry=hu("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!ym(0,o,h,p)}),iy=hu("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),sy=hu("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),ay=hu(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class hp{constructor(o,h,p,_,b){this.type=on,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ft);if(!p)return null;const _=o[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let b=null;if(_.locale&&(b=h.parse(_.locale,1,on),!b))return null;let x=null;if(_.currency&&(x=h.parse(_.currency,1,on),!x))return null;let E=null;if(_["min-fraction-digits"]&&(E=h.parse(_["min-fraction-digits"],1,ft),!E))return null;let P=null;return _["max-fraction-digits"]&&(P=h.parse(_["max-fraction-digits"],1,ft),!P)?null:new hp(p,b,x,E,P)}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 gh{constructor(o){this.type=Vr,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 _=[];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 P=null;if(E["font-scale"]&&(P=h.parse(E["font-scale"],1,ft),!P))return null;let A=null;if(E["text-font"]&&(A=h.parse(E["text-font"],1,K(on)),!A))return null;let N=null;if(E["text-color"]&&(N=h.parse(E["text-color"],1,Rr),!N))return null;const O=_[_.length-1];O.scale=P,O.font=A,O.textColor=N}else{const P=h.parse(o[x],1,tn);if(!P)return null;const A=P.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,_.push({content:P,scale:null,font:null,textColor:null})}}return new gh(_)}evaluate(o){return new Ro(this.sections.map(h=>{const p=h.content.evaluate(o);return ni(p)===V?new sp("",p,null,null,null):new sp(ec(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 fp{constructor(o){this.type=V,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,on);return p?new fp(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=ts.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class pp{constructor(o){this.type=ft,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 ${se(p.type)} instead.`):new pp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new yr(`Expected value to be of type string or array, but found ${se(ni(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const fu={"==":ny,"!=":ry,">":oy,"<":iy,">=":ay,"<=":sy,array:No,at:ap,boolean:No,case:cp,coalesce:fh,collator:cu,format:gh,image:fp,in:lp,"index-of":dh,interpolate:zi,"interpolate-hcl":zi,"interpolate-lab":zi,length:pp,let:ph,literal:Za,match:up,number:No,"number-format":hp,object:No,slice:mh,step:ac,string:No,"to-boolean":Us,"to-color":Us,"to-number":Us,"to-string":Us,var:uh,within:Ll};function vm(u,[o,h,p,_]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const b=_?_.evaluate(u):1,x=uu(o,h,p,b);if(x)throw new yr(x);return new jn(o/255,h/255,p/255,b,!1)}function bm(u,o){return u in o}function dp(u,o){const h=o[u];return h===void 0?null:h}function Ml(u){return{type:u}}function xm(u){return{result:"success",value:u}}function pu(u){return{result:"error",value:u}}function du(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function wm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function mp(u){return!!u.expression&&u.expression.interpolated}function Mn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function _h(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function ly(u){return u}function Sm(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",_=p||!(p||u.property!==void 0),b=u.type||(mp(o)?"exponential":"interval");if(h||o.type==="padding"){const N=h?jn.parse:_o.parse;(u=Qo({},u)).stops&&(u.stops=u.stops.map(O=>[O[0],N(O[1])])),u.default=N(u.default?u.default:o.default)}if(u.colorSpace&&(x=u.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var x;let E,P,A;if(b==="exponential")E=In;else if(b==="interval")E=uy;else if(b==="categorical"){E=Ur,P=Object.create(null);for(const N of u.stops)P[N[0]]=N[1];A=typeof u.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=gp}if(p){const N={},O=[];for(let X=0;XX[0]),evaluate:({zoom:X},ne)=>In({stops:G,base:u.base},o,X).evaluate(X,ne)}}if(_){const N=b==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:zi.interpolationFactor.bind(void 0,N),zoomStops:u.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(u,o,O,P,A)}}return{kind:"source",evaluate(N,O){const G=O&&O.properties?O.properties[u.property]:void 0;return G===void 0?lc(u.default,o.default):E(u,o,G,P,A)}}}function lc(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function Ur(u,o,h,p,_){return lc(typeof h===_?p[h]:void 0,u.default,o.default)}function uy(u,o,h){if(Mn(h)!=="number")return lc(u.default,o.default);const p=u.stops.length;if(p===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[p-1][0])return u.stops[p-1][1];const _=sc(u.stops.map(b=>b[0]),h);return u.stops[_][1]}function In(u,o,h){const p=u.base!==void 0?u.base:1;if(Mn(h)!=="number")return lc(u.default,o.default);const _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];const b=sc(u.stops.map(N=>N[0]),h),x=function(N,O,G,H){const X=H-G,ne=N-G;return X===0?0:O===1?ne/X:(Math.pow(O,ne)-1)/(Math.pow(O,X)-1)}(h,p,u.stops[b][0],u.stops[b+1][0]),E=u.stops[b][1],P=u.stops[b+1][1],A=to[o.type]||ly;return typeof E.evaluate=="function"?{evaluate(...N){const O=E.evaluate.apply(void 0,N),G=P.evaluate.apply(void 0,N);if(O!==void 0&&G!==void 0)return A(O,G,x,u.colorSpace)}}:A(E,P,x,u.colorSpace)}function gp(u,o,h){switch(o.type){case"color":h=jn.parse(h);break;case"formatted":h=Ro.fromString(h.toString());break;case"resolvedImage":h=ts.fromString(h.toString());break;case"padding":h=_o.parse(h);break;default:Mn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return lc(h,u.default,o.default)}Oo.register(fu,{error:[{kind:"error"},[on],(u,[o])=>{throw new yr(o.evaluate(u))}],typeof:[on,[tn],(u,[o])=>se(ni(o.evaluate(u)))],"to-rgba":[K(ft,4),[Rr],(u,[o])=>{const[h,p,_,b]=o.evaluate(u).rgb;return[255*h,255*p,255*_,b]}],rgb:[Rr,[ft,ft,ft],vm],rgba:[Rr,[ft,ft,ft,ft],vm],has:{type:nn,overloads:[[[on],(u,[o])=>bm(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>bm(o.evaluate(u),h.evaluate(u))]]},get:{type:tn,overloads:[[[on],(u,[o])=>dp(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>dp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[tn,[on],(u,[o])=>dp(o.evaluate(u),u.featureState||{})],properties:[$o,[],u=>u.properties()],"geometry-type":[on,[],u=>u.geometryType()],id:[tn,[],u=>u.id()],zoom:[ft,[],u=>u.globals.zoom],"heatmap-density":[ft,[],u=>u.globals.heatmapDensity||0],"line-progress":[ft,[],u=>u.globals.lineProgress||0],accumulated:[tn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ft,Ml(ft),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[ft,Ml(ft),(u,o)=>{let h=1;for(const p of o)h*=p.evaluate(u);return h}],"-":{type:ft,overloads:[[[ft,ft],(u,[o,h])=>o.evaluate(u)-h.evaluate(u)],[[ft],(u,[o])=>-o.evaluate(u)]]},"/":[ft,[ft,ft],(u,[o,h])=>o.evaluate(u)/h.evaluate(u)],"%":[ft,[ft,ft],(u,[o,h])=>o.evaluate(u)%h.evaluate(u)],ln2:[ft,[],()=>Math.LN2],pi:[ft,[],()=>Math.PI],e:[ft,[],()=>Math.E],"^":[ft,[ft,ft],(u,[o,h])=>Math.pow(o.evaluate(u),h.evaluate(u))],sqrt:[ft,[ft],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))],log2:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ft,[ft],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ft,[ft],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ft,[ft],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ft,[ft],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ft,[ft],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ft,[ft],(u,[o])=>Math.atan(o.evaluate(u))],min:[ft,Ml(ft),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[ft,Ml(ft),(u,o)=>Math.max(...o.map(h=>h.evaluate(u)))],abs:[ft,[ft],(u,[o])=>Math.abs(o.evaluate(u))],round:[ft,[ft],(u,[o])=>{const h=o.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[ft,[ft],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ft,[ft],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[nn,[on,tn],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[nn,[tn],(u,[o])=>u.id()===o.value],"filter-type-==":[nn,[on],(u,[o])=>u.geometryType()===o.value],"filter-<":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[nn,[tn],(u,[o])=>o.value in u.properties()],"filter-has-id":[nn,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[nn,[K(on)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[nn,[K(tn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[nn,[on,K(tn)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[nn,[on,K(tn)],(u,[o,h])=>function(p,_,b,x){for(;b<=x;){const E=b+x>>1;if(_[E]===p)return!0;_[E]>p?x=E-1:b=E+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Ml(nn),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Ml(nn),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[nn,[nn],(u,[o])=>!o.evaluate(u)],"is-supported-script":[nn,[on],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[on,[on],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[on,[on],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[on,Ml(tn),(u,o)=>o.map(h=>ec(h.evaluate(u))).join("")],"resolved-locale":[on,[ba],(u,[o])=>o.evaluate(u).resolvedLocale()]});class sr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new qn,this._defaultValue=h?(p=h).type==="color"&&_h(p.default)?new jn(0,0,0,0):p.type==="color"?jn.parse(p.default)||null:p.type==="padding"?_o.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?es.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,_,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,_,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,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 yr(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).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 $n(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in fu}function Al(u,o){const h=new ih(fu,rc,[],o?function(_){const b={color:Rr,string:on,number:ft,enum:on,boolean:nn,formatted:Vr,padding:he,resolvedImage:V,variableAnchorOffsetCollection:W};return _.type==="array"?K(b[_.value]||tn,_.length):b[_.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?xm(new sr(p,o)):pu(h.errors)}class yh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!ic(h.expression)}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}}class _p{constructor(o,h,p,_){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!ic(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}interpolationFactor(o,h,p){return this.interpolationType?zi.interpolationFactor(this.interpolationType,o,h,p):0}}function Em(u,o){const h=Al(u,o);if(h.result==="error")return h;const p=h.value.expression,_=ch(p);if(!_&&!du(o))return pu([new $i("","data expressions not supported")]);const b=oc(p,["zoom"]);if(!b&&!wm(o))return pu([new $i("","zoom expressions not supported")]);const x=bh(p);return x||b?x instanceof $i?pu([x]):x instanceof zi&&!mp(o)?pu([new $i("",'"interpolate" expressions cannot be used with this property')]):xm(x?new _p(_?"camera":"composite",h.value,x.labels,x instanceof zi?x.interpolation:void 0):new yh(_?"constant":"source",h.value)):pu([new $i("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class vh{constructor(o,h){this._parameters=o,this._specification=h,Qo(this,Sm(this._parameters,this._specification))}static deserialize(o){return new vh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function bh(u){let o=null;if(u instanceof ph)o=bh(u.result);else if(u instanceof fh){for(const h of u.args)if(o=bh(h),o)break}else(u instanceof ac||u instanceof zi)&&u.input instanceof Oo&&u.input.name==="zoom"&&(o=u);return o instanceof $i||u.eachChild(h=>{const p=bh(h);p instanceof $i?o=p:!o&&p?o=new $i("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new $i("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function xh(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const o of u.slice(1))if(!xh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Im={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wh(u){if(u==null)return{filter:()=>!0,needGeometry:!1};xh(u)||(u=Eh(u));const o=Al(u,Im);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>o.value.evaluate(h,p,{},_),needGeometry:Sh(u)}}function Cm(u,o){return uo?1:0}function Sh(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?yp(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(Eh))):o==="all"?["all"].concat(u.slice(1).map(Eh)):o==="none"?["all"].concat(u.slice(1).map(Eh).map(Ih)):o==="in"?Tm(u[1],u.slice(2)):o==="!in"?Ih(Tm(u[1],u.slice(2))):o==="has"?Lm(u[1]):o==="!has"?Ih(Lm(u[1])):o!=="within"||u;var h}function yp(u,o,h){switch(u){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,u,o]}}function Tm(u,o){if(o.length===0)return!1;switch(u){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",u,["literal",o.sort(Cm)]]:["filter-in-small",u,["literal",o]]}}function Lm(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Ih(u){return["!",u]}function vp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let _="[";for(const b of u)_+=`${vp(b)},`;return`${_}]`}const h=Object.keys(u).sort();let p="{";for(let _=0;_p.maximum?[new at(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Mm(u){const o=u.valueSpec,h=Cr(u.value.type);let p,_,b,x={};const E=h!=="categorical"&&u.value.property===void 0,P=!E,A=Mn(u.value.stops)==="array"&&Mn(u.value.stops[0])==="array"&&Mn(u.value.stops[0][0])==="object",N=no({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(H){if(h==="identity")return[new at(H.key,H.value,'identity function may not have a "stops" property')];let X=[];const ne=H.value;return X=X.concat(bp({key:H.key,value:ne,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:O})),Mn(ne)==="array"&&ne.length===0&&X.push(new at(H.key,ne,"array must have at least one stop")),X},default:function(H){return H.validateSpec({key:H.key,value:H.value,valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec})}}});return h==="identity"&&E&&N.push(new at(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||N.push(new at(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!mp(u.valueSpec)&&N.push(new at(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(P&&!du(u.valueSpec)?N.push(new at(u.key,u.value,"property functions not supported")):E&&!wm(u.valueSpec)&&N.push(new at(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!A||u.value.property!==void 0||N.push(new at(u.key,u.value,'"property" property is required')),N;function O(H){let X=[];const ne=H.value,ce=H.key;if(Mn(ne)!=="array")return[new at(ce,ne,`array expected, ${Mn(ne)} found`)];if(ne.length!==2)return[new at(ce,ne,`array length 2 expected, length ${ne.length} found`)];if(A){if(Mn(ne[0])!=="object")return[new at(ce,ne,`object expected, ${Mn(ne[0])} found`)];if(ne[0].zoom===void 0)return[new at(ce,ne,"object stop key must have zoom")];if(ne[0].value===void 0)return[new at(ce,ne,"object stop key must have value")];if(b&&b>Cr(ne[0].zoom))return[new at(ce,ne[0].zoom,"stop zoom values must appear in ascending order")];Cr(ne[0].zoom)!==b&&(b=Cr(ne[0].zoom),_=void 0,x={}),X=X.concat(no({key:`${ce}[0]`,value:ne[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:Ch,value:G}}))}else X=X.concat(G({key:`${ce}[0]`,value:ne[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},ne));return $n(Ya(ne[1]))?X.concat([new at(`${ce}[1]`,ne[1],"expressions are not allowed in function stops.")]):X.concat(H.validateSpec({key:`${ce}[1]`,value:ne[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function G(H,X){const ne=Mn(H.value),ce=Cr(H.value),_e=H.value!==null?H.value:X;if(p){if(ne!==p)return[new at(H.key,_e,`${ne} stop domain type must match previous stop domain type ${p}`)]}else p=ne;if(ne!=="number"&&ne!=="string"&&ne!=="boolean")return[new at(H.key,_e,"stop domain value must be a number, string, or boolean")];if(ne!=="number"&&h!=="categorical"){let Re=`number expected, ${ne} found`;return du(o)&&h===void 0&&(Re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(H.key,_e,Re)]}return h!=="categorical"||ne!=="number"||isFinite(ce)&&Math.floor(ce)===ce?h!=="categorical"&&ne==="number"&&_!==void 0&&ce<_?[new at(H.key,_e,"stop domain values must appear in ascending order")]:(_=ce,h==="categorical"&&ce in x?[new at(H.key,_e,"stop domain values must be unique")]:(x[ce]=!0,[])):[new at(H.key,_e,`integer expected, found ${ce}`)]}}function Ka(u){const o=(u.expressionContext==="property"?Em:Al)(Ya(u.value),u.valueSpec);if(o.result==="error")return o.value.map(p=>new at(`${u.key}${p.key}`,u.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new at(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!ic(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!ic(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!oc(h,["zoom","feature-state"]))return[new at(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!ch(h))return[new at(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ja(u){const o=u.key,h=u.value,p=u.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(Cr(h))===-1&&_.push(new at(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Cr(h))===-1&&_.push(new at(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function mu(u){return xh(Ya(u.value))?Ka(Qo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xp(u)}function xp(u){const o=u.value,h=u.key;if(Mn(o)!=="array")return[new at(h,o,`array expected, ${Mn(o)} found`)];const p=u.styleSpec;let _,b=[];if(o.length<1)return[new at(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:u.style,styleSpec:u.styleSpec})),Cr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Cr(o[1])==="$type"&&b.push(new at(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new at(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(_=Mn(o[1]),_!=="string"&&b.push(new at(`${h}[1]`,o[1],`string expected, ${_} found`)));for(let x=2;x{A in h&&o.push(new at(p,h[A],`"${A}" is prohibited for ref layers`))}),_.layers.forEach(A=>{Cr(A.id)===E&&(P=A)}),P?P.ref?o.push(new at(p,h.ref,"ref cannot reference another ref layer")):x=Cr(P.type):o.push(new at(p,h.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(h.source){const P=_.sources&&_.sources[h.source],A=P&&Cr(P.type);P?A==="vector"&&x==="raster"?o.push(new at(p,h.source,`layer "${h.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new at(p,h.source,`layer "${h.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new at(p,h.source,`layer "${h.id}" requires a vector source`)):A!=="vector"||h["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new at(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!h.paint||!h.paint["line-gradient"]||A==="geojson"&&P.lineMetrics||o.push(new at(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new at(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new at(p,h.source,`source "${h.source}" not found`))}else o.push(new at(p,h,'missing required property "source"'));return o=o.concat(no({key:p,value:h,valueSpec:b.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:h.type,valueSpec:b.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:mu,layout:P=>no({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Sp(Qo({layerType:x},A))}}),paint:P=>no({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>wp(Qo({layerType:x},A))}})}})),o}function kl(u){const o=u.value,h=u.key,p=Mn(o);return p!=="string"?[new at(h,o,`string expected, ${p} found`)]:[]}const Am={promoteId:function({key:u,value:o}){if(Mn(o)==="string")return kl({key:u,value:o});{const h=[];for(const p in o)h.push(...kl({key:`${u}.${p}`,value:o[p]}));return h}}};function km(u){const o=u.value,h=u.key,p=u.styleSpec,_=u.style,b=u.validateSpec;if(!o.type)return[new at(h,o,'"type" is required')];const x=Cr(o.type);let E;switch(x){case"vector":case"raster":return E=no({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:Am,validateSpec:b}),E;case"raster-dem":return E=function(P){var A;const N=(A=P.sourceName)!==null&&A!==void 0?A:"",O=P.value,G=P.styleSpec,H=G.source_raster_dem,X=P.style;let ne=[];const ce=Mn(O);if(O===void 0)return ne;if(ce!=="object")return ne.push(new at("source_raster_dem",O,`object expected, ${ce} found`)),ne;const _e=Cr(O.encoding)==="custom",Re=["redFactor","greenFactor","blueFactor","baseShift"],be=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Te in O)!_e&&Re.includes(Te)?ne.push(new at(Te,O[Te],`In "${N}": "${Te}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):H[Te]?ne=ne.concat(P.validateSpec({key:Te,value:O[Te],valueSpec:H[Te],validateSpec:P.validateSpec,style:X,styleSpec:G})):ne.push(new at(Te,O[Te],`unknown property "${Te}"`));return ne}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=no({key:h,value:o,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:b,objectElementValidators:Am}),o.cluster)for(const P in o.clusterProperties){const[A,N]=o.clusterProperties[P],O=typeof A=="string"?[A,["accumulated"],["get",P]]:A;E.push(...Ka({key:`${h}.${P}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),E.push(...Ka({key:`${h}.${P}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return no({key:h,value:o,valueSpec:p.source_video,style:_,validateSpec:b,styleSpec:p});case"image":return no({key:h,value:o,valueSpec:p.source_image,style:_,validateSpec:b,styleSpec:p});case"canvas":return[new at(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:_,validateSpec:b,styleSpec:p})}}function Dm(u){const o=u.value,h=u.styleSpec,p=h.light,_=u.style;let b=[];const x=Mn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new at("light",o,`object expected, ${x} found`)]),b;for(const E in o){const P=E.match(/^(.*)-transition$/);b=b.concat(P&&p[P[1]]&&p[P[1]].transition?u.validateSpec({key:E,value:o[E],valueSpec:h.transition,validateSpec:u.validateSpec,style:_,styleSpec:h}):p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new at(E,o[E],`unknown property "${E}"`)])}return b}function Rm(u){const o=u.value,h=u.styleSpec,p=h.sky,_=u.style,b=Mn(o);if(o===void 0)return[];if(b!=="object")return[new at("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Gs({key:E,value:o[E],valueSpec:p[E],style:_,styleSpec:h}):[new at(E,o[E],`unknown property "${E}"`)]);return x}function cc(u){const o=u.value,h=u.styleSpec,p=h.terrain,_=u.style;let b=[];const x=Mn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new at("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new at(E,o[E],`unknown property "${E}"`)]);return b}function hc(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const _=[],b=[];for(const x in h)h[x].id&&_.includes(h[x].id)&&o.push(new at(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),_.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new at(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat(no({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return kl({key:p,value:h})}const yo={"*":()=>[],array:bp,boolean:function(u){const o=u.value,h=u.key,p=Mn(o);return p!=="boolean"?[new at(h,o,`boolean expected, ${p} found`)]:[]},number:Ch,color:function(u){const o=u.key,h=u.value,p=Mn(h);return p!=="string"?[new at(o,h,`color expected, ${p} found`)]:jn.parse(String(h))?[]:[new at(o,h,`color expected, "${h}" found`)]},constants:Pm,enum:Ja,filter:mu,function:Mm,layer:uc,object:no,source:km,light:Dm,sky:Rm,terrain:cc,string:kl,formatted:function(u){return kl(u).length===0?[]:Ka(u)},resolvedImage:function(u){return kl(u).length===0?[]:Ka(u)},padding:function(u){const o=u.key,h=u.value;if(Mn(h)==="array"){if(h.length<1||h.length>4)return[new at(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let b=0;b[]}})),u.constants&&(h=h.concat(Pm({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:Gs}))),gu(h)}function js(u){return function(o){return u({...o,validateSpec:Gs})}}function gu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function vs(u){return function(...o){return gu(u.apply(this,o))}}ys.source=vs(js(km)),ys.sprite=vs(js(hc)),ys.glyphs=vs(js(Ep)),ys.light=vs(js(Dm)),ys.sky=vs(js(Rm)),ys.terrain=vs(js(cc)),ys.layer=vs(js(uc)),ys.filter=vs(js(mu)),ys.paintProperty=vs(js(wp)),ys.layoutProperty=vs(js(Sp));const Dl=ys,hy=Dl.light,Ip=Dl.paintProperty,fy=Dl.layoutProperty;function _u(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new _t(new Error(p.message))),h=!0;return h}class fc{constructor(o,h,p){const _=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 P=0;P=O[X+0]&&_>=O[X+1])?(E[H]=!0,x.push(N[H])):E[H]=!1}}}}_forEachCell(o,h,p,_,b,x,E,P){const A=this._convertToCellCoord(o),N=this._convertToCellCoord(h),O=this._convertToCellCoord(p),G=this._convertToCellCoord(_);for(let H=A;H<=O;H++)for(let X=N;X<=G;X++){const ne=this.d*X+H;if((!P||P(this._convertFromCellCoord(H),this._convertFromCellCoord(X),this._convertFromCellCoord(H+1),this._convertFromCellCoord(X+1)))&&b.call(this,o,h,p,_,ne,x,E,P))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=u[b];_[b]=qs[p].shallow.indexOf(b)>=0?x:yu(x,o)}u instanceof Error&&(_.message=u.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(_.$name=p),_}throw new Error("can't serialize object of type "+typeof u)}function vu(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||u instanceof Error||Lh(u)||zt(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(vu);if(typeof u=="object"){const o=u.$name||"Object";if(!qs[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=qs[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const _ of Object.keys(u)){if(_==="$name")continue;const b=u[_];p[_]=qs[o].shallow.indexOf(_)>=0?b:vu(b)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Nm{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.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519};function bu(u){for(const o of u)if(Ph(o.charCodeAt(0)))return!0;return!1}function Om(u){for(const o of u)if(!zm(o.charCodeAt(0)))return!1;return!0}function zm(u){return!(bt.Arabic(u)||bt["Arabic Supplement"](u)||bt["Arabic Extended-A"](u)||bt["Arabic Presentation Forms-A"](u)||bt["Arabic Presentation Forms-B"](u))}function Ph(u){return!(u!==746&&u!==747&&(u<4352||!(bt["Bopomofo Extended"](u)||bt.Bopomofo(u)||bt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||bt["CJK Compatibility Ideographs"](u)||bt["CJK Compatibility"](u)||bt["CJK Radicals Supplement"](u)||bt["CJK Strokes"](u)||!(!bt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||bt["CJK Unified Ideographs Extension A"](u)||bt["CJK Unified Ideographs"](u)||bt["Enclosed CJK Letters and Months"](u)||bt["Hangul Compatibility Jamo"](u)||bt["Hangul Jamo Extended-A"](u)||bt["Hangul Jamo Extended-B"](u)||bt["Hangul Jamo"](u)||bt["Hangul Syllables"](u)||bt.Hiragana(u)||bt["Ideographic Description Characters"](u)||bt.Kanbun(u)||bt["Kangxi Radicals"](u)||bt["Katakana Phonetic Extensions"](u)||bt.Katakana(u)&&u!==12540||!(!bt["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!bt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||bt["Unified Canadian Aboriginal Syllabics"](u)||bt["Unified Canadian Aboriginal Syllabics Extended"](u)||bt["Vertical Forms"](u)||bt["Yijing Hexagram Symbols"](u)||bt["Yi Syllables"](u)||bt["Yi Radicals"](u))))}function Cp(u){return!(Ph(u)||function(o){return!!(bt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||bt["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)||bt["Letterlike Symbols"](o)||bt["Number Forms"](o)||bt["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)||bt["Control Pictures"](o)&&o!==9251||bt["Optical Character Recognition"](o)||bt["Enclosed Alphanumerics"](o)||bt["Geometric Shapes"](o)||bt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||bt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||bt["CJK Symbols and Punctuation"](o)||bt.Katakana(o)||bt["Private Use Area"](o)||bt["CJK Compatibility Forms"](o)||bt["Small Form Variants"](o)||bt["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function Mh(u){return u>=1424&&u<=2303||bt["Arabic Presentation Forms-A"](u)||bt["Arabic Presentation Forms-B"](u)}function Fm(u,o){return!(!o&&Mh(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||bt.Khmer(u))}function py(u){for(const o of u)if(Mh(o.charCodeAt(0)))return!0;return!1}const Qa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class fr{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 Nm,this.transition={})}isSupportedScript(o){return function(h,p){for(const _ of h)if(!Fm(_.charCodeAt(0),p))return!1;return!0}(o,Qa.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 pc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,_){if(_h(p))return new vh(p,_);if($n(p)){const b=Em(p,_);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return _.type==="color"&&typeof p=="string"?b=jn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=es.parse(p)):b=_o.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 Ah{constructor(o){this.property=o,this.value=new pc(o,void 0)}transitioned(o,h){return new Bm(this.property,this.value,h,pe({},o.transition,this.transition),o.now)}untransitioned(){return new Bm(this.property,this.value,null,{},0)}}class Tp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Y(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Ah(this._values[o].property)),this._values[o].value=new pc(this._values[o].property,h===null?void 0:Y(h))}getTransition(o){return Y(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Ah(this._values[o].property)),this._values[o].transition=Y(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 _=this.getTransition(h);_!==void 0&&(o[`${h}-transition`]=_)}return o}transitioned(o,h){const p=new Vm(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(o,h._values[_]);return p}untransitioned(){const o=new Vm(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Bm{constructor(o,h,p,_,b){this.property=o,this.value=h,this.begin=b+_.delay||0,this.end=this.begin+_.duration||0,o.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const _=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(_>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(_=1)return 1;const A=P*P,N=A*P;return 4*(P<.5?N:3*(P-A)+N-.75)}(E))}}return b}}class Vm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const _=new dc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Um{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Y(this._values[o].value)}setValue(o,h){this._values[o]=new pc(this._values[o].property,h===null?void 0:Y(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 _=new dc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}}class bs{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,_){return this.property.evaluate(this.value,this.parameters,o,h,p,_)}}class dc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Dt{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 _=to[this.specification.type];return _?_(o,h,p):o}}class Vt{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,_){return new bs(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,_)}: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 bs(this,{kind:"constant",value:void 0},o.parameters);const _=to[this.specification.type];if(_){const b=_(o.value.value,h.value.value,p);return new bs(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,_,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,_,b,x)}}class kh extends Vt{possiblyEvaluate(o,h,p,_){if(o.value===void 0)return new bs(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,h);return new bs(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 bs(this,{kind:"constant",value:b},h)}return new bs(this,o.expression,h)}evaluate(o,h,p,_,b,x){if(o.kind==="source"){const E=o.evaluate(h,p,_,b,x);return this._calculate(E,E,E,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,_),o.evaluate({zoom:Math.floor(h.zoom)},p,_),o.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):o.value}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class mc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new fr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new fr(Math.floor(h.zoom),h)),o.expression.evaluate(new fr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Lp{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){return!!o.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class vo{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 _=this.defaultPropertyValues[h]=new pc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new Ah(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}Et("DataDrivenProperty",Vt),Et("DataConstantProperty",Dt),Et("CrossFadedDataDrivenProperty",kh),Et("CrossFadedProperty",mc),Et("ColorRampProperty",Lp);const Pp="-transition";class xs extends xn{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 Um(h.layout)),h.paint)){this._transitionablePaint=new Tp(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 dc(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(fy,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(Pp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(Ip,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(Pp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[o],b=_.property.specification["property-type"]==="cross-faded-data-driven",x=_.value.isDataDriven(),E=_.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const P=this._transitionablePaint._values[o].value;return P.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,P)}}_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),Ae(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,_,b={}){return(!b||b.validate!==!1)&&_u(this,o.call(Dl,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:ze,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 bs&&du(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const Gm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class gc{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 Tr{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 Gr(u,o=1){let h=0,p=0;return{members:u.map(_=>{const b=Gm[_.type].BYTES_PER_ELEMENT,x=h=jm(h,Math.max(o,b)),E=_.components||1;return p=Math.max(p,b),h+=b*E,{name:_.name,type:_.type,components:E,offset:x}}),size:jm(h,Math.max(p,o)),alignment:o}}function jm(u,o){return Math.ceil(u/o)*o}class _c extends Tr{_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 _=2*o;return this.int16[_+0]=h,this.int16[_+1]=p,o}}_c.prototype.bytesPerElement=4,Et("StructArrayLayout2i4",_c);class xa extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=_,o}}xa.prototype.bytesPerElement=6,Et("StructArrayLayout3i6",xa);class Mp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=_,this.int16[x+3]=b,o}}Mp.prototype.bytesPerElement=8,Et("StructArrayLayout4i8",Mp);class Ap extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,o}}Ap.prototype.bytesPerElement=12,Et("StructArrayLayout2i4i12",Ap);class kp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=4*o,A=8*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.uint8[A+4]=_,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}kp.prototype.bytesPerElement=8,Et("StructArrayLayout2i4ub8",kp);class yc extends Tr{_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 _=2*o;return this.float32[_+0]=h,this.float32[_+1]=p,o}}yc.prototype.bytesPerElement=8,Et("StructArrayLayout2f8",yc);class Dh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,_,b,x,E,P,A,N)}emplace(o,h,p,_,b,x,E,P,A,N,O){const G=10*o;return this.uint16[G+0]=h,this.uint16[G+1]=p,this.uint16[G+2]=_,this.uint16[G+3]=b,this.uint16[G+4]=x,this.uint16[G+5]=E,this.uint16[G+6]=P,this.uint16[G+7]=A,this.uint16[G+8]=N,this.uint16[G+9]=O,o}}Dh.prototype.bytesPerElement=20,Et("StructArrayLayout10ui20",Dh);class Dp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G){const H=this.length;return this.resize(H+1),this.emplace(H,o,h,p,_,b,x,E,P,A,N,O,G)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H){const X=12*o;return this.int16[X+0]=h,this.int16[X+1]=p,this.int16[X+2]=_,this.int16[X+3]=b,this.uint16[X+4]=x,this.uint16[X+5]=E,this.uint16[X+6]=P,this.uint16[X+7]=A,this.int16[X+8]=N,this.int16[X+9]=O,this.int16[X+10]=G,this.int16[X+11]=H,o}}Dp.prototype.bytesPerElement=24,Et("StructArrayLayout4i4ui4i24",Dp);class Rp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Rp.prototype.bytesPerElement=12,Et("StructArrayLayout3f12",Rp);class wa extends Tr{_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}}wa.prototype.bytesPerElement=4,Et("StructArrayLayout1ul4",wa);class Rh extends Tr{_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,_,b,x,E,P,A){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,_,b,x,E,P,A)}emplace(o,h,p,_,b,x,E,P,A,N){const O=10*o,G=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=_,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[G+3]=P,this.uint16[O+8]=A,this.uint16[O+9]=N,o}}Rh.prototype.bytesPerElement=20,Et("StructArrayLayout6i1ul2ui20",Rh);class vc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,o}}vc.prototype.bytesPerElement=12,Et("StructArrayLayout2i2i2i12",vc);class Nh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_,b)}emplace(o,h,p,_,b,x){const E=4*o,P=8*o;return this.float32[E+0]=h,this.float32[E+1]=p,this.float32[E+2]=_,this.int16[P+6]=b,this.int16[P+7]=x,o}}Nh.prototype.bytesPerElement=16,Et("StructArrayLayout2f1f2i16",Nh);class bc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=12*o,E=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[E+1]=_,this.float32[E+2]=b,o}}bc.prototype.bytesPerElement=12,Et("StructArrayLayout2ub2f12",bc);class Oh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=_,o}}Oh.prototype.bytesPerElement=6,Et("StructArrayLayout3ui6",Oh);class xu extends Tr{_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,_,b,x,E,P,A,N,O,G,H,X,ne,ce,_e){const Re=this.length;return this.resize(Re+1),this.emplace(Re,o,h,p,_,b,x,E,P,A,N,O,G,H,X,ne,ce,_e)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H,X,ne,ce,_e,Re){const be=24*o,Te=12*o,Ke=48*o;return this.int16[be+0]=h,this.int16[be+1]=p,this.uint16[be+2]=_,this.uint16[be+3]=b,this.uint32[Te+2]=x,this.uint32[Te+3]=E,this.uint32[Te+4]=P,this.uint16[be+10]=A,this.uint16[be+11]=N,this.uint16[be+12]=O,this.float32[Te+7]=G,this.float32[Te+8]=H,this.uint8[Ke+36]=X,this.uint8[Ke+37]=ne,this.uint8[Ke+38]=ce,this.uint32[Te+10]=_e,this.int16[be+22]=Re,o}}xu.prototype.bytesPerElement=48,Et("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xu);class Rl extends Tr{_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,_,b,x,E,P,A,N,O,G,H,X,ne,ce,_e,Re,be,Te,Ke,Qe,wt,Tt,xt,yt,ct,It){const mt=this.length;return this.resize(mt+1),this.emplace(mt,o,h,p,_,b,x,E,P,A,N,O,G,H,X,ne,ce,_e,Re,be,Te,Ke,Qe,wt,Tt,xt,yt,ct,It)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H,X,ne,ce,_e,Re,be,Te,Ke,Qe,wt,Tt,xt,yt,ct,It,mt){const st=32*o,Bt=16*o;return this.int16[st+0]=h,this.int16[st+1]=p,this.int16[st+2]=_,this.int16[st+3]=b,this.int16[st+4]=x,this.int16[st+5]=E,this.int16[st+6]=P,this.int16[st+7]=A,this.uint16[st+8]=N,this.uint16[st+9]=O,this.uint16[st+10]=G,this.uint16[st+11]=H,this.uint16[st+12]=X,this.uint16[st+13]=ne,this.uint16[st+14]=ce,this.uint16[st+15]=_e,this.uint16[st+16]=Re,this.uint16[st+17]=be,this.uint16[st+18]=Te,this.uint16[st+19]=Ke,this.uint16[st+20]=Qe,this.uint16[st+21]=wt,this.uint16[st+22]=Tt,this.uint32[Bt+12]=xt,this.float32[Bt+13]=yt,this.float32[Bt+14]=ct,this.uint16[st+30]=It,this.uint16[st+31]=mt,o}}Rl.prototype.bytesPerElement=64,Et("StructArrayLayout8i15ui1ul2f2ui64",Rl);class zh extends Tr{_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}}zh.prototype.bytesPerElement=4,Et("StructArrayLayout1f4",zh);class Fh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Fh.prototype.bytesPerElement=12,Et("StructArrayLayout1ui2f12",Fh);class Nl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=_,o}}Nl.prototype.bytesPerElement=8,Et("StructArrayLayout1ul2ui8",Nl);class Np extends Tr{_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 _=2*o;return this.uint16[_+0]=h,this.uint16[_+1]=p,o}}Np.prototype.bytesPerElement=4,Et("StructArrayLayout2ui4",Np);class Op extends Tr{_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}}Op.prototype.bytesPerElement=2,Et("StructArrayLayout1ui2",Op);class Bh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,this.float32[x+3]=b,o}}Bh.prototype.bytesPerElement=16,Et("StructArrayLayout4f16",Bh);class qm extends gc{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)}}qm.prototype.size=20;class y extends Rh{get(o){return new qm(this,o)}}Et("CollisionBoxArray",y);class s extends gc{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 xu{get(o){return new s(this,o)}}Et("PlacedSymbolArray",f);class m extends gc{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]}}m.prototype.size=64;class g extends Rl{get(o){return new m(this,o)}}Et("SymbolInstanceArray",g);class v extends zh{getoffsetX(o){return this.float32[1*o+0]}}Et("GlyphOffsetArray",v);class C extends xa{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}Et("SymbolLineVertexArray",C);class L extends gc{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]}}L.prototype.size=12;class M extends Fh{get(o){return new L(this,o)}}Et("TextAnchorOffsetArray",M);class R extends gc{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}R.prototype.size=8;class z extends Nl{get(o){return new R(this,o)}}Et("FeatureIndexArray",z);class F extends _c{}class Z extends _c{}class ue extends _c{}class le extends Ap{}class fe extends kp{}class te extends yc{}class xe extends Dh{}class Be extends Dp{}class de extends Rp{}class Pe extends wa{}class Ve extends vc{}class je extends bc{}class Xe extends Oh{}class tt extends Np{}const $e=Gr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ut}=$e;class pt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,_){let b=this.segments[this.segments.length-1];return o>pt.MAX_VERTEX_ARRAY_LENGTH&&He(`Max vertices per segment is ${pt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>pt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==_)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(b.sortKey=_),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,_){return new pt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function sn(u,o){return 256*(u=ae(Math.floor(u),0,255))+ae(Math.floor(o),0,255)}pt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Et("SegmentVector",pt);const dt=Gr([{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 Ut={exports:{}},an={exports:{}};an.exports=function(u,o){var h,p,_,b,x,E,P,A;for(p=u.length-(h=3&u.length),_=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(P=0,h){case 3:P^=(255&u.charCodeAt(A+2))<<16;case 2:P^=(255&u.charCodeAt(A+1))<<8;case 1:_^=P=(65535&(P=(P=(65535&(P^=255&u.charCodeAt(A)))*x+(((P>>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295}return _^=u.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var Cn=an.exports,Ht={exports:{}};Ht.exports=function(u,o){for(var h,p=u.length,_=o^p,b=0;p>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(b)|(255&u.charCodeAt(++b))<<8|(255&u.charCodeAt(++b))<<16|(255&u.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:_^=(255&u.charCodeAt(b+2))<<16;case 2:_^=(255&u.charCodeAt(b+1))<<8;case 1:_=1540483477*(65535&(_^=255&u.charCodeAt(b)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var hn=Cn,pn=Ht.exports;Ut.exports=hn,Ut.exports.murmur3=hn,Ut.exports.murmur2=pn;var Lr=d(Ut.exports);class Wn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,_){this.ids.push(zo(o)),this.positions.push(h,p,_)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zo(o);let p=0,_=this.ids.length-1;for(;p<_;){const x=p+_>>1;this.ids[x]>=h?_=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),_=new Uint32Array(o.positions);return li(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(o){const h=new Wn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function zo(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Lr(String(u))}function li(u,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(u[b]<_);do x--;while(u[x]>_);if(b>=x)break;vr(u,b,x),vr(o,3*b,3*x),vr(o,3*b+1,3*x+1),vr(o,3*b+2,3*x+2)}x-h`u_${_}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new $a(o,h):new Fo(o,h)}}class ri{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,_){const b=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Ws(o,h):new Fo(o,h)}}class br{constructor(o,h,p,_){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 _}populatePaintArray(o,h,p,_,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new fr(0),h,{},_,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const _=el(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=_,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,_,b){const x=this.expression.evaluate(new fr(this.zoom),h,{},_,[],b),E=this.expression.evaluate(new fr(this.zoom+1),h,{},_,[],b),P=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(P,o,x,E)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:this.zoom},p,_),x=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,_){if(this.type==="color"){const b=el(p),x=el(_);for(let E=o;E`#define HAS_UNIFORM_${_}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof br||p instanceof pr)for(let _=0;_!0){this.programConfigurations={};for(const _ of o)this.programConfigurations[_.id]=new ii(_,h,p);this.needsUpload=!1,this._featureMap=new Wn,this._bufferOffset=0}populatePaintArrays(o,h,p,_,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,h,_,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,_){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,_)||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 rs(u,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"]}[u]||[u.replace(`${o}-`,"").replace(/-/g,"_")]}function oi(u,o,h){const p={color:{source:yc,composite:Bh},number:{source:zh,composite:yc}},_=function(b){return{"line-pattern":{source:xe,composite:xe},"fill-pattern":{source:xe,composite:xe},"fill-extrusion-pattern":{source:xe,composite:xe}}[b]}(u);return _&&_[h]||p[o][h]}Et("ConstantBinder",Hs),Et("CrossFadedConstantBinder",ri),Et("SourceExpressionBinder",br),Et("CrossFadedCompositeBinder",ns),Et("CompositeExpressionBinder",pr),Et("ProgramConfiguration",ii,{omit:["_buffers"]}),Et("ProgramConfigurationSet",xr);const Nr=8192,zp=Math.pow(2,14)-1,Wm=-zp-1;function Ol(u){const o=Nr/u.extent,h=u.loadGeometry();for(let p=0;px.x+1||Px.y+1)&&He("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function zl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?Ol(u):[]}}function Vh(u,o,h,p,_){u.emplaceBack(2*o+(p+1)/2,2*h+(_+1)/2)}class tl{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 Z,this.indexArray=new Xe,this.segments=new pt,this.programConfigurations=new xr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const _=this.layers[0],b=[];let x=null,E=!1;_.type==="circle"&&(x=_.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:P,id:A,index:N,sourceLayerIndex:O}of o){const G=this.layers[0]._featureFilter.needGeometry,H=zl(P,G);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),H,p))continue;const X=E?x.evaluate(H,{},p):void 0,ne={id:A,properties:P.properties,type:P.type,sourceLayerIndex:O,index:N,geometry:G?H.geometry:Ol(P),patterns:{},sortKey:X};b.push(ne)}E&&b.sort((P,A)=>P.sortKey-A.sortKey);for(const P of b){const{geometry:A,index:N,sourceLayerIndex:O}=P,G=o[N].feature;this.addFeature(P,A,N,p),h.featureIndex.insert(G,A,N,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,ut),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,_){for(const b of h)for(const x of b){const E=x.x,P=x.y;if(E<0||E>=Nr||P<0||P>=Nr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),N=A.vertexLength;Vh(this.layoutVertexArray,E,P,-1,-1),Vh(this.layoutVertexArray,E,P,1,-1),Vh(this.layoutVertexArray,E,P,1,1),Vh(this.layoutVertexArray,E,P,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},_)}}function Fp(u,o){for(let h=0;h1){if(Uh(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(_)._add(o))}function R1(u,o){let h,p,_,b=!1;for(let x=0;xo.y!=_.y>o.y&&o.x<(_.x-p.x)*(o.y-p.y)/(_.y-p.y)+p.x&&(b=!b)}return b}function Gh(u,o){let h=!1;for(let p=0,_=u.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 sT(u,o,h){const p=h[0],_=h[2];if(u.x_.x&&o.x>_.x||u.y_.y&&o.y>_.y)return!1;const b=ge(u,o,h[0]);return b!==ge(u,o,h[1])||b!==ge(u,o,h[2])||b!==ge(u,o,h[3])}function Gp(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function Zm(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Xm(u,o,h,p,_){if(!o[0]&&!o[1])return u;const b=I.convert(o)._mult(_);h==="viewport"&&b._rotate(-p);const x=[];for(let E=0;EF1(ce,ne))}(A,P),H=O?N*E:N;for(const X of _)for(const ne of X){const ce=O?ne:F1(ne,P);let _e=H;const Re=Ym([],[ne.x,ne.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?_e*=Re[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(_e*=x.cameraToCenterDistance/Re[3]),Hm(G,ce,_e))return!0}return!1}}function F1(u,o){const h=Ym([],[u.x,u.y,0,1],o);return new I(h[0]/h[3],h[1]/h[3])}class B1 extends tl{}let V1;Et("HeatmapBucket",B1,{omit:["layers"]});var cT={get paint(){return V1=V1||new vo({"heatmap-radius":new Vt(ze.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vt(ze.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Dt(ze.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Lp(ze.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Dt(ze.paint_heatmap["heatmap-opacity"])})}};function gy(u,{width:o,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${o*h*p}`)}else _=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=_,u}function U1(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const _=gy({},{width:o,height:h},p);_y(u,_,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,h)},p),u.width=o,u.height=h,u.data=_.data}function _y(u,o,h,p,_,b){if(_.width===0||_.height===0)return o;if(_.width>u.width||_.height>u.height||h.x>u.width-_.width||h.y>u.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>o.width||_.height>o.height||p.x>o.width-_.width||p.y>o.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const x=u.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<_.height;P++){const A=((h.y+P)*u.width+h.x)*b,N=((p.y+P)*o.width+p.x)*b;for(let O=0;O<_.width*b;O++)E[N+O]=x[A+O]}return o}class qp{constructor(o,h){gy(this,o,1,h)}resize(o){U1(this,o,1)}clone(){return new qp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){_y(o,h,p,_,b,1)}}class ws{constructor(o,h){gy(this,o,4,h)}resize(o){U1(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new ws({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){_y(o,h,p,_,b,4)}}function G1(u){const o={},h=u.resolution||256,p=u.clips?u.clips.length:1,_=u.image||new ws({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const b=(x,E,P)=>{o[u.evaluationKey]=P;const A=u.expression.evaluate(o);_.data[x+E+0]=Math.floor(255*A.r/A.a),_.data[x+E+1]=Math.floor(255*A.g/A.a),_.data[x+E+2]=Math.floor(255*A.b/A.a),_.data[x+E+3]=Math.floor(255*A.a)};if(u.clips)for(let x=0,E=0;x80*h){p=b=u[0],_=x=u[1];for(var X=h;Xb&&(b=E),P>x&&(x=P);A=(A=Math.max(b-p,x-_))!==0?32767/A:0}return Wp(G,H,h,p,_,A,0),H}function q1(u,o,h,p,_){var b,x;if(_===xy(u,o,h,p)>0)for(b=o;b=o;b-=p)x=Z1(b,u[b],u[b+1],x);return x&&Jm(x,x.next)&&(Zp(x),x=x.next),x}function wc(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!Jm(p,p.next)&&jr(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 Wp(u,o,h,p,_,b,x){if(u){!x&&b&&function(N,O,G,H){var X=N;do X.z===0&&(X.z=vy(X.x,X.y,O,G,H)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==N);X.prevZ.nextZ=null,X.prevZ=null,function(ne){var ce,_e,Re,be,Te,Ke,Qe,wt,Tt=1;do{for(_e=ne,ne=null,Te=null,Ke=0;_e;){for(Ke++,Re=_e,Qe=0,ce=0;ce0||wt>0&ℜ)Qe!==0&&(wt===0||!Re||_e.z<=Re.z)?(be=_e,_e=_e.nextZ,Qe--):(be=Re,Re=Re.nextZ,wt--),Te?Te.nextZ=be:ne=be,be.prevZ=Te,Te=be;_e=Re}Te.nextZ=null,Tt*=2}while(Ke>1)}(X)}(u,p,_,b);for(var E,P,A=u;u.prev!==u.next;)if(E=u.prev,P=u.next,b?_T(u,p,_,b):gT(u))o.push(E.i/h|0),o.push(u.i/h|0),o.push(P.i/h|0),Zp(u),u=P.next,A=P.next;else if((u=P)===A){x?x===1?Wp(u=yT(wc(u),o,h),o,h,p,_,b,2):x===2&&vT(u,o,h,p,_,b):Wp(wc(u),o,h,p,_,b,1);break}}}function gT(u){var o=u.prev,h=u,p=u.next;if(jr(o,h,p)>=0)return!1;for(var _=o.x,b=h.x,x=p.x,E=o.y,P=h.y,A=p.y,N=_b?_>x?_:x:b>x?b:x,H=E>P?E>A?E:A:P>A?P:A,X=p.next;X!==o;){if(X.x>=N&&X.x<=G&&X.y>=O&&X.y<=H&&qh(_,E,b,P,x,A,X.x,X.y)&&jr(X.prev,X,X.next)>=0)return!1;X=X.next}return!0}function _T(u,o,h,p){var _=u.prev,b=u,x=u.next;if(jr(_,b,x)>=0)return!1;for(var E=_.x,P=b.x,A=x.x,N=_.y,O=b.y,G=x.y,H=EP?E>A?E:A:P>A?P:A,ce=N>O?N>G?N:G:O>G?O:G,_e=vy(H,X,o,h,p),Re=vy(ne,ce,o,h,p),be=u.prevZ,Te=u.nextZ;be&&be.z>=_e&&Te&&Te.z<=Re;){if(be.x>=H&&be.x<=ne&&be.y>=X&&be.y<=ce&&be!==_&&be!==x&&qh(E,N,P,O,A,G,be.x,be.y)&&jr(be.prev,be,be.next)>=0||(be=be.prevZ,Te.x>=H&&Te.x<=ne&&Te.y>=X&&Te.y<=ce&&Te!==_&&Te!==x&&qh(E,N,P,O,A,G,Te.x,Te.y)&&jr(Te.prev,Te,Te.next)>=0))return!1;Te=Te.nextZ}for(;be&&be.z>=_e;){if(be.x>=H&&be.x<=ne&&be.y>=X&&be.y<=ce&&be!==_&&be!==x&&qh(E,N,P,O,A,G,be.x,be.y)&&jr(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Te&&Te.z<=Re;){if(Te.x>=H&&Te.x<=ne&&Te.y>=X&&Te.y<=ce&&Te!==_&&Te!==x&&qh(E,N,P,O,A,G,Te.x,Te.y)&&jr(Te.prev,Te,Te.next)>=0)return!1;Te=Te.nextZ}return!0}function yT(u,o,h){var p=u;do{var _=p.prev,b=p.next.next;!Jm(_,b)&&W1(_,p,p.next,b)&&Hp(_,b)&&Hp(b,_)&&(o.push(_.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),Zp(p),Zp(p.next),p=u=b),p=p.next}while(p!==u);return wc(p)}function vT(u,o,h,p,_,b){var x=u;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&ET(x,E)){var P=H1(x,E);return x=wc(x,x.next),P=wc(P,P.next),Wp(x,o,h,p,_,b,0),void Wp(P,o,h,p,_,b,0)}E=E.next}x=x.next}while(x!==u)}function bT(u,o){return u.x-o.x}function xT(u,o){var h=function(_,b){var x,E=b,P=_.x,A=_.y,N=-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<=P&&O>N&&(N=O,x=E.x=E.x&&E.x>=X&&P!==E.x&&qh(Ax.x||E.x===x.x&&wT(x,E)))&&(x=E,ce=G)),E=E.next;while(E!==H);return x}(u,o);if(!h)return o;var p=H1(h,u);return wc(p,p.next),wc(h,h.next)}function wT(u,o){return jr(u.prev,u,o.prev)<0&&jr(o.next,u,u.next)<0}function vy(u,o,h,p,_){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*_|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*_|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function ST(u){var o=u,h=u;do(o.x=(u-x)*(b-E)&&(u-x)*(p-E)>=(h-x)*(o-E)&&(h-x)*(b-E)>=(_-x)*(p-E)}function ET(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&W1(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(u,o)&&(Hp(u,o)&&Hp(o,u)&&function(h,p){var _=h,b=!1,x=(h.x+p.x)/2,E=(h.y+p.y)/2;do _.y>E!=_.next.y>E&&_.next.y!==_.y&&x<(_.next.x-_.x)*(E-_.y)/(_.next.y-_.y)+_.x&&(b=!b),_=_.next;while(_!==h);return b}(u,o)&&(jr(u.prev,u,o.prev)||jr(u,o.prev,o))||Jm(u,o)&&jr(u.prev,u,u.next)>0&&jr(o.prev,o,o.next)>0)}function jr(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function Jm(u,o){return u.x===o.x&&u.y===o.y}function W1(u,o,h,p){var _=$m(jr(u,o,h)),b=$m(jr(u,o,p)),x=$m(jr(h,p,u)),E=$m(jr(h,p,o));return _!==b&&x!==E||!(_!==0||!Qm(u,h,o))||!(b!==0||!Qm(u,p,o))||!(x!==0||!Qm(h,u,p))||!(E!==0||!Qm(h,o,p))}function Qm(u,o,h){return o.x<=Math.max(u.x,h.x)&&o.x>=Math.min(u.x,h.x)&&o.y<=Math.max(u.y,h.y)&&o.y>=Math.min(u.y,h.y)}function $m(u){return u>0?1:u<0?-1:0}function Hp(u,o){return jr(u.prev,u,u.next)<0?jr(u,o,u.next)>=0&&jr(u,u.prev,o)>=0:jr(u,o,u.prev)<0||jr(u,u.next,o)<0}function H1(u,o){var h=new by(u.i,u.x,u.y),p=new by(o.i,o.x,o.y),_=u.next,b=o.prev;return u.next=o,o.prev=u,h.next=_,_.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function Z1(u,o,h,p){var _=new by(u,o,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function Zp(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function by(u,o,h){this.i=u,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 xy(u,o,h,p){for(var _=0,b=o,x=h-p;b0&&h.holes.push(p+=u[_-1].length)}return h};var X1=d(yy.exports);function IT(u,o,h,p,_){Y1(u,o,h||0,p||u.length-1,_||CT)}function Y1(u,o,h,p,_){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,E=Math.log(b),P=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*P*(b-P)/b)*(x-b/2<0?-1:1);Y1(u,o,Math.max(h,Math.floor(o-x*P/b+A)),Math.min(p,Math.floor(o+(b-x)*P/b+A)),_)}var N=u[o],O=h,G=p;for(Xp(u,h,o),_(u[p],N)>0&&Xp(u,h,p);O0;)G--}_(u[h],N)===0?Xp(u,h,G):Xp(u,++G,p),G<=o&&(h=G+1),o<=G&&(p=G-1)}}function Xp(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function CT(u,o){return uo?1:0}function wy(u,o){const h=u.length;if(h<=1)return[u];const p=[];let _,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ue,this.indexArray=new Xe,this.indexArray2=new tt,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new pt,this.segments2=new pt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Sy("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),b=!_.isConstant(),x=[];for(const{feature:E,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=zl(E,O);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),G,p))continue;const H=b?_.evaluate(G,{},p,h.availableImages):void 0,X={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Ol(E),patterns:{},sortKey:H};x.push(X)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:A,sourceLayerIndex:N}=E;if(this.hasPattern){const O=Ey("fill",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.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,mT),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,_,b){for(const x of wy(h,500)){let E=0;for(const H of x)E+=H.length;const P=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=P.vertexLength,N=[],O=[];for(const H of x){if(H.length===0)continue;H!==x[0]&&O.push(N.length/2);const X=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),ne=X.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(ne+H.length-1,ne),N.push(H[0].x),N.push(H[0].y);for(let ce=1;ce>3}if(_--,p===1||p===2)b+=u.readSVarint(),x+=u.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new DT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},Wh.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,_=0,b=0,x=1/0,E=-1/0,P=1/0,A=-1/0;u.pos>3}if(p--,h===1||h===2)(_+=u.readSVarint())E&&(E=_),(b+=u.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,P,E,A]},Wh.prototype.toGeoJSON=function(u,o,h){var p,_,b=this.extent*Math.pow(2,h),x=this.extent*u,E=this.extent*o,P=this.loadGeometry(),A=Wh.types[this.type];function N(H){for(var X=0;X>3;_=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 _}(h))}eb.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var o=this._pbf.readVarint()+this._pbf.pos;return new OT(this._pbf,o,this.extent,this._keys,this._values)};var FT=$1;function BT(u,o,h){if(u===3){var p=new FT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}wu.VectorTile=function(u,o){this.layers=u.readFields(BT,{},o)},wu.VectorTileFeature=Q1,wu.VectorTileLayer=$1;const VT=wu.VectorTileFeature.types,Cy=Math.pow(2,13);function Yp(u,o,h,p,_,b,x,E){u.emplaceBack(o,h,2*Math.floor(p*Cy)+x,_*Cy*2,b*Cy*2,Math.round(E))}class Ty{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 le,this.centroidVertexArray=new F,this.indexArray=new Xe,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new pt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=Sy("fill-extrusion",this.layers,h);for(const{feature:_,id:b,index:x,sourceLayerIndex:E}of o){const P=this.layers[0]._featureFilter.needGeometry,A=zl(_,P);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),A,p))continue;const N={id:b,sourceLayerIndex:E,index:x,geometry:P?A.geometry:Ol(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(Ey("fill-extrusion",this.layers,N,this.zoom,h)):this.addFeature(N,N.geometry,x,p,{}),h.featureIndex.insert(_,N.geometry,x,E,this.index,!0)}}addFeatures(o,h,p){for(const _ of this.features){const{geometry:b}=_;this.addFeature(_,b,_.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,kT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,AT.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,_,b){const x={x:0,y:0,vertexCount:0};for(const E of wy(h,500)){let P=0;for(const X of E)P+=X.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const X of E){if(X.length===0||GT(X))continue;let ne=0;for(let ce=0;ce=1){const Re=X[ce-1];if(!UT(_e,Re)){A.vertexLength+4>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=_e.sub(Re)._perp()._unit(),Te=Re.dist(_e);ne+Te>32768&&(ne=0),Yp(this.layoutVertexArray,_e.x,_e.y,be.x,be.y,0,0,ne),Yp(this.layoutVertexArray,_e.x,_e.y,be.x,be.y,0,1,ne),x.x+=2*_e.x,x.y+=2*_e.y,x.vertexCount+=2,ne+=Te,Yp(this.layoutVertexArray,Re.x,Re.y,be.x,be.y,0,0,ne),Yp(this.layoutVertexArray,Re.x,Re.y,be.x,be.y,0,1,ne),x.x+=2*Re.x,x.y+=2*Re.y,x.vertexCount+=2;const Ke=A.vertexLength;this.indexArray.emplaceBack(Ke,Ke+2,Ke+1),this.indexArray.emplaceBack(Ke+1,Ke+2,Ke+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+P>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),VT[o.type]!=="Polygon")continue;const N=[],O=[],G=A.vertexLength;for(const X of E)if(X.length!==0){X!==E[0]&&O.push(N.length/2);for(let ne=0;neNr)||u.y===o.y&&(u.y<0||u.y>Nr)}function GT(u){return u.every(o=>o.x<0)||u.every(o=>o.x>Nr)||u.every(o=>o.y<0)||u.every(o=>o.y>Nr)}let tb;Et("FillExtrusionBucket",Ty,{omit:["layers","features"]});var jT={get paint(){return tb=tb||new vo({"fill-extrusion-opacity":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new kh(ze["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class qT extends xs{constructor(o){super(o,jT)}createBucket(o){return new Ty(o)}queryRadius(){return Zm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,_,b,x,E,P){const A=Xm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),N=this.paint.get("fill-extrusion-height").evaluate(h,p),O=this.paint.get("fill-extrusion-base").evaluate(h,p),G=function(X,ne,ce,_e){const Re=[];for(const be of X){const Te=[be.x,be.y,0,1];Ym(Te,Te,ne),Re.push(new I(Te[0]/Te[3],Te[1]/Te[3]))}return Re}(A,P),H=function(X,ne,ce,_e){const Re=[],be=[],Te=_e[8]*ne,Ke=_e[9]*ne,Qe=_e[10]*ne,wt=_e[11]*ne,Tt=_e[8]*ce,xt=_e[9]*ce,yt=_e[10]*ce,ct=_e[11]*ce;for(const It of X){const mt=[],st=[];for(const Bt of It){const At=Bt.x,gn=Bt.y,ar=_e[0]*At+_e[4]*gn+_e[12],dr=_e[1]*At+_e[5]*gn+_e[13],hi=_e[2]*At+_e[6]*gn+_e[14],is=_e[3]*At+_e[7]*gn+_e[15],xo=hi+Qe,si=is+wt,ki=ar+Tt,Bi=dr+xt,wo=hi+yt,So=is+ct,fi=new I((ar+Te)/si,(dr+Ke)/si);fi.z=xo/si,mt.push(fi);const pi=new I(ki/So,Bi/So);pi.z=wo/So,st.push(pi)}Re.push(mt),be.push(st)}return[Re,be]}(_,O,N,P);return function(X,ne,ce){let _e=1/0;Bp(ce,ne)&&(_e=nb(ce,ne[0]));for(let Re=0;Reh.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 fe,this.layoutVertexArray2=new te,this.indexArray=new Xe,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new pt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Sy("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),b=!_.isConstant(),x=[];for(const{feature:E,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=zl(E,O);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),G,p))continue;const H=b?_.evaluate(G,{},p):void 0,X={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Ol(E),patterns:{},sortKey:H};x.push(X)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:A,sourceLayerIndex:N}=E;if(this.hasPattern){const O=Ey("line",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.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,XT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,HT),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,_,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),P=x.get("line-cap"),A=x.get("line-miter-limit"),N=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of h)this.addLine(O,o,E,P,A,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,_)}addLine(o,h,p,_,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let _e=0;_e=2&&o[P-1].equals(o[P-2]);)P--;let A=0;for(;A0;if(wt&&_e>A){const ct=G.dist(H);if(ct>2*N){const It=G.sub(G.sub(H)._mult(N/ct)._round());this.updateDistance(H,It),this.addCurrentVertex(It,ne,0,0,O),H=It}}const xt=H&&X;let yt=xt?p:E?"butt":_;if(xt&&yt==="round"&&(Keb&&(yt="bevel"),yt==="bevel"&&(Ke>2&&(yt="flipbevel"),Ke100)Re=ce.mult(-1);else{const ct=Ke*ne.add(ce).mag()/ne.sub(ce).mag();Re._perp()._mult(ct*(Tt?-1:1))}this.addCurrentVertex(G,Re,0,0,O),this.addCurrentVertex(G,Re.mult(-1),0,0,O)}else if(yt==="bevel"||yt==="fakeround"){const ct=-Math.sqrt(Ke*Ke-1),It=Tt?ct:0,mt=Tt?0:ct;if(H&&this.addCurrentVertex(G,ne,It,mt,O),yt==="fakeround"){const st=Math.round(180*Qe/Math.PI/20);for(let Bt=1;Bt2*N){const It=G.add(X.sub(G)._mult(N/ct)._round());this.updateDistance(G,It),this.addCurrentVertex(It,ce,0,0,O),G=It}}}}addCurrentVertex(o,h,p,_,b,x=!1){const E=h.y*_-h.x,P=-h.y-h.x*_;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,E,P,x,!0,-_,b),this.distance>rb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,_,b,x))}addHalfVertex({x:o,y:h},p,_,b,x,E,P){const A=.5*(this.lineClips?this.scaledDistance*(rb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*_)+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 N=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),P.primitiveLength++),x?this.e2=N:this.e1=N}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 ib,ob;Et("LineBucket",Ly,{omit:["layers","patternFeatures"]});var sb={get paint(){return ob=ob||new vo({"line-opacity":new Vt(ze.paint_line["line-opacity"]),"line-color":new Vt(ze.paint_line["line-color"]),"line-translate":new Dt(ze.paint_line["line-translate"]),"line-translate-anchor":new Dt(ze.paint_line["line-translate-anchor"]),"line-width":new Vt(ze.paint_line["line-width"]),"line-gap-width":new Vt(ze.paint_line["line-gap-width"]),"line-offset":new Vt(ze.paint_line["line-offset"]),"line-blur":new Vt(ze.paint_line["line-blur"]),"line-dasharray":new mc(ze.paint_line["line-dasharray"]),"line-pattern":new kh(ze.paint_line["line-pattern"]),"line-gradient":new Lp(ze.paint_line["line-gradient"])})},get layout(){return ib=ib||new vo({"line-cap":new Dt(ze.layout_line["line-cap"]),"line-join":new Vt(ze.layout_line["line-join"]),"line-miter-limit":new Dt(ze.layout_line["line-miter-limit"]),"line-round-limit":new Dt(ze.layout_line["line-round-limit"]),"line-sort-key":new Vt(ze.layout_line["line-sort-key"])})}};class JT extends Vt{possiblyEvaluate(o,h){return h=new fr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,_){return h=pe({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,_)}}let eg;class QT extends xs{constructor(o){super(o,sb),this.gradientVersion=0,eg||(eg=new JT(sb.paint.properties["line-width"].specification),eg.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 ac,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"]=eg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new Ly(o)}queryRadius(o){const h=o,p=ab(Gp("line-width",this,h),Gp("line-gap-width",this,h)),_=Gp("line-offset",this,h);return p/2+Math.abs(_)+Zm(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,_,b,x,E){const P=Xm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*ab(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),N=this.paint.get("line-offset").evaluate(h,p);return N&&(_=function(O,G){const H=[];for(let X=0;X=3){for(let ce=0;ce0?o+2*u:u}const $T=Gr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),eL=Gr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Gr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const tL=Gr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Gr([{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 lb=Gr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nL=Gr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rL(u,o,h){return u.sections.forEach(p=>{p.text=function(_,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?_=_.toLocaleUpperCase():E==="lowercase"&&(_=_.toLocaleLowerCase()),Qa.applyArabicShaping&&(_=Qa.applyArabicShaping(_)),_}(p.text,o,h)}),u}Gr([{name:"triangle",components:3,type:"Uint16"}]),Gr([{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"}]),Gr([{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"}]),Gr([{type:"Float32",name:"offsetX"}]),Gr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Gr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Jp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ci=24,ub=Yn,cb=function(u,o,h,p,_){var b,x,E=8*_-p-1,P=(1<>1,N=-7,O=h?_-1:0,G=h?-1:1,H=u[o+O];for(O+=G,b=H&(1<<-N)-1,H>>=-N,N+=E;N>0;b=256*b+u[o+O],O+=G,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=p;N>0;x=256*x+u[o+O],O+=G,N-=8);if(b===0)b=1-A;else{if(b===P)return x?NaN:1/0*(H?-1:1);x+=Math.pow(2,p),b-=A}return(H?-1:1)*x*Math.pow(2,b-p)},hb=function(u,o,h,p,_,b){var x,E,P,A=8*b-_-1,N=(1<>1,G=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=p?0:b-1,X=p?1:-1,ne=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=N):(x=Math.floor(Math.log(o)/Math.LN2),o*(P=Math.pow(2,-x))<1&&(x--,P*=2),(o+=x+O>=1?G/P:G*Math.pow(2,1-O))*P>=2&&(x++,P/=2),x+O>=N?(E=0,x=N):x+O>=1?(E=(o*P-1)*Math.pow(2,_),x+=O):(E=o*Math.pow(2,O-1)*Math.pow(2,_),x=0));_>=8;u[h+H]=255&E,H+=X,E/=256,_-=8);for(x=x<<_|E,A+=_;A>0;u[h+H]=255&x,H+=X,x/=256,A-=8);u[h+H-X]|=128*ne};function Yn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}Yn.Varint=0,Yn.Fixed64=1,Yn.Bytes=2,Yn.Fixed32=5;var Py=4294967296,fb=1/Py,pb=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Fl(u){return u.type===Yn.Bytes?u.readVarint()+u.pos:u.pos+1}function Hh(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function db(u,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 _=h.pos-1;_>=u;_--)h.buf[_+p]=h.buf[_]}function iL(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function mb(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}Yn.prototype={destroy:function(){this.buf=null},readFields:function(u,o,h){for(h=h||this.length;this.pos>3,b=this.pos;this.type=7&p,u(_,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=tg(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=mb(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=tg(this.buf,this.pos)+tg(this.buf,this.pos+4)*Py;return this.pos+=8,u},readSFixed64:function(){var u=tg(this.buf,this.pos)+mb(this.buf,this.pos+4)*Py;return this.pos+=8,u},readFloat:function(){var u=cb(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=cb(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){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(_,b,x){var E,P,A=x.buf;if(E=(112&(P=A[x.pos++]))>>4,P<128||(E|=(127&(P=A[x.pos++]))<<3,P<128)||(E|=(127&(P=A[x.pos++]))<<10,P<128)||(E|=(127&(P=A[x.pos++]))<<17,P<128)||(E|=(127&(P=A[x.pos++]))<<24,P<128)||(E|=(1&(P=A[x.pos++]))<<31,P<128))return Hh(_,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,o=this.pos;return this.pos=u,u-o>=12&&pb?function(h,p,_){return pb.decode(h.subarray(p,_))}(this.buf,o,u):function(h,p,_){for(var b="",x=p;x<_;){var E,P,A,N=h[x],O=null,G=N>239?4:N>223?3:N>191?2:1;if(x+G>_)break;G===1?N<128&&(O=N):G===2?(192&(E=h[x+1]))==128&&(O=(31&N)<<6|63&E)<=127&&(O=null):G===3?(P=h[x+2],(192&(E=h[x+1]))==128&&(192&P)==128&&((O=(15&N)<<12|(63&E)<<6|63&P)<=2047||O>=55296&&O<=57343)&&(O=null)):G===4&&(P=h[x+2],A=h[x+3],(192&(E=h[x+1]))==128&&(192&P)==128&&(192&A)==128&&((O=(15&N)<<18|(63&E)<<12|(63&P)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,G=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=G}return b}(this.buf,o,u)},readBytes:function(){var u=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,u);return this.pos=u,o},readPackedVarint:function(u,o){if(this.type!==Yn.Bytes)return u.push(this.readVarint(o));var h=Fl(this);for(u=u||[];this.pos127;);else if(o===Yn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Yn.Fixed32)this.pos+=4;else{if(o!==Yn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(u,o){this.writeVarint(u<<3|o)},realloc:function(u){for(var o=this.length||16;o268435455||u<0?function(o,h){var p,_;if(o>=0?(p=o%4294967296|0,_=o/4294967296|0):(_=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,_=_+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)))))}(_,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var o=this.pos;this.pos=function(p,_,b){for(var x,E,P=0;P<_.length;P++){if((x=_.charCodeAt(P))>55295&&x<57344){if(!E){x>56319||P+1===_.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,u,this.pos);var h=this.pos-o;h>=128&&db(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),hb(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),hb(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var o=u.length;this.writeVarint(o),this.realloc(o);for(var h=0;h=128&&db(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,h){this.writeTag(u,Yn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,iL,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,oL,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,lL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,sL,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,aL,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,uL,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,cL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,hL,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,fL,o)},writeBytesField:function(u,o){this.writeTag(u,Yn.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,Yn.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,Yn.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,Yn.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var My=d(ub);const Ay=3;function pL(u,o,h){u===1&&h.readMessage(dL,o)}function dL(u,o,h){if(u===3){const{id:p,bitmap:_,width:b,height:x,left:E,top:P,advance:A}=h.readMessage(mL,{});o.push({id:p,bitmap:new qp({width:b+2*Ay,height:x+2*Ay},_),metrics:{width:b,height:x,left:E,top:P,advance:A}})}}function mL(u,o,h){u===1?o.id=h.readVarint():u===2?o.bitmap=h.readBytes():u===3?o.width=h.readVarint():u===4?o.height=h.readVarint():u===5?o.left=h.readSVarint():u===6?o.top=h.readSVarint():u===7&&(o.advance=h.readVarint())}const gb=Ay;function _b(u){let o=0,h=0;for(const x of u)o+=x.w*x.h,h=Math.max(h,x.w);u.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 _=0,b=0;for(const x of u)for(let E=p.length-1;E>=0;E--){const P=p[E];if(!(x.w>P.w||x.h>P.h)){if(x.x=P.x,x.y=P.y,b=Math.max(b,x.y+x.h),_=Math.max(_,x.x+x.w),x.w===P.w&&x.h===P.h){const A=p.pop();E=0&&p>=o&&rg[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 Xh;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($p.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ng(u,o,h,p,_,b,x,E,P,A,N,O,G,H,X,ne){const ce=Xh.fromFeature(u,_);let _e;O===c.ah.vertical&&ce.verticalizePunctuation();const{processBidirectionalText:Re,processStyledBidirectionalText:be}=Qa;if(Re&&ce.sections.length===1){_e=[];const Qe=Re(ce.toString(),Dy(ce,A,b,o,p,H,X));for(const wt of Qe){const Tt=new Xh;Tt.text=wt,Tt.sections=ce.sections;for(let xt=0;xt0&&Vl>Vo&&(Vo=Vl)}else{const Es=Tt[wn.fontStack],Go=Es&&Es[Vi];if(Go&&Go.rect)Sa=Go.rect,Zs=Go.metrics;else{const Vl=wt[wn.fontStack],id=Vl&&Vl[Vi];if(!id)continue;Zs=id.metrics}mi=(pi-wn.scale)*ci}Xs?(Qe.verticalizable=!0,io.push({glyph:Vi,imageName:Ea,x:ar,y:dr+mi,vertical:Xs,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:oo,metrics:Zs,rect:Sa}),ar+=Bl*wn.scale+Bt):(io.push({glyph:Vi,imageName:Ea,x:ar,y:dr+mi,vertical:Xs,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:oo,metrics:Zs,rect:Sa}),ar+=Zs.advance*wn.scale+Bt)}io.length!==0&&(hi=Math.max(ar-Bt,hi),yL(io,0,io.length-1,xo,Vo)),ar=0;const Uo=ct*pi+Vo;Eo.lineOffset=Math.max(Vo,ro),dr+=Uo,is=Math.max(Uo,is),++si}var ki;const Bi=dr-Qp,{horizontalAlign:wo,verticalAlign:So}=Ry(It);(function(fi,pi,ro,Eo,io,Vo,Uo,di,wn){const oo=(pi-ro)*io;let Vi=0;Vi=Vo!==Uo?-di*Eo-Qp:(-Eo*wn+.5)*Uo;for(const mi of fi)for(const Zs of mi.positionedGlyphs)Zs.x+=oo,Zs.y+=Vi})(Qe.positionedLines,xo,wo,So,hi,is,ct,Bi,yt.length),Qe.top+=-So*Bi,Qe.bottom=Qe.top+Bi,Qe.left+=-wo*hi,Qe.right=Qe.left+hi}(Ke,o,h,p,_e,x,E,P,O,A,G,ne),!function(Qe){for(const wt of Qe)if(wt.positionedGlyphs.length!==0)return!1;return!0}(Te)&&Ke}const rg={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gL={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 vb(u,o,h,p,_,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ci/b+_:0}{const x=h[o.fontStack],E=x&&x[u];return E?E.metrics.advance*o.scale+_:0}}function bb(u,o,h,p){const _=Math.pow(u-o,2);return p?u=0;let N=0;for(let G=0;Gx.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=my([]),this.placementViewportMatrix=my([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Eb(this.zoom,h["text-size"]),this.iconSizeData=Eb(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=Ny(p,"text-overlap","text-allow-overlap")!=="never"||Ny(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-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 zy(new xr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new zy(new xr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new g,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,h,p,_,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!N)return;const G=h.iconDependencies,H=h.glyphDependencies,X=h.availableImages,ne=new fr(this.zoom);for(const{feature:ce,id:_e,index:Re,sourceLayerIndex:be}of o){const Te=_._featureFilter.needGeometry,Ke=zl(ce,Te);if(!_._featureFilter.filter(ne,Ke,p))continue;let Qe,wt;if(Te||(Ke.geometry=Ol(ce)),A){const xt=_.getValueAndResolveTokens("text-field",Ke,p,X),yt=Ro.factory(xt),ct=this.hasRTLText=this.hasRTLText||wL(yt);(!ct||Qa.getRTLTextPluginStatus()==="unavailable"||ct&&Qa.isParsed())&&(Qe=rL(yt,_,Ke))}if(N){const xt=_.getValueAndResolveTokens("icon-image",Ke,p,X);wt=xt instanceof ts?xt:ts.fromString(xt)}if(!Qe&&!wt)continue;const Tt=this.sortFeaturesByKey?O.evaluate(Ke,{},p):void 0;if(this.features.push({id:_e,text:Qe,icon:wt,index:Re,sourceLayerIndex:be,geometry:Ke.geometry,properties:ce.properties,type:bL[ce.type],sortKey:Tt}),wt&&(G[wt.name]=!0),Qe){const xt=x.evaluate(Ke,{},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 ct of Qe.sections)if(ct.image)G[ct.image.name]=!0;else{const It=bu(Qe.toString()),mt=ct.fontStack||xt,st=H[mt]=H[mt]||{};this.calculateGlyphDependencies(ct.text,st,yt,this.allowVerticalPlacement,It)}}}b.get("symbol-placement")==="line"&&(this.features=function(ce){const _e={},Re={},be=[];let Te=0;function Ke(xt){be.push(ce[xt]),Te++}function Qe(xt,yt,ct){const It=Re[xt];return delete Re[xt],Re[yt]=It,be[It].geometry[0].pop(),be[It].geometry[0]=be[It].geometry[0].concat(ct[0]),It}function wt(xt,yt,ct){const It=_e[yt];return delete _e[yt],_e[xt]=It,be[It].geometry[0].shift(),be[It].geometry[0]=ct[0].concat(be[It].geometry[0]),It}function Tt(xt,yt,ct){const It=ct?yt[0][yt[0].length-1]:yt[0][0];return`${xt}:${It.x}:${It.y}`}for(let xt=0;xtxt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ce,_e)=>ce.sortKey-_e.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 _=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),_=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;b<_;b+=4)o.indexArray.emplaceBack(b,b+1,b+2),o.indexArray.emplaceBack(b+1,b+2,b+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),_=[],b=[],x=[];for(let E=0;E_[E]-_[P]||b[P]-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((_,b,x)=>{_>=0&&x.indexOf(_)===b&&this.addIndicesForPlacedSymbol(this.text,_)}),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 Ib,Cb;Et("SymbolBucket",Yh,{omit:["layers","collisionBoxArray","features","compareText"]}),Yh.MAX_GLYPHS=65535,Yh.addDynamicAttributes=Oy;var By={get paint(){return Cb=Cb||new vo({"icon-opacity":new Vt(ze.paint_symbol["icon-opacity"]),"icon-color":new Vt(ze.paint_symbol["icon-color"]),"icon-halo-color":new Vt(ze.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vt(ze.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vt(ze.paint_symbol["icon-halo-blur"]),"icon-translate":new Dt(ze.paint_symbol["icon-translate"]),"icon-translate-anchor":new Dt(ze.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vt(ze.paint_symbol["text-opacity"]),"text-color":new Vt(ze.paint_symbol["text-color"],{runtimeType:Rr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Vt(ze.paint_symbol["text-halo-color"]),"text-halo-width":new Vt(ze.paint_symbol["text-halo-width"]),"text-halo-blur":new Vt(ze.paint_symbol["text-halo-blur"]),"text-translate":new Dt(ze.paint_symbol["text-translate"]),"text-translate-anchor":new Dt(ze.paint_symbol["text-translate-anchor"])})},get layout(){return Ib=Ib||new vo({"symbol-placement":new Dt(ze.layout_symbol["symbol-placement"]),"symbol-spacing":new Dt(ze.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Dt(ze.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vt(ze.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Dt(ze.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Dt(ze.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Dt(ze.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Dt(ze.layout_symbol["icon-ignore-placement"]),"icon-optional":new Dt(ze.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Dt(ze.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vt(ze.layout_symbol["icon-size"]),"icon-text-fit":new Dt(ze.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Dt(ze.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vt(ze.layout_symbol["icon-image"]),"icon-rotate":new Vt(ze.layout_symbol["icon-rotate"]),"icon-padding":new Vt(ze.layout_symbol["icon-padding"]),"icon-keep-upright":new Dt(ze.layout_symbol["icon-keep-upright"]),"icon-offset":new Vt(ze.layout_symbol["icon-offset"]),"icon-anchor":new Vt(ze.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Dt(ze.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Dt(ze.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Dt(ze.layout_symbol["text-rotation-alignment"]),"text-field":new Vt(ze.layout_symbol["text-field"]),"text-font":new Vt(ze.layout_symbol["text-font"]),"text-size":new Vt(ze.layout_symbol["text-size"]),"text-max-width":new Vt(ze.layout_symbol["text-max-width"]),"text-line-height":new Dt(ze.layout_symbol["text-line-height"]),"text-letter-spacing":new Vt(ze.layout_symbol["text-letter-spacing"]),"text-justify":new Vt(ze.layout_symbol["text-justify"]),"text-radial-offset":new Vt(ze.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Dt(ze.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Vt(ze.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Vt(ze.layout_symbol["text-anchor"]),"text-max-angle":new Dt(ze.layout_symbol["text-max-angle"]),"text-writing-mode":new Dt(ze.layout_symbol["text-writing-mode"]),"text-rotate":new Vt(ze.layout_symbol["text-rotate"]),"text-padding":new Dt(ze.layout_symbol["text-padding"]),"text-keep-upright":new Dt(ze.layout_symbol["text-keep-upright"]),"text-transform":new Vt(ze.layout_symbol["text-transform"]),"text-offset":new Vt(ze.layout_symbol["text-offset"]),"text-allow-overlap":new Dt(ze.layout_symbol["text-allow-overlap"]),"text-overlap":new Dt(ze.layout_symbol["text-overlap"]),"text-ignore-placement":new Dt(ze.layout_symbol["text-ignore-placement"]),"text-optional":new Dt(ze.layout_symbol["text-optional"])})}};class Tb{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:ei,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}}Et("FormatSectionOverride",Tb,{omit:["defaultValue"]});class og extends xs{constructor(o){super(o,By)}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 _=[];for(const b of p)_.indexOf(b)<0&&_.push(b);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,_){const b=this.layout.get(o).evaluate(h,{},p,_),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||$n(x.value)||!b?b:function(E,P){return P.replace(/{([^{}]+)}/g,(A,N)=>E&&N in E?String(E[N]):"")}(h.properties,b)}createBucket(o){return new Yh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of By.paint.overridableProperties){if(!og.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new Tb(h),_=new sr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new yh("source",_):new _p("composite",_,h.value.zoomStops),this.paint._values[o]=new bs(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&og.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),_=By.paint.properties[h];let b=!1;const x=E=>{for(const P of E)if(_.overrides&&_.overrides.hasOverride(P))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ro)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Za&&ni(A.value)===Vr?x(A.value.sections):A instanceof gh?x(A.sections):A.eachChild(E))},P=p.value;P._styleExpression&&E(P._styleExpression.expression)}return b}}let Lb;var SL={get paint(){return Lb=Lb||new vo({"background-color":new Dt(ze.paint_background["background-color"]),"background-pattern":new mc(ze.paint_background["background-pattern"]),"background-opacity":new Dt(ze.paint_background["background-opacity"])})}};class EL extends xs{constructor(o){super(o,SL)}}let Pb;var IL={get paint(){return Pb=Pb||new vo({"raster-opacity":new Dt(ze.paint_raster["raster-opacity"]),"raster-hue-rotate":new Dt(ze.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Dt(ze.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Dt(ze.paint_raster["raster-brightness-max"]),"raster-saturation":new Dt(ze.paint_raster["raster-saturation"]),"raster-contrast":new Dt(ze.paint_raster["raster-contrast"]),"raster-resampling":new Dt(ze.paint_raster["raster-resampling"]),"raster-fade-duration":new Dt(ze.paint_raster["raster-fade-duration"])})}};class CL extends xs{constructor(o){super(o,IL)}}class TL extends xs{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 LL{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 Vy=63710088e-1;class Iu{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 Iu(me(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,_=o.lat*h,b=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((o.lng-this.lng)*h);return Vy*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof Iu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Iu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Iu(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 Mb=2*Math.PI*Vy;function Ab(u){return Mb*Math.cos(u*Math.PI/180)}function kb(u){return(180+u)/360}function Db(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function Rb(u,o){return u/Ab(o)}function Uy(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class sg{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=Iu.convert(o);return new sg(kb(p.lng),Db(p.lat),Rb(h,p.lat))}toLngLat(){return new Iu(360*this.x-180,Uy(this.y))}toAltitude(){return this.z*Ab(Uy(this.y))}meterInMercatorCoordinateUnits(){return 1/Mb*(o=Uy(this.y),1/Math.cos(o*Math.PI/180));var o}}function Nb(u,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class Gy{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=td(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 _=(x=this.y,E=this.z,P=Nb(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=Nb(256*(b+1),256*(x+1),E),P[0]+","+P[1]+","+A[0]+","+A[1]);var b,x,E,P,A;const N=function(O,G,H){let X,ne="";for(let ce=O;ce>0;ce--)X=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,_)}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)*Nr,(o.y*h-this.y)*Nr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ob{constructor(o,h){this.wrap=o,this.canonical=h,this.key=td(o,h.z,h.z,h.x,h.y)}}class Ss{constructor(o,h,p,_,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new Gy(p,+_,+b),this.key=td(h,o,p,_,b)}clone(){return new Ss(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 Ss(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(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?td(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):td(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 Ss(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,_=2*this.canonical.y;return[new Ss(h,this.wrap,h,p,_),new Ss(h,this.wrap,h,p+1,_),new Ss(h,this.wrap,h,p,_+1),new Ss(h,this.wrap,h,p+1,_+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 ws({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 _=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(h){case-1:_=b-1;break;case 1:b=_+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const P=-h*this.dim,A=-p*this.dim;for(let N=x;N=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 Bb{constructor(o,h,p,_,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._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 Vb{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new fc(Nr,16,0),this.grid3D=new fc(Nr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,_,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,b);const P=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&P.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new wu.VectorTile(new My(this.rawTileData)).layers,this.sourceLayerCoder=new Fb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,_){this.loadVTLayers();const b=o.params||{},x=Nr/o.tileSize/o.scale,E=wh(b.filter),P=o.queryGeometry,A=o.queryPadding*x,N=Gb(P),O=this.grid.query(N.minX-A,N.minY-A,N.maxX+A,N.maxY+A),G=Gb(o.cameraQueryGeometry),H=this.grid3D.query(G.minX-A,G.minY-A,G.maxX+A,G.maxY+A,(ce,_e,Re,be)=>function(Te,Ke,Qe,wt,Tt){for(const yt of Te)if(Ke<=yt.x&&Qe<=yt.y&&wt>=yt.x&&Tt>=yt.y)return!0;const xt=[new I(Ke,Qe),new I(Ke,Tt),new I(wt,Tt),new I(wt,Qe)];if(Te.length>2){for(const yt of xt)if(Gh(Te,yt))return!0}for(let yt=0;yt(be||(be=Ol(Te)),Ke.queryIntersectsFeature(P,Te,Qe,be,this.z,o.transform,x,o.pixelPosMatrix)))}return X}loadMatchingFeature(o,h,p,_,b,x,E,P,A,N,O){const G=this.bucketLayerIDs[h];if(x&&!function(ce,_e){for(let Re=0;Re=0)return!0;return!1}(x,G))return;const H=this.sourceLayerCoder.decode(p),X=this.vtLayers[H].feature(_);if(b.needGeometry){const ce=zl(X,!0);if(!b.filter(new fr(this.tileID.overscaledZ),ce,this.tileID.canonical))return}else if(!b.filter(new fr(this.tileID.overscaledZ),X))return;const ne=this.getId(X,H);for(let ce=0;ce{const E=o instanceof dc?o.get(x):null;return E&&E.evaluate?E.evaluate(h,p,_):E})}function Gb(u){let o=1/0,h=1/0,p=-1/0,_=-1/0;for(const b of u)o=Math.min(o,b.x),h=Math.min(h,b.y),p=Math.max(p,b.x),_=Math.max(_,b.y);return{minX:o,minY:h,maxX:p,maxY:_}}function PL(u,o){return o-u}function jb(u,o,h,p,_){const b=[];for(let x=0;x=p&&O.x>=p||(N.x>=p?N=new I(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round():O.x>=p&&(O=new I(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round()),N.y>=_&&O.y>=_||(N.y>=_?N=new I(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round():O.y>=_&&(O=new I(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round()),P&&N.equals(P[P.length-1])||(P=[N],b.push(P)),P.push(O)))))}}return b}Et("FeatureIndex",Vb,{omit:["rawTileData","sourceLayerCoder"]});class Cu extends I{constructor(o,h,p,_){super(o,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new Cu(this.x,this.y,this.angle,this.segment)}}function qb(u,o,h,p,_){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-=u[x].dist(b),b=u[x]}E+=u[x].dist(u[x+1]),x++;const P=[];let A=0;for(;Ep;)A-=P.shift().angleDelta;if(A>_)return!1;x++,E+=N.dist(O)}return!0}function Wb(u){let o=0;for(let h=0;hA){const X=(A-P)/H,ne=to.number(O.x,G.x,X),ce=to.number(O.y,G.y,X),_e=new Cu(ne,ce,G.angleTo(O),N);return _e._round(),!x||qb(u,_e,E,x,o)?_e:void 0}P+=H}}function AL(u,o,h,p,_,b,x,E,P){const A=Hb(p,b,x),N=Zb(p,_),O=N*x,G=u[0].x===0||u[0].x===P||u[0].y===0||u[0].y===P;return o-O=0&&Te=0&&Ke=0&&G+A<=N){const Qe=new Cu(Te,Ke,Re,X);Qe._round(),p&&!qb(u,Qe,b,p,_)||H.push(Qe)}}O+=_e}return E||H.length||x||(H=Xb(u,O/2,h,p,_,b,x,!0,P)),H}Et("Anchor",Cu);const Kh=Bo;function Yb(u,o,h,p){const _=[],b=u.image,x=b.pixelRatio,E=b.paddedRect.w-2*Kh,P=b.paddedRect.h-2*Kh,A=u.right-u.left,N=u.bottom-u.top,O=b.stretchX||[[0,E]],G=b.stretchY||[[0,P]],H=(ct,It)=>ct+It[1]-It[0],X=O.reduce(H,0),ne=G.reduce(H,0),ce=E-X,_e=P-ne;let Re=0,be=X,Te=0,Ke=ne,Qe=0,wt=ce,Tt=0,xt=_e;if(b.content&&p){const ct=b.content;Re=ag(O,0,ct[0]),Te=ag(G,0,ct[1]),be=ag(O,ct[0],ct[2]),Ke=ag(G,ct[1],ct[3]),Qe=ct[0]-Re,Tt=ct[1]-Te,wt=ct[2]-ct[0]-be,xt=ct[3]-ct[1]-Ke}const yt=(ct,It,mt,st)=>{const Bt=lg(ct.stretch-Re,be,A,u.left),At=ug(ct.fixed-Qe,wt,ct.stretch,X),gn=lg(It.stretch-Te,Ke,N,u.top),ar=ug(It.fixed-Tt,xt,It.stretch,ne),dr=lg(mt.stretch-Re,be,A,u.left),hi=ug(mt.fixed-Qe,wt,mt.stretch,X),is=lg(st.stretch-Te,Ke,N,u.top),xo=ug(st.fixed-Tt,xt,st.stretch,ne),si=new I(Bt,gn),ki=new I(dr,gn),Bi=new I(dr,is),wo=new I(Bt,is),So=new I(At/x,ar/x),fi=new I(hi/x,xo/x),pi=o*Math.PI/180;if(pi){const io=Math.sin(pi),Vo=Math.cos(pi),Uo=[Vo,-io,io,Vo];si._matMult(Uo),ki._matMult(Uo),wo._matMult(Uo),Bi._matMult(Uo)}const ro=ct.stretch+ct.fixed,Eo=It.stretch+It.fixed;return{tl:si,tr:ki,bl:wo,br:Bi,tex:{x:b.paddedRect.x+Kh+ro,y:b.paddedRect.y+Kh+Eo,w:mt.stretch+mt.fixed-ro,h:st.stretch+st.fixed-Eo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:So,pixelOffsetBR:fi,minFontScaleX:wt/x/A,minFontScaleY:xt/x/N,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ct=Kb(O,ce,X),It=Kb(G,_e,ne);for(let mt=0;mt0&&(X=Math.max(10,X),this.circleDiameter=X)}else{let O=x.top*E-P[0],G=x.bottom*E+P[2],H=x.left*E-P[3],X=x.right*E+P[1];const ne=x.collisionPadding;if(ne&&(H-=ne[0]*E,O-=ne[1]*E,X+=ne[2]*E,G+=ne[3]*E),N){const ce=new I(H,O),_e=new I(X,O),Re=new I(H,G),be=new I(X,G),Te=N*Math.PI/180;ce._rotate(Te),_e._rotate(Te),Re._rotate(Te),be._rotate(Te),H=Math.min(ce.x,_e.x,Re.x,be.x),X=Math.max(ce.x,_e.x,Re.x,be.x),O=Math.min(ce.y,_e.y,Re.y,be.y),G=Math.max(ce.y,_e.y,Re.y,be.y)}o.emplaceBack(h.x,h.y,H,O,X,G,p,_,b)}this.boxEndIndex=o.length}}class kL{constructor(o=[],h=DL){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,_=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(_,x)>=0)break;h[o]=x,o=b}h[o]=_}_down(o){const{data:h,compare:p}=this,_=this.length>>1,b=h[o];for(;o<_;){let x=1+(o<<1),E=h[x];const P=x+1;if(P=0)break;h[o]=E,o=x}h[o]=b}}function DL(u,o){return uo?1:0}function RL(u,o=1,h=!1){let p=1/0,_=1/0,b=-1/0,x=-1/0;const E=u[0];for(let H=0;Hb)&&(b=X.x),(!H||X.y>x)&&(x=X.y)}const P=Math.min(b-p,x-_);let A=P/2;const N=new kL([],NL);if(P===0)return new I(p,_);for(let H=p;HO.d||!O.d)&&(O=H,h&&console.log("found best %d after %d probes",Math.round(1e4*H.d)/1e4,G)),H.max-O.d<=o||(A=H.h/2,N.push(new Jh(H.p.x-A,H.p.y-A,A,u)),N.push(new Jh(H.p.x+A,H.p.y-A,A,u)),N.push(new Jh(H.p.x-A,H.p.y+A,A,u)),N.push(new Jh(H.p.x+A,H.p.y+A,A,u)),G+=4)}return h&&(console.log(`num probes: ${G}`),console.log(`best distance: ${O.d}`)),O.p}function NL(u,o){return o.max-u.max}function Jh(u,o,h,p){this.p=new I(u,o),this.h=h,this.d=function(_,b){let x=!1,E=1/0;for(let P=0;P_.y!=X.y>_.y&&_.x<(X.x-H.x)*(_.y-H.y)/(X.y-H.y)+H.x&&(x=!x),E=Math.min(E,D1(_,H,X))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Fi;c.ap=void 0,(Fi=c.ap||(c.ap={}))[Fi.center=1]="center",Fi[Fi.left=2]="left",Fi[Fi.right=3]="right",Fi[Fi.top=4]="top",Fi[Fi.bottom=5]="bottom",Fi[Fi["top-left"]=6]="top-left",Fi[Fi["top-right"]=7]="top-right",Fi[Fi["bottom-left"]=8]="bottom-left",Fi[Fi["bottom-right"]=9]="bottom-right";const Tu=7,jy=Number.POSITIVE_INFINITY;function Jb(u,o){return o[1]!==jy?function(h,p,_){let b=0,x=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":x=_-Tu;break;case"bottom-right":case"bottom-left":case"bottom":x=-_+Tu}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]}(u,o[0],o[1]):function(h,p){let _=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-Tu;break;case"bottom-right":case"bottom-left":b=-x+Tu;break;case"bottom":b=-p+Tu;break;case"top":b=p-Tu}switch(h){case"top-right":case"bottom-right":_=-x;break;case"top-left":case"bottom-left":_=x;break;case"left":_=p;break;case"right":_=-p}return[_,b]}(u,o[0])}function Qb(u,o,h){var p;const _=u.layout,b=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const E=b.values,P=[];for(let A=0;AG*ci);N.startsWith("top")?O[1]-=Tu:N.startsWith("bottom")&&(O[1]+=Tu),P[A+1]=O}return new es(P)}const x=_.get("text-variable-anchor");if(x){let E;E=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(o,{},h)*ci,jy]:_.get("text-offset").evaluate(o,{},h).map(A=>A*ci);const P=[];for(const A of x)P.push(A,Jb(A,E));return new es(P)}return null}function qy(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function OL(u,o,h,p,_,b,x,E,P,A,N){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const G=u.layers[0].layout,H=G.get("icon-offset").evaluate(o,{},N),X=ex(h.horizontal),ne=x/24,ce=u.tilePixelRatio*ne,_e=u.tilePixelRatio*O/24,Re=u.tilePixelRatio*E,be=u.tilePixelRatio*G.get("symbol-spacing"),Te=G.get("text-padding")*u.tilePixelRatio,Ke=function(st,Bt,At,gn=1){const ar=st.get("icon-padding").evaluate(Bt,{},At),dr=ar&&ar.values;return[dr[0]*gn,dr[1]*gn,dr[2]*gn,dr[3]*gn]}(G,o,N,u.tilePixelRatio),Qe=G.get("text-max-angle")/180*Math.PI,wt=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Tt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",xt=G.get("symbol-placement"),yt=be/2,ct=G.get("icon-text-fit");let It;p&&ct!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(It=Sb(p,h.vertical,ct,G.get("icon-text-fit-padding"),H,ne)),X&&(p=Sb(p,X,ct,G.get("icon-text-fit-padding"),H,ne)));const mt=(st,Bt)=>{Bt.x<0||Bt.x>=Nr||Bt.y<0||Bt.y>=Nr||function(At,gn,ar,dr,hi,is,xo,si,ki,Bi,wo,So,fi,pi,ro,Eo,io,Vo,Uo,di,wn,oo,Vi,mi,Zs){const Sa=At.addToLineVertexArray(gn,ar);let Ea,Bl,Xs,Es,Go=0,Vl=0,id=0,ix=0,Qy=-1,$y=-1;const Ul={};let ox=Lr("");if(At.allowVerticalPlacement&&dr.vertical){const so=si.layout.get("text-rotate").evaluate(wn,{},mi)+90;Xs=new cg(ki,gn,Bi,wo,So,dr.vertical,fi,pi,ro,so),xo&&(Es=new cg(ki,gn,Bi,wo,So,xo,io,Vo,ro,so))}if(hi){const so=si.layout.get("icon-rotate").evaluate(wn,{}),Is=si.layout.get("icon-text-fit")!=="none",Sc=Yb(hi,so,Vi,Is),Ca=xo?Yb(xo,so,Vi,Is):void 0;Bl=new cg(ki,gn,Bi,wo,So,hi,io,Vo,!1,so),Go=4*Sc.length;const Ec=At.iconSizeData;let rl=null;Ec.kind==="source"?(rl=[nl*si.layout.get("icon-size").evaluate(wn,{})],rl[0]>Eu&&He(`${At.layerIds[0]}: Value for "icon-size" is >= ${ed}. Reduce your "icon-size".`)):Ec.kind==="composite"&&(rl=[nl*oo.compositeIconSizes[0].evaluate(wn,{},mi),nl*oo.compositeIconSizes[1].evaluate(wn,{},mi)],(rl[0]>Eu||rl[1]>Eu)&&He(`${At.layerIds[0]}: Value for "icon-size" is >= ${ed}. Reduce your "icon-size".`)),At.addSymbols(At.icon,Sc,rl,di,Uo,wn,c.ah.none,gn,Sa.lineStartIndex,Sa.lineLength,-1,mi),Qy=At.icon.placedSymbolArray.length-1,Ca&&(Vl=4*Ca.length,At.addSymbols(At.icon,Ca,rl,di,Uo,wn,c.ah.vertical,gn,Sa.lineStartIndex,Sa.lineLength,-1,mi),$y=At.icon.placedSymbolArray.length-1)}const sx=Object.keys(dr.horizontal);for(const so of sx){const Is=dr.horizontal[so];if(!Ea){ox=Lr(Is.text);const Ca=si.layout.get("text-rotate").evaluate(wn,{},mi);Ea=new cg(ki,gn,Bi,wo,So,Is,fi,pi,ro,Ca)}const Sc=Is.positionedLines.length===1;if(id+=$b(At,gn,Is,is,si,ro,wn,Eo,Sa,dr.vertical?c.ah.horizontal:c.ah.horizontalOnly,Sc?sx:[so],Ul,Qy,oo,mi),Sc)break}dr.vertical&&(ix+=$b(At,gn,dr.vertical,is,si,ro,wn,Eo,Sa,c.ah.vertical,["vertical"],Ul,$y,oo,mi));const BL=Ea?Ea.boxStartIndex:At.collisionBoxArray.length,VL=Ea?Ea.boxEndIndex:At.collisionBoxArray.length,UL=Xs?Xs.boxStartIndex:At.collisionBoxArray.length,GL=Xs?Xs.boxEndIndex:At.collisionBoxArray.length,jL=Bl?Bl.boxStartIndex:At.collisionBoxArray.length,qL=Bl?Bl.boxEndIndex:At.collisionBoxArray.length,WL=Es?Es.boxStartIndex:At.collisionBoxArray.length,HL=Es?Es.boxEndIndex:At.collisionBoxArray.length;let Ia=-1;const fg=(so,Is)=>so&&so.circleDiameter?Math.max(so.circleDiameter,Is):Is;Ia=fg(Ea,Ia),Ia=fg(Xs,Ia),Ia=fg(Bl,Ia),Ia=fg(Es,Ia);const ax=Ia>-1?1:0;ax&&(Ia*=Zs/ci),At.glyphOffsetArray.length>=Yh.MAX_GLYPHS&&He("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wn.sortKey!==void 0&&At.addToSortKeyRanges(At.symbolInstances.length,wn.sortKey);const ZL=Qb(si,wn,mi),[XL,YL]=function(so,Is){const Sc=so.length,Ca=Is==null?void 0:Is.values;if((Ca==null?void 0:Ca.length)>0)for(let Ec=0;Ec=0?Ul.right:-1,Ul.center>=0?Ul.center:-1,Ul.left>=0?Ul.left:-1,Ul.vertical||-1,Qy,$y,ox,BL,VL,UL,GL,jL,qL,WL,HL,Bi,id,ix,Go,Vl,ax,0,fi,Ia,XL,YL)}(u,Bt,st,h,p,_,It,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ce,[Te,Te,Te,Te],wt,P,Re,Ke,Tt,H,o,b,A,N,x)};if(xt==="line")for(const st of jb(o.geometry,0,0,Nr,Nr)){const Bt=AL(st,be,Qe,h.vertical||X,p,24,_e,u.overscaling,Nr);for(const At of Bt)X&&zL(u,X.text,yt,At)||mt(st,At)}else if(xt==="line-center"){for(const st of o.geometry)if(st.length>1){const Bt=ML(st,Qe,h.vertical||X,p,24,_e);Bt&&mt(st,Bt)}}else if(o.type==="Polygon")for(const st of wy(o.geometry,0)){const Bt=RL(st,16);mt(st[0],new Cu(Bt.x,Bt.y,0))}else if(o.type==="LineString")for(const st of o.geometry)mt(st,new Cu(st[0].x,st[0].y,0));else if(o.type==="Point")for(const st of o.geometry)for(const Bt of st)mt([Bt],new Cu(Bt.x,Bt.y,0))}function $b(u,o,h,p,_,b,x,E,P,A,N,O,G,H,X){const ne=function(Re,be,Te,Ke,Qe,wt,Tt,xt){const yt=Ke.layout.get("text-rotate").evaluate(wt,{})*Math.PI/180,ct=[];for(const It of be.positionedLines)for(const mt of It.positionedGlyphs){if(!mt.rect)continue;const st=mt.rect||{};let Bt=gb+1,At=!0,gn=1,ar=0;const dr=(Qe||xt)&&mt.vertical,hi=mt.metrics.advance*mt.scale/2;if(xt&&be.verticalizable&&(ar=It.lineOffset/2-(mt.imageName?-(ci-mt.metrics.width*mt.scale)/2:(mt.scale-1)*ci)),mt.imageName){const di=Tt[mt.imageName];At=di.sdf,gn=di.pixelRatio,Bt=Bo/gn}const is=Qe?[mt.x+hi,mt.y]:[0,0];let xo=Qe?[0,0]:[mt.x+hi+Te[0],mt.y+Te[1]-ar],si=[0,0];dr&&(si=xo,xo=[0,0]);const ki=mt.metrics.isDoubleResolution?2:1,Bi=(mt.metrics.left-Bt)*mt.scale-hi+xo[0],wo=(-mt.metrics.top-Bt)*mt.scale+xo[1],So=Bi+st.w/ki*mt.scale/gn,fi=wo+st.h/ki*mt.scale/gn,pi=new I(Bi,wo),ro=new I(So,wo),Eo=new I(Bi,fi),io=new I(So,fi);if(dr){const di=new I(-hi,hi-Qp),wn=-Math.PI/2,oo=ci/2-hi,Vi=new I(5-Qp-oo,-(mt.imageName?oo:0)),mi=new I(...si);pi._rotateAround(wn,di)._add(Vi)._add(mi),ro._rotateAround(wn,di)._add(Vi)._add(mi),Eo._rotateAround(wn,di)._add(Vi)._add(mi),io._rotateAround(wn,di)._add(Vi)._add(mi)}if(yt){const di=Math.sin(yt),wn=Math.cos(yt),oo=[wn,-di,di,wn];pi._matMult(oo),ro._matMult(oo),Eo._matMult(oo),io._matMult(oo)}const Vo=new I(0,0),Uo=new I(0,0);ct.push({tl:pi,tr:ro,bl:Eo,br:io,tex:st,writingMode:be.writingMode,glyphOffset:is,sectionIndex:mt.sectionIndex,isSDF:At,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return ct}(0,h,E,_,b,x,p,u.allowVerticalPlacement),ce=u.textSizeData;let _e=null;ce.kind==="source"?(_e=[nl*_.layout.get("text-size").evaluate(x,{})],_e[0]>Eu&&He(`${u.layerIds[0]}: Value for "text-size" is >= ${ed}. Reduce your "text-size".`)):ce.kind==="composite"&&(_e=[nl*H.compositeTextSizes[0].evaluate(x,{},X),nl*H.compositeTextSizes[1].evaluate(x,{},X)],(_e[0]>Eu||_e[1]>Eu)&&He(`${u.layerIds[0]}: Value for "text-size" is >= ${ed}. Reduce your "text-size".`)),u.addSymbols(u.text,ne,_e,E,b,x,A,o,P.lineStartIndex,P.lineLength,G,X);for(const Re of N)O[Re]=u.text.placedSymbolArray.length-1;return 4*ne.length}function ex(u){for(const o in u)return u[o];return null}function zL(u,o,h,p){const _=u.compareText;if(o in _){const b=_[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const b=tx[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 Wy(E,x,b,o)}constructor(o,h=64,p=Float64Array,_){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=tx.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+P,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+P),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+P,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 Hy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,P=[0,b.length-1,0],A=[];for(;P.length;){const N=P.pop()||0,O=P.pop()||0,G=P.pop()||0;if(O-G<=E){for(let ce=G;ce<=O;ce++){const _e=x[2*ce],Re=x[2*ce+1];_e>=o&&_e<=p&&Re>=h&&Re<=_&&A.push(b[ce])}continue}const H=G+O>>1,X=x[2*H],ne=x[2*H+1];X>=o&&X<=p&&ne>=h&&ne<=_&&A.push(b[H]),(N===0?o<=X:h<=ne)&&(P.push(G),P.push(H-1),P.push(1-N)),(N===0?p>=X:_>=ne)&&(P.push(H+1),P.push(O),P.push(1-N))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:b,nodeSize:x}=this,E=[0,_.length-1,0],P=[],A=p*p;for(;E.length;){const N=E.pop()||0,O=E.pop()||0,G=E.pop()||0;if(O-G<=x){for(let ce=G;ce<=O;ce++)rx(b[2*ce],b[2*ce+1],o,h)<=A&&P.push(_[ce]);continue}const H=G+O>>1,X=b[2*H],ne=b[2*H+1];rx(X,ne,o,h)<=A&&P.push(_[H]),(N===0?o-p<=X:h-p<=ne)&&(E.push(G),E.push(H-1),E.push(1-N)),(N===0?o+p>=X:h+p>=ne)&&(E.push(H+1),E.push(O),E.push(1-N))}return P}}function Hy(u,o,h,p,_,b){if(_-p<=h)return;const x=p+_>>1;nx(u,o,x,p,_,b),Hy(u,o,h,p,x-1,1-b),Hy(u,o,h,x+1,_,1-b)}function nx(u,o,h,p,_,b){for(;_>p;){if(_-p>600){const A=_-p+1,N=h-p+1,O=Math.log(A),G=.5*Math.exp(2*O/3),H=.5*Math.sqrt(O*G*(A-G)/A)*(N-A/2<0?-1:1);nx(u,o,h,Math.max(p,Math.floor(h-N*G/A+H)),Math.min(_,Math.floor(h+(A-N)*G/A+H)),b)}const x=o[2*h+b];let E=p,P=_;for(nd(u,o,p,h),o[2*_+b]>x&&nd(u,o,p,_);Ex;)P--}o[2*p+b]===x?nd(u,o,p,P):(P++,nd(u,o,P,_)),P<=h&&(p=P+1),h<=P&&(_=P-1)}}function nd(u,o,h,p){Zy(u,h,p),Zy(o,2*h,2*p),Zy(o,2*h+1,2*p+1)}function Zy(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function rx(u,o,h,p){const _=u-h,b=o-p;return _*_+b*b}var Xy;c.bd=void 0,(Xy=c.bd||(c.bd={})).create="create",Xy.load="load",Xy.fullLoad="fullLoad";let hg=null,rd=[];const Yy=1e3/60,Ky="loadTime",Jy="fullLoadTime",FL={mark(u){performance.mark(u)},frame(u){const o=u;hg!=null&&rd.push(o-hg),hg=o},clearMetrics(){hg=null,rd=[],performance.clearMeasures(Ky),performance.clearMeasures(Jy);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(Ky,c.bd.create,c.bd.load),performance.measure(Jy,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(Ky)[0].duration,o=performance.getEntriesByName(Jy)[0].duration,h=rd.length,p=1/(rd.reduce((b,x)=>b+x,0)/h/1e3),_=rd.filter(b=>b>Yy).reduce((b,x)=>b+(x-Yy)/Yy,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};c.$=pt,c.A=jh,c.B=function(u){if(qe==null){const o=u.navigator?u.navigator.userAgent:null;qe=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return qe},c.C=class{constructor(u,o){this.target=u,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new LL(()=>this.process()),this.subscription=function(h,p,_,b){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Je(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const E={id:_,type:"",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},u),{id:_,sourceMapId:this.mapId,origin:location.origin,data:yu(u.data,b)});this.target.postMessage(x,{transfer:b})})}receive(u){const o=u.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(Je(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 u=this.taskQueue.shift(),o=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(u,o)}processTask(u,o){return l(this,void 0,void 0,function*(){if(o.type===""){const _=this.resolveRejects[u];return delete this.resolveRejects[u],_?void(o.error?_.reject(vu(o.error)):_.resolve(vu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=vu(o.data),p=new AbortController;this.abortControllers[u]=p;try{const _=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,_)}catch(_){this.completeTask(u,_)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const _={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?yu(o):null,data:yu(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Dt,c.E=xn,c.F=function(){var u=new jh(16);return jh!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},c.G=Bn,c.H=function(u,o,h){var p,_,b,x,E,P,A,N,O,G,H,X,ne=h[0],ce=h[1],_e=h[2];return o===u?(u[12]=o[0]*ne+o[4]*ce+o[8]*_e+o[12],u[13]=o[1]*ne+o[5]*ce+o[9]*_e+o[13],u[14]=o[2]*ne+o[6]*ce+o[10]*_e+o[14],u[15]=o[3]*ne+o[7]*ce+o[11]*_e+o[15]):(_=o[1],b=o[2],x=o[3],E=o[4],P=o[5],A=o[6],N=o[7],O=o[8],G=o[9],H=o[10],X=o[11],u[0]=p=o[0],u[1]=_,u[2]=b,u[3]=x,u[4]=E,u[5]=P,u[6]=A,u[7]=N,u[8]=O,u[9]=G,u[10]=H,u[11]=X,u[12]=p*ne+E*ce+O*_e+o[12],u[13]=_*ne+P*ce+G*_e+o[13],u[14]=b*ne+A*ce+H*_e+o[14],u[15]=x*ne+N*ce+X*_e+o[15]),u},c.I=ky,c.J=function(u,o,h){var p=h[0],_=h[1],b=h[2];return u[0]=o[0]*p,u[1]=o[1]*p,u[2]=o[2]*p,u[3]=o[3]*p,u[4]=o[4]*_,u[5]=o[5]*_,u[6]=o[6]*_,u[7]=o[7]*_,u[8]=o[8]*b,u[9]=o[9]*b,u[10]=o[10]*b,u[11]=o[11]*b,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},c.K=z1,c.L=function(u,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 u){const _=window.document.createElement("source");cr(p)||(o.crossOrigin="Anonymous"),_.src=p,o.appendChild(_)}})},c.a3=function(){return Q++},c.a4=y,c.a5=Yh,c.a6=wh,c.a7=zl,c.a8=fr,c.a9=Bb,c.aA=Y,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!fn(u.version,o.version))return[{command:"setStyle",args:[o]}];fn(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),fn(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),fn(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),fn(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),fn(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),fn(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),fn(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),fn(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),fn(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),fn(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},_=[];(function(x,E,P,A){let N;for(N in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,N)&&(Object.prototype.hasOwnProperty.call(E,N)||gs(N,P,A));for(N in E)Object.prototype.hasOwnProperty.call(E,N)&&(Object.prototype.hasOwnProperty.call(x,N)?fn(x[N],E[N])||(x[N].type==="geojson"&&E[N].type==="geojson"&&Ha(x,E,N)?er(P,{command:"setGeoJSONSourceData",args:[N,E[N].data]}):Bs(N,E,P,A)):Do(N,E,P))})(u.sources,o.sources,_,p);const b=[];u.layers&&u.layers.forEach(x=>{"source"in x&&p[x.source]?h.push({command:"removeLayer",args:[x.id]}):b.push(x)}),h=h.concat(_),function(x,E,P){E=E||[];const A=(x=x||[]).map(Cl),N=E.map(Cl),O=x.reduce(_s,{}),G=E.reduce(_s,{}),H=A.slice(),X=Object.create(null);let ne,ce,_e,Re,be;for(let Te=0,Ke=0;Te@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,b)=>{const x=_||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(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=ae,c.ad=function(u,o,h){var p=Math.sin(h),_=Math.cos(h),b=o[0],x=o[1],E=o[2],P=o[3],A=o[4],N=o[5],O=o[6],G=o[7];return o!==u&&(u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[0]=b*_+A*p,u[1]=x*_+N*p,u[2]=E*_+O*p,u[3]=P*_+G*p,u[4]=A*_-b*p,u[5]=N*_-x*p,u[6]=O*_-E*p,u[7]=G*_-P*p,u},c.ae=function(u){var o=new jh(16);return o[0]=u[0],o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=u[6],o[7]=u[7],o[8]=u[8],o[9]=u[9],o[10]=u[10],o[11]=u[11],o[12]=u[12],o[13]=u[13],o[14]=u[14],o[15]=u[15],o},c.af=Ym,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:_,minZoom:b,maxZoom:x}=u,E=_?ae(zi.interpolationFactor(_,o,b,x),0,1):0;u.kind==="camera"?p=to.number(u.minSize,u.maxSize,E):h=E}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:_}){return u.kind==="source"?p/nl:u.kind==="composite"?to.number(p/nl,_/nl,h):o},c.aj=Oy,c.ak=function(u,o,h,p){const _=o.y-u.y,b=o.x-u.x,x=p.y-h.y,E=p.x-h.x,P=x*b-E*_;if(P===0)return null;const A=(E*(u.y-h.y)-x*(u.x-h.x))/P;return new I(u.x+A*b,u.y+A*_)},c.al=jb,c.am=Fp,c.an=my,c.ao=ci,c.aq=Ny,c.ar=function(u,o){var h=o[0],p=o[1],_=o[2],b=o[3],x=o[4],E=o[5],P=o[6],A=o[7],N=o[8],O=o[9],G=o[10],H=o[11],X=o[12],ne=o[13],ce=o[14],_e=o[15],Re=h*E-p*x,be=h*P-_*x,Te=h*A-b*x,Ke=p*P-_*E,Qe=p*A-b*E,wt=_*A-b*P,Tt=N*ne-O*X,xt=N*ce-G*X,yt=N*_e-H*X,ct=O*ce-G*ne,It=O*_e-H*ne,mt=G*_e-H*ce,st=Re*mt-be*It+Te*ct+Ke*yt-Qe*xt+wt*Tt;return st?(u[0]=(E*mt-P*It+A*ct)*(st=1/st),u[1]=(_*It-p*mt-b*ct)*st,u[2]=(ne*wt-ce*Qe+_e*Ke)*st,u[3]=(G*Qe-O*wt-H*Ke)*st,u[4]=(P*yt-x*mt-A*xt)*st,u[5]=(h*mt-_*yt+b*xt)*st,u[6]=(ce*Te-X*wt-_e*be)*st,u[7]=(N*wt-G*Te+H*be)*st,u[8]=(x*It-E*yt+A*Tt)*st,u[9]=(p*yt-h*It-b*Tt)*st,u[10]=(X*Qe-ne*Te+_e*Re)*st,u[11]=(O*Te-N*Qe-H*Re)*st,u[12]=(E*xt-x*ct-P*Tt)*st,u[13]=(h*ct-p*xt+_*Tt)*st,u[14]=(ne*be-X*Ke-ce*Re)*st,u[15]=(N*Ke-O*be+G*Re)*st,u):null},c.as=qy,c.at=Ry,c.au=Wy,c.av=function(){const u={},o=ze.$version;for(const h in ze.$root){const p=ze.$root[h];if(p.required){let _=null;_=h==="version"?o:p.type==="array"?[]:{},_!=null&&(u[h]=_)}}return u},c.aw=Nm,c.ax=$r,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hst*ci)}let xt=x?"center":h.get("text-justify").evaluate(A,{},u.canonical);const yt=h.get("symbol-placement"),ct=yt==="point"?h.get("text-max-width").evaluate(A,{},u.canonical)*ci:0,It=()=>{u.bucket.allowVerticalPlacement&&bu(Te)&&(X.vertical=ng(ne,u.glyphMap,u.glyphPositions,u.imagePositions,N,ct,b,wt,"left",Qe,_e,c.ah.vertical,!0,yt,G,O))};if(!x&&Tt){const mt=new Set;if(xt==="auto")for(let Bt=0;Btl(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(u)],{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=u=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Pt})},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 _=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(_):Pt}),c.g=mn,c.h=(u,o)=>_r(pe(u,{type:"json"}),o),c.i=Je,c.j=_t,c.k=Ce,c.l=(u,o)=>_r(pe(u,{type:"arrayBuffer"}),o),c.m=_r,c.n=function(u){return new My(u).readFields(pL,[])},c.o=qp,c.p=_b,c.q=vo,c.r=hy,c.s=cr,c.t=_u,c.u=bt,c.v=ze,c.w=He,c.x=Dl,c.y=function([u,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(h),y:u*Math.sin(o)*Math.sin(h),z:u*Math.cos(h)}},c.z=to}),i("worker",["./shared"],function(c){class l{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,W){for(const se of V){this._layerConfigs[se.id]=se;const Ee=this._layers[se.id]=c.az(se);Ee._featureFilter=c.a6(Ee.filter),this.keyCache[se.id]&&delete this.keyCache[se.id]}for(const se of W)delete this.keyCache[se],delete this._layerConfigs[se],delete this._layers[se];this.familiesBySource={};const K=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const se of K){const Ee=se.map(Ze=>this._layers[Ze.id]),J=Ee[0];if(J.visibility==="none")continue;const Ie=J.source||"";let ye=this.familiesBySource[Ie];ye||(ye=this.familiesBySource[Ie]={});const De=J.sourceLayer||"_geojsonTileLayer";let Ge=ye[De];Ge||(Ge=ye[De]=[]),Ge.push(Ee)}}}class d{constructor(V){const W={},K=[];for(const Ie in V){const ye=V[Ie],De=W[Ie]={};for(const Ge in ye){const Ze=ye[+Ge];if(!Ze||Ze.bitmap.width===0||Ze.bitmap.height===0)continue;const Ye={x:0,y:0,w:Ze.bitmap.width+2,h:Ze.bitmap.height+2};K.push(Ye),De[Ge]={rect:Ye,metrics:Ze.metrics}}}const{w:se,h:Ee}=c.p(K),J=new c.o({width:se||1,height:Ee||1});for(const Ie in V){const ye=V[Ie];for(const De in ye){const Ge=ye[+De];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const Ze=W[Ie][De].rect;c.o.copy(Ge.bitmap,J,{x:0,y:0},{x:Ze.x+1,y:Ze.y+1},Ge.bitmap)}}this.image=J,this.positions=W}}c.bi("GlyphAtlas",d);class w{constructor(V){this.tileID=new c.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,W,K,se){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new c.a4;const Ee=new c.bj(Object.keys(V.layers).sort()),J=new c.bk(this.tileID,this.promoteId);J.bucketLayerIDs=[];const Ie={},ye={featureIndex:J,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},De=W.familiesBySource[this.source];for(const cn in De){const Ir=V.layers[cn];if(!Ir)continue;Ir.version===1&&c.w(`Vector tile source "${this.source}" layer "${cn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ai=Ee.encode(cn),eo=[];for(let go=0;go=xi.maxzoom||xi.visibility!=="none"&&(S(go,this.zoom,K),(Ie[xi.id]=xi.createBucket({index:J.bucketLayerIDs.length,layers:go,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(eo,ye,this.tileID.canonical),J.bucketLayerIDs.push(go.map(Vs=>Vs.id)))}}const Ge=c.aE(ye.glyphDependencies,cn=>Object.keys(cn).map(Number));this.inFlightDependencies.forEach(cn=>cn==null?void 0:cn.abort()),this.inFlightDependencies=[];let Ze=Promise.resolve({});if(Object.keys(Ge).length){const cn=new AbortController;this.inFlightDependencies.push(cn),Ze=se.sendAsync({type:"GG",data:{stacks:Ge,source:this.source,tileID:this.tileID,type:"glyphs"}},cn)}const Ye=Object.keys(ye.iconDependencies);let Mt=Promise.resolve({});if(Ye.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Mt=se.sendAsync({type:"GI",data:{icons:Ye,source:this.source,tileID:this.tileID,type:"icons"}},cn)}const Rt=Object.keys(ye.patternDependencies);let Yt=Promise.resolve({});if(Rt.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Yt=se.sendAsync({type:"GI",data:{icons:Rt,source:this.source,tileID:this.tileID,type:"patterns"}},cn)}const[Qt,En,Xn]=yield Promise.all([Ze,Mt,Yt]),hr=new d(Qt),ti=new c.bl(En,Xn);for(const cn in Ie){const Ir=Ie[cn];Ir instanceof c.a5?(S(Ir.layers,this.zoom,K),c.bm({bucket:Ir,glyphMap:Qt,glyphPositions:hr.positions,imageMap:En,imagePositions:ti.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ir.hasPattern&&(Ir instanceof c.bn||Ir instanceof c.bo||Ir instanceof c.bp)&&(S(Ir.layers,this.zoom,K),Ir.addFeatures(ye,this.tileID.canonical,ti.patternPositions))}return this.status="done",{buckets:Object.values(Ie).filter(cn=>!cn.isEmpty()),featureIndex:J,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:hr.image,imageAtlas:ti,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?En:null,glyphPositions:this.returnDependencies?hr.positions:null}})}}function S(he,V,W){const K=new c.a8(V);for(const se of he)se.recalculate(K,W)}class I{constructor(V,W,K){this.actor=V,this.layerIndex=W,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,W){return c._(this,void 0,void 0,function*(){const K=yield c.l(V.request,W);try{return{vectorTile:new c.bq.VectorTile(new c.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(se){const Ee=new Uint8Array(K.data);let J=`Unable to parse the tile at ${V.request.url}, `;throw J+=Ee[0]===31&&Ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${se.messge}`,new Error(J)}})}loadTile(V){return c._(this,void 0,void 0,function*(){const W=V.uid,K=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request),se=new w(V);this.loading[W]=se;const Ee=new AbortController;se.abort=Ee;try{const J=yield this.loadVectorTile(V,Ee);if(delete this.loading[W],!J)return null;const Ie=J.rawData,ye={};J.expires&&(ye.expires=J.expires),J.cacheControl&&(ye.cacheControl=J.cacheControl);const De={};if(K){const Ze=K.finish();Ze&&(De.resourceTiming=JSON.parse(JSON.stringify(Ze)))}se.vectorTile=J.vectorTile;const Ge=se.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=se,this.fetching[W]={rawTileData:Ie,cacheControl:ye,resourceTiming:De};try{const Ze=yield Ge;return c.e({rawTileData:Ie.slice(0)},Ze,ye,De)}finally{delete this.fetching[W]}}catch(J){throw delete this.loading[W],se.status="done",this.loaded[W]=se,J}})}reloadTile(V){return c._(this,void 0,void 0,function*(){const W=V.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[W];if(K.showCollisionBoxes=V.showCollisionBoxes,K.status==="parsing"){const se=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let Ee;if(this.fetching[W]){const{rawTileData:J,cacheControl:Ie,resourceTiming:ye}=this.fetching[W];delete this.fetching[W],Ee=c.e({rawTileData:J.slice(0)},se,Ie,ye)}else Ee=se;return Ee}if(K.status==="done"&&K.vectorTile)return K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return c._(this,void 0,void 0,function*(){const W=this.loading,K=V.uid;W&&W[K]&&W[K].abort&&(W[K].abort.abort(),delete W[K])})}removeTile(V){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class T{constructor(){this.loaded={}}loadTile(V){return c._(this,void 0,void 0,function*(){const{uid:W,encoding:K,rawImageData:se,redFactor:Ee,greenFactor:J,blueFactor:Ie,baseShift:ye}=V,De=se.width+2,Ge=se.height+2,Ze=c.b(se)?new c.R({width:De,height:Ge},yield c.bt(se,-1,-1,De,Ge)):se,Ye=new c.bu(W,Ze,K,Ee,J,Ie,ye);return this.loaded=this.loaded||{},this.loaded[W]=Ye,Ye})}removeTile(V){const W=this.loaded,K=V.uid;W&&W[K]&&delete W[K]}}function k(he,V){if(he.length!==0){D(he[0],V);for(var W=1;W=Math.abs(Ie)?W-ye+Ie:Ie-ye+W,W=ye}W+K>=0!=!!V&&he.reverse()}var U=c.bv(function he(V,W){var K,se=V&&V.type;if(se==="FeatureCollection")for(K=0;K>31}function Ne(he,V){for(var W=he.loadGeometry(),K=he.type,se=0,Ee=0,J=W.length,Ie=0;Iehe},Pt=Math.fround||(Zt=new Float32Array(1),he=>(Zt[0]=+he,Zt[0]));var Zt;const Xt=3,kt=5,un=6;class Fn{constructor(V){this.options=Object.assign(Object.create(zt),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:W,minZoom:K,maxZoom:se}=this.options;W&&console.time("total time");const Ee=`prepare ${V.length} points`;W&&console.time(Ee),this.points=V;const J=[];for(let ye=0;ye=K;ye--){const De=+Date.now();Ie=this.trees[ye]=this._createTree(this._cluster(Ie,ye)),W&&console.log("z%d: %d clusters in %dms",ye,Ie.numItems,+Date.now()-De)}return W&&console.timeEnd("total time"),this}getClusters(V,W){let K=((V[0]+180)%360+360)%360-180;const se=Math.max(-90,Math.min(90,V[1]));let Ee=V[2]===180?180:((V[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)K=-180,Ee=180;else if(K>Ee){const Ze=this.getClusters([K,se,180,J],W),Ye=this.getClusters([-180,se,Ee,J],W);return Ze.concat(Ye)}const Ie=this.trees[this._limitZoom(W)],ye=Ie.range(Bn(K),ir(J),Bn(Ee),ir(se)),De=Ie.data,Ge=[];for(const Ze of ye){const Ye=this.stride*Ze;Ge.push(De[Ye+kt]>1?bn(De,Ye,this.clusterProps):this.points[De[Ye+Xt]])}return Ge}getChildren(V){const W=this._getOriginId(V),K=this._getOriginZoom(V),se="No cluster with the specified id.",Ee=this.trees[K];if(!Ee)throw new Error(se);const J=Ee.data;if(W*this.stride>=J.length)throw new Error(se);const Ie=this.options.radius/(this.options.extent*Math.pow(2,K-1)),ye=Ee.within(J[W*this.stride],J[W*this.stride+1],Ie),De=[];for(const Ge of ye){const Ze=Ge*this.stride;J[Ze+4]===V&&De.push(J[Ze+kt]>1?bn(J,Ze,this.clusterProps):this.points[J[Ze+Xt]])}if(De.length===0)throw new Error(se);return De}getLeaves(V,W,K){const se=[];return this._appendLeaves(se,V,W=W||10,K=K||0,0),se}getTile(V,W,K){const se=this.trees[this._limitZoom(V)],Ee=Math.pow(2,V),{extent:J,radius:Ie}=this.options,ye=Ie/J,De=(K-ye)/Ee,Ge=(K+1+ye)/Ee,Ze={features:[]};return this._addTileFeatures(se.range((W-ye)/Ee,De,(W+1+ye)/Ee,Ge),se.data,W,K,Ee,Ze),W===0&&this._addTileFeatures(se.range(1-ye/Ee,De,1,Ge),se.data,Ee,K,Ee,Ze),W===Ee-1&&this._addTileFeatures(se.range(0,De,ye/Ee,Ge),se.data,-1,K,Ee,Ze),Ze.features.length?Ze:null}getClusterExpansionZoom(V){let W=this._getOriginZoom(V)-1;for(;W<=this.options.maxZoom;){const K=this.getChildren(V);if(W++,K.length!==1)break;V=K[0].properties.cluster_id}return W}_appendLeaves(V,W,K,se,Ee){const J=this.getChildren(W);for(const Ie of J){const ye=Ie.properties;if(ye&&ye.cluster?Ee+ye.point_count<=se?Ee+=ye.point_count:Ee=this._appendLeaves(V,ye.cluster_id,K,se,Ee):Ee1;let Ge,Ze,Ye;if(De)Ge=mn(W,ye,this.clusterProps),Ze=W[ye],Ye=W[ye+1];else{const Yt=this.points[W[ye+Xt]];Ge=Yt.properties;const[Qt,En]=Yt.geometry.coordinates;Ze=Bn(Qt),Ye=ir(En)}const Mt={type:1,geometry:[[Math.round(this.options.extent*(Ze*Ee-K)),Math.round(this.options.extent*(Ye*Ee-se))]],tags:Ge};let Rt;Rt=De||this.options.generateId?W[ye+Xt]:this.points[W[ye+Xt]].id,Rt!==void 0&&(Mt.id=Rt),J.features.push(Mt)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,W){const{radius:K,extent:se,reduce:Ee,minPoints:J}=this.options,Ie=K/(se*Math.pow(2,W)),ye=V.data,De=[],Ge=this.stride;for(let Ze=0;ZeW&&(Qt+=ye[Xn+kt])}if(Qt>Yt&&Qt>=J){let En,Xn=Ye*Yt,hr=Mt*Yt,ti=-1;const cn=((Ze/Ge|0)<<5)+(W+1)+this.points.length;for(const Ir of Rt){const ai=Ir*Ge;if(ye[ai+2]<=W)continue;ye[ai+2]=W;const eo=ye[ai+kt];Xn+=ye[ai]*eo,hr+=ye[ai+1]*eo,ye[ai+4]=cn,Ee&&(En||(En=this._map(ye,Ze,!0),ti=this.clusterProps.length,this.clusterProps.push(En)),Ee(En,this._map(ye,ai)))}ye[Ze+4]=cn,De.push(Xn/Qt,hr/Qt,1/0,cn,-1,Qt),Ee&&De.push(ti)}else{for(let En=0;En1)for(const En of Rt){const Xn=En*Ge;if(!(ye[Xn+2]<=W)){ye[Xn+2]=W;for(let hr=0;hr>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,W,K){if(V[W+kt]>1){const J=this.clusterProps[V[W+un]];return K?Object.assign({},J):J}const se=this.points[V[W+Xt]].properties,Ee=this.options.map(se);return K&&Ee===se?Object.assign({},Ee):Ee}}function bn(he,V,W){return{type:"Feature",id:he[V+Xt],properties:mn(he,V,W),geometry:{type:"Point",coordinates:[(K=he[V],360*(K-.5)),$r(he[V+1])]}};var K}function mn(he,V,W){const K=he[V+kt],se=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,Ee=he[V+un],J=Ee===-1?{}:Object.assign({},W[Ee]);return Object.assign(J,{cluster:!0,cluster_id:he[V+Xt],point_count:K,point_count_abbreviated:se})}function Bn(he){return he/360+.5}function ir(he){const V=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return W<0?0:W>1?1:W}function $r(he){const V=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function _r(he,V,W,K){for(var se,Ee=K,J=W-V>>1,Ie=W-V,ye=he[V],De=he[V+1],Ge=he[W],Ze=he[W+1],Ye=V+3;YeEe)se=Ye,Ee=Mt;else if(Mt===Ee){var Rt=Math.abs(Ye-J);RtK&&(se-V>3&&_r(he,V,se,K),he[se+2]=Ee,W-se>3&&_r(he,se,W,K))}function cr(he,V,W,K,se,Ee){var J=se-W,Ie=Ee-K;if(J!==0||Ie!==0){var ye=((he-W)*J+(V-K)*Ie)/(J*J+Ie*Ie);ye>1?(W=se,K=Ee):ye>0&&(W+=J*ye,K+=Ie*ye)}return(J=he-W)*J+(Ie=V-K)*Ie}function or(he,V,W,K){var se={id:he===void 0?null:he,type:V,geometry:W,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ee){var J=Ee.geometry,Ie=Ee.type;if(Ie==="Point"||Ie==="MultiPoint"||Ie==="LineString")re(Ee,J);else if(Ie==="Polygon"||Ie==="MultiLineString")for(var ye=0;ye0&&(J+=K?(se*De-ye*Ee)/2:Math.sqrt(Math.pow(ye-se,2)+Math.pow(De-Ee,2))),se=ye,Ee=De}var Ge=V.length-3;V[2]=1,_r(V,0,Ge,W),V[Ge+2]=1,V.size=Math.abs(J),V.start=0,V.end=V.size}function ze(he,V,W,K){for(var se=0;se1?1:W}function fn(he,V,W,K,se,Ee,J,Ie){if(K/=V,Ee>=(W/=V)&&J=K)return null;for(var ye=[],De=0;De=W&&Rt=K)){var Yt=[];if(Ye==="Point"||Ye==="MultiPoint")er(Ze,Yt,W,K,se);else if(Ye==="LineString")Do(Ze,Yt,W,K,se,!1,Ie.lineMetrics);else if(Ye==="MultiLineString")Bs(Ze,Yt,W,K,se,!1);else if(Ye==="Polygon")Bs(Ze,Yt,W,K,se,!0);else if(Ye==="MultiPolygon")for(var Qt=0;Qt=W&&J<=K&&(V.push(he[Ee]),V.push(he[Ee+1]),V.push(he[Ee+2]))}}function Do(he,V,W,K,se,Ee,J){for(var Ie,ye,De=gs(he),Ge=se===0?Ai:Cl,Ze=he.start,Ye=0;YeW&&(ye=Ge(De,Mt,Rt,Qt,En,W),J&&(De.start=Ze+Ie*ye)):Xn>K?hr=W&&(ye=Ge(De,Mt,Rt,Qt,En,W),ti=!0),hr>K&&Xn<=K&&(ye=Ge(De,Mt,Rt,Qt,En,K),ti=!0),!Ee&&ti&&(J&&(De.end=Ze+Ie*ye),V.push(De),De=gs(he)),J&&(Ze+=Ie)}var cn=he.length-3;Mt=he[cn],Rt=he[cn+1],Yt=he[cn+2],(Xn=se===0?Mt:Rt)>=W&&Xn<=K&&Ha(De,Mt,Rt,Yt),cn=De.length-3,Ee&&cn>=3&&(De[cn]!==De[0]||De[cn+1]!==De[1])&&Ha(De,De[0],De[1],De[2]),De.length&&V.push(De)}function gs(he){var V=[];return V.size=he.size,V.start=he.start,V.end=he.end,V}function Bs(he,V,W,K,se,Ee){for(var J=0;JJ.maxX&&(J.maxX=Ge),Ze>J.maxY&&(J.maxY=Ze)}return J}function ei(he,V,W,K){var se=V.geometry,Ee=V.type,J=[];if(Ee==="Point"||Ee==="MultiPoint")for(var Ie=0;Ie0&&V.size<(se?J:K))W.numPoints+=V.length/3;else{for(var Ie=[],ye=0;yeJ)&&(W.numSimplified++,Ie.push(V[ye]),Ie.push(V[ye+1])),W.numPoints++;se&&function(De,Ge){for(var Ze=0,Ye=0,Mt=De.length,Rt=Mt-2;Ye0===Ge)for(Ye=0,Mt=De.length;Ye24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var K=function(se,Ee){var J=[];if(se.type==="FeatureCollection")for(var Ie=0;Ie1&&console.time("creation"),Ye=this.tiles[Ze]=Tl(he,V,W,K,ye),this.tileCoords.push({z:V,x:W,y:K}),De)){De>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,W,K,Ye.numFeatures,Ye.numPoints,Ye.numSimplified),console.timeEnd("creation"));var Mt="z"+V;this.stats[Mt]=(this.stats[Mt]||0)+1,this.total++}if(Ye.source=he,se){if(V===ye.maxZoom||V===se)continue;var Rt=1<1&&console.time("clipping");var Yt,Qt,En,Xn,hr,ti,cn=.5*ye.buffer/ye.extent,Ir=.5-cn,ai=.5+cn,eo=1+cn;Yt=Qt=En=Xn=null,hr=fn(he,Ge,W-cn,W+ai,0,Ye.minX,Ye.maxX,ye),ti=fn(he,Ge,W+Ir,W+eo,0,Ye.minX,Ye.maxX,ye),he=null,hr&&(Yt=fn(hr,Ge,K-cn,K+ai,1,Ye.minY,Ye.maxY,ye),Qt=fn(hr,Ge,K+Ir,K+eo,1,Ye.minY,Ye.maxY,ye),hr=null),ti&&(En=fn(ti,Ge,K-cn,K+ai,1,Ye.minY,Ye.maxY,ye),Xn=fn(ti,Ge,K+Ir,K+eo,1,Ye.minY,Ye.maxY,ye),ti=null),De>1&&console.timeEnd("clipping"),Ie.push(Yt||[],V+1,2*W,2*K),Ie.push(Qt||[],V+1,2*W,2*K+1),Ie.push(En||[],V+1,2*W+1,2*K),Ie.push(Xn||[],V+1,2*W+1,2*K+1)}}},on.prototype.getTile=function(he,V,W){var K=this.options,se=K.extent,Ee=K.debug;if(he<0||he>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",he,V,W);for(var ye,De=he,Ge=V,Ze=W;!ye&&De>0;)De--,Ge=Math.floor(Ge/2),Ze=Math.floor(Ze/2),ye=this.tiles[nn(De,Ge,Ze)];return ye&&ye.source?(Ee>1&&console.log("found parent tile z%d-%d-%d",De,Ge,Ze),Ee>1&&console.time("drilling down"),this.splitTile(ye.source,De,Ge,Ze,he,V,W),Ee>1&&console.timeEnd("drilling down"),this.tiles[Ie]?Qo(this.tiles[Ie],se):null):null};class ba extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,W){return c._(this,void 0,void 0,function*(){const K=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const se=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!se)return null;const Ee=new class{constructor(Ie){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=Ie.length,this._features=Ie}feature(Ie){return new class{constructor(ye){this._feature=ye,this.extent=c.W,this.type=ye.type,this.properties=ye.tags,"id"in ye&&!isNaN(ye.id)&&(this.id=parseInt(ye.id,10))}loadGeometry(){if(this._feature.type===1){const ye=[];for(const De of this._feature.geometry)ye.push([new c.P(De[0],De[1])]);return ye}{const ye=[];for(const De of this._feature.geometry){const Ge=[];for(const Ze of De)Ge.push(new c.P(Ze[0],Ze[1]));ye.push(Ge)}return ye}}toGeoJSON(ye,De,Ge){return q.call(this,ye,De,Ge)}}(this._features[Ie])}}(se.features);let J=qe(Ee);return J.byteOffset===0&&J.byteLength===J.buffer.byteLength||(J=new Uint8Array(J)),{vectorTile:Ee,rawData:J.buffer}})}loadData(V){return c._(this,void 0,void 0,function*(){var W;(W=this._pendingRequest)===null||W===void 0||W.abort();const K=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request);this._pendingRequest=new AbortController;try{let se=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof se!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(U(se,!0),V.filter){const J=c.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));se={type:"FeatureCollection",features:se.features.filter(ye=>J.value.evaluate({zoom:0},ye))}}this._geoJSONIndex=V.cluster?new Fn(function({superclusterOptions:J,clusterProperties:Ie}){if(!Ie||!J)return J;const ye={},De={},Ge={accumulated:null,zoom:0},Ze={properties:null},Ye=Object.keys(Ie);for(const Mt of Ye){const[Rt,Yt]=Ie[Mt],Qt=c.by(Yt),En=c.by(typeof Rt=="string"?[Rt,["accumulated"],["get",Mt]]:Rt);ye[Mt]=Qt.value,De[Mt]=En.value}return J.map=Mt=>{Ze.properties=Mt;const Rt={};for(const Yt of Ye)Rt[Yt]=ye[Yt].evaluate(Ge,Ze);return Rt},J.reduce=(Mt,Rt)=>{Ze.properties=Rt;for(const Yt of Ye)Ge.accumulated=Mt[Yt],Mt[Yt]=De[Yt].evaluate(Ge,Ze)},J}(V)).load(se.features):function(J,Ie){return new on(J,Ie)}(se,V.geojsonVtOptions),this.loaded={};const Ee={};if(K){const J=K.finish();J&&(Ee.resourceTiming={},Ee.resourceTiming[V.source]=JSON.parse(JSON.stringify(J)))}return Ee}catch(se){if(delete this._pendingRequest,c.bz(se))return{abandoned:!0};throw se}})}reloadTile(V){const W=this.loaded;return W&&W[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,W){return c._(this,void 0,void 0,function*(){const{promoteId:K}=V;if(V.request){const se=yield c.h(V.request,W);return this._dataUpdateable=$o(se.data,K)?tn(se.data,K):void 0,se.data}if(typeof V.data=="string")try{const se=JSON.parse(V.data);return this._dataUpdateable=$o(se,K)?tn(se,K):void 0,se}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(se,Ee,J){var Ie,ye,De,Ge;if(Ee.removeAll&&se.clear(),Ee.remove)for(const Ze of Ee.remove)se.delete(Ze);if(Ee.add)for(const Ze of Ee.add){const Ye=Rr(Ze,J);Ye!=null&&se.set(Ye,Ze)}if(Ee.update)for(const Ze of Ee.update){let Ye=se.get(Ze.id);if(Ye==null)continue;const Mt=!Ze.removeAllProperties&&(((Ie=Ze.removeProperties)===null||Ie===void 0?void 0:Ie.length)>0||((ye=Ze.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0);if((Ze.newGeometry||Ze.removeAllProperties||Mt)&&(Ye=Object.assign({},Ye),se.set(Ze.id,Ye),Mt&&(Ye.properties=Object.assign({},Ye.properties))),Ze.newGeometry&&(Ye.geometry=Ze.newGeometry),Ze.removeAllProperties)Ye.properties={};else if(((De=Ze.removeProperties)===null||De===void 0?void 0:De.length)>0)for(const Rt of Ze.removeProperties)Object.prototype.hasOwnProperty.call(Ye.properties,Rt)&&delete Ye.properties[Rt];if(((Ge=Ze.addOrUpdateProperties)===null||Ge===void 0?void 0:Ge.length)>0)for(const{key:Rt,value:Yt}of Ze.addOrUpdateProperties)Ye.properties[Rt]=Yt}}(this._dataUpdateable,V.dataDiff,K),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class Vr{constructor(V){this.self=V,this.actor=new c.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,K)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=K},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=W=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,K)=>this._getDEMWorkerSource(W,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(W,K)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(W,K)=>this._getWorkerSource(W,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(W,K)=>this._getWorkerSource(W,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(W,K)=>this._getWorkerSource(W,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(W,K)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][K.type]||!this.workerSources[W][K.type][K.source])return;const se=this.workerSources[W][K.type][K.source];delete this.workerSources[W][K.type][K.source],se.removeSource!==void 0&&se.removeSource(K)})),this.actor.registerMessageHandler("RM",W=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,K)=>c._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(W,K)=>this._syncRTLPluginState(W,K)),this.actor.registerMessageHandler("IS",(W,K)=>c._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(W,K)=>this._setImages(W,K)),this.actor.registerMessageHandler("UL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(K)}))}_setImages(V,W){return c._(this,void 0,void 0,function*(){this.availableImages[V]=W;for(const K in this.workerSources[V]){const se=this.workerSources[V][K];for(const Ee in se)se[Ee].availableImages=W}})}_syncRTLPluginState(V,W){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(W.pluginStatus!=="loading")return c.bA.setState(W),W;const K=W.pluginURL;if(this.self.importScripts(K),c.bA.isParsed()){const se={pluginStatus:"loaded",pluginURL:K};return c.bA.setState(se),se}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_getAvailableImages(V){let W=this.availableImages[V];return W||(W=[]),W}_getLayerIndex(V){let W=this.layerIndexes[V];return W||(W=this.layerIndexes[V]=new l),W}_getWorkerSource(V,W,K){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][W]||(this.workerSources[V][W]={}),!this.workerSources[V][W][K]){const se={sendAsync:(Ee,J)=>(Ee.targetMapId=V,this.actor.sendAsync(Ee,J))};switch(W){case"vector":this.workerSources[V][W][K]=new I(se,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][W][K]=new ba(se,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][W][K]=new this.externalWorkerSourceTypes[W](se,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][W][K]}_getDEMWorkerSource(V,W){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][W]||(this.demWorkerSources[V][W]=new T),this.demWorkerSources[V][W]}}return c.i(self)&&(self.worker=new Vr(self)),Vr}),i("index",["exports","./shared"],function(c,l){var d="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((s,f)=>{const m=requestAnimationFrame(s);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),f(l.c())})}),getImageData(y,s=0){return this.getImageCanvasContext(y).getImageData(-s,-s,y.width+2*s,y.height+2*s)},getImageCanvasContext(y){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=y.width,s.height=y.height,f.drawImage(y,0,0,y.width,y.height),f},resolveURL:y=>(w||(w=document.createElement("a")),w.href=y,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class T{static testProp(s){if(!T.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",T.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,m){const g=f.boundingClientRect;return new l.P((m.clientX-g.left)/f.x-s.clientLeft,(m.clientY-g.top)/f.y-s.clientTop)}static mousePos(s,f){const m=T.getScale(s);return T.getPoint(s,m,f)}static touchPos(s,f){const m=[],g=T.getScale(s);for(let v=0;v{s=[],f=0,m=0,g={}},y.addThrottleControl=M=>{const R=m++;return g[R]=M,R},y.removeThrottleControl=M=>{delete g[M],C()},y.getImage=(M,R,z=!0)=>new Promise((F,Z)=>{k.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),l.e(M,{type:"image"}),s.push({abortController:R,requestParameters:M,supportImageRefresh:z,state:"queued",onError:ue=>{Z(ue)},onSuccess:ue=>{F(ue)}}),C()});const v=M=>l._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:R,supportImageRefresh:z,onError:F,onSuccess:Z,abortController:ue}=M,le=z===!1&&!l.i(self)&&!l.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((xe,Be)=>xe&&Be==="accept",!0));f++;const fe=le?L(R,ue):l.m(R,ue);try{const xe=yield fe;delete M.abortController,M.state="completed",xe.data instanceof HTMLImageElement||l.b(xe.data)?Z(xe):xe.data&&Z({data:yield(te=xe.data,typeof createImageBitmap=="function"?l.d(te):l.f(te)),cacheControl:xe.cacheControl,expires:xe.expires})}catch(xe){delete M.abortController,F(xe)}finally{f--,C()}var te}),C=()=>{const M=(()=>{for(const R of Object.keys(g))if(g[R]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=f;R0;R++){const z=s.shift();z.abortController.signal.aborted?R--:v(z)}},L=(M,R)=>new Promise((z,F)=>{const Z=new Image,ue=M.url,le=M.credentials;le&&le==="include"?Z.crossOrigin="use-credentials":(le&&le==="same-origin"||!l.s(ue))&&(Z.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,z({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,R.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=ue})}(j||(j={})),j.resetRequestQueue();class ${constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,m){const g=function(v){const C=v.match(ae);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 g.path+=`${f}${m}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const ae=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function me(y){var s=new l.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var pe,Q=function(y,s,f){return y[0]=s[0]-f[0],y[1]=s[1]-f[1],y[2]=s[2]-f[2],y};pe=new l.A(3),l.A!=Float32Array&&(pe[0]=0,pe[1]=0,pe[2]=0);var oe=function(y){var s=y[0],f=y[1];return s*s+f*f};function Ae(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const f=[];for(const{id:m,url:g}of y){const v=`${m}${g}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:m,url:g}))}}return s}(function(){var y=new l.A(2);l.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Y{constructor(s,f,m,g){this.context=s,this.format=m,this.texture=s.gl.createTexture(),this.update(f,g)}update(s,f,m){const{width:g,height:v}=s,C=!(this.size&&this.size[0]===g&&this.size[1]===v||m),{context:L}=this,{gl:M}=L;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[g,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:R,y:z}=m||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,R,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,R,z,g,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,m){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),m!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,m||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 ie(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class He extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.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:m}of this.requestors)m(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const m=f.spriteData;f.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.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 m=!0;const g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchX" value`))),m=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchY" value`))),m=!1),this._validateContent(f.content,f)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "content" value`))),m=!1),m}_validateStretch(s,f){if(!s)return!0;let m=0;for(const g of s){if(g[0]{let g=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(g=!1);this.isLoaded()||g?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const m of s){let g=this.getImage(m);g||(this.fire(new l.k("styleimagemissing",{id:m})),g=this.getImage(m)),g?f[m]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:l.w(`Image "${m}" 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],m=this.getImage(s);if(!m)return null;if(f&&f.position.version===m.version)return f.position;if(f)f.position.version=m.version;else{const g={w:m.data.width+2,h:m.data.height+2,x:0,y:0},v=new l.I(g,m);this.patterns[s]={bin:g,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 Y(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:m}=l.p(s),g=this.atlasImage;g.resize({width:f||1,height:m||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],L=C.x+1,M=C.y+1,R=this.getImage(v).data,z=R.width,F=R.height;l.R.copy(R,g,{x:0,y:0},{x:L,y:M},{width:z,height:F}),l.R.copy(R,g,{x:0,y:F-1},{x:L,y:M-1},{width:z,height:1}),l.R.copy(R,g,{x:0,y:0},{x:L,y:M+F},{width:z,height:1}),l.R.copy(R,g,{x:z-1,y:0},{x:L-1,y:M},{width:1,height:F}),l.R.copy(R,g,{x:0,y:0},{x:L+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 m=this.getImage(f);m||l.w(`Image with ID: "${f}" was not found`),ie(m)&&this.updateImage(f,m)}}}const ge=1e20;function Ne(y,s,f,m,g,v,C,L,M){for(let R=s;R-1);M++,v[M]=L,C[M]=R,C[M+1]=ge}for(let L=0,M=0;L65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[v])return{stack:s,id:f,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[v]){const L=qe.loadGlyphRange(s,v,this.url,this.requestManager);m.requests[v]=L}const C=yield m.requests[v];for(const L in C)this._doesCharSupportLocalGlyph(+L)||(m.glyphs[+L]=C[+L]);return m.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](s)||l.u["Hangul Syllables"](s)||l.u.Hiragana(s)||l.u.Katakana(s))}_tinySDF(s,f,m){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(m))return;let v=s.tinySDF;if(!v){let L="400";/bold/i.test(f)?L="900":/medium/i.test(f)?L="500":/light/i.test(f)&&(L="200"),v=s.tinySDF=new qe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:L})}const C=v.draw(String.fromCharCode(m));return{id:m,bitmap:new l.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(y,s,f,m){return l._(this,void 0,void 0,function*(){const g=256*s,v=g+255,C=m.transformRequest(f.replace("{fontstack}",y).replace("{range}",`${g}-${v}`),"Glyphs"),L=yield l.l(C,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);const M={};for(const R of l.n(L.data))M[R.id]=R;return M})},qe.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:f=8,cutoff:m=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=m,this.radius=f;const L=this.size=y+4*s,M=this._createCanvas(L),R=this.ctx=M.getContext("2d",{willReadFrequently:!0});R.font=`${C} ${v} ${y}px ${g}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:m,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(y),C=Math.ceil(f),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-g))),M=Math.min(this.size-this.buffer,C+Math.ceil(m)),R=L+2*this.buffer,z=M+2*this.buffer,F=Math.max(R*z,0),Z=new Uint8ClampedArray(F),ue={data:Z,width:R,height:z,glyphWidth:L,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(L===0||M===0)return ue;const{ctx:le,buffer:fe,gridInner:te,gridOuter:xe}=this;le.clearRect(fe,fe,L,M),le.fillText(y,fe,fe+C);const Be=le.getImageData(fe,fe,L,M);xe.fill(ge,0,F),te.fill(0,0,F);for(let de=0;de0?Xe*Xe:0,te[je]=Xe<0?Xe*Xe:0}}Ne(xe,0,0,R,z,R,this.f,this.v,this.z),Ne(te,fe,fe,L,M,R,this.f,this.v,this.z);for(let de=0;de1&&(M=s[++L]);const z=Math.abs(R-M.left),F=Math.abs(R-M.right),Z=Math.min(z,F);let ue;const le=v/m*(g+1);if(M.isDash){const fe=g-Math.abs(le);ue=Math.sqrt(Z*Z+fe*fe)}else ue=g-Math.sqrt(Z*Z+le*le);this.data[C+R]=Math.max(0,Math.min(255,ue+128))}}}addRegularDash(s){for(let L=s.length-1;L>=0;--L){const M=s[L],R=s[L+1];M.zeroLength?s.splice(L,1):R&&R.isDash===M.isDash&&(R.left=M.left,s.splice(L,1))}const f=s[0],m=s[s.length-1];f.isDash===m.isDash&&(f.left=m.left-this.width,m.right=f.right+this.width);const g=this.width*this.nextRow;let v=0,C=s[v];for(let L=0;L1&&(C=s[++v]);const M=Math.abs(L-C.left),R=Math.abs(L-C.right),z=Math.min(M,R);this.data[g+L]=Math.max(0,Math.min(255,(C.isDash?z:-z)+128))}}addDash(s,f){const m=f?7:0,g=2*m+1;if(this.nextRow+g>this.height)return l.w("LineAtlas out of space"),null;let v=0;for(let L=0;L{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[kt]}numActive(){return Object.keys(this.active).length}}const Fn=Math.floor(I.hardwareConcurrency/2);let bn,mn;function Bn(){return bn||(bn=new un),bn}un.workerCount=l.B(globalThis)?Math.max(Math.min(Fn,3),1):1;class ir{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const m=this.workerPool.acquire(f);for(let g=0;g{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const m of this.actors)m.registerMessageHandler(s,f)}}function $r(){return mn||(mn=new ir(Bn(),l.G),mn.registerMessageHandler("GR",(y,s,f)=>l.m(s,f))),mn}function _r(y,s){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*y.width,.5*y.height,1]),l.K(f,f,y.calculatePosMatrix(s.toUnwrapped()))}function cr(y,s,f,m,g,v){const C=function(F,Z,ue){if(F)for(const le of F){const fe=Z[le];if(fe&&fe.source===ue&&fe.type==="fill-extrusion")return!0}else for(const le in Z){const fe=Z[le];if(fe.source===ue&&fe.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),L=v.maxPitchScaleFactor(),M=y.tilesIn(m,L,C);M.sort(or);const R=[];for(const F of M)R.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,y._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,g,v,L,_r(y.transform,F.tileID))});const z=function(F){const Z={},ue={};for(const le of F){const fe=le.queryResults,te=le.wrappedTileID,xe=ue[te]=ue[te]||{};for(const Be in fe){const de=fe[Be],Pe=xe[Be]=xe[Be]||{},Ve=Z[Be]=Z[Be]||[];for(const je of de)Pe[je.featureIndex]||(Pe[je.featureIndex]=!0,Ve.push(je))}}return Z}(R);for(const F in z)z[F].forEach(Z=>{const ue=Z.feature,le=y.getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=le});return z}function or(y,s){const f=y.tileID,m=s.tileID;return f.overscaledZ-m.overscaledZ||f.canonical.y-m.canonical.y||f.wrap-m.wrap||f.canonical.x-m.canonical.x}function re(y,s,f){return l._(this,void 0,void 0,function*(){let m=y;if(y.url?m=(yield l.h(s.transformRequest(y.url,"Source"),f)).data:yield I.frameAsync(f),!m)return null;const g=l.L(l.e(m,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(g.vectorLayerIds=m.vector_layers.map(v=>v.id)),g})}class Ce{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 l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}extend(s){const f=this._sw,m=this._ne;let g,v;if(s instanceof l.M)g=s,v=s;else{if(!(s instanceof Ce))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ce.convert(s)):this.extend(l.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(l.M.convert(s)):this;if(g=s._sw,v=s._ne,!g||!v)return this}return f||m?(f.lng=Math.min(g.lng,f.lng),f.lat=Math.min(g.lat,f.lat),m.lng=Math.max(v.lng,m.lng),m.lat=Math.max(v.lat,m.lat)):(this._sw=new l.M(g.lng,g.lat),this._ne=new l.M(v.lng,v.lat)),this}getCenter(){return new l.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 l.M(this.getWest(),this.getNorth())}getSouthEast(){return new l.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:m}=l.M.convert(s);let g=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&g}static convert(s){return s instanceof Ce?s:s&&new Ce(s)}static fromLngLat(s,f=0){const m=360*f/40075017,g=m/Math.cos(Math.PI/180*s.lat);return new Ce(new l.M(s.lng-g,s.lat-m),new l.M(s.lng+g,s.lat+m))}}class _t{constructor(s,f,m){this.bounds=Ce.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=m||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),m=Math.floor(l.N(this.bounds.getWest())*f),g=Math.floor(l.O(this.bounds.getNorth())*f),v=Math.ceil(l.N(this.bounds.getEast())*f),C=Math.ceil(l.O(this.bounds.getSouth())*f);return s.x>=m&&s.x=g&&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 l.e({},this._options)}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={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};m.request.collectResourceTiming=this._collectResourceTiming;let g="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(),g="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:g,data:m},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 m=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(m.resolve).catch(m.reject)}}abortTile(s){return l._(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 l._(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 ze extends l.E{constructor(s,f,m,g){super(),this.id=s,this.dispatcher=m,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},f),l.e(this,l.L(f,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield re(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new _t(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.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 l.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return l._(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 m=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(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const g=this.map.painter.context,v=g.gl,C=m.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new Y(g,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class en extends ze{constructor(s,f,m,g){super(s,f,m,g),this.type="raster-dem",this.maxzoom=22,this._options=l.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 l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const g=yield j.getImage(m,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(g&&g.data){const v=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&s.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const C=l.b(v)&&l.S()?v:yield this.readImageNow(v),L={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:L});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(g){if(delete s.abortController,s.aborted)s.state="unloaded";else if(g)throw s.state="errored",g}})}readImageNow(s){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.U()){const f=s.width+2,m=s.height+2;try{return new l.R({width:f,height:m},yield l.V(s,-1,-1,f,m))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,m=Math.pow(2,f.z),g=(f.x-1+m)%m,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+m)%m,L=f.x+1===m?s.wrap+1:s.wrap,M={};return M[new l.Q(s.overscaledZ,v,f.z,g,f.y).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new l.Q(s.overscaledZ,v,f.z,g,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&l.e(v,{resourceTiming:g}),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const m={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 g=yield this.actor.sendAsync({type:f,data:m},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(g,this.map.painter,f==="RT")})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return l._(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 l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var fn=l.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class er extends l.E{constructor(s,f,m,g){super(),this.id=s,this.dispatcher=m,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=f}load(s){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.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 l.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 l.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(l.Y.fromLngLat);this.tileID=function(g){let v=1/0,C=1/0,L=-1/0,M=-1/0;for(const Z of g)v=Math.min(v,Z.x),C=Math.min(C,Z.y),L=Math.max(L,Z.x),M=Math.max(M,Z.y);const R=Math.max(L-v,M-C),z=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),F=Math.pow(2,z);return new l.a0(z,Math.floor((v+L)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const m=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new l.Z,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.W,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.W),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.W,l.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.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,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Y(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return l._(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 Do extends er{constructor(s,f,m,g){super(s,f,m,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return l._(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 l.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 l.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 l.j(new l.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,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.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 Y(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,m=!0)}m&&this.fire(new l.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 gs extends er{constructor(s,f,m,g){super(s,f,m,g),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 l.j(new l.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new l.j(new l.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 l.j(new l.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 l.j(new l.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return l._(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 l.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,m=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Y(f,this.canvas,m.RGBA,{premultiply:!0});let g=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,g=!0)}g&&this.fire(new l.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 Bs={},Ha=y=>{switch(y){case"geojson":return Dr;case"image":return er;case"raster":return ze;case"raster-dem":return en;case"vector":return xn;case"video":return Do;case"canvas":return gs}return Bs[y]},Ai="RTLPluginLoaded";class Cl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$r()}_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 l._(this,arguments,void 0,function*(f,m=!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(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ai))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _s=null;function at(){return _s||(_s=new Cl),_s}class Qo{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=l.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(R)).filter(Boolean);if(M.length!==0){L.layers=M,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(R=>M.filter(z=>z.id===R)[0]));for(const R of M)C[R.id]=L}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5){if(this.hasSymbolBuckets=!0,!m)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5&&v.hasRTLText){this.hasRTLText=!0,at().lazyLoad();break}}this.queryPadding=0;for(const g in this.buckets){const v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(g).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new l.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 m in this.buckets){const g=this.buckets[m];g.uploadPending()&&g.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Y(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Y(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,m,g,v,C,L,M,R,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:L,queryPadding:this.queryPadding*R},s,f,m):{}}querySourceFeatures(s,f){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const g=m.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=g._geojsonTileLayer||g[v];if(!C)return;const L=l.a6(f&&f.filter),{z:M,x:R,y:z}=this.tileID.canonical,F={z:M,x:R,y:z};for(let Z=0;Zm)g=!1;else if(f)if(this.expirationTime{this.remove(s,v)},m)),this.data[g].push(v),this.order.push(g),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 m=s.wrapped().key,g=f===void 0?0:this.data[m].indexOf(f),v=this.data[m][g];return this.data[m].splice(g,1),v.timeout&&clearTimeout(v.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(v.value),this.order.splice(this.order.indexOf(m),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 m in this.data)for(const g of this.data[m])s(g.value)||f.push(g);for(const m of f)this.remove(m.value.tileID,m)}}class Tl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,m){const g=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},l.e(this.stateChanges[s][g],m),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==g&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const v in this.state[s][g])m[v]||(this.deletedStates[s][g][v]=null)}else for(const v in m)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][v]===null&&delete this.deletedStates[s][g][v]}removeFeatureState(s,f,m){if(this.deletedStates[s]===null)return;const g=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},m&&f!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][m]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(m in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][m]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,f){const m=String(f),g=l.e({},(this.state[s]||{})[m],(this.stateChanges[s]||{})[m]);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 g[C]}return g}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const m={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const v={};for(const C in this.stateChanges[g])this.state[g][C]||(this.state[g][C]={}),l.e(this.state[g][C],this.stateChanges[g][C]),v[C]=this.state[g][C];m[g]=v}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const v={};if(this.deletedStates[g]===null)for(const C in this.state[g])v[C]={},this.state[g][C]={};else for(const C in this.deletedStates[g]){if(this.deletedStates[g][C]===null)this.state[g][C]={};else for(const L of Object.keys(this.deletedStates[g][C]))delete this.state[g][C][L];v[C]=this.state[g][C]}m[g]=m[g]||{},l.e(m[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const g in s)s[g].setFeatureState(m,f)}}class ei extends l.E{constructor(s,f,m){super(),this.id=s,this.dispatcher=m,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,v,C,L)=>{const M=new(Ha(v.type))(g,v,C,L);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,f,m,this),this._tiles={},this._cache=new $i(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Tl,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,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,m)}catch(g){s.state="errored",g.status!==404?this._source.fire(new l.j(g,{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 l.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 m=this._tiles[f];m.upload(s),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ft).map(s=>s.key)}getRenderableIds(s){const f=[];for(const m in this._tiles)this._isIdRenderable(m,s)&&f.push(this._tiles[m]);return s?f.sort((m,g)=>{const v=m.tileID,C=g.tileID,L=new l.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new l.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-L.y||M.x-L.x}).map(m=>m.tileID.key):f.map(m=>m.tileID).sort(ft).map(m=>m.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 l._(this,void 0,void 0,function*(){const m=this._tiles[s];m&&(m.state!=="loading"&&(m.state=f),yield this._loadTile(m,s,f))})}_tileLoaded(s,f,m){s.timeAdded=I.now(),m==="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 l.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let g=0;g1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,C,L),g.neighboringTiles&&g.neighboringTiles[R]&&(g.neighboringTiles[R].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,m,g){for(const v in this._tiles){let C=this._tiles[v];if(g[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>m)continue;let L=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const R=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[R.key],C&&C.hasData()&&(L=R)}let M=L;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[L.key]=L;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const m=this._loadedParentTiles[s.key];return m&&m.tileID.overscaledZ>=f?m:null}for(let m=s.overscaledZ-1;m>=f;m--){const g=s.scaledTo(m),v=this._getLoadedTile(g);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,m=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(f*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;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 m={};for(const g in this._tiles){const v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),m[v.tileID.key]=v}this._tiles=m;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let m;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new l.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(m=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&&(m=m.filter(z=>this._source.hasTile(z)))):m=[];const g=s.coveringZoomLevel(this._source),v=Math.max(g-ei.maxOverzooming,this._source.minzoom),C=Math.max(g+ei.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);z[Z.key]=Z;const ue=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[ue.key]=ue}m=m.concat(Object.values(z))}const L=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(m,g);if(on(this._source.type)){const z={},F={},Z=Object.keys(M),ue=I.now();for(const le of Z){const fe=M[le],te=this._tiles[le];if(!te||te.fadeEndTime!==0&&te.fadeEndTime<=ue)continue;const xe=this.findLoadedParent(fe,v);xe&&(this._addTile(xe.tileID),z[xe.tileID.key]=xe.tileID),F[le]=fe}this._retainLoadedChildren(F,g,C,M);for(const le in z)M[le]||(this._coveredTiles[le]=!0,M[le]=z[le]);if(f){const le={},fe={};for(const te of m)this._tiles[te.key].hasData()?le[te.key]=te:fe[te.key]=te;for(const te in fe){const xe=fe[te].children(this._source.maxzoom);this._tiles[xe[0].key]&&this._tiles[xe[1].key]&&this._tiles[xe[2].key]&&this._tiles[xe[3].key]&&(le[xe[0].key]=M[xe[0].key]=xe[0],le[xe[1].key]=M[xe[1].key]=xe[1],le[xe[2].key]=M[xe[2].key]=xe[2],le[xe[3].key]=M[xe[3].key]=xe[3],delete fe[te])}for(const te in fe){const xe=this.findLoadedParent(fe[te],this._source.minzoom);if(xe){le[xe.tileID.key]=M[xe.tileID.key]=xe.tileID;for(const Be in le)le[Be].isChildOf(xe.tileID)&&delete le[Be]}}for(const te in this._tiles)le[te]||(this._coveredTiles[te]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const R=l.ab(this._tiles,M);for(const z of R){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 m={},g={},v=Math.max(f-ei.maxOverzooming,this._source.minzoom),C=Math.max(f+ei.maxUnderzooming,this._source.minzoom),L={};for(const M of s){const R=this._addTile(M);m[M.key]=M,R.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],Z=this.getTile(F);if(Z&&Z.hasData()){m[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(m[F[0].key]&&m[F[1].key]&&m[F[2].key]&&m[F[3].key])continue}let z=R.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const Z=M.scaledTo(F);if(g[Z.key])break;if(g[Z.key]=!0,R=this.getTile(Z),!R&&z&&(R=this._addTile(Z)),R){const ue=R.hasData();if((z||ue)&&(m[Z.key]=Z),z=R.wasRequested(),ue)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let m,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){m=this._loadedParentTiles[g.key];break}f.push(g.key);const v=g.scaledTo(g.overscaledZ-1);if(m=this._getLoadedTile(v),m)break;g=v}for(const v of f)this._loadedParentTiles[v]=m}}_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 m=f;return f||(f=new Qo(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,m||this._source.fire(new l.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 m=f.getExpiryTimeout();m&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},m))}_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,m){const g=[],v=this.transform;if(!v)return g;const C=m?v.getCameraQueryGeometry(s):s,L=s.map(le=>v.pointCoordinate(le,this.terrain)),M=C.map(le=>v.pointCoordinate(le,this.terrain)),R=this.getIds();let z=1/0,F=1/0,Z=-1/0,ue=-1/0;for(const le of M)z=Math.min(z,le.x),F=Math.min(F,le.y),Z=Math.max(Z,le.x),ue=Math.max(ue,le.y);for(let le=0;le=0&&de[1].y+Be>=0){const Pe=L.map(je=>te.getTilePoint(je)),Ve=M.map(je=>te.getTilePoint(je));g.push({tile:fe,tileID:te,queryGeometry:Pe,cameraQueryGeometry:Ve,scale:xe})}}return g}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(m=>this._tiles[m].tileID);for(const m of f)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(on(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,m){this._state.updateState(s=s||"_geojsonTileLayer",f,m)}removeFeatureState(s,f,m){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,m)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,m){const g=this._tiles[s];g&&g.setDependencies(f,m)}reloadTilesForDependencies(s,f){for(const m in this._tiles)this._tiles[m].hasDependency(s,f)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(s,f))}}function ft(y,s){const f=Math.abs(2*y.wrap)-+(y.wrap<0),m=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||m-f||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function on(y){return y==="raster"||y==="image"||y==="video"}ei.maxOverzooming=10,ei.maxUnderzooming=3;class nn{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let m=1;m0?(g-C)/L:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Rr(y,s){let f=!0;return y==="always"||y!=="never"&&s!=="never"||(f=!1),f}class $o{constructor(s,f,m){const g=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/m),this.yCellCount=Math.ceil(f/m);for(let C=0;Cthis.width||g<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=m&&this.height<=g){if(v)return[{key:null,x1:s,y1:f,x2:m,y2:g}];for(let R=0;R0}hitTestCircle(s,f,m,g,v){const C=s-m,L=s+m,M=f-m,R=f+m;if(L<0||C>this.width||R<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,L,R,this._queryCellCircle,z,{hitTest:!0,overlapMode:g,circle:{x:s,y:f,radius:m},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,m,g,v,C,L,M){const{seenUids:R,hitTest:z,overlapMode:F}=L,Z=this.boxCells[v];if(Z!==null){const le=this.bboxes;for(const fe of Z)if(!R.box[fe]){R.box[fe]=!0;const te=4*fe,xe=this.boxKeys[fe];if(s<=le[te+2]&&f<=le[te+3]&&m>=le[te+0]&&g>=le[te+1]&&(!M||M(xe))&&(!z||!Rr(F,xe.overlapMode))&&(C.push({key:xe,x1:le[te],y1:le[te+1],x2:le[te+2],y2:le[te+3]}),z))return!0}}const ue=this.circleCells[v];if(ue!==null){const le=this.circles;for(const fe of ue)if(!R.circle[fe]){R.circle[fe]=!0;const te=3*fe,xe=this.circleKeys[fe];if(this._circleAndRectCollide(le[te],le[te+1],le[te+2],s,f,m,g)&&(!M||M(xe))&&(!z||!Rr(F,xe.overlapMode))){const Be=le[te],de=le[te+1],Pe=le[te+2];if(C.push({key:xe,x1:Be-Pe,y1:de-Pe,x2:Be+Pe,y2:de+Pe}),z)return!0}}}return!1}_queryCellCircle(s,f,m,g,v,C,L,M){const{circle:R,seenUids:z,overlapMode:F}=L,Z=this.boxCells[v];if(Z!==null){const le=this.bboxes;for(const fe of Z)if(!z.box[fe]){z.box[fe]=!0;const te=4*fe,xe=this.boxKeys[fe];if(this._circleAndRectCollide(R.x,R.y,R.radius,le[te+0],le[te+1],le[te+2],le[te+3])&&(!M||M(xe))&&!Rr(F,xe.overlapMode))return C.push(!0),!0}}const ue=this.circleCells[v];if(ue!==null){const le=this.circles;for(const fe of ue)if(!z.circle[fe]){z.circle[fe]=!0;const te=3*fe,xe=this.circleKeys[fe];if(this._circlesCollide(le[te],le[te+1],le[te+2],R.x,R.y,R.radius)&&(!M||M(xe))&&!Rr(F,xe.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,m,g,v,C,L,M){const R=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(g);for(let ue=R;ue<=F;ue++)for(let le=z;le<=Z;le++)if(v.call(this,s,f,m,g,this.xCellCount*le+ue,C,L,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,m,g,v,C){const L=g-s,M=v-f,R=m+C;return R*R>L*L+M*M}_circleAndRectCollide(s,f,m,g,v,C,L){const M=(C-g)/2,R=Math.abs(s-(g+M));if(R>M+m)return!1;const z=(L-v)/2,F=Math.abs(f-(v+z));if(F>z+m)return!1;if(R<=M||F<=z)return!0;const Z=R-M,ue=F-z;return Z*Z+ue*ue<=m*m}}function tn(y,s,f,m,g){const v=l.F();return s?(l.J(v,v,[1/g,1/g,1]),f||l.ad(v,v,m.angle)):l.K(v,m.labelPlaneMatrix,y),v}function ba(y,s,f,m,g){if(s){const v=l.ae(y);return l.J(v,v,[g,g,1]),f||l.ad(v,v,-m.angle),v}return m.glCoordMatrix}function Vr(y,s,f){let m;f?(m=[y.x,y.y,f(y.x,y.y),1],l.af(m,m,s)):(m=[y.x,y.y,0,1],Mt(m,m,s));const g=m[3];return{point:new l.P(m[0]/g,m[1]/g),signedDistanceFromCamera:g}}function he(y,s){return .5+y/s*.5}function V(y,s){const f=y[0]/y[3],m=y[1]/y[3];return f>=-s[0]&&f<=s[0]&&m>=-s[1]&&m<=s[1]}function W(y,s,f,m,g,v,C,L,M,R){const z=m?y.textSizeData:y.iconSizeData,F=l.ag(z,f.transform.zoom),Z=[256/f.width*2+1,256/f.height*2+1],ue=m?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;ue.clear();const le=y.lineVertexArray,fe=m?y.text.placedSymbolArray:y.icon.placedSymbolArray,te=f.transform.width/f.transform.height;let xe=!1;for(let Be=0;BeMath.abs(f.x-s.x)*m?{useVertical:!0}:(y===l.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function Ee(y,s,f,m,g,v,C,L,M,R,z,F,Z,ue,le,fe){const te=s/24,xe=y.lineOffsetX*te,Be=y.lineOffsetY*te;let de;if(y.numGlyphs>1){const Pe=y.glyphStartIndex+y.numGlyphs,Ve=y.lineStartIndex,je=y.lineStartIndex+y.lineLength,Xe=K(te,L,xe,Be,f,z,F,y,M,v,Z,le,fe);if(!Xe)return{notEnoughRoom:!0};const tt=Vr(Xe.first.point,C,fe).point,$e=Vr(Xe.last.point,C,fe).point;if(m&&!f){const ut=se(y.writingMode,tt,$e,ue);if(ut)return ut}de=[Xe.first];for(let ut=y.glyphStartIndex+1;ut0?tt.point:J(F,Xe,Ve,1,g,fe),ut=se(y.writingMode,Ve,$e,ue);if(ut)return ut}const Pe=Ge(te*L.getoffsetX(y.glyphStartIndex),xe,Be,f,z,F,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,v,Z,le,fe);if(!Pe)return{notEnoughRoom:!0};de=[Pe]}for(const Pe of de)l.aj(R,Pe.point,Pe.angle);return{}}function J(y,s,f,m,g,v){const C=Vr(y.add(y.sub(s)._unit()),g,v).point,L=f.sub(C);return f.add(L._mult(m/L.mag()))}function Ie(y,s){const{projectionCache:f,lineVertexArray:m,labelPlaneMatrix:g,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:L,previousVertex:M,direction:R,absOffsetX:z}=s;if(f.projections[y])return f.projections[y];const F=new l.P(m.getx(y),m.gety(y)),Z=Vr(F,g,L);if(Z.signedDistanceFromCamera>0)return f.projections[y]=Z.point,Z.point;const ue=y-R;return J(C===0?v:new l.P(m.getx(ue),m.gety(ue)),F,M,z-C+1,g,L)}function ye(y,s,f){return y._unit()._perp()._mult(s*f)}function De(y,s,f,m,g,v,C,L){const{projectionCache:M,direction:R}=L;if(M.offsets[y])return M.offsets[y];const z=f.add(s);if(y+R=g)return M.offsets[y]=z,z;const F=Ie(y+R,L),Z=ye(F.sub(f),C,R),ue=f.add(Z),le=F.add(Z);return M.offsets[y]=l.ak(v,z,ue,le)||z,M.offsets[y]}function Ge(y,s,f,m,g,v,C,L,M,R,z,F,Z,ue){const le=m?y-s:y+s;let fe=le>0?1:-1,te=0;m&&(fe*=-1,te=Math.PI),fe<0&&(te+=Math.PI);let xe,Be,de=fe>0?L+C:L+C+1,Pe=g,Ve=g,je=0,Xe=0;const tt=Math.abs(le),$e=[];let ut;for(;je+Xe<=tt;){if(de+=fe,de=M)return null;je+=Xe,Ve=Pe,Be=xe;const dt={projectionCache:F,lineVertexArray:R,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:je,getElevation:ue,previousVertex:Ve,direction:fe,absOffsetX:tt};if(Pe=Ie(de,dt),f===0)$e.push(Ve),ut=Pe.sub(Ve);else{let Ut;const an=Pe.sub(Ve);Ut=an.mag()===0?ye(Ie(de+fe,dt).sub(Pe),f,fe):ye(an,f,fe),Be||(Be=Ve.add(Ut)),xe=De(de,Ut,Pe,L,M,Be,f,dt),$e.push(Be),ut=xe.sub(Be)}Xe=ut.mag()}const pt=ut._mult((tt-je)/Xe)._add(Be||Ve),sn=te+Math.atan2(Pe.y-Ve.y,Pe.x-Ve.x);return $e.push(pt),{point:pt,angle:Z?sn:0,path:$e}}const Ze=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ye(y,s){for(let f=0;f=1;hn--)an.push(dt.path[hn]);for(let hn=1;hnVr(pn,M,le));an=hn.some(pn=>pn.signedDistanceFromCamera<=0)?[]:hn.map(pn=>pn.point)}let Ht=[];if(an.length>0){const hn=an[0].clone(),pn=an[0].clone();for(let Lr=1;Lr=ut.x&&pn.x<=pt.x&&hn.y>=ut.y&&pn.y<=pt.y?[an]:pn.xpt.x||pn.ypt.y?[]:l.al([an],ut.x,ut.y,pt.x,pt.y)}for(const hn of Ht){sn.reset(hn,.25*$e);let pn=0;pn=sn.length<=.5*$e?1:Math.ceil(sn.paddedLength/Cn)+1;for(let Lr=0;Lr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,f,m,g){return m>=0&&s=0&&fm.collisionGroupID===f}}return this.collisionGroups[s]}}function ai(y,s,f,m,g){const{horizontalAlign:v,verticalAlign:C}=l.at(y);return new l.P(-(v-.5)*s+m[0]*g,-(C-.5)*f+m[1]*g)}function eo(y,s,f,m,g,v){const{x1:C,x2:L,y1:M,y2:R,anchorPointX:z,anchorPointY:F}=y,Z=new l.P(s,f);return m&&Z._rotate(g?v:-v),{x1:C+Z.x,y1:M+Z.y,x2:L+Z.x,y2:R+Z.y,anchorPointX:z,anchorPointY:F}}class go{constructor(s,f,m,g,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Yt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Ir(g),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,m,g){const v=m.getBucket(f),C=m.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const L=m.collisionBoxArray,M=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),z=m.tileSize/l.W,F=this.transform.calculatePosMatrix(m.tileID.toUnwrapped()),Z=M.get("text-pitch-alignment")==="map",ue=M.get("text-rotation-alignment")==="map",le=Qt(m,1,this.transform.zoom),fe=tn(F,Z,ue,this.transform,le);let te=null;if(Z){const Be=ba(F,Z,ue,this.transform,le);te=l.K([],this.transform.labelPlaneMatrix,Be)}this.retainedQueryData[v.bucketInstanceId]=new cn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,m.tileID);const xe={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:fe,labelToScreenMatrix:te,scale:R,textPixelRatio:z,holdingForFade:m.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:l.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(const Be of v.sortKeyRanges){const{sortKey:de,symbolInstanceStart:Pe,symbolInstanceEnd:Ve}=Be;s.push({sortKey:de,symbolInstanceStart:Pe,symbolInstanceEnd:Ve,parameters:xe})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:xe})}attemptAnchorPlacement(s,f,m,g,v,C,L,M,R,z,F,Z,ue,le,fe,te){const xe=l.ap[s.textAnchor],Be=[s.textOffset0,s.textOffset1],de=ai(xe,m,g,Be,v),Pe=this.collisionIndex.placeCollisionBox(eo(f,de.x,de.y,C,L,this.transform.angle),F,M,R,z.predicate,te);if((!fe||this.collisionIndex.placeCollisionBox(eo(fe,de.x,de.y,C,L,this.transform.angle),F,M,R,z.predicate,te).box.length!==0)&&Pe.box.length>0){let Ve;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Ve=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:Be,width:m,height:g,anchor:xe,textBoxScale:v,prevAnchor:Ve},this.markUsedJustification(ue,xe,Z,le),ue.allowVerticalPlacement&&(this.markUsedOrientation(ue,le,Z),this.placedOrientations[Z.crossTileID]=le),{shift:de,placedGlyphBoxes:Pe}}}placeLayerBucketPart(s,f,m){const{bucket:g,layout:v,posMatrix:C,textLabelPlaneMatrix:L,labelToScreenMatrix:M,textPixelRatio:R,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:Z,collisionGroup:ue}=s.parameters,le=v.get("text-optional"),fe=v.get("icon-optional"),te=l.aq(v,"text-overlap","text-allow-overlap"),xe=te==="always",Be=l.aq(v,"icon-overlap","icon-allow-overlap"),de=Be==="always",Pe=v.get("text-rotation-alignment")==="map",Ve=v.get("text-pitch-alignment")==="map",je=v.get("icon-text-fit")!=="none",Xe=v.get("symbol-z-order")==="viewport-y",tt=xe&&(de||!g.hasIconData()||fe),$e=de&&(xe||!g.hasTextData()||le);!g.collisionArrays&&F&&g.deserializeCollisionBoxes(F);const ut=this.retainedQueryData[g.bucketInstanceId].tileID,pt=this.terrain?(dt,Ut)=>this.terrain.getElevation(ut,dt,Ut):null,sn=(dt,Ut)=>{var an,Cn;if(f[dt.crossTileID])return;if(z)return void(this.placements[dt.crossTileID]=new hr(!1,!1,!1));let Ht=!1,hn=!1,pn=!0,Lr=null,Wn={box:null,offscreen:null},zo={box:null,offscreen:null},li=null,vr=null,ui=null,Fo=0,Ws=0,$a=0;Ut.textFeatureIndex?Fo=Ut.textFeatureIndex:dt.useRuntimeCollisionCircles&&(Fo=dt.featureIndex),Ut.verticalTextFeatureIndex&&(Ws=Ut.verticalTextFeatureIndex);const xc=Ut.textBox;if(xc){const ri=ii=>{let xr=l.ah.horizontal;if(g.allowVerticalPlacement&&!ii&&this.prevPlacement){const rs=this.prevPlacement.placedOrientations[dt.crossTileID];rs&&(this.placedOrientations[dt.crossTileID]=rs,xr=rs,this.markUsedOrientation(g,xr,dt))}return xr},br=(ii,xr)=>{if(g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&Ut.verticalTextBox){for(const rs of g.writingModes)if(rs===l.ah.vertical?(Wn=xr(),zo=Wn):Wn=ii(),Wn&&Wn.box&&Wn.box.length)break}else Wn=ii()},pr=dt.textAnchorOffsetStartIndex,ns=dt.textAnchorOffsetEndIndex;if(ns===pr){const ii=(xr,rs)=>{const oi=this.collisionIndex.placeCollisionBox(xr,te,R,C,ue.predicate,pt);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(g,rs,dt),this.placedOrientations[dt.crossTileID]=rs),oi};br(()=>ii(xc,l.ah.horizontal),()=>{const xr=Ut.verticalTextBox;return g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&xr?ii(xr,l.ah.vertical):{box:null,offscreen:null}}),ri(Wn&&Wn.box&&Wn.box.length)}else{let ii=l.ap[(Cn=(an=this.prevPlacement)===null||an===void 0?void 0:an.variableOffsets[dt.crossTileID])===null||Cn===void 0?void 0:Cn.anchor];const xr=(oi,Nr,zp)=>{const Wm=oi.x2-oi.x1,Ol=oi.y2-oi.y1,zl=dt.textBoxScale,Vh=je&&Be==="never"?Nr:null;let tl={box:[],offscreen:!1},Fp=te==="never"?1:2,Hm="never";ii&&Fp++;for(let Bp=0;Bpxr(xc,Ut.iconBox,l.ah.horizontal),()=>{const oi=Ut.verticalTextBox;return g.allowVerticalPlacement&&!(Wn&&Wn.box&&Wn.box.length)&&dt.numVerticalGlyphVertices>0&&oi?xr(oi,Ut.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),Wn&&(Ht=Wn.box,pn=Wn.offscreen);const rs=ri(Wn&&Wn.box);if(!Ht&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[dt.crossTileID];oi&&(this.variableOffsets[dt.crossTileID]=oi,this.markUsedJustification(g,oi.anchor,dt,rs))}}}if(li=Wn,Ht=li&&li.box&&li.box.length>0,pn=li&&li.offscreen,dt.useRuntimeCollisionCircles){const ri=g.text.placedSymbolArray.get(dt.centerJustifiedTextSymbolIndex),br=l.ai(g.textSizeData,Z,ri),pr=v.get("text-padding");vr=this.collisionIndex.placeCollisionCircles(te,ri,g.lineVertexArray,g.glyphOffsetArray,br,C,L,M,m,Ve,ue.predicate,dt.collisionCircleDiameter,pr,pt),vr.circles.length&&vr.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Ht=xe||vr.circles.length>0&&!vr.collisionDetected,pn=pn&&vr.offscreen}if(Ut.iconFeatureIndex&&($a=Ut.iconFeatureIndex),Ut.iconBox){const ri=br=>{const pr=je&&Lr?eo(br,Lr.x,Lr.y,Pe,Ve,this.transform.angle):br;return this.collisionIndex.placeCollisionBox(pr,Be,R,C,ue.predicate,pt)};zo&&zo.box&&zo.box.length&&Ut.verticalIconBox?(ui=ri(Ut.verticalIconBox),hn=ui.box.length>0):(ui=ri(Ut.iconBox),hn=ui.box.length>0),pn=pn&&ui.offscreen}const el=le||dt.numHorizontalGlyphVertices===0&&dt.numVerticalGlyphVertices===0,Hs=fe||dt.numIconVertices===0;if(el||Hs?Hs?el||(hn=hn&&Ht):Ht=hn&&Ht:hn=Ht=hn&&Ht,Ht&&li&&li.box&&this.collisionIndex.insertCollisionBox(li.box,te,v.get("text-ignore-placement"),g.bucketInstanceId,zo&&zo.box&&Ws?Ws:Fo,ue.ID),hn&&ui&&this.collisionIndex.insertCollisionBox(ui.box,Be,v.get("icon-ignore-placement"),g.bucketInstanceId,$a,ue.ID),vr&&(Ht&&this.collisionIndex.insertCollisionCircles(vr.circles,te,v.get("text-ignore-placement"),g.bucketInstanceId,Fo,ue.ID),m)){const ri=g.bucketInstanceId;let br=this.collisionCircleArrays[ri];br===void 0&&(br=this.collisionCircleArrays[ri]=new ti);for(let pr=0;pr=0;--Ut){const an=dt[Ut];sn(g.symbolInstances.get(an),g.collisionArrays[an])}}else for(let dt=s.symbolInstanceStart;dt=0&&(s.text.placedSymbolArray.get(L).crossTileID=v>=0&&L!==v?0:m.crossTileID)}markUsedOrientation(s,f,m){const g=f===l.ah.horizontal||f===l.ah.horizontalOnly?f:0,v=f===l.ah.vertical?f:0,C=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const L of C)s.text.placedSymbolArray.get(L).placedOrientation=g;m.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let m=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const g=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},L=f?f.placedOrientations:{};for(const M in this.placements){const R=this.placements[M],z=v[M];z?(this.opacities[M]=new Xn(z,g,R.text,R.icon),m=m||R.text!==z.text.placed||R.icon!==z.icon.placed):(this.opacities[M]=new Xn(null,g,R.text,R.icon,R.skipFade),m=m||R.text||R.icon)}for(const M in v){const R=v[M];if(!this.opacities[M]){const z=new Xn(R,g,!1,!1);z.isHidden()||(this.opacities[M]=z,m=m||R.text.placed||R.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 L)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=L[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const m={};for(const g of f){const v=g.getBucket(s);v&&g.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,m,g.collisionBoxArray)}}updateBucketOpacities(s,f,m){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],v=g.layout,C=new Xn(null,0,!1,!1,!0),L=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),R=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._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",ue=new Xn(null,0,L&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(L||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&m&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(m);const le=(fe,te,xe)=>{for(let Be=0;Be0,je=this.placedOrientations[te.crossTileID],Xe=je===l.ah.vertical,tt=je===l.ah.horizontal||je===l.ah.horizontalOnly;if(xe>0||Be>0){const $e=_o(Pe.text);le(s.text,xe,Xe?$u:$e),le(s.text,Be,tt?$u:$e);const ut=Pe.text.isHidden();[te.rightJustifiedTextSymbolIndex,te.centerJustifiedTextSymbolIndex,te.leftJustifiedTextSymbolIndex].forEach(dt=>{dt>=0&&(s.text.placedSymbolArray.get(dt).hidden=ut||Xe?1:0)}),te.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(te.verticalPlacedTextSymbolIndex).hidden=ut||tt?1:0);const pt=this.variableOffsets[te.crossTileID];pt&&this.markUsedJustification(s,pt.anchor,te,je);const sn=this.placedOrientations[te.crossTileID];sn&&(this.markUsedJustification(s,"left",te,sn),this.markUsedOrientation(s,sn,te))}if(Ve){const $e=_o(Pe.icon),ut=!(Z&&te.verticalPlacedIconSymbolIndex&&Xe);te.placedIconSymbolIndex>=0&&(le(s.icon,te.numIconVertices,ut?$e:$u),s.icon.placedSymbolArray.get(te.placedIconSymbolIndex).hidden=Pe.icon.isHidden()),te.verticalPlacedIconSymbolIndex>=0&&(le(s.icon,te.numVerticalIconVertices,ut?$u:$e),s.icon.placedSymbolArray.get(te.verticalPlacedIconSymbolIndex).hidden=Pe.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $e=s.collisionArrays[fe];if($e){let ut=new l.P(0,0);if($e.textBox||$e.verticalTextBox){let sn=!0;if(R){const dt=this.variableOffsets[de];dt?(ut=ai(dt.anchor,dt.width,dt.height,dt.textOffset,dt.textBoxScale),z&&ut._rotate(F?this.transform.angle:-this.transform.angle)):sn=!1}$e.textBox&&xi(s.textCollisionBox.collisionVertexArray,Pe.text.placed,!sn||Xe,ut.x,ut.y),$e.verticalTextBox&&xi(s.textCollisionBox.collisionVertexArray,Pe.text.placed,!sn||tt,ut.x,ut.y)}const pt=!!(!tt&&$e.verticalIconBox);$e.iconBox&&xi(s.iconCollisionBox.collisionVertexArray,Pe.icon.placed,pt,Z?ut.x:0,Z?ut.y:0),$e.verticalIconBox&&xi(s.iconCollisionBox.collisionVertexArray,Pe.icon.placed,!pt,Z?ut.x:0,Z?ut.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 fe=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=fe.invProjMatrix,s.placementViewportMatrix=fe.viewportMatrix,s.collisionCircleArray=fe.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 xi(y,s,f,m,g){y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0)}const Vs=Math.pow(2,25),lm=Math.pow(2,24),Y_=Math.pow(2,17),jn=Math.pow(2,16),op=Math.pow(2,9),sp=Math.pow(2,8),Ro=Math.pow(2,1);function _o(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,f=Math.floor(127*y.opacity);return f*Vs+s*lm+f*Y_+s*jn+f*op+s*sp+f*Ro+s}const $u=0;class es{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,m,g,v){const C=this._bucketParts;for(;this._currentTileIndexL.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-g>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=L)&&(!C.maxzoom||C.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new es(C)),this._inProgressLayer.continuePlacement(m[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 uu=512/l.W/2;class th{constructor(s,f,m){this.tileID=s,this.bucketInstanceId=m,this._symbolsByKey={};const g=new Map;for(let v=0;v({x:Math.floor(M.anchorX*uu),y:Math.floor(M.anchorY*uu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(L.positions.length>128){const M=new l.au(L.positions.length,16,Uint16Array);for(const{x:R,y:z}of L.positions)M.add(R,z);M.finish(),delete L.positions,L.index=M}this._symbolsByKey[v]=L}}getScaledCoordinates(s,f){const{x:m,y:g,z:v}=this.tileID.canonical,{x:C,y:L,z:M}=f.canonical,R=uu/Math.pow(2,M-v),z=(L*l.W+s.anchorY)*R,F=g*l.W*uu;return{x:Math.floor((C*l.W+s.anchorX)*R-m*l.W*uu),y:Math.floor(z-F)}}findMatches(s,f,m){const g=this.tileID.canonical.zs)}}class ni{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ec{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const m in this.indexes){const g=this.indexes[m],v={};for(const C in g){const L=g[C];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+f),v[L.tileID.key]=L}this.indexes[m]=v}this.lng=s}addBucket(s,f,m){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 L in C){const M=C[L];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,g)}else{const L=C[s.scaledTo(Number(v)).key];L&&L.findMatches(f.symbolInstances,s,g)}}for(let v=0;v{f[m]=!0});for(const m in this.layerIndexes)f[m]||delete this.layerIndexes[m]}}const yr=(y,s)=>l.t(y,s&&s.filter(f=>f.identifier!=="source.canvas")),nh=l.av();class No extends l.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const g=this.sourceCaches[m].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[m].reload()}},this.map=s,this.dispatcher=new ir(Bn(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,g)=>this.getGlyphs(m,g)),this.dispatcher.registerMessageHandler("GI",(m,g)=>this.getImages(m,g)),this.imageManager=new He,this.imageManager.setEventedParent(this),this.glyphManager=new qe(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Xt(256,512),this.crossTileSymbolIndex=new Za,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ax()),at().on(Ai,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const g=this.sourceCaches[m.sourceId];if(!g)return;const v=g.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const L=this._layers[C];L.source===v.id&&this._validateLayer(L)}})}loadURL(s,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,l.h(g,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,m)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new l.j(v))})}loadJSON(s,f={},m){this.fire(new l.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,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(nh,{validate:!1})}_load(s,f,m){var g;const v=f.transformStyle?f.transformStyle(m,s):s;if(!f.validate||!yr(this,l.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 Zt(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const s=l.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 m=l.az(f);m.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=m}}_loadSprite(s,f=!1,m=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,L,M){return l._(this,void 0,void 0,function*(){const R=Ae(v),z=L>1?"@2x":"",F={},Z={};for(const{id:ue,url:le}of R){const fe=C.transformRequest(C.normalizeSpriteURL(le,z,".json"),"SpriteJSON");F[ue]=l.h(fe,M);const te=C.transformRequest(C.normalizeSpriteURL(le,z,".png"),"SpriteImage");Z[ue]=j.getImage(te,M)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(ue,le){return l._(this,void 0,void 0,function*(){const fe={};for(const te in ue){fe[te]={};const xe=I.getImageCanvasContext((yield le[te]).data),Be=(yield ue[te]).data;for(const de in Be){const{width:Pe,height:Ve,x:je,y:Xe,sdf:tt,pixelRatio:$e,stretchX:ut,stretchY:pt,content:sn}=Be[de];fe[te][de]={data:null,pixelRatio:$e,sdf:tt,stretchX:ut,stretchY:pt,content:sn,spriteData:{width:Pe,height:Ve,x:je,y:Xe,context:xe}}}}return fe})}(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 L=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of L)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const R=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,v[C][M],!1):this.imageManager.addImage(R,v[C][M]),f&&(this._changedImages[R]=!0)}}}).catch(v=>{this._spriteRequest=null,g=v,this.fire(new l.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const m=s.sourceLayer;if(!m)return;const g=f.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const m=[];for(const g of s)f[g]&&m.push(f[g]);return m}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const m of f){const g=this._layers[m];g.type!=="custom"&&(s[m]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const g=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(g.length||v.length)&&this._updateWorkerLayers(g,v);for(const C in this._updatedSources){const L=this._updatedSources[C];if(L==="reload")this._reloadSource(C);else{if(L!=="clear")throw new Error(`Invalid action ${L}`);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 m={};for(const g in this.sourceCaches){const v=this.sourceCaches[g];m[g]=v.used,v.used=!1}for(const g of this._order){const v=this._layers[g];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const g in m){const v=this.sourceCaches[g];!!m[g]!=!!v.used&&v.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new l.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 m;this._checkLoaded();const g=this.serialize();if(s=f.transformStyle?f.transformStyle(g,s):s,((m=f.validate)===null||m===void 0||m)&&yr(this,l.x(s)))return!1;(s=l.aA(s)).layers=l.ay(s.layers);const v=l.aB(g,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 L of C.operations)L();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],m=[];for(const g of s)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":f.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":f.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":f.push(()=>{});break;default:m.push(g.command)}return{operations:f,unimplemented:m}}addImage(s,f){if(this.getImage(s))return this.fire(new l.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 l.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 l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,m={}){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(l.x.source,`sources.${s}`,f,null,m))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[s]=new ei(s,f,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===s)return this.fire(new l.j(new Error(`Source "${s}" cannot be removed while layer "${m}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new l.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 m=this.sourceCaches[s].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,m={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new l.j(new Error(`Layer "${g}" already exists on this map.`)));let v;if(s.type==="custom"){if(yr(this,l.aC(s)))return;v=l.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=l.aA(s),s=l.e(s,{source:g})),this._validate(l.x.layer,`layers.${g}`,s,{arrayIndex:-1},m))return;v=l.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:g}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new l.j(new Error(`Cannot add layer "${g}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,g),this._layerOrderChanged=!0,this._layers[g]=v,this._removedLayers[g]&&v.source&&v.type!=="custom"){const L=this._removedLayers[g];delete this._removedLayers[g],L.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 l.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const m=this._order.indexOf(s);this._order.splice(m,1);const g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new l.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const m=this._order.indexOf(s);this._order.splice(m,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,m){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===f&&g.maxzoom===m||(f!=null&&(g.minzoom=f),m!=null&&(g.maxzoom=m),this._updateLayer(g)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,m={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!l.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(l.x.filter,`layers.${g.id}.filter`,f,null,m)||(g.filter=l.aA(f),this._updateLayer(g)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return l.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,m,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getLayoutProperty(f),m)||(v.setLayoutProperty(f,m,g),this._updateLayer(v)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const m=this.getLayer(s);if(m)return m.getLayoutProperty(f);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,m,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getPaintProperty(f),m)||(v.setPaintProperty(f,m,g)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const m=s.source,g=s.sourceLayer,v=this.sourceCaches[m];if(v===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&g?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||g?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(g,s.id,f)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const m=s.source,g=this.sourceCaches[m];if(g===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const v=g.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(C,s.id,f):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,m=s.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||m?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(m,s.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=l.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),m=this.map.getTerrain()||void 0,g=this.stylesheet;return l.aF({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:f,terrain:m},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",m={},g=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L)){m[L]=C;for(const M of s){const R=M[L];if(R)for(const z of R)g.push(z)}}}g.sort((C,L)=>L.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L))for(let M=g.length-1;M>=0;M--){const R=g[M].feature;if(m[R.layer.id]{const tt=xe.featureSortOrder;if(tt){const $e=tt.indexOf(je.featureIndex);return tt.indexOf(Xe.featureIndex)-$e}return Xe.featureIndex-je.featureIndex});for(const je of Ve)Pe.push(je)}}for(const xe in le)le[xe].forEach(Be=>{const de=Be.feature,Pe=R[L[xe].source].getFeatureState(de.layer["source-layer"],de.id);de.source=de.layer.source,de.layer["source-layer"]&&(de.sourceLayer=de.layer["source-layer"]),de.state=Pe});return le}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(l.x.filter,"querySourceFeatures.filter",f.filter,null,f);const m=this.sourceCaches[s];return m?function(g,v){const C=g.getRenderableIds().map(R=>g.getTileByID(R)),L=[],M={};for(let R=0;RZ.getTileByID(ue)).sort((ue,le)=>le.tileID.overscaledZ-ue.tileID.overscaledZ||(ue.tileID.isLessThan(le.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||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new ts(s,this.map.terrain,this._order,v,f,m,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(I.now()),L=!0),C&&this.pauseablePlacement.placement.setStale()),L||C)for(const R of this._order){const z=this._layers[R];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 l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,f.icons),m})}getGlyphs(s,f){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(f.stacks),g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(l.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,m={},g){this._checkLoaded();const v=[{id:s,url:f}],C=[...Ae(this.stylesheet.sprite),...v];this._validate(l.x.sprite,"sprite",C,null,m)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,g))}removeSprite(s){this._checkLoaded();const f=Ae(this.stylesheet.sprite);if(f.find(m=>m.id===s)){if(this._spritesImagesIds[s])for(const m of this._spritesImagesIds[s])this.imageManager.removeImage(m),this._changedImages[m]=!0;f.splice(f.findIndex(m=>m.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 l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ae(this.stylesheet.sprite)}setSprite(s,f={},m){this._checkLoaded(),s&&this._validate(l.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,m):(this._unloadSprite(),m&&m(null)))}}var rh=l.X([{name:"a_pos",type:"Int16",components:2}]),Us="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 tc={prelude:qn(`#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:qn(`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:qn(`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:qn(`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:qn("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:qn(`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:qn(`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:qn("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:qn("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:qn("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:qn(`#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:qn(`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:qn(`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:qn(`#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:qn(`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:qn(`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:qn(`#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:qn(`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:qn(`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:qn(`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:qn(`#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:qn(`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:qn(`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:qn(`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:qn(`#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:qn(`#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:qn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Us),terrainDepth:qn("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);}",Us),terrainCoords:qn("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);}",Us)};function qn(y,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(g):g,L={};return{fragmentSource:y=y.replace(f,(M,R,z,F,Z)=>(L[Z]=!0,R==="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,R,z,F,Z)=>{const ue=F==="float"?"vec2":"vec4",le=Z.match(/color/)?"color":ue;return L[Z]?R==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +uniform lowp float u_${Z}_t; +attribute ${z} ${ue} a_${Z}; +varying ${z} ${F} ${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:le==="vec4"?` +#ifndef HAS_UNIFORM_u_${Z} + ${Z} = a_${Z}; +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Z} + ${Z} = unpack_mix_${le}(a_${Z}, u_${Z}_t); +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:R==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +uniform lowp float u_${Z}_t; +attribute ${z} ${ue} a_${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:le==="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_${le}(a_${Z}, u_${Z}_t); +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`}),staticAttributes:m,staticUniforms:C}}class ih{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,m,g,v,C,L,M,R){this.context=s;let z=this.boundPaintVertexBuffers.length!==g.length;for(let F=0;!z&&F({u_depth:new l.aG(je,Xe.u_depth),u_terrain:new l.aG(je,Xe.u_terrain),u_terrain_dim:new l.aH(je,Xe.u_terrain_dim),u_terrain_matrix:new l.aI(je,Xe.u_terrain_matrix),u_terrain_unpack:new l.aJ(je,Xe.u_terrain_unpack),u_terrain_exaggeration:new l.aH(je,Xe.u_terrain_exaggeration)}))(s,Ve),this.binderUniforms=m?m.getUniforms(s,Ve):[]}draw(s,f,m,g,v,C,L,M,R,z,F,Z,ue,le,fe,te,xe,Be){const de=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(m),s.setStencilMode(g),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(de.TEXTURE2),de.bindTexture(de.TEXTURE_2D,M.depthTexture),s.activeTexture.set(de.TEXTURE3),de.bindTexture(de.TEXTURE_2D,M.texture);for(const Ve in this.terrainUniforms)this.terrainUniforms[Ve].set(M[Ve])}for(const Ve in this.fixedUniforms)this.fixedUniforms[Ve].set(L[Ve]);fe&&fe.setUniforms(s,this.binderUniforms,ue,{zoom:le});let Pe=0;switch(f){case de.LINES:Pe=2;break;case de.TRIANGLES:Pe=3;break;case de.LINE_STRIP:Pe=1}for(const Ve of Z.get()){const je=Ve.vaos||(Ve.vaos={});(je[R]||(je[R]=new ih)).bind(s,this,z,fe?fe.getPaintVertexBuffers():[],F,Ve.vertexOffset,te,xe,Be),de.drawElements(f,Ve.primitiveLength*Pe,de.UNSIGNED_SHORT,Ve.primitiveOffset*Pe*2)}}}function oh(y,s,f){const m=1/Qt(f,1,s.transform.tileZoom),g=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/g,C=v*(f.tileID.canonical.x+f.tileID.wrap*g),L=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[m,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[C>>16,L>>16],u_pixel_coord_lower:[65535&C,65535&L]}}const nc=(y,s,f,m)=>{const g=s.style.light,v=g.properties.get("position"),C=[v.x,v.y,v.z],L=function(){var R=new l.A(9);return l.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();g.properties.get("anchor")==="viewport"&&function(R,z){var F=Math.sin(z),Z=Math.cos(z);R[0]=Z,R[1]=F,R[2]=0,R[3]=-F,R[4]=Z,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(L,-s.transform.angle),function(R,z,F){var Z=z[0],ue=z[1],le=z[2];R[0]=Z*F[0]+ue*F[3]+le*F[6],R[1]=Z*F[1]+ue*F[4]+le*F[7],R[2]=Z*F[2]+ue*F[5]+le*F[8]}(C,C,L);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:C,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:m}},K_=(y,s,f,m,g,v,C)=>l.e(nc(y,s,f,m),oh(v,s,C),{u_height_factor:-Math.pow(2,g.overscaledZ)/C.tileSize/8}),um=y=>({u_matrix:y}),sh=(y,s,f,m)=>l.e(um(y),oh(f,s,m)),J_=(y,s)=>({u_matrix:y,u_world:s}),cm=(y,s,f,m,g)=>l.e(sh(y,s,f,m),{u_world:g}),Q_=(y,s,f,m)=>{const g=y.transform;let v,C;if(m.paint.get("circle-pitch-alignment")==="map"){const L=Qt(f,1,g.zoom);v=!0,C=[L,L]}else v=!1,C=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,f,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:C}},hm=(y,s,f)=>{const m=Qt(f,1,s.zoom),g=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[s.pixelsToGLUnits[0]/(m*g),s.pixelsToGLUnits[1]/(m*g)],u_overscale_factor:v}},fm=(y,s,f=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:f}),ah=y=>({u_matrix:y}),pm=(y,s,f,m)=>({u_matrix:y,u_extrude_scale:Qt(s,1,f),u_intensity:m});function dm(y,s){const f=Math.pow(2,s.canonical.z),m=s.canonical.y;return[new l.Y(0,m/f).toLngLat().lat,new l.Y(0,(m+1)/f).toLngLat().lat]}const lh=(y,s,f,m)=>{const g=y.transform;return{u_matrix:rc(y,s,f,m),u_ratio:1/Qt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},mm=(y,s,f,m,g)=>l.e(lh(y,s,f,g),{u_image:0,u_image_height:m}),Ll=(y,s,f,m,g)=>{const v=y.transform,C=Oo(s,v);return{u_matrix:rc(y,s,f,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Qt(s,1,v.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[C,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},uh=(y,s,f,m,g,v)=>{const C=y.lineAtlas,L=Oo(s,y.transform),M=f.layout.get("line-cap")==="round",R=C.getDash(m.from,M),z=C.getDash(m.to,M),F=R.width*g.fromScale,Z=z.width*g.toScale;return l.e(lh(y,s,f,v),{u_patternscale_a:[L/F,-R.height/2],u_patternscale_b:[L/Z,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,Z)*y.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:z.y,u_mix:g.t})};function Oo(y,s){return 1/Qt(y,1,s.tileZoom)}function rc(y,s,f,m){return y.translatePosMatrix(m?m.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const ch=(y,s,f,m,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(C=g.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=g.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:ic(g.paint.get("raster-hue-rotate"))};var v,C};function ic(y){y*=Math.PI/180;const s=Math.sin(y),f=Math.cos(y);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const oc=(y,s,f,m,g,v,C,L,M,R)=>{const z=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:L,u_is_text:+M,u_pitch_with_map:+m,u_texsize:R,u_texture:0}},sc=(y,s,f,m,g,v,C,L,M,R,z)=>{const F=g.transform;return l.e(oc(y,s,f,m,g,v,C,L,M,R),{u_gamma_scale:m?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+z})},ac=(y,s,f,m,g,v,C,L,M,R)=>l.e(sc(y,s,f,m,g,v,C,L,!0,M,!0),{u_texsize_icon:R,u_texture_icon:1}),$_=(y,s,f)=>({u_matrix:y,u_opacity:s,u_color:f}),ey=(y,s,f,m,g,v)=>l.e(function(C,L,M,R){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:Z,height:ue}=M.imageManager.getPixelSize(),le=Math.pow(2,R.tileID.overscaledZ),fe=R.tileSize*Math.pow(2,M.transform.tileZoom)/le,te=fe*(R.tileID.canonical.x+R.tileID.wrap*le),xe=fe*R.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,ue],u_mix:L.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Qt(R,1,M.transform.tileZoom),u_pixel_coord_upper:[te>>16,xe>>16],u_pixel_coord_lower:[65535&te,65535&xe]}}(m,v,f,g),{u_matrix:y,u_opacity:s}),gm={fillExtrusion:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_opacity:new l.aH(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_height_factor:new l.aH(y,s.u_height_factor),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade),u_opacity:new l.aH(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_scale_with_map:new l.aG(y,s.u_scale_with_map),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_matrix:new l.aI(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(y,s.u_pixels_to_tile_units),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_overscale_factor:new l.aH(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_inv_matrix:new l.aI(y,s.u_inv_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_viewport_size:new l.aL(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new l.aM(y,s.u_color),u_matrix:new l.aI(y,s.u_matrix),u_overlay:new l.aG(y,s.u_overlay),u_overlay_scale:new l.aH(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new l.aH(y,s.u_extrude_scale),u_intensity:new l.aH(y,s.u_intensity),u_matrix:new l.aI(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_color_ramp:new l.aG(y,s.u_color_ramp),u_opacity:new l.aH(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_latrange:new l.aL(y,s.u_latrange),u_light:new l.aL(y,s.u_light),u_shadow:new l.aM(y,s.u_shadow),u_highlight:new l.aM(y,s.u_highlight),u_accent:new l.aM(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_dimension:new l.aL(y,s.u_dimension),u_zoom:new l.aH(y,s.u_zoom),u_unpack:new l.aJ(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_image:new l.aG(y,s.u_image),u_image_height:new l.aH(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texsize:new l.aL(y,s.u_texsize),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_image:new l.aG(y,s.u_image),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_patternscale_a:new l.aL(y,s.u_patternscale_a),u_patternscale_b:new l.aL(y,s.u_patternscale_b),u_sdfgamma:new l.aH(y,s.u_sdfgamma),u_image:new l.aG(y,s.u_image),u_tex_y_a:new l.aH(y,s.u_tex_y_a),u_tex_y_b:new l.aH(y,s.u_tex_y_b),u_mix:new l.aH(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_tl_parent:new l.aL(y,s.u_tl_parent),u_scale_parent:new l.aH(y,s.u_scale_parent),u_buffer_scale:new l.aH(y,s.u_buffer_scale),u_fade_t:new l.aH(y,s.u_fade_t),u_opacity:new l.aH(y,s.u_opacity),u_image0:new l.aG(y,s.u_image0),u_image1:new l.aG(y,s.u_image1),u_brightness_low:new l.aH(y,s.u_brightness_low),u_brightness_high:new l.aH(y,s.u_brightness_high),u_saturation_factor:new l.aH(y,s.u_saturation_factor),u_contrast_factor:new l.aH(y,s.u_contrast_factor),u_spin_weights:new l.aK(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texsize_icon:new l.aL(y,s.u_texsize_icon),u_texture:new l.aG(y,s.u_texture),u_texture_icon:new l.aG(y,s.u_texture_icon),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_color:new l.aM(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_image:new l.aG(y,s.u_image),u_pattern_tl_a:new l.aL(y,s.u_pattern_tl_a),u_pattern_br_a:new l.aL(y,s.u_pattern_br_a),u_pattern_tl_b:new l.aL(y,s.u_pattern_tl_b),u_pattern_br_b:new l.aL(y,s.u_pattern_br_b),u_texsize:new l.aL(y,s.u_texsize),u_mix:new l.aH(y,s.u_mix),u_pattern_size_a:new l.aL(y,s.u_pattern_size_a),u_pattern_size_b:new l.aL(y,s.u_pattern_size_b),u_scale_a:new l.aH(y,s.u_scale_a),u_scale_b:new l.aH(y,s.u_scale_b),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_terrain_coords_id:new l.aH(y,s.u_terrain_coords_id),u_ele_delta:new l.aH(y,s.u_ele_delta)})};class ty{constructor(s,f,m){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.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 Pl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class hh{constructor(s,f,m,g){this.length=f.length,this.attributes=m,this.itemSize=f.bytesPerElement,this.dynamicDraw=g,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 m=0;m0){const ut=l.F(),pt=Xe;l.aP(ut,je.placementInvProjMatrix,y.transform.glCoordMatrix),l.aP(ut,ut,je.placementViewportMatrix),z.push({circleArray:$e,circleOffset:Z,transform:pt,invTransform:ut,coord:Pe}),F+=$e.length/4,Z=F}tt&&R.draw(L,M.LINES,In.disabled,sr.disabled,y.colorModeForRenderPass(),$n.disabled,hm(Xe,y.transform,Ve),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pe),f.id,tt.layoutVertexBuffer,tt.indexBuffer,tt.segments,null,y.transform.zoom,null,null,tt.collisionVertexBuffer)}if(!C||!z.length)return;const ue=y.useProgram("collisionCircle"),le=new l.aQ;le.resize(4*F),le._trim();let fe=0;for(const de of z)for(let Pe=0;Pe=0&&(le[te.associatedIconIndex]={shiftedAnchor:sn,angle:dt})}else Ye(te.numGlyphs,Z)}if(R){ue.clear();const fe=y.icon.placedSymbolArray;for(let te=0;tey.style.map.terrain.getElevation(tt,rs,oi):null,xr=f.layout.get("text-rotation-alignment")==="map";W(ut,tt.posMatrix,y,g,Fo,Ws,te,R,xr,ii)}const el=y.translatePosMatrix(tt.posMatrix,$e,v,C),Hs=xe||g&&je||xc?_p:Fo,ri=y.translatePosMatrix(Ws,$e,v,C,!0),br=dt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let pr;pr=dt?ut.iconsInText?ac(Ut.kind,Ht,Be,te,y,el,Hs,ri,pn,li):sc(Ut.kind,Ht,Be,te,y,el,Hs,ri,g,pn,!0):oc(Ut.kind,Ht,Be,te,y,el,Hs,ri,g,pn);const ns={program:Cn,buffers:pt,uniformValues:pr,atlasTexture:Lr,atlasTextureIcon:vr,atlasInterpolation:Wn,atlasInterpolationIcon:zo,isSDF:dt,hasHalo:br};if(de&&ut.canOverlap){Pe=!0;const ii=pt.segments.get();for(const xr of ii)Xe.push({segments:new l.$([xr]),sortKey:xr.sortKey,state:ns,terrainData:hn})}else Xe.push({segments:pt.segments,sortKey:0,state:ns,terrainData:hn})}Pe&&Xe.sort((tt,$e)=>tt.sortKey-$e.sortKey);for(const tt of Xe){const $e=tt.state;if(Z.activeTexture.set(ue.TEXTURE0),$e.atlasTexture.bind($e.atlasInterpolation,ue.CLAMP_TO_EDGE),$e.atlasTextureIcon&&(Z.activeTexture.set(ue.TEXTURE1),$e.atlasTextureIcon&&$e.atlasTextureIcon.bind($e.atlasInterpolationIcon,ue.CLAMP_TO_EDGE)),$e.isSDF){const ut=$e.uniformValues;$e.hasHalo&&(ut.u_is_halo=1,Im($e.buffers,tt.segments,f,y,$e.program,Ve,z,F,ut,tt.terrainData)),ut.u_is_halo=0}Im($e.buffers,tt.segments,f,y,$e.program,Ve,z,F,$e.uniformValues,tt.terrainData)}}function Im(y,s,f,m,g,v,C,L,M,R){const z=m.context;g.draw(z,z.gl.TRIANGLES,v,C,L,$n.disabled,M,R,f.id,y.layoutVertexBuffer,y.indexBuffer,s,f.paint,m.transform.zoom,y.programConfigurations.get(f.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function wh(y,s,f,m,g){if(!f||!m||!m.imageAtlas)return;const v=m.imageAtlas.patternPositions;let C=v[f.to.toString()],L=v[f.from.toString()];if(!C&&L&&(C=L),!L&&C&&(L=C),!C||!L){const M=g.getPaintProperty(s);C=v[M],L=v[M]}C&&L&&y.setConstantPatternPositions(C,L)}function Cm(y,s,f,m,g,v,C){const L=y.context.gl,M="fill-pattern",R=f.paint.get(M),z=R&&R.constantOr(1),F=f.getCrossfadeParameters();let Z,ue,le,fe,te;C?(ue=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=L.LINES):(ue=z?"fillPattern":"fill",Z=L.TRIANGLES);const xe=R.constantOr(null);for(const Be of m){const de=s.getTile(Be);if(z&&!de.patternsLoaded())continue;const Pe=de.getBucket(f);if(!Pe)continue;const Ve=Pe.programConfigurations.get(f.id),je=y.useProgram(ue,Ve),Xe=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Be);z&&(y.context.activeTexture.set(L.TEXTURE0),de.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ve.updatePaintBuffers(F)),wh(Ve,M,xe,de,f);const tt=Xe?Be:null,$e=y.translatePosMatrix(tt?tt.posMatrix:Be.posMatrix,de,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){fe=Pe.indexBuffer2,te=Pe.segments2;const ut=[L.drawingBufferWidth,L.drawingBufferHeight];le=ue==="fillOutlinePattern"&&z?cm($e,y,F,de,ut):J_($e,ut)}else fe=Pe.indexBuffer,te=Pe.segments,le=z?sh($e,y,F,de):um($e);je.draw(y.context,Z,g,y.stencilModeForClipping(Be),v,$n.disabled,le,Xe,f.id,Pe.layoutVertexBuffer,fe,te,f.paint,y.transform.zoom,Ve)}}function Sh(y,s,f,m,g,v,C){const L=y.context,M=L.gl,R="fill-extrusion-pattern",z=f.paint.get(R),F=z.constantOr(1),Z=f.getCrossfadeParameters(),ue=f.paint.get("fill-extrusion-opacity"),le=z.constantOr(null);for(const fe of m){const te=s.getTile(fe),xe=te.getBucket(f);if(!xe)continue;const Be=y.style.map.terrain&&y.style.map.terrain.getTerrainData(fe),de=xe.programConfigurations.get(f.id),Pe=y.useProgram(F?"fillExtrusionPattern":"fillExtrusion",de);F&&(y.context.activeTexture.set(M.TEXTURE0),te.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),de.updatePaintBuffers(Z)),wh(de,R,le,te,f);const Ve=y.translatePosMatrix(fe.posMatrix,te,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),je=f.paint.get("fill-extrusion-vertical-gradient"),Xe=F?K_(Ve,y,je,ue,fe,Z,te):nc(Ve,y,je,ue);Pe.draw(L,L.gl.TRIANGLES,g,v,C,$n.backCCW,Xe,Be,f.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,f.paint,y.transform.zoom,de,y.style.map.terrain&&xe.centroidVertexBuffer)}}function Eh(y,s,f,m,g,v,C){const L=y.context,M=L.gl,R=f.fbo;if(!R)return;const z=y.useProgram("hillshade"),F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,R.colorAttachment.get()),z.draw(L,M.TRIANGLES,g,v,C,$n.disabled,((Z,ue,le,fe)=>{const te=le.paint.get("hillshade-shadow-color"),xe=le.paint.get("hillshade-highlight-color"),Be=le.paint.get("hillshade-accent-color");let de=le.paint.get("hillshade-illumination-direction")*(Math.PI/180);le.paint.get("hillshade-illumination-anchor")==="viewport"&&(de-=Z.transform.angle);const Pe=!Z.options.moving;return{u_matrix:fe?fe.posMatrix:Z.transform.calculatePosMatrix(ue.tileID.toUnwrapped(),Pe),u_image:0,u_latrange:dm(0,ue.tileID),u_light:[le.paint.get("hillshade-exaggeration"),de],u_shadow:te,u_highlight:xe,u_accent:Be}})(y,f,m,F?s:null),F,m.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function yp(y,s,f,m,g,v){const C=y.context,L=C.gl,M=s.dem;if(M&&M.data){const R=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(L.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(z),s.demTexture){const ue=s.demTexture;ue.update(F,{premultiply:!1}),ue.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else s.demTexture=new Y(C,F,L.RGBA,{premultiply:!1}),s.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);C.activeTexture.set(L.TEXTURE0);let Z=s.fbo;if(!Z){const ue=new Y(C,{width:R,height:R,data:null},L.RGBA);ue.bind(L.LINEAR,L.CLAMP_TO_EDGE),Z=s.fbo=C.createFramebuffer(R,R,!0,!1),Z.colorAttachment.set(ue.texture)}C.bindFramebuffer.set(Z.framebuffer),C.viewport.set([0,0,R,R]),y.useProgram("hillshadePrepare").draw(C,L.TRIANGLES,m,g,v,$n.disabled,((ue,le)=>{const fe=le.stride,te=l.F();return l.aN(te,0,l.W,-l.W,0,0,1),l.H(te,te,[0,-l.W,0]),{u_matrix:te,u_image:1,u_dimension:[fe,fe],u_zoom:ue.overscaledZ,u_unpack:le.getUnpackVector()}})(s.tileID,M),null,f.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Tm(y,s,f,m,g,v){const C=m.paint.get("raster-fade-duration");if(!v&&C>0){const L=I.now(),M=(L-y.timeAdded)/C,R=s?(L-s.timeAdded)/C:-1,z=f.getSource(),F=g.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),Z=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(y.tileID.overscaledZ-F),ue=Z&&y.refreshedUponExpiration?1:l.ac(Z?M:1-R,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-ue}:{opacity:ue,mix:0}}return{opacity:1,mix:0}}const Lm=new l.aO(1,0,0,1),Ih=new l.aO(0,1,0,1),vp=new l.aO(0,0,1,1),cy=new l.aO(1,0,1,1),Pm=new l.aO(0,1,1,1);function Cr(y,s,f,m){no(y,0,s+f/2,y.transform.width,f,m)}function Ya(y,s,f,m){no(y,s-f/2,0,f,y.transform.height,m)}function no(y,s,f,m,g,v){const C=y.context,L=C.gl;L.enable(L.SCISSOR_TEST),L.scissor(s*y.pixelRatio,f*y.pixelRatio,m*y.pixelRatio,g*y.pixelRatio),C.clear({color:v}),L.disable(L.SCISSOR_TEST)}function bp(y,s,f){const m=y.context,g=m.gl,v=f.posMatrix,C=y.useProgram("debug"),L=In.disabled,M=sr.disabled,R=y.colorModeForRenderPass(),z="$debug",F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(f);m.activeTexture.set(g.TEXTURE0);const Z=s.getTileByID(f.key).latestRawTileData,ue=Math.floor((Z&&Z.byteLength||0)/1024),le=s.getTile(f).tileSize,fe=512/Math.min(le,512)*(f.overscaledZ/y.transform.zoom)*.5;let te=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(te+=` => ${f.overscaledZ}`),function(xe,Be){xe.initDebugOverlayCanvas();const de=xe.debugOverlayCanvas,Pe=xe.context.gl,Ve=xe.debugOverlayCanvas.getContext("2d");Ve.clearRect(0,0,de.width,de.height),Ve.shadowColor="white",Ve.shadowBlur=2,Ve.lineWidth=1.5,Ve.strokeStyle="white",Ve.textBaseline="top",Ve.font="bold 36px Open Sans, sans-serif",Ve.fillText(Be,5,5),Ve.strokeText(Be,5,5),xe.debugOverlayTexture.update(de),xe.debugOverlayTexture.bind(Pe.LINEAR,Pe.CLAMP_TO_EDGE)}(y,`${te} ${ue}kB`),C.draw(m,g.TRIANGLES,L,M,Ur.alphaBlended,$n.disabled,fm(v,l.aO.transparent,fe),null,z,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),C.draw(m,g.LINE_STRIP,L,M,R,$n.disabled,fm(v,l.aO.red),F,z,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Ch(y,s,f){const m=y.context,g=m.gl,v=y.colorModeForRenderPass(),C=new In(g.LEQUAL,In.ReadWrite,y.depthRangeFor3D),L=y.useProgram("terrain"),M=s.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,y.width,y.height]);for(const R of f){const z=y.renderToTexture.getTexture(R),F=s.getTerrainData(R.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,z.texture);const Z={u_matrix:y.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};L.draw(m,g.TRIANGLES,C,sr.disabled,v,$n.backCCW,Z,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Mm{constructor(s,f){this.context=new uy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ei.maxUnderzooming+ei.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Za}resize(s,f,m){if(this.width=Math.floor(s*m),this.height=Math.floor(f*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,f=new l.aV;f.emplaceBack(0,0),f.emplaceBack(l.W,0),f.emplaceBack(0,l.W),f.emplaceBack(l.W,l.W),this.tileExtentBuffer=s.createVertexBuffer(f,rh.members),this.tileExtentSegments=l.$.simpleSegment(0,0,4,2);const m=new l.aV;m.emplaceBack(0,0),m.emplaceBack(l.W,0),m.emplaceBack(0,l.W),m.emplaceBack(l.W,l.W),this.debugBuffer=s.createVertexBuffer(m,rh.members),this.debugSegments=l.$.simpleSegment(0,0,4,5);const g=new l.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(l.W,0,l.W,0),g.emplaceBack(0,l.W,0,l.W),g.emplaceBack(l.W,l.W,l.W,l.W),this.rasterBoundsBuffer=s.createVertexBuffer(g,fn.members),this.rasterBoundsSegments=l.$.simpleSegment(0,0,4,2);const v=new l.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,rh.members),this.viewportSegments=l.$.simpleSegment(0,0,4,2);const C=new l.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const L=new l.aX;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(L);const M=this.context.gl;this.stencilClearMode=new sr({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 m=l.F();l.aN(m,0,this.width,this.height,0,0,1),l.J(m,m,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,In.disabled,this.stencilClearMode,Ur.disabled,$n.disabled,ah(m),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 m=this.context,g=m.gl;this.nextStencilID+f.length>256&&this.clearStencil(),m.setColorMode(Ur.disabled),m.setDepthMode(In.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const L=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(m,g.TRIANGLES,In.disabled,new sr({func:g.ALWAYS,mask:0},L,255,g.KEEP,g.KEEP,g.REPLACE),Ur.disabled,$n.disabled,ah(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 sr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new sr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,m=s.sort((C,L)=>L.overscaledZ-C.overscaledZ),g=m[m.length-1].overscaledZ,v=m[0].overscaledZ-g+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let L=0;L=0;this.currentLayer--){const M=this.style._layers[m[this.currentLayer]],R=g[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,R,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerte.source&&!te.isHidden(z)?[R.sourceCaches[te.source]]:[]),ue=Z.filter(te=>te.getSource().type==="vector"),le=Z.filter(te=>te.getSource().type!=="vector"),fe=te=>{(!F||F.getSource().maxzoomfe(te)),F||le.forEach(te=>fe(te)),F}(this.style,this.transform.zoom);M&&function(R,z,F){for(let Z=0;Z0),g&&(l.a_(f,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.sourceCache.getRenderableTiles(),ue=v.useProgram("terrainDepth");L.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1});for(const le of Z){const fe=C.getTerrainData(le.tileID),te={u_matrix:v.transform.calculatePosMatrix(le.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ue.draw(L,M.TRIANGLES,z,sr.disabled,R,$n.backCCW,te,fe,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.getCoordsTexture(),ue=C.sourceCache.getRenderableTiles(),le=v.useProgram("terrainCoords");L.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1}),C.coordsIndex=[];for(const fe of ue){const te=C.getTerrainData(fe.tileID);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,Z.texture);const xe={u_matrix:v.transform.calculatePosMatrix(fe.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};le.draw(L,M.TRIANGLES,z,sr.disabled,R,$n.backCCW,xe,te,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(fe.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(v,C,L,M,R){if(v.renderPass!=="translucent")return;const z=sr.disabled,F=v.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,ue,le,fe,te,xe,Be){const de=ue.transform,Pe=te==="map",Ve=xe==="map";for(const je of Z){const Xe=fe.getTile(je),tt=Xe.getBucket(le);if(!tt||!tt.text||!tt.text.segments.get().length)continue;const $e=l.ag(tt.textSizeData,de.zoom),ut=Qt(Xe,1,ue.transform.zoom),pt=tn(je.posMatrix,Ve,Pe,ue.transform,ut),sn=le.layout.get("icon-text-fit")!=="none"&&tt.hasIconData();if($e){const dt=Math.pow(2,de.zoom-Xe.tileID.overscaledZ);vh(tt,Pe,Ve,Be,de,pt,je.posMatrix,dt,$e,sn,ue.style.map.terrain?(Ut,an)=>ue.style.map.terrain.getElevation(je,Ut,an):null)}}}(M,v,L,C,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),R),L.paint.get("icon-opacity").constantOr(1)!==0&&xh(v,C,L,M,!1,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),L.layout.get("icon-rotation-alignment"),L.layout.get("icon-pitch-alignment"),L.layout.get("icon-keep-upright"),z,F),L.paint.get("text-opacity").constantOr(1)!==0&&xh(v,C,L,M,!0,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(yh(v,C,L,M,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),!0),yh(v,C,L,M,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),!1))})(s,f,m,g,this.style.placement.variableOffsets);break;case"circle":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("circle-opacity"),z=L.paint.get("circle-stroke-width"),F=L.paint.get("circle-stroke-opacity"),Z=!L.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const ue=v.context,le=ue.gl,fe=v.depthModeForSublayer(0,In.ReadOnly),te=sr.disabled,xe=v.colorModeForRenderPass(),Be=[];for(let de=0;dede.sortKey-Pe.sortKey);for(const de of Be){const{programConfiguration:Pe,program:Ve,layoutVertexBuffer:je,indexBuffer:Xe,uniformValues:tt,terrainData:$e}=de.state;Ve.draw(ue,le.TRIANGLES,fe,te,xe,$n.disabled,tt,$e,L.id,je,Xe,de.segments,L.paint,v.transform.zoom,Pe)}})(s,f,m,g);break;case"heatmap":(function(v,C,L,M){if(L.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,z=R.gl,F=sr.disabled,Z=new Ur([z.ONE,z.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(ue,le,fe){const te=ue.gl;ue.activeTexture.set(te.TEXTURE1),ue.viewport.set([0,0,le.width/4,le.height/4]);let xe=fe.heatmapFbo;if(xe)te.bindTexture(te.TEXTURE_2D,xe.colorAttachment.get()),ue.bindFramebuffer.set(xe.framebuffer);else{const Be=te.createTexture();te.bindTexture(te.TEXTURE_2D,Be),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_WRAP_S,te.CLAMP_TO_EDGE),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_WRAP_T,te.CLAMP_TO_EDGE),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_MIN_FILTER,te.LINEAR),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_MAG_FILTER,te.LINEAR),xe=fe.heatmapFbo=ue.createFramebuffer(le.width/4,le.height/4,!1,!1),function(de,Pe,Ve,je){var Xe,tt;const $e=de.gl,ut=(Xe=de.HALF_FLOAT)!==null&&Xe!==void 0?Xe:$e.UNSIGNED_BYTE,pt=(tt=de.RGBA16F)!==null&&tt!==void 0?tt:$e.RGBA;$e.texImage2D($e.TEXTURE_2D,0,pt,Pe.width/4,Pe.height/4,0,$e.RGBA,ut,null),je.colorAttachment.set(Ve)}(ue,le,Be,xe)}})(R,v,L),R.clear({color:l.aO.transparent});for(let ue=0;ue{const de=l.F();l.aN(de,0,fe.width,fe.height,0,0,1);const Pe=fe.context.gl;return{u_matrix:de,u_world:[Pe.drawingBufferWidth,Pe.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:te.paint.get("heatmap-opacity")}})(R,z),null,z.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,z.paint,R.transform.zoom)}(v,L))})(s,f,m,g);break;case"line":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("line-opacity"),z=L.paint.get("line-width");if(R.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,In.ReadOnly),Z=v.colorModeForRenderPass(),ue=L.paint.get("line-dasharray"),le=L.paint.get("line-pattern"),fe=le.constantOr(1),te=L.paint.get("line-gradient"),xe=L.getCrossfadeParameters(),Be=fe?"linePattern":ue?"lineSDF":te?"lineGradient":"line",de=v.context,Pe=de.gl;let Ve=!0;for(const je of M){const Xe=C.getTile(je);if(fe&&!Xe.patternsLoaded())continue;const tt=Xe.getBucket(L);if(!tt)continue;const $e=tt.programConfigurations.get(L.id),ut=v.context.program.get(),pt=v.useProgram(Be,$e),sn=Ve||pt.program!==ut,dt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(je),Ut=le.constantOr(null);if(Ut&&Xe.imageAtlas){const Ht=Xe.imageAtlas,hn=Ht.patternPositions[Ut.to.toString()],pn=Ht.patternPositions[Ut.from.toString()];hn&&pn&&$e.setConstantPatternPositions(hn,pn)}const an=dt?je:null,Cn=fe?Ll(v,Xe,L,xe,an):ue?uh(v,Xe,L,ue,xe,an):te?mm(v,Xe,L,tt.lineClipsArray.length,an):lh(v,Xe,L,an);if(fe)de.activeTexture.set(Pe.TEXTURE0),Xe.imageAtlasTexture.bind(Pe.LINEAR,Pe.CLAMP_TO_EDGE),$e.updatePaintBuffers(xe);else if(ue&&(sn||v.lineAtlas.dirty))de.activeTexture.set(Pe.TEXTURE0),v.lineAtlas.bind(de);else if(te){const Ht=tt.gradients[L.id];let hn=Ht.texture;if(L.gradientVersion!==Ht.version){let pn=256;if(L.stepInterpolant){const Lr=C.getSource().maxzoom,Wn=je.canonical.z===Lr?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()),m=this.imageManager.getPattern(s.to.toString());return!f||!m}useProgram(s,f){this.cache=this.cache||{};const m=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new Xa(this.context,tc[s],f,gm[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}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 Y(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 Ka{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,m){const g=Math.pow(2,m),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(L=>{const M=1/(L=l.af([],L,s))[3]/f*g;return l.a$(L,L,[M,M,1/L[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const M=function(Z,ue){var le=ue[0],fe=ue[1],te=ue[2],xe=le*le+fe*fe+te*te;return xe>0&&(xe=1/Math.sqrt(xe)),Z[0]=ue[0]*xe,Z[1]=ue[1]*xe,Z[2]=ue[2]*xe,Z}([],function(Z,ue,le){var fe=ue[0],te=ue[1],xe=ue[2],Be=le[0],de=le[1],Pe=le[2];return Z[0]=te*Pe-xe*de,Z[1]=xe*Be-fe*Pe,Z[2]=fe*de-te*Be,Z}([],Q([],v[L[0]],v[L[1]]),Q([],v[L[2]],v[L[1]]))),R=-((z=M)[0]*(F=v[L[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(R)});return new Ka(v,C)}}class Ja{constructor(s,f){this.min=s,this.max=f,this.center=function(m,g,v){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,v){return m[0]=g[0]+v[0],m[1]=g[1]+v[1],m[2]=g[2]+v[2],m}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],m=me(this.min),g=me(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let L=0;Lthis.max[g]-this.min[g])return 0}return 1}}class mu{constructor(s=0,f=0,m=0,g=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=m,this.right=g}interpolate(s,f,m){return f.top!=null&&s.top!=null&&(this.top=l.z.number(s.top,f.top,m)),f.bottom!=null&&s.bottom!=null&&(this.bottom=l.z.number(s.bottom,f.bottom,m)),f.left!=null&&s.left!=null&&(this.left=l.z.number(s.left,f.left,m)),f.right!=null&&s.right!=null&&(this.right=l.z.number(s.right,f.right,m)),this}getCenter(s,f){const m=l.ac((this.left+s-this.right)/2,0,s),g=l.ac((this.top+f-this.bottom)/2,0,f);return new l.P(m,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new mu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const xp=85.051129;class Th{constructor(s,f,m,g,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=m??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new mu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new Th(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 l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-l.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,v){var C=g[0],L=g[1],M=g[2],R=g[3],z=Math.sin(v),F=Math.cos(v);m[0]=C*F+M*z,m[1]=L*F+R*z,m[2]=C*-z+M*F,m[3]=L*-z+R*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=l.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,m){this._unmodified=!1,this._edgeInsets.interpolate(s,f,m),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 l.b2(0,s)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),g=this.pointCoordinate(new l.P(this.width,0)),v=this.pointCoordinate(new l.P(this.width,this.height)),C=this.pointCoordinate(new l.P(0,this.height)),L=Math.floor(Math.min(m.x,g.x,v.x,C.x)),M=Math.floor(Math.max(m.x,g.x,v.x,C.x)),R=1;for(let z=L-R;z<=M+R;z++)z!==0&&f.push(new l.b2(z,s))}return f}coveringTiles(s){var f,m;let g=this.coveringZoomLevel(s);const v=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),L=l.Y.fromLngLat(this.center),M=Math.pow(2,g),R=[M*C.x,M*C.y,0],z=[M*L.x,M*L.y,0],F=Ka.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let Z=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=g);const ue=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,le=de=>({aabb:new Ja([de*M,0,0],[(de+1)*M,M,0]),zoom:0,x:0,y:0,wrap:de,fullyVisible:!1}),fe=[],te=[],xe=g,Be=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let de=1;de<=3;de++)fe.push(le(-de)),fe.push(le(de));for(fe.push(le(0));fe.length>0;){const de=fe.pop(),Pe=de.x,Ve=de.y;let je=de.fullyVisible;if(!je){const pt=de.aabb.intersects(F);if(pt===0)continue;je=pt===2}const Xe=s.terrain?R:z,tt=de.aabb.distanceX(Xe),$e=de.aabb.distanceY(Xe),ut=Math.max(Math.abs(tt),Math.abs($e));if(de.zoom===xe||ut>ue+(1<=Z){const pt=xe-de.zoom,sn=R[0]-.5-(Pe<>1),Ut=de.zoom+1;let an=de.aabb.quadrant(pt);if(s.terrain){const Cn=new l.Q(Ut,de.wrap,Ut,sn,dt),Ht=s.terrain.getMinMaxElevation(Cn),hn=(f=Ht.minElevation)!==null&&f!==void 0?f:this.elevation,pn=(m=Ht.maxElevation)!==null&&m!==void 0?m:this.elevation;an=new Ja([an.min[0],an.min[1],hn],[an.max[0],an.max[1],pn])}fe.push({aabb:an,zoom:Ut,x:sn,y:dt,wrap:de.wrap,fullyVisible:je})}}return te.sort((de,Pe)=>de.distanceSq-Pe.distanceSq).map(de=>de.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=l.ac(s.lat,-85.051129,xp);return new l.P(l.N(s.lng)*this.worldSize,l.O(f)*this.worldSize)}unproject(s){return new l.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,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-v))return;const C=m+f-v,L=Math.cos(this._pitch)*this.cameraToCenterDistance/C/l.b3(1,g.lat),M=this.scaleZoom(L/this.tileSize);this._elevation=v,this._center=g,this.zoom=M}setLocationAtPoint(s,f){const m=this.pointCoordinate(f),g=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new l.Y(v.x-(m.x-g.x),v.y-(m.y-g.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 l.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 m=[s.x,s.y,0,1],g=[s.x,s.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(g,g,this.pixelMatrixInverse);const v=m[3],C=g[3],L=m[1]/v,M=g[1]/C,R=m[2]/v,z=g[2]/C,F=R===z?0:(0-R)/(z-R);return new l.Y(l.z.number(m[0]/v,g[0]/C,F)/this.worldSize,l.z.number(L,M,F)/this.worldSize)}coordinatePoint(s,f=0,m=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,f,1];return l.af(g,g,m),new l.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ce([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,xp])}calculatePosMatrix(s,f=!1){const m=s.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),L=v.x+Math.pow(2,v.z)*s.wrap,M=l.an(new Float64Array(16));return l.H(M,M,[L*C,v.y*C,0]),l.J(M,M,[C/l.W,C/l.W,1]),l.K(M,f?this.alignedProjMatrix:this.projMatrix,M),g[m]=new Float32Array(M),g[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=l.ac(+f,this.minZoom,this.maxZoom);const m={center:new l.M(s.lng,s.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const de=179.9999999999;g=[-de,de]}const v=this.tileSize*this.zoomScale(m.zoom);let C=0,L=v,M=0,R=v,z=0,F=0;const{x:Z,y:ue}=this.size;if(this.latRange){const de=this.latRange;C=l.O(de[1])*v,L=l.O(de[0])*v,L-CL&&(xe=L-de)}if(g){const de=(M+R)/2;let Pe=le;this._renderWorldCopies&&(Pe=l.b1(le,de-v/2,de+v/2));const Ve=Z/2;Pe-VeR&&(te=R-Ve)}if(te!==void 0||xe!==void 0){const de=new l.P(te??le,xe??fe);m.center=this.unproject.call({worldSize:v},de).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=m,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b3(1,this.center.lat)*this.worldSize;let g=l.an(new Float64Array(16));l.J(g,g,[this.width/2,-this.height/2,1]),l.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=l.an(new Float64Array(16)),l.J(g,g,[1,-1,1]),l.H(g,g,[-1,-1,0]),l.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),L=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?L:v,R=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(l.ac(Math.PI-R-z,.01,Math.PI-.01)),Z=this.getHorizon(),ue=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+s.y/(2*Z)),le=Math.sin(ue)*M/Math.sin(l.ac(Math.PI-R-ue,.01,Math.PI-.01)),fe=Math.min(F,le),te=1.01*(Math.cos(Math.PI/2-this._pitch)*fe+M),xe=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,xe,te),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,l.J(g,g,[1,-1,1]),l.H(g,g,[0,0,-this.cameraToCenterDistance]),l.b5(g,g,this._pitch),l.ad(g,g,this.angle),l.H(g,g,[-f,-m,0]),this.mercatorMatrix=l.J([],g,[this.worldSize,this.worldSize,this.worldSize]),l.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.K(new Float64Array(16),this.labelPlaneMatrix,g),l.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=l.ar([],g),this.pixelMatrix3D=l.K(new Float64Array(16),this.labelPlaneMatrix,g);const Be=this.width%2/2,de=this.height%2/2,Pe=Math.cos(this.angle),Ve=Math.sin(this.angle),je=f-Math.round(f)+Pe*Be+Ve*de,Xe=m-Math.round(m)+Pe*de+Ve*Be,tt=new Float64Array(g);if(l.H(tt,tt,[je>.5?je-1:je,Xe>.5?Xe-1:Xe,0]),this.alignedProjMatrix=tt,g=l.ar(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let m=f.x,g=f.y,v=f.x,C=f.y;for(const L of s)m=Math.min(m,L.x),g=Math.min(g,L.y),v=Math.max(v,L.x),C=Math.max(C,L.y);return[new l.P(m,g),new l.P(v,g),new l.P(v,C),new l.P(m,C),new l.P(m,g)]}}lngLatToCameraDepth(s,f){const m=this.locationCoordinate(s),g=[m.x*this.worldSize,m.y*this.worldSize,f,1];return l.af(g,g,this.projMatrix),g[2]/g[3]}}function wp(y,s){let f,m=!1,g=null,v=null;const C=()=>{g=null,m&&(y.apply(v,f),g=setTimeout(C,s),m=!1)};return(...L)=>(m=!0,v=this,f=L,g||C(),g)}class Sp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let m;return f.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(m=>isNaN(m))){const m=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:m,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=wp(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(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,g),C=Math.round(f.lng*v)/v,L=Math.round(f.lat*v)/v,M=this._map.getBearing(),R=this._map.getPitch();let z="";if(z+=s?`/${C}/${L}/${m}`:`${m}/${L}/${C}`,(M||R)&&(z+="/"+Math.round(10*M)/10),R&&(z+=`/${Math.round(R)}`),this._hashName){const F=this._hashName;let Z=!1;const ue=window.location.hash.slice(1).split("&").map(le=>{const fe=le.split("=")[0];return fe===F?(Z=!0,`${fe}=${z}`):le}).filter(le=>le);return Z||ue.push(`${F}=${z}`),`#${ue.join("&")}`}return`#${z}`}}const uc={linearity:.3,easing:l.b6(0,0,.3,1)},kl=l.e({deceleration:2500,maxSpeed:1400},uc),Am=l.e({deceleration:20,maxSpeed:1400},uc),km=l.e({deceleration:1e3,maxSpeed:360},uc),Dm=l.e({deceleration:1e3,maxSpeed:90},uc);class Rm{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 l.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 m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(f.pan.mag()){const v=hc(f.pan.mag(),m,l.e({},kl,s||{}));g.offset=f.pan.mult(v.amount/f.pan.mag()),g.center=this._map.transform.center,cc(g,v)}if(f.zoom){const v=hc(f.zoom,m,Am);g.zoom=this._map.transform.zoom+v.amount,cc(g,v)}if(f.bearing){const v=hc(f.bearing,m,km);g.bearing=this._map.transform.bearing+l.ac(v.amount,-179,179),cc(g,v)}if(f.pitch){const v=hc(f.pitch,m,Dm);g.pitch=this._map.transform.pitch+v.amount,cc(g,v)}if(g.zoom||g.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;g.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),l.e(g,{noMoveStart:!0})}}function cc(y,s){(!y.duration||y.durationf.unproject(M)),L=v.reduce((M,R,z,F)=>M.add(R.div(F.length)),new l.P(0,0));super(s,{points:v,point:L,lngLats:C,lngLat:f.unproject(L),originalEvent:m}),this._defaultPrevented=!1}}class Ep extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,m){super(s,{originalEvent:m}),this._defaultPrevented=!1}}class ys{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Ep(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new yo(s.type,this._map,s))}mouseup(s){this._map.fire(new yo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new yo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new yo(s.type,this._map,s))}mouseover(s){this._map.fire(new yo(s.type,this._map,s))}mouseout(s){this._map.fire(new yo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Gs(s.type,this._map,s))}touchmove(s){this._map.fire(new Gs(s.type,this._map,s))}touchend(s){this._map.fire(new Gs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Gs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class js{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new yo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new yo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new yo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{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(l.P.convert(s),this._map.terrain)}}class vs{constructor(s,f){this._map=s,this._tr=new gu(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&&(T.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const m=f;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)v.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new l.k(s,{originalEvent:f}))}}function Dl(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const f={};for(let m=0;mthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const v=new l.P(0,0);for(const C of g)v._add(C);return v.div(g.length)}(f),this.touches=Dl(m,f)))}touchmove(s,f,m){if(this.aborted||!this.centroid)return;const g=Dl(m,f);for(const v in this.touches){const C=g[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,m){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Ip{constructor(s){this.singleTap=new hy(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,m){this.singleTap.touchstart(s,f,m)}touchmove(s,f,m){this.singleTap.touchmove(s,f,m)}touchend(s,f,m){const g=this.singleTap.touchend(s,f,m);if(g){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(g)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class fy{constructor(s){this._tr=new gu(s),this._zoomIn=new Ip({numTouches:1,numTaps:2}),this._zoomOut=new Ip({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,m){this._zoomIn.touchstart(s,f,m),this._zoomOut.touchstart(s,f,m)}touchmove(s,f,m){this._zoomIn.touchmove(s,f,m),this._zoomOut.touchmove(s,f,m)}touchend(s,f,m){const g=this._zoomIn.touchend(s,f,m),v=this._zoomOut.touchend(s,f,m),C=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.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 _u{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 m=this._lastPoint;if(!m)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=f.length?f[0]:f;return!this._moved&&g.dist(m){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},yu=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const m=new qs({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new _u({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*f}),moveStateManager:m,enable:y,assignEvents:Lh})},vu=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const m=new qs({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new _u({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*f}),moveStateManager:m,enable:y,assignEvents:Lh})};class Nm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,m){return this._calculateTransform(s,f,m)}touchmove(s,f,m){if(this._active&&!(m.length0&&(this._active=!0);const g=Dl(m,f),v=new l.P(0,0),C=new l.P(0,0);let L=0;for(const R in g){const z=g[R],F=this._touches[R];F&&(v._add(z),C._add(z.sub(F)),L++,g[R]=z)}if(this._touches=g,LMath.abs(y.x)}class Fm extends bt{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,m){super.touchstart(s,f,m),this._currentTouchCount=m.length}_start(s){this._lastPoints=s,Mh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,v,m.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,m){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,v=f.mag()>=2;if(!g&&!v)return;if(!g||!v)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return Mh(s)&&Mh(f)&&C}}const py={panStep:100,bearingStep:15,pitchStep:10};class Qa{constructor(s){this._tr=new gu(s);const f=py;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,m=0,g=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?m=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?m=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:L=>{const M=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:fr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+m*this._bearingStep,pitch:M.pitch+g*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 fr(y){return y*(2-y)}const pc=4.000244140625;class Ah{constructor(s,f){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=s,this._tr=new gu(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 m=I.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,f!==0&&f%pc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*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=T.mousePos(this._map.getCanvas(),s),m=this._tr;this._around=f.y>m.transform.height/2-m.transform.getHorizon()?l.M.convert(this._aroundCenter?m.center:m.unproject(f)):l.M.convert(m.center),this._aroundPoint=m.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 L=this._type==="wheel"&&Math.abs(this._delta)>pc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&M!==0&&(M=1/M);const R=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(R*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,m=this._startZoom,g=this._easing;let v,C=!1;if(this._type==="wheel"&&m&&g){const L=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=g(L);v=l.z.number(m,f,M),L<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=l.b7;if(this._prevEase){const m=this._prevEase,g=(I.now()-m.start)/m.duration,v=m.easing(g+.01)-m.easing(g),C=.27/Math.sqrt(v*v+1e-4)*.01,L=Math.sqrt(.0729-C*C);f=l.b6(C,L,.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 Tp{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 Bm{constructor(s){this._tr=new gu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:m=>{m.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 Vm{constructor(){this._tap=new Ip({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,m){if(!this._swipePoint)if(this._tapTime){const g=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(g)<30;v&&C?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(s,f,m)}touchmove(s,f,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=f[0],v=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,m)}touchend(s,f,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(s,f,m);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Um{constructor(s,f,m){this._el=s,this._mousePan=f,this._touchPan=m}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 bs{constructor(s,f,m){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=m}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 dc{constructor(s,f,m,g){this._el=s,this._touchZoom=f,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Dt{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=T.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=f,this._container.appendChild(g);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=m,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(T.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 Vt=y=>y.zoom||y.drag||y.pitch||y.rotate;class kh extends l.k{}function mc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Lp{constructor(s,f){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,v)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=g.type==="renderFrame"?void 0:g,L={needsRenderFrame:!1},M={},R={},z=g.touches,F=z?this._getMapTouches(z):void 0,Z=F?T.touchPos(this._map.getCanvas(),F):T.mousePos(this._map.getCanvas(),g);for(const{handlerName:fe,handler:te,allowed:xe}of this._handlers){if(!te.isEnabled())continue;let Be;this._blockedByActive(R,xe,fe)?te.reset():te[v||g.type]&&(Be=te[v||g.type](g,Z,F),this.mergeHandlerResult(L,M,Be,fe,C),Be&&Be.needsRenderFrame&&this._triggerRenderFrame()),(Be||te.isActive())&&(R[fe]=te)}const ue={};for(const fe in this._previousActiveHandlers)R[fe]||(ue[fe]=C);this._previousActiveHandlers=R,(Object.keys(ue).length||mc(L))&&(this._changes.push([L,M,ue]),this._triggerRenderFrame()),(Object.keys(R).length||mc(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:le}=L;le&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],le(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Rm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,v,C]of this._listeners)T.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,m]of this._listeners)T.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(s){const f=this._map,m=f.getCanvasContainer();this._add("mapEvent",new ys(f,s));const g=f.boxZoom=new vs(f,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const v=f.cooperativeGestures=new Dt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new fy(f),L=new Bm(f);f.doubleClickZoom=new Tp(L,C),this._add("tapZoom",C),this._add("clickZoom",L),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Vm;this._add("tapDragZoom",M);const R=f.touchPitch=new Fm(f);this._add("touchPitch",R),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=yu(s),F=vu(s);f.dragRotate=new bs(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const Z=(({enable:Be,clickTolerance:de})=>{const Pe=new qs({checkCorrectEvent:Ve=>T.mouseButton(Ve)===0&&!Ve.ctrlKey});return new _u({clickTolerance:de,move:(Ve,je)=>({around:je,panDelta:je.sub(Ve)}),activateOnStart:!0,moveStateManager:Pe,enable:Be,assignEvents:Lh})})(s),ue=new Nm(s,f);f.dragPan=new Um(m,Z,ue),this._add("mousePan",Z),this._add("touchPan",ue,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const le=new Cp,fe=new zm;f.touchZoomRotate=new dc(m,fe,le,M),this._add("touchRotate",le,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const te=f.scrollZoom=new Ah(f,()=>this._triggerRenderFrame());this._add("scrollZoom",te,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const xe=f.keyboard=new Qa(f);this._add("keyboard",xe),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new js(f))}_add(s,f,m){this._handlers.push({handlerName:s,handler:f,allowed:m}),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!!Vt(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,m){for(const g in s)if(g!==m&&(!f||f.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const m of s)this._el.contains(m.target)&&f.push(m);return f}mergeHandlerResult(s,f,m,g,v){if(!m)return;l.e(s,m);const C={handlerName:g,originalEvent:m.originalEvent||v};m.zoomDelta!==void 0&&(f.zoom=C),m.panDelta!==void 0&&(f.drag=C),m.pitchDelta!==void 0&&(f.pitch=C),m.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},m={};for(const[g,v,C]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),l.e(f,v),l.e(m,C);this._updateMapTransform(s,f,m),this._changes=[]}_updateMapTransform(s,f,m){const g=this._map,v=g._getTransformForUpdate(),C=g.terrain;if(!(mc(s)||C&&this._terrainMovement))return this._fireEvents(f,m,!0);let{panDelta:L,zoomDelta:M,bearingDelta:R,pitchDelta:z,around:F,pinchAround:Z}=s;Z!==void 0&&(F=Z),g._stop(!0),F=F||g.transform.centerPoint;const ue=v.pointLocation(L?F.sub(L):F);R&&(v.bearing+=R),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(L)):v.setLocationAtPoint(ue,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(ue,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(g.terrain)})):v.setLocationAtPoint(ue,F),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,m,!0)}_fireEvents(s,f,m){const g=Vt(this._eventsInProgress),v=Vt(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!g&&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 L={};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,L[`${z}end`]=M)}for(const z in L)this._fireEvent(z,L[z]);const R=Vt(this._eventsInProgress);if(m&&(g||v)&&!R){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=Z=>Z!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new kh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class vo extends l.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const m=Math.min((I.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<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 l.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,m){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},f),m)}panTo(s,f,m){return this.easeTo(l.e({center:s},f),m)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,m){return this.easeTo(l.e({zoom:s},f),m)}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,m){return this.easeTo(l.e({bearing:s},f),m)}resetNorth(s,f){return this.rotateTo(0,l.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=l.z.number(v,te,Xe)),this._rotating&&(g.bearing=l.z.number(C,R,Xe)),this._pitching&&(g.pitch=l.z.number(L,z,Xe)),this._padding&&(g.interpolatePadding(M,F,Xe),ue=g.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Xe),Pe)g.setLocationAtPoint(Pe,Ve);else{const tt=g.zoomScale(g.zoom-v),$e=te>v?Math.min(2,de):Math.max(.5,de),ut=Math.pow($e,1-Xe),pt=g.unproject(xe.add(Be.mult(Xe*ut)).mult(tt));g.setLocationAtPoint(g.renderWorldCopies?pt.wrap():pt,ue)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},Xe=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Xe)},s),this}_prepareEase(s,f,m={}){this._moving=!0,f||m.moving||this.fire(new l.k("movestart",s)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!m.pitching&&this.fire(new l.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 m=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(m-(f-(m*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=l.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:m,zoom:g,pitch:v,bearing:C,elevation:L}=this.transformCameraUpdate(f);m&&(f.center=m),g!==void 0&&(f.zoom=g),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),L!==void 0&&(f.elevation=L),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const m=this._zooming,g=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",s)),g&&this.fire(new l.k("rotateend",s)),v&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,f){var m;if(!s.essential&&I.prefersReducedMotion){const Cn=l.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Cn,f)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b7},s);const g=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),L=this.getPitch(),M=this.getPadding(),R="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:L,F="padding"in s?s.padding:g.padding,Z=l.P.convert(s.offset);let ue=g.centerPoint.add(Z);const le=g.pointLocation(ue),{center:fe,zoom:te}=g.getConstrained(l.M.convert(s.center||le),(m=s.zoom)!==null&&m!==void 0?m:v);this._normalizeCenter(fe);const xe=g.zoomScale(te-v),Be=g.project(le),de=g.project(fe).sub(Be);let Pe=s.curve;const Ve=Math.max(g.width,g.height),je=Ve/xe,Xe=de.mag();if("minZoom"in s){const Cn=l.ac(Math.min(s.minZoom,v,te),g.minZoom,g.maxZoom),Ht=Ve/g.zoomScale(Cn-v);Pe=Math.sqrt(Ht/Xe*2)}const tt=Pe*Pe;function $e(Cn){const Ht=(je*je-Ve*Ve+(Cn?-1:1)*tt*tt*Xe*Xe)/(2*(Cn?je:Ve)*tt*Xe);return Math.log(Math.sqrt(Ht*Ht+1)-Ht)}function ut(Cn){return(Math.exp(Cn)-Math.exp(-Cn))/2}function pt(Cn){return(Math.exp(Cn)+Math.exp(-Cn))/2}const sn=$e(!1);let dt=function(Cn){return pt(sn)/pt(sn+Pe*Cn)},Ut=function(Cn){return Ve*((pt(sn)*(ut(Ht=sn+Pe*Cn)/pt(Ht))-ut(sn))/tt)/Xe;var Ht},an=($e(!0)-sn)/Pe;if(Math.abs(Xe)<1e-6||!isFinite(an)){if(Math.abs(Ve-je)<1e-6)return this.easeTo(s,f);const Cn=jes.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==R,this._pitching=z!==L,this._padding=!g.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(fe),this._ease(Cn=>{const Ht=Cn*an,hn=1/dt(Ht);g.zoom=Cn===1?te:v+g.scaleZoom(hn),this._rotating&&(g.bearing=l.z.number(C,R,Cn)),this._pitching&&(g.pitch=l.z.number(L,z,Cn)),this._padding&&(g.interpolatePadding(M,F,Cn),ue=g.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Cn);const pn=Cn===1?fe:g.unproject(Be.add(de.mult(Ut(Ht))).mult(hn));g.setLocationAtPoint(g.renderWorldCopies?pn.wrap():pn,ue),this._applyUpdatedTransform(g),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 m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,f)}if(!s){const m=this.handlers;m&&m.stop(!1)}return this}_ease(s,f,m){m.animate===!1||m.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=m,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=l.b1(s,-180,180);const m=Math.abs(s-f);return Math.abs(s-360-f)180?-360:m<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Pp={compact:!0,customAttribution:'MapLibre'};class xs{constructor(s=Pp){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=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.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 m=this._map._getUIString(`AttributionControl.${f}`);s.title=m,s.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const f=this._map.style.sourceCaches;for(const g in f){const v=f[g];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,v)=>g.length-v.length),s=s.filter((g,v)=>{for(let C=v+1;C=0)return!1;return!0});const m=s.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,s.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Gm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const m=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.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=T.create("div","maplibregl-ctrl");const f=T.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(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class gc{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,m=f?this._queue.concat(f):this._queue;for(const g of m)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const m of f)if(!m.cancelled&&(m.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Tr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class Gr extends l.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 m={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),l.aN(g.posMatrix,0,l.W,0,l.W,0,1),this._tiles[g.key]=new Qo(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(s){for(const f in this._tiles){const m=this._tiles[f];(!s||m.tileID.equals(s)||m.tileID.isChildOf(s)||s.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),l.aN(v.posMatrix,0,l.W,0,l.W,0,1),f[m]=v}else if(g.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=g.canonical.z-s.canonical.z,L=g.canonical.x-(g.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,R,0,R,0,1),l.H(v.posMatrix,v.posMatrix,[-L*R,-M*R,0]),f[m]=v}else if(s.canonical.isChildOf(g.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-g.canonical.z,L=s.canonical.x-(s.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,l.W,0,l.W,0,1),l.H(v.posMatrix,v.posMatrix,[L*R,M*R,0]),l.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[m]=v}}return f}getSourceTile(s,f){const m=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g=m.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(g--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class jm{constructor(s,f,m){this.painter=s,this.sourceCache=new Gr(f),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,m,g=l.W){var v;if(!(f>=0&&f=0&&ms.canonical.z&&(s.canonical.z>=g?v=s.canonical.z-g:l.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 m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new Y(s,m,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),m=this.painter.context,g=m.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,L-C-1,1,1,g.RGBA,g.UNSIGNED_BYTE,f),m.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),R=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,ue=(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 xa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new _c(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(m=>!s._layers[m].isHidden(f)),this._coordsDescendingInv={};for(const m in s.sourceCaches){this._coordsDescendingInv[m]={};const g=s.sourceCaches[m].getVisibleCoordinates();for(const v of g){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const L in C)this._coordsDescendingInv[m][L]||(this._coordsDescendingInv[m][L]=[]),this._coordsDescendingInv[m][L].push(C[L])}}this._coordsDescendingInvStr={};for(const m of s._order){const g=s._layers[m],v=g.source;if(xa[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(L=>L.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[g][m.tileID.key];v&&v!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(xa[f]&&(this._prevType&&xa[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(xa[this._prevType]||xa[f]&&g){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(Ch(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[v]){const R=this.pool.getObjectForId(L.rtt[v].id);if(R.stamp===L.rtt[v].stamp){this.pool.useObject(R);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),L.rtt[v]={id:M.id,stamp:M.stamp},m.context.bindFramebuffer.set(M.fbo.framebuffer),m.context.clear({color:l.aO.transparent,stencil:0}),m.currentStencilSource=void 0;for(let R=0;R{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Dp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Rp{constructor(s,f,m=!1){this.mousedown=C=>{this.startMouse(l.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),T.mousePos(this.element,C)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,T.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=T.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=T.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 g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=yu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:L,bearingDegreesPerPixelMoved:M=.8})=>{const R=new Et;return new _u({clickTolerance:L,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:R,enable:C,assignEvents:Dh})})({clickTolerance:g,enable:!0}),this.map=s,m&&(this.mousePitch=vu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:L,pitchDegreesPerPixelMoved:M=-.5})=>{const R=new Et;return new _u({clickTolerance:L,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:R,enable:C,assignEvents:Dh})})({clickTolerance:v,enable:!0})),T.addEventListener(f,"mousedown",this.mousedown),T.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),T.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),T.disableDrag()}moveMouse(s,f){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&m.setPitch(m.getPitch()+v)}}moveTouch(s,f){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&m.setPitch(m.getPitch()+v)}}off(){const s=this.element;T.removeEventListener(s,"mousedown",this.mousedown),T.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let wa;function Rh(y,s,f){const m=new l.M(y.lng,y.lat);if(y=new l.M(y.lng,y.lat),s){const g=new l.M(y.lng-360,y.lat),v=new l.M(y.lng+360,y.lat),C=f.locationPoint(y).distSqr(s);f.locationPoint(g).distSqr(s)180;){const g=f.locationPoint(y);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;y.lng>f.center.lng?y.lng-=360:y.lng+=360}return y.lng!==m.lng&&f.locationPoint(y).y>f.height/2-f.getHorizon()?y:m}const vc={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 Nh(y,s,f){const m=y.classList;for(const g in vc)m.remove(`maplibregl-${f}-anchor-${g}`);m.add(`maplibregl-${f}-anchor-${s}`)}class bc extends l.E{constructor(s){if(super(),this._onKeyPress=f=>{const m=f.code,g=f.charCode||f.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=f=>{const m=f.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=f=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Rh(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.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()),T.setTransform(this._element,`${vc[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 m=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=m}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 l.k("dragstart"))),this.fire(new l.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 l.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=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div"),this._element.setAttribute("aria-label","Map marker");const f=T.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${m}px`),f.setAttributeNS(null,"width",`${g}px`),f.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const v=T.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=T.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.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 xe of M){const Be=T.createNS("http://www.w3.org/2000/svg","ellipse");Be.setAttributeNS(null,"opacity","0.04"),Be.setAttributeNS(null,"cx","10.5"),Be.setAttributeNS(null,"cy","5.80029008"),Be.setAttributeNS(null,"rx",xe.rx),Be.setAttributeNS(null,"ry",xe.ry),L.appendChild(Be)}const R=T.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const z=T.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"),R.appendChild(z);const F=T.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Z=T.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 ue=T.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ue.setAttributeNS(null,"fill","#FFFFFF");const le=T.createNS("http://www.w3.org/2000/svg","g");le.setAttributeNS(null,"transform","translate(8.0, 8.0)");const fe=T.createNS("http://www.w3.org/2000/svg","circle");fe.setAttributeNS(null,"fill","#000000"),fe.setAttributeNS(null,"opacity","0.25"),fe.setAttributeNS(null,"cx","5.5"),fe.setAttributeNS(null,"cy","5.5"),fe.setAttributeNS(null,"r","5.4999962");const te=T.createNS("http://www.w3.org/2000/svg","circle");te.setAttributeNS(null,"fill","#FFFFFF"),te.setAttributeNS(null,"cx","5.5"),te.setAttributeNS(null,"cy","5.5"),te.setAttributeNS(null,"r","5.4999962"),le.appendChild(fe),le.appendChild(te),C.appendChild(L),C.appendChild(R),C.appendChild(F),C.appendChild(ue),C.appendChild(le),f.appendChild(C),f.setAttributeNS(null,"height",m*this._scale+"px"),f.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(f),this._offset=l.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()}),Nh(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),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.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 g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._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,m;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 g=this._map,v=g.terrain.depthAtPoint(this._pos),C=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/g.transform._pixelPerMeter,M=Math.sin(g.getPitch()*Math.PI/180)*L,R=g.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),z=g.transform.lngLatToCameraDepth(this._lngLat,C+M)-R>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.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 Oh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let xu=0,Rl=!1;const zh={maxWidth:100,unit:"metric"};function Fh(y,s,f){const m=f&&f.maxWidth||100,g=y._container.clientHeight/2,v=y.unproject([0,g]),C=y.unproject([m,g]),L=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*L;M>5280?Nl(s,m,M/5280,y._getUIString("ScaleControl.Miles")):Nl(s,m,M,y._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Nl(s,m,L/1852,y._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Nl(s,m,L/1e3,y._getUIString("ScaleControl.Kilometers")):Nl(s,m,L,y._getUIString("ScaleControl.Meters"))}function Nl(y,s,f,m){const g=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let L=v/C;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(M){const R=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*R)/R}(L),C*L}(f);y.style.width=s*(g/f)+"px",y.innerHTML=`${g} ${m}`}const Np={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Op=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Bh(y){if(y){if(typeof y=="number"){const s=Math.round(Math.abs(y)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,y),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-y),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(y,0),right:new l.P(-y,0)}}if(y instanceof l.P||Array.isArray(y)){const s=l.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(y.center||[0,0]),top:l.P.convert(y.top||[0,0]),"top-left":l.P.convert(y["top-left"]||[0,0]),"top-right":l.P.convert(y["top-right"]||[0,0]),bottom:l.P.convert(y.bottom||[0,0]),"bottom-left":l.P.convert(y["bottom-left"]||[0,0]),"bottom-right":l.P.convert(y["bottom-right"]||[0,0]),left:l.P.convert(y.left||[0,0]),right:l.P.convert(y.right||[0,0])}}return Bh(new l.P(0,0))}const qm=d;c.AJAXError=l.be,c.Evented=l.E,c.LngLat=l.M,c.MercatorCoordinate=l.Y,c.Point=l.P,c.addProtocol=l.bf,c.config=l.a,c.removeProtocol=l.bg,c.AttributionControl=xs,c.BoxZoomHandler=vs,c.CanvasSource=gs,c.CooperativeGesturesHandler=Dt,c.DoubleClickZoomHandler=Tp,c.DragPanHandler=Um,c.DragRotateHandler=bs,c.EdgeInsets=mu,c.FullscreenControl=class extends l.E{constructor(y={}){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,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.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=Dr,c.GeolocateControl=class extends l.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.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 l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new l.M(s.coords.longitude,s.coords.latitude),m=s.coords.accuracy,g=this._map.getBearing(),v=l.e({bearing:g},this.options.fitBoundsOptions),C=Ce.fromLngLat(f,m);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new l.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&&Rl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.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=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){l.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=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bc({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bc({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 l.k("trackuserlocationend")))})}},this.options=l.e({},Oh,y)}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(s=!1){if(wa!==void 0&&!s)return wa;if(window.navigator.permissions===void 0)return wa=!!window.navigator.geolocation,wa;try{wa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{wa=!!window.navigator.geolocation}return wa})}().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(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xu=0,Rl=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),f=y.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 y=this._map.getBounds(),s=y.getSouthEast(),f=y.getNorthEast(),m=s.distanceTo(f),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return l.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 l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xu--,Rl=!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 l.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 l.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xu++,xu>1?(y={maximumAge:6e5,timeout:0},Rl=!0):(y=this.options.positionOptions,Rl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.Hash=Sp,c.ImageSource=er,c.KeyboardHandler=Qa,c.LngLatBounds=Ce,c.LogoControl=Gm,c.Map=class extends vo{constructor(y){if(l.bc.mark(l.bd.create),(y=l.e({},yc,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Th(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new gc,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},Ap,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new $(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=wp(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{s?f(m):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Lp(this,y),this._hash=y.hash&&new Sp(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,l.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new xs(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new Gm,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new l.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new l.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new l.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=y.onAdd(this);this._controls.push(y);const m=this._controlPositions[s];return s.indexOf("bottom")!==-1?m.insertBefore(f,m.firstChild):m.appendChild(f),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,f,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,f,m)}resize(y){var s;const f=this._containerDimensions(),m=f[0],g=f[1],v=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,v),this.painter.resize(m,g,v),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const M=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,M),this.painter.resize(m,g,M)}this.transform.resize(m,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(m,g);const C=!this._moving;return C&&(this.stop(),this.fire(new l.k("movestart",y)).fire(new l.k("move",y))),this.fire(new l.k("resize",y)),C&&this.fire(new l.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:f,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),v=y*g,C=s*g;return Math.min(v>f?f/v:1,C>m?m/C:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(Ce.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(l.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(l.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,s,f){if(y==="mouseenter"||y==="mouseover"){let m=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?m||(m=!0,f.call(this,new yo(y,this,v.originalEvent,{features:C}))):m=!1},mouseout:()=>{m=!1}}}}if(y==="mouseleave"||y==="mouseout"){let m=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?m=!0:m&&(m=!1,f.call(this,new yo(y,this,C.originalEvent)))},mouseout:C=>{m&&(m=!1,f.call(this,new yo(y,this,C.originalEvent)))}}}}{const m=g=>{const v=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];v.length&&(g.features=v,f.call(this,g),delete g.features)};return{layer:s,listener:f,delegates:{[y]:m}}}}on(y,s,f){if(f===void 0)return super.on(y,s);const m=this._createDelegatedListener(y,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(y,s,f){if(f===void 0)return super.once(y,s);const m=this._createDelegatedListener(y,s,f);for(const g in m.delegates)this.once(g,m.delegates[g]);return this}off(y,s,f){return f===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(m=>{const g=this._delegatedListeners[y];for(let v=0;vthis._updateStyle(y,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new No(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,f):this.style.loadJSON(y,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new No(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const f=this._requestManager.transformRequest(y,"Style");l.h(f,new AbortController).then(m=>{this._updateDiff(m.data,s)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&this._update(!0)}catch(f){l.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(y,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(y,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const m=this.style._layers[f];m.type==="hillshade"&&m.source===y.source&&l.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 jm(this.painter,s,y),this.painter.renderToTexture=new Mp(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!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(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 l.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const f=y[s]._tiles;for(const m in f){const g=f[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,f={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:v,stretchY:C,content:L}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.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:R,data:z}=s,F=s;return this.style.addImage(y,{data:new l.R({width:M,height:R},new Uint8Array(z)),pixelRatio:m,stretchX:v,stretchY:C,content:L,sdf:g,version:0,userImage:F}),F.onAdd&&F.onAdd(this,y),this}}{const{width:M,height:R,data:z}=I.getImageData(s);this.style.addImage(y,{data:new l.R({width:M,height:R},z),pixelRatio:m,stretchX:v,stretchY:C,content:L,sdf:g,version:0})}}updateImage(y,s){const f=this.style.getImage(y);if(!f)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=s instanceof HTMLImageElement||l.b(s)?I.getImageData(s):s,{width:g,height:v,data:C}=m;if(g===void 0||v===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==f.data.width||v!==f.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(s instanceof HTMLImageElement||l.b(s));return f.data.replace(C,L),this.style.updateImage(y,f),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return j.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,s,f){return this.style.setLayerZoomRange(y,s,f),this._update(!0)}setFilter(y,s,f={}){return this.style.setFilter(y,s,f),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,f,m={}){return this.style.setPaintProperty(y,s,f,m),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,f,m={}){return this.style.setLayoutProperty(y,s,f,m),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,f,m=>{m||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,f=>{f||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=T.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=T.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(),m=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],m);const g=this._controlContainer=T.create("div","maplibregl-control-container",y),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=T.create("div",`maplibregl-ctrl-${C} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,s,f){this._canvas.width=Math.floor(f*y),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{s={requestedAttributes:y},m&&(s.statusMessage=m.statusMessage,s.type=m.type)},{once:!0});const f=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!f){const m="Failed to initialize WebGL";throw s?(s.message=m,new Error(JSON.stringify(s))):new Error(m)}this.painter=new Mm(f,this.transform),k.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,v=I.now();this.style.zoomHistory.update(g,v);const C=new l.a8(g,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=C.crossFadingFactor();L===1&&L===this._crossFadingFactor||(f=!0,this._crossFadingFactor=L),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 l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bc.mark(l.bd.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bc.mark(l.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const 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),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bc.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(y=>{l.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return kp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=yo,c.MapTouchEvent=Gs,c.MapWheelEvent=Ep,c.Marker=bc,c.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),m=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.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 m=this._map._getUIString(`NavigationControl.${f}`);s.title=m,s.setAttribute("aria-label",m)},this.options=l.e({},Dp,y),this._container=T.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})),T.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})),T.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=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,s){const f=T.create("button",y,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends l.E{constructor(y){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.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 l.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=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const L of this.options.className.split(" "))this._container.classList.add(L);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?Rh(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const m=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 g=this.options.anchor;const v=Bh(this.options.offset);if(!g){const L=this._container.offsetWidth,M=this._container.offsetHeight;let R;R=m.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],m.xthis._map.transform.width-L/2&&R.push("right"),g=R.length===0?"bottom":R.join("-")}let C=m.add(v[g]);this.options.subpixelPositioning||(C=C.round()),T.setTransform(this._container,`${vc[g]} translate(${C.x}px,${C.y}px)`),Nh(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Np),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=l.M.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const s=document.createDocumentFragment(),f=document.createElement("body");let m;for(f.innerHTML=y;m=f.firstChild,m;)s.appendChild(m);return this.setDOMContent(s)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Op);y&&y.focus()}},c.RasterDEMTileSource=en,c.RasterTileSource=ze,c.ScaleControl=class{constructor(y){this._onMove=()=>{Fh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Fh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},zh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Ah,c.Style=No,c.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Fm,c.TwoFingersTouchRotateHandler=Cp,c.TwoFingersTouchZoomHandler=zm,c.TwoFingersTouchZoomRotateHandler=dc,c.VectorTileSource=xn,c.VideoSource=Do,c.addSourceType=(y,s)=>l._(void 0,void 0,void 0,function*(){if(Ha(y))throw new Error(`A source type called "${y}" already exists.`);((f,m)=>{Bs[f]=m})(y,s)}),c.clearPrewarmedResources=function(){const y=bn;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(kt),bn=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 l.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return at().getRTLTextPluginStatus()},c.getVersion=function(){return qm},c.getWorkerCount=function(){return un.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(y){return $r().broadcast("IS",y)},c.prewarm=function(){Bn().acquire(kt)},c.setMaxParallelImageRequests=function(y){l.a.MAX_PARALLEL_IMAGE_REQUESTS=y},c.setRTLTextPlugin=function(y,s){return at().setRTLTextPlugin(y,s)},c.setWorkerCount=function(y){un.workerCount=y},c.setWorkerUrl=function(y){l.a.WORKER_URL=y}});var a=n;return a})})(NI);var mD=NI.exports;const Ts=Dv(mD);var gD=Object.defineProperty,_D=(t,e,n)=>e in t?gD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ww=(t,e,n)=>(_D(t,typeof e!="symbol"?e+"":e,n),n);function Ad(){}function zI(t){return t()}function Hw(){return Object.create(null)}function M_(t){t.forEach(zI)}function FI(t){return typeof t=="function"}function yD(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function vD(t){return Object.keys(t).length===0}function bD(t,e){t.appendChild(e)}function xD(t,e,n){t.insertBefore(e,n||null)}function BI(t){t.parentNode&&t.parentNode.removeChild(t)}function Zw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Lu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function wD(t){return Array.from(t.childNodes)}function yg(t,e,n){t.classList.toggle(e,!!n)}let t1;function Id(t){t1=t}const uf=[],Xw=[];let gf=[];const Yw=[],SD=Promise.resolve();let iv=!1;function ED(){iv||(iv=!0,SD.then(VI))}function ov(t){gf.push(t)}const E0=new Set;let nf=0;function VI(){if(nf!==0)return;const t=t1;do{try{for(;nft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),gf=e}const TD=new Set;function LD(t,e){t&&t.i&&(TD.delete(t),t.i(e))}function PD(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),ov(()=>{const a=t.$$.on_mount.map(zI).filter(FI);t.$$.on_destroy?t.$$.on_destroy.push(...a):M_(a),t.$$.on_mount=[]}),i.forEach(ov)}function MD(t,e){const n=t.$$;n.fragment!==null&&(CD(n.after_update),M_(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function AD(t,e){t.$$.dirty[0]===-1&&(uf.push(t),ED(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const D=k.length?k[0]:T;return w.ctx&&i(w.ctx[I],w.ctx[I]=D)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](D),S&&AD(t,I)),T}):[],w.update(),S=!0,M_(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=wD(e.target);w.fragment&&w.fragment.l(I),I.forEach(BI)}else w.fragment&&w.fragment.c();e.intro&&LD(t.$$.fragment),PD(t,e.target,e.anchor),VI()}Id(d)}class DD{constructor(){Ww(this,"$$"),Ww(this,"$$set")}$destroy(){MD(this,1),this.$destroy=Ad}$on(e,n){if(!FI(n))return Ad;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&&!vD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const RD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(RD);function ND(t){let e,n,r;return{c(){e=Zw("svg"),n=Zw("path"),Lu(n,"stroke-width","4"),Lu(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"),Lu(n,"class","svelte-gzo3ar"),Lu(e,"width",r=t[0]==="list"?20:void 0),Lu(e,"viewBox","0 0 70 85"),Lu(e,"fill","none"),Lu(e,"class","svelte-gzo3ar"),yg(e,"in-map",t[0]!=="list"),yg(e,"list-icon",t[0]==="list")},m(i,a){xD(i,e,a),bD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Lu(e,"width",r),a&1&&yg(e,"in-map",i[0]!=="list"),a&1&&yg(e,"list-icon",i[0]==="list")},i:Ad,o:Ad,d(i){i&&BI(e)}}}function OD(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class zD extends DD{constructor(e){super(),kD(this,e,OD,ND,yD,{displayIn:0})}}const FD=[{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"}],BD={decimalLatitude:40.123,decimalLongitude:-74.123},VD=[{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}],UD=[{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 GD(){const t=[];return FD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...BD})}),[...t,...VD,...UD]}const jD=GD();jD.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 qD(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:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(w){return function(S){return d([w,S])}}function d(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 l=e.right;if(e.right=l.left,l.left=e,e=l,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 I0(t,e,n,r){var i=new zu(t,e);if(n===null)return i.left=i.right=null,i;n=ku(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 Kw(t,e,n){var r=null,i=null;if(e){e=ku(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 HD(t,e,n){return e===null?t:(t===null||(e=ku(t.key,e,n),e.left=t),e)}function sv(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` +`);var a=e+(n?" ":"│ ");t.left&&sv(t.left,a,!1,r,i),t.right&&sv(t.right,a,!0,r,i)}}var n1=function(){function t(e){e===void 0&&(e=WD),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=I0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new zu(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=ku(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=ku(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=ku(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=ku(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=ku(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,l=this._root,d;a.length!==0||l;)if(l)a.push(l),l=l.left;else{if(l=a.pop(),d=c(l.key,n),d>0)break;if(c(l.key,e)>=0&&r.call(i,l))return this;l=l.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 XD(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&&uv(e,n,0,i-1,a),this._root===null)this._root=av(e,n,0,i),this._size=i;else{var c=YD(this.toList(),ZD(e,n),a);i=this._size+i,this._root=lv({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 sv(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=Kw(e,this._root,i),c=a.left,l=a.right;i(e,n)<0?l=I0(n,r,l,i):c=I0(n,r,c,i),this._root=HD(c,l,i)},t.prototype.split=function(e){return Kw(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return qD(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 av(t,e,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),c=t[a],l=e[a],d=new zu(c,l);return d.left=av(t,e,n,a),d.right=av(t,e,a+1,r),d}return null}function ZD(t,e){for(var n=new zu(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 lv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=lv(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=lv(t,i+1,n),c}return null}function YD(t,e,n){for(var r=new zu(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 uv(t,e,n,r,i){if(!(n>=r)){for(var a=t[n+r>>1],c=n-1,l=r+1;;){do c++;while(i(t[c],a)<0);do l--;while(i(t[l],a)>0);if(c>=l)break;var d=t[c];t[c]=t[l],t[l]=d,d=e[c],e[c]=e[l],e[l]=d}uv(t,e,n,l,i),uv(t,e,l+1,r,i)}}function _a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Jw(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){_a(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ho(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?wT?-1:0:d<0&&I<0?wT?1:0:Id?1:0}}}]),t}(),tR=0,u_=function(){Ho(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(cl&&d>w)return-1;var I=e.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var T=n.comparePoint(e.rightSE.point);return T!==0?T:-1}if(r>i){if(ld&&l>S)return 1;var k=n.comparePoint(e.leftSE.point);if(k!==0)return k;var D=e.comparePoint(n.rightSE.point);return D<0?1:D>0?-1:1}if(ld)return 1;if(ac){var q=e.comparePoint(n.rightSE.point);if(q<0)return 1;if(q>0)return-1}if(a!==c){var ee=w-l,B=a-r,j=S-d,$=c-i;if(ee>B&&j<$)return 1;if(ee$)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){_a(this,t),this.id=++tR,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 Ho(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&&l.swapEvents(),ll.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 l=0,d=r.rings.length;l0)i=n,a=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var d=new ll(i,!0),w=new ll(a,!1);return new t(d,w,[r],[c])}}]),t}(),n2=function(){function t(e,n,r){if(_a(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=kd.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,l=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),a=d)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(u_.fromRing(a,i,this))}return Ho(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 Ho(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 Ho(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}(),i2=function(){function t(e){_a(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ho(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]:u_.compare;_a(this,t),this.queue=e,this.tree=new n1(n),this.segments=[]}return Ho(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,l=void 0,d=void 0;l===void 0;)a=this.tree.prev(a),a===null?l=null:a.key.consumedBy===void 0&&(l=a.key);for(;d===void 0;)c=this.tree.next(c),c===null?d=null:c.key.consumedBy===void 0&&(d=c.key);if(e.isLeft){var w=null;if(l){var S=l.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!l.isAnEndpoint(S)))for(var I=this._splitSafely(l,S),T=0,k=I.length;T0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&d){var Q=l.getIntersection(d);if(Q!==null){if(!l.isAnEndpoint(Q))for(var oe=this._splitSafely(l,Q),Ae=0,Y=oe.length;Aeo2)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var $=new oR(D),ae=D.size,me=D.pop();me;){var pe=me.key;if(D.size===ae){var Q=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(Q.id," ")+"[".concat(Q.leftSE.point.x,", ").concat(Q.leftSE.point.y,"] -> ")+"[".concat(Q.rightSE.point.x,", ").concat(Q.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(D.size>o2)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if($.segments.length>sR)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var oe=$.process(pe),Ae=0,Y=oe.length;Ae1?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};Oe.prototype.clone=function(){};Oe.prototype.copy=function(){return new Oe(this)};Oe.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Oe.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)};Oe.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};Oe.prototype.hashCode=function(){var t=17;return t=37*t+Oe.hashCode(this.x),t=37*t+Oe.hashCode(this.y),t};Oe.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};Oe.prototype.interfaces_=function(){return[ds,k_,ms]};Oe.prototype.getClass=function(){return Oe};Oe.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=$t.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Yc.DimensionalComparator.get=function(){return Xl};Yc.serialVersionUID.get=function(){return 6683108902428367e3};Yc.NULL_ORDINATE.get=function(){return $t.NaN};Yc.X.get=function(){return 0};Yc.Y.get=function(){return 1};Yc.Z.get=function(){return 2};Object.defineProperties(Oe,Yc);var Xl=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new lr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Xl.prototype.compare=function(t,e){var n=t,r=e,i=Xl.compare(n.x,r.x);if(i!==0)return i;var a=Xl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=Xl.compare(n.z,r.z);return c};Xl.prototype.interfaces_=function(){return[Sf]};Xl.prototype.getClass=function(){return Xl};Xl.compare=function(t,e){return te?1:$t.isNaN(t)?$t.isNaN(e)?0:-1:$t.isNaN(e)?1:0};var Ef=function(){};Ef.prototype.create=function(){};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};var Fe=function(){},Qd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Fe.prototype.interfaces_=function(){return[]};Fe.prototype.getClass=function(){return Fe};Fe.toLocationSymbol=function(t){switch(t){case Fe.EXTERIOR:return"e";case Fe.BOUNDARY:return"b";case Fe.INTERIOR:return"i";case Fe.NONE:return"-"}throw new lr("Unknown location value: "+t)};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(Fe,Qd);var Wt=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Zo=function(){},YI={LOG_10:{configurable:!0}};Zo.prototype.interfaces_=function(){return[]};Zo.prototype.getClass=function(){return Zo};Zo.log10=function(t){var e=Math.log(t);return $t.isInfinite(e)||$t.isNaN(e)?e:e/Zo.LOG_10};Zo.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}};Zo.wrap=function(t,e){return t<0?e- -t%e:t%e};Zo.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],l=arguments[3],d=i;return a>d&&(d=a),c>d&&(d=c),l>d&&(d=l),d}};Zo.average=function(t,e){return(t+e)/2};YI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Zo,YI);var ya=function(t){this.str=t};ya.prototype.append=function(t){this.str+=t};ya.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};ya.prototype.toString=function(t){return this.str};var oa=function(t){this.value=t};oa.prototype.intValue=function(){return this.value};oa.prototype.compareTo=function(t){return this.valuet?1:0};oa.isNaN=function(t){return Number.isNaN(t)};var Dd=function(){};Dd.isWhitespace=function(t){return t<=32&&t>=0||t===127};Dd.toUpperCase=function(t){return t.toUpperCase()};var We=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)}},zs={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}};We.prototype.le=function(t){return(this._hi9?(S=!0,I="9"):I="0"+w,c.append(I),n=n.subtract(We.valueOf(w)).multiply(We.TEN),S&&n.selfAdd(We.TEN);var T=!0,k=We.magnitude(n._hi);if(k<0&&Math.abs(k)>=l-d&&(T=!1),!T)break}return e[0]=r,c.toString()};We.prototype.sqr=function(){return this.multiply(this)};We.prototype.doubleValue=function(){return this._hi+this._lo};We.prototype.subtract=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};We.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};We.prototype.isZero=function(){return this._hi===0&&this._lo===0};We.prototype.selfSubtract=function(){if(arguments[0]instanceof We){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)}};We.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};We.prototype.min=function(t){return this.le(t)?this:t};We.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof We){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,l=null,d=null,w=null,S=null,I=null;return d=this._hi/n,w=We.SPLIT*d,i=w-d,I=We.SPLIT*n,i=w-i,a=d-i,c=I-n,S=d*n,c=I-c,l=n-c,I=i*c-S+i*l+a*c+a*l,w=(this._hi-S-I+this._lo-d*r)/n,I=d+w,this._hi=I,this._lo=d-I+w,this}};We.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};We.prototype.divide=function(){if(arguments[0]instanceof We){var t=arguments[0],e=null,n=null,r=null,i=null,a=null,c=null,l=null,d=null;a=this._hi/t._hi,c=We.SPLIT*a,e=c-a,d=We.SPLIT*t._hi,e=c-e,n=a-e,r=d-t._hi,l=a*t._hi,r=d-r,i=t._hi-r,d=e*r-l+e*i+n*r+n*i,c=(this._hi-l-d+this._lo-a*t._lo)/t._hi,d=a+c;var w=d,S=a-d+c;return new We(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return $t.isNaN(I)?We.createNaN():We.copy(this).selfDivide(I,0)}};We.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};We.prototype.pow=function(t){if(t===0)return We.valueOf(1);var e=new We(this),n=We.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};We.prototype.ceil=function(){if(this.isNaN())return We.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new We(t,e)};We.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};We.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};We.prototype.setValue=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};We.prototype.max=function(t){return this.ge(t)?this:t};We.prototype.sqrt=function(){if(this.isZero())return We.valueOf(0);if(this.isNegative())return We.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=We.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};We.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof We){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,l=null;return i=this._hi+e,c=i-this._hi,a=i-c,a=e-c+(this._hi-a),l=a+this._lo,n=i+l,r=l+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],w=arguments[1],S=null,I=null,T=null,k=null,D=null,U=null,q=null,ee=null;D=this._hi+d,T=this._lo+w,q=D-this._hi,ee=T-this._lo,U=D-q,k=T-ee,U=d-q+(this._hi-U),k=w-ee+(this._lo-k),q=U+T,S=D+q,I=q+(D-S),q=k+I;var B=S+q,j=q+(S-B);return this._hi=B,this._lo=j,this}};We.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof We){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,l=null,d=null,w=null;d=We.SPLIT*this._hi,i=d-this._hi,w=We.SPLIT*n,i=d-i,a=this._hi-i,c=w-n,d=this._hi*n,c=w-c,l=n-c,w=i*c-d+i*l+a*c+a*l+(this._hi*r+this._lo*n);var S=d+w;i=d-S;var I=w+i;return this._hi=S,this._lo=I,this}};We.prototype.selfSqr=function(){return this.selfMultiply(this)};We.prototype.floor=function(){if(this.isNaN())return We.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new We(t,e)};We.prototype.negate=function(){return this.isNaN()?this:new We(-this._hi,-this._lo)};We.prototype.clone=function(){};We.prototype.multiply=function(){if(arguments[0]instanceof We){var t=arguments[0];return t.isNaN()?We.createNaN():We.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return $t.isNaN(e)?We.createNaN():We.copy(this).selfMultiply(e,0)}};We.prototype.isNaN=function(){return $t.isNaN(this._hi)};We.prototype.intValue=function(){return Math.trunc(this._hi)};We.prototype.toString=function(){var t=We.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};We.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."+We.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=We.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};We.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,a=null,c=null,l=null;i=1/this._hi,a=We.SPLIT*i,t=a-i,l=We.SPLIT*this._hi,t=a-t,e=i-t,n=l-this._hi,c=i*this._hi,n=l-n,r=this._hi-n,l=t*n-c+t*r+e*n+e*r,a=(1-c-l-i*this._lo)/this._hi;var d=i+a,w=i-d+a;return new We(d,w)};We.prototype.toSciNotation=function(){if(this.isZero())return We.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=We.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};We.prototype.abs=function(){return this.isNaN()?We.NaN:this.isNegative()?this.negate():new We(this)};We.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};We.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};We.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};We.prototype.trunc=function(){return this.isNaN()?We.NaN:this.isPositive()?this.floor():this.ceil()};We.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};We.prototype.interfaces_=function(){return[ms,ds,k_]};We.prototype.getClass=function(){return We};We.sqr=function(t){return We.valueOf(t).selfMultiply(t)};We.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return We.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new We(e)}};We.sqrt=function(t){return We.valueOf(t).sqrt()};We.parse=function(t){for(var e=0,n=t.length;Dd.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,Dd.isDigit(w)){var S=w-"0";a.selfMultiply(We.TEN),a.selfAdd(S),c++;continue}if(w==="."){l=c;continue}if(w==="e"||w==="E"){var I=t.substring(e);try{d=oa.parseInt(I)}catch(q){throw q instanceof Error?new Error("Invalid exponent "+I+" in string "+t):q}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var T=a,k=c-l-d;if(k===0)T=a;else if(k>0){var D=We.TEN.pow(k);T=a.divide(D)}else if(k<0){var U=We.TEN.pow(-k);T=a.multiply(U)}return r?T.negate():T};We.createNaN=function(){return new We($t.NaN,$t.NaN)};We.copy=function(t){return new We(t)};We.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};We.stringOfChar=function(t,e){for(var n=new ya,r=0;r0){if(a<=0)return uo.signum(c);r=i+a}else if(i<0){if(a>=0)return uo.signum(c);r=-i-a}else return uo.signum(c);var l=uo.DP_SAFE_EPSILON*r;return c>=l||-c>=l?uo.signum(c):2};uo.signum=function(t){return t>0?1:t<0?-1:0};KI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(uo,KI);var Tn=function(){},$d={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};$d.X.get=function(){return 0};$d.Y.get=function(){return 1};$d.Z.get=function(){return 2};$d.M.get=function(){return 3};Tn.prototype.setOrdinate=function(t,e,n){};Tn.prototype.size=function(){};Tn.prototype.getOrdinate=function(t,e){};Tn.prototype.getCoordinate=function(){};Tn.prototype.getCoordinateCopy=function(t){};Tn.prototype.getDimension=function(){};Tn.prototype.getX=function(t){};Tn.prototype.clone=function(){};Tn.prototype.expandEnvelope=function(t){};Tn.prototype.copy=function(){};Tn.prototype.getY=function(t){};Tn.prototype.toCoordinateArray=function(){};Tn.prototype.interfaces_=function(){return[k_]};Tn.prototype.getClass=function(){return Tn};Object.defineProperties(Tn,$d);var JI=function(){},Kf=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}(JI),Ci=function(){};Ci.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}};Nt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Nt){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))}};Nt.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};Nt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Nt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Nt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Nt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Nt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Nt.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()}};Nt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Nt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof Oe){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)}};Nt.prototype.centre=function(){return this.isNull()?null:new Oe((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Nt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Oe){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Nt){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],l=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)};Nt.prototype.hashCode=function(){var t=17;return t=37*t+Oe.hashCode(this._minx),t=37*t+Oe.hashCode(this._maxx),t=37*t+Oe.hashCode(this._miny),t=37*t+Oe.hashCode(this._maxy),t};Nt.prototype.interfaces_=function(){return[ds,ms]};Nt.prototype.getClass=function(){return Nt};Nt.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],l=Math.min(a.x,c.x),d=Math.max(a.x,c.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>d||Sd)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};mr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};mr.prototype.setPrecisionModel=function(t){this._precisionModel=t};mr.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),l=Math.abs(t.y-e.y);r>i?a=c:a=l,a===0&&!t.equals(e)&&(a=Math.max(c,l))}return ln.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};mr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return ln.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};Kc.DONT_INTERSECT.get=function(){return 0};Kc.DO_INTERSECT.get=function(){return 1};Kc.COLLINEAR.get=function(){return 2};Kc.NO_INTERSECTION.get=function(){return 0};Kc.POINT_INTERSECTION.get=function(){return 1};Kc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(mr,Kc);var Ju=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 Nt(this._inputLines[0][0],this._inputLines[0][1]),i=new Nt(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,Nt.intersects(r,i,n)&&St.orientationIndex(r,i,n)===0&&St.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=Ls.intersection(n,r,i,a)}catch(l){if(l instanceof Kf)c=e.nearestEndpoint(n,r,i,a);else throw l}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 Oe(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,l=Math.abs(c);return Math.abs(r)1e-4&&Ci.out.println("Distance = "+c.distance(l))},e.prototype.intersectionWithNormalization=function(n,r,i,a){var c=new Oe(n),l=new Oe(r),d=new Oe(i),w=new Oe(a),S=new Oe;this.normalizeToEnvCentre(c,l,d,w,S);var I=this.safeHCoordinateIntersection(c,l,d,w);return I.x+=S.x,I.y+=S.y,I},e.prototype.computeCollinearIntersection=function(n,r,i,a){var c=Nt.intersects(n,r,i),l=Nt.intersects(n,r,a),d=Nt.intersects(i,a,n),w=Nt.intersects(i,a,r);return c&&l?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):d&&w?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&d?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!l&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!l&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&d?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!c&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!c&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,a,c){var l=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,D=i.y>a.y?i.y:a.y,U=l>I?l:I,q=wT?d:T,B=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var d=St.orientationIndex(i,a,n),w=St.orientationIndex(i,a,r);if(d>0&&w>0||d<0&&w<0)return t.NO_INTERSECTION;var S=c===0&&l===0&&d===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(c===0||l===0||d===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 Oe(i):l===0?this._intPt[0]=new Oe(a):d===0?this._intPt[0]=new Oe(n):w===0&&(this._intPt[0]=new Oe(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,l=St.distancePointLine(n,i,a),d=St.distancePointLine(r,i,a);return d0?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 ra=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ra.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,l=e.y-this._p.y,d=Ac.signOfDet2x2(i,a,c,l);if(d===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};ra.prototype.isPointInPolygon=function(){return this.getLocation()!==Fe.EXTERIOR};ra.prototype.getLocation=function(){return this._isPointOnSegment?Fe.BOUNDARY:this._crossingCount%2===1?Fe.INTERIOR:Fe.EXTERIOR};ra.prototype.isOnSegment=function(){return this._isPointOnSegment};ra.prototype.interfaces_=function(){return[]};ra.prototype.getClass=function(){return ra};ra.locatePointInRing=function(){if(arguments[0]instanceof Oe&&Wt(arguments[1],Tn)){for(var t=arguments[0],e=arguments[1],n=new ra(t),r=new Oe,i=new Oe,a=1;a1||d<0||d>1)&&(i=!0)}}return i?Zo.min(St.distancePointLine(t,n,r),St.distancePointLine(e,n,r),St.distancePointLine(n,t,e),St.distancePointLine(r,t,e)):0};St.isPointInRing=function(t,e){return St.locatePointInRing(t,e)!==Fe.EXTERIOR};St.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Oe;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 l=r;do l=(l+1)%e;while(t[l].equals2D(n)&&l!==r);var d=t[c],w=t[l];if(d.equals2D(n)||w.equals2D(n)||d.equals2D(w))return!1;var S=St.computeOrientation(d,n,w),I=!1;return S===0?I=d.x>w.x:I=S>0,I};St.locatePointInRing=function(t,e){return ra.locatePointInRing(t,e)};St.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)};St.computeOrientation=function(t,e,n){return St.orientationIndex(t,e,n)};St.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new lr("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return a.distance(l);var S=((c.y-a.y)*(l.x-c.x)-(c.x-a.x)*(l.y-c.y))/d;return Math.abs(S)*Math.sqrt(d)}};St.isOnLine=function(t,e){for(var n=new Ju,r=1;r0};Cf.prototype.interfaces_=function(){return[hs]};Cf.prototype.getClass=function(){return Cf};var Tf=function(){};Tf.prototype.isInBoundary=function(t){return t>1};Tf.prototype.interfaces_=function(){return[hs]};Tf.prototype.getClass=function(){return Tf};var Lf=function(){};Lf.prototype.isInBoundary=function(t){return t===1};Lf.prototype.interfaces_=function(){return[hs]};Lf.prototype.getClass=function(){return Lf};var qr=function(){};qr.prototype.add=function(){};qr.prototype.addAll=function(){};qr.prototype.isEmpty=function(){};qr.prototype.iterator=function(){};qr.prototype.size=function(){};qr.prototype.toArray=function(){};qr.prototype.remove=function(){};function i1(t){this.message=t||""}i1.prototype=new Error;i1.prototype.name="IndexOutOfBoundsException";var Jf=function(){};Jf.prototype.hasNext=function(){};Jf.prototype.next=function(){};Jf.prototype.remove=function(){};var Ps=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}(qr);function Qf(t){this.message=t||""}Qf.prototype=new Error;Qf.prototype.name="NoSuchElementException";var gt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof qr&&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,qr]},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 _R(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new i1;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(l))return null}t.prototype.add.call(this,l)}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 T=arguments[0],k=arguments[1],D=arguments[2];if(D)for(var U=0;U=0;q--)r.add(T[q],k);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Oe){var ee=arguments[0],B=arguments[1],j=arguments[2];if(!j){var $=this.size();if($>0){if(ee>0){var ae=this.get(ee-1);if(ae.equals2D(B))return null}if(ee<$){var me=this.get(ee);if(me.equals2D(B))return null}}}t.prototype.add.call(this,ee,B)}}else if(arguments.length===4){var pe=arguments[0],Q=arguments[1],oe=arguments[2],Ae=arguments[3],Y=1;oe>Ae&&(Y=-1);for(var ie=oe;ie!==Ae;ie+=Y)r.add(pe[ie],Q);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Oe(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(gt),vn=function(){},R_={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};R_.ForwardComparator.get=function(){return Rd};R_.BidirectionalComparator.get=function(){return Pf};R_.coordArrayType.get=function(){return new Array(0).fill(null)};vn.prototype.interfaces_=function(){return[]};vn.prototype.getClass=function(){return vn};vn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};vn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};vn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};vn.extract=function(t,e,n){e=Zo.clamp(e,0,t.length),n=Zo.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=vn.compare(n,r),a=vn.isEqualReversed(n,r);return a?0:i};Pf.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=vn.increasingDirection(n),a=vn.increasingDirection(r),c=i>0?0:n.length-1,l=a>0?0:n.length-1,d=0;d0)e=e.right;else return e.value}return null};Ri.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,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:ul,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};Ri.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Pu;t!=null&&t!==this.root_&&t.parent.color===Pu;)if(Kn(t)===C0(Kn(Kn(t)))){var n=u2(Kn(Kn(t)));l2(n)===Pu?(il(Kn(t),ul),il(n,ul),il(Kn(Kn(t)),Pu),t=Kn(Kn(t))):(t===u2(Kn(t))&&(t=Kn(t),e.rotateLeft(t)),il(Kn(t),ul),il(Kn(Kn(t)),Pu),e.rotateRight(Kn(Kn(t))))}else{var r=C0(Kn(Kn(t)));l2(r)===Pu?(il(Kn(t),ul),il(r,ul),il(Kn(Kn(t)),Pu),t=Kn(Kn(t))):(t===C0(Kn(t))&&(t=Kn(t),e.rotateRight(t)),il(Kn(t),ul),il(Kn(Kn(t)),Pu),e.rotateLeft(Kn(Kn(t))))}this.root_.color=ul};Ri.prototype.values=function(){var t=new gt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Ri.successor(e))!==null;)t.add(e.value);return t};Ri.prototype.entrySet=function(){var t=new o1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Ri.successor(e))!==null;)t.add(e);return t};Ri.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}};Ri.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}};Ri.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Ri.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}};Ri.prototype.size=function(){return this.size_};var Nd=function(){};Nd.prototype.interfaces_=function(){return[]};Nd.prototype.getClass=function(){return Nd};function $I(){}$I.prototype=new N_;function sa(){this.array_=[],arguments[0]instanceof qr&&this.addAll(arguments[0])}sa.prototype=new $I;sa.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 l=new Array(r.size()).fill(null),d=0;d0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(as.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Ar.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Ar.createClosedRing(t,e,4);var r=e.getOrdinate(0,Tn.X)===e.getOrdinate(n-1,Tn.X)&&e.getOrdinate(0,Tn.Y)===e.getOrdinate(n-1,Tn.Y);return r?e:Ar.createClosedRing(t,e,n+1)};Ar.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Ar.copy(e,0,r,0,i);for(var a=i;a0&&Ar.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?kn.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 St.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Ar.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,l=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}(Sr),ka=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 jt.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};Fd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Fd.prototype.getClass=function(){return Fd};var Bd=function(){};Bd.prototype.edit=function(t,e){return t instanceof Oa?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Sr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Po?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Bd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Bd.prototype.getClass=function(){return Bd};var Pr=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 ya(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Pr(n):new Pr(n,r)}};za.prototype.interfaces_=function(){return[Ef,ms]};za.prototype.getClass=function(){return za};za.instance=function(){return za.instanceObject};a1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};a1.instanceObject.get=function(){return new za};Object.defineProperties(za,a1);var tC=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 gt,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 o1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Qc),Rn=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 la){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}}},l1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Rn.prototype.equals=function(t){if(!(t instanceof Rn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Rn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new oa(n).compareTo(new oa(r))};Rn.prototype.getScale=function(){return this._scale};Rn.prototype.isFloating=function(){return this._modelType===Rn.FLOATING||this._modelType===Rn.FLOATING_SINGLE};Rn.prototype.getType=function(){return this._modelType};Rn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Rn.FLOATING?t="Floating":this._modelType===Rn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Rn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Rn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if($t.isNaN(t))return t;if(this._modelType===Rn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Rn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Oe){var n=arguments[0];if(this._modelType===Rn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Rn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Rn.FLOATING?t=16:this._modelType===Rn.FLOATING_SINGLE?t=6:this._modelType===Rn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Rn.prototype.setScale=function(t){this._scale=Math.abs(t)};Rn.prototype.interfaces_=function(){return[ms,ds]};Rn.prototype.getClass=function(){return Rn};Rn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};l1.serialVersionUID.get=function(){return 7777263578777804e3};l1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Rn,l1);var la=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},u1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};la.prototype.readResolve=function(){return la.nameToTypeMap.get(this._name)};la.prototype.toString=function(){return this._name};la.prototype.interfaces_=function(){return[ms]};la.prototype.getClass=function(){return la};u1.serialVersionUID.get=function(){return-552860263173159e4};u1.nameToTypeMap.get=function(){return new tC};Object.defineProperties(la,u1);Rn.Type=la;Rn.FIXED=new la("FIXED");Rn.FLOATING=new la("FLOATING");Rn.FLOATING_SINGLE=new la("FLOATING SINGLE");var yn=function t(){this._precisionModel=new Rn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Wt(arguments[0],Ef)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Rn&&(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]))},nC={serialVersionUID:{configurable:!0}};yn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Oe(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Oe(t.getMinX(),t.getMinY()),new Oe(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Oe(t.getMinX(),t.getMinY()),new Oe(t.getMinX(),t.getMaxY()),new Oe(t.getMaxX(),t.getMaxY()),new Oe(t.getMaxX(),t.getMinY()),new Oe(t.getMinX(),t.getMinY())]),null)};yn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Sr(this.getCoordinateSequenceFactory().create(t),this);if(Wt(t,Tn))return new Sr(t,this)}else return new Sr(this.getCoordinateSequenceFactory().create([]),this)};yn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Fu(null,this);if(arguments.length===1){var t=arguments[0];return new Fu(t,this)}};yn.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(yn.toGeometryArray(t));var l=t.iterator().next(),d=t.size()>1;if(d){if(l instanceof Qr)return this.createMultiPolygon(yn.toPolygonArray(t));if(l instanceof Sr)return this.createMultiLineString(yn.toLineStringArray(t));if(l instanceof Po)return this.createMultiPoint(yn.toPointArray(t));ln.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};yn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};yn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Oe){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Wt(arguments[0],Tn)){var e=arguments[0];return new Po(e,this)}}};yn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};yn.prototype.createPolygon=function(){if(arguments.length===0)return new Qr(null,null,this);if(arguments.length===1){if(Wt(arguments[0],Tn)){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 Oa){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Qr(r,i,this)}};yn.prototype.getSRID=function(){return this._SRID};yn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Yi(null,this);if(arguments.length===1){var t=arguments[0];return new Yi(t,this)}};yn.prototype.createGeometry=function(t){var e=new fs(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};yn.prototype.getPrecisionModel=function(){return this._precisionModel};yn.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(Wt(arguments[0],Tn)){var e=arguments[0];return new Oa(e,this)}}};yn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ka(null,this);if(arguments.length===1){var t=arguments[0];return new ka(t,this)}};yn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Mf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Mf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Wt(arguments[0],Tn)){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]};va.prototype.push=function(t){return this.array_.push(t),t};va.prototype.pop=function(t){if(this.array_.length===0)throw new V_;return this.array_.pop()};va.prototype.peek=function(){if(this.array_.length===0)throw new V_;return this.array_[this.array_.length-1]};va.prototype.empty=function(){return this.array_.length===0};va.prototype.isEmpty=function(){return this.empty()};va.prototype.search=function(t){return this.array_.indexOf(t)};va.prototype.size=function(){return this.array_.length};va.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===St.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ua.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=lt.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};ua.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)};ua.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}ln.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===lt.LEFT&&(this._orientedDe=this._minDe.getSym())};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};var yl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new Oe(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}(gl),U_=function(){this.array_=[]};U_.prototype.addLast=function(t){this.array_.push(t)};U_.prototype.removeFirst=function(){return this.array_.shift()};U_.prototype.isEmpty=function(){return this.array_.length===0};var Ki=function(){this._finder=null,this._dirEdgeList=new gt,this._nodes=new gt,this._rightMostCoord=null,this._env=null,this._finder=new ua};Ki.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Ki.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Ki.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 yl("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)}};Ki.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(lt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Ki.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Ki.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(lt.RIGHT)>=1&&e.getDepth(lt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Ki.prototype.computeDepths=function(t){var e=this,n=new o1,r=new U_,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 l=c.next(),d=l.getSym();if(!d.isVisited()){var w=d.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Ki.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Ki.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Nt,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[lt.ON]=this.location[lt.ON],n[lt.LEFT]=Fe.NONE,n[lt.RIGHT]=Fe.NONE,this.location=n}for(var r=0;r1&&t.append(Fe.toLocationSymbol(this.location[lt.LEFT])),t.append(Fe.toLocationSymbol(this.location[lt.ON])),this.location.length>1&&t.append(Fe.toLocationSymbol(this.location[lt.RIGHT])),t.toString()};Jn.prototype.setLocations=function(t,e,n){this.location[lt.ON]=t,this.location[lt.LEFT]=e,this.location[lt.RIGHT]=n};Jn.prototype.get=function(t){return t1};Jn.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};Br.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;d--)r._pts.add(i[d])}};Br.prototype.isHole=function(){return this._isHole};Br.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Br.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!St.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};Br.prototype.addHole=function(t){this._holes.add(t)};Br.prototype.isShell=function(){return this._shell===null};Br.prototype.getLabel=function(){return this._label};Br.prototype.getEdges=function(){return this._edges};Br.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Br.prototype.getShell=function(){return this._shell};Br.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,lt.RIGHT);if(r===Fe.NONE)return null;if(this._label.getLocation(n)===Fe.NONE)return this._label.setLocation(n,r),null}};Br.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Br.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)};Xo.prototype.isInResult=function(){return this._isInResult};Xo.prototype.isVisited=function(){return this._isVisited};Xo.prototype.interfaces_=function(){return[]};Xo.prototype.getClass=function(){return Xo};var G_=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 Vn(0,Fe.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=Fe.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==Fe.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 Vn(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 Vn)for(var i=arguments[0],a=0;a<2;a++){var c=n.computeMergedLocation(i,a),l=n._label.getLocation(a);l===Fe.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=Fe.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Fe.BOUNDARY:i=Fe.INTERIOR;break;case Fe.INTERIOR:i=Fe.BOUNDARY;break;default:i=Fe.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xo),ca=function(){this.nodeMap=new Ri,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ca.prototype.find=function(t){return this.nodeMap.get(t)};ca.prototype.addNode=function(){if(arguments[0]instanceof Oe){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 G_){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ca.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};ca.prototype.iterator=function(){return this.nodeMap.values().iterator()};ca.prototype.values=function(){return this.nodeMap.values()};ca.prototype.getBoundaryNodes=function(t){for(var e=new gt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Fe.BOUNDARY&&e.add(r)}return e};ca.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};var Un=function(){},nm={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Un.prototype.interfaces_=function(){return[]};Un.prototype.getClass=function(){return Un};Un.isNorthern=function(t){return t===Un.NE||t===Un.NW};Un.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Un.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};Un.isInHalfPlane=function(t,e){return e===Un.SE?t===Un.SE||t===Un.SW:t===e||t===e+1};Un.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 lr("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Un.NE:Un.SE:e>=0?Un.NW:Un.SW}else if(arguments[0]instanceof Oe&&arguments[1]instanceof Oe){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new lr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Un.NE:Un.SE:r.y>=n.y?Un.NW:Un.SW}};nm.NE.get=function(){return 0};nm.NW.get=function(){return 1};nm.SW.get=function(){return 2};nm.SE.get=function(){return 3};Object.defineProperties(Un,nm);var Ni=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],l=arguments[2],d=arguments[3];this._edge=a,this.init(c,l),this._label=d}};Ni.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var l=c.buildMinimalRings(),d=r.findShell(l);d!==null?(r.placePolygonHoles(d,l),e.add(d)):n.addAll(l)}else i.add(c)}return i};Mo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Mo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new gt,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new LR(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};Mo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Mo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Mo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,c=null,l=e.iterator();l.hasNext();){var d=l.next(),w=d.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(c=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&St.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||c.contains(S))&&(a=d)}return a};Mo.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 ln.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Mo.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];gr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new gt,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Mo.prototype.interfaces_=function(){return[]};Mo.prototype.getClass=function(){return Mo};var kf=function(){};kf.prototype.getBounds=function(){};kf.prototype.interfaces_=function(){return[]};kf.prototype.getClass=function(){return kf};var ks=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};ks.prototype.getItem=function(){return this._item};ks.prototype.getBounds=function(){return this._bounds};ks.prototype.interfaces_=function(){return[kf,ms]};ks.prototype.getClass=function(){return ks};var vl=function(){this._size=null,this._items=null,this._size=0,this._items=new gt,this._items.add(null)};vl.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};vl.prototype.size=function(){return this._size};vl.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)};vl.prototype.clear=function(){this._size=0,this._items.clear()};vl.prototype.isEmpty=function(){return this._size===0};vl.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)};vl.prototype.interfaces_=function(){return[]};vl.prototype.getClass=function(){return vl};var eu=function(){};eu.prototype.visitItem=function(t){};eu.prototype.interfaces_=function(){return[]};eu.prototype.getClass=function(){return eu};var kc=function(){};kc.prototype.insert=function(t,e){};kc.prototype.remove=function(t,e){};kc.prototype.query=function(){};kc.prototype.interfaces_=function(){return[]};kc.prototype.getClass=function(){return kc};var Zr=function(){if(this._childBoundables=new gt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},iC={serialVersionUID:{configurable:!0}};Zr.prototype.getLevel=function(){return this._level};Zr.prototype.size=function(){return this._childBoundables.size()};Zr.prototype.getChildBoundables=function(){return this._childBoundables};Zr.prototype.addChildBoundable=function(t){ln.isTrue(this._bounds===null),this._childBoundables.add(t)};Zr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Zr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Zr.prototype.interfaces_=function(){return[kf,ms]};Zr.prototype.getClass=function(){return Zr};iC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Zr,iC);var Ds=function(){};Ds.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ds.min=function(t){return Ds.sort(t),t.get(0)};Ds.sort=function(t,e){var n=t.toArray();e?Nu.sort(n,e):Nu.sort(n);for(var r=t.iterator(),i=0,a=n.length;iOr.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 lr("neither boundable is composite")};Or.prototype.isLeaves=function(){return!(Or.isComposite(this._boundable1)||Or.isComposite(this._boundable2))};Or.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Or.prototype.expand=function(t,e,n,r){for(var i=this,a=t.getChildBoundables(),c=a.iterator();c.hasNext();){var l=c.next(),d=new Or(l,e,i._itemDistance);d.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},j_={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};yi.prototype.getNodeCapacity=function(){return this._nodeCapacity};yi.prototype.lastNode=function(t){return t.get(t.size()-1)};yi.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 Zr?n+=t.size(i):i instanceof ks&&(n+=1)}return n}};yi.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof ks&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};yi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new gt:e}else if(arguments.length===1){for(var n=arguments[0],r=new gt,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Zr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof ks?r.add(a.getItem()):ln.shouldNeverReachHere()}return r.size()<=0?null:r}};yi.prototype.insert=function(t,e){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ks(t,e))};yi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new gt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(ln.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var l=c.next();l instanceof Zr?t.boundablesAtLevel(r,l,a):(ln.isTrue(l instanceof ks),r===-1&&a.add(l))}return null}};yi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new gt;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(Wt(arguments[2],eu)&&arguments[0]instanceof Object&&arguments[1]instanceof Zr)for(var a=arguments[0],c=arguments[1],l=arguments[2],d=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};yi.prototype.createParentBoundables=function(t,e){var n=this;ln.isTrue(!t.isEmpty());var r=new gt;r.add(this.createNode(e));var i=new gt(t);Ds.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};yi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};yi.prototype.interfaces_=function(){return[ms]};yi.prototype.getClass=function(){return yi};yi.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new gt,l=0;l0;){var D=k.poll(),U=D.getDistance();if(U>=I)break;D.isLeaves()?(I=U,T=D):D.expandToQueue(k,I)}return[T.getBoundable(0).getItem(),T.getBoundable(1).getItem()]}}else if(arguments.length===3){var q=arguments[0],ee=arguments[1],B=arguments[2],j=new ks(q,ee),$=new Or(this.getRoot(),j,B);return this.nearestNeighbour($)[0]}},e.prototype.interfaces_=function(){return[kc,ms]},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 c2},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Sf]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Sf]},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}(yi),c2=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 Nt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zr),ao=function(){};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};ao.relativeSign=function(t,e){return te?1:0};ao.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=ao.relativeSign(e.x,n.x),i=ao.relativeSign(e.y,n.y);switch(t){case 0:return ao.compareValue(r,i);case 1:return ao.compareValue(i,r);case 2:return ao.compareValue(i,-r);case 3:return ao.compareValue(-r,i);case 4:return ao.compareValue(-r,-i);case 5:return ao.compareValue(-i,-r);case 6:return ao.compareValue(-i,r);case 7:return ao.compareValue(r,-i)}return ln.shouldNeverReachHere("invalid octant value"),0};ao.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var tu=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 Oe(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};tu.prototype.getCoordinate=function(){return this.coord};tu.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};tu.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:ao.compare(this._segmentOctant,this.coord,e.coord)};tu.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};tu.prototype.isInterior=function(){return this._isInterior};tu.prototype.interfaces_=function(){return[ds]};tu.prototype.getClass=function(){return tu};var Ji=function(){this._nodeMap=new Ri,this._edge=null;var t=arguments[0];this._edge=t};Ji.prototype.getSplitCoordinates=function(){var t=this,e=new em;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()};Ji.prototype.addCollapsedNodes=function(){var t=this,e=new gt;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)}};Ji.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Ji.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 Oe&&arguments[1]instanceof Oe){var i=arguments[0],a=arguments[1],c=a.x-i.x,l=a.y-i.y;if(c===0&&l===0)throw new lr("Cannot compute the octant for two identical points "+i);return Dc.octant(c,l)}};var Fa=function(){};Fa.prototype.getCoordinates=function(){};Fa.prototype.size=function(){};Fa.prototype.getCoordinate=function(t){};Fa.prototype.isClosed=function(){};Fa.prototype.setData=function(t){};Fa.prototype.getData=function(){};Fa.prototype.interfaces_=function(){return[]};Fa.prototype.getClass=function(){return Fa};var Vd=function(){};Vd.prototype.addIntersection=function(t,e){};Vd.prototype.interfaces_=function(){return[Fa]};Vd.prototype.getClass=function(){return Vd};var kr=function(){this._nodeList=new Ji(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};kr.prototype.getCoordinates=function(){return this._pts};kr.prototype.size=function(){return this._pts.length};kr.prototype.getCoordinate=function(t){return this._pts[t]};kr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};kr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};kr.prototype.setData=function(t){this._data=t};kr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Dc.octant(t,e)};kr.prototype.getData=function(){return this._data};kr.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 Oe(n.getIntersection(i));this.addIntersection(a,r)}};kr.prototype.toString=function(){return Ms.toLineString(new Pr(this._pts))};kr.prototype.getNodeList=function(){return this._nodeList};kr.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 Oe){var r=arguments[0];return St.orientationIndex(this.p0,this.p1,r)}};Ot.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Ot.prototype.isVertical=function(){return this.p0.x===this.p1.x};Ot.prototype.equals=function(t){if(!(t instanceof Ot))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Ot.prototype.intersection=function(t){var e=new Ju;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Ot.prototype.project=function(){if(arguments[0]instanceof Oe){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Oe(t);var e=this.projectionFactor(t),n=new Oe;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 Ot){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 l=this.project(r.p1);return a<0&&(l=this.p0),a>1&&(l=this.p1),new Ot(c,l)}};Ot.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Ot.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Ot.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Ot.prototype.distancePerpendicular=function(t){return St.distancePointLinePerpendicular(t,this.p0,this.p1)};Ot.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Ot.prototype.midPoint=function(){return Ot.midPoint(this.p0,this.p1)};Ot.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 $t.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};Ot.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=$t.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||$t.isNaN(e))&&(e=1),e};Ot.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Ot.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Ot.prototype.distance=function(){if(arguments[0]instanceof Ot){var t=arguments[0];return St.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Oe){var e=arguments[0];return St.distancePointLine(e,this.p0,this.p1)}};Ot.prototype.pointAlong=function(t){var e=new Oe;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};Ot.prototype.hashCode=function(){var t=$t.doubleToLongBits(this.p0.x);t^=$t.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=$t.doubleToLongBits(this.p1.x);n^=$t.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};Ot.prototype.interfaces_=function(){return[ds,ms]};Ot.prototype.getClass=function(){return Ot};Ot.midPoint=function(t,e){return new Oe((t.x+e.x)/2,(t.y+e.y)/2)};sC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Ot,sC);var Ud=function(){this.tempEnv1=new Nt,this.tempEnv2=new Nt,this._overlapSeg1=new Ot,this._overlapSeg2=new Ot};Ud.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)}};Ud.prototype.interfaces_=function(){return[]};Ud.prototype.getClass=function(){return Ud};var Ao=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};Ao.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Ao.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=Un.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 h2},Object.defineProperties(e,n),e}(Gd),h2=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(),l=i.getContext();this._si.processIntersections(c,r,l,a)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ud),Dn=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],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(c),this.setMitreLimit(l)}}},Il={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}};Dn.prototype.getEndCapStyle=function(){return this._endCapStyle};Dn.prototype.isSingleSided=function(){return this._isSingleSided};Dn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Dn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Dn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Dn.JOIN_ROUND&&(this._quadrantSegments=Dn.DEFAULT_QUADRANT_SEGMENTS)};Dn.prototype.getJoinStyle=function(){return this._joinStyle};Dn.prototype.setJoinStyle=function(t){this._joinStyle=t};Dn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Dn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Dn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Dn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Dn.prototype.getMitreLimit=function(){return this._mitreLimit};Dn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Dn.prototype.setSingleSided=function(t){this._isSingleSided=t};Dn.prototype.interfaces_=function(){return[]};Dn.prototype.getClass=function(){return Dn};Dn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Il.CAP_ROUND.get=function(){return 1};Il.CAP_FLAT.get=function(){return 2};Il.CAP_SQUARE.get=function(){return 3};Il.JOIN_ROUND.get=function(){return 1};Il.JOIN_MITRE.get=function(){return 2};Il.JOIN_BEVEL.get=function(){return 3};Il.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Il.DEFAULT_MITRE_LIMIT.get=function(){return 5};Il.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Dn,Il);var Er=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=St.COUNTERCLOCKWISE,this._inputLine=t||null},rm={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Er.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)};Er.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])};Yo.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-=Sn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Sn.PI_TIMES_2;return t};Sn.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)}};Sn.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,l=r*a+i*c;return l>0};Sn.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,l=r*a+i*c;return l<0};Sn.interiorAngle=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Math.abs(i-r)};Sn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Sn.PI_TIMES_2;t>=Sn.PI_TIMES_2&&(t=0)}else{for(;t>=Sn.PI_TIMES_2;)t-=Sn.PI_TIMES_2;t<0&&(t=0)}return t};Sn.angleBetween=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Sn.diff(r,i)};Sn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Sn.toRadians=function(t){return t*Math.PI/180};Sn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Sn.COUNTERCLOCKWISE:n<0?Sn.CLOCKWISE:Sn.NONE};Sn.angleBetweenOriented=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n),a=i-r;return a<=-Math.PI?a+Sn.PI_TIMES_2:a>Math.PI?a-Sn.PI_TIMES_2:a};$c.PI_TIMES_2.get=function(){return 2*Math.PI};$c.PI_OVER_2.get=function(){return Math.PI/2};$c.PI_OVER_4.get=function(){return Math.PI/4};$c.COUNTERCLOCKWISE.get=function(){return St.COUNTERCLOCKWISE};$c.CLOCKWISE.get=function(){return St.CLOCKWISE};$c.NONE.get=function(){return St.COLLINEAR};Object.defineProperties(Sn,$c);var nr=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 Ot,this._seg1=new Ot,this._offset0=new Ot,this._offset1=new Ot,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 Ju,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Dn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},im={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}};nr.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=St.computeOrientation(this._s0,this._s1,this._s2),r=n===St.CLOCKWISE&&this._side===lt.LEFT||n===St.COUNTERCLOCKWISE&&this._side===lt.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};nr.prototype.addLineEndCap=function(t,e){var n=new Ot(t,e),r=new Ot;this.computeOffsetSegment(n,lt.LEFT,this._distance,r);var i=new Ot;this.computeOffsetSegment(n,lt.RIGHT,this._distance,i);var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a);switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,St.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Dn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Dn.CAP_SQUARE:var d=new Oe;d.x=Math.abs(this._distance)*Math.cos(l),d.y=Math.abs(this._distance)*Math.sin(l);var w=new Oe(r.p1.x+d.x,r.p1.y+d.y),S=new Oe(i.p1.x+d.x,i.p1.y+d.y);this._segList.addPt(w),this._segList.addPt(S);break}};nr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};nr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Ls.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(l){if(l instanceof Kf)a=new Oe(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};nr.prototype.addFilletCorner=function(t,e,n,r,i){var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a),d=n.x-t.x,w=n.y-t.y,S=Math.atan2(w,d);r===St.CLOCKWISE?l<=S&&(l+=2*Math.PI):l>=S&&(l-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,l,S,r,i),this._segList.addPt(n)};nr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Oe((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 Oe((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)}};nr.prototype.createCircle=function(t){var e=new Oe(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};nr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};nr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Yo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*nr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};nr.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()===Dn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Dn.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,St.CLOCKWISE,this._distance))};nr.prototype.closeRing=function(){this._segList.closeRing()};nr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};nr.prototype.interfaces_=function(){return[]};nr.prototype.getClass=function(){return nr};im.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};im.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};im.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};im.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(nr,im);var ho=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};ho.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&&vn.reverse(a),a};ho.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Er.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],lt.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var l=Er.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],lt.LEFT),n.addFirstSegment();for(var w=2;w<=d;w++)n.addNextSegment(l[w],!0)}n.addLastSegment(),n.closeRing()};ho.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===lt.RIGHT&&(r=-r);var i=Er.simplify(t,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],e);for(var c=1;c<=a;c++){var l=c!==1;n.addNextSegment(i[c],l)}n.closeRing()};ho.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Er.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],lt.LEFT);for(var a=2;a<=i;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=Er.simplify(t,-n),l=c.length-1;e.initSideSegments(c[l],c[l-1],lt.LEFT);for(var d=l-2;d>=0;d--)e.addNextSegment(c[d],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};ho.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:e.createCircle(t);break;case Dn.CAP_SQUARE:e.createSquare(t);break}};ho.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};ho.prototype.getBufferParameters=function(){return this._bufParams};ho.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};ho.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return ho.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};ho.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Er.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],lt.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var l=Er.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],lt.LEFT),n.addFirstSegment();for(var w=2;w<=d;w++)n.addNextSegment(l[w],!0)}n.addLastSegment()};ho.prototype.getSegGen=function(t){return new nr(this._precisionModel,this._bufParams,t)};ho.prototype.interfaces_=function(){return[]};ho.prototype.getClass=function(){return ho};ho.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(Wt(arguments[2],Ps)&&arguments[0]instanceof Oe&&arguments[1]instanceof dv)for(var c=arguments[0],l=arguments[1],d=arguments[2],w=l.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)&&St.computeOrientation(t._seg.p0,t._seg.p1,c)!==St.RIGHT){var T=l.getDepth(lt.LEFT);t._seg.p0.equals(w[S])||(T=l.getDepth(lt.RIGHT));var k=new Vu(t._seg,T);d.add(k)}}else if(Wt(arguments[2],Ps)&&arguments[0]instanceof Oe&&Wt(arguments[1],Ps))for(var D=arguments[0],U=arguments[1],q=arguments[2],ee=U.iterator();ee.hasNext();){var B=ee.next();B.isForward()&&t.findStabbedSegments(D,B,q)}}};Rc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ds.min(e);return n._leftDepth};Rc.prototype.interfaces_=function(){return[]};Rc.prototype.getClass=function(){return Rc};lC.DepthSegment.get=function(){return Vu};Object.defineProperties(Rc,lC);var Vu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Ot(t),this._leftDepth=e};Vu.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)};Vu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Vu.prototype.toString=function(){return this._upwardSeg.toString()};Vu.prototype.interfaces_=function(){return[ds]};Vu.prototype.getClass=function(){return Vu};var Nn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Nn.prototype.area=function(){return Nn.area(this.p0,this.p1,this.p2)};Nn.prototype.signedArea=function(){return Nn.signedArea(this.p0,this.p1,this.p2)};Nn.prototype.interpolateZ=function(t){if(t===null)throw new lr("Supplied point is null.");return Nn.interpolateZ(t,this.p0,this.p1,this.p2)};Nn.prototype.longestSideLength=function(){return Nn.longestSideLength(this.p0,this.p1,this.p2)};Nn.prototype.isAcute=function(){return Nn.isAcute(this.p0,this.p1,this.p2)};Nn.prototype.circumcentre=function(){return Nn.circumcentre(this.p0,this.p1,this.p2)};Nn.prototype.area3D=function(){return Nn.area3D(this.p0,this.p1,this.p2)};Nn.prototype.centroid=function(){return Nn.centroid(this.p0,this.p1,this.p2)};Nn.prototype.inCentre=function(){return Nn.inCentre(this.p0,this.p1,this.p2)};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.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)};Nn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};Nn.det=function(t,e,n,r){return t*r-e*n};Nn.interpolateZ=function(t,e,n,r){var i=e.x,a=e.y,c=n.x-i,l=r.x-i,d=n.y-a,w=r.y-a,S=c*w-l*d,I=t.x-i,T=t.y-a,k=(w*I-l*T)/S,D=(-d*I+c*T)/S,U=e.z+k*(n.z-e.z)+D*(r.z-e.z);return U};Nn.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};Nn.isAcute=function(t,e,n){return!(!Sn.isAcute(t,e,n)||!Sn.isAcute(e,n,t)||!Sn.isAcute(n,t,e))};Nn.circumcentre=function(t,e,n){var r=n.x,i=n.y,a=t.x-r,c=t.y-i,l=e.x-r,d=e.y-i,w=2*Nn.det(a,c,l,d),S=Nn.det(c,a*a+c*c,d,l*l+d*d),I=Nn.det(a,a*a+c*c,l,l*l+d*d),T=r-S/w,k=i+I/w;return new Oe(T,k)};Nn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Ls(t.x+n/2,t.y+r/2,1),a=new Ls(t.x-r+n/2,t.y+n+r/2,1);return new Ls(i,a)};Nn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),a=r/(r+i),c=n.x-t.x,l=n.y-t.y,d=new Oe(t.x+a*c,t.y+a*l);return d};Nn.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,l=n.y-t.y,d=n.z-t.z,w=i*d-a*l,S=a*c-r*d,I=r*l-i*c,T=w*w+S*S+I*I,k=Math.sqrt(T)/2;return k};Nn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Oe(r,i)};Nn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),a=t.distance(e),c=r+i+a,l=(r*t.x+i*e.x+a*n.x)/c,d=(r*t.y+i*e.y+a*n.y)/c;return new Oe(l,d)};var ps=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new gt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};ps.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Fe.EXTERIOR,Fe.INTERIOR)};ps.prototype.addPolygon=function(t){var e=this,n=this._distance,r=lt.LEFT;this._distance<0&&(n=-this._distance,r=lt.RIGHT);var i=t.getExteriorRing(),a=vn.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,Fe.EXTERIOR,Fe.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(l,-e._distance)||e.addPolygonRing(d,n,lt.opposite(r),Fe.INTERIOR,Fe.EXTERIOR)}};ps.prototype.isTriangleErodedCompletely=function(t,e){var n=new Nn(t[0],t[1],t[2]),r=n.inCentre(),i=St.distancePointLine(r,n.p0,n.p1);return i=Oa.MINIMUM_VALID_SIZE&&St.isCCW(t)&&(a=i,c=r,n=lt.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,a,c)};ps.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Qr?this.addPolygon(t):t instanceof Sr?this.addLineString(t):t instanceof Po?this.addPoint(t):t instanceof Mf?this.addCollection(t):t instanceof Fu?this.addCollection(t):t instanceof ka?this.addCollection(t):t instanceof Yi&&this.addCollection(t)};ps.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};ps.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new Qf;var t=this._parent.getGeometryN(this._index++);return t instanceof Yi?(this._subcollectionIterator=new Da(t),this._subcollectionIterator.next()):t};Da.prototype.remove=function(){throw new Error(this.getClass().getName())};Da.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)};Da.prototype.interfaces_=function(){return[Jf]};Da.prototype.getClass=function(){return Da};Da.isAtomic=function(t){return!(t instanceof Yi)};var Wo=function(){this._geom=null;var t=arguments[0];this._geom=t};Wo.prototype.locate=function(t){return Wo.locate(t,this._geom)};Wo.prototype.interfaces_=function(){return[Rf]};Wo.prototype.getClass=function(){return Wo};Wo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?St.isPointInRing(t,e.getCoordinates()):!1};Wo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Wo.isPointInRing(t,n))return!1;for(var r=0;r=0;a--){var c=n._edgeList.get(a),l=c.getSym();i===null&&(i=l),r!==null&&l.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(lt.LEFT),c=r.getDepth(lt.RIGHT),l=this.computeDepths(i+1,this._edgeList.size(),a),d=this.computeDepths(0,i,l);if(d!==c)throw new yl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],T=I,k=w;k=0;l--){var d=r._resultAreaEdgeList.get(l),w=d.getSym();switch(i===null&&d.getEdgeRing()===n&&(i=d),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(d.getEdgeRing()!==n)continue;a.setNextMin(d),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(ln.isTrue(i!==null,"found null for first outgoing dirEdge"),ln.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,l=this.iterator();l.hasNext();){var d=l.next();d.getEdgeRing()===a&&c++}return c}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Fe.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Fe.INTERIOR;break}if(a.isInResult()){n=Fe.EXTERIOR;break}}}if(n===Fe.NONE)return null;for(var c=n,l=this.iterator();l.hasNext();){var d=l.next(),w=d.getSym();d.isLineEdge()?d.getEdge().setCovered(c===Fe.INTERIOR):(d.isInResult()&&(c=Fe.EXTERIOR),w.isInResult()&&(c=Fe.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new Vn(Fe.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getEdge(),l=c.getLabel(),d=0;d<2;d++){var w=l.getLocation(d);(w===Fe.INTERIOR||w===Fe.BOUNDARY)&&r._label.setLocation(d,Fe.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oi),uC=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 G_(n,new MR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Af),nu=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};nu.prototype.compareTo=function(t){var e=t,n=nu.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};nu.prototype.interfaces_=function(){return[ds]};nu.prototype.getClass=function(){return nu};nu.orientation=function(t){return vn.increasingDirection(t)===1};nu.compareOriented=function(t,e,n,r){for(var i=e?1:-1,a=r?1:-1,c=e?t.length:-1,l=r?n.length:-1,d=e?0:t.length-1,w=r?0:n.length-1;;){var S=t[d].compareTo(n[w]);if(S!==0)return S;d+=i,w+=a;var I=d===c,T=w===l;if(I&&!T)return-1;if(!I&&T)return 1;if(I&&T)return 0}};var Rs=function(){this._edges=new gt,this._ocaMap=new Ri};Rs.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(") ")};Rs.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};Rs.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),l=0;c[l++]=new Oe(t.coord);for(var d=t.segmentIndex+1;d<=e.segmentIndex;d++)c[l++]=n.edge.pts[d];return a&&(c[l]=e.coord),new p_(c,new Vn(this.edge._label))};Ba.prototype.add=function(t,e,n){var r=new ha(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Ba.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Ba.prototype.interfaces_=function(){return[]};Ba.prototype.getClass=function(){return Ba};var Gu=function(){};Gu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new gt;r.add(new oa(n));do{var i=e.findChainEnd(t,n);r.add(new oa(i)),n=i}while(nn?e:n};bl.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}}};Ii.prototype.getDelta=function(t){return this._depth[t][lt.RIGHT]-this._depth[t][lt.LEFT]};Ii.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Fe.EXTERIOR:Fe.INTERIOR};Ii.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ii.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===Fe.EXTERIOR||i===Fe.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ii.depthAtLocation(i):t._depth[n][r]+=Ii.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],l=arguments[2];l===Fe.INTERIOR&&this._depth[a][c]++}};Ii.prototype.interfaces_=function(){return[]};Ii.prototype.getClass=function(){return Ii};Ii.depthAtLocation=function(t){return t===Fe.EXTERIOR?0:t===Fe.INTERIOR?1:Ii.NULL_VALUE};cC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ii,cC);var p_=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Ba(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ii,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,Vn.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,l=this.pts.length,d=0;d0?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 bl(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Nt;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 l=this.intersectsToleranceSquare(t,e);return ln.isTrue(!(c&&l),"Found bad envelope test"),l};fo.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 Oe(this._maxx,this._maxy),this._corner[1]=new Oe(this._minx,this._maxy),this._corner[2]=new Oe(this._minx,this._miny),this._corner[3]=new Oe(this._maxx,this._miny)};fo.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))};fo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};fo.prototype.getCoordinate=function(){return this._originalPt};fo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};fo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=fo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Nt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};fo.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()))};fo.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))};fo.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};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};fC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(fo,fC);var jd=function(){this.tempEnv1=new Nt,this.selectedSegment=new Ot};jd.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)}};jd.prototype.interfaces_=function(){return[]};jd.prototype.getClass=function(){return jd};var Nf=function(){this._index=null;var t=arguments[0];this._index=t},pC={HotPixelSnapAction:{configurable:!0}};Nf.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 dC(e,n,r);return this._index.query(i,{interfaces_:function(){return[eu]},visitItem:function(c){var l=c;l.select(i,a)}}),a.isNodeAdded()}};Nf.prototype.interfaces_=function(){return[]};Nf.prototype.getClass=function(){return Nf};pC.HotPixelSnapAction.get=function(){return dC};Object.defineProperties(Nf,pC);var dC=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}(jd),Nc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new gt};Nc.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],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(a){if(a instanceof yl)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=Si.precisionScaleFactor(this._argGeom,this._distance,n),i=new Rn(r);this.bufferFixedPrecision(i)}};Si.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Rn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Si.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Si.prototype.bufferOriginalPrecision=function(){try{var t=new Hi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof gl)this._saveException=e;else throw e}finally{}};Si.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Si.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Si.prototype.interfaces_=function(){return[]};Si.prototype.getClass=function(){return Si};Si.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Si(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof jt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],l=new Si(i);l.setQuadrantSegments(c);var d=l.getResultGeometry(a);return d}else if(arguments[2]instanceof Dn&&arguments[0]instanceof jt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],T=new Si(w,I),k=T.getResultGeometry(S);return k}}else if(arguments.length===4){var D=arguments[0],U=arguments[1],q=arguments[2],ee=arguments[3],B=new Si(D);B.setQuadrantSegments(q),B.setEndCapStyle(ee);var j=B.getResultGeometry(U);return j}};Si.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Zo.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,l=Math.trunc(Math.log(c)/Math.log(10)+1),d=n-l,w=Math.pow(10,d);return w};$f.CAP_ROUND.get=function(){return Dn.CAP_ROUND};$f.CAP_BUTT.get=function(){return Dn.CAP_FLAT};$f.CAP_FLAT.get=function(){return Dn.CAP_FLAT};$f.CAP_SQUARE.get=function(){return Dn.CAP_SQUARE};$f.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Si,$f);var ji=function(){this._pt=[new Oe,new Oe],this._distance=$t.NaN,this._isNull=!0};ji.prototype.getCoordinates=function(){return this._pt};ji.prototype.getCoordinate=function(t){return this._pt[t]};ji.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)}};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};var Pa=function(){};Pa.prototype.interfaces_=function(){return[]};Pa.prototype.getClass=function(){return Pa};Pa.computeDistance=function(){if(arguments[2]instanceof ji&&arguments[0]instanceof Sr&&arguments[1]instanceof Oe)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Ot,a=0;a0||this._isIn?Fe.INTERIOR:Fe.EXTERIOR)};Ns.prototype.interfaces_=function(){return[]};Ns.prototype.getClass=function(){return Ns};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}},mC={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};mC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,mC);var Kl=function(t){this._pts=t||null};Kl.prototype.filter=function(t){t instanceof Po&&this._pts.add(t)};Kl.prototype.interfaces_=function(){return[aa]};Kl.prototype.getClass=function(){return Kl};Kl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Po?Ds.singletonList(t):Kl.getPoints(t,new gt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Po?n.add(e):e instanceof Yi&&e.apply(new Kl(n)),n}};var zc=function(){this._locations=null;var t=arguments[0];this._locations=t};zc.prototype.filter=function(t){(t instanceof Po||t instanceof Sr||t instanceof Qr)&&this._locations.add(new qi(t,0,t.getCoordinate()))};zc.prototype.interfaces_=function(){return[aa]};zc.prototype.getClass=function(){return zc};zc.getLocations=function(t){var e=new gt;return t.apply(new zc(e)),e};var Ti=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ns,this._minDistanceLocation=null,this._minDistance=$t.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}};Ti.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=dl.getPolygons(this._geom[n]);if(a.size()>0){var c=zc.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&&Wt(arguments[0],Ps)&&Wt(arguments[1],Ps)){for(var l=arguments[0],d=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 k=S.getCoordinates(),D=I.getCoordinates(),U=0;Uthis._distance&&this.initialize(e,n,r)}};Di.prototype.interfaces_=function(){return[]};Di.prototype.getClass=function(){return Di};var ea=function(){};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};ea.computeDistance=function(){if(arguments[2]instanceof Di&&arguments[0]instanceof Sr&&arguments[1]instanceof Oe)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Ot,i=t.getCoordinates(),a=0;a1||t<=0)throw new lr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ls.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ls.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ls.prototype.computeOrientedDistance=function(t,e,n){var r=new Fc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new ou(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ls.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ls.prototype.interfaces_=function(){return[]};ls.prototype.getClass=function(){return ls};ls.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ls(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ls(r,i);return c.setDensifyFraction(a),c.distance()}};p1.MaxPointDistanceFilter.get=function(){return Fc};p1.MaxDensifiedByFractionDistanceFilter.get=function(){return ou};Object.defineProperties(ls,p1);var Fc=function(){this._maxPtDist=new Di,this._minPtDist=new Di,this._euclideanDist=new ea,this._geom=null;var t=arguments[0];this._geom=t};Fc.prototype.filter=function(t){this._minPtDist.initialize(),ea.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Fc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Fc.prototype.interfaces_=function(){return[Na]};Fc.prototype.getClass=function(){return Fc};var ou=function(){this._maxPtDist=new Di,this._minPtDist=new Di,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};ou.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,l=0;ln){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 "+Ms.toLineString(i[0],i[1])+")"}};Co.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Co.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(),Co.VERBOSE&&Ci.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Co.prototype.checkNegativeValid=function(){if(!(this._input instanceof Qr||this._input instanceof ka||this._input instanceof Yi))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)};Co.prototype.getErrorIndicator=function(){return this._errorIndicator};Co.prototype.checkMinimumDistance=function(t,e,n){var r=new Ti(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")};Li.prototype.report=function(t){if(!Li.VERBOSE)return null;Ci.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Li.prototype.getErrorMessage=function(){return this._errorMsg};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.isValidMsg=function(t,e,n){var r=new Li(t,e,n);return r.isValid()?null:r.getErrorMessage()};Li.isValid=function(t,e,n){var r=new Li(t,e,n);return!!r.isValid()};m1.VERBOSE.get=function(){return!1};m1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Li,m1);var pa=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};pa.prototype.getCoordinates=function(){return this._pts};pa.prototype.size=function(){return this._pts.length};pa.prototype.getCoordinate=function(t){return this._pts[t]};pa.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};pa.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Dc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};pa.prototype.setData=function(t){this._data=t};pa.prototype.getData=function(){return this._data};pa.prototype.toString=function(){return Ms.toLineString(new Pr(this._pts))};pa.prototype.interfaces_=function(){return[Fa]};pa.prototype.getClass=function(){return pa};var vi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new gt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};vi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};vi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};vi.prototype.getIntersectionSegments=function(){return this._intSegments};vi.prototype.count=function(){return this._intersectionCount};vi.prototype.getIntersections=function(){return this._intersections};vi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};vi.prototype.setKeepIntersections=function(t){this._keepIntersections=t};vi.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],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];this._li.computeIntersection(a,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=c,this._intSegments[2]=l,this._intSegments[3]=d,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};vi.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};vi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};vi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};vi.prototype.interfaces_=function(){return[Uu]};vi.prototype.getClass=function(){return vi};vi.createAllIntersectionsFinder=function(t){var e=new vi(t);return e.setFindAllIntersections(!0),e};vi.createAnyIntersectionFinder=function(t){return new vi(t)};vi.createIntersectionCounter=function(t){var e=new vi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Os=function(){this._li=new Ju,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Os.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Os.prototype.getIntersections=function(){return this._segInt.getIntersections()};Os.prototype.isValid=function(){return this.execute(),this._isValid};Os.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Os.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new h1;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Os.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new yl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Os.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ms.toLineString(t[0],t[1])+" and "+Ms.toLineString(t[2],t[3])};Os.prototype.interfaces_=function(){return[]};Os.prototype.getClass=function(){return Os};Os.computeIntersections=function(t){var e=new Os(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var qu=function t(){this._nv=null;var e=arguments[0];this._nv=new Os(t.toSegmentStrings(e))};qu.prototype.checkValid=function(){this._nv.checkValid()};qu.prototype.interfaces_=function(){return[]};qu.prototype.getClass=function(){return qu};qu.toSegmentStrings=function(t){for(var e=new gt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new pa(r.getCoordinates(),r))}return e};qu.checkValid=function(t){var e=new qu(t);e.checkValid()};var Bc=function(t){this._mapOp=t};Bc.prototype.map=function(t){for(var e=this,n=new gt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};po.prototype.interfaces_=function(){return[]};po.prototype.getClass=function(){return po};var Ua=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ot,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Sr&&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}};Ua.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 Oe(a),!1)}};Ua.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=$t.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(Mr.computeOverlaySnapTolerance(i),Mr.computeOverlaySnapTolerance(a))}};Mr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Mr.SNAP_PRECISION_FACTOR;return r};Mr.snapToSelf=function(t,e,n){var r=new Mr(t);return r.snapToSelf(e,n)};gC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Mr,gC);var _C=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 Ua(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}(po),Gi=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Gi.prototype.getCommon=function(){return $t.longBitsToDouble(this._commonBits)};Gi.prototype.add=function(t){var e=$t.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Gi.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Gi.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Gi.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Gi.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Gi.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=$t.longBitsToDouble(t),n=$t.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}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};Gi.getBit=function(t,e){var n=1<>52};Gi.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Gi.getBit(t,r)!==Gi.getBit(e,r))return n;n++}return 52};var su=function(){this._commonCoord=null,this._ccFilter=new Uc},g1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};su.prototype.addCommonBits=function(t){var e=new au(this._commonCoord);t.apply(e),t.geometryChanged()};su.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new Oe(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new au(e);return t.apply(n),t.geometryChanged(),t};su.prototype.getCommonCoordinate=function(){return this._commonCoord};su.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};su.prototype.interfaces_=function(){return[]};su.prototype.getClass=function(){return su};g1.CommonCoordinateFilter.get=function(){return Uc};g1.Translater.get=function(){return au};Object.defineProperties(su,g1);var Uc=function(){this._commonBitsX=new Gi,this._commonBitsY=new Gi};Uc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Uc.prototype.getCommonCoordinate=function(){return new Oe(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Uc.prototype.interfaces_=function(){return[Na]};Uc.prototype.getClass=function(){return Uc};var au=function(){this.trans=null;var t=arguments[0];this.trans=t};au.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)};au.prototype.isDone=function(){return!1};au.prototype.isGeometryChanged=function(){return!0};au.prototype.interfaces_=function(){return[As]};au.prototype.getClass=function(){return au};var bi=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()};bi.prototype.selfSnap=function(t){var e=new Mr(t),n=e.snapTo(t,this._snapTolerance);return n};bi.prototype.removeCommonBits=function(t){this._cbr=new su,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};bi.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};bi.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=rn.overlayOp(e[0],e[1],t);return this.prepareResult(n)};bi.prototype.checkValid=function(t){t.isValid()||Ci.out.println("Snapped geometry is invalid")};bi.prototype.computeSnapTolerance=function(){this._snapTolerance=Mr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};bi.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Mr.snap(e[0],e[1],this._snapTolerance);return n};bi.prototype.interfaces_=function(){return[]};bi.prototype.getClass=function(){return bi};bi.overlayOp=function(t,e,n){var r=new bi(t,e);return r.getResultGeometry(n)};bi.union=function(t,e){return bi.overlayOp(t,e,rn.UNION)};bi.intersection=function(t,e){return bi.overlayOp(t,e,rn.INTERSECTION)};bi.symDifference=function(t,e){return bi.overlayOp(t,e,rn.SYMDIFFERENCE)};bi.difference=function(t,e){return bi.overlayOp(t,e,rn.DIFFERENCE)};var Qi=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Qi.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=rn.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof gl)r=a;else throw a}finally{}if(!n)try{e=bi.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof gl?r:a}finally{}return e};Qi.prototype.interfaces_=function(){return[]};Qi.prototype.getClass=function(){return Qi};Qi.overlayOp=function(t,e,n){var r=new Qi(t,e);return r.getResultGeometry(n)};Qi.union=function(t,e){return Qi.overlayOp(t,e,rn.UNION)};Qi.intersection=function(t,e){return Qi.overlayOp(t,e,rn.INTERSECTION)};Qi.symDifference=function(t,e){return Qi.overlayOp(t,e,rn.SYMDIFFERENCE)};Qi.difference=function(t,e){return Qi.overlayOp(t,e,rn.DIFFERENCE)};var qd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};qd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};qd.prototype.interfaces_=function(){return[]};qd.prototype.getClass=function(){return qd};var ko=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}},_1={INSERT:{configurable:!0},DELETE:{configurable:!0}};ko.prototype.isDelete=function(){return this._eventType===ko.DELETE};ko.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};ko.prototype.getObject=function(){return this._obj};ko.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};ko.prototype.getInsertEvent=function(){return this._insertEvent};ko.prototype.isInsert=function(){return this._eventType===ko.INSERT};ko.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};ko.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};ko.prototype.interfaces_=function(){return[ds]};ko.prototype.getClass=function(){return ko};_1.INSERT.get=function(){return 1};_1.DELETE.get=function(){return 2};Object.defineProperties(ko,_1);var d_=function(){};d_.prototype.interfaces_=function(){return[]};d_.prototype.getClass=function(){return d_};var Pi=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};Pi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Pi.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};Pi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Pi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Pi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Pi.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};Pi.prototype.hasProperIntersection=function(){return this._hasProper};Pi.prototype.hasIntersection=function(){return this._hasIntersection};Pi.prototype.isDone=function(){return this._isDone};Pi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Pi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Pi.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],l=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,c,l),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))))};Pi.prototype.interfaces_=function(){return[]};Pi.prototype.getClass=function(){return Pi};Pi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var AR=function(t){function e(){t.call(this),this.events=new gt,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;Ds.sort(this.events);for(var r=0;re||this._maxa?1:0};Wd.prototype.interfaces_=function(){return[Sf]};Wd.prototype.getClass=function(){return Wd};var kR=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}(Ga),DR=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}(Ga),ja=function(){this._leaves=new gt,this._root=null,this._level=0};ja.prototype.buildTree=function(){var t=this;Ds.sort(this._leaves,new Ga.NodeComparator);for(var e=this._leaves,n=null,r=new gt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};ja.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 kR(t,e,n))};ja.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};ja.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ja.prototype.printNode=function(t){Ci.out.println(Ms.toLineString(new Oe(t._min,this._level),new Oe(t._max,this._level)))};ja.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ja.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===Fe.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=vn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,l=i;St.isCCW(a)&&(c=i,l=r);var d=new p_(a,new Vn(this._argIndex,Fe.BOUNDARY,c,l));this._lineEdgeMap.put(n,d),this.insertEdge(d),this.insertPoint(this._argIndex,a[0],Fe.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),c=a.getLabel();c===null?a._label=new Vn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new AR},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),l=a.eiList.iterator();l.hasNext();){var d=l.next();r.addSelfIntersectionNode(n,d.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof ka&&(this._useBoundaryDeterminationRule=!1),n instanceof Qr)this.addPolygon(n);else if(n instanceof Sr)this.addLineString(n);else if(n instanceof Po)this.addPoint(n);else if(n instanceof Mf)this.addCollection(n);else if(n instanceof Fu)this.addCollection(n);else if(n instanceof ka)this.addCollection(n);else if(n instanceof Yi)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 zf(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)?Fe.BOUNDARY:Fe.INTERIOR},e}(gr),Bf=function(){if(this._li=new Ju,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 ud(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=hs.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 ud(0,e,r),this._arg[1]=new ud(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 ud(0,i,c),this._arg[1]=new ud(1,a,c)}};Bf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Bf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Bf.prototype.interfaces_=function(){return[]};Bf.prototype.getClass=function(){return Bf};var Ou=function(){};Ou.prototype.interfaces_=function(){return[]};Ou.prototype.getClass=function(){return Ou};Ou.map=function(){if(arguments[0]instanceof jt&&Wt(arguments[1],Ou.MapOp)){for(var t=arguments[0],e=arguments[1],n=new gt,r=0;r=t.size()?null:t.get(e)};Fr.union=function(t){var e=new Fr(t);return e.union()};bC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Fr,bC);var m_=function(){};m_.prototype.interfaces_=function(){return[]};m_.prototype.getClass=function(){return m_};m_.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return rn.createEmptyResult(rn.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Qi.overlayOp(t,e,rn.UNION)};function Qu(){return new g_}function g_(){this.reset()}g_.prototype={constructor:g_,reset:function(){this.s=this.t=0},add:function(t){f2(vg,t,this.t),f2(this,vg.s,this.s),this.s?this.t+=vg.t:this.s=vg.t},valueOf:function(){return this.s}};var vg=new g_;function f2(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var wr=1e-6,Hn=Math.PI,pl=Hn/2,p2=Hn/4,xl=Hn*2,Mu=180/Hn,Ks=Hn/180,Wi=Math.abs,RR=Math.atan,Uf=Math.atan2,Wr=Math.cos,Hr=Math.sin,ep=Math.sqrt;function xC(t){return t>1?0:t<-1?Hn:Math.acos(t)}function Gc(t){return t>1?pl:t<-1?-pl:Math.asin(t)}function yd(){}function __(t,e){t&&m2.hasOwnProperty(t.type)&&m2[t.type](t,e)}var d2={Feature:function(t,e){__(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rHn?t-xl:t<-Hn?t+xl:t,e]}yv.invert=yv;function OR(t,e,n){return(t%=xl)?e||n?wC(y2(t),v2(e,n)):y2(t):e||n?v2(e,n):yv}function _2(t){return function(e,n){return e+=t,[e>Hn?e-xl:e<-Hn?e+xl:e,n]}}function y2(t){var e=_2(t);return e.invert=_2(-t),e}function v2(t,e){var n=Wr(t),r=Hr(t),i=Wr(e),a=Hr(e);function c(l,d){var w=Wr(d),S=Wr(l)*w,I=Hr(l)*w,T=Hr(d),k=T*n+S*r;return[Uf(I*i-k*a,S*n-T*r),Gc(k*i+I*a)]}return c.invert=function(l,d){var w=Wr(d),S=Wr(l)*w,I=Hr(l)*w,T=Hr(d),k=T*i-I*a;return[Uf(I*i+T*a,S*n+k*r),Gc(k*n-S*r)]},c}function zR(t,e,n,r,i,a){if(n){var c=Wr(e),l=Hr(e),d=r*n;i==null?(i=e+r*xl,a=e-d/2):(i=b2(c,i),a=b2(c,a),(r>0?ia)&&(i+=r*xl));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 FR(t,e,n,r,i,a){var c=t[0],l=t[1],d=e[0],w=e[1],S=0,I=1,T=d-c,k=w-l,D;if(D=n-c,!(!T&&D>0)){if(D/=T,T<0){if(D0){if(D>I)return;D>S&&(S=D)}if(D=i-c,!(!T&&D<0)){if(D/=T,T<0){if(D>I)return;D>S&&(S=D)}else if(T>0){if(D0)){if(D/=k,k<0){if(D0){if(D>I)return;D>S&&(S=D)}if(D=a-l,!(!k&&D<0)){if(D/=k,k<0){if(D>I)return;D>S&&(S=D)}else if(k>0){if(D0&&(t[0]=c+S*T,t[1]=l+S*k),I<1&&(e[0]=c+I*T,e[1]=l+I*k),!0}}}}}function zg(t,e){return Wi(t[0]-e[0])=0;--l)i.point((I=S[l])[0],I[1]);else r(T.x,T.p.x,-1,i);T=T.p}T=T.o,S=T.z,k=!k}while(!T.v);i.lineEnd()}}}function x2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function BR(t){return t.length===1&&(t=VR(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 VR(t){return function(e,n){return IC(t(e),n)}}BR(IC);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 vd=1e9,Sg=-vd;function UR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,I,T){var k=0,D=0;if(w==null||(k=c(w,I))!==(D=c(S,I))||d(w,S)<0^I>0)do T.point(k===0||k===3?t:n,k>1?r:e);while((k=(k+I+4)%4)!==D);else T.point(S[0],S[1])}function c(w,S){return Wi(w[0]-t)0?0:3:Wi(w[0]-n)0?2:1:Wi(w[1]-e)0?1:0:S>0?3:2}function l(w,S){return d(w.x,S.x)}function d(w,S){var I=c(w,1),T=c(S,1);return I!==T?I-T: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=SC(),T,k,D,U,q,ee,B,j,$,ae,me,pe={point:Q,lineStart:ie,lineEnd:He,polygonStart:Ae,polygonEnd:Y};function Q(Ne,Je){i(Ne,Je)&&S.point(Ne,Je)}function oe(){for(var Ne=0,Je=0,qe=k.length;Jer&&(Fn-kt)*(r-un)>(bn-un)*(t-kt)&&++Ne:bn<=r&&(Fn-kt)*(r-un)<(bn-un)*(t-kt)&&--Ne;return Ne}function Ae(){S=I,T=[],k=[],me=!0}function Y(){var Ne=oe(),Je=me&&Ne,qe=(T=CC(T)).length;(Je||qe)&&(w.polygonStart(),Je&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),qe&&EC(T,l,Ne,a,w),w.polygonEnd()),S=w,T=k=D=null}function ie(){pe.point=ge,k&&k.push(D=[]),ae=!0,$=!1,B=j=NaN}function He(){T&&(ge(U,q),ee&&$&&I.rejoin(),T.push(I.result())),pe.point=Q,$&&S.lineEnd()}function ge(Ne,Je){var qe=i(Ne,Je);if(k&&D.push([Ne,Je]),ae)U=Ne,q=Je,ee=qe,ae=!1,qe&&(S.lineStart(),S.point(Ne,Je));else if(qe&&$)S.point(Ne,Je);else{var zt=[B=Math.max(Sg,Math.min(vd,B)),j=Math.max(Sg,Math.min(vd,j))],Pt=[Ne=Math.max(Sg,Math.min(vd,Ne)),Je=Math.max(Sg,Math.min(vd,Je))];FR(zt,Pt,t,e,n,r)?($||(S.lineStart(),S.point(zt[0],zt[1])),S.point(Pt[0],Pt[1]),qe||S.lineEnd(),me=!1):qe&&(S.lineStart(),S.point(Ne,Je),me=!1)}B=Ne,j=Je,$=qe}return pe}}var L0=Qu();function GR(t,e){var n=e[0],r=e[1],i=[Hr(n),-Wr(n),0],a=0,c=0;L0.reset();for(var l=0,d=t.length;l=0?1:-1,Q=pe*me,oe=Q>Hn,Ae=D*$;if(L0.add(Uf(Ae*pe*Hr(Q),U*ae+Ae*Wr(Q))),a+=oe?me+pe*xl:me,oe^T>=n^B>=n){var Y=y_(Gf(I),Gf(ee));_v(Y);var ie=y_(i,Y);_v(ie);var He=(oe^me>=0?-1:1)*Gc(ie[2]);(r>He||r===He&&(Y[0]||Y[1]))&&(c+=oe^me>=0?1:-1)}}return(a<-wr||aHd&&(Hd=t),eb_&&(b_=e)}Qu();function TC(t,e,n,r){return function(i,a){var c=e(a),l=i.invert(r[0],r[1]),d=SC(),w=e(d),S=!1,I,T,k,D={point:U,lineStart:ee,lineEnd:B,polygonStart:function(){D.point=j,D.lineStart=$,D.lineEnd=ae,T=[],I=[]},polygonEnd:function(){D.point=U,D.lineStart=ee,D.lineEnd=B,T=CC(T);var me=GR(I,l);T.length?(S||(a.polygonStart(),S=!0),EC(T,WR,me,n,a)):me&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),T=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function U(me,pe){var Q=i(me,pe);t(me=Q[0],pe=Q[1])&&a.point(me,pe)}function q(me,pe){var Q=i(me,pe);c.point(Q[0],Q[1])}function ee(){D.point=q,c.lineStart()}function B(){D.point=U,c.lineEnd()}function j(me,pe){k.push([me,pe]);var Q=i(me,pe);w.point(Q[0],Q[1])}function $(){w.lineStart(),k=[]}function ae(){j(k[0][0],k[0][1]),w.lineEnd();var me=w.clean(),pe=d.result(),Q,oe=pe.length,Ae,Y,ie;if(k.pop(),I.push(k),k=null,!!oe){if(me&1){if(Y=pe[0],(Ae=Y.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),Q=0;Q1&&me&2&&pe.push(pe.pop().concat(pe.shift())),T.push(pe.filter(qR))}}return D}}function qR(t){return t.length>1}function WR(t,e){return((t=t.x)[0]<0?t[1]-pl-wr:pl-t[1])-((e=e.x)[0]<0?e[1]-pl-wr:pl-e[1])}const E2=TC(function(){return!0},HR,XR,[-Hn,-pl]);function HR(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,c){var l=a>0?Hn:-Hn,d=Wi(a-e);Wi(d-Hn)0?pl:-pl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(a,n),i=0):r!==l&&d>=Hn&&(Wi(e-r)wr?RR((Hr(e)*(a=Wr(r))*Hr(n)-Hr(r)*(i=Wr(e))*Hr(t))/(i*a*c)):(e+r)/2}function XR(t,e,n,r){var i;if(t==null)i=n*pl,r.point(-Hn,i),r.point(0,i),r.point(Hn,i),r.point(Hn,0),r.point(Hn,-i),r.point(0,-i),r.point(-Hn,-i),r.point(-Hn,0),r.point(-Hn,i);else if(Wi(t[0]-e[0])>wr){var a=t[0]0,i=Wi(n)>wr;function a(S,I,T,k){zR(k,t,e,T,S,I)}function c(S,I){return Wr(S)*Wr(I)>n}function l(S){var I,T,k,D,U;return{lineStart:function(){D=k=!1,U=1},point:function(q,ee){var B=[q,ee],j,$=c(q,ee),ae=r?$?0:w(q,ee):$?w(q+(q<0?Hn:-Hn),ee):0;if(!I&&(D=k=$)&&S.lineStart(),$!==k&&(j=d(I,B),(!j||zg(I,j)||zg(B,j))&&(B[0]+=wr,B[1]+=wr,$=c(B[0],B[1]))),$!==k)U=0,$?(S.lineStart(),j=d(B,I),S.point(j[0],j[1])):(j=d(I,B),S.point(j[0],j[1]),S.lineEnd()),I=j;else if(i&&I&&r^$){var me;!(ae&T)&&(me=d(B,I,!0))&&(U=0,r?(S.lineStart(),S.point(me[0][0],me[0][1]),S.point(me[1][0],me[1][1]),S.lineEnd()):(S.point(me[1][0],me[1][1]),S.lineEnd(),S.lineStart(),S.point(me[0][0],me[0][1])))}$&&(!I||!zg(I,B))&&S.point(B[0],B[1]),I=B,k=$,T=ae},lineEnd:function(){k&&S.lineEnd(),I=null},clean:function(){return U|(D&&k)<<1}}}function d(S,I,T){var k=Gf(S),D=Gf(I),U=[1,0,0],q=y_(k,D),ee=bg(q,q),B=q[0],j=ee-B*B;if(!j)return!T&&S;var $=n*ee/j,ae=-n*B/j,me=y_(U,q),pe=xg(U,$),Q=xg(q,ae);T0(pe,Q);var oe=me,Ae=bg(pe,oe),Y=bg(oe,oe),ie=Ae*Ae-Y*(bg(pe,pe)-1);if(!(ie<0)){var He=ep(ie),ge=xg(oe,(-Ae-He)/Y);if(T0(ge,pe),ge=gv(ge),!T)return ge;var Ne=S[0],Je=I[0],qe=S[1],zt=I[1],Pt;Je0^ge[1]<(Wi(ge[0]-Ne)Hn^(Ne<=ge[0]&&ge[0]<=Je)){var un=xg(oe,(-Ae+He)/Y);return T0(un,pe),[ge,gv(un)]}}}function w(S,I){var T=r?t:Hn-t,k=0;return S<-T?k|=1:S>T&&(k|=2),I<-T?k|=4:I>T&&(k|=8),k}return TC(c,l,a,r?[0,-t]:[-Hn,t-Hn])}function LC(t){return function(e){var n=new vv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function vv(){}vv.prototype={constructor:vv,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),NR(n,t.stream(S2));var c=S2.result(),l=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),d=+e[0][0]+(r-l*(c[1][0]+c[0][0]))/2,w=+e[0][1]+(i-l*(c[1][1]+c[0][1]))/2;return a!=null&&t.clipExtent(a),t.scale(l*150).translate([d,w])}function KR(t,e,n){return PC(t,[[0,0],e],n)}var I2=16,JR=Wr(30*Ks);function C2(t,e){return+e?$R(t,e):QR(t)}function QR(t){return LC({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function $R(t,e){function n(r,i,a,c,l,d,w,S,I,T,k,D,U,q){var ee=w-r,B=S-i,j=ee*ee+B*B;if(j>4*e&&U--){var $=c+T,ae=l+k,me=d+D,pe=ep($*$+ae*ae+me*me),Q=Gc(me/=pe),oe=Wi(Wi(me)-1)e||Wi((ee*He+B*ge)/j-.5)>.3||c*T+l*k+d*D2?ge[2]%360*Ks:0,ie()):[w*Mu,S*Mu,I*Mu]},oe.precision=function(ge){return arguments.length?(me=C2(Y,ae=ge*ge),He()):ep(ae)},oe.fitExtent=function(ge,Ne){return PC(oe,ge,Ne)},oe.fitSize=function(ge,Ne){return KR(oe,ge,Ne)};function ie(){k=wC(T=OR(w,S,I),e);var ge=e(l,d);return a=r-ge[0]*n,c=i+ge[1]*n,He()}function He(){return pe=Q=null,oe}return function(){return e=t.apply(this,arguments),oe.invert=e.invert&&Ae,ie()}}function MC(t){return function(e,n){var r=Wr(e),i=Wr(n),a=t(r*i);return[a*i*Hr(e),a*Hr(n)]}}function AC(t){return function(e,n){var r=ep(e*e+n*n),i=t(r),a=Hr(i),c=Wr(i);return[Uf(e*a,r*c),Gc(r&&n*a/r)]}}var rN=MC(function(t){return ep(2/(1+t))});rN.invert=AC(function(t){return 2*Gc(t/2)});var kC=MC(function(t){return(t=xC(t))&&t/Hr(t)});kC.invert=AC(function(t){return t});function iN(){return tN(kC).scale(79.4188).clipAngle(180-.001)}function T2(t,e){return[t,e]}T2.invert=T2;function oN(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 ZI(t,function(c){var l=Fg(c,e,r,i);l&&a.push(l)}),fv(a);case"FeatureCollection":return a2(t,function(c){var l=Fg(c,e,r,i);l&&a2(l,function(d){d&&a.push(d)})}),fv(a)}return Fg(t,e,r,i)}function Fg(t,e,n,r){var i=t.properties||{},a=t.type==="Feature"?t.geometry:t;if(a.type==="GeometryCollection"){var c=[];return ZI(t,function(U){var q=Fg(U,e,n,r);q&&c.push(q)}),fv(c)}var l=sN(a),d={type:a.type,coordinates:RC(a.coordinates,l)},w=new c1,S=w.read(d),I=pR(dR(e,n),"meters"),T=Si.bufferOp(S,I,r),k=new rC;if(T=k.write(T),!DC(T.coordinates)){var D={type:T.type,coordinates:NC(T.coordinates,l)};return A_(D,i)}}function DC(t){return Array.isArray(t[0])?DC(t[0]):isNaN(t[0])}function RC(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return RC(n,e)})}function NC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return NC(n,e)})}function sN(t){var e=gR(t).geometry.coordinates,n=[-e[0],-e[1]];return iN().rotate(n).scale(jo)}function aN(t,e){var n=c_(t),r=c_(e),i=t.properties||{},a=GI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?qI(a[0],i):WI(a,i)}function L2(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 P2(t,e){const n=aN({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=oN(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)L2(i);else for(const i of r.geometry.coordinates)for(const a of i)L2(a);e({type:"FeatureCollection",features:[r,n]})}let M2={type:"FeatureCollection",features:[]};function lN(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 l,d=[],w,S;function I(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:M2}),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 T=D=>{l==null||l({type:"mapClick",coordinates:[D.lngLat.lng,D.lngLat.lat]})};function k(D=!1){if(!e)throw new Error;const U=document.createElement("div");return D&&U.classList.add("marker-interactive"),new zD({props:{displayIn:"maplibre"},target:U}),new e.Marker({element:U,offset:[1,-13]})}return{setEventHandler(D){D?(l=D,t.on("click",T)):(l=void 0,t.off("click",T))},flyTo(D,U){t.flyTo({center:D,zoom:U,...i})},fitBounds(D,U,q){t.fitBounds([[D[0],D[1]],[D[2],D[3]]],{padding:U,maxZoom:q,...a})},indicateReverse(D){t.getCanvasContainer().style.cursor=D?"crosshair":""},setReverseMarker(D){!e||!n||(S?D?S.setLngLat(D):(S.remove(),S=void 0):D&&(S=(typeof n=="object"?new e.Marker(n):k()).setLngLat(D).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(D,U){if(!n)return;function q(ee){var B;(B=t.getSource("full-geom"))==null||B.setData(ee)}for(const ee of d)ee.remove();if(d.length=0,q(M2),!!e){if(U){let ee=!1;if(U.geometry.type==="GeometryCollection"){const B=U.geometry.geometries.filter(j=>j.type==="Polygon"||j.type==="MultiPolygon");if(B.length>0){let j=B.pop();for(const $ of B)j=mR(j,$);P2({...U,geometry:j},q),ee=!0}else{const j=U.geometry.geometries.filter($=>$.type==="LineString"||$.type==="MultiLineString");j.length>0&&(q({...U,geometry:{type:"GeometryCollection",geometries:j}}),ee=!0)}}if(!ee){if(U.geometry.type==="Polygon"||U.geometry.type==="MultiPolygon")P2(U,q);else if(U.geometry.type==="LineString"||U.geometry.type==="MultiLineString"){q(U);return}}n&&d.push((typeof n=="object"?new e.Marker(n):k()).setLngLat(U.center).addTo(t))}if(r)for(const ee of D??[]){if(ee===U)continue;const B=(typeof r=="object"?new e.Marker(r):k(!0)).setLngLat(ee.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(ee.place_type[0]==="reverse"?ee.place_name:ee.place_name.replace(/,.*/,""))).addTo(t),j=B.getElement();j.addEventListener("click",$=>{$.stopPropagation(),l==null||l({type:"markerClick",id:ee.id})}),j.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:ee.id}),B.togglePopup()}),j.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:ee.id}),B.togglePopup()}),d.push(B)}}},setSelectedMarker(D){w&&w.getElement().classList.toggle("marker-selected",!1),w=D>-1?d[D]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const D=t.getCenter();return[t.getZoom(),D.lng,D.lat]}}}function uN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("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){Me(r,e,i),we(e,n)},p:et,i:et,o:et,d(r){r&&Le(e)}}}class OC extends Jt{constructor(e){super(),Kt(this,e,null,uN,qt,{})}}function cN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("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){Me(r,e,i),we(e,n)},p:et,i:et,o:et,d(r){r&&Le(e)}}}class zC extends Jt{constructor(e){super(),Kt(this,e,null,cN,qt,{})}}function hN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"area.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"area.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function fN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"reverse.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"reverse.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function pN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"poi.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"poi.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function dN(t){let e,n;return{c(){e=ke("img"),To(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){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"postal_code.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function mN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"street.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"street.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function gN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"road.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"road.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function _N(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"housenumber.svg")||Ue(e,"src",n),Ue(e,"alt",t[6]),Ue(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"housenumber.svg")&&Ue(e,"src",n),i&64&&Ue(e,"alt",r[6])},d(r){r&&Le(e)}}}function yN(t){let e,n,r,i;return{c(){e=ke("img"),To(e.src,n=t[5])||Ue(e,"src",n),Ue(e,"alt",t[4]),Ue(e,"class","svelte-ltkwvy")},m(a,c){Me(a,e,c),r||(i=Gt(e,"error",t[14]),r=!0)},p(a,c){c&32&&!To(e.src,n=a[5])&&Ue(e,"src",n),c&16&&Ue(e,"alt",a[4])},d(a){a&&Le(e),r=!1,i()}}}function A2(t){let e,n;return{c(){e=ke("span"),n=vt(t[6]),Ue(e,"class","secondary svelte-ltkwvy")},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&64&&An(n,r[6])},d(r){r&&Le(e)}}}function vN(t){var pe,Q;let e,n,r,i,a,c,l,d,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,I,T=t[2]==="always"||t[2]&&!t[0].address&&((pe=t[0].properties)==null?void 0:pe.kind)!=="road"&&((Q=t[0].properties)==null?void 0:Q.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],k,D,U=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",q,ee,B;function j(oe,Ae){var Y,ie;return Ae&1&&(n=null),Ae&1&&(r=null),Ae&1&&(i=null),oe[5]?yN:oe[0].address?_N:((Y=oe[0].properties)==null?void 0:Y.kind)==="road"||((ie=oe[0].properties)==null?void 0:ie.kind)==="road_relation"?gN:(n==null&&(n=!!oe[0].id.startsWith("address.")),n?mN:(r==null&&(r=!!oe[0].id.startsWith("postal_code.")),r?dN:(i==null&&(i=!!oe[0].id.startsWith("poi.")),i?pN:oe[7]?fN:hN)))}let $=j(t,-1),ae=$(t),me=T&&A2(t);return{c(){e=ke("li"),ae.c(),a=nt(),c=ke("span"),l=ke("span"),d=ke("span"),S=vt(w),I=nt(),me&&me.c(),k=nt(),D=ke("span"),q=vt(U),Ue(d,"class","primary svelte-ltkwvy"),Ue(l,"class","svelte-ltkwvy"),Ue(D,"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"),hl(e,"selected",t[1])},m(oe,Ae){Me(oe,e,Ae),ae.m(e,null),we(e,a),we(e,c),we(c,l),we(l,d),we(d,S),we(l,I),me&&me.m(l,null),we(c,k),we(c,D),we(D,q),ee||(B=[Gt(e,"mouseenter",t[12]),Gt(e,"focus",t[13])],ee=!0)},p(oe,[Ae]){var Y,ie;$===($=j(oe,Ae))&&ae?ae.p(oe,Ae):(ae.d(1),ae=$(oe),ae&&(ae.c(),ae.m(e,a))),Ae&1&&w!==(w=(oe[7]?oe[0].place_name:oe[0].place_name.replace(/,.*/,""))+"")&&An(S,w),Ae&37&&(T=oe[2]==="always"||oe[2]&&!oe[0].address&&((Y=oe[0].properties)==null?void 0:Y.kind)!=="road"&&((ie=oe[0].properties)==null?void 0:ie.kind)!=="road_relation"&&!oe[0].id.startsWith("address.")&&!oe[0].id.startsWith("postal_code.")&&(!oe[0].id.startsWith("poi.")||!oe[5])&&!oe[7]),T?me?me.p(oe,Ae):(me=A2(oe),me.c(),me.m(l,null)):me&&(me.d(1),me=null),Ae&1&&U!==(U=(oe[7]?"":oe[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&An(q,U),Ae&2&&Ue(e,"data-selected",oe[1]),Ae&2&&hl(e,"selected",oe[1])},i:et,o:et,d(oe){oe&&Le(e),ae.d(),me&&me.d(),ee=!1,Mi(B)}}}function bN(t,e,n){var j;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:d}=e,{iconsBaseUrl:w}=e;const S=(j=a.properties)==null?void 0:j.categories;let I,T,k=0,D=a.place_type[0]==="reverse";function U($){T&&d.add(T),n(10,k++,k)}function q($){dn.call(this,t,$)}function ee($){dn.call(this,t,$)}const B=$=>U($.currentTarget);return t.$$set=$=>{"feature"in $&&n(0,a=$.feature),"selected"in $&&n(1,c=$.selected),"showPlaceType"in $&&n(2,l=$.showPlaceType),"missingIconsCache"in $&&n(9,d=$.missingIconsCache),"iconsBaseUrl"in $&&n(3,w=$.iconsBaseUrl)},t.$$.update=()=>{var $,ae,me,pe;if(t.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,T=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!T||d.has(T)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(ae=($=a.properties)==null?void 0:$.categories)==null?void 0:ae.join(", "):((pe=(me=a.properties)==null?void 0:me.place_type_name)==null?void 0:pe[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,c,l,w,I,T,i,D,U,d,k,r,q,ee,B]}class xN extends Jt{constructor(e){super(),Kt(this,e,bN,vN,qt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function wN(t){let e;return{c(){e=ke("div"),e.innerHTML='',Ue(e,"class","svelte-7cmwmc")},m(n,r){Me(n,e,r)},p:et,i:et,o:et,d(n){n&&Le(e)}}}class SN extends Jt{constructor(e){super(),Kt(this,e,null,wN,qt,{})}}function EN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("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){Me(r,e,i),we(e,n)},p:et,i:et,o:et,d(r){r&&Le(e)}}}class IN extends Jt{constructor(e){super(),Kt(this,e,null,EN,qt,{})}}function CN(t){let e,n,r;return{c(){e=Yl("svg"),n=Yl("circle"),r=Yl("path"),Ue(n,"cx","4.789"),Ue(n,"cy","4.787"),Ue(n,"r","3.85"),Ei(n,"stroke-width","1.875"),Ei(n,"fill","none"),Ue(r,"d","M12.063 12.063 7.635 7.635"),Ei(r,"stroke-width","1.875"),Ei(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){Me(i,e,a),we(e,n),we(e,r)},p:et,i:et,o:et,d(i){i&&Le(e)}}}class TN extends Jt{constructor(e){super(),Kt(this,e,null,CN,qt,{})}}function LN(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 k2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!cd.coords)break e;return cd.coords}let a;try{return a=await new Promise((c,l)=>{n.signal.addEventListener("abort",()=>{l(Error("aborted"))}),navigator.geolocation.getCurrentPosition(d=>{c([d.coords.longitude,d.coords.latitude].map(w=>w.toFixed(6)).join(","))},d=>{l(d)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(cd={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 D2=/(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,R2=/(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,N2=/(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,O2=/(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 MN(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=z2(e[0],t),r=z2(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 z2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=AN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${l}'`}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 AN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function v1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],l=!1;if(D2.test(t))if(c=D2.exec(t),l=Eg(c),l){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(R2.test(t))if(c=R2.exec(t),l=Eg(c),l)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(N2.test(t))if(c=N2.exec(t),l=Eg(c),l)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(O2.test(t))if(c=O2.exec(t),l=Eg(c),l)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(l){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 d=/S|SOUTH/i;d.test(i)&&n>0&&(n=-1*n),d=/W|WEST/i,d.test(a)&&r>0&&(r=-1*r);const w=c[0].trim();let S,I;const T=/[,/;\u0020]/g,k=w.match(T);if(k==null){const q=Math.floor(t.length/2);S=w.substring(0,q).trim(),I=w.substring(q).trim()}else{let q;k.length%2==1?q=Math.floor(k.length/2):q=k.length/2-1;let ee=0;if(q==0)ee=w.indexOf(k[0]),S=w.substring(0,ee).trim(),I=w.substring(ee+1).trim();else{let B=0,j=0;for(;B<=q;)ee=w.indexOf(k[B],j),j=ee+1,B++;S=w.substring(0,ee).trim(),I=w.substring(ee+1).trim()}}const D=S.split(".");if(D.length==2&&D[1]==0&&D[1].length!=2)throw new Error("invalid coordinates format");const U=I.split(".");if(U.length==2&&U[1]==0&&U[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:kN,toCoordinateFormat:MN})}else throw new Error("coordinates pattern match failed")}function Eg(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,...NN})}),[...t,...ON,...zN]}const BN=FN();v1.formats=BN.map(t=>t.verbatimCoordinates);const VN=v1;function B2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function V2(t){let e,n;return e=new SN({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function U2(t){let e,n,r,i,a;return n=new IN({}),{c(){e=ke("button"),ot(n.$$.fragment),Ue(e,"type","button"),Ue(e,"title",t[9]),Ue(e,"class","svelte-zh3kmv"),hl(e,"active",t[0])},m(c,l){Me(c,e,l),rt(n,e,null),r=!0,i||(a=Gt(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Ue(e,"title",c[9]),(!r||l[0]&1)&&hl(e,"active",c[0])},i(c){r||(ve(n.$$.fragment,c),r=!0)},o(c){Se(n.$$.fragment,c),r=!1},d(c){c&&Le(e),it(n),i=!1,a()}}}function UN(t){let e,n=[],r=new Map,i,a,c,l=zr(t[14]);const d=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{pe=null}),Pn()),(!j||Ne[0]&2)&&hl(w,"displayable",ge[1]!==""),ge[5]===!0?Q?(Q.p(ge,Ne),Ne[0]&32&&ve(Q,1)):(Q=U2(ge),Q.c(),ve(Q,1),Q.m(r,D)):Q&&(Ln(),Se(Q,1,1,()=>{Q=null}),Pn()),Ae&&Ae.p&&(!j||Ne[1]&134217728)&&Kr(Ae,oe,ge,ge[58],j?Yr(oe,ge[58],Ne,null):Jr(ge[58]),null);let Je=q;q=He(ge),q===Je?~q&&ie[q].p(ge,Ne):(ee&&(Ln(),Se(ie[Je],1,1,()=>{ie[Je]=null}),Pn()),~q?(ee=ie[q],ee?ee.p(ge,Ne):(ee=ie[q]=Y[q](ge),ee.c()),ve(ee,1),ee.m(n,null)):ee=null),(!j||Ne[0]&4&&B!==(B=Bg(ge[2])+" svelte-zh3kmv"))&&Ue(n,"class",B),(!j||Ne[0]&22)&&hl(n,"can-collapse",ge[4]&&ge[1]==="")},i(ge){j||(ve(me),ve(a.$$.fragment,ge),ve(I.$$.fragment,ge),ve(pe),ve(Q),ve(Ae,ge),ve(ee),j=!0)},o(ge){Se(me),Se(a.$$.fragment,ge),Se(I.$$.fragment,ge),Se(pe),Se(Q),Se(Ae,ge),Se(ee),j=!1},d(ge){ge&&(Le(e),Le(n)),it(a),t[61](null),it(I),pe&&pe.d(),Q&&Q.d(),Ae&&Ae.d(ge),~q&&ie[q].d(),$=!1,Mi(ae)}}}function HN(t,e,n){let r,{$$slots:i={},$$scope:a}=e,{class:c=void 0}=e,{apiKey:l}=e,{bbox:d=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:I=!1}=e,{country:T=void 0}=e,{debounceSearch:k=200}=e,{enableReverse:D=!1}=e,{errorMessage:U="Something went wrong…"}=e,{filter:q=()=>!0}=e,{flyTo:ee=!0}=e,{fuzzyMatch:B=!0}=e,{language:j=void 0}=e,{limit:$=void 0}=e,{mapController:ae=void 0}=e,{minLength:me=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:Q="Search"}=e,{proximity:oe=[{type:"server-geolocation"}]}=e,{reverseActive:Ae=D==="always"}=e,{reverseButtonTitle:Y="toggle reverse geocoding"}=e,{searchValue:ie=""}=e,{showFullGeometry:He=!0}=e,{showPlaceType:ge="ifNeeded"}=e,{showResultsWhileTyping:Ne=!0}=e,{selectFirst:Je=!0}=e,{flyToSelected:qe=!1}=e,{markerOnSelected:zt=!0}=e,{types:Pt=void 0}=e,{excludeTypes:Zt=!1}=e,{zoom:Xt=16}=e,{maxZoom:kt=18}=e,{apiUrl:un="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Fn={}}=e,{iconsBaseUrl:bn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:mn=J=>{}}=e;function Bn(){ze.focus()}function ir(){ze.blur()}function $r(J,Ie=!0){n(1,ie=J),Ie?(n(15,en=-1),Cl()):(ei(),setTimeout(()=>{ze.focus(),ze.select()}))}function _r(){n(14,re=void 0),n(55,_t=void 0),n(15,en=-1)}function cr(){n(54,Ce=[]),n(55,_t=void 0)}let or=!1,re,Ce,_t,xn="",ze,en=-1,Dr,fn=[],er,Do,gs,Bs;const Ha=new Set,Ai=Xu();us(()=>{ae&&(ae.setEventHandler(void 0),ae.indicateReverse(!1),ae.setSelectedMarker(-1),ae.setMarkers(void 0,void 0))});function Cl(J){if(Do&&(clearTimeout(Do),Do=void 0),en>-1&&re)n(55,_t=re[en]),n(1,ie=_t.place_type[0]==="reverse"?_t.place_name:_t.place_name.replace(/,.*/,"")),n(18,Dr=void 0),n(54,Ce=void 0),n(15,en=-1);else if(ie){const Ie=J||!_s(ie);at(ie,{exact:!0}).then(()=>{n(54,Ce=re),n(55,_t=void 0),Ie&&Qo()}).catch(ye=>n(18,Dr=ye))}}function _s(J){try{return VN(J,6)}catch{return!1}}async function at(J,{byId:Ie=!1,exact:ye=!1}={}){n(18,Dr=void 0),er==null||er.abort();const De=new AbortController;n(19,er=De);try{const Ge=_s(J),Ze=new URLSearchParams;if(j!==void 0&&Ze.set("language",Array.isArray(j)?j.join(","):j??""),Pt&&Ze.set("types",Pt.join(",")),Zt&&Ze.set("excludeTypes",String(Zt)),d&&Ze.set("bbox",d.map(Yt=>Yt.toFixed(6)).join(",")),T&&Ze.set("country",Array.isArray(T)?T.join(","):T),!Ie&&!Ge){const Yt=await PN(ae,oe,De);Yt&&Ze.set("proximity",Yt),(ye||!Ne)&&Ze.set("autocomplete","false"),Ze.set("fuzzyMatch",String(B))}$!==void 0&&(!Ge||(Pt==null?void 0:Pt.length)===1)&&Ze.set("limit",String($)),Ze.set("key",l),mn(Ze);const Ye=un+"/"+encodeURIComponent(Ge?Ge.decimalLongitude+","+Ge.decimalLatitude:J)+".json?"+Ze.toString();if(Ye===xn){Ie?(n(14,re=void 0),n(55,_t=fn[0])):n(14,re=fn);return}xn=Ye;const Mt=await fetch(Ye,{signal:De.signal,...Fn});if(!Mt.ok)throw new Error(await Mt.text());const Rt=await Mt.json();Ai("response",{url:Ye,featureCollection:Rt}),Ie?(n(14,re=void 0),n(55,_t=Rt.features[0]),fn=[_t]):(n(14,re=Rt.features.filter(q)),Ge&&re.unshift({type:"Feature",properties:{},id:"reverse_"+Ge.decimalLongitude+"_"+Ge.decimalLatitude,text:Ge.decimalLatitude+", "+Ge.decimalLongitude,place_name:Ge.decimalLatitude+", "+Ge.decimalLongitude,place_type:["reverse"],center:[Ge.decimalLongitude,Ge.decimalLatitude],bbox:[Ge.decimalLongitude,Ge.decimalLatitude,Ge.decimalLongitude,Ge.decimalLatitude],geometry:{type:"Point",coordinates:[Ge.decimalLongitude,Ge.decimalLatitude]}}),fn=re,Ge&&ze.focus())}catch(Ge){if(Ge&&typeof Ge=="object"&&"name"in Ge&&Ge.name==="AbortError")return;throw Ge}finally{De===er&&n(19,er=void 0)}}function Qo(){var ye;if(!(Ce!=null&&Ce.length)||!ee)return;const J=[180,90,-180,-90],Ie=!Ce.some(De=>!De.matching_text);for(const De of Ce)if(Ie||!De.matching_text)for(const Ge of[0,1,2,3])J[Ge]=Math[Ge<2?"min":"max"](J[Ge],((ye=De.bbox)==null?void 0:ye[Ge])??De.center[Ge%2]);ae&&Ce.length>0&&(_t&&J[0]===J[2]&&J[1]===J[3]?ae.flyTo(_t.center,Xt):ae.fitBounds(k2(J),50,kt))}function $i(J){n(0,Ae=D==="always"),n(14,re=void 0),n(55,_t=void 0),n(15,en=-1),$r(J[1].toFixed(6)+", "+LN(J[0],[-180,180],!0).toFixed(6),!1)}function Tl(J){if(!re)return;let Ie=J.key==="ArrowDown"?1:J.key==="ArrowUp"?-1:0;Ie&&(en===(Je?0:-1)&&Ie===-1&&n(15,en=re.length),n(15,en+=Ie),en>=re.length&&n(15,en=-1),en<0&&Je&&n(15,en=0),J.preventDefault())}function ei(J=!0){if(n(18,Dr=void 0),Ne){if(Do&&clearTimeout(Do),ie.length{at(Ie).catch(ye=>n(18,Dr=ye))},J?k:0)}else n(14,re=void 0),n(18,Dr=void 0)}function ft(J){n(55,_t=J),n(1,ie=J.place_name),n(15,en=-1)}const on=()=>ze.focus();function nn(J){Gn[J?"unshift":"push"](()=>{ze=J,n(17,ze)})}function Rr(){ie=this.value,n(1,ie),n(13,or),n(27,S)}const $o=()=>n(13,or=!0),tn=()=>n(13,or=!1),ba=()=>ei(),Vr=()=>{n(1,ie=""),ze.focus()},he=()=>n(0,Ae=!Ae),V=()=>n(18,Dr=void 0),W=J=>n(15,en=J),K=J=>ft(J),se=()=>{Je||n(15,en=-1)},Ee=()=>{};return t.$$set=J=>{"class"in J&&n(2,c=J.class),"apiKey"in J&&n(25,l=J.apiKey),"bbox"in J&&n(26,d=J.bbox),"clearButtonTitle"in J&&n(3,w=J.clearButtonTitle),"clearOnBlur"in J&&n(27,S=J.clearOnBlur),"collapsed"in J&&n(4,I=J.collapsed),"country"in J&&n(28,T=J.country),"debounceSearch"in J&&n(29,k=J.debounceSearch),"enableReverse"in J&&n(5,D=J.enableReverse),"errorMessage"in J&&n(6,U=J.errorMessage),"filter"in J&&n(30,q=J.filter),"flyTo"in J&&n(31,ee=J.flyTo),"fuzzyMatch"in J&&n(32,B=J.fuzzyMatch),"language"in J&&n(33,j=J.language),"limit"in J&&n(34,$=J.limit),"mapController"in J&&n(35,ae=J.mapController),"minLength"in J&&n(36,me=J.minLength),"noResultsMessage"in J&&n(7,pe=J.noResultsMessage),"placeholder"in J&&n(8,Q=J.placeholder),"proximity"in J&&n(37,oe=J.proximity),"reverseActive"in J&&n(0,Ae=J.reverseActive),"reverseButtonTitle"in J&&n(9,Y=J.reverseButtonTitle),"searchValue"in J&&n(1,ie=J.searchValue),"showFullGeometry"in J&&n(38,He=J.showFullGeometry),"showPlaceType"in J&&n(10,ge=J.showPlaceType),"showResultsWhileTyping"in J&&n(39,Ne=J.showResultsWhileTyping),"selectFirst"in J&&n(11,Je=J.selectFirst),"flyToSelected"in J&&n(40,qe=J.flyToSelected),"markerOnSelected"in J&&n(41,zt=J.markerOnSelected),"types"in J&&n(42,Pt=J.types),"excludeTypes"in J&&n(43,Zt=J.excludeTypes),"zoom"in J&&n(44,Xt=J.zoom),"maxZoom"in J&&n(45,kt=J.maxZoom),"apiUrl"in J&&n(46,un=J.apiUrl),"fetchParameters"in J&&n(47,Fn=J.fetchParameters),"iconsBaseUrl"in J&&n(12,bn=J.iconsBaseUrl),"adjustUrlQuery"in J&&n(48,mn=J.adjustUrlQuery),"$$scope"in J&&n(58,a=J.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,gs=or),S&&!or&&n(1,ie="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&ie.lengthn(18,Dr=J)),t.$$.dirty[1]&50356241&&(ae&&_t&&_t.id!==Bs&&ee&&(!_t.bbox||_t.bbox[0]===_t.bbox[2]&&_t.bbox[1]===_t.bbox[3]?ae.flyTo(_t.center,_t.id.startsWith("poi.")||_t.id.startsWith("address.")?kt:Xt):ae.fitBounds(k2(_t.bbox),50,kt),n(14,re=void 0),n(54,Ce=void 0),n(15,en=-1)),n(56,Bs=_t==null?void 0:_t.id)),t.$$.dirty[0]&18432&&Je&&re!=null&&re.length&&n(15,en=0),t.$$.dirty[0]&2050&&(Je||n(15,en=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Ce!==re&&n(54,Ce=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&ae&&ae.setEventHandler(J=>{switch(J.type){case"mapClick":Ae&&$i(J.coordinates);break;case"markerClick":{const Ie=re==null?void 0:re.find(ye=>ye.id===J.id);Ie&&ft(Ie)}break;case"markerMouseEnter":Ce&&n(15,en=gs?(re==null?void 0:re.findIndex(Ie=>Ie.id===J.id))??-1:-1);break;case"markerMouseLeave":Ce&&n(15,en=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=re==null?void 0:re[en]),t.$$.dirty[1]&67133969&&ae&&r&&ee&&qe&&ae.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?kt:Xt),t.$$.dirty[1]&1040&&(zt||ae==null||ae.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&ae&&zt&&!Ce&&(ae.setMarkers(r?[r]:void 0,void 0),ae.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&ae&&ae.setMarkers(Ce,_t),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Ce&&ae&&ae.setSelectedMarker(en),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&ae){const J=_s(ie);ae.setReverseMarker(J?[J.decimalLongitude,J.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Ai("select",r),t.$$.dirty[1]&16777216&&Ai("pick",_t),t.$$.dirty[0]&81920&&Ai("optionsVisibilityChange",gs&&!!re),t.$$.dirty[0]&16384&&Ai("featuresListed",re),t.$$.dirty[1]&8388608&&Ai("featuresMarked",Ce),t.$$.dirty[0]&1&&Ai("reverseToggle",Ae),t.$$.dirty[0]&2&&Ai("queryChange",ie),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&ae&&ae.indicateReverse(Ae)},[Ae,ie,c,w,I,D,U,pe,Q,Y,ge,Je,bn,or,re,en,gs,ze,Dr,er,Ha,Cl,Tl,ei,ft,l,d,S,T,k,q,ee,B,j,$,ae,me,oe,He,Ne,qe,zt,Pt,Zt,Xt,kt,un,Fn,mn,Bn,ir,$r,_r,cr,Ce,_t,Bs,r,a,i,on,nn,Rr,$o,tn,ba,Vr,he,V,W,K,se,Ee]}class ZN extends Jt{constructor(e){super(),Kt(this,e,HN,WN,qt,{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 j2(t){let e,n,r;return n=new ZN({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"class","svelte-ixhnie")},m(i,a){Me(i,e,a),rt(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||(ve(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function XN(t){let e,n,r=t[1]&&j2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&ve(r,1)):(r=j2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function YN(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?lN(a,Ts):null)},[i,r,a]}class KN extends Jt{constructor(e){super(),Kt(this,e,YN,XN,qt,{apiKey:0,map:2})}}const JN=Symbol.for("svelte-maplibre");function QN(){return Cv(JN)}function $N(t){return"layerType"in t&&t.layerType==="deckgl"}var jc=e5;function e5(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}),W2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function H2(t){let e,n,r=(t[4]||t[3]instanceof Ts.Marker)&&Z2(t);return{c(){e=ke("div"),r&&r.c()},m(i,a){Me(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Ts.Marker?r?(r.p(i,a),a[0]&24&&ve(r,1)):(r=Z2(i),r.c(),ve(r,1),r.m(e,null)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(),t[32](null)}}}function Z2(t){let e;const n=t[30].default,r=Xr(n,t,t[29],W2);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)&&Kr(r,n,i,i[29],e?Yr(n,i[29],a,r5):Jr(i[29]),W2)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function i5(t){let e,n,r=t[9].default&&H2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&ve(r,1)):(r=H2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function o5(t,e,n){let r,i,a,c,l,d,{$$slots:w={},$$scope:S}=e;const I=tP(w);let{closeButton:T=void 0}=e,{closeOnClickOutside:k=!0}=e,{closeOnClickInside:D=!1}=e,{closeOnMove:U=!1}=e,{openOn:q="click"}=e,{openIfTopMost:ee=!0}=e,{focusAfterOpen:B=!0}=e,{anchor:j=void 0}=e,{offset:$=void 0}=e,{popupClass:ae=void 0}=e,{maxWidth:me=void 0}=e,{lngLat:pe=void 0}=e,{html:Q=void 0}=e,{open:oe=!1}=e;const Ae=Xu(),{map:Y,popupTarget:ie,layerEvent:He,layer:ge,eventTopMost:Ne}=QN();Ct(t,Y,Ce=>n(2,a=Ce)),Ct(t,ie,Ce=>n(3,l=Ce)),Ct(t,He,Ce=>n(28,c=Ce)),Ct(t,ge,Ce=>n(35,d=Ce));const Je=["click","dblclick","contextmenu"];let qe,zt=!1,Pt;function Zt(){if(!qe)return;let Ce=qe.getElement();!Ce||Ce===Pt||(Pt=Ce,q==="hover"&&(Pt.style.pointerEvents="none"),Pt.addEventListener("mouseenter",()=>{n(24,zt=!0)},{passive:!0}),Pt.addEventListener("mouseleave",()=>{n(24,zt=!1)},{passive:!0}),Pt.addEventListener("click",()=>{D&&n(0,oe=!1)},{passive:!0}))}Zu(()=>{if(a)return a.on("click",_r),a.on("contextmenu",_r),typeof l=="string"&&(a.on("click",l,Fn),a.on("dblclick",l,Fn),a.on("contextmenu",l,Fn),a.on("mousemove",l,$r),a.on("mouseleave",l,ir),a.on("touchstart",l,mn),a.on("touchend",l,Bn)),()=>{a!=null&&a.loaded()&&(qe==null||qe.remove(),a.off("click",_r),a.off("contextmenu",_r),l instanceof Ts.Marker?l.getPopup()===qe&&l.setPopup(void 0):typeof l=="string"&&(a.off("click",l,Fn),a.off("dblclick",l,Fn),a.off("contextmenu",l,Fn),a.off("mousemove",l,$r),a.off("mouseleave",l,ir),a.off("touchstart",l,mn),a.off("touchend",l,Bn)))}});function Xt(Ce){return ee?!("marker"in Ce)&&!$N(Ce)&&Ne(Ce)!==d:!1}let kt=null,un="normal";function Fn(Ce){Ce.type===q&&(Xt(Ce)||("layerType"in Ce?Ce.layerType==="deckgl"?(n(10,pe=Ce.coordinate),n(4,kt=Ce.object?[Ce.object]:null)):(n(10,pe=Ce.lngLat),n(4,kt=Ce.features??[])):(n(10,pe=Ce.lngLat),n(4,kt=Ce.features??[])),setTimeout(()=>n(0,oe=!0))))}let bn=null;function mn(Ce){bn=Ce.point}function Bn(Ce){if(!bn||q!=="hover")return;let _t=bn.dist(Ce.point);bn=null,_t<3&&(n(10,pe=Ce.lngLat),n(4,kt=Ce.features??[]),qe.isOpen()?n(25,un="justOpened"):(n(25,un="opening"),n(0,oe=!0)))}function ir(Ce){q!=="hover"||bn||un!=="normal"||(n(0,oe=!1),n(4,kt=null))}function $r(Ce){if(!(q!=="hover"||bn||un!=="normal")){if(Xt(Ce)){n(0,oe=!1),n(4,kt=null);return}n(0,oe=!0),n(4,kt=Ce.features??[]),n(10,pe=Ce.lngLat)}}function _r(Ce){if(un==="justOpened"){n(25,un="normal");return}if(!k)return;let _t=[Pt,l instanceof Ts.Marker?l==null?void 0:l.getElement():null];oe&&qe.isOpen()&&!_t.some(xn=>xn==null?void 0:xn.contains(Ce.originalEvent.target))&&(Ce.type==="contextmenu"&&q==="contextmenu"||Ce.type!=="contextmenu")&&n(0,oe=!1)}us(()=>{a&&(qe!=null&&qe.isOpen())&&qe.remove()});let cr;const or=()=>n(0,oe=!1);function re(Ce){Gn[Ce?"unshift":"push"](()=>{cr=Ce,n(1,cr)})}return t.$$set=Ce=>{"closeButton"in Ce&&n(11,T=Ce.closeButton),"closeOnClickOutside"in Ce&&n(12,k=Ce.closeOnClickOutside),"closeOnClickInside"in Ce&&n(13,D=Ce.closeOnClickInside),"closeOnMove"in Ce&&n(14,U=Ce.closeOnMove),"openOn"in Ce&&n(15,q=Ce.openOn),"openIfTopMost"in Ce&&n(16,ee=Ce.openIfTopMost),"focusAfterOpen"in Ce&&n(17,B=Ce.focusAfterOpen),"anchor"in Ce&&n(18,j=Ce.anchor),"offset"in Ce&&n(19,$=Ce.offset),"popupClass"in Ce&&n(20,ae=Ce.popupClass),"maxWidth"in Ce&&n(21,me=Ce.maxWidth),"lngLat"in Ce&&n(10,pe=Ce.lngLat),"html"in Ce&&n(22,Q=Ce.html),"open"in Ce&&n(0,oe=Ce.open),"$$scope"in Ce&&n(29,S=Ce.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=T??(!k&&!D)),t.$$.dirty[0]&146685952&&(qe||(n(23,qe=new Ts.Popup({closeButton:r,closeOnClick:!1,closeOnMove:U,focusAfterOpen:B,maxWidth:me,className:ae,anchor:j,offset:$})),Pt=qe.getElement(),qe.on("open",()=>{n(0,oe=!0),Zt(),Ae("open",qe)}),qe.on("close",()=>{n(0,oe=!1),Ae("close",qe)}),qe.on("hover",()=>{Ae("hover",qe)}))),t.$$.dirty[0]&8421384&&qe&&l instanceof Ts.Marker&&(q==="click"?l.setPopup(qe):l.getPopup()===qe&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&Je.includes(q)&&(c==null?void 0:c.type)===q&&(Fn(c),Zn(He,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=q==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&q==="hover"&&He&&(i&&c&&(c.layerType==="deckgl"?(n(10,pe=c.coordinate),n(4,kt=c.object?[c.object]:null)):(n(10,pe=c.lngLat),n(4,kt=c.features??[]))),n(0,oe=(i||zt)??!1)),t.$$.dirty[0]&12582914&&(cr?qe.setDOMContent(cr):Q&&qe.setHTML(Q)),t.$$.dirty[0]&8389632&&pe&&qe.setLngLat(pe),t.$$.dirty[0]&41943045&&a){let Ce=qe.isOpen();oe&&!Ce?(qe.addTo(a),un==="opening"&&n(25,un="justOpened")):!oe&&Ce&&qe.remove()}},[oe,cr,a,l,kt,Y,ie,He,ge,I,pe,T,k,D,U,q,ee,B,j,$,ae,me,Q,qe,zt,un,i,r,c,S,w,or,re]}class s5 extends Jt{constructor(e){super(),Kt(this,e,o5,i5,qt,{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 om=Uint8Array,FC=Uint16Array,a5=Int32Array,l5=new om([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]),u5=new om([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]),BC=function(t,e){for(var n=new FC(31),r=0;r<31;++r)n[r]=e+=1<>1|(Qn&21845)<<1,jl=(jl&52428)>>2|(jl&13107)<<2,jl=(jl&61680)>>4|(jl&3855)<<4,f5[Qn]=((jl&65280)>>8|(jl&255)<<8)>>1;var jl,Qn,q_=new om(288);for(Qn=0;Qn<144;++Qn)q_[Qn]=8;var Qn;for(Qn=144;Qn<256;++Qn)q_[Qn]=9;var Qn;for(Qn=256;Qn<280;++Qn)q_[Qn]=7;var Qn;for(Qn=280;Qn<288;++Qn)q_[Qn]=8;var Qn,p5=new om(32);for(Qn=0;Qn<32;++Qn)p5[Qn]=5;var Qn,d5=new om(0),m5=typeof TextDecoder<"u"&&new TextDecoder,g5=0;try{m5.decode(d5,{stream:!0}),g5=1}catch{}const _5=t=>({props:t&8}),X2=t=>({props:b5(t[3])});function y5(t){let e;const n=t[1].default,r=Xr(n,t,t[2],X2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&Kr(r,n,i,i[2],e?Yr(n,i[2],a,_5):Jr(i[2]),X2)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function v5(t){let e,n;return e=new s5({props:{openOn:t[0],$$slots:{default:[y5,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(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||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function b5(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function x5(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 eh extends Jt{constructor(e){super(),Kt(this,e,x5,v5,qt,{openOn:0})}}const w5=["==",["geometry-type"],"Polygon"],S5=["==",["geometry-type"],"LineString"];function x1(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 qf(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(l=>{var d;return(d=t.get(l.layer.id))==null?void 0:d.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,a),a}}function C5(){let t=new Map;return Iv(w1,{map:tr(null),source:n0(null),layer:n0(null),popupTarget:n0(null),cluster:tr(),loadedImages:tr(new Set),minzoom:tr(0),maxzoom:tr(24),layerEvent:tr(null),layerInfo:t,eventTopMost:I5(t)})}function Y2(t){return{subscribe:t.subscribe}}function S1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=np(),a=tr(null),c=Y2(a),l={...i,[t]:Y2(a)};if(e&&(l.popupTarget=c),r){let d=tr(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=tr()),Iv(w1,l),{...i,self:a}}function T5(){return S1({key:"source",setCluster:!0})}function L5(t=!0){return S1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function P5(){return S1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function K2(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 M5(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 A5(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function qc(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function J2(t){let e=t[0],n,r,i=Q2(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c[0]&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=Q2(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function Q2(t){let e;const n=t[36].default,r=Xr(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)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function k5(t){let e,n,r=t[0]&&J2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&ve(r,1)):(r=J2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function D5(t,e,n){let r,i,a,c,l,d,w,S,I,T,k,D,{$$slots:U={},$$scope:q}=e,{id:ee=tp("layer")}=e,{source:B=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:$=void 0}=e,{beforeLayerType:ae=void 0}=e,{type:me}=e,{paint:pe=void 0}=e,{layout:Q=void 0}=e,{filter:oe=void 0}=e,{applyToClusters:Ae=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:ie=void 0}=e,{manageHoverState:He=!1}=e,{hovered:ge=null}=e,{interactive:Ne=!0}=e,{hoverCursor:Je=void 0}=e,{eventsIfTopMost:qe=!1}=e;const zt=Xu(),{map:Pt,source:Zt,self:Xt,minzoom:kt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=L5();Ct(t,Pt,re=>n(31,I=re)),Ct(t,Zt,re=>n(32,T=re)),Ct(t,Xt,re=>n(0,S=re)),Ct(t,kt,re=>n(34,D=re)),Ct(t,un,re=>n(33,k=re)),us(()=>{S&&I&&(bn.delete(S),I==null||I.removeLayer(S))});let mn;function Bn(re){var ze,en;if(!Ne||!S||!I||qe&&Fn(re)!==S)return;let Ce=re.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn={event:re,map:I,clusterId:_t,layer:S,source:l,features:Ce};zt(re.type,xn)}function ir(re){var ze,en;if(!Ne||!S||!I||qe&&Fn(re)!==S)return;Je&&(I.getCanvas().style.cursor=Je);let Ce=re.features??[];n(6,ge=Ce[0]??null);let _t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id;zt("mouseenter",{event:re,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function $r(re){var ze,en,Dr;if(!Ne||!I)return;if(qe&&Fn(re)!==S){n(6,ge=null),He&&mn!==void 0&&(I==null||I.setFeatureState({source:l,sourceLayer:j,id:mn},{hover:!1}),mn=void 0);return}I.getCanvas().style.cursor=Je;let Ce=re.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn=(Dr=Ce[0])==null?void 0:Dr.id;xn!==mn&&(He&&(mn!==void 0&&(I==null||I.setFeatureState({source:l,id:mn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:l,id:xn,sourceLayer:j},{hover:!0})),mn=xn,n(6,ge=Ce[0]??null)),zt("mousemove",{event:re,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function _r(re){if(!(!Ne||!S||!I)){if(Je&&(I.getCanvas().style.cursor=""),n(6,ge=null),He&&mn!==void 0){const Ce={source:l,id:mn,sourceLayer:j};I==null||I.setFeatureState(Ce,{hover:!1}),mn=void 0}zt("mouseleave",{map:I,layer:S,source:l})}}let cr=!0;function or(re){I&&(I.off("click",re,Bn),I.off("dblclick",re,Bn),I.off("contextmenu",re,Bn),I.off("mouseenter",re,ir),I.off("mousemove",re,$r),I.off("mouseleave",re,_r))}return us(()=>{I&&S&&or(S)}),t.$$set=re=>{"id"in re&&n(7,ee=re.id),"source"in re&&n(8,B=re.source),"sourceLayer"in re&&n(9,j=re.sourceLayer),"beforeId"in re&&n(10,$=re.beforeId),"beforeLayerType"in re&&n(11,ae=re.beforeLayerType),"type"in re&&n(12,me=re.type),"paint"in re&&n(13,pe=re.paint),"layout"in re&&n(14,Q=re.layout),"filter"in re&&n(15,oe=re.filter),"applyToClusters"in re&&n(16,Ae=re.applyToClusters),"minzoom"in re&&n(17,Y=re.minzoom),"maxzoom"in re&&n(18,ie=re.maxzoom),"manageHoverState"in re&&n(19,He=re.manageHoverState),"hovered"in re&&n(6,ge=re.hovered),"interactive"in re&&n(20,Ne=re.interactive),"hoverCursor"in re&&n(21,Je=re.hoverCursor),"eventsIfTopMost"in re&&n(22,qe=re.eventsIfTopMost),"$$scope"in re&&n(35,q=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=A5(Ae)),t.$$.dirty[0]&1073774592&&n(24,i=M5("all",r,oe)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Y??D),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=ie??k),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==ee&&l){S&&(or(S),bn.delete(S));let re=$;if(!$&&ae){let Ce=I.getStyle().layers,_t=typeof ae=="function"?ae:ze=>ze.type===ae,xn=Ce==null?void 0:Ce.find(_t);xn&&(re=xn.id)}Zn(Xt,S=ee,S),I.addLayer(jc({id:S,type:me,source:l,"source-layer":j,filter:i,paint:pe,layout:Q,minzoom:a,maxzoom:c}),re),n(23,cr=!0),I.on("click",S,Bn),I.on("dblclick",S,Bn),I.on("contextmenu",S,Bn),I.on("mouseenter",S,ir),I.on("mousemove",S,$r),I.on("mouseleave",S,_r)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Ne}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?K2((re,Ce)=>I==null?void 0:I.setPaintProperty(S,re,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?K2((re,Ce)=>I==null?void 0:I.setLayoutProperty(S,re,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(pe)),t.$$.dirty[0]&134234112&&(w==null||w(Q)),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&&(cr?n(23,cr=!1):I==null||I.setFilter(S,i))},[S,Pt,Zt,Xt,kt,un,ge,ee,B,j,$,ae,me,pe,Q,oe,Ae,Y,ie,He,Ne,Je,qe,cr,i,c,a,w,d,l,r,I,T,k,D,q,U]}let W_=class extends Jt{constructor(e){super(),Kt(this,e,D5,k5,qt,{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 R5(t){let e;const n=t[16].default,r=Xr(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)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function N5(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:[R5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new W_({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function O5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:$=!0}=e;function ae(ie){B=ie,n(0,B)}function me(ie){dn.call(this,t,ie)}function pe(ie){dn.call(this,t,ie)}function Q(ie){dn.call(this,t,ie)}function oe(ie){dn.call(this,t,ie)}function Ae(ie){dn.call(this,t,ie)}function Y(ie){dn.call(this,t,ie)}return t.$$set=ie=>{"id"in ie&&n(1,a=ie.id),"source"in ie&&n(2,c=ie.source),"sourceLayer"in ie&&n(3,l=ie.sourceLayer),"beforeId"in ie&&n(4,d=ie.beforeId),"beforeLayerType"in ie&&n(5,w=ie.beforeLayerType),"paint"in ie&&n(6,S=ie.paint),"layout"in ie&&n(7,I=ie.layout),"filter"in ie&&n(8,T=ie.filter),"applyToClusters"in ie&&n(9,k=ie.applyToClusters),"minzoom"in ie&&n(10,D=ie.minzoom),"maxzoom"in ie&&n(11,U=ie.maxzoom),"hoverCursor"in ie&&n(12,q=ie.hoverCursor),"manageHoverState"in ie&&n(13,ee=ie.manageHoverState),"hovered"in ie&&n(0,B=ie.hovered),"eventsIfTopMost"in ie&&n(14,j=ie.eventsIfTopMost),"interactive"in ie&&n(15,$=ie.interactive),"$$scope"in ie&&n(24,i=ie.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,q,ee,j,$,r,ae,me,pe,Q,oe,Ae,Y,i]}let H_=class extends Jt{constructor(e){super(),Kt(this,e,O5,N5,qt,{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 z5(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function F5(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:[z5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new W_({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function B5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function $(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function pe(Y){dn.call(this,t,Y)}function Q(Y){dn.call(this,t,Y)}function oe(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,$,ae,me,pe,Q,oe,Ae,i]}let E1=class extends Jt{constructor(e){super(),Kt(this,e,B5,F5,qt,{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 V5(t,e,n){let r;const{map:i}=np();Ct(t,i,d=>n(4,r=d));let{position:a="top-left"}=e,{container:c=void 0}=e,l=null;return us(()=>{r!=null&&r.loaded()&&l&&r.removeControl(l)}),t.$$set=d=>{"position"in d&&n(1,a=d.position),"container"in d&&n(2,c=d.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!l){let d;typeof c=="string"?d=document.querySelector(c)??void 0:d=c,n(3,l=new Ts.FullscreenControl({container:d})),r.addControl(l,a)}},[i,a,c,l,r]}class U5 extends Jt{constructor(e){super(),Kt(this,e,V5,null,qt,{position:1,container:2})}}function G5(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 l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function j5(t,e,n){dE().then(()=>{let r=uE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function $2(t){let e=t[0],n,r,i=eS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=eS(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function eS(t){let e;const n=t[19].default,r=Xr(n,t,t[18],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&262144)&&Kr(r,n,i,i[18],e?Yr(n,i[18],a,null):Jr(i[18]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function q5(t){let e,n,r=t[0]&&$2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=$2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function W5(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:d=tp("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:T=void 0}=e,{lineMetrics:k=void 0}=e,{cluster:D=void 0}=e,{maxzoom:U=void 0}=e,{attribution:q=void 0}=e,{buffer:ee=void 0}=e,{tolerance:B=void 0}=e;const{map:j,cluster:$,self:ae}=T5();Ct(t,j,Q=>n(17,i=Q)),Ct(t,$,Q=>n(20,a=Q)),Ct(t,ae,Q=>n(0,r=Q));let me,pe=!0;return us(()=>{r&&me&&i&&(j5(j,r,me),Zn(ae,r=null,r),n(15,me=void 0))}),t.$$set=Q=>{"id"in Q&&n(4,d=Q.id),"data"in Q&&n(5,w=Q.data),"generateId"in Q&&n(6,S=Q.generateId),"promoteId"in Q&&n(7,I=Q.promoteId),"filter"in Q&&n(8,T=Q.filter),"lineMetrics"in Q&&n(9,k=Q.lineMetrics),"cluster"in Q&&n(10,D=Q.cluster),"maxzoom"in Q&&n(11,U=Q.maxzoom),"attribution"in Q&&n(12,q=Q.attribution),"buffer"in Q&&n(13,ee=Q.buffer),"tolerance"in Q&&n(14,B=Q.tolerance),"$$scope"in Q&&n(18,l=Q.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Zn($,a=D,a),t.$$.dirty&196593&&i&&r!==d&&(Zn(ae,r=d,r),G5(i,r,jc({type:"geojson",data:w,filter:T,lineMetrics:k,generateId:S,promoteId:I,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties,maxzoom:U,attribution:q,buffer:ee,tolerance:B}),Q=>i&&Q===r,()=>{r&&(n(15,me=i==null?void 0:i.getSource(r)),n(16,pe=!0))})),t.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,me=i==null?void 0:i.getSource(d))})),t.$$.dirty&98336&&me&&(pe?n(16,pe=!1):me.setData(w)),t.$$.dirty&33792&&(me==null||me.setClusterOptions(jc({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[r,j,$,ae,d,w,S,I,T,k,D,U,q,ee,B,me,pe,i,l,c]}let qa=class extends Jt{constructor(e){super(),Kt(this,e,W5,q5,qt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function H5(t,e,n){let r;const{map:i}=np();Ct(t,i,T=>n(8,r=T));let{position:a="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:l=void 0}=e,{trackUserLocation:d=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:S=!0}=e,{control:I=null}=e;return us(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),t.$$set=T=>{"position"in T&&n(2,a=T.position),"positionOptions"in T&&n(3,c=T.positionOptions),"fitBoundsOptions"in T&&n(4,l=T.fitBoundsOptions),"trackUserLocation"in T&&n(5,d=T.trackUserLocation),"showAccuracyCircle"in T&&n(6,w=T.showAccuracyCircle),"showUserLocation"in T&&n(7,S=T.showUserLocation),"control"in T&&n(1,I=T.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!I&&(n(1,I=new Ts.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:d,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,I,a,c,l,d,w,S,r]}class Z5 extends Jt{constructor(e){super(),Kt(this,e,H5,null,qt,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function X5(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function Y5(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:[X5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new W_({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function K5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function $(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function pe(Y){dn.call(this,t,Y)}function Q(Y){dn.call(this,t,Y)}function oe(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,$,ae,me,pe,Q,oe,Ae,i]}let lu=class extends Jt{constructor(e){super(),Kt(this,e,K5,Y5,qt,{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 J5(t,e,n){let r;const i=Xu();let{layer:a=void 0}=e;const{map:c}=np();Ct(t,c,S=>n(2,r=S));function l(S){i(S.type,{...S,map:c})}const d=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return us(()=>{if(r)if(a)for(const S of d)r.off(S,a,l);else for(const S of w)r.off(S,l)}),t.$$set=S=>{"layer"in S&&n(1,a=S.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(a)for(const S of d)r.on(S,a,l);else for(const S of w)r.on(S,l)},[c,a,r]}class Q5 extends Jt{constructor(e){super(),Kt(this,e,J5,null,qt,{layer:1})}}function $5(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,l=`${n}/${a}/${c}`,d=t.getBearing(),w=t.getPitch();return(d||w)&&(l+=`/${Math.round(d*10)/10}`),w&&(l+=`/${Math.round(w)}`),`#${l}`}function eO(t){return t.replace("#","").split("/").map(parseFloat)}function tO(t,e,n){let r;const{map:i}=np();Ct(t,i,S=>n(6,r=S));let{position:a="top-left"}=e,{showCompass:c=!0}=e,{showZoom:l=!0}=e,{visualizePitch:d=!1}=e,w=null;return us(()=>{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,l=S.showZoom),"visualizePitch"in S&&n(4,d=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Ts.NavigationControl({showCompass:c,showZoom:l,visualizePitch:d})),r.addControl(w,a))},[i,a,c,l,d,w,r]}class nO extends Jt{constructor(e){super(),Kt(this,e,tO,null,qt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function rO(t,e,n){let r;const{map:i}=np();Ct(t,i,w=>n(5,r=w));let{position:a="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:l="metric"}=e,d=null;return us(()=>{r!=null&&r.loaded()&&d&&r.removeControl(d)}),t.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,c=w.maxWidth),"unit"in w&&n(3,l=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!d&&(n(4,d=new Ts.ScaleControl({maxWidth:c,unit:l})),r.addControl(d,a))},[i,a,c,l,d,r]}class iO extends Jt{constructor(e){super(),Kt(this,e,rO,null,qt,{position:1,maxWidth:2,unit:3})}}const{window:oO}=nP,sO=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),tS=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function nS(t){let e,n,r=t[3]&&rS(t);const i=t[40].default,a=Xr(i,t,t[39],tS);return{c(){r&&r.c(),e=nt(),a&&a.c()},m(c,l){r&&r.m(c,l),Me(c,e,l),a&&a.m(c,l),n=!0},p(c,l){c[3]?r?(r.p(c,l),l[0]&8&&ve(r,1)):(r=rS(c),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn()),a&&a.p&&(!n||l[0]&112|l[1]&256)&&Kr(a,i,c,c[39],n?Yr(i,c[39],l,sO):Jr(c[39]),tS)},i(c){n||(ve(r),ve(a,c),n=!0)},o(c){Se(r),Se(a,c),n=!1},d(c){c&&Le(e),r&&r.d(c),a&&a.d(c)}}}function rS(t){let e,n,r,i,a,c,l,d;return e=new nO({props:{position:t[7]}}),r=new Z5({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new U5({props:{position:t[7]}}),l=new iO({props:{position:t[7]}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment),c=nt(),ot(l.$$.fragment)},m(w,S){rt(e,w,S),Me(w,n,S),rt(r,w,S),Me(w,i,S),rt(a,w,S),Me(w,c,S),rt(l,w,S),d=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),e.$set(I);const T={};S[0]&128&&(T.position=w[7]),r.$set(T);const k={};S[0]&128&&(k.position=w[7]),a.$set(k);const D={};S[0]&128&&(D.position=w[7]),l.$set(D)},i(w){d||(ve(e.$$.fragment,w),ve(r.$$.fragment,w),ve(a.$$.fragment,w),ve(l.$$.fragment,w),d=!0)},o(w){Se(e.$$.fragment,w),Se(r.$$.fragment,w),Se(a.$$.fragment,w),Se(l.$$.fragment,w),d=!1},d(w){w&&(Le(n),Le(i),Le(c)),it(e,w),it(r,w),it(a,w),it(l,w)}}}function aO(t){let e,n,r,i,a,c=t[4]&&t[0]&&nS(t);return{c(){e=ke("div"),c&&c.c(),Ue(e,"class",n=Bg(t[2])+" svelte-p00lfq"),Ue(e,"data-testid","map-container"),hl(e,"expand-map",!t[2])},m(l,d){Me(l,e,d),c&&c.m(e,null),t[41](e),r=!0,i||(a=[Gt(oO,"hashchange",t[11]),M0(t[10].call(null,e))],i=!0)},p(l,d){l[4]&&l[0]?c?(c.p(l,d),d[0]&17&&ve(c,1)):(c=nS(l),c.c(),ve(c,1),c.m(e,null)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),(!r||d[0]&4&&n!==(n=Bg(l[2])+" svelte-p00lfq"))&&Ue(e,"class",n),(!r||d[0]&4)&&hl(e,"expand-map",!l[2])},i(l){r||(ve(c),r=!0)},o(l){Se(c),r=!1},d(l){l&&Le(e),c&&c.d(),t[41](null),i=!1,Mi(a)}}}function lO(t,e,n){let r,i,a,c,{$$slots:l={},$$scope:d}=e,{map:w=null}=e,{mapContainer:S=void 0}=e,{class:I=void 0}=e,{style:T}=e,{diffStyleUpdates:k=!1}=e,{center:D=void 0}=e,{zoom:U=void 0}=e,{pitch:q=0}=e,{bearing:ee=0}=e,{bounds:B=void 0}=e,{hash:j=!1}=e,{updateHash:$=re=>{window.history.replaceState(window.history.state,"",re)}}=e,{loaded:ae=!1}=e,{minZoom:me=0}=e,{maxZoom:pe=22}=e,{antialias:Q=void 0}=e,{zoomOnDoubleClick:oe=!0}=e,{locale:Ae=void 0}=e,{interactive:Y=!0}=e,{attributionControl:ie=!0}=e,{cooperativeGestures:He=!1}=e,{preserveDrawingBuffer:ge=!1}=e,{maxBounds:Ne=void 0}=e,{images:Je=[]}=e,{standardControls:qe=!1}=e,{filterLayers:zt=void 0}=e,{transformRequest:Pt=void 0}=e;const Zt=Xu(),{map:Xt,loadedImages:kt}=C5();Ct(t,Xt,re=>n(4,a=re)),Ct(t,kt,re=>n(5,c=re));let un=new Set;async function Fn(re,Ce=!1){if(a&&!(!a.loaded()&&!Ce))if("url"in re){un.add(re.id);try{let _t=await a.loadImage(re.url);a==null||a.addImage(re.id,_t.data,re.options),c.add(re.id),kt.set(c)}catch(_t){Zt("error",_t)}finally{un.delete(re.id)}}else a.addImage(re.id,re.data,re.options),c.add(re.id),kt.set(c)}let bn,mn,Bn,ir;function $r(re){return cr(),Zn(Xt,a=new Ts.Map(jc({container:re,style:T,locale:Ae,center:D,zoom:U,pitch:q,bearing:ee,minZoom:me,maxZoom:pe,antialias:Q,interactive:Y,preserveDrawingBuffer:ge,maxBounds:Ne,bounds:B,attributionControl:ie,transformRequest:Pt,cooperativeGestures:He})),a),a.on("load",Ce=>{Ce.target.getContainer().setAttribute("data-testid","map"),Ce.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,ae=!0),Zt("load",a)}),a.on("error",Ce=>Zt("error",{...Ce,map:a})),a.on("movestart",Ce=>Zt("movestart",{...Ce,map:a})),a.on("moveend",Ce=>{if(n(12,D=Ce.target.getCenter()),n(13,U=Ce.target.getZoom()),n(14,q=Ce.target.getPitch()),n(15,ee=Ce.target.getBearing()),n(16,B=Ce.target.getBounds()),Zt("moveend",{...Ce,map:a}),j){let _t=new URL(window.location.href.replace(/(#.+)?$/,$5(a)));$(_t)}}),a.on("click",Ce=>Zt("click",{...Ce,map:a})),a.on("dblclick",Ce=>Zt("dblclick",{...Ce,map:a})),a.on("contextmenu",Ce=>Zt("contextmenu",{...Ce,map:a})),a.on("zoomstart",Ce=>Zt("zoomstart",{...Ce,map:a})),a.on("zoom",Ce=>{Zt("zoom",{...Ce,map:a})}),a.on("zoomend",Ce=>{Zt("zoomend",{...Ce,map:a})}),a.on("style.load",()=>{if(a){const Ce=a.getStyle();if(n(36,bn=Ce.layers.map(_t=>_t.id)),n(37,mn=Object.keys(Ce.sources)),ir)for(const[_t,xn]of Object.entries(ir))a.addSource(_t,xn);if(Bn)for(const _t of Bn)a.addLayer(_t);for(const _t of Je)Fn(_t,!0)}}),a.on("styledata",Ce=>{if(a&&zt){const _t=a.getStyle().layers;if(_t)for(let xn of _t)zt(xn)||a.setLayoutProperty(xn.id,"visibility","none")}Zt("styledata",{...Ce,map:a})}),{destroy(){n(0,ae=!1),a==null||a.remove(),Zn(Xt,a=null,a)}}}let _r=T;function cr(){if(j){let re=eO(window.location.hash);re.length>=3&&(n(13,U=re[0]),n(12,D=[re[2],re[1]])),re.length==5&&(n(15,ee=re[3]),n(14,q=re[4]))}}function or(re){Gn[re?"unshift":"push"](()=>{S=re,n(1,S)})}return t.$$set=re=>{"map"in re&&n(17,w=re.map),"mapContainer"in re&&n(1,S=re.mapContainer),"class"in re&&n(2,I=re.class),"style"in re&&n(18,T=re.style),"diffStyleUpdates"in re&&n(19,k=re.diffStyleUpdates),"center"in re&&n(12,D=re.center),"zoom"in re&&n(13,U=re.zoom),"pitch"in re&&n(14,q=re.pitch),"bearing"in re&&n(15,ee=re.bearing),"bounds"in re&&n(16,B=re.bounds),"hash"in re&&n(20,j=re.hash),"updateHash"in re&&n(21,$=re.updateHash),"loaded"in re&&n(0,ae=re.loaded),"minZoom"in re&&n(22,me=re.minZoom),"maxZoom"in re&&n(23,pe=re.maxZoom),"antialias"in re&&n(24,Q=re.antialias),"zoomOnDoubleClick"in re&&n(25,oe=re.zoomOnDoubleClick),"locale"in re&&n(26,Ae=re.locale),"interactive"in re&&n(27,Y=re.interactive),"attributionControl"in re&&n(28,ie=re.attributionControl),"cooperativeGestures"in re&&n(29,He=re.cooperativeGestures),"preserveDrawingBuffer"in re&&n(30,ge=re.preserveDrawingBuffer),"maxBounds"in re&&n(31,Ne=re.maxBounds),"images"in re&&n(32,Je=re.images),"standardControls"in re&&n(3,qe=re.standardControls),"filterLayers"in re&&n(33,zt=re.filterLayers),"transformRequest"in re&&n(34,Pt=re.transformRequest),"$$scope"in re&&n(39,d=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof qe=="boolean"?void 0:qe),t.$$.dirty[0]&16&&n(17,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&a&&!rf(T,_r)){const re=a.getStyle();if(bn&&(Bn=re.layers.filter(Ce=>!bn.includes(Ce.id))),mn){const Ce=Object.keys(re.sources).filter(_t=>!mn.includes(_t));ir={};for(const _t of Ce)ir[_t]=re.sources[_t]}n(38,_r=T),a.setStyle(T,{diff:k}),Zn(kt,c=new Set,c),n(35,un=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&ae&&a!=null&&a.loaded())for(let re of Je)!c.has(re.id)&&!un.has(re.id)&&!a.hasImage(re.id)&&Fn(re);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,i=Je.every(re=>c.has(re.id))),t.$$.dirty[0]&61456&&a){let re={};D!=null&&!rf(D,a==null?void 0:a.getCenter())&&(re.center=D),U!=null&&!rf(U,a==null?void 0:a.getZoom())&&(re.zoom=U),ee!=null&&!rf(ee,a==null?void 0:a.getBearing())&&(re.bearing=ee),q!=null&&!rf(q,a==null?void 0:a.getPitch())&&(re.pitch=q),Object.keys(re).length&&a.easeTo(re)}t.$$.dirty[0]&65552&&B&&!rf(B,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(B)),t.$$.dirty[0]&33554448&&(oe?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[ae,S,I,qe,a,c,i,r,Xt,kt,$r,cr,D,U,q,ee,B,w,T,k,j,$,me,pe,Q,oe,Ae,Y,ie,He,ge,Ne,Je,zt,Pt,un,bn,mn,_r,d,l,or]}class uO extends Jt{constructor(e){super(),Kt(this,e,lO,aO,qt,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const cO=t=>({marker:t&8}),iS=t=>({marker:t[3]});function hO(t){let e,n,r,i,a,c,l;const d=t[19].default,w=Xr(d,t,t[18],iS);return{c(){e=ke("div"),w&&w.c(),Ue(e,"tabindex",n=t[1]?0:void 0),Ue(e,"role",r=t[1]?"button":void 0),Ei(e,"z-index",t[2])},m(S,I){Me(S,e,I),w&&w.m(e,null),a=!0,c||(l=[M0(t[7].call(null,e)),M0(i=fO.call(null,e,t[0])),Gt(e,"click",e0(t[20])),Gt(e,"dblclick",e0(t[21])),Gt(e,"contextmenu",e0(t[22])),Gt(e,"mouseenter",t[23]),Gt(e,"mouseleave",t[24]),Gt(e,"mousemove",t[25]),Gt(e,"keydown",t[8])],c=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&Kr(w,d,S,S[18],a?Yr(d,S[18],I,cO):Jr(S[18]),iS),(!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&&S_(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Ei(e,"z-index",S[2])},i(S){a||(ve(w,S),a=!0)},o(S){Se(w,S),a=!1},d(S){S&&Le(e),w&&w.d(S),c=!1,Mi(l)}}}function fO(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function pO(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{marker:d=void 0}=e,{lngLat:w}=e,{class:S=void 0}=e,{interactive:I=!0}=e,{asButton:T=!1}=e,{draggable:k=!1}=e,{feature:D=null}=e,{offset:U=void 0}=e,{zIndex:q=void 0}=e,{rotation:ee=0}=e,{opacity:B=1}=e;const j=Xu(),{map:$,layerEvent:ae,self:me}=P5();Ct(t,$,qe=>n(27,a=qe)),Ct(t,ae,qe=>n(26,r=qe)),Ct(t,me,qe=>n(3,i=qe));function pe(qe){Zn(me,i=new Ts.Marker({element:qe,rotation:ee,draggable:k,offset:U,opacity:B.toString()}).setLngLat(w).addTo(a),i),n(11,d=i);const zt=()=>Ae("dragstart"),Pt=()=>{Q(),Ae("drag")},Zt=()=>{Q(),Ae("dragend")};return k&&(i.on("dragstart",zt),i.on("drag",Pt),i.on("dragend",Zt)),{destroy(){k&&(i==null||i.off("dragstart",zt),i==null||i.off("drag",Pt),i==null||i.off("dragend",Zt)),n(11,d=void 0),i==null||i.remove()}}}function Q(){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 oe(qe){qe.key===" "&&(qe.preventDefault(),qe.stopPropagation(),Ae("click"))}function Ae(qe){if(!I)return;let zt=i==null?void 0:i.getLngLat();if(!zt)return;const Pt=[zt.lng,zt.lat];let Zt={map:a,marker:i,lngLat:Pt,features:[{type:"Feature",properties:(D==null?void 0:D.properties)??{},geometry:{type:"Point",coordinates:Pt}}]};Zn(ae,r={...Zt,layerType:"marker",type:qe},r),j(qe,Zt)}const Y=()=>Ae("click"),ie=()=>Ae("dblclick"),He=()=>Ae("contextmenu"),ge=qe=>{Ae("mouseenter")},Ne=()=>{Ae("mouseleave")},Je=()=>Ae("mousemove");return t.$$set=qe=>{"marker"in qe&&n(11,d=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,T=qe.asButton),"draggable"in qe&&n(13,k=qe.draggable),"feature"in qe&&n(14,D=qe.feature),"offset"in qe&&n(15,U=qe.offset),"zIndex"in qe&&n(2,q=qe.zIndex),"rotation"in qe&&n(16,ee=qe.rotation),"opacity"in qe&&n(17,B=qe.opacity),"$$scope"in qe&&n(18,l=qe.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(w)),t.$$.dirty&32776&&(i==null||i.setOffset(U??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(ee)),t.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,T,q,i,$,ae,me,pe,oe,Ae,w,d,I,k,D,U,ee,B,l,c,Y,ie,He,ge,Ne,Je]}class Zd extends Jt{constructor(e){super(),Kt(this,e,pO,hO,qt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function dO(t){let e;const n=t[16].default,r=Xr(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)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function mO(t){let e,n,r;function i(c){t[17](c)}let a={id:t[1],type:"symbol",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:[dO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new W_({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function gO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("symbol")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S=void 0}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:$=!0}=e;function ae(ie){B=ie,n(0,B)}function me(ie){dn.call(this,t,ie)}function pe(ie){dn.call(this,t,ie)}function Q(ie){dn.call(this,t,ie)}function oe(ie){dn.call(this,t,ie)}function Ae(ie){dn.call(this,t,ie)}function Y(ie){dn.call(this,t,ie)}return t.$$set=ie=>{"id"in ie&&n(1,a=ie.id),"source"in ie&&n(2,c=ie.source),"sourceLayer"in ie&&n(3,l=ie.sourceLayer),"beforeId"in ie&&n(4,d=ie.beforeId),"beforeLayerType"in ie&&n(5,w=ie.beforeLayerType),"paint"in ie&&n(6,S=ie.paint),"layout"in ie&&n(7,I=ie.layout),"filter"in ie&&n(8,T=ie.filter),"applyToClusters"in ie&&n(9,k=ie.applyToClusters),"minzoom"in ie&&n(10,D=ie.minzoom),"maxzoom"in ie&&n(11,U=ie.maxzoom),"hoverCursor"in ie&&n(12,q=ie.hoverCursor),"manageHoverState"in ie&&n(13,ee=ie.manageHoverState),"hovered"in ie&&n(0,B=ie.hovered),"eventsIfTopMost"in ie&&n(14,j=ie.eventsIfTopMost),"interactive"in ie&&n(15,$=ie.interactive),"$$scope"in ie&&n(24,i=ie.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,q,ee,j,$,r,ae,me,pe,Q,oe,Ae,Y,i]}class _O extends Jt{constructor(e){super(),Kt(this,e,gO,mO,qt,{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})}}const yO=t=>({}),oS=t=>({}),vO=t=>({}),sS=t=>({}),bO=t=>({}),aS=t=>({});function xO(t){let e,n,r,i,a,c;const l=t[1].top,d=Xr(l,t,t[0],aS),w=t[1].left,S=Xr(w,t,t[0],sS),I=t[1].main,T=Xr(I,t,t[0],oS);return{c(){e=ke("div"),d&&d.c(),n=nt(),r=ke("div"),S&&S.c(),i=nt(),a=ke("div"),T&&T.c(),Ue(e,"class","top svelte-mpick2"),Ue(r,"class","left svelte-mpick2"),Ue(a,"class","main svelte-mpick2")},m(k,D){Me(k,e,D),d&&d.m(e,null),Me(k,n,D),Me(k,r,D),S&&S.m(r,null),Me(k,i,D),Me(k,a,D),T&&T.m(a,null),c=!0},p(k,[D]){d&&d.p&&(!c||D&1)&&Kr(d,l,k,k[0],c?Yr(l,k[0],D,bO):Jr(k[0]),aS),S&&S.p&&(!c||D&1)&&Kr(S,w,k,k[0],c?Yr(w,k[0],D,vO):Jr(k[0]),sS),T&&T.p&&(!c||D&1)&&Kr(T,I,k,k[0],c?Yr(I,k[0],D,yO):Jr(k[0]),oS)},i(k){c||(ve(d,k),ve(S,k),ve(T,k),c=!0)},o(k){Se(d,k),Se(S,k),Se(T,k),c=!1},d(k){k&&(Le(e),Le(n),Le(r),Le(i),Le(a)),d&&d.d(k),S&&S.d(k),T&&T.d(k)}}}function wO(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class SO extends Jt{constructor(e){super(),Kt(this,e,wO,xO,qt,{})}}const EO=t=>({}),lS=t=>({}),IO=t=>({}),uS=t=>({}),CO=t=>({}),cS=t=>({});function TO(t){let e,n,r,i,a,c;const l=t[4].top,d=Xr(l,t,t[3],cS),w=t[4].sidebar,S=Xr(w,t,t[3],uS),I=t[4].map,T=Xr(I,t,t[3],lS);return{c(){e=ke("div"),d&&d.c(),n=nt(),r=ke("div"),S&&S.c(),i=nt(),a=ke("div"),T&&T.c()},m(k,D){Me(k,e,D),d&&d.m(e,null),t[5](e),Me(k,n,D),Me(k,r,D),S&&S.m(r,null),t[6](r),Me(k,i,D),Me(k,a,D),T&&T.m(a,null),t[7](a),c=!0},p(k,[D]){d&&d.p&&(!c||D&8)&&Kr(d,l,k,k[3],c?Yr(l,k[3],D,CO):Jr(k[3]),cS),S&&S.p&&(!c||D&8)&&Kr(S,w,k,k[3],c?Yr(w,k[3],D,IO):Jr(k[3]),uS),T&&T.p&&(!c||D&8)&&Kr(T,I,k,k[3],c?Yr(I,k[3],D,EO):Jr(k[3]),lS)},i(k){c||(ve(d,k),ve(S,k),ve(T,k),c=!0)},o(k){Se(d,k),Se(S,k),Se(T,k),c=!1},d(k){k&&(Le(e),Le(n),Le(r),Le(i),Le(a)),d&&d.d(k),t[5](null),S&&S.d(k),t[6](null),T&&T.d(k),t[7](null)}}}function LO(t,e,n){let r,i,a;Ct(t,bv,I=>n(0,r=I)),Ct(t,xv,I=>n(1,i=I)),Ct(t,wv,I=>n(2,a=I));let{$$slots:c={},$$scope:l}=e;function d(I){Gn[I?"unshift":"push"](()=>{r=I,bv.set(r)})}function w(I){Gn[I?"unshift":"push"](()=>{i=I,xv.set(i)})}function S(I){Gn[I?"unshift":"push"](()=>{a=I,wv.set(a)})}return t.$$set=I=>{"$$scope"in I&&n(3,l=I.$$scope)},[r,i,a,l,c,d,w,S]}class rp extends Jt{constructor(e){super(),Kt(this,e,LO,TO,qt,{})}}let bv=tr(null),xv=tr(null),wv=tr(null);function hS(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[PO,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&48&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function PO(t){let e,n;return e=new Mv({props:{properties:t[4]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.properties=r[4]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function MO(t){let e,n,r=t[1]&&hS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[1]?r?(r.p(i,a),a&2&&ve(r,1)):(r=hS(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function AO(t){let e,n,r;function i(c){t[2](c)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":qc("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[MO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Xi(e,"hovered",i)),e.$on("click",t[3]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&34&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function kO(t,e,n){let{hovered:r=null}=e,{popups:i=!1}=e;function a(l){r=l,n(0,r)}const c=l=>window.open(cs(l.detail.features[0].properties).osm_id,"_blank");return t.$$set=l=>{"hovered"in l&&n(0,r=l.hovered),"popups"in l&&n(1,i=l.popups)},[r,i,a,c]}class UC extends Jt{constructor(e){super(),Kt(this,e,kO,AO,qt,{hovered:0,popups:1})}}function fS(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function pS(t,e,n){const r=t.slice();return r[6]=e[n],r}function dS(t){let e,n,r=Hg(t[6])+"",i,a,c;return{c(){e=ke("li"),n=ke("a"),i=vt(r),c=nt(),Ue(n,"href",a=t[6].properties.osm_id),Ue(n,"target","_blank")},m(l,d){Me(l,e,d),we(e,n),we(n,i),we(e,c)},p(l,d){d&1&&r!==(r=Hg(l[6])+"")&&An(i,r),d&1&&a!==(a=l[6].properties.osm_id)&&Ue(n,"href",a)},d(l){l&&Le(e)}}}function mS(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",l,d,w,S,I,T=zr(t[3]),k=[];for(let D=0;Di[1].length-r[1].length),n}function RO(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 GC extends Jt{constructor(e){super(),Kt(this,e,RO,DO,qt,{gj:1})}}function _S(t,e,n){const r=t.slice();return r[3]=e[n],r}function yS(t){let e,n,r=zr(t[0]),i=[];for(let a=0;a0&&yS(t);return{c(){n&&n.c(),e=ur()},m(r,i){n&&n.m(r,i),Me(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=yS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:et,o:et,d(r){r&&Le(e),n&&n.d(r)}}}function OO(t,e,n){let{loading:r}=e,i;function a(c){Gn[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 jC extends Jt{constructor(e){super(),Kt(this,e,OO,NO,qt,{loading:0})}}function zO(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,q,ee,B,j,$,ae,me,pe,Q,oe,Ae,Y,ie,He,ge;return{c(){e=ke("nav"),n=ke("ul"),r=ke("li"),i=ke("button"),i.textContent="Change study area",a=nt(),c=ke("li"),l=ke("button"),d=vt("Isochrone"),S=nt(),I=ke("li"),T=ke("button"),k=vt("Route"),U=nt(),q=ke("li"),ee=ke("button"),B=vt("Score"),$=nt(),ae=ke("li"),me=ke("button"),pe=vt("Debug network"),oe=nt(),Ae=ke("label"),Y=ke("input"),ie=vt("Population"),l.disabled=w=t[0].kind=="isochrone",T.disabled=D=t[0].kind=="route",ee.disabled=j=t[0].kind=="score",me.disabled=Q=t[0].kind=="debug",Ue(Y,"type","checkbox")},m(Ne,Je){Me(Ne,e,Je),we(e,n),we(n,r),we(r,i),we(n,a),we(n,c),we(c,l),we(l,d),we(n,S),we(n,I),we(I,T),we(T,k),we(n,U),we(n,q),we(q,ee),we(ee,B),we(n,$),we(n,ae),we(ae,me),we(me,pe),we(e,oe),we(e,Ae),we(Ae,Y),Y.checked=t[1],we(Ae,ie),He||(ge=[Gt(i,"click",t[2]),Gt(l,"click",t[3]),Gt(T,"click",t[4]),Gt(ee,"click",t[5]),Gt(me,"click",t[6]),Gt(Y,"change",t[7])],He=!0)},p(Ne,[Je]){Je&1&&w!==(w=Ne[0].kind=="isochrone")&&(l.disabled=w),Je&1&&D!==(D=Ne[0].kind=="route")&&(T.disabled=D),Je&1&&j!==(j=Ne[0].kind=="score")&&(ee.disabled=j),Je&1&&Q!==(Q=Ne[0].kind=="debug")&&(me.disabled=Q),Je&2&&(Y.checked=Ne[1])},i:et,o:et,d(Ne){Ne&&Le(e),He=!1,Mi(ge)}}}function FO(t,e,n){let r,i;Ct(t,$s,I=>n(0,r=I)),Ct(t,O0,I=>n(1,i=I));const a=()=>Zn($s,r={kind:"title"},r),c=()=>Zn($s,r={kind:"isochrone"},r),l=()=>Zn($s,r={kind:"route"},r),d=()=>Zn($s,r={kind:"score"},r),w=()=>Zn($s,r={kind:"debug"},r);function S(){i=this.checked,O0.set(i)}return[r,i,a,c,l,d,w,S]}class Z_ extends Jt{constructor(e){super(),Kt(this,e,FO,zO,qt,{})}}function bS(t,e,n){const r=t.slice();return r[10]=e[n][0],r[11]=e[n][1],r[12]=e,r[13]=n,r}function BO(t){let e,n,r=t[0].join(", ")+"",i,a,c,l,d;return{c(){e=ke("p"),n=vt("Amenities: "),i=vt(r),a=nt(),c=ke("button"),c.textContent="Choose"},m(w,S){Me(w,e,S),we(e,n),we(e,i),Me(w,a,S),Me(w,c,S),l||(d=Gt(c,"click",t[6]),l=!0)},p(w,S){S&1&&r!==(r=w[0].join(", ")+"")&&An(i,r)},i:et,o:et,d(w){w&&(Le(e),Le(a),Le(c)),l=!1,d()}}}function VO(t){let e,n;return e=new Pv({props:{$$slots:{default:[UO,({dialog:r})=>({9:r}),({dialog:r})=>r?512:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&16898&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function xS(t){let e,n,r,i=t[10]+"",a,c,l=t[11].num+"",d,w,S,I;function T(){t[3].call(n,t[12],t[13])}return{c(){e=ke("label"),n=ke("input"),r=nt(),a=vt(i),c=vt(" ("),d=vt(l),w=vt(`) + `),Ue(n,"type","checkbox")},m(k,D){Me(k,e,D),we(e,n),n.checked=t[11].enabled,we(e,r),we(e,a),we(e,c),we(e,d),we(e,w),S||(I=Gt(n,"change",T),S=!0)},p(k,D){t=k,D&2&&(n.checked=t[11].enabled),D&2&&i!==(i=t[10]+"")&&An(a,i),D&2&&l!==(l=t[11].num+"")&&An(d,l)},d(k){k&&Le(e),S=!1,I()}}}function UO(t){let e,n,r,i,a,c,l,d,w,S,I=zr(t[1].entries()),T=[];for(let D=0;D{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),ve(n,1),n.m(r.parentNode,r))},i(d){i||(ve(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Le(r),c[e].d(d)}}}function jO(t,e){let n=[...t.entries()];n.sort((i,a)=>e(a[1])-e(i[1]));let r=new Map;for(let[i,a]of n)r.set(i,a);return r}function qO(t,e,n){let r;Ct(t,Ql,T=>n(7,r=T));let i=new Map,a=!1,{enabled:c}=e;Zu(async()=>{let T=await r.renderAmenities();for(let k of T.features){let D=k.properties.amenity_kind;i.has(D)?i.get(D).num+=1:i.set(D,{enabled:!1,num:1})}n(1,i=jO(i,k=>k.num))});function l(T){return[...i.entries()].filter(k=>k[1].enabled).map(k=>k[0])}function d(T,k){T[k][1].enabled=this.checked,n(1,i)}const w=T=>cs(T).close(),S=()=>n(2,a=!1),I=()=>n(2,a=!0);return t.$$set=T=>{"enabled"in T&&n(0,c=T.enabled)},t.$$.update=()=>{t.$$.dirty&2&&n(0,c=l())},[c,i,a,d,w,S,I]}class WO extends Jt{constructor(e){super(),Kt(this,e,qO,GO,qt,{enabled:0})}}function HO(t){let e,n,r,i,a,c,l,d,w;return{c(){e=ke("label"),n=vt(`Mode: + `),r=ke("select"),i=ke("option"),i.textContent="Car",a=ke("option"),a.textContent="Bicycle",c=ke("option"),c.textContent="Foot",l=ke("option"),l.textContent="Public transit",i.__value="car",co(i,i.__value),a.__value="bicycle",co(a,a.__value),c.__value="foot",co(c,c.__value),l.__value="transit",co(l,l.__value),t[0]===void 0&&Ld(()=>t[1].call(r))},m(S,I){Me(S,e,I),we(e,n),we(e,r),we(r,i),we(r,a),we(r,c),we(r,l),Vg(r,t[0],!0),d||(w=Gt(r,"change",t[1]),d=!0)},p(S,[I]){I&1&&Vg(r,S[0])},i:et,o:et,d(S){S&&Le(e),d=!1,w()}}}function ZO(t,e,n){let{travelMode:r}=e;function i(){r=hE(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class I1 extends Jt{constructor(e){super(),Kt(this,e,ZO,HO,qt,{travelMode:0})}}const Wc=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],XO=["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"];function YO(t){let e=t[2].population.toLocaleString()+"",n,r,i=Math.round(t[2].density).toLocaleString()+"",a,c;return{c(){n=vt(e),r=vt(" people live here ("),a=vt(i),c=vt(" people / square kilometer)")},m(l,d){Me(l,n,d),Me(l,r,d),Me(l,a,d),Me(l,c,d)},p(l,d){d&4&&e!==(e=l[2].population.toLocaleString()+"")&&An(n,e),d&4&&i!==(i=Math.round(l[2].density).toLocaleString()+"")&&An(a,i)},d(l){l&&(Le(n),Le(r),Le(a),Le(c))}}}function KO(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[YO,({props:r})=>({2:r}),({props:r})=>r?4:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function JO(t){let e,n,r,i;return e=new E1({props:{manageHoverState:!0,paint:{"fill-color":qf(["get","density"],t[1],XO),"fill-opacity":qc(.2,.8)},$$slots:{default:[KO]},$$scope:{ctx:t}}}),r=new lu({props:{paint:{"line-color":"black","line-width":1}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment)},m(a,c){rt(e,a,c),Me(a,n,c),rt(r,a,c),i=!0},p(a,c){const l={};c&8&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){i||(ve(e.$$.fragment,a),ve(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Le(n),it(e,a),it(r,a)}}}function QO(t){let e,n;return e=new qa({props:{data:t[0],generateId:!0,$$slots:{default:[JO]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&8&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function $O(t,e,n){let{gj:r}=e,i=Array.from(Array(6).keys()).map(a=>r.max_density/(6-1)*a);return t.$$set=a=>{"gj"in a&&n(0,r=a.gj)},[r,i]}class ez extends Jt{constructor(e){super(),Kt(this,e,$O,QO,qt,{gj:0})}}function wS(t,e,n){const r=t.slice();return r[3]=e[n],r}function tz(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=vt(e),r=vt(" has "),a=vt(i),c=vt(" next steps (arrivals)")},m(l,d){Me(l,n,d),Me(l,r,d),Me(l,a,d),Me(l,c,d)},p(l,d){d&64&&e!==(e=l[6].name+"")&&An(n,e),d&64&&i!==(i=JSON.parse(l[6].next_steps).length+"")&&An(a,i)},d(l){l&&(Le(n),Le(r),Le(a),Le(c))}}}function nz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[tz,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function SS(t){let e,n;return e=new Pv({props:{$$slots:{default:[rz]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function ES(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=ke("p"),r=vt(n)},m(i,a){Me(i,e,a),we(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&An(r,n)},d(i){i&&Le(e)}}}function rz(t){let e,n=zr(t[0]),r=[];for(let i=0;i{a=null}),Pn())},i(c){i||(ve(e.$$.fragment,c),ve(a),i=!0)},o(c){Se(e.$$.fragment,c),Se(a),i=!1},d(c){c&&(Le(n),Le(r)),it(e,c),a&&a.d(c)}}}function oz(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(cs(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class sz extends Jt{constructor(e){super(),Kt(this,e,oz,iz,qt,{})}}function az(t){let e,n,r;return n=new Z_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function IS(t){let e,n;return e=new GC({props:{gj:t[0]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function lz(t){let e,n,r,i,a,c,l,d,w;function S(k){t[3](k)}let I={};t[1]!==void 0&&(I.travelMode=t[1]),c=new I1({props:I}),Gn.push(()=>Xi(c,"travelMode",S));let T=t[0]&&IS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debug mode",r=nt(),i=ke("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=nt(),ot(c.$$.fragment),d=nt(),T&&T.c(),Ue(e,"slot","sidebar")},m(k,D){Me(k,e,D),we(e,n),we(e,r),we(e,i),we(e,a),rt(c,e,null),we(e,d),T&&T.m(e,null),w=!0},p(k,D){const U={};!l&&D&2&&(l=!0,U.travelMode=k[1],Zi(()=>l=!1)),c.$set(U),k[0]?T?(T.p(k,D),D&1&&ve(T,1)):(T=IS(k),T.c(),ve(T,1),T.m(e,null)):T&&(Ln(),Se(T,1,1,()=>{T=null}),Pn())},i(k){w||(ve(c.$$.fragment,k),ve(T),w=!0)},o(k){Se(c.$$.fragment,k),Se(T),w=!1},d(k){k&&Le(e),it(c),T&&T.d()}}}function CS(t){let e,n;return e=new qa({props:{data:t[0],generateId:!0,$$slots:{default:[hz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(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||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function uz(t){let e,n;return e=new Mv({props:{properties:t[5]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function cz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[uz,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function hz(t){let e,n,r,i,a,c;return e=new lu({props:{id:"network",paint:{"line-width":qc(5,7),"line-color":"black"},filter:bx(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[cz]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new UC({props:{popups:!0}}),a=new sz({}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment)},m(l,d){rt(e,l,d),Me(l,n,d),rt(r,l,d),Me(l,i,d),rt(a,l,d),c=!0},p(l,d){const w={};d&2&&(w.filter=bx(l[1])),d&64&&(w.$$scope={dirty:d,ctx:l}),e.$set(w)},i(l){c||(ve(e.$$.fragment,l),ve(r.$$.fragment,l),ve(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Le(n),Le(i)),it(e,l),it(r,l),it(a,l)}}}function fz(t){let e,n,r=t[0]&&CS(t);return{c(){e=ke("div"),r&&r.c(),Ue(e,"slot","map")},m(i,a){Me(i,e,a),r&&r.m(e,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=CS(i),r.c(),ve(r,1),r.m(e,null)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d()}}}function pz(t){let e,n;return e=new rp({props:{$$slots:{map:[fz],sidebar:[lz],top:[az]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function dz(t,e,n){let r,i;Ct(t,Ql,d=>n(4,r=d)),Ct(t,yf,d=>n(1,i=d));let a=null;Zu(async()=>{n(0,a=await r.renderDebug())});const c=d=>window.open(cs(d.detail.features[0].properties).way,"_blank");function l(d){i=d,yf.set(i)}return[a,i,c,l]}class mz extends Jt{constructor(e){super(),Kt(this,e,dz,pz,qt,{})}}function gz(t){let e,n,r;return n=new Z_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function TS(t){let e,n=Hg(t[2])+"",r,i,a=t[2].properties.amenity_kind+"",c,l;return{c(){e=ke("span"),r=vt(n),i=vt(" ("),c=vt(a),l=vt(")")},m(d,w){Me(d,e,w),we(e,r),we(e,i),we(e,c),we(e,l)},p(d,w){w&4&&n!==(n=Hg(d[2])+"")&&An(r,n),w&4&&a!==(a=d[2].properties.amenity_kind+"")&&An(c,a)},d(d){d&&Le(e)}}}function LS(t){let e,n;return{c(){e=ke("p"),n=vt(t[7])},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&128&&An(n,r[7])},d(r){r&&Le(e)}}}function PS(t){let e,n;return e=new GC({props:{gj:t[5]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function _z(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,q,ee,B,j,$,ae,me,pe,Q,oe=t[2]&&TS(t);function Ae(ge){t[12](ge)}let Y={};t[4]!==void 0&&(Y.travelMode=t[4]),l=new I1({props:Y}),Gn.push(()=>Xi(l,"travelMode",Ae)),j=new mE({props:{colorScale:Wc,limits:t[8]}});let ie=t[7]&&LS(t),He=t[5]&&PS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Isochrone mode",r=nt(),i=ke("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time + in seconds.`,a=nt(),oe&&oe.c(),c=nt(),ot(l.$$.fragment),w=nt(),S=ke("label"),I=vt(`Start time (PT only) + `),T=ke("input"),D=nt(),U=ke("label"),q=ke("input"),ee=vt("Contours"),B=nt(),ot(j.$$.fragment),$=nt(),ie&&ie.c(),ae=nt(),He&&He.c(),Ue(T,"type","time"),T.disabled=k=t[4]!="transit",Ue(q,"type","checkbox"),Ue(e,"slot","sidebar")},m(ge,Ne){Me(ge,e,Ne),we(e,n),we(e,r),we(e,i),we(e,a),oe&&oe.m(e,null),we(e,c),rt(l,e,null),we(e,w),we(e,S),we(S,I),we(S,T),co(T,t[3]),we(e,D),we(e,U),we(U,q),q.checked=t[1],we(U,ee),we(e,B),rt(j,e,null),we(e,$),ie&&ie.m(e,null),we(e,ae),He&&He.m(e,null),me=!0,pe||(Q=[Gt(T,"input",t[13]),Gt(q,"change",t[14])],pe=!0)},p(ge,Ne){ge[2]?oe?oe.p(ge,Ne):(oe=TS(ge),oe.c(),oe.m(e,c)):oe&&(oe.d(1),oe=null);const Je={};!d&&Ne&16&&(d=!0,Je.travelMode=ge[4],Zi(()=>d=!1)),l.$set(Je),(!me||Ne&16&&k!==(k=ge[4]!="transit"))&&(T.disabled=k),Ne&8&&co(T,ge[3]),Ne&2&&(q.checked=ge[1]),ge[7]?ie?ie.p(ge,Ne):(ie=LS(ge),ie.c(),ie.m(e,ae)):ie&&(ie.d(1),ie=null),ge[5]?He?(He.p(ge,Ne),Ne&32&&ve(He,1)):(He=PS(ge),He.c(),ve(He,1),He.m(e,null)):He&&(Ln(),Se(He,1,1,()=>{He=null}),Pn())},i(ge){me||(ve(l.$$.fragment,ge),ve(j.$$.fragment,ge),ve(He),me=!0)},o(ge){Se(l.$$.fragment,ge),Se(j.$$.fragment,ge),Se(He),me=!1},d(ge){ge&&Le(e),oe&&oe.d(),it(l),it(j),ie&&ie.d(),He&&He.d(),pe=!1,Mi(Q)}}}function MS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[yz]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Zd({props:a}),Gn.push(()=>Xi(e,"lngLat",i)),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,l){const d={};l&524288&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.lngLat=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function yz(t){let e;return{c(){e=ke("span"),e.textContent="X",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function AS(t){let e,n;return e=new qa({props:{data:t[5],generateId:!0,$$slots:{default:[xz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(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||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function vz(t){let e=(t[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=vt(e),r=vt(" minutes away")},m(i,a){Me(i,n,a),Me(i,r,a)},p(i,a){a&262144&&e!==(e=(i[18].cost_seconds/60).toFixed(1)+"")&&An(n,e)},d(i){i&&(Le(n),Le(r))}}}function bz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[vz,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&786432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function xz(t){let e,n,r,i,a,c,l;e=new lu({props:{id:"isochrone",filter:S5,paint:{"line-width":2,"line-color":qf(["get","cost_seconds"],t[9],Wc),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[bz]},$$scope:{ctx:t}}}),r=new E1({props:{id:"isochrone-contours",filter:w5,paint:{"fill-color":qf(["get","min_seconds"],t[9],Wc),"fill-opacity":.5}}});function d(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new UC({props:w}),Gn.push(()=>Xi(a,"hovered",d)),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment)},m(S,I){rt(e,S,I),Me(S,n,I),rt(r,S,I),Me(S,i,I),rt(a,S,I),l=!0},p(S,I){const T={};I&524288&&(T.$$scope={dirty:I,ctx:S}),e.$set(T);const k={};!c&&I&4&&(c=!0,k.hovered=S[2],Zi(()=>c=!1)),a.$set(k)},i(S){l||(ve(e.$$.fragment,S),ve(r.$$.fragment,S),ve(a.$$.fragment,S),l=!0)},o(S){Se(e.$$.fragment,S),Se(r.$$.fragment,S),Se(a.$$.fragment,S),l=!1},d(S){S&&(Le(n),Le(i)),it(e,S),it(r,S),it(a,S)}}}function kS(t){let e,n;return e=new qa({props:{data:t[6],$$slots:{default:[wz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(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||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function wz(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Sz(t){let e,n,r,i,a=t[0]&&MS(t),c=t[5]&&AS(t),l=t[6]&&kS(t);return{c(){e=ke("div"),a&&a.c(),n=nt(),c&&c.c(),r=nt(),l&&l.c(),Ue(e,"slot","map")},m(d,w){Me(d,e,w),a&&a.m(e,null),we(e,n),c&&c.m(e,null),we(e,r),l&&l.m(e,null),i=!0},p(d,w){d[0]?a?(a.p(d,w),w&1&&ve(a,1)):(a=MS(d),a.c(),ve(a,1),a.m(e,n)):a&&(Ln(),Se(a,1,1,()=>{a=null}),Pn()),d[5]?c?(c.p(d,w),w&32&&ve(c,1)):(c=AS(d),c.c(),ve(c,1),c.m(e,r)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),d[6]?l?(l.p(d,w),w&64&&ve(l,1)):(l=kS(d),l.c(),ve(l,1),l.m(e,null)):l&&(Ln(),Se(l,1,1,()=>{l=null}),Pn())},i(d){i||(ve(a),ve(c),ve(l),i=!0)},o(d){Se(a),Se(c),Se(l),i=!1},d(d){d&&Le(e),a&&a.d(),c&&c.d(),l&&l.d()}}}function Ez(t){let e,n;return e=new rp({props:{$$slots:{map:[Sz],sidebar:[_z],top:[gz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&524543&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function DS(t,e,n){return e+t*(n-e)}function Iz(t,e,n){let r,i,a;Ct(t,Wg,ae=>n(3,r=ae)),Ct(t,yf,ae=>n(4,i=ae)),Ct(t,Ql,ae=>n(15,a=ae));let c=null;Zu(async()=>{let ae=await a.getBounds();n(0,c={lng:DS(.5,ae[0],ae[2]),lat:DS(.5,ae[1],ae[3])})});let l=!1,d=null,w=null,S="",I;async function T(ae,me,pe,Q){if(c)try{n(5,d=await a.isochrone({start:c,mode:i,contours:l,startTime:r})),n(7,S="")}catch(oe){n(5,d=null),oe=oe.toString()}}async function k(ae,me,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(Q){n(6,w=null),Q=Q.toString()}else n(6,w=null)}let D=[0,3,6,9,12,15],U=D.map(ae=>ae*60);function q(ae){c=ae,n(0,c)}function ee(ae){I=ae,n(2,I)}function B(ae){i=ae,yf.set(i)}function j(){r=this.value,Wg.set(r)}function $(){l=this.checked,n(1,l)}return t.$$.update=()=>{t.$$.dirty&27&&T(),t.$$.dirty&13&&k()},[c,l,I,r,i,d,w,S,D,U,q,ee,B,j,$]}class Cz extends Jt{constructor(e){super(),Kt(this,e,Iz,Ez,qt,{})}}function RS(t,e,n){const r=t.slice();r[22]=e[n];const i=cs(r[22].properties);return r[21]=i,r}function Tz(t){let e,n,r;return n=new Z_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function Lz(t){let e,n,r,i,a,c,l,d=!t[0]&&NS(t);return{c(){e=ke("button"),n=vt("Watch how this route was found (PT only)"),i=nt(),d&&d.c(),a=ur(),e.disabled=r=t[5]!="transit"},m(w,S){Me(w,e,S),we(e,n),Me(w,i,S),d&&d.m(w,S),Me(w,a,S),c||(l=Gt(e,"click",t[9]),c=!0)},p(w,S){S&32&&r!==(r=w[5]!="transit")&&(e.disabled=r),w[0]?d&&(d.d(1),d=null):d?d.p(w,S):(d=NS(w),d.c(),d.m(a.parentNode,a))},d(w){w&&(Le(e),Le(i),Le(a)),d&&d.d(w),c=!1,l()}}}function Pz(t){let e,n;return{c(){e=ke("p"),n=vt(t[7])},m(r,i){Me(r,e,i),we(e,n)},p(r,i){i&128&&An(n,r[7])},d(r){r&&Le(e)}}}function NS(t){let e,n=zr(t[6].features),r=[];for(let i=0;iXi(i,"travelMode",Ae));function ie(Ne,Je){if(Ne[7])return Pz;if(Ne[6])return Lz}let He=ie(t),ge=He&&He(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Route mode",r=nt(),ot(i.$$.fragment),c=nt(),l=ke("label"),d=ke("input"),S=vt(` + Use heuristic (PT only)`),I=nt(),T=ke("label"),k=vt(`Start time (PT only) + `),D=ke("input"),q=nt(),ee=ke("label"),B=ke("input"),j=vt(` + Buffer 5 minutes around route (same mode)`),$=nt(),ae=ke("p"),ae.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to + set the first pin somewhere.)`,me=nt(),ge&&ge.c(),Ue(d,"type","checkbox"),d.disabled=w=t[5]!="transit",Ue(D,"type","time"),D.disabled=U=t[5]!="transit",Ue(B,"type","checkbox"),Ue(e,"slot","sidebar")},m(Ne,Je){Me(Ne,e,Je),we(e,n),we(e,r),rt(i,e,null),we(e,c),we(e,l),we(l,d),d.checked=t[4],we(l,S),we(e,I),we(e,T),we(T,k),we(T,D),co(D,t[3]),we(e,q),we(e,ee),we(ee,B),B.checked=t[0],we(ee,j),we(e,$),we(e,ae),we(e,me),ge&&ge.m(e,null),pe=!0,Q||(oe=[Gt(d,"change",t[14]),Gt(D,"input",t[15]),Gt(B,"change",t[16])],Q=!0)},p(Ne,Je){const qe={};!a&&Je&32&&(a=!0,qe.travelMode=Ne[5],Zi(()=>a=!1)),i.$set(qe),(!pe||Je&32&&w!==(w=Ne[5]!="transit"))&&(d.disabled=w),Je&16&&(d.checked=Ne[4]),(!pe||Je&32&&U!==(U=Ne[5]!="transit"))&&(D.disabled=U),Je&8&&co(D,Ne[3]),Je&1&&(B.checked=Ne[0]),He===(He=ie(Ne))&&ge?ge.p(Ne,Je):(ge&&ge.d(1),ge=He&&He(Ne),ge&&(ge.c(),ge.m(e,null)))},i(Ne){pe||(ve(i.$$.fragment,Ne),pe=!0)},o(Ne){Se(i.$$.fragment,Ne),pe=!1},d(Ne){Ne&&Le(e),it(i),ge&&ge.d(),Q=!1,Mi(oe)}}}function Nz(t){let e;return{c(){e=ke("span"),e.textContent="A",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function Oz(t){let e;return{c(){e=ke("span"),e.textContent="B",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function zS(t){let e,n;return e=new qa({props:{data:t[6],generateId:!0,$$slots:{default:[Wz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&33554433&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function zz(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":20,"line-color":x1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":qc(.5,1)},manageHoverState:!0,$$slots:{default:[Vz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&33554432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Fz(t){let e,n;return e=new lu({props:{paint:{"line-width":["case",["==",["get","kind"],"route"],20,3],"line-color":["case",["==",["get","kind"],"route"],"red",qf(["get","cost_seconds"],t[10],Wc)],"line-opacity":.5},$$slots:{default:[qz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&33554432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Bz(t){let e,n;return e=new Mv({props:{properties:t[21]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&2097152&&(a.properties=r[21]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Vz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[Bz,({props:r})=>({21:r}),({props:r})=>r?2097152:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&35651584&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Uz(t){let e;return{c(){e=vt("part of the route")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function Gz(t){let e=(t[21].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=vt(e),r=vt(" minutes away")},m(i,a){Me(i,n,a),Me(i,r,a)},p(i,a){a&2097152&&e!==(e=(i[21].cost_seconds/60).toFixed(1)+"")&&An(n,e)},d(i){i&&(Le(n),Le(r))}}}function jz(t){let e;function n(a,c){return a[21].kind=="buffer"?Gz:Uz}let r=n(t),i=r(t);return{c(){i.c(),e=ur()},m(a,c){i.m(a,c),Me(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&&Le(e),i.d(a)}}}function qz(t){let e,n;return e=new eh({props:{openOn:"hover",$$slots:{default:[jz,({props:r})=>({21:r}),({props:r})=>r?2097152:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&35651584&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Wz(t){let e,n,r,i;const a=[Fz,zz],c=[];function l(d,w){return d[0]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=ur()},m(d,w){c[e].m(d,w),Me(d,r,w),i=!0},p(d,w){let S=e;e=l(d),e===S?c[e].p(d,w):(Ln(),Se(c[S],1,1,()=>{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),ve(n,1),n.m(r.parentNode,r))},i(d){i||(ve(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Le(r),c[e].d(d)}}}function Hz(t){let e,n,r,i,a,c,l,d,w,S;n=new Q5({}),n.$on("contextmenu",t[8]);function I(q){t[11](q)}let T={draggable:!0,$$slots:{default:[Nz]},$$scope:{ctx:t}};t[2]!==void 0&&(T.lngLat=t[2]),i=new Zd({props:T}),Gn.push(()=>Xi(i,"lngLat",I));function k(q){t[12](q)}let D={draggable:!0,$$slots:{default:[Oz]},$$scope:{ctx:t}};t[1]!==void 0&&(D.lngLat=t[1]),l=new Zd({props:D}),Gn.push(()=>Xi(l,"lngLat",k));let U=t[6]&&zS(t);return{c(){e=ke("div"),ot(n.$$.fragment),r=nt(),ot(i.$$.fragment),c=nt(),ot(l.$$.fragment),w=nt(),U&&U.c(),Ue(e,"slot","map")},m(q,ee){Me(q,e,ee),rt(n,e,null),we(e,r),rt(i,e,null),we(e,c),rt(l,e,null),we(e,w),U&&U.m(e,null),S=!0},p(q,ee){const B={};ee&33554432&&(B.$$scope={dirty:ee,ctx:q}),!a&&ee&4&&(a=!0,B.lngLat=q[2],Zi(()=>a=!1)),i.$set(B);const j={};ee&33554432&&(j.$$scope={dirty:ee,ctx:q}),!d&&ee&2&&(d=!0,j.lngLat=q[1],Zi(()=>d=!1)),l.$set(j),q[6]?U?(U.p(q,ee),ee&64&&ve(U,1)):(U=zS(q),U.c(),ve(U,1),U.m(e,null)):U&&(Ln(),Se(U,1,1,()=>{U=null}),Pn())},i(q){S||(ve(n.$$.fragment,q),ve(i.$$.fragment,q),ve(l.$$.fragment,q),ve(U),S=!0)},o(q){Se(n.$$.fragment,q),Se(i.$$.fragment,q),Se(l.$$.fragment,q),Se(U),S=!1},d(q){q&&Le(e),it(n),it(i),it(l),U&&U.d()}}}function Zz(t){let e,n;return e=new rp({props:{$$slots:{map:[Hz],sidebar:[Rz],top:[Tz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&33554687&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Xz(t,e,n){let r,i,a,c,l,d,w;Ct(t,vf,Q=>n(1,r=Q)),Ct(t,Tc,Q=>n(2,i=Q)),Ct(t,$s,Q=>n(17,a=Q)),Ct(t,Wg,Q=>n(3,c=Q)),Ct(t,xx,Q=>n(4,l=Q)),Ct(t,yf,Q=>n(5,d=Q)),Ct(t,Ql,Q=>n(18,w=Q));let S=null,I=!1,T="";async function k(Q,oe,Ae,Y,ie,He){try{He?n(6,S=await w.bufferRoute({start:i,end:[r.lng,r.lat],mode:d,useHeuristic:l,startTime:c,maxSeconds:5*60})):n(6,S=await w.route({start:Q,end:[oe.lng,oe.lat],mode:Ae,debugSearch:!1,useHeuristic:l,startTime:c})),n(7,T="")}catch(ge){n(6,S=null),n(7,T=ge.toString())}}function D(Q){Zn(Tc,i=Q.detail.lngLat,i)}async function U(){try{let Q=await w.route({start:i,end:[r.lng,r.lat],mode:d,debugSearch:!0,useHeuristic:l,startTime:c});Zn($s,a={kind:"debug-route",debugGj:Q,start:i,end:r,routeGj:S},a)}catch(Q){n(7,T=Q.toString())}}let ee=[0,1,2,3,4,5].map(Q=>Q*60);function B(Q){i=Q,Tc.set(i)}function j(Q){r=Q,vf.set(r)}function $(Q){d=Q,yf.set(d)}function ae(){l=this.checked,xx.set(l)}function me(){c=this.value,Wg.set(c)}function pe(){I=this.checked,n(0,I)}return t.$$.update=()=>{t.$$.dirty&63&&k(i,r,d,l,c,I)},[I,r,i,c,l,d,S,T,D,U,ee,B,j,$,ae,me,pe]}class Yz extends Jt{constructor(e){super(),Kt(this,e,Xz,Zz,qt,{})}}function Kz(t){let e,n,r,i;return{c(){e=ke("div"),n=ke("button"),n.textContent="Back",Ue(e,"slot","top")},m(a,c){Me(a,e,c),we(e,n),r||(i=Gt(n,"click",t[10]),r=!0)},p:et,d(a){a&&Le(e),r=!1,i()}}}function Jz(t){let e,n,r,i,a,c,l,d,w,S=cs(t[4].features[t[4].features.length-1].properties).time+"",I,T,k;return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debugging a route",r=nt(),i=ke("p"),i.textContent=`${t[6]} total nodes searched`,a=nt(),c=ke("input"),l=nt(),d=ke("p"),w=vt("Search is currently at "),I=vt(S),Ue(c,"type","range"),Ue(c,"min","1"),Ue(c,"max",t[6]),Ue(e,"slot","sidebar")},m(D,U){Me(D,e,U),we(e,n),we(e,r),we(e,i),we(e,a),we(e,c),co(c,t[3]),we(e,l),we(e,d),we(d,w),we(d,I),T||(k=[Gt(c,"change",t[9]),Gt(c,"input",t[9])],T=!0)},p(D,U){U&8&&co(c,D[3]),U&16&&S!==(S=cs(D[4].features[D[4].features.length-1].properties).time+"")&&An(I,S)},d(D){D&&Le(e),T=!1,Mi(k)}}}function Qz(t){let e;return{c(){e=ke("span"),e.textContent="A",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function $z(t){let e;return{c(){e=ke("span"),e.textContent="B",Ue(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function e6(t){let e,n;return e=new lu({props:{paint:{"line-width":20,"line-color":x1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function t6(t){let e,n,r,i;return e=new H_({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new lu({props:{paint:{"line-width":5,"line-color":x1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment)},m(a,c){rt(e,a,c),Me(a,n,c),rt(r,a,c),i=!0},p:et,i(a){i||(ve(e.$$.fragment,a),ve(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Le(n),it(e,a),it(r,a)}}}function n6(t){let e,n,r,i,a,c,l,d,w;return n=new Zd({props:{lngLat:t[0],$$slots:{default:[Qz]},$$scope:{ctx:t}}}),i=new Zd({props:{lngLat:t[1],$$slots:{default:[$z]},$$scope:{ctx:t}}}),c=new qa({props:{data:t[2],$$slots:{default:[e6]},$$scope:{ctx:t}}}),d=new qa({props:{data:t[4],generateId:!0,$$slots:{default:[t6]},$$scope:{ctx:t}}}),{c(){e=ke("div"),ot(n.$$.fragment),r=nt(),ot(i.$$.fragment),a=nt(),ot(c.$$.fragment),l=nt(),ot(d.$$.fragment),Ue(e,"slot","map")},m(S,I){Me(S,e,I),rt(n,e,null),we(e,r),rt(i,e,null),we(e,a),rt(c,e,null),we(e,l),rt(d,e,null),w=!0},p(S,I){const T={};I&1&&(T.lngLat=S[0]),I&4096&&(T.$$scope={dirty:I,ctx:S}),n.$set(T);const k={};I&2&&(k.lngLat=S[1]),I&4096&&(k.$$scope={dirty:I,ctx:S}),i.$set(k);const D={};I&4&&(D.data=S[2]),I&4096&&(D.$$scope={dirty:I,ctx:S}),c.$set(D);const U={};I&16&&(U.data=S[4]),I&4096&&(U.$$scope={dirty:I,ctx:S}),d.$set(U)},i(S){w||(ve(n.$$.fragment,S),ve(i.$$.fragment,S),ve(c.$$.fragment,S),ve(d.$$.fragment,S),w=!0)},o(S){Se(n.$$.fragment,S),Se(i.$$.fragment,S),Se(c.$$.fragment,S),Se(d.$$.fragment,S),w=!1},d(S){S&&Le(e),it(n),it(i),it(c),it(d)}}}function r6(t){let e,n,r,i;return e=new rp({props:{$$slots:{map:[n6],sidebar:[Jz],top:[Kz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(a,c){rt(e,a,c),n=!0,r||(i=Gt(window,"keydown",t[7]),r=!0)},p(a,[c]){const l={};c&4159&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){n||(ve(e.$$.fragment,a),n=!0)},o(a){Se(e.$$.fragment,a),n=!1},d(a){it(e,a),r=!1,i()}}}function i6(t,e,n){let r,i,a;Ct(t,E_,U=>n(11,i=U)),Ct(t,$s,U=>n(5,a=U));let{debugGj:c}=e,{start:l}=e,{end:d}=e,{routeGj:w}=e,S=c.features.length/2,I=1;function T(U){U.key=="ArrowLeft"&&I>1&&(U.stopPropagation(),n(3,I--,I)),U.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),us(()=>{i==null||i.keyboard.enable()});function k(){I=Ev(this.value),n(3,I)}const D=()=>Zn($s,a={kind:"route"},a);return t.$$set=U=>{"debugGj"in U&&n(8,c=U.debugGj),"start"in U&&n(0,l=U.start),"end"in U&&n(1,d=U.end),"routeGj"in U&&n(2,w=U.routeGj)},t.$$.update=()=>{t.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:c.features.slice(0,2*I)})},[l,d,w,I,r,a,S,T,c,k,D]}class o6 extends Jt{constructor(e){super(),Kt(this,e,i6,r6,qt,{debugGj:8,start:0,end:1,routeGj:2})}}function FS(t){let e,n;return e=new jC({props:{loading:t[3]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.loading=r[3]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function s6(t){let e,n,r;return n=new Z_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function BS(t){let e,n,r=t[2].properties.poi+"",i,a,c=t[2].properties.cost+"",l,d;return{c(){e=ke("span"),n=vt("From "),i=vt(r),a=vt(", it's "),l=vt(c),d=vt(" seconds to the nearest parking")},m(w,S){Me(w,e,S),we(e,n),we(e,i),we(e,a),we(e,l),we(e,d)},p(w,S){S&4&&r!==(r=w[2].properties.poi+"")&&An(i,r),S&4&&c!==(c=w[2].properties.cost+"")&&An(l,c)},d(w){w&&Le(e)}}}function a6(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,q,ee,B,j,$,ae,me,pe,Q=t[2]&&BS(t);function oe(Y){t[10](Y)}let Ae={};return t[1]!==void 0&&(Ae.enabled=t[1]),a=new WO({props:Ae}),Gn.push(()=>Xi(a,"enabled",oe)),d=new mE({props:{colorScale:Wc,limits:t[7]}}),{c(){e=ke("div"),n=ke("h2"),n.textContent="Score mode",r=nt(),Q&&Q.c(),i=nt(),ot(a.$$.fragment),l=nt(),ot(d.$$.fragment),w=nt(),S=ke("label"),I=ke("input"),T=vt(` + Max time (seconds)`),k=nt(),D=ke("label"),U=ke("input"),q=vt(` + Show parking`),ee=nt(),B=ke("p"),B.textContent=`This is an early experiment of a mode to show an "access score". Right + now, it's starting from every POI chosen and walking up to some time 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.`,j=nt(),$=ke("p"),$.innerHTML='Parking icon from OpenStreetMap Carto',Ue(I,"type","number"),Ue(U,"type","checkbox"),Ue(e,"slot","sidebar")},m(Y,ie){Me(Y,e,ie),we(e,n),we(e,r),Q&&Q.m(e,null),we(e,i),rt(a,e,null),we(e,l),rt(d,e,null),we(e,w),we(e,S),we(S,I),co(I,t[0]),we(S,T),we(e,k),we(e,D),we(D,U),U.checked=t[4],we(D,q),we(e,ee),we(e,B),we(e,j),we(e,$),ae=!0,me||(pe=[Gt(I,"input",t[11]),Gt(U,"change",t[12])],me=!0)},p(Y,ie){Y[2]?Q?Q.p(Y,ie):(Q=BS(Y),Q.c(),Q.m(e,i)):Q&&(Q.d(1),Q=null);const He={};!c&&ie&2&&(c=!0,He.enabled=Y[1],Zi(()=>c=!1)),a.$set(He);const ge={};ie&128&&(ge.limits=Y[7]),d.$set(ge),ie&1&&Ev(I.value)!==Y[0]&&co(I,Y[0]),ie&16&&(U.checked=Y[4])},i(Y){ae||(ve(a.$$.fragment,Y),ve(d.$$.fragment,Y),ae=!0)},o(Y){Se(a.$$.fragment,Y),Se(d.$$.fragment,Y),ae=!1},d(Y){Y&&Le(e),Q&&Q.d(),it(a),it(d),me=!1,Mi(pe)}}}function VS(t){let e,n;return e=new qa({props:{data:t[5],generateId:!0,$$slots:{default:[l6]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&131204&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function l6(t){let e,n,r;function i(c){t[9](c)}let a={paint:{"circle-radius":15,"circle-color":qf(["get","cost"],t[7],Wc),"circle-stroke-width":qc(1,3),"circle-stroke-color":"black"},manageHoverState:!0};return t[2]!==void 0&&(a.hovered=t[2]),e=new H_({props:a}),Gn.push(()=>Xi(e,"hovered",i)),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,l){const d={};l&128&&(d.paint={"circle-radius":15,"circle-color":qf(["get","cost"],c[7],Wc),"circle-stroke-width":qc(1,3),"circle-stroke-color":"black"}),!n&&l&4&&(n=!0,d.hovered=c[2],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function US(t){let e,n;return e=new qa({props:{data:t[6],$$slots:{default:[u6]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&131072&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function u6(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function c6(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function h6(t){let e,n;return e=new qa({props:{data:t[16],$$slots:{default:[f6]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&256&&(a.data=r[16]),i&131088&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function f6(t){let e,n;return e=new _O({props:{filter:["==",["get","amenity_kind"],"bicycle_parking"],layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:t[4]?"visible":"none"}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.layout={"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[4]?"visible":"none"}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function p6(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function d6(t){let e,n,r,i,a,c=t[5]&&VS(t),l=t[6]&&US(t),d={ctx:t,current:null,token:null,hasCatch:!1,pending:p6,then:h6,catch:c6,value:16,blocks:[,,,]};return _f(i=cs(t[8]).renderAmenities(),d),{c(){e=ke("div"),c&&c.c(),n=nt(),l&&l.c(),r=nt(),d.block.c(),Ue(e,"slot","map")},m(w,S){Me(w,e,S),c&&c.m(e,null),we(e,n),l&&l.m(e,null),we(e,r),d.block.m(e,d.anchor=null),d.mount=()=>e,d.anchor=null,a=!0},p(w,S){t=w,t[5]?c?(c.p(t,S),S&32&&ve(c,1)):(c=VS(t),c.c(),ve(c,1),c.m(e,n)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),t[6]?l?(l.p(t,S),S&64&&ve(l,1)):(l=US(t),l.c(),ve(l,1),l.m(e,r)):l&&(Ln(),Se(l,1,1,()=>{l=null}),Pn()),d.ctx=t,S&256&&i!==(i=cs(t[8]).renderAmenities())&&_f(i,d)||Lv(d,t,S)},i(w){a||(ve(c),ve(l),ve(d.block),a=!0)},o(w){Se(c),Se(l);for(let S=0;S<3;S+=1){const I=d.blocks[S];Se(I)}a=!1},d(w){w&&Le(e),c&&c.d(),l&&l.d(),d.block.d(),d.token=null,d=null}}}function m6(t){let e,n,r,i=t[5]==null&&FS(t);return n=new rp({props:{$$slots:{map:[d6],sidebar:[a6],top:[s6]},$$scope:{ctx:t}}}),{c(){i&&i.c(),e=nt(),ot(n.$$.fragment)},m(a,c){i&&i.m(a,c),Me(a,e,c),rt(n,a,c),r=!0},p(a,[c]){a[5]==null?i?(i.p(a,c),c&32&&ve(i,1)):(i=FS(a),i.c(),ve(i,1),i.m(e.parentNode,e)):i&&(Ln(),Se(i,1,1,()=>{i=null}),Pn());const l={};c&131575&&(l.$$scope={dirty:c,ctx:a}),n.$set(l)},i(a){r||(ve(i),ve(n.$$.fragment,a),r=!0)},o(a){Se(i),Se(n.$$.fragment,a),r=!1},d(a){a&&Le(e),i&&i.d(a),it(n,a)}}}function g6(t,e,n){let r,i;Ct(t,Ql,j=>n(8,i=j));let a=[],c=600,l=[],d=!0,w=null;async function S(j,$){n(3,a=[...a,"Calculating scores"]),n(5,w=await i.score({poiKinds:l,maxSeconds:c},kv(I))),n(3,a=[])}function I(j){n(3,a=[...a,j])}let T=null,k;async function D(j){if(k)try{n(6,T=await i.route({start:{lng:k.geometry.coordinates[0],lat:k.geometry.coordinates[1]},end:[k.properties.closest_lon,k.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch($){console.log(`No route: ${$}`),n(6,T=null)}else n(6,T=null)}function U(j){k=j,n(2,k)}function q(j){l=j,n(1,l)}function ee(){c=Ev(this.value),n(0,c)}function B(){d=this.checked,n(4,d)}return t.$$.update=()=>{t.$$.dirty&3&&S(),t.$$.dirty&1&&n(7,r=Array.from(Array(6).keys()).map(j=>c/(6-1)*j)),t.$$.dirty&4&&D()},[c,l,k,a,d,w,T,r,i,U,q,ee,B]}class _6 extends Jt{constructor(e){super(),Kt(this,e,g6,m6,qt,{})}}var Io=63710088e-1,C1={centimeters:Io*100,centimetres:Io*100,degrees:Io/111325,feet:Io*3.28084,inches:Io*39.37,kilometers:Io/1e3,kilometres:Io/1e3,meters:Io,metres:Io,miles:Io/1609.344,millimeters:Io*1e3,millimetres:Io*1e3,nauticalmiles:Io/1852,radians:1,yards:Io*1.0936},y6={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/Io,yards:1.0936133},Sv={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 ma(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 v6(t,e,n){switch(t){case"Point":return os(e).geometry;case"LineString":return ta(e).geometry;case"Polygon":return T1(e).geometry;case"MultiPoint":return WC(e).geometry;case"MultiLineString":return qC(e).geometry;case"MultiPolygon":return HC(e).geometry;default:throw new Error(t+" is invalid")}}function os(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(!x_(t[0])||!x_(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ma(r,e,n)}function b6(t,e,n){return n===void 0&&(n={}),Hc(t.map(function(r){return os(r,e)}),n)}function T1(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 L1(t,e){e===void 0&&(e="kilometers");var n=C1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function X_(t,e){e===void 0&&(e="kilometers");var n=C1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function I6(t,e){return Xd(X_(t,e))}function C6(t){var e=t%360;return e<0&&(e+=360),e}function Xd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function na(t){var e=t%360;return e*Math.PI/180}function T6(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 L1(X_(t,e),n)}function L6(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=Sv[e];if(!r)throw new Error("invalid original units");var i=Sv[n];if(!i)throw new Error("invalid final units");return t/r*i}function x_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function P1(t){return!!t&&t.constructor===Object}function P6(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(!x_(e))throw new Error("bbox must only contain numbers")})}function M6(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 A6=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Sv,bearingToAzimuth:C6,convertArea:L6,convertLength:T6,degreesToRadians:na,earthRadius:Io,factors:C1,feature:ma,featureCollection:Hc,geometry:v6,geometryCollection:S6,isNumber:x_,isObject:P1,lengthToDegrees:I6,lengthToRadians:X_,lineString:ta,lineStrings:w6,multiLineString:qC,multiPoint:WC,multiPolygon:HC,point:os,points:b6,polygon:T1,polygons:x6,radiansToDegrees:Xd,radiansToLength:L1,round:E6,unitsFactors:y6,validateBBox:P6,validateId:M6},Symbol.toStringTag,{value:"Module"}));function Yd(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 Wf(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 ZC(t,e,n){if(n===void 0&&(n={}),n.final===!0)return k6(t,e);var r=Yd(t),i=Yd(e),a=na(r[0]),c=na(i[0]),l=na(r[1]),d=na(i[1]),w=Math.sin(c-a)*Math.cos(d),S=Math.cos(l)*Math.sin(d)-Math.sin(l)*Math.cos(d)*Math.cos(c-a);return Xd(Math.atan2(w,S))}function k6(t,e){var n=ZC(e,t);return n=(n+180)%360,n}function hd(t,e,n){n===void 0&&(n={});var r=Yd(t),i=Yd(e),a=na(i[1]-r[1]),c=na(i[0]-r[0]),l=na(r[1]),d=na(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return L1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function GS(t,e,n,r){r===void 0&&(r={});var i=Yd(t),a=na(i[0]),c=na(i[1]),l=na(n),d=X_(e,r.units),w=Math.asin(Math.sin(c)*Math.cos(d)+Math.cos(c)*Math.sin(d)*Math.cos(l)),S=a+Math.atan2(Math.sin(l)*Math.sin(d)*Math.cos(c),Math.cos(d)-Math.sin(c)*Math.sin(w)),I=Xd(S),T=Xd(w);return os([I,T],r.properties)}function sm(t,e,n){if(t!==null)for(var r,i,a,c,l,d,w,S=0,I=0,T,k=t.type,D=k==="FeatureCollection",U=k==="Feature",q=D?t.features.length:1,ee=0;eed||D>w||U>S){l=I,d=r,w=D,S=U,a=0;return}var q=ta([l,I],n.properties);if(e(q,r,i,U,a)===!1)return!1;a++,l=I})===!1)return!1}}})}function B6(t,e,n){var r=n,i=!1;return YC(t,function(a,c,l,d,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,d,w),i=!0}),r}function KC(t,e){if(!t)throw new Error("geojson is required");ip(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 l=0;li?n:i,w=r>a?r:a;return[c,l,d,w]}var A1={exports:{}},JC={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Kd,function(){function n(B,j,$,ae,me){(function pe(Q,oe,Ae,Y,ie){for(;Y>Ae;){if(Y-Ae>600){var He=Y-Ae+1,ge=oe-Ae+1,Ne=Math.log(He),Je=.5*Math.exp(2*Ne/3),qe=.5*Math.sqrt(Ne*Je*(He-Je)/He)*(ge-He/2<0?-1:1),zt=Math.max(Ae,Math.floor(oe-ge*Je/He+qe)),Pt=Math.min(Y,Math.floor(oe+(He-ge)*Je/He+qe));pe(Q,oe,zt,Pt,ie)}var Zt=Q[oe],Xt=Ae,kt=Y;for(r(Q,Ae,oe),ie(Q[Y],Zt)>0&&r(Q,Ae,Y);Xt0;)kt--}ie(Q[Ae],Zt)===0?r(Q,Ae,kt):r(Q,++kt,Y),kt<=oe&&(Ae=kt+1),oe<=kt&&(Y=kt-1)}})(B,j,$||0,ae||B.length-1,me||i)}function r(B,j,$){var ae=B[j];B[j]=B[$],B[$]=ae}function i(B,j){return Bj?1:0}var a=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(B,j,$){if(!$)return j.indexOf(B);for(var ae=0;ae=B.minX&&j.maxY>=B.minY}function q(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ee(B,j,$,ae,me){for(var pe=[j,$];pe.length;)if(!(($=pe.pop())-(j=pe.pop())<=ae)){var Q=j+Math.ceil(($-j)/ae/2)*ae;n(B,Q,j,$,me),pe.push(j,Q,Q,$)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(B){var j=this.data,$=[];if(!U(B,j))return $;for(var ae=this.toBBox,me=[];j;){for(var pe=0;pe=0&&me[j].children.length>this._maxEntries;)this._split(me,j),j--;this._adjustParentBBoxes(ae,me,j)},a.prototype._split=function(B,j){var $=B[j],ae=$.children.length,me=this._minEntries;this._chooseSplitAxis($,me,ae);var pe=this._chooseSplitIndex($,me,ae),Q=q($.children.splice(pe,$.children.length-pe));Q.height=$.height,Q.leaf=$.leaf,l($,this.toBBox),l(Q,this.toBBox),j?B[j-1].children.push(Q):this._splitRoot($,Q)},a.prototype._splitRoot=function(B,j){this.data=q([B,j]),this.data.height=B.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(B,j,$){for(var ae,me,pe,Q,oe,Ae,Y,ie=1/0,He=1/0,ge=j;ge<=$-j;ge++){var Ne=d(B,0,ge,this.toBBox),Je=d(B,ge,$,this.toBBox),qe=(me=Ne,pe=Je,Q=void 0,oe=void 0,Ae=void 0,Y=void 0,Q=Math.max(me.minX,pe.minX),oe=Math.max(me.minY,pe.minY),Ae=Math.min(me.maxX,pe.maxX),Y=Math.min(me.maxY,pe.maxY),Math.max(0,Ae-Q)*Math.max(0,Y-oe)),zt=T(Ne)+T(Je);qe=j;ie--){var He=B.children[ie];w(Q,B.leaf?me(He):He),oe+=k(Q)}return oe},a.prototype._adjustParentBBoxes=function(B,j,$){for(var ae=$;ae>=0;ae--)w(j[ae],B)},a.prototype._condense=function(B){for(var j=B.length-1,$=void 0;j>=0;j--)B[j].children.length===0?j>0?($=B[j-1].children).splice($.indexOf(B[j]),1):this.clear():l(B[j],this.toBBox)},a})})(JC);var Z6=JC.exports;const X6=I_(A6),Y6=I_(j6),K6=I_(dD);var ol=Z6,QC=X6,$C=Y6,of=K6.default,J6=$C.featureEach;$C.coordEach;QC.polygon;var qS=QC.featureCollection;function eT(t){var e=new ol(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:of(n),ol.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:of(i),r.push(i)}):J6(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:of(i),r.push(i)}),ol.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:of(n),ol.prototype.remove.call(this,n,r)},e.clear=function(){return ol.prototype.clear.call(this)},e.search=function(n){var r=ol.prototype.search.call(this,this.toBBox(n));return qS(r)},e.collides=function(n){return ol.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=ol.prototype.all.call(this);return qS(n)},e.toJSON=function(){return ol.prototype.toJSON.call(this)},e.fromJSON=function(n){return ol.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=of(n);else if(n.type==="FeatureCollection")r=of(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}A1.exports=eT;A1.exports.default=eT;var Q6=A1.exports;const $6=Dv(Q6);function eF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=ma(t)),e.type==="LineString"&&(e=ma(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=WS(t,e);return i&&r.push(i),Hc(r)}var a=$6();return a.load(jS(e)),w_(jS(t),function(c){w_(a.search(c),function(l){var d=WS(c,l);if(d){var w=Wf(d).join(",");n[w]||(n[w]=!0,r.push(d))}})}),Hc(r)}function WS(t,e){var n=Wf(t),r=Wf(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],l=n[1][1],d=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],T=(I-w)*(c-i)-(S-d)*(l-a),k=(S-d)*(a-w)-(I-w)*(i-d),D=(c-i)*(a-w)-(l-a)*(i-d);if(T===0)return null;var U=k/T,q=D/T;if(U>=0&&U<=1&&q>=0&&q<=1){var ee=i+U*(c-i),B=a+U*(l-a);return os([ee,B])}return null}function tF(t,e,n){n===void 0&&(n={});var r=os([1/0,1/0],{dist:1/0}),i=0;return ip(t,function(a){for(var c=Wf(a),l=0;l0&&(q=U.features[0],q.properties.dist=hd(e,q,n),q.properties.location=i+hd(d,q,n)),d.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()}});gi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(HS(this.points).forEach((r,i)=>{n.push([i+1,tF(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))});gi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=P0(e.lngLat.toArray()),this.onClick(e),this.finish())});gi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});gi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});gi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});gi(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=P0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat(HS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),nT.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,rT.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=P0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(tT),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>oF&&this.previousStates.shift()}}function HS(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 aF(t){let e,n,r;return{c(){e=vt("Undo ("),n=vt(t[1]),r=vt(")")},m(i,a){Me(i,e,a),Me(i,n,a),Me(i,r,a)},p(i,a){a&2&&An(n,i[1])},d(i){i&&(Le(e),Le(n),Le(r))}}}function lF(t){let e;return{c(){e=vt("Undo")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function uF(t){let e,n,r,i,a,c,l,d,w,S,I;function T(U,q){return U[1]==0?lF:aF}let k=T(t),D=k(t);return{c(){e=ke("div"),n=ke("button"),n.textContent="Finish",r=nt(),i=ke("button"),i.textContent="Cancel",a=nt(),c=ke("button"),D.c(),d=nt(),w=ke("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=l=t[1]==0,Ei(e,"display","flex"),Ei(e,"justify-content","space-between")},m(U,q){Me(U,e,q),we(e,n),we(e,r),we(e,i),we(e,a),we(e,c),D.m(c,null),Me(U,d,q),Me(U,w,q),S||(I=[Gt(n,"click",t[2]),Gt(i,"click",t[3]),Gt(c,"click",t[4])],S=!0)},p(U,[q]){k===(k=T(U))&&D?D.p(U,q):(D.d(1),D=k(U),D&&(D.c(),D.m(c,null))),q&2&&l!==(l=U[1]==0)&&(c.disabled=l)},i:et,o:et,d(U){U&&(Le(e),Le(d),Le(w)),D.d(),S=!1,Mi(I)}}}function cF(t,e,n){let r;Ct(t,rT,d=>n(1,r=d));let{polygonTool:i}=e;const a=()=>i.finish(),c=()=>i.cancel(),l=()=>i.undo();return t.$$set=d=>{"polygonTool"in d&&n(0,i=d.polygonTool)},[i,r,a,c,l]}class hF extends Jt{constructor(e){super(),Kt(this,e,cF,uF,qt,{polygonTool:0})}}let fF=Date.now();function am(t){return`${t}-${fF++}`}const iT=Symbol.for("svelte-maplibre");function pF(){return Cv(iT)}function ZS(t){return{subscribe:t.subscribe}}function oT({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=pF(),a=tr(null),c=ZS(a),l={...i,[t]:ZS(a)};if(e&&(l.popupTarget=c),r){let d=tr(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=tr()),Iv(iT,l),{...i,self:a}}function dF(){return oT({key:"source",setCluster:!0})}function mF(t=!0){return oT({key:"layer",setPopupTarget:t,setMouseEvent:t})}function XS(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 gF(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 _F(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function YS(t){let e=t[0],n,r,i=KS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c[0]&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=KS(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function KS(t){let e;const n=t[36].default,r=Xr(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)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function yF(t){let e,n,r=t[0]&&YS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&ve(r,1)):(r=YS(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function vF(t,e,n){let r,i,a,c,l,d,w,S,I,T,k,D,{$$slots:U={},$$scope:q}=e,{id:ee=am("layer")}=e,{source:B=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:$=void 0}=e,{beforeLayerType:ae=void 0}=e,{type:me}=e,{paint:pe=void 0}=e,{layout:Q=void 0}=e,{filter:oe=void 0}=e,{applyToClusters:Ae=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:ie=void 0}=e,{manageHoverState:He=!1}=e,{hovered:ge=null}=e,{interactive:Ne=!0}=e,{hoverCursor:Je=void 0}=e,{eventsIfTopMost:qe=!1}=e;const zt=Xu(),{map:Pt,source:Zt,self:Xt,minzoom:kt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=mF();Ct(t,Pt,re=>n(31,I=re)),Ct(t,Zt,re=>n(32,T=re)),Ct(t,Xt,re=>n(0,S=re)),Ct(t,kt,re=>n(34,D=re)),Ct(t,un,re=>n(33,k=re)),us(()=>{S&&I&&(bn.delete(S),I==null||I.removeLayer(S))});let mn;function Bn(re){var ze,en;if(!Ne||!S||!I||qe&&Fn(re)!==S)return;let Ce=re.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn={event:re,map:I,clusterId:_t,layer:S,source:l,features:Ce};zt(re.type,xn)}function ir(re){var ze,en;if(!Ne||!S||!I||qe&&Fn(re)!==S)return;Je&&(I.getCanvas().style.cursor=Je);let Ce=re.features??[];n(6,ge=Ce[0]??null);let _t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id;zt("mouseenter",{event:re,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function $r(re){var ze,en,Dr;if(!Ne||!I)return;if(qe&&Fn(re)!==S){n(6,ge=null),He&&mn!==void 0&&(I==null||I.setFeatureState({source:l,sourceLayer:j,id:mn},{hover:!1}),mn=void 0);return}I.getCanvas().style.cursor=Je;let Ce=re.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn=(Dr=Ce[0])==null?void 0:Dr.id;xn!==mn&&(He&&(mn!==void 0&&(I==null||I.setFeatureState({source:l,id:mn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:l,id:xn,sourceLayer:j},{hover:!0})),mn=xn,n(6,ge=Ce[0]??null)),zt("mousemove",{event:re,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function _r(re){if(!(!Ne||!S||!I)){if(Je&&(I.getCanvas().style.cursor=""),n(6,ge=null),He&&mn!==void 0){const Ce={source:l,id:mn,sourceLayer:j};I==null||I.setFeatureState(Ce,{hover:!1}),mn=void 0}zt("mouseleave",{map:I,layer:S,source:l})}}let cr=!0;function or(re){I&&(I.off("click",re,Bn),I.off("dblclick",re,Bn),I.off("contextmenu",re,Bn),I.off("mouseenter",re,ir),I.off("mousemove",re,$r),I.off("mouseleave",re,_r))}return us(()=>{I&&S&&or(S)}),t.$$set=re=>{"id"in re&&n(7,ee=re.id),"source"in re&&n(8,B=re.source),"sourceLayer"in re&&n(9,j=re.sourceLayer),"beforeId"in re&&n(10,$=re.beforeId),"beforeLayerType"in re&&n(11,ae=re.beforeLayerType),"type"in re&&n(12,me=re.type),"paint"in re&&n(13,pe=re.paint),"layout"in re&&n(14,Q=re.layout),"filter"in re&&n(15,oe=re.filter),"applyToClusters"in re&&n(16,Ae=re.applyToClusters),"minzoom"in re&&n(17,Y=re.minzoom),"maxzoom"in re&&n(18,ie=re.maxzoom),"manageHoverState"in re&&n(19,He=re.manageHoverState),"hovered"in re&&n(6,ge=re.hovered),"interactive"in re&&n(20,Ne=re.interactive),"hoverCursor"in re&&n(21,Je=re.hoverCursor),"eventsIfTopMost"in re&&n(22,qe=re.eventsIfTopMost),"$$scope"in re&&n(35,q=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=_F(Ae)),t.$$.dirty[0]&1073774592&&n(24,i=gF("all",r,oe)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Y??D),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=ie??k),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==ee&&l){S&&(or(S),bn.delete(S));let re=$;if(!$&&ae){let Ce=I.getStyle().layers,_t=typeof ae=="function"?ae:ze=>ze.type===ae,xn=Ce==null?void 0:Ce.find(_t);xn&&(re=xn.id)}Zn(Xt,S=ee,S),I.addLayer(jc({id:S,type:me,source:l,"source-layer":j,filter:i,paint:pe,layout:Q,minzoom:a,maxzoom:c}),re),n(23,cr=!0),I.on("click",S,Bn),I.on("dblclick",S,Bn),I.on("contextmenu",S,Bn),I.on("mouseenter",S,ir),I.on("mousemove",S,$r),I.on("mouseleave",S,_r)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Ne}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?XS((re,Ce)=>I==null?void 0:I.setPaintProperty(S,re,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?XS((re,Ce)=>I==null?void 0:I.setLayoutProperty(S,re,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(pe)),t.$$.dirty[0]&134234112&&(w==null||w(Q)),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&&(cr?n(23,cr=!1):I==null||I.setFilter(S,i))},[S,Pt,Zt,Xt,kt,un,ge,ee,B,j,$,ae,me,pe,Q,oe,Ae,Y,ie,He,Ne,Je,qe,cr,i,c,a,w,d,l,r,I,T,k,D,q,U]}class k1 extends Jt{constructor(e){super(),Kt(this,e,vF,yF,qt,{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 bF(t){let e;const n=t[16].default,r=Xr(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)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function xF(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:[bF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new k1({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function wF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=am("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:$=!0}=e;function ae(ie){B=ie,n(0,B)}function me(ie){dn.call(this,t,ie)}function pe(ie){dn.call(this,t,ie)}function Q(ie){dn.call(this,t,ie)}function oe(ie){dn.call(this,t,ie)}function Ae(ie){dn.call(this,t,ie)}function Y(ie){dn.call(this,t,ie)}return t.$$set=ie=>{"id"in ie&&n(1,a=ie.id),"source"in ie&&n(2,c=ie.source),"sourceLayer"in ie&&n(3,l=ie.sourceLayer),"beforeId"in ie&&n(4,d=ie.beforeId),"beforeLayerType"in ie&&n(5,w=ie.beforeLayerType),"paint"in ie&&n(6,S=ie.paint),"layout"in ie&&n(7,I=ie.layout),"filter"in ie&&n(8,T=ie.filter),"applyToClusters"in ie&&n(9,k=ie.applyToClusters),"minzoom"in ie&&n(10,D=ie.minzoom),"maxzoom"in ie&&n(11,U=ie.maxzoom),"hoverCursor"in ie&&n(12,q=ie.hoverCursor),"manageHoverState"in ie&&n(13,ee=ie.manageHoverState),"hovered"in ie&&n(0,B=ie.hovered),"eventsIfTopMost"in ie&&n(14,j=ie.eventsIfTopMost),"interactive"in ie&&n(15,$=ie.interactive),"$$scope"in ie&&n(24,i=ie.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,q,ee,j,$,r,ae,me,pe,Q,oe,Ae,Y,i]}class SF extends Jt{constructor(e){super(),Kt(this,e,wF,xF,qt,{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 EF(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function IF(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:[EF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new k1({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function CF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=am("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function $(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function pe(Y){dn.call(this,t,Y)}function Q(Y){dn.call(this,t,Y)}function oe(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,$,ae,me,pe,Q,oe,Ae,i]}class TF extends Jt{constructor(e){super(),Kt(this,e,CF,IF,qt,{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 LF(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 l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function PF(t,e,n){dE().then(()=>{let r=uE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function JS(t){let e=t[0],n,r,i=QS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=QS(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function QS(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[14],e?Yr(n,i[14],a,null):Jr(i[14]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function MF(t){let e,n,r=t[0]&&JS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=JS(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ve(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function AF(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:d=am("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:T=void 0}=e,{lineMetrics:k=void 0}=e,{cluster:D=void 0}=e;const{map:U,cluster:q,self:ee}=dF();Ct(t,U,$=>n(13,i=$)),Ct(t,q,$=>n(16,a=$)),Ct(t,ee,$=>n(0,r=$));let B,j=!0;return us(()=>{r&&B&&i&&(PF(U,r,B),Zn(ee,r=null,r),n(11,B=void 0))}),t.$$set=$=>{"id"in $&&n(4,d=$.id),"data"in $&&n(5,w=$.data),"generateId"in $&&n(6,S=$.generateId),"promoteId"in $&&n(7,I=$.promoteId),"filter"in $&&n(8,T=$.filter),"lineMetrics"in $&&n(9,k=$.lineMetrics),"cluster"in $&&n(10,D=$.cluster),"$$scope"in $&&n(14,l=$.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Zn(q,a=D,a),t.$$.dirty&12273&&i&&r!==d&&(Zn(ee,r=d,r),LF(i,r,jc({type:"geojson",data:w,filter:T,lineMetrics:k,generateId:S,promoteId:I,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),$=>i&&$===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,j=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(d))})),t.$$.dirty&6176&&B&&(j?n(12,j=!1):B.setData(w)),t.$$.dirty&3072&&(B==null||B.setClusterOptions(jc({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[r,U,q,ee,d,w,S,I,T,k,D,B,j,i,l,c]}class kF extends Jt{constructor(e){super(),Kt(this,e,AF,MF,qt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function DF(t){let e;const n=t[15].default,r=Xr(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)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function RF(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:[DF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new k1({props:a}),Gn.push(()=>Xi(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(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Zi(()=>n=!1)),e.$set(d)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function NF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=am("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function $(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function pe(Y){dn.call(this,t,Y)}function Q(Y){dn.call(this,t,Y)}function oe(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,$,ae,me,pe,Q,oe,Ae,i]}class OF extends Jt{constructor(e){super(),Kt(this,e,NF,RF,qt,{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 zF(t){let e,n,r,i,a,c;return e=new TF({props:{id:"edit-polygon-fill",filter:nF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new OF({props:{id:"edit-polygon-lines",filter:rF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new SF({props:{id:"edit-polygon-vertices",filter:iF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment)},m(l,d){rt(e,l,d),Me(l,n,d),rt(r,l,d),Me(l,i,d),rt(a,l,d),c=!0},p:et,i(l){c||(ve(e.$$.fragment,l),ve(r.$$.fragment,l),ve(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Le(n),Le(i)),it(e,l),it(r,l),it(a,l)}}}function FF(t){let e,n;return e=new kF({props:{data:t[0],$$slots:{default:[zF]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(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||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function BF(t,e,n){let r;return Ct(t,nT,i=>n(0,r=i)),[r]}class VF extends Jt{constructor(e){super(),Kt(this,e,BF,FF,qt,{})}}function UF(t){let e,n,r,i,a,c,l;return{c(){e=ke("button"),e.textContent="Import current view",n=nt(),r=ke("i"),r.textContent="or...",i=nt(),a=ke("button"),a.textContent="Draw an area to import on the map",Ue(e,"type","button"),Ue(a,"type","button")},m(d,w){Me(d,e,w),Me(d,n,w),Me(d,r,w),Me(d,i,w),Me(d,a,w),c||(l=[Gt(e,"click",t[1]),Gt(a,"click",t[2])],c=!0)},p:et,i:et,o:et,d(d){d&&(Le(e),Le(n),Le(r),Le(i),Le(a)),c=!1,Mi(l)}}}function GF(t){let e,n;return e=new hF({props:{polygonTool:t[0]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function jF(t){let e,n,r,i;const a=[GF,UF],c=[];function l(d,w){return d[0]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=ur()},m(d,w){c[e].m(d,w),Me(d,r,w),i=!0},p(d,[w]){let S=e;e=l(d),e===S?c[e].p(d,w):(Ln(),Se(c[S],1,1,()=>{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),ve(n,1),n.m(r.parentNode,r))},i(d){i||(ve(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Le(r),c[e].d(d)}}}function fd(t){return[t.lng,t.lat]}function qF(t,e,n){let{map:r}=e;const i=Xu();let a=null;async function c(S){try{i("loading","Loading from Overpass");let T=await(await fetch(HF(S))).text();i("gotXml",T)}catch(I){i("error",I.toString())}}function l(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[fd(S.getSouthWest()),fd(S.getNorthWest()),fd(S.getNorthEast()),fd(S.getSouthEast()),fd(S.getSouthWest())]],type:"Polygon"}}}async function d(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await c(l())}}function w(){r&&(n(0,a=new sF(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,d,w,r]}class WF extends Jt{constructor(e){super(),Kt(this,e,qF,jF,qt,{map:3})}}function HF(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 $S(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function eE(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function tE(t){let e,n=t[26]+"",r,i;return{c(){e=ke("option"),r=vt(n),e.__value=i=t[25],co(e,e.__value)},m(a,c){Me(a,e,c),we(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&An(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,co(e,e.__value))},d(a){a&&Le(e)}}}function nE(t){let e,n,r=zr(t[22]),i=[];for(let a=0;at[9].call(c)),Ue(D,"type","file"),Ue(oe,"type","file")},m(Ne,Je){rt(e,Ne,Je),Me(Ne,n,Je),Me(Ne,r,Je),we(r,i),we(i,a),we(i,c),we(c,l);for(let qe=0;qen(15,r=Q)),Ct(t,Ql,Q=>n(16,i=Q)),Ct(t,E_,Q=>n(5,a=Q));let c="",l=[],d=!1,w=[];Zu(async()=>{try{let Q=await fetch("/osm/areas.json");if(Q.ok)d=!0,console.log("Using local cache, not od2net.org"),n(2,w=await Q.json());else{let oe=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await oe.json())}}catch{}});let S;async function I(Q){try{await D(await S.files[0].arrayBuffer()),n(0,c="")}catch(oe){window.alert(`Couldn't open this file: ${oe}`)}n(1,l=[])}let T;async function k(Q){try{n(1,l=["Loading pre-built file"]);let oe=await T.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(oe)),console.timeEnd("load"),Zn(df,r=!0,r),n(0,c="")}catch(oe){window.alert(`Couldn't open this file: ${oe}`)}n(1,l=[])}async function D(Q){let oe=d?`http://${window.location.host}/15m/gtfs.gmd`:"https://assets.od2net.org/gtfs.gmd",Ae=d?`http://${window.location.host}/15m/population.fgb`:"https://assets.od2net.org/population.fgb";n(1,l=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(Q),oe,Ae,kv(U)),console.timeEnd("load"),Zn(df,r=!0,r)}function U(Q){n(1,l=[...l,Q])}async function q(Q){try{await D(new TextEncoder().encode(Q.detail)),n(0,c="")}catch(oe){window.alert(`Couldn't import from Overpass: ${oe}`)}n(1,l=[])}async function ee(Q){Q!=""&&(d?await B(`/osm/${Q}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${Q}.pbf`))}async function B(Q){try{n(1,l=[`Downloading ${Q}`]);let oe=await fetch(Q);await D(await oe.arrayBuffer())}catch(oe){window.alert(`Couldn't open from URL ${Q}: ${oe}`)}n(1,l=[])}function j(){c=hE(this),n(0,c),n(2,w)}function $(Q){Gn[Q?"unshift":"push"](()=>{S=Q,n(3,S)})}const ae=Q=>n(1,l=[...l,Q.detail]),me=Q=>window.alert(Q.detail);function pe(Q){Gn[Q?"unshift":"push"](()=>{T=Q,n(4,T)})}return t.$$.update=()=>{t.$$.dirty&1&&ee(c)},[c,l,w,S,T,a,I,k,q,j,$,ae,me,pe]}class YF extends Jt{constructor(e){super(),Kt(this,e,XF,ZF,qt,{})}}function KF(t){let e;return{c(){e=ke("div"),Ue(e,"slot","top")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function JF(t){let e;return{c(){e=ke("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Me(n,e,r)},i:et,o:et,d(n){n&&Le(e)}}}function QF(t){let e,n;return e=new YF({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function $F(t){let e,n,r,i,a,c;const l=[QF,JF],d=[];function w(S,I){return S[0]?0:1}return i=w(t),a=d[i]=l[i](t),{c(){e=ke("div"),n=ke("h2"),n.textContent="Choose your study area",r=nt(),a.c(),Ue(e,"slot","sidebar")},m(S,I){Me(S,e,I),we(e,n),we(e,r),d[i].m(e,null),c=!0},p(S,I){let T=i;i=w(S),i!==T&&(Ln(),Se(d[T],1,1,()=>{d[T]=null}),Pn(),a=d[i],a||(a=d[i]=l[i](S),a.c()),ve(a,1),a.m(e,null))},i(S){c||(ve(a),c=!0)},o(S){Se(a),c=!1},d(S){S&&Le(e),d[i].d()}}}function eB(t){let e,n,r;return n=new VF({}),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"slot","map")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function tB(t){let e,n;return e=new rp({props:{$$slots:{map:[eB],sidebar:[$F],top:[KF]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function nB(t,e,n){let r,i,a,c,l;return Ct(t,vf,d=>n(1,r=d)),Ct(t,Tc,d=>n(2,i=d)),Ct(t,Ql,d=>n(3,a=d)),Ct(t,df,d=>n(4,c=d)),Ct(t,E_,d=>n(0,l=d)),Zu(async()=>{Zn(df,c=!1,c),await a.unset(),Zn(Tc,i=null,i),Zn(vf,r=null,r)}),[l]}class rB extends Jt{constructor(e){super(),Kt(this,e,nB,tB,qt,{})}}function iB(){return new Worker("/15m/assets/worker-28b5e3cc.js")}function oB(t){let e,n,r,i,a,c;return{c(){e=ke("div"),n=ke("button"),n.innerHTML=`A/B Street logo`,r=nt(),i=ke("span"),Ue(n,"class","outline"),Ei(i,"width","100%"),Ue(e,"slot","top"),Ei(e,"display","flex")},m(l,d){Me(l,e,d),we(e,n),we(e,r),we(e,i),t[18](i),a||(c=Gt(n,"click",t[17]),a=!0)},p:et,d(l){l&&Le(e),t[18](null),a=!1,c()}}}function rE(t){let e,n,r,i,a,c;return{c(){e=ke("hr"),n=nt(),r=ke("div"),i=ke("button"),i.textContent="Zoom to fit"},m(l,d){Me(l,e,d),Me(l,n,d),Me(l,r,d),we(r,i),a||(c=Gt(i,"click",t[9]),a=!0)},p:et,d(l){l&&(Le(e),Le(n),Le(r)),a=!1,c()}}}function sB(t){let e,n,r,i,a,c=t[5].kind!="title"&&rE(t);return{c(){e=ke("div"),n=ke("h1"),n.textContent="15-minute neighbourhood tool",r=nt(),i=ke("div"),a=nt(),c&&c.c(),Ue(e,"slot","left")},m(l,d){Me(l,e,d),we(e,n),we(e,r),we(e,i),t[16](i),we(e,a),c&&c.m(e,null)},p(l,d){l[5].kind!="title"?c?c.p(l,d):(c=rE(l),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(l){l&&Le(e),t[16](null),c&&c.d()}}}function iE(t){let e,n;return e=new rB({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function oE(t){let e,n,r,i,a,c,l,d={ctx:t,current:null,token:null,hasCatch:!1,pending:cB,then:lB,catch:aB,value:23,blocks:[,,,]};_f(e=cs(t[6]).getInvertedBoundary(),d);const w=[mB,dB,pB,fB,hB],S=[];function I(k,D){return k[5].kind=="debug"?0:k[5].kind=="isochrone"?1:k[5].kind=="route"?2:k[5].kind=="score"?3:k[5].kind=="debug-route"?4:-1}~(r=I(t))&&(i=S[r]=w[r](t));let T=t[7]&&sE(t);return{c(){d.block.c(),n=nt(),i&&i.c(),a=nt(),T&&T.c(),c=ur()},m(k,D){d.block.m(k,d.anchor=D),d.mount=()=>n.parentNode,d.anchor=n,Me(k,n,D),~r&&S[r].m(k,D),Me(k,a,D),T&&T.m(k,D),Me(k,c,D),l=!0},p(k,D){t=k,d.ctx=t,D&64&&e!==(e=cs(t[6]).getInvertedBoundary())&&_f(e,d)||Lv(d,t,D);let U=r;r=I(t),r===U?~r&&S[r].p(t,D):(i&&(Ln(),Se(S[U],1,1,()=>{S[U]=null}),Pn()),~r?(i=S[r],i?i.p(t,D):(i=S[r]=w[r](t),i.c()),ve(i,1),i.m(a.parentNode,a)):i=null),t[7]?T?(T.p(t,D),D&128&&ve(T,1)):(T=sE(t),T.c(),ve(T,1),T.m(c.parentNode,c)):T&&(Ln(),Se(T,1,1,()=>{T=null}),Pn())},i(k){l||(ve(d.block),ve(i),ve(T),l=!0)},o(k){for(let D=0;D<3;D+=1){const U=d.blocks[D];Se(U)}Se(i),Se(T),l=!1},d(k){k&&(Le(n),Le(a),Le(c)),d.block.d(k),d.token=null,d=null,~r&&S[r].d(k),T&&T.d(k)}}}function aB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function lB(t){let e,n;return e=new qa({props:{data:t[23],$$slots:{default:[uB]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[23]),i&16777216&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function uB(t){let e,n;return e=new E1({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function cB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function hB(t){let e,n;return e=new o6({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){ot(e.$$.fragment)},m(r,i){rt(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||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function fB(t){let e,n;return e=new _6({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function pB(t){let e,n;return e=new Yz({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function dB(t){let e,n;return e=new Cz({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function mB(t){let e,n;return e=new mz({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function sE(t){let e,n,r,i={ctx:t,current:null,token:null,hasCatch:!1,pending:yB,then:_B,catch:gB,value:22,blocks:[,,,]};return _f(n=cs(t[6]).renderZones(),i),{c(){e=ur(),i.block.c()},m(a,c){Me(a,e,c),i.block.m(a,i.anchor=c),i.mount=()=>e.parentNode,i.anchor=e,r=!0},p(a,c){t=a,i.ctx=t,c&64&&n!==(n=cs(t[6]).renderZones())&&_f(n,i)||Lv(i,t,c)},i(a){r||(ve(i.block),r=!0)},o(a){for(let c=0;c<3;c+=1){const l=i.blocks[c];Se(l)}r=!1},d(a){a&&Le(e),i.block.d(a),i.token=null,i=null}}}function gB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function _B(t){let e,n;return e=new ez({props:{gj:t[22]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.gj=r[22]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function yB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function vB(t){let e,n,r,i,a,c,l;e=new KN({props:{map:t[0],apiKey:IE}});let d=t[5].kind=="title"&&iE(),w=t[4]&&oE(t);return{c(){ot(e.$$.fragment),n=nt(),r=ke("div"),i=nt(),d&&d.c(),a=nt(),w&&w.c(),c=ur()},m(S,I){rt(e,S,I),Me(S,n,I),Me(S,r,I),t[13](r),Me(S,i,I),d&&d.m(S,I),Me(S,a,I),w&&w.m(S,I),Me(S,c,I),l=!0},p(S,I){const T={};I&1&&(T.map=S[0]),e.$set(T),S[5].kind=="title"?d?I&32&&ve(d,1):(d=iE(),d.c(),ve(d,1),d.m(a.parentNode,a)):d&&(Ln(),Se(d,1,1,()=>{d=null}),Pn()),S[4]?w?(w.p(S,I),I&16&&ve(w,1)):(w=oE(S),w.c(),ve(w,1),w.m(c.parentNode,c)):w&&(Ln(),Se(w,1,1,()=>{w=null}),Pn())},i(S){l||(ve(e.$$.fragment,S),ve(d),ve(w),l=!0)},o(S){Se(e.$$.fragment,S),Se(d),Se(w),l=!1},d(S){S&&(Le(n),Le(r),Le(i),Le(a),Le(c)),it(e,S),t[13](null),d&&d.d(S),w&&w.d(S)}}}function bB(t){let e,n,r,i;function a(l){t[14](l)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${IE}`,standardControls:!0,hash:!0,images:[{id:"cycle_parking",url:fP}],$$slots:{default:[vB]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new uO({props:c}),Gn.push(()=>Xi(n,"map",a)),n.$on("error",t[15]),{c(){e=ke("div"),ot(n.$$.fragment),Ue(e,"slot","main"),Ei(e,"position","relative"),Ei(e,"width","100%"),Ei(e,"height","100vh")},m(l,d){Me(l,e,d),rt(n,e,null),i=!0},p(l,d){const w={};d&16777465&&(w.$$scope={dirty:d,ctx:l}),!r&&d&1&&(r=!0,w.map=l[0],Zi(()=>r=!1)),n.$set(w)},i(l){i||(ve(n.$$.fragment,l),i=!0)},o(l){Se(n.$$.fragment,l),i=!1},d(l){l&&Le(e),it(n)}}}function xB(t){let e,n,r,i;return e=new YP({}),r=new SO({props:{$$slots:{main:[bB],left:[sB],top:[oB]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment)},m(a,c){rt(e,a,c),Me(a,n,c),rt(r,a,c),i=!0},p(a,[c]){const l={};c&16777727&&(l.$$scope={dirty:c,ctx:a}),r.$set(l)},i(a){i||(ve(e.$$.fragment,a),ve(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Le(n),it(e,a),it(r,a)}}}function Ig(t,e,n){return e+t*(n-e)}function wB(t,e,n){let r,i,a,c,l,d,w,S,I,T;Ct(t,wv,oe=>n(10,r=oe)),Ct(t,xv,oe=>n(11,i=oe)),Ct(t,bv,oe=>n(12,a=oe)),Ct(t,df,oe=>n(4,c=oe)),Ct(t,$s,oe=>n(5,l=oe)),Ct(t,vf,oe=>n(19,d=oe)),Ct(t,Tc,oe=>n(20,w=oe)),Ct(t,Ql,oe=>n(6,S=oe)),Ct(t,O0,oe=>n(7,I=oe)),Ct(t,qg,oe=>n(8,T=oe)),Zu(async()=>{const oe=bE(new iB);let Ae=await new oe;Ql.set(Ae)});let k;async function D(){k&&c&&k.fitBounds(await S.getBounds(),{animate:!1})}async function U(oe){if(oe){console.log("New map model loaded");let Ae=await S.getBounds();Zn(Tc,w={lng:Ig(.4,Ae[0],Ae[2]),lat:Ig(.4,Ae[1],Ae[3])},w),Zn(vf,d={lng:Ig(.6,Ae[0],Ae[2]),lat:Ig(.6,Ae[1],Ae[3])},d),await D(),Zn($s,l={kind:"isochrone"},l)}}let q,ee,B;function j(oe){Gn[oe?"unshift":"push"](()=>{B=oe,n(3,B),n(10,r)})}function $(oe){k=oe,n(0,k)}const ae=oe=>{console.log(oe.detail.error)};function me(oe){Gn[oe?"unshift":"push"](()=>{ee=oe,n(2,ee),n(11,i)})}const pe=()=>Zn(qg,T=!0,T);function Q(oe){Gn[oe?"unshift":"push"](()=>{q=oe,n(1,q),n(12,a)})}return t.$$.update=()=>{t.$$.dirty&1&&k&&E_.set(k),t.$$.dirty&16&&U(c),t.$$.dirty&4098&&q&&a&&(n(1,q.innerHTML="",q),q.appendChild(a)),t.$$.dirty&2052&&ee&&i&&(n(2,ee.innerHTML="",ee),ee.appendChild(i)),t.$$.dirty&1032&&B&&r&&(n(3,B.innerHTML="",B),B.appendChild(r))},[k,q,ee,B,c,l,S,I,T,D,r,i,a,j,$,ae,me,pe,Q]}class SB extends Jt{constructor(e){super(),Kt(this,e,wB,xB,qt,{})}}new SB({target:document.getElementById("app")}); diff --git a/index.html b/index.html index 4fe26a9..238875a 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ 15-minute neighborhood tool - +