diff --git a/assets/main-76f6db9e.js b/assets/main-76f6db9e.js deleted file mode 100644 index e5ee1a4..0000000 --- a/assets/main-76f6db9e.js +++ /dev/null @@ -1,642 +0,0 @@ -var UL=Object.defineProperty;var GL=(t,e,n)=>e in t?UL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var yi=(t,e,n)=>(GL(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 yt(){}function qL(t,e){for(const n in e)t[n]=e[n];return t}function jL(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function JS(t){return t()}function tx(){return Object.create(null)}function Ni(t){t.forEach(JS)}function _y(t){return typeof t=="function"}function Gt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ag;function Eo(t,e){return t===e?!0:(ag||(ag=document.createElement("a")),ag.href=e,t===ag.href)}function WL(t){return Object.keys(t).length===0}function QS(t,...e){if(t==null){for(const r of e)r(void 0);return yt}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function $S(t){let e;return QS(t,n=>e=n)(),e}function Pt(t,e,n){t.$$.on_destroy.push(QS(e,n))}function ii(t,e,n,r){if(t){const i=eE(t,e,n,r);return t[0](i)}}function eE(t,e,n,r){return t[1]&&r?qL(n.ctx.slice(),t[1](r(e))):n.ctx}function oi(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],c=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function XL(t){return function(e){return e.preventDefault(),t.call(this,e)}}function X_(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Ve(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function YL(t){return t===""?null:+t}function KL(t){return Array.from(t.childNodes)}function Bn(t,e){e=""+e,t.data!==e&&(t.data=e)}function Go(t,e){t.value=e??""}function zr(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Ng(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=JL(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function vv(t,e){return Ff().$$.context.set(t,e),e}function bv(t){return Ff().$$.context.get(t)}function In(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const ef=[],Zn=[];let af=[];const C0=[],nE=Promise.resolve();let T0=!1;function rE(){T0||(T0=!0,nE.then(xv))}function iE(){return rE(),nE}function vd(t){af.push(t)}function so(t){C0.push(t)}const Y_=new Set;let Xh=0;function xv(){if(Xh!==0)return;const t=_d;do{try{for(;Xht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),af=e}const xg=new Set;let Sc;function kn(){Sc={r:0,c:[],p:Sc}}function Dn(){Sc.r||Ni(Sc.c),Sc=Sc.p}function be(t,e){t&&t.i&&(xg.delete(t),t.i(e))}function Te(t,e,n,r){if(t&&t.o){if(xg.has(t))return;xg.add(t),Sc.c.push(()=>{xg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function nx(t,e){const n=e.token={};function r(i,a,c,u){if(e.token!==n)return;e.resolved=u;let m=e.ctx;c!==void 0&&(m=m.slice(),m[c]=u);const w=i&&(e.current=i)(m);let S=!1;e.block&&(e.blocks?e.blocks.forEach((E,P)=>{P!==a&&E&&(kn(),Te(E,1,1,()=>{e.blocks[P]===E&&(e.blocks[P]=null)}),Dn())}):e.block.d(1),w.c(),be(w,1),w.m(e.mount(),e.anchor),S=!0),e.block=w,e.blocks&&(e.blocks[a]=w),S&&xv()}if(jL(t)){const i=Ff();if(t.then(a=>{Ul(i),r(e.then,1,e.value,a),Ul(null)},a=>{if(Ul(i),r(e.catch,2,e.error,a),Ul(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 eP(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 Fr(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function tP(t,e){Te(t,1,1,()=>{e.delete(t.key)})}function nP(t,e,n,r,i,a,c,u,m,w,S,E){let P=t.length,D=a.length,k=P;const V={};for(;k--;)V[t[k].key]=k;const j=[],te=new Map,U=new Map,W=[];for(k=D;k--;){const se=E(i,a,k),ce=n(se);let me=c.get(ce);me?r&&W.push(()=>me.p(se,e)):(me=w(ce,se),me.c()),te.set(ce,j[k]=me),ce in V&&U.set(ce,Math.abs(k-V[ce]))}const Y=new Set,oe=new Set;function _e(se){be(se,1),se.m(u,S),c.set(se.key,se),S=se.first,D--}for(;P&&D;){const se=j[D-1],ce=t[P-1],me=se.key,Le=ce.key;se===ce?(S=se.first,P--,D--):te.has(Le)?!c.has(me)||Y.has(me)?_e(se):oe.has(Le)?P--:U.get(me)>U.get(Le)?(oe.add(me),_e(se)):(Y.add(Le),P--):(m(ce,c),P--)}for(;P--;){const se=t[P];te.has(se.key)||m(se,c)}for(;D;)_e(j[D-1]);return Ni(W),j}function ao(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function lt(t){t&&t.c()}function st(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),vd(()=>{const a=t.$$.on_mount.map(JS).filter(_y);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ni(a),t.$$.on_mount=[]}),i.forEach(vd)}function at(t,e){const n=t.$$;n.fragment!==null&&($L(n.after_update),Ni(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function rP(t,e){t.$$.dirty[0]===-1&&(ef.push(t),rE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=D.length?D[0]:P;return w.ctx&&i(w.ctx[E],w.ctx[E]=k)&&(!w.skip_bound&&w.bound[E]&&w.bound[E](k),S&&rP(t,E)),P}):[],w.update(),S=!0,Ni(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const E=KL(e.target);w.fragment&&w.fragment.l(E),E.forEach(ke)}else w.fragment&&w.fragment.c();e.intro&&be(t.$$.fragment),st(t,e.target,e.anchor),xv()}Ul(m)}class Qt{constructor(){yi(this,"$$");yi(this,"$$set")}$destroy(){at(this,1),this.$destroy=yt}$on(e,n){if(!_y(n))return yt;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&&!WL(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const iP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(iP);const oP="/15m/assets/logo_dark-ed08d841.svg";const sP=t=>({dialog:t&1}),rx=t=>({dialog:t[0]});function aP(t){let e,n,r,i,a;const c=t[4].default,u=ii(c,t,t[3],rx);return{c(){e=Ne("dialog"),n=Ne("article"),u&&u.c(),e.open=!0},m(m,w){De(m,e,w),Se(e,n),u&&u.m(n,null),t[6](e),r=!0,i||(a=[Wt(window,"click",t[1]),Wt(window,"keydown",t[2]),Wt(e,"close",t[5])],i=!0)},p(m,[w]){u&&u.p&&(!r||w&9)&&si(u,c,m,m[3],r?oi(c,m[3],w,sP):ai(m[3]),rx)},i(m){r||(be(u,m),r=!0)},o(m){Te(u,m),r=!1},d(m){m&&ke(e),u&&u.d(m),t[6](null),i=!1,Ni(a)}}}function lP(t,e,n){let{$$slots:r={},$$scope:i}=e,a;function c(S){a.open&&S.target==a&&a.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function m(S){In.call(this,t,S)}function w(S){Zn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,c,u,i,r,m,w]}class wv extends Qt{constructor(e){super(),Jt(this,e,lP,aP,Gt,{})}}function ix(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function ox(t){let e,n,r=t[1]+"",i,a,c,u=t[2]+"",m,w;return{c(){e=Ne("tr"),n=Ne("td"),i=It(r),a=rt(),c=Ne("td"),m=It(u),w=rt()},m(S,E){De(S,e,E),Se(e,n),Se(n,i),Se(e,a),Se(e,c),Se(c,m),Se(e,w)},p(S,E){E&1&&r!==(r=S[1]+"")&&Bn(i,r),E&1&&u!==(u=S[2]+"")&&Bn(m,u)},d(S){S&&ke(e)}}}function uP(t){let e,n,r=Fr(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class Sv extends Qt{constructor(e){super(),Jt(this,e,cP,uP,Gt,{properties:0})}}function sx(t,e,n){const r=t.slice();return r[3]=e[n],r}function ax(t,e,n){const r=t.slice();return r[6]=e[n],r}function lx(t){let e,n;return{c(){e=Ne("span"),n=It(`  - `),zr(e,"background",t[6]),zr(e,"width","100%"),zr(e,"border","1px solid black")},m(r,i){De(r,e,i),Se(e,n)},p(r,i){i&1&&zr(e,"background",r[6])},d(r){r&&ke(e)}}}function hP(t){let e,n=t[3]+"",r;return{c(){e=Ne("span"),r=It(n)},m(i,a){De(i,e,a),Se(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&Bn(r,n)},d(i){i&&ke(e)}}}function fP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=Ne("span"),r=It(n)},m(i,a){De(i,e,a),Se(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&Bn(r,n)},d(i){i&&ke(e)}}}function ux(t){let e;function n(a,c){return a[2]>0?fP:hP}let r=n(t),i=r(t);return{c(){i.c(),e=Ur()},m(a,c){i.m(a,c),De(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&&ke(e),i.d(a)}}}function pP(t){let e,n,r,i=Fr(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 oE extends Qt{constructor(e){super(),Jt(this,e,dP,pP,Gt,{colorScale:0,limits:1,decimalPlaces:2})}}function ul(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const Yh=[];function K_(t,e){return{subscribe:sr(t,e).subscribe}}function sr(t,e=yt){let n;const r=new Set;function i(u){if(Gt(t,u)&&(t=u,n)){const m=!Yh.length;for(const w of r)w[1](),Yh.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 sE=Symbol("Comlink.proxy"),mP=Symbol("Comlink.endpoint"),gP=Symbol("Comlink.releaseProxy"),J_=Symbol("Comlink.finalizer"),wg=Symbol("Comlink.thrown"),aE=t=>typeof t=="object"&&t!==null||typeof t=="function",yP={canHandle:t=>aE(t)&&t[sE],serialize(t){const{port1:e,port2:n}=new MessageChannel;return Ev(t,e),[n,[n]]},deserialize(t){return t.start(),cE(t)}},_P={canHandle:t=>aE(t)&&wg 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}},lE=new Map([["proxy",yP],["throw",_P]]);function vP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function Ev(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!vP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:c,path:u}=Object.assign({path:[]},i.data),m=(i.data.argumentList||[]).map(wc);let w;try{const S=u.slice(0,-1).reduce((P,D)=>P[D],t),E=u.reduce((P,D)=>P[D],t);switch(c){case"GET":w=E;break;case"SET":S[u.slice(-1)[0]]=wc(i.data.value),w=!0;break;case"APPLY":w=E.apply(S,m);break;case"CONSTRUCT":{const P=new E(...m);w=Iv(P)}break;case"ENDPOINT":{const{port1:P,port2:D}=new MessageChannel;Ev(t,D),w=EP(P,[P])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[wg]:0}}Promise.resolve(w).catch(S=>({value:S,[wg]:0})).then(S=>{const[E,P]=Fg(S);e.postMessage(Object.assign(Object.assign({},E),{id:a}),P),c==="RELEASE"&&(e.removeEventListener("message",r),uE(e),J_ in t&&typeof t[J_]=="function"&&t[J_]())}).catch(S=>{const[E,P]=Fg({value:new TypeError("Unserializable return value"),[wg]:0});e.postMessage(Object.assign(Object.assign({},E),{id:a}),P)})}),e.start&&e.start()}function bP(t){return t.constructor.name==="MessagePort"}function uE(t){bP(t)&&t.close()}function cE(t,e){return L0(t,[],e)}function lg(t){if(t)throw new Error("Proxy has been released and is not useable")}function hE(t){return tf(t,{type:"RELEASE"}).then(()=>{uE(t)})}const Og=new WeakMap,zg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Og.get(t)||0)-1;Og.set(t,e),e===0&&hE(t)});function xP(t,e){const n=(Og.get(e)||0)+1;Og.set(e,n),zg&&zg.register(t,e,t)}function wP(t){zg&&zg.unregister(t)}function L0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(lg(r),c===gP)return()=>{wP(i),hE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const u=tf(t,{type:"GET",path:e.map(m=>m.toString())}).then(wc);return u.then.bind(u)}return L0(t,[...e,c])},set(a,c,u){lg(r);const[m,w]=Fg(u);return tf(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:m},w).then(wc)},apply(a,c,u){lg(r);const m=e[e.length-1];if(m===mP)return tf(t,{type:"ENDPOINT"}).then(wc);if(m==="bind")return L0(t,e.slice(0,-1));const[w,S]=cx(u);return tf(t,{type:"APPLY",path:e.map(E=>E.toString()),argumentList:w},S).then(wc)},construct(a,c){lg(r);const[u,m]=cx(c);return tf(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:u},m).then(wc)}});return xP(i,t),i}function SP(t){return Array.prototype.concat.apply([],t)}function cx(t){const e=t.map(Fg);return[e.map(n=>n[0]),SP(e.map(n=>n[1]))]}const fE=new WeakMap;function EP(t,e){return fE.set(t,e),t}function Iv(t){return Object.assign(t,{[sE]:!0})}function Fg(t){for(const[e,n]of lE)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},fE.get(t)||[]]}function wc(t){switch(t.type){case"HANDLER":return lE.get(t.name).deserialize(t.value);case"RAW":return t.value}}function tf(t,e,n){return new Promise(r=>{const i=IP();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 IP(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let cn;const Vl=new Array(128).fill(void 0);Vl.push(void 0,null,!0,!1);function dn(t){return Vl[t]}let cd=Vl.length;function CP(t){t<132||(Vl[t]=cd,cd=t)}function xc(t){const e=dn(t);return CP(t),e}let Ec=0,id=null;function hd(){return(id===null||id.byteLength===0)&&(id=new Uint8Array(cn.memory.buffer)),id}const Sg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},TP=typeof Sg.encodeInto=="function"?function(t,e){return Sg.encodeInto(t,e)}:function(t,e){const n=Sg.encode(t);return e.set(n),{read:t.length,written:n.length}};function Q_(t,e,n){if(n===void 0){const u=Sg.encode(t),m=e(u.length,1)>>>0;return hd().subarray(m,m+u.length).set(u),Ec=u.length,m}let r=t.length,i=e(r,1)>>>0;const a=hd();let c=0;for(;c127)break;a[i+c]=u}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const u=hd().subarray(i+c,i+r),m=TP(t,u);c+=m.written,i=n(i,r,c,1)>>>0}return Ec=c,i}function fd(t){return t==null}let od=null;function jn(){return(od===null||od.byteLength===0)&&(od=new Int32Array(cn.memory.buffer)),od}let sd=null;function pE(){return(sd===null||sd.byteLength===0)&&(sd=new Float64Array(cn.memory.buffer)),sd}const dE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&dE.decode();function ol(t,e){return t=t>>>0,dE.decode(hd().subarray(t,t+e))}function or(t){cd===Vl.length&&Vl.push(Vl.length+1);const e=cd;return cd=Vl[e],Vl[e]=t,e}function P0(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+=P0(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:r}function LP(t,e){const n=e(t.length*1,1)>>>0;return hd().set(t,n/1),Ec=t.length,n}function PP(t,e){return t=t>>>0,pE().subarray(t/8,t/8+e)}function Su(t,e){try{return t.apply(this,e)}catch(n){cn.__wbindgen_exn_store(or(n))}}const MP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>cn.__wbg_mapmodel_free(t>>>0));class hx{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,MP.unregister(this),e}free(){const e=this.__destroy_into_raw();cn.__wbg_mapmodel_free(e)}constructor(e,n,r){try{const u=cn.__wbindgen_add_to_stack_pointer(-16),m=LP(e,cn.__wbindgen_malloc),w=Ec;cn.mapmodel_new(u,m,w,n,fd(r)?0:or(r));var i=jn()[u/4+0],a=jn()[u/4+1],c=jn()[u/4+2];if(c)throw xc(a);return this.__wbg_ptr=i>>>0,this}finally{cn.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_renderDebug(w,this.__wbg_ptr);var r=jn()[w/4+0],i=jn()[w/4+1],a=jn()[w/4+2],c=jn()[w/4+3],u=r,m=i;if(c)throw u=0,m=0,xc(a);return e=u,n=m,ol(u,m)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=jn()[w/4+0],i=jn()[w/4+1],a=jn()[w/4+2],c=jn()[w/4+3],u=r,m=i;if(c)throw u=0,m=0,xc(a);return e=u,n=m,ol(u,m)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}getBounds(){try{const i=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getBounds(i,this.__wbg_ptr);var e=jn()[i/4+0],n=jn()[i/4+1],r=PP(e,n).slice();return cn.__wbindgen_free(e,n*8,8),r}finally{cn.__wbindgen_add_to_stack_pointer(16)}}isochrone(e){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_isochrone(S,this.__wbg_ptr,or(e));var i=jn()[S/4+0],a=jn()[S/4+1],c=jn()[S/4+2],u=jn()[S/4+3],m=i,w=a;if(u)throw m=0,w=0,xc(c);return n=m,r=w,ol(m,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_route(S,this.__wbg_ptr,or(e));var i=jn()[S/4+0],a=jn()[S/4+1],c=jn()[S/4+2],u=jn()[S/4+3],m=i,w=a;if(u)throw m=0,w=0,xc(c);return n=m,r=w,ol(m,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}score(e,n){let r,i;try{const E=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_score(E,this.__wbg_ptr,or(e),fd(n)?0:or(n));var a=jn()[E/4+0],c=jn()[E/4+1],u=jn()[E/4+2],m=jn()[E/4+3],w=a,S=c;if(m)throw w=0,S=0,xc(u);return r=w,i=S,ol(w,S)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(r,i,1)}}}async function AP(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 kP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){xc(e)},t.wbg.__wbindgen_string_get=function(e,n){const r=dn(n),i=typeof r=="string"?r:void 0;var a=fd(i)?0:Q_(i,cn.__wbindgen_malloc,cn.__wbindgen_realloc),c=Ec;jn()[e/4+1]=c,jn()[e/4+0]=a},t.wbg.__wbindgen_boolean_get=function(e){const n=dn(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_object=function(e){const n=dn(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return dn(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return dn(e)in dn(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=dn(n),i=typeof r=="number"?r:void 0;pE()[e/8+1]=fd(i)?0:i,jn()[e/4+0]=!fd(i)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(ol(e,n));return or(r)},t.wbg.__wbindgen_string_new=function(e,n){const r=ol(e,n);return or(r)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return dn(e)==dn(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=dn(e)[dn(n)];return or(r)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=dn(e);return or(n)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(dn(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(dn(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(dn(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(dn(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(dn(e))},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return or(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=dn(n).stack,i=Q_(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Ec;jn()[e/4+1]=a,jn()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(ol(e,n))}finally{cn.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=dn(e).performance;return or(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return dn(e).now()},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,n){const r=dn(e)[n>>>0];return or(r)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return dn(e).length},t.wbg.__wbindgen_is_function=function(e){return typeof dn(e)=="function"},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(ol(e,n));return or(r)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const n=dn(e).next;return or(n)},t.wbg.__wbg_next_196c84450b364254=function(){return Su(function(e){const n=dn(e).next();return or(n)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return dn(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const n=dn(e).value;return or(n)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return or(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return Su(function(e,n){const r=Reflect.get(dn(e),dn(n));return or(r)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return Su(function(e,n){const r=dn(e).call(dn(n));return or(r)},arguments)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Su(function(){const e=self.self;return or(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return Su(function(){const e=window.window;return or(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Su(function(){const e=globalThis.globalThis;return or(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return Su(function(){const e=global.global;return or(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(dn(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=dn(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Su(function(e,n,r){const i=dn(e).call(dn(n),dn(r));return or(i)},arguments)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=dn(e).buffer;return or(n)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(dn(e));return or(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){dn(e).set(dn(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return dn(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=dn(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const r=P0(dn(n)),i=Q_(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Ec;jn()[e/4+1]=a,jn()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(ol(e,n))},t.wbg.__wbindgen_memory=function(){const e=cn.memory;return or(e)},t}function DP(t,e){return cn=t.exports,M0.__wbindgen_wasm_module=e,sd=null,od=null,id=null,cn}async function M0(t){if(cn!==void 0)return cn;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=kP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await AP(await t,e);return DP(n,r)}class RP{constructor(){yi(this,"inner");this.inner=null}async loadOsmFile(e,n){await M0(),this.inner=new hx(e,!0,n)}async loadGraphFile(e){await M0(),this.inner=new hx(e,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}score(e,n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds},n))}}Ev(RP);let mE="MZEJTanw3WpxRvt7qDfo",Ys=sr({kind:"title"}),vy=sr(null),Bg=sr(!0);function fx(t){return["!=",["get",`access_${t}`],"None"]}let hf=sr("foot"),Vg=sr("07:00"),Ic=sr(null),ff=sr(null),px=sr(!0),Zl=sr(null),lf=sr(!1);function Ug(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 dx(t){let e,n;return e=new wv({props:{$$slots:{default:[NP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function NP(t){let e,n,r,i,a,c,u,m,w,S;function E(){return t[1](t[3])}return{c(){e=Ne("h1"),e.textContent="15-minute neighborhood tool",n=rt(),r=Ne("p"),r.textContent="TODO. Extremely early in development.",i=rt(),a=Ne("p"),a.innerHTML=`This open source - tool is created by - Dustin Carlino - and relies heavily on - OpenStreetMap data.`,c=rt(),u=Ne("center"),m=Ne("button"),m.textContent="Start!"},m(P,D){De(P,e,D),De(P,n,D),De(P,r,D),De(P,i,D),De(P,a,D),De(P,c,D),De(P,u,D),Se(u,m),w||(S=Wt(m,"click",E),w=!0)},p(P,D){t=P},d(P){P&&(ke(e),ke(n),ke(r),ke(i),ke(a),ke(c),ke(u)),w=!1,S()}}}function OP(t){let e,n,r=t[0]&&dx(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=dx(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function zP(t,e,n){let r;return Pt(t,Bg,c=>n(0,r=c)),[r,c=>ul(c).close(),()=>Hn(Bg,r=!1,r)]}class FP extends Qt{constructor(e){super(),Jt(this,e,zP,OP,Gt,{})}}var Ud=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function by(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 mx=Object.prototype.toString,gE=function(e){var n=mx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&mx.call(e.callee)==="[object Function]"),r},$_,gx;function BP(){if(gx)return $_;gx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=gE,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],m=function(P){var D=P.constructor;return D&&D.prototype===P},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var P in window)try{if(!w["$"+P]&&e.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{m(window[P])}catch{return!0}}catch{return!0}return!1}(),E=function(P){if(typeof window>"u"||!S)return m(P);try{return m(P)}catch{return!1}};t=function(D){var k=D!==null&&typeof D=="object",V=n.call(D)==="[object Function]",j=r(D),te=k&&n.call(D)==="[object String]",U=[];if(!k&&!V&&!j)throw new TypeError("Object.keys called on a non-object");var W=c&&V;if(te&&D.length>0&&!e.call(D,0))for(var Y=0;Y0)for(var oe=0;oe"u"||!Vi?zn:Vi(Uint8Array),Tc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":Kh&&Vi?Vi([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":nf,"%AsyncGenerator%":nf,"%AsyncGeneratorFunction%":nf,"%AsyncIteratorPrototype%":nf,"%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%":aM,"%eval%":eval,"%EvalError%":lM,"%Float32Array%":typeof Float32Array>"u"?zn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?zn:FinalizationRegistry,"%Function%":vE,"%GeneratorFunction%":nf,"%Int8Array%":typeof Int8Array>"u"?zn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?zn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Kh&&Vi?Vi(Vi([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map>"u"?zn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Kh||!Vi?zn:Vi(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%":uM,"%ReferenceError%":cM,"%Reflect%":typeof Reflect>"u"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?zn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Kh||!Vi?zn:Vi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Kh&&Vi?Vi(""[Symbol.iterator]()):zn,"%Symbol%":Kh?Symbol:zn,"%SyntaxError%":pf,"%ThrowTypeError%":fM,"%TypedArray%":dM,"%TypeError%":uf,"%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%":hM,"%WeakMap%":typeof WeakMap>"u"?zn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?zn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?zn:WeakSet};if(Vi)try{null.error}catch(t){var mM=Vi(Vi(t));Tc["%Error.prototype%"]=mM}var gM=function t(e){var n;if(e==="%AsyncFunction%")n=t0("async function () {}");else if(e==="%GeneratorFunction%")n=t0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=t0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Vi&&(n=Vi(i.prototype))}return Tc[e]=n,n},xx={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Gd=Pv,Gg=_E,yM=Gd.call(Function.call,Array.prototype.concat),_M=Gd.call(Function.apply,Array.prototype.splice),wx=Gd.call(Function.call,String.prototype.replace),qg=Gd.call(Function.call,String.prototype.slice),vM=Gd.call(Function.call,RegExp.prototype.exec),bM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,xM=/\\(\\)?/g,wM=function(e){var n=qg(e,0,1),r=qg(e,-1);if(n==="%"&&r!=="%")throw new pf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new pf("invalid intrinsic syntax, expected opening `%`");var i=[];return wx(e,bM,function(a,c,u,m){i[i.length]=u?wx(m,xM,"$1"):c||a}),i},SM=function(e,n){var r=e,i;if(Gg(xx,r)&&(i=xx[r],r="%"+i[0]+"%"),Gg(Tc,r)){var a=Tc[r];if(a===nf&&(a=gM(r)),typeof a>"u"&&!n)throw new uf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new pf("intrinsic "+e+" does not exist!")},yl=function(e,n){if(typeof e!="string"||e.length===0)throw new uf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new uf('"allowMissing" argument must be a boolean');if(vM(/^%?[^%]*%?$/,e)===null)throw new pf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=wM(e),i=r.length>0?r[0]:"",a=SM("%"+i+"%",n),c=a.name,u=a.value,m=!1,w=a.alias;w&&(i=w[0],_M(r,yM([0,1],w)));for(var S=1,E=!0;S=r.length){var V=Cc(u,P);E=!!V,E&&"get"in V&&!("originalValue"in V.get)?u=V.get:u=u[P]}else E=Gg(u,P),u=u[P];E&&!m&&(Tc[c]=u)}}return u},r0,Sx;function Mv(){if(Sx)return r0;Sx=1;var t=yl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return r0=e,r0}var EM=yl,Ig=EM("%Object.getOwnPropertyDescriptor%",!0);if(Ig)try{Ig([],"length")}catch{Ig=null}var Av=Ig,Ex=Mv(),IM=yE,Jh=Wu,Ix=Av,kv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Jh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Jh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Jh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Jh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Jh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Jh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,m=!!Ix&&Ix(e,n);if(Ex)Ex(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(u||!i&&!a&&!c)e[n]=r;else throw new IM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},A0=Mv(),bE=function(){return!!A0};bE.hasArrayLengthDefineBug=function(){if(!A0)return null;try{return A0([],"length",{value:1}).length!==1}catch{return!0}};var Dv=bE,CM=Tv,TM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",LM=Object.prototype.toString,PM=Array.prototype.concat,Cx=kv,MM=function(t){return typeof t=="function"&&LM.call(t)==="[object Function]"},xE=Dv(),AM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!MM(r)||!r())return}xE?Cx(t,e,n,!0):Cx(t,e,n)},wE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=CM(e);TM&&(r=PM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||RM(n)!==n)throw new Px("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Lx){var c=Lx(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(DM?Tx(e,"length",n,!0,!0):Tx(e,"length",n)),e};(function(t){var e=Pv,n=yl,r=NM,i=Wu,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||e.call(c,a),m=Mv(),w=n("%Math.max%");t.exports=function(P){if(typeof P!="function")throw new i("a function is required");var D=u(e,c,arguments);return r(D,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(e,a,arguments)};m?m(t.exports,"apply",{value:S}):t.exports.apply=S})(SE);var Bf=SE.exports,EE=yl,IE=Bf,OM=IE(EE("String.prototype.indexOf")),fa=function(e,n){var r=EE(e,!!n);return typeof r=="function"&&OM(e,".prototype.")>-1?IE(r):r},zM=Tv,CE=xy(),TE=fa,Mx=Object,FM=TE("Array.prototype.push"),Ax=TE("Object.prototype.propertyIsEnumerable"),BM=CE?Object.getOwnPropertySymbols:null,LE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Mx(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||eA)&&($M?kx(e,"name",n,!0,!0):kx(e,"name",n)),e},rA=nA,iA=Wu,oA=Object,kE=rA(function(){if(this==null||this!==oA(this))throw new iA("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),sA=kE,aA=qc.supportsDescriptors,lA=Object.getOwnPropertyDescriptor,DE=function(){if(aA&&/a/mig.flags==="gim"){var e=lA(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 sA},uA=qc.supportsDescriptors,cA=DE,hA=Object.getOwnPropertyDescriptor,fA=Object.defineProperty,pA=TypeError,Dx=Object.getPrototypeOf,dA=/a/,mA=function(){if(!uA||!Dx)throw new pA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=cA(),n=Dx(dA),r=hA(n,"flags");return(!r||r.get!==e)&&fA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},gA=qc,yA=Bf,_A=kE,RE=DE,vA=mA,NE=yA(RE());gA(NE,{getPolyfill:RE,implementation:_A,shim:vA});var bA=NE,Cg={exports:{}},xA=xy,jc=function(){return xA()&&!!Symbol.toStringTag},wA=jc(),SA=fa,k0=SA("Object.prototype.toString"),wy=function(e){return wA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:k0(e)==="[object Arguments]"},OE=function(e){return wy(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&k0(e)!=="[object Array]"&&k0(e.callee)==="[object Function]"},EA=function(){return wy(arguments)}();wy.isLegacyArguments=OE;var zE=EA?wy:OE;const IA={},CA=Object.freeze(Object.defineProperty({__proto__:null,default:IA},Symbol.toStringTag,{value:"Module"})),TA=by(CA);var Rv=typeof Map=="function"&&Map.prototype,o0=Object.getOwnPropertyDescriptor&&Rv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,jg=Rv&&o0&&typeof o0.get=="function"?o0.get:null,Rx=Rv&&Map.prototype.forEach,Nv=typeof Set=="function"&&Set.prototype,s0=Object.getOwnPropertyDescriptor&&Nv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wg=Nv&&s0&&typeof s0.get=="function"?s0.get:null,Nx=Nv&&Set.prototype.forEach,LA=typeof WeakMap=="function"&&WeakMap.prototype,dd=LA?WeakMap.prototype.has:null,PA=typeof WeakSet=="function"&&WeakSet.prototype,md=PA?WeakSet.prototype.has:null,MA=typeof WeakRef=="function"&&WeakRef.prototype,Ox=MA?WeakRef.prototype.deref:null,AA=Boolean.prototype.valueOf,kA=Object.prototype.toString,DA=Function.prototype.toString,RA=String.prototype.match,Ov=String.prototype.slice,Pu=String.prototype.replace,NA=String.prototype.toUpperCase,zx=String.prototype.toLowerCase,FE=RegExp.prototype.test,Fx=Array.prototype.concat,il=Array.prototype.join,OA=Array.prototype.slice,Bx=Math.floor,D0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,a0=Object.getOwnPropertySymbols,R0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,df=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Io=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===df||"symbol")?Symbol.toStringTag:null,BE=Object.prototype.propertyIsEnumerable,Vx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Ux(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||FE.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Bx(-t):Bx(t);if(r!==t){var i=String(r),a=Ov.call(e,i.length+1);return Pu.call(i,n,"$&_")+"."+Pu.call(Pu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pu.call(e,n,"$&_")}var N0=TA,Gx=N0.custom,qx=UE(Gx)?Gx:null,zA=function t(e,n,r,i){var a=n||{};if(Tu(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Tu(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=Tu(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(Tu(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(Tu(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return qE(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var m=String(e);return u?Ux(e,m):m}if(typeof e=="bigint"){var w=String(e)+"n";return u?Ux(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 O0(e)?"[Array]":"[Object]";var E=tk(a,r);if(typeof i>"u")i=[];else if(GE(i,e)>=0)return"[Circular]";function P(Ke,Ee,Ze){if(Ee&&(i=OA.call(i),i.push(Ee)),Ze){var tt={depth:a.depth};return Tu(a,"quoteStyle")&&(tt.quoteStyle=a.quoteStyle),t(Ke,tt,r+1,i)}return t(Ke,a,r+1,i)}if(typeof e=="function"&&!jx(e)){var D=HA(e),k=ug(e,P);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(k.length>0?" { "+il.call(k,", ")+" }":"")}if(UE(e)){var V=df?Pu.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):R0.call(e);return typeof e=="object"&&!df?Kp(V):V}if(QA(e)){for(var j="<"+zx.call(String(e.nodeName)),te=e.attributes||[],U=0;U",j}if(O0(e)){if(e.length===0)return"[]";var W=ug(e,P);return E&&!ek(W)?"["+z0(W,E)+"]":"[ "+il.call(W,", ")+" ]"}if(VA(e)){var Y=ug(e,P);return!("cause"in Error.prototype)&&"cause"in e&&!BE.call(e,"cause")?"{ ["+String(e)+"] "+il.call(Fx.call("[cause]: "+P(e.cause),Y),", ")+" }":Y.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+il.call(Y,", ")+" }"}if(typeof e=="object"&&c){if(qx&&typeof e[qx]=="function"&&N0)return N0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ZA(e)){var oe=[];return Rx&&Rx.call(e,function(Ke,Ee){oe.push(P(Ee,e,!0)+" => "+P(Ke,e))}),Wx("Map",jg.call(e),oe,E)}if(KA(e)){var _e=[];return Nx&&Nx.call(e,function(Ke){_e.push(P(Ke,e))}),Wx("Set",Wg.call(e),_e,E)}if(XA(e))return l0("WeakMap");if(JA(e))return l0("WeakSet");if(YA(e))return l0("WeakRef");if(GA(e))return Kp(P(Number(e)));if(jA(e))return Kp(P(D0.call(e)));if(qA(e))return Kp(AA.call(e));if(UA(e))return Kp(P(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Ud)return"{ [object globalThis] }";if(!BA(e)&&!jx(e)){var se=ug(e,P),ce=Vx?Vx(e)===Object.prototype:e instanceof Object||e.constructor===Object,me=e instanceof Object?"":"null prototype",Le=!ce&&Io&&Object(e)===e&&Io in e?Ov.call(Hu(e),8,-1):me?"Object":"",Z=ce||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",fe=Z+(Le||me?"["+il.call(Fx.call([],Le||[],me||[]),": ")+"] ":"");return se.length===0?fe+"{}":E?fe+"{"+z0(se,E)+"}":fe+"{ "+il.call(se,", ")+" }"}return String(e)};function VE(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function FA(t){return Pu.call(String(t),/"/g,""")}function O0(t){return Hu(t)==="[object Array]"&&(!Io||!(typeof t=="object"&&Io in t))}function BA(t){return Hu(t)==="[object Date]"&&(!Io||!(typeof t=="object"&&Io in t))}function jx(t){return Hu(t)==="[object RegExp]"&&(!Io||!(typeof t=="object"&&Io in t))}function VA(t){return Hu(t)==="[object Error]"&&(!Io||!(typeof t=="object"&&Io in t))}function UA(t){return Hu(t)==="[object String]"&&(!Io||!(typeof t=="object"&&Io in t))}function GA(t){return Hu(t)==="[object Number]"&&(!Io||!(typeof t=="object"&&Io in t))}function qA(t){return Hu(t)==="[object Boolean]"&&(!Io||!(typeof t=="object"&&Io in t))}function UE(t){if(df)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!R0)return!1;try{return R0.call(t),!0}catch{}return!1}function jA(t){if(!t||typeof t!="object"||!D0)return!1;try{return D0.call(t),!0}catch{}return!1}var WA=Object.prototype.hasOwnProperty||function(t){return t in this};function Tu(t,e){return WA.call(t,e)}function Hu(t){return kA.call(t)}function HA(t){if(t.name)return t.name;var e=RA.call(DA.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function GE(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(Ov.call(t,0,e.maxStringLength),e)+r}var i=Pu.call(Pu.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$A);return VE(i,"single",e)}function $A(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":"")+NA.call(e.toString(16))}function Kp(t){return"Object("+t+")"}function l0(t){return t+" { ? }"}function Wx(t,e,n,r){var i=r?z0(n,r):il.call(n,", ");return t+" ("+e+") {"+i+"}"}function ek(t){for(var e=0;e=0)return!1;return!0}function tk(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=il.call(Array(t.indent+1)," ");else return null;return{base:n,prev:il.call(Array(e+1),n)}}function z0(t,e){if(t.length===0)return"";var n=` -`+e.prev+e.base;return n+il.call(t,","+n)+` -`+e.prev}function ug(t,e){var n=O0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=$x(e,n);if(i<55296||i>56319)return n+1;var a=$x(e,n+1);return a<56320||a>57343?n+1:n+2},c0=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}}}},ew=function(e,n){if(Ik(e)||Yx(e))return c0(e);if(Ck(e)){var r=0;return{next:function(){var a=Mk(e,r),c=Pk(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(!Tk&&!Lk)Cg.exports=function(e){if(e!=null)return ew(e,!0)};else{var Ak=YE,kk=JE,tw=Sa("Map.prototype.forEach",!0),nw=Sa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var rw=Sa("Map.prototype.iterator",!0),iw=Sa("Set.prototype.iterator",!0);var ow=Sa("Map.prototype.@@iterator",!0)||Sa("Map.prototype._es6-shim iterator_",!0),sw=Sa("Set.prototype.@@iterator",!0)||Sa("Set.prototype._es6-shim iterator_",!0),Dk=function(e){if(Ak(e)){if(rw)return Kx(rw(e));if(ow)return ow(e);if(tw){var n=[];return tw(e,function(i,a){Qx(n,[a,i])}),c0(n)}}if(kk(e)){if(iw)return Kx(iw(e));if(sw)return sw(e);if(nw){var r=[];return nw(e,function(i){Qx(r,i)}),c0(r)}}};Cg.exports=function(e){return Dk(e)||ew(e)}}}var Rk=Cg.exports,aw=function(t){return t!==t},QE=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||aw(e)&&aw(n))},Nk=QE,$E=function(){return typeof Object.is=="function"?Object.is:Nk},Ok=$E,zk=qc,Fk=function(){var e=Ok();return zk(Object,{is:e},{is:function(){return Object.is!==e}}),e},Bk=qc,Vk=Bf,Uk=QE,eI=$E,Gk=Fk,tI=Vk(eI(),Object);Bk(tI,{getPolyfill:eI,implementation:Uk,shim:Gk});var qk=tI,jk=Bf,nI=fa,Wk=yl,F0=Wk("%ArrayBuffer%",!0),Tg=nI("ArrayBuffer.prototype.byteLength",!0),Hk=nI("Object.prototype.toString"),lw=!!F0&&!Tg&&new F0(0).slice,uw=!!lw&&jk(lw),rI=Tg||uw?function(e){if(!e||typeof e!="object")return!1;try{return Tg?Tg(e):uw(e,0),!0}catch{return!1}}:F0?function(e){return Hk(e)==="[object ArrayBuffer]"}:function(e){return!1},Zk=Date.prototype.getDay,Xk=function(e){try{return Zk.call(e),!0}catch{return!1}},Yk=Object.prototype.toString,Kk="[object Date]",Jk=jc(),Qk=function(e){return typeof e!="object"||e===null?!1:Jk?Xk(e):Yk.call(e)===Kk},B0=fa,iI=jc(),oI,sI,V0,U0;if(iI){oI=B0("Object.prototype.hasOwnProperty"),sI=B0("RegExp.prototype.exec"),V0={};var h0=function(){throw V0};U0={toString:h0,valueOf:h0},typeof Symbol.toPrimitive=="symbol"&&(U0[Symbol.toPrimitive]=h0)}var $k=B0("Object.prototype.toString"),e3=Object.getOwnPropertyDescriptor,t3="[object RegExp]",n3=iI?function(e){if(!e||typeof e!="object")return!1;var n=e3(e,"lastIndex"),r=n&&oI(n,"value");if(!r)return!1;try{sI(e,U0)}catch(i){return i===V0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:$k(e)===t3},r3=fa,cw=r3("SharedArrayBuffer.prototype.byteLength",!0),i3=cw?function(e){if(!e||typeof e!="object")return!1;try{return cw(e),!0}catch{return!1}}:function(e){return!1},o3=Number.prototype.toString,s3=function(e){try{return o3.call(e),!0}catch{return!1}},a3=Object.prototype.toString,l3="[object Number]",u3=jc(),c3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:u3?s3(e):a3.call(e)===l3},aI=fa,h3=aI("Boolean.prototype.toString"),f3=aI("Object.prototype.toString"),p3=function(e){try{return h3(e),!0}catch{return!1}},d3="[object Boolean]",m3=jc(),g3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:m3&&Symbol.toStringTag in e?p3(e):f3(e)===d3},G0={exports:{}},y3=Object.prototype.toString,_3=Lv();if(_3){var v3=Symbol.prototype.toString,b3=/^Symbol\(.*\)$/,x3=function(e){return typeof e.valueOf()!="symbol"?!1:b3.test(v3.call(e))};G0.exports=function(e){if(typeof e=="symbol")return!0;if(y3.call(e)!=="[object Symbol]")return!1;try{return x3(e)}catch{return!1}}}else G0.exports=function(e){return!1};var w3=G0.exports,q0={exports:{}},hw=typeof BigInt<"u"&&BigInt,S3=function(){return typeof hw=="function"&&typeof BigInt=="function"&&typeof hw(42)=="bigint"&&typeof BigInt(42)=="bigint"},E3=S3();if(E3){var I3=BigInt.prototype.valueOf,C3=function(e){try{return I3.call(e),!0}catch{}return!1};q0.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:C3(e)}}else q0.exports=function(e){return!1};var T3=q0.exports,L3=ZE,P3=c3,M3=g3,A3=w3,k3=T3,D3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(L3(e))return"String";if(P3(e))return"Number";if(M3(e))return"Boolean";if(A3(e))return"Symbol";if(k3(e))return"BigInt"},Xg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,fw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Yg;Xg||(Yg=function(e){return!1});var j0=Xg?Xg.prototype.has:null,f0=fw?fw.prototype.has:null;!Yg&&!j0&&(Yg=function(e){return!1});var R3=Yg||function(e){if(!e||typeof e!="object")return!1;try{if(j0.call(e,j0),f0)try{f0.call(e,f0)}catch{return!0}return e instanceof Xg}catch{}return!1},W0={exports:{}},N3=yl,lI=fa,O3=N3("%WeakSet%",!0),p0=lI("WeakSet.prototype.has",!0);if(p0){var d0=lI("WeakMap.prototype.has",!0);W0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(p0(e,p0),d0)try{d0(e,d0)}catch{return!0}return e instanceof O3}catch{}return!1}}else W0.exports=function(e){return!1};var z3=W0.exports,F3=YE,B3=JE,V3=R3,U3=z3,G3=function(e){if(e&&typeof e=="object"){if(F3(e))return"Map";if(B3(e))return"Set";if(V3(e))return"WeakMap";if(U3(e))return"WeakSet"}return!1},uI=Function.prototype.toString,of=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,H0,Lg;if(typeof of=="function"&&typeof Object.defineProperty=="function")try{H0=Object.defineProperty({},"length",{get:function(){throw Lg}}),Lg={},of(function(){throw 42},null,H0)}catch(t){t!==Lg&&(of=null)}else of=null;var q3=/^\s*class\b/,Z0=function(e){try{var n=uI.call(e);return q3.test(n)}catch{return!1}},m0=function(e){try{return Z0(e)?!1:(uI.call(e),!0)}catch{return!1}},Pg=Object.prototype.toString,j3="[object Object]",W3="[object Function]",H3="[object GeneratorFunction]",Z3="[object HTMLAllCollection]",X3="[object HTML document.all class]",Y3="[object HTMLCollection]",K3=typeof Symbol=="function"&&!!Symbol.toStringTag,J3=!(0 in[,]),X0=function(){return!1};if(typeof document=="object"){var Q3=document.all;Pg.call(Q3)===Pg.call(document.all)&&(X0=function(e){if((J3||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Pg.call(e);return(n===Z3||n===X3||n===Y3||n===j3)&&e("")==null}catch{}return!1})}var $3=of?function(e){if(X0(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{of(e,null,H0)}catch(n){if(n!==Lg)return!1}return!Z0(e)&&m0(e)}:function(e){if(X0(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(K3)return m0(e);if(Z0(e))return!1;var n=Pg.call(e);return n!==W3&&n!==H3&&!/^\[object HTML/.test(n)?!1:m0(e)},e4=$3,t4=Object.prototype.toString,cI=Object.prototype.hasOwnProperty,n4=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),t4.call(e)==="[object Array]"?n4(e,n,i):typeof e=="string"?r4(e,n,i):i4(e,n,i)},s4=o4,a4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],g0=a4,l4=typeof globalThis>"u"?Ud:globalThis,u4=function(){for(var e=[],n=0;n"u"?Ud:globalThis,Y0=c4(),Gv=Uv("String.prototype.slice"),y0=Object.getPrototypeOf,f4=Uv("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:d4(e)}return Mg?p4(e):null},g4=fa,mw=g4("ArrayBuffer.prototype.byteLength",!0),y4=rI,_4=function(e){return y4(e)?mw?mw(e):e.byteLength:NaN},fI=KM,_l=fa,gw=bA,v4=yl,mf=Rk,b4=WE,yw=qk,_w=zE,vw=HE,bw=rI,xw=Qk,ww=n3,Sw=i3,Ew=Tv,Iw=D3,Cw=G3,Tw=m4,Lw=_4,Pw=_l("SharedArrayBuffer.prototype.byteLength",!0),Mw=_l("Date.prototype.getTime"),_0=Object.getPrototypeOf,Aw=_l("Object.prototype.toString"),Qg=v4("%Set%",!0),K0=_l("Map.prototype.has",!0),$g=_l("Map.prototype.get",!0),kw=_l("Map.prototype.size",!0),ey=_l("Set.prototype.add",!0),pI=_l("Set.prototype.delete",!0),ty=_l("Set.prototype.has",!0),Ag=_l("Set.prototype.size",!0);function Dw(t,e,n,r){for(var i=mf(t),a;(a=i.next())&&!a.done;)if(Ca(e,a.value,n,r))return pI(t,a.value),!0;return!1}function dI(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 x4(t,e,n,r,i,a){var c=dI(n);if(c!=null)return c;var u=$g(e,c),m=fI({},i,{strict:!1});return typeof u>"u"&&!K0(e,c)||!Ca(r,u,m,a)?!1:!K0(t,c)&&Ca(r,u,m,a)}function w4(t,e,n){var r=dI(n);return r??(ty(e,r)&&!ty(t,r))}function Rw(t,e,n,r,i,a){for(var c=mf(t),u,m;(u=c.next())&&!u.done;)if(m=u.value,Ca(n,m,i,a)&&Ca(r,$g(e,m),i,a))return pI(t,m),!0;return!1}function Ca(t,e,n,r){var i=n||{};if(i.strict?yw(t,e):t===e)return!0;var a=Iw(t),c=Iw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?yw(t,e):t==e;var u=r.has(t),m=r.has(e),w;if(u&&m){if(r.get(t)===r.get(e))return!0}else w={};return u||r.set(t,w),m||r.set(e,w),I4(t,e,i,r)}function Nw(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 S4(t,e,n,r){if(Ag(t)!==Ag(e))return!1;for(var i=mf(t),a=mf(e),c,u,m;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")m||(m=new Qg),ey(m,c.value);else if(!ty(e,c.value)){if(n.strict||!w4(t,e,c.value))return!1;m||(m=new Qg),ey(m,c.value)}if(m){for(;(u=a.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!Dw(m,u.value,n.strict,r))return!1}else if(!n.strict&&!ty(t,u.value)&&!Dw(m,u.value,n.strict,r))return!1;return Ag(m)===0}return!0}function E4(t,e,n,r){if(kw(t)!==kw(e))return!1;for(var i=mf(t),a=mf(e),c,u,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 Qg),ey(m,w);else if(E=$g(e,w),typeof E>"u"&&!K0(e,w)||!Ca(S,E,n,r)){if(n.strict||!x4(t,e,w,S,n,r))return!1;m||(m=new Qg),ey(m,w)}if(m){for(;(u=a.next())&&!u.done;)if(w=u.value[0],E=u.value[1],w&&typeof w=="object"){if(!Rw(m,t,w,E,n,r))return!1}else if(!n.strict&&(!t.has(w)||!Ca($g(t,w),E,n,r))&&!Rw(m,t,w,E,fI({},n,{strict:!1}),r))return!1;return Ag(m)===0}return!0}function I4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||Aw(t)!==Aw(e)||_w(t)!==_w(e))return!1;var c=vw(t),u=vw(e);if(c!==u)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=ww(t),E=ww(e);if(S!==E||(S||E)&&(t.source!==e.source||gw(t)!==gw(e)))return!1;var P=xw(t),D=xw(e);if(P!==D||(P||D)&&Mw(t)!==Mw(e)||n.strict&&_0&&_0(t)!==_0(e))return!1;var k=Tw(t),V=Tw(e);if(k!==V)return!1;if(k||V){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(_e[i]!=se[i])return!1;for(i=_e.length-1;i>=0;i--)if(a=_e[i],!Ca(t[a],e[a],n,r))return!1;var ce=Cw(t),me=Cw(e);return ce!==me?!1:ce==="Set"||me==="Set"?S4(t,e,n,r):ce==="Map"?E4(t,e,n,r):!0}var C4=function(e,n,r){return Ca(e,n,r,b4())};const T4=Cv(C4);var L4=Object.defineProperty,nr=(t,e)=>L4(t,"name",{value:e,configurable:!0}),P4=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||!ad(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=J0(e),i=J0(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 ad(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?T4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return ad(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)}};nr(P4,"GeojsonEquality");function ad(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}nr(ad,"sameLength");function J0(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}nr(J0,"explode");var Ss=63710088e-1,mI={centimeters:Ss*100,centimetres:Ss*100,degrees:360/(2*Math.PI),feet:Ss*3.28084,inches:Ss*39.37,kilometers:Ss/1e3,kilometres:Ss/1e3,meters:Ss,metres:Ss,miles:Ss/1609.344,millimeters:Ss*1e3,millimetres:Ss*1e3,nauticalmiles:Ss/1852,radians:1,yards:Ss*1.0936},Ow={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 cl(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}nr(cl,"feature");function M4(t,e,n={}){switch(t){case"Point":return Bl(e).geometry;case"LineString":return Gl(e).geometry;case"Polygon":return qv(e).geometry;case"MultiPoint":return yI(e).geometry;case"MultiLineString":return gI(e).geometry;case"MultiPolygon":return _I(e).geometry;default:throw new Error(t+" is invalid")}}nr(M4,"geometry");function Bl(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(!ny(t[0])||!ny(t[1]))throw new Error("coordinates must contain numbers");return cl({type:"Point",coordinates:t},e,n)}nr(Bl,"point");function A4(t,e,n={}){return Sy(t.map(r=>Bl(r,e)),n)}nr(A4,"points");function qv(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;aqv(r,e)),n)}nr(k4,"polygons");function Gl(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return cl({type:"LineString",coordinates:t},e,n)}nr(Gl,"lineString");function D4(t,e,n={}){return Sy(t.map(r=>Gl(r,e)),n)}nr(D4,"lineStrings");function Sy(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}nr(Sy,"featureCollection");function gI(t,e,n={}){return cl({type:"MultiLineString",coordinates:t},e,n)}nr(gI,"multiLineString");function yI(t,e,n={}){return cl({type:"MultiPoint",coordinates:t},e,n)}nr(yI,"multiPoint");function _I(t,e,n={}){return cl({type:"MultiPolygon",coordinates:t},e,n)}nr(_I,"multiPolygon");function R4(t,e,n={}){return cl({type:"GeometryCollection",geometries:t},e,n)}nr(R4,"geometryCollection");function N4(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}nr(N4,"round");function vI(t,e="kilometers"){const n=mI[e];if(!n)throw new Error(e+" units is invalid");return t*n}nr(vI,"radiansToLength");function jv(t,e="kilometers"){const n=mI[e];if(!n)throw new Error(e+" units is invalid");return t/n}nr(jv,"lengthToRadians");function O4(t,e){return bI(jv(t,e))}nr(O4,"lengthToDegrees");function z4(t){let e=t%360;return e<0&&(e+=360),e}nr(z4,"bearingToAzimuth");function bI(t){return t%(2*Math.PI)*180/Math.PI}nr(bI,"radiansToDegrees");function F4(t){return t%360*Math.PI/180}nr(F4,"degreesToRadians");function B4(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return vI(jv(t,e),n)}nr(B4,"convertLength");function V4(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=Ow[e];if(!r)throw new Error("invalid original units");const i=Ow[n];if(!i)throw new Error("invalid final units");return t/r*i}nr(V4,"convertArea");function ny(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}nr(ny,"isNumber");function Wv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}nr(Wv,"isObject");function U4(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(!ny(e))throw new Error("bbox must only contain numbers")})}nr(U4,"validateBBox");function G4(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")}nr(G4,"validateId");var q4=Object.defineProperty,ho=(t,e)=>q4(t,"name",{value:e,configurable:!0});function Uf(t,e,n){if(t!==null)for(var r,i,a,c,u,m,w,S=0,E=0,P,D=t.type,k=D==="FeatureCollection",V=D==="Feature",j=k?t.features.length:1,te=0;tem||k>w||V>S){u=E,m=r,w=k,S=V,a=0;return}var j=Gl([u,E],n.properties);if(e(j,r,i,V,a)===!1)return!1;a++,u=E})===!1)return!1}}})}ho(SI,"segmentEach");function K4(t,e,n){var r=n,i=!1;return SI(t,function(a,c,u,m,w){i===!1&&n===void 0?r=a:r=e(r,a,c,u,m,w),i=!0}),r}ho(K4,"segmentReduce");function EI(t,e){if(!t)throw new Error("geojson is required");Ey(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ueD(t,"name",{value:e,configurable:!0});function Zv(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Uf(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]1)return 1;for(var h=l,p=0;p<8;p++){var y=this.sampleCurveX(h)-l;if(Math.abs(y)y?x=h:I=h,h=.5*(I-x)+x;return h},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var k=m(P);let V,j;function te(){return V==null&&(V=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),V}function U(){if(j==null&&(j=!1,te())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const y=4*p;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){j=!0;break}}}return j||!1}function W(l,o,h,p){const y=new k(l,o,h,p);return function(b){return y.solve(b)}}const Y=W(.25,.1,.25,1);function oe(l,o,h){return Math.min(h,Math.max(o,l))}function _e(l,o,h){const p=h-o,y=((l-o)%p+p)%p+o;return y===o?h:y}function se(l,...o){for(const h of o)for(const p in h)l[p]=h[p];return l}let ce=1;function me(l,o,h){const p={};for(const y in l)p[y]=o.call(h||this,l[y],y,l);return p}function Le(l,o,h){const p={};for(const y in l)o.call(h||this,l[y],y,l)&&(p[y]=l[y]);return p}function Z(l){return Array.isArray(l)?l.map(Z):typeof l=="object"&&l?me(l,Z):l}const fe={};function Ke(l){fe[l]||(typeof console<"u"&&console.warn(l),fe[l]=!0)}function Ee(l,o,h){return(h.y-l.y)*(o.x-l.x)>(o.y-l.y)*(h.x-l.x)}function Ze(l){let o=0;for(let h,p,y=0,b=l.length,x=b-1;y"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(l,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const I=x.startsWith("BGR"),L=new Uint8ClampedArray(p*y*4);if(yield b.copyTo(L,function(A,N,O,G,H){const K=4*Math.max(-N,0),ee=(Math.max(0,O)-O)*G*4+K,ae=4*G,pe=Math.max(0,N),Ae=Math.max(0,O);return{rect:{x:pe,y:Ae,width:Math.min(A.width,N+G)-pe,height:Math.min(A.height,O+H)-Ae},layout:[{offset:ee,stride:ae}]}}(l,o,h,p,y)),I)for(let A=0;Att(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Sr=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){const p=_n(l.url);if(p)return p(l,o);if(tt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:Rn},o)}if(!(/^file:/.test(h=l.url)||/^file:/.test(kr())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,y){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:kr(),signal:y.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new wr(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 L=yield I;if(y.signal.aborted)throw Tn();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(l,o);if(tt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:Rn},o)}var h;return function(p,y){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 L in p.headers)I.setRequestHeader(L,p.headers[L]);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(!y.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let L=I.response;if(p.type==="json")try{L=JSON.parse(I.response)}catch(A){return void x(A)}b({data:L,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const L=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});x(new wr(I.status,I.statusText,p.url,L))}},y.signal.addEventListener("abort",()=>{I.abort(),x(Tn())}),I.send(p.body)})}(l,o)};function dr(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const o=new URL(l),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function Qe(l,o,h){h[l]&&h[l].indexOf(o)!==-1||(h[l]=h[l]||[],h[l].push(o))}function ge(l,o,h){if(h&&h[l]){const p=h[l].indexOf(o);p!==-1&&h[l].splice(p,1)}}class Pe{constructor(o,h={}){se(this,h),this.type=o}}class Ct extends Pe{constructor(o,h={}){super("error",se({error:o},h))}}class Nn{on(o,h){return this._listeners=this._listeners||{},Qe(o,h,this._listeners),this}off(o,h){return ge(o,h,this._listeners),ge(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Qe(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Pe(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const y=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const I of y)I.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const I of b)ge(p,I,this._oneTimeListeners),I.call(this,o);const x=this._eventedParent;x&&(se(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof Ct&&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 Yt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Dr(l,o){const h={};for(const p in l)p!=="ref"&&(h[p]=l[p]);return Yt.forEach(p=>{p in o&&(h[p]=o[p])}),h}function ln(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let h=0;h`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}const xe=[Jr,ht,tn,$t,Rr,Gr,Jo,J(Kt),le,B,q];function Q(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(l.itemType,o.itemType))&&(typeof l.N!="number"||l.N===o.N))return null}else{if(l.kind===o.kind)return null;if(l.kind==="value"){for(const h of xe)if(!Q(h,o))return null}}return`Expected ${ne(l)} but found ${ne(o)} instead.`}function we(l,o){return o.some(h=>h.kind===l.kind)}function de(l,o){return o.some(h=>h==="null"?l===null:h==="array"?Array.isArray(l):h==="object"?l&&!Array.isArray(l)&&typeof l=="object":h===typeof l)}function Me(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const Ue=.96422,We=.82521,Xe=4/29,Lt=6/29,Dt=3*Lt*Lt,Ht=Lt*Lt*Lt,Zt=Math.PI/180,xn=180/Math.PI;function Xn(l){return(l%=360)<0&&(l+=360),l}function lr([l,o,h,p]){let y,b;const x=sn((.2225045*(l=Qr(l))+.7168786*(o=Qr(o))+.0606169*(h=Qr(h)))/1);l===o&&o===h?y=b=x:(y=sn((.4360747*l+.3850649*o+.1430804*h)/Ue),b=sn((.0139322*l+.0971045*o+.7141733*h)/We));const I=116*x-16;return[I<0?0:I,500*(y-x),200*(x-b),p]}function Qr(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function sn(l){return l>Ht?Math.pow(l,1/3):l/Dt+Xe}function Er([l,o,h,p]){let y=(l+16)/116,b=isNaN(o)?y:y+o/500,x=isNaN(h)?y:y-h/200;return y=1*Ji(y),b=Ue*Ji(b),x=We*Ji(x),[li(3.1338561*b-1.6168667*y-.4906146*x),li(-.9787684*b+1.9161415*y+.033454*x),li(.0719453*b-.2289914*y+1.4052427*x),p]}function li(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Ji(l){return l>Lt?l*l*l:Dt*(l-Xe)}function fo(l){return parseInt(l.padEnd(2,l),16)/255}function xi(l,o){return zs(o?l/100:l,0,1)}function zs(l,o,h){return Math.min(Math.max(o,l),h)}function nm(l){return!l.some(Number.isNaN)}const qy={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 Un{constructor(o,h,p,y=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=y,b||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,h,p,y]))}static parse(o){if(o instanceof Un)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=qy[p];if(y){const[x,I,L]=y;return[x/255,I/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let I=1;return[fo(p.slice(I,I+=x)),fo(p.slice(I,I+=x)),fo(p.slice(I,I+=x)),fo(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,L,A,N,O,G,H,K,ee,ae,pe,Ae]=x,ye=[N||" ",H||" ",ae].join("");if(ye===" "||ye===" /"||ye===",,"||ye===",,,"){const Ie=[A,G,ee].join(""),Ye=Ie==="%%%"?100:Ie===""?255:0;if(Ye){const Je=[zs(+L/Ye,0,1),zs(+O/Ye,0,1),zs(+K/Ye,0,1),pe?xi(+pe,Ae):1];if(nm(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,L,A,N,O,G,H,K]=b,ee=[L||" ",N||" ",G].join("");if(ee===" "||ee===" /"||ee===",,"||ee===",,,"){const ae=[+I,zs(+A,0,100),zs(+O,0,100),H?xi(+H,K):1];if(nm(ae))return function([pe,Ae,ye,Ie]){function Ye(Je){const bt=(Je+pe/30)%12,Tt=Ae*Math.min(ye,1-ye);return ye-Tt*Math.max(-1,Math.min(bt-3,9-bt,1))}return pe=Xn(pe),Ae/=100,ye/=100,[Ye(0),Ye(8),Ye(4),Ie]}(ae)}}}(o);return h?new Un(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:y}=this,b=y||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,y])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,y,b]=lr(o),x=Math.sqrt(p*p+y*y);return[Math.round(1e4*x)?Xn(Math.atan2(y,p)*xn):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",lr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,y]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${y})`}}Un.black=new Un(0,0,0,1),Un.white=new Un(1,1,1,1),Un.transparent=new Un(0,0,0,0),Un.red=new Un(1,0,0,1);class Kf{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 Jf{constructor(o,h,p,y,b){this.text=o,this.image=h,this.scale=p,this.fontStack=y,this.textColor=b}}class Ao{constructor(o){this.sections=o}static fromString(o){return new Ao([new Jf(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Ao?o:Ao.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class po{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof po)return o;if(typeof o=="number")return new po([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 po(o)}}toString(){return JSON.stringify(this.values)}}const Yu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Qo)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[l,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[l,o,h,p]:[l,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Jc(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Un||l instanceof Kf||l instanceof Ao||l instanceof po||l instanceof Qo||l instanceof $o)return!0;if(Array.isArray(l)){for(const o of l)if(!Jc(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!Jc(l[o]))return!1;return!0}return!1}function $r(l){if(l===null)return Jr;if(typeof l=="string")return tn;if(typeof l=="boolean")return $t;if(typeof l=="number")return ht;if(l instanceof Un)return Rr;if(l instanceof Kf)return ga;if(l instanceof Ao)return Gr;if(l instanceof po)return le;if(l instanceof Qo)return q;if(l instanceof $o)return B;if(Array.isArray(l)){const o=l.length;let h;for(const p of l){const y=$r(p);if(h){if(h===y)continue;h=Kt;break}h=y}return J(h||Kt,o)}return Jo}function Ku(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Un||l instanceof Ao||l instanceof po||l instanceof Qo||l instanceof $o?l.toString():JSON.stringify(l)}class Ua{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(!Jc(o[1]))return h.error("invalid value");const p=o[1];let y=$r(p);const b=h.expectedType;return y.kind!=="array"||y.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(y=b),new Ua(y,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class mr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Qc={string:tn,number:ht,boolean:$t,object:Jo};class ko{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,y=1;const b=o[0];if(b==="array"){let I,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Qc)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);I=Qc[A],y++}else I=Kt;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);L=o[2],y++}p=J(I,L)}else{if(!Qc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Qc[b]}const x=[];for(;yo.outputDefined())}}const $c={"to-boolean":$t,"to-color":Rr,"to-number":ht,"to-string":tn};class Fs{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!$c[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const y=$c[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:iu(h[0],h[1],h[2],h[3]),!p))return new Un(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new mr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const y=po.parse(h);if(y)return y}throw new mr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const y=Qo.parse(h);if(y)return y}throw new mr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const y=Number(h);if(!isNaN(y))return y}throw new mr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ao.fromString(Ku(this.args[0].evaluate(o)));case"resolvedImage":return $o.fromString(Ku(this.args[0].evaluate(o)));default:return Ku(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Ju=["Unknown","Point","LineString","Polygon"];class Gn{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"?Ju[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]=Un.parse(o)),h}}class eh{constructor(o,h,p=[],y,b=new wl,x=[]){this.registry=o,this.path=p,this.key=p.map(I=>`[${I}]`).join(""),this.scope=b,this.errors=x,this.expectedType=y,this._isConstant=h}parse(o,h,p,y,b={}){return h?this.concat(h,p,y)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(y,b,x){return x==="assert"?new ko(b,[y]):x==="coerce"?new Fs(b,[y]):y}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[y];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const I=this.expectedType,L=x.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||L.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(I.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(I,L))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 Ua)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const I=new Gn;try{x=new Ua(x.type,x.evaluate(I))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,h,p){const y=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new eh(this.registry,this._isConstant,y,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(y=>`[${y}]`).join("")}`;this.errors.push(new Ki(p,o))}checkSubtype(o,h){const p=Q(o,h);return p&&this.error(p),p}}class ou{constructor(o,h,p){this.type=ga,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const y=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,$t);if(!y)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,$t);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,tn),!x)?null:new ou(y,b,x)}evaluate(o){return new Kf(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 Ga=8192;function th(l,o){l[0]=Math.min(l[0],o[0]),l[1]=Math.min(l[1],o[1]),l[2]=Math.max(l[2],o[0]),l[3]=Math.max(l[3],o[1])}function Qu(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function jy(l,o){const h=(180+l[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,y=Math.pow(2,o.z);return[Math.round(h*y*Ga),Math.round(p*y*Ga)]}function rm(l,o,h){const p=l[0]-o[0],y=l[1]-o[1],b=l[0]-h[0],x=l[1]-h[1];return p*x-b*y==0&&p*b<=0&&y*x<=0}function nh(l,o){let h=!1;for(let x=0,I=o.length;x(p=l)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-y[0])*(p[1]-y[1])/(b[1]-y[1])+y[0]&&(h=!h)}}var p,y,b;return h}function Wy(l,o){for(let h=0;h0&&I<0||x<0&&I>0}function Hy(l,o,h){for(const A of h)for(let N=0;Nh[2]){const y=.5*p;let b=l[0]-h[0]>y?-p:h[0]-l[0]>y?p:0;b===0&&(b=l[0]-h[2]>y?-p:h[2]-l[0]>y?p:0),l[0]+=b}th(o,l)}function ih(l,o,h,p){const y=Math.pow(2,p.z)*Ga,b=[p.x*Ga,p.y*Ga],x=[];for(const I of l)for(const L of I){const A=[L.x+b[0],L.y+b[1]];lm(A,o,h,y),x.push(A)}return x}function um(l,o,h,p){const y=Math.pow(2,p.z)*Ga,b=[p.x*Ga,p.y*Ga],x=[];for(const L of l){const A=[];for(const N of L){const O=[N.x+b[0],N.y+b[1]];th(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=y/2){(I=o)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const L of x)for(const A of L)lm(A,o,h,y)}var I;return x}class Sl{constructor(o,h){this.type=$t,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(Jc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const y=[];for(const b of p.features){const{type:x,coordinates:I}=b.geometry;x==="Polygon"&&y.push(I),x==="MultiPolygon"&&y.push(...I)}if(y.length)return new Sl(p,{type:"MultiPolygon",coordinates:y})}else if(p.type==="Feature"){const y=p.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new Sl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Sl(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const I=rh(p.coordinates,b,x),L=ih(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!nh(A,I))return!1}if(p.type==="MultiPolygon"){const I=am(p.coordinates,b,x),L=ih(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!Wy(A,I))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const I=rh(p.coordinates,b,x),L=um(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!om(A,I))return!1}if(p.type==="MultiPolygon"){const I=am(p.coordinates,b,x),L=um(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!sm(A,I))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class oh{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 oh(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Do{constructor(o,h,p,y){this.name=o,this.type=h,this._evaluate=p,this.args=y}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],y=Do.definitions[p];if(!y)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(y)?y[0]:y.type,x=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,I=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,N]of I){L=new eh(h.registry,$u,h.path,null,h.scope);const O=[];let G=!1;for(let H=1;H{return G=O,Array.isArray(G)?`(${G.map(ne).join(", ")})`:`(${ne(G.type)}...)`;var G}).join(" | "),N=[];for(let O=1;O{h=o?h&&$u(p):h&&p instanceof Ua}),!!h&&sh(l)&&tc(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function sh(l){if(l instanceof Do&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof Sl)return!1;let o=!0;return l.eachChild(h=>{o&&!sh(h)&&(o=!1)}),o}function ec(l){if(l instanceof Do&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(h=>{o&&!ec(h)&&(o=!1)}),o}function tc(l,o){if(l instanceof Do&&o.indexOf(l.name)>=0)return!1;let h=!0;return l.eachChild(p=>{h&&!tc(p,o)&&(h=!1)}),h}function nc(l,o){const h=l.length-1;let p,y,b=0,x=h,I=0;for(;b<=x;)if(I=Math.floor((b+x)/2),p=l[I],y=l[I+1],p<=o){if(I===h||oo))throw new mr("Input is not a number.");x=I-1}return 0}class rc{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[y,b]of p)this.labels.push(y),this.outputs.push(b)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,ht);if(!p)return null;const y=[];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(L,N,b);if(!O)return null;b=b||O.type,y.push([I,O])}return new rc(b,p,y)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const b=h.length;return y>=h[b-1]?p[b-1].evaluate(o):p[nc(h,y)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Zy(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Xy=cm;function cm(l,o,h,p){this.cx=3*l,this.bx=3*(h-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=h,this.p2y=p}cm.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var h=l,p=0;p<8;p++){var y=this.sampleCurveX(h)-l;if(Math.abs(y)y?x=h:I=h,h=.5*(I-x)+x;return h},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Yy=Zy(Xy);function El(l,o,h){return l+h*(o-l)}function ah(l,o,h){return l.map((p,y)=>El(p,o[y],h))}const Qi={number:El,color:function(l,o,h,p="rgb"){switch(p){case"rgb":{const[y,b,x,I]=ah(l.rgb,o.rgb,h);return new Un(y,b,x,I,!1)}case"hcl":{const[y,b,x,I]=l.hcl,[L,A,N,O]=o.hcl;let G,H;if(isNaN(y)||isNaN(L))isNaN(y)?isNaN(L)?G=NaN:(G=L,x!==1&&x!==0||(H=A)):(G=y,N!==1&&N!==0||(H=b));else{let Ae=L-y;L>y&&Ae>180?Ae-=360:L180&&(Ae+=360),G=y+h*Ae}const[K,ee,ae,pe]=function([Ae,ye,Ie,Ye]){return Ae=isNaN(Ae)?0:Ae*Zt,Er([Ie,Math.cos(Ae)*ye,Math.sin(Ae)*ye,Ye])}([G,H??El(b,A,h),El(x,N,h),El(I,O,h)]);return new Un(K,ee,ae,pe,!1)}case"lab":{const[y,b,x,I]=Er(ah(l.lab,o.lab,h));return new Un(y,b,x,I,!1)}}},array:ah,padding:function(l,o,h){return new po(ah(l.values,o.values,h))},variableAnchorOffsetCollection:function(l,o,h){const p=l.values,y=o.values;if(p.length!==y.length)throw new mr(`Cannot interpolate values of different length. from: ${l.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);y={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(b=h.parse(b,2,ht),!b)return null;const I=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Rr:h.expectedType&&h.expectedType.kind!=="value"&&(L=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 K=h.parse(O,H,L);if(!K)return null;L=L||K.type,I.push([N,K])}return Me(L,ht)||Me(L,Rr)||Me(L,le)||Me(L,q)||Me(L,J(ht))?new Oi(L,p,y,b,I):h.error(`Type ${ne(L)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const b=h.length;if(y>=h[b-1])return p[b-1].evaluate(o);const x=nc(h,y),I=Oi.interpolationFactor(this.interpolation,y,h[x],h[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return Qi[this.type.kind](L,A,I);case"interpolate-hcl":return Qi.color(L,A,I,"hcl");case"interpolate-lab":return Qi.color(L,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(l,o,h,p){const y=p-h,b=l-h;return y===0?0:o===1?b/y:(Math.pow(o,b)-1)/(Math.pow(o,y)-1)}class lh{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const y=h.expectedType;y&&y.kind!=="value"&&(p=y);const b=[];for(const I of o.slice(1)){const L=h.parse(I,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=y&&b.some(I=>Q(y,I.type));return new lh(x?Kt:p,b)}evaluate(o){let h,p=null,y=0;for(const b of this.args)if(y++,p=b.evaluate(o),p&&p instanceof $o&&!p.available&&(h||(h=p.name),p=null,y===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class uh{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 mr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new mr(`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 $f{constructor(o,h){this.type=$t,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Kt),y=h.parse(o[2],2,Kt);return p&&y?we(p.type,[$t,tn,ht,Jr,Kt])?new $f(p,y):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ne(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!de(h,["boolean","string","number","null"]))throw new mr(`Expected first argument to be of type boolean, string, number or null, but found ${ne($r(h))} instead.`);if(!de(p,["string","array"]))throw new mr(`Expected second argument to be of type array or string, but found ${ne($r(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class ch{constructor(o,h,p){this.type=ht,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Kt),y=h.parse(o[2],2,Kt);if(!p||!y)return null;if(!we(p.type,[$t,tn,ht,Jr,Kt]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ne(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ht);return b?new ch(p,y,b):null}return new ch(p,y)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!de(h,["boolean","string","number","null"]))throw new mr(`Expected first argument to be of type boolean, string, number or null, but found ${ne($r(h))} instead.`);if(!de(p,["string","array"]))throw new mr(`Expected second argument to be of type array or string, but found ${ne($r(p))} instead.`);if(this.fromIndex){const y=this.fromIndex.evaluate(o);return p.indexOf(h,y)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class ep{constructor(o,h,p,y,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=y,this.outputs=b,this.otherwise=x}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,$r(K)))return null}else p=$r(K);if(b[String(K)]!==void 0)return G.error("Branch labels must be unique.");b[String(K)]=x.length}const H=h.parse(O,A,y);if(!H)return null;y=y||H.type,x.push(H)}const I=h.parse(o[1],1,Kt);if(!I)return null;const L=h.parse(o[o.length-1],o.length-1,y);return L?I.type.kind!=="value"&&h.concat(1).checkSubtype(p,I.type)?null:new ep(p,y,I,b,x,L):null}evaluate(o){const h=this.input.evaluate(o);return($r(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 tp{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const y=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class hh{constructor(o,h,p,y){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=y}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Kt),y=h.parse(o[2],2,ht);if(!p||!y)return null;if(!we(p.type,[J(Kt),tn,Kt]))return h.error(`Expected first argument to be of type array or string, but found ${ne(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ht);return b?new hh(p.type,p,y,b):null}return new hh(p.type,p,y)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!de(h,["string","array"]))throw new mr(`Expected first argument to be of type array or string, but found ${ne($r(h))} instead.`);if(this.endIndex){const y=this.endIndex.evaluate(o);return h.slice(p,y)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function hm(l,o){return l==="=="||l==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function fm(l,o,h,p){return p.compare(o,h)===0}function su(l,o,h){const p=l!=="=="&&l!=="!=";return class CI{constructor(b,x,I){this.type=$t,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 L=x.parse(b[1],1,Kt);if(!L)return null;if(!hm(I,L.type))return x.concat(1).error(`"${I}" comparisons are not supported for type '${ne(L.type)}'.`);let A=x.parse(b[2],2,Kt);if(!A)return null;if(!hm(I,A.type))return x.concat(2).error(`"${I}" comparisons are not supported for type '${ne(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${ne(L.type)}' and '${ne(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new ko(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new ko(L.type,[A])));let N=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,ga),!N)return null}return new CI(L,A,N)}evaluate(b){const x=this.lhs.evaluate(b),I=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=$r(x),A=$r(I);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new mr(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=$r(x),A=$r(I);if(L.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 Ky=su("==",function(l,o,h){return o===h},fm),Jy=su("!=",function(l,o,h){return o!==h},function(l,o,h,p){return!fm(0,o,h,p)}),Qy=su("<",function(l,o,h){return o",function(l,o,h){return o>h},function(l,o,h,p){return p.compare(o,h)>0}),e_=su("<=",function(l,o,h){return o<=h},function(l,o,h,p){return p.compare(o,h)<=0}),t_=su(">=",function(l,o,h){return o>=h},function(l,o,h,p){return p.compare(o,h)>=0});class np{constructor(o,h,p,y,b){this.type=tn,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=y,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ht);if(!p)return null;const y=o[2];if(typeof y!="object"||Array.isArray(y))return h.error("NumberFormat options argument must be an object.");let b=null;if(y.locale&&(b=h.parse(y.locale,1,tn),!b))return null;let x=null;if(y.currency&&(x=h.parse(y.currency,1,tn),!x))return null;let I=null;if(y["min-fraction-digits"]&&(I=h.parse(y["min-fraction-digits"],1,ht),!I))return null;let L=null;return y["max-fraction-digits"]&&(L=h.parse(y["max-fraction-digits"],1,ht),!L)?null:new np(p,b,x,I,L)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class fh{constructor(o){this.type=Gr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const y=[];let b=!1;for(let x=1;x<=o.length-1;++x){const I=o[x];if(b&&typeof I=="object"&&!Array.isArray(I)){b=!1;let L=null;if(I["font-scale"]&&(L=h.parse(I["font-scale"],1,ht),!L))return null;let A=null;if(I["text-font"]&&(A=h.parse(I["text-font"],1,J(tn)),!A))return null;let N=null;if(I["text-color"]&&(N=h.parse(I["text-color"],1,Rr),!N))return null;const O=y[y.length-1];O.scale=L,O.font=A,O.textColor=N}else{const L=h.parse(o[x],1,Kt);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,y.push({content:L,scale:null,font:null,textColor:null})}}return new fh(y)}evaluate(o){return new Ao(this.sections.map(h=>{const p=h.content.evaluate(o);return $r(p)===B?new Jf("",p,null,null,null):new Jf(Ku(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 rp{constructor(o){this.type=B,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,tn);return p?new rp(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=$o.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class ip{constructor(o){this.type=ht,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${ne(p.type)} instead.`):new ip(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new mr(`Expected value to be of type string or array, but found ${ne($r(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const au={"==":Ky,"!=":Jy,">":$y,"<":Qy,">=":t_,"<=":e_,array:ko,at:Qf,boolean:ko,case:tp,coalesce:lh,collator:ou,format:fh,image:rp,in:$f,"index-of":ch,interpolate:Oi,"interpolate-hcl":Oi,"interpolate-lab":Oi,length:ip,let:uh,literal:Ua,match:ep,number:ko,"number-format":np,object:ko,slice:hh,step:rc,string:ko,"to-boolean":Fs,"to-color":Fs,"to-number":Fs,"to-string":Fs,var:oh,within:Sl};function pm(l,[o,h,p,y]){o=o.evaluate(l),h=h.evaluate(l),p=p.evaluate(l);const b=y?y.evaluate(l):1,x=iu(o,h,p,b);if(x)throw new mr(x);return new Un(o/255,h/255,p/255,b,!1)}function dm(l,o){return l in o}function op(l,o){const h=o[l];return h===void 0?null:h}function Il(l){return{type:l}}function mm(l){return{result:"success",value:l}}function lu(l){return{result:"error",value:l}}function uu(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function gm(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function sp(l){return!!l.expression&&l.expression.interpolated}function Cn(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function ph(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function n_(l){return l}function ym(l,o){const h=o.type==="color",p=l.stops&&typeof l.stops[0][0]=="object",y=p||!(p||l.property!==void 0),b=l.type||(sp(o)?"exponential":"interval");if(h||o.type==="padding"){const N=h?Un.parse:po.parse;(l=Ko({},l)).stops&&(l.stops=l.stops.map(O=>[O[0],N(O[1])])),l.default=N(l.default?l.default:o.default)}if(l.colorSpace&&(x=l.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var x;let I,L,A;if(b==="exponential")I=wn;else if(b==="interval")I=r_;else if(b==="categorical"){I=qr,L=Object.create(null);for(const N of l.stops)L[N[0]]=N[1];A=typeof l.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);I=ap}if(p){const N={},O=[];for(let K=0;KK[0]),evaluate:({zoom:K},ee)=>wn({stops:G,base:l.base},o,K).evaluate(K,ee)}}if(y){const N=b==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:Oi.interpolationFactor.bind(void 0,N),zoomStops:l.stops.map(O=>O[0]),evaluate:({zoom:O})=>I(l,o,O,L,A)}}return{kind:"source",evaluate(N,O){const G=O&&O.properties?O.properties[l.property]:void 0;return G===void 0?ic(l.default,o.default):I(l,o,G,L,A)}}}function ic(l,o,h){return l!==void 0?l:o!==void 0?o:h!==void 0?h:void 0}function qr(l,o,h,p,y){return ic(typeof h===y?p[h]:void 0,l.default,o.default)}function r_(l,o,h){if(Cn(h)!=="number")return ic(l.default,o.default);const p=l.stops.length;if(p===1||h<=l.stops[0][0])return l.stops[0][1];if(h>=l.stops[p-1][0])return l.stops[p-1][1];const y=nc(l.stops.map(b=>b[0]),h);return l.stops[y][1]}function wn(l,o,h){const p=l.base!==void 0?l.base:1;if(Cn(h)!=="number")return ic(l.default,o.default);const y=l.stops.length;if(y===1||h<=l.stops[0][0])return l.stops[0][1];if(h>=l.stops[y-1][0])return l.stops[y-1][1];const b=nc(l.stops.map(N=>N[0]),h),x=function(N,O,G,H){const K=H-G,ee=N-G;return K===0?0:O===1?ee/K:(Math.pow(O,ee)-1)/(Math.pow(O,K)-1)}(h,p,l.stops[b][0],l.stops[b+1][0]),I=l.stops[b][1],L=l.stops[b+1][1],A=Qi[o.type]||n_;return typeof I.evaluate=="function"?{evaluate(...N){const O=I.evaluate.apply(void 0,N),G=L.evaluate.apply(void 0,N);if(O!==void 0&&G!==void 0)return A(O,G,x,l.colorSpace)}}:A(I,L,x,l.colorSpace)}function ap(l,o,h){switch(o.type){case"color":h=Un.parse(h);break;case"formatted":h=Ao.fromString(h.toString());break;case"resolvedImage":h=$o.fromString(h.toString());break;case"padding":h=po.parse(h);break;default:Cn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return ic(h,l.default,o.default)}Do.register(au,{error:[{kind:"error"},[tn],(l,[o])=>{throw new mr(o.evaluate(l))}],typeof:[tn,[Kt],(l,[o])=>ne($r(o.evaluate(l)))],"to-rgba":[J(ht,4),[Rr],(l,[o])=>{const[h,p,y,b]=o.evaluate(l).rgb;return[255*h,255*p,255*y,b]}],rgb:[Rr,[ht,ht,ht],pm],rgba:[Rr,[ht,ht,ht,ht],pm],has:{type:$t,overloads:[[[tn],(l,[o])=>dm(o.evaluate(l),l.properties())],[[tn,Jo],(l,[o,h])=>dm(o.evaluate(l),h.evaluate(l))]]},get:{type:Kt,overloads:[[[tn],(l,[o])=>op(o.evaluate(l),l.properties())],[[tn,Jo],(l,[o,h])=>op(o.evaluate(l),h.evaluate(l))]]},"feature-state":[Kt,[tn],(l,[o])=>op(o.evaluate(l),l.featureState||{})],properties:[Jo,[],l=>l.properties()],"geometry-type":[tn,[],l=>l.geometryType()],id:[Kt,[],l=>l.id()],zoom:[ht,[],l=>l.globals.zoom],"heatmap-density":[ht,[],l=>l.globals.heatmapDensity||0],"line-progress":[ht,[],l=>l.globals.lineProgress||0],accumulated:[Kt,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[ht,Il(ht),(l,o)=>{let h=0;for(const p of o)h+=p.evaluate(l);return h}],"*":[ht,Il(ht),(l,o)=>{let h=1;for(const p of o)h*=p.evaluate(l);return h}],"-":{type:ht,overloads:[[[ht,ht],(l,[o,h])=>o.evaluate(l)-h.evaluate(l)],[[ht],(l,[o])=>-o.evaluate(l)]]},"/":[ht,[ht,ht],(l,[o,h])=>o.evaluate(l)/h.evaluate(l)],"%":[ht,[ht,ht],(l,[o,h])=>o.evaluate(l)%h.evaluate(l)],ln2:[ht,[],()=>Math.LN2],pi:[ht,[],()=>Math.PI],e:[ht,[],()=>Math.E],"^":[ht,[ht,ht],(l,[o,h])=>Math.pow(o.evaluate(l),h.evaluate(l))],sqrt:[ht,[ht],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[ht,[ht],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[ht,[ht],(l,[o])=>Math.log(o.evaluate(l))],log2:[ht,[ht],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[ht,[ht],(l,[o])=>Math.sin(o.evaluate(l))],cos:[ht,[ht],(l,[o])=>Math.cos(o.evaluate(l))],tan:[ht,[ht],(l,[o])=>Math.tan(o.evaluate(l))],asin:[ht,[ht],(l,[o])=>Math.asin(o.evaluate(l))],acos:[ht,[ht],(l,[o])=>Math.acos(o.evaluate(l))],atan:[ht,[ht],(l,[o])=>Math.atan(o.evaluate(l))],min:[ht,Il(ht),(l,o)=>Math.min(...o.map(h=>h.evaluate(l)))],max:[ht,Il(ht),(l,o)=>Math.max(...o.map(h=>h.evaluate(l)))],abs:[ht,[ht],(l,[o])=>Math.abs(o.evaluate(l))],round:[ht,[ht],(l,[o])=>{const h=o.evaluate(l);return h<0?-Math.round(-h):Math.round(h)}],floor:[ht,[ht],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[ht,[ht],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[$t,[tn,Kt],(l,[o,h])=>l.properties()[o.value]===h.value],"filter-id-==":[$t,[Kt],(l,[o])=>l.id()===o.value],"filter-type-==":[$t,[tn],(l,[o])=>l.geometryType()===o.value],"filter-<":[$t,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p{const h=l.id(),p=o.value;return typeof h==typeof p&&h":[$t,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p>y}],"filter-id->":[$t,[Kt],(l,[o])=>{const h=l.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[$t,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p<=y}],"filter-id-<=":[$t,[Kt],(l,[o])=>{const h=l.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[$t,[tn,Kt],(l,[o,h])=>{const p=l.properties()[o.value],y=h.value;return typeof p==typeof y&&p>=y}],"filter-id->=":[$t,[Kt],(l,[o])=>{const h=l.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[$t,[Kt],(l,[o])=>o.value in l.properties()],"filter-has-id":[$t,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[$t,[J(tn)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[$t,[J(Kt)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[$t,[tn,J(Kt)],(l,[o,h])=>h.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[$t,[tn,J(Kt)],(l,[o,h])=>function(p,y,b,x){for(;b<=x;){const I=b+x>>1;if(y[I]===p)return!0;y[I]>p?x=I-1:b=I+1}return!1}(l.properties()[o.value],h.value,0,h.value.length-1)],all:{type:$t,overloads:[[[$t,$t],(l,[o,h])=>o.evaluate(l)&&h.evaluate(l)],[Il($t),(l,o)=>{for(const h of o)if(!h.evaluate(l))return!1;return!0}]]},any:{type:$t,overloads:[[[$t,$t],(l,[o,h])=>o.evaluate(l)||h.evaluate(l)],[Il($t),(l,o)=>{for(const h of o)if(h.evaluate(l))return!0;return!1}]]},"!":[$t,[$t],(l,[o])=>!o.evaluate(l)],"is-supported-script":[$t,[tn],(l,[o])=>{const h=l.globals&&l.globals.isSupportedScript;return!h||h(o.evaluate(l))}],upcase:[tn,[tn],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[tn,[tn],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[tn,Il(Kt),(l,o)=>o.map(h=>Ku(h.evaluate(l))).join("")],"resolved-locale":[tn,[ga],(l,[o])=>o.evaluate(l).resolvedLocale()]});class rr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new Gn,this._defaultValue=h?(p=h).type==="color"&&ph(p.default)?new Un(0,0,0,0):p.type==="color"?Un.parse(p.default)||null:p.type==="padding"?po.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Qo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,y,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const 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 mr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).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(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in au}function Cl(l,o){const h=new eh(au,$u,[],o?function(y){const b={color:Rr,string:tn,number:ht,enum:tn,boolean:$t,formatted:Gr,padding:le,resolvedImage:B,variableAnchorOffsetCollection:q};return y.type==="array"?J(b[y.value]||Kt,y.length):b[y.type]}(o):void 0),p=h.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?mm(new rr(p,o)):lu(h.errors)}class dh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!ec(h.expression)}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,b,x)}evaluate(o,h,p,y,b,x){return this._styleExpression.evaluate(o,h,p,y,b,x)}}class lp{constructor(o,h,p,y){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!ec(h.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,b,x)}evaluate(o,h,p,y,b,x){return this._styleExpression.evaluate(o,h,p,y,b,x)}interpolationFactor(o,h,p){return this.interpolationType?Oi.interpolationFactor(this.interpolationType,o,h,p):0}}function _m(l,o){const h=Cl(l,o);if(h.result==="error")return h;const p=h.value.expression,y=sh(p);if(!y&&!uu(o))return lu([new Ki("","data expressions not supported")]);const b=tc(p,["zoom"]);if(!b&&!gm(o))return lu([new Ki("","zoom expressions not supported")]);const x=gh(p);return x||b?x instanceof Ki?lu([x]):x instanceof Oi&&!sp(o)?lu([new Ki("",'"interpolate" expressions cannot be used with this property')]):mm(x?new lp(y?"camera":"composite",h.value,x.labels,x instanceof Oi?x.interpolation:void 0):new dh(y?"constant":"source",h.value)):lu([new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class mh{constructor(o,h){this._parameters=o,this._specification=h,Ko(this,ym(this._parameters,this._specification))}static deserialize(o){return new mh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function gh(l){let o=null;if(l instanceof uh)o=gh(l.result);else if(l instanceof lh){for(const h of l.args)if(o=gh(h),o)break}else(l instanceof rc||l instanceof Oi)&&l.input instanceof Do&&l.input.name==="zoom"&&(o=l);return o instanceof Ki||l.eachChild(h=>{const p=gh(h);p instanceof Ki?o=p:!o&&p?o=new Ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Ki("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function yh(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const o of l.slice(1))if(!yh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const vm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _h(l){if(l==null)return{filter:()=>!0,needGeometry:!1};yh(l)||(l=bh(l));const o=Cl(l,vm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,y)=>o.value.evaluate(h,p,{},y),needGeometry:vh(l)}}function bm(l,o){return lo?1:0}function vh(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?up(l[1],l[2],o):o==="any"?(h=l.slice(1),["any"].concat(h.map(bh))):o==="all"?["all"].concat(l.slice(1).map(bh)):o==="none"?["all"].concat(l.slice(1).map(bh).map(xh)):o==="in"?xm(l[1],l.slice(2)):o==="!in"?xh(xm(l[1],l.slice(2))):o==="has"?wm(l[1]):o==="!has"?xh(wm(l[1])):o!=="within"||l;var h}function up(l,o,h){switch(l){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,l,o]}}function xm(l,o){if(o.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(h=>typeof h!=typeof o[0])?["filter-in-large",l,["literal",o.sort(bm)]]:["filter-in-small",l,["literal",o]]}}function wm(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function xh(l){return["!",l]}function cp(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let y="[";for(const b of l)y+=`${cp(b)},`;return`${y}]`}const h=Object.keys(l).sort();let p="{";for(let y=0;yp.maximum?[new it(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Em(l){const o=l.valueSpec,h=Ir(l.value.type);let p,y,b,x={};const I=h!=="categorical"&&l.value.property===void 0,L=!I,A=Cn(l.value.stops)==="array"&&Cn(l.value.stops[0])==="array"&&Cn(l.value.stops[0][0])==="object",N=$i({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(H){if(h==="identity")return[new it(H.key,H.value,'identity function may not have a "stops" property')];let K=[];const ee=H.value;return K=K.concat(hp({key:H.key,value:ee,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:O})),Cn(ee)==="array"&&ee.length===0&&K.push(new it(H.key,ee,"array must have at least one stop")),K},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"&&I&&N.push(new it(l.key,l.value,'missing required property "property"')),h==="identity"||l.value.stops||N.push(new it(l.key,l.value,'missing required property "stops"')),h==="exponential"&&l.valueSpec.expression&&!sp(l.valueSpec)&&N.push(new it(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(L&&!uu(l.valueSpec)?N.push(new it(l.key,l.value,"property functions not supported")):I&&!gm(l.valueSpec)&&N.push(new it(l.key,l.value,"zoom functions not supported"))),h!=="categorical"&&!A||l.value.property!==void 0||N.push(new it(l.key,l.value,'"property" property is required')),N;function O(H){let K=[];const ee=H.value,ae=H.key;if(Cn(ee)!=="array")return[new it(ae,ee,`array expected, ${Cn(ee)} found`)];if(ee.length!==2)return[new it(ae,ee,`array length 2 expected, length ${ee.length} found`)];if(A){if(Cn(ee[0])!=="object")return[new it(ae,ee,`object expected, ${Cn(ee[0])} found`)];if(ee[0].zoom===void 0)return[new it(ae,ee,"object stop key must have zoom")];if(ee[0].value===void 0)return[new it(ae,ee,"object stop key must have value")];if(b&&b>Ir(ee[0].zoom))return[new it(ae,ee[0].zoom,"stop zoom values must appear in ascending order")];Ir(ee[0].zoom)!==b&&(b=Ir(ee[0].zoom),y=void 0,x={}),K=K.concat($i({key:`${ae}[0]`,value:ee[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:wh,value:G}}))}else K=K.concat(G({key:`${ae}[0]`,value:ee[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},ee));return $n(qa(ee[1]))?K.concat([new it(`${ae}[1]`,ee[1],"expressions are not allowed in function stops.")]):K.concat(H.validateSpec({key:`${ae}[1]`,value:ee[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function G(H,K){const ee=Cn(H.value),ae=Ir(H.value),pe=H.value!==null?H.value:K;if(p){if(ee!==p)return[new it(H.key,pe,`${ee} stop domain type must match previous stop domain type ${p}`)]}else p=ee;if(ee!=="number"&&ee!=="string"&&ee!=="boolean")return[new it(H.key,pe,"stop domain value must be a number, string, or boolean")];if(ee!=="number"&&h!=="categorical"){let Ae=`number expected, ${ee} found`;return uu(o)&&h===void 0&&(Ae+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new it(H.key,pe,Ae)]}return h!=="categorical"||ee!=="number"||isFinite(ae)&&Math.floor(ae)===ae?h!=="categorical"&&ee==="number"&&y!==void 0&&aenew it(`${l.key}${p.key}`,l.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!h.outputDefined())return[new it(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!ec(h))return[new it(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!ec(h))return[new it(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!tc(h,["zoom","feature-state"]))return[new it(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!sh(h))return[new it(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Wa(l){const o=l.key,h=l.value,p=l.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(Ir(h))===-1&&y.push(new it(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Ir(h))===-1&&y.push(new it(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),y}function cu(l){return yh(qa(l.value))?ja(Ko({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):fp(l)}function fp(l){const o=l.value,h=l.key;if(Cn(o)!=="array")return[new it(h,o,`array expected, ${Cn(o)} found`)];const p=l.styleSpec;let y,b=[];if(o.length<1)return[new it(h,o,"filter array must have at least 1 element")];switch(b=b.concat(Wa({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:l.style,styleSpec:l.styleSpec})),Ir(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Ir(o[1])==="$type"&&b.push(new it(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new it(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(y=Cn(o[1]),y!=="string"&&b.push(new it(`${h}[1]`,o[1],`string expected, ${y} found`)));for(let x=2;x{A in h&&o.push(new it(p,h[A],`"${A}" is prohibited for ref layers`))}),y.layers.forEach(A=>{Ir(A.id)===I&&(L=A)}),L?L.ref?o.push(new it(p,h.ref,"ref cannot reference another ref layer")):x=Ir(L.type):o.push(new it(p,h.ref,`ref layer "${I}" not found`))}else if(x!=="background")if(h.source){const L=y.sources&&y.sources[h.source],A=L&&Ir(L.type);L?A==="vector"&&x==="raster"?o.push(new it(p,h.source,`layer "${h.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new it(p,h.source,`layer "${h.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new it(p,h.source,`layer "${h.id}" requires a vector source`)):A!=="vector"||h["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new it(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!h.paint||!h.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||o.push(new it(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new it(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new it(p,h.source,`source "${h.source}" not found`))}else o.push(new it(p,h,'missing required property "source"'));return o=o.concat($i({key:p,value:h,valueSpec:b.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${p}.type`,value:h.type,valueSpec:b.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:h,objectKey:"type"}),filter:cu,layout:L=>$i({layer:h,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>dp(Ko({layerType:x},A))}}),paint:L=>$i({layer:h,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>pp(Ko({layerType:x},A))}})}})),o}function Tl(l){const o=l.value,h=l.key,p=Cn(o);return p!=="string"?[new it(h,o,`string expected, ${p} found`)]:[]}const Im={promoteId:function({key:l,value:o}){if(Cn(o)==="string")return Tl({key:l,value:o});{const h=[];for(const p in o)h.push(...Tl({key:`${l}.${p}`,value:o[p]}));return h}}};function Cm(l){const o=l.value,h=l.key,p=l.styleSpec,y=l.style,b=l.validateSpec;if(!o.type)return[new it(h,o,'"type" is required')];const x=Ir(o.type);let I;switch(x){case"vector":case"raster":return I=$i({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:l.style,styleSpec:p,objectElementValidators:Im,validateSpec:b}),I;case"raster-dem":return I=function(L){var A;const N=(A=L.sourceName)!==null&&A!==void 0?A:"",O=L.value,G=L.styleSpec,H=G.source_raster_dem,K=L.style;let ee=[];const ae=Cn(O);if(O===void 0)return ee;if(ae!=="object")return ee.push(new it("source_raster_dem",O,`object expected, ${ae} found`)),ee;const pe=Ir(O.encoding)==="custom",Ae=["redFactor","greenFactor","blueFactor","baseShift"],ye=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const Ie in O)!pe&&Ae.includes(Ie)?ee.push(new it(Ie,O[Ie],`In "${N}": "${Ie}" is only valid when "encoding" is set to "custom". ${ye} encoding found`)):H[Ie]?ee=ee.concat(L.validateSpec({key:Ie,value:O[Ie],valueSpec:H[Ie],validateSpec:L.validateSpec,style:K,styleSpec:G})):ee.push(new it(Ie,O[Ie],`unknown property "${Ie}"`));return ee}({sourceName:h,value:o,style:l.style,styleSpec:p,validateSpec:b}),I;case"geojson":if(I=$i({key:h,value:o,valueSpec:p.source_geojson,style:y,styleSpec:p,validateSpec:b,objectElementValidators:Im}),o.cluster)for(const L in o.clusterProperties){const[A,N]=o.clusterProperties[L],O=typeof A=="string"?[A,["accumulated"],["get",L]]:A;I.push(...ja({key:`${h}.${L}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),I.push(...ja({key:`${h}.${L}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return I;case"video":return $i({key:h,value:o,valueSpec:p.source_video,style:y,validateSpec:b,styleSpec:p});case"image":return $i({key:h,value:o,valueSpec:p.source_image,style:y,validateSpec:b,styleSpec:p});case"canvas":return[new it(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Wa({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:b,styleSpec:p})}}function Tm(l){const o=l.value,h=l.styleSpec,p=h.light,y=l.style;let b=[];const x=Cn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new it("light",o,`object expected, ${x} found`)]),b;for(const I in o){const L=I.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?l.validateSpec({key:I,value:o[I],valueSpec:h.transition,validateSpec:l.validateSpec,style:y,styleSpec:h}):p[I]?l.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:l.validateSpec,style:y,styleSpec:h}):[new it(I,o[I],`unknown property "${I}"`)])}return b}function Lm(l){const o=l.value,h=l.styleSpec,p=h.sky,y=l.style,b=Cn(o);if(o===void 0)return[];if(b!=="object")return[new it("sky",o,`object expected, ${b} found`)];let x=[];for(const I in o)x=x.concat(p[I]?Bs({key:I,value:o[I],valueSpec:p[I],style:y,styleSpec:h}):[new it(I,o[I],`unknown property "${I}"`)]);return x}function sc(l){const o=l.value,h=l.styleSpec,p=h.terrain,y=l.style;let b=[];const x=Cn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new it("terrain",o,`object expected, ${x} found`)]),b;for(const I in o)b=b.concat(p[I]?l.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:l.validateSpec,style:y,styleSpec:h}):[new it(I,o[I],`unknown property "${I}"`)]);return b}function ac(l){let o=[];const h=l.value,p=l.key;if(Array.isArray(h)){const y=[],b=[];for(const x in h)h[x].id&&y.includes(h[x].id)&&o.push(new it(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),y.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new it(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat($i({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return Tl({key:p,value:h})}const mo={"*":()=>[],array:hp,boolean:function(l){const o=l.value,h=l.key,p=Cn(o);return p!=="boolean"?[new it(h,o,`boolean expected, ${p} found`)]:[]},number:wh,color:function(l){const o=l.key,h=l.value,p=Cn(h);return p!=="string"?[new it(o,h,`color expected, ${p} found`)]:Un.parse(String(h))?[]:[new it(o,h,`color expected, "${h}" found`)]},constants:Sm,enum:Wa,filter:cu,function:Em,layer:oc,object:$i,source:Cm,light:Tm,sky:Lm,terrain:sc,string:Tl,formatted:function(l){return Tl(l).length===0?[]:ja(l)},resolvedImage:function(l){return Tl(l).length===0?[]:ja(l)},padding:function(l){const o=l.key,h=l.value;if(Cn(h)==="array"){if(h.length<1||h.length>4)return[new it(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let y=[];for(let b=0;b[]}})),l.constants&&(h=h.concat(Sm({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Bs}))),hu(h)}function Vs(l){return function(o){return l({...o,validateSpec:Bs})}}function hu(l){return[].concat(l).sort((o,h)=>o.line-h.line)}function gs(l){return function(...o){return hu(l.apply(this,o))}}ms.source=gs(Vs(Cm)),ms.sprite=gs(Vs(ac)),ms.glyphs=gs(Vs(mp)),ms.light=gs(Vs(Tm)),ms.sky=gs(Vs(Lm)),ms.terrain=gs(Vs(sc)),ms.layer=gs(Vs(oc)),ms.filter=gs(Vs(cu)),ms.paintProperty=gs(Vs(pp)),ms.layoutProperty=gs(Vs(dp));const Ll=ms,o_=Ll.light,gp=Ll.paintProperty,s_=Ll.layoutProperty;function fu(l,o){let h=!1;if(o&&o.length)for(const p of o)l.fire(new Ct(new Error(p.message))),h=!0;return h}class lc{constructor(o,h,p){const y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(h=x[1])+2*(p=x[2]);for(let L=0;L=O[K+0]&&y>=O[K+1])?(I[H]=!0,x.push(N[H])):I[H]=!1}}}}_forEachCell(o,h,p,y,b,x,I,L){const A=this._convertToCellCoord(o),N=this._convertToCellCoord(h),O=this._convertToCellCoord(p),G=this._convertToCellCoord(y);for(let H=A;H<=O;H++)for(let K=N;K<=G;K++){const ee=this.d*K+H;if((!L||L(this._convertFromCellCoord(H),this._convertFromCellCoord(K),this._convertFromCellCoord(H+1),this._convertFromCellCoord(K+1)))&&b.call(this,o,h,p,y,ee,x,I,L))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,h=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=l[b];y[b]=Us[p].shallow.indexOf(b)>=0?x:pu(x,o)}l instanceof Error&&(y.message=l.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(y.$name=p),y}throw new Error("can't serialize object of type "+typeof l)}function du(l){if(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||l instanceof Error||Eh(l)||Ot(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(du);if(typeof l=="object"){const o=l.$name||"Object";if(!Us[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=Us[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(l);const p=Object.create(h.prototype);for(const y of Object.keys(l)){if(y==="$name")continue;const b=l[y];p[y]=Us[o].shallow.indexOf(y)>=0?b:du(b)}return p}throw new Error("can't deserialize object of type "+typeof l)}class Pm{constructor(){this.first=!0}update(o,h){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZooml>=128&&l<=255,Arabic:l=>l>=1536&&l<=1791,"Arabic Supplement":l=>l>=1872&&l<=1919,"Arabic Extended-A":l=>l>=2208&&l<=2303,"Hangul Jamo":l=>l>=4352&&l<=4607,"Unified Canadian Aboriginal Syllabics":l=>l>=5120&&l<=5759,Khmer:l=>l>=6016&&l<=6143,"Unified Canadian Aboriginal Syllabics Extended":l=>l>=6320&&l<=6399,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"CJK Radicals Supplement":l=>l>=11904&&l<=12031,"Kangxi Radicals":l=>l>=12032&&l<=12255,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Hiragana:l=>l>=12352&&l<=12447,Katakana:l=>l>=12448&&l<=12543,Bopomofo:l=>l>=12544&&l<=12591,"Hangul Compatibility Jamo":l=>l>=12592&&l<=12687,Kanbun:l=>l>=12688&&l<=12703,"Bopomofo Extended":l=>l>=12704&&l<=12735,"CJK Strokes":l=>l>=12736&&l<=12783,"Katakana Phonetic Extensions":l=>l>=12784&&l<=12799,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"CJK Unified Ideographs Extension A":l=>l>=13312&&l<=19903,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"CJK Unified Ideographs":l=>l>=19968&&l<=40959,"Yi Syllables":l=>l>=40960&&l<=42127,"Yi Radicals":l=>l>=42128&&l<=42191,"Hangul Jamo Extended-A":l=>l>=43360&&l<=43391,"Hangul Syllables":l=>l>=44032&&l<=55215,"Hangul Jamo Extended-B":l=>l>=55216&&l<=55295,"Private Use Area":l=>l>=57344&&l<=63743,"CJK Compatibility Ideographs":l=>l>=63744&&l<=64255,"Arabic Presentation Forms-A":l=>l>=64336&&l<=65023,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Arabic Presentation Forms-B":l=>l>=65136&&l<=65279,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function mu(l){for(const o of l)if(Ih(o.charCodeAt(0)))return!0;return!1}function Mm(l){for(const o of l)if(!Am(o.charCodeAt(0)))return!1;return!0}function Am(l){return!(_t.Arabic(l)||_t["Arabic Supplement"](l)||_t["Arabic Extended-A"](l)||_t["Arabic Presentation Forms-A"](l)||_t["Arabic Presentation Forms-B"](l))}function Ih(l){return!(l!==746&&l!==747&&(l<4352||!(_t["Bopomofo Extended"](l)||_t.Bopomofo(l)||_t["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||_t["CJK Compatibility Ideographs"](l)||_t["CJK Compatibility"](l)||_t["CJK Radicals Supplement"](l)||_t["CJK Strokes"](l)||!(!_t["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||_t["CJK Unified Ideographs Extension A"](l)||_t["CJK Unified Ideographs"](l)||_t["Enclosed CJK Letters and Months"](l)||_t["Hangul Compatibility Jamo"](l)||_t["Hangul Jamo Extended-A"](l)||_t["Hangul Jamo Extended-B"](l)||_t["Hangul Jamo"](l)||_t["Hangul Syllables"](l)||_t.Hiragana(l)||_t["Ideographic Description Characters"](l)||_t.Kanbun(l)||_t["Kangxi Radicals"](l)||_t["Katakana Phonetic Extensions"](l)||_t.Katakana(l)&&l!==12540||!(!_t["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!_t["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||_t["Unified Canadian Aboriginal Syllabics"](l)||_t["Unified Canadian Aboriginal Syllabics Extended"](l)||_t["Vertical Forms"](l)||_t["Yijing Hexagram Symbols"](l)||_t["Yi Syllables"](l)||_t["Yi Radicals"](l))))}function yp(l){return!(Ih(l)||function(o){return!!(_t["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_t["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||_t["Letterlike Symbols"](o)||_t["Number Forms"](o)||_t["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||_t["Control Pictures"](o)&&o!==9251||_t["Optical Character Recognition"](o)||_t["Enclosed Alphanumerics"](o)||_t["Geometric Shapes"](o)||_t["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_t["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_t["CJK Symbols and Punctuation"](o)||_t.Katakana(o)||_t["Private Use Area"](o)||_t["CJK Compatibility Forms"](o)||_t["Small Form Variants"](o)||_t["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(l))}function Ch(l){return l>=1424&&l<=2303||_t["Arabic Presentation Forms-A"](l)||_t["Arabic Presentation Forms-B"](l)}function km(l,o){return!(!o&&Ch(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||_t.Khmer(l))}function a_(l){for(const o of l)if(Ch(o.charCodeAt(0)))return!0;return!1}const Ha=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class ur{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 Pm,this.transition={})}isSupportedScript(o){return function(h,p){for(const y of h)if(!km(y.charCodeAt(0),p))return!1;return!0}(o,Ha.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 uc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,y){if(ph(p))return new mh(p,y);if($n(p)){const b=_m(p,y);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return y.type==="color"&&typeof p=="string"?b=Un.parse(p):y.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Qo.parse(p)):b=po.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 Th{constructor(o){this.property=o,this.value=new uc(o,void 0)}transitioned(o,h){return new Dm(this.property,this.value,h,se({},o.transition,this.transition),o.now)}untransitioned(){return new Dm(this.property,this.value,null,{},0)}}class _p{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Z(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Th(this._values[o].property)),this._values[o].value=new uc(this._values[o].property,h===null?void 0:Z(h))}getTransition(o){return Z(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Th(this._values[o].property)),this._values[o].transition=Z(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const y=this.getTransition(h);y!==void 0&&(o[`${h}-transition`]=y)}return o}transitioned(o,h){const p=new Rm(this._properties);for(const y of Object.keys(this._values))p._values[y]=this._values[y].transitioned(o,h._values[y]);return p}untransitioned(){const o=new Rm(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Dm{constructor(o,h,p,y,b){this.property=o,this.value=h,this.begin=b+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const y=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(y>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(y=1)return 1;const A=L*L,N=A*L;return 4*(L<.5?N:3*(L-A)+N-.75)}(I))}}return b}}class Rm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const y=new cc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,h,p);return y}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Nm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Z(this._values[o].value)}setValue(o,h){this._values[o]=new uc(this._values[o].property,h===null?void 0:Z(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const y=new cc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,h,p);return y}}class ys{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,y){return this.property.evaluate(this.value,this.parameters,o,h,p,y)}}class cc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class kt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const y=Qi[this.specification.type];return y?y(o,h,p):o}}class Ft{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,y){return new ys(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,y)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new ys(this,{kind:"constant",value:void 0},o.parameters);const y=Qi[this.specification.type];if(y){const b=y(o.value.value,h.value.value,p);return new ys(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,y,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,y,b,x)}}class Lh extends Ft{possiblyEvaluate(o,h,p,y){if(o.value===void 0)return new ys(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,y),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,I=this._calculate(x,x,x,h);return new ys(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 ys(this,{kind:"constant",value:b},h)}return new ys(this,o.expression,h)}evaluate(o,h,p,y,b,x){if(o.kind==="source"){const I=o.evaluate(h,p,y,b,x);return this._calculate(I,I,I,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,y),o.evaluate({zoom:Math.floor(h.zoom)},p,y),o.evaluate({zoom:Math.floor(h.zoom)+1},p,y),h):o.value}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class hc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,y);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new ur(Math.floor(h.zoom-1),h)),o.expression.evaluate(new ur(Math.floor(h.zoom),h)),o.expression.evaluate(new ur(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class vp{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){return!!o.expression.evaluate(h,null,{},p,y)}interpolate(){return!1}}class go{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const y=this.defaultPropertyValues[h]=new uc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new Th(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",Ft),St("DataConstantProperty",kt),St("CrossFadedDataDrivenProperty",Lh),St("CrossFadedProperty",hc),St("ColorRampProperty",vp);const bp="-transition";class _s extends Nn{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 Nm(h.layout)),h.paint)){this._transitionablePaint=new _p(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 cc(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(s_,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(bp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(gp,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(bp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const y=this._transitionablePaint._values[o],b=y.property.specification["property-type"]==="cross-faded-data-driven",x=y.value.isDataDriven(),I=y.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,I,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Le(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,y,b={}){return(!b||b.validate!==!1)&&fu(this,o.call(Ll,{key:h,layerType:this.type,objectKey:p,value:y,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 ys&&uu(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const Om={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class fc{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 Cr{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 jr(l,o=1){let h=0,p=0;return{members:l.map(y=>{const b=Om[y.type].BYTES_PER_ELEMENT,x=h=zm(h,Math.max(o,b)),I=y.components||1;return p=Math.max(p,b),h+=b*I,{name:y.name,type:y.type,components:I,offset:x}}),size:zm(h,Math.max(p,o)),alignment:o}}function zm(l,o){return Math.ceil(l/o)*o}class pc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.int16[y+0]=h,this.int16[y+1]=p,o}}pc.prototype.bytesPerElement=4,St("StructArrayLayout2i4",pc);class ya extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=y,o}}ya.prototype.bytesPerElement=6,St("StructArrayLayout3i6",ya);class xp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=y,this.int16[x+3]=b,o}}xp.prototype.bytesPerElement=8,St("StructArrayLayout4i8",xp);class wp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,I){const L=6*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=I,o}}wp.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",wp);class Sp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,I){const L=4*o,A=8*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.uint8[A+4]=y,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=I,o}}Sp.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",Sp);class dc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.float32[y+0]=h,this.float32[y+1]=p,o}}dc.prototype.bytesPerElement=8,St("StructArrayLayout2f8",dc);class Ph extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,y,b,x,I,L,A,N)}emplace(o,h,p,y,b,x,I,L,A,N,O){const G=10*o;return this.uint16[G+0]=h,this.uint16[G+1]=p,this.uint16[G+2]=y,this.uint16[G+3]=b,this.uint16[G+4]=x,this.uint16[G+5]=I,this.uint16[G+6]=L,this.uint16[G+7]=A,this.uint16[G+8]=N,this.uint16[G+9]=O,o}}Ph.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",Ph);class Ep extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N,O,G){const H=this.length;return this.resize(H+1),this.emplace(H,o,h,p,y,b,x,I,L,A,N,O,G)}emplace(o,h,p,y,b,x,I,L,A,N,O,G,H){const K=12*o;return this.int16[K+0]=h,this.int16[K+1]=p,this.int16[K+2]=y,this.int16[K+3]=b,this.uint16[K+4]=x,this.uint16[K+5]=I,this.uint16[K+6]=L,this.uint16[K+7]=A,this.int16[K+8]=N,this.int16[K+9]=O,this.int16[K+10]=G,this.int16[K+11]=H,o}}Ep.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",Ep);class Ip extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=y,o}}Ip.prototype.bytesPerElement=12,St("StructArrayLayout3f12",Ip);class _a extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}_a.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",_a);class Mh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,y,b,x,I,L,A)}emplace(o,h,p,y,b,x,I,L,A,N){const O=10*o,G=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=y,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=I,this.uint32[G+3]=L,this.uint16[O+8]=A,this.uint16[O+9]=N,o}}Mh.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",Mh);class mc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,I){const L=6*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=I,o}}mc.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",mc);class Ah extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,y,b)}emplace(o,h,p,y,b,x){const I=4*o,L=8*o;return this.float32[I+0]=h,this.float32[I+1]=p,this.float32[I+2]=y,this.int16[L+6]=b,this.int16[L+7]=x,o}}Ah.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ah);class gc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=12*o,I=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[I+1]=y,this.float32[I+2]=b,o}}gc.prototype.bytesPerElement=12,St("StructArrayLayout2ub2f12",gc);class kh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=y,o}}kh.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",kh);class gu extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee,ae,pe){const Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee,ae,pe)}emplace(o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee,ae,pe,Ae){const ye=24*o,Ie=12*o,Ye=48*o;return this.int16[ye+0]=h,this.int16[ye+1]=p,this.uint16[ye+2]=y,this.uint16[ye+3]=b,this.uint32[Ie+2]=x,this.uint32[Ie+3]=I,this.uint32[Ie+4]=L,this.uint16[ye+10]=A,this.uint16[ye+11]=N,this.uint16[ye+12]=O,this.float32[Ie+7]=G,this.float32[Ie+8]=H,this.uint8[Ye+36]=K,this.uint8[Ye+37]=ee,this.uint8[Ye+38]=ae,this.uint32[Ie+10]=pe,this.int16[ye+22]=Ae,o}}gu.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",gu);class Pl extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee,ae,pe,Ae,ye,Ie,Ye,Je,bt,Tt,vt,gt,ct,Et){const dt=this.length;return this.resize(dt+1),this.emplace(dt,o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee,ae,pe,Ae,ye,Ie,Ye,Je,bt,Tt,vt,gt,ct,Et)}emplace(o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee,ae,pe,Ae,ye,Ie,Ye,Je,bt,Tt,vt,gt,ct,Et,dt){const nt=32*o,zt=16*o;return this.int16[nt+0]=h,this.int16[nt+1]=p,this.int16[nt+2]=y,this.int16[nt+3]=b,this.int16[nt+4]=x,this.int16[nt+5]=I,this.int16[nt+6]=L,this.int16[nt+7]=A,this.uint16[nt+8]=N,this.uint16[nt+9]=O,this.uint16[nt+10]=G,this.uint16[nt+11]=H,this.uint16[nt+12]=K,this.uint16[nt+13]=ee,this.uint16[nt+14]=ae,this.uint16[nt+15]=pe,this.uint16[nt+16]=Ae,this.uint16[nt+17]=ye,this.uint16[nt+18]=Ie,this.uint16[nt+19]=Ye,this.uint16[nt+20]=Je,this.uint16[nt+21]=bt,this.uint16[nt+22]=Tt,this.uint32[zt+12]=vt,this.float32[zt+13]=gt,this.float32[zt+14]=ct,this.uint16[nt+30]=Et,this.uint16[nt+31]=dt,o}}Pl.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",Pl);class Dh extends Cr{_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}}Dh.prototype.bytesPerElement=4,St("StructArrayLayout1f4",Dh);class Rh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=y,o}}Rh.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",Rh);class Ml extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=y,o}}Ml.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",Ml);class Cp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.uint16[y+0]=h,this.uint16[y+1]=p,o}}Cp.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",Cp);class Tp extends Cr{_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}}Tp.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Tp);class Nh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=y,this.float32[x+3]=b,o}}Nh.prototype.bytesPerElement=16,St("StructArrayLayout4f16",Nh);class Fm extends fc{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)}}Fm.prototype.size=20;class _ extends Mh{get(o){return new Fm(this,o)}}St("CollisionBoxArray",_);class s extends fc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends gu{get(o){return new s(this,o)}}St("PlacedSymbolArray",f);class d extends fc{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 Pl{get(o){return new d(this,o)}}St("SymbolInstanceArray",g);class v extends Dh{getoffsetX(o){return this.float32[1*o+0]}}St("GlyphOffsetArray",v);class C extends ya{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}St("SymbolLineVertexArray",C);class T extends fc{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}T.prototype.size=12;class M extends Rh{get(o){return new T(this,o)}}St("TextAnchorOffsetArray",M);class R extends fc{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 Ml{get(o){return new R(this,o)}}St("FeatureIndexArray",z);class F extends pc{}class X extends pc{}class ie extends pc{}class re extends wp{}class ue extends Sp{}class $ extends dc{}class ve extends Ph{}class Fe extends Ep{}class he extends Ip{}class Ce extends _a{}class Be extends mc{}class Ge extends gc{}class He extends kh{}class et extends Cp{}const $e=jr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ut}=$e;class ft{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,y){let b=this.segments[this.segments.length-1];return o>ft.MAX_VERTEX_ARRAY_LENGTH&&Ke(`Max vertices per segment is ${ft.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>ft.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==y)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},y!==void 0&&(b.sortKey=y),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,y){return new ft([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:y,vaos:{},sortKey:0}])}}function nn(l,o){return 256*(l=oe(Math.floor(l),0,255))+oe(Math.floor(o),0,255)}ft.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",ft);const pt=jr([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Bt={exports:{}},rn={exports:{}};rn.exports=function(l,o){var h,p,y,b,x,I,L,A;for(p=l.length-(h=3&l.length),y=o,x=3432918353,I=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*I+(((L>>>16)*I&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,h){case 3:L^=(255&l.charCodeAt(A+2))<<16;case 2:L^=(255&l.charCodeAt(A+1))<<8;case 1:y^=L=(65535&(L=(L=(65535&(L^=255&l.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*I+(((L>>>16)*I&65535)<<16)&4294967295}return y^=l.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var Sn=rn.exports,jt={exports:{}};jt.exports=function(l,o){for(var h,p=l.length,y=o^p,b=0;p>=4;)h=1540483477*(65535&(h=255&l.charCodeAt(b)|(255&l.charCodeAt(++b))<<8|(255&l.charCodeAt(++b))<<16|(255&l.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:y^=(255&l.charCodeAt(b+2))<<16;case 2:y^=(255&l.charCodeAt(b+1))<<8;case 1:y=1540483477*(65535&(y^=255&l.charCodeAt(b)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var an=Sn,fn=jt.exports;Bt.exports=an,Bt.exports.murmur3=an,Bt.exports.murmur2=fn;var Tr=m(Bt.exports);class qn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,y){this.ids.push(Ro(o)),this.positions.push(h,p,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=Ro(o);let p=0,y=this.ids.length-1;for(;p>1;this.ids[x]>=h?y=x:p=x+1}const b=[];for(;this.ids[p]===h;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,h){const p=new Float64Array(o.ids),y=new Uint32Array(o.positions);return ui(p,y,0,p.length-1),h&&h.push(p.buffer,y.buffer),{ids:p,positions:y}}static deserialize(o){const h=new qn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function Ro(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Tr(String(l))}function ui(l,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(l[b]y);if(b>=x)break;gr(l,b,x),gr(o,3*b,3*x),gr(o,3*b+1,3*x+1),gr(o,3*b+2,3*x+2)}x-h`u_${y}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new Za(o,h):new No(o,h)}}class ei{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,y){const b=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Gs(o,h):new No(o,h)}}class yr{constructor(o,h,p,y){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,h,p,y,b){const x=this.paintVertexArray.length,I=this.expression.evaluate(new ur(0),h,{},y,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,I)}updatePaintArray(o,h,p,y){const b=this.expression.evaluate({zoom:0},p,y);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const y=Xa(p);for(let b=o;b`u_${I}_t`),this.type=p,this.useIntegerZoom=y,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,y,b){const x=this.expression.evaluate(new ur(this.zoom),h,{},y,[],b),I=this.expression.evaluate(new ur(this.zoom+1),h,{},y,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,I)}updatePaintArray(o,h,p,y){const b=this.expression.evaluate({zoom:this.zoom},p,y),x=this.expression.evaluate({zoom:this.zoom+1},p,y);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,y){if(this.type==="color"){const b=Xa(p),x=Xa(y);for(let I=o;I`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof yr||p instanceof cr)for(let y=0;y!0){this.programConfigurations={};for(const y of o)this.programConfigurations[y.id]=new ti(y,h,p);this.needsUpload=!1,this._featureMap=new qn,this._bufferOffset=0}populatePaintArrays(o,h,p,y,b,x){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(o,h,y,b,x);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,y){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,y)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function ts(l,o){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[l]||[l.replace(`${o}-`,"").replace(/-/g,"_")]}function ni(l,o,h){const p={color:{source:dc,composite:Nh},number:{source:Dh,composite:dc}},y=function(b){return{"line-pattern":{source:ve,composite:ve},"fill-pattern":{source:ve,composite:ve},"fill-extrusion-pattern":{source:ve,composite:ve}}[b]}(l);return y&&y[h]||p[o][h]}St("ConstantBinder",qs),St("CrossFadedConstantBinder",ei),St("SourceExpressionBinder",yr),St("CrossFadedCompositeBinder",es),St("CompositeExpressionBinder",cr),St("ProgramConfiguration",ti,{omit:["_buffers"]}),St("ProgramConfigurationSet",_r);const Nr=8192,Lp=Math.pow(2,14)-1,Bm=-Lp-1;function Al(l){const o=Nr/l.extent,h=l.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Ke("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function kl(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?Al(l):[]}}function Oh(l,o,h,p,y){l.emplaceBack(2*o+(p+1)/2,2*h+(y+1)/2)}class Ya{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new X,this.indexArray=new He,this.segments=new ft,this.programConfigurations=new _r(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const y=this.layers[0],b=[];let x=null,I=!1;y.type==="circle"&&(x=y.layout.get("circle-sort-key"),I=!x.isConstant());for(const{feature:L,id:A,index:N,sourceLayerIndex:O}of o){const G=this.layers[0]._featureFilter.needGeometry,H=kl(L,G);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),H,p))continue;const K=I?x.evaluate(H,{},p):void 0,ee={id:A,properties:L.properties,type:L.type,sourceLayerIndex:O,index:N,geometry:G?H.geometry:Al(L),patterns:{},sortKey:K};b.push(ee)}I&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:N,sourceLayerIndex:O}=L,G=o[N].feature;this.addFeature(L,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,y){for(const b of h)for(const x of b){const I=x.x,L=x.y;if(I<0||I>=Nr||L<0||L>=Nr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),N=A.vertexLength;Oh(this.layoutVertexArray,I,L,-1,-1),Oh(this.layoutVertexArray,I,L,1,-1),Oh(this.layoutVertexArray,I,L,1,1),Oh(this.layoutVertexArray,I,L,-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,{},y)}}function Pp(l,o){for(let h=0;h1){if(zh(l,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(y)._add(o))}function T1(l,o){let h,p,y,b=!1;for(let x=0;xo.y!=y.y>o.y&&o.x<(y.x-p.x)*(o.y-p.y)/(y.y-p.y)+p.x&&(b=!b)}return b}function Fh(l,o){let h=!1;for(let p=0,y=l.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(h=!h)}return h}function JC(l,o,h){const p=h[0],y=h[2];if(l.xy.x&&o.x>y.x||l.yy.y&&o.y>y.y)return!1;const b=Ee(l,o,h[0]);return b!==Ee(l,o,h[1])||b!==Ee(l,o,h[2])||b!==Ee(l,o,h[3])}function Dp(l,o,h){const p=o.paint.get(l).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(l)}function Um(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function Gm(l,o,h,p,y){if(!o[0]&&!o[1])return l;const b=E.convert(o)._mult(y);h==="viewport"&&b._rotate(-p);const x=[];for(let I=0;IA1(ae,ee))}(A,L),H=O?N*I:N;for(const K of y)for(const ee of K){const ae=O?ee:A1(ee,L);let pe=H;const Ae=qm([],[ee.x,ee.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pe*=Ae[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pe*=x.cameraToCenterDistance/Ae[3]),Vm(G,ae,pe))return!0}return!1}}function A1(l,o){const h=qm([],[l.x,l.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class k1 extends Ya{}let D1;St("HeatmapBucket",k1,{omit:["layers"]});var tT={get paint(){return D1=D1||new go({"heatmap-radius":new Ft(Oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ft(Oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new kt(Oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new vp(Oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new kt(Oe.paint_heatmap["heatmap-opacity"])})}};function c_(l,{width:o,height:h},p,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*h*p}`)}else y=new Uint8Array(o*h*p);return l.width=o,l.height=h,l.data=y,l}function R1(l,{width:o,height:h},p){if(o===l.width&&h===l.height)return;const y=c_({},{width:o,height:h},p);h_(l,y,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,h)},p),l.width=o,l.height=h,l.data=y.data}function h_(l,o,h,p,y,b){if(y.width===0||y.height===0)return o;if(y.width>l.width||y.height>l.height||h.x>l.width-y.width||h.y>l.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||p.x>o.width-y.width||p.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const x=l.data,I=o.data;if(x===I)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[l.evaluationKey]=L;const A=l.expression.evaluate(o);y.data[x+I+0]=Math.floor(255*A.r/A.a),y.data[x+I+1]=Math.floor(255*A.g/A.a),y.data[x+I+2]=Math.floor(255*A.b/A.a),y.data[x+I+3]=Math.floor(255*A.a)};if(l.clips)for(let x=0,I=0;x80*h){p=b=l[0],y=x=l[1];for(var K=h;Kb&&(b=I),L>x&&(x=L);A=(A=Math.max(b-p,x-y))!==0?32767/A:0}return Op(G,H,h,p,y,A,0),H}function z1(l,o,h,p,y){var b,x;if(y===m_(l,o,h,p)>0)for(b=o;b=o;b-=p)x=V1(b,l[b],l[b+1],x);return x&&Wm(x,x.next)&&(Fp(x),x=x.next),x}function _c(l,o){if(!l)return l;o||(o=l);var h,p=l;do if(h=!1,p.steiner||!Wm(p,p.next)&&Wr(p.prev,p,p.next)!==0)p=p.next;else{if(Fp(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function Op(l,o,h,p,y,b,x){if(l){!x&&b&&function(N,O,G,H){var K=N;do K.z===0&&(K.z=p_(K.x,K.y,O,G,H)),K.prevZ=K.prev,K.nextZ=K.next,K=K.next;while(K!==N);K.prevZ.nextZ=null,K.prevZ=null,function(ee){var ae,pe,Ae,ye,Ie,Ye,Je,bt,Tt=1;do{for(pe=ee,ee=null,Ie=null,Ye=0;pe;){for(Ye++,Ae=pe,Je=0,ae=0;ae0||bt>0&&Ae;)Je!==0&&(bt===0||!Ae||pe.z<=Ae.z)?(ye=pe,pe=pe.nextZ,Je--):(ye=Ae,Ae=Ae.nextZ,bt--),Ie?Ie.nextZ=ye:ee=ye,ye.prevZ=Ie,Ie=ye;pe=Ae}Ie.nextZ=null,Tt*=2}while(Ye>1)}(K)}(l,p,y,b);for(var I,L,A=l;l.prev!==l.next;)if(I=l.prev,L=l.next,b?lT(l,p,y,b):aT(l))o.push(I.i/h|0),o.push(l.i/h|0),o.push(L.i/h|0),Fp(l),l=L.next,A=L.next;else if((l=L)===A){x?x===1?Op(l=uT(_c(l),o,h),o,h,p,y,b,2):x===2&&cT(l,o,h,p,y,b):Op(_c(l),o,h,p,y,b,1);break}}}function aT(l){var o=l.prev,h=l,p=l.next;if(Wr(o,h,p)>=0)return!1;for(var y=o.x,b=h.x,x=p.x,I=o.y,L=h.y,A=p.y,N=yb?y>x?y:x:b>x?b:x,H=I>L?I>A?I:A:L>A?L:A,K=p.next;K!==o;){if(K.x>=N&&K.x<=G&&K.y>=O&&K.y<=H&&Vh(y,I,b,L,x,A,K.x,K.y)&&Wr(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function lT(l,o,h,p){var y=l.prev,b=l,x=l.next;if(Wr(y,b,x)>=0)return!1;for(var I=y.x,L=b.x,A=x.x,N=y.y,O=b.y,G=x.y,H=IL?I>A?I:A:L>A?L:A,ae=N>O?N>G?N:G:O>G?O:G,pe=p_(H,K,o,h,p),Ae=p_(ee,ae,o,h,p),ye=l.prevZ,Ie=l.nextZ;ye&&ye.z>=pe&&Ie&&Ie.z<=Ae;){if(ye.x>=H&&ye.x<=ee&&ye.y>=K&&ye.y<=ae&&ye!==y&&ye!==x&&Vh(I,N,L,O,A,G,ye.x,ye.y)&&Wr(ye.prev,ye,ye.next)>=0||(ye=ye.prevZ,Ie.x>=H&&Ie.x<=ee&&Ie.y>=K&&Ie.y<=ae&&Ie!==y&&Ie!==x&&Vh(I,N,L,O,A,G,Ie.x,Ie.y)&&Wr(Ie.prev,Ie,Ie.next)>=0))return!1;Ie=Ie.nextZ}for(;ye&&ye.z>=pe;){if(ye.x>=H&&ye.x<=ee&&ye.y>=K&&ye.y<=ae&&ye!==y&&ye!==x&&Vh(I,N,L,O,A,G,ye.x,ye.y)&&Wr(ye.prev,ye,ye.next)>=0)return!1;ye=ye.prevZ}for(;Ie&&Ie.z<=Ae;){if(Ie.x>=H&&Ie.x<=ee&&Ie.y>=K&&Ie.y<=ae&&Ie!==y&&Ie!==x&&Vh(I,N,L,O,A,G,Ie.x,Ie.y)&&Wr(Ie.prev,Ie,Ie.next)>=0)return!1;Ie=Ie.nextZ}return!0}function uT(l,o,h){var p=l;do{var y=p.prev,b=p.next.next;!Wm(y,b)&&F1(y,p,p.next,b)&&zp(y,b)&&zp(b,y)&&(o.push(y.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),Fp(p),Fp(p.next),p=l=b),p=p.next}while(p!==l);return _c(p)}function cT(l,o,h,p,y,b){var x=l;do{for(var I=x.next.next;I!==x.prev;){if(x.i!==I.i&&mT(x,I)){var L=B1(x,I);return x=_c(x,x.next),L=_c(L,L.next),Op(x,o,h,p,y,b,0),void Op(L,o,h,p,y,b,0)}I=I.next}x=x.next}while(x!==l)}function hT(l,o){return l.x-o.x}function fT(l,o){var h=function(y,b){var x,I=b,L=y.x,A=y.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<=L&&O>N&&(N=O,x=I.x=I.x&&I.x>=K&&L!==I.x&&Vh(Ax.x||I.x===x.x&&pT(x,I)))&&(x=I,ae=G)),I=I.next;while(I!==H);return x}(l,o);if(!h)return o;var p=B1(h,l);return _c(p,p.next),_c(h,h.next)}function pT(l,o){return Wr(l.prev,l,o.prev)<0&&Wr(o.next,l,l.next)<0}function p_(l,o,h,p,y){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-h)*y|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function dT(l){var o=l,h=l;do(o.x=(l-x)*(b-I)&&(l-x)*(p-I)>=(h-x)*(o-I)&&(h-x)*(b-I)>=(y-x)*(p-I)}function mT(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(h,p){var y=h;do{if(y.i!==h.i&&y.next.i!==h.i&&y.i!==p.i&&y.next.i!==p.i&&F1(y,y.next,h,p))return!0;y=y.next}while(y!==h);return!1}(l,o)&&(zp(l,o)&&zp(o,l)&&function(h,p){var y=h,b=!1,x=(h.x+p.x)/2,I=(h.y+p.y)/2;do y.y>I!=y.next.y>I&&y.next.y!==y.y&&x<(y.next.x-y.x)*(I-y.y)/(y.next.y-y.y)+y.x&&(b=!b),y=y.next;while(y!==h);return b}(l,o)&&(Wr(l.prev,l,o.prev)||Wr(l,o.prev,o))||Wm(l,o)&&Wr(l.prev,l,l.next)>0&&Wr(o.prev,o,o.next)>0)}function Wr(l,o,h){return(o.y-l.y)*(h.x-o.x)-(o.x-l.x)*(h.y-o.y)}function Wm(l,o){return l.x===o.x&&l.y===o.y}function F1(l,o,h,p){var y=Zm(Wr(l,o,h)),b=Zm(Wr(l,o,p)),x=Zm(Wr(h,p,l)),I=Zm(Wr(h,p,o));return y!==b&&x!==I||!(y!==0||!Hm(l,h,o))||!(b!==0||!Hm(l,p,o))||!(x!==0||!Hm(h,l,p))||!(I!==0||!Hm(h,o,p))}function Hm(l,o,h){return o.x<=Math.max(l.x,h.x)&&o.x>=Math.min(l.x,h.x)&&o.y<=Math.max(l.y,h.y)&&o.y>=Math.min(l.y,h.y)}function Zm(l){return l>0?1:l<0?-1:0}function zp(l,o){return Wr(l.prev,l,l.next)<0?Wr(l,o,l.next)>=0&&Wr(l,l.prev,o)>=0:Wr(l,o,l.prev)<0||Wr(l,l.next,o)<0}function B1(l,o){var h=new d_(l.i,l.x,l.y),p=new d_(o.i,o.x,o.y),y=l.next,b=o.prev;return l.next=o,o.prev=l,h.next=y,y.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function V1(l,o,h,p){var y=new d_(l,o,h);return p?(y.next=p.next,y.prev=p,p.next.prev=y,p.next=y):(y.prev=y,y.next=y),y}function Fp(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function d_(l,o,h){this.i=l,this.x=o,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function m_(l,o,h,p){for(var y=0,b=o,x=h-p;b0&&h.holes.push(p+=l[y-1].length)}return h};var U1=m(f_.exports);function gT(l,o,h,p,y){G1(l,o,h||0,p||l.length-1,y||yT)}function G1(l,o,h,p,y){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,I=Math.log(b),L=.5*Math.exp(2*I/3),A=.5*Math.sqrt(I*L*(b-L)/b)*(x-b/2<0?-1:1);G1(l,o,Math.max(h,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),y)}var N=l[o],O=h,G=p;for(Bp(l,h,o),y(l[p],N)>0&&Bp(l,h,p);O0;)G--}y(l[h],N)===0?Bp(l,h,G):Bp(l,++G,p),G<=o&&(h=G+1),o<=G&&(p=G-1)}}function Bp(l,o,h){var p=l[o];l[o]=l[h],l[h]=p}function yT(l,o){return lo?1:0}function g_(l,o){const h=l.length;if(h<=1)return[l];const p=[];let y,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ie,this.indexArray=new He,this.indexArray2=new et,this.programConfigurations=new _r(o.layers,o.zoom),this.segments=new ft,this.segments2=new ft,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=y_("fill",this.layers,h);const y=this.layers[0].layout.get("fill-sort-key"),b=!y.isConstant(),x=[];for(const{feature:I,id:L,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=kl(I,O);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),G,p))continue;const H=b?y.evaluate(G,{},p,h.availableImages):void 0,K={id:L,properties:I.properties,type:I.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Al(I),patterns:{},sortKey:H};x.push(K)}b&&x.sort((I,L)=>I.sortKey-L.sortKey);for(const I of x){const{geometry:L,index:A,sourceLayerIndex:N}=I;if(this.hasPattern){const O=__("fill",this.layers,I,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(I,L,A,p,{});h.featureIndex.insert(o[A].feature,L,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 y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,sT),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,h,p,y,b){for(const x of g_(h,500)){let I=0;for(const H of x)I+=H.length;const L=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),A=L.vertexLength,N=[],O=[];for(const H of x){if(H.length===0)continue;H!==x[0]&&O.push(N.length/2);const K=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),ee=K.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(ee+H.length-1,ee),N.push(H[0].x),N.push(H[0].y);for(let ae=1;ae>3}if(y--,p===1||p===2)b+=l.readSVarint(),x+=l.readSVarint(),p===1&&(o&&I.push(o),o=[]),o.push(new ET(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&I.push(o),I},Uh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,h=1,p=0,y=0,b=0,x=1/0,I=-1/0,L=1/0,A=-1/0;l.pos>3}if(p--,h===1||h===2)(y+=l.readSVarint())I&&(I=y),(b+=l.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,L,I,A]},Uh.prototype.toGeoJSON=function(l,o,h){var p,y,b=this.extent*Math.pow(2,h),x=this.extent*l,I=this.extent*o,L=this.loadGeometry(),A=Uh.types[this.type];function N(H){for(var K=0;K>3;y=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return y}(h))}Z1.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var o=this._pbf.readVarint()+this._pbf.pos;return new TT(this._pbf,o,this.extent,this._keys,this._values)};var PT=H1;function MT(l,o,h){if(l===3){var p=new PT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}yu.VectorTile=function(l,o){this.layers=l.readFields(MT,{},o)},yu.VectorTileFeature=W1,yu.VectorTileLayer=H1;const AT=yu.VectorTileFeature.types,b_=Math.pow(2,13);function Vp(l,o,h,p,y,b,x,I){l.emplaceBack(o,h,2*Math.floor(p*b_)+x,y*b_*2,b*b_*2,Math.round(I))}class x_{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 re,this.centroidVertexArray=new F,this.indexArray=new He,this.programConfigurations=new _r(o.layers,o.zoom),this.segments=new ft,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=y_("fill-extrusion",this.layers,h);for(const{feature:y,id:b,index:x,sourceLayerIndex:I}of o){const L=this.layers[0]._featureFilter.needGeometry,A=kl(y,L);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),A,p))continue;const N={id:b,sourceLayerIndex:I,index:x,geometry:L?A.geometry:Al(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(__("fill-extrusion",this.layers,N,this.zoom,h)):this.addFeature(N,N.geometry,x,p,{}),h.featureIndex.insert(y,N.geometry,x,I,this.index,!0)}}addFeatures(o,h,p){for(const y of this.features){const{geometry:b}=y;this.addFeature(y,b,y.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,ST),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,wT.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,h,p,y,b){const x={x:0,y:0,vertexCount:0};for(const I of g_(h,500)){let L=0;for(const K of I)L+=K.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of I){if(K.length===0||DT(K))continue;let ee=0;for(let ae=0;ae=1){const Ae=K[ae-1];if(!kT(pe,Ae)){A.vertexLength+4>ft.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ye=pe.sub(Ae)._perp()._unit(),Ie=Ae.dist(pe);ee+Ie>32768&&(ee=0),Vp(this.layoutVertexArray,pe.x,pe.y,ye.x,ye.y,0,0,ee),Vp(this.layoutVertexArray,pe.x,pe.y,ye.x,ye.y,0,1,ee),x.x+=2*pe.x,x.y+=2*pe.y,x.vertexCount+=2,ee+=Ie,Vp(this.layoutVertexArray,Ae.x,Ae.y,ye.x,ye.y,0,0,ee),Vp(this.layoutVertexArray,Ae.x,Ae.y,ye.x,ye.y,0,1,ee),x.x+=2*Ae.x,x.y+=2*Ae.y,x.vertexCount+=2;const Ye=A.vertexLength;this.indexArray.emplaceBack(Ye,Ye+2,Ye+1),this.indexArray.emplaceBack(Ye+1,Ye+2,Ye+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>ft.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),AT[o.type]!=="Polygon")continue;const N=[],O=[],G=A.vertexLength;for(const K of I)if(K.length!==0){K!==I[0]&&O.push(N.length/2);for(let ee=0;eeNr)||l.y===o.y&&(l.y<0||l.y>Nr)}function DT(l){return l.every(o=>o.x<0)||l.every(o=>o.x>Nr)||l.every(o=>o.y<0)||l.every(o=>o.y>Nr)}let X1;St("FillExtrusionBucket",x_,{omit:["layers","features"]});var RT={get paint(){return X1=X1||new go({"fill-extrusion-opacity":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ft(Oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Lh(Oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ft(Oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ft(Oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class NT extends _s{constructor(o){super(o,RT)}createBucket(o){return new x_(o)}queryRadius(){return Um(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,y,b,x,I,L){const A=Gm(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(K,ee,ae,pe){const Ae=[];for(const ye of K){const Ie=[ye.x,ye.y,0,1];qm(Ie,Ie,ee),Ae.push(new E(Ie[0]/Ie[3],Ie[1]/Ie[3]))}return Ae}(A,L),H=function(K,ee,ae,pe){const Ae=[],ye=[],Ie=pe[8]*ee,Ye=pe[9]*ee,Je=pe[10]*ee,bt=pe[11]*ee,Tt=pe[8]*ae,vt=pe[9]*ae,gt=pe[10]*ae,ct=pe[11]*ae;for(const Et of K){const dt=[],nt=[];for(const zt of Et){const Mt=zt.x,pn=zt.y,ir=pe[0]*Mt+pe[4]*pn+pe[12],hr=pe[1]*Mt+pe[5]*pn+pe[13],fi=pe[2]*Mt+pe[6]*pn+pe[14],ns=pe[3]*Mt+pe[7]*pn+pe[15],_o=fi+Je,ri=ns+bt,Mi=ir+Tt,Fi=hr+vt,vo=fi+gt,bo=ns+ct,pi=new E((ir+Ie)/ri,(hr+Ye)/ri);pi.z=_o/ri,dt.push(pi);const di=new E(Mi/bo,Fi/bo);di.z=vo/bo,nt.push(di)}Ae.push(dt),ye.push(nt)}return[Ae,ye]}(y,O,N,L);return function(K,ee,ae){let pe=1/0;Mp(ae,ee)&&(pe=Y1(ae,ee[0]));for(let Ae=0;Aeh.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 ue,this.layoutVertexArray2=new $,this.indexArray=new He,this.programConfigurations=new _r(o.layers,o.zoom),this.segments=new ft,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=y_("line",this.layers,h);const y=this.layers[0].layout.get("line-sort-key"),b=!y.isConstant(),x=[];for(const{feature:I,id:L,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=kl(I,O);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),G,p))continue;const H=b?y.evaluate(G,{},p):void 0,K={id:L,properties:I.properties,type:I.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Al(I),patterns:{},sortKey:H};x.push(K)}b&&x.sort((I,L)=>I.sortKey-L.sortKey);for(const I of x){const{geometry:L,index:A,sourceLayerIndex:N}=I;if(this.hasPattern){const O=__("line",this.layers,I,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(I,L,A,p,{});h.featureIndex.insert(o[A].feature,L,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 y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,BT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,zT),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,h,p,y,b){const x=this.layers[0].layout,I=x.get("line-join").evaluate(o,{}),L=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,L,A,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,y)}addLine(o,h,p,y,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pe=0;pe=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(bt&&pe>A){const ct=G.dist(H);if(ct>2*N){const Et=G.sub(G.sub(H)._mult(N/ct)._round());this.updateDistance(H,Et),this.addCurrentVertex(Et,ee,0,0,O),H=Et}}const vt=H&&K;let gt=vt?p:I?"butt":y;if(vt&>==="round"&&(Yeb&&(gt="bevel"),gt==="bevel"&&(Ye>2&&(gt="flipbevel"),Ye100)Ae=ae.mult(-1);else{const ct=Ye*ee.add(ae).mag()/ee.sub(ae).mag();Ae._perp()._mult(ct*(Tt?-1:1))}this.addCurrentVertex(G,Ae,0,0,O),this.addCurrentVertex(G,Ae.mult(-1),0,0,O)}else if(gt==="bevel"||gt==="fakeround"){const ct=-Math.sqrt(Ye*Ye-1),Et=Tt?ct:0,dt=Tt?0:ct;if(H&&this.addCurrentVertex(G,ee,Et,dt,O),gt==="fakeround"){const nt=Math.round(180*Je/Math.PI/20);for(let zt=1;zt2*N){const Et=G.add(K.sub(G)._mult(N/ct)._round());this.updateDistance(G,Et),this.addCurrentVertex(Et,ae,0,0,O),G=Et}}}}addCurrentVertex(o,h,p,y,b,x=!1){const I=h.y*y-h.x,L=-h.y-h.x*y;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,I,L,x,!0,-y,b),this.distance>K1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,y,b,x))}addHalfVertex({x:o,y:h},p,y,b,x,I,L){const A=.5*(this.lineClips?this.scaledDistance*(K1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*y)+128,1+(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=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),L.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 J1,Q1;St("LineBucket",w_,{omit:["layers","patternFeatures"]});var $1={get paint(){return Q1=Q1||new go({"line-opacity":new Ft(Oe.paint_line["line-opacity"]),"line-color":new Ft(Oe.paint_line["line-color"]),"line-translate":new kt(Oe.paint_line["line-translate"]),"line-translate-anchor":new kt(Oe.paint_line["line-translate-anchor"]),"line-width":new Ft(Oe.paint_line["line-width"]),"line-gap-width":new Ft(Oe.paint_line["line-gap-width"]),"line-offset":new Ft(Oe.paint_line["line-offset"]),"line-blur":new Ft(Oe.paint_line["line-blur"]),"line-dasharray":new hc(Oe.paint_line["line-dasharray"]),"line-pattern":new Lh(Oe.paint_line["line-pattern"]),"line-gradient":new vp(Oe.paint_line["line-gradient"])})},get layout(){return J1=J1||new go({"line-cap":new kt(Oe.layout_line["line-cap"]),"line-join":new Ft(Oe.layout_line["line-join"]),"line-miter-limit":new kt(Oe.layout_line["line-miter-limit"]),"line-round-limit":new kt(Oe.layout_line["line-round-limit"]),"line-sort-key":new Ft(Oe.layout_line["line-sort-key"])})}};class GT extends Ft{possiblyEvaluate(o,h){return h=new ur(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,y){return h=se({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,y)}}let Xm;class qT extends _s{constructor(o){super(o,$1),this.gradientVersion=0,Xm||(Xm=new GT($1.paint.properties["line-width"].specification),Xm.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 rc,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"]=Xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new w_(o)}queryRadius(o){const h=o,p=eb(Dp("line-width",this,h),Dp("line-gap-width",this,h)),y=Dp("line-offset",this,h);return p/2+Math.abs(y)+Um(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,y,b,x,I){const L=Gm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,I),A=I/2*eb(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&&(y=function(O,G){const H=[];for(let K=0;K=3){for(let ae=0;ae0?o+2*l:l}const jT=jr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),WT=jr([{name:"a_projected_pos",components:3,type:"Float32"}],4);jr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const HT=jr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);jr([{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 tb=jr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ZT=jr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function XT(l,o,h){return l.sections.forEach(p=>{p.text=function(y,b,x){const I=b.layout.get("text-transform").evaluate(x,{});return I==="uppercase"?y=y.toLocaleUpperCase():I==="lowercase"&&(y=y.toLocaleLowerCase()),Ha.applyArabicShaping&&(y=Ha.applyArabicShaping(y)),y}(p.text,o,h)}),l}jr([{name:"triangle",components:3,type:"Uint16"}]),jr([{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"}]),jr([{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"}]),jr([{type:"Float32",name:"offsetX"}]),jr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),jr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Gp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hi=24,nb=Yn,rb=function(l,o,h,p,y){var b,x,I=8*y-p-1,L=(1<>1,N=-7,O=h?y-1:0,G=h?-1:1,H=l[o+O];for(O+=G,b=H&(1<<-N)-1,H>>=-N,N+=I;N>0;b=256*b+l[o+O],O+=G,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=p;N>0;x=256*x+l[o+O],O+=G,N-=8);if(b===0)b=1-A;else{if(b===L)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)},ib=function(l,o,h,p,y,b){var x,I,L,A=8*b-y-1,N=(1<>1,G=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=p?0:b-1,K=p?1:-1,ee=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*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+O>=1?G/L:G*Math.pow(2,1-O))*L>=2&&(x++,L/=2),x+O>=N?(I=0,x=N):x+O>=1?(I=(o*L-1)*Math.pow(2,y),x+=O):(I=o*Math.pow(2,O-1)*Math.pow(2,y),x=0));y>=8;l[h+H]=255&I,H+=K,I/=256,y-=8);for(x=x<0;l[h+H]=255&x,H+=K,x/=256,A-=8);l[h+H-K]|=128*ee};function Yn(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||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 S_=4294967296,ob=1/S_,sb=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Dl(l){return l.type===Yn.Bytes?l.readVarint()+l.pos:l.pos+1}function Gh(l,o,h){return h?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function ab(l,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var y=h.pos-1;y>=l;y--)h.buf[y+p]=h.buf[y]}function YT(l,o){for(var h=0;h>>8,l[h+2]=o>>>16,l[h+3]=o>>>24}function lb(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Yn.prototype={destroy:function(){this.buf=null},readFields:function(l,o,h){for(h=h||this.length;this.pos>3,b=this.pos;this.type=7&p,l(y,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=Ym(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=lb(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=Ym(this.buf,this.pos)+Ym(this.buf,this.pos+4)*S_;return this.pos+=8,l},readSFixed64:function(){var l=Ym(this.buf,this.pos)+lb(this.buf,this.pos+4)*S_;return this.pos+=8,l},readFloat:function(){var l=rb(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=rb(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(y,b,x){var I,L,A=x.buf;if(I=(112&(L=A[x.pos++]))>>4,L<128||(I|=(127&(L=A[x.pos++]))<<3,L<128)||(I|=(127&(L=A[x.pos++]))<<10,L<128)||(I|=(127&(L=A[x.pos++]))<<17,L<128)||(I|=(127&(L=A[x.pos++]))<<24,L<128)||(I|=(1&(L=A[x.pos++]))<<31,L<128))return Gh(y,I,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,o=this.pos;return this.pos=l,l-o>=12&&sb?function(h,p,y){return sb.decode(h.subarray(p,y))}(this.buf,o,l):function(h,p,y){for(var b="",x=p;x239?4:N>223?3:N>191?2:1;if(x+G>y)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?(L=h[x+2],(192&(I=h[x+1]))==128&&(192&L)==128&&((O=(15&N)<<12|(63&I)<<6|63&L)<=2047||O>=55296&&O<=57343)&&(O=null)):G===4&&(L=h[x+2],A=h[x+3],(192&(I=h[x+1]))==128&&(192&L)==128&&(192&A)==128&&((O=(15&N)<<18|(63&I)<<12|(63&L)<<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,l)},readBytes:function(){var l=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,l);return this.pos=l,o},readPackedVarint:function(l,o){if(this.type!==Yn.Bytes)return l.push(this.readVarint(o));var h=Dl(this);for(l=l||[];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(l,o){this.writeVarint(l<<3|o)},realloc:function(l){for(var o=this.length||16;o268435455||l<0?function(o,h){var p,y;if(o>=0?(p=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(b,x,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)))))}(y,h)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var o=this.pos;this.pos=function(p,y,b){for(var x,I,L=0;L55295&&x<57344){if(!I){x>56319||L+1===y.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,l,this.pos);var h=this.pos-o;h>=128&&ab(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(l){this.realloc(4),ib(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),ib(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var o=l.length;this.writeVarint(o),this.realloc(o);for(var h=0;h=128&&ab(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(l,o,h){this.writeTag(l,Yn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,YT,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,KT,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,$T,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,JT,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,QT,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,eL,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,tL,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,nL,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,rL,o)},writeBytesField:function(l,o){this.writeTag(l,Yn.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Yn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Yn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Yn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Yn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Yn.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Yn.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Yn.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Yn.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Yn.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var E_=m(nb);const I_=3;function iL(l,o,h){l===1&&h.readMessage(oL,o)}function oL(l,o,h){if(l===3){const{id:p,bitmap:y,width:b,height:x,left:I,top:L,advance:A}=h.readMessage(sL,{});o.push({id:p,bitmap:new Np({width:b+2*I_,height:x+2*I_},y),metrics:{width:b,height:x,left:I,top:L,advance:A}})}}function sL(l,o,h){l===1?o.id=h.readVarint():l===2?o.bitmap=h.readBytes():l===3?o.width=h.readVarint():l===4?o.height=h.readVarint():l===5?o.left=h.readSVarint():l===6?o.top=h.readSVarint():l===7&&(o.advance=h.readVarint())}const ub=I_;function cb(l){let o=0,h=0;for(const x of l)o+=x.w*x.h,h=Math.max(h,x.w);l.sort((x,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 y=0,b=0;for(const x of l)for(let I=p.length-1;I>=0;I--){const L=p[I];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),y=Math.max(y,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();I=0&&p>=o&&Jm[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 jh;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(jp.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Km(l,o,h,p,y,b,x,I,L,A,N,O,G,H,K,ee){const ae=jh.fromFeature(l,y);let pe;O===c.ah.vertical&&ae.verticalizePunctuation();const{processBidirectionalText:Ae,processStyledBidirectionalText:ye}=Ha;if(Ae&&ae.sections.length===1){pe=[];const Je=Ae(ae.toString(),T_(ae,A,b,o,p,H,K));for(const bt of Je){const Tt=new jh;Tt.text=bt,Tt.sections=ae.sections;for(let vt=0;vt0&&Nl>zo&&(zo=Nl)}else{const xs=Tt[vn.fontStack],Bo=xs&&xs[Bi];if(Bo&&Bo.rect)va=Bo.rect,js=Bo.metrics;else{const Nl=bt[vn.fontStack],Yp=Nl&&Nl[Bi];if(!Yp)continue;js=Yp.metrics}gi=(di-vn.scale)*hi}Ws?(Je.verticalizable=!0,to.push({glyph:Bi,imageName:ba,x:ir,y:hr+gi,vertical:Ws,scale:vn.scale,fontStack:vn.fontStack,sectionIndex:no,metrics:js,rect:va}),ir+=Rl*vn.scale+zt):(to.push({glyph:Bi,imageName:ba,x:ir,y:hr+gi,vertical:Ws,scale:vn.scale,fontStack:vn.fontStack,sectionIndex:no,metrics:js,rect:va}),ir+=js.advance*vn.scale+zt)}to.length!==0&&(fi=Math.max(ir-zt,fi),uL(to,0,to.length-1,_o,zo)),ir=0;const Fo=ct*di+zo;xo.lineOffset=Math.max(zo,eo),hr+=Fo,ns=Math.max(Fo,ns),++ri}var Mi;const Fi=hr-qp,{horizontalAlign:vo,verticalAlign:bo}=L_(Et);(function(pi,di,eo,xo,to,zo,Fo,mi,vn){const no=(di-eo)*to;let Bi=0;Bi=zo!==Fo?-mi*xo-qp:(-xo*vn+.5)*Fo;for(const gi of pi)for(const js of gi.positionedGlyphs)js.x+=no,js.y+=Bi})(Je.positionedLines,_o,vo,bo,fi,ns,ct,Fi,gt.length),Je.top+=-bo*Fi,Je.bottom=Je.top+Fi,Je.left+=-vo*fi,Je.right=Je.left+fi}(Ye,o,h,p,pe,x,I,L,O,A,G,ee),!function(Je){for(const bt of Je)if(bt.positionedGlyphs.length!==0)return!1;return!0}(Ie)&&Ye}const Jm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},aL={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 fb(l,o,h,p,y,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*hi/b+y:0}{const x=h[o.fontStack],I=x&&x[l];return I?I.metrics.advance*o.scale+y:0}}function pb(l,o,h,p){const y=Math.pow(l-o,2);return p?l=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=u_([]),this.placementViewportMatrix=u_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=yb(this.zoom,h["text-size"]),this.iconSizeData=yb(this.zoom,h["icon-size"]);const p=this.layers[0].layout,y=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=P_(p,"text-overlap","text-allow-overlap")!=="never"||P_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>c.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new A_(new _r(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new A_(new _r(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,y,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!N)return;const G=h.iconDependencies,H=h.glyphDependencies,K=h.availableImages,ee=new ur(this.zoom);for(const{feature:ae,id:pe,index:Ae,sourceLayerIndex:ye}of o){const Ie=y._featureFilter.needGeometry,Ye=kl(ae,Ie);if(!y._featureFilter.filter(ee,Ye,p))continue;let Je,bt;if(Ie||(Ye.geometry=Al(ae)),A){const vt=y.getValueAndResolveTokens("text-field",Ye,p,K),gt=Ao.factory(vt),ct=this.hasRTLText=this.hasRTLText||pL(gt);(!ct||Ha.getRTLTextPluginStatus()==="unavailable"||ct&&Ha.isParsed())&&(Je=XT(gt,y,Ye))}if(N){const vt=y.getValueAndResolveTokens("icon-image",Ye,p,K);bt=vt instanceof $o?vt:$o.fromString(vt)}if(!Je&&!bt)continue;const Tt=this.sortFeaturesByKey?O.evaluate(Ye,{},p):void 0;if(this.features.push({id:pe,text:Je,icon:bt,index:Ae,sourceLayerIndex:ye,geometry:Ye.geometry,properties:ae.properties,type:hL[ae.type],sortKey:Tt}),bt&&(G[bt.name]=!0),Je){const vt=x.evaluate(Ye,{},p).join(","),gt=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 Et=mu(Je.toString()),dt=ct.fontStack||vt,nt=H[dt]=H[dt]||{};this.calculateGlyphDependencies(ct.text,nt,gt,this.allowVerticalPlacement,Et)}}}b.get("symbol-placement")==="line"&&(this.features=function(ae){const pe={},Ae={},ye=[];let Ie=0;function Ye(vt){ye.push(ae[vt]),Ie++}function Je(vt,gt,ct){const Et=Ae[vt];return delete Ae[vt],Ae[gt]=Et,ye[Et].geometry[0].pop(),ye[Et].geometry[0]=ye[Et].geometry[0].concat(ct[0]),Et}function bt(vt,gt,ct){const Et=pe[gt];return delete pe[gt],pe[vt]=Et,ye[Et].geometry[0].shift(),ye[Et].geometry[0]=ct[0].concat(ye[Et].geometry[0]),Et}function Tt(vt,gt,ct){const Et=ct?gt[0][gt[0].length-1]:gt[0][0];return`${vt}:${Et.x}:${Et.y}`}for(let vt=0;vtvt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ae,pe)=>ae.sortKey-pe.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(h[o.segment+1]),b=o.dist(h[o.segment]);const x={};for(let 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),y=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;by[I]-y[L]||b[L]-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((y,b,x)=>{y>=0&&x.indexOf(y)===b&&this.addIndicesForPlacedSymbol(this.text,y)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let _b,vb;St("SymbolBucket",Wh,{omit:["layers","collisionBoxArray","features","compareText"]}),Wh.MAX_GLYPHS=65535,Wh.addDynamicAttributes=M_;var D_={get paint(){return vb=vb||new go({"icon-opacity":new Ft(Oe.paint_symbol["icon-opacity"]),"icon-color":new Ft(Oe.paint_symbol["icon-color"]),"icon-halo-color":new Ft(Oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ft(Oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ft(Oe.paint_symbol["icon-halo-blur"]),"icon-translate":new kt(Oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new kt(Oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ft(Oe.paint_symbol["text-opacity"]),"text-color":new Ft(Oe.paint_symbol["text-color"],{runtimeType:Rr,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Ft(Oe.paint_symbol["text-halo-color"]),"text-halo-width":new Ft(Oe.paint_symbol["text-halo-width"]),"text-halo-blur":new Ft(Oe.paint_symbol["text-halo-blur"]),"text-translate":new kt(Oe.paint_symbol["text-translate"]),"text-translate-anchor":new kt(Oe.paint_symbol["text-translate-anchor"])})},get layout(){return _b=_b||new go({"symbol-placement":new kt(Oe.layout_symbol["symbol-placement"]),"symbol-spacing":new kt(Oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new kt(Oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ft(Oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new kt(Oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new kt(Oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new kt(Oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new kt(Oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new kt(Oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new kt(Oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ft(Oe.layout_symbol["icon-size"]),"icon-text-fit":new kt(Oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new kt(Oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ft(Oe.layout_symbol["icon-image"]),"icon-rotate":new Ft(Oe.layout_symbol["icon-rotate"]),"icon-padding":new Ft(Oe.layout_symbol["icon-padding"]),"icon-keep-upright":new kt(Oe.layout_symbol["icon-keep-upright"]),"icon-offset":new Ft(Oe.layout_symbol["icon-offset"]),"icon-anchor":new Ft(Oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new kt(Oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new kt(Oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new kt(Oe.layout_symbol["text-rotation-alignment"]),"text-field":new Ft(Oe.layout_symbol["text-field"]),"text-font":new Ft(Oe.layout_symbol["text-font"]),"text-size":new Ft(Oe.layout_symbol["text-size"]),"text-max-width":new Ft(Oe.layout_symbol["text-max-width"]),"text-line-height":new kt(Oe.layout_symbol["text-line-height"]),"text-letter-spacing":new Ft(Oe.layout_symbol["text-letter-spacing"]),"text-justify":new Ft(Oe.layout_symbol["text-justify"]),"text-radial-offset":new Ft(Oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new kt(Oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ft(Oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ft(Oe.layout_symbol["text-anchor"]),"text-max-angle":new kt(Oe.layout_symbol["text-max-angle"]),"text-writing-mode":new kt(Oe.layout_symbol["text-writing-mode"]),"text-rotate":new Ft(Oe.layout_symbol["text-rotate"]),"text-padding":new kt(Oe.layout_symbol["text-padding"]),"text-keep-upright":new kt(Oe.layout_symbol["text-keep-upright"]),"text-transform":new Ft(Oe.layout_symbol["text-transform"]),"text-offset":new Ft(Oe.layout_symbol["text-offset"]),"text-allow-overlap":new kt(Oe.layout_symbol["text-allow-overlap"]),"text-overlap":new kt(Oe.layout_symbol["text-overlap"]),"text-ignore-placement":new kt(Oe.layout_symbol["text-ignore-placement"]),"text-optional":new kt(Oe.layout_symbol["text-optional"])})}};class bb{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:Jr,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",bb,{omit:["defaultValue"]});class $m extends _s{constructor(o){super(o,D_)}recalculate(o,h){if(super.recalculate(o,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const y=[];for(const b of p)y.indexOf(b)<0&&y.push(b);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,y){const b=this.layout.get(o).evaluate(h,{},p,y),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||$n(x.value)||!b?b:function(I,L){return L.replace(/{([^{}]+)}/g,(A,N)=>I&&N in I?String(I[N]):"")}(h.properties,b)}createBucket(o){return new Wh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of D_.paint.overridableProperties){if(!$m.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new bb(h),y=new rr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new dh("source",y):new lp("composite",y,h.value.zoomStops),this.paint._values[o]=new ys(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&$m.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),y=D_.paint.properties[h];let b=!1;const x=I=>{for(const L of I)if(y.overrides&&y.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ao)x(p.value.value.sections);else if(p.value.kind==="source"){const I=A=>{b||(A instanceof Ua&&$r(A.value)===Gr?x(A.value.sections):A instanceof fh?x(A.sections):A.eachChild(I))},L=p.value;L._styleExpression&&I(L._styleExpression.expression)}return b}}let xb;var dL={get paint(){return xb=xb||new go({"background-color":new kt(Oe.paint_background["background-color"]),"background-pattern":new hc(Oe.paint_background["background-pattern"]),"background-opacity":new kt(Oe.paint_background["background-opacity"])})}};class mL extends _s{constructor(o){super(o,dL)}}let wb;var gL={get paint(){return wb=wb||new go({"raster-opacity":new kt(Oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new kt(Oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new kt(Oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new kt(Oe.paint_raster["raster-brightness-max"]),"raster-saturation":new kt(Oe.paint_raster["raster-saturation"]),"raster-contrast":new kt(Oe.paint_raster["raster-contrast"]),"raster-resampling":new kt(Oe.paint_raster["raster-resampling"]),"raster-fade-duration":new kt(Oe.paint_raster["raster-fade-duration"])})}};class yL extends _s{constructor(o){super(o,gL)}}class _L extends _s{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class vL{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 R_=63710088e-1;class bu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new bu(_e(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,y=o.lat*h,b=Math.sin(p)*Math.sin(y)+Math.cos(p)*Math.cos(y)*Math.cos((o.lng-this.lng)*h);return R_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof bu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new bu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new bu(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Sb=2*Math.PI*R_;function Eb(l){return Sb*Math.cos(l*Math.PI/180)}function Ib(l){return(180+l)/360}function Cb(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function Tb(l,o){return l/Eb(o)}function N_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class eg{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=bu.convert(o);return new eg(Ib(p.lng),Cb(p.lat),Tb(h,p.lat))}toLngLat(){return new bu(360*this.x-180,N_(this.y))}toAltitude(){return this.z*Eb(N_(this.y))}meterInMercatorCoordinateUnits(){return 1/Sb*(o=N_(this.y),1/Math.cos(o*Math.PI/180));var o}}function Lb(l,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[l*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class O_{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=Hp(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const y=(x=this.y,I=this.z,L=Lb(256*(b=this.x),256*(x=Math.pow(2,I)-x-1),I),A=Lb(256*(b+1),256*(x+1),I),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,I,L,A;const N=function(O,G,H){let K,ee="";for(let ae=O;ae>0;ae--)K=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,y)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new E((o.x*h-this.x)*Nr,(o.y*h-this.y)*Nr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Pb{constructor(o,h){this.wrap=o,this.canonical=h,this.key=Hp(o,h.z,h.z,h.x,h.y)}}class bs{constructor(o,h,p,y,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new O_(p,+y,+b),this.key=Hp(h,o,p,y,b)}clone(){return new bs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-o;return o>this.canonical.z?new bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Hp(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):Hp(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,y=2*this.canonical.y;return[new bs(h,this.wrap,h,p,y),new bs(h,this.wrap,h,p+1,y),new bs(h,this.wrap,h,p,y+1),new bs(h,this.wrap,h,p+1,y+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,I=p*this.dim+this.dim;switch(h){case-1:y=b-1;break;case 1:b=y+1}switch(p){case-1:x=I-1;break;case 1:I=x+1}const L=-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 kb{constructor(o,h,p,y,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=y,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class Db{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new lc(Nr,16,0),this.grid3D=new lc(Nr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,y,b,x){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,y,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&L.insert(I,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new yu.VectorTile(new E_(this.rawTileData)).layers,this.sourceLayerCoder=new Ab(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,y){this.loadVTLayers();const b=o.params||{},x=Nr/o.tileSize/o.scale,I=_h(b.filter),L=o.queryGeometry,A=o.queryPadding*x,N=Nb(L),O=this.grid.query(N.minX-A,N.minY-A,N.maxX+A,N.maxY+A),G=Nb(o.cameraQueryGeometry),H=this.grid3D.query(G.minX-A,G.minY-A,G.maxX+A,G.maxY+A,(ae,pe,Ae,ye)=>function(Ie,Ye,Je,bt,Tt){for(const gt of Ie)if(Ye<=gt.x&&Je<=gt.y&&bt>=gt.x&&Tt>=gt.y)return!0;const vt=[new E(Ye,Je),new E(Ye,Tt),new E(bt,Tt),new E(bt,Je)];if(Ie.length>2){for(const gt of vt)if(Fh(Ie,gt))return!0}for(let gt=0;gt(ye||(ye=Al(Ie)),Ye.queryIntersectsFeature(L,Ie,Je,ye,this.z,o.transform,x,o.pixelPosMatrix)))}return K}loadMatchingFeature(o,h,p,y,b,x,I,L,A,N,O){const G=this.bucketLayerIDs[h];if(x&&!function(ae,pe){for(let Ae=0;Ae=0)return!0;return!1}(x,G))return;const H=this.sourceLayerCoder.decode(p),K=this.vtLayers[H].feature(y);if(b.needGeometry){const ae=kl(K,!0);if(!b.filter(new ur(this.tileID.overscaledZ),ae,this.tileID.canonical))return}else if(!b.filter(new ur(this.tileID.overscaledZ),K))return;const ee=this.getId(K,H);for(let ae=0;ae{const I=o instanceof cc?o.get(x):null;return I&&I.evaluate?I.evaluate(h,p,y):I})}function Nb(l){let o=1/0,h=1/0,p=-1/0,y=-1/0;for(const b of l)o=Math.min(o,b.x),h=Math.min(h,b.y),p=Math.max(p,b.x),y=Math.max(y,b.y);return{minX:o,minY:h,maxX:p,maxY:y}}function bL(l,o){return o-l}function Ob(l,o,h,p,y){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>=y&&O.y>=y||(N.y>=y?N=new E(N.x+(y-N.y)/(O.y-N.y)*(O.x-N.x),y)._round():O.y>=y&&(O=new E(N.x+(y-N.y)/(O.y-N.y)*(O.x-N.x),y)._round()),L&&N.equals(L[L.length-1])||(L=[N],b.push(L)),L.push(O)))))}}return b}St("FeatureIndex",Db,{omit:["rawTileData","sourceLayerCoder"]});class xu extends E{constructor(o,h,p,y){super(o,h),this.angle=p,y!==void 0&&(this.segment=y)}clone(){return new xu(this.x,this.y,this.angle,this.segment)}}function zb(l,o,h,p,y){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-=l[x].dist(b),b=l[x]}I+=l[x].dist(l[x+1]),x++;const L=[];let A=0;for(;Ip;)A-=L.shift().angleDelta;if(A>y)return!1;x++,I+=N.dist(O)}return!0}function Fb(l){let o=0;for(let h=0;hA){const K=(A-L)/H,ee=Qi.number(O.x,G.x,K),ae=Qi.number(O.y,G.y,K),pe=new xu(ee,ae,G.angleTo(O),N);return pe._round(),!x||zb(l,pe,I,x,o)?pe:void 0}L+=H}}function wL(l,o,h,p,y,b,x,I,L){const A=Bb(p,b,x),N=Vb(p,y),O=N*x,G=l[0].x===0||l[0].x===L||l[0].y===0||l[0].y===L;return o-O=0&&Ie=0&&Ye=0&&G+A<=N){const Je=new xu(Ie,Ye,Ae,K);Je._round(),p&&!zb(l,Je,b,p,y)||H.push(Je)}}O+=pe}return I||H.length||x||(H=Ub(l,O/2,h,p,y,b,x,!0,L)),H}St("Anchor",xu);const Hh=Oo;function Gb(l,o,h,p){const y=[],b=l.image,x=b.pixelRatio,I=b.paddedRect.w-2*Hh,L=b.paddedRect.h-2*Hh,A=l.right-l.left,N=l.bottom-l.top,O=b.stretchX||[[0,I]],G=b.stretchY||[[0,L]],H=(ct,Et)=>ct+Et[1]-Et[0],K=O.reduce(H,0),ee=G.reduce(H,0),ae=I-K,pe=L-ee;let Ae=0,ye=K,Ie=0,Ye=ee,Je=0,bt=ae,Tt=0,vt=pe;if(b.content&&p){const ct=b.content;Ae=tg(O,0,ct[0]),Ie=tg(G,0,ct[1]),ye=tg(O,ct[0],ct[2]),Ye=tg(G,ct[1],ct[3]),Je=ct[0]-Ae,Tt=ct[1]-Ie,bt=ct[2]-ct[0]-ye,vt=ct[3]-ct[1]-Ye}const gt=(ct,Et,dt,nt)=>{const zt=ng(ct.stretch-Ae,ye,A,l.left),Mt=rg(ct.fixed-Je,bt,ct.stretch,K),pn=ng(Et.stretch-Ie,Ye,N,l.top),ir=rg(Et.fixed-Tt,vt,Et.stretch,ee),hr=ng(dt.stretch-Ae,ye,A,l.left),fi=rg(dt.fixed-Je,bt,dt.stretch,K),ns=ng(nt.stretch-Ie,Ye,N,l.top),_o=rg(nt.fixed-Tt,vt,nt.stretch,ee),ri=new E(zt,pn),Mi=new E(hr,pn),Fi=new E(hr,ns),vo=new E(zt,ns),bo=new E(Mt/x,ir/x),pi=new E(fi/x,_o/x),di=o*Math.PI/180;if(di){const to=Math.sin(di),zo=Math.cos(di),Fo=[zo,-to,to,zo];ri._matMult(Fo),Mi._matMult(Fo),vo._matMult(Fo),Fi._matMult(Fo)}const eo=ct.stretch+ct.fixed,xo=Et.stretch+Et.fixed;return{tl:ri,tr:Mi,bl:vo,br:Fi,tex:{x:b.paddedRect.x+Hh+eo,y:b.paddedRect.y+Hh+xo,w:dt.stretch+dt.fixed-eo,h:nt.stretch+nt.fixed-xo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:bo,pixelOffsetBR:pi,minFontScaleX:bt/x/A,minFontScaleY:vt/x/N,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ct=qb(O,ae,K),Et=qb(G,pe,ee);for(let dt=0;dt0&&(K=Math.max(10,K),this.circleDiameter=K)}else{let O=x.top*I-L[0],G=x.bottom*I+L[2],H=x.left*I-L[3],K=x.right*I+L[1];const ee=x.collisionPadding;if(ee&&(H-=ee[0]*I,O-=ee[1]*I,K+=ee[2]*I,G+=ee[3]*I),N){const ae=new E(H,O),pe=new E(K,O),Ae=new E(H,G),ye=new E(K,G),Ie=N*Math.PI/180;ae._rotate(Ie),pe._rotate(Ie),Ae._rotate(Ie),ye._rotate(Ie),H=Math.min(ae.x,pe.x,Ae.x,ye.x),K=Math.max(ae.x,pe.x,Ae.x,ye.x),O=Math.min(ae.y,pe.y,Ae.y,ye.y),G=Math.max(ae.y,pe.y,Ae.y,ye.y)}o.emplaceBack(h.x,h.y,H,O,K,G,p,y,b)}this.boxEndIndex=o.length}}class SL{constructor(o=[],h=EL){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,y=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(y,x)>=0)break;h[o]=x,o=b}h[o]=y}_down(o){const{data:h,compare:p}=this,y=this.length>>1,b=h[o];for(;o=0)break;h[o]=I,o=x}h[o]=b}}function EL(l,o){return lo?1:0}function IL(l,o=1,h=!1){let p=1/0,y=1/0,b=-1/0,x=-1/0;const I=l[0];for(let H=0;Hb)&&(b=K.x),(!H||K.y>x)&&(x=K.y)}const L=Math.min(b-p,x-y);let A=L/2;const N=new SL([],CL);if(L===0)return new E(p,y);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 Zh(H.p.x-A,H.p.y-A,A,l)),N.push(new Zh(H.p.x+A,H.p.y-A,A,l)),N.push(new Zh(H.p.x-A,H.p.y+A,A,l)),N.push(new Zh(H.p.x+A,H.p.y+A,A,l)),G+=4)}return h&&(console.log(`num probes: ${G}`),console.log(`best distance: ${O.d}`)),O.p}function CL(l,o){return o.max-l.max}function Zh(l,o,h,p){this.p=new E(l,o),this.h=h,this.d=function(y,b){let x=!1,I=1/0;for(let L=0;Ly.y!=K.y>y.y&&y.x<(K.x-H.x)*(y.y-H.y)/(K.y-H.y)+H.x&&(x=!x),I=Math.min(I,C1(y,H,K))}}return(x?1:-1)*Math.sqrt(I)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var zi;c.ap=void 0,(zi=c.ap||(c.ap={}))[zi.center=1]="center",zi[zi.left=2]="left",zi[zi.right=3]="right",zi[zi.top=4]="top",zi[zi.bottom=5]="bottom",zi[zi["top-left"]=6]="top-left",zi[zi["top-right"]=7]="top-right",zi[zi["bottom-left"]=8]="bottom-left",zi[zi["bottom-right"]=9]="bottom-right";const wu=7,z_=Number.POSITIVE_INFINITY;function jb(l,o){return o[1]!==z_?function(h,p,y){let b=0,x=0;switch(p=Math.abs(p),y=Math.abs(y),h){case"top-right":case"top-left":case"top":x=y-wu;break;case"bottom-right":case"bottom-left":case"bottom":x=-y+wu}switch(h){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(l,o[0],o[1]):function(h,p){let y=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-wu;break;case"bottom-right":case"bottom-left":b=-x+wu;break;case"bottom":b=-p+wu;break;case"top":b=p-wu}switch(h){case"top-right":case"bottom-right":y=-x;break;case"top-left":case"bottom-left":y=x;break;case"left":y=p;break;case"right":y=-p}return[y,b]}(l,o[0])}function Wb(l,o,h){var p;const y=l.layout,b=(p=y.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const I=b.values,L=[];for(let A=0;AG*hi);N.startsWith("top")?O[1]-=wu:N.startsWith("bottom")&&(O[1]+=wu),L[A+1]=O}return new Qo(L)}const x=y.get("text-variable-anchor");if(x){let I;I=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},h)*hi,z_]:y.get("text-offset").evaluate(o,{},h).map(A=>A*hi);const L=[];for(const A of x)L.push(A,jb(A,I));return new Qo(L)}return null}function F_(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function TL(l,o,h,p,y,b,x,I,L,A,N){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const G=l.layers[0].layout,H=G.get("icon-offset").evaluate(o,{},N),K=Zb(h.horizontal),ee=x/24,ae=l.tilePixelRatio*ee,pe=l.tilePixelRatio*O/24,Ae=l.tilePixelRatio*I,ye=l.tilePixelRatio*G.get("symbol-spacing"),Ie=G.get("text-padding")*l.tilePixelRatio,Ye=function(nt,zt,Mt,pn=1){const ir=nt.get("icon-padding").evaluate(zt,{},Mt),hr=ir&&ir.values;return[hr[0]*pn,hr[1]*pn,hr[2]*pn,hr[3]*pn]}(G,o,N,l.tilePixelRatio),Je=G.get("text-max-angle")/180*Math.PI,bt=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Tt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",vt=G.get("symbol-placement"),gt=ye/2,ct=G.get("icon-text-fit");let Et;p&&ct!=="none"&&(l.allowVerticalPlacement&&h.vertical&&(Et=gb(p,h.vertical,ct,G.get("icon-text-fit-padding"),H,ee)),K&&(p=gb(p,K,ct,G.get("icon-text-fit-padding"),H,ee)));const dt=(nt,zt)=>{zt.x<0||zt.x>=Nr||zt.y<0||zt.y>=Nr||function(Mt,pn,ir,hr,fi,ns,_o,ri,Mi,Fi,vo,bo,pi,di,eo,xo,to,zo,Fo,mi,vn,no,Bi,gi,js){const va=Mt.addToLineVertexArray(pn,ir);let ba,Rl,Ws,xs,Bo=0,Nl=0,Yp=0,Jb=0,H_=-1,Z_=-1;const Ol={};let Qb=Tr("");if(Mt.allowVerticalPlacement&&hr.vertical){const ro=ri.layout.get("text-rotate").evaluate(vn,{},gi)+90;Ws=new ig(Mi,pn,Fi,vo,bo,hr.vertical,pi,di,eo,ro),_o&&(xs=new ig(Mi,pn,Fi,vo,bo,_o,to,zo,eo,ro))}if(fi){const ro=ri.layout.get("icon-rotate").evaluate(vn,{}),ws=ri.layout.get("icon-text-fit")!=="none",vc=Gb(fi,ro,Bi,ws),wa=_o?Gb(_o,ro,Bi,ws):void 0;Rl=new ig(Mi,pn,Fi,vo,bo,fi,to,zo,!1,ro),Bo=4*vc.length;const bc=Mt.iconSizeData;let Ja=null;bc.kind==="source"?(Ja=[Ka*ri.layout.get("icon-size").evaluate(vn,{})],Ja[0]>vu&&Ke(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Wp}. Reduce your "icon-size".`)):bc.kind==="composite"&&(Ja=[Ka*no.compositeIconSizes[0].evaluate(vn,{},gi),Ka*no.compositeIconSizes[1].evaluate(vn,{},gi)],(Ja[0]>vu||Ja[1]>vu)&&Ke(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Wp}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,vc,Ja,mi,Fo,vn,c.ah.none,pn,va.lineStartIndex,va.lineLength,-1,gi),H_=Mt.icon.placedSymbolArray.length-1,wa&&(Nl=4*wa.length,Mt.addSymbols(Mt.icon,wa,Ja,mi,Fo,vn,c.ah.vertical,pn,va.lineStartIndex,va.lineLength,-1,gi),Z_=Mt.icon.placedSymbolArray.length-1)}const $b=Object.keys(hr.horizontal);for(const ro of $b){const ws=hr.horizontal[ro];if(!ba){Qb=Tr(ws.text);const wa=ri.layout.get("text-rotate").evaluate(vn,{},gi);ba=new ig(Mi,pn,Fi,vo,bo,ws,pi,di,eo,wa)}const vc=ws.positionedLines.length===1;if(Yp+=Hb(Mt,pn,ws,ns,ri,eo,vn,xo,va,hr.vertical?c.ah.horizontal:c.ah.horizontalOnly,vc?$b:[ro],Ol,H_,no,gi),vc)break}hr.vertical&&(Jb+=Hb(Mt,pn,hr.vertical,ns,ri,eo,vn,xo,va,c.ah.vertical,["vertical"],Ol,Z_,no,gi));const ML=ba?ba.boxStartIndex:Mt.collisionBoxArray.length,AL=ba?ba.boxEndIndex:Mt.collisionBoxArray.length,kL=Ws?Ws.boxStartIndex:Mt.collisionBoxArray.length,DL=Ws?Ws.boxEndIndex:Mt.collisionBoxArray.length,RL=Rl?Rl.boxStartIndex:Mt.collisionBoxArray.length,NL=Rl?Rl.boxEndIndex:Mt.collisionBoxArray.length,OL=xs?xs.boxStartIndex:Mt.collisionBoxArray.length,zL=xs?xs.boxEndIndex:Mt.collisionBoxArray.length;let xa=-1;const sg=(ro,ws)=>ro&&ro.circleDiameter?Math.max(ro.circleDiameter,ws):ws;xa=sg(ba,xa),xa=sg(Ws,xa),xa=sg(Rl,xa),xa=sg(xs,xa);const ex=xa>-1?1:0;ex&&(xa*=js/hi),Mt.glyphOffsetArray.length>=Wh.MAX_GLYPHS&&Ke("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),vn.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,vn.sortKey);const FL=Wb(ri,vn,gi),[BL,VL]=function(ro,ws){const vc=ro.length,wa=ws==null?void 0:ws.values;if((wa==null?void 0:wa.length)>0)for(let bc=0;bc=0?Ol.right:-1,Ol.center>=0?Ol.center:-1,Ol.left>=0?Ol.left:-1,Ol.vertical||-1,H_,Z_,Qb,ML,AL,kL,DL,RL,NL,OL,zL,Fi,Yp,Jb,Bo,Nl,ex,0,pi,xa,BL,VL)}(l,zt,nt,h,p,y,Et,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,ae,[Ie,Ie,Ie,Ie],bt,L,Ae,Ye,Tt,H,o,b,A,N,x)};if(vt==="line")for(const nt of Ob(o.geometry,0,0,Nr,Nr)){const zt=wL(nt,ye,Je,h.vertical||K,p,24,pe,l.overscaling,Nr);for(const Mt of zt)K&&LL(l,K.text,gt,Mt)||dt(nt,Mt)}else if(vt==="line-center"){for(const nt of o.geometry)if(nt.length>1){const zt=xL(nt,Je,h.vertical||K,p,24,pe);zt&&dt(nt,zt)}}else if(o.type==="Polygon")for(const nt of g_(o.geometry,0)){const zt=IL(nt,16);dt(nt[0],new xu(zt.x,zt.y,0))}else if(o.type==="LineString")for(const nt of o.geometry)dt(nt,new xu(nt[0].x,nt[0].y,0));else if(o.type==="Point")for(const nt of o.geometry)for(const zt of nt)dt([zt],new xu(zt.x,zt.y,0))}function Hb(l,o,h,p,y,b,x,I,L,A,N,O,G,H,K){const ee=function(Ae,ye,Ie,Ye,Je,bt,Tt,vt){const gt=Ye.layout.get("text-rotate").evaluate(bt,{})*Math.PI/180,ct=[];for(const Et of ye.positionedLines)for(const dt of Et.positionedGlyphs){if(!dt.rect)continue;const nt=dt.rect||{};let zt=ub+1,Mt=!0,pn=1,ir=0;const hr=(Je||vt)&&dt.vertical,fi=dt.metrics.advance*dt.scale/2;if(vt&&ye.verticalizable&&(ir=Et.lineOffset/2-(dt.imageName?-(hi-dt.metrics.width*dt.scale)/2:(dt.scale-1)*hi)),dt.imageName){const mi=Tt[dt.imageName];Mt=mi.sdf,pn=mi.pixelRatio,zt=Oo/pn}const ns=Je?[dt.x+fi,dt.y]:[0,0];let _o=Je?[0,0]:[dt.x+fi+Ie[0],dt.y+Ie[1]-ir],ri=[0,0];hr&&(ri=_o,_o=[0,0]);const Mi=dt.metrics.isDoubleResolution?2:1,Fi=(dt.metrics.left-zt)*dt.scale-fi+_o[0],vo=(-dt.metrics.top-zt)*dt.scale+_o[1],bo=Fi+nt.w/Mi*dt.scale/pn,pi=vo+nt.h/Mi*dt.scale/pn,di=new E(Fi,vo),eo=new E(bo,vo),xo=new E(Fi,pi),to=new E(bo,pi);if(hr){const mi=new E(-fi,fi-qp),vn=-Math.PI/2,no=hi/2-fi,Bi=new E(5-qp-no,-(dt.imageName?no:0)),gi=new E(...ri);di._rotateAround(vn,mi)._add(Bi)._add(gi),eo._rotateAround(vn,mi)._add(Bi)._add(gi),xo._rotateAround(vn,mi)._add(Bi)._add(gi),to._rotateAround(vn,mi)._add(Bi)._add(gi)}if(gt){const mi=Math.sin(gt),vn=Math.cos(gt),no=[vn,-mi,mi,vn];di._matMult(no),eo._matMult(no),xo._matMult(no),to._matMult(no)}const zo=new E(0,0),Fo=new E(0,0);ct.push({tl:di,tr:eo,bl:xo,br:to,tex:nt,writingMode:ye.writingMode,glyphOffset:ns,sectionIndex:dt.sectionIndex,isSDF:Mt,pixelOffsetTL:zo,pixelOffsetBR:Fo,minFontScaleX:0,minFontScaleY:0})}return ct}(0,h,I,y,b,x,p,l.allowVerticalPlacement),ae=l.textSizeData;let pe=null;ae.kind==="source"?(pe=[Ka*y.layout.get("text-size").evaluate(x,{})],pe[0]>vu&&Ke(`${l.layerIds[0]}: Value for "text-size" is >= ${Wp}. Reduce your "text-size".`)):ae.kind==="composite"&&(pe=[Ka*H.compositeTextSizes[0].evaluate(x,{},K),Ka*H.compositeTextSizes[1].evaluate(x,{},K)],(pe[0]>vu||pe[1]>vu)&&Ke(`${l.layerIds[0]}: Value for "text-size" is >= ${Wp}. Reduce your "text-size".`)),l.addSymbols(l.text,ee,pe,I,b,x,A,o,L.lineStartIndex,L.lineLength,G,K);for(const Ae of N)O[Ae]=l.text.placedSymbolArray.length-1;return 4*ee.length}function Zb(l){for(const o in l)return l[o];return null}function LL(l,o,h,p){const y=l.compareText;if(o in y){const b=y[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const b=Xb[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 B_(I,x,b,o)}constructor(o,h=64,p=Float64Array,y){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=Xb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,I=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-I%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+I+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return V_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:I}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const N=L.pop()||0,O=L.pop()||0,G=L.pop()||0;if(O-G<=I){for(let ae=G;ae<=O;ae++){const pe=x[2*ae],Ae=x[2*ae+1];pe>=o&&pe<=p&&Ae>=h&&Ae<=y&&A.push(b[ae])}continue}const H=G+O>>1,K=x[2*H],ee=x[2*H+1];K>=o&&K<=p&&ee>=h&&ee<=y&&A.push(b[H]),(N===0?o<=K:h<=ee)&&(L.push(G),L.push(H-1),L.push(1-N)),(N===0?p>=K:y>=ee)&&(L.push(H+1),L.push(O),L.push(1-N))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:b,nodeSize:x}=this,I=[0,y.length-1,0],L=[],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 ae=G;ae<=O;ae++)Kb(b[2*ae],b[2*ae+1],o,h)<=A&&L.push(y[ae]);continue}const H=G+O>>1,K=b[2*H],ee=b[2*H+1];Kb(K,ee,o,h)<=A&&L.push(y[H]),(N===0?o-p<=K:h-p<=ee)&&(I.push(G),I.push(H-1),I.push(1-N)),(N===0?o+p>=K:h+p>=ee)&&(I.push(H+1),I.push(O),I.push(1-N))}return L}}function V_(l,o,h,p,y,b){if(y-p<=h)return;const x=p+y>>1;Yb(l,o,x,p,y,b),V_(l,o,h,p,x-1,1-b),V_(l,o,h,x+1,y,1-b)}function Yb(l,o,h,p,y,b){for(;y>p;){if(y-p>600){const A=y-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);Yb(l,o,h,Math.max(p,Math.floor(h-N*G/A+H)),Math.min(y,Math.floor(h+(A-N)*G/A+H)),b)}const x=o[2*h+b];let I=p,L=y;for(Zp(l,o,p,h),o[2*y+b]>x&&Zp(l,o,p,y);Ix;)L--}o[2*p+b]===x?Zp(l,o,p,L):(L++,Zp(l,o,L,y)),L<=h&&(p=L+1),h<=L&&(y=L-1)}}function Zp(l,o,h,p){U_(l,h,p),U_(o,2*h,2*p),U_(o,2*h+1,2*p+1)}function U_(l,o,h){const p=l[o];l[o]=l[h],l[h]=p}function Kb(l,o,h,p){const y=l-h,b=o-p;return y*y+b*b}var G_;c.bd=void 0,(G_=c.bd||(c.bd={})).create="create",G_.load="load",G_.fullLoad="fullLoad";let og=null,Xp=[];const q_=1e3/60,j_="loadTime",W_="fullLoadTime",PL={mark(l){performance.mark(l)},frame(l){const o=l;og!=null&&Xp.push(o-og),og=o},clearMetrics(){og=null,Xp=[],performance.clearMeasures(j_),performance.clearMeasures(W_);for(const l in c.bd)performance.clearMarks(c.bd[l])},getPerformanceMetrics(){performance.measure(j_,c.bd.create,c.bd.load),performance.measure(W_,c.bd.create,c.bd.fullLoad);const l=performance.getEntriesByName(j_)[0].duration,o=performance.getEntriesByName(W_)[0].duration,h=Xp.length,p=1/(Xp.reduce((b,x)=>b+x,0)/h/1e3),y=Xp.filter(b=>b>q_).reduce((b,x)=>b+(x-q_)/q_,0);return{loadTime:l,fullLoadTime:o,fps:p,percentDroppedFrames:y/(h+y)*100,totalFrames:h}}};c.$=ft,c.A=Bh,c.B=function(l){if(qe==null){const o=l.navigator?l.navigator.userAgent:null;qe=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return qe},c.C=class{constructor(l,o){this.target=l,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vL(()=>this.process()),this.subscription=function(h,p,y,b){return h.addEventListener(p,y,!1),{unsubscribe:()=>{h.removeEventListener(p,y,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=tt(self)?l:window}registerMessageHandler(l,o){this.messageHandlers[l]=o}sendAsync(l,o){return new Promise((h,p)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const I={id:y,type:"",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(I)},{once:!0});const b=[],x=Object.assign(Object.assign({},l),{id:y,sourceMapId:this.mapId,origin:location.origin,data:pu(l.data,b)});this.target.postMessage(x,{transfer:b})})}receive(l){const o=l.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(tt(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const l=this.taskQueue.shift(),o=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(l,o)}processTask(l,o){return u(this,void 0,void 0,function*(){if(o.type===""){const y=this.resolveRejects[l];return delete this.resolveRejects[l],y?void(o.error?y.reject(du(o.error)):y.resolve(du(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=du(o.data),p=new AbortController;this.abortControllers[l]=p;try{const y=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(l,null,y)}catch(y){this.completeTask(l,y)}})}completeTask(l,o,h){const p=[];delete this.abortControllers[l];const y={id:l,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?pu(o):null,data:pu(h,p)};this.target.postMessage(y,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=kt,c.E=Nn,c.F=function(){var l=new Bh(16);return Bh!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},c.G=Rn,c.H=function(l,o,h){var p,y,b,x,I,L,A,N,O,G,H,K,ee=h[0],ae=h[1],pe=h[2];return o===l?(l[12]=o[0]*ee+o[4]*ae+o[8]*pe+o[12],l[13]=o[1]*ee+o[5]*ae+o[9]*pe+o[13],l[14]=o[2]*ee+o[6]*ae+o[10]*pe+o[14],l[15]=o[3]*ee+o[7]*ae+o[11]*pe+o[15]):(y=o[1],b=o[2],x=o[3],I=o[4],L=o[5],A=o[6],N=o[7],O=o[8],G=o[9],H=o[10],K=o[11],l[0]=p=o[0],l[1]=y,l[2]=b,l[3]=x,l[4]=I,l[5]=L,l[6]=A,l[7]=N,l[8]=O,l[9]=G,l[10]=H,l[11]=K,l[12]=p*ee+I*ae+O*pe+o[12],l[13]=y*ee+L*ae+G*pe+o[13],l[14]=b*ee+A*ae+H*pe+o[14],l[15]=x*ee+N*ae+K*pe+o[15]),l},c.I=C_,c.J=function(l,o,h){var p=h[0],y=h[1],b=h[2];return l[0]=o[0]*p,l[1]=o[1]*p,l[2]=o[2]*p,l[3]=o[3]*p,l[4]=o[4]*y,l[5]=o[5]*y,l[6]=o[6]*y,l[7]=o[7]*y,l[8]=o[8]*b,l[9]=o[9]*b,l[10]=o[10]*b,l[11]=o[11]*b,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},c.K=M1,c.L=function(l,o){const h={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of l){const y=window.document.createElement("source");dr(p)||(o.crossOrigin="Anonymous"),y.src=p,o.appendChild(y)}})},c.a3=function(){return ce++},c.a4=_,c.a5=Wh,c.a6=_h,c.a7=kl,c.a8=ur,c.a9=kb,c.aA=Z,c.aB=function(l,o){if(!l)return[{command:"setStyle",args:[o]}];let h=[];try{if(!ln(l.version,o.version))return[{command:"setStyle",args:[o]}];ln(l.center,o.center)||h.push({command:"setCenter",args:[o.center]}),ln(l.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),ln(l.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),ln(l.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),ln(l.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),ln(l.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),ln(l.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),ln(l.light,o.light)||h.push({command:"setLight",args:[o.light]}),ln(l.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),ln(l.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},y=[];(function(x,I,L,A){let N;for(N in I=I||{},x=x||{})Object.prototype.hasOwnProperty.call(x,N)&&(Object.prototype.hasOwnProperty.call(I,N)||ps(N,L,A));for(N in I)Object.prototype.hasOwnProperty.call(I,N)&&(Object.prototype.hasOwnProperty.call(x,N)?ln(x[N],I[N])||(x[N].type==="geojson"&&I[N].type==="geojson"&&Va(x,I,N)?er(L,{command:"setGeoJSONSourceData",args:[N,I[N].data]}):Os(N,I,L,A)):Mo(N,I,L))})(l.sources,o.sources,y,p);const b=[];l.layers&&l.layers.forEach(x=>{"source"in x&&p[x.source]?h.push({command:"removeLayer",args:[x.id]}):b.push(x)}),h=h.concat(y),function(x,I,L){I=I||[];const A=(x=x||[]).map(xl),N=I.map(xl),O=x.reduce(ds,{}),G=I.reduce(ds,{}),H=A.slice(),K=Object.create(null);let ee,ae,pe,Ae,ye;for(let Ie=0,Ye=0;Ie@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,y,b)=>{const x=y||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(l,o){const h=[];for(const p in l)p in o||h.push(p);return h},c.ac=oe,c.ad=function(l,o,h){var p=Math.sin(h),y=Math.cos(h),b=o[0],x=o[1],I=o[2],L=o[3],A=o[4],N=o[5],O=o[6],G=o[7];return o!==l&&(l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[0]=b*y+A*p,l[1]=x*y+N*p,l[2]=I*y+O*p,l[3]=L*y+G*p,l[4]=A*y-b*p,l[5]=N*y-x*p,l[6]=O*y-I*p,l[7]=G*y-L*p,l},c.ae=function(l){var o=new Bh(16);return o[0]=l[0],o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=l[6],o[7]=l[7],o[8]=l[8],o[9]=l[9],o[10]=l[10],o[11]=l[11],o[12]=l[12],o[13]=l[13],o[14]=l[14],o[15]=l[15],o},c.af=qm,c.ag=function(l,o){let h=0,p=0;if(l.kind==="constant")p=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:y,minZoom:b,maxZoom:x}=l,I=y?oe(Oi.interpolationFactor(y,o,b,x),0,1):0;l.kind==="camera"?p=Qi.number(l.minSize,l.maxSize,I):h=I}return{uSizeT:h,uSize:p}},c.ai=function(l,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:y}){return l.kind==="source"?p/Ka:l.kind==="composite"?Qi.number(p/Ka,y/Ka,h):o},c.aj=M_,c.ak=function(l,o,h,p){const y=o.y-l.y,b=o.x-l.x,x=p.y-h.y,I=p.x-h.x,L=x*b-I*y;if(L===0)return null;const A=(I*(l.y-h.y)-x*(l.x-h.x))/L;return new E(l.x+A*b,l.y+A*y)},c.al=Ob,c.am=Pp,c.an=u_,c.ao=hi,c.aq=P_,c.ar=function(l,o){var h=o[0],p=o[1],y=o[2],b=o[3],x=o[4],I=o[5],L=o[6],A=o[7],N=o[8],O=o[9],G=o[10],H=o[11],K=o[12],ee=o[13],ae=o[14],pe=o[15],Ae=h*I-p*x,ye=h*L-y*x,Ie=h*A-b*x,Ye=p*L-y*I,Je=p*A-b*I,bt=y*A-b*L,Tt=N*ee-O*K,vt=N*ae-G*K,gt=N*pe-H*K,ct=O*ae-G*ee,Et=O*pe-H*ee,dt=G*pe-H*ae,nt=Ae*dt-ye*Et+Ie*ct+Ye*gt-Je*vt+bt*Tt;return nt?(l[0]=(I*dt-L*Et+A*ct)*(nt=1/nt),l[1]=(y*Et-p*dt-b*ct)*nt,l[2]=(ee*bt-ae*Je+pe*Ye)*nt,l[3]=(G*Je-O*bt-H*Ye)*nt,l[4]=(L*gt-x*dt-A*vt)*nt,l[5]=(h*dt-y*gt+b*vt)*nt,l[6]=(ae*Ie-K*bt-pe*ye)*nt,l[7]=(N*bt-G*Ie+H*ye)*nt,l[8]=(x*Et-I*gt+A*Tt)*nt,l[9]=(p*gt-h*Et-b*Tt)*nt,l[10]=(K*Je-ee*Ie+pe*Ae)*nt,l[11]=(O*Ie-N*Je-H*Ae)*nt,l[12]=(I*vt-x*ct-L*Tt)*nt,l[13]=(h*ct-p*vt+y*Tt)*nt,l[14]=(ee*ye-K*Ye-ae*Ae)*nt,l[15]=(N*Ye-O*ye+G*Ae)*nt,l):null},c.as=F_,c.at=L_,c.au=B_,c.av=function(){const l={},o=Oe.$version;for(const h in Oe.$root){const p=Oe.$root[h];if(p.required){let y=null;y=h==="version"?o:p.type==="array"?[]:{},y!=null&&(l[h]=y)}}return l},c.aw=Pm,c.ax=kr,c.ay=function(l){l=l.slice();const o=Object.create(null);for(let h=0;hnt*hi)}let vt=x?"center":h.get("text-justify").evaluate(A,{},l.canonical);const gt=h.get("symbol-placement"),ct=gt==="point"?h.get("text-max-width").evaluate(A,{},l.canonical)*hi:0,Et=()=>{l.bucket.allowVerticalPlacement&&mu(Ie)&&(K.vertical=Km(ee,l.glyphMap,l.glyphPositions,l.imagePositions,N,ct,b,bt,"left",Je,pe,c.ah.vertical,!0,gt,G,O))};if(!x&&Tt){const dt=new Set;if(vt==="auto")for(let zt=0;ztu(void 0,void 0,void 0,function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=se,c.f=l=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=wt})},p.onerror=()=>h(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const y=new Blob([new Uint8Array(l)],{type:"image/png"});p.src=l.byteLength?URL.createObjectURL(y):wt}),c.g=_n,c.h=(l,o)=>Sr(se(l,{type:"json"}),o),c.i=tt,c.j=Ct,c.k=Pe,c.l=(l,o)=>Sr(se(l,{type:"arrayBuffer"}),o),c.m=Sr,c.n=function(l){return new E_(l).readFields(iL,[])},c.o=Np,c.p=cb,c.q=go,c.r=o_,c.s=dr,c.t=fu,c.u=_t,c.v=Oe,c.w=Ke,c.x=Ll,c.y=function([l,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(h),y:l*Math.sin(o)*Math.sin(h),z:l*Math.cos(h)}},c.z=Qi}),i("worker",["./shared"],function(c){class u{constructor(B){this.keyCache={},B&&this.replace(B)}replace(B){this._layerConfigs={},this._layers={},this.update(B,[])}update(B,q){for(const ne of B){this._layerConfigs[ne.id]=ne;const xe=this._layers[ne.id]=c.az(ne);xe._featureFilter=c.a6(xe.filter),this.keyCache[ne.id]&&delete this.keyCache[ne.id]}for(const ne of q)delete this.keyCache[ne],delete this._layerConfigs[ne],delete this._layers[ne];this.familiesBySource={};const J=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const ne of J){const xe=ne.map(We=>this._layers[We.id]),Q=xe[0];if(Q.visibility==="none")continue;const we=Q.source||"";let de=this.familiesBySource[we];de||(de=this.familiesBySource[we]={});const Me=Q.sourceLayer||"_geojsonTileLayer";let Ue=de[Me];Ue||(Ue=de[Me]=[]),Ue.push(xe)}}}class m{constructor(B){const q={},J=[];for(const we in B){const de=B[we],Me=q[we]={};for(const Ue in de){const We=de[+Ue];if(!We||We.bitmap.width===0||We.bitmap.height===0)continue;const Xe={x:0,y:0,w:We.bitmap.width+2,h:We.bitmap.height+2};J.push(Xe),Me[Ue]={rect:Xe,metrics:We.metrics}}}const{w:ne,h:xe}=c.p(J),Q=new c.o({width:ne||1,height:xe||1});for(const we in B){const de=B[we];for(const Me in de){const Ue=de[+Me];if(!Ue||Ue.bitmap.width===0||Ue.bitmap.height===0)continue;const We=q[we][Me].rect;c.o.copy(Ue.bitmap,Q,{x:0,y:0},{x:We.x+1,y:We.y+1},Ue.bitmap)}}this.image=Q,this.positions=q}}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,q,J,ne){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=B,this.collisionBoxArray=new c.a4;const xe=new c.bj(Object.keys(B.layers).sort()),Q=new c.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const we={},de={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Me=q.familiesBySource[this.source];for(const sn in Me){const Er=B.layers[sn];if(!Er)continue;Er.version===1&&c.w(`Vector tile source "${this.source}" layer "${sn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const li=xe.encode(sn),Ji=[];for(let fo=0;fo=xi.maxzoom||xi.visibility!=="none"&&(S(fo,this.zoom,J),(we[xi.id]=xi.createBucket({index:Q.bucketLayerIDs.length,layers:fo,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:li,sourceID:this.source})).populate(Ji,de,this.tileID.canonical),Q.bucketLayerIDs.push(fo.map(zs=>zs.id)))}}const Ue=c.aE(de.glyphDependencies,sn=>Object.keys(sn).map(Number));this.inFlightDependencies.forEach(sn=>sn==null?void 0:sn.abort()),this.inFlightDependencies=[];let We=Promise.resolve({});if(Object.keys(Ue).length){const sn=new AbortController;this.inFlightDependencies.push(sn),We=ne.sendAsync({type:"GG",data:{stacks:Ue,source:this.source,tileID:this.tileID,type:"glyphs"}},sn)}const Xe=Object.keys(de.iconDependencies);let Lt=Promise.resolve({});if(Xe.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Lt=ne.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"icons"}},sn)}const Dt=Object.keys(de.patternDependencies);let Ht=Promise.resolve({});if(Dt.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Ht=ne.sendAsync({type:"GI",data:{icons:Dt,source:this.source,tileID:this.tileID,type:"patterns"}},sn)}const[Zt,xn,Xn]=yield Promise.all([We,Lt,Ht]),lr=new m(Zt),Qr=new c.bl(xn,Xn);for(const sn in we){const Er=we[sn];Er instanceof c.a5?(S(Er.layers,this.zoom,J),c.bm({bucket:Er,glyphMap:Zt,glyphPositions:lr.positions,imageMap:xn,imagePositions:Qr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Er.hasPattern&&(Er instanceof c.bn||Er instanceof c.bo||Er instanceof c.bp)&&(S(Er.layers,this.zoom,J),Er.addFeatures(de,this.tileID.canonical,Qr.patternPositions))}return this.status="done",{buckets:Object.values(we).filter(sn=>!sn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:lr.image,imageAtlas:Qr,glyphMap:this.returnDependencies?Zt:null,iconMap:this.returnDependencies?xn:null,glyphPositions:this.returnDependencies?lr.positions:null}})}}function S(le,B,q){const J=new c.a8(B);for(const ne of le)ne.recalculate(J,q)}class E{constructor(B,q,J){this.actor=B,this.layerIndex=q,this.availableImages=J,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(B,q){return c._(this,void 0,void 0,function*(){const J=yield c.l(B.request,q);try{return{vectorTile:new c.bq.VectorTile(new c.br(J.data)),rawData:J.data,cacheControl:J.cacheControl,expires:J.expires}}catch(ne){const xe=new Uint8Array(J.data);let Q=`Unable to parse the tile at ${B.request.url}, `;throw Q+=xe[0]===31&&xe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ne.messge}`,new Error(Q)}})}loadTile(B){return c._(this,void 0,void 0,function*(){const q=B.uid,J=!!(B&&B.request&&B.request.collectResourceTiming)&&new c.bs(B.request),ne=new w(B);this.loading[q]=ne;const xe=new AbortController;ne.abort=xe;try{const Q=yield this.loadVectorTile(B,xe);if(delete this.loading[q],!Q)return null;const we=Q.rawData,de={};Q.expires&&(de.expires=Q.expires),Q.cacheControl&&(de.cacheControl=Q.cacheControl);const Me={};if(J){const We=J.finish();We&&(Me.resourceTiming=JSON.parse(JSON.stringify(We)))}ne.vectorTile=Q.vectorTile;const Ue=ne.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[q]=ne,this.fetching[q]={rawTileData:we,cacheControl:de,resourceTiming:Me};try{const We=yield Ue;return c.e({rawTileData:we.slice(0)},We,de,Me)}finally{delete this.fetching[q]}}catch(Q){throw delete this.loading[q],ne.status="done",this.loaded[q]=ne,Q}})}reloadTile(B){return c._(this,void 0,void 0,function*(){const q=B.uid;if(!this.loaded||!this.loaded[q])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const J=this.loaded[q];if(J.showCollisionBoxes=B.showCollisionBoxes,J.status==="parsing"){const ne=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);let xe;if(this.fetching[q]){const{rawTileData:Q,cacheControl:we,resourceTiming:de}=this.fetching[q];delete this.fetching[q],xe=c.e({rawTileData:Q.slice(0)},ne,we,de)}else xe=ne;return xe}if(J.status==="done"&&J.vectorTile)return J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(B){return c._(this,void 0,void 0,function*(){const q=this.loading,J=B.uid;q&&q[J]&&q[J].abort&&(q[J].abort.abort(),delete q[J])})}removeTile(B){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[B.uid]&&delete this.loaded[B.uid]})}}class P{constructor(){this.loaded={}}loadTile(B){return c._(this,void 0,void 0,function*(){const{uid:q,encoding:J,rawImageData:ne,redFactor:xe,greenFactor:Q,blueFactor:we,baseShift:de}=B,Me=ne.width+2,Ue=ne.height+2,We=c.b(ne)?new c.R({width:Me,height:Ue},yield c.bt(ne,-1,-1,Me,Ue)):ne,Xe=new c.bu(q,We,J,xe,Q,we,de);return this.loaded=this.loaded||{},this.loaded[q]=Xe,Xe})}removeTile(B){const q=this.loaded,J=B.uid;q&&q[J]&&delete q[J]}}function D(le,B){if(le.length!==0){k(le[0],B);for(var q=1;q=Math.abs(we)?q-de+we:we-de+q,q=de}q+J>=0!=!!B&&le.reverse()}var V=c.bv(function le(B,q){var J,ne=B&&B.type;if(ne==="FeatureCollection")for(J=0;J>31}function Ze(le,B){for(var q=le.loadGeometry(),J=le.type,ne=0,xe=0,Q=q.length,we=0;wele},wt=Math.fround||(un=new Float32Array(1),le=>(un[0]=+le,un[0]));var un;const qt=3,At=5,hn=6;class Tn{constructor(B){this.options=Object.assign(Object.create(Ot),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:q,minZoom:J,maxZoom:ne}=this.options;q&&console.time("total time");const xe=`prepare ${B.length} points`;q&&console.time(xe),this.points=B;const Q=[];for(let de=0;de=J;de--){const Me=+Date.now();we=this.trees[de]=this._createTree(this._cluster(we,de)),q&&console.log("z%d: %d clusters in %dms",de,we.numItems,+Date.now()-Me)}return q&&console.timeEnd("total time"),this}getClusters(B,q){let J=((B[0]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,B[1]));let xe=B[2]===180?180:((B[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)J=-180,xe=180;else if(J>xe){const We=this.getClusters([J,ne,180,Q],q),Xe=this.getClusters([-180,ne,xe,Q],q);return We.concat(Xe)}const we=this.trees[this._limitZoom(q)],de=we.range(Rn(J),wr(Q),Rn(xe),wr(ne)),Me=we.data,Ue=[];for(const We of de){const Xe=this.stride*We;Ue.push(Me[Xe+At]>1?yn(Me,Xe,this.clusterProps):this.points[Me[Xe+qt]])}return Ue}getChildren(B){const q=this._getOriginId(B),J=this._getOriginZoom(B),ne="No cluster with the specified id.",xe=this.trees[J];if(!xe)throw new Error(ne);const Q=xe.data;if(q*this.stride>=Q.length)throw new Error(ne);const we=this.options.radius/(this.options.extent*Math.pow(2,J-1)),de=xe.within(Q[q*this.stride],Q[q*this.stride+1],we),Me=[];for(const Ue of de){const We=Ue*this.stride;Q[We+4]===B&&Me.push(Q[We+At]>1?yn(Q,We,this.clusterProps):this.points[Q[We+qt]])}if(Me.length===0)throw new Error(ne);return Me}getLeaves(B,q,J){const ne=[];return this._appendLeaves(ne,B,q=q||10,J=J||0,0),ne}getTile(B,q,J){const ne=this.trees[this._limitZoom(B)],xe=Math.pow(2,B),{extent:Q,radius:we}=this.options,de=we/Q,Me=(J-de)/xe,Ue=(J+1+de)/xe,We={features:[]};return this._addTileFeatures(ne.range((q-de)/xe,Me,(q+1+de)/xe,Ue),ne.data,q,J,xe,We),q===0&&this._addTileFeatures(ne.range(1-de/xe,Me,1,Ue),ne.data,xe,J,xe,We),q===xe-1&&this._addTileFeatures(ne.range(0,Me,de/xe,Ue),ne.data,-1,J,xe,We),We.features.length?We:null}getClusterExpansionZoom(B){let q=this._getOriginZoom(B)-1;for(;q<=this.options.maxZoom;){const J=this.getChildren(B);if(q++,J.length!==1)break;B=J[0].properties.cluster_id}return q}_appendLeaves(B,q,J,ne,xe){const Q=this.getChildren(q);for(const we of Q){const de=we.properties;if(de&&de.cluster?xe+de.point_count<=ne?xe+=de.point_count:xe=this._appendLeaves(B,de.cluster_id,J,ne,xe):xe1;let Ue,We,Xe;if(Me)Ue=_n(q,de,this.clusterProps),We=q[de],Xe=q[de+1];else{const Ht=this.points[q[de+qt]];Ue=Ht.properties;const[Zt,xn]=Ht.geometry.coordinates;We=Rn(Zt),Xe=wr(xn)}const Lt={type:1,geometry:[[Math.round(this.options.extent*(We*xe-J)),Math.round(this.options.extent*(Xe*xe-ne))]],tags:Ue};let Dt;Dt=Me||this.options.generateId?q[de+qt]:this.points[q[de+qt]].id,Dt!==void 0&&(Lt.id=Dt),Q.features.push(Lt)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,q){const{radius:J,extent:ne,reduce:xe,minPoints:Q}=this.options,we=J/(ne*Math.pow(2,q)),de=B.data,Me=[],Ue=this.stride;for(let We=0;Weq&&(Zt+=de[Xn+At])}if(Zt>Ht&&Zt>=Q){let xn,Xn=Xe*Ht,lr=Lt*Ht,Qr=-1;const sn=((We/Ue|0)<<5)+(q+1)+this.points.length;for(const Er of Dt){const li=Er*Ue;if(de[li+2]<=q)continue;de[li+2]=q;const Ji=de[li+At];Xn+=de[li]*Ji,lr+=de[li+1]*Ji,de[li+4]=sn,xe&&(xn||(xn=this._map(de,We,!0),Qr=this.clusterProps.length,this.clusterProps.push(xn)),xe(xn,this._map(de,li)))}de[We+4]=sn,Me.push(Xn/Zt,lr/Zt,1/0,sn,-1,Zt),xe&&Me.push(Qr)}else{for(let xn=0;xn1)for(const xn of Dt){const Xn=xn*Ue;if(!(de[Xn+2]<=q)){de[Xn+2]=q;for(let lr=0;lr>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,q,J){if(B[q+At]>1){const Q=this.clusterProps[B[q+hn]];return J?Object.assign({},Q):Q}const ne=this.points[B[q+qt]].properties,xe=this.options.map(ne);return J&&xe===ne?Object.assign({},xe):xe}}function yn(le,B,q){return{type:"Feature",id:le[B+qt],properties:_n(le,B,q),geometry:{type:"Point",coordinates:[(J=le[B],360*(J-.5)),kr(le[B+1])]}};var J}function _n(le,B,q){const J=le[B+At],ne=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,xe=le[B+hn],Q=xe===-1?{}:Object.assign({},q[xe]);return Object.assign(Q,{cluster:!0,cluster_id:le[B+qt],point_count:J,point_count_abbreviated:ne})}function Rn(le){return le/360+.5}function wr(le){const B=Math.sin(le*Math.PI/180),q=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return q<0?0:q>1?1:q}function kr(le){const B=(180-360*le)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function Sr(le,B,q,J){for(var ne,xe=J,Q=q-B>>1,we=q-B,de=le[B],Me=le[B+1],Ue=le[q],We=le[q+1],Xe=B+3;Xexe)ne=Xe,xe=Lt;else if(Lt===xe){var Dt=Math.abs(Xe-Q);DtJ&&(ne-B>3&&Sr(le,B,ne,J),le[ne+2]=xe,q-ne>3&&Sr(le,ne,q,J))}function dr(le,B,q,J,ne,xe){var Q=ne-q,we=xe-J;if(Q!==0||we!==0){var de=((le-q)*Q+(B-J)*we)/(Q*Q+we*we);de>1?(q=ne,J=xe):de>0&&(q+=Q*de,J+=we*de)}return(Q=le-q)*Q+(we=B-J)*we}function Qe(le,B,q,J){var ne={id:le===void 0?null:le,type:B,geometry:q,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xe){var Q=xe.geometry,we=xe.type;if(we==="Point"||we==="MultiPoint"||we==="LineString")ge(xe,Q);else if(we==="Polygon"||we==="MultiLineString")for(var de=0;de0&&(Q+=J?(ne*Me-de*xe)/2:Math.sqrt(Math.pow(de-ne,2)+Math.pow(Me-xe,2))),ne=de,xe=Me}var Ue=B.length-3;B[2]=1,Sr(B,0,Ue,q),B[Ue+2]=1,B.size=Math.abs(Q),B.start=0,B.end=B.size}function Oe(le,B,q,J){for(var ne=0;ne1?1:q}function ln(le,B,q,J,ne,xe,Q,we){if(J/=B,xe>=(q/=B)&&Q=J)return null;for(var de=[],Me=0;Me=q&&Dt=J)){var Ht=[];if(Xe==="Point"||Xe==="MultiPoint")er(We,Ht,q,J,ne);else if(Xe==="LineString")Mo(We,Ht,q,J,ne,!1,we.lineMetrics);else if(Xe==="MultiLineString")Os(We,Ht,q,J,ne,!1);else if(Xe==="Polygon")Os(We,Ht,q,J,ne,!0);else if(Xe==="MultiPolygon")for(var Zt=0;Zt=q&&Q<=J&&(B.push(le[xe]),B.push(le[xe+1]),B.push(le[xe+2]))}}function Mo(le,B,q,J,ne,xe,Q){for(var we,de,Me=ps(le),Ue=ne===0?Pi:xl,We=le.start,Xe=0;Xeq&&(de=Ue(Me,Lt,Dt,Zt,xn,q),Q&&(Me.start=We+we*de)):Xn>J?lr=q&&(de=Ue(Me,Lt,Dt,Zt,xn,q),Qr=!0),lr>J&&Xn<=J&&(de=Ue(Me,Lt,Dt,Zt,xn,J),Qr=!0),!xe&&Qr&&(Q&&(Me.end=We+we*de),B.push(Me),Me=ps(le)),Q&&(We+=we)}var sn=le.length-3;Lt=le[sn],Dt=le[sn+1],Ht=le[sn+2],(Xn=ne===0?Lt:Dt)>=q&&Xn<=J&&Va(Me,Lt,Dt,Ht),sn=Me.length-3,xe&&sn>=3&&(Me[sn]!==Me[0]||Me[sn+1]!==Me[1])&&Va(Me,Me[0],Me[1],Me[2]),Me.length&&B.push(Me)}function ps(le){var B=[];return B.size=le.size,B.start=le.start,B.end=le.end,B}function Os(le,B,q,J,ne,xe){for(var Q=0;QQ.maxX&&(Q.maxX=Ue),We>Q.maxY&&(Q.maxY=We)}return Q}function Jr(le,B,q,J){var ne=B.geometry,xe=B.type,Q=[];if(xe==="Point"||xe==="MultiPoint")for(var we=0;we0&&B.size<(ne?Q:J))q.numPoints+=B.length/3;else{for(var we=[],de=0;deQ)&&(q.numSimplified++,we.push(B[de]),we.push(B[de+1])),q.numPoints++;ne&&function(Me,Ue){for(var We=0,Xe=0,Lt=Me.length,Dt=Lt-2;Xe0===Ue)for(Xe=0,Lt=Me.length;Xe24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");var J=function(ne,xe){var Q=[];if(ne.type==="FeatureCollection")for(var we=0;we1&&console.time("creation"),Xe=this.tiles[We]=wl(le,B,q,J,de),this.tileCoords.push({z:B,x:q,y:J}),Me)){Me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,q,J,Xe.numFeatures,Xe.numPoints,Xe.numSimplified),console.timeEnd("creation"));var Lt="z"+B;this.stats[Lt]=(this.stats[Lt]||0)+1,this.total++}if(Xe.source=le,ne){if(B===de.maxZoom||B===ne)continue;var Dt=1<1&&console.time("clipping");var Ht,Zt,xn,Xn,lr,Qr,sn=.5*de.buffer/de.extent,Er=.5-sn,li=.5+sn,Ji=1+sn;Ht=Zt=xn=Xn=null,lr=ln(le,Ue,q-sn,q+li,0,Xe.minX,Xe.maxX,de),Qr=ln(le,Ue,q+Er,q+Ji,0,Xe.minX,Xe.maxX,de),le=null,lr&&(Ht=ln(lr,Ue,J-sn,J+li,1,Xe.minY,Xe.maxY,de),Zt=ln(lr,Ue,J+Er,J+Ji,1,Xe.minY,Xe.maxY,de),lr=null),Qr&&(xn=ln(Qr,Ue,J-sn,J+li,1,Xe.minY,Xe.maxY,de),Xn=ln(Qr,Ue,J+Er,J+Ji,1,Xe.minY,Xe.maxY,de),Qr=null),Me>1&&console.timeEnd("clipping"),we.push(Ht||[],B+1,2*q,2*J),we.push(Zt||[],B+1,2*q,2*J+1),we.push(xn||[],B+1,2*q+1,2*J),we.push(Xn||[],B+1,2*q+1,2*J+1)}}},tn.prototype.getTile=function(le,B,q){var J=this.options,ne=J.extent,xe=J.debug;if(le<0||le>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",le,B,q);for(var de,Me=le,Ue=B,We=q;!de&&Me>0;)Me--,Ue=Math.floor(Ue/2),We=Math.floor(We/2),de=this.tiles[$t(Me,Ue,We)];return de&&de.source?(xe>1&&console.log("found parent tile z%d-%d-%d",Me,Ue,We),xe>1&&console.time("drilling down"),this.splitTile(de.source,Me,Ue,We,le,B,q),xe>1&&console.timeEnd("drilling down"),this.tiles[we]?Ko(this.tiles[we],ne):null):null};class ga extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(B,q){return c._(this,void 0,void 0,function*(){const J=B.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ne=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!ne)return null;const xe=new class{constructor(we){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=we.length,this._features=we}feature(we){return new class{constructor(de){this._feature=de,this.extent=c.W,this.type=de.type,this.properties=de.tags,"id"in de&&!isNaN(de.id)&&(this.id=parseInt(de.id,10))}loadGeometry(){if(this._feature.type===1){const de=[];for(const Me of this._feature.geometry)de.push([new c.P(Me[0],Me[1])]);return de}{const de=[];for(const Me of this._feature.geometry){const Ue=[];for(const We of Me)Ue.push(new c.P(We[0],We[1]));de.push(Ue)}return de}}toGeoJSON(de,Me,Ue){return j.call(this,de,Me,Ue)}}(this._features[we])}}(ne.features);let Q=qe(xe);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:xe,rawData:Q.buffer}})}loadData(B){return c._(this,void 0,void 0,function*(){var q;(q=this._pendingRequest)===null||q===void 0||q.abort();const J=!!(B&&B.request&&B.request.collectResourceTiming)&&new c.bs(B.request);this._pendingRequest=new AbortController;try{let ne=yield this.loadGeoJSON(B,this._pendingRequest);if(delete this._pendingRequest,typeof ne!="object")throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(V(ne,!0),B.filter){const Q=c.by(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(de=>`${de.key}: ${de.message}`).join(", "));ne={type:"FeatureCollection",features:ne.features.filter(de=>Q.value.evaluate({zoom:0},de))}}this._geoJSONIndex=B.cluster?new Tn(function({superclusterOptions:Q,clusterProperties:we}){if(!we||!Q)return Q;const de={},Me={},Ue={accumulated:null,zoom:0},We={properties:null},Xe=Object.keys(we);for(const Lt of Xe){const[Dt,Ht]=we[Lt],Zt=c.by(Ht),xn=c.by(typeof Dt=="string"?[Dt,["accumulated"],["get",Lt]]:Dt);de[Lt]=Zt.value,Me[Lt]=xn.value}return Q.map=Lt=>{We.properties=Lt;const Dt={};for(const Ht of Xe)Dt[Ht]=de[Ht].evaluate(Ue,We);return Dt},Q.reduce=(Lt,Dt)=>{We.properties=Dt;for(const Ht of Xe)Ue.accumulated=Lt[Ht],Lt[Ht]=Me[Ht].evaluate(Ue,We)},Q}(B)).load(ne.features):function(Q,we){return new tn(Q,we)}(ne,B.geojsonVtOptions),this.loaded={};const xe={};if(J){const Q=J.finish();Q&&(xe.resourceTiming={},xe.resourceTiming[B.source]=JSON.parse(JSON.stringify(Q)))}return xe}catch(ne){if(delete this._pendingRequest,c.bz(ne))return{abandoned:!0};throw ne}})}reloadTile(B){const q=this.loaded;return q&&q[B.uid]?super.reloadTile(B):this.loadTile(B)}loadGeoJSON(B,q){return c._(this,void 0,void 0,function*(){const{promoteId:J}=B;if(B.request){const ne=yield c.h(B.request,q);return this._dataUpdateable=Jo(ne.data,J)?Kt(ne.data,J):void 0,ne.data}if(typeof B.data=="string")try{const ne=JSON.parse(B.data);return this._dataUpdateable=Jo(ne,J)?Kt(ne,J):void 0,ne}catch{throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`)}if(!B.dataDiff)throw new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${B.source}`);return function(ne,xe,Q){var we,de,Me,Ue;if(xe.removeAll&&ne.clear(),xe.remove)for(const We of xe.remove)ne.delete(We);if(xe.add)for(const We of xe.add){const Xe=Rr(We,Q);Xe!=null&&ne.set(Xe,We)}if(xe.update)for(const We of xe.update){let Xe=ne.get(We.id);if(Xe==null)continue;const Lt=!We.removeAllProperties&&(((we=We.removeProperties)===null||we===void 0?void 0:we.length)>0||((de=We.addOrUpdateProperties)===null||de===void 0?void 0:de.length)>0);if((We.newGeometry||We.removeAllProperties||Lt)&&(Xe=Object.assign({},Xe),ne.set(We.id,Xe),Lt&&(Xe.properties=Object.assign({},Xe.properties))),We.newGeometry&&(Xe.geometry=We.newGeometry),We.removeAllProperties)Xe.properties={};else if(((Me=We.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const Dt of We.removeProperties)Object.prototype.hasOwnProperty.call(Xe.properties,Dt)&&delete Xe.properties[Dt];if(((Ue=We.addOrUpdateProperties)===null||Ue===void 0?void 0:Ue.length)>0)for(const{key:Dt,value:Ht}of We.addOrUpdateProperties)Xe.properties[Dt]=Ht}}(this._dataUpdateable,B.dataDiff,J),{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 Gr{constructor(B){this.self=B,this.actor=new c.C(B),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(q,J)=>{if(this.externalWorkerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.externalWorkerSourceTypes[q]=J},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=q=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(q)},this.actor.registerMessageHandler("LDT",(q,J)=>this._getDEMWorkerSource(q,J.source).loadTile(J)),this.actor.registerMessageHandler("RDT",(q,J)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(q,J.source).removeTile(J)})),this.actor.registerMessageHandler("GCEZ",(q,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterExpansionZoom(J)})),this.actor.registerMessageHandler("GCC",(q,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterChildren(J)})),this.actor.registerMessageHandler("GCL",(q,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterLeaves(J)})),this.actor.registerMessageHandler("LD",(q,J)=>this._getWorkerSource(q,J.type,J.source).loadData(J)),this.actor.registerMessageHandler("LT",(q,J)=>this._getWorkerSource(q,J.type,J.source).loadTile(J)),this.actor.registerMessageHandler("RT",(q,J)=>this._getWorkerSource(q,J.type,J.source).reloadTile(J)),this.actor.registerMessageHandler("AT",(q,J)=>this._getWorkerSource(q,J.type,J.source).abortTile(J)),this.actor.registerMessageHandler("RMT",(q,J)=>this._getWorkerSource(q,J.type,J.source).removeTile(J)),this.actor.registerMessageHandler("RS",(q,J)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[q]||!this.workerSources[q][J.type]||!this.workerSources[q][J.type][J.source])return;const ne=this.workerSources[q][J.type][J.source];delete this.workerSources[q][J.type][J.source],ne.removeSource!==void 0&&ne.removeSource(J)})),this.actor.registerMessageHandler("RM",q=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[q],delete this.availableImages[q],delete this.workerSources[q],delete this.demWorkerSources[q]})),this.actor.registerMessageHandler("SR",(q,J)=>c._(this,void 0,void 0,function*(){this.referrer=J})),this.actor.registerMessageHandler("SRPS",(q,J)=>this._syncRTLPluginState(q,J)),this.actor.registerMessageHandler("IS",(q,J)=>c._(this,void 0,void 0,function*(){this.self.importScripts(J)})),this.actor.registerMessageHandler("SI",(q,J)=>this._setImages(q,J)),this.actor.registerMessageHandler("UL",(q,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(q).update(J.layers,J.removedIds)})),this.actor.registerMessageHandler("SL",(q,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(q).replace(J)}))}_setImages(B,q){return c._(this,void 0,void 0,function*(){this.availableImages[B]=q;for(const J in this.workerSources[B]){const ne=this.workerSources[B][J];for(const xe in ne)ne[xe].availableImages=q}})}_syncRTLPluginState(B,q){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(q.pluginStatus!=="loading")return c.bA.setState(q),q;const J=q.pluginURL;if(this.self.importScripts(J),c.bA.isParsed()){const ne={pluginStatus:"loaded",pluginURL:J};return c.bA.setState(ne),ne}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${J}`)})}_getAvailableImages(B){let q=this.availableImages[B];return q||(q=[]),q}_getLayerIndex(B){let q=this.layerIndexes[B];return q||(q=this.layerIndexes[B]=new u),q}_getWorkerSource(B,q,J){if(this.workerSources[B]||(this.workerSources[B]={}),this.workerSources[B][q]||(this.workerSources[B][q]={}),!this.workerSources[B][q][J]){const ne={sendAsync:(xe,Q)=>(xe.targetMapId=B,this.actor.sendAsync(xe,Q))};switch(q){case"vector":this.workerSources[B][q][J]=new E(ne,this._getLayerIndex(B),this._getAvailableImages(B));break;case"geojson":this.workerSources[B][q][J]=new ga(ne,this._getLayerIndex(B),this._getAvailableImages(B));break;default:this.workerSources[B][q][J]=new this.externalWorkerSourceTypes[q](ne,this._getLayerIndex(B),this._getAvailableImages(B))}}return this.workerSources[B][q][J]}_getDEMWorkerSource(B,q){return this.demWorkerSources[B]||(this.demWorkerSources[B]={}),this.demWorkerSources[B][q]||(this.demWorkerSources[B][q]=new P),this.demWorkerSources[B][q]}}return c.i(self)&&(self.worker=new Gr(self)),Gr}),i("index",["exports","./shared"],function(c,u){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:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const g=f.boundingClientRect;return new u.P((d.clientX-g.left)/f.x-s.clientLeft,(d.clientY-g.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],g=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,g={}},_.addThrottleControl=M=>{const R=d++;return g[R]=M,R},_.removeThrottleControl=M=>{delete g[M],C()},_.getImage=(M,R,z=!0)=>new Promise((F,X)=>{D.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:R,requestParameters:M,supportImageRefresh:z,state:"queued",onError:ie=>{X(ie)},onSuccess:ie=>{F(ie)}}),C()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:R,supportImageRefresh:z,onError:F,onSuccess:X,abortController:ie}=M,re=z===!1&&!u.i(self)&&!u.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((ve,Fe)=>ve&&Fe==="accept",!0));f++;const ue=re?T(R,ie):u.m(R,ie);try{const ve=yield ue;delete M.abortController,M.state="completed",ve.data instanceof HTMLImageElement||u.b(ve.data)?X(ve):ve.data&&X({data:yield($=ve.data,typeof createImageBitmap=="function"?u.d($):u.f($)),cacheControl:ve.cacheControl,expires:ve.expires})}catch(ve){delete M.abortController,F(ve)}finally{f--,C()}var $}),C=()=>{const M=(()=>{for(const R of Object.keys(g))if(g[R]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=f;R0;R++){const z=s.shift();z.abortController.signal.aborted?R--:v(z)}},T=(M,R)=>new Promise((z,F)=>{const X=new Image,ie=M.url,re=M.credentials;re&&re==="include"?X.crossOrigin="use-credentials":(re&&re==="same-origin"||!u.s(ie))&&(X.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{X.src="",F(u.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,z({data:X})},X.onerror=()=>{X.onerror=X.onload=null,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=ie})}(W||(W={})),W.resetRequestQueue();class Y{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(oe);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 oe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _e(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var se,ce=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};se=new u.A(3),u.A!=Float32Array&&(se[0]=0,se[1]=0,se[2]=0);var me=function(_){var s=_[0],f=_[1];return s*s+f*f};function Le(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:g}of _){const v=`${d}${g}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:g}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Z{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:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[g,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,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||u.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 fe(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Ke extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const 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 u.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)}:u.w(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const g={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.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 Z(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),g=this.atlasImage;g.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],T=C.x+1,M=C.y+1,R=this.getImage(v).data,z=R.width,F=R.height;u.R.copy(R,g,{x:0,y:0},{x:T,y:M},{width:z,height:F}),u.R.copy(R,g,{x:0,y:F-1},{x:T,y:M-1},{width:z,height:1}),u.R.copy(R,g,{x:0,y:0},{x:T,y:M+F},{width:z,height:1}),u.R.copy(R,g,{x:z-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(R,g,{x:0,y:0},{x:T+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),fe(d)&&this.updateImage(f,d)}}}const Ee=1e20;function Ze(_,s,f,d,g,v,C,T,M){for(let R=s;R-1);M++,v[M]=T,C[M]=R,C[M+1]=Ee}for(let T=0,M=0;T65535)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 T=qe.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const C=yield d.requests[v];for(const T in C)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=C[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new qe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:T})}const C=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}qe.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const g=256*s,v=g+255,C=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${g}-${v}`),"Glyphs"),T=yield u.l(C,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);const M={};for(const R of u.n(T.data))M[R.id]=R;return M})},qe.TinySDF=class{constructor({fontSize:_=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 T=this.size=_+4*s,M=this._createCanvas(T),R=this.ctx=M.getContext("2d",{willReadFrequently:!0});R.font=`${C} ${v} ${_}px ${g}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(_),C=Math.ceil(f),T=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=T+2*this.buffer,z=M+2*this.buffer,F=Math.max(R*z,0),X=new Uint8ClampedArray(F),ie={data:X,width:R,height:z,glyphWidth:T,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return ie;const{ctx:re,buffer:ue,gridInner:$,gridOuter:ve}=this;re.clearRect(ue,ue,T,M),re.fillText(_,ue,ue+C);const Fe=re.getImageData(ue,ue,T,M);ve.fill(Ee,0,F),$.fill(0,0,F);for(let he=0;he0?He*He:0,$[Ge]=He<0?He*He:0}}Ze(ve,0,0,R,z,R,this.f,this.v,this.z),Ze($,ue,ue,T,M,R,this.f,this.v,this.z);for(let he=0;he1&&(M=s[++T]);const z=Math.abs(R-M.left),F=Math.abs(R-M.right),X=Math.min(z,F);let ie;const re=v/d*(g+1);if(M.isDash){const ue=g-Math.abs(re);ie=Math.sqrt(X*X+ue*ue)}else ie=g-Math.sqrt(X*X+re*re);this.data[C+R]=Math.max(0,Math.min(255,ie+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],R=s[T+1];M.zeroLength?s.splice(T,1):R&&R.isDash===M.isDash&&(R.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const g=this.width*this.nextRow;let v=0,C=s[v];for(let T=0;T1&&(C=s[++v]);const M=Math.abs(T-C.left),R=Math.abs(T-C.right),z=Math.min(M,R);this.data[g+T]=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 u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[At]}numActive(){return Object.keys(this.active).length}}const Tn=Math.floor(E.hardwareConcurrency/2);let yn,_n;function Rn(){return yn||(yn=new hn),yn}hn.workerCount=u.B(globalThis)?Math.max(Math.min(Tn,3),1):1;class wr{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 kr(){return _n||(_n=new wr(Rn(),u.G),_n.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),_n}function Sr(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function dr(_,s,f,d,g,v){const C=function(F,X,ie){if(F)for(const re of F){const ue=X[re];if(ue&&ue.source===ie&&ue.type==="fill-extrusion")return!0}else for(const re in X){const ue=X[re];if(ue.source===ie&&ue.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,C);M.sort(Qe);const R=[];for(const F of M)R.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,g,v,T,Sr(_.transform,F.tileID))});const z=function(F){const X={},ie={};for(const re of F){const ue=re.queryResults,$=re.wrappedTileID,ve=ie[$]=ie[$]||{};for(const Fe in ue){const he=ue[Fe],Ce=ve[Fe]=ve[Fe]||{},Be=X[Fe]=X[Fe]||[];for(const Ge of he)Ce[Ge.featureIndex]||(Ce[Ge.featureIndex]=!0,Be.push(Ge))}}return X}(R);for(const F in z)z[F].forEach(X=>{const ie=X.feature,re=_.getFeatureState(ie.layer["source-layer"],ie.id);ie.source=ie.layer.source,ie.layer["source-layer"]&&(ie.sourceLayer=ie.layer["source-layer"]),ie.state=re});return z}function Qe(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function ge(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield E.frameAsync(f),!d)return null;const g=u.L(u.e(d,_),["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 Pe{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let g,v;if(s instanceof u.M)g=s,v=s;else{if(!(s instanceof Pe))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Pe.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(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 u.M(g.lng,g.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:d}=u.M.convert(s);let 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 Pe?s:s&&new Pe(s)}static fromLngLat(s,f=0){const d=360*f/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Pe(new u.M(s.lng-g,s.lat-d),new u.M(s.lng+g,s.lat+d))}}class Ct{constructor(s,f,d){this.bounds=Pe.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),g=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),C=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=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 u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let 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 u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Oe extends u.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=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ge(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new Ct(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield W.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 Z(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 u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class Yt extends Oe{constructor(s,f,d,g){super(s,f,d,g),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const g=yield W.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=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(g){if(delete s.abortController,s.aborted)s.state="unloaded";else if(g)throw s.state="errored",g}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return 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,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,g,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,g,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:g}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const 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 u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ln=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class er extends u.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 u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield W.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(g){let v=1/0,C=1/0,T=-1/0,M=-1/0;for(const X of g)v=Math.min(v,X.x),C=Math.min(C,X.y),T=Math.max(T,X.x),M=Math.max(M,X.y);const R=Math.max(T-v,M-C),z=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),F=Math.pow(2,z);return new u.a0(z,Math.floor((v+T)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Z(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 u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Mo extends er{constructor(s,f,d,g){super(s,f,d,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Z(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 u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ps extends 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 u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,ln.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Z(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 u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Os={},Va=_=>{switch(_){case"geojson":return Dr;case"image":return er;case"raster":return Oe;case"raster-dem":return Yt;case"vector":return Nn;case"video":return Mo;case"canvas":return ps}return Os[_]},Pi="RTLPluginLoaded";class xl extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=kr()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=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 u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Pi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ds=null;function it(){return ds||(ds=new xl),ds}class Ko{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.a3(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(s){const f=s+this.timeAdded;fv.getLayer(R)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(R=>M.filter(z=>z.id===R)[0]));for(const R of M)C[R.id]=T}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof u.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 u.a5&&v.hasRTLText){this.hasRTLText=!0,it().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 u.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Z(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Z(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,T,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:T,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 T=u.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 wl{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]||{},u.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=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete 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]={}),u.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 T of Object.keys(this.deletedStates[g][C]))delete this.state[g][C][T];v[C]=this.state[g][C]}d[g]=d[g]||{},u.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 Jr extends u.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,T)=>{const M=new(Va(v.type))(g,v,C,T);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 Ki(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new wl,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(g){s.state="errored",g.status!==404?this._source.fire(new u.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 u.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ht).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,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(ht).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=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 u.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,T),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 T=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()&&(T=R)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const 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?u.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 u.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(d=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(d=d.filter(z=>this._source.hasTile(z)))):d=[];const g=s.coveringZoomLevel(this._source),v=Math.max(g-Jr.maxOverzooming,this._source.minzoom),C=Math.max(g+Jr.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 ie=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[ie.key]=ie}d=d.concat(Object.values(z))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(tn(this._source.type)){const z={},F={},X=Object.keys(M),ie=E.now();for(const re of X){const ue=M[re],$=this._tiles[re];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=ie)continue;const ve=this.findLoadedParent(ue,v);ve&&(this._addTile(ve.tileID),z[ve.tileID.key]=ve.tileID),F[re]=ue}this._retainLoadedChildren(F,g,C,M);for(const re in z)M[re]||(this._coveredTiles[re]=!0,M[re]=z[re]);if(f){const re={},ue={};for(const $ of d)this._tiles[$.key].hasData()?re[$.key]=$:ue[$.key]=$;for(const $ in ue){const ve=ue[$].children(this._source.maxzoom);this._tiles[ve[0].key]&&this._tiles[ve[1].key]&&this._tiles[ve[2].key]&&this._tiles[ve[3].key]&&(re[ve[0].key]=M[ve[0].key]=ve[0],re[ve[1].key]=M[ve[1].key]=ve[1],re[ve[2].key]=M[ve[2].key]=ve[2],re[ve[3].key]=M[ve[3].key]=ve[3],delete ue[$])}for(const $ in ue){const ve=this.findLoadedParent(ue[$],this._source.minzoom);if(ve){re[ve.tileID.key]=M[ve.tileID.key]=ve.tileID;for(const Fe in re)re[Fe].isChildOf(ve.tileID)&&delete re[Fe]}}for(const $ in this._tiles)re[$]||(this._coveredTiles[$]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const R=u.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-Jr.maxOverzooming,this._source.minzoom),C=Math.max(f+Jr.maxUnderzooming,this._source.minzoom),T={};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 ie=R.hasData();if((z||ie)&&(d[X.key]=X),z=R.wasRequested(),ie)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 Ko(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const g=[],v=this.transform;if(!v)return g;const C=d?v.getCameraQueryGeometry(s):s,T=s.map(re=>v.pointCoordinate(re,this.terrain)),M=C.map(re=>v.pointCoordinate(re,this.terrain)),R=this.getIds();let z=1/0,F=1/0,X=-1/0,ie=-1/0;for(const re of M)z=Math.min(z,re.x),F=Math.min(F,re.y),X=Math.max(X,re.x),ie=Math.max(ie,re.y);for(let re=0;re=0&&he[1].y+Fe>=0){const Ce=T.map(Ge=>$.getTilePoint(Ge)),Be=M.map(Ge=>$.getTilePoint(Ge));g.push({tile:ue,tileID:$,queryGeometry:Ce,cameraQueryGeometry:Be,scale:ve})}}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(tn(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 ht(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function tn(_){return _==="raster"||_==="image"||_==="video"}Jr.maxOverzooming=10,Jr.maxUnderzooming=3;class $t{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-C)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Rr(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Jo{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,T=s+d,M=f-d,R=f+d;if(T<0||C>this.width||R<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,T,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,T,M){const{seenUids:R,hitTest:z,overlapMode:F}=T,X=this.boxCells[v];if(X!==null){const re=this.bboxes;for(const ue of X)if(!R.box[ue]){R.box[ue]=!0;const $=4*ue,ve=this.boxKeys[ue];if(s<=re[$+2]&&f<=re[$+3]&&d>=re[$+0]&&g>=re[$+1]&&(!M||M(ve))&&(!z||!Rr(F,ve.overlapMode))&&(C.push({key:ve,x1:re[$],y1:re[$+1],x2:re[$+2],y2:re[$+3]}),z))return!0}}const ie=this.circleCells[v];if(ie!==null){const re=this.circles;for(const ue of ie)if(!R.circle[ue]){R.circle[ue]=!0;const $=3*ue,ve=this.circleKeys[ue];if(this._circleAndRectCollide(re[$],re[$+1],re[$+2],s,f,d,g)&&(!M||M(ve))&&(!z||!Rr(F,ve.overlapMode))){const Fe=re[$],he=re[$+1],Ce=re[$+2];if(C.push({key:ve,x1:Fe-Ce,y1:he-Ce,x2:Fe+Ce,y2:he+Ce}),z)return!0}}}return!1}_queryCellCircle(s,f,d,g,v,C,T,M){const{circle:R,seenUids:z,overlapMode:F}=T,X=this.boxCells[v];if(X!==null){const re=this.bboxes;for(const ue of X)if(!z.box[ue]){z.box[ue]=!0;const $=4*ue,ve=this.boxKeys[ue];if(this._circleAndRectCollide(R.x,R.y,R.radius,re[$+0],re[$+1],re[$+2],re[$+3])&&(!M||M(ve))&&!Rr(F,ve.overlapMode))return C.push(!0),!0}}const ie=this.circleCells[v];if(ie!==null){const re=this.circles;for(const ue of ie)if(!z.circle[ue]){z.circle[ue]=!0;const $=3*ue,ve=this.circleKeys[ue];if(this._circlesCollide(re[$],re[$+1],re[$+2],R.x,R.y,R.radius)&&(!M||M(ve))&&!Rr(F,ve.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,g,v,C,T,M){const R=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),X=this._convertToYCellCoord(g);for(let ie=R;ie<=F;ie++)for(let re=z;re<=X;re++)if(v.call(this,s,f,d,g,this.xCellCount*re+ie,C,T,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,d,g,v,C){const T=g-s,M=v-f,R=d+C;return R*R>T*T+M*M}_circleAndRectCollide(s,f,d,g,v,C,T){const M=(C-g)/2,R=Math.abs(s-(g+M));if(R>M+d)return!1;const z=(T-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,ie=F-z;return X*X+ie*ie<=d*d}}function Kt(_,s,f,d,g){const v=u.F();return s?(u.J(v,v,[1/g,1/g,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ga(_,s,f,d,g){if(s){const v=u.ae(_);return u.J(v,v,[g,g,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Gr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],Lt(d,d,s));const g=d[3];return{point:new u.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function le(_,s){return .5+_/s*.5}function B(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function q(_,s,f,d,g,v,C,T,M,R){const z=d?_.textSizeData:_.iconSizeData,F=u.ag(z,f.transform.zoom),X=[256/f.width*2+1,256/f.height*2+1],ie=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;ie.clear();const re=_.lineVertexArray,ue=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,$=f.transform.width/f.transform.height;let ve=!1;for(let Fe=0;FeMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function xe(_,s,f,d,g,v,C,T,M,R,z,F,X,ie,re,ue){const $=s/24,ve=_.lineOffsetX*$,Fe=_.lineOffsetY*$;let he;if(_.numGlyphs>1){const Ce=_.glyphStartIndex+_.numGlyphs,Be=_.lineStartIndex,Ge=_.lineStartIndex+_.lineLength,He=J($,T,ve,Fe,f,z,F,_,M,v,X,re,ue);if(!He)return{notEnoughRoom:!0};const et=Gr(He.first.point,C,ue).point,$e=Gr(He.last.point,C,ue).point;if(d&&!f){const ut=ne(_.writingMode,et,$e,ie);if(ut)return ut}he=[He.first];for(let ut=_.glyphStartIndex+1;ut0?et.point:Q(F,He,Be,1,g,ue),ut=ne(_.writingMode,Be,$e,ie);if(ut)return ut}const Ce=Ue($*T.getoffsetX(_.glyphStartIndex),ve,Fe,f,z,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,X,re,ue);if(!Ce)return{notEnoughRoom:!0};he=[Ce]}for(const Ce of he)u.aj(R,Ce.point,Ce.angle);return{}}function Q(_,s,f,d,g,v){const C=Gr(_.add(_.sub(s)._unit()),g,v).point,T=f.sub(C);return f.add(T._mult(d/T.mag()))}function we(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:T,previousVertex:M,direction:R,absOffsetX:z}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),X=Gr(F,g,T);if(X.signedDistanceFromCamera>0)return f.projections[_]=X.point,X.point;const ie=_-R;return Q(C===0?v:new u.P(d.getx(ie),d.gety(ie)),F,M,z-C+1,g,T)}function de(_,s,f){return _._unit()._perp()._mult(s*f)}function Me(_,s,f,d,g,v,C,T){const{projectionCache:M,direction:R}=T;if(M.offsets[_])return M.offsets[_];const z=f.add(s);if(_+R=g)return M.offsets[_]=z,z;const F=we(_+R,T),X=de(F.sub(f),C,R),ie=f.add(X),re=F.add(X);return M.offsets[_]=u.ak(v,z,ie,re)||z,M.offsets[_]}function Ue(_,s,f,d,g,v,C,T,M,R,z,F,X,ie){const re=d?_-s:_+s;let ue=re>0?1:-1,$=0;d&&(ue*=-1,$=Math.PI),ue<0&&($+=Math.PI);let ve,Fe,he=ue>0?T+C:T+C+1,Ce=g,Be=g,Ge=0,He=0;const et=Math.abs(re),$e=[];let ut;for(;Ge+He<=et;){if(he+=ue,he=M)return null;Ge+=He,Be=Ce,Fe=ve;const pt={projectionCache:F,lineVertexArray:R,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:Ge,getElevation:ie,previousVertex:Be,direction:ue,absOffsetX:et};if(Ce=we(he,pt),f===0)$e.push(Be),ut=Ce.sub(Be);else{let Bt;const rn=Ce.sub(Be);Bt=rn.mag()===0?de(we(he+ue,pt).sub(Ce),f,ue):de(rn,f,ue),Fe||(Fe=Be.add(Bt)),ve=Me(he,Bt,Ce,T,M,Fe,f,pt),$e.push(Fe),ut=ve.sub(Fe)}He=ut.mag()}const ft=ut._mult((et-Ge)/He)._add(Fe||Be),nn=$+Math.atan2(Ce.y-Be.y,Ce.x-Be.x);return $e.push(ft),{point:ft,angle:X?nn:0,path:$e}}const We=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xe(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(We,3*d)}}function Lt(_,s,f){const d=s[0],g=s[1];return _[0]=f[0]*d+f[4]*g+f[12],_[1]=f[1]*d+f[5]*g+f[13],_[3]=f[3]*d+f[7]*g+f[15],_}const Dt=100;class Ht{constructor(s,f=new Jo(s.width+200,s.height+200,25),d=new Jo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Dt,this.screenBottomBoundary=s.height+Dt,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,g,v,C){const T=this.projectAndGetPerspectiveRatio(g,s.anchorPointX,s.anchorPointY,C),M=d*T.perspectiveRatio,R=s.x1*M+T.point.x,z=s.y1*M+T.point.y,F=s.x2*M+T.point.x,X=s.y2*M+T.point.y;return!this.isInsideGrid(R,z,F,X)||f!=="always"&&this.grid.hitTest(R,z,F,X,f,v)||T.perspectiveRatio=1;an--)rn.push(pt.path[an]);for(let an=1;anGr(fn,M,re));rn=an.some(fn=>fn.signedDistanceFromCamera<=0)?[]:an.map(fn=>fn.point)}let jt=[];if(rn.length>0){const an=rn[0].clone(),fn=rn[0].clone();for(let Tr=1;Tr=ut.x&&fn.x<=ft.x&&an.y>=ut.y&&fn.y<=ft.y?[rn]:fn.xft.x||fn.yft.y?[]:u.al([rn],ut.x,ut.y,ft.x,ft.y)}for(const an of jt){nn.reset(an,.25*$e);let fn=0;fn=nn.length<=.5*$e?1:Math.ceil(nn.paddedLength/Sn)+1;for(let Tr=0;Tr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,f,d,g){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function li(_,s,f,d,g){const{horizontalAlign:v,verticalAlign:C}=u.at(_);return new u.P(-(v-.5)*s+d[0]*g,-(C-.5)*f+d[1]*g)}function Ji(_,s,f,d,g,v){const{x1:C,x2:T,y1:M,y2:R,anchorPointX:z,anchorPointY:F}=_,X=new u.P(s,f);return d&&X._rotate(g?v:-v),{x1:C+X.x,y1:M+X.y,x2:T+X.x,y2:R+X.y,anchorPointX:z,anchorPointY:F}}class fo{constructor(s,f,d,g,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Ht(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Er(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 T=d.collisionBoxArray,M=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),z=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),X=M.get("text-pitch-alignment")==="map",ie=M.get("text-rotation-alignment")==="map",re=Zt(d,1,this.transform.zoom),ue=Kt(F,X,ie,this.transform,re);let $=null;if(X){const Fe=ga(F,X,ie,this.transform,re);$=u.K([],this.transform.labelPlaneMatrix,Fe)}this.retainedQueryData[v.bucketInstanceId]=new sn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const ve={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:ue,labelToScreenMatrix:$,scale:R,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(const Fe of v.sortKeyRanges){const{sortKey:he,symbolInstanceStart:Ce,symbolInstanceEnd:Be}=Fe;s.push({sortKey:he,symbolInstanceStart:Ce,symbolInstanceEnd:Be,parameters:ve})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:ve})}attemptAnchorPlacement(s,f,d,g,v,C,T,M,R,z,F,X,ie,re,ue,$){const ve=u.ap[s.textAnchor],Fe=[s.textOffset0,s.textOffset1],he=li(ve,d,g,Fe,v),Ce=this.collisionIndex.placeCollisionBox(Ji(f,he.x,he.y,C,T,this.transform.angle),F,M,R,z.predicate,$);if((!ue||this.collisionIndex.placeCollisionBox(Ji(ue,he.x,he.y,C,T,this.transform.angle),F,M,R,z.predicate,$).box.length!==0)&&Ce.box.length>0){let Be;if(this.prevPlacement&&this.prevPlacement.variableOffsets[X.crossTileID]&&this.prevPlacement.placements[X.crossTileID]&&this.prevPlacement.placements[X.crossTileID].text&&(Be=this.prevPlacement.variableOffsets[X.crossTileID].anchor),X.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[X.crossTileID]={textOffset:Fe,width:d,height:g,anchor:ve,textBoxScale:v,prevAnchor:Be},this.markUsedJustification(ie,ve,X,re),ie.allowVerticalPlacement&&(this.markUsedOrientation(ie,re,X),this.placedOrientations[X.crossTileID]=re),{shift:he,placedGlyphBoxes:Ce}}}placeLayerBucketPart(s,f,d){const{bucket:g,layout:v,posMatrix:C,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:R,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:X,collisionGroup:ie}=s.parameters,re=v.get("text-optional"),ue=v.get("icon-optional"),$=u.aq(v,"text-overlap","text-allow-overlap"),ve=$==="always",Fe=u.aq(v,"icon-overlap","icon-allow-overlap"),he=Fe==="always",Ce=v.get("text-rotation-alignment")==="map",Be=v.get("text-pitch-alignment")==="map",Ge=v.get("icon-text-fit")!=="none",He=v.get("symbol-z-order")==="viewport-y",et=ve&&(he||!g.hasIconData()||ue),$e=he&&(ve||!g.hasTextData()||re);!g.collisionArrays&&F&&g.deserializeCollisionBoxes(F);const ut=this.retainedQueryData[g.bucketInstanceId].tileID,ft=this.terrain?(pt,Bt)=>this.terrain.getElevation(ut,pt,Bt):null,nn=(pt,Bt)=>{var rn,Sn;if(f[pt.crossTileID])return;if(z)return void(this.placements[pt.crossTileID]=new lr(!1,!1,!1));let jt=!1,an=!1,fn=!0,Tr=null,qn={box:null,offscreen:null},Ro={box:null,offscreen:null},ui=null,gr=null,ci=null,No=0,Gs=0,Za=0;Bt.textFeatureIndex?No=Bt.textFeatureIndex:pt.useRuntimeCollisionCircles&&(No=pt.featureIndex),Bt.verticalTextFeatureIndex&&(Gs=Bt.verticalTextFeatureIndex);const yc=Bt.textBox;if(yc){const ei=ti=>{let _r=u.ah.horizontal;if(g.allowVerticalPlacement&&!ti&&this.prevPlacement){const ts=this.prevPlacement.placedOrientations[pt.crossTileID];ts&&(this.placedOrientations[pt.crossTileID]=ts,_r=ts,this.markUsedOrientation(g,_r,pt))}return _r},yr=(ti,_r)=>{if(g.allowVerticalPlacement&&pt.numVerticalGlyphVertices>0&&Bt.verticalTextBox){for(const ts of g.writingModes)if(ts===u.ah.vertical?(qn=_r(),Ro=qn):qn=ti(),qn&&qn.box&&qn.box.length)break}else qn=ti()},cr=pt.textAnchorOffsetStartIndex,es=pt.textAnchorOffsetEndIndex;if(es===cr){const ti=(_r,ts)=>{const ni=this.collisionIndex.placeCollisionBox(_r,$,R,C,ie.predicate,ft);return ni&&ni.box&&ni.box.length&&(this.markUsedOrientation(g,ts,pt),this.placedOrientations[pt.crossTileID]=ts),ni};yr(()=>ti(yc,u.ah.horizontal),()=>{const _r=Bt.verticalTextBox;return g.allowVerticalPlacement&&pt.numVerticalGlyphVertices>0&&_r?ti(_r,u.ah.vertical):{box:null,offscreen:null}}),ei(qn&&qn.box&&qn.box.length)}else{let ti=u.ap[(Sn=(rn=this.prevPlacement)===null||rn===void 0?void 0:rn.variableOffsets[pt.crossTileID])===null||Sn===void 0?void 0:Sn.anchor];const _r=(ni,Nr,Lp)=>{const Bm=ni.x2-ni.x1,Al=ni.y2-ni.y1,kl=pt.textBoxScale,Oh=Ge&&Fe==="never"?Nr:null;let Ya={box:[],offscreen:!1},Pp=$==="never"?1:2,Vm="never";ti&&Pp++;for(let Mp=0;Mp_r(yc,Bt.iconBox,u.ah.horizontal),()=>{const ni=Bt.verticalTextBox;return g.allowVerticalPlacement&&!(qn&&qn.box&&qn.box.length)&&pt.numVerticalGlyphVertices>0&&ni?_r(ni,Bt.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),qn&&(jt=qn.box,fn=qn.offscreen);const ts=ei(qn&&qn.box);if(!jt&&this.prevPlacement){const ni=this.prevPlacement.variableOffsets[pt.crossTileID];ni&&(this.variableOffsets[pt.crossTileID]=ni,this.markUsedJustification(g,ni.anchor,pt,ts))}}}if(ui=qn,jt=ui&&ui.box&&ui.box.length>0,fn=ui&&ui.offscreen,pt.useRuntimeCollisionCircles){const ei=g.text.placedSymbolArray.get(pt.centerJustifiedTextSymbolIndex),yr=u.ai(g.textSizeData,X,ei),cr=v.get("text-padding");gr=this.collisionIndex.placeCollisionCircles($,ei,g.lineVertexArray,g.glyphOffsetArray,yr,C,T,M,d,Be,ie.predicate,pt.collisionCircleDiameter,cr,ft),gr.circles.length&&gr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),jt=ve||gr.circles.length>0&&!gr.collisionDetected,fn=fn&&gr.offscreen}if(Bt.iconFeatureIndex&&(Za=Bt.iconFeatureIndex),Bt.iconBox){const ei=yr=>{const cr=Ge&&Tr?Ji(yr,Tr.x,Tr.y,Ce,Be,this.transform.angle):yr;return this.collisionIndex.placeCollisionBox(cr,Fe,R,C,ie.predicate,ft)};Ro&&Ro.box&&Ro.box.length&&Bt.verticalIconBox?(ci=ei(Bt.verticalIconBox),an=ci.box.length>0):(ci=ei(Bt.iconBox),an=ci.box.length>0),fn=fn&&ci.offscreen}const Xa=re||pt.numHorizontalGlyphVertices===0&&pt.numVerticalGlyphVertices===0,qs=ue||pt.numIconVertices===0;if(Xa||qs?qs?Xa||(an=an&&jt):jt=an&&jt:an=jt=an&&jt,jt&&ui&&ui.box&&this.collisionIndex.insertCollisionBox(ui.box,$,v.get("text-ignore-placement"),g.bucketInstanceId,Ro&&Ro.box&&Gs?Gs:No,ie.ID),an&&ci&&this.collisionIndex.insertCollisionBox(ci.box,Fe,v.get("icon-ignore-placement"),g.bucketInstanceId,Za,ie.ID),gr&&(jt&&this.collisionIndex.insertCollisionCircles(gr.circles,$,v.get("text-ignore-placement"),g.bucketInstanceId,No,ie.ID),d)){const ei=g.bucketInstanceId;let yr=this.collisionCircleArrays[ei];yr===void 0&&(yr=this.collisionCircleArrays[ei]=new Qr);for(let cr=0;cr=0;--Bt){const rn=pt[Bt];nn(g.symbolInstances.get(rn),g.collisionArrays[rn])}}else for(let pt=s.symbolInstanceStart;pt=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const g=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,C=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of C)s.text.placedSymbolArray.get(T).placedOrientation=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:{},T=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 T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const 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),T=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",ie=new Xn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const re=(ue,$,ve)=>{for(let Fe=0;Fe<$/4;Fe++)ue.opacityVertexArray.emplaceBack(ve);ue.hasVisibleVertices=ue.hasVisibleVertices||ve!==Yu};for(let ue=0;ue0,Ge=this.placedOrientations[$.crossTileID],He=Ge===u.ah.vertical,et=Ge===u.ah.horizontal||Ge===u.ah.horizontalOnly;if(ve>0||Fe>0){const $e=po(Ce.text);re(s.text,ve,He?Yu:$e),re(s.text,Fe,et?Yu:$e);const ut=Ce.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(pt=>{pt>=0&&(s.text.placedSymbolArray.get(pt).hidden=ut||He?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=ut||et?1:0);const ft=this.variableOffsets[$.crossTileID];ft&&this.markUsedJustification(s,ft.anchor,$,Ge);const nn=this.placedOrientations[$.crossTileID];nn&&(this.markUsedJustification(s,"left",$,nn),this.markUsedOrientation(s,nn,$))}if(Be){const $e=po(Ce.icon),ut=!(X&&$.verticalPlacedIconSymbolIndex&&He);$.placedIconSymbolIndex>=0&&(re(s.icon,$.numIconVertices,ut?$e:Yu),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Ce.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(re(s.icon,$.numVerticalIconVertices,ut?Yu:$e),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Ce.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $e=s.collisionArrays[ue];if($e){let ut=new u.P(0,0);if($e.textBox||$e.verticalTextBox){let nn=!0;if(R){const pt=this.variableOffsets[he];pt?(ut=li(pt.anchor,pt.width,pt.height,pt.textOffset,pt.textBoxScale),z&&ut._rotate(F?this.transform.angle:-this.transform.angle)):nn=!1}$e.textBox&&xi(s.textCollisionBox.collisionVertexArray,Ce.text.placed,!nn||He,ut.x,ut.y),$e.verticalTextBox&&xi(s.textCollisionBox.collisionVertexArray,Ce.text.placed,!nn||et,ut.x,ut.y)}const ft=!!(!et&&$e.verticalIconBox);$e.iconBox&&xi(s.iconCollisionBox.collisionVertexArray,Ce.icon.placed,ft,X?ut.x:0,X?ut.y:0),$e.verticalIconBox&&xi(s.iconCollisionBox.collisionVertexArray,Ce.icon.placed,!ft,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 ue=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ue.invProjMatrix,s.placementViewportMatrix=ue.viewportMatrix,s.collisionCircleArray=ue.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(_,s,f,d,g){_.emplaceBack(s?1:0,f?1:0,d||0,g||0),_.emplaceBack(s?1:0,f?1:0,d||0,g||0),_.emplaceBack(s?1:0,f?1:0,d||0,g||0),_.emplaceBack(s?1:0,f?1:0,d||0,g||0)}const zs=Math.pow(2,25),nm=Math.pow(2,24),qy=Math.pow(2,17),Un=Math.pow(2,16),Kf=Math.pow(2,9),Jf=Math.pow(2,8),Ao=Math.pow(2,1);function po(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*zs+s*nm+f*qy+s*Un+f*Kf+s*Jf+f*Ao+s}const Yu=0;class Qo{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,d,g,v){const C=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&E.now()-g>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=T)&&(!C.maxzoom||C.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Qo(C)),this._inProgressLayer.continuePlacement(d[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const iu=512/u.W/2;class Jc{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*iu),y:Math.floor(M.anchorY*iu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:R,y:z}of T.positions)M.add(R,z);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:g,z:v}=this.tileID.canonical,{x:C,y:T,z:M}=f.canonical,R=iu/Math.pow(2,M-v),z=(T*u.W+s.anchorY)*R,F=g*u.W*iu;return{x:Math.floor((C*u.W+s.anchorX)*R-d*u.W*iu),y:Math.floor(z-F)}}findMatches(s,f,d){const g=this.tileID.canonical.zs)}}class $r{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ku{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 T=g[C];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in C){const M=C[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,g)}else{const T=C[s.scaledTo(Number(v)).key];T&&T.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 mr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Qc=u.av();class ko extends u.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 wr(Rn(),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 Ke,this.imageManager.setEventedParent(this),this.glyphManager=new qe(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new qt(256,512),this.crossTileSymbolIndex=new Ua,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),it().on(Pi,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 T=this._layers[C];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(g,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Qc,{validate:!1})}_load(s,f,d){var g;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!mr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new un(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,T,M){return u._(this,void 0,void 0,function*(){const R=Le(v),z=T>1?"@2x":"",F={},X={};for(const{id:ie,url:re}of R){const ue=C.transformRequest(C.normalizeSpriteURL(re,z,".json"),"SpriteJSON");F[ie]=u.h(ue,M);const $=C.transformRequest(C.normalizeSpriteURL(re,z,".png"),"SpriteImage");X[ie]=W.getImage($,M)}return yield Promise.all([...Object.values(F),...Object.values(X)]),function(ie,re){return u._(this,void 0,void 0,function*(){const ue={};for(const $ in ie){ue[$]={};const ve=E.getImageCanvasContext((yield re[$]).data),Fe=(yield ie[$]).data;for(const he in Fe){const{width:Ce,height:Be,x:Ge,y:He,sdf:et,pixelRatio:$e,stretchX:ut,stretchY:ft,content:nn}=Fe[he];ue[$][he]={data:null,pixelRatio:$e,sdf:et,stretchX:ut,stretchY:ft,content:nn,spriteData:{width:Ce,height:Be,x:Ge,y:He,context:ve}}}}return ue})}(F,X)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const T=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const 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 u.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 u.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 u.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 u.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 T=this._updatedSources[C];if(T==="reload")this._reloadSource(C);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const 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 u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const g=this.serialize();if(s=f.transformStyle?f.transformStyle(g,s):s,((d=f.validate)===null||d===void 0||d)&&mr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.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 T of C.operations)T();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 u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[s]=new Jr(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 u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new u.j(new Error(`Layer "${g}" already exists on this map.`)));let v;if(s.type==="custom"){if(mr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=u.aA(s),s=u.e(s,{source:g})),this._validate(u.x.layer,`layers.${g}`,s,{arrayIndex:-1},d))return;v=u.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 u.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 T=this._removedLayers[g];delete this._removedLayers[g],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new u.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 u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const 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 u.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(!u.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(u.x.filter,`layers.${g.id}.filter`,f,null,d)||(g.filter=u.aA(f),this._updateLayer(g)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,g={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,g),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,g={}){this._checkLoaded();const v=this.getLayer(s);v?u.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 u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,g=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&g?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||g?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(g,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new u.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 u.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(C,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return u.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 T=this._order[C];if(f(T)){d[T]=C;for(const M of s){const R=M[T];if(R)for(const z of R)g.push(z)}}}g.sort((C,T)=>T.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T))for(let M=g.length-1;M>=0;M--){const R=g[M].feature;if(d[R.layer.id]{const et=ve.featureSortOrder;if(et){const $e=et.indexOf(Ge.featureIndex);return et.indexOf(He.featureIndex)-$e}return He.featureIndex-Ge.featureIndex});for(const Ge of Be)Ce.push(Ge)}}for(const ve in re)re[ve].forEach(Fe=>{const he=Fe.feature,Ce=R[T[ve].source].getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=Ce});return re}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(g,v){const C=g.getRenderableIds().map(R=>g.getTileByID(R)),T=[],M={};for(let R=0;RX.getTileByID(ie)).sort((ie,re)=>re.tileID.overscaledZ-ie.tileID.overscaledZ||(ie.tileID.isLessThan(re.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 $o(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()),T=!0),C&&this.pauseablePlacement.placement.setStale()),T||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 u._(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 u._(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(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},g){this._checkLoaded();const v=[{id:s,url:f}],C=[...Le(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",C,null,d)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,g))}removeSprite(s){this._checkLoaded();const f=Le(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Le(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var $c=u.X([{name:"a_pos",type:"Int16",components:2}]),Fs="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Ju={prelude:Gn(`#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:Gn(`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:Gn(`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:Gn(`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:Gn("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:Gn(`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:Gn(`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:Gn("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:Gn("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:Gn("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:Gn(`#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:Gn(`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:Gn(`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:Gn(`#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:Gn(`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:Gn(`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:Gn(`#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:Gn(`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:Gn(`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:Gn(`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:Gn(`#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:Gn(`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:Gn(`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:Gn(`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:Gn(`#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:Gn(`#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:Gn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Fs),terrainDepth:Gn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Fs),terrainCoords:Gn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Fs)};function Gn(_,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(g):g,T={};return{fragmentSource:_=_.replace(f,(M,R,z,F,X)=>(T[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 ie=F==="float"?"vec2":"vec4",re=X.match(/color/)?"color":ie;return T[X]?R==="define"?` -#ifndef HAS_UNIFORM_u_${X} -uniform lowp float u_${X}_t; -attribute ${z} ${ie} a_${X}; -varying ${z} ${F} ${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:re==="vec4"?` -#ifndef HAS_UNIFORM_u_${X} - ${X} = a_${X}; -#else - ${z} ${F} ${X} = u_${X}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${X} - ${X} = unpack_mix_${re}(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} ${ie} a_${X}; -#else -uniform ${z} ${F} u_${X}; -#endif -`:re==="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_${re}(a_${X}, u_${X}_t); -#else - ${z} ${F} ${X} = u_${X}; -#endif -`}),staticAttributes:d,staticUniforms:C}}class eh{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,T,M,R){this.context=s;let z=this.boundPaintVertexBuffers.length!==g.length;for(let F=0;!z&&F({u_depth:new u.aG(Ge,He.u_depth),u_terrain:new u.aG(Ge,He.u_terrain),u_terrain_dim:new u.aH(Ge,He.u_terrain_dim),u_terrain_matrix:new u.aI(Ge,He.u_terrain_matrix),u_terrain_unpack:new u.aJ(Ge,He.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Ge,He.u_terrain_exaggeration)}))(s,Be),this.binderUniforms=d?d.getUniforms(s,Be):[]}draw(s,f,d,g,v,C,T,M,R,z,F,X,ie,re,ue,$,ve,Fe){const he=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(he.TEXTURE2),he.bindTexture(he.TEXTURE_2D,M.depthTexture),s.activeTexture.set(he.TEXTURE3),he.bindTexture(he.TEXTURE_2D,M.texture);for(const Be in this.terrainUniforms)this.terrainUniforms[Be].set(M[Be])}for(const Be in this.fixedUniforms)this.fixedUniforms[Be].set(T[Be]);ue&&ue.setUniforms(s,this.binderUniforms,ie,{zoom:re});let Ce=0;switch(f){case he.LINES:Ce=2;break;case he.TRIANGLES:Ce=3;break;case he.LINE_STRIP:Ce=1}for(const Be of X.get()){const Ge=Be.vaos||(Be.vaos={});(Ge[R]||(Ge[R]=new eh)).bind(s,this,z,ue?ue.getPaintVertexBuffers():[],F,Be.vertexOffset,$,ve,Fe),he.drawElements(f,Be.primitiveLength*Ce,he.UNSIGNED_SHORT,Be.primitiveOffset*Ce*2)}}}function th(_,s,f){const d=1/Zt(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),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[C>>16,T>>16],u_pixel_coord_lower:[65535&C,65535&T]}}const Qu=(_,s,f,d)=>{const g=s.style.light,v=g.properties.get("position"),C=[v.x,v.y,v.z],T=function(){var R=new u.A(9);return u.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}(T,-s.transform.angle),function(R,z,F){var X=z[0],ie=z[1],re=z[2];R[0]=X*F[0]+ie*F[3]+re*F[6],R[1]=X*F[1]+ie*F[4]+re*F[7],R[2]=X*F[2]+ie*F[5]+re*F[8]}(C,C,T);const M=g.properties.get("color");return{u_matrix:_,u_lightpos:C,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},jy=(_,s,f,d,g,v,C)=>u.e(Qu(_,s,f,d),th(v,s,C),{u_height_factor:-Math.pow(2,g.overscaledZ)/C.tileSize/8}),rm=_=>({u_matrix:_}),nh=(_,s,f,d)=>u.e(rm(_),th(f,s,d)),Wy=(_,s)=>({u_matrix:_,u_world:s}),im=(_,s,f,d,g)=>u.e(nh(_,s,f,d),{u_world:g}),Hy=(_,s,f,d)=>{const g=_.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const T=Zt(f,1,g.zoom);v=!0,C=[T,T]}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:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:C}},om=(_,s,f)=>{const d=Zt(f,1,s.zoom),g=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:v}},sm=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),rh=_=>({u_matrix:_}),am=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:Zt(s,1,f),u_intensity:d});function lm(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const ih=(_,s,f,d)=>{const g=_.transform;return{u_matrix:$u(_,s,f,d),u_ratio:1/Zt(s,1,g.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},um=(_,s,f,d,g)=>u.e(ih(_,s,f,g),{u_image:0,u_image_height:d}),Sl=(_,s,f,d,g)=>{const v=_.transform,C=Do(s,v);return{u_matrix:$u(_,s,f,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Zt(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[C,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},oh=(_,s,f,d,g,v)=>{const C=_.lineAtlas,T=Do(s,_.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 u.e(ih(_,s,f,v),{u_patternscale_a:[T/F,-R.height/2],u_patternscale_b:[T/X,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,X)*_.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:z.y,u_mix:g.t})};function Do(_,s){return 1/Zt(_,1,s.tileZoom)}function $u(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const sh=(_,s,f,d,g)=>{return{u_matrix:_,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:ec(g.paint.get("raster-hue-rotate"))};var v,C};function ec(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const tc=(_,s,f,d,g,v,C,T,M,R)=>{const z=g.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:R,u_texture:0}},nc=(_,s,f,d,g,v,C,T,M,R,z)=>{const F=g.transform;return u.e(tc(_,s,f,d,g,v,C,T,M,R),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+z})},rc=(_,s,f,d,g,v,C,T,M,R)=>u.e(nc(_,s,f,d,g,v,C,T,!0,M,!0),{u_texsize_icon:R,u_texture_icon:1}),Zy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),Xy=(_,s,f,d,g,v)=>u.e(function(C,T,M,R){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:X,height:ie}=M.imageManager.getPixelSize(),re=Math.pow(2,R.tileID.overscaledZ),ue=R.tileSize*Math.pow(2,M.transform.tileZoom)/re,$=ue*(R.tileID.canonical.x+R.tileID.wrap*re),ve=ue*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,ie],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/Zt(R,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,ve>>16],u_pixel_coord_lower:[65535&$,65535&ve]}}(d,v,f,g),{u_matrix:_,u_opacity:s}),cm={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Yy{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 El={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ah{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=u.F(),ft=He;u.aP(ut,Ge.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(ut,ut,Ge.placementViewportMatrix),z.push({circleArray:$e,circleOffset:X,transform:ft,invTransform:ut,coord:Ce}),F+=$e.length/4,X=F}et&&R.draw(T,M.LINES,wn.disabled,rr.disabled,_.colorModeForRenderPass(),$n.disabled,om(He,_.transform,Be),_.style.map.terrain&&_.style.map.terrain.getTerrainData(Ce),f.id,et.layoutVertexBuffer,et.indexBuffer,et.segments,null,_.transform.zoom,null,null,et.collisionVertexBuffer)}if(!C||!z.length)return;const ie=_.useProgram("collisionCircle"),re=new u.aQ;re.resize(4*F),re._trim();let ue=0;for(const he of z)for(let Ce=0;Ce=0&&(re[$.associatedIconIndex]={shiftedAnchor:nn,angle:pt})}else Xe($.numGlyphs,X)}if(R){ie.clear();const ue=_.icon.placedSymbolArray;for(let $=0;$_.style.map.terrain.getElevation(et,ts,ni):null,_r=f.layout.get("text-rotation-alignment")==="map";q(ut,et.posMatrix,_,g,No,Gs,$,R,_r,ti)}const Xa=_.translatePosMatrix(et.posMatrix,$e,v,C),qs=ve||g&&Ge||yc?lp:No,ei=_.translatePosMatrix(Gs,$e,v,C,!0),yr=pt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let cr;cr=pt?ut.iconsInText?rc(Bt.kind,jt,Fe,$,_,Xa,qs,ei,fn,ui):nc(Bt.kind,jt,Fe,$,_,Xa,qs,ei,g,fn,!0):tc(Bt.kind,jt,Fe,$,_,Xa,qs,ei,g,fn);const es={program:Sn,buffers:ft,uniformValues:cr,atlasTexture:Tr,atlasTextureIcon:gr,atlasInterpolation:qn,atlasInterpolationIcon:Ro,isSDF:pt,hasHalo:yr};if(he&&ut.canOverlap){Ce=!0;const ti=ft.segments.get();for(const _r of ti)He.push({segments:new u.$([_r]),sortKey:_r.sortKey,state:es,terrainData:an})}else He.push({segments:ft.segments,sortKey:0,state:es,terrainData:an})}Ce&&He.sort((et,$e)=>et.sortKey-$e.sortKey);for(const et of He){const $e=et.state;if(X.activeTexture.set(ie.TEXTURE0),$e.atlasTexture.bind($e.atlasInterpolation,ie.CLAMP_TO_EDGE),$e.atlasTextureIcon&&(X.activeTexture.set(ie.TEXTURE1),$e.atlasTextureIcon&&$e.atlasTextureIcon.bind($e.atlasInterpolationIcon,ie.CLAMP_TO_EDGE)),$e.isSDF){const ut=$e.uniformValues;$e.hasHalo&&(ut.u_is_halo=1,vm($e.buffers,et.segments,f,_,$e.program,Be,z,F,ut,et.terrainData)),ut.u_is_halo=0}vm($e.buffers,et.segments,f,_,$e.program,Be,z,F,$e.uniformValues,et.terrainData)}}function vm(_,s,f,d,g,v,C,T,M,R){const z=d.context;g.draw(z,z.gl.TRIANGLES,v,C,T,$n.disabled,M,R,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function _h(_,s,f,d,g){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],T=v[f.from.toString()];if(!C&&T&&(C=T),!T&&C&&(T=C),!C||!T){const M=g.getPaintProperty(s);C=v[M],T=v[M]}C&&T&&_.setConstantPatternPositions(C,T)}function bm(_,s,f,d,g,v,C){const T=_.context.gl,M="fill-pattern",R=f.paint.get(M),z=R&&R.constantOr(1),F=f.getCrossfadeParameters();let X,ie,re,ue,$;C?(ie=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",X=T.LINES):(ie=z?"fillPattern":"fill",X=T.TRIANGLES);const ve=R.constantOr(null);for(const Fe of d){const he=s.getTile(Fe);if(z&&!he.patternsLoaded())continue;const Ce=he.getBucket(f);if(!Ce)continue;const Be=Ce.programConfigurations.get(f.id),Ge=_.useProgram(ie,Be),He=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Fe);z&&(_.context.activeTexture.set(T.TEXTURE0),he.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Be.updatePaintBuffers(F)),_h(Be,M,ve,he,f);const et=He?Fe:null,$e=_.translatePosMatrix(et?et.posMatrix:Fe.posMatrix,he,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){ue=Ce.indexBuffer2,$=Ce.segments2;const ut=[T.drawingBufferWidth,T.drawingBufferHeight];re=ie==="fillOutlinePattern"&&z?im($e,_,F,he,ut):Wy($e,ut)}else ue=Ce.indexBuffer,$=Ce.segments,re=z?nh($e,_,F,he):rm($e);Ge.draw(_.context,X,g,_.stencilModeForClipping(Fe),v,$n.disabled,re,He,f.id,Ce.layoutVertexBuffer,ue,$,f.paint,_.transform.zoom,Be)}}function vh(_,s,f,d,g,v,C){const T=_.context,M=T.gl,R="fill-extrusion-pattern",z=f.paint.get(R),F=z.constantOr(1),X=f.getCrossfadeParameters(),ie=f.paint.get("fill-extrusion-opacity"),re=z.constantOr(null);for(const ue of d){const $=s.getTile(ue),ve=$.getBucket(f);if(!ve)continue;const Fe=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ue),he=ve.programConfigurations.get(f.id),Ce=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",he);F&&(_.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),he.updatePaintBuffers(X)),_h(he,R,re,$,f);const Be=_.translatePosMatrix(ue.posMatrix,$,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ge=f.paint.get("fill-extrusion-vertical-gradient"),He=F?jy(Be,_,Ge,ie,ue,X,$):Qu(Be,_,Ge,ie);Ce.draw(T,T.gl.TRIANGLES,g,v,C,$n.backCCW,He,Fe,f.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,f.paint,_.transform.zoom,he,_.style.map.terrain&&ve.centroidVertexBuffer)}}function bh(_,s,f,d,g,v,C){const T=_.context,M=T.gl,R=f.fbo;if(!R)return;const z=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,R.colorAttachment.get()),z.draw(T,M.TRIANGLES,g,v,C,$n.disabled,((X,ie,re,ue)=>{const $=re.paint.get("hillshade-shadow-color"),ve=re.paint.get("hillshade-highlight-color"),Fe=re.paint.get("hillshade-accent-color");let he=re.paint.get("hillshade-illumination-direction")*(Math.PI/180);re.paint.get("hillshade-illumination-anchor")==="viewport"&&(he-=X.transform.angle);const Ce=!X.options.moving;return{u_matrix:ue?ue.posMatrix:X.transform.calculatePosMatrix(ie.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:lm(0,ie.tileID),u_light:[re.paint.get("hillshade-exaggeration"),he],u_shadow:$,u_highlight:ve,u_accent:Fe}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function up(_,s,f,d,g,v){const C=_.context,T=C.gl,M=s.dem;if(M&&M.data){const R=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(T.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(z),s.demTexture){const ie=s.demTexture;ie.update(F,{premultiply:!1}),ie.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new Z(C,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);C.activeTexture.set(T.TEXTURE0);let X=s.fbo;if(!X){const ie=new Z(C,{width:R,height:R,data:null},T.RGBA);ie.bind(T.LINEAR,T.CLAMP_TO_EDGE),X=s.fbo=C.createFramebuffer(R,R,!0,!1),X.colorAttachment.set(ie.texture)}C.bindFramebuffer.set(X.framebuffer),C.viewport.set([0,0,R,R]),_.useProgram("hillshadePrepare").draw(C,T.TRIANGLES,d,g,v,$n.disabled,((ie,re)=>{const ue=re.stride,$=u.F();return u.aN($,0,u.W,-u.W,0,0,1),u.H($,$,[0,-u.W,0]),{u_matrix:$,u_image:1,u_dimension:[ue,ue],u_zoom:ie.overscaledZ,u_unpack:re.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function xm(_,s,f,d,g,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const T=E.now(),M=(T-_.timeAdded)/C,R=s?(T-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(_.tileID.overscaledZ-F),ie=X&&_.refreshedUponExpiration?1:u.ac(X?M:1-R,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-ie}:{opacity:ie,mix:0}}return{opacity:1,mix:0}}const wm=new u.aO(1,0,0,1),xh=new u.aO(0,1,0,1),cp=new u.aO(0,0,1,1),i_=new u.aO(1,0,1,1),Sm=new u.aO(0,1,1,1);function Ir(_,s,f,d){$i(_,0,s+f/2,_.transform.width,f,d)}function qa(_,s,f,d){$i(_,s-f/2,0,f,_.transform.height,d)}function $i(_,s,f,d,g,v){const C=_.context,T=C.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,g*_.pixelRatio),C.clear({color:v}),T.disable(T.SCISSOR_TEST)}function hp(_,s,f){const d=_.context,g=d.gl,v=f.posMatrix,C=_.useProgram("debug"),T=wn.disabled,M=rr.disabled,R=_.colorModeForRenderPass(),z="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(g.TEXTURE0);const X=s.getTileByID(f.key).latestRawTileData,ie=Math.floor((X&&X.byteLength||0)/1024),re=s.getTile(f).tileSize,ue=512/Math.min(re,512)*(f.overscaledZ/_.transform.zoom)*.5;let $=f.canonical.toString();f.overscaledZ!==f.canonical.z&&($+=` => ${f.overscaledZ}`),function(ve,Fe){ve.initDebugOverlayCanvas();const he=ve.debugOverlayCanvas,Ce=ve.context.gl,Be=ve.debugOverlayCanvas.getContext("2d");Be.clearRect(0,0,he.width,he.height),Be.shadowColor="white",Be.shadowBlur=2,Be.lineWidth=1.5,Be.strokeStyle="white",Be.textBaseline="top",Be.font="bold 36px Open Sans, sans-serif",Be.fillText(Fe,5,5),Be.strokeText(Fe,5,5),ve.debugOverlayTexture.update(he),ve.debugOverlayTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE)}(_,`${$} ${ie}kB`),C.draw(d,g.TRIANGLES,T,M,qr.alphaBlended,$n.disabled,sm(v,u.aO.transparent,ue),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),C.draw(d,g.LINE_STRIP,T,M,R,$n.disabled,sm(v,u.aO.red),F,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function wh(_,s,f){const d=_.context,g=d.gl,v=_.colorModeForRenderPass(),C=new wn(g.LEQUAL,wn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const R of f){const z=_.renderToTexture.getTexture(R),F=s.getTerrainData(R.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,z.texture);const X={u_matrix:_.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,g.TRIANGLES,C,rr.disabled,v,$n.backCCW,X,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Em{constructor(s,f){this.context=new r_(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Jr.maxUnderzooming+Jr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ua}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 u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,$c.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,$c.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const g=new u.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(u.W,0,u.W,0),g.emplaceBack(0,u.W,0,u.W),g.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(g,ln.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,$c.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const C=new u.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new rr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,wn.disabled,this.stencilClearMode,qr.disabled,$n.disabled,rh(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(qr.disabled),d.setDepthMode(wn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const T=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,g.TRIANGLES,wn.disabled,new rr({func:g.ALWAYS,mask:0},T,255,g.KEEP,g.KEEP,g.REPLACE),qr.disabled,$n.disabled,rh(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new rr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new rr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((C,T)=>T.overscaledZ-C.overscaledZ),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 T=0;T=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.currentLayer$.source&&!$.isHidden(z)?[R.sourceCaches[$.source]]:[]),ie=X.filter($=>$.getSource().type==="vector"),re=X.filter($=>$.getSource().type!=="vector"),ue=$=>{(!F||F.getSource().maxzoom<$.getSource().maxzoom)&&(F=$)};return ie.forEach($=>ue($)),F||re.forEach($=>ue($)),F}(this.style,this.transform.zoom);M&&function(R,z,F){for(let X=0;X0),g&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const T=v.context,M=T.gl,R=qr.unblended,z=new wn(M.LEQUAL,wn.ReadWrite,[0,1]),F=C.getTerrainMesh(),X=C.sourceCache.getRenderableTiles(),ie=v.useProgram("terrainDepth");T.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const re of X){const ue=C.getTerrainData(re.tileID),$={u_matrix:v.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ie.draw(T,M.TRIANGLES,z,rr.disabled,R,$n.backCCW,$,ue,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const T=v.context,M=T.gl,R=qr.unblended,z=new wn(M.LEQUAL,wn.ReadWrite,[0,1]),F=C.getTerrainMesh(),X=C.getCoordsTexture(),ie=C.sourceCache.getRenderableTiles(),re=v.useProgram("terrainCoords");T.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),C.coordsIndex=[];for(const ue of ie){const $=C.getTerrainData(ue.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,X.texture);const ve={u_matrix:v.transform.calculatePosMatrix(ue.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};re.draw(T,M.TRIANGLES,z,rr.disabled,R,$n.backCCW,ve,$,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(ue.tileID.key)}T.bindFramebuffer.set(null),T.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,T,M,R){if(v.renderPass!=="translucent")return;const z=rr.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(X,ie,re,ue,$,ve,Fe){const he=ie.transform,Ce=$==="map",Be=ve==="map";for(const Ge of X){const He=ue.getTile(Ge),et=He.getBucket(re);if(!et||!et.text||!et.text.segments.get().length)continue;const $e=u.ag(et.textSizeData,he.zoom),ut=Zt(He,1,ie.transform.zoom),ft=Kt(Ge.posMatrix,Be,Ce,ie.transform,ut),nn=re.layout.get("icon-text-fit")!=="none"&&et.hasIconData();if($e){const pt=Math.pow(2,he.zoom-He.tileID.overscaledZ);mh(et,Ce,Be,Fe,he,ft,Ge.posMatrix,pt,$e,nn,ie.style.map.terrain?(Bt,rn)=>ie.style.map.terrain.getElevation(Ge,Bt,rn):null)}}}(M,v,T,C,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),R),T.paint.get("icon-opacity").constantOr(1)!==0&&yh(v,C,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),z,F),T.paint.get("text-opacity").constantOr(1)!==0&&yh(v,C,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(dh(v,C,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),dh(v,C,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,g,this.style.placement.variableOffsets);break;case"circle":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const R=T.paint.get("circle-opacity"),z=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),X=!T.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const ie=v.context,re=ie.gl,ue=v.depthModeForSublayer(0,wn.ReadOnly),$=rr.disabled,ve=v.colorModeForRenderPass(),Fe=[];for(let he=0;hehe.sortKey-Ce.sortKey);for(const he of Fe){const{programConfiguration:Ce,program:Be,layoutVertexBuffer:Ge,indexBuffer:He,uniformValues:et,terrainData:$e}=he.state;Be.draw(ie,re.TRIANGLES,ue,$,ve,$n.disabled,et,$e,T.id,Ge,He,he.segments,T.paint,v.transform.zoom,Ce)}})(s,f,d,g);break;case"heatmap":(function(v,C,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,z=R.gl,F=rr.disabled,X=new qr([z.ONE,z.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(ie,re,ue){const $=ie.gl;ie.activeTexture.set($.TEXTURE1),ie.viewport.set([0,0,re.width/4,re.height/4]);let ve=ue.heatmapFbo;if(ve)$.bindTexture($.TEXTURE_2D,ve.colorAttachment.get()),ie.bindFramebuffer.set(ve.framebuffer);else{const Fe=$.createTexture();$.bindTexture($.TEXTURE_2D,Fe),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_S,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_T,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MIN_FILTER,$.LINEAR),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MAG_FILTER,$.LINEAR),ve=ue.heatmapFbo=ie.createFramebuffer(re.width/4,re.height/4,!1,!1),function(he,Ce,Be,Ge){var He,et;const $e=he.gl,ut=(He=he.HALF_FLOAT)!==null&&He!==void 0?He:$e.UNSIGNED_BYTE,ft=(et=he.RGBA16F)!==null&&et!==void 0?et:$e.RGBA;$e.texImage2D($e.TEXTURE_2D,0,ft,Ce.width/4,Ce.height/4,0,$e.RGBA,ut,null),Ge.colorAttachment.set(Be)}(ie,re,Fe,ve)}})(R,v,T),R.clear({color:u.aO.transparent});for(let ie=0;ie{const he=u.F();u.aN(he,0,ue.width,ue.height,0,0,1);const Ce=ue.context.gl;return{u_matrix:he,u_world:[Ce.drawingBufferWidth,Ce.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(R,z),null,z.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,z.paint,R.transform.zoom)}(v,T))})(s,f,d,g);break;case"line":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const R=T.paint.get("line-opacity"),z=T.paint.get("line-width");if(R.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,wn.ReadOnly),X=v.colorModeForRenderPass(),ie=T.paint.get("line-dasharray"),re=T.paint.get("line-pattern"),ue=re.constantOr(1),$=T.paint.get("line-gradient"),ve=T.getCrossfadeParameters(),Fe=ue?"linePattern":ie?"lineSDF":$?"lineGradient":"line",he=v.context,Ce=he.gl;let Be=!0;for(const Ge of M){const He=C.getTile(Ge);if(ue&&!He.patternsLoaded())continue;const et=He.getBucket(T);if(!et)continue;const $e=et.programConfigurations.get(T.id),ut=v.context.program.get(),ft=v.useProgram(Fe,$e),nn=Be||ft.program!==ut,pt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ge),Bt=re.constantOr(null);if(Bt&&He.imageAtlas){const jt=He.imageAtlas,an=jt.patternPositions[Bt.to.toString()],fn=jt.patternPositions[Bt.from.toString()];an&&fn&&$e.setConstantPatternPositions(an,fn)}const rn=pt?Ge:null,Sn=ue?Sl(v,He,T,ve,rn):ie?oh(v,He,T,ie,ve,rn):$?um(v,He,T,et.lineClipsArray.length,rn):ih(v,He,T,rn);if(ue)he.activeTexture.set(Ce.TEXTURE0),He.imageAtlasTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE),$e.updatePaintBuffers(ve);else if(ie&&(nn||v.lineAtlas.dirty))he.activeTexture.set(Ce.TEXTURE0),v.lineAtlas.bind(he);else if($){const jt=et.gradients[T.id];let an=jt.texture;if(T.gradientVersion!==jt.version){let fn=256;if(T.stepInterpolant){const Tr=C.getSource().maxzoom,qn=Ge.canonical.z===Tr?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 Ga(this.context,Ju[s],f,cm[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 Z(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 ja{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(T=>{const M=1/(T=u.af([],T,s))[3]/f*g;return u.a$(T,T,[M,M,1/T[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(X,ie){var re=ie[0],ue=ie[1],$=ie[2],ve=re*re+ue*ue+$*$;return ve>0&&(ve=1/Math.sqrt(ve)),X[0]=ie[0]*ve,X[1]=ie[1]*ve,X[2]=ie[2]*ve,X}([],function(X,ie,re){var ue=ie[0],$=ie[1],ve=ie[2],Fe=re[0],he=re[1],Ce=re[2];return X[0]=$*Ce-ve*he,X[1]=ve*Fe-ue*Ce,X[2]=ue*he-$*Fe,X}([],ce([],v[T[0]],v[T[1]]),ce([],v[T[2]],v[T[1]]))),R=-((z=M)[0]*(F=v[T[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(R)});return new ja(v,C)}}class Wa{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=_e(this.min),g=_e(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let T=0;Tthis.max[g]-this.min[g])return 0}return 1}}class cu{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=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),g=u.ac((this.top+f-this.bottom)/2,0,f);return new u.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 cu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const fp=85.051129;class Sh{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 u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new cu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new Sh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,v){var C=g[0],T=g[1],M=g[2],R=g[3],z=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*z,d[1]=T*F+R*z,d[2]=C*-z+M*F,d[3]=T*-z+R*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),g=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),C=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,g.x,v.x,C.x)),M=Math.floor(Math.max(d.x,g.x,v.x,C.x)),R=1;for(let z=T-R;z<=M+R;z++)z!==0&&f.push(new u.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()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,g),R=[M*C.x,M*C.y,0],z=[M*T.x,M*T.y,0],F=ja.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let X=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(X=g);const ie=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,re=he=>({aabb:new Wa([he*M,0,0],[(he+1)*M,M,0]),zoom:0,x:0,y:0,wrap:he,fullyVisible:!1}),ue=[],$=[],ve=g,Fe=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let he=1;he<=3;he++)ue.push(re(-he)),ue.push(re(he));for(ue.push(re(0));ue.length>0;){const he=ue.pop(),Ce=he.x,Be=he.y;let Ge=he.fullyVisible;if(!Ge){const ft=he.aabb.intersects(F);if(ft===0)continue;Ge=ft===2}const He=s.terrain?R:z,et=he.aabb.distanceX(He),$e=he.aabb.distanceY(He),ut=Math.max(Math.abs(et),Math.abs($e));if(he.zoom===ve||ut>ie+(1<=X){const ft=ve-he.zoom,nn=R[0]-.5-(Ce<>1),Bt=he.zoom+1;let rn=he.aabb.quadrant(ft);if(s.terrain){const Sn=new u.Q(Bt,he.wrap,Bt,nn,pt),jt=s.terrain.getMinMaxElevation(Sn),an=(f=jt.minElevation)!==null&&f!==void 0?f:this.elevation,fn=(d=jt.maxElevation)!==null&&d!==void 0?d:this.elevation;rn=new Wa([rn.min[0],rn.min[1],an],[rn.max[0],rn.max[1],fn])}ue.push({aabb:rn,zoom:Bt,x:nn,y:pt,wrap:he.wrap,fullyVisible:Ge})}}return $.sort((he,Ce)=>he.distanceSq-Ce.distanceSq).map(he=>he.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=u.ac(s.lat,-85.051129,fp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-v))return;const C=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/C/u.b3(1,g.lat),M=this.scaleZoom(T/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 u.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 u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const X=f.pointCoordinate(s);if(X!=null)return X}const d=[s.x,s.y,0,1],g=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(g,g,this.pixelMatrixInverse);const v=d[3],C=g[3],T=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 u.Y(u.z.number(d[0]/v,g[0]/C,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(g,g,d),new u.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Pe().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Pe([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,fp])}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),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*C,v.y*C,0]),u.J(M,M,[C/u.W,C/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),g[d]=new Float32Array(M),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const he=179.9999999999;g=[-he,he]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,T=v,M=0,R=v,z=0,F=0;const{x:X,y:ie}=this.size;if(this.latRange){const he=this.latRange;C=u.O(he[1])*v,T=u.O(he[0])*v,T-CT&&(ve=T-he)}if(g){const he=(M+R)/2;let Ce=re;this._renderWorldCopies&&(Ce=u.b1(re,he-v/2,he+v/2));const Be=X/2;Ce-BeR&&($=R-Be)}if($!==void 0||ve!==void 0){const he=new u.P($??re,ve??ue);d.center=this.unproject.call({worldSize:v},he).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let g=u.an(new Float64Array(16));u.J(g,g,[this.width/2,-this.height/2,1]),u.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=u.an(new Float64Array(16)),u.J(g,g,[1,-1,1]),u.H(g,g,[-1,-1,0]),u.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),T=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?T:v,R=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(u.ac(Math.PI-R-z,.01,Math.PI-.01)),X=this.getHorizon(),ie=2*Math.atan(X/this.cameraToCenterDistance)*(.5+s.y/(2*X)),re=Math.sin(ie)*M/Math.sin(u.ac(Math.PI-R-ie,.01,Math.PI-.01)),ue=Math.min(F,re),$=1.01*(Math.cos(Math.PI/2-this._pitch)*ue+M),ve=this.height/50;g=new Float64Array(16),u.b4(g,this._fov,this.width/this.height,ve,$),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,u.J(g,g,[1,-1,1]),u.H(g,g,[0,0,-this.cameraToCenterDistance]),u.b5(g,g,this._pitch),u.ad(g,g,this.angle),u.H(g,g,[-f,-d,0]),this.mercatorMatrix=u.J([],g,[this.worldSize,this.worldSize,this.worldSize]),u.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,g),u.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=u.ar([],g),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,g);const Fe=this.width%2/2,he=this.height%2/2,Ce=Math.cos(this.angle),Be=Math.sin(this.angle),Ge=f-Math.round(f)+Ce*Fe+Be*he,He=d-Math.round(d)+Ce*he+Be*Fe,et=new Float64Array(g);if(u.H(et,et,[Ge>.5?Ge-1:Ge,He>.5?He-1:He,0]),this.alignedProjMatrix=et,g=u.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 u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,g=f.y,v=f.x,C=f.y;for(const T of s)d=Math.min(d,T.x),g=Math.min(g,T.y),v=Math.max(v,T.x),C=Math.max(C,T.y);return[new u.P(d,g),new u.P(v,g),new u.P(v,C),new u.P(d,C),new u.P(d,g)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),g=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(g,g,this.projMatrix),g[2]/g[3]}}function pp(_,s){let f,d=!1,g=null,v=null;const C=()=>{g=null,d&&(_.apply(v,f),g=setTimeout(C,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,g||C(),g)}class dp{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=pp(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,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),R=this._map.getPitch();let z="";if(z+=s?`/${C}/${T}/${d}`:`${d}/${T}/${C}`,(M||R)&&(z+="/"+Math.round(10*M)/10),R&&(z+=`/${Math.round(R)}`),this._hashName){const F=this._hashName;let X=!1;const ie=window.location.hash.slice(1).split("&").map(re=>{const ue=re.split("=")[0];return ue===F?(X=!0,`${ue}=${z}`):re}).filter(re=>re);return X||ie.push(`${F}=${z}`),`#${ie.join("&")}`}return`#${z}`}}const oc={linearity:.3,easing:u.b6(0,0,.3,1)},Tl=u.e({deceleration:2500,maxSpeed:1400},oc),Im=u.e({deceleration:20,maxSpeed:1400},oc),Cm=u.e({deceleration:1e3,maxSpeed:360},oc),Tm=u.e({deceleration:1e3,maxSpeed:90},oc);class Lm{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 u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(f.pan.mag()){const v=ac(f.pan.mag(),d,u.e({},Tl,s||{}));g.offset=f.pan.mult(v.amount/f.pan.mag()),g.center=this._map.transform.center,sc(g,v)}if(f.zoom){const v=ac(f.zoom,d,Im);g.zoom=this._map.transform.zoom+v.amount,sc(g,v)}if(f.bearing){const v=ac(f.bearing,d,Cm);g.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),sc(g,v)}if(f.pitch){const v=ac(f.pitch,d,Tm);g.pitch=this._map.transform.pitch+v.amount,sc(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(),u.e(g,{noMoveStart:!0})}}function sc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,R,z,F)=>M.add(R.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:C,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class mp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ms{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new mp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new mo(s.type,this._map,s))}mouseup(s){this._map.fire(new mo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new mo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new mo(s.type,this._map,s))}mouseover(s){this._map.fire(new mo(s.type,this._map,s))}mouseout(s){this._map.fire(new mo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Bs(s.type,this._map,s))}touchmove(s){this._map.fire(new Bs(s.type,this._map,s))}touchend(s){this._map.fire(new Bs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Bs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new mo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new mo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new mo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(u.P.convert(s),this._map.terrain)}}class gs{constructor(s,f){this._map=s,this._tr=new hu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,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&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function Ll(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class o_{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const v=new u.P(0,0);for(const C of g)v._add(C);return v.div(g.length)}(f),this.touches=Ll(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const g=Ll(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 gp{constructor(s){this.singleTap=new o_(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 s_{constructor(s){this._tr=new hu(s),this._zoomIn=new gp({numTouches:1,numTaps:2}),this._zoomOut=new gp({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:T=>T.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fu{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=f.length?f[0]:f;return!this._moved&&g.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},pu=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Us({checkCorrectEvent:g=>P.mouseButton(g)===0&&g.ctrlKey||P.mouseButton(g)===2});return new fu({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*f}),moveStateManager:d,enable:_,assignEvents:Eh})},du=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Us({checkCorrectEvent:g=>P.mouseButton(g)===0&&g.ctrlKey||P.mouseButton(g)===2});return new fu({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*f}),moveStateManager:d,enable:_,assignEvents:Eh})};class Pm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const g=Ll(d,f),v=new u.P(0,0),C=new u.P(0,0);let T=0;for(const R in g){const z=g[R],F=this._touches[R];F&&(v._add(z),C._add(z.sub(F)),T++,g[R]=z)}if(this._touches=g,TMath.abs(_.x)}class km extends _t{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Ch(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 Ch(s)&&Ch(f)&&C}}const a_={panStep:100,bearingStep:15,pitchStep:10};class Ha{constructor(s){this._tr=new hu(s);const f=a_;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:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:ur,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 ur(_){return _*(2-_)}const uc=4.000244140625;class Th{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new hu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=E.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%uc==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=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>uc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));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 T=Math.min((E.now()-this._lastWheelEventTime)/200,1),M=g(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,g=(E.now()-d.start)/d.duration,v=d.easing(g+.01)-d.easing(g),C=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-C*C);f=u.b6(C,T,.25,1)}return this._prevEase={start: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 _p{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 Dm{constructor(s){this._tr=new hu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rm{constructor(){this._tap=new gp({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 Nm{constructor(s,f,d){this._el=s,this._mousePan=f,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ys{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class cc{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 kt{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),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&&(P.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ft=_=>_.zoom||_.drag||_.pitch||_.rotate;class Lh extends u.k{}function hc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class vp{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,T={needsRenderFrame:!1},M={},R={},z=g.touches,F=z?this._getMapTouches(z):void 0,X=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),g);for(const{handlerName:ue,handler:$,allowed:ve}of this._handlers){if(!$.isEnabled())continue;let Fe;this._blockedByActive(R,ve,ue)?$.reset():$[v||g.type]&&(Fe=$[v||g.type](g,X,F),this.mergeHandlerResult(T,M,Fe,ue,C),Fe&&Fe.needsRenderFrame&&this._triggerRenderFrame()),(Fe||$.isActive())&&(R[ue]=$)}const ie={};for(const ue in this._previousActiveHandlers)R[ue]||(ie[ue]=C);this._previousActiveHandlers=R,(Object.keys(ie).length||hc(T))&&(this._changes.push([T,M,ie]),this._triggerRenderFrame()),(Object.keys(R).length||hc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:re}=T;re&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],re(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Lm(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)P.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ms(f,s));const g=f.boxZoom=new gs(f,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const v=f.cooperativeGestures=new kt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new s_(f),T=new Dm(f);f.doubleClickZoom=new _p(T,C),this._add("tapZoom",C),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Rm;this._add("tapDragZoom",M);const R=f.touchPitch=new km(f);this._add("touchPitch",R),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=pu(s),F=du(s);f.dragRotate=new ys(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const X=(({enable:Fe,clickTolerance:he})=>{const Ce=new Us({checkCorrectEvent:Be=>P.mouseButton(Be)===0&&!Be.ctrlKey});return new fu({clickTolerance:he,move:(Be,Ge)=>({around:Ge,panDelta:Ge.sub(Be)}),activateOnStart:!0,moveStateManager:Ce,enable:Fe,assignEvents:Eh})})(s),ie=new Pm(s,f);f.dragPan=new Nm(d,X,ie),this._add("mousePan",X),this._add("touchPan",ie,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const re=new yp,ue=new Am;f.touchZoomRotate=new cc(d,ue,re,M),this._add("touchRotate",re,["touchPan","touchZoom"]),this._add("touchZoom",ue,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const $=f.scrollZoom=new Th(f,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const ve=f.keyboard=new Ha(f);this._add("keyboard",ve),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Vs(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ft(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const 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;u.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 u.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),u.e(f,v),u.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(!(hc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,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 ie=v.pointLocation(T?F.sub(T):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(T)):v.setLocationAtPoint(ie,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(ie,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(g.terrain)})):v.setLocationAtPoint(ie,F),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const g=Ft(this._eventsInProgress),v=Ft(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!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 T={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:X}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||X,T[`${z}end`]=M)}for(const z in T)this._fireEvent(z,T[z]);const R=Ft(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 Lh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class go extends u.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 u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=u.z.number(v,$,He)),this._rotating&&(g.bearing=u.z.number(C,R,He)),this._pitching&&(g.pitch=u.z.number(T,z,He)),this._padding&&(g.interpolatePadding(M,F,He),ie=g.centerPoint.add(X)),this.terrain&&!s.freezeElevation&&this._updateElevation(He),Ce)g.setLocationAtPoint(Ce,Be);else{const et=g.zoomScale(g.zoom-v),$e=$>v?Math.min(2,he):Math.max(.5,he),ut=Math.pow($e,1-He),ft=g.unproject(ve.add(Fe.mult(He*ut)).mult(et));g.setLocationAtPoint(g.renderWorldCopies?ft.wrap():ft,ie)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},He=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,He)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:d,zoom:g,pitch:v,bearing:C,elevation:T}=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),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,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 u.k("zoomend",s)),g&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&E.prefersReducedMotion){const Sn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Sn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const g=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),T=this.getPitch(),M=this.getPadding(),R="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:g.padding,X=u.P.convert(s.offset);let ie=g.centerPoint.add(X);const re=g.pointLocation(ie),{center:ue,zoom:$}=g.getConstrained(u.M.convert(s.center||re),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(ue);const ve=g.zoomScale($-v),Fe=g.project(re),he=g.project(ue).sub(Fe);let Ce=s.curve;const Be=Math.max(g.width,g.height),Ge=Be/ve,He=he.mag();if("minZoom"in s){const Sn=u.ac(Math.min(s.minZoom,v,$),g.minZoom,g.maxZoom),jt=Be/g.zoomScale(Sn-v);Ce=Math.sqrt(jt/He*2)}const et=Ce*Ce;function $e(Sn){const jt=(Ge*Ge-Be*Be+(Sn?-1:1)*et*et*He*He)/(2*(Sn?Ge:Be)*et*He);return Math.log(Math.sqrt(jt*jt+1)-jt)}function ut(Sn){return(Math.exp(Sn)-Math.exp(-Sn))/2}function ft(Sn){return(Math.exp(Sn)+Math.exp(-Sn))/2}const nn=$e(!1);let pt=function(Sn){return ft(nn)/ft(nn+Ce*Sn)},Bt=function(Sn){return Be*((ft(nn)*(ut(jt=nn+Ce*Sn)/ft(jt))-ut(nn))/et)/He;var jt},rn=($e(!0)-nn)/Ce;if(Math.abs(He)<1e-6||!isFinite(rn)){if(Math.abs(Be-Ge)<1e-6)return this.easeTo(s,f);const Sn=Ges.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==R,this._pitching=z!==T,this._padding=!g.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(ue),this._ease(Sn=>{const jt=Sn*rn,an=1/pt(jt);g.zoom=Sn===1?$:v+g.scaleZoom(an),this._rotating&&(g.bearing=u.z.number(C,R,Sn)),this._pitching&&(g.pitch=u.z.number(T,z,Sn)),this._padding&&(g.interpolatePadding(M,F,Sn),ie=g.centerPoint.add(X)),this.terrain&&!s.freezeElevation&&this._updateElevation(Sn);const fn=Sn===1?ue:g.unproject(Fe.add(he.mult(Bt(jt))).mult(an));g.setLocationAtPoint(g.renderWorldCopies?fn.wrap():fn,ie),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=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const bp={compact:!0,customAttribution:'MapLibre'};class _s{constructor(s=bp){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){P.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const d=this._map._getUIString(`AttributionControl.${f}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(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 Om{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=P.create("div","maplibregl-ctrl");const f=P.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class fc{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 Cr=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class jr extends u.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const 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),u.aN(g.posMatrix,0,u.W,0,u.W,0,1),this._tiles[g.key]=new Ko(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),u.aN(v.posMatrix,0,u.W,0,u.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,T=g.canonical.x-(g.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,R,0,R,0,1),u.H(v.posMatrix,v.posMatrix,[-T*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,T=s.canonical.x-(s.canonical.x>>C<>C<>C;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*R,M*R,0]),u.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let 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 zm{constructor(s,f,d){this.painter=s,this.sourceCache=new jr(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=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=g?v=s.canonical.z-g:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new Z(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),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,T-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,ie=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const ya={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class xp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new pc(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 T in C)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(C[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],v=g.source;if(ya[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const 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(ya[f]&&(this._prevType&&ya[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(ya[this._prevType]||ya[f]&&g){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(wh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const R=this.pool.getObjectForId(T.rtt[v].id);if(R.stamp===T.rtt[v].stamp){this.pool.useObject(R);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let R=0;R{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Ep={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ip{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(u.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),P.mousePos(this.element,C)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,P.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=pu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const R=new St;return new fu({clickTolerance:T,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:R,enable:C,assignEvents:Ph})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=du({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const R=new St;return new fu({clickTolerance:T,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:R,enable:C,assignEvents:Ph})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta: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;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let _a;function Mh(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const g=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),C=f.locationPoint(_).distSqr(s);f.locationPoint(g).distSqr(s)180;){const g=f.locationPoint(_);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const mc={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 Ah(_,s,f){const d=_.classList;for(const g in mc)d.remove(`maplibregl-${f}-anchor-${g}`);d.add(`maplibregl-${f}-anchor-${s}`)}class gc extends u.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?Mh(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${mc[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 u.k("dragstart"))),this.fire(new u.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new u.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,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=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=P.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ve of M){const Fe=P.createNS("http://www.w3.org/2000/svg","ellipse");Fe.setAttributeNS(null,"opacity","0.04"),Fe.setAttributeNS(null,"cx","10.5"),Fe.setAttributeNS(null,"cy","5.80029008"),Fe.setAttributeNS(null,"rx",ve.rx),Fe.setAttributeNS(null,"ry",ve.ry),T.appendChild(Fe)}const R=P.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const z=P.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),R.appendChild(z);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const X=P.createNS("http://www.w3.org/2000/svg","path");X.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(X);const ie=P.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ie.setAttributeNS(null,"fill","#FFFFFF");const re=P.createNS("http://www.w3.org/2000/svg","g");re.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ue=P.createNS("http://www.w3.org/2000/svg","circle");ue.setAttributeNS(null,"fill","#000000"),ue.setAttributeNS(null,"opacity","0.25"),ue.setAttributeNS(null,"cx","5.5"),ue.setAttributeNS(null,"cy","5.5"),ue.setAttributeNS(null,"r","5.4999962");const $=P.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),re.appendChild(ue),re.appendChild($),C.appendChild(T),C.appendChild(R),C.appendChild(F),C.appendChild(ie),C.appendChild(re),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=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Ah(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const 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 T=-this._offset.y/g.transform._pixelPerMeter,M=Math.sin(g.getPitch()*Math.PI/180)*T,R=g.terrain.depthAtPoint(new u.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=u.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const kh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let gu=0,Pl=!1;const Dh={maxWidth:100,unit:"metric"};function Rh(_,s,f){const d=f&&f.maxWidth||100,g=_._container.clientHeight/2,v=_.unproject([0,g]),C=_.unproject([d,g]),T=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Ml(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Ml(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Ml(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Ml(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Ml(s,d,T,_._getUIString("ScaleControl.Meters"))}function Ml(_,s,f,d){const g=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/C;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const R=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*R)/R}(T),C*T}(f);_.style.width=s*(g/f)+"px",_.innerHTML=`${g} ${d}`}const Cp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Tp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Nh(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Nh(new u.P(0,0))}const Fm=m;c.AJAXError=u.be,c.Evented=u.E,c.LngLat=u.M,c.MercatorCoordinate=u.Y,c.Point=u.P,c.addProtocol=u.bf,c.config=u.a,c.removeProtocol=u.bg,c.AttributionControl=_s,c.BoxZoomHandler=gs,c.CanvasSource=ps,c.CooperativeGesturesHandler=kt,c.DoubleClickZoomHandler=_p,c.DragPanHandler=Nm,c.DragRotateHandler=ys,c.EdgeInsets=cu,c.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=Dr,c.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,g=this._map.getBearing(),v=u.e({bearing:g},this.options.fitBoundsOptions),C=Pe.fromLngLat(f,d);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Pl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new gc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new gc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},kh,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(_a!==void 0&&!s)return _a;if(window.navigator.permissions===void 0)return _a=!!window.navigator.geolocation,_a;try{_a=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_a=!!window.navigator.geolocation}return _a})}().then(s=>this._setupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,gu=0,Pl=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),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 u.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":gu--,Pl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new u.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),gu++,gu>1?(_={maximumAge:6e5,timeout:0},Pl=!0):(_=this.options.positionOptions,Pl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.Hash=dp,c.ImageSource=er,c.KeyboardHandler=Ha,c.LngLatBounds=Pe,c.LogoControl=Om,c.Map=class extends go{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},dc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Sh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new fc,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},wp,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=W.addThrottleControl(()=>this.isMoving()),this._requestManager=new Y(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=pp(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 vp(this,_),this._hash=_.hash&&new dp(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new _s(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Om,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],g=f[1],v=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,v),this.painter.resize(d,g,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.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 u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),C&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),v=_*g,C=s*g;return Math.min(v>f?f/v:1,C>d?d/C:1)*g}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Pe.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?d||(d=!0,f.call(this,new mo(_,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new mo(_,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new mo(_,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:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const g=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new ko(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ko(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new zm(this.painter,s,_),this.painter.renderToTexture=new xp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const g=f[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:v,stretchY:C,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:R,data:z}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:R},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:g,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:R,data:z}=E.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:R},z),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:g,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||u.b(s)?E.getImageData(s):s,{width:g,height:v,data:C}=d;if(g===void 0||v===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(C,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return W.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const g=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=P.create("div",`maplibregl-ctrl-${C} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Em(f,this.transform),D.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,v=E.now();this.style.zoomHistory.update(g,v);const C=new u.a8(g,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=C.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),W.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Sp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=mo,c.MapTouchEvent=Bs,c.MapWheelEvent=mp,c.Marker=gc,c.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},Ep,_),this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ip(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Mh(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=Nh(this.options.offset);if(!g){const T=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-T/2&&R.push("right"),g=R.length===0?"bottom":R.join("-")}let C=d.add(v[g]);this.options.subpixelPositioning||(C=C.round()),P.setTransform(this._container,`${mc[g]} translate(${C.x}px,${C.y}px)`),Ah(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Cp),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Tp);_&&_.focus()}},c.RasterDEMTileSource=Yt,c.RasterTileSource=Oe,c.ScaleControl=class{constructor(_){this._onMove=()=>{Rh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Rh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Dh),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Th,c.Style=ko,c.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=km,c.TwoFingersTouchRotateHandler=yp,c.TwoFingersTouchZoomHandler=Am,c.TwoFingersTouchZoomRotateHandler=cc,c.VectorTileSource=Nn,c.VideoSource=Mo,c.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Va(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{Os[f]=d})(_,s)}),c.clearPrewarmedResources=function(){const _=yn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(At),yn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},c.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return it().getRTLTextPluginStatus()},c.getVersion=function(){return Fm},c.getWorkerCount=function(){return hn.workerCount},c.getWorkerUrl=function(){return u.a.WORKER_URL},c.importScriptInWorkers=function(_){return kr().broadcast("IS",_)},c.prewarm=function(){Rn().acquire(At)},c.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},c.setRTLTextPlugin=function(_,s){return it().setRTLTextPlugin(_,s)},c.setWorkerCount=function(_){hn.workerCount=_},c.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var a=n;return a})})(II);var iD=II.exports;const Es=Cv(iD);var oD=Object.defineProperty,sD=(t,e,n)=>e in t?oD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zw=(t,e,n)=>(sD(t,typeof e!="symbol"?e+"":e,n),n);function xd(){}function TI(t){return t()}function Fw(){return Object.create(null)}function Iy(t){t.forEach(TI)}function LI(t){return typeof t=="function"}function aD(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function lD(t){return Object.keys(t).length===0}function uD(t,e){t.appendChild(e)}function cD(t,e,n){t.insertBefore(e,n||null)}function PI(t){t.parentNode&&t.parentNode.removeChild(t)}function Bw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Eu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function hD(t){return Array.from(t.childNodes)}function fg(t,e,n){t.classList.toggle(e,!!n)}let Xv;function gd(t){Xv=t}const rf=[],Vw=[];let cf=[];const Uw=[],fD=Promise.resolve();let Q0=!1;function pD(){Q0||(Q0=!0,fD.then(MI))}function $0(t){cf.push(t)}const v0=new Set;let Qh=0;function MI(){if(Qh!==0)return;const t=Xv;do{try{for(;Qht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),cf=e}const gD=new Set;function yD(t,e){t&&t.i&&(gD.delete(t),t.i(e))}function _D(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),$0(()=>{const a=t.$$.on_mount.map(TI).filter(LI);t.$$.on_destroy?t.$$.on_destroy.push(...a):Iy(a),t.$$.on_mount=[]}),i.forEach($0)}function vD(t,e){const n=t.$$;n.fragment!==null&&(mD(n.after_update),Iy(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function bD(t,e){t.$$.dirty[0]===-1&&(rf.push(t),pD(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=D.length?D[0]:P;return w.ctx&&i(w.ctx[E],w.ctx[E]=k)&&(!w.skip_bound&&w.bound[E]&&w.bound[E](k),S&&bD(t,E)),P}):[],w.update(),S=!0,Iy(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const E=hD(e.target);w.fragment&&w.fragment.l(E),E.forEach(PI)}else w.fragment&&w.fragment.c();e.intro&&yD(t.$$.fragment),_D(t,e.target,e.anchor),MI()}gd(m)}class wD{constructor(){zw(this,"$$"),zw(this,"$$set")}$destroy(){vD(this,1),this.$destroy=xd}$on(e,n){if(!LI(n))return xd;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&&!lD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const SD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(SD);function ED(t){let e,n,r;return{c(){e=Bw("svg"),n=Bw("path"),Eu(n,"stroke-width","4"),Eu(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"),Eu(n,"class","svelte-gzo3ar"),Eu(e,"width",r=t[0]==="list"?20:void 0),Eu(e,"viewBox","0 0 70 85"),Eu(e,"fill","none"),Eu(e,"class","svelte-gzo3ar"),fg(e,"in-map",t[0]!=="list"),fg(e,"list-icon",t[0]==="list")},m(i,a){cD(i,e,a),uD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Eu(e,"width",r),a&1&&fg(e,"in-map",i[0]!=="list"),a&1&&fg(e,"list-icon",i[0]==="list")},i:xd,o:xd,d(i){i&&PI(e)}}}function ID(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class CD extends wD{constructor(e){super(),xD(this,e,ID,ED,aD,{displayIn:0})}}const TD=[{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"}],LD={decimalLatitude:40.123,decimalLongitude:-74.123},PD=[{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}],MD=[{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 AD(){const t=[];return TD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...LD})}),[...t,...PD,...MD]}const kD=AD();kD.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 DD(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(w){return function(S){return 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 u=e.right;if(e.right=u.left,u.left=e,e=u,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,a.left=e.right,e.left=r.right,e.right=r.left,e}function b0(t,e,n,r){var i=new Du(t,e);if(n===null)return i.left=i.right=null,i;n=Lu(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 Gw(t,e,n){var r=null,i=null;if(e){e=Lu(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 ND(t,e,n){return e===null?t:(t===null||(e=Lu(t.key,e,n),e.left=t),e)}function ev(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` -`);var a=e+(n?" ":"│ ");t.left&&ev(t.left,a,!1,r,i),t.right&&ev(t.right,a,!0,r,i)}}var Yv=function(){function t(e){e===void 0&&(e=RD),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=b0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new Du(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=Lu(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=Lu(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=Lu(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=Lu(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=Lu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):a=!0;return this},t.prototype.range=function(e,n,r,i){for(var a=[],c=this._comparator,u=this._root,m;a.length!==0||u;)if(u)a.push(u),u=u.left;else{if(u=a.pop(),m=c(u.key,n),m>0)break;if(c(u.key,e)>=0&&r.call(i,u))return this;u=u.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return 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&&rv(e,n,0,i-1,a),this._root===null)this._root=tv(e,n,0,i),this._size=i;else{var c=FD(this.toList(),OD(e,n),a);i=this._size+i,this._root=nv({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 ev(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=Gw(e,this._root,i),c=a.left,u=a.right;i(e,n)<0?u=b0(n,r,u,i):c=b0(n,r,c,i),this._root=ND(c,u,i)},t.prototype.split=function(e){return Gw(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return DD(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 tv(t,e,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),c=t[a],u=e[a],m=new Du(c,u);return m.left=tv(t,e,n,a),m.right=tv(t,e,a+1,r),m}return null}function OD(t,e){for(var n=new Du(null,null),r=n,i=0;i0?(e=a=a.next=n.pop(),e=e.right):r=!0;return a.next=null,i.next}function nv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=nv(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=nv(t,i+1,n),c}return null}function FD(t,e,n){for(var r=new Du(null,null),i=r,a=t,c=e;a!==null&&c!==null;)n(a.key,c.key)<0?(i.next=a,a=a.next):(i.next=c,c=c.next),i=i.next;return a!==null?i.next=a:c!==null&&(i.next=c),r.next}function rv(t,e,n,r,i){if(!(n>=r)){for(var a=t[n+r>>1],c=n-1,u=r+1;;){do c++;while(i(t[c],a)<0);do u--;while(i(t[u],a)>0);if(c>=u)break;var m=t[c];t[c]=t[u],t[u]=m,m=e[c],e[c]=e[u],e[u]=m}rv(t,e,n,u,i),rv(t,e,u+1,r,i)}}function pa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qw(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){pa(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return jo(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r=0&&E>=0?wP?-1:0:m<0&&E<0?wP?1:0:Em?1:0}}}]),t}(),jD=0,iy=function(){jo(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,a=e.rightSE.point.x,c=n.rightSE.point.x;if(cu&&m>w)return-1;var E=e.comparePoint(n.leftSE.point);if(E<0)return 1;if(E>0)return-1;var P=n.comparePoint(e.rightSE.point);return P!==0?P:-1}if(r>i){if(um&&u>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(um)return 1;if(ac){var j=e.comparePoint(n.rightSE.point);if(j<0)return 1;if(j>0)return-1}if(a!==c){var te=w-u,U=a-r,W=S-m,Y=c-i;if(te>U&&WY)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){pa(this,t),this.id=++jD,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return jo(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&u.swapEvents(),nl.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var c=n;n=r,r=c}for(var u=0,m=r.rings.length;u0)i=n,a=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var m=new nl(i,!0),w=new nl(a,!1);return new t(m,w,[r],[c])}}]),t}(),Xw=function(){function t(e,n,r){if(pa(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=wd.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,c=1,u=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=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(iy.fromRing(a,i,this))}return jo(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return jo(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return jo(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n0&&(e=i)}for(var a=e.segment.prevInResult(),c=a?a.prevInResult():null;;){if(!a)return null;if(!c)return a.ringOut;if(c.ringOut!==a.ringOut)return c.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=c.prevInResult(),c=a?a.prevInResult():null}}}]),t}(),Kw=function(){function t(e){pa(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return jo(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:iy.compare;pa(this,t),this.queue=e,this.tree=new Yv(n),this.segments=[]}return jo(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=i,c=i,u=void 0,m=void 0;u===void 0;)a=this.tree.prev(a),a===null?u=null:a.key.consumedBy===void 0&&(u=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(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var E=this._splitSafely(u,S),P=0,D=E.length;P0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=u)}else{if(u&&m){var ce=u.getIntersection(m);if(ce!==null){if(!u.isAnEndpoint(ce))for(var me=this._splitSafely(u,ce),Le=0,Z=me.length;LeJw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Y=new XD(k),oe=k.size,_e=k.pop();_e;){var se=_e.key;if(k.size===oe){var ce=se.segment;throw new Error("Unable to pop() ".concat(se.isLeft?"left":"right"," SweepEvent ")+"[".concat(se.point.x,", ").concat(se.point.y,"] from segment #").concat(ce.id," ")+"[".concat(ce.leftSE.point.x,", ").concat(ce.leftSE.point.y,"] -> ")+"[".concat(ce.rightSE.point.x,", ").concat(ce.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(k.size>Jw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Y.segments.length>YD)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var me=Y.process(se),Le=0,Z=me.length;Le1?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};Re.prototype.clone=function(){};Re.prototype.copy=function(){return new Re(this)};Re.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Re.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)};Re.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};Re.prototype.hashCode=function(){var t=17;return t=37*t+Re.hashCode(this.x),t=37*t+Re.hashCode(this.y),t};Re.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};Re.prototype.interfaces_=function(){return[hs,Ty,fs]};Re.prototype.getClass=function(){return Re};Re.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=Xt.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Wc.DimensionalComparator.get=function(){return ql};Wc.serialVersionUID.get=function(){return 6683108902428367e3};Wc.NULL_ORDINATE.get=function(){return Xt.NaN};Wc.X.get=function(){return 0};Wc.Y.get=function(){return 1};Wc.Z.get=function(){return 2};Object.defineProperties(Re,Wc);var ql=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new ar("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};ql.prototype.compare=function(t,e){var n=t,r=e,i=ql.compare(n.x,r.x);if(i!==0)return i;var a=ql.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=ql.compare(n.z,r.z);return c};ql.prototype.interfaces_=function(){return[gf]};ql.prototype.getClass=function(){return ql};ql.compare=function(t,e){return te?1:Xt.isNaN(t)?Xt.isNaN(e)?0:-1:Xt.isNaN(e)?1:0};var yf=function(){};yf.prototype.create=function(){};yf.prototype.interfaces_=function(){return[]};yf.prototype.getClass=function(){return yf};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 ar("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 Ut=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Wo=function(){},BI={LOG_10:{configurable:!0}};Wo.prototype.interfaces_=function(){return[]};Wo.prototype.getClass=function(){return Wo};Wo.log10=function(t){var e=Math.log(t);return Xt.isInfinite(e)||Xt.isNaN(e)?e:e/Wo.LOG_10};Wo.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};Wo.wrap=function(t,e){return t<0?e- -t%e:t%e};Wo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],u=arguments[3],m=i;return a>m&&(m=a),c>m&&(m=c),u>m&&(m=u),m}};Wo.average=function(t,e){return(t+e)/2};BI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Wo,BI);var da=function(t){this.str=t};da.prototype.append=function(t){this.str+=t};da.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};da.prototype.toString=function(t){return this.str};var ta=function(t){this.value=t};ta.prototype.intValue=function(){return this.value};ta.prototype.compareTo=function(t){return this.valuet?1:0};ta.isNaN=function(t){return Number.isNaN(t)};var Sd=function(){};Sd.isWhitespace=function(t){return t<=32&&t>=0||t===127};Sd.toUpperCase=function(t){return t.toUpperCase()};var je=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},Rs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};je.prototype.le=function(t){return(this._hi9?(S=!0,E="9"):E="0"+w,c.append(E),n=n.subtract(je.valueOf(w)).multiply(je.TEN),S&&n.selfAdd(je.TEN);var P=!0,D=je.magnitude(n._hi);if(D<0&&Math.abs(D)>=u-m&&(P=!1),!P)break}return e[0]=r,c.toString()};je.prototype.sqr=function(){return this.multiply(this)};je.prototype.doubleValue=function(){return this._hi+this._lo};je.prototype.subtract=function(){if(arguments[0]instanceof je){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};je.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};je.prototype.isZero=function(){return this._hi===0&&this._lo===0};je.prototype.selfSubtract=function(){if(arguments[0]instanceof je){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};je.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};je.prototype.min=function(t){return this.le(t)?this:t};je.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof je){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,u=null,m=null,w=null,S=null,E=null;return m=this._hi/n,w=je.SPLIT*m,i=w-m,E=je.SPLIT*n,i=w-i,a=m-i,c=E-n,S=m*n,c=E-c,u=n-c,E=i*c-S+i*u+a*c+a*u,w=(this._hi-S-E+this._lo-m*r)/n,E=m+w,this._hi=E,this._lo=m-E+w,this}};je.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};je.prototype.divide=function(){if(arguments[0]instanceof je){var t=arguments[0],e=null,n=null,r=null,i=null,a=null,c=null,u=null,m=null;a=this._hi/t._hi,c=je.SPLIT*a,e=c-a,m=je.SPLIT*t._hi,e=c-e,n=a-e,r=m-t._hi,u=a*t._hi,r=m-r,i=t._hi-r,m=e*r-u+e*i+n*r+n*i,c=(this._hi-u-m+this._lo-a*t._lo)/t._hi,m=a+c;var w=m,S=a-m+c;return new je(w,S)}else if(typeof arguments[0]=="number"){var E=arguments[0];return Xt.isNaN(E)?je.createNaN():je.copy(this).selfDivide(E,0)}};je.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};je.prototype.pow=function(t){if(t===0)return je.valueOf(1);var e=new je(this),n=je.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(e),r/=2,r>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};je.prototype.ceil=function(){if(this.isNaN())return je.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new je(t,e)};je.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};je.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};je.prototype.setValue=function(){if(arguments[0]instanceof je){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};je.prototype.max=function(t){return this.ge(t)?this:t};je.prototype.sqrt=function(){if(this.isZero())return je.valueOf(0);if(this.isNegative())return je.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=je.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};je.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof je){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,a=null,c=null,u=null;return i=this._hi+e,c=i-this._hi,a=i-c,a=e-c+(this._hi-a),u=a+this._lo,n=i+u,r=u+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var m=arguments[0],w=arguments[1],S=null,E=null,P=null,D=null,k=null,V=null,j=null,te=null;k=this._hi+m,P=this._lo+w,j=k-this._hi,te=P-this._lo,V=k-j,D=P-te,V=m-j+(this._hi-V),D=w-te+(this._lo-D),j=V+P,S=k+j,E=j+(k-S),j=D+E;var U=S+j,W=j+(S-U);return this._hi=U,this._lo=W,this}};je.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof je){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,u=null,m=null,w=null;m=je.SPLIT*this._hi,i=m-this._hi,w=je.SPLIT*n,i=m-i,a=this._hi-i,c=w-n,m=this._hi*n,c=w-c,u=n-c,w=i*c-m+i*u+a*c+a*u+(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}};je.prototype.selfSqr=function(){return this.selfMultiply(this)};je.prototype.floor=function(){if(this.isNaN())return je.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new je(t,e)};je.prototype.negate=function(){return this.isNaN()?this:new je(-this._hi,-this._lo)};je.prototype.clone=function(){};je.prototype.multiply=function(){if(arguments[0]instanceof je){var t=arguments[0];return t.isNaN()?je.createNaN():je.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return Xt.isNaN(e)?je.createNaN():je.copy(this).selfMultiply(e,0)}};je.prototype.isNaN=function(){return Xt.isNaN(this._hi)};je.prototype.intValue=function(){return Math.trunc(this._hi)};je.prototype.toString=function(){var t=je.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};je.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+je.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=je.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};je.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,a=null,c=null,u=null;i=1/this._hi,a=je.SPLIT*i,t=a-i,u=je.SPLIT*this._hi,t=a-t,e=i-t,n=u-this._hi,c=i*this._hi,n=u-n,r=this._hi-n,u=t*n-c+t*r+e*n+e*r,a=(1-c-u-i*this._lo)/this._hi;var m=i+a,w=i-m+a;return new je(m,w)};je.prototype.toSciNotation=function(){if(this.isZero())return je.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=je.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};je.prototype.abs=function(){return this.isNaN()?je.NaN:this.isNegative()?this.negate():new je(this)};je.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};je.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};je.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};je.prototype.trunc=function(){return this.isNaN()?je.NaN:this.isPositive()?this.floor():this.ceil()};je.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};je.prototype.interfaces_=function(){return[fs,hs,Ty]};je.prototype.getClass=function(){return je};je.sqr=function(t){return je.valueOf(t).selfMultiply(t)};je.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return je.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new je(e)}};je.sqrt=function(t){return je.valueOf(t).sqrt()};je.parse=function(t){for(var e=0,n=t.length;Sd.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,Sd.isDigit(w)){var S=w-"0";a.selfMultiply(je.TEN),a.selfAdd(S),c++;continue}if(w==="."){u=c;continue}if(w==="e"||w==="E"){var E=t.substring(e);try{m=ta.parseInt(E)}catch(j){throw j instanceof Error?new Error("Invalid exponent "+E+" in string "+t):j}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var P=a,D=c-u-m;if(D===0)P=a;else if(D>0){var k=je.TEN.pow(D);P=a.divide(k)}else if(D<0){var V=je.TEN.pow(-D);P=a.multiply(V)}return r?P.negate():P};je.createNaN=function(){return new je(Xt.NaN,Xt.NaN)};je.copy=function(t){return new je(t)};je.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=e&&(r+=1),r};je.stringOfChar=function(t,e){for(var n=new da,r=0;r0){if(a<=0)return oo.signum(c);r=i+a}else if(i<0){if(a>=0)return oo.signum(c);r=-i-a}else return oo.signum(c);var u=oo.DP_SAFE_EPSILON*r;return c>=u||-c>=u?oo.signum(c):2};oo.signum=function(t){return t>0?1:t<0?-1:0};VI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(oo,VI);var En=function(){},jd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};jd.X.get=function(){return 0};jd.Y.get=function(){return 1};jd.Z.get=function(){return 2};jd.M.get=function(){return 3};En.prototype.setOrdinate=function(t,e,n){};En.prototype.size=function(){};En.prototype.getOrdinate=function(t,e){};En.prototype.getCoordinate=function(){};En.prototype.getCoordinateCopy=function(t){};En.prototype.getDimension=function(){};En.prototype.getX=function(t){};En.prototype.clone=function(){};En.prototype.expandEnvelope=function(t){};En.prototype.copy=function(){};En.prototype.getY=function(t){};En.prototype.toCoordinateArray=function(){};En.prototype.interfaces_=function(){return[Ty]};En.prototype.getClass=function(){return En};Object.defineProperties(En,jd);var UI=function(){},Gf=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}(UI),Ii=function(){};Ii.arraycopy=function(t,e,n,r,i){for(var a=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Rt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Rt){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))}};Rt.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};Rt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Rt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Rt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Rt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Rt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Rt.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()}};Rt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Rt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof Re){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)}};Rt.prototype.centre=function(){return this.isNull()?null:new Re((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Rt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Re){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Rt){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],u=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Rt.prototype.hashCode=function(){var t=17;return t=37*t+Re.hashCode(this._minx),t=37*t+Re.hashCode(this._maxx),t=37*t+Re.hashCode(this._miny),t=37*t+Re.hashCode(this._maxy),t};Rt.prototype.interfaces_=function(){return[hs,fs]};Rt.prototype.getClass=function(){return Rt};Rt.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3],u=Math.min(a.x,c.x),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)}};fr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};fr.prototype.setPrecisionModel=function(t){this._precisionModel=t};fr.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ni?a=r:a=i;else{var c=Math.abs(t.x-e.x),u=Math.abs(t.y-e.y);r>i?a=c:a=u,a===0&&!t.equals(e)&&(a=Math.max(c,u))}return on.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};fr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return on.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};Hc.DONT_INTERSECT.get=function(){return 0};Hc.DO_INTERSECT.get=function(){return 1};Hc.COLLINEAR.get=function(){return 2};Hc.NO_INTERSECTION.get=function(){return 0};Hc.POINT_INTERSECTION.get=function(){return 1};Hc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(fr,Hc);var Zu=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 Rt(this._inputLines[0][0],this._inputLines[0][1]),i=new Rt(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,Rt.intersects(r,i,n)&&xt.orientationIndex(r,i,n)===0&&xt.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,a,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,a.x-=c.x,a.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,a){var c=null;try{c=Is.intersection(n,r,i,a)}catch(u){if(u instanceof Gf)c=e.nearestEndpoint(n,r,i,a);else throw u}finally{}return c},e.prototype.intersection=function(n,r,i,a){var c=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(c)||(c=new Re(e.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c},e.prototype.smallestInAbsValue=function(n,r,i,a){var c=n,u=Math.abs(c);return Math.abs(r)1e-4&&Ii.out.println("Distance = "+c.distance(u))},e.prototype.intersectionWithNormalization=function(n,r,i,a){var c=new Re(n),u=new Re(r),m=new Re(i),w=new Re(a),S=new Re;this.normalizeToEnvCentre(c,u,m,w,S);var E=this.safeHCoordinateIntersection(c,u,m,w);return E.x+=S.x,E.y+=S.y,E},e.prototype.computeCollinearIntersection=function(n,r,i,a){var c=Rt.intersects(n,r,i),u=Rt.intersects(n,r,a),m=Rt.intersects(i,a,n),w=Rt.intersects(i,a,r);return c&&u?(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)&&!u&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!u&&!m?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&m?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!c&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!c&&!m?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,a,c){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,E=i.xa.x?i.x:a.x,k=i.y>a.y?i.y:a.y,V=u>E?u:E,j=wP?m:P,U=S0&&u>0||c<0&&u<0)return t.NO_INTERSECTION;var m=xt.orientationIndex(i,a,n),w=xt.orientationIndex(i,a,r);if(m>0&&w>0||m<0&&w<0)return t.NO_INTERSECTION;var S=c===0&&u===0&&m===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(c===0||u===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 Re(i):u===0?this._intPt[0]=new Re(a):m===0?this._intPt[0]=new Re(n):w===0&&(this._intPt[0]=new Re(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,a){var c=n,u=xt.distancePointLine(n,i,a),m=xt.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 $s=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};$s.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,a=t.y-this._p.y,c=e.x-this._p.x,u=e.y-this._p.y,m=Pc.signOfDet2x2(i,a,c,u);if(m===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};$s.prototype.isPointInPolygon=function(){return this.getLocation()!==ze.EXTERIOR};$s.prototype.getLocation=function(){return this._isPointOnSegment?ze.BOUNDARY:this._crossingCount%2===1?ze.INTERIOR:ze.EXTERIOR};$s.prototype.isOnSegment=function(){return this._isPointOnSegment};$s.prototype.interfaces_=function(){return[]};$s.prototype.getClass=function(){return $s};$s.locatePointInRing=function(){if(arguments[0]instanceof Re&&Ut(arguments[1],En)){for(var t=arguments[0],e=arguments[1],n=new $s(t),r=new Re,i=new Re,a=1;a1||m<0||m>1)&&(i=!0)}}return i?Wo.min(xt.distancePointLine(t,n,r),xt.distancePointLine(e,n,r),xt.distancePointLine(n,t,e),xt.distancePointLine(r,t,e)):0};xt.isPointInRing=function(t,e){return xt.locatePointInRing(t,e)!==ze.EXTERIOR};xt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Re;t.getCoordinate(0,r);for(var i=r.x,a=r.y,c=1;cn.y&&(n=a,r=i)}var c=r;do c=c-1,c<0&&(c=e);while(t[c].equals2D(n)&&c!==r);var u=r;do u=(u+1)%e;while(t[u].equals2D(n)&&u!==r);var m=t[c],w=t[u];if(m.equals2D(n)||w.equals2D(n)||m.equals2D(w))return!1;var S=xt.computeOrientation(m,n,w),E=!1;return S===0?E=m.x>w.x:E=S>0,E};xt.locatePointInRing=function(t,e){return $s.locatePointInRing(t,e)};xt.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};xt.computeOrientation=function(t,e,n){return xt.orientationIndex(t,e,n)};xt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new ar("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return a.distance(u);var S=((c.y-a.y)*(u.x-c.x)-(c.x-a.x)*(u.y-c.y))/m;return Math.abs(S)*Math.sqrt(m)}};xt.isOnLine=function(t,e){for(var n=new Zu,r=1;r0};vf.prototype.interfaces_=function(){return[ls]};vf.prototype.getClass=function(){return vf};var bf=function(){};bf.prototype.isInBoundary=function(t){return t>1};bf.prototype.interfaces_=function(){return[ls]};bf.prototype.getClass=function(){return bf};var xf=function(){};xf.prototype.isInBoundary=function(t){return t===1};xf.prototype.interfaces_=function(){return[ls]};xf.prototype.getClass=function(){return xf};var Hr=function(){};Hr.prototype.add=function(){};Hr.prototype.addAll=function(){};Hr.prototype.isEmpty=function(){};Hr.prototype.iterator=function(){};Hr.prototype.size=function(){};Hr.prototype.toArray=function(){};Hr.prototype.remove=function(){};function Jv(t){this.message=t||""}Jv.prototype=new Error;Jv.prototype.name="IndexOutOfBoundsException";var qf=function(){};qf.prototype.hasNext=function(){};qf.prototype.next=function(){};qf.prototype.remove=function(){};var Cs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Hr);function jf(t){this.message=t||""}jf.prototype=new Error;jf.prototype.name="NoSuchElementException";var mt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Hr&&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,Hr]},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 sR(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new Jv;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}t.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],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 P=arguments[0],D=arguments[1],k=arguments[2];if(k)for(var V=0;V=0;j--)r.add(P[j],D);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Re){var te=arguments[0],U=arguments[1],W=arguments[2];if(!W){var Y=this.size();if(Y>0){if(te>0){var oe=this.get(te-1);if(oe.equals2D(U))return null}if(teLe&&(Z=-1);for(var fe=me;fe!==Le;fe+=Z)r.add(se[fe],ce);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Re(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(mt),gn=function(){},Py={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Py.ForwardComparator.get=function(){return Ed};Py.BidirectionalComparator.get=function(){return wf};Py.coordArrayType.get=function(){return new Array(0).fill(null)};gn.prototype.interfaces_=function(){return[]};gn.prototype.getClass=function(){return gn};gn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};gn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};gn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};gn.extract=function(t,e,n){e=Wo.clamp(e,0,t.length),n=Wo.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=gn.compare(n,r),a=gn.isEqualReversed(n,r);return a?0:i};wf.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=gn.increasingDirection(n),a=gn.increasingDirection(r),c=i>0?0:n.length-1,u=a>0?0:n.length-1,m=0;m0)e=e.right;else return e.value}return null};ki.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:rl,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:rl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};ki.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Iu;t!=null&&t!==this.root_&&t.parent.color===Iu;)if(Kn(t)===x0(Kn(Kn(t)))){var n=t2(Kn(Kn(t)));e2(n)===Iu?(Qa(Kn(t),rl),Qa(n,rl),Qa(Kn(Kn(t)),Iu),t=Kn(Kn(t))):(t===t2(Kn(t))&&(t=Kn(t),e.rotateLeft(t)),Qa(Kn(t),rl),Qa(Kn(Kn(t)),Iu),e.rotateRight(Kn(Kn(t))))}else{var r=x0(Kn(Kn(t)));e2(r)===Iu?(Qa(Kn(t),rl),Qa(r,rl),Qa(Kn(Kn(t)),Iu),t=Kn(Kn(t))):(t===x0(Kn(t))&&(t=Kn(t),e.rotateRight(t)),Qa(Kn(t),rl),Qa(Kn(Kn(t)),Iu),e.rotateLeft(Kn(Kn(t))))}this.root_.color=rl};ki.prototype.values=function(){var t=new mt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=ki.successor(e))!==null;)t.add(e.value);return t};ki.prototype.entrySet=function(){var t=new Qv,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=ki.successor(e))!==null;)t.add(e);return t};ki.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};ki.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};ki.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};ki.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};ki.prototype.size=function(){return this.size_};var Id=function(){};Id.prototype.interfaces_=function(){return[]};Id.prototype.getClass=function(){return Id};function qI(){}qI.prototype=new My;function na(){this.array_=[],arguments[0]instanceof Hr&&this.addAll(arguments[0])}na.prototype=new qI;na.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var c=i.substring(0,a);r.add(c),i=i.substring(a+n),a=i.indexOf(e)}i.length>0&&r.add(i);for(var u=new Array(r.size()).fill(null),m=0;m0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(os.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Mr.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Mr.createClosedRing(t,e,4);var r=e.getOrdinate(0,En.X)===e.getOrdinate(n-1,En.X)&&e.getOrdinate(0,En.Y)===e.getOrdinate(n-1,En.Y);return r?e:Mr.createClosedRing(t,e,n+1)};Mr.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Mr.copy(e,0,r,0,i);for(var a=i;a0&&Mr.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Ln.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return xt.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Mr.reverse(r);var i=this.getFactory().createLineString(r);return i},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,c=0,u=0;c= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=this,a=0;a=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(br),Ta=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};Ld.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Ld.prototype.getClass=function(){return Ld};var Pd=function(){};Pd.prototype.edit=function(t,e){return t instanceof Aa?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof br?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Co?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Pd.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Pd.prototype.getClass=function(){return Pd};var Lr=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new da(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Lr(n):new Lr(n,r)}};ka.prototype.interfaces_=function(){return[yf,fs]};ka.prototype.getClass=function(){return ka};ka.instance=function(){return ka.instanceObject};e1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};e1.instanceObject.get=function(){return new ka};Object.defineProperties(ka,e1);var WI=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new mt,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new Qv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Xc),Mn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ia){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},t1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Mn.prototype.equals=function(t){if(!(t instanceof Mn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Mn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new ta(n).compareTo(new ta(r))};Mn.prototype.getScale=function(){return this._scale};Mn.prototype.isFloating=function(){return this._modelType===Mn.FLOATING||this._modelType===Mn.FLOATING_SINGLE};Mn.prototype.getType=function(){return this._modelType};Mn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Mn.FLOATING?t="Floating":this._modelType===Mn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Mn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Mn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Xt.isNaN(t))return t;if(this._modelType===Mn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Mn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Re){var n=arguments[0];if(this._modelType===Mn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Mn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Mn.FLOATING?t=16:this._modelType===Mn.FLOATING_SINGLE?t=6:this._modelType===Mn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Mn.prototype.setScale=function(t){this._scale=Math.abs(t)};Mn.prototype.interfaces_=function(){return[fs,hs]};Mn.prototype.getClass=function(){return Mn};Mn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};t1.serialVersionUID.get=function(){return 7777263578777804e3};t1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Mn,t1);var ia=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},n1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ia.prototype.readResolve=function(){return ia.nameToTypeMap.get(this._name)};ia.prototype.toString=function(){return this._name};ia.prototype.interfaces_=function(){return[fs]};ia.prototype.getClass=function(){return ia};n1.serialVersionUID.get=function(){return-552860263173159e4};n1.nameToTypeMap.get=function(){return new WI};Object.defineProperties(ia,n1);Mn.Type=ia;Mn.FIXED=new ia("FIXED");Mn.FLOATING=new ia("FLOATING");Mn.FLOATING_SINGLE=new ia("FLOATING SINGLE");var mn=function t(){this._precisionModel=new Mn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ut(arguments[0],yf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Mn&&(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]))},HI={serialVersionUID:{configurable:!0}};mn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Re(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Re(t.getMinX(),t.getMinY()),new Re(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Re(t.getMinX(),t.getMinY()),new Re(t.getMinX(),t.getMaxY()),new Re(t.getMaxX(),t.getMaxY()),new Re(t.getMaxX(),t.getMinY()),new Re(t.getMinX(),t.getMinY())]),null)};mn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new br(this.getCoordinateSequenceFactory().create(t),this);if(Ut(t,En))return new br(t,this)}else return new br(this.getCoordinateSequenceFactory().create([]),this)};mn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ru(null,this);if(arguments.length===1){var t=arguments[0];return new Ru(t,this)}};mn.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(mn.toGeometryArray(t));var u=t.iterator().next(),m=t.size()>1;if(m){if(u instanceof Kr)return this.createMultiPolygon(mn.toPolygonArray(t));if(u instanceof br)return this.createMultiLineString(mn.toLineStringArray(t));if(u instanceof Co)return this.createMultiPoint(mn.toPointArray(t));on.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};mn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};mn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Re){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Ut(arguments[0],En)){var e=arguments[0];return new Co(e,this)}}};mn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};mn.prototype.createPolygon=function(){if(arguments.length===0)return new Kr(null,null,this);if(arguments.length===1){if(Ut(arguments[0],En)){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 Aa){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Kr(r,i,this)}};mn.prototype.getSRID=function(){return this._SRID};mn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hi(null,this);if(arguments.length===1){var t=arguments[0];return new Hi(t,this)}};mn.prototype.createGeometry=function(t){var e=new us(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};mn.prototype.getPrecisionModel=function(){return this._precisionModel};mn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ut(arguments[0],En)){var e=arguments[0];return new Aa(e,this)}}};mn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ta(null,this);if(arguments.length===1){var t=arguments[0];return new Ta(t,this)}};mn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Sf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Sf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ut(arguments[0],En)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[t]};ma.prototype.push=function(t){return this.array_.push(t),t};ma.prototype.pop=function(t){if(this.array_.length===0)throw new Ny;return this.array_.pop()};ma.prototype.peek=function(){if(this.array_.length===0)throw new Ny;return this.array_[this.array_.length-1]};ma.prototype.empty=function(){return this.array_.length===0};ma.prototype.isEmpty=function(){return this.empty()};ma.prototype.search=function(t){return this.array_.indexOf(t)};ma.prototype.size=function(){return this.array_.length};ma.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===xt.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};oa.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var i=ot.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};oa.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};oa.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}on.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===ot.LEFT&&(this._orientedDe=this._minDe.getSym())};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};var pl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new Re(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}(hl),Oy=function(){this.array_=[]};Oy.prototype.addLast=function(t){this.array_.push(t)};Oy.prototype.removeFirst=function(){return this.array_.shift()};Oy.prototype.isEmpty=function(){return this.array_.length===0};var Zi=function(){this._finder=null,this._dirEdgeList=new mt,this._nodes=new mt,this._rightMostCoord=null,this._env=null,this._finder=new oa};Zi.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Zi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Zi.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new pl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var a=t.getEdges().iterator();a.hasNext();){var c=a.next();c.setVisited(!0),e.copySymDepths(c)}};Zi.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ot.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Zi.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Zi.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ot.RIGHT)>=1&&e.getDepth(ot.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Zi.prototype.computeDepths=function(t){var e=this,n=new Qv,r=new Oy,i=t.getNode();for(r.addLast(i),n.add(i),t.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),e.computeNodeDepth(a);for(var c=a.getEdges().iterator();c.hasNext();){var u=c.next(),m=u.getSym();if(!m.isVisited()){var w=m.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Zi.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Zi.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Rt,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[ot.ON]=this.location[ot.ON],n[ot.LEFT]=ze.NONE,n[ot.RIGHT]=ze.NONE,this.location=n}for(var r=0;r1&&t.append(ze.toLocationSymbol(this.location[ot.LEFT])),t.append(ze.toLocationSymbol(this.location[ot.ON])),this.location.length>1&&t.append(ze.toLocationSymbol(this.location[ot.RIGHT])),t.toString()};Jn.prototype.setLocations=function(t,e,n){this.location[ot.ON]=t,this.location[ot.LEFT]=e,this.location[ot.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};Vr.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])}};Vr.prototype.isHole=function(){return this._isHole};Vr.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Vr.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!xt.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};Vr.prototype.addHole=function(t){this._holes.add(t)};Vr.prototype.isShell=function(){return this._shell===null};Vr.prototype.getLabel=function(){return this._label};Vr.prototype.getEdges=function(){return this._edges};Vr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Vr.prototype.getShell=function(){return this._shell};Vr.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,ot.RIGHT);if(r===ze.NONE)return null;if(this._label.getLocation(n)===ze.NONE)return this._label.setLocation(n,r),null}};Vr.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Vr.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};Ho.prototype.isInResult=function(){return this._isInResult};Ho.prototype.isVisited=function(){return this._isVisited};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};var zy=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 Fn(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 Fn(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 Fn)for(var i=arguments[0],a=0;a<2;a++){var c=n.computeMergedLocation(i,a),u=n._label.getLocation(a);u===ze.NONE&&n._label.setLocation(a,c)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=ze.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case ze.BOUNDARY:i=ze.INTERIOR;break;case ze.INTERIOR:i=ze.BOUNDARY;break;default:i=ze.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ho),sa=function(){this.nodeMap=new ki,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};sa.prototype.find=function(t){return this.nodeMap.get(t)};sa.prototype.addNode=function(){if(arguments[0]instanceof Re){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 zy){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};sa.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};sa.prototype.iterator=function(){return this.nodeMap.values().iterator()};sa.prototype.values=function(){return this.nodeMap.values()};sa.prototype.getBoundaryNodes=function(t){for(var e=new mt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===ze.BOUNDARY&&e.add(r)}return e};sa.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};sa.prototype.interfaces_=function(){return[]};sa.prototype.getClass=function(){return sa};var Vn=function(){},Zd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Vn.prototype.interfaces_=function(){return[]};Vn.prototype.getClass=function(){return Vn};Vn.isNorthern=function(t){return t===Vn.NE||t===Vn.NW};Vn.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Vn.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};Vn.isInHalfPlane=function(t,e){return e===Vn.SE?t===Vn.SE||t===Vn.SW:t===e||t===e+1};Vn.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 ar("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Vn.NE:Vn.SE:e>=0?Vn.NW:Vn.SW}else if(arguments[0]instanceof Re&&arguments[1]instanceof Re){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new ar("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Vn.NE:Vn.SE:r.y>=n.y?Vn.NW:Vn.SW}};Zd.NE.get=function(){return 0};Zd.NW.get=function(){return 1};Zd.SW.get=function(){return 2};Zd.SE.get=function(){return 3};Object.defineProperties(Vn,Zd);var Di=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],u=arguments[2],m=arguments[3];this._edge=a,this.init(c,u),this._label=m}};Di.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var u=c.buildMinimalRings(),m=r.findShell(u);m!==null?(r.placePolygonHoles(m,u),e.add(m)):n.addAll(u)}else i.add(c)}return i};To.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};To.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new mt,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new yR(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};To.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};To.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};To.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,c=null,u=e.iterator();u.hasNext();){var m=u.next(),w=m.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(c=a.getLinearRing().getEnvelopeInternal());var E=!1;S.contains(r)&&xt.isPointInRing(i,w.getCoordinates())&&(E=!0),E&&(a===null||c.contains(S))&&(a=m)}return a};To.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return on.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};To.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];pr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new mt,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};To.prototype.interfaces_=function(){return[]};To.prototype.getClass=function(){return To};var If=function(){};If.prototype.getBounds=function(){};If.prototype.interfaces_=function(){return[]};If.prototype.getClass=function(){return If};var Ps=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ps.prototype.getItem=function(){return this._item};Ps.prototype.getBounds=function(){return this._bounds};Ps.prototype.interfaces_=function(){return[If,fs]};Ps.prototype.getClass=function(){return Ps};var dl=function(){this._size=null,this._items=null,this._size=0,this._items=new mt,this._items.add(null)};dl.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};dl.prototype.size=function(){return this._size};dl.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)};dl.prototype.clear=function(){this._size=0,this._items.clear()};dl.prototype.isEmpty=function(){return this._size===0};dl.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)};dl.prototype.interfaces_=function(){return[]};dl.prototype.getClass=function(){return dl};var Yl=function(){};Yl.prototype.visitItem=function(t){};Yl.prototype.interfaces_=function(){return[]};Yl.prototype.getClass=function(){return Yl};var Mc=function(){};Mc.prototype.insert=function(t,e){};Mc.prototype.remove=function(t,e){};Mc.prototype.query=function(){};Mc.prototype.interfaces_=function(){return[]};Mc.prototype.getClass=function(){return Mc};var Yr=function(){if(this._childBoundables=new mt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},XI={serialVersionUID:{configurable:!0}};Yr.prototype.getLevel=function(){return this._level};Yr.prototype.size=function(){return this._childBoundables.size()};Yr.prototype.getChildBoundables=function(){return this._childBoundables};Yr.prototype.addChildBoundable=function(t){on.isTrue(this._bounds===null),this._childBoundables.add(t)};Yr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Yr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Yr.prototype.interfaces_=function(){return[If,fs]};Yr.prototype.getClass=function(){return Yr};XI.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Yr,XI);var Ms=function(){};Ms.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ms.min=function(t){return Ms.sort(t),t.get(0)};Ms.sort=function(t,e){var n=t.toArray();e?Au.sort(n,e):Au.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 ar("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 u=c.next(),m=new Or(u,e,i._itemDistance);m.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Fy={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};_i.prototype.getNodeCapacity=function(){return this._nodeCapacity};_i.prototype.lastNode=function(t){return t.get(t.size()-1)};_i.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 Yr?n+=t.size(i):i instanceof Ps&&(n+=1)}return n}};_i.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ps&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};_i.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new mt:e}else if(arguments.length===1){for(var n=arguments[0],r=new mt,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Yr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof Ps?r.add(a.getItem()):on.shouldNeverReachHere()}return r.size()<=0?null:r}};_i.prototype.insert=function(t,e){on.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ps(t,e))};_i.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new mt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(on.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var u=c.next();u instanceof Yr?t.boundablesAtLevel(r,u,a):(on.isTrue(u instanceof Ps),r===-1&&a.add(u))}return null}};_i.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new mt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Ut(arguments[2],Yl)&&arguments[0]instanceof Object&&arguments[1]instanceof Yr)for(var a=arguments[0],c=arguments[1],u=arguments[2],m=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};_i.prototype.createParentBoundables=function(t,e){var n=this;on.isTrue(!t.isEmpty());var r=new mt;r.add(this.createNode(e));var i=new mt(t);Ms.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var c=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};_i.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};_i.prototype.interfaces_=function(){return[fs]};_i.prototype.getClass=function(){return _i};_i.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new mt,u=0;u0;){var k=D.poll(),V=k.getDistance();if(V>=E)break;k.isLeaves()?(E=V,P=k):k.expandToQueue(D,E)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var j=arguments[0],te=arguments[1],U=arguments[2],W=new Ps(j,te),Y=new Or(this.getRoot(),W,U);return this.nearestNeighbour(Y)[0]}},e.prototype.interfaces_=function(){return[Mc,fs]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return n2},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[gf]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[gf]},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}(_i),n2=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 Rt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yr),io=function(){};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};io.relativeSign=function(t,e){return te?1:0};io.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=io.relativeSign(e.x,n.x),i=io.relativeSign(e.y,n.y);switch(t){case 0:return io.compareValue(r,i);case 1:return io.compareValue(i,r);case 2:return io.compareValue(i,-r);case 3:return io.compareValue(-r,i);case 4:return io.compareValue(-r,-i);case 5:return io.compareValue(-i,-r);case 6:return io.compareValue(-i,r);case 7:return io.compareValue(r,-i)}return on.shouldNeverReachHere("invalid octant value"),0};io.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Kl=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 Re(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};Kl.prototype.getCoordinate=function(){return this.coord};Kl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Kl.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:io.compare(this._segmentOctant,this.coord,e.coord)};Kl.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Kl.prototype.isInterior=function(){return this._isInterior};Kl.prototype.interfaces_=function(){return[hs]};Kl.prototype.getClass=function(){return Kl};var Xi=function(){this._nodeMap=new ki,this._edge=null;var t=arguments[0];this._edge=t};Xi.prototype.getSplitCoordinates=function(){var t=this,e=new Wd;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();t.addEdgeCoordinates(r,i,e),r=i}return e.toCoordinateArray()};Xi.prototype.addCollapsedNodes=function(){var t=this,e=new mt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};Xi.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Xi.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Re&&arguments[1]instanceof Re){var i=arguments[0],a=arguments[1],c=a.x-i.x,u=a.y-i.y;if(c===0&&u===0)throw new ar("Cannot compute the octant for two identical points "+i);return Ac.octant(c,u)}};var Da=function(){};Da.prototype.getCoordinates=function(){};Da.prototype.size=function(){};Da.prototype.getCoordinate=function(t){};Da.prototype.isClosed=function(){};Da.prototype.setData=function(t){};Da.prototype.getData=function(){};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};var Md=function(){};Md.prototype.addIntersection=function(t,e){};Md.prototype.interfaces_=function(){return[Da]};Md.prototype.getClass=function(){return Md};var Ar=function(){this._nodeList=new Xi(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ar.prototype.getCoordinates=function(){return this._pts};Ar.prototype.size=function(){return this._pts.length};Ar.prototype.getCoordinate=function(t){return this._pts[t]};Ar.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ar.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};Ar.prototype.setData=function(t){this._data=t};Ar.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Ac.octant(t,e)};Ar.prototype.getData=function(){return this._data};Ar.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 Re(n.getIntersection(i));this.addIntersection(a,r)}};Ar.prototype.toString=function(){return Ts.toLineString(new Lr(this._pts))};Ar.prototype.getNodeList=function(){return this._nodeList};Ar.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 Re){var r=arguments[0];return xt.orientationIndex(this.p0,this.p1,r)}};Nt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Nt.prototype.isVertical=function(){return this.p0.x===this.p1.x};Nt.prototype.equals=function(t){if(!(t instanceof Nt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Nt.prototype.intersection=function(t){var e=new Zu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Nt.prototype.project=function(){if(arguments[0]instanceof Re){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Re(t);var e=this.projectionFactor(t),n=new Re;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 Nt){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var c=this.project(r.p0);i<0&&(c=this.p0),i>1&&(c=this.p1);var u=this.project(r.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new Nt(c,u)}};Nt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Nt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Nt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Nt.prototype.distancePerpendicular=function(t){return xt.distancePointLinePerpendicular(t,this.p0,this.p1)};Nt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Nt.prototype.midPoint=function(){return Nt.midPoint(this.p0,this.p1)};Nt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return Xt.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};Nt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=Xt.MAX_VALUE,i=null,a=this.closestPoint(t.p0);r=a.distance(t.p0),n[0]=a,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||Xt.isNaN(e))&&(e=1),e};Nt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Nt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Nt.prototype.distance=function(){if(arguments[0]instanceof Nt){var t=arguments[0];return xt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Re){var e=arguments[0];return xt.distancePointLine(e,this.p0,this.p1)}};Nt.prototype.pointAlong=function(t){var e=new Re;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};Nt.prototype.hashCode=function(){var t=Xt.doubleToLongBits(this.p0.x);t^=Xt.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Xt.doubleToLongBits(this.p1.x);n^=Xt.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};Nt.prototype.interfaces_=function(){return[hs,fs]};Nt.prototype.getClass=function(){return Nt};Nt.midPoint=function(t,e){return new Re((t.x+e.x)/2,(t.y+e.y)/2)};KI.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Nt,KI);var Ad=function(){this.tempEnv1=new Rt,this.tempEnv2=new Rt,this._overlapSeg1=new Nt,this._overlapSeg2=new Nt};Ad.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)}};Ad.prototype.interfaces_=function(){return[]};Ad.prototype.getClass=function(){return Ad};var Lo=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Lo.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Lo.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=Vn.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 r2},Object.defineProperties(e,n),e}(kd),r2=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3],c=n.getContext(),u=i.getContext();this._si.processIntersections(c,r,u,a)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ad),Pn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],u=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(c),this.setMitreLimit(u)}}},bl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Pn.prototype.getEndCapStyle=function(){return this._endCapStyle};Pn.prototype.isSingleSided=function(){return this._isSingleSided};Pn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Pn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Pn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Pn.JOIN_ROUND&&(this._quadrantSegments=Pn.DEFAULT_QUADRANT_SEGMENTS)};Pn.prototype.getJoinStyle=function(){return this._joinStyle};Pn.prototype.setJoinStyle=function(t){this._joinStyle=t};Pn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Pn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Pn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Pn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Pn.prototype.getMitreLimit=function(){return this._mitreLimit};Pn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Pn.prototype.setSingleSided=function(t){this._isSingleSided=t};Pn.prototype.interfaces_=function(){return[]};Pn.prototype.getClass=function(){return Pn};Pn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};bl.CAP_ROUND.get=function(){return 1};bl.CAP_FLAT.get=function(){return 2};bl.CAP_SQUARE.get=function(){return 3};bl.JOIN_ROUND.get=function(){return 1};bl.JOIN_MITRE.get=function(){return 2};bl.JOIN_BEVEL.get=function(){return 3};bl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};bl.DEFAULT_MITRE_LIMIT.get=function(){return 5};bl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Pn,bl);var xr=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=xt.COUNTERCLOCKWISE,this._inputLine=t||null},Xd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};xr.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)};xr.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};Zo.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=bn.PI_TIMES_2;for(;t<=-Math.PI;)t+=bn.PI_TIMES_2;return t};bn.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)}};bn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,u=r*a+i*c;return u>0};bn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,u=r*a+i*c;return u<0};bn.interiorAngle=function(t,e,n){var r=bn.angle(e,t),i=bn.angle(e,n);return Math.abs(i-r)};bn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=bn.PI_TIMES_2;t>=bn.PI_TIMES_2&&(t=0)}else{for(;t>=bn.PI_TIMES_2;)t-=bn.PI_TIMES_2;t<0&&(t=0)}return t};bn.angleBetween=function(t,e,n){var r=bn.angle(e,t),i=bn.angle(e,n);return bn.diff(r,i)};bn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};bn.toRadians=function(t){return t*Math.PI/180};bn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?bn.COUNTERCLOCKWISE:n<0?bn.CLOCKWISE:bn.NONE};bn.angleBetweenOriented=function(t,e,n){var r=bn.angle(e,t),i=bn.angle(e,n),a=i-r;return a<=-Math.PI?a+bn.PI_TIMES_2:a>Math.PI?a-bn.PI_TIMES_2:a};Yc.PI_TIMES_2.get=function(){return 2*Math.PI};Yc.PI_OVER_2.get=function(){return Math.PI/2};Yc.PI_OVER_4.get=function(){return Math.PI/4};Yc.COUNTERCLOCKWISE.get=function(){return xt.COUNTERCLOCKWISE};Yc.CLOCKWISE.get=function(){return xt.CLOCKWISE};Yc.NONE.get=function(){return xt.COLLINEAR};Object.defineProperties(bn,Yc);var tr=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 Nt,this._seg1=new Nt,this._offset0=new Nt,this._offset1=new Nt,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 Zu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Pn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Yd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};tr.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=xt.computeOrientation(this._s0,this._s1,this._s2),r=n===xt.CLOCKWISE&&this._side===ot.LEFT||n===xt.COUNTERCLOCKWISE&&this._side===ot.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};tr.prototype.addLineEndCap=function(t,e){var n=new Nt(t,e),r=new Nt;this.computeOffsetSegment(n,ot.LEFT,this._distance,r);var i=new Nt;this.computeOffsetSegment(n,ot.RIGHT,this._distance,i);var a=e.x-t.x,c=e.y-t.y,u=Math.atan2(c,a);switch(this._bufParams.getEndCapStyle()){case Pn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,u+Math.PI/2,u-Math.PI/2,xt.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Pn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Pn.CAP_SQUARE:var m=new Re;m.x=Math.abs(this._distance)*Math.cos(u),m.y=Math.abs(this._distance)*Math.sin(u);var w=new Re(r.p1.x+m.x,r.p1.y+m.y),S=new Re(i.p1.x+m.x,i.p1.y+m.y);this._segList.addPt(w),this._segList.addPt(S);break}};tr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};tr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Is.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:a.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(u){if(u instanceof Gf)a=new Re(0,0),i=!1;else throw u}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};tr.prototype.addFilletCorner=function(t,e,n,r,i){var a=e.x-t.x,c=e.y-t.y,u=Math.atan2(c,a),m=n.x-t.x,w=n.y-t.y,S=Math.atan2(w,m);r===xt.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,u,S,r,i),this._segList.addPt(n)};tr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Re((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 Re((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)}};tr.prototype.createCircle=function(t){var e=new Re(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};tr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};tr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Zo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*tr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};tr.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()===Pn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Pn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,xt.CLOCKWISE,this._distance))};tr.prototype.closeRing=function(){this._segList.closeRing()};tr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};tr.prototype.interfaces_=function(){return[]};tr.prototype.getClass=function(){return tr};Yd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Yd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Yd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Yd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(tr,Yd);var lo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};lo.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&&gn.reverse(a),a};lo.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=xr.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ot.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var u=xr.simplify(t,r),m=u.length-1;n.initSideSegments(u[0],u[1],ot.LEFT),n.addFirstSegment();for(var w=2;w<=m;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};lo.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===ot.RIGHT&&(r=-r);var i=xr.simplify(t,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],e);for(var c=1;c<=a;c++){var u=c!==1;n.addNextSegment(i[c],u)}n.closeRing()};lo.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=xr.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],ot.LEFT);for(var a=2;a<=i;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=xr.simplify(t,-n),u=c.length-1;e.initSideSegments(c[u],c[u-1],ot.LEFT);for(var m=u-2;m>=0;m--)e.addNextSegment(c[m],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};lo.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Pn.CAP_ROUND:e.createCircle(t);break;case Pn.CAP_SQUARE:e.createSquare(t);break}};lo.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};lo.prototype.getBufferParameters=function(){return this._bufParams};lo.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};lo.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return lo.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};lo.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=xr.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ot.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var u=xr.simplify(t,r),m=u.length-1;n.initSideSegments(u[0],u[1],ot.LEFT),n.addFirstSegment();for(var w=2;w<=m;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};lo.prototype.getSegGen=function(t){return new tr(this._precisionModel,this._bufParams,t)};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};lo.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;na.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ut(arguments[2],Cs)&&arguments[0]instanceof Re&&arguments[1]instanceof lv)for(var c=arguments[0],u=arguments[1],m=arguments[2],w=u.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)&&xt.computeOrientation(t._seg.p0,t._seg.p1,c)!==xt.RIGHT){var P=u.getDepth(ot.LEFT);t._seg.p0.equals(w[S])||(P=u.getDepth(ot.RIGHT));var D=new Ou(t._seg,P);m.add(D)}}else if(Ut(arguments[2],Cs)&&arguments[0]instanceof Re&&Ut(arguments[1],Cs))for(var k=arguments[0],V=arguments[1],j=arguments[2],te=V.iterator();te.hasNext();){var U=te.next();U.isForward()&&t.findStabbedSegments(k,U,j)}}};kc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ms.min(e);return n._leftDepth};kc.prototype.interfaces_=function(){return[]};kc.prototype.getClass=function(){return kc};QI.DepthSegment.get=function(){return Ou};Object.defineProperties(kc,QI);var Ou=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Nt(t),this._leftDepth=e};Ou.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};Ou.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Ou.prototype.toString=function(){return this._upwardSeg.toString()};Ou.prototype.interfaces_=function(){return[hs]};Ou.prototype.getClass=function(){return Ou};var An=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};An.prototype.area=function(){return An.area(this.p0,this.p1,this.p2)};An.prototype.signedArea=function(){return An.signedArea(this.p0,this.p1,this.p2)};An.prototype.interpolateZ=function(t){if(t===null)throw new ar("Supplied point is null.");return An.interpolateZ(t,this.p0,this.p1,this.p2)};An.prototype.longestSideLength=function(){return An.longestSideLength(this.p0,this.p1,this.p2)};An.prototype.isAcute=function(){return An.isAcute(this.p0,this.p1,this.p2)};An.prototype.circumcentre=function(){return An.circumcentre(this.p0,this.p1,this.p2)};An.prototype.area3D=function(){return An.area3D(this.p0,this.p1,this.p2)};An.prototype.centroid=function(){return An.centroid(this.p0,this.p1,this.p2)};An.prototype.inCentre=function(){return An.inCentre(this.p0,this.p1,this.p2)};An.prototype.interfaces_=function(){return[]};An.prototype.getClass=function(){return An};An.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)};An.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};An.det=function(t,e,n,r){return t*r-e*n};An.interpolateZ=function(t,e,n,r){var i=e.x,a=e.y,c=n.x-i,u=r.x-i,m=n.y-a,w=r.y-a,S=c*w-u*m,E=t.x-i,P=t.y-a,D=(w*E-u*P)/S,k=(-m*E+c*P)/S,V=e.z+D*(n.z-e.z)+k*(r.z-e.z);return V};An.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};An.isAcute=function(t,e,n){return!(!bn.isAcute(t,e,n)||!bn.isAcute(e,n,t)||!bn.isAcute(n,t,e))};An.circumcentre=function(t,e,n){var r=n.x,i=n.y,a=t.x-r,c=t.y-i,u=e.x-r,m=e.y-i,w=2*An.det(a,c,u,m),S=An.det(c,a*a+c*c,m,u*u+m*m),E=An.det(a,a*a+c*c,u,u*u+m*m),P=r-S/w,D=i+E/w;return new Re(P,D)};An.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Is(t.x+n/2,t.y+r/2,1),a=new Is(t.x-r+n/2,t.y+n+r/2,1);return new Is(i,a)};An.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),a=r/(r+i),c=n.x-t.x,u=n.y-t.y,m=new Re(t.x+a*c,t.y+a*u);return m};An.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,a=e.z-t.z,c=n.x-t.x,u=n.y-t.y,m=n.z-t.z,w=i*m-a*u,S=a*c-r*m,E=r*u-i*c,P=w*w+S*S+E*E,D=Math.sqrt(P)/2;return D};An.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Re(r,i)};An.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),a=t.distance(e),c=r+i+a,u=(r*t.x+i*e.x+a*n.x)/c,m=(r*t.y+i*e.y+a*n.y)/c;return new Re(u,m)};var cs=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new mt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};cs.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,ze.EXTERIOR,ze.INTERIOR)};cs.prototype.addPolygon=function(t){var e=this,n=this._distance,r=ot.LEFT;this._distance<0&&(n=-this._distance,r=ot.RIGHT);var i=t.getExteriorRing(),a=gn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,ze.EXTERIOR,ze.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(u,-e._distance)||e.addPolygonRing(m,n,ot.opposite(r),ze.INTERIOR,ze.EXTERIOR)}};cs.prototype.isTriangleErodedCompletely=function(t,e){var n=new An(t[0],t[1],t[2]),r=n.inCentre(),i=xt.distancePointLine(r,n.p0,n.p1);return i=Aa.MINIMUM_VALID_SIZE&&xt.isCCW(t)&&(a=i,c=r,n=ot.opposite(n));var u=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(u,a,c)};cs.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Kr?this.addPolygon(t):t instanceof br?this.addLineString(t):t instanceof Co?this.addPoint(t):t instanceof Sf?this.addCollection(t):t instanceof Ru?this.addCollection(t):t instanceof Ta?this.addCollection(t):t instanceof Hi&&this.addCollection(t)};cs.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};cs.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new jf;var t=this._parent.getGeometryN(this._index++);return t instanceof Hi?(this._subcollectionIterator=new La(t),this._subcollectionIterator.next()):t};La.prototype.remove=function(){throw new Error(this.getClass().getName())};La.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};La.prototype.interfaces_=function(){return[qf]};La.prototype.getClass=function(){return La};La.isAtomic=function(t){return!(t instanceof Hi)};var qo=function(){this._geom=null;var t=arguments[0];this._geom=t};qo.prototype.locate=function(t){return qo.locate(t,this._geom)};qo.prototype.interfaces_=function(){return[Tf]};qo.prototype.getClass=function(){return qo};qo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?xt.isPointInRing(t,e.getCoordinates()):!1};qo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!qo.isPointInRing(t,n))return!1;for(var r=0;r=0;a--){var c=n._edgeList.get(a),u=c.getSym();i===null&&(i=u),r!==null&&u.setNext(r),r=c}i.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(ot.LEFT),c=r.getDepth(ot.RIGHT),u=this.computeDepths(i+1,this._edgeList.size(),a),m=this.computeDepths(0,i,u);if(m!==c)throw new pl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],E=arguments[2],P=E,D=w;D=0;u--){var m=r._resultAreaEdgeList.get(u),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&&(on.isTrue(i!==null,"found null for first outgoing dirEdge"),on.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],c=0,u=this.iterator();u.hasNext();){var m=u.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,u=this.iterator();u.hasNext();){var m=u.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 Fn(ze.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getEdge(),u=c.getLabel(),m=0;m<2;m++){var w=u.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}(Ri),$I=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 zy(n,new vR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ef),Jl=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Jl.prototype.compareTo=function(t){var e=t,n=Jl.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};Jl.prototype.interfaces_=function(){return[hs]};Jl.prototype.getClass=function(){return Jl};Jl.orientation=function(t){return gn.increasingDirection(t)===1};Jl.compareOriented=function(t,e,n,r){for(var i=e?1:-1,a=r?1:-1,c=e?t.length:-1,u=r?n.length:-1,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,P=w===u;if(E&&!P)return-1;if(!E&&P)return 1;if(E&&P)return 0}};var As=function(){this._edges=new mt,this._ocaMap=new ki};As.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),a=0;a0&&t.print(","),t.print(i[a].x+" "+i[a].y);t.println(")")}t.print(") ")};As.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};As.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),u=0;c[u++]=new Re(t.coord);for(var m=t.segmentIndex+1;m<=e.segmentIndex;m++)c[u++]=n.edge.pts[m];return a&&(c[u]=e.coord),new ly(c,new Fn(this.edge._label))};Ra.prototype.add=function(t,e,n){var r=new aa(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Ra.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Ra.prototype.interfaces_=function(){return[]};Ra.prototype.getClass=function(){return Ra};var Fu=function(){};Fu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new mt;r.add(new ta(n));do{var i=e.findChainEnd(t,n);r.add(new ta(i)),n=i}while(nn?e:n};ml.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ei.prototype.getDelta=function(t){return this._depth[t][ot.RIGHT]-this._depth[t][ot.LEFT]};Ei.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?ze.EXTERIOR:ze.INTERIOR};Ei.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ei.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===ze.EXTERIOR||i===ze.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ei.depthAtLocation(i):t._depth[n][r]+=Ei.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],u=arguments[2];u===ze.INTERIOR&&this._depth[a][c]++}};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.depthAtLocation=function(t){return t===ze.EXTERIOR?0:t===ze.INTERIOR?1:Ei.NULL_VALUE};eC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ei,eC);var ly=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Ra(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ei,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,Fn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,c=!0,u=this.pts.length,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 ml(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Rt;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(c)return!1;var u=this.intersectsToleranceSquare(t,e);return on.isTrue(!(c&&u),"Found bad envelope test"),u};uo.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 Re(this._maxx,this._maxy),this._corner[1]=new Re(this._minx,this._maxy),this._corner[2]=new Re(this._minx,this._miny),this._corner[3]=new Re(this._maxx,this._miny)};uo.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))};uo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};uo.prototype.getCoordinate=function(){return this._originalPt};uo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};uo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=uo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Rt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};uo.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()))};uo.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))};uo.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};uo.prototype.interfaces_=function(){return[]};uo.prototype.getClass=function(){return uo};nC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(uo,nC);var Dd=function(){this.tempEnv1=new Rt,this.selectedSegment=new Nt};Dd.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)}};Dd.prototype.interfaces_=function(){return[]};Dd.prototype.getClass=function(){return Dd};var Lf=function(){this._index=null;var t=arguments[0];this._index=t},rC={HotPixelSnapAction:{configurable:!0}};Lf.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 iC(e,n,r);return this._index.query(i,{interfaces_:function(){return[Yl]},visitItem:function(c){var u=c;u.select(i,a)}}),a.isNodeAdded()}};Lf.prototype.interfaces_=function(){return[]};Lf.prototype.getClass=function(){return Lf};rC.HotPixelSnapAction.get=function(){return iC};Object.defineProperties(Lf,rC);var iC=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}(Dd),Dc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new mt};Dc.prototype.processIntersections=function(t,e,n,r){var i=this;if(t===n&&e===r)return null;var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],u=n.getCoordinates()[r],m=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,c,u,m),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(a){if(a instanceof pl)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 Mn(r);this.bufferFixedPrecision(i)}};Si.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Mn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Si.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Si.prototype.bufferOriginalPrecision=function(){try{var t=new Wi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof hl)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 Vt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],u=new Si(i);u.setQuadrantSegments(c);var m=u.getResultGeometry(a);return m}else if(arguments[2]instanceof Pn&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],E=arguments[2],P=new Si(w,E),D=P.getResultGeometry(S);return D}}else if(arguments.length===4){var k=arguments[0],V=arguments[1],j=arguments[2],te=arguments[3],U=new Si(k);U.setQuadrantSegments(j),U.setEndCapStyle(te);var W=U.getResultGeometry(V);return W}};Si.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Wo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=e>0?e:0,c=i+2*a,u=Math.trunc(Math.log(c)/Math.log(10)+1),m=n-u,w=Math.pow(10,m);return w};Wf.CAP_ROUND.get=function(){return Pn.CAP_ROUND};Wf.CAP_BUTT.get=function(){return Pn.CAP_FLAT};Wf.CAP_FLAT.get=function(){return Pn.CAP_FLAT};Wf.CAP_SQUARE.get=function(){return Pn.CAP_SQUARE};Wf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Si,Wf);var Gi=function(){this._pt=[new Re,new Re],this._distance=Xt.NaN,this._isNull=!0};Gi.prototype.getCoordinates=function(){return this._pt};Gi.prototype.getCoordinate=function(t){return this._pt[t]};Gi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};var Ea=function(){};Ea.prototype.interfaces_=function(){return[]};Ea.prototype.getClass=function(){return Ea};Ea.computeDistance=function(){if(arguments[2]instanceof Gi&&arguments[0]instanceof br&&arguments[1]instanceof Re)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Nt,a=0;a0||this._isIn?ze.INTERIOR:ze.EXTERIOR)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var qi=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},oC={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};oC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(qi,oC);var Wl=function(t){this._pts=t||null};Wl.prototype.filter=function(t){t instanceof Co&&this._pts.add(t)};Wl.prototype.interfaces_=function(){return[ra]};Wl.prototype.getClass=function(){return Wl};Wl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Co?Ms.singletonList(t):Wl.getPoints(t,new mt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Co?n.add(e):e instanceof Hi&&e.apply(new Wl(n)),n}};var Nc=function(){this._locations=null;var t=arguments[0];this._locations=t};Nc.prototype.filter=function(t){(t instanceof Co||t instanceof br||t instanceof Kr)&&this._locations.add(new qi(t,0,t.getCoordinate()))};Nc.prototype.interfaces_=function(){return[ra]};Nc.prototype.getClass=function(){return Nc};Nc.getLocations=function(t){var e=new mt;return t.apply(new Nc(e)),e};var Ci=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ks,this._minDistanceLocation=null,this._minDistance=Xt.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ci.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=ll.getPolygons(this._geom[n]);if(a.size()>0){var c=Nc.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ut(arguments[0],Cs)&&Ut(arguments[1],Cs)){for(var u=arguments[0],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(),V=0;Vthis._distance&&this.initialize(e,n,r)}};Ai.prototype.interfaces_=function(){return[]};Ai.prototype.getClass=function(){return Ai};var Ks=function(){};Ks.prototype.interfaces_=function(){return[]};Ks.prototype.getClass=function(){return Ks};Ks.computeDistance=function(){if(arguments[2]instanceof Ai&&arguments[0]instanceof br&&arguments[1]instanceof Re)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Nt,i=t.getCoordinates(),a=0;a1||t<=0)throw new ar("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ss.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ss.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ss.prototype.computeOrientedDistance=function(t,e,n){var r=new Oc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new eu(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ss.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ss(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ss(r,i);return c.setDensifyFraction(a),c.distance()}};s1.MaxPointDistanceFilter.get=function(){return Oc};s1.MaxDensifiedByFractionDistanceFilter.get=function(){return eu};Object.defineProperties(ss,s1);var Oc=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._euclideanDist=new Ks,this._geom=null;var t=arguments[0];this._geom=t};Oc.prototype.filter=function(t){this._minPtDist.initialize(),Ks.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Oc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Oc.prototype.interfaces_=function(){return[Ma]};Oc.prototype.getClass=function(){return Oc};var eu=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};eu.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),a=(i.x-r.x)/this._numSubSegs,c=(i.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ts.toLineString(i[0],i[1])+")"}};So.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=So.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(),So.VERBOSE&&Ii.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};So.prototype.checkNegativeValid=function(){if(!(this._input instanceof Kr||this._input instanceof Ta||this._input instanceof Hi))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};So.prototype.getErrorIndicator=function(){return this._errorIndicator};So.prototype.checkMinimumDistance=function(t,e,n){var r=new Ci(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ti.prototype.report=function(t){if(!Ti.VERBOSE)return null;Ii.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Ti.prototype.getErrorMessage=function(){return this._errorMsg};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};Ti.isValidMsg=function(t,e,n){var r=new Ti(t,e,n);return r.isValid()?null:r.getErrorMessage()};Ti.isValid=function(t,e,n){var r=new Ti(t,e,n);return!!r.isValid()};l1.VERBOSE.get=function(){return!1};l1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ti,l1);var ua=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ua.prototype.getCoordinates=function(){return this._pts};ua.prototype.size=function(){return this._pts.length};ua.prototype.getCoordinate=function(t){return this._pts[t]};ua.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ua.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ac.octant(this.getCoordinate(t),this.getCoordinate(t+1))};ua.prototype.setData=function(t){this._data=t};ua.prototype.getData=function(){return this._data};ua.prototype.toString=function(){return Ts.toLineString(new Lr(this._pts))};ua.prototype.interfaces_=function(){return[Da]};ua.prototype.getClass=function(){return ua};var vi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new mt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};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],u=n.getCoordinates()[r],m=n.getCoordinates()[r+1];this._li.computeIntersection(a,c,u,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]=u,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[zu]};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 Ds=function(){this._li=new Zu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ds.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ds.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ds.prototype.isValid=function(){return this.execute(),this._isValid};Ds.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ds.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new i1;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ds.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new pl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ds.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ts.toLineString(t[0],t[1])+" and "+Ts.toLineString(t[2],t[3])};Ds.prototype.interfaces_=function(){return[]};Ds.prototype.getClass=function(){return Ds};Ds.computeIntersections=function(t){var e=new Ds(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Vu=function t(){this._nv=null;var e=arguments[0];this._nv=new Ds(t.toSegmentStrings(e))};Vu.prototype.checkValid=function(){this._nv.checkValid()};Vu.prototype.interfaces_=function(){return[]};Vu.prototype.getClass=function(){return Vu};Vu.toSegmentStrings=function(t){for(var e=new mt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new ua(r.getCoordinates(),r))}return e};Vu.checkValid=function(t){var e=new Vu(t);e.checkValid()};var zc=function(t){this._mapOp=t};zc.prototype.map=function(t){for(var e=this,n=new mt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};co.prototype.interfaces_=function(){return[]};co.prototype.getClass=function(){return co};var Oa=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Nt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof br&&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}};Oa.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 Re(a),!1)}};Oa.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=Xt.MAX_VALUE,i=-1,a=0;ae&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Pr.computeOverlaySnapTolerance(i),Pr.computeOverlaySnapTolerance(a))}};Pr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Pr.SNAP_PRECISION_FACTOR;return r};Pr.snapToSelf=function(t,e,n){var r=new Pr(t);return r.snapToSelf(e,n)};sC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Pr,sC);var aC=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 Oa(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}(co),Ui=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Ui.prototype.getCommon=function(){return Xt.longBitsToDouble(this._commonBits)};Ui.prototype.add=function(t){var e=Xt.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Ui.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Ui.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Ui.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Ui.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Ui.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Xt.longBitsToDouble(t),n=Xt.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return a}};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.getBit=function(t,e){var n=1<>52};Ui.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Ui.getBit(t,r)!==Ui.getBit(e,r))return n;n++}return 52};var tu=function(){this._commonCoord=null,this._ccFilter=new Bc},u1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tu.prototype.addCommonBits=function(t){var e=new nu(this._commonCoord);t.apply(e),t.geometryChanged()};tu.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new Re(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new nu(e);return t.apply(n),t.geometryChanged(),t};tu.prototype.getCommonCoordinate=function(){return this._commonCoord};tu.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};tu.prototype.interfaces_=function(){return[]};tu.prototype.getClass=function(){return tu};u1.CommonCoordinateFilter.get=function(){return Bc};u1.Translater.get=function(){return nu};Object.defineProperties(tu,u1);var Bc=function(){this._commonBitsX=new Ui,this._commonBitsY=new Ui};Bc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Bc.prototype.getCommonCoordinate=function(){return new Re(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Bc.prototype.interfaces_=function(){return[Ma]};Bc.prototype.getClass=function(){return Bc};var nu=function(){this.trans=null;var t=arguments[0];this.trans=t};nu.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)};nu.prototype.isDone=function(){return!1};nu.prototype.isGeometryChanged=function(){return!0};nu.prototype.interfaces_=function(){return[Ls]};nu.prototype.getClass=function(){return nu};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 Pr(t),n=e.snapTo(t,this._snapTolerance);return n};bi.prototype.removeCommonBits=function(t){this._cbr=new tu,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=en.overlayOp(e[0],e[1],t);return this.prepareResult(n)};bi.prototype.checkValid=function(t){t.isValid()||Ii.out.println("Snapped geometry is invalid")};bi.prototype.computeSnapTolerance=function(){this._snapTolerance=Pr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};bi.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Pr.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,en.UNION)};bi.intersection=function(t,e){return bi.overlayOp(t,e,en.INTERSECTION)};bi.symDifference=function(t,e){return bi.overlayOp(t,e,en.SYMDIFFERENCE)};bi.difference=function(t,e){return bi.overlayOp(t,e,en.DIFFERENCE)};var Yi=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Yi.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=en.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof hl)r=a;else throw a}finally{}if(!n)try{e=bi.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof hl?r:a}finally{}return e};Yi.prototype.interfaces_=function(){return[]};Yi.prototype.getClass=function(){return Yi};Yi.overlayOp=function(t,e,n){var r=new Yi(t,e);return r.getResultGeometry(n)};Yi.union=function(t,e){return Yi.overlayOp(t,e,en.UNION)};Yi.intersection=function(t,e){return Yi.overlayOp(t,e,en.INTERSECTION)};Yi.symDifference=function(t,e){return Yi.overlayOp(t,e,en.SYMDIFFERENCE)};Yi.difference=function(t,e){return Yi.overlayOp(t,e,en.DIFFERENCE)};var Rd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Rd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Rd.prototype.interfaces_=function(){return[]};Rd.prototype.getClass=function(){return Rd};var Po=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}},c1={INSERT:{configurable:!0},DELETE:{configurable:!0}};Po.prototype.isDelete=function(){return this._eventType===Po.DELETE};Po.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};Po.prototype.getObject=function(){return this._obj};Po.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};Po.prototype.getInsertEvent=function(){return this._insertEvent};Po.prototype.isInsert=function(){return this._eventType===Po.INSERT};Po.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};Po.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Po.prototype.interfaces_=function(){return[hs]};Po.prototype.getClass=function(){return Po};c1.INSERT.get=function(){return 1};c1.DELETE.get=function(){return 2};Object.defineProperties(Po,c1);var uy=function(){};uy.prototype.interfaces_=function(){return[]};uy.prototype.getClass=function(){return uy};var Li=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};Li.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Li.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Li.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Li.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Li.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Li.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Li.prototype.hasProperIntersection=function(){return this._hasProper};Li.prototype.hasIntersection=function(){return this._hasIntersection};Li.prototype.isDone=function(){return this._isDone};Li.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Li.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Li.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],a=t.getCoordinates()[e+1],c=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,c,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var bR=function(t){function e(){t.call(this),this.events=new mt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;Ms.sort(this.events);for(var r=0;re||this._maxa?1:0};Nd.prototype.interfaces_=function(){return[gf]};Nd.prototype.getClass=function(){return Nd};var xR=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}(za),wR=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}(za),Fa=function(){this._leaves=new mt,this._root=null,this._level=0};Fa.prototype.buildTree=function(){var t=this;Ms.sort(this._leaves,new za.NodeComparator);for(var e=this._leaves,n=null,r=new mt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};Fa.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 xR(t,e,n))};Fa.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};Fa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Fa.prototype.printNode=function(t){Ii.out.println(Ts.toLineString(new Re(t._min,this._level),new Re(t._max,this._level)))};Fa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Fa.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=gn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,u=i;xt.isCCW(a)&&(c=i,u=r);var m=new ly(a,new Fn(this._argIndex,ze.BOUNDARY,c,u));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 Fn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new bR},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),c=a.getLabel().getLocation(n),u=a.eiList.iterator();u.hasNext();){var m=u.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 Ta&&(this._useBoundaryDeterminationRule=!1),n instanceof Kr)this.addPolygon(n);else if(n instanceof br)this.addLineString(n);else if(n instanceof Co)this.addPoint(n);else if(n instanceof Sf)this.addCollection(n);else if(n instanceof Ru)this.addCollection(n);else if(n instanceof Ta)this.addCollection(n);else if(n instanceof Hi)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Mf(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}(pr),kf=function(){if(this._li=new Zu,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 ed(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=ls.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ed(0,e,r),this._arg[1]=new ed(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 ed(0,i,c),this._arg[1]=new ed(1,a,c)}};kf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};kf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};kf.prototype.interfaces_=function(){return[]};kf.prototype.getClass=function(){return kf};var ku=function(){};ku.prototype.interfaces_=function(){return[]};ku.prototype.getClass=function(){return ku};ku.map=function(){if(arguments[0]instanceof Vt&&Ut(arguments[1],ku.MapOp)){for(var t=arguments[0],e=arguments[1],n=new mt,r=0;r=t.size()?null:t.get(e)};Br.union=function(t){var e=new Br(t);return e.union()};cC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Br,cC);var cy=function(){};cy.prototype.interfaces_=function(){return[]};cy.prototype.getClass=function(){return cy};cy.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return en.createEmptyResult(en.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Yi.overlayOp(t,e,en.UNION)};function Xu(){return new hy}function hy(){this.reset()}hy.prototype={constructor:hy,reset:function(){this.s=this.t=0},add:function(t){i2(pg,t,this.t),i2(this,pg.s,this.s),this.s?this.t+=pg.t:this.s=pg.t},valueOf:function(){return this.s}};var pg=new hy;function i2(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var vr=1e-6,Wn=Math.PI,al=Wn/2,o2=Wn/4,gl=Wn*2,Cu=180/Wn,Zs=Wn/180,ji=Math.abs,SR=Math.atan,Rf=Math.atan2,Zr=Math.cos,Xr=Math.sin,Hf=Math.sqrt;function hC(t){return t>1?0:t<-1?Wn:Math.acos(t)}function Vc(t){return t>1?al:t<-1?-al:Math.asin(t)}function ld(){}function fy(t,e){t&&a2.hasOwnProperty(t.type)&&a2[t.type](t,e)}var s2={Feature:function(t,e){fy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rWn?t-gl:t<-Wn?t+gl:t,e]}fv.invert=fv;function IR(t,e,n){return(t%=gl)?e||n?fC(c2(t),h2(e,n)):c2(t):e||n?h2(e,n):fv}function u2(t){return function(e,n){return e+=t,[e>Wn?e-gl:e<-Wn?e+gl:e,n]}}function c2(t){var e=u2(t);return e.invert=u2(-t),e}function h2(t,e){var n=Zr(t),r=Xr(t),i=Zr(e),a=Xr(e);function c(u,m){var w=Zr(m),S=Zr(u)*w,E=Xr(u)*w,P=Xr(m),D=P*n+S*r;return[Rf(E*i-D*a,S*n-P*r),Vc(D*i+E*a)]}return c.invert=function(u,m){var w=Zr(m),S=Zr(u)*w,E=Xr(u)*w,P=Xr(m),D=P*i-E*a;return[Rf(E*i+P*a,S*n+D*r),Vc(D*n-S*r)]},c}function CR(t,e,n,r,i,a){if(n){var c=Zr(e),u=Xr(e),m=r*n;i==null?(i=e+r*gl,a=e-m/2):(i=f2(c,i),a=f2(c,a),(r>0?ia)&&(i+=r*gl));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 TR(t,e,n,r,i,a){var c=t[0],u=t[1],m=e[0],w=e[1],S=0,E=1,P=m-c,D=w-u,k;if(k=n-c,!(!P&&k>0)){if(k/=P,P<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=i-c,!(!P&&k<0)){if(k/=P,P<0){if(k>E)return;k>S&&(S=k)}else if(P>0){if(k0)){if(k/=D,D<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=a-u,!(!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*P,t[1]=u+S*D),E<1&&(e[0]=c+E*P,e[1]=u+E*D),!0}}}}}function kg(t,e){return ji(t[0]-e[0])=0;--u)i.point((E=S[u])[0],E[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,D=!D}while(!P.v);i.lineEnd()}}}function p2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function LR(t){return t.length===1&&(t=PR(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 PR(t){return function(e,n){return mC(t(e),n)}}LR(mC);function gC(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 ud=1e9,yg=-ud;function MR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,E,P){var D=0,k=0;if(w==null||(D=c(w,E))!==(k=c(S,E))||m(w,S)<0^E>0)do P.point(D===0||D===3?t:n,D>1?r:e);while((D=(D+E+4)%4)!==k);else P.point(S[0],S[1])}function c(w,S){return ji(w[0]-t)0?0:3:ji(w[0]-n)0?2:1:ji(w[1]-e)0?1:0:S>0?3:2}function u(w,S){return m(w.x,S.x)}function m(w,S){var E=c(w,1),P=c(S,1);return E!==P?E-P: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=pC(),P,D,k,V,j,te,U,W,Y,oe,_e,se={point:ce,lineStart:fe,lineEnd:Ke,polygonStart:Le,polygonEnd:Z};function ce(Ze,tt){i(Ze,tt)&&S.point(Ze,tt)}function me(){for(var Ze=0,tt=0,qe=D.length;ttr&&(Tn-At)*(r-hn)>(yn-hn)*(t-At)&&++Ze:yn<=r&&(Tn-At)*(r-hn)<(yn-hn)*(t-At)&&--Ze;return Ze}function Le(){S=E,P=[],D=[],_e=!0}function Z(){var Ze=me(),tt=_e&&Ze,qe=(P=gC(P)).length;(tt||qe)&&(w.polygonStart(),tt&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),qe&&dC(P,u,Ze,a,w),w.polygonEnd()),S=w,P=D=k=null}function fe(){se.point=Ee,D&&D.push(k=[]),oe=!0,Y=!1,U=W=NaN}function Ke(){P&&(Ee(V,j),te&&Y&&E.rejoin(),P.push(E.result())),se.point=ce,Y&&S.lineEnd()}function Ee(Ze,tt){var qe=i(Ze,tt);if(D&&k.push([Ze,tt]),oe)V=Ze,j=tt,te=qe,oe=!1,qe&&(S.lineStart(),S.point(Ze,tt));else if(qe&&Y)S.point(Ze,tt);else{var Ot=[U=Math.max(yg,Math.min(ud,U)),W=Math.max(yg,Math.min(ud,W))],wt=[Ze=Math.max(yg,Math.min(ud,Ze)),tt=Math.max(yg,Math.min(ud,tt))];TR(Ot,wt,t,e,n,r)?(Y||(S.lineStart(),S.point(Ot[0],Ot[1])),S.point(wt[0],wt[1]),qe||S.lineEnd(),_e=!1):qe&&(S.lineStart(),S.point(Ze,tt),_e=!1)}U=Ze,W=tt,Y=qe}return se}}var S0=Xu();function AR(t,e){var n=e[0],r=e[1],i=[Xr(n),-Zr(n),0],a=0,c=0;S0.reset();for(var u=0,m=t.length;u=0?1:-1,ce=se*_e,me=ce>Wn,Le=k*Y;if(S0.add(Rf(Le*se*Xr(ce),V*oe+Le*Zr(ce))),a+=me?_e+se*gl:_e,me^P>=n^U>=n){var Z=py(Nf(E),Nf(te));hv(Z);var fe=py(i,Z);hv(fe);var Ke=(me^_e>=0?-1:1)*Vc(fe[2]);(r>Ke||r===Ke&&(Z[0]||Z[1]))&&(c+=me^_e>=0?1:-1)}}return(a<-vr||aOd&&(Od=t),emy&&(my=e)}Xu();function yC(t,e,n,r){return function(i,a){var c=e(a),u=i.invert(r[0],r[1]),m=pC(),w=e(m),S=!1,E,P,D,k={point:V,lineStart:te,lineEnd:U,polygonStart:function(){k.point=W,k.lineStart=Y,k.lineEnd=oe,P=[],E=[]},polygonEnd:function(){k.point=V,k.lineStart=te,k.lineEnd=U,P=gC(P);var _e=AR(E,u);P.length?(S||(a.polygonStart(),S=!0),dC(P,RR,_e,n,a)):_e&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),P=E=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function V(_e,se){var ce=i(_e,se);t(_e=ce[0],se=ce[1])&&a.point(_e,se)}function j(_e,se){var ce=i(_e,se);c.point(ce[0],ce[1])}function te(){k.point=j,c.lineStart()}function U(){k.point=V,c.lineEnd()}function W(_e,se){D.push([_e,se]);var ce=i(_e,se);w.point(ce[0],ce[1])}function Y(){w.lineStart(),D=[]}function oe(){W(D[0][0],D[0][1]),w.lineEnd();var _e=w.clean(),se=m.result(),ce,me=se.length,Le,Z,fe;if(D.pop(),E.push(D),D=null,!!me){if(_e&1){if(Z=se[0],(Le=Z.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),ce=0;ce1&&_e&2&&se.push(se.pop().concat(se.shift())),P.push(se.filter(DR))}}return k}}function DR(t){return t.length>1}function RR(t,e){return((t=t.x)[0]<0?t[1]-al-vr:al-t[1])-((e=e.x)[0]<0?e[1]-al-vr:al-e[1])}const g2=yC(function(){return!0},NR,zR,[-Wn,-al]);function NR(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,c){var u=a>0?Wn:-Wn,m=ji(a-e);ji(m-Wn)0?al:-al),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(a,n),i=0):r!==u&&m>=Wn&&(ji(e-r)vr?SR((Xr(e)*(a=Zr(r))*Xr(n)-Xr(r)*(i=Zr(e))*Xr(t))/(i*a*c)):(e+r)/2}function zR(t,e,n,r){var i;if(t==null)i=n*al,r.point(-Wn,i),r.point(0,i),r.point(Wn,i),r.point(Wn,0),r.point(Wn,-i),r.point(0,-i),r.point(-Wn,-i),r.point(-Wn,0),r.point(-Wn,i);else if(ji(t[0]-e[0])>vr){var a=t[0]0,i=ji(n)>vr;function a(S,E,P,D){CR(D,t,e,P,S,E)}function c(S,E){return Zr(S)*Zr(E)>n}function u(S){var E,P,D,k,V;return{lineStart:function(){k=D=!1,V=1},point:function(j,te){var U=[j,te],W,Y=c(j,te),oe=r?Y?0:w(j,te):Y?w(j+(j<0?Wn:-Wn),te):0;if(!E&&(k=D=Y)&&S.lineStart(),Y!==D&&(W=m(E,U),(!W||kg(E,W)||kg(U,W))&&(U[0]+=vr,U[1]+=vr,Y=c(U[0],U[1]))),Y!==D)V=0,Y?(S.lineStart(),W=m(U,E),S.point(W[0],W[1])):(W=m(E,U),S.point(W[0],W[1]),S.lineEnd()),E=W;else if(i&&E&&r^Y){var _e;!(oe&P)&&(_e=m(U,E,!0))&&(V=0,r?(S.lineStart(),S.point(_e[0][0],_e[0][1]),S.point(_e[1][0],_e[1][1]),S.lineEnd()):(S.point(_e[1][0],_e[1][1]),S.lineEnd(),S.lineStart(),S.point(_e[0][0],_e[0][1])))}Y&&(!E||!kg(E,U))&&S.point(U[0],U[1]),E=U,D=Y,P=oe},lineEnd:function(){D&&S.lineEnd(),E=null},clean:function(){return V|(k&&D)<<1}}}function m(S,E,P){var D=Nf(S),k=Nf(E),V=[1,0,0],j=py(D,k),te=dg(j,j),U=j[0],W=te-U*U;if(!W)return!P&&S;var Y=n*te/W,oe=-n*U/W,_e=py(V,j),se=mg(V,Y),ce=mg(j,oe);w0(se,ce);var me=_e,Le=dg(se,me),Z=dg(me,me),fe=Le*Le-Z*(dg(se,se)-1);if(!(fe<0)){var Ke=Hf(fe),Ee=mg(me,(-Le-Ke)/Z);if(w0(Ee,se),Ee=cv(Ee),!P)return Ee;var Ze=S[0],tt=E[0],qe=S[1],Ot=E[1],wt;tt0^Ee[1]<(ji(Ee[0]-Ze)Wn^(Ze<=Ee[0]&&Ee[0]<=tt)){var hn=mg(me,(-Le+Ke)/Z);return w0(hn,se),[Ee,cv(hn)]}}}function w(S,E){var P=r?t:Wn-t,D=0;return S<-P?D|=1:S>P&&(D|=2),E<-P?D|=4:E>P&&(D|=8),D}return yC(c,u,a,r?[0,-t]:[-Wn,t-Wn])}function _C(t){return function(e){var n=new pv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function pv(){}pv.prototype={constructor:pv,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 vC(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),ER(n,t.stream(m2));var c=m2.result(),u=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),m=+e[0][0]+(r-u*(c[1][0]+c[0][0]))/2,w=+e[0][1]+(i-u*(c[1][1]+c[0][1]))/2;return a!=null&&t.clipExtent(a),t.scale(u*150).translate([m,w])}function BR(t,e,n){return vC(t,[[0,0],e],n)}var y2=16,VR=Zr(30*Zs);function _2(t,e){return+e?GR(t,e):UR(t)}function UR(t){return _C({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function GR(t,e){function n(r,i,a,c,u,m,w,S,E,P,D,k,V,j){var te=w-r,U=S-i,W=te*te+U*U;if(W>4*e&&V--){var Y=c+P,oe=u+D,_e=m+k,se=Hf(Y*Y+oe*oe+_e*_e),ce=Vc(_e/=se),me=ji(ji(_e)-1)e||ji((te*Ke+U*Ee)/W-.5)>.3||c*P+u*D+m*k2?Ee[2]%360*Zs:0,fe()):[w*Cu,S*Cu,E*Cu]},me.precision=function(Ee){return arguments.length?(_e=_2(Z,oe=Ee*Ee),Ke()):Hf(oe)},me.fitExtent=function(Ee,Ze){return vC(me,Ee,Ze)},me.fitSize=function(Ee,Ze){return BR(me,Ee,Ze)};function fe(){D=fC(P=IR(w,S,E),e);var Ee=e(u,m);return a=r-Ee[0]*n,c=i+Ee[1]*n,Ke()}function Ke(){return se=ce=null,me}return function(){return e=t.apply(this,arguments),me.invert=e.invert&&Le,fe()}}function bC(t){return function(e,n){var r=Zr(e),i=Zr(n),a=t(r*i);return[a*i*Xr(e),a*Xr(n)]}}function xC(t){return function(e,n){var r=Hf(e*e+n*n),i=t(r),a=Xr(i),c=Zr(i);return[Rf(e*a,r*c),Vc(r&&n*a/r)]}}var HR=bC(function(t){return Hf(2/(1+t))});HR.invert=xC(function(t){return 2*Vc(t/2)});var wC=bC(function(t){return(t=hC(t))&&t/Xr(t)});wC.invert=xC(function(t){return t});function ZR(){return jR(wC).scale(79.4188).clipAngle(180-.001)}function v2(t,e){return[t,e]}v2.invert=v2;function XR(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 u=Dg(c,e,r,i);u&&a.push(u)}),sv(a);case"FeatureCollection":return $w(t,function(c){var u=Dg(c,e,r,i);u&&$w(u,function(m){m&&a.push(m)})}),sv(a)}return Dg(t,e,r,i)}function Dg(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(V){var j=Dg(V,e,n,r);j&&c.push(j)}),sv(c)}var u=YR(a),m={type:a.type,coordinates:EC(a.coordinates,u)},w=new r1,S=w.read(m),E=nR(rR(e,n),"meters"),P=Si.bufferOp(S,E,r),D=new ZI;if(P=D.write(P),!SC(P.coordinates)){var k={type:P.type,coordinates:IC(P.coordinates,u)};return Cy(k,i)}}function SC(t){return Array.isArray(t[0])?SC(t[0]):isNaN(t[0])}function EC(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return EC(n,e)})}function IC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return IC(n,e)})}function YR(t){var e=oR(t).geometry.coordinates,n=[-e[0],-e[1]];return ZR().rotate(n).scale(Vo)}function KR(t,e){var n=oy(t),r=oy(e),i=t.properties||{},a=kI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?RI(a[0],i):NI(a,i)}function b2(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 x2(t,e){const n=KR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=XR(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)b2(i);else for(const i of r.geometry.coordinates)for(const a of i)b2(a);e({type:"FeatureCollection",features:[r,n]})}let w2={type:"FeatureCollection",features:[]};function JR(t,e,n=!0,r=!0,i={},a={},c={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let u,m=[],w,S;function E(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:w2}),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 P=k=>{u==null||u({type:"mapClick",coordinates:[k.lngLat.lng,k.lngLat.lat]})};function D(k=!1){if(!e)throw new Error;const V=document.createElement("div");return k&&V.classList.add("marker-interactive"),new CD({props:{displayIn:"maplibre"},target:V}),new e.Marker({element:V,offset:[1,-13]})}return{setEventHandler(k){k?(u=k,t.on("click",P)):(u=void 0,t.off("click",P))},flyTo(k,V){t.flyTo({center:k,zoom:V,...i})},fitBounds(k,V,j){t.fitBounds([[k[0],k[1]],[k[2],k[3]]],{padding:V,maxZoom:j,...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,V){if(!n)return;function j(te){var U;(U=t.getSource("full-geom"))==null||U.setData(te)}for(const te of m)te.remove();if(m.length=0,j(w2),!!e){if(V){let te=!1;if(V.geometry.type==="GeometryCollection"){const U=V.geometry.geometries.filter(W=>W.type==="Polygon"||W.type==="MultiPolygon");if(U.length>0){let W=U.pop();for(const Y of U)W=iR(W,Y);x2({...V,geometry:W},j),te=!0}else{const W=V.geometry.geometries.filter(Y=>Y.type==="LineString"||Y.type==="MultiLineString");W.length>0&&(j({...V,geometry:{type:"GeometryCollection",geometries:W}}),te=!0)}}if(!te){if(V.geometry.type==="Polygon"||V.geometry.type==="MultiPolygon")x2(V,j);else if(V.geometry.type==="LineString"||V.geometry.type==="MultiLineString"){j(V);return}}n&&m.push((typeof n=="object"?new e.Marker(n):D()).setLngLat(V.center).addTo(t))}if(r)for(const te of k??[]){if(te===V)continue;const U=(typeof r=="object"?new e.Marker(r):D(!0)).setLngLat(te.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(te.place_type[0]==="reverse"?te.place_name:te.place_name.replace(/,.*/,""))).addTo(t),W=U.getElement();W.addEventListener("click",Y=>{Y.stopPropagation(),u==null||u({type:"markerClick",id:te.id})}),W.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:te.id}),U.togglePopup()}),W.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:te.id}),U.togglePopup()}),m.push(U)}}},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 QR(t){let e,n;return{c(){e=jl("svg"),n=jl("path"),Ve(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"),Ve(e,"viewBox","0 0 14 14"),Ve(e,"width","13"),Ve(e,"height","13"),Ve(e,"class","svelte-en2qvf")},m(r,i){De(r,e,i),Se(e,n)},p:yt,i:yt,o:yt,d(r){r&&ke(e)}}}class CC extends Qt{constructor(e){super(),Jt(this,e,null,QR,Gt,{})}}function $R(t){let e,n;return{c(){e=jl("svg"),n=jl("path"),Ve(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"),Ve(e,"viewBox","0 0 30 30"),Ve(e,"fill","none"),Ve(e,"xmlns","http://www.w3.org/2000/svg"),Ve(e,"class","svelte-d2loi5")},m(r,i){De(r,e,i),Se(e,n)},p:yt,i:yt,o:yt,d(r){r&&ke(e)}}}class TC extends Qt{constructor(e){super(),Jt(this,e,null,$R,Gt,{})}}function eN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"area.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"area.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function tN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"reverse.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"reverse.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function nN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"poi.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"poi.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function rN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"postal_code.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"postal_code.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function iN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"street.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"street.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function oN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"road.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"road.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function sN(t){let e,n;return{c(){e=Ne("img"),Eo(e.src,n=t[3]+"housenumber.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"housenumber.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function aN(t){let e,n,r,i;return{c(){e=Ne("img"),Eo(e.src,n=t[5])||Ve(e,"src",n),Ve(e,"alt",t[4]),Ve(e,"class","svelte-ltkwvy")},m(a,c){De(a,e,c),r||(i=Wt(e,"error",t[14]),r=!0)},p(a,c){c&32&&!Eo(e.src,n=a[5])&&Ve(e,"src",n),c&16&&Ve(e,"alt",a[4])},d(a){a&&ke(e),r=!1,i()}}}function S2(t){let e,n;return{c(){e=Ne("span"),n=It(t[6]),Ve(e,"class","secondary svelte-ltkwvy")},m(r,i){De(r,e,i),Se(e,n)},p(r,i){i&64&&Bn(n,r[6])},d(r){r&&ke(e)}}}function lN(t){var se,ce;let e,n,r,i,a,c,u,m,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,E,P=t[2]==="always"||t[2]&&!t[0].address&&((se=t[0].properties)==null?void 0:se.kind)!=="road"&&((ce=t[0].properties)==null?void 0:ce.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,V=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",j,te,U;function W(me,Le){var Z,fe;return Le&1&&(n=null),Le&1&&(r=null),Le&1&&(i=null),me[5]?aN:me[0].address?sN:((Z=me[0].properties)==null?void 0:Z.kind)==="road"||((fe=me[0].properties)==null?void 0:fe.kind)==="road_relation"?oN:(n==null&&(n=!!me[0].id.startsWith("address.")),n?iN:(r==null&&(r=!!me[0].id.startsWith("postal_code.")),r?rN:(i==null&&(i=!!me[0].id.startsWith("poi.")),i?nN:me[7]?tN:eN)))}let Y=W(t,-1),oe=Y(t),_e=P&&S2(t);return{c(){e=Ne("li"),oe.c(),a=rt(),c=Ne("span"),u=Ne("span"),m=Ne("span"),S=It(w),E=rt(),_e&&_e.c(),D=rt(),k=Ne("span"),j=It(V),Ve(m,"class","primary svelte-ltkwvy"),Ve(u,"class","svelte-ltkwvy"),Ve(k,"class","line2 svelte-ltkwvy"),Ve(c,"class","texts svelte-ltkwvy"),Ve(e,"tabindex","0"),Ve(e,"data-selected",t[1]),Ve(e,"class","svelte-ltkwvy"),sl(e,"selected",t[1])},m(me,Le){De(me,e,Le),oe.m(e,null),Se(e,a),Se(e,c),Se(c,u),Se(u,m),Se(m,S),Se(u,E),_e&&_e.m(u,null),Se(c,D),Se(c,k),Se(k,j),te||(U=[Wt(e,"mouseenter",t[12]),Wt(e,"focus",t[13])],te=!0)},p(me,[Le]){var Z,fe;Y===(Y=W(me,Le))&&oe?oe.p(me,Le):(oe.d(1),oe=Y(me),oe&&(oe.c(),oe.m(e,a))),Le&1&&w!==(w=(me[7]?me[0].place_name:me[0].place_name.replace(/,.*/,""))+"")&&Bn(S,w),Le&37&&(P=me[2]==="always"||me[2]&&!me[0].address&&((Z=me[0].properties)==null?void 0:Z.kind)!=="road"&&((fe=me[0].properties)==null?void 0:fe.kind)!=="road_relation"&&!me[0].id.startsWith("address.")&&!me[0].id.startsWith("postal_code.")&&(!me[0].id.startsWith("poi.")||!me[5])&&!me[7]),P?_e?_e.p(me,Le):(_e=S2(me),_e.c(),_e.m(u,null)):_e&&(_e.d(1),_e=null),Le&1&&V!==(V=(me[7]?"":me[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Bn(j,V),Le&2&&Ve(e,"data-selected",me[1]),Le&2&&sl(e,"selected",me[1])},i:yt,o:yt,d(me){me&&ke(e),oe.d(),_e&&_e.d(),te=!1,Ni(U)}}}function uN(t,e,n){var W;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:u}=e,{missingIconsCache:m}=e,{iconsBaseUrl:w}=e;const S=(W=a.properties)==null?void 0:W.categories;let E,P,D=0,k=a.place_type[0]==="reverse";function V(Y){P&&m.add(P),n(10,D++,D)}function j(Y){In.call(this,t,Y)}function te(Y){In.call(this,t,Y)}const U=Y=>V(Y.currentTarget);return t.$$set=Y=>{"feature"in Y&&n(0,a=Y.feature),"selected"in Y&&n(1,c=Y.selected),"showPlaceType"in Y&&n(2,u=Y.showPlaceType),"missingIconsCache"in Y&&n(9,m=Y.missingIconsCache),"iconsBaseUrl"in Y&&n(3,w=Y.iconsBaseUrl)},t.$$.update=()=>{var Y,oe,_e,se;if(t.$$.dirty&3640)do n(11,r--,r),n(4,E=S==null?void 0:S[r]),n(5,P=E?w+E.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||m.has(P)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(oe=(Y=a.properties)==null?void 0:Y.categories)==null?void 0:oe.join(", "):((se=(_e=a.properties)==null?void 0:_e.place_type_name)==null?void 0:se[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,c,u,w,E,P,i,k,V,m,D,r,j,te,U]}class cN extends Qt{constructor(e){super(),Jt(this,e,uN,lN,Gt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function hN(t){let e;return{c(){e=Ne("div"),e.innerHTML='',Ve(e,"class","svelte-7cmwmc")},m(n,r){De(n,e,r)},p:yt,i:yt,o:yt,d(n){n&&ke(e)}}}class fN extends Qt{constructor(e){super(),Jt(this,e,null,hN,Gt,{})}}function pN(t){let e,n;return{c(){e=jl("svg"),n=jl("path"),Ve(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"),Ve(e,"viewBox","0 0 60.006 21.412"),Ve(e,"width","14"),Ve(e,"height","20"),Ve(e,"class","svelte-en2qvf")},m(r,i){De(r,e,i),Se(e,n)},p:yt,i:yt,o:yt,d(r){r&&ke(e)}}}class dN extends Qt{constructor(e){super(),Jt(this,e,null,pN,Gt,{})}}function mN(t){let e,n,r;return{c(){e=jl("svg"),n=jl("circle"),r=jl("path"),Ve(n,"cx","4.789"),Ve(n,"cy","4.787"),Ve(n,"r","3.85"),zr(n,"stroke-width","1.875"),zr(n,"fill","none"),Ve(r,"d","M12.063 12.063 7.635 7.635"),zr(r,"stroke-width","1.875"),zr(r,"stroke-linecap","round"),Ve(e,"xmlns","http://www.w3.org/2000/svg"),Ve(e,"width","13"),Ve(e,"height","13"),Ve(e,"viewBox","0 0 13 13"),Ve(e,"class","svelte-1bpbt60")},m(i,a){De(i,e,a),Se(e,n),Se(e,r)},p:yt,i:yt,o:yt,d(i){i&&ke(e)}}}class gN extends Qt{constructor(e){super(),Jt(this,e,null,mN,Gt,{})}}function yN(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 E2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!td.coords)break e;return td.coords}let a;try{return a=await new Promise((c,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(m=>{c([m.coords.longitude,m.coords.latitude].map(w=>w.toFixed(6)).join(","))},m=>{u(m)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(td={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 I2=/(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,C2=/(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,T2=/(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,L2=/(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 vN(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=P2(e[0],t),r=P2(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 P2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let u=bN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let a=Math.floor(i),c=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${c}"`}function bN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function f1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],u=!1;if(I2.test(t))if(c=I2.exec(t),u=_g(c),u){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(i=c[1],a=c[5]):c[4]&&(i=c[4],a=c[8])}else throw new Error("invalid decimal coordinate format");else if(C2.test(t))if(c=C2.exec(t),u=_g(c),u)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6].replace(",",".")/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(i=c[1],a=c[8]):c[7]&&(i=c[7],a=c[14]);else throw new Error("invalid DMS coordinates format");else if(T2.test(t))if(c=T2.exec(t),u=_g(c),u)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid DMS coordinates format");else if(L2.test(t))if(c=L2.exec(t),u=_g(c),u)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let 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 P=/[,/;\u0020]/g,D=w.match(P);if(D==null){const j=Math.floor(t.length/2);S=w.substring(0,j).trim(),E=w.substring(j).trim()}else{let j;D.length%2==1?j=Math.floor(D.length/2):j=D.length/2-1;let te=0;if(j==0)te=w.indexOf(D[0]),S=w.substring(0,te).trim(),E=w.substring(te+1).trim();else{let U=0,W=0;for(;U<=j;)te=w.indexOf(D[U],W),W=te+1,U++;S=w.substring(0,te).trim(),E=w.substring(te+1).trim()}}const k=S.split(".");if(k.length==2&&k[1]==0&&k[1].length!=2)throw new Error("invalid coordinates format");const V=E.split(".");if(V.length==2&&V[1]==0&&V[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:xN,toCoordinateFormat:vN})}else throw new Error("coordinates pattern match failed")}function _g(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,...EN})}),[...t,...IN,...CN]}const LN=TN();f1.formats=LN.map(t=>t.verbatimCoordinates);const PN=f1;function A2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function k2(t){let e,n;return e=new fN({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function D2(t){let e,n,r,i,a;return n=new dN({}),{c(){e=Ne("button"),lt(n.$$.fragment),Ve(e,"type","button"),Ve(e,"title",t[9]),Ve(e,"class","svelte-zh3kmv"),sl(e,"active",t[0])},m(c,u){De(c,e,u),st(n,e,null),r=!0,i||(a=Wt(e,"click",t[67]),i=!0)},p(c,u){(!r||u[0]&512)&&Ve(e,"title",c[9]),(!r||u[0]&1)&&sl(e,"active",c[0])},i(c){r||(be(n.$$.fragment,c),r=!0)},o(c){Te(n.$$.fragment,c),r=!1},d(c){c&&ke(e),at(n),i=!1,a()}}}function MN(t){let e,n=[],r=new Map,i,a,c,u=Fr(t[14]);const m=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{se=null}),Dn()),(!W||Ze[0]&2)&&sl(w,"displayable",Ee[1]!==""),Ee[5]===!0?ce?(ce.p(Ee,Ze),Ze[0]&32&&be(ce,1)):(ce=D2(Ee),ce.c(),be(ce,1),ce.m(r,k)):ce&&(kn(),Te(ce,1,1,()=>{ce=null}),Dn()),Le&&Le.p&&(!W||Ze[1]&134217728)&&si(Le,me,Ee,Ee[58],W?oi(me,Ee[58],Ze,null):ai(Ee[58]),null);let tt=j;j=Ke(Ee),j===tt?~j&&fe[j].p(Ee,Ze):(te&&(kn(),Te(fe[tt],1,1,()=>{fe[tt]=null}),Dn()),~j?(te=fe[j],te?te.p(Ee,Ze):(te=fe[j]=Z[j](Ee),te.c()),be(te,1),te.m(n,null)):te=null),(!W||Ze[0]&4&&U!==(U=Rg(Ee[2])+" svelte-zh3kmv"))&&Ve(n,"class",U),(!W||Ze[0]&22)&&sl(n,"can-collapse",Ee[4]&&Ee[1]==="")},i(Ee){W||(be(_e),be(a.$$.fragment,Ee),be(E.$$.fragment,Ee),be(se),be(ce),be(Le,Ee),be(te),W=!0)},o(Ee){Te(_e),Te(a.$$.fragment,Ee),Te(E.$$.fragment,Ee),Te(se),Te(ce),Te(Le,Ee),Te(te),W=!1},d(Ee){Ee&&(ke(e),ke(n)),at(a),t[61](null),at(E),se&&se.d(),ce&&ce.d(),Le&&Le.d(Ee),~j&&fe[j].d(),Y=!1,Ni(oe)}}}function NN(t,e,n){let r,{$$slots:i={},$$scope:a}=e,{class:c=void 0}=e,{apiKey:u}=e,{bbox:m=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:E=!1}=e,{country:P=void 0}=e,{debounceSearch:D=200}=e,{enableReverse:k=!1}=e,{errorMessage:V="Something went wrong…"}=e,{filter:j=()=>!0}=e,{flyTo:te=!0}=e,{fuzzyMatch:U=!0}=e,{language:W=void 0}=e,{limit:Y=void 0}=e,{mapController:oe=void 0}=e,{minLength:_e=2}=e,{noResultsMessage:se="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:ce="Search"}=e,{proximity:me=[{type:"server-geolocation"}]}=e,{reverseActive:Le=k==="always"}=e,{reverseButtonTitle:Z="toggle reverse geocoding"}=e,{searchValue:fe=""}=e,{showFullGeometry:Ke=!0}=e,{showPlaceType:Ee="ifNeeded"}=e,{showResultsWhileTyping:Ze=!0}=e,{selectFirst:tt=!0}=e,{flyToSelected:qe=!1}=e,{markerOnSelected:Ot=!0}=e,{types:wt=void 0}=e,{excludeTypes:un=!1}=e,{zoom:qt=16}=e,{maxZoom:At=18}=e,{apiUrl:hn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Tn={}}=e,{iconsBaseUrl:yn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:_n=Q=>{}}=e;function Rn(){Oe.focus()}function wr(){Oe.blur()}function kr(Q,we=!0){n(1,fe=Q),we?(n(15,Yt=-1),xl()):(Jr(),setTimeout(()=>{Oe.focus(),Oe.select()}))}function Sr(){n(14,ge=void 0),n(55,Ct=void 0),n(15,Yt=-1)}function dr(){n(54,Pe=[]),n(55,Ct=void 0)}let Qe=!1,ge,Pe,Ct,Nn="",Oe,Yt=-1,Dr,ln=[],er,Mo,ps,Os;const Va=new Set,Pi=ju();as(()=>{oe&&(oe.setEventHandler(void 0),oe.indicateReverse(!1),oe.setSelectedMarker(-1),oe.setMarkers(void 0,void 0))});function xl(Q){if(Mo&&(clearTimeout(Mo),Mo=void 0),Yt>-1&&ge)n(55,Ct=ge[Yt]),n(1,fe=Ct.place_type[0]==="reverse"?Ct.place_name:Ct.place_name.replace(/,.*/,"")),n(18,Dr=void 0),n(54,Pe=void 0),n(15,Yt=-1);else if(fe){const we=Q||!ds(fe);it(fe,{exact:!0}).then(()=>{n(54,Pe=ge),n(55,Ct=void 0),we&&Ko()}).catch(de=>n(18,Dr=de))}}function ds(Q){try{return PN(Q,6)}catch{return!1}}async function it(Q,{byId:we=!1,exact:de=!1}={}){n(18,Dr=void 0),er==null||er.abort();const Me=new AbortController;n(19,er=Me);try{const Ue=ds(Q),We=new URLSearchParams;if(W!==void 0&&We.set("language",Array.isArray(W)?W.join(","):W??""),wt&&We.set("types",wt.join(",")),un&&We.set("excludeTypes",String(un)),m&&We.set("bbox",m.map(Ht=>Ht.toFixed(6)).join(",")),P&&We.set("country",Array.isArray(P)?P.join(","):P),!we&&!Ue){const Ht=await _N(oe,me,Me);Ht&&We.set("proximity",Ht),(de||!Ze)&&We.set("autocomplete","false"),We.set("fuzzyMatch",String(U))}Y!==void 0&&(!Ue||(wt==null?void 0:wt.length)===1)&&We.set("limit",String(Y)),We.set("key",u),_n(We);const Xe=hn+"/"+encodeURIComponent(Ue?Ue.decimalLongitude+","+Ue.decimalLatitude:Q)+".json?"+We.toString();if(Xe===Nn){we?(n(14,ge=void 0),n(55,Ct=ln[0])):n(14,ge=ln);return}Nn=Xe;const Lt=await fetch(Xe,{signal:Me.signal,...Tn});if(!Lt.ok)throw new Error(await Lt.text());const Dt=await Lt.json();Pi("response",{url:Xe,featureCollection:Dt}),we?(n(14,ge=void 0),n(55,Ct=Dt.features[0]),ln=[Ct]):(n(14,ge=Dt.features.filter(j)),Ue&&ge.unshift({type:"Feature",properties:{},id:"reverse_"+Ue.decimalLongitude+"_"+Ue.decimalLatitude,text:Ue.decimalLatitude+", "+Ue.decimalLongitude,place_name:Ue.decimalLatitude+", "+Ue.decimalLongitude,place_type:["reverse"],center:[Ue.decimalLongitude,Ue.decimalLatitude],bbox:[Ue.decimalLongitude,Ue.decimalLatitude,Ue.decimalLongitude,Ue.decimalLatitude],geometry:{type:"Point",coordinates:[Ue.decimalLongitude,Ue.decimalLatitude]}}),ln=ge,Ue&&Oe.focus())}catch(Ue){if(Ue&&typeof Ue=="object"&&"name"in Ue&&Ue.name==="AbortError")return;throw Ue}finally{Me===er&&n(19,er=void 0)}}function Ko(){var de;if(!(Pe!=null&&Pe.length)||!te)return;const Q=[180,90,-180,-90],we=!Pe.some(Me=>!Me.matching_text);for(const Me of Pe)if(we||!Me.matching_text)for(const Ue of[0,1,2,3])Q[Ue]=Math[Ue<2?"min":"max"](Q[Ue],((de=Me.bbox)==null?void 0:de[Ue])??Me.center[Ue%2]);oe&&Pe.length>0&&(Ct&&Q[0]===Q[2]&&Q[1]===Q[3]?oe.flyTo(Ct.center,qt):oe.fitBounds(E2(Q),50,At))}function Ki(Q){n(0,Le=k==="always"),n(14,ge=void 0),n(55,Ct=void 0),n(15,Yt=-1),kr(Q[1].toFixed(6)+", "+yN(Q[0],[-180,180],!0).toFixed(6),!1)}function wl(Q){if(!ge)return;let we=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;we&&(Yt===(tt?0:-1)&&we===-1&&n(15,Yt=ge.length),n(15,Yt+=we),Yt>=ge.length&&n(15,Yt=-1),Yt<0&&tt&&n(15,Yt=0),Q.preventDefault())}function Jr(Q=!0){if(n(18,Dr=void 0),Ze){if(Mo&&clearTimeout(Mo),fe.length<_e)return;const we=fe;Mo=window.setTimeout(()=>{it(we).catch(de=>n(18,Dr=de))},Q?D:0)}else n(14,ge=void 0),n(18,Dr=void 0)}function ht(Q){n(55,Ct=Q),n(1,fe=Q.place_name),n(15,Yt=-1)}const tn=()=>Oe.focus();function $t(Q){Zn[Q?"unshift":"push"](()=>{Oe=Q,n(17,Oe)})}function Rr(){fe=this.value,n(1,fe),n(13,Qe),n(27,S)}const Jo=()=>n(13,Qe=!0),Kt=()=>n(13,Qe=!1),ga=()=>Jr(),Gr=()=>{n(1,fe=""),Oe.focus()},le=()=>n(0,Le=!Le),B=()=>n(18,Dr=void 0),q=Q=>n(15,Yt=Q),J=Q=>ht(Q),ne=()=>{tt||n(15,Yt=-1)},xe=()=>{};return t.$$set=Q=>{"class"in Q&&n(2,c=Q.class),"apiKey"in Q&&n(25,u=Q.apiKey),"bbox"in Q&&n(26,m=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,E=Q.collapsed),"country"in Q&&n(28,P=Q.country),"debounceSearch"in Q&&n(29,D=Q.debounceSearch),"enableReverse"in Q&&n(5,k=Q.enableReverse),"errorMessage"in Q&&n(6,V=Q.errorMessage),"filter"in Q&&n(30,j=Q.filter),"flyTo"in Q&&n(31,te=Q.flyTo),"fuzzyMatch"in Q&&n(32,U=Q.fuzzyMatch),"language"in Q&&n(33,W=Q.language),"limit"in Q&&n(34,Y=Q.limit),"mapController"in Q&&n(35,oe=Q.mapController),"minLength"in Q&&n(36,_e=Q.minLength),"noResultsMessage"in Q&&n(7,se=Q.noResultsMessage),"placeholder"in Q&&n(8,ce=Q.placeholder),"proximity"in Q&&n(37,me=Q.proximity),"reverseActive"in Q&&n(0,Le=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,Z=Q.reverseButtonTitle),"searchValue"in Q&&n(1,fe=Q.searchValue),"showFullGeometry"in Q&&n(38,Ke=Q.showFullGeometry),"showPlaceType"in Q&&n(10,Ee=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,Ze=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,tt=Q.selectFirst),"flyToSelected"in Q&&n(40,qe=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Ot=Q.markerOnSelected),"types"in Q&&n(42,wt=Q.types),"excludeTypes"in Q&&n(43,un=Q.excludeTypes),"zoom"in Q&&n(44,qt=Q.zoom),"maxZoom"in Q&&n(45,At=Q.maxZoom),"apiUrl"in Q&&n(46,hn=Q.apiUrl),"fetchParameters"in Q&&n(47,Tn=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,yn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,_n=Q.adjustUrlQuery),"$$scope"in Q&&n(58,a=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ps=Qe),S&&!Qe&&n(1,fe="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&fe.length<_e&&(n(55,Ct=void 0),n(14,ge=void 0),n(18,Dr=void 0),n(54,Pe=ge)),t.$$.dirty[1]&16777344&&Ke&&Ct&&!Ct.address&&Ct.geometry.type==="Point"&&Ct.place_type[0]!=="reverse"&&it(Ct.id,{byId:!0}).catch(Q=>n(18,Dr=Q)),t.$$.dirty[1]&50356241&&(oe&&Ct&&Ct.id!==Os&&te&&(!Ct.bbox||Ct.bbox[0]===Ct.bbox[2]&&Ct.bbox[1]===Ct.bbox[3]?oe.flyTo(Ct.center,Ct.id.startsWith("poi.")||Ct.id.startsWith("address.")?At:qt):oe.fitBounds(E2(Ct.bbox),50,At),n(14,ge=void 0),n(54,Pe=void 0),n(15,Yt=-1)),n(56,Os=Ct==null?void 0:Ct.id)),t.$$.dirty[0]&18432&&tt&&ge!=null&&ge.length&&n(15,Yt=0),t.$$.dirty[0]&2050&&(tt||n(15,Yt=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Pe!==ge&&n(54,Pe=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&oe&&oe.setEventHandler(Q=>{switch(Q.type){case"mapClick":Le&&Ki(Q.coordinates);break;case"markerClick":{const we=ge==null?void 0:ge.find(de=>de.id===Q.id);we&&ht(we)}break;case"markerMouseEnter":Pe&&n(15,Yt=ps?(ge==null?void 0:ge.findIndex(we=>we.id===Q.id))??-1:-1);break;case"markerMouseLeave":Pe&&n(15,Yt=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ge==null?void 0:ge[Yt]),t.$$.dirty[1]&67133969&&oe&&r&&te&&qe&&oe.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?At:qt),t.$$.dirty[1]&1040&&(Ot||oe==null||oe.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&oe&&Ot&&!Pe&&(oe.setMarkers(r?[r]:void 0,void 0),oe.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&oe&&oe.setMarkers(Pe,Ct),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Pe&&oe&&oe.setSelectedMarker(Yt),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&oe){const Q=ds(fe);oe.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Pi("select",r),t.$$.dirty[1]&16777216&&Pi("pick",Ct),t.$$.dirty[0]&81920&&Pi("optionsVisibilityChange",ps&&!!ge),t.$$.dirty[0]&16384&&Pi("featuresListed",ge),t.$$.dirty[1]&8388608&&Pi("featuresMarked",Pe),t.$$.dirty[0]&1&&Pi("reverseToggle",Le),t.$$.dirty[0]&2&&Pi("queryChange",fe),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&oe&&oe.indicateReverse(Le)},[Le,fe,c,w,E,k,V,se,ce,Z,Ee,tt,yn,Qe,ge,Yt,ps,Oe,Dr,er,Va,xl,wl,Jr,ht,u,m,S,P,D,j,te,U,W,Y,oe,_e,me,Ke,Ze,qe,Ot,wt,un,qt,At,hn,Tn,_n,Rn,wr,kr,Sr,dr,Pe,Ct,Os,r,a,i,tn,$t,Rr,Jo,Kt,ga,Gr,le,B,q,J,ne,xe]}class ON extends Qt{constructor(e){super(),Jt(this,e,NN,RN,Gt,{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 N2(t){let e,n,r;return n=new ON({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=Ne("div"),lt(n.$$.fragment),Ve(e,"class","svelte-ixhnie")},m(i,a){De(i,e,a),st(n,e,null),r=!0},p(i,a){const c={};a&2&&(c.mapController=i[1]),a&1&&(c.apiKey=i[0]),n.$set(c)},i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&ke(e),at(n)}}}function zN(t){let e,n,r=t[1]&&N2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&be(r,1)):(r=N2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function FN(t,e,n){let r,{apiKey:i}=e,{map:a}=e;return t.$$set=c=>{"apiKey"in c&&n(0,i=c.apiKey),"map"in c&&n(2,a=c.map)},t.$$.update=()=>{t.$$.dirty&4&&n(1,r=a?JR(a,Es):null)},[i,r,a]}class BN extends Qt{constructor(e){super(),Jt(this,e,FN,zN,Gt,{apiKey:0,map:2})}}const VN=Symbol.for("svelte-maplibre");function UN(){return bv(VN)}function GN(t){return"layerType"in t&&t.layerType==="deckgl"}var Uc=qN;function qN(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}),z2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function F2(t){let e,n,r=(t[4]||t[3]instanceof Es.Marker)&&B2(t);return{c(){e=Ne("div"),r&&r.c()},m(i,a){De(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Es.Marker?r?(r.p(i,a),a[0]&24&&be(r,1)):(r=B2(i),r.c(),be(r,1),r.m(e,null)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(),t[32](null)}}}function B2(t){let e;const n=t[30].default,r=ii(n,t,t[29],z2);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)&&si(r,n,i,i[29],e?oi(n,i[29],a,HN):ai(i[29]),z2)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function ZN(t){let e,n,r=t[9].default&&F2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&be(r,1)):(r=F2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function XN(t,e,n){let r,i,a,c,u,m,{$$slots:w={},$$scope:S}=e;const E=HL(w);let{closeButton:P=void 0}=e,{closeOnClickOutside:D=!0}=e,{closeOnClickInside:k=!1}=e,{closeOnMove:V=!1}=e,{openOn:j="click"}=e,{openIfTopMost:te=!0}=e,{focusAfterOpen:U=!0}=e,{anchor:W=void 0}=e,{offset:Y=void 0}=e,{popupClass:oe=void 0}=e,{maxWidth:_e=void 0}=e,{lngLat:se=void 0}=e,{html:ce=void 0}=e,{open:me=!1}=e;const Le=ju(),{map:Z,popupTarget:fe,layerEvent:Ke,layer:Ee,eventTopMost:Ze}=UN();Pt(t,Z,Pe=>n(2,a=Pe)),Pt(t,fe,Pe=>n(3,u=Pe)),Pt(t,Ke,Pe=>n(28,c=Pe)),Pt(t,Ee,Pe=>n(35,m=Pe));const tt=["click","dblclick","contextmenu"];let qe,Ot=!1,wt;function un(){if(!qe)return;let Pe=qe.getElement();!Pe||Pe===wt||(wt=Pe,j==="hover"&&(wt.style.pointerEvents="none"),wt.addEventListener("mouseenter",()=>{n(24,Ot=!0)},{passive:!0}),wt.addEventListener("mouseleave",()=>{n(24,Ot=!1)},{passive:!0}),wt.addEventListener("click",()=>{k&&n(0,me=!1)},{passive:!0}))}qu(()=>{if(a)return a.on("click",Sr),a.on("contextmenu",Sr),typeof u=="string"&&(a.on("click",u,Tn),a.on("dblclick",u,Tn),a.on("contextmenu",u,Tn),a.on("mousemove",u,kr),a.on("mouseleave",u,wr),a.on("touchstart",u,_n),a.on("touchend",u,Rn)),()=>{a!=null&&a.loaded()&&(qe==null||qe.remove(),a.off("click",Sr),a.off("contextmenu",Sr),u instanceof Es.Marker?u.getPopup()===qe&&u.setPopup(void 0):typeof u=="string"&&(a.off("click",u,Tn),a.off("dblclick",u,Tn),a.off("contextmenu",u,Tn),a.off("mousemove",u,kr),a.off("mouseleave",u,wr),a.off("touchstart",u,_n),a.off("touchend",u,Rn)))}});function qt(Pe){return te?!("marker"in Pe)&&!GN(Pe)&&Ze(Pe)!==m:!1}let At=null,hn="normal";function Tn(Pe){Pe.type===j&&(qt(Pe)||("layerType"in Pe?Pe.layerType==="deckgl"?(n(10,se=Pe.coordinate),n(4,At=Pe.object?[Pe.object]:null)):(n(10,se=Pe.lngLat),n(4,At=Pe.features??[])):(n(10,se=Pe.lngLat),n(4,At=Pe.features??[])),setTimeout(()=>n(0,me=!0))))}let yn=null;function _n(Pe){yn=Pe.point}function Rn(Pe){if(!yn||j!=="hover")return;let Ct=yn.dist(Pe.point);yn=null,Ct<3&&(n(10,se=Pe.lngLat),n(4,At=Pe.features??[]),qe.isOpen()?n(25,hn="justOpened"):(n(25,hn="opening"),n(0,me=!0)))}function wr(Pe){j!=="hover"||yn||hn!=="normal"||(n(0,me=!1),n(4,At=null))}function kr(Pe){if(!(j!=="hover"||yn||hn!=="normal")){if(qt(Pe)){n(0,me=!1),n(4,At=null);return}n(0,me=!0),n(4,At=Pe.features??[]),n(10,se=Pe.lngLat)}}function Sr(Pe){if(hn==="justOpened"){n(25,hn="normal");return}if(!D)return;let Ct=[wt,u instanceof Es.Marker?u==null?void 0:u.getElement():null];me&&qe.isOpen()&&!Ct.some(Nn=>Nn==null?void 0:Nn.contains(Pe.originalEvent.target))&&(Pe.type==="contextmenu"&&j==="contextmenu"||Pe.type!=="contextmenu")&&n(0,me=!1)}as(()=>{a&&(qe!=null&&qe.isOpen())&&qe.remove()});let dr;const Qe=()=>n(0,me=!1);function ge(Pe){Zn[Pe?"unshift":"push"](()=>{dr=Pe,n(1,dr)})}return t.$$set=Pe=>{"closeButton"in Pe&&n(11,P=Pe.closeButton),"closeOnClickOutside"in Pe&&n(12,D=Pe.closeOnClickOutside),"closeOnClickInside"in Pe&&n(13,k=Pe.closeOnClickInside),"closeOnMove"in Pe&&n(14,V=Pe.closeOnMove),"openOn"in Pe&&n(15,j=Pe.openOn),"openIfTopMost"in Pe&&n(16,te=Pe.openIfTopMost),"focusAfterOpen"in Pe&&n(17,U=Pe.focusAfterOpen),"anchor"in Pe&&n(18,W=Pe.anchor),"offset"in Pe&&n(19,Y=Pe.offset),"popupClass"in Pe&&n(20,oe=Pe.popupClass),"maxWidth"in Pe&&n(21,_e=Pe.maxWidth),"lngLat"in Pe&&n(10,se=Pe.lngLat),"html"in Pe&&n(22,ce=Pe.html),"open"in Pe&&n(0,me=Pe.open),"$$scope"in Pe&&n(29,S=Pe.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=P??(!D&&!k)),t.$$.dirty[0]&146685952&&(qe||(n(23,qe=new Es.Popup({closeButton:r,closeOnClick:!1,closeOnMove:V,focusAfterOpen:U,maxWidth:_e,className:oe,anchor:W,offset:Y})),wt=qe.getElement(),qe.on("open",()=>{n(0,me=!0),un(),Le("open",qe)}),qe.on("close",()=>{n(0,me=!1),Le("close",qe)}),qe.on("hover",()=>{Le("hover",qe)}))),t.$$.dirty[0]&8421384&&qe&&u instanceof Es.Marker&&(j==="click"?u.setPopup(qe):u.getPopup()===qe&&u.setPopup(void 0)),t.$$.dirty[0]&268468224&&tt.includes(j)&&(c==null?void 0:c.type)===j&&(Tn(c),Hn(Ke,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=j==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&j==="hover"&&Ke&&(i&&c&&(c.layerType==="deckgl"?(n(10,se=c.coordinate),n(4,At=c.object?[c.object]:null)):(n(10,se=c.lngLat),n(4,At=c.features??[]))),n(0,me=(i||Ot)??!1)),t.$$.dirty[0]&12582914&&(dr?qe.setDOMContent(dr):ce&&qe.setHTML(ce)),t.$$.dirty[0]&8389632&&se&&qe.setLngLat(se),t.$$.dirty[0]&41943045&&a){let Pe=qe.isOpen();me&&!Pe?(qe.addTo(a),hn==="opening"&&n(25,hn="justOpened")):!me&&Pe&&qe.remove()}},[me,dr,a,u,At,Z,fe,Ke,Ee,E,se,P,D,k,V,j,te,U,W,Y,oe,_e,ce,qe,Ot,hn,i,r,c,S,w,Qe,ge]}class YN extends Qt{constructor(e){super(),Jt(this,e,XN,ZN,Gt,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var Kd=Uint8Array,LC=Uint16Array,KN=Int32Array,JN=new Kd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),QN=new Kd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),PC=function(t,e){for(var n=new LC(31),r=0;r<31;++r)n[r]=e+=1<>1|(Qn&21845)<<1,Fl=(Fl&52428)>>2|(Fl&13107)<<2,Fl=(Fl&61680)>>4|(Fl&3855)<<4,tO[Qn]=((Fl&65280)>>8|(Fl&255)<<8)>>1;var Fl,Qn,By=new Kd(288);for(Qn=0;Qn<144;++Qn)By[Qn]=8;var Qn;for(Qn=144;Qn<256;++Qn)By[Qn]=9;var Qn;for(Qn=256;Qn<280;++Qn)By[Qn]=7;var Qn;for(Qn=280;Qn<288;++Qn)By[Qn]=8;var Qn,nO=new Kd(32);for(Qn=0;Qn<32;++Qn)nO[Qn]=5;var Qn,rO=new Kd(0),iO=typeof TextDecoder<"u"&&new TextDecoder,oO=0;try{iO.decode(rO,{stream:!0}),oO=1}catch{}const sO=t=>({props:t&8}),V2=t=>({props:uO(t[3])});function aO(t){let e;const n=t[1].default,r=ii(n,t,t[2],V2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&si(r,n,i,i[2],e?oi(n,i[2],a,sO):ai(i[2]),V2)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function lO(t){let e,n;return e=new YN({props:{openOn:t[0],$$slots:{default:[aO,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function uO(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function cO(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 Jd extends Qt{constructor(e){super(),Jt(this,e,cO,lO,Gt,{openOn:0})}}const hO=["==",["geometry-type"],"Polygon"],fO=["==",["geometry-type"],"LineString"];function d1(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 dv(t,e,n){let r=["step",t];for(let i=1;i{var c;let r=e.get(n.originalEvent);if(r!==void 0)return r;let a=(c=n.target.queryRenderedFeatures(n.point).find(u=>{var m;return(m=t.get(u.layer.id))==null?void 0:m.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,a),a}}function mO(){let t=new Map;return vv(m1,{map:sr(null),source:K_(null),layer:K_(null),popupTarget:K_(null),cluster:sr(),loadedImages:sr(new Set),minzoom:sr(0),maxzoom:sr(24),layerEvent:sr(null),layerInfo:t,eventTopMost:dO(t)})}function U2(t){return{subscribe:t.subscribe}}function g1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Zf(),a=sr(null),c=U2(a),u={...i,[t]:U2(a)};if(e&&(u.popupTarget=c),r){let m=sr(null);u.layerEvent=m,i.layerEvent=m}return n&&(u.cluster=sr()),vv(m1,u),{...i,self:a}}function gO(){return g1({key:"source",setCluster:!0})}function yO(t=!0){return g1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function _O(){return g1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function G2(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 vO(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 bO(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function $d(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function q2(t){let e=t[0],n,r,i=j2(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c[0]&1&&Gt(e,e=a[0])?(kn(),Te(i,1,1,yt),Dn(),i=j2(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function j2(t){let e;const n=t[36].default,r=ii(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)&&si(r,n,i,i[35],e?oi(n,i[35],a,null):ai(i[35]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function xO(t){let e,n,r=t[0]&&q2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&be(r,1)):(r=q2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function wO(t,e,n){let r,i,a,c,u,m,w,S,E,P,D,k,{$$slots:V={},$$scope:j}=e,{id:te=Qd("layer")}=e,{source:U=void 0}=e,{sourceLayer:W=void 0}=e,{beforeId:Y=void 0}=e,{beforeLayerType:oe=void 0}=e,{type:_e}=e,{paint:se=void 0}=e,{layout:ce=void 0}=e,{filter:me=void 0}=e,{applyToClusters:Le=void 0}=e,{minzoom:Z=void 0}=e,{maxzoom:fe=void 0}=e,{manageHoverState:Ke=!1}=e,{hovered:Ee=null}=e,{interactive:Ze=!0}=e,{hoverCursor:tt=void 0}=e,{eventsIfTopMost:qe=!1}=e;const Ot=ju(),{map:wt,source:un,self:qt,minzoom:At,maxzoom:hn,eventTopMost:Tn,layerInfo:yn}=yO();Pt(t,wt,ge=>n(31,E=ge)),Pt(t,un,ge=>n(32,P=ge)),Pt(t,qt,ge=>n(0,S=ge)),Pt(t,At,ge=>n(34,k=ge)),Pt(t,hn,ge=>n(33,D=ge)),as(()=>{S&&E&&(yn.delete(S),E==null||E.removeLayer(S))});let _n;function Rn(ge){var Oe,Yt;if(!Ze||!S||!E||qe&&Tn(ge)!==S)return;let Pe=ge.features??[],Ct=(Yt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Yt.cluster_id,Nn={event:ge,map:E,clusterId:Ct,layer:S,source:u,features:Pe};Ot(ge.type,Nn)}function wr(ge){var Oe,Yt;if(!Ze||!S||!E||qe&&Tn(ge)!==S)return;tt&&(E.getCanvas().style.cursor=tt);let Pe=ge.features??[];n(6,Ee=Pe[0]??null);let Ct=(Yt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Yt.cluster_id;Ot("mouseenter",{event:ge,map:E,clusterId:Ct,layer:S,source:u,features:Pe})}function kr(ge){var Oe,Yt,Dr;if(!Ze||!E)return;if(qe&&Tn(ge)!==S){n(6,Ee=null),Ke&&_n!==void 0&&(E==null||E.setFeatureState({source:u,sourceLayer:W,id:_n},{hover:!1}),_n=void 0);return}E.getCanvas().style.cursor=tt;let Pe=ge.features??[],Ct=(Yt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Yt.cluster_id,Nn=(Dr=Pe[0])==null?void 0:Dr.id;Nn!==_n&&(Ke&&(_n!==void 0&&(E==null||E.setFeatureState({source:u,id:_n,sourceLayer:W},{hover:!1})),E==null||E.setFeatureState({source:u,id:Nn,sourceLayer:W},{hover:!0})),_n=Nn,n(6,Ee=Pe[0]??null)),Ot("mousemove",{event:ge,map:E,clusterId:Ct,layer:S,source:u,features:Pe})}function Sr(ge){if(!(!Ze||!S||!E)){if(tt&&(E.getCanvas().style.cursor=""),n(6,Ee=null),Ke&&_n!==void 0){const Pe={source:u,id:_n,sourceLayer:W};E==null||E.setFeatureState(Pe,{hover:!1}),_n=void 0}Ot("mouseleave",{map:E,layer:S,source:u})}}let dr=!0;function Qe(ge){E&&(E.off("click",ge,Rn),E.off("dblclick",ge,Rn),E.off("contextmenu",ge,Rn),E.off("mouseenter",ge,wr),E.off("mousemove",ge,kr),E.off("mouseleave",ge,Sr))}return as(()=>{E&&S&&Qe(S)}),t.$$set=ge=>{"id"in ge&&n(7,te=ge.id),"source"in ge&&n(8,U=ge.source),"sourceLayer"in ge&&n(9,W=ge.sourceLayer),"beforeId"in ge&&n(10,Y=ge.beforeId),"beforeLayerType"in ge&&n(11,oe=ge.beforeLayerType),"type"in ge&&n(12,_e=ge.type),"paint"in ge&&n(13,se=ge.paint),"layout"in ge&&n(14,ce=ge.layout),"filter"in ge&&n(15,me=ge.filter),"applyToClusters"in ge&&n(16,Le=ge.applyToClusters),"minzoom"in ge&&n(17,Z=ge.minzoom),"maxzoom"in ge&&n(18,fe=ge.maxzoom),"manageHoverState"in ge&&n(19,Ke=ge.manageHoverState),"hovered"in ge&&n(6,Ee=ge.hovered),"interactive"in ge&&n(20,Ze=ge.interactive),"hoverCursor"in ge&&n(21,tt=ge.hoverCursor),"eventsIfTopMost"in ge&&n(22,qe=ge.eventsIfTopMost),"$$scope"in ge&&n(35,j=ge.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=bO(Le)),t.$$.dirty[0]&1073774592&&n(24,i=vO("all",r,me)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Z??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=fe??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,u=U||P),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==te&&u){S&&(Qe(S),yn.delete(S));let ge=Y;if(!Y&&oe){let Pe=E.getStyle().layers,Ct=typeof oe=="function"?oe:Oe=>Oe.type===oe,Nn=Pe==null?void 0:Pe.find(Ct);Nn&&(ge=Nn.id)}Hn(qt,S=te,S),E.addLayer(Uc({id:S,type:_e,source:u,"source-layer":W,filter:i,paint:se,layout:ce,minzoom:a,maxzoom:c}),ge),n(23,dr=!0),E.on("click",S,Rn),E.on("dblclick",S,Rn),E.on("contextmenu",S,Rn),E.on("mouseenter",S,wr),E.on("mousemove",S,kr),E.on("mouseleave",S,Sr)}t.$$.dirty[0]&1048577&&S&&yn.set(S,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,m=S?G2((ge,Pe)=>E==null?void 0:E.setPaintProperty(S,ge,Pe)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?G2((ge,Pe)=>E==null?void 0:E.setLayoutProperty(S,ge,Pe)):void 0),t.$$.dirty[0]&268443648&&(m==null||m(se)),t.$$.dirty[0]&134234112&&(w==null||w(ce)),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&&(dr?n(23,dr=!1):E==null||E.setFilter(S,i))},[S,wt,un,qt,At,hn,Ee,te,U,W,Y,oe,_e,se,ce,me,Le,Z,fe,Ke,Ze,tt,qe,dr,i,c,a,w,m,u,r,E,P,D,k,j,V]}let y1=class extends Qt{constructor(e){super(),Jt(this,e,wO,xO,Gt,{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 SO(t){let e;const n=t[16].default,r=ii(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)&&si(r,n,i,i[24],e?oi(n,i[24],a,null):ai(i[24]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function EO(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:[SO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new y1({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&2&&(m.id=c[1]),u&4&&(m.source=c[2]),u&8&&(m.sourceLayer=c[3]),u&16&&(m.beforeId=c[4]),u&32&&(m.beforeLayerType=c[5]),u&64&&(m.paint=c[6]),u&128&&(m.layout=c[7]),u&256&&(m.filter=c[8]),u&512&&(m.applyToClusters=c[9]),u&1024&&(m.minzoom=c[10]),u&2048&&(m.maxzoom=c[11]),u&4096&&(m.hoverCursor=c[12]),u&8192&&(m.manageHoverState=c[13]),u&16384&&(m.eventsIfTopMost=c[14]),u&32768&&(m.interactive=c[15]),u&16777216&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function IO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Qd("circle")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:V=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:te=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:Y=!0}=e;function oe(fe){U=fe,n(0,U)}function _e(fe){In.call(this,t,fe)}function se(fe){In.call(this,t,fe)}function ce(fe){In.call(this,t,fe)}function me(fe){In.call(this,t,fe)}function Le(fe){In.call(this,t,fe)}function Z(fe){In.call(this,t,fe)}return t.$$set=fe=>{"id"in fe&&n(1,a=fe.id),"source"in fe&&n(2,c=fe.source),"sourceLayer"in fe&&n(3,u=fe.sourceLayer),"beforeId"in fe&&n(4,m=fe.beforeId),"beforeLayerType"in fe&&n(5,w=fe.beforeLayerType),"paint"in fe&&n(6,S=fe.paint),"layout"in fe&&n(7,E=fe.layout),"filter"in fe&&n(8,P=fe.filter),"applyToClusters"in fe&&n(9,D=fe.applyToClusters),"minzoom"in fe&&n(10,k=fe.minzoom),"maxzoom"in fe&&n(11,V=fe.maxzoom),"hoverCursor"in fe&&n(12,j=fe.hoverCursor),"manageHoverState"in fe&&n(13,te=fe.manageHoverState),"hovered"in fe&&n(0,U=fe.hovered),"eventsIfTopMost"in fe&&n(14,W=fe.eventsIfTopMost),"interactive"in fe&&n(15,Y=fe.interactive),"$$scope"in fe&&n(24,i=fe.$$scope)},[U,a,c,u,m,w,S,E,P,D,k,V,j,te,W,Y,r,oe,_e,se,ce,me,Le,Z,i]}let Vy=class extends Qt{constructor(e){super(),Jt(this,e,IO,EO,Gt,{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 CO(t){let e;const n=t[15].default,r=ii(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)&&si(r,n,i,i[23],e?oi(n,i[23],a,null):ai(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function TO(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:[CO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new y1({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&2&&(m.id=c[1]),u&4&&(m.source=c[2]),u&8&&(m.sourceLayer=c[3]),u&16&&(m.beforeId=c[4]),u&32&&(m.beforeLayerType=c[5]),u&64&&(m.paint=c[6]),u&128&&(m.layout=c[7]),u&256&&(m.filter=c[8]),u&512&&(m.minzoom=c[9]),u&1024&&(m.maxzoom=c[10]),u&2048&&(m.hoverCursor=c[11]),u&4096&&(m.manageHoverState=c[12]),u&8192&&(m.eventsIfTopMost=c[13]),u&16384&&(m.interactive=c[14]),u&8388608&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function LO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Qd("fill")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:V=void 0}=e,{manageHoverState:j=!1}=e,{hovered:te=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:W=!0}=e;function Y(Z){te=Z,n(0,te)}function oe(Z){In.call(this,t,Z)}function _e(Z){In.call(this,t,Z)}function se(Z){In.call(this,t,Z)}function ce(Z){In.call(this,t,Z)}function me(Z){In.call(this,t,Z)}function Le(Z){In.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,u=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,V=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,te=Z.hovered),"eventsIfTopMost"in Z&&n(13,U=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[te,a,c,u,m,w,S,E,P,D,k,V,j,U,W,r,Y,oe,_e,se,ce,me,Le,i]}let AC=class extends Qt{constructor(e){super(),Jt(this,e,LO,TO,Gt,{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 PO(t,e,n){let r;const{map:i}=Zf();Pt(t,i,m=>n(4,r=m));let{position:a="top-left"}=e,{container:c=void 0}=e,u=null;return as(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),t.$$set=m=>{"position"in m&&n(1,a=m.position),"container"in m&&n(2,c=m.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!u){let m;typeof c=="string"?m=document.querySelector(c)??void 0:m=c,n(3,u=new Es.FullscreenControl({container:m})),r.addControl(u,a)}},[i,a,c,u,r]}class MO extends Qt{constructor(e){super(),Jt(this,e,PO,null,Gt,{position:1,container:2})}}function AO(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const u=()=>{e&&(t.getSource(e)?setTimeout(u,1):c())};u()}else c()}function kO(t,e,n){iE().then(()=>{let r=$S(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function W2(t){let e=t[0],n,r,i=H2(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c&1&&Gt(e,e=a[0])?(kn(),Te(i,1,1,yt),Dn(),i=H2(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function H2(t){let e;const n=t[15].default,r=ii(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)&&si(r,n,i,i[14],e?oi(n,i[14],a,null):ai(i[14]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function DO(t){let e,n,r=t[0]&&W2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=W2(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function RO(t,e,n){let r,i,a,{$$slots:c={},$$scope:u}=e,{id:m=Qd("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:P=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:k=void 0}=e;const{map:V,cluster:j,self:te}=gO();Pt(t,V,Y=>n(13,i=Y)),Pt(t,j,Y=>n(16,a=Y)),Pt(t,te,Y=>n(0,r=Y));let U,W=!0;return as(()=>{r&&U&&i&&(kO(V,r,U),Hn(te,r=null,r),n(11,U=void 0))}),t.$$set=Y=>{"id"in Y&&n(4,m=Y.id),"data"in Y&&n(5,w=Y.data),"generateId"in Y&&n(6,S=Y.generateId),"promoteId"in Y&&n(7,E=Y.promoteId),"filter"in Y&&n(8,P=Y.filter),"lineMetrics"in Y&&n(9,D=Y.lineMetrics),"cluster"in Y&&n(10,k=Y.cluster),"$$scope"in Y&&n(14,u=Y.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Hn(j,a=k,a),t.$$.dirty&12273&&i&&r!==m&&(Hn(te,r=m,r),AO(i,r,Uc({type:"geojson",data:w,filter:P,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}),Y=>i&&Y===r,()=>{r&&(n(11,U=i==null?void 0:i.getSource(r)),n(12,W=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,U=i==null?void 0:i.getSource(m))})),t.$$.dirty&6176&&U&&(W?n(12,W=!1):U.setData(w)),t.$$.dirty&3072&&(U==null||U.setClusterOptions(Uc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,V,j,te,m,w,S,E,P,D,k,U,W,i,u,c]}let ru=class extends Qt{constructor(e){super(),Jt(this,e,RO,DO,Gt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}};function NO(t,e,n){let r;const{map:i}=Zf();Pt(t,i,P=>n(8,r=P));let{position:a="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:u=void 0}=e,{trackUserLocation:m=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:S=!0}=e,E=null;return as(()=>{r!=null&&r.loaded()&&E&&r.removeControl(E)}),t.$$set=P=>{"position"in P&&n(1,a=P.position),"positionOptions"in P&&n(2,c=P.positionOptions),"fitBoundsOptions"in P&&n(3,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(4,m=P.trackUserLocation),"showAccuracyCircle"in P&&n(5,w=P.showAccuracyCircle),"showUserLocation"in P&&n(6,S=P.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&r&&!E&&(n(7,E=new Es.GeolocateControl({positionOptions:c,fitBoundsOptions:u,trackUserLocation:m,showAccuracyCircle:w,showUserLocation:S})),r.addControl(E,a))},[i,a,c,u,m,w,S,E,r]}class OO extends Qt{constructor(e){super(),Jt(this,e,NO,null,Gt,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function zO(t){let e;const n=t[15].default,r=ii(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)&&si(r,n,i,i[23],e?oi(n,i[23],a,null):ai(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function FO(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 y1({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&2&&(m.id=c[1]),u&4&&(m.source=c[2]),u&8&&(m.sourceLayer=c[3]),u&16&&(m.beforeId=c[4]),u&32&&(m.beforeLayerType=c[5]),u&64&&(m.paint=c[6]),u&128&&(m.layout=c[7]),u&256&&(m.filter=c[8]),u&512&&(m.minzoom=c[9]),u&1024&&(m.maxzoom=c[10]),u&2048&&(m.hoverCursor=c[11]),u&4096&&(m.manageHoverState=c[12]),u&8192&&(m.eventsIfTopMost=c[13]),u&16384&&(m.interactive=c[14]),u&8388608&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function BO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Qd("line")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:V=void 0}=e,{manageHoverState:j=!1}=e,{hovered:te=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:W=!0}=e;function Y(Z){te=Z,n(0,te)}function oe(Z){In.call(this,t,Z)}function _e(Z){In.call(this,t,Z)}function se(Z){In.call(this,t,Z)}function ce(Z){In.call(this,t,Z)}function me(Z){In.call(this,t,Z)}function Le(Z){In.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,u=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,V=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,te=Z.hovered),"eventsIfTopMost"in Z&&n(13,U=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[te,a,c,u,m,w,S,E,P,D,k,V,j,U,W,r,Y,oe,_e,se,ce,me,Le,i]}let Kc=class extends Qt{constructor(e){super(),Jt(this,e,BO,FO,Gt,{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 VO(t,e,n){let r;const i=ju();let{layer:a=void 0}=e;const{map:c}=Zf();Pt(t,c,S=>n(2,r=S));function u(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 as(()=>{if(r)if(a)for(const S of m)r.off(S,a,u);else for(const S of w)r.off(S,u)}),t.$$set=S=>{"layer"in S&&n(1,a=S.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(a)for(const S of m)r.on(S,a,u);else for(const S of w)r.on(S,u)},[c,a,r]}class UO extends Qt{constructor(e){super(),Jt(this,e,VO,null,Gt,{layer:1})}}function GO(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(e.lat*i)/i,c=Math.round(e.lng*i)/i,u=`${n}/${a}/${c}`,m=t.getBearing(),w=t.getPitch();return(m||w)&&(u+=`/${Math.round(m*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function qO(t){return t.replace("#","").split("/").map(parseFloat)}function jO(t,e,n){let r;const{map:i}=Zf();Pt(t,i,S=>n(6,r=S));let{position:a="top-left"}=e,{showCompass:c=!0}=e,{showZoom:u=!0}=e,{visualizePitch:m=!1}=e,w=null;return as(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),t.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,m=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Es.NavigationControl({showCompass:c,showZoom:u,visualizePitch:m})),r.addControl(w,a))},[i,a,c,u,m,w,r]}class WO extends Qt{constructor(e){super(),Jt(this,e,jO,null,Gt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function HO(t,e,n){let r;const{map:i}=Zf();Pt(t,i,w=>n(5,r=w));let{position:a="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:u="metric"}=e,m=null;return as(()=>{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,u=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!m&&(n(4,m=new Es.ScaleControl({maxWidth:c,unit:u})),r.addControl(m,a))},[i,a,c,u,m,r]}class ZO extends Qt{constructor(e){super(),Jt(this,e,HO,null,Gt,{position:1,maxWidth:2,unit:3})}}const{window:XO}=ZL,YO=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),Z2=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function X2(t){let e,n,r=t[3]&&Y2(t);const i=t[39].default,a=ii(i,t,t[38],Z2);return{c(){r&&r.c(),e=rt(),a&&a.c()},m(c,u){r&&r.m(c,u),De(c,e,u),a&&a.m(c,u),n=!0},p(c,u){c[3]?r?(r.p(c,u),u[0]&8&&be(r,1)):(r=Y2(c),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn()),a&&a.p&&(!n||u[0]&112|u[1]&128)&&si(a,i,c,c[38],n?oi(i,c[38],u,YO):ai(c[38]),Z2)},i(c){n||(be(r),be(a,c),n=!0)},o(c){Te(r),Te(a,c),n=!1},d(c){c&&ke(e),r&&r.d(c),a&&a.d(c)}}}function Y2(t){let e,n,r,i,a,c,u,m;return e=new WO({props:{position:t[7]}}),r=new OO({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new MO({props:{position:t[7]}}),u=new ZO({props:{position:t[7]}}),{c(){lt(e.$$.fragment),n=rt(),lt(r.$$.fragment),i=rt(),lt(a.$$.fragment),c=rt(),lt(u.$$.fragment)},m(w,S){st(e,w,S),De(w,n,S),st(r,w,S),De(w,i,S),st(a,w,S),De(w,c,S),st(u,w,S),m=!0},p(w,S){const E={};S[0]&128&&(E.position=w[7]),e.$set(E);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const D={};S[0]&128&&(D.position=w[7]),a.$set(D);const k={};S[0]&128&&(k.position=w[7]),u.$set(k)},i(w){m||(be(e.$$.fragment,w),be(r.$$.fragment,w),be(a.$$.fragment,w),be(u.$$.fragment,w),m=!0)},o(w){Te(e.$$.fragment,w),Te(r.$$.fragment,w),Te(a.$$.fragment,w),Te(u.$$.fragment,w),m=!1},d(w){w&&(ke(n),ke(i),ke(c)),at(e,w),at(r,w),at(a,w),at(u,w)}}}function KO(t){let e,n,r,i,a,c=t[4]&&t[0]&&X2(t);return{c(){e=Ne("div"),c&&c.c(),Ve(e,"class",n=Rg(t[2])+" svelte-p00lfq"),Ve(e,"data-testid","map-container"),sl(e,"expand-map",!t[2])},m(u,m){De(u,e,m),c&&c.m(e,null),t[40](e),r=!0,i||(a=[Wt(XO,"hashchange",t[11]),I0(t[10].call(null,e))],i=!0)},p(u,m){u[4]&&u[0]?c?(c.p(u,m),m[0]&17&&be(c,1)):(c=X2(u),c.c(),be(c,1),c.m(e,null)):c&&(kn(),Te(c,1,1,()=>{c=null}),Dn()),(!r||m[0]&4&&n!==(n=Rg(u[2])+" svelte-p00lfq"))&&Ve(e,"class",n),(!r||m[0]&4)&&sl(e,"expand-map",!u[2])},i(u){r||(be(c),r=!0)},o(u){Te(c),r=!1},d(u){u&&ke(e),c&&c.d(),t[40](null),i=!1,Ni(a)}}}function JO(t,e,n){let r,i,a,c,{$$slots:u={},$$scope:m}=e,{map:w=null}=e,{mapContainer:S=void 0}=e,{class:E=void 0}=e,{style:P}=e,{diffStyleUpdates:D=!1}=e,{center:k=void 0}=e,{zoom:V=void 0}=e,{pitch:j=0}=e,{bearing:te=0}=e,{bounds:U=void 0}=e,{hash:W=!1}=e,{loaded:Y=!1}=e,{minZoom:oe=0}=e,{maxZoom:_e=22}=e,{antialias:se=void 0}=e,{zoomOnDoubleClick:ce=!0}=e,{locale:me=void 0}=e,{interactive:Le=!0}=e,{attributionControl:Z=!0}=e,{cooperativeGestures:fe=!1}=e,{preserveDrawingBuffer:Ke=!1}=e,{maxBounds:Ee=void 0}=e,{images:Ze=[]}=e,{standardControls:tt=!1}=e,{filterLayers:qe=void 0}=e,{transformRequest:Ot=void 0}=e;const wt=ju(),{map:un,loadedImages:qt}=mO();Pt(t,un,Qe=>n(4,a=Qe)),Pt(t,qt,Qe=>n(5,c=Qe));let At=new Set;async function hn(Qe,ge=!1){if(a&&!(!a.loaded()&&!ge))if("url"in Qe){At.add(Qe.id);try{let Pe=await a.loadImage(Qe.url);a==null||a.addImage(Qe.id,Pe.data,Qe.options),c.add(Qe.id),qt.set(c)}catch(Pe){wt("error",Pe)}finally{At.delete(Qe.id)}}else a.addImage(Qe.id,Qe.data,Qe.options),c.add(Qe.id),qt.set(c)}let Tn,yn,_n,Rn;function wr(Qe){return Sr(),Hn(un,a=new Es.Map(Uc({container:Qe,style:P,locale:me,center:k,zoom:V,pitch:j,bearing:te,minZoom:oe,maxZoom:_e,antialias:se,interactive:Le,preserveDrawingBuffer:Ke,maxBounds:Ee,bounds:U,attributionControl:Z,transformRequest:Ot,cooperativeGestures:fe})),a),a.on("load",ge=>{ge.target.getContainer().setAttribute("data-testid","map"),ge.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,Y=!0),wt("load",a)}),a.on("error",ge=>wt("error",{...ge,map:a})),a.on("movestart",ge=>wt("movestart",{...ge,map:a})),a.on("moveend",ge=>{if(n(12,k=ge.target.getCenter()),n(13,V=ge.target.getZoom()),n(14,U=ge.target.getBounds()),wt("moveend",{...ge,map:a}),W){let Pe=window.location.href.replace(/(#.+)?$/,GO(a));window.history.replaceState(window.history.state,"",Pe)}}),a.on("click",ge=>wt("click",{...ge,map:a})),a.on("dblclick",ge=>wt("dblclick",{...ge,map:a})),a.on("contextmenu",ge=>wt("contextmenu",{...ge,map:a})),a.on("zoomstart",ge=>wt("zoomstart",{...ge,map:a})),a.on("zoom",ge=>{n(13,V=ge.target.getZoom()),wt("zoom",{...ge,map:a})}),a.on("zoomend",ge=>{n(13,V=ge.target.getZoom()),wt("zoomend",{...ge,map:a})}),a.on("style.load",()=>{if(a){const ge=a.getStyle();if(n(35,Tn=ge.layers.map(Pe=>Pe.id)),n(36,yn=Object.keys(ge.sources)),Rn)for(const[Pe,Ct]of Object.entries(Rn))a.addSource(Pe,Ct);if(_n)for(const Pe of _n)a.addLayer(Pe);for(const Pe of Ze)hn(Pe,!0)}}),a.on("styledata",ge=>{if(a&&qe){const Pe=a.getStyle().layers;if(Pe)for(let Ct of Pe)qe(Ct)||a.setLayoutProperty(Ct.id,"visibility","none")}wt("styledata",{...ge,map:a})}),{destroy(){n(0,Y=!1),a==null||a.remove(),Hn(un,a=null,a)}}}let kr=P;function Sr(){if(W){let Qe=qO(window.location.hash);Qe.length>=3&&(n(13,V=Qe[0]),n(12,k=[Qe[2],Qe[1]])),Qe.length==5&&(n(17,te=Qe[3]),n(16,j=Qe[4]))}}function dr(Qe){Zn[Qe?"unshift":"push"](()=>{S=Qe,n(1,S)})}return t.$$set=Qe=>{"map"in Qe&&n(15,w=Qe.map),"mapContainer"in Qe&&n(1,S=Qe.mapContainer),"class"in Qe&&n(2,E=Qe.class),"style"in Qe&&n(18,P=Qe.style),"diffStyleUpdates"in Qe&&n(19,D=Qe.diffStyleUpdates),"center"in Qe&&n(12,k=Qe.center),"zoom"in Qe&&n(13,V=Qe.zoom),"pitch"in Qe&&n(16,j=Qe.pitch),"bearing"in Qe&&n(17,te=Qe.bearing),"bounds"in Qe&&n(14,U=Qe.bounds),"hash"in Qe&&n(20,W=Qe.hash),"loaded"in Qe&&n(0,Y=Qe.loaded),"minZoom"in Qe&&n(21,oe=Qe.minZoom),"maxZoom"in Qe&&n(22,_e=Qe.maxZoom),"antialias"in Qe&&n(23,se=Qe.antialias),"zoomOnDoubleClick"in Qe&&n(24,ce=Qe.zoomOnDoubleClick),"locale"in Qe&&n(25,me=Qe.locale),"interactive"in Qe&&n(26,Le=Qe.interactive),"attributionControl"in Qe&&n(27,Z=Qe.attributionControl),"cooperativeGestures"in Qe&&n(28,fe=Qe.cooperativeGestures),"preserveDrawingBuffer"in Qe&&n(29,Ke=Qe.preserveDrawingBuffer),"maxBounds"in Qe&&n(30,Ee=Qe.maxBounds),"images"in Qe&&n(31,Ze=Qe.images),"standardControls"in Qe&&n(3,tt=Qe.standardControls),"filterLayers"in Qe&&n(32,qe=Qe.filterLayers),"transformRequest"in Qe&&n(33,Ot=Qe.transformRequest),"$$scope"in Qe&&n(38,m=Qe.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof tt=="boolean"?void 0:tt),t.$$.dirty[0]&16&&n(15,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&112&&a&&!vg(P,kr)){const Qe=a.getStyle();if(Tn&&(_n=Qe.layers.filter(ge=>!Tn.includes(ge.id))),yn){const ge=Object.keys(Qe.sources).filter(Pe=>!yn.includes(Pe));Rn={};for(const Pe of ge)Rn[Pe]=Qe.sources[Pe]}n(37,kr=P),a.setStyle(P,{diff:D}),Hn(qt,c=new Set,c),n(34,At=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&9&&Y&&a!=null&&a.loaded())for(let Qe of Ze)!c.has(Qe.id)&&!At.has(Qe.id)&&!a.hasImage(Qe.id)&&hn(Qe);t.$$.dirty[0]&32|t.$$.dirty[1]&1&&n(6,i=Ze.every(Qe=>c.has(Qe.id))),t.$$.dirty[0]&4112&&k&&!vg(k,a==null?void 0:a.getCenter())&&(a==null||a.panTo(k)),t.$$.dirty[0]&8208&&V&&!vg(V,a==null?void 0:a.getZoom())&&(a==null||a.zoomTo(V)),t.$$.dirty[0]&16400&&U&&!vg(U,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(U)),t.$$.dirty[0]&16777232&&(ce?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[Y,S,E,tt,a,c,i,r,un,qt,wr,Sr,k,V,U,w,j,te,P,D,W,oe,_e,se,ce,me,Le,Z,fe,Ke,Ee,Ze,qe,Ot,At,Tn,yn,kr,m,u,dr]}class QO extends Qt{constructor(e){super(),Jt(this,e,JO,KO,Gt,{map:15,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:16,bearing:17,bounds:14,hash:20,loaded:0,minZoom:21,maxZoom:22,antialias:23,zoomOnDoubleClick:24,locale:25,interactive:26,attributionControl:27,cooperativeGestures:28,preserveDrawingBuffer:29,maxBounds:30,images:31,standardControls:3,filterLayers:32,transformRequest:33},null,[-1,-1])}}const $O=t=>({marker:t&8}),K2=t=>({marker:t[3]});function e5(t){let e,n,r,i,a,c,u;const m=t[19].default,w=ii(m,t,t[18],K2);return{c(){e=Ne("div"),w&&w.c(),Ve(e,"tabindex",n=t[1]?0:void 0),Ve(e,"role",r=t[1]?"button":void 0),zr(e,"z-index",t[2])},m(S,E){De(S,e,E),w&&w.m(e,null),a=!0,c||(u=[I0(t[7].call(null,e)),I0(i=t5.call(null,e,t[0])),Wt(e,"click",X_(t[20])),Wt(e,"dblclick",X_(t[21])),Wt(e,"contextmenu",X_(t[22])),Wt(e,"mouseenter",t[23]),Wt(e,"mouseleave",t[24]),Wt(e,"mousemove",t[25]),Wt(e,"keydown",t[8])],c=!0)},p(S,[E]){w&&w.p&&(!a||E&262152)&&si(w,m,S,S[18],a?oi(m,S[18],E,$O):ai(S[18]),K2),(!a||E&2&&n!==(n=S[1]?0:void 0))&&Ve(e,"tabindex",n),(!a||E&2&&r!==(r=S[1]?"button":void 0))&&Ve(e,"role",r),i&&_y(i.update)&&E&1&&i.update.call(null,S[0]),E&4&&zr(e,"z-index",S[2])},i(S){a||(be(w,S),a=!0)},o(S){Te(w,S),a=!1},d(S){S&&ke(e),w&&w.d(S),c=!1,Ni(u)}}}function t5(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function n5(t,e,n){let r,i,a,{$$slots:c={},$$scope:u}=e,{marker:m=void 0}=e,{lngLat:w}=e,{class:S=void 0}=e,{interactive:E=!0}=e,{asButton:P=!1}=e,{draggable:D=!1}=e,{feature:k=null}=e,{offset:V=void 0}=e,{zIndex:j=void 0}=e,{rotation:te=0}=e,{opacity:U=1}=e;const W=ju(),{map:Y,layerEvent:oe,self:_e}=_O();Pt(t,Y,qe=>n(27,a=qe)),Pt(t,oe,qe=>n(26,r=qe)),Pt(t,_e,qe=>n(3,i=qe));function se(qe){Hn(_e,i=new Es.Marker({element:qe,rotation:te,draggable:D,offset:V,opacity:U.toString()}).setLngLat(w).addTo(a),i),n(11,m=i);const Ot=()=>Le("dragstart"),wt=()=>{ce(),Le("drag")},un=()=>{ce(),Le("dragend")};return D&&(i.on("dragstart",Ot),i.on("drag",wt),i.on("dragend",un)),{destroy(){D&&(i==null||i.off("dragstart",Ot),i==null||i.off("drag",wt),i==null||i.off("dragend",un)),n(11,m=void 0),i==null||i.remove()}}}function ce(){let qe=i==null?void 0:i.getLngLat();qe&&(Array.isArray(w)?n(10,w=[qe.lng,qe.lat]):w&&"lon"in w?n(10,w={lon:qe.lng,lat:qe.lat}):n(10,w=qe))}function me(qe){qe.key===" "&&(qe.preventDefault(),qe.stopPropagation(),Le("click"))}function Le(qe){if(!E)return;let Ot=i==null?void 0:i.getLngLat();if(!Ot)return;const wt=[Ot.lng,Ot.lat];let un={map:a,marker:i,lngLat:wt,features:[{type:"Feature",properties:(k==null?void 0:k.properties)??{},geometry:{type:"Point",coordinates:wt}}]};Hn(oe,r={...un,layerType:"marker",type:qe},r),W(qe,un)}const Z=()=>Le("click"),fe=()=>Le("dblclick"),Ke=()=>Le("contextmenu"),Ee=qe=>{Le("mouseenter")},Ze=()=>{Le("mouseleave")},tt=()=>Le("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,P=qe.asButton),"draggable"in qe&&n(13,D=qe.draggable),"feature"in qe&&n(14,k=qe.feature),"offset"in qe&&n(15,V=qe.offset),"zIndex"in qe&&n(2,j=qe.zIndex),"rotation"in qe&&n(16,te=qe.rotation),"opacity"in qe&&n(17,U=qe.opacity),"$$scope"in qe&&n(18,u=qe.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(w)),t.$$.dirty&32776&&(i==null||i.setOffset(V??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(te)),t.$$.dirty&131080&&(i==null||i.setOpacity(U.toString()))},[S,P,j,i,Y,oe,_e,se,me,Le,w,m,E,D,k,V,te,U,u,c,Z,fe,Ke,Ee,Ze,tt]}class zd extends Qt{constructor(e){super(),Jt(this,e,n5,e5,Gt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const r5=t=>({}),J2=t=>({}),i5=t=>({}),Q2=t=>({}),o5=t=>({}),$2=t=>({});function s5(t){let e,n,r,i,a,c;const u=t[1].top,m=ii(u,t,t[0],$2),w=t[1].left,S=ii(w,t,t[0],Q2),E=t[1].main,P=ii(E,t,t[0],J2);return{c(){e=Ne("div"),m&&m.c(),n=rt(),r=Ne("div"),S&&S.c(),i=rt(),a=Ne("div"),P&&P.c(),Ve(e,"class","top svelte-mpick2"),Ve(r,"class","left svelte-mpick2"),Ve(a,"class","main svelte-mpick2")},m(D,k){De(D,e,k),m&&m.m(e,null),De(D,n,k),De(D,r,k),S&&S.m(r,null),De(D,i,k),De(D,a,k),P&&P.m(a,null),c=!0},p(D,[k]){m&&m.p&&(!c||k&1)&&si(m,u,D,D[0],c?oi(u,D[0],k,o5):ai(D[0]),$2),S&&S.p&&(!c||k&1)&&si(S,w,D,D[0],c?oi(w,D[0],k,i5):ai(D[0]),Q2),P&&P.p&&(!c||k&1)&&si(P,E,D,D[0],c?oi(E,D[0],k,r5):ai(D[0]),J2)},i(D){c||(be(m,D),be(S,D),be(P,D),c=!0)},o(D){Te(m,D),Te(S,D),Te(P,D),c=!1},d(D){D&&(ke(e),ke(n),ke(r),ke(i),ke(a)),m&&m.d(D),S&&S.d(D),P&&P.d(D)}}}function a5(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class l5 extends Qt{constructor(e){super(),Jt(this,e,a5,s5,Gt,{})}}const u5=t=>({}),eS=t=>({}),c5=t=>({}),tS=t=>({}),h5=t=>({}),nS=t=>({});function f5(t){let e,n,r,i,a,c;const u=t[4].top,m=ii(u,t,t[3],nS),w=t[4].sidebar,S=ii(w,t,t[3],tS),E=t[4].map,P=ii(E,t,t[3],eS);return{c(){e=Ne("div"),m&&m.c(),n=rt(),r=Ne("div"),S&&S.c(),i=rt(),a=Ne("div"),P&&P.c()},m(D,k){De(D,e,k),m&&m.m(e,null),t[5](e),De(D,n,k),De(D,r,k),S&&S.m(r,null),t[6](r),De(D,i,k),De(D,a,k),P&&P.m(a,null),t[7](a),c=!0},p(D,[k]){m&&m.p&&(!c||k&8)&&si(m,u,D,D[3],c?oi(u,D[3],k,h5):ai(D[3]),nS),S&&S.p&&(!c||k&8)&&si(S,w,D,D[3],c?oi(w,D[3],k,c5):ai(D[3]),tS),P&&P.p&&(!c||k&8)&&si(P,E,D,D[3],c?oi(E,D[3],k,u5):ai(D[3]),eS)},i(D){c||(be(m,D),be(S,D),be(P,D),c=!0)},o(D){Te(m,D),Te(S,D),Te(P,D),c=!1},d(D){D&&(ke(e),ke(n),ke(r),ke(i),ke(a)),m&&m.d(D),t[5](null),S&&S.d(D),t[6](null),P&&P.d(D),t[7](null)}}}function p5(t,e,n){let r,i,a;Pt(t,mv,E=>n(0,r=E)),Pt(t,gv,E=>n(1,i=E)),Pt(t,yv,E=>n(2,a=E));let{$$slots:c={},$$scope:u}=e;function m(E){Zn[E?"unshift":"push"](()=>{r=E,mv.set(r)})}function w(E){Zn[E?"unshift":"push"](()=>{i=E,gv.set(i)})}function S(E){Zn[E?"unshift":"push"](()=>{a=E,yv.set(a)})}return t.$$set=E=>{"$$scope"in E&&n(3,u=E.$$scope)},[r,i,a,u,c,m,w,S]}class Xf extends Qt{constructor(e){super(),Jt(this,e,p5,f5,Gt,{})}}let mv=sr(null),gv=sr(null),yv=sr(null);function rS(t){let e,n;return e=new Jd({props:{openOn:"hover",$$slots:{default:[d5,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&48&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function d5(t){let e,n;return e=new Sv({props:{properties:t[4]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.properties=r[4]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function m5(t){let e,n,r=t[1]&&rS(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[1]?r?(r.p(i,a),a&2&&be(r,1)):(r=rS(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function g5(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":$d("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[m5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Vy({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[3]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&34&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function y5(t,e,n){let{hovered:r=null}=e,{popups:i=!1}=e;function a(u){r=u,n(0,r)}const c=u=>window.open(ul(u.detail.features[0].properties).osm_id,"_blank");return t.$$set=u=>{"hovered"in u&&n(0,r=u.hovered),"popups"in u&&n(1,i=u.popups)},[r,i,a,c]}class kC extends Qt{constructor(e){super(),Jt(this,e,y5,g5,Gt,{hovered:0,popups:1})}}function iS(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function oS(t,e,n){const r=t.slice();return r[6]=e[n],r}function sS(t){let e,n,r=Ug(t[6])+"",i,a,c;return{c(){e=Ne("li"),n=Ne("a"),i=It(r),c=rt(),Ve(n,"href",a=t[6].properties.osm_id),Ve(n,"target","_blank")},m(u,m){De(u,e,m),Se(e,n),Se(n,i),Se(e,c)},p(u,m){m&1&&r!==(r=Ug(u[6])+"")&&Bn(i,r),m&1&&a!==(a=u[6].properties.osm_id)&&Ve(n,"href",a)},d(u){u&&ke(e)}}}function aS(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",u,m,w,S,E,P=Fr(t[3]),D=[];for(let k=0;ki[1].length-r[1].length),n}function v5(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 DC extends Qt{constructor(e){super(),Jt(this,e,v5,_5,Gt,{gj:1})}}function uS(t,e,n){const r=t.slice();return r[3]=e[n],r}function cS(t){let e,n,r=Fr(t[0]),i=[];for(let a=0;a0&&cS(t);return{c(){n&&n.c(),e=Ur()},m(r,i){n&&n.m(r,i),De(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=cS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:yt,o:yt,d(r){r&&ke(e),n&&n.d(r)}}}function x5(t,e,n){let{loading:r}=e,i;function a(c){Zn[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 RC extends Qt{constructor(e){super(),Jt(this,e,x5,b5,Gt,{loading:0})}}function w5(t){let e,n,r,i,a,c,u,m,w,S,E,P,D,k,V,j,te,U,W,Y,oe,_e,se,ce,me,Le;return{c(){e=Ne("nav"),n=Ne("ul"),r=Ne("li"),i=Ne("button"),i.textContent="Change study area",a=rt(),c=Ne("li"),u=Ne("button"),m=It("Isochrone"),S=rt(),E=Ne("li"),P=Ne("button"),D=It("Route"),V=rt(),j=Ne("li"),te=Ne("button"),U=It("Score"),Y=rt(),oe=Ne("li"),_e=Ne("button"),se=It("Debug network"),u.disabled=w=t[0].kind=="isochrone",P.disabled=k=t[0].kind=="route",te.disabled=W=t[0].kind=="score",_e.disabled=ce=t[0].kind=="debug"},m(Z,fe){De(Z,e,fe),Se(e,n),Se(n,r),Se(r,i),Se(n,a),Se(n,c),Se(c,u),Se(u,m),Se(n,S),Se(n,E),Se(E,P),Se(P,D),Se(n,V),Se(n,j),Se(j,te),Se(te,U),Se(n,Y),Se(n,oe),Se(oe,_e),Se(_e,se),me||(Le=[Wt(i,"click",t[1]),Wt(u,"click",t[2]),Wt(P,"click",t[3]),Wt(te,"click",t[4]),Wt(_e,"click",t[5])],me=!0)},p(Z,[fe]){fe&1&&w!==(w=Z[0].kind=="isochrone")&&(u.disabled=w),fe&1&&k!==(k=Z[0].kind=="route")&&(P.disabled=k),fe&1&&W!==(W=Z[0].kind=="score")&&(te.disabled=W),fe&1&&ce!==(ce=Z[0].kind=="debug")&&(_e.disabled=ce)},i:yt,o:yt,d(Z){Z&&ke(e),me=!1,Ni(Le)}}}function S5(t,e,n){let r;return Pt(t,Ys,w=>n(0,r=w)),[r,()=>Hn(Ys,r={kind:"title"},r),()=>Hn(Ys,r={kind:"isochrone"},r),()=>Hn(Ys,r={kind:"route"},r),()=>Hn(Ys,r={kind:"score"},r),()=>Hn(Ys,r={kind:"debug"},r)]}class Uy extends Qt{constructor(e){super(),Jt(this,e,S5,w5,Gt,{})}}function fS(t,e,n){const r=t.slice();return r[9]=e[n],r[10]=e,r[11]=n,r}function E5(t){let e,n,r=t[0].join(", ")+"",i,a,c,u,m;return{c(){e=Ne("p"),n=It("Amenities: "),i=It(r),a=rt(),c=Ne("button"),c.textContent="Choose"},m(w,S){De(w,e,S),Se(e,n),Se(e,i),De(w,a,S),De(w,c,S),u||(m=Wt(c,"click",t[6]),u=!0)},p(w,S){S&1&&r!==(r=w[0].join(", ")+"")&&Bn(i,r)},i:yt,o:yt,d(w){w&&(ke(e),ke(a),ke(c)),u=!1,m()}}}function I5(t){let e,n;return e=new wv({props:{$$slots:{default:[C5,({dialog:r})=>({8:r}),({dialog:r})=>r?256:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&4354&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function pS(t){let e,n,r,i=t[9]+"",a,c,u,m;function w(){t[3].call(n,t[9])}return{c(){e=Ne("label"),n=Ne("input"),r=rt(),a=It(i),c=rt(),Ve(n,"type","checkbox")},m(S,E){De(S,e,E),Se(e,n),n.checked=t[1][t[9]],Se(e,r),Se(e,a),Se(e,c),u||(m=Wt(n,"change",w),u=!0)},p(S,E){t=S,E&2&&(n.checked=t[1][t[9]]),E&2&&i!==(i=t[9]+"")&&Bn(a,i)},d(S){S&&ke(e),u=!1,m()}}}function C5(t){let e,n,r,i,a,c,u,m,w,S,E=Fr(Object.keys(t[1])),P=[];for(let k=0;k{c[S]=null}),Dn(),n=c[e],n?n.p(m,w):(n=c[e]=a[e](m),n.c()),be(n,1),n.m(r.parentNode,r))},i(m){i||(be(n),i=!0)},o(m){Te(n),i=!1},d(m){m&&ke(r),c[e].d(m)}}}function L5(t){return Object.entries(t).filter(e=>e[1]).map(e=>e[0])}function P5(t,e,n){let r;Pt(t,Zl,E=>n(7,r=E));let i={},a=!1,{enabled:c}=e;qu(async()=>{let E=await r.renderDebug(),P=new Set;for(let D of E.features){let k=D.properties.amenity_kind;k&&P.add(k)}for(let D of[...P].sort())n(1,i[D]=!1,i);n(1,i)});function u(E){i[E]=this.checked,n(1,i)}const m=E=>ul(E).close(),w=()=>n(2,a=!1),S=()=>n(2,a=!0);return t.$$set=E=>{"enabled"in E&&n(0,c=E.enabled)},t.$$.update=()=>{t.$$.dirty&2&&n(0,c=L5(i))},[c,i,a,u,m,w,S]}class M5 extends Qt{constructor(e){super(),Jt(this,e,P5,T5,Gt,{enabled:0})}}function A5(t){let e,n,r,i,a,c,u,m,w;return{c(){e=Ne("label"),n=It(`Mode: - `),r=Ne("select"),i=Ne("option"),i.textContent="Car",a=Ne("option"),a.textContent="Bicycle",c=Ne("option"),c.textContent="Foot",u=Ne("option"),u.textContent="Public transit",i.__value="car",Go(i,i.__value),a.__value="bicycle",Go(a,a.__value),c.__value="foot",Go(c,c.__value),u.__value="transit",Go(u,u.__value),t[0]===void 0&&vd(()=>t[1].call(r))},m(S,E){De(S,e,E),Se(e,n),Se(e,r),Se(r,i),Se(r,a),Se(r,c),Se(r,u),Ng(r,t[0],!0),m||(w=Wt(r,"change",t[1]),m=!0)},p(S,[E]){E&1&&Ng(r,S[0])},i:yt,o:yt,d(S){S&&ke(e),m=!1,w()}}}function k5(t,e,n){let{travelMode:r}=e;function i(){r=tE(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class _1 extends Qt{constructor(e){super(),Jt(this,e,k5,A5,Gt,{travelMode:0})}}function dS(t,e,n){const r=t.slice();return r[3]=e[n],r}function D5(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=It(e),r=It(" has "),a=It(i),c=It(" next steps (arrivals)")},m(u,m){De(u,n,m),De(u,r,m),De(u,a,m),De(u,c,m)},p(u,m){m&64&&e!==(e=u[6].name+"")&&Bn(n,e),m&64&&i!==(i=JSON.parse(u[6].next_steps).length+"")&&Bn(a,i)},d(u){u&&(ke(n),ke(r),ke(a),ke(c))}}}function R5(t){let e,n;return e=new Jd({props:{openOn:"hover",$$slots:{default:[D5,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function mS(t){let e,n;return e=new wv({props:{$$slots:{default:[N5]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function gS(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=Ne("p"),r=It(n)},m(i,a){De(i,e,a),Se(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&Bn(r,n)},d(i){i&&ke(e)}}}function N5(t){let e,n=Fr(t[0]),r=[];for(let i=0;i{a=null}),Dn())},i(c){i||(be(e.$$.fragment,c),be(a),i=!0)},o(c){Te(e.$$.fragment,c),Te(a),i=!1},d(c){c&&(ke(n),ke(r)),at(e,c),a&&a.d(c)}}}function z5(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(ul(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class F5 extends Qt{constructor(e){super(),Jt(this,e,z5,O5,Gt,{})}}function B5(t){let e,n,r;return n=new Uy({}),{c(){e=Ne("div"),lt(n.$$.fragment),Ve(e,"slot","top")},m(i,a){De(i,e,a),st(n,e,null),r=!0},p:yt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&ke(e),at(n)}}}function yS(t){let e,n;return e=new DC({props:{gj:t[0]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function V5(t){let e,n,r,i,a,c,u,m,w;function S(D){t[3](D)}let E={};t[1]!==void 0&&(E.travelMode=t[1]),c=new _1({props:E}),Zn.push(()=>ao(c,"travelMode",S));let P=t[0]&&yS(t);return{c(){e=Ne("div"),n=Ne("h2"),n.textContent="Debug mode",r=rt(),i=Ne("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=rt(),lt(c.$$.fragment),m=rt(),P&&P.c(),Ve(e,"slot","sidebar")},m(D,k){De(D,e,k),Se(e,n),Se(e,r),Se(e,i),Se(e,a),st(c,e,null),Se(e,m),P&&P.m(e,null),w=!0},p(D,k){const V={};!u&&k&2&&(u=!0,V.travelMode=D[1],so(()=>u=!1)),c.$set(V),D[0]?P?(P.p(D,k),k&1&&be(P,1)):(P=yS(D),P.c(),be(P,1),P.m(e,null)):P&&(kn(),Te(P,1,1,()=>{P=null}),Dn())},i(D){w||(be(c.$$.fragment,D),be(P),w=!0)},o(D){Te(c.$$.fragment,D),Te(P),w=!1},d(D){D&&ke(e),at(c),P&&P.d()}}}function _S(t){let e,n;return e=new ru({props:{data:t[0],generateId:!0,$$slots:{default:[q5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.data=r[0]),i&66&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function U5(t){let e,n;return e=new Sv({props:{properties:t[5]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function G5(t){let e,n;return e=new Jd({props:{openOn:"hover",$$slots:{default:[U5,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function q5(t){let e,n,r,i,a,c;return e=new Kc({props:{id:"network",paint:{"line-width":$d(5,7),"line-color":"black"},filter:fx(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[G5]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new kC({props:{popups:!0}}),a=new F5({}),{c(){lt(e.$$.fragment),n=rt(),lt(r.$$.fragment),i=rt(),lt(a.$$.fragment)},m(u,m){st(e,u,m),De(u,n,m),st(r,u,m),De(u,i,m),st(a,u,m),c=!0},p(u,m){const w={};m&2&&(w.filter=fx(u[1])),m&64&&(w.$$scope={dirty:m,ctx:u}),e.$set(w)},i(u){c||(be(e.$$.fragment,u),be(r.$$.fragment,u),be(a.$$.fragment,u),c=!0)},o(u){Te(e.$$.fragment,u),Te(r.$$.fragment,u),Te(a.$$.fragment,u),c=!1},d(u){u&&(ke(n),ke(i)),at(e,u),at(r,u),at(a,u)}}}function j5(t){let e,n,r=t[0]&&_S(t);return{c(){e=Ne("div"),r&&r.c(),Ve(e,"slot","map")},m(i,a){De(i,e,a),r&&r.m(e,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=_S(i),r.c(),be(r,1),r.m(e,null)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d()}}}function W5(t){let e,n;return e=new Xf({props:{$$slots:{map:[j5],sidebar:[V5],top:[B5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function H5(t,e,n){let r,i;Pt(t,Zl,m=>n(4,r=m)),Pt(t,hf,m=>n(1,i=m));let a=null;qu(async()=>{n(0,a=await r.renderDebug())});const c=m=>window.open(ul(m.detail.features[0].properties).way,"_blank");function u(m){i=m,hf.set(i)}return[a,i,c,u]}class Z5 extends Qt{constructor(e){super(),Jt(this,e,H5,W5,Gt,{})}}const Fd=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"];function vS(t){let e,n=Ug(t[2])+"",r,i,a=t[2].properties.amenity_kind+"",c,u;return{c(){e=Ne("span"),r=It(n),i=It(" ("),c=It(a),u=It(")")},m(m,w){De(m,e,w),Se(e,r),Se(e,i),Se(e,c),Se(e,u)},p(m,w){w&4&&n!==(n=Ug(m[2])+"")&&Bn(r,n),w&4&&a!==(a=m[2].properties.amenity_kind+"")&&Bn(c,a)},d(m){m&&ke(e)}}}function X5(t){let e,n,r,i;n=new Uy({});let a=t[2]&&vS(t);return{c(){e=Ne("div"),lt(n.$$.fragment),r=rt(),a&&a.c(),Ve(e,"slot","top"),zr(e,"display","flex"),zr(e,"justify-content","space-between")},m(c,u){De(c,e,u),st(n,e,null),Se(e,r),a&&a.m(e,null),i=!0},p(c,u){c[2]?a?a.p(c,u):(a=vS(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i(c){i||(be(n.$$.fragment,c),i=!0)},o(c){Te(n.$$.fragment,c),i=!1},d(c){c&&ke(e),at(n),a&&a.d()}}}function bS(t){let e,n;return{c(){e=Ne("p"),n=It(t[7])},m(r,i){De(r,e,i),Se(e,n)},p(r,i){i&128&&Bn(n,r[7])},d(r){r&&ke(e)}}}function xS(t){let e,n;return e=new DC({props:{gj:t[5]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function Y5(t){let e,n,r,i,a,c,u,m,w,S,E,P,D,k,V,j,te,U,W,Y,oe,_e,se;function ce(fe){t[12](fe)}let me={};t[4]!==void 0&&(me.travelMode=t[4]),c=new _1({props:me}),Zn.push(()=>ao(c,"travelMode",ce)),U=new oE({props:{colorScale:Fd,limits:t[8]}});let Le=t[7]&&bS(t),Z=t[5]&&xS(t);return{c(){e=Ne("div"),n=Ne("h2"),n.textContent="Isochrone mode",r=rt(),i=Ne("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time - in seconds.`,a=rt(),lt(c.$$.fragment),m=rt(),w=Ne("label"),S=It(`Start time (PT only) - `),E=Ne("input"),D=rt(),k=Ne("label"),V=Ne("input"),j=It("Contours"),te=rt(),lt(U.$$.fragment),W=rt(),Le&&Le.c(),Y=rt(),Z&&Z.c(),Ve(E,"type","time"),E.disabled=P=t[4]!="transit",Ve(V,"type","checkbox"),Ve(e,"slot","sidebar")},m(fe,Ke){De(fe,e,Ke),Se(e,n),Se(e,r),Se(e,i),Se(e,a),st(c,e,null),Se(e,m),Se(e,w),Se(w,S),Se(w,E),Go(E,t[3]),Se(e,D),Se(e,k),Se(k,V),V.checked=t[1],Se(k,j),Se(e,te),st(U,e,null),Se(e,W),Le&&Le.m(e,null),Se(e,Y),Z&&Z.m(e,null),oe=!0,_e||(se=[Wt(E,"input",t[13]),Wt(V,"change",t[14])],_e=!0)},p(fe,Ke){const Ee={};!u&&Ke&16&&(u=!0,Ee.travelMode=fe[4],so(()=>u=!1)),c.$set(Ee),(!oe||Ke&16&&P!==(P=fe[4]!="transit"))&&(E.disabled=P),Ke&8&&Go(E,fe[3]),Ke&2&&(V.checked=fe[1]),fe[7]?Le?Le.p(fe,Ke):(Le=bS(fe),Le.c(),Le.m(e,Y)):Le&&(Le.d(1),Le=null),fe[5]?Z?(Z.p(fe,Ke),Ke&32&&be(Z,1)):(Z=xS(fe),Z.c(),be(Z,1),Z.m(e,null)):Z&&(kn(),Te(Z,1,1,()=>{Z=null}),Dn())},i(fe){oe||(be(c.$$.fragment,fe),be(U.$$.fragment,fe),be(Z),oe=!0)},o(fe){Te(c.$$.fragment,fe),Te(U.$$.fragment,fe),Te(Z),oe=!1},d(fe){fe&&ke(e),at(c),at(U),Le&&Le.d(),Z&&Z.d(),_e=!1,Ni(se)}}}function wS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[K5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new zd({props:a}),Zn.push(()=>ao(e,"lngLat",i)),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,u){const m={};u&524288&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.lngLat=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function K5(t){let e;return{c(){e=Ne("span"),e.textContent="X",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function SS(t){let e,n;return e=new ru({props:{data:t[5],generateId:!0,$$slots:{default:[$5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&524292&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function J5(t){let e=(t[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=It(e),r=It(" minutes away")},m(i,a){De(i,n,a),De(i,r,a)},p(i,a){a&262144&&e!==(e=(i[18].cost_seconds/60).toFixed(1)+"")&&Bn(n,e)},d(i){i&&(ke(n),ke(r))}}}function Q5(t){let e,n;return e=new Jd({props:{openOn:"hover",$$slots:{default:[J5,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&786432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function $5(t){let e,n,r,i,a,c,u;e=new Kc({props:{id:"isochrone",filter:fO,paint:{"line-width":20,"line-color":dv(["get","cost_seconds"],t[9],Fd),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[Q5]},$$scope:{ctx:t}}}),r=new AC({props:{id:"isochrone-contours",filter:hO,paint:{"fill-color":dv(["get","min_seconds"],t[9],Fd),"fill-opacity":.5}}});function m(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new kC({props:w}),Zn.push(()=>ao(a,"hovered",m)),{c(){lt(e.$$.fragment),n=rt(),lt(r.$$.fragment),i=rt(),lt(a.$$.fragment)},m(S,E){st(e,S,E),De(S,n,E),st(r,S,E),De(S,i,E),st(a,S,E),u=!0},p(S,E){const P={};E&524288&&(P.$$scope={dirty:E,ctx:S}),e.$set(P);const D={};!c&&E&4&&(c=!0,D.hovered=S[2],so(()=>c=!1)),a.$set(D)},i(S){u||(be(e.$$.fragment,S),be(r.$$.fragment,S),be(a.$$.fragment,S),u=!0)},o(S){Te(e.$$.fragment,S),Te(r.$$.fragment,S),Te(a.$$.fragment,S),u=!1},d(S){S&&(ke(n),ke(i)),at(e,S),at(r,S),at(a,S)}}}function ES(t){let e,n;return e=new ru({props:{data:t[6],$$slots:{default:[ez]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&524288&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function ez(t){let e,n;return e=new Kc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function tz(t){let e,n,r,i,a=t[0]&&wS(t),c=t[5]&&SS(t),u=t[6]&&ES(t);return{c(){e=Ne("div"),a&&a.c(),n=rt(),c&&c.c(),r=rt(),u&&u.c(),Ve(e,"slot","map")},m(m,w){De(m,e,w),a&&a.m(e,null),Se(e,n),c&&c.m(e,null),Se(e,r),u&&u.m(e,null),i=!0},p(m,w){m[0]?a?(a.p(m,w),w&1&&be(a,1)):(a=wS(m),a.c(),be(a,1),a.m(e,n)):a&&(kn(),Te(a,1,1,()=>{a=null}),Dn()),m[5]?c?(c.p(m,w),w&32&&be(c,1)):(c=SS(m),c.c(),be(c,1),c.m(e,r)):c&&(kn(),Te(c,1,1,()=>{c=null}),Dn()),m[6]?u?(u.p(m,w),w&64&&be(u,1)):(u=ES(m),u.c(),be(u,1),u.m(e,null)):u&&(kn(),Te(u,1,1,()=>{u=null}),Dn())},i(m){i||(be(a),be(c),be(u),i=!0)},o(m){Te(a),Te(c),Te(u),i=!1},d(m){m&&ke(e),a&&a.d(),c&&c.d(),u&&u.d()}}}function nz(t){let e,n;return e=new Xf({props:{$$slots:{map:[tz],sidebar:[Y5],top:[X5]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&524543&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function IS(t,e,n){return e+t*(n-e)}function rz(t,e,n){let r,i,a;Pt(t,Vg,oe=>n(3,r=oe)),Pt(t,hf,oe=>n(4,i=oe)),Pt(t,Zl,oe=>n(15,a=oe));let c=null;qu(async()=>{let oe=await a.getBounds();n(0,c={lng:IS(.5,oe[0],oe[2]),lat:IS(.5,oe[1],oe[3])})});let u=!0,m=null,w=null,S="",E;async function P(oe,_e,se,ce){if(c)try{n(5,m=await a.isochrone({start:c,mode:i,contours:u,startTime:r})),n(7,S="")}catch(me){n(5,m=null),me=me.toString()}}async function D(oe,_e,se){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(ce){n(6,w=null),ce=ce.toString()}else n(6,w=null)}let k=[0,3,6,9,12,15],V=k.map(oe=>oe*60);function j(oe){c=oe,n(0,c)}function te(oe){E=oe,n(2,E)}function U(oe){i=oe,hf.set(i)}function W(){r=this.value,Vg.set(r)}function Y(){u=this.checked,n(1,u)}return t.$$.update=()=>{t.$$.dirty&27&&P(),t.$$.dirty&13&&D()},[c,u,E,r,i,m,w,S,k,V,j,te,U,W,Y]}class iz extends Qt{constructor(e){super(),Jt(this,e,rz,nz,Gt,{})}}function CS(t,e,n){const r=t.slice();r[18]=e[n];const i=ul(r[18].properties);return r[17]=i,r}function oz(t){let e,n,r;return n=new Uy({}),{c(){e=Ne("div"),lt(n.$$.fragment),Ve(e,"slot","top")},m(i,a){De(i,e,a),st(n,e,null),r=!0},p:yt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&ke(e),at(n)}}}function sz(t){let e,n,r,i,a,c=Fr(t[5].features),u=[];for(let m=0;mao(i,"travelMode",_e));function ce(Z,fe){if(Z[6])return az;if(Z[5])return sz}let me=ce(t),Le=me&&me(t);return{c(){e=Ne("div"),n=Ne("h2"),n.textContent="Route mode",r=rt(),lt(i.$$.fragment),c=rt(),u=Ne("label"),m=Ne("input"),S=It(` - Use heuristic (PT only)`),E=rt(),P=Ne("label"),D=It(`Start time (PT only) - `),k=Ne("input"),j=rt(),te=Ne("p"),te.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to - set the first pin somewhere.)`,U=rt(),Le&&Le.c(),Ve(m,"type","checkbox"),m.disabled=w=t[4]!="transit",Ve(k,"type","time"),k.disabled=V=t[4]!="transit",Ve(e,"slot","sidebar")},m(Z,fe){De(Z,e,fe),Se(e,n),Se(e,r),st(i,e,null),Se(e,c),Se(e,u),Se(u,m),m.checked=t[3],Se(u,S),Se(e,E),Se(e,P),Se(P,D),Se(P,k),Go(k,t[2]),Se(e,j),Se(e,te),Se(e,U),Le&&Le.m(e,null),W=!0,Y||(oe=[Wt(m,"change",t[12]),Wt(k,"input",t[13])],Y=!0)},p(Z,fe){const Ke={};!a&&fe&16&&(a=!0,Ke.travelMode=Z[4],so(()=>a=!1)),i.$set(Ke),(!W||fe&16&&w!==(w=Z[4]!="transit"))&&(m.disabled=w),fe&8&&(m.checked=Z[3]),(!W||fe&16&&V!==(V=Z[4]!="transit"))&&(k.disabled=V),fe&4&&Go(k,Z[2]),me===(me=ce(Z))&&Le?Le.p(Z,fe):(Le&&Le.d(1),Le=me&&me(Z),Le&&(Le.c(),Le.m(e,null)))},i(Z){W||(be(i.$$.fragment,Z),W=!0)},o(Z){Te(i.$$.fragment,Z),W=!1},d(Z){Z&&ke(e),at(i),Le&&Le.d(),Y=!1,Ni(oe)}}}function pz(t){let e;return{c(){e=Ne("span"),e.textContent="A",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function dz(t){let e;return{c(){e=Ne("span"),e.textContent="B",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function LS(t){let e,n;return e=new ru({props:{data:t[5],generateId:!0,$$slots:{default:[yz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function mz(t){let e,n;return e=new Sv({props:{properties:t[17]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&131072&&(a.properties=r[17]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function gz(t){let e,n;return e=new Jd({props:{openOn:"hover",$$slots:{default:[mz,({props:r})=>({17:r}),({props:r})=>r?131072:0]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&2228224&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function yz(t){let e,n;return e=new Kc({props:{id:"route",paint:{"line-width":20,"line-color":d1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":$d(.5,1)},manageHoverState:!0,$$slots:{default:[gz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function _z(t){let e,n,r,i,a,c,u,m,w,S;n=new UO({}),n.$on("contextmenu",t[7]);function E(j){t[9](j)}let P={draggable:!0,$$slots:{default:[pz]},$$scope:{ctx:t}};t[1]!==void 0&&(P.lngLat=t[1]),i=new zd({props:P}),Zn.push(()=>ao(i,"lngLat",E));function D(j){t[10](j)}let k={draggable:!0,$$slots:{default:[dz]},$$scope:{ctx:t}};t[0]!==void 0&&(k.lngLat=t[0]),u=new zd({props:k}),Zn.push(()=>ao(u,"lngLat",D));let V=t[5]&&LS(t);return{c(){e=Ne("div"),lt(n.$$.fragment),r=rt(),lt(i.$$.fragment),c=rt(),lt(u.$$.fragment),w=rt(),V&&V.c(),Ve(e,"slot","map")},m(j,te){De(j,e,te),st(n,e,null),Se(e,r),st(i,e,null),Se(e,c),st(u,e,null),Se(e,w),V&&V.m(e,null),S=!0},p(j,te){const U={};te&2097152&&(U.$$scope={dirty:te,ctx:j}),!a&&te&2&&(a=!0,U.lngLat=j[1],so(()=>a=!1)),i.$set(U);const W={};te&2097152&&(W.$$scope={dirty:te,ctx:j}),!m&&te&1&&(m=!0,W.lngLat=j[0],so(()=>m=!1)),u.$set(W),j[5]?V?(V.p(j,te),te&32&&be(V,1)):(V=LS(j),V.c(),be(V,1),V.m(e,null)):V&&(kn(),Te(V,1,1,()=>{V=null}),Dn())},i(j){S||(be(n.$$.fragment,j),be(i.$$.fragment,j),be(u.$$.fragment,j),be(V),S=!0)},o(j){Te(n.$$.fragment,j),Te(i.$$.fragment,j),Te(u.$$.fragment,j),Te(V),S=!1},d(j){j&&ke(e),at(n),at(i),at(u),V&&V.d()}}}function vz(t){let e,n;return e=new Xf({props:{$$slots:{map:[_z],sidebar:[fz],top:[oz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&2097279&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function bz(t,e,n){let r,i,a,c,u,m,w;Pt(t,ff,Y=>n(0,r=Y)),Pt(t,Ic,Y=>n(1,i=Y)),Pt(t,Ys,Y=>n(14,a=Y)),Pt(t,Vg,Y=>n(2,c=Y)),Pt(t,px,Y=>n(3,u=Y)),Pt(t,hf,Y=>n(4,m=Y)),Pt(t,Zl,Y=>n(15,w=Y));let S=null,E="";async function P(Y,oe,_e,se,ce){try{n(5,S=await w.route({start:Y,end:[oe.lng,oe.lat],mode:_e,debugSearch:!1,useHeuristic:u,startTime:c})),n(6,E="")}catch(me){n(5,S=null),n(6,E=me.toString())}}function D(Y){Hn(Ic,i=Y.detail.lngLat,i)}async function k(){try{let Y=await w.route({start:i,end:[r.lng,r.lat],mode:m,debugSearch:!0,useHeuristic:u,startTime:c});Hn(Ys,a={kind:"debug-route",debugGj:Y,start:i,end:r,routeGj:S},a)}catch(Y){n(6,E=Y.toString())}}function V(Y){i=Y,Ic.set(i)}function j(Y){r=Y,ff.set(r)}function te(Y){m=Y,hf.set(m)}function U(){u=this.checked,px.set(u)}function W(){c=this.value,Vg.set(c)}return t.$$.update=()=>{t.$$.dirty&31&&P(i,r,m)},[r,i,c,u,m,S,E,D,k,V,j,te,U,W]}class xz extends Qt{constructor(e){super(),Jt(this,e,bz,vz,Gt,{})}}function wz(t){let e,n,r,i;return{c(){e=Ne("div"),n=Ne("button"),n.textContent="Back",Ve(e,"slot","top")},m(a,c){De(a,e,c),Se(e,n),r||(i=Wt(n,"click",t[10]),r=!0)},p:yt,d(a){a&&ke(e),r=!1,i()}}}function Sz(t){let e,n,r,i,a,c,u,m,w,S=ul(t[4].features[t[4].features.length-1].properties).time+"",E,P,D;return{c(){e=Ne("div"),n=Ne("h2"),n.textContent="Debugging a route",r=rt(),i=Ne("p"),i.textContent=`${t[6]} total nodes searched`,a=rt(),c=Ne("input"),u=rt(),m=Ne("p"),w=It("Search is currently at "),E=It(S),Ve(c,"type","range"),Ve(c,"min","1"),Ve(c,"max",t[6]),Ve(e,"slot","sidebar")},m(k,V){De(k,e,V),Se(e,n),Se(e,r),Se(e,i),Se(e,a),Se(e,c),Go(c,t[3]),Se(e,u),Se(e,m),Se(m,w),Se(m,E),P||(D=[Wt(c,"change",t[9]),Wt(c,"input",t[9])],P=!0)},p(k,V){V&8&&Go(c,k[3]),V&16&&S!==(S=ul(k[4].features[k[4].features.length-1].properties).time+"")&&Bn(E,S)},d(k){k&&ke(e),P=!1,Ni(D)}}}function Ez(t){let e;return{c(){e=Ne("span"),e.textContent="A",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function Iz(t){let e;return{c(){e=Ne("span"),e.textContent="B",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function Cz(t){let e,n;return e=new Kc({props:{paint:{"line-width":20,"line-color":d1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function Tz(t){let e,n,r,i;return e=new Vy({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new Kc({props:{paint:{"line-width":5,"line-color":d1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){lt(e.$$.fragment),n=rt(),lt(r.$$.fragment)},m(a,c){st(e,a,c),De(a,n,c),st(r,a,c),i=!0},p:yt,i(a){i||(be(e.$$.fragment,a),be(r.$$.fragment,a),i=!0)},o(a){Te(e.$$.fragment,a),Te(r.$$.fragment,a),i=!1},d(a){a&&ke(n),at(e,a),at(r,a)}}}function Lz(t){let e,n,r,i,a,c,u,m,w;return n=new zd({props:{lngLat:t[0],$$slots:{default:[Ez]},$$scope:{ctx:t}}}),i=new zd({props:{lngLat:t[1],$$slots:{default:[Iz]},$$scope:{ctx:t}}}),c=new ru({props:{data:t[2],$$slots:{default:[Cz]},$$scope:{ctx:t}}}),m=new ru({props:{data:t[4],generateId:!0,$$slots:{default:[Tz]},$$scope:{ctx:t}}}),{c(){e=Ne("div"),lt(n.$$.fragment),r=rt(),lt(i.$$.fragment),a=rt(),lt(c.$$.fragment),u=rt(),lt(m.$$.fragment),Ve(e,"slot","map")},m(S,E){De(S,e,E),st(n,e,null),Se(e,r),st(i,e,null),Se(e,a),st(c,e,null),Se(e,u),st(m,e,null),w=!0},p(S,E){const P={};E&1&&(P.lngLat=S[0]),E&4096&&(P.$$scope={dirty:E,ctx:S}),n.$set(P);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 V={};E&16&&(V.data=S[4]),E&4096&&(V.$$scope={dirty:E,ctx:S}),m.$set(V)},i(S){w||(be(n.$$.fragment,S),be(i.$$.fragment,S),be(c.$$.fragment,S),be(m.$$.fragment,S),w=!0)},o(S){Te(n.$$.fragment,S),Te(i.$$.fragment,S),Te(c.$$.fragment,S),Te(m.$$.fragment,S),w=!1},d(S){S&&ke(e),at(n),at(i),at(c),at(m)}}}function Pz(t){let e,n,r,i;return e=new Xf({props:{$$slots:{map:[Lz],sidebar:[Sz],top:[wz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(a,c){st(e,a,c),n=!0,r||(i=Wt(window,"keydown",t[7]),r=!0)},p(a,[c]){const u={};c&4159&&(u.$$scope={dirty:c,ctx:a}),e.$set(u)},i(a){n||(be(e.$$.fragment,a),n=!0)},o(a){Te(e.$$.fragment,a),n=!1},d(a){at(e,a),r=!1,i()}}}function Mz(t,e,n){let r,i,a;Pt(t,vy,V=>n(11,i=V)),Pt(t,Ys,V=>n(5,a=V));let{debugGj:c}=e,{start:u}=e,{end:m}=e,{routeGj:w}=e,S=c.features.length/2,E=1;function P(V){V.key=="ArrowLeft"&&E>1&&(V.stopPropagation(),n(3,E--,E)),V.key=="ArrowRight"&&E{i==null||i.keyboard.disable()}),as(()=>{i==null||i.keyboard.enable()});function D(){E=YL(this.value),n(3,E)}const k=()=>Hn(Ys,a={kind:"route"},a);return t.$$set=V=>{"debugGj"in V&&n(8,c=V.debugGj),"start"in V&&n(0,u=V.start),"end"in V&&n(1,m=V.end),"routeGj"in V&&n(2,w=V.routeGj)},t.$$.update=()=>{t.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:c.features.slice(0,2*E)})},[u,m,w,E,r,a,S,P,c,D,k]}class Az extends Qt{constructor(e){super(),Jt(this,e,Mz,Pz,Gt,{debugGj:8,start:0,end:1,routeGj:2})}}function PS(t){let e,n;return e=new RC({props:{loading:t[2]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&4&&(a.loading=r[2]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function MS(t){let e,n,r=t[1].properties.poi+"",i,a,c=t[1].properties.cost+"",u,m;return{c(){e=Ne("span"),n=It("From "),i=It(r),a=It(", it's "),u=It(c),m=It(" seconds to the nearest parking")},m(w,S){De(w,e,S),Se(e,n),Se(e,i),Se(e,a),Se(e,u),Se(e,m)},p(w,S){S&2&&r!==(r=w[1].properties.poi+"")&&Bn(i,r),S&2&&c!==(c=w[1].properties.cost+"")&&Bn(u,c)},d(w){w&&ke(e)}}}function kz(t){let e,n,r,i;n=new Uy({});let a=t[1]&&MS(t);return{c(){e=Ne("div"),lt(n.$$.fragment),r=rt(),a&&a.c(),Ve(e,"slot","top"),zr(e,"display","flex"),zr(e,"justify-content","space-between")},m(c,u){De(c,e,u),st(n,e,null),Se(e,r),a&&a.m(e,null),i=!0},p(c,u){c[1]?a?a.p(c,u):(a=MS(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i(c){i||(be(n.$$.fragment,c),i=!0)},o(c){Te(n.$$.fragment,c),i=!1},d(c){c&&ke(e),at(n),a&&a.d()}}}function Dz(t){let e,n,r,i,a,c,u,m,w,S;function E(D){t[7](D)}let P={};return t[0]!==void 0&&(P.enabled=t[0]),i=new M5({props:P}),Zn.push(()=>ao(i,"enabled",E)),u=new oE({props:{colorScale:Fd,limits:t[5]}}),{c(){e=Ne("div"),n=Ne("h2"),n.textContent="Score mode",r=rt(),lt(i.$$.fragment),c=rt(),lt(u.$$.fragment),m=rt(),w=Ne("p"),w.textContent=`This is an early experiment of a mode to show an "access score". Right - now, it's starting from every POI based on the types chosen below and - walking up to 10 minutes 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.`,Ve(e,"slot","sidebar")},m(D,k){De(D,e,k),Se(e,n),Se(e,r),st(i,e,null),Se(e,c),st(u,e,null),Se(e,m),Se(e,w),S=!0},p(D,k){const V={};!a&&k&1&&(a=!0,V.enabled=D[0],so(()=>a=!1)),i.$set(V)},i(D){S||(be(i.$$.fragment,D),be(u.$$.fragment,D),S=!0)},o(D){Te(i.$$.fragment,D),Te(u.$$.fragment,D),S=!1},d(D){D&&ke(e),at(i),at(u)}}}function AS(t){let e,n;return e=new ru({props:{data:t[3],generateId:!0,$$slots:{default:[Rz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.data=r[3]),i&4098&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function Rz(t){let e,n,r;function i(c){t[6](c)}let a={paint:{"circle-radius":15,"circle-color":dv(["get","cost"],t[5],Fd),"circle-stroke-width":$d(1,3),"circle-stroke-color":"black"},manageHoverState:!0,eventsIfTopMost:!0};return t[1]!==void 0&&(a.hovered=t[1]),e=new Vy({props:a}),Zn.push(()=>ao(e,"hovered",i)),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,u){const m={};!n&&u&2&&(n=!0,m.hovered=c[1],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function kS(t){let e,n;return e=new ru({props:{data:t[4],$$slots:{default:[Nz]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.data=r[4]),i&4096&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function Nz(t){let e,n;return e=new Kc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function Oz(t){let e,n,r,i=t[3]&&AS(t),a=t[4]&&kS(t);return{c(){e=Ne("div"),i&&i.c(),n=rt(),a&&a.c(),Ve(e,"slot","map")},m(c,u){De(c,e,u),i&&i.m(e,null),Se(e,n),a&&a.m(e,null),r=!0},p(c,u){c[3]?i?(i.p(c,u),u&8&&be(i,1)):(i=AS(c),i.c(),be(i,1),i.m(e,n)):i&&(kn(),Te(i,1,1,()=>{i=null}),Dn()),c[4]?a?(a.p(c,u),u&16&&be(a,1)):(a=kS(c),a.c(),be(a,1),a.m(e,null)):a&&(kn(),Te(a,1,1,()=>{a=null}),Dn())},i(c){r||(be(i),be(a),r=!0)},o(c){Te(i),Te(a),r=!1},d(c){c&&ke(e),i&&i.d(),a&&a.d()}}}function zz(t){let e,n,r,i=t[3]==null&&PS(t);return n=new Xf({props:{$$slots:{map:[Oz],sidebar:[Dz],top:[kz]},$$scope:{ctx:t}}}),{c(){i&&i.c(),e=rt(),lt(n.$$.fragment)},m(a,c){i&&i.m(a,c),De(a,e,c),st(n,a,c),r=!0},p(a,[c]){a[3]==null?i?(i.p(a,c),c&8&&be(i,1)):(i=PS(a),i.c(),be(i,1),i.m(e.parentNode,e)):i&&(kn(),Te(i,1,1,()=>{i=null}),Dn());const u={};c&4123&&(u.$$scope={dirty:c,ctx:a}),n.$set(u)},i(a){r||(be(i),be(n.$$.fragment,a),r=!0)},o(a){Te(i),Te(n.$$.fragment,a),r=!1},d(a){a&&ke(e),i&&i.d(a),at(n,a)}}}function Fz(t,e,n){let r;Pt(t,Zl,V=>n(8,r=V));let i=[],a=[],c=null;async function u(V){n(2,i=[...i,"Calculating scores"]),n(3,c=await r.score({poiKinds:a},Iv(m))),n(2,i=[])}function m(V){n(2,i=[...i,V])}let w=null,S=Array.from(Array(6).keys()).map(V=>60*10/(6-1)*V),E;async function P(V){if(E)try{n(4,w=await r.route({start:{lng:E.geometry.coordinates[0],lat:E.geometry.coordinates[1]},end:[E.properties.closest_lon,E.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(j){console.log(`No route: ${j}`),n(4,w=null)}else n(4,w=null)}function D(V){E=V,n(1,E)}function k(V){a=V,n(0,a)}return t.$$.update=()=>{t.$$.dirty&1&&u(),t.$$.dirty&2&&P()},[a,E,i,c,w,S,D,k]}class Bz extends Qt{constructor(e){super(),Jt(this,e,Fz,zz,Gt,{})}}var wo=63710088e-1,v1={centimeters:wo*100,centimetres:wo*100,degrees:wo/111325,feet:wo*3.28084,inches:wo*39.37,kilometers:wo/1e3,kilometres:wo/1e3,meters:wo,metres:wo,miles:wo/1609.344,millimeters:wo*1e3,millimetres:wo*1e3,nauticalmiles:wo/1852,radians:1,yards:wo*1.0936},Vz={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/wo,yards:1.0936133},_v={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ha(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function Uz(t,e,n){switch(t){case"Point":return rs(e).geometry;case"LineString":return Js(e).geometry;case"Polygon":return b1(e).geometry;case"MultiPoint":return OC(e).geometry;case"MultiLineString":return NC(e).geometry;case"MultiPolygon":return zC(e).geometry;default:throw new Error(t+" is invalid")}}function rs(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!gy(t[0])||!gy(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ha(r,e,n)}function Gz(t,e,n){return n===void 0&&(n={}),Gc(t.map(function(r){return rs(r,e)}),n)}function b1(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 x1(t,e){e===void 0&&(e="kilometers");var n=v1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function Gy(t,e){e===void 0&&(e="kilometers");var n=v1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function Zz(t,e){return Bd(Gy(t,e))}function Xz(t){var e=t%360;return e<0&&(e+=360),e}function Bd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function Qs(t){var e=t%360;return e*Math.PI/180}function Yz(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 x1(Gy(t,e),n)}function Kz(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=_v[e];if(!r)throw new Error("invalid original units");var i=_v[n];if(!i)throw new Error("invalid final units");return t/r*i}function gy(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function w1(t){return!!t&&t.constructor===Object}function Jz(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(!gy(e))throw new Error("bbox must only contain numbers")})}function Qz(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 $z=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:_v,bearingToAzimuth:Xz,convertArea:Kz,convertLength:Yz,degreesToRadians:Qs,earthRadius:wo,factors:v1,feature:ha,featureCollection:Gc,geometry:Uz,geometryCollection:Wz,isNumber:gy,isObject:w1,lengthToDegrees:Zz,lengthToRadians:Gy,lineString:Js,lineStrings:jz,multiLineString:NC,multiPoint:OC,multiPolygon:zC,point:rs,points:Gz,polygon:b1,polygons:qz,radiansToDegrees:Bd,radiansToLength:x1,round:Hz,unitsFactors:Vz,validateBBox:Jz,validateId:Qz},Symbol.toStringTag,{value:"Module"}));function Vd(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 zf(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 FC(t,e,n){if(n===void 0&&(n={}),n.final===!0)return eF(t,e);var r=Vd(t),i=Vd(e),a=Qs(r[0]),c=Qs(i[0]),u=Qs(r[1]),m=Qs(i[1]),w=Math.sin(c-a)*Math.cos(m),S=Math.cos(u)*Math.sin(m)-Math.sin(u)*Math.cos(m)*Math.cos(c-a);return Bd(Math.atan2(w,S))}function eF(t,e){var n=FC(e,t);return n=(n+180)%360,n}function nd(t,e,n){n===void 0&&(n={});var r=Vd(t),i=Vd(e),a=Qs(i[1]-r[1]),c=Qs(i[0]-r[0]),u=Qs(r[1]),m=Qs(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(u)*Math.cos(m);return x1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function DS(t,e,n,r){r===void 0&&(r={});var i=Vd(t),a=Qs(i[0]),c=Qs(i[1]),u=Qs(n),m=Gy(e,r.units),w=Math.asin(Math.sin(c)*Math.cos(m)+Math.cos(c)*Math.sin(m)*Math.cos(u)),S=a+Math.atan2(Math.sin(u)*Math.sin(m)*Math.cos(c),Math.cos(m)-Math.sin(c)*Math.sin(w)),E=Bd(S),P=Bd(w);return rs([E,P],r.properties)}function em(t,e,n){if(t!==null)for(var r,i,a,c,u,m,w,S=0,E=0,P,D=t.type,k=D==="FeatureCollection",V=D==="Feature",j=k?t.features.length:1,te=0;tem||k>w||V>S){u=E,m=r,w=k,S=V,a=0;return}var j=Js([u,E],n.properties);if(e(j,r,i,V,a)===!1)return!1;a++,u=E})===!1)return!1}}})}function aF(t,e,n){var r=n,i=!1;return VC(t,function(a,c,u,m,w){i===!1&&n===void 0?r=a:r=e(r,a,c,u,m,w),i=!0}),r}function UC(t,e){if(!t)throw new Error("geojson is required");Yf(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ui?n:i,w=r>a?r:a;return[c,u,m,w]}var E1={exports:{}},GC={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Ud,function(){function n(U,W,Y,oe,_e){(function se(ce,me,Le,Z,fe){for(;Z>Le;){if(Z-Le>600){var Ke=Z-Le+1,Ee=me-Le+1,Ze=Math.log(Ke),tt=.5*Math.exp(2*Ze/3),qe=.5*Math.sqrt(Ze*tt*(Ke-tt)/Ke)*(Ee-Ke/2<0?-1:1),Ot=Math.max(Le,Math.floor(me-Ee*tt/Ke+qe)),wt=Math.min(Z,Math.floor(me+(Ke-Ee)*tt/Ke+qe));se(ce,me,Ot,wt,fe)}var un=ce[me],qt=Le,At=Z;for(r(ce,Le,me),fe(ce[Z],un)>0&&r(ce,Le,Z);qt0;)At--}fe(ce[Le],un)===0?r(ce,Le,At):r(ce,++At,Z),At<=me&&(Le=At+1),me<=At&&(Z=At-1)}})(U,W,Y||0,oe||U.length-1,_e||i)}function r(U,W,Y){var oe=U[W];U[W]=U[Y],U[Y]=oe}function i(U,W){return UW?1:0}var a=function(U){U===void 0&&(U=9),this._maxEntries=Math.max(4,U),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(U,W,Y){if(!Y)return W.indexOf(U);for(var oe=0;oe=U.minX&&W.maxY>=U.minY}function j(U){return{children:U,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function te(U,W,Y,oe,_e){for(var se=[W,Y];se.length;)if(!((Y=se.pop())-(W=se.pop())<=oe)){var ce=W+Math.ceil((Y-W)/oe/2)*oe;n(U,ce,W,Y,_e),se.push(W,ce,ce,Y)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(U){var W=this.data,Y=[];if(!V(U,W))return Y;for(var oe=this.toBBox,_e=[];W;){for(var se=0;se=0&&_e[W].children.length>this._maxEntries;)this._split(_e,W),W--;this._adjustParentBBoxes(oe,_e,W)},a.prototype._split=function(U,W){var Y=U[W],oe=Y.children.length,_e=this._minEntries;this._chooseSplitAxis(Y,_e,oe);var se=this._chooseSplitIndex(Y,_e,oe),ce=j(Y.children.splice(se,Y.children.length-se));ce.height=Y.height,ce.leaf=Y.leaf,u(Y,this.toBBox),u(ce,this.toBBox),W?U[W-1].children.push(ce):this._splitRoot(Y,ce)},a.prototype._splitRoot=function(U,W){this.data=j([U,W]),this.data.height=U.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(U,W,Y){for(var oe,_e,se,ce,me,Le,Z,fe=1/0,Ke=1/0,Ee=W;Ee<=Y-W;Ee++){var Ze=m(U,0,Ee,this.toBBox),tt=m(U,Ee,Y,this.toBBox),qe=(_e=Ze,se=tt,ce=void 0,me=void 0,Le=void 0,Z=void 0,ce=Math.max(_e.minX,se.minX),me=Math.max(_e.minY,se.minY),Le=Math.min(_e.maxX,se.maxX),Z=Math.min(_e.maxY,se.maxY),Math.max(0,Le-ce)*Math.max(0,Z-me)),Ot=P(Ze)+P(tt);qe=W;fe--){var Ke=U.children[fe];w(ce,U.leaf?_e(Ke):Ke),me+=D(ce)}return me},a.prototype._adjustParentBBoxes=function(U,W,Y){for(var oe=Y;oe>=0;oe--)w(W[oe],U)},a.prototype._condense=function(U){for(var W=U.length-1,Y=void 0;W>=0;W--)U[W].children.length===0?W>0?(Y=U[W-1].children).splice(Y.indexOf(U[W]),1):this.clear():u(U[W],this.toBBox)},a})})(GC);var mF=GC.exports;const gF=by($z),yF=by(hF),_F=by(rD);var $a=mF,qC=gF,jC=yF,$h=_F.default,vF=jC.featureEach;jC.coordEach;qC.polygon;var NS=qC.featureCollection;function WC(t){var e=new $a(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:$h(n),$a.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:$h(i),r.push(i)}):vF(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:$h(i),r.push(i)}),$a.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:$h(n),$a.prototype.remove.call(this,n,r)},e.clear=function(){return $a.prototype.clear.call(this)},e.search=function(n){var r=$a.prototype.search.call(this,this.toBBox(n));return NS(r)},e.collides=function(n){return $a.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=$a.prototype.all.call(this);return NS(n)},e.toJSON=function(){return $a.prototype.toJSON.call(this)},e.fromJSON=function(n){return $a.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=$h(n);else if(n.type==="FeatureCollection")r=$h(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}E1.exports=WC;E1.exports.default=WC;var bF=E1.exports;const xF=Cv(bF);function wF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=ha(t)),e.type==="LineString"&&(e=ha(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=OS(t,e);return i&&r.push(i),Gc(r)}var a=xF();return a.load(RS(e)),yy(RS(t),function(c){yy(a.search(c),function(u){var m=OS(c,u);if(m){var w=zf(m).join(",");n[w]||(n[w]=!0,r.push(m))}})}),Gc(r)}function OS(t,e){var n=zf(t),r=zf(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],c=n[1][0],u=n[1][1],m=r[0][0],w=r[0][1],S=r[1][0],E=r[1][1],P=(E-w)*(c-i)-(S-m)*(u-a),D=(S-m)*(a-w)-(E-w)*(i-m),k=(c-i)*(a-w)-(u-a)*(i-m);if(P===0)return null;var V=D/P,j=k/P;if(V>=0&&V<=1&&j>=0&&j<=1){var te=i+V*(c-i),U=a+V*(u-a);return rs([te,U])}return null}function SF(t,e,n){n===void 0&&(n={});var r=rs([1/0,1/0],{dist:1/0}),i=0;return Yf(t,function(a){for(var c=zf(a),u=0;u0&&(j=V.features[0],j.properties.dist=nd(e,j,n),j.properties.location=i+nd(m,j,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()}});yi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(zS(this.points).forEach((r,i)=>{n.push([i+1,SF(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))});yi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=E0(e.lngLat.toArray()),this.onClick(e),this.finish())});yi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});yi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});yi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});yi(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=E0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat(zS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),ZC.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,XC.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=E0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(HC),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>TF&&this.previousStates.shift()}}function zS(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 PF(t){let e,n,r;return{c(){e=It("Undo ("),n=It(t[1]),r=It(")")},m(i,a){De(i,e,a),De(i,n,a),De(i,r,a)},p(i,a){a&2&&Bn(n,i[1])},d(i){i&&(ke(e),ke(n),ke(r))}}}function MF(t){let e;return{c(){e=It("Undo")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function AF(t){let e,n,r,i,a,c,u,m,w,S,E;function P(V,j){return V[1]==0?MF:PF}let D=P(t),k=D(t);return{c(){e=Ne("div"),n=Ne("button"),n.textContent="Finish",r=rt(),i=Ne("button"),i.textContent="Cancel",a=rt(),c=Ne("button"),k.c(),m=rt(),w=Ne("ul"),w.innerHTML=`
  • Click - the map to add a vertex
  • Click - a vertex to delete it
  • Drag - a vertex or the polygon to move it
  • Press Control+Z - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `,c.disabled=u=t[1]==0,zr(e,"display","flex"),zr(e,"justify-content","space-between")},m(V,j){De(V,e,j),Se(e,n),Se(e,r),Se(e,i),Se(e,a),Se(e,c),k.m(c,null),De(V,m,j),De(V,w,j),S||(E=[Wt(n,"click",t[2]),Wt(i,"click",t[3]),Wt(c,"click",t[4])],S=!0)},p(V,[j]){D===(D=P(V))&&k?k.p(V,j):(k.d(1),k=D(V),k&&(k.c(),k.m(c,null))),j&2&&u!==(u=V[1]==0)&&(c.disabled=u)},i:yt,o:yt,d(V){V&&(ke(e),ke(m),ke(w)),k.d(),S=!1,Ni(E)}}}function kF(t,e,n){let r;Pt(t,XC,m=>n(1,r=m));let{polygonTool:i}=e;const a=()=>i.finish(),c=()=>i.cancel(),u=()=>i.undo();return t.$$set=m=>{"polygonTool"in m&&n(0,i=m.polygonTool)},[i,r,a,c,u]}class DF extends Qt{constructor(e){super(),Jt(this,e,kF,AF,Gt,{polygonTool:0})}}let RF=Date.now();function tm(t){return`${t}-${RF++}`}const YC=Symbol.for("svelte-maplibre");function NF(){return bv(YC)}function FS(t){return{subscribe:t.subscribe}}function KC({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=NF(),a=sr(null),c=FS(a),u={...i,[t]:FS(a)};if(e&&(u.popupTarget=c),r){let m=sr(null);u.layerEvent=m,i.layerEvent=m}return n&&(u.cluster=sr()),vv(YC,u),{...i,self:a}}function OF(){return KC({key:"source",setCluster:!0})}function zF(t=!0){return KC({key:"layer",setPopupTarget:t,setMouseEvent:t})}function BS(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 FF(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 BF(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function VS(t){let e=t[0],n,r,i=US(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c[0]&1&&Gt(e,e=a[0])?(kn(),Te(i,1,1,yt),Dn(),i=US(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function US(t){let e;const n=t[36].default,r=ii(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)&&si(r,n,i,i[35],e?oi(n,i[35],a,null):ai(i[35]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function VF(t){let e,n,r=t[0]&&VS(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&be(r,1)):(r=VS(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function UF(t,e,n){let r,i,a,c,u,m,w,S,E,P,D,k,{$$slots:V={},$$scope:j}=e,{id:te=tm("layer")}=e,{source:U=void 0}=e,{sourceLayer:W=void 0}=e,{beforeId:Y=void 0}=e,{beforeLayerType:oe=void 0}=e,{type:_e}=e,{paint:se=void 0}=e,{layout:ce=void 0}=e,{filter:me=void 0}=e,{applyToClusters:Le=void 0}=e,{minzoom:Z=void 0}=e,{maxzoom:fe=void 0}=e,{manageHoverState:Ke=!1}=e,{hovered:Ee=null}=e,{interactive:Ze=!0}=e,{hoverCursor:tt=void 0}=e,{eventsIfTopMost:qe=!1}=e;const Ot=ju(),{map:wt,source:un,self:qt,minzoom:At,maxzoom:hn,eventTopMost:Tn,layerInfo:yn}=zF();Pt(t,wt,ge=>n(31,E=ge)),Pt(t,un,ge=>n(32,P=ge)),Pt(t,qt,ge=>n(0,S=ge)),Pt(t,At,ge=>n(34,k=ge)),Pt(t,hn,ge=>n(33,D=ge)),as(()=>{S&&E&&(yn.delete(S),E==null||E.removeLayer(S))});let _n;function Rn(ge){var Oe,Yt;if(!Ze||!S||!E||qe&&Tn(ge)!==S)return;let Pe=ge.features??[],Ct=(Yt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Yt.cluster_id,Nn={event:ge,map:E,clusterId:Ct,layer:S,source:u,features:Pe};Ot(ge.type,Nn)}function wr(ge){var Oe,Yt;if(!Ze||!S||!E||qe&&Tn(ge)!==S)return;tt&&(E.getCanvas().style.cursor=tt);let Pe=ge.features??[];n(6,Ee=Pe[0]??null);let Ct=(Yt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Yt.cluster_id;Ot("mouseenter",{event:ge,map:E,clusterId:Ct,layer:S,source:u,features:Pe})}function kr(ge){var Oe,Yt,Dr;if(!Ze||!E)return;if(qe&&Tn(ge)!==S){n(6,Ee=null),Ke&&_n!==void 0&&(E==null||E.setFeatureState({source:u,sourceLayer:W,id:_n},{hover:!1}),_n=void 0);return}E.getCanvas().style.cursor=tt;let Pe=ge.features??[],Ct=(Yt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Yt.cluster_id,Nn=(Dr=Pe[0])==null?void 0:Dr.id;Nn!==_n&&(Ke&&(_n!==void 0&&(E==null||E.setFeatureState({source:u,id:_n,sourceLayer:W},{hover:!1})),E==null||E.setFeatureState({source:u,id:Nn,sourceLayer:W},{hover:!0})),_n=Nn,n(6,Ee=Pe[0]??null)),Ot("mousemove",{event:ge,map:E,clusterId:Ct,layer:S,source:u,features:Pe})}function Sr(ge){if(!(!Ze||!S||!E)){if(tt&&(E.getCanvas().style.cursor=""),n(6,Ee=null),Ke&&_n!==void 0){const Pe={source:u,id:_n,sourceLayer:W};E==null||E.setFeatureState(Pe,{hover:!1}),_n=void 0}Ot("mouseleave",{map:E,layer:S,source:u})}}let dr=!0;function Qe(ge){E&&(E.off("click",ge,Rn),E.off("dblclick",ge,Rn),E.off("contextmenu",ge,Rn),E.off("mouseenter",ge,wr),E.off("mousemove",ge,kr),E.off("mouseleave",ge,Sr))}return as(()=>{E&&S&&Qe(S)}),t.$$set=ge=>{"id"in ge&&n(7,te=ge.id),"source"in ge&&n(8,U=ge.source),"sourceLayer"in ge&&n(9,W=ge.sourceLayer),"beforeId"in ge&&n(10,Y=ge.beforeId),"beforeLayerType"in ge&&n(11,oe=ge.beforeLayerType),"type"in ge&&n(12,_e=ge.type),"paint"in ge&&n(13,se=ge.paint),"layout"in ge&&n(14,ce=ge.layout),"filter"in ge&&n(15,me=ge.filter),"applyToClusters"in ge&&n(16,Le=ge.applyToClusters),"minzoom"in ge&&n(17,Z=ge.minzoom),"maxzoom"in ge&&n(18,fe=ge.maxzoom),"manageHoverState"in ge&&n(19,Ke=ge.manageHoverState),"hovered"in ge&&n(6,Ee=ge.hovered),"interactive"in ge&&n(20,Ze=ge.interactive),"hoverCursor"in ge&&n(21,tt=ge.hoverCursor),"eventsIfTopMost"in ge&&n(22,qe=ge.eventsIfTopMost),"$$scope"in ge&&n(35,j=ge.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=BF(Le)),t.$$.dirty[0]&1073774592&&n(24,i=FF("all",r,me)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Z??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=fe??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,u=U||P),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==te&&u){S&&(Qe(S),yn.delete(S));let ge=Y;if(!Y&&oe){let Pe=E.getStyle().layers,Ct=typeof oe=="function"?oe:Oe=>Oe.type===oe,Nn=Pe==null?void 0:Pe.find(Ct);Nn&&(ge=Nn.id)}Hn(qt,S=te,S),E.addLayer(Uc({id:S,type:_e,source:u,"source-layer":W,filter:i,paint:se,layout:ce,minzoom:a,maxzoom:c}),ge),n(23,dr=!0),E.on("click",S,Rn),E.on("dblclick",S,Rn),E.on("contextmenu",S,Rn),E.on("mouseenter",S,wr),E.on("mousemove",S,kr),E.on("mouseleave",S,Sr)}t.$$.dirty[0]&1048577&&S&&yn.set(S,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,m=S?BS((ge,Pe)=>E==null?void 0:E.setPaintProperty(S,ge,Pe)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?BS((ge,Pe)=>E==null?void 0:E.setLayoutProperty(S,ge,Pe)):void 0),t.$$.dirty[0]&268443648&&(m==null||m(se)),t.$$.dirty[0]&134234112&&(w==null||w(ce)),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&&(dr?n(23,dr=!1):E==null||E.setFilter(S,i))},[S,wt,un,qt,At,hn,Ee,te,U,W,Y,oe,_e,se,ce,me,Le,Z,fe,Ke,Ze,tt,qe,dr,i,c,a,w,m,u,r,E,P,D,k,j,V]}class I1 extends Qt{constructor(e){super(),Jt(this,e,UF,VF,Gt,{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 GF(t){let e;const n=t[16].default,r=ii(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)&&si(r,n,i,i[24],e?oi(n,i[24],a,null):ai(i[24]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function qF(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:[GF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new I1({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&2&&(m.id=c[1]),u&4&&(m.source=c[2]),u&8&&(m.sourceLayer=c[3]),u&16&&(m.beforeId=c[4]),u&32&&(m.beforeLayerType=c[5]),u&64&&(m.paint=c[6]),u&128&&(m.layout=c[7]),u&256&&(m.filter=c[8]),u&512&&(m.applyToClusters=c[9]),u&1024&&(m.minzoom=c[10]),u&2048&&(m.maxzoom=c[11]),u&4096&&(m.hoverCursor=c[12]),u&8192&&(m.manageHoverState=c[13]),u&16384&&(m.eventsIfTopMost=c[14]),u&32768&&(m.interactive=c[15]),u&16777216&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function jF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tm("circle")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:V=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:te=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:Y=!0}=e;function oe(fe){U=fe,n(0,U)}function _e(fe){In.call(this,t,fe)}function se(fe){In.call(this,t,fe)}function ce(fe){In.call(this,t,fe)}function me(fe){In.call(this,t,fe)}function Le(fe){In.call(this,t,fe)}function Z(fe){In.call(this,t,fe)}return t.$$set=fe=>{"id"in fe&&n(1,a=fe.id),"source"in fe&&n(2,c=fe.source),"sourceLayer"in fe&&n(3,u=fe.sourceLayer),"beforeId"in fe&&n(4,m=fe.beforeId),"beforeLayerType"in fe&&n(5,w=fe.beforeLayerType),"paint"in fe&&n(6,S=fe.paint),"layout"in fe&&n(7,E=fe.layout),"filter"in fe&&n(8,P=fe.filter),"applyToClusters"in fe&&n(9,D=fe.applyToClusters),"minzoom"in fe&&n(10,k=fe.minzoom),"maxzoom"in fe&&n(11,V=fe.maxzoom),"hoverCursor"in fe&&n(12,j=fe.hoverCursor),"manageHoverState"in fe&&n(13,te=fe.manageHoverState),"hovered"in fe&&n(0,U=fe.hovered),"eventsIfTopMost"in fe&&n(14,W=fe.eventsIfTopMost),"interactive"in fe&&n(15,Y=fe.interactive),"$$scope"in fe&&n(24,i=fe.$$scope)},[U,a,c,u,m,w,S,E,P,D,k,V,j,te,W,Y,r,oe,_e,se,ce,me,Le,Z,i]}class WF extends Qt{constructor(e){super(),Jt(this,e,jF,qF,Gt,{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 HF(t){let e;const n=t[15].default,r=ii(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)&&si(r,n,i,i[23],e?oi(n,i[23],a,null):ai(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function ZF(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:[HF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new I1({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&2&&(m.id=c[1]),u&4&&(m.source=c[2]),u&8&&(m.sourceLayer=c[3]),u&16&&(m.beforeId=c[4]),u&32&&(m.beforeLayerType=c[5]),u&64&&(m.paint=c[6]),u&128&&(m.layout=c[7]),u&256&&(m.filter=c[8]),u&512&&(m.minzoom=c[9]),u&1024&&(m.maxzoom=c[10]),u&2048&&(m.hoverCursor=c[11]),u&4096&&(m.manageHoverState=c[12]),u&8192&&(m.eventsIfTopMost=c[13]),u&16384&&(m.interactive=c[14]),u&8388608&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function XF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tm("fill")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:V=void 0}=e,{manageHoverState:j=!1}=e,{hovered:te=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:W=!0}=e;function Y(Z){te=Z,n(0,te)}function oe(Z){In.call(this,t,Z)}function _e(Z){In.call(this,t,Z)}function se(Z){In.call(this,t,Z)}function ce(Z){In.call(this,t,Z)}function me(Z){In.call(this,t,Z)}function Le(Z){In.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,u=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,V=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,te=Z.hovered),"eventsIfTopMost"in Z&&n(13,U=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[te,a,c,u,m,w,S,E,P,D,k,V,j,U,W,r,Y,oe,_e,se,ce,me,Le,i]}class YF extends Qt{constructor(e){super(),Jt(this,e,XF,ZF,Gt,{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 u=()=>{e&&(t.getSource(e)?setTimeout(u,1):c())};u()}else c()}function JF(t,e,n){iE().then(()=>{let r=$S(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function GS(t){let e=t[0],n,r,i=qS(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c&1&&Gt(e,e=a[0])?(kn(),Te(i,1,1,yt),Dn(),i=qS(a),i.c(),be(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(be(i),r=!0)},o(a){Te(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function qS(t){let e;const n=t[15].default,r=ii(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)&&si(r,n,i,i[14],e?oi(n,i[14],a,null):ai(i[14]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function QF(t){let e,n,r=t[0]&&GS(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&be(r,1)):(r=GS(i),r.c(),be(r,1),r.m(e.parentNode,e)):r&&(kn(),Te(r,1,1,()=>{r=null}),Dn())},i(i){n||(be(r),n=!0)},o(i){Te(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function $F(t,e,n){let r,i,a,{$$slots:c={},$$scope:u}=e,{id:m=tm("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:P=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:k=void 0}=e;const{map:V,cluster:j,self:te}=OF();Pt(t,V,Y=>n(13,i=Y)),Pt(t,j,Y=>n(16,a=Y)),Pt(t,te,Y=>n(0,r=Y));let U,W=!0;return as(()=>{r&&U&&i&&(JF(V,r,U),Hn(te,r=null,r),n(11,U=void 0))}),t.$$set=Y=>{"id"in Y&&n(4,m=Y.id),"data"in Y&&n(5,w=Y.data),"generateId"in Y&&n(6,S=Y.generateId),"promoteId"in Y&&n(7,E=Y.promoteId),"filter"in Y&&n(8,P=Y.filter),"lineMetrics"in Y&&n(9,D=Y.lineMetrics),"cluster"in Y&&n(10,k=Y.cluster),"$$scope"in Y&&n(14,u=Y.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Hn(j,a=k,a),t.$$.dirty&12273&&i&&r!==m&&(Hn(te,r=m,r),KF(i,r,Uc({type:"geojson",data:w,filter:P,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}),Y=>i&&Y===r,()=>{r&&(n(11,U=i==null?void 0:i.getSource(r)),n(12,W=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,U=i==null?void 0:i.getSource(m))})),t.$$.dirty&6176&&U&&(W?n(12,W=!1):U.setData(w)),t.$$.dirty&3072&&(U==null||U.setClusterOptions(Uc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,V,j,te,m,w,S,E,P,D,k,U,W,i,u,c]}class e6 extends Qt{constructor(e){super(),Jt(this,e,$F,QF,Gt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function t6(t){let e;const n=t[15].default,r=ii(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)&&si(r,n,i,i[23],e?oi(n,i[23],a,null):ai(i[23]),null)},i(i){e||(be(r,i),e=!0)},o(i){Te(r,i),e=!1},d(i){r&&r.d(i)}}}function n6(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:[t6]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new I1({props:a}),Zn.push(()=>ao(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){lt(e.$$.fragment)},m(c,u){st(e,c,u),r=!0},p(c,[u]){const m={};u&2&&(m.id=c[1]),u&4&&(m.source=c[2]),u&8&&(m.sourceLayer=c[3]),u&16&&(m.beforeId=c[4]),u&32&&(m.beforeLayerType=c[5]),u&64&&(m.paint=c[6]),u&128&&(m.layout=c[7]),u&256&&(m.filter=c[8]),u&512&&(m.minzoom=c[9]),u&1024&&(m.maxzoom=c[10]),u&2048&&(m.hoverCursor=c[11]),u&4096&&(m.manageHoverState=c[12]),u&8192&&(m.eventsIfTopMost=c[13]),u&16384&&(m.interactive=c[14]),u&8388608&&(m.$$scope={dirty:u,ctx:c}),!n&&u&1&&(n=!0,m.hovered=c[0],so(()=>n=!1)),e.$set(m)},i(c){r||(be(e.$$.fragment,c),r=!0)},o(c){Te(e.$$.fragment,c),r=!1},d(c){at(e,c)}}}function r6(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tm("line")}=e,{source:c=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:m=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:V=void 0}=e,{manageHoverState:j=!1}=e,{hovered:te=null}=e,{eventsIfTopMost:U=!1}=e,{interactive:W=!0}=e;function Y(Z){te=Z,n(0,te)}function oe(Z){In.call(this,t,Z)}function _e(Z){In.call(this,t,Z)}function se(Z){In.call(this,t,Z)}function ce(Z){In.call(this,t,Z)}function me(Z){In.call(this,t,Z)}function Le(Z){In.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,u=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,V=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,te=Z.hovered),"eventsIfTopMost"in Z&&n(13,U=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[te,a,c,u,m,w,S,E,P,D,k,V,j,U,W,r,Y,oe,_e,se,ce,me,Le,i]}class i6 extends Qt{constructor(e){super(),Jt(this,e,r6,n6,Gt,{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 o6(t){let e,n,r,i,a,c;return e=new YF({props:{id:"edit-polygon-fill",filter:EF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new i6({props:{id:"edit-polygon-lines",filter:IF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new WF({props:{id:"edit-polygon-vertices",filter:CF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){lt(e.$$.fragment),n=rt(),lt(r.$$.fragment),i=rt(),lt(a.$$.fragment)},m(u,m){st(e,u,m),De(u,n,m),st(r,u,m),De(u,i,m),st(a,u,m),c=!0},p:yt,i(u){c||(be(e.$$.fragment,u),be(r.$$.fragment,u),be(a.$$.fragment,u),c=!0)},o(u){Te(e.$$.fragment,u),Te(r.$$.fragment,u),Te(a.$$.fragment,u),c=!1},d(u){u&&(ke(n),ke(i)),at(e,u),at(r,u),at(a,u)}}}function s6(t){let e,n;return e=new e6({props:{data:t[0],$$slots:{default:[o6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function a6(t,e,n){let r;return Pt(t,ZC,i=>n(0,r=i)),[r]}class l6 extends Qt{constructor(e){super(),Jt(this,e,a6,s6,Gt,{})}}function u6(t){let e,n,r,i,a,c,u;return{c(){e=Ne("button"),e.textContent="Import current view",n=rt(),r=Ne("i"),r.textContent="or...",i=rt(),a=Ne("button"),a.textContent="Draw an area to import on the map",Ve(e,"type","button"),Ve(a,"type","button")},m(m,w){De(m,e,w),De(m,n,w),De(m,r,w),De(m,i,w),De(m,a,w),c||(u=[Wt(e,"click",t[1]),Wt(a,"click",t[2])],c=!0)},p:yt,i:yt,o:yt,d(m){m&&(ke(e),ke(n),ke(r),ke(i),ke(a)),c=!1,Ni(u)}}}function c6(t){let e,n;return e=new DF({props:{polygonTool:t[0]}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function h6(t){let e,n,r,i;const a=[c6,u6],c=[];function u(m,w){return m[0]?0:1}return e=u(t),n=c[e]=a[e](t),{c(){n.c(),r=Ur()},m(m,w){c[e].m(m,w),De(m,r,w),i=!0},p(m,[w]){let S=e;e=u(m),e===S?c[e].p(m,w):(kn(),Te(c[S],1,1,()=>{c[S]=null}),Dn(),n=c[e],n?n.p(m,w):(n=c[e]=a[e](m),n.c()),be(n,1),n.m(r.parentNode,r))},i(m){i||(be(n),i=!0)},o(m){Te(n),i=!1},d(m){m&&ke(r),c[e].d(m)}}}function rd(t){return[t.lng,t.lat]}function f6(t,e,n){let{map:r}=e;const i=ju();let a=null;async function c(S){try{i("loading","Loading from Overpass");let P=await(await fetch(d6(S))).text();i("gotXml",P)}catch(E){i("error",E.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[rd(S.getSouthWest()),rd(S.getNorthWest()),rd(S.getNorthEast()),rd(S.getSouthEast()),rd(S.getSouthWest())]],type:"Polygon"}}}async function m(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await c(u())}}function w(){r&&(n(0,a=new LF(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 p6 extends Qt{constructor(e){super(),Jt(this,e,f6,h6,Gt,{map:3})}}function d6(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 jS(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function WS(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function HS(t){let e,n=t[26]+"",r,i;return{c(){e=Ne("option"),r=It(n),e.__value=i=t[25],Go(e,e.__value)},m(a,c){De(a,e,c),Se(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&Bn(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,Go(e,e.__value))},d(a){a&&ke(e)}}}function ZS(t){let e,n,r=Fr(t[22]),i=[];for(let a=0;at[9].call(c)),Ve(k,"type","file"),Ve(me,"type","file")},m(Ze,tt){st(e,Ze,tt),De(Ze,n,tt),De(Ze,r,tt),Se(r,i),Se(i,a),Se(i,c),Se(c,u);for(let qe=0;qen(15,r=ce)),Pt(t,Zl,ce=>n(16,i=ce)),Pt(t,vy,ce=>n(5,a=ce));let c="",u=[],m=!1,w=[];qu(async()=>{try{let ce=await fetch("/osm/areas.json");if(ce.ok)m=!0,console.log("Using local cache, not od2net.org"),n(2,w=await ce.json());else{let me=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await me.json())}}catch{}});let S;async function E(ce){try{await k(await S.files[0].arrayBuffer()),n(0,c="")}catch(me){window.alert(`Couldn't open this file: ${me}`)}n(1,u=[])}let P;async function D(ce){try{n(1,u=["Loading pre-built file"]);let me=await P.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(me)),console.timeEnd("load"),Hn(lf,r=!0,r),n(0,c="")}catch(me){window.alert(`Couldn't open this file: ${me}`)}n(1,u=[])}async function k(ce){n(1,u=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(ce),Iv(V)),console.timeEnd("load"),Hn(lf,r=!0,r)}function V(ce){n(1,u=[...u,ce])}async function j(ce){try{await k(new TextEncoder().encode(ce.detail)),n(0,c="")}catch(me){window.alert(`Couldn't import from Overpass: ${me}`)}n(1,u=[])}async function te(ce){ce!=""&&(m?await U(`/osm/${ce}.pbf`):await U(`https://assets.od2net.org/severance_pbfs/${ce}.pbf`))}async function U(ce){try{n(1,u=[`Downloading ${ce}`]);let me=await fetch(ce);await k(await me.arrayBuffer())}catch(me){window.alert(`Couldn't open from URL ${ce}: ${me}`)}n(1,u=[])}function W(){c=tE(this),n(0,c),n(2,w)}function Y(ce){Zn[ce?"unshift":"push"](()=>{S=ce,n(3,S)})}const oe=ce=>n(1,u=[...u,ce.detail]),_e=ce=>window.alert(ce.detail);function se(ce){Zn[ce?"unshift":"push"](()=>{P=ce,n(4,P)})}return t.$$.update=()=>{t.$$.dirty&1&&te(c)},[c,u,w,S,P,a,E,D,j,W,Y,oe,_e,se]}class y6 extends Qt{constructor(e){super(),Jt(this,e,g6,m6,Gt,{})}}function _6(t){let e;return{c(){e=Ne("div"),Ve(e,"slot","top")},m(n,r){De(n,e,r)},p:yt,d(n){n&&ke(e)}}}function v6(t){let e;return{c(){e=Ne("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){De(n,e,r)},i:yt,o:yt,d(n){n&&ke(e)}}}function b6(t){let e,n;return e=new y6({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function x6(t){let e,n,r,i,a,c;const u=[b6,v6],m=[];function w(S,E){return S[0]?0:1}return i=w(t),a=m[i]=u[i](t),{c(){e=Ne("div"),n=Ne("h2"),n.textContent="Choose your study area",r=rt(),a.c(),Ve(e,"slot","sidebar")},m(S,E){De(S,e,E),Se(e,n),Se(e,r),m[i].m(e,null),c=!0},p(S,E){let P=i;i=w(S),i!==P&&(kn(),Te(m[P],1,1,()=>{m[P]=null}),Dn(),a=m[i],a||(a=m[i]=u[i](S),a.c()),be(a,1),a.m(e,null))},i(S){c||(be(a),c=!0)},o(S){Te(a),c=!1},d(S){S&&ke(e),m[i].d()}}}function w6(t){let e,n,r;return n=new l6({}),{c(){e=Ne("div"),lt(n.$$.fragment),Ve(e,"slot","map")},m(i,a){De(i,e,a),st(n,e,null),r=!0},p:yt,i(i){r||(be(n.$$.fragment,i),r=!0)},o(i){Te(n.$$.fragment,i),r=!1},d(i){i&&ke(e),at(n)}}}function S6(t){let e,n;return e=new Xf({props:{$$slots:{map:[w6],sidebar:[x6],top:[_6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,[i]){const a={};i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function E6(t,e,n){let r,i,a,c,u;return Pt(t,ff,m=>n(1,r=m)),Pt(t,Ic,m=>n(2,i=m)),Pt(t,Zl,m=>n(3,a=m)),Pt(t,lf,m=>n(4,c=m)),Pt(t,vy,m=>n(0,u=m)),qu(async()=>{Hn(lf,c=!1,c),await a.unset(),Hn(Ic,i=null,i),Hn(ff,r=null,r)}),[u]}class I6 extends Qt{constructor(e){super(),Jt(this,e,E6,S6,Gt,{})}}function C6(){return new Worker("/15m/assets/worker-e9143c35.js")}function T6(t){let e,n,r,i,a,c;return{c(){e=Ne("div"),n=Ne("button"),n.innerHTML=`A/B Street logo`,r=rt(),i=Ne("span"),Ve(n,"class","outline"),zr(i,"width","100%"),Ve(e,"slot","top"),zr(e,"display","flex")},m(u,m){De(u,e,m),Se(e,n),Se(e,r),Se(e,i),t[16](i),a||(c=Wt(n,"click",t[15]),a=!0)},p:yt,d(u){u&&ke(e),t[16](null),a=!1,c()}}}function XS(t){let e,n,r,i,a,c;return{c(){e=Ne("hr"),n=rt(),r=Ne("div"),i=Ne("button"),i.textContent="Zoom to fit"},m(u,m){De(u,e,m),De(u,n,m),De(u,r,m),Se(r,i),a||(c=Wt(i,"click",t[8]),a=!0)},p:yt,d(u){u&&(ke(e),ke(n),ke(r)),a=!1,c()}}}function L6(t){let e,n,r,i,a,c=t[5].kind!="title"&&XS(t);return{c(){e=Ne("div"),n=Ne("h1"),n.textContent="15-minute neighbourhood tool",r=rt(),i=Ne("div"),a=rt(),c&&c.c(),Ve(e,"slot","left")},m(u,m){De(u,e,m),Se(e,n),Se(e,r),Se(e,i),t[14](i),Se(e,a),c&&c.m(e,null)},p(u,m){u[5].kind!="title"?c?c.p(u,m):(c=XS(u),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(u){u&&ke(e),t[14](null),c&&c.d()}}}function YS(t){let e,n;return e=new I6({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function KS(t){let e,n,r,i,a,c,u={ctx:t,current:null,token:null,hasCatch:!1,pending:k6,then:M6,catch:P6,value:20,blocks:[,,,]};nx(e=ul(t[6]).getInvertedBoundary(),u);const m=[z6,O6,N6,R6,D6],w=[];function S(E,P){return E[5].kind=="debug"?0:E[5].kind=="isochrone"?1:E[5].kind=="route"?2:E[5].kind=="score"?3:E[5].kind=="debug-route"?4:-1}return~(r=S(t))&&(i=w[r]=m[r](t)),{c(){u.block.c(),n=rt(),i&&i.c(),a=Ur()},m(E,P){u.block.m(E,u.anchor=P),u.mount=()=>n.parentNode,u.anchor=n,De(E,n,P),~r&&w[r].m(E,P),De(E,a,P),c=!0},p(E,P){t=E,u.ctx=t,P&64&&e!==(e=ul(t[6]).getInvertedBoundary())&&nx(e,u)||eP(u,t,P);let D=r;r=S(t),r===D?~r&&w[r].p(t,P):(i&&(kn(),Te(w[D],1,1,()=>{w[D]=null}),Dn()),~r?(i=w[r],i?i.p(t,P):(i=w[r]=m[r](t),i.c()),be(i,1),i.m(a.parentNode,a)):i=null)},i(E){c||(be(u.block),be(i),c=!0)},o(E){for(let P=0;P<3;P+=1){const D=u.blocks[P];Te(D)}Te(i),c=!1},d(E){E&&(ke(n),ke(a)),u.block.d(E),u.token=null,u=null,~r&&w[r].d(E)}}}function P6(t){return{c:yt,m:yt,p:yt,i:yt,o:yt,d:yt}}function M6(t){let e,n;return e=new ru({props:{data:t[20],$$slots:{default:[A6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[20]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function A6(t){let e,n;return e=new AC({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function k6(t){return{c:yt,m:yt,p:yt,i:yt,o:yt,d:yt}}function D6(t){let e,n;return e=new Az({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.debugGj=r[5].debugGj),i&32&&(a.start=r[5].start),i&32&&(a.end=r[5].end),i&32&&(a.routeGj=r[5].routeGj),e.$set(a)},i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function R6(t){let e,n;return e=new Bz({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function N6(t){let e,n;return e=new xz({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function O6(t){let e,n;return e=new iz({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function z6(t){let e,n;return e=new Z5({}),{c(){lt(e.$$.fragment)},m(r,i){st(e,r,i),n=!0},p:yt,i(r){n||(be(e.$$.fragment,r),n=!0)},o(r){Te(e.$$.fragment,r),n=!1},d(r){at(e,r)}}}function F6(t){let e,n,r,i,a,c,u;e=new BN({props:{map:t[0],apiKey:mE}});let m=t[5].kind=="title"&&YS(),w=t[4]&&KS(t);return{c(){lt(e.$$.fragment),n=rt(),r=Ne("div"),i=rt(),m&&m.c(),a=rt(),w&&w.c(),c=Ur()},m(S,E){st(e,S,E),De(S,n,E),De(S,r,E),t[12](r),De(S,i,E),m&&m.m(S,E),De(S,a,E),w&&w.m(S,E),De(S,c,E),u=!0},p(S,E){const P={};E&1&&(P.map=S[0]),e.$set(P),S[5].kind=="title"?m?E&32&&be(m,1):(m=YS(),m.c(),be(m,1),m.m(a.parentNode,a)):m&&(kn(),Te(m,1,1,()=>{m=null}),Dn()),S[4]?w?(w.p(S,E),E&16&&be(w,1)):(w=KS(S),w.c(),be(w,1),w.m(c.parentNode,c)):w&&(kn(),Te(w,1,1,()=>{w=null}),Dn())},i(S){u||(be(e.$$.fragment,S),be(m),be(w),u=!0)},o(S){Te(e.$$.fragment,S),Te(m),Te(w),u=!1},d(S){S&&(ke(n),ke(r),ke(i),ke(a),ke(c)),at(e,S),t[12](null),m&&m.d(S),w&&w.d(S)}}}function B6(t){let e,n,r,i;function a(u){t[13](u)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${mE}`,standardControls:!0,hash:!0,$$slots:{default:[F6]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new QO({props:c}),Zn.push(()=>ao(n,"map",a)),{c(){e=Ne("div"),lt(n.$$.fragment),Ve(e,"slot","main"),zr(e,"position","relative"),zr(e,"width","100%"),zr(e,"height","100vh")},m(u,m){De(u,e,m),st(n,e,null),i=!0},p(u,m){const w={};m&2097273&&(w.$$scope={dirty:m,ctx:u}),!r&&m&1&&(r=!0,w.map=u[0],so(()=>r=!1)),n.$set(w)},i(u){i||(be(n.$$.fragment,u),i=!0)},o(u){Te(n.$$.fragment,u),i=!1},d(u){u&&ke(e),at(n)}}}function V6(t){let e,n,r,i;return e=new FP({}),r=new l5({props:{$$slots:{main:[B6],left:[L6],top:[T6]},$$scope:{ctx:t}}}),{c(){lt(e.$$.fragment),n=rt(),lt(r.$$.fragment)},m(a,c){st(e,a,c),De(a,n,c),st(r,a,c),i=!0},p(a,[c]){const u={};c&2097407&&(u.$$scope={dirty:c,ctx:a}),r.$set(u)},i(a){i||(be(e.$$.fragment,a),be(r.$$.fragment,a),i=!0)},o(a){Te(e.$$.fragment,a),Te(r.$$.fragment,a),i=!1},d(a){a&&ke(n),at(e,a),at(r,a)}}}function bg(t,e,n){return e+t*(n-e)}function U6(t,e,n){let r,i,a,c,u,m,w,S,E;Pt(t,yv,se=>n(9,r=se)),Pt(t,gv,se=>n(10,i=se)),Pt(t,mv,se=>n(11,a=se)),Pt(t,lf,se=>n(4,c=se)),Pt(t,Ys,se=>n(5,u=se)),Pt(t,ff,se=>n(17,m=se)),Pt(t,Ic,se=>n(18,w=se)),Pt(t,Zl,se=>n(6,S=se)),Pt(t,Bg,se=>n(7,E=se)),qu(async()=>{const se=cE(new C6);let ce=await new se;Zl.set(ce)});let P;async function D(){P&&c&&P.fitBounds(await S.getBounds(),{animate:!1})}async function k(se){if(se){console.log("New map model loaded");let ce=await S.getBounds();Hn(Ic,w={lng:bg(.4,ce[0],ce[2]),lat:bg(.4,ce[1],ce[3])},w),Hn(ff,m={lng:bg(.6,ce[0],ce[2]),lat:bg(.6,ce[1],ce[3])},m),await D(),Hn(Ys,u={kind:"isochrone"},u)}}let V,j,te;function U(se){Zn[se?"unshift":"push"](()=>{te=se,n(3,te),n(9,r)})}function W(se){P=se,n(0,P)}function Y(se){Zn[se?"unshift":"push"](()=>{j=se,n(2,j),n(10,i)})}const oe=()=>Hn(Bg,E=!0,E);function _e(se){Zn[se?"unshift":"push"](()=>{V=se,n(1,V),n(11,a)})}return t.$$.update=()=>{t.$$.dirty&1&&P&&vy.set(P),t.$$.dirty&16&&k(c),t.$$.dirty&2050&&V&&a&&(n(1,V.innerHTML="",V),V.appendChild(a)),t.$$.dirty&1028&&j&&i&&(n(2,j.innerHTML="",j),j.appendChild(i)),t.$$.dirty&520&&te&&r&&(n(3,te.innerHTML="",te),te.appendChild(r))},[P,V,j,te,c,u,S,E,D,r,i,a,U,W,Y,oe,_e]}class G6 extends Qt{constructor(e){super(),Jt(this,e,U6,V6,Gt,{})}}new G6({target:document.getElementById("app")}); diff --git a/assets/main-edb2cf13.js b/assets/main-edb2cf13.js new file mode 100644 index 0000000..9a35a04 --- /dev/null +++ b/assets/main-edb2cf13.js @@ -0,0 +1,643 @@ +var GL=Object.defineProperty;var jL=(t,e,n)=>e in t?GL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var yi=(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 ut(){}function qL(t,e){for(const n in e)t[n]=e[n];return t}function WL(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function JS(t){return t()}function nx(){return Object.create(null)}function Ni(t){t.forEach(JS)}function vy(t){return typeof t=="function"}function Gt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ag;function Eo(t,e){return t===e?!0:(ag||(ag=document.createElement("a")),ag.href=e,t===ag.href)}function HL(t){return Object.keys(t).length===0}function QS(t,...e){if(t==null){for(const r of e)r(void 0);return ut}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function $S(t){let e;return QS(t,n=>e=n)(),e}function Pt(t,e,n){t.$$.on_destroy.push(QS(e,n))}function Kr(t,e,n,r){if(t){const i=eE(t,e,n,r);return t[0](i)}}function eE(t,e,n,r){return t[1]&&r?qL(n.ctx.slice(),t[1](r(e))):n.ctx}function Jr(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 YL(t){return function(e){return e.preventDefault(),t.call(this,e)}}function K_(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Ve(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function KL(t){return t===""?null:+t}function JL(t){return Array.from(t.childNodes)}function Bn(t,e){e=""+e,t.data!==e&&(t.data=e)}function Go(t,e){t.value=e??""}function zr(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Ng(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=QL(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function xv(t,e){return Ff().$$.context.set(t,e),e}function wv(t){return Ff().$$.context.get(t)}function pn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const ef=[],Un=[];let af=[];const L0=[],nE=Promise.resolve();let P0=!1;function rE(){P0||(P0=!0,nE.then(Sv))}function iE(){return rE(),nE}function bd(t){af.push(t)}function Hi(t){L0.push(t)}const J_=new Set;let Xh=0;function Sv(){if(Xh!==0)return;const t=vd;do{try{for(;Xht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),af=e}const xg=new Set;let Sc;function kn(){Sc={r:0,c:[],p:Sc}}function Dn(){Sc.r||Ni(Sc.c),Sc=Sc.p}function ve(t,e){t&&t.i&&(xg.delete(t),t.i(e))}function Ie(t,e,n,r){if(t&&t.o){if(xg.has(t))return;xg.add(t),Sc.c.push(()=>{xg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function Og(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,P)=>{P!==a&&E&&(kn(),Ie(E,1,1,()=>{e.blocks[P]===E&&(e.blocks[P]=null)}),Dn())}):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&&Sv()}if(WL(t)){const i=Ff();if(t.then(a=>{Gl(i),r(e.then,1,e.value,a),Gl(null)},a=>{if(Gl(i),r(e.catch,2,e.error,a),Gl(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 oE(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 Fr(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function tP(t,e){Ie(t,1,1,()=>{e.delete(t.key)})}function nP(t,e,n,r,i,a,c,l,m,w,S,E){let P=t.length,D=a.length,k=P;const U={};for(;k--;)U[t[k].key]=k;const j=[],$=new Map,B=new Map,W=[];for(k=D;k--;){const pe=E(i,a,k),oe=n(pe);let fe=c.get(oe);fe?r&&W.push(()=>fe.p(pe,e)):(fe=w(oe,pe),fe.c()),$.set(oe,j[k]=fe),oe in U&&B.set(oe,Math.abs(k-U[oe]))}const X=new Set,re=new Set;function ge(pe){ve(pe,1),pe.m(l,S),c.set(pe.key,pe),S=pe.first,D--}for(;P&&D;){const pe=j[D-1],oe=t[P-1],fe=pe.key,Te=oe.key;pe===oe?(S=pe.first,P--,D--):$.has(Te)?!c.has(fe)||X.has(fe)?ge(pe):re.has(Te)?P--:B.get(fe)>B.get(Te)?(re.add(fe),ge(pe)):(X.add(Te),P--):(m(oe,c),P--)}for(;P--;){const pe=t[P];$.has(pe.key)||m(pe,c)}for(;D;)ge(j[D-1]);return Ni(W),j}function Zi(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function st(t){t&&t.c()}function it(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),bd(()=>{const a=t.$$.on_mount.map(JS).filter(vy);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ni(a),t.$$.on_mount=[]}),i.forEach(bd)}function ot(t,e){const n=t.$$;n.fragment!==null&&(eP(n.after_update),Ni(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function rP(t,e){t.$$.dirty[0]===-1&&(ef.push(t),rE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=D.length?D[0]:P;return w.ctx&&i(w.ctx[E],w.ctx[E]=k)&&(!w.skip_bound&&w.bound[E]&&w.bound[E](k),S&&rP(t,E)),P}):[],w.update(),S=!0,Ni(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const E=JL(e.target);w.fragment&&w.fragment.l(E),E.forEach(ke)}else w.fragment&&w.fragment.c();e.intro&&ve(t.$$.fragment),it(t,e.target,e.anchor),Sv()}Gl(m)}class Kt{constructor(){yi(this,"$$");yi(this,"$$set")}$destroy(){ot(this,1),this.$destroy=ut}$on(e,n){if(!vy(n))return ut;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&&!HL(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const iP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(iP);const oP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAAmJLR0QA/4ePzL8AAACgSURBVBjTY2D4D4cvGHoY2BlQwH8U2I4pCQKsDHFg3VglGRjEgazvmJLlQNjIcAnIOobbztcM5piSHUBYzxDNwMfAgMtOGKjHJpnJ8IwhhcGFYREDM6ZkCMMqoPHXGC4zBKEa5cPwBKioAAiXMIQz/GZ4yuCFkHzC4MjgxPCNoZaBjeE+kOXEcB0h+RjIdWG4AGU7w9lg4A0UesBgj8oGAP6nSFElh0b7AAAAAElFTkSuQmCC",sP="/15m/assets/logo_dark-ed08d841.svg";const aP=t=>({dialog:t&1}),rx=t=>({dialog:t[0]});function lP(t){let e,n,r,i,a;const c=t[4].default,l=Kr(c,t,t[3],rx);return{c(){e=Re("dialog"),n=Re("article"),l&&l.c(),e.open=!0},m(m,w){De(m,e,w),Se(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(a=[jt(window,"click",t[1]),jt(window,"keydown",t[2]),jt(e,"close",t[5])],i=!0)},p(m,[w]){l&&l.p&&(!r||w&9)&&Qr(l,c,m,m[3],r?Jr(c,m[3],w,aP):$r(m[3]),rx)},i(m){r||(ve(l,m),r=!0)},o(m){Ie(l,m),r=!1},d(m){m&&ke(e),l&&l.d(m),t[6](null),i=!1,Ni(a)}}}function uP(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){pn.call(this,t,S)}function w(S){Un[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 Ev extends Kt{constructor(e){super(),Yt(this,e,uP,lP,Gt,{})}}function ix(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function ox(t){let e,n,r=t[1]+"",i,a,c,l=t[2]+"",m,w;return{c(){e=Re("tr"),n=Re("td"),i=It(r),a=rt(),c=Re("td"),m=It(l),w=rt()},m(S,E){De(S,e,E),Se(e,n),Se(n,i),Se(e,a),Se(e,c),Se(c,m),Se(e,w)},p(S,E){E&1&&r!==(r=S[1]+"")&&Bn(i,r),E&1&&l!==(l=S[2]+"")&&Bn(m,l)},d(S){S&&ke(e)}}}function cP(t){let e,n,r=Fr(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class Iv extends Kt{constructor(e){super(),Yt(this,e,hP,cP,Gt,{properties:0})}}function sx(t,e,n){const r=t.slice();return r[3]=e[n],r}function ax(t,e,n){const r=t.slice();return r[6]=e[n],r}function lx(t){let e,n;return{c(){e=Re("span"),n=It(`  + `),zr(e,"background",t[6]),zr(e,"width","100%"),zr(e,"border","1px solid black")},m(r,i){De(r,e,i),Se(e,n)},p(r,i){i&1&&zr(e,"background",r[6])},d(r){r&&ke(e)}}}function fP(t){let e,n=t[3]+"",r;return{c(){e=Re("span"),r=It(n)},m(i,a){De(i,e,a),Se(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&Bn(r,n)},d(i){i&&ke(e)}}}function pP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=Re("span"),r=It(n)},m(i,a){De(i,e,a),Se(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&Bn(r,n)},d(i){i&&ke(e)}}}function ux(t){let e;function n(a,c){return a[2]>0?pP:fP}let r=n(t),i=r(t);return{c(){i.c(),e=Ur()},m(a,c){i.m(a,c),De(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&&ke(e),i.d(a)}}}function dP(t){let e,n,r,i=Fr(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 sE extends Kt{constructor(e){super(),Yt(this,e,mP,dP,Gt,{colorScale:0,limits:1,decimalPlaces:2})}}function ta(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const Yh=[];function Q_(t,e){return{subscribe:sr(t,e).subscribe}}function sr(t,e=ut){let n;const r=new Set;function i(l){if(Gt(t,l)&&(t=l,n)){const m=!Yh.length;for(const w of r)w[1](),Yh.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 aE=Symbol("Comlink.proxy"),gP=Symbol("Comlink.endpoint"),yP=Symbol("Comlink.releaseProxy"),$_=Symbol("Comlink.finalizer"),wg=Symbol("Comlink.thrown"),lE=t=>typeof t=="object"&&t!==null||typeof t=="function",_P={canHandle:t=>lE(t)&&t[aE],serialize(t){const{port1:e,port2:n}=new MessageChannel;return Cv(t,e),[n,[n]]},deserialize(t){return t.start(),hE(t)}},vP={canHandle:t=>lE(t)&&wg 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}},uE=new Map([["proxy",_P],["throw",vP]]);function bP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function Cv(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!bP(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(wc);let w;try{const S=l.slice(0,-1).reduce((P,D)=>P[D],t),E=l.reduce((P,D)=>P[D],t);switch(c){case"GET":w=E;break;case"SET":S[l.slice(-1)[0]]=wc(i.data.value),w=!0;break;case"APPLY":w=E.apply(S,m);break;case"CONSTRUCT":{const P=new E(...m);w=Tv(P)}break;case"ENDPOINT":{const{port1:P,port2:D}=new MessageChannel;Cv(t,D),w=IP(P,[P])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[wg]:0}}Promise.resolve(w).catch(S=>({value:S,[wg]:0})).then(S=>{const[E,P]=Bg(S);e.postMessage(Object.assign(Object.assign({},E),{id:a}),P),c==="RELEASE"&&(e.removeEventListener("message",r),cE(e),$_ in t&&typeof t[$_]=="function"&&t[$_]())}).catch(S=>{const[E,P]=Bg({value:new TypeError("Unserializable return value"),[wg]:0});e.postMessage(Object.assign(Object.assign({},E),{id:a}),P)})}),e.start&&e.start()}function xP(t){return t.constructor.name==="MessagePort"}function cE(t){xP(t)&&t.close()}function hE(t,e){return M0(t,[],e)}function lg(t){if(t)throw new Error("Proxy has been released and is not useable")}function fE(t){return tf(t,{type:"RELEASE"}).then(()=>{cE(t)})}const zg=new WeakMap,Fg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(zg.get(t)||0)-1;zg.set(t,e),e===0&&fE(t)});function wP(t,e){const n=(zg.get(e)||0)+1;zg.set(e,n),Fg&&Fg.register(t,e,t)}function SP(t){Fg&&Fg.unregister(t)}function M0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(lg(r),c===yP)return()=>{SP(i),fE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const l=tf(t,{type:"GET",path:e.map(m=>m.toString())}).then(wc);return l.then.bind(l)}return M0(t,[...e,c])},set(a,c,l){lg(r);const[m,w]=Bg(l);return tf(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:m},w).then(wc)},apply(a,c,l){lg(r);const m=e[e.length-1];if(m===gP)return tf(t,{type:"ENDPOINT"}).then(wc);if(m==="bind")return M0(t,e.slice(0,-1));const[w,S]=cx(l);return tf(t,{type:"APPLY",path:e.map(E=>E.toString()),argumentList:w},S).then(wc)},construct(a,c){lg(r);const[l,m]=cx(c);return tf(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:l},m).then(wc)}});return wP(i,t),i}function EP(t){return Array.prototype.concat.apply([],t)}function cx(t){const e=t.map(Bg);return[e.map(n=>n[0]),EP(e.map(n=>n[1]))]}const pE=new WeakMap;function IP(t,e){return pE.set(t,e),t}function Tv(t){return Object.assign(t,{[aE]:!0})}function Bg(t){for(const[e,n]of uE)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},pE.get(t)||[]]}function wc(t){switch(t.type){case"HANDLER":return uE.get(t.name).deserialize(t.value);case"RAW":return t.value}}function tf(t,e,n){return new Promise(r=>{const i=CP();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 CP(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let cn;const Ul=new Array(128).fill(void 0);Ul.push(void 0,null,!0,!1);function mn(t){return Ul[t]}let hd=Ul.length;function TP(t){t<132||(Ul[t]=hd,hd=t)}function xc(t){const e=mn(t);return TP(t),e}let Ec=0,od=null;function fd(){return(od===null||od.byteLength===0)&&(od=new Uint8Array(cn.memory.buffer)),od}const Sg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},LP=typeof Sg.encodeInto=="function"?function(t,e){return Sg.encodeInto(t,e)}:function(t,e){const n=Sg.encode(t);return e.set(n),{read:t.length,written:n.length}};function e0(t,e,n){if(n===void 0){const l=Sg.encode(t),m=e(l.length,1)>>>0;return fd().subarray(m,m+l.length).set(l),Ec=l.length,m}let r=t.length,i=e(r,1)>>>0;const a=fd();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=fd().subarray(i+c,i+r),m=LP(t,l);c+=m.written,i=n(i,r,c,1)>>>0}return Ec=c,i}function pd(t){return t==null}let sd=null;function Wn(){return(sd===null||sd.byteLength===0)&&(sd=new Int32Array(cn.memory.buffer)),sd}let ad=null;function dE(){return(ad===null||ad.byteLength===0)&&(ad=new Float64Array(cn.memory.buffer)),ad}const mE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&mE.decode();function sl(t,e){return t=t>>>0,mE.decode(fd().subarray(t,t+e))}function or(t){hd===Ul.length&&Ul.push(Ul.length+1);const e=hd;return hd=Ul[e],Ul[e]=t,e}function A0(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+=A0(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:r}function PP(t,e){const n=e(t.length*1,1)>>>0;return fd().set(t,n/1),Ec=t.length,n}function MP(t,e){return t=t>>>0,dE().subarray(t/8,t/8+e)}function Su(t,e){try{return t.apply(this,e)}catch(n){cn.__wbindgen_exn_store(or(n))}}const AP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>cn.__wbg_mapmodel_free(t>>>0));class hx{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,AP.unregister(this),e}free(){const e=this.__destroy_into_raw();cn.__wbg_mapmodel_free(e)}constructor(e,n,r){try{const l=cn.__wbindgen_add_to_stack_pointer(-16),m=PP(e,cn.__wbindgen_malloc),w=Ec;cn.mapmodel_new(l,m,w,n,pd(r)?0:or(r));var i=Wn()[l/4+0],a=Wn()[l/4+1],c=Wn()[l/4+2];if(c)throw xc(a);return this.__wbg_ptr=i>>>0,this}finally{cn.__wbindgen_add_to_stack_pointer(16)}}renderDebug(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_renderDebug(w,this.__wbg_ptr);var r=Wn()[w/4+0],i=Wn()[w/4+1],a=Wn()[w/4+2],c=Wn()[w/4+3],l=r,m=i;if(c)throw l=0,m=0,xc(a);return e=l,n=m,sl(l,m)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=Wn()[w/4+0],i=Wn()[w/4+1],a=Wn()[w/4+2],c=Wn()[w/4+3],l=r,m=i;if(c)throw l=0,m=0,xc(a);return e=l,n=m,sl(l,m)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(e,n,1)}}getBounds(){try{const i=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_getBounds(i,this.__wbg_ptr);var e=Wn()[i/4+0],n=Wn()[i/4+1],r=MP(e,n).slice();return cn.__wbindgen_free(e,n*8,8),r}finally{cn.__wbindgen_add_to_stack_pointer(16)}}isochrone(e){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_isochrone(S,this.__wbg_ptr,or(e));var i=Wn()[S/4+0],a=Wn()[S/4+1],c=Wn()[S/4+2],l=Wn()[S/4+3],m=i,w=a;if(l)throw m=0,w=0,xc(c);return n=m,r=w,sl(m,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_route(S,this.__wbg_ptr,or(e));var i=Wn()[S/4+0],a=Wn()[S/4+1],c=Wn()[S/4+2],l=Wn()[S/4+3],m=i,w=a;if(l)throw m=0,w=0,xc(c);return n=m,r=w,sl(m,w)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(n,r,1)}}score(e,n){let r,i;try{const E=cn.__wbindgen_add_to_stack_pointer(-16);cn.mapmodel_score(E,this.__wbg_ptr,or(e),pd(n)?0:or(n));var a=Wn()[E/4+0],c=Wn()[E/4+1],l=Wn()[E/4+2],m=Wn()[E/4+3],w=a,S=c;if(m)throw w=0,S=0,xc(l);return r=w,i=S,sl(w,S)}finally{cn.__wbindgen_add_to_stack_pointer(16),cn.__wbindgen_free(r,i,1)}}}async function kP(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 DP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){xc(e)},t.wbg.__wbindgen_string_get=function(e,n){const r=mn(n),i=typeof r=="string"?r:void 0;var a=pd(i)?0:e0(i,cn.__wbindgen_malloc,cn.__wbindgen_realloc),c=Ec;Wn()[e/4+1]=c,Wn()[e/4+0]=a},t.wbg.__wbindgen_boolean_get=function(e){const n=mn(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_object=function(e){const n=mn(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return mn(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return mn(e)in mn(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=mn(n),i=typeof r=="number"?r:void 0;dE()[e/8+1]=pd(i)?0:i,Wn()[e/4+0]=!pd(i)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(sl(e,n));return or(r)},t.wbg.__wbindgen_string_new=function(e,n){const r=sl(e,n);return or(r)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return mn(e)==mn(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=mn(e)[mn(n)];return or(r)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=mn(e);return or(n)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(mn(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(mn(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(mn(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(mn(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(mn(e))},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return or(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=mn(n).stack,i=e0(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Ec;Wn()[e/4+1]=a,Wn()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(sl(e,n))}finally{cn.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=mn(e).performance;return or(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return mn(e).now()},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,n){const r=mn(e)[n>>>0];return or(r)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return mn(e).length},t.wbg.__wbindgen_is_function=function(e){return typeof mn(e)=="function"},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(sl(e,n));return or(r)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const n=mn(e).next;return or(n)},t.wbg.__wbg_next_196c84450b364254=function(){return Su(function(e){const n=mn(e).next();return or(n)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return mn(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const n=mn(e).value;return or(n)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return or(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return Su(function(e,n){const r=Reflect.get(mn(e),mn(n));return or(r)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return Su(function(e,n){const r=mn(e).call(mn(n));return or(r)},arguments)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Su(function(){const e=self.self;return or(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return Su(function(){const e=window.window;return or(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Su(function(){const e=globalThis.globalThis;return or(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return Su(function(){const e=global.global;return or(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(mn(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=mn(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Su(function(e,n,r){const i=mn(e).call(mn(n),mn(r));return or(i)},arguments)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=mn(e).buffer;return or(n)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(mn(e));return or(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){mn(e).set(mn(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return mn(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=mn(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const r=A0(mn(n)),i=e0(r,cn.__wbindgen_malloc,cn.__wbindgen_realloc),a=Ec;Wn()[e/4+1]=a,Wn()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(sl(e,n))},t.wbg.__wbindgen_memory=function(){const e=cn.memory;return or(e)},t}function RP(t,e){return cn=t.exports,k0.__wbindgen_wasm_module=e,ad=null,sd=null,od=null,cn}async function k0(t){if(cn!==void 0)return cn;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=DP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await kP(await t,e);return RP(n,r)}class NP{constructor(){yi(this,"inner");this.inner=null}async loadOsmFile(e,n){await k0(),this.inner=new hx(e,!0,n)}async loadGraphFile(e){await k0(),this.inner=new hx(e,!1,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}score(e,n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds},n))}}Cv(NP);let gE="MZEJTanw3WpxRvt7qDfo",Ys=sr({kind:"title"}),by=sr(null),Vg=sr(!0);function fx(t){return["!=",["get",`access_${t}`],"None"]}let hf=sr("foot"),Ug=sr("07:00"),Ic=sr(null),ff=sr(null),px=sr(!0),Xl=sr(null),lf=sr(!1);function Gg(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 dx(t){let e,n;return e=new Ev({props:{$$slots:{default:[OP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function OP(t){let e,n,r,i,a,c,l,m,w,S;function E(){return t[1](t[3])}return{c(){e=Re("h1"),e.textContent="15-minute neighborhood tool",n=rt(),r=Re("p"),r.textContent="TODO. Extremely early in development.",i=rt(),a=Re("p"),a.innerHTML=`This open source + tool is created by + Dustin Carlino + and relies heavily on + OpenStreetMap data.`,c=rt(),l=Re("center"),m=Re("button"),m.textContent="Start!"},m(P,D){De(P,e,D),De(P,n,D),De(P,r,D),De(P,i,D),De(P,a,D),De(P,c,D),De(P,l,D),Se(l,m),w||(S=jt(m,"click",E),w=!0)},p(P,D){t=P},d(P){P&&(ke(e),ke(n),ke(r),ke(i),ke(a),ke(c),ke(l)),w=!1,S()}}}function zP(t){let e,n,r=t[0]&&dx(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=dx(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function FP(t,e,n){let r;return Pt(t,Vg,c=>n(0,r=c)),[r,c=>ta(c).close(),()=>Zn(Vg,r=!1,r)]}class BP extends Kt{constructor(e){super(),Yt(this,e,FP,zP,Gt,{})}}var Gd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function xy(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 mx=Object.prototype.toString,yE=function(e){var n=mx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&mx.call(e.callee)==="[object Function]"),r},t0,gx;function VP(){if(gx)return t0;gx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=yE,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(P){var D=P.constructor;return D&&D.prototype===P},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var P in window)try{if(!w["$"+P]&&e.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{m(window[P])}catch{return!0}}catch{return!0}return!1}(),E=function(P){if(typeof window>"u"||!S)return m(P);try{return m(P)}catch{return!1}};t=function(D){var k=D!==null&&typeof D=="object",U=n.call(D)==="[object Function]",j=r(D),$=k&&n.call(D)==="[object String]",B=[];if(!k&&!U&&!j)throw new TypeError("Object.keys called on a non-object");var W=c&&U;if($&&D.length>0&&!e.call(D,0))for(var X=0;X0)for(var re=0;re"u"||!Vi?zn:Vi(Uint8Array),Tc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":Kh&&Vi?Vi([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":nf,"%AsyncGenerator%":nf,"%AsyncGeneratorFunction%":nf,"%AsyncIteratorPrototype%":nf,"%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%":lM,"%eval%":eval,"%EvalError%":uM,"%Float32Array%":typeof Float32Array>"u"?zn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?zn:FinalizationRegistry,"%Function%":bE,"%GeneratorFunction%":nf,"%Int8Array%":typeof Int8Array>"u"?zn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?zn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Kh&&Vi?Vi(Vi([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map>"u"?zn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Kh||!Vi?zn:Vi(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%":cM,"%ReferenceError%":hM,"%Reflect%":typeof Reflect>"u"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?zn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Kh||!Vi?zn:Vi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Kh&&Vi?Vi(""[Symbol.iterator]()):zn,"%Symbol%":Kh?Symbol:zn,"%SyntaxError%":pf,"%ThrowTypeError%":pM,"%TypedArray%":mM,"%TypeError%":uf,"%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%":fM,"%WeakMap%":typeof WeakMap>"u"?zn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?zn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?zn:WeakSet};if(Vi)try{null.error}catch(t){var gM=Vi(Vi(t));Tc["%Error.prototype%"]=gM}var yM=function t(e){var n;if(e==="%AsyncFunction%")n=r0("async function () {}");else if(e==="%GeneratorFunction%")n=r0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=r0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Vi&&(n=Vi(i.prototype))}return Tc[e]=n,n},xx={__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=Av,jg=vE,_M=jd.call(Function.call,Array.prototype.concat),vM=jd.call(Function.apply,Array.prototype.splice),wx=jd.call(Function.call,String.prototype.replace),qg=jd.call(Function.call,String.prototype.slice),bM=jd.call(Function.call,RegExp.prototype.exec),xM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,wM=/\\(\\)?/g,SM=function(e){var n=qg(e,0,1),r=qg(e,-1);if(n==="%"&&r!=="%")throw new pf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new pf("invalid intrinsic syntax, expected opening `%`");var i=[];return wx(e,xM,function(a,c,l,m){i[i.length]=l?wx(m,wM,"$1"):c||a}),i},EM=function(e,n){var r=e,i;if(jg(xx,r)&&(i=xx[r],r="%"+i[0]+"%"),jg(Tc,r)){var a=Tc[r];if(a===nf&&(a=yM(r)),typeof a>"u"&&!n)throw new uf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new pf("intrinsic "+e+" does not exist!")},_l=function(e,n){if(typeof e!="string"||e.length===0)throw new uf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new uf('"allowMissing" argument must be a boolean');if(bM(/^%?[^%]*%?$/,e)===null)throw new pf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=SM(e),i=r.length>0?r[0]:"",a=EM("%"+i+"%",n),c=a.name,l=a.value,m=!1,w=a.alias;w&&(i=w[0],vM(r,_M([0,1],w)));for(var S=1,E=!0;S=r.length){var U=Cc(l,P);E=!!U,E&&"get"in U&&!("originalValue"in U.get)?l=U.get:l=l[P]}else E=jg(l,P),l=l[P];E&&!m&&(Tc[c]=l)}}return l},o0,Sx;function kv(){if(Sx)return o0;Sx=1;var t=_l,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return o0=e,o0}var IM=_l,Ig=IM("%Object.getOwnPropertyDescriptor%",!0);if(Ig)try{Ig([],"length")}catch{Ig=null}var Dv=Ig,Ex=kv(),CM=_E,Jh=Wu,Ix=Dv,Rv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Jh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Jh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Jh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Jh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Jh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Jh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,m=!!Ix&&Ix(e,n);if(Ex)Ex(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 CM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},D0=kv(),xE=function(){return!!D0};xE.hasArrayLengthDefineBug=function(){if(!D0)return null;try{return D0([],"length",{value:1}).length!==1}catch{return!0}};var Nv=xE,TM=Pv,LM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",PM=Object.prototype.toString,MM=Array.prototype.concat,Cx=Rv,AM=function(t){return typeof t=="function"&&PM.call(t)==="[object Function]"},wE=Nv(),kM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!AM(r)||!r())return}wE?Cx(t,e,n,!0):Cx(t,e,n)},SE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=TM(e);LM&&(r=MM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||NM(n)!==n)throw new Px("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Lx){var c=Lx(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(RM?Tx(e,"length",n,!0,!0):Tx(e,"length",n)),e};(function(t){var e=Av,n=_l,r=OM,i=Wu,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,a),m=kv(),w=n("%Math.max%");t.exports=function(P){if(typeof P!="function")throw new i("a function is required");var D=l(e,c,arguments);return r(D,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return l(e,a,arguments)};m?m(t.exports,"apply",{value:S}):t.exports.apply=S})(EE);var Bf=EE.exports,IE=_l,CE=Bf,zM=CE(IE("String.prototype.indexOf")),pa=function(e,n){var r=IE(e,!!n);return typeof r=="function"&&zM(e,".prototype.")>-1?CE(r):r},FM=Pv,TE=wy(),LE=pa,Mx=Object,BM=LE("Array.prototype.push"),Ax=LE("Object.prototype.propertyIsEnumerable"),VM=TE?Object.getOwnPropertySymbols:null,PE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Mx(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||tA)&&(eA?kx(e,"name",n,!0,!0):kx(e,"name",n)),e},iA=rA,oA=Wu,sA=Object,DE=iA(function(){if(this==null||this!==sA(this))throw new oA("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),aA=DE,lA=jc.supportsDescriptors,uA=Object.getOwnPropertyDescriptor,RE=function(){if(lA&&/a/mig.flags==="gim"){var e=uA(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 aA},cA=jc.supportsDescriptors,hA=RE,fA=Object.getOwnPropertyDescriptor,pA=Object.defineProperty,dA=TypeError,Dx=Object.getPrototypeOf,mA=/a/,gA=function(){if(!cA||!Dx)throw new dA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=hA(),n=Dx(mA),r=fA(n,"flags");return(!r||r.get!==e)&&pA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},yA=jc,_A=Bf,vA=DE,NE=RE,bA=gA,OE=_A(NE());yA(OE,{getPolyfill:NE,implementation:vA,shim:bA});var xA=OE,Cg={exports:{}},wA=wy,qc=function(){return wA()&&!!Symbol.toStringTag},SA=qc(),EA=pa,R0=EA("Object.prototype.toString"),Sy=function(e){return SA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:R0(e)==="[object Arguments]"},zE=function(e){return Sy(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&R0(e)!=="[object Array]"&&R0(e.callee)==="[object Function]"},IA=function(){return Sy(arguments)}();Sy.isLegacyArguments=zE;var FE=IA?Sy:zE;const CA={},TA=Object.freeze(Object.defineProperty({__proto__:null,default:CA},Symbol.toStringTag,{value:"Module"})),LA=xy(TA);var Ov=typeof Map=="function"&&Map.prototype,a0=Object.getOwnPropertyDescriptor&&Ov?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wg=Ov&&a0&&typeof a0.get=="function"?a0.get:null,Rx=Ov&&Map.prototype.forEach,zv=typeof Set=="function"&&Set.prototype,l0=Object.getOwnPropertyDescriptor&&zv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Hg=zv&&l0&&typeof l0.get=="function"?l0.get:null,Nx=zv&&Set.prototype.forEach,PA=typeof WeakMap=="function"&&WeakMap.prototype,md=PA?WeakMap.prototype.has:null,MA=typeof WeakSet=="function"&&WeakSet.prototype,gd=MA?WeakSet.prototype.has:null,AA=typeof WeakRef=="function"&&WeakRef.prototype,Ox=AA?WeakRef.prototype.deref:null,kA=Boolean.prototype.valueOf,DA=Object.prototype.toString,RA=Function.prototype.toString,NA=String.prototype.match,Fv=String.prototype.slice,Pu=String.prototype.replace,OA=String.prototype.toUpperCase,zx=String.prototype.toLowerCase,BE=RegExp.prototype.test,Fx=Array.prototype.concat,ol=Array.prototype.join,zA=Array.prototype.slice,Bx=Math.floor,N0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,u0=Object.getOwnPropertySymbols,O0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,df=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Io=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===df||"symbol")?Symbol.toStringTag:null,VE=Object.prototype.propertyIsEnumerable,Vx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Ux(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||BE.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Bx(-t):Bx(t);if(r!==t){var i=String(r),a=Fv.call(e,i.length+1);return Pu.call(i,n,"$&_")+"."+Pu.call(Pu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pu.call(e,n,"$&_")}var z0=LA,Gx=z0.custom,jx=GE(Gx)?Gx:null,FA=function t(e,n,r,i){var a=n||{};if(Tu(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Tu(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=Tu(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(Tu(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(Tu(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?Ux(e,m):m}if(typeof e=="bigint"){var w=String(e)+"n";return l?Ux(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 F0(e)?"[Array]":"[Object]";var E=nk(a,r);if(typeof i>"u")i=[];else if(jE(i,e)>=0)return"[Circular]";function P(Ke,Ee,Ze){if(Ee&&(i=zA.call(i),i.push(Ee)),Ze){var tt={depth:a.depth};return Tu(a,"quoteStyle")&&(tt.quoteStyle=a.quoteStyle),t(Ke,tt,r+1,i)}return t(Ke,a,r+1,i)}if(typeof e=="function"&&!qx(e)){var D=ZA(e),k=ug(e,P);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(k.length>0?" { "+ol.call(k,", ")+" }":"")}if(GE(e)){var U=df?Pu.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):O0.call(e);return typeof e=="object"&&!df?Jp(U):U}if($A(e)){for(var j="<"+zx.call(String(e.nodeName)),$=e.attributes||[],B=0;B<$.length;B++)j+=" "+$[B].name+"="+UE(BA($[B].value),"double",a);return j+=">",e.childNodes&&e.childNodes.length&&(j+="..."),j+="",j}if(F0(e)){if(e.length===0)return"[]";var W=ug(e,P);return E&&!tk(W)?"["+B0(W,E)+"]":"[ "+ol.call(W,", ")+" ]"}if(UA(e)){var X=ug(e,P);return!("cause"in Error.prototype)&&"cause"in e&&!VE.call(e,"cause")?"{ ["+String(e)+"] "+ol.call(Fx.call("[cause]: "+P(e.cause),X),", ")+" }":X.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ol.call(X,", ")+" }"}if(typeof e=="object"&&c){if(jx&&typeof e[jx]=="function"&&z0)return z0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(XA(e)){var re=[];return Rx&&Rx.call(e,function(Ke,Ee){re.push(P(Ee,e,!0)+" => "+P(Ke,e))}),Wx("Map",Wg.call(e),re,E)}if(JA(e)){var ge=[];return Nx&&Nx.call(e,function(Ke){ge.push(P(Ke,e))}),Wx("Set",Hg.call(e),ge,E)}if(YA(e))return c0("WeakMap");if(QA(e))return c0("WeakSet");if(KA(e))return c0("WeakRef");if(jA(e))return Jp(P(Number(e)));if(WA(e))return Jp(P(N0.call(e)));if(qA(e))return Jp(kA.call(e));if(GA(e))return Jp(P(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Gd)return"{ [object globalThis] }";if(!VA(e)&&!qx(e)){var pe=ug(e,P),oe=Vx?Vx(e)===Object.prototype:e instanceof Object||e.constructor===Object,fe=e instanceof Object?"":"null prototype",Te=!oe&&Io&&Object(e)===e&&Io in e?Fv.call(Hu(e),8,-1):fe?"Object":"",Z=oe||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",ne=Z+(Te||fe?"["+ol.call(Fx.call([],Te||[],fe||[]),": ")+"] ":"");return pe.length===0?ne+"{}":E?ne+"{"+B0(pe,E)+"}":ne+"{ "+ol.call(pe,", ")+" }"}return String(e)};function UE(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function BA(t){return Pu.call(String(t),/"/g,""")}function F0(t){return Hu(t)==="[object Array]"&&(!Io||!(typeof t=="object"&&Io in t))}function VA(t){return Hu(t)==="[object Date]"&&(!Io||!(typeof t=="object"&&Io in t))}function qx(t){return Hu(t)==="[object RegExp]"&&(!Io||!(typeof t=="object"&&Io in t))}function UA(t){return Hu(t)==="[object Error]"&&(!Io||!(typeof t=="object"&&Io in t))}function GA(t){return Hu(t)==="[object String]"&&(!Io||!(typeof t=="object"&&Io in t))}function jA(t){return Hu(t)==="[object Number]"&&(!Io||!(typeof t=="object"&&Io in t))}function qA(t){return Hu(t)==="[object Boolean]"&&(!Io||!(typeof t=="object"&&Io in t))}function GE(t){if(df)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!O0)return!1;try{return O0.call(t),!0}catch{}return!1}function WA(t){if(!t||typeof t!="object"||!N0)return!1;try{return N0.call(t),!0}catch{}return!1}var HA=Object.prototype.hasOwnProperty||function(t){return t in this};function Tu(t,e){return HA.call(t,e)}function Hu(t){return DA.call(t)}function ZA(t){if(t.name)return t.name;var e=NA.call(RA.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(Fv.call(t,0,e.maxStringLength),e)+r}var i=Pu.call(Pu.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ek);return UE(i,"single",e)}function ek(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":"")+OA.call(e.toString(16))}function Jp(t){return"Object("+t+")"}function c0(t){return t+" { ? }"}function Wx(t,e,n,r){var i=r?B0(n,r):ol.call(n,", ");return t+" ("+e+") {"+i+"}"}function tk(t){for(var e=0;e=0)return!1;return!0}function nk(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=ol.call(Array(t.indent+1)," ");else return null;return{base:n,prev:ol.call(Array(e+1),n)}}function B0(t,e){if(t.length===0)return"";var n=` +`+e.prev+e.base;return n+ol.call(t,","+n)+` +`+e.prev}function ug(t,e){var n=F0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=$x(e,n);if(i<55296||i>56319)return n+1;var a=$x(e,n+1);return a<56320||a>57343?n+1:n+2},f0=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}}}},ew=function(e,n){if(Ck(e)||Yx(e))return f0(e);if(Tk(e)){var r=0;return{next:function(){var a=Ak(e,r),c=Mk(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(!Lk&&!Pk)Cg.exports=function(e){if(e!=null)return ew(e,!0)};else{var kk=KE,Dk=QE,tw=Ea("Map.prototype.forEach",!0),nw=Ea("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var rw=Ea("Map.prototype.iterator",!0),iw=Ea("Set.prototype.iterator",!0);var ow=Ea("Map.prototype.@@iterator",!0)||Ea("Map.prototype._es6-shim iterator_",!0),sw=Ea("Set.prototype.@@iterator",!0)||Ea("Set.prototype._es6-shim iterator_",!0),Rk=function(e){if(kk(e)){if(rw)return Kx(rw(e));if(ow)return ow(e);if(tw){var n=[];return tw(e,function(i,a){Qx(n,[a,i])}),f0(n)}}if(Dk(e)){if(iw)return Kx(iw(e));if(sw)return sw(e);if(nw){var r=[];return nw(e,function(i){Qx(r,i)}),f0(r)}}};Cg.exports=function(e){return Rk(e)||ew(e)}}}var Nk=Cg.exports,aw=function(t){return t!==t},$E=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||aw(e)&&aw(n))},Ok=$E,eI=function(){return typeof Object.is=="function"?Object.is:Ok},zk=eI,Fk=jc,Bk=function(){var e=zk();return Fk(Object,{is:e},{is:function(){return Object.is!==e}}),e},Vk=jc,Uk=Bf,Gk=$E,tI=eI,jk=Bk,nI=Uk(tI(),Object);Vk(nI,{getPolyfill:tI,implementation:Gk,shim:jk});var qk=nI,Wk=Bf,rI=pa,Hk=_l,V0=Hk("%ArrayBuffer%",!0),Tg=rI("ArrayBuffer.prototype.byteLength",!0),Zk=rI("Object.prototype.toString"),lw=!!V0&&!Tg&&new V0(0).slice,uw=!!lw&&Wk(lw),iI=Tg||uw?function(e){if(!e||typeof e!="object")return!1;try{return Tg?Tg(e):uw(e,0),!0}catch{return!1}}:V0?function(e){return Zk(e)==="[object ArrayBuffer]"}:function(e){return!1},Xk=Date.prototype.getDay,Yk=function(e){try{return Xk.call(e),!0}catch{return!1}},Kk=Object.prototype.toString,Jk="[object Date]",Qk=qc(),$k=function(e){return typeof e!="object"||e===null?!1:Qk?Yk(e):Kk.call(e)===Jk},U0=pa,oI=qc(),sI,aI,G0,j0;if(oI){sI=U0("Object.prototype.hasOwnProperty"),aI=U0("RegExp.prototype.exec"),G0={};var p0=function(){throw G0};j0={toString:p0,valueOf:p0},typeof Symbol.toPrimitive=="symbol"&&(j0[Symbol.toPrimitive]=p0)}var e3=U0("Object.prototype.toString"),t3=Object.getOwnPropertyDescriptor,n3="[object RegExp]",r3=oI?function(e){if(!e||typeof e!="object")return!1;var n=t3(e,"lastIndex"),r=n&&sI(n,"value");if(!r)return!1;try{aI(e,j0)}catch(i){return i===G0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:e3(e)===n3},i3=pa,cw=i3("SharedArrayBuffer.prototype.byteLength",!0),o3=cw?function(e){if(!e||typeof e!="object")return!1;try{return cw(e),!0}catch{return!1}}:function(e){return!1},s3=Number.prototype.toString,a3=function(e){try{return s3.call(e),!0}catch{return!1}},l3=Object.prototype.toString,u3="[object Number]",c3=qc(),h3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:c3?a3(e):l3.call(e)===u3},lI=pa,f3=lI("Boolean.prototype.toString"),p3=lI("Object.prototype.toString"),d3=function(e){try{return f3(e),!0}catch{return!1}},m3="[object Boolean]",g3=qc(),y3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:g3&&Symbol.toStringTag in e?d3(e):p3(e)===m3},q0={exports:{}},_3=Object.prototype.toString,v3=Mv();if(v3){var b3=Symbol.prototype.toString,x3=/^Symbol\(.*\)$/,w3=function(e){return typeof e.valueOf()!="symbol"?!1:x3.test(b3.call(e))};q0.exports=function(e){if(typeof e=="symbol")return!0;if(_3.call(e)!=="[object Symbol]")return!1;try{return w3(e)}catch{return!1}}}else q0.exports=function(e){return!1};var S3=q0.exports,W0={exports:{}},hw=typeof BigInt<"u"&&BigInt,E3=function(){return typeof hw=="function"&&typeof BigInt=="function"&&typeof hw(42)=="bigint"&&typeof BigInt(42)=="bigint"},I3=E3();if(I3){var C3=BigInt.prototype.valueOf,T3=function(e){try{return C3.call(e),!0}catch{}return!1};W0.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:T3(e)}}else W0.exports=function(e){return!1};var L3=W0.exports,P3=XE,M3=h3,A3=y3,k3=S3,D3=L3,R3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(P3(e))return"String";if(M3(e))return"Number";if(A3(e))return"Boolean";if(k3(e))return"Symbol";if(D3(e))return"BigInt"},Yg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,fw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Kg;Yg||(Kg=function(e){return!1});var H0=Yg?Yg.prototype.has:null,d0=fw?fw.prototype.has:null;!Kg&&!H0&&(Kg=function(e){return!1});var N3=Kg||function(e){if(!e||typeof e!="object")return!1;try{if(H0.call(e,H0),d0)try{d0.call(e,d0)}catch{return!0}return e instanceof Yg}catch{}return!1},Z0={exports:{}},O3=_l,uI=pa,z3=O3("%WeakSet%",!0),m0=uI("WeakSet.prototype.has",!0);if(m0){var g0=uI("WeakMap.prototype.has",!0);Z0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(m0(e,m0),g0)try{g0(e,g0)}catch{return!0}return e instanceof z3}catch{}return!1}}else Z0.exports=function(e){return!1};var F3=Z0.exports,B3=KE,V3=QE,U3=N3,G3=F3,j3=function(e){if(e&&typeof e=="object"){if(B3(e))return"Map";if(V3(e))return"Set";if(U3(e))return"WeakMap";if(G3(e))return"WeakSet"}return!1},cI=Function.prototype.toString,of=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,X0,Lg;if(typeof of=="function"&&typeof Object.defineProperty=="function")try{X0=Object.defineProperty({},"length",{get:function(){throw Lg}}),Lg={},of(function(){throw 42},null,X0)}catch(t){t!==Lg&&(of=null)}else of=null;var q3=/^\s*class\b/,Y0=function(e){try{var n=cI.call(e);return q3.test(n)}catch{return!1}},y0=function(e){try{return Y0(e)?!1:(cI.call(e),!0)}catch{return!1}},Pg=Object.prototype.toString,W3="[object Object]",H3="[object Function]",Z3="[object GeneratorFunction]",X3="[object HTMLAllCollection]",Y3="[object HTML document.all class]",K3="[object HTMLCollection]",J3=typeof Symbol=="function"&&!!Symbol.toStringTag,Q3=!(0 in[,]),K0=function(){return!1};if(typeof document=="object"){var $3=document.all;Pg.call($3)===Pg.call(document.all)&&(K0=function(e){if((Q3||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Pg.call(e);return(n===X3||n===Y3||n===K3||n===W3)&&e("")==null}catch{}return!1})}var e4=of?function(e){if(K0(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{of(e,null,X0)}catch(n){if(n!==Lg)return!1}return!Y0(e)&&y0(e)}:function(e){if(K0(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(J3)return y0(e);if(Y0(e))return!1;var n=Pg.call(e);return n!==H3&&n!==Z3&&!/^\[object HTML/.test(n)?!1:y0(e)},t4=e4,n4=Object.prototype.toString,hI=Object.prototype.hasOwnProperty,r4=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),n4.call(e)==="[object Array]"?r4(e,n,i):typeof e=="string"?i4(e,n,i):o4(e,n,i)},a4=s4,l4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],_0=l4,u4=typeof globalThis>"u"?Gd:globalThis,c4=function(){for(var e=[],n=0;n<_0.length;n++)typeof u4[_0[n]]=="function"&&(e[e.length]=_0[n]);return e},Jg=a4,h4=c4,pw=Bf,jv=pa,Mg=Dv,f4=jv("Object.prototype.toString"),fI=qc(),dw=typeof globalThis>"u"?Gd:globalThis,J0=h4(),qv=jv("String.prototype.slice"),v0=Object.getPrototypeOf,p4=jv("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:m4(e)}return Mg?d4(e):null},y4=pa,mw=y4("ArrayBuffer.prototype.byteLength",!0),_4=iI,v4=function(e){return _4(e)?mw?mw(e):e.byteLength:NaN},pI=JM,vl=pa,gw=xA,b4=_l,mf=Nk,x4=HE,yw=qk,_w=FE,vw=ZE,bw=iI,xw=$k,ww=r3,Sw=o3,Ew=Pv,Iw=R3,Cw=j3,Tw=g4,Lw=v4,Pw=vl("SharedArrayBuffer.prototype.byteLength",!0),Mw=vl("Date.prototype.getTime"),b0=Object.getPrototypeOf,Aw=vl("Object.prototype.toString"),$g=b4("%Set%",!0),Q0=vl("Map.prototype.has",!0),ey=vl("Map.prototype.get",!0),kw=vl("Map.prototype.size",!0),ty=vl("Set.prototype.add",!0),dI=vl("Set.prototype.delete",!0),ny=vl("Set.prototype.has",!0),Ag=vl("Set.prototype.size",!0);function Dw(t,e,n,r){for(var i=mf(t),a;(a=i.next())&&!a.done;)if(Ta(e,a.value,n,r))return dI(t,a.value),!0;return!1}function mI(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 w4(t,e,n,r,i,a){var c=mI(n);if(c!=null)return c;var l=ey(e,c),m=pI({},i,{strict:!1});return typeof l>"u"&&!Q0(e,c)||!Ta(r,l,m,a)?!1:!Q0(t,c)&&Ta(r,l,m,a)}function S4(t,e,n){var r=mI(n);return r??(ny(e,r)&&!ny(t,r))}function Rw(t,e,n,r,i,a){for(var c=mf(t),l,m;(l=c.next())&&!l.done;)if(m=l.value,Ta(n,m,i,a)&&Ta(r,ey(e,m),i,a))return dI(t,m),!0;return!1}function Ta(t,e,n,r){var i=n||{};if(i.strict?yw(t,e):t===e)return!0;var a=Iw(t),c=Iw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?yw(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),C4(t,e,i,r)}function Nw(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 E4(t,e,n,r){if(Ag(t)!==Ag(e))return!1;for(var i=mf(t),a=mf(e),c,l,m;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")m||(m=new $g),ty(m,c.value);else if(!ny(e,c.value)){if(n.strict||!S4(t,e,c.value))return!1;m||(m=new $g),ty(m,c.value)}if(m){for(;(l=a.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Dw(m,l.value,n.strict,r))return!1}else if(!n.strict&&!ny(t,l.value)&&!Dw(m,l.value,n.strict,r))return!1;return Ag(m)===0}return!0}function I4(t,e,n,r){if(kw(t)!==kw(e))return!1;for(var i=mf(t),a=mf(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 $g),ty(m,w);else if(E=ey(e,w),typeof E>"u"&&!Q0(e,w)||!Ta(S,E,n,r)){if(n.strict||!w4(t,e,w,S,n,r))return!1;m||(m=new $g),ty(m,w)}if(m){for(;(l=a.next())&&!l.done;)if(w=l.value[0],E=l.value[1],w&&typeof w=="object"){if(!Rw(m,t,w,E,n,r))return!1}else if(!n.strict&&(!t.has(w)||!Ta(ey(t,w),E,n,r))&&!Rw(m,t,w,E,pI({},n,{strict:!1}),r))return!1;return Ag(m)===0}return!0}function C4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||Aw(t)!==Aw(e)||_w(t)!==_w(e))return!1;var c=vw(t),l=vw(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=ww(t),E=ww(e);if(S!==E||(S||E)&&(t.source!==e.source||gw(t)!==gw(e)))return!1;var P=xw(t),D=xw(e);if(P!==D||(P||D)&&Mw(t)!==Mw(e)||n.strict&&b0&&b0(t)!==b0(e))return!1;var k=Tw(t),U=Tw(e);if(k!==U)return!1;if(k||U){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(ge[i]!=pe[i])return!1;for(i=ge.length-1;i>=0;i--)if(a=ge[i],!Ta(t[a],e[a],n,r))return!1;var oe=Cw(t),fe=Cw(e);return oe!==fe?!1:oe==="Set"||fe==="Set"?E4(t,e,n,r):oe==="Map"?I4(t,e,n,r):!0}var T4=function(e,n,r){return Ta(e,n,r,x4())};const L4=Lv(T4);var P4=Object.defineProperty,nr=(t,e)=>P4(t,"name",{value:e,configurable:!0}),M4=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||!ld(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=$0(e),i=$0(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 ld(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?L4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return ld(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)}};nr(M4,"GeojsonEquality");function ld(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}nr(ld,"sameLength");function $0(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}nr($0,"explode");var Ss=63710088e-1,gI={centimeters:Ss*100,centimetres:Ss*100,degrees:360/(2*Math.PI),feet:Ss*3.28084,inches:Ss*39.37,kilometers:Ss/1e3,kilometres:Ss/1e3,meters:Ss,metres:Ss,miles:Ss/1609.344,millimeters:Ss*1e3,millimetres:Ss*1e3,nauticalmiles:Ss/1852,radians:1,yards:Ss*1.0936},Ow={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 cl(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}nr(cl,"feature");function A4(t,e,n={}){switch(t){case"Point":return Vl(e).geometry;case"LineString":return jl(e).geometry;case"Polygon":return Wv(e).geometry;case"MultiPoint":return _I(e).geometry;case"MultiLineString":return yI(e).geometry;case"MultiPolygon":return vI(e).geometry;default:throw new Error(t+" is invalid")}}nr(A4,"geometry");function Vl(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(!ry(t[0])||!ry(t[1]))throw new Error("coordinates must contain numbers");return cl({type:"Point",coordinates:t},e,n)}nr(Vl,"point");function k4(t,e,n={}){return Ey(t.map(r=>Vl(r,e)),n)}nr(k4,"points");function Wv(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;aWv(r,e)),n)}nr(D4,"polygons");function jl(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return cl({type:"LineString",coordinates:t},e,n)}nr(jl,"lineString");function R4(t,e,n={}){return Ey(t.map(r=>jl(r,e)),n)}nr(R4,"lineStrings");function Ey(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}nr(Ey,"featureCollection");function yI(t,e,n={}){return cl({type:"MultiLineString",coordinates:t},e,n)}nr(yI,"multiLineString");function _I(t,e,n={}){return cl({type:"MultiPoint",coordinates:t},e,n)}nr(_I,"multiPoint");function vI(t,e,n={}){return cl({type:"MultiPolygon",coordinates:t},e,n)}nr(vI,"multiPolygon");function N4(t,e,n={}){return cl({type:"GeometryCollection",geometries:t},e,n)}nr(N4,"geometryCollection");function O4(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}nr(O4,"round");function bI(t,e="kilometers"){const n=gI[e];if(!n)throw new Error(e+" units is invalid");return t*n}nr(bI,"radiansToLength");function Hv(t,e="kilometers"){const n=gI[e];if(!n)throw new Error(e+" units is invalid");return t/n}nr(Hv,"lengthToRadians");function z4(t,e){return xI(Hv(t,e))}nr(z4,"lengthToDegrees");function F4(t){let e=t%360;return e<0&&(e+=360),e}nr(F4,"bearingToAzimuth");function xI(t){return t%(2*Math.PI)*180/Math.PI}nr(xI,"radiansToDegrees");function B4(t){return t%360*Math.PI/180}nr(B4,"degreesToRadians");function V4(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return bI(Hv(t,e),n)}nr(V4,"convertLength");function U4(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=Ow[e];if(!r)throw new Error("invalid original units");const i=Ow[n];if(!i)throw new Error("invalid final units");return t/r*i}nr(U4,"convertArea");function ry(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}nr(ry,"isNumber");function Zv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}nr(Zv,"isObject");function G4(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(!ry(e))throw new Error("bbox must only contain numbers")})}nr(G4,"validateBBox");function j4(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")}nr(j4,"validateId");var q4=Object.defineProperty,ho=(t,e)=>q4(t,"name",{value:e,configurable:!0});function Uf(t,e,n){if(t!==null)for(var r,i,a,c,l,m,w,S=0,E=0,P,D=t.type,k=D==="FeatureCollection",U=D==="Feature",j=k?t.features.length:1,$=0;$m||k>w||U>S){l=E,m=r,w=k,S=U,a=0;return}var j=jl([l,E],n.properties);if(e(j,r,i,U,a)===!1)return!1;a++,l=E})===!1)return!1}}})}ho(EI,"segmentEach");function J4(t,e,n){var r=n,i=!1;return EI(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}ho(J4,"segmentReduce");function II(t,e){if(!t)throw new Error("geojson is required");Iy(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;ltD(t,"name",{value:e,configurable:!0});function Yv(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Uf(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 y=this.sampleCurveX(h)-u;if(Math.abs(y)y?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(P);let U,j;function $(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function B(){if(j==null&&(j=!1,$())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const y=4*p;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){j=!0;break}}}return j||!1}function W(u,o,h,p){const y=new k(u,o,h,p);return function(b){return y.solve(b)}}const X=W(.25,.1,.25,1);function re(u,o,h){return Math.min(h,Math.max(o,u))}function ge(u,o,h){const p=h-o,y=((u-o)%p+p)%p+o;return y===o?h:y}function pe(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let oe=1;function fe(u,o,h){const p={};for(const y in u)p[y]=o.call(h||this,u[y],y,u);return p}function Te(u,o,h){const p={};for(const y in u)o.call(h||this,u[y],y,u)&&(p[y]=u[y]);return p}function Z(u){return Array.isArray(u)?u.map(Z):typeof u=="object"&&u?fe(u,Z):u}const ne={};function Ke(u){ne[u]||(typeof console<"u"&&console.warn(u),ne[u]=!0)}function Ee(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function Ze(u){let o=0;for(let h,p,y=0,b=u.length,x=b-1;y"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"),L=new Uint8ClampedArray(p*y*4);if(yield b.copyTo(L,function(A,N,O,G,H){const K=4*Math.max(-N,0),te=(Math.max(0,O)-O)*G*4+K,le=4*G,de=Math.max(0,N),Ae=Math.max(0,O);return{rect:{x:de,y:Ae,width:Math.min(A.width,N+G)-de,height:Math.min(A.height,O+H)-Ae},layout:[{offset:te,stride:le}]}}(u,o,h,p,y)),I)for(let A=0;Att(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Sr=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=vn(u.url);if(p)return p(u,o);if(tt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Rn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test(kr())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,y){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:kr(),signal:y.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new wr(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 L=yield I;if(y.signal.aborted)throw Tn();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(u,o);if(tt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Rn},o)}var h;return function(p,y){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 L in p.headers)I.setRequestHeader(L,p.headers[L]);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(!y.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let L=I.response;if(p.type==="json")try{L=JSON.parse(I.response)}catch(A){return void x(A)}b({data:L,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const L=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});x(new wr(I.status,I.statusText,p.url,L))}},y.signal.addEventListener("abort",()=>{I.abort(),x(Tn())}),I.send(p.body)})}(u,o)};function dr(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 Qe(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function ye(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Pe{constructor(o,h={}){pe(this,h),this.type=o}}class Ct extends Pe{constructor(o,h={}){super("error",pe({error:o},h))}}class Nn{on(o,h){return this._listeners=this._listeners||{},Qe(o,h,this._listeners),this}off(o,h){return ye(o,h,this._listeners),ye(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Qe(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Pe(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const y=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const I of y)I.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const I of b)ye(p,I,this._oneTimeListeners),I.call(this,o);const x=this._eventedParent;x&&(pe(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof Ct&&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 Jt=["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 Jt.forEach(p=>{p in o&&(h[p]=o[p])}),h}function ln(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 xe=[ti,ft,tn,$t,Rr,Gr,Jo,J(Qt),ue,V,q];function Q(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(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 xe)if(!Q(h,o))return null}}return`Expected ${ie(u)} but found ${ie(o)} instead.`}function we(u,o){return o.some(h=>h.kind===u.kind)}function me(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 Me(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const Ue=.96422,We=.82521,Xe=4/29,Lt=6/29,Dt=3*Lt*Lt,Ht=Lt*Lt*Lt,Zt=Math.PI/180,wn=180/Math.PI;function Xn(u){return(u%=360)<0&&(u+=360),u}function lr([u,o,h,p]){let y,b;const x=sn((.2225045*(u=ni(u))+.7168786*(o=ni(o))+.0606169*(h=ni(h)))/1);u===o&&o===h?y=b=x:(y=sn((.4360747*u+.3850649*o+.1430804*h)/Ue),b=sn((.0139322*u+.0971045*o+.7141733*h)/We));const I=116*x-16;return[I<0?0:I,500*(y-x),200*(x-b),p]}function ni(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function sn(u){return u>Ht?Math.pow(u,1/3):u/Dt+Xe}function Er([u,o,h,p]){let y=(u+16)/116,b=isNaN(o)?y:y+o/500,x=isNaN(h)?y:y-h/200;return y=1*$i(y),b=Ue*$i(b),x=We*$i(x),[li(3.1338561*b-1.6168667*y-.4906146*x),li(-.9787684*b+1.9161415*y+.033454*x),li(.0719453*b-.2289914*y+1.4052427*x),p]}function li(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function $i(u){return u>Lt?u*u*u:Dt*(u-Xe)}function fo(u){return parseInt(u.padEnd(2,u),16)/255}function xi(u,o){return zs(o?u/100:u,0,1)}function zs(u,o,h){return Math.min(Math.max(o,u),h)}function nm(u){return!u.some(Number.isNaN)}const Wy={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 Gn{constructor(o,h,p,y=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=y,b||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,h,p,y]))}static parse(o){if(o instanceof Gn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Wy[p];if(y){const[x,I,L]=y;return[x/255,I/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let I=1;return[fo(p.slice(I,I+=x)),fo(p.slice(I,I+=x)),fo(p.slice(I,I+=x)),fo(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,L,A,N,O,G,H,K,te,le,de,Ae]=x,_e=[N||" ",H||" ",le].join("");if(_e===" "||_e===" /"||_e===",,"||_e===",,,"){const Ce=[A,G,te].join(""),Ye=Ce==="%%%"?100:Ce===""?255:0;if(Ye){const Je=[zs(+L/Ye,0,1),zs(+O/Ye,0,1),zs(+K/Ye,0,1),de?xi(+de,Ae):1];if(nm(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,L,A,N,O,G,H,K]=b,te=[L||" ",N||" ",G].join("");if(te===" "||te===" /"||te===",,"||te===",,,"){const le=[+I,zs(+A,0,100),zs(+O,0,100),H?xi(+H,K):1];if(nm(le))return function([de,Ae,_e,Ce]){function Ye(Je){const bt=(Je+de/30)%12,Tt=Ae*Math.min(_e,1-_e);return _e-Tt*Math.max(-1,Math.min(bt-3,9-bt,1))}return de=Xn(de),Ae/=100,_e/=100,[Ye(0),Ye(8),Ye(4),Ce]}(le)}}}(o);return h?new Gn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:y}=this,b=y||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,y])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,y,b]=lr(o),x=Math.sqrt(p*p+y*y);return[Math.round(1e4*x)?Xn(Math.atan2(y,p)*wn):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",lr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,y]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${y})`}}Gn.black=new Gn(0,0,0,1),Gn.white=new Gn(1,1,1,1),Gn.transparent=new Gn(0,0,0,0),Gn.red=new Gn(1,0,0,1);class Jf{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 Qf{constructor(o,h,p,y,b){this.text=o,this.image=h,this.scale=p,this.fontStack=y,this.textColor=b}}class Ao{constructor(o){this.sections=o}static fromString(o){return new Ao([new Qf(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Ao?o:Ao.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class po{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof po)return o;if(typeof o=="number")return new po([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 po(o)}}toString(){return JSON.stringify(this.values)}}const Yu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Qo)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&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 Jc(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof Gn||u instanceof Jf||u instanceof Ao||u instanceof po||u instanceof Qo||u instanceof $o)return!0;if(Array.isArray(u)){for(const o of u)if(!Jc(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!Jc(u[o]))return!1;return!0}return!1}function ri(u){if(u===null)return ti;if(typeof u=="string")return tn;if(typeof u=="boolean")return $t;if(typeof u=="number")return ft;if(u instanceof Gn)return Rr;if(u instanceof Jf)return ya;if(u instanceof Ao)return Gr;if(u instanceof po)return ue;if(u instanceof Qo)return q;if(u instanceof $o)return V;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const y=ri(p);if(h){if(h===y)continue;h=Qt;break}h=y}return J(h||Qt,o)}return Jo}function Ku(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Gn||u instanceof Ao||u instanceof po||u instanceof Qo||u instanceof $o?u.toString():JSON.stringify(u)}class Ga{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(!Jc(o[1]))return h.error("invalid value");const p=o[1];let y=ri(p);const b=h.expectedType;return y.kind!=="array"||y.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(y=b),new Ga(y,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class mr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Qc={string:tn,number:ft,boolean:$t,object:Jo};class ko{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,y=1;const b=o[0];if(b==="array"){let I,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Qc)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);I=Qc[A],y++}else I=Qt;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);L=o[2],y++}p=J(I,L)}else{if(!Qc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Qc[b]}const x=[];for(;yo.outputDefined())}}const $c={"to-boolean":$t,"to-color":Rr,"to-number":ft,"to-string":tn};class Fs{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!$c[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const y=$c[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:iu(h[0],h[1],h[2],h[3]),!p))return new Gn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new mr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const y=po.parse(h);if(y)return y}throw new mr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const y=Qo.parse(h);if(y)return y}throw new mr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const y=Number(h);if(!isNaN(y))return y}throw new mr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ao.fromString(Ku(this.args[0].evaluate(o)));case"resolvedImage":return $o.fromString(Ku(this.args[0].evaluate(o)));default:return Ku(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Ju=["Unknown","Point","LineString","Polygon"];class jn{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"?Ju[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]=Gn.parse(o)),h}}class eh{constructor(o,h,p=[],y,b=new Sl,x=[]){this.registry=o,this.path=p,this.key=p.map(I=>`[${I}]`).join(""),this.scope=b,this.errors=x,this.expectedType=y,this._isConstant=h}parse(o,h,p,y,b={}){return h?this.concat(h,p,y)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(y,b,x){return x==="assert"?new ko(b,[y]):x==="coerce"?new Fs(b,[y]):y}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[y];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const I=this.expectedType,L=x.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||L.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(I.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(I,L))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 Ga)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const I=new jn;try{x=new Ga(x.type,x.evaluate(I))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,h,p){const y=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new eh(this.registry,this._isConstant,y,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(y=>`[${y}]`).join("")}`;this.errors.push(new Qi(p,o))}checkSubtype(o,h){const p=Q(o,h);return p&&this.error(p),p}}class ou{constructor(o,h,p){this.type=ya,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const y=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,$t);if(!y)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,$t);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,tn),!x)?null:new ou(y,b,x)}evaluate(o){return new Jf(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const ja=8192;function th(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 Qu(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function Hy(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,y=Math.pow(2,o.z);return[Math.round(h*y*ja),Math.round(p*y*ja)]}function rm(u,o,h){const p=u[0]-o[0],y=u[1]-o[1],b=u[0]-h[0],x=u[1]-h[1];return p*x-b*y==0&&p*b<=0&&y*x<=0}function nh(u,o){let h=!1;for(let x=0,I=o.length;x(p=u)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-y[0])*(p[1]-y[1])/(b[1]-y[1])+y[0]&&(h=!h)}}var p,y,b;return h}function Zy(u,o){for(let h=0;h0&&I<0||x<0&&I>0}function Xy(u,o,h){for(const A of h)for(let N=0;Nh[2]){const y=.5*p;let b=u[0]-h[0]>y?-p:h[0]-u[0]>y?p:0;b===0&&(b=u[0]-h[2]>y?-p:h[2]-u[0]>y?p:0),u[0]+=b}th(o,u)}function ih(u,o,h,p){const y=Math.pow(2,p.z)*ja,b=[p.x*ja,p.y*ja],x=[];for(const I of u)for(const L of I){const A=[L.x+b[0],L.y+b[1]];lm(A,o,h,y),x.push(A)}return x}function um(u,o,h,p){const y=Math.pow(2,p.z)*ja,b=[p.x*ja,p.y*ja],x=[];for(const L of u){const A=[];for(const N of L){const O=[N.x+b[0],N.y+b[1]];th(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=y/2){(I=o)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const L of x)for(const A of L)lm(A,o,h,y)}var I;return x}class El{constructor(o,h){this.type=$t,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(Jc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const y=[];for(const b of p.features){const{type:x,coordinates:I}=b.geometry;x==="Polygon"&&y.push(I),x==="MultiPolygon"&&y.push(...I)}if(y.length)return new El(p,{type:"MultiPolygon",coordinates:y})}else if(p.type==="Feature"){const y=p.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new El(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new El(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const I=rh(p.coordinates,b,x),L=ih(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!nh(A,I))return!1}if(p.type==="MultiPolygon"){const I=am(p.coordinates,b,x),L=ih(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!Zy(A,I))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const I=rh(p.coordinates,b,x),L=um(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!om(A,I))return!1}if(p.type==="MultiPolygon"){const I=am(p.coordinates,b,x),L=um(h.geometry(),y,b,x);if(!Qu(y,b))return!1;for(const A of L)if(!sm(A,I))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class oh{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 oh(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Do{constructor(o,h,p,y){this.name=o,this.type=h,this._evaluate=p,this.args=y}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],y=Do.definitions[p];if(!y)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(y)?y[0]:y.type,x=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,I=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,N]of I){L=new eh(h.registry,$u,h.path,null,h.scope);const O=[];let G=!1;for(let H=1;H{return G=O,Array.isArray(G)?`(${G.map(ie).join(", ")})`:`(${ie(G.type)}...)`;var G}).join(" | "),N=[];for(let O=1;O{h=o?h&&$u(p):h&&p instanceof Ga}),!!h&&sh(u)&&tc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function sh(u){if(u instanceof Do&&(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 El)return!1;let o=!0;return u.eachChild(h=>{o&&!sh(h)&&(o=!1)}),o}function ec(u){if(u instanceof Do&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!ec(h)&&(o=!1)}),o}function tc(u,o){if(u instanceof Do&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!tc(p,o)&&(h=!1)}),h}function nc(u,o){const h=u.length-1;let p,y,b=0,x=h,I=0;for(;b<=x;)if(I=Math.floor((b+x)/2),p=u[I],y=u[I+1],p<=o){if(I===h||oo))throw new mr("Input is not a number.");x=I-1}return 0}class rc{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[y,b]of p)this.labels.push(y),this.outputs.push(b)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,ft);if(!p)return null;const y=[];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(L,N,b);if(!O)return null;b=b||O.type,y.push([I,O])}return new rc(b,p,y)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const b=h.length;return y>=h[b-1]?p[b-1].evaluate(o):p[nc(h,y)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Yy(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var Ky=cm;function cm(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}cm.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 y=this.sampleCurveX(h)-u;if(Math.abs(y)y?x=h:I=h,h=.5*(I-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var Jy=Yy(Ky);function Il(u,o,h){return u+h*(o-u)}function ah(u,o,h){return u.map((p,y)=>Il(p,o[y],h))}const eo={number:Il,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[y,b,x,I]=ah(u.rgb,o.rgb,h);return new Gn(y,b,x,I,!1)}case"hcl":{const[y,b,x,I]=u.hcl,[L,A,N,O]=o.hcl;let G,H;if(isNaN(y)||isNaN(L))isNaN(y)?isNaN(L)?G=NaN:(G=L,x!==1&&x!==0||(H=A)):(G=y,N!==1&&N!==0||(H=b));else{let Ae=L-y;L>y&&Ae>180?Ae-=360:L180&&(Ae+=360),G=y+h*Ae}const[K,te,le,de]=function([Ae,_e,Ce,Ye]){return Ae=isNaN(Ae)?0:Ae*Zt,Er([Ce,Math.cos(Ae)*_e,Math.sin(Ae)*_e,Ye])}([G,H??Il(b,A,h),Il(x,N,h),Il(I,O,h)]);return new Gn(K,te,le,de,!1)}case"lab":{const[y,b,x,I]=Er(ah(u.lab,o.lab,h));return new Gn(y,b,x,I,!1)}}},array:ah,padding:function(u,o,h){return new po(ah(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,y=o.values;if(p.length!==y.length)throw new mr(`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);y={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(b=h.parse(b,2,ft),!b)return null;const I=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Rr:h.expectedType&&h.expectedType.kind!=="value"&&(L=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 K=h.parse(O,H,L);if(!K)return null;L=L||K.type,I.push([N,K])}return Me(L,ft)||Me(L,Rr)||Me(L,ue)||Me(L,q)||Me(L,J(ft))?new Oi(L,p,y,b,I):h.error(`Type ${ie(L)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const b=h.length;if(y>=h[b-1])return p[b-1].evaluate(o);const x=nc(h,y),I=Oi.interpolationFactor(this.interpolation,y,h[x],h[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return eo[this.type.kind](L,A,I);case"interpolate-hcl":return eo.color(L,A,I,"hcl");case"interpolate-lab":return eo.color(L,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 y=p-h,b=u-h;return y===0?0:o===1?b/y:(Math.pow(o,b)-1)/(Math.pow(o,y)-1)}class lh{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const y=h.expectedType;y&&y.kind!=="value"&&(p=y);const b=[];for(const I of o.slice(1)){const L=h.parse(I,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=y&&b.some(I=>Q(y,I.type));return new lh(x?Qt:p,b)}evaluate(o){let h,p=null,y=0;for(const b of this.args)if(y++,p=b.evaluate(o),p&&p instanceof $o&&!p.available&&(h||(h=p.name),p=null,y===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class uh{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 mr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new mr(`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 ep{constructor(o,h){this.type=$t,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,Qt),y=h.parse(o[2],2,Qt);return p&&y?we(p.type,[$t,tn,ft,ti,Qt])?new ep(p,y):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!me(h,["boolean","string","number","null"]))throw new mr(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ri(h))} instead.`);if(!me(p,["string","array"]))throw new mr(`Expected second argument to be of type array or string, but found ${ie(ri(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class ch{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,Qt),y=h.parse(o[2],2,Qt);if(!p||!y)return null;if(!we(p.type,[$t,tn,ft,ti,Qt]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new ch(p,y,b):null}return new ch(p,y)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!me(h,["boolean","string","number","null"]))throw new mr(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ri(h))} instead.`);if(!me(p,["string","array"]))throw new mr(`Expected second argument to be of type array or string, but found ${ie(ri(p))} instead.`);if(this.fromIndex){const y=this.fromIndex.evaluate(o);return p.indexOf(h,y)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class tp{constructor(o,h,p,y,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=y,this.outputs=b,this.otherwise=x}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,ri(K)))return null}else p=ri(K);if(b[String(K)]!==void 0)return G.error("Branch labels must be unique.");b[String(K)]=x.length}const H=h.parse(O,A,y);if(!H)return null;y=y||H.type,x.push(H)}const I=h.parse(o[1],1,Qt);if(!I)return null;const L=h.parse(o[o.length-1],o.length-1,y);return L?I.type.kind!=="value"&&h.concat(1).checkSubtype(p,I.type)?null:new tp(p,y,I,b,x,L):null}evaluate(o){const h=this.input.evaluate(o);return(ri(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 np{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const y=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class hh{constructor(o,h,p,y){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=y}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Qt),y=h.parse(o[2],2,ft);if(!p||!y)return null;if(!we(p.type,[J(Qt),tn,Qt]))return h.error(`Expected first argument to be of type array or string, but found ${ie(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new hh(p.type,p,y,b):null}return new hh(p.type,p,y)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!me(h,["string","array"]))throw new mr(`Expected first argument to be of type array or string, but found ${ie(ri(h))} instead.`);if(this.endIndex){const y=this.endIndex.evaluate(o);return h.slice(p,y)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function hm(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 fm(u,o,h,p){return p.compare(o,h)===0}function su(u,o,h){const p=u!=="=="&&u!=="!=";return class TI{constructor(b,x,I){this.type=$t,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 L=x.parse(b[1],1,Qt);if(!L)return null;if(!hm(I,L.type))return x.concat(1).error(`"${I}" comparisons are not supported for type '${ie(L.type)}'.`);let A=x.parse(b[2],2,Qt);if(!A)return null;if(!hm(I,A.type))return x.concat(2).error(`"${I}" comparisons are not supported for type '${ie(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${ie(L.type)}' and '${ie(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new ko(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new ko(L.type,[A])));let N=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,ya),!N)return null}return new TI(L,A,N)}evaluate(b){const x=this.lhs.evaluate(b),I=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=ri(x),A=ri(I);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new mr(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=ri(x),A=ri(I);if(L.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 Qy=su("==",function(u,o,h){return o===h},fm),$y=su("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!fm(0,o,h,p)}),e_=su("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),n_=su("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),r_=su(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class rp{constructor(o,h,p,y,b){this.type=tn,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=y,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ft);if(!p)return null;const y=o[2];if(typeof y!="object"||Array.isArray(y))return h.error("NumberFormat options argument must be an object.");let b=null;if(y.locale&&(b=h.parse(y.locale,1,tn),!b))return null;let x=null;if(y.currency&&(x=h.parse(y.currency,1,tn),!x))return null;let I=null;if(y["min-fraction-digits"]&&(I=h.parse(y["min-fraction-digits"],1,ft),!I))return null;let L=null;return y["max-fraction-digits"]&&(L=h.parse(y["max-fraction-digits"],1,ft),!L)?null:new rp(p,b,x,I,L)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class fh{constructor(o){this.type=Gr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const y=[];let b=!1;for(let x=1;x<=o.length-1;++x){const I=o[x];if(b&&typeof I=="object"&&!Array.isArray(I)){b=!1;let L=null;if(I["font-scale"]&&(L=h.parse(I["font-scale"],1,ft),!L))return null;let A=null;if(I["text-font"]&&(A=h.parse(I["text-font"],1,J(tn)),!A))return null;let N=null;if(I["text-color"]&&(N=h.parse(I["text-color"],1,Rr),!N))return null;const O=y[y.length-1];O.scale=L,O.font=A,O.textColor=N}else{const L=h.parse(o[x],1,Qt);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,y.push({content:L,scale:null,font:null,textColor:null})}}return new fh(y)}evaluate(o){return new Ao(this.sections.map(h=>{const p=h.content.evaluate(o);return ri(p)===V?new Qf("",p,null,null,null):new Qf(Ku(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 ip{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,tn);return p?new ip(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=$o.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class op{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 ${ie(p.type)} instead.`):new op(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new mr(`Expected value to be of type string or array, but found ${ie(ri(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const au={"==":Qy,"!=":$y,">":t_,"<":e_,">=":r_,"<=":n_,array:ko,at:$f,boolean:ko,case:np,coalesce:lh,collator:ou,format:fh,image:ip,in:ep,"index-of":ch,interpolate:Oi,"interpolate-hcl":Oi,"interpolate-lab":Oi,length:op,let:uh,literal:Ga,match:tp,number:ko,"number-format":rp,object:ko,slice:hh,step:rc,string:ko,"to-boolean":Fs,"to-color":Fs,"to-number":Fs,"to-string":Fs,var:oh,within:El};function pm(u,[o,h,p,y]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const b=y?y.evaluate(u):1,x=iu(o,h,p,b);if(x)throw new mr(x);return new Gn(o/255,h/255,p/255,b,!1)}function dm(u,o){return u in o}function sp(u,o){const h=o[u];return h===void 0?null:h}function Cl(u){return{type:u}}function mm(u){return{result:"success",value:u}}function lu(u){return{result:"error",value:u}}function uu(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function gm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function ap(u){return!!u.expression&&u.expression.interpolated}function Cn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function ph(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function i_(u){return u}function ym(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",y=p||!(p||u.property!==void 0),b=u.type||(ap(o)?"exponential":"interval");if(h||o.type==="padding"){const N=h?Gn.parse:po.parse;(u=Ko({},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,L,A;if(b==="exponential")I=Sn;else if(b==="interval")I=o_;else if(b==="categorical"){I=jr,L=Object.create(null);for(const N of u.stops)L[N[0]]=N[1];A=typeof u.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);I=lp}if(p){const N={},O=[];for(let K=0;KK[0]),evaluate:({zoom:K},te)=>Sn({stops:G,base:u.base},o,K).evaluate(K,te)}}if(y){const N=b==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:Oi.interpolationFactor.bind(void 0,N),zoomStops:u.stops.map(O=>O[0]),evaluate:({zoom:O})=>I(u,o,O,L,A)}}return{kind:"source",evaluate(N,O){const G=O&&O.properties?O.properties[u.property]:void 0;return G===void 0?ic(u.default,o.default):I(u,o,G,L,A)}}}function ic(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function jr(u,o,h,p,y){return ic(typeof h===y?p[h]:void 0,u.default,o.default)}function o_(u,o,h){if(Cn(h)!=="number")return ic(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 y=nc(u.stops.map(b=>b[0]),h);return u.stops[y][1]}function Sn(u,o,h){const p=u.base!==void 0?u.base:1;if(Cn(h)!=="number")return ic(u.default,o.default);const y=u.stops.length;if(y===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[y-1][0])return u.stops[y-1][1];const b=nc(u.stops.map(N=>N[0]),h),x=function(N,O,G,H){const K=H-G,te=N-G;return K===0?0:O===1?te/K:(Math.pow(O,te)-1)/(Math.pow(O,K)-1)}(h,p,u.stops[b][0],u.stops[b+1][0]),I=u.stops[b][1],L=u.stops[b+1][1],A=eo[o.type]||i_;return typeof I.evaluate=="function"?{evaluate(...N){const O=I.evaluate.apply(void 0,N),G=L.evaluate.apply(void 0,N);if(O!==void 0&&G!==void 0)return A(O,G,x,u.colorSpace)}}:A(I,L,x,u.colorSpace)}function lp(u,o,h){switch(o.type){case"color":h=Gn.parse(h);break;case"formatted":h=Ao.fromString(h.toString());break;case"resolvedImage":h=$o.fromString(h.toString());break;case"padding":h=po.parse(h);break;default:Cn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return ic(h,u.default,o.default)}Do.register(au,{error:[{kind:"error"},[tn],(u,[o])=>{throw new mr(o.evaluate(u))}],typeof:[tn,[Qt],(u,[o])=>ie(ri(o.evaluate(u)))],"to-rgba":[J(ft,4),[Rr],(u,[o])=>{const[h,p,y,b]=o.evaluate(u).rgb;return[255*h,255*p,255*y,b]}],rgb:[Rr,[ft,ft,ft],pm],rgba:[Rr,[ft,ft,ft,ft],pm],has:{type:$t,overloads:[[[tn],(u,[o])=>dm(o.evaluate(u),u.properties())],[[tn,Jo],(u,[o,h])=>dm(o.evaluate(u),h.evaluate(u))]]},get:{type:Qt,overloads:[[[tn],(u,[o])=>sp(o.evaluate(u),u.properties())],[[tn,Jo],(u,[o,h])=>sp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[Qt,[tn],(u,[o])=>sp(o.evaluate(u),u.featureState||{})],properties:[Jo,[],u=>u.properties()],"geometry-type":[tn,[],u=>u.geometryType()],id:[Qt,[],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:[Qt,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ft,Cl(ft),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[ft,Cl(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,Cl(ft),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[ft,Cl(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-==":[$t,[tn,Qt],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[$t,[Qt],(u,[o])=>u.id()===o.value],"filter-type-==":[$t,[tn],(u,[o])=>u.geometryType()===o.value],"filter-<":[$t,[tn,Qt],(u,[o,h])=>{const p=u.properties()[o.value],y=h.value;return typeof p==typeof y&&p{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[$t,[tn,Qt],(u,[o,h])=>{const p=u.properties()[o.value],y=h.value;return typeof p==typeof y&&p>y}],"filter-id->":[$t,[Qt],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[$t,[tn,Qt],(u,[o,h])=>{const p=u.properties()[o.value],y=h.value;return typeof p==typeof y&&p<=y}],"filter-id-<=":[$t,[Qt],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[$t,[tn,Qt],(u,[o,h])=>{const p=u.properties()[o.value],y=h.value;return typeof p==typeof y&&p>=y}],"filter-id->=":[$t,[Qt],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[$t,[Qt],(u,[o])=>o.value in u.properties()],"filter-has-id":[$t,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[$t,[J(tn)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[$t,[J(Qt)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[$t,[tn,J(Qt)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[$t,[tn,J(Qt)],(u,[o,h])=>function(p,y,b,x){for(;b<=x;){const I=b+x>>1;if(y[I]===p)return!0;y[I]>p?x=I-1:b=I+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:$t,overloads:[[[$t,$t],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Cl($t),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:$t,overloads:[[[$t,$t],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Cl($t),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[$t,[$t],(u,[o])=>!o.evaluate(u)],"is-supported-script":[$t,[tn],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[tn,[tn],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[tn,[tn],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[tn,Cl(Qt),(u,o)=>o.map(h=>Ku(h.evaluate(u))).join("")],"resolved-locale":[tn,[ya],(u,[o])=>o.evaluate(u).resolvedLocale()]});class rr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new jn,this._defaultValue=h?(p=h).type==="color"&&ph(p.default)?new Gn(0,0,0,0):p.type==="color"?Gn.parse(p.default)||null:p.type==="padding"?po.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Qo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,y,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=y,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const 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 mr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).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 au}function Tl(u,o){const h=new eh(au,$u,[],o?function(y){const b={color:Rr,string:tn,number:ft,enum:tn,boolean:$t,formatted:Gr,padding:ue,resolvedImage:V,variableAnchorOffsetCollection:q};return y.type==="array"?J(b[y.value]||Qt,y.length):b[y.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?mm(new rr(p,o)):lu(h.errors)}class dh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!ec(h.expression)}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,b,x)}evaluate(o,h,p,y,b,x){return this._styleExpression.evaluate(o,h,p,y,b,x)}}class up{constructor(o,h,p,y){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!ec(h.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,h,p,y,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,b,x)}evaluate(o,h,p,y,b,x){return this._styleExpression.evaluate(o,h,p,y,b,x)}interpolationFactor(o,h,p){return this.interpolationType?Oi.interpolationFactor(this.interpolationType,o,h,p):0}}function _m(u,o){const h=Tl(u,o);if(h.result==="error")return h;const p=h.value.expression,y=sh(p);if(!y&&!uu(o))return lu([new Qi("","data expressions not supported")]);const b=tc(p,["zoom"]);if(!b&&!gm(o))return lu([new Qi("","zoom expressions not supported")]);const x=gh(p);return x||b?x instanceof Qi?lu([x]):x instanceof Oi&&!ap(o)?lu([new Qi("",'"interpolate" expressions cannot be used with this property')]):mm(x?new up(y?"camera":"composite",h.value,x.labels,x instanceof Oi?x.interpolation:void 0):new dh(y?"constant":"source",h.value)):lu([new Qi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class mh{constructor(o,h){this._parameters=o,this._specification=h,Ko(this,ym(this._parameters,this._specification))}static deserialize(o){return new mh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function gh(u){let o=null;if(u instanceof uh)o=gh(u.result);else if(u instanceof lh){for(const h of u.args)if(o=gh(h),o)break}else(u instanceof rc||u instanceof Oi)&&u.input instanceof Do&&u.input.name==="zoom"&&(o=u);return o instanceof Qi||u.eachChild(h=>{const p=gh(h);p instanceof Qi?o=p:!o&&p?o=new Qi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Qi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function yh(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(!yh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const vm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _h(u){if(u==null)return{filter:()=>!0,needGeometry:!1};yh(u)||(u=bh(u));const o=Tl(u,vm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,y)=>o.value.evaluate(h,p,{},y),needGeometry:vh(u)}}function bm(u,o){return uo?1:0}function vh(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?cp(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(bh))):o==="all"?["all"].concat(u.slice(1).map(bh)):o==="none"?["all"].concat(u.slice(1).map(bh).map(xh)):o==="in"?xm(u[1],u.slice(2)):o==="!in"?xh(xm(u[1],u.slice(2))):o==="has"?wm(u[1]):o==="!has"?xh(wm(u[1])):o!=="within"||u;var h}function cp(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 xm(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(bm)]]:["filter-in-small",u,["literal",o]]}}function wm(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function xh(u){return["!",u]}function hp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let y="[";for(const b of u)y+=`${hp(b)},`;return`${y}]`}const h=Object.keys(u).sort();let p="{";for(let y=0;yp.maximum?[new at(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Em(u){const o=u.valueSpec,h=Ir(u.value.type);let p,y,b,x={};const I=h!=="categorical"&&u.value.property===void 0,L=!I,A=Cn(u.value.stops)==="array"&&Cn(u.value.stops[0])==="array"&&Cn(u.value.stops[0][0])==="object",N=to({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 K=[];const te=H.value;return K=K.concat(fp({key:H.key,value:te,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:O})),Cn(te)==="array"&&te.length===0&&K.push(new at(H.key,te,"array must have at least one stop")),K},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"&&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&&!ap(u.valueSpec)&&N.push(new at(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(L&&!uu(u.valueSpec)?N.push(new at(u.key,u.value,"property functions not supported")):I&&!gm(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 K=[];const te=H.value,le=H.key;if(Cn(te)!=="array")return[new at(le,te,`array expected, ${Cn(te)} found`)];if(te.length!==2)return[new at(le,te,`array length 2 expected, length ${te.length} found`)];if(A){if(Cn(te[0])!=="object")return[new at(le,te,`object expected, ${Cn(te[0])} found`)];if(te[0].zoom===void 0)return[new at(le,te,"object stop key must have zoom")];if(te[0].value===void 0)return[new at(le,te,"object stop key must have value")];if(b&&b>Ir(te[0].zoom))return[new at(le,te[0].zoom,"stop zoom values must appear in ascending order")];Ir(te[0].zoom)!==b&&(b=Ir(te[0].zoom),y=void 0,x={}),K=K.concat(to({key:`${le}[0]`,value:te[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:wh,value:G}}))}else K=K.concat(G({key:`${le}[0]`,value:te[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},te));return $n(qa(te[1]))?K.concat([new at(`${le}[1]`,te[1],"expressions are not allowed in function stops.")]):K.concat(H.validateSpec({key:`${le}[1]`,value:te[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function G(H,K){const te=Cn(H.value),le=Ir(H.value),de=H.value!==null?H.value:K;if(p){if(te!==p)return[new at(H.key,de,`${te} stop domain type must match previous stop domain type ${p}`)]}else p=te;if(te!=="number"&&te!=="string"&&te!=="boolean")return[new at(H.key,de,"stop domain value must be a number, string, or boolean")];if(te!=="number"&&h!=="categorical"){let Ae=`number expected, ${te} found`;return uu(o)&&h===void 0&&(Ae+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(H.key,de,Ae)]}return h!=="categorical"||te!=="number"||isFinite(le)&&Math.floor(le)===le?h!=="categorical"&&te==="number"&&y!==void 0&&lenew 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"&&!ec(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!ec(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(!tc(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"&&!sh(h))return[new at(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ha(u){const o=u.key,h=u.value,p=u.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(Ir(h))===-1&&y.push(new at(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Ir(h))===-1&&y.push(new at(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),y}function cu(u){return yh(qa(u.value))?Wa(Ko({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):pp(u)}function pp(u){const o=u.value,h=u.key;if(Cn(o)!=="array")return[new at(h,o,`array expected, ${Cn(o)} found`)];const p=u.styleSpec;let y,b=[];if(o.length<1)return[new at(h,o,"filter array must have at least 1 element")];switch(b=b.concat(Ha({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Ir(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Ir(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&&(y=Cn(o[1]),y!=="string"&&b.push(new at(`${h}[1]`,o[1],`string expected, ${y} found`)));for(let x=2;x{A in h&&o.push(new at(p,h[A],`"${A}" is prohibited for ref layers`))}),y.layers.forEach(A=>{Ir(A.id)===I&&(L=A)}),L?L.ref?o.push(new at(p,h.ref,"ref cannot reference another ref layer")):x=Ir(L.type):o.push(new at(p,h.ref,`ref layer "${I}" not found`))}else if(x!=="background")if(h.source){const L=y.sources&&y.sources[h.source],A=L&&Ir(L.type);L?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"&&L.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(to({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:cu,layout:L=>to({layer:h,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>mp(Ko({layerType:x},A))}}),paint:L=>to({layer:h,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>dp(Ko({layerType:x},A))}})}})),o}function Ll(u){const o=u.value,h=u.key,p=Cn(o);return p!=="string"?[new at(h,o,`string expected, ${p} found`)]:[]}const Im={promoteId:function({key:u,value:o}){if(Cn(o)==="string")return Ll({key:u,value:o});{const h=[];for(const p in o)h.push(...Ll({key:`${u}.${p}`,value:o[p]}));return h}}};function Cm(u){const o=u.value,h=u.key,p=u.styleSpec,y=u.style,b=u.validateSpec;if(!o.type)return[new at(h,o,'"type" is required')];const x=Ir(o.type);let I;switch(x){case"vector":case"raster":return I=to({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:Im,validateSpec:b}),I;case"raster-dem":return I=function(L){var A;const N=(A=L.sourceName)!==null&&A!==void 0?A:"",O=L.value,G=L.styleSpec,H=G.source_raster_dem,K=L.style;let te=[];const le=Cn(O);if(O===void 0)return te;if(le!=="object")return te.push(new at("source_raster_dem",O,`object expected, ${le} found`)),te;const de=Ir(O.encoding)==="custom",Ae=["redFactor","greenFactor","blueFactor","baseShift"],_e=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const Ce in O)!de&&Ae.includes(Ce)?te.push(new at(Ce,O[Ce],`In "${N}": "${Ce}" is only valid when "encoding" is set to "custom". ${_e} encoding found`)):H[Ce]?te=te.concat(L.validateSpec({key:Ce,value:O[Ce],valueSpec:H[Ce],validateSpec:L.validateSpec,style:K,styleSpec:G})):te.push(new at(Ce,O[Ce],`unknown property "${Ce}"`));return te}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:b}),I;case"geojson":if(I=to({key:h,value:o,valueSpec:p.source_geojson,style:y,styleSpec:p,validateSpec:b,objectElementValidators:Im}),o.cluster)for(const L in o.clusterProperties){const[A,N]=o.clusterProperties[L],O=typeof A=="string"?[A,["accumulated"],["get",L]]:A;I.push(...Wa({key:`${h}.${L}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),I.push(...Wa({key:`${h}.${L}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return I;case"video":return to({key:h,value:o,valueSpec:p.source_video,style:y,validateSpec:b,styleSpec:p});case"image":return to({key:h,value:o,valueSpec:p.source_image,style:y,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 Ha({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:b,styleSpec:p})}}function Tm(u){const o=u.value,h=u.styleSpec,p=h.light,y=u.style;let b=[];const x=Cn(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 L=I.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?u.validateSpec({key:I,value:o[I],valueSpec:h.transition,validateSpec:u.validateSpec,style:y,styleSpec:h}):p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:y,styleSpec:h}):[new at(I,o[I],`unknown property "${I}"`)])}return b}function Lm(u){const o=u.value,h=u.styleSpec,p=h.sky,y=u.style,b=Cn(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]?Bs({key:I,value:o[I],valueSpec:p[I],style:y,styleSpec:h}):[new at(I,o[I],`unknown property "${I}"`)]);return x}function sc(u){const o=u.value,h=u.styleSpec,p=h.terrain,y=u.style;let b=[];const x=Cn(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:y,styleSpec:h}):[new at(I,o[I],`unknown property "${I}"`)]);return b}function ac(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const y=[],b=[];for(const x in h)h[x].id&&y.includes(h[x].id)&&o.push(new at(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),y.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new at(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat(to({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return Ll({key:p,value:h})}const mo={"*":()=>[],array:fp,boolean:function(u){const o=u.value,h=u.key,p=Cn(o);return p!=="boolean"?[new at(h,o,`boolean expected, ${p} found`)]:[]},number:wh,color:function(u){const o=u.key,h=u.value,p=Cn(h);return p!=="string"?[new at(o,h,`color expected, ${p} found`)]:Gn.parse(String(h))?[]:[new at(o,h,`color expected, "${h}" found`)]},constants:Sm,enum:Ha,filter:cu,function:Em,layer:oc,object:to,source:Cm,light:Tm,sky:Lm,terrain:sc,string:Ll,formatted:function(u){return Ll(u).length===0?[]:Wa(u)},resolvedImage:function(u){return Ll(u).length===0?[]:Wa(u)},padding:function(u){const o=u.key,h=u.value;if(Cn(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 y=[];for(let b=0;b[]}})),u.constants&&(h=h.concat(Sm({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:Bs}))),hu(h)}function Vs(u){return function(o){return u({...o,validateSpec:Bs})}}function hu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function gs(u){return function(...o){return hu(u.apply(this,o))}}ms.source=gs(Vs(Cm)),ms.sprite=gs(Vs(ac)),ms.glyphs=gs(Vs(gp)),ms.light=gs(Vs(Tm)),ms.sky=gs(Vs(Lm)),ms.terrain=gs(Vs(sc)),ms.layer=gs(Vs(oc)),ms.filter=gs(Vs(cu)),ms.paintProperty=gs(Vs(dp)),ms.layoutProperty=gs(Vs(mp));const Pl=ms,a_=Pl.light,yp=Pl.paintProperty,l_=Pl.layoutProperty;function fu(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new Ct(new Error(p.message))),h=!0;return h}class lc{constructor(o,h,p){const y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(h=x[1])+2*(p=x[2]);for(let L=0;L=O[K+0]&&y>=O[K+1])?(I[H]=!0,x.push(N[H])):I[H]=!1}}}}_forEachCell(o,h,p,y,b,x,I,L){const A=this._convertToCellCoord(o),N=this._convertToCellCoord(h),O=this._convertToCellCoord(p),G=this._convertToCellCoord(y);for(let H=A;H<=O;H++)for(let K=N;K<=G;K++){const te=this.d*K+H;if((!L||L(this._convertFromCellCoord(H),this._convertFromCellCoord(K),this._convertFromCellCoord(H+1),this._convertFromCellCoord(K+1)))&&b.call(this,o,h,p,y,te,x,I,L))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,h=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=u[b];y[b]=Us[p].shallow.indexOf(b)>=0?x:pu(x,o)}u instanceof Error&&(y.message=u.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(y.$name=p),y}throw new Error("can't serialize object of type "+typeof u)}function du(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||Eh(u)||Ot(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(du);if(typeof u=="object"){const o=u.$name||"Object";if(!Us[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=Us[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const y of Object.keys(u)){if(y==="$name")continue;const b=u[y];p[y]=Us[o].shallow.indexOf(y)>=0?b:du(b)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Pm{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 mu(u){for(const o of u)if(Ih(o.charCodeAt(0)))return!0;return!1}function Mm(u){for(const o of u)if(!Am(o.charCodeAt(0)))return!1;return!0}function Am(u){return!(_t.Arabic(u)||_t["Arabic Supplement"](u)||_t["Arabic Extended-A"](u)||_t["Arabic Presentation Forms-A"](u)||_t["Arabic Presentation Forms-B"](u))}function Ih(u){return!(u!==746&&u!==747&&(u<4352||!(_t["Bopomofo Extended"](u)||_t.Bopomofo(u)||_t["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||_t["CJK Compatibility Ideographs"](u)||_t["CJK Compatibility"](u)||_t["CJK Radicals Supplement"](u)||_t["CJK Strokes"](u)||!(!_t["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||_t["CJK Unified Ideographs Extension A"](u)||_t["CJK Unified Ideographs"](u)||_t["Enclosed CJK Letters and Months"](u)||_t["Hangul Compatibility Jamo"](u)||_t["Hangul Jamo Extended-A"](u)||_t["Hangul Jamo Extended-B"](u)||_t["Hangul Jamo"](u)||_t["Hangul Syllables"](u)||_t.Hiragana(u)||_t["Ideographic Description Characters"](u)||_t.Kanbun(u)||_t["Kangxi Radicals"](u)||_t["Katakana Phonetic Extensions"](u)||_t.Katakana(u)&&u!==12540||!(!_t["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)||!(!_t["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||_t["Unified Canadian Aboriginal Syllabics"](u)||_t["Unified Canadian Aboriginal Syllabics Extended"](u)||_t["Vertical Forms"](u)||_t["Yijing Hexagram Symbols"](u)||_t["Yi Syllables"](u)||_t["Yi Radicals"](u))))}function _p(u){return!(Ih(u)||function(o){return!!(_t["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_t["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||_t["Letterlike Symbols"](o)||_t["Number Forms"](o)||_t["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||_t["Control Pictures"](o)&&o!==9251||_t["Optical Character Recognition"](o)||_t["Enclosed Alphanumerics"](o)||_t["Geometric Shapes"](o)||_t["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_t["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_t["CJK Symbols and Punctuation"](o)||_t.Katakana(o)||_t["Private Use Area"](o)||_t["CJK Compatibility Forms"](o)||_t["Small Form Variants"](o)||_t["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function Ch(u){return u>=1424&&u<=2303||_t["Arabic Presentation Forms-A"](u)||_t["Arabic Presentation Forms-B"](u)}function km(u,o){return!(!o&&Ch(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||_t.Khmer(u))}function u_(u){for(const o of u)if(Ch(o.charCodeAt(0)))return!0;return!1}const Za=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 ur{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 Pm,this.transition={})}isSupportedScript(o){return function(h,p){for(const y of h)if(!km(y.charCodeAt(0),p))return!1;return!0}(o,Za.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 uc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,y){if(ph(p))return new mh(p,y);if($n(p)){const b=_m(p,y);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return y.type==="color"&&typeof p=="string"?b=Gn.parse(p):y.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Qo.parse(p)):b=po.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 Th{constructor(o){this.property=o,this.value=new uc(o,void 0)}transitioned(o,h){return new Dm(this.property,this.value,h,pe({},o.transition,this.transition),o.now)}untransitioned(){return new Dm(this.property,this.value,null,{},0)}}class vp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Z(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Th(this._values[o].property)),this._values[o].value=new uc(this._values[o].property,h===null?void 0:Z(h))}getTransition(o){return Z(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Th(this._values[o].property)),this._values[o].transition=Z(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const y=this.getTransition(h);y!==void 0&&(o[`${h}-transition`]=y)}return o}transitioned(o,h){const p=new Rm(this._properties);for(const y of Object.keys(this._values))p._values[y]=this._values[y].transitioned(o,h._values[y]);return p}untransitioned(){const o=new Rm(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Dm{constructor(o,h,p,y,b){this.property=o,this.value=h,this.begin=b+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const y=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(y>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(y=1)return 1;const A=L*L,N=A*L;return 4*(L<.5?N:3*(L-A)+N-.75)}(I))}}return b}}class Rm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const y=new cc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,h,p);return y}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Nm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Z(this._values[o].value)}setValue(o,h){this._values[o]=new uc(this._values[o].property,h===null?void 0:Z(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const y=new cc(this._properties);for(const b of Object.keys(this._values))y._values[b]=this._values[b].possiblyEvaluate(o,h,p);return y}}class ys{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,y){return this.property.evaluate(this.value,this.parameters,o,h,p,y)}}class cc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class kt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const y=eo[this.specification.type];return y?y(o,h,p):o}}class Ft{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,y){return new ys(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,y)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new ys(this,{kind:"constant",value:void 0},o.parameters);const y=eo[this.specification.type];if(y){const b=y(o.value.value,h.value.value,p);return new ys(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,y,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,y,b,x)}}class Lh extends Ft{possiblyEvaluate(o,h,p,y){if(o.value===void 0)return new ys(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,y),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,I=this._calculate(x,x,x,h);return new ys(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 ys(this,{kind:"constant",value:b},h)}return new ys(this,o.expression,h)}evaluate(o,h,p,y,b,x){if(o.kind==="source"){const I=o.evaluate(h,p,y,b,x);return this._calculate(I,I,I,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,y),o.evaluate({zoom:Math.floor(h.zoom)},p,y),o.evaluate({zoom:Math.floor(h.zoom)+1},p,y),h):o.value}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class hc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,y);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new ur(Math.floor(h.zoom-1),h)),o.expression.evaluate(new ur(Math.floor(h.zoom),h)),o.expression.evaluate(new ur(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class bp{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){return!!o.expression.evaluate(h,null,{},p,y)}interpolate(){return!1}}class go{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const y=this.defaultPropertyValues[h]=new uc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new Th(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",Ft),St("DataConstantProperty",kt),St("CrossFadedDataDrivenProperty",Lh),St("CrossFadedProperty",hc),St("ColorRampProperty",bp);const xp="-transition";class _s extends Nn{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 Nm(h.layout)),h.paint)){this._transitionablePaint=new vp(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 cc(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(l_,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(xp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(yp,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(xp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const y=this._transitionablePaint._values[o],b=y.property.specification["property-type"]==="cross-faded-data-driven",x=y.value.isDataDriven(),I=y.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,I,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Te(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,y,b={}){return(!b||b.validate!==!1)&&fu(this,o.call(Pl,{key:h,layerType:this.type,objectKey:p,value:y,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 ys&&uu(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const Om={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class fc{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 Cr{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 qr(u,o=1){let h=0,p=0;return{members:u.map(y=>{const b=Om[y.type].BYTES_PER_ELEMENT,x=h=zm(h,Math.max(o,b)),I=y.components||1;return p=Math.max(p,b),h+=b*I,{name:y.name,type:y.type,components:I,offset:x}}),size:zm(h,Math.max(p,o)),alignment:o}}function zm(u,o){return Math.ceil(u/o)*o}class pc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.int16[y+0]=h,this.int16[y+1]=p,o}}pc.prototype.bytesPerElement=4,St("StructArrayLayout2i4",pc);class _a extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=y,o}}_a.prototype.bytesPerElement=6,St("StructArrayLayout3i6",_a);class wp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=y,this.int16[x+3]=b,o}}wp.prototype.bytesPerElement=8,St("StructArrayLayout4i8",wp);class Sp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,I){const L=6*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=I,o}}Sp.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",Sp);class Ep extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,I){const L=4*o,A=8*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.uint8[A+4]=y,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=I,o}}Ep.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",Ep);class dc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.float32[y+0]=h,this.float32[y+1]=p,o}}dc.prototype.bytesPerElement=8,St("StructArrayLayout2f8",dc);class Ph extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,y,b,x,I,L,A,N)}emplace(o,h,p,y,b,x,I,L,A,N,O){const G=10*o;return this.uint16[G+0]=h,this.uint16[G+1]=p,this.uint16[G+2]=y,this.uint16[G+3]=b,this.uint16[G+4]=x,this.uint16[G+5]=I,this.uint16[G+6]=L,this.uint16[G+7]=A,this.uint16[G+8]=N,this.uint16[G+9]=O,o}}Ph.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",Ph);class Ip extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N,O,G){const H=this.length;return this.resize(H+1),this.emplace(H,o,h,p,y,b,x,I,L,A,N,O,G)}emplace(o,h,p,y,b,x,I,L,A,N,O,G,H){const K=12*o;return this.int16[K+0]=h,this.int16[K+1]=p,this.int16[K+2]=y,this.int16[K+3]=b,this.uint16[K+4]=x,this.uint16[K+5]=I,this.uint16[K+6]=L,this.uint16[K+7]=A,this.int16[K+8]=N,this.int16[K+9]=O,this.int16[K+10]=G,this.int16[K+11]=H,o}}Ip.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",Ip);class Cp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=y,o}}Cp.prototype.bytesPerElement=12,St("StructArrayLayout3f12",Cp);class va extends Cr{_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}}va.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",va);class Mh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,y,b,x,I,L,A)}emplace(o,h,p,y,b,x,I,L,A,N){const O=10*o,G=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=y,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=I,this.uint32[G+3]=L,this.uint16[O+8]=A,this.uint16[O+9]=N,o}}Mh.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",Mh);class mc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,y,b,x)}emplace(o,h,p,y,b,x,I){const L=6*o;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=y,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=I,o}}mc.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",mc);class Ah extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,y,b)}emplace(o,h,p,y,b,x){const I=4*o,L=8*o;return this.float32[I+0]=h,this.float32[I+1]=p,this.float32[I+2]=y,this.int16[L+6]=b,this.int16[L+7]=x,o}}Ah.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ah);class gc extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=12*o,I=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[I+1]=y,this.float32[I+2]=b,o}}gc.prototype.bytesPerElement=12,St("StructArrayLayout2ub2f12",gc);class kh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=y,o}}kh.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",kh);class gu extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N,O,G,H,K,te,le,de){const Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,o,h,p,y,b,x,I,L,A,N,O,G,H,K,te,le,de)}emplace(o,h,p,y,b,x,I,L,A,N,O,G,H,K,te,le,de,Ae){const _e=24*o,Ce=12*o,Ye=48*o;return this.int16[_e+0]=h,this.int16[_e+1]=p,this.uint16[_e+2]=y,this.uint16[_e+3]=b,this.uint32[Ce+2]=x,this.uint32[Ce+3]=I,this.uint32[Ce+4]=L,this.uint16[_e+10]=A,this.uint16[_e+11]=N,this.uint16[_e+12]=O,this.float32[Ce+7]=G,this.float32[Ce+8]=H,this.uint8[Ye+36]=K,this.uint8[Ye+37]=te,this.uint8[Ye+38]=le,this.uint32[Ce+10]=de,this.int16[_e+22]=Ae,o}}gu.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",gu);class Ml extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y,b,x,I,L,A,N,O,G,H,K,te,le,de,Ae,_e,Ce,Ye,Je,bt,Tt,vt,yt,ht,Et){const mt=this.length;return this.resize(mt+1),this.emplace(mt,o,h,p,y,b,x,I,L,A,N,O,G,H,K,te,le,de,Ae,_e,Ce,Ye,Je,bt,Tt,vt,yt,ht,Et)}emplace(o,h,p,y,b,x,I,L,A,N,O,G,H,K,te,le,de,Ae,_e,Ce,Ye,Je,bt,Tt,vt,yt,ht,Et,mt){const nt=32*o,zt=16*o;return this.int16[nt+0]=h,this.int16[nt+1]=p,this.int16[nt+2]=y,this.int16[nt+3]=b,this.int16[nt+4]=x,this.int16[nt+5]=I,this.int16[nt+6]=L,this.int16[nt+7]=A,this.uint16[nt+8]=N,this.uint16[nt+9]=O,this.uint16[nt+10]=G,this.uint16[nt+11]=H,this.uint16[nt+12]=K,this.uint16[nt+13]=te,this.uint16[nt+14]=le,this.uint16[nt+15]=de,this.uint16[nt+16]=Ae,this.uint16[nt+17]=_e,this.uint16[nt+18]=Ce,this.uint16[nt+19]=Ye,this.uint16[nt+20]=Je,this.uint16[nt+21]=bt,this.uint16[nt+22]=Tt,this.uint32[zt+12]=vt,this.float32[zt+13]=yt,this.float32[zt+14]=ht,this.uint16[nt+30]=Et,this.uint16[nt+31]=mt,o}}Ml.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",Ml);class Dh extends Cr{_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}}Dh.prototype.bytesPerElement=4,St("StructArrayLayout1f4",Dh);class Rh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=y,o}}Rh.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",Rh);class Al extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=y,o}}Al.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",Al);class Tp extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.uint16[y+0]=h,this.uint16[y+1]=p,o}}Tp.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",Tp);class Lp extends Cr{_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}}Lp.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Lp);class Nh extends Cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,y)}emplace(o,h,p,y,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=y,this.float32[x+3]=b,o}}Nh.prototype.bytesPerElement=16,St("StructArrayLayout4f16",Nh);class Fm extends fc{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)}}Fm.prototype.size=20;class _ extends Mh{get(o){return new Fm(this,o)}}St("CollisionBoxArray",_);class s extends fc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends gu{get(o){return new s(this,o)}}St("PlacedSymbolArray",f);class d extends fc{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 Ml{get(o){return new d(this,o)}}St("SymbolInstanceArray",g);class v extends Dh{getoffsetX(o){return this.float32[1*o+0]}}St("GlyphOffsetArray",v);class C extends _a{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}St("SymbolLineVertexArray",C);class T extends fc{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}T.prototype.size=12;class M extends Rh{get(o){return new T(this,o)}}St("TextAnchorOffsetArray",M);class R extends fc{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 Al{get(o){return new R(this,o)}}St("FeatureIndexArray",z);class F extends pc{}class Y extends pc{}class ae extends pc{}class se extends Sp{}class ce extends Ep{}class ee extends dc{}class be extends Ph{}class Fe extends Ip{}class he extends Cp{}class Le extends va{}class Be extends mc{}class Ge extends gc{}class He extends kh{}class et extends Tp{}const $e=qr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ct}=$e;class pt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,y){let b=this.segments[this.segments.length-1];return o>pt.MAX_VERTEX_ARRAY_LENGTH&&Ke(`Max vertices per segment is ${pt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>pt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==y)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},y!==void 0&&(b.sortKey=y),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,y){return new pt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:y,vaos:{},sortKey:0}])}}function nn(u,o){return 256*(u=re(Math.floor(u),0,255))+re(Math.floor(o),0,255)}pt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",pt);const dt=qr([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Bt={exports:{}},rn={exports:{}};rn.exports=function(u,o){var h,p,y,b,x,I,L,A;for(p=u.length-(h=3&u.length),y=o,x=3432918353,I=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*I+(((L>>>16)*I&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,h){case 3:L^=(255&u.charCodeAt(A+2))<<16;case 2:L^=(255&u.charCodeAt(A+1))<<8;case 1:y^=L=(65535&(L=(L=(65535&(L^=255&u.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*I+(((L>>>16)*I&65535)<<16)&4294967295}return y^=u.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var En=rn.exports,Wt={exports:{}};Wt.exports=function(u,o){for(var h,p=u.length,y=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),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:y^=(255&u.charCodeAt(b+2))<<16;case 2:y^=(255&u.charCodeAt(b+1))<<8;case 1:y=1540483477*(65535&(y^=255&u.charCodeAt(b)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var an=En,fn=Wt.exports;Bt.exports=an,Bt.exports.murmur3=an,Bt.exports.murmur2=fn;var Tr=m(Bt.exports);class qn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,y){this.ids.push(Ro(o)),this.positions.push(h,p,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=Ro(o);let p=0,y=this.ids.length-1;for(;p>1;this.ids[x]>=h?y=x:p=x+1}const b=[];for(;this.ids[p]===h;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,h){const p=new Float64Array(o.ids),y=new Uint32Array(o.positions);return ui(p,y,0,p.length-1),h&&h.push(p.buffer,y.buffer),{ids:p,positions:y}}static deserialize(o){const h=new qn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function Ro(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Tr(String(u))}function ui(u,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(u[b]y);if(b>=x)break;gr(u,b,x),gr(o,3*b,3*x),gr(o,3*b+1,3*x+1),gr(o,3*b+2,3*x+2)}x-h`u_${y}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new Xa(o,h):new No(o,h)}}class ii{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,y){const b=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Gs(o,h):new No(o,h)}}class yr{constructor(o,h,p,y){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,h,p,y,b){const x=this.paintVertexArray.length,I=this.expression.evaluate(new ur(0),h,{},y,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,I)}updatePaintArray(o,h,p,y){const b=this.expression.evaluate({zoom:0},p,y);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const y=Ya(p);for(let b=o;b`u_${I}_t`),this.type=p,this.useIntegerZoom=y,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,y,b){const x=this.expression.evaluate(new ur(this.zoom),h,{},y,[],b),I=this.expression.evaluate(new ur(this.zoom+1),h,{},y,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,I)}updatePaintArray(o,h,p,y){const b=this.expression.evaluate({zoom:this.zoom},p,y),x=this.expression.evaluate({zoom:this.zoom+1},p,y);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,y){if(this.type==="color"){const b=Ya(p),x=Ya(y);for(let I=o;I`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof yr||p instanceof cr)for(let y=0;y!0){this.programConfigurations={};for(const y of o)this.programConfigurations[y.id]=new oi(y,h,p);this.needsUpload=!1,this._featureMap=new qn,this._bufferOffset=0}populatePaintArrays(o,h,p,y,b,x){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(o,h,y,b,x);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,y){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,y)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function ts(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 si(u,o,h){const p={color:{source:dc,composite:Nh},number:{source:Dh,composite:dc}},y=function(b){return{"line-pattern":{source:be,composite:be},"fill-pattern":{source:be,composite:be},"fill-extrusion-pattern":{source:be,composite:be}}[b]}(u);return y&&y[h]||p[o][h]}St("ConstantBinder",js),St("CrossFadedConstantBinder",ii),St("SourceExpressionBinder",yr),St("CrossFadedCompositeBinder",es),St("CompositeExpressionBinder",cr),St("ProgramConfiguration",oi,{omit:["_buffers"]}),St("ProgramConfigurationSet",_r);const Nr=8192,Pp=Math.pow(2,14)-1,Bm=-Pp-1;function kl(u){const o=Nr/u.extent,h=u.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Ke("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function Dl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?kl(u):[]}}function Oh(u,o,h,p,y){u.emplaceBack(2*o+(p+1)/2,2*h+(y+1)/2)}class Ka{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 Y,this.indexArray=new He,this.segments=new pt,this.programConfigurations=new _r(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const y=this.layers[0],b=[];let x=null,I=!1;y.type==="circle"&&(x=y.layout.get("circle-sort-key"),I=!x.isConstant());for(const{feature:L,id:A,index:N,sourceLayerIndex:O}of o){const G=this.layers[0]._featureFilter.needGeometry,H=Dl(L,G);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),H,p))continue;const K=I?x.evaluate(H,{},p):void 0,te={id:A,properties:L.properties,type:L.type,sourceLayerIndex:O,index:N,geometry:G?H.geometry:kl(L),patterns:{},sortKey:K};b.push(te)}I&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:N,sourceLayerIndex:O}=L,G=o[N].feature;this.addFeature(L,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,ct),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,h,p,y){for(const b of h)for(const x of b){const I=x.x,L=x.y;if(I<0||I>=Nr||L<0||L>=Nr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),N=A.vertexLength;Oh(this.layoutVertexArray,I,L,-1,-1),Oh(this.layoutVertexArray,I,L,1,-1),Oh(this.layoutVertexArray,I,L,1,1),Oh(this.layoutVertexArray,I,L,-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,{},y)}}function Mp(u,o){for(let h=0;h1){if(zh(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(y)._add(o))}function L1(u,o){let h,p,y,b=!1;for(let x=0;xo.y!=y.y>o.y&&o.x<(y.x-p.x)*(o.y-p.y)/(y.y-p.y)+p.x&&(b=!b)}return b}function Fh(u,o){let h=!1;for(let p=0,y=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 QC(u,o,h){const p=h[0],y=h[2];if(u.xy.x&&o.x>y.x||u.yy.y&&o.y>y.y)return!1;const b=Ee(u,o,h[0]);return b!==Ee(u,o,h[1])||b!==Ee(u,o,h[2])||b!==Ee(u,o,h[3])}function Rp(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function Um(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Gm(u,o,h,p,y){if(!o[0]&&!o[1])return u;const b=E.convert(o)._mult(y);h==="viewport"&&b._rotate(-p);const x=[];for(let I=0;Ik1(le,te))}(A,L),H=O?N*I:N;for(const K of y)for(const te of K){const le=O?te:k1(te,L);let de=H;const Ae=jm([],[te.x,te.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?de*=Ae[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(de*=x.cameraToCenterDistance/Ae[3]),Vm(G,le,de))return!0}return!1}}function k1(u,o){const h=jm([],[u.x,u.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class D1 extends Ka{}let R1;St("HeatmapBucket",D1,{omit:["layers"]});var nT={get paint(){return R1=R1||new go({"heatmap-radius":new Ft(Oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ft(Oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new kt(Oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bp(Oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new kt(Oe.paint_heatmap["heatmap-opacity"])})}};function f_(u,{width:o,height:h},p,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*h*p}`)}else y=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=y,u}function N1(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const y=f_({},{width:o,height:h},p);p_(u,y,{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=y.data}function p_(u,o,h,p,y,b){if(y.width===0||y.height===0)return o;if(y.width>u.width||y.height>u.height||h.x>u.width-y.width||h.y>u.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||p.x>o.width-y.width||p.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const x=u.data,I=o.data;if(x===I)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[u.evaluationKey]=L;const A=u.expression.evaluate(o);y.data[x+I+0]=Math.floor(255*A.r/A.a),y.data[x+I+1]=Math.floor(255*A.g/A.a),y.data[x+I+2]=Math.floor(255*A.b/A.a),y.data[x+I+3]=Math.floor(255*A.a)};if(u.clips)for(let x=0,I=0;x80*h){p=b=u[0],y=x=u[1];for(var K=h;Kb&&(b=I),L>x&&(x=L);A=(A=Math.max(b-p,x-y))!==0?32767/A:0}return zp(G,H,h,p,y,A,0),H}function F1(u,o,h,p,y){var b,x;if(y===y_(u,o,h,p)>0)for(b=o;b=o;b-=p)x=U1(b,u[b],u[b+1],x);return x&&Wm(x,x.next)&&(Bp(x),x=x.next),x}function _c(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!Wm(p,p.next)&&Wr(p.prev,p,p.next)!==0)p=p.next;else{if(Bp(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function zp(u,o,h,p,y,b,x){if(u){!x&&b&&function(N,O,G,H){var K=N;do K.z===0&&(K.z=m_(K.x,K.y,O,G,H)),K.prevZ=K.prev,K.nextZ=K.next,K=K.next;while(K!==N);K.prevZ.nextZ=null,K.prevZ=null,function(te){var le,de,Ae,_e,Ce,Ye,Je,bt,Tt=1;do{for(de=te,te=null,Ce=null,Ye=0;de;){for(Ye++,Ae=de,Je=0,le=0;le0||bt>0&&Ae;)Je!==0&&(bt===0||!Ae||de.z<=Ae.z)?(_e=de,de=de.nextZ,Je--):(_e=Ae,Ae=Ae.nextZ,bt--),Ce?Ce.nextZ=_e:te=_e,_e.prevZ=Ce,Ce=_e;de=Ae}Ce.nextZ=null,Tt*=2}while(Ye>1)}(K)}(u,p,y,b);for(var I,L,A=u;u.prev!==u.next;)if(I=u.prev,L=u.next,b?uT(u,p,y,b):lT(u))o.push(I.i/h|0),o.push(u.i/h|0),o.push(L.i/h|0),Bp(u),u=L.next,A=L.next;else if((u=L)===A){x?x===1?zp(u=cT(_c(u),o,h),o,h,p,y,b,2):x===2&&hT(u,o,h,p,y,b):zp(_c(u),o,h,p,y,b,1);break}}}function lT(u){var o=u.prev,h=u,p=u.next;if(Wr(o,h,p)>=0)return!1;for(var y=o.x,b=h.x,x=p.x,I=o.y,L=h.y,A=p.y,N=yb?y>x?y:x:b>x?b:x,H=I>L?I>A?I:A:L>A?L:A,K=p.next;K!==o;){if(K.x>=N&&K.x<=G&&K.y>=O&&K.y<=H&&Vh(y,I,b,L,x,A,K.x,K.y)&&Wr(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function uT(u,o,h,p){var y=u.prev,b=u,x=u.next;if(Wr(y,b,x)>=0)return!1;for(var I=y.x,L=b.x,A=x.x,N=y.y,O=b.y,G=x.y,H=IL?I>A?I:A:L>A?L:A,le=N>O?N>G?N:G:O>G?O:G,de=m_(H,K,o,h,p),Ae=m_(te,le,o,h,p),_e=u.prevZ,Ce=u.nextZ;_e&&_e.z>=de&&Ce&&Ce.z<=Ae;){if(_e.x>=H&&_e.x<=te&&_e.y>=K&&_e.y<=le&&_e!==y&&_e!==x&&Vh(I,N,L,O,A,G,_e.x,_e.y)&&Wr(_e.prev,_e,_e.next)>=0||(_e=_e.prevZ,Ce.x>=H&&Ce.x<=te&&Ce.y>=K&&Ce.y<=le&&Ce!==y&&Ce!==x&&Vh(I,N,L,O,A,G,Ce.x,Ce.y)&&Wr(Ce.prev,Ce,Ce.next)>=0))return!1;Ce=Ce.nextZ}for(;_e&&_e.z>=de;){if(_e.x>=H&&_e.x<=te&&_e.y>=K&&_e.y<=le&&_e!==y&&_e!==x&&Vh(I,N,L,O,A,G,_e.x,_e.y)&&Wr(_e.prev,_e,_e.next)>=0)return!1;_e=_e.prevZ}for(;Ce&&Ce.z<=Ae;){if(Ce.x>=H&&Ce.x<=te&&Ce.y>=K&&Ce.y<=le&&Ce!==y&&Ce!==x&&Vh(I,N,L,O,A,G,Ce.x,Ce.y)&&Wr(Ce.prev,Ce,Ce.next)>=0)return!1;Ce=Ce.nextZ}return!0}function cT(u,o,h){var p=u;do{var y=p.prev,b=p.next.next;!Wm(y,b)&&B1(y,p,p.next,b)&&Fp(y,b)&&Fp(b,y)&&(o.push(y.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),Bp(p),Bp(p.next),p=u=b),p=p.next}while(p!==u);return _c(p)}function hT(u,o,h,p,y,b){var x=u;do{for(var I=x.next.next;I!==x.prev;){if(x.i!==I.i&&gT(x,I)){var L=V1(x,I);return x=_c(x,x.next),L=_c(L,L.next),zp(x,o,h,p,y,b,0),void zp(L,o,h,p,y,b,0)}I=I.next}x=x.next}while(x!==u)}function fT(u,o){return u.x-o.x}function pT(u,o){var h=function(y,b){var x,I=b,L=y.x,A=y.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<=L&&O>N&&(N=O,x=I.x=I.x&&I.x>=K&&L!==I.x&&Vh(Ax.x||I.x===x.x&&dT(x,I)))&&(x=I,le=G)),I=I.next;while(I!==H);return x}(u,o);if(!h)return o;var p=V1(h,u);return _c(p,p.next),_c(h,h.next)}function dT(u,o){return Wr(u.prev,u,o.prev)<0&&Wr(o.next,u,u.next)<0}function m_(u,o,h,p,y){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*y|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function mT(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)>=(y-x)*(p-I)}function gT(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var y=h;do{if(y.i!==h.i&&y.next.i!==h.i&&y.i!==p.i&&y.next.i!==p.i&&B1(y,y.next,h,p))return!0;y=y.next}while(y!==h);return!1}(u,o)&&(Fp(u,o)&&Fp(o,u)&&function(h,p){var y=h,b=!1,x=(h.x+p.x)/2,I=(h.y+p.y)/2;do y.y>I!=y.next.y>I&&y.next.y!==y.y&&x<(y.next.x-y.x)*(I-y.y)/(y.next.y-y.y)+y.x&&(b=!b),y=y.next;while(y!==h);return b}(u,o)&&(Wr(u.prev,u,o.prev)||Wr(u,o.prev,o))||Wm(u,o)&&Wr(u.prev,u,u.next)>0&&Wr(o.prev,o,o.next)>0)}function Wr(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function Wm(u,o){return u.x===o.x&&u.y===o.y}function B1(u,o,h,p){var y=Zm(Wr(u,o,h)),b=Zm(Wr(u,o,p)),x=Zm(Wr(h,p,u)),I=Zm(Wr(h,p,o));return y!==b&&x!==I||!(y!==0||!Hm(u,h,o))||!(b!==0||!Hm(u,p,o))||!(x!==0||!Hm(h,u,p))||!(I!==0||!Hm(h,o,p))}function Hm(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 Zm(u){return u>0?1:u<0?-1:0}function Fp(u,o){return Wr(u.prev,u,u.next)<0?Wr(u,o,u.next)>=0&&Wr(u,u.prev,o)>=0:Wr(u,o,u.prev)<0||Wr(u,u.next,o)<0}function V1(u,o){var h=new g_(u.i,u.x,u.y),p=new g_(o.i,o.x,o.y),y=u.next,b=o.prev;return u.next=o,o.prev=u,h.next=y,y.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function U1(u,o,h,p){var y=new g_(u,o,h);return p?(y.next=p.next,y.prev=p,p.next.prev=y,p.next=y):(y.prev=y,y.next=y),y}function Bp(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 g_(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 y_(u,o,h,p){for(var y=0,b=o,x=h-p;b0&&h.holes.push(p+=u[y-1].length)}return h};var G1=m(d_.exports);function yT(u,o,h,p,y){j1(u,o,h||0,p||u.length-1,y||_T)}function j1(u,o,h,p,y){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,I=Math.log(b),L=.5*Math.exp(2*I/3),A=.5*Math.sqrt(I*L*(b-L)/b)*(x-b/2<0?-1:1);j1(u,o,Math.max(h,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),y)}var N=u[o],O=h,G=p;for(Vp(u,h,o),y(u[p],N)>0&&Vp(u,h,p);O0;)G--}y(u[h],N)===0?Vp(u,h,G):Vp(u,++G,p),G<=o&&(h=G+1),o<=G&&(p=G-1)}}function Vp(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function _T(u,o){return uo?1:0}function __(u,o){const h=u.length;if(h<=1)return[u];const p=[];let y,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ae,this.indexArray=new He,this.indexArray2=new et,this.programConfigurations=new _r(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=v_("fill",this.layers,h);const y=this.layers[0].layout.get("fill-sort-key"),b=!y.isConstant(),x=[];for(const{feature:I,id:L,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=Dl(I,O);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),G,p))continue;const H=b?y.evaluate(G,{},p,h.availableImages):void 0,K={id:L,properties:I.properties,type:I.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:kl(I),patterns:{},sortKey:H};x.push(K)}b&&x.sort((I,L)=>I.sortKey-L.sortKey);for(const I of x){const{geometry:L,index:A,sourceLayerIndex:N}=I;if(this.hasPattern){const O=b_("fill",this.layers,I,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(I,L,A,p,{});h.featureIndex.insert(o[A].feature,L,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 y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,aT),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,h,p,y,b){for(const x of __(h,500)){let I=0;for(const H of x)I+=H.length;const L=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),A=L.vertexLength,N=[],O=[];for(const H of x){if(H.length===0)continue;H!==x[0]&&O.push(N.length/2);const K=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),te=K.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(te+H.length-1,te),N.push(H[0].x),N.push(H[0].y);for(let le=1;le>3}if(y--,p===1||p===2)b+=u.readSVarint(),x+=u.readSVarint(),p===1&&(o&&I.push(o),o=[]),o.push(new IT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&I.push(o),I},Uh.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,y=0,b=0,x=1/0,I=-1/0,L=1/0,A=-1/0;u.pos>3}if(p--,h===1||h===2)(y+=u.readSVarint())I&&(I=y),(b+=u.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,L,I,A]},Uh.prototype.toGeoJSON=function(u,o,h){var p,y,b=this.extent*Math.pow(2,h),x=this.extent*u,I=this.extent*o,L=this.loadGeometry(),A=Uh.types[this.type];function N(H){for(var K=0;K>3;y=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return y}(h))}X1.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 LT(this._pbf,o,this.extent,this._keys,this._values)};var MT=Z1;function AT(u,o,h){if(u===3){var p=new MT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}yu.VectorTile=function(u,o){this.layers=u.readFields(AT,{},o)},yu.VectorTileFeature=H1,yu.VectorTileLayer=Z1;const kT=yu.VectorTileFeature.types,w_=Math.pow(2,13);function Up(u,o,h,p,y,b,x,I){u.emplaceBack(o,h,2*Math.floor(p*w_)+x,y*w_*2,b*w_*2,Math.round(I))}class S_{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 se,this.centroidVertexArray=new F,this.indexArray=new He,this.programConfigurations=new _r(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=v_("fill-extrusion",this.layers,h);for(const{feature:y,id:b,index:x,sourceLayerIndex:I}of o){const L=this.layers[0]._featureFilter.needGeometry,A=Dl(y,L);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),A,p))continue;const N={id:b,sourceLayerIndex:I,index:x,geometry:L?A.geometry:kl(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(b_("fill-extrusion",this.layers,N,this.zoom,h)):this.addFeature(N,N.geometry,x,p,{}),h.featureIndex.insert(y,N.geometry,x,I,this.index,!0)}}addFeatures(o,h,p){for(const y of this.features){const{geometry:b}=y;this.addFeature(y,b,y.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,ET),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,ST.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,h,p,y,b){const x={x:0,y:0,vertexCount:0};for(const I of __(h,500)){let L=0;for(const K of I)L+=K.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of I){if(K.length===0||RT(K))continue;let te=0;for(let le=0;le=1){const Ae=K[le-1];if(!DT(de,Ae)){A.vertexLength+4>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const _e=de.sub(Ae)._perp()._unit(),Ce=Ae.dist(de);te+Ce>32768&&(te=0),Up(this.layoutVertexArray,de.x,de.y,_e.x,_e.y,0,0,te),Up(this.layoutVertexArray,de.x,de.y,_e.x,_e.y,0,1,te),x.x+=2*de.x,x.y+=2*de.y,x.vertexCount+=2,te+=Ce,Up(this.layoutVertexArray,Ae.x,Ae.y,_e.x,_e.y,0,0,te),Up(this.layoutVertexArray,Ae.x,Ae.y,_e.x,_e.y,0,1,te),x.x+=2*Ae.x,x.y+=2*Ae.y,x.vertexCount+=2;const Ye=A.vertexLength;this.indexArray.emplaceBack(Ye,Ye+2,Ye+1),this.indexArray.emplaceBack(Ye+1,Ye+2,Ye+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),kT[o.type]!=="Polygon")continue;const N=[],O=[],G=A.vertexLength;for(const K of I)if(K.length!==0){K!==I[0]&&O.push(N.length/2);for(let te=0;teNr)||u.y===o.y&&(u.y<0||u.y>Nr)}function RT(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 Y1;St("FillExtrusionBucket",S_,{omit:["layers","features"]});var NT={get paint(){return Y1=Y1||new go({"fill-extrusion-opacity":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ft(Oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Lh(Oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ft(Oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ft(Oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new kt(Oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class OT extends _s{constructor(o){super(o,NT)}createBucket(o){return new S_(o)}queryRadius(){return Um(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,y,b,x,I,L){const A=Gm(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(K,te,le,de){const Ae=[];for(const _e of K){const Ce=[_e.x,_e.y,0,1];jm(Ce,Ce,te),Ae.push(new E(Ce[0]/Ce[3],Ce[1]/Ce[3]))}return Ae}(A,L),H=function(K,te,le,de){const Ae=[],_e=[],Ce=de[8]*te,Ye=de[9]*te,Je=de[10]*te,bt=de[11]*te,Tt=de[8]*le,vt=de[9]*le,yt=de[10]*le,ht=de[11]*le;for(const Et of K){const mt=[],nt=[];for(const zt of Et){const Mt=zt.x,dn=zt.y,ir=de[0]*Mt+de[4]*dn+de[12],hr=de[1]*Mt+de[5]*dn+de[13],fi=de[2]*Mt+de[6]*dn+de[14],ns=de[3]*Mt+de[7]*dn+de[15],_o=fi+Je,ai=ns+bt,Mi=ir+Tt,Fi=hr+vt,vo=fi+yt,bo=ns+ht,pi=new E((ir+Ce)/ai,(hr+Ye)/ai);pi.z=_o/ai,mt.push(pi);const di=new E(Mi/bo,Fi/bo);di.z=vo/bo,nt.push(di)}Ae.push(mt),_e.push(nt)}return[Ae,_e]}(y,O,N,L);return function(K,te,le){let de=1/0;Ap(le,te)&&(de=K1(le,te[0]));for(let Ae=0;Aeh.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 ce,this.layoutVertexArray2=new ee,this.indexArray=new He,this.programConfigurations=new _r(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=v_("line",this.layers,h);const y=this.layers[0].layout.get("line-sort-key"),b=!y.isConstant(),x=[];for(const{feature:I,id:L,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=Dl(I,O);if(!this.layers[0]._featureFilter.filter(new ur(this.zoom),G,p))continue;const H=b?y.evaluate(G,{},p):void 0,K={id:L,properties:I.properties,type:I.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:kl(I),patterns:{},sortKey:H};x.push(K)}b&&x.sort((I,L)=>I.sortKey-L.sortKey);for(const I of x){const{geometry:L,index:A,sourceLayerIndex:N}=I;if(this.hasPattern){const O=b_("line",this.layers,I,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(I,L,A,p,{});h.featureIndex.insert(o[A].feature,L,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 y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,VT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,FT),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,h,p,y,b){const x=this.layers[0].layout,I=x.get("line-join").evaluate(o,{}),L=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,L,A,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,y)}addLine(o,h,p,y,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let de=0;de=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(bt&&de>A){const ht=G.dist(H);if(ht>2*N){const Et=G.sub(G.sub(H)._mult(N/ht)._round());this.updateDistance(H,Et),this.addCurrentVertex(Et,te,0,0,O),H=Et}}const vt=H&&K;let yt=vt?p:I?"butt":y;if(vt&&yt==="round"&&(Yeb&&(yt="bevel"),yt==="bevel"&&(Ye>2&&(yt="flipbevel"),Ye100)Ae=le.mult(-1);else{const ht=Ye*te.add(le).mag()/te.sub(le).mag();Ae._perp()._mult(ht*(Tt?-1:1))}this.addCurrentVertex(G,Ae,0,0,O),this.addCurrentVertex(G,Ae.mult(-1),0,0,O)}else if(yt==="bevel"||yt==="fakeround"){const ht=-Math.sqrt(Ye*Ye-1),Et=Tt?ht:0,mt=Tt?0:ht;if(H&&this.addCurrentVertex(G,te,Et,mt,O),yt==="fakeround"){const nt=Math.round(180*Je/Math.PI/20);for(let zt=1;zt2*N){const Et=G.add(K.sub(G)._mult(N/ht)._round());this.updateDistance(G,Et),this.addCurrentVertex(Et,le,0,0,O),G=Et}}}}addCurrentVertex(o,h,p,y,b,x=!1){const I=h.y*y-h.x,L=-h.y-h.x*y;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,I,L,x,!0,-y,b),this.distance>J1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,y,b,x))}addHalfVertex({x:o,y:h},p,y,b,x,I,L){const A=.5*(this.lineClips?this.scaledDistance*(J1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*y)+128,1+(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=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),L.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 Q1,$1;St("LineBucket",E_,{omit:["layers","patternFeatures"]});var eb={get paint(){return $1=$1||new go({"line-opacity":new Ft(Oe.paint_line["line-opacity"]),"line-color":new Ft(Oe.paint_line["line-color"]),"line-translate":new kt(Oe.paint_line["line-translate"]),"line-translate-anchor":new kt(Oe.paint_line["line-translate-anchor"]),"line-width":new Ft(Oe.paint_line["line-width"]),"line-gap-width":new Ft(Oe.paint_line["line-gap-width"]),"line-offset":new Ft(Oe.paint_line["line-offset"]),"line-blur":new Ft(Oe.paint_line["line-blur"]),"line-dasharray":new hc(Oe.paint_line["line-dasharray"]),"line-pattern":new Lh(Oe.paint_line["line-pattern"]),"line-gradient":new bp(Oe.paint_line["line-gradient"])})},get layout(){return Q1=Q1||new go({"line-cap":new kt(Oe.layout_line["line-cap"]),"line-join":new Ft(Oe.layout_line["line-join"]),"line-miter-limit":new kt(Oe.layout_line["line-miter-limit"]),"line-round-limit":new kt(Oe.layout_line["line-round-limit"]),"line-sort-key":new Ft(Oe.layout_line["line-sort-key"])})}};class jT extends Ft{possiblyEvaluate(o,h){return h=new ur(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,y){return h=pe({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,y)}}let Xm;class qT extends _s{constructor(o){super(o,eb),this.gradientVersion=0,Xm||(Xm=new jT(eb.paint.properties["line-width"].specification),Xm.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 rc,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"]=Xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new E_(o)}queryRadius(o){const h=o,p=tb(Rp("line-width",this,h),Rp("line-gap-width",this,h)),y=Rp("line-offset",this,h);return p/2+Math.abs(y)+Um(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,y,b,x,I){const L=Gm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,I),A=I/2*tb(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&&(y=function(O,G){const H=[];for(let K=0;K=3){for(let le=0;le0?o+2*u:u}const WT=qr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),HT=qr([{name:"a_projected_pos",components:3,type:"Float32"}],4);qr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ZT=qr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);qr([{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 nb=qr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),XT=qr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function YT(u,o,h){return u.sections.forEach(p=>{p.text=function(y,b,x){const I=b.layout.get("text-transform").evaluate(x,{});return I==="uppercase"?y=y.toLocaleUpperCase():I==="lowercase"&&(y=y.toLocaleLowerCase()),Za.applyArabicShaping&&(y=Za.applyArabicShaping(y)),y}(p.text,o,h)}),u}qr([{name:"triangle",components:3,type:"Uint16"}]),qr([{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"}]),qr([{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"}]),qr([{type:"Float32",name:"offsetX"}]),qr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),qr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const jp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hi=24,rb=Yn,ib=function(u,o,h,p,y){var b,x,I=8*y-p-1,L=(1<>1,N=-7,O=h?y-1:0,G=h?-1:1,H=u[o+O];for(O+=G,b=H&(1<<-N)-1,H>>=-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===L)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)},ob=function(u,o,h,p,y,b){var x,I,L,A=8*b-y-1,N=(1<>1,G=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=p?0:b-1,K=p?1:-1,te=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*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+O>=1?G/L:G*Math.pow(2,1-O))*L>=2&&(x++,L/=2),x+O>=N?(I=0,x=N):x+O>=1?(I=(o*L-1)*Math.pow(2,y),x+=O):(I=o*Math.pow(2,O-1)*Math.pow(2,y),x=0));y>=8;u[h+H]=255&I,H+=K,I/=256,y-=8);for(x=x<0;u[h+H]=255&x,H+=K,x/=256,A-=8);u[h+H-K]|=128*te};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 I_=4294967296,sb=1/I_,ab=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Rl(u){return u.type===Yn.Bytes?u.readVarint()+u.pos:u.pos+1}function Gh(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function lb(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 y=h.pos-1;y>=u;y--)h.buf[y+p]=h.buf[y]}function KT(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function ub(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(y,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=Ym(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=ub(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=Ym(this.buf,this.pos)+Ym(this.buf,this.pos+4)*I_;return this.pos+=8,u},readSFixed64:function(){var u=Ym(this.buf,this.pos)+ub(this.buf,this.pos+4)*I_;return this.pos+=8,u},readFloat:function(){var u=ib(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=ib(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(y,b,x){var I,L,A=x.buf;if(I=(112&(L=A[x.pos++]))>>4,L<128||(I|=(127&(L=A[x.pos++]))<<3,L<128)||(I|=(127&(L=A[x.pos++]))<<10,L<128)||(I|=(127&(L=A[x.pos++]))<<17,L<128)||(I|=(127&(L=A[x.pos++]))<<24,L<128)||(I|=(1&(L=A[x.pos++]))<<31,L<128))return Gh(y,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&&ab?function(h,p,y){return ab.decode(h.subarray(p,y))}(this.buf,o,u):function(h,p,y){for(var b="",x=p;x239?4:N>223?3:N>191?2:1;if(x+G>y)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?(L=h[x+2],(192&(I=h[x+1]))==128&&(192&L)==128&&((O=(15&N)<<12|(63&I)<<6|63&L)<=2047||O>=55296&&O<=57343)&&(O=null)):G===4&&(L=h[x+2],A=h[x+3],(192&(I=h[x+1]))==128&&(192&L)==128&&(192&A)==128&&((O=(15&N)<<18|(63&I)<<12|(63&L)<<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=Rl(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,y;if(o>=0?(p=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(b,x,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)))))}(y,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,y,b){for(var x,I,L=0;L55295&&x<57344){if(!I){x>56319||L+1===y.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&&lb(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),ob(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),ob(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&&lb(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,KT,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,JT,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,eL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,QT,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,$T,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,tL,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,nL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,rL,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,iL,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 C_=m(rb);const T_=3;function oL(u,o,h){u===1&&h.readMessage(sL,o)}function sL(u,o,h){if(u===3){const{id:p,bitmap:y,width:b,height:x,left:I,top:L,advance:A}=h.readMessage(aL,{});o.push({id:p,bitmap:new Op({width:b+2*T_,height:x+2*T_},y),metrics:{width:b,height:x,left:I,top:L,advance:A}})}}function aL(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 cb=T_;function hb(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 y=0,b=0;for(const x of u)for(let I=p.length-1;I>=0;I--){const L=p[I];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),y=Math.max(y,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();I=0&&p>=o&&Jm[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 qh;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(Wp.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Km(u,o,h,p,y,b,x,I,L,A,N,O,G,H,K,te){const le=qh.fromFeature(u,y);let de;O===c.ah.vertical&&le.verticalizePunctuation();const{processBidirectionalText:Ae,processStyledBidirectionalText:_e}=Za;if(Ae&&le.sections.length===1){de=[];const Je=Ae(le.toString(),P_(le,A,b,o,p,H,K));for(const bt of Je){const Tt=new qh;Tt.text=bt,Tt.sections=le.sections;for(let vt=0;vt0&&Ol>zo&&(zo=Ol)}else{const xs=Tt[bn.fontStack],Bo=xs&&xs[Bi];if(Bo&&Bo.rect)ba=Bo.rect,qs=Bo.metrics;else{const Ol=bt[bn.fontStack],Kp=Ol&&Ol[Bi];if(!Kp)continue;qs=Kp.metrics}gi=(di-bn.scale)*hi}Ws?(Je.verticalizable=!0,ro.push({glyph:Bi,imageName:xa,x:ir,y:hr+gi,vertical:Ws,scale:bn.scale,fontStack:bn.fontStack,sectionIndex:io,metrics:qs,rect:ba}),ir+=Nl*bn.scale+zt):(ro.push({glyph:Bi,imageName:xa,x:ir,y:hr+gi,vertical:Ws,scale:bn.scale,fontStack:bn.fontStack,sectionIndex:io,metrics:qs,rect:ba}),ir+=qs.advance*bn.scale+zt)}ro.length!==0&&(fi=Math.max(ir-zt,fi),cL(ro,0,ro.length-1,_o,zo)),ir=0;const Fo=ht*di+zo;xo.lineOffset=Math.max(zo,no),hr+=Fo,ns=Math.max(Fo,ns),++ai}var Mi;const Fi=hr-qp,{horizontalAlign:vo,verticalAlign:bo}=M_(Et);(function(pi,di,no,xo,ro,zo,Fo,mi,bn){const io=(di-no)*ro;let Bi=0;Bi=zo!==Fo?-mi*xo-qp:(-xo*bn+.5)*Fo;for(const gi of pi)for(const qs of gi.positionedGlyphs)qs.x+=io,qs.y+=Bi})(Je.positionedLines,_o,vo,bo,fi,ns,ht,Fi,yt.length),Je.top+=-bo*Fi,Je.bottom=Je.top+Fi,Je.left+=-vo*fi,Je.right=Je.left+fi}(Ye,o,h,p,de,x,I,L,O,A,G,te),!function(Je){for(const bt of Je)if(bt.positionedGlyphs.length!==0)return!1;return!0}(Ce)&&Ye}const Jm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},lL={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 pb(u,o,h,p,y,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*hi/b+y:0}{const x=h[o.fontStack],I=x&&x[u];return I?I.metrics.advance*o.scale+y:0}}function db(u,o,h,p){const y=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=h_([]),this.placementViewportMatrix=h_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=_b(this.zoom,h["text-size"]),this.iconSizeData=_b(this.zoom,h["icon-size"]);const p=this.layers[0].layout,y=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=A_(p,"text-overlap","text-allow-overlap")!=="never"||A_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>c.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new D_(new _r(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new D_(new _r(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,y,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!N)return;const G=h.iconDependencies,H=h.glyphDependencies,K=h.availableImages,te=new ur(this.zoom);for(const{feature:le,id:de,index:Ae,sourceLayerIndex:_e}of o){const Ce=y._featureFilter.needGeometry,Ye=Dl(le,Ce);if(!y._featureFilter.filter(te,Ye,p))continue;let Je,bt;if(Ce||(Ye.geometry=kl(le)),A){const vt=y.getValueAndResolveTokens("text-field",Ye,p,K),yt=Ao.factory(vt),ht=this.hasRTLText=this.hasRTLText||dL(yt);(!ht||Za.getRTLTextPluginStatus()==="unavailable"||ht&&Za.isParsed())&&(Je=YT(yt,y,Ye))}if(N){const vt=y.getValueAndResolveTokens("icon-image",Ye,p,K);bt=vt instanceof $o?vt:$o.fromString(vt)}if(!Je&&!bt)continue;const Tt=this.sortFeaturesByKey?O.evaluate(Ye,{},p):void 0;if(this.features.push({id:de,text:Je,icon:bt,index:Ae,sourceLayerIndex:_e,geometry:Ye.geometry,properties:le.properties,type:fL[le.type],sortKey:Tt}),bt&&(G[bt.name]=!0),Je){const vt=x.evaluate(Ye,{},p).join(","),yt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ah.vertical)>=0;for(const ht of Je.sections)if(ht.image)G[ht.image.name]=!0;else{const Et=mu(Je.toString()),mt=ht.fontStack||vt,nt=H[mt]=H[mt]||{};this.calculateGlyphDependencies(ht.text,nt,yt,this.allowVerticalPlacement,Et)}}}b.get("symbol-placement")==="line"&&(this.features=function(le){const de={},Ae={},_e=[];let Ce=0;function Ye(vt){_e.push(le[vt]),Ce++}function Je(vt,yt,ht){const Et=Ae[vt];return delete Ae[vt],Ae[yt]=Et,_e[Et].geometry[0].pop(),_e[Et].geometry[0]=_e[Et].geometry[0].concat(ht[0]),Et}function bt(vt,yt,ht){const Et=de[yt];return delete de[yt],de[vt]=Et,_e[Et].geometry[0].shift(),_e[Et].geometry[0]=ht[0].concat(_e[Et].geometry[0]),Et}function Tt(vt,yt,ht){const Et=ht?yt[0][yt[0].length-1]:yt[0][0];return`${vt}:${Et.x}:${Et.y}`}for(let vt=0;vtvt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,de)=>le.sortKey-de.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(h[o.segment+1]),b=o.dist(h[o.segment]);const x={};for(let 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),y=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;by[I]-y[L]||b[L]-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((y,b,x)=>{y>=0&&x.indexOf(y)===b&&this.addIndicesForPlacedSymbol(this.text,y)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let vb,bb;St("SymbolBucket",Wh,{omit:["layers","collisionBoxArray","features","compareText"]}),Wh.MAX_GLYPHS=65535,Wh.addDynamicAttributes=k_;var N_={get paint(){return bb=bb||new go({"icon-opacity":new Ft(Oe.paint_symbol["icon-opacity"]),"icon-color":new Ft(Oe.paint_symbol["icon-color"]),"icon-halo-color":new Ft(Oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ft(Oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ft(Oe.paint_symbol["icon-halo-blur"]),"icon-translate":new kt(Oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new kt(Oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ft(Oe.paint_symbol["text-opacity"]),"text-color":new Ft(Oe.paint_symbol["text-color"],{runtimeType:Rr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Ft(Oe.paint_symbol["text-halo-color"]),"text-halo-width":new Ft(Oe.paint_symbol["text-halo-width"]),"text-halo-blur":new Ft(Oe.paint_symbol["text-halo-blur"]),"text-translate":new kt(Oe.paint_symbol["text-translate"]),"text-translate-anchor":new kt(Oe.paint_symbol["text-translate-anchor"])})},get layout(){return vb=vb||new go({"symbol-placement":new kt(Oe.layout_symbol["symbol-placement"]),"symbol-spacing":new kt(Oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new kt(Oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ft(Oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new kt(Oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new kt(Oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new kt(Oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new kt(Oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new kt(Oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new kt(Oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ft(Oe.layout_symbol["icon-size"]),"icon-text-fit":new kt(Oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new kt(Oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ft(Oe.layout_symbol["icon-image"]),"icon-rotate":new Ft(Oe.layout_symbol["icon-rotate"]),"icon-padding":new Ft(Oe.layout_symbol["icon-padding"]),"icon-keep-upright":new kt(Oe.layout_symbol["icon-keep-upright"]),"icon-offset":new Ft(Oe.layout_symbol["icon-offset"]),"icon-anchor":new Ft(Oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new kt(Oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new kt(Oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new kt(Oe.layout_symbol["text-rotation-alignment"]),"text-field":new Ft(Oe.layout_symbol["text-field"]),"text-font":new Ft(Oe.layout_symbol["text-font"]),"text-size":new Ft(Oe.layout_symbol["text-size"]),"text-max-width":new Ft(Oe.layout_symbol["text-max-width"]),"text-line-height":new kt(Oe.layout_symbol["text-line-height"]),"text-letter-spacing":new Ft(Oe.layout_symbol["text-letter-spacing"]),"text-justify":new Ft(Oe.layout_symbol["text-justify"]),"text-radial-offset":new Ft(Oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new kt(Oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ft(Oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ft(Oe.layout_symbol["text-anchor"]),"text-max-angle":new kt(Oe.layout_symbol["text-max-angle"]),"text-writing-mode":new kt(Oe.layout_symbol["text-writing-mode"]),"text-rotate":new Ft(Oe.layout_symbol["text-rotate"]),"text-padding":new kt(Oe.layout_symbol["text-padding"]),"text-keep-upright":new kt(Oe.layout_symbol["text-keep-upright"]),"text-transform":new Ft(Oe.layout_symbol["text-transform"]),"text-offset":new Ft(Oe.layout_symbol["text-offset"]),"text-allow-overlap":new kt(Oe.layout_symbol["text-allow-overlap"]),"text-overlap":new kt(Oe.layout_symbol["text-overlap"]),"text-ignore-placement":new kt(Oe.layout_symbol["text-ignore-placement"]),"text-optional":new kt(Oe.layout_symbol["text-optional"])})}};class xb{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:ti,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",xb,{omit:["defaultValue"]});class $m extends _s{constructor(o){super(o,N_)}recalculate(o,h){if(super.recalculate(o,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const y=[];for(const b of p)y.indexOf(b)<0&&y.push(b);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,y){const b=this.layout.get(o).evaluate(h,{},p,y),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||$n(x.value)||!b?b:function(I,L){return L.replace(/{([^{}]+)}/g,(A,N)=>I&&N in I?String(I[N]):"")}(h.properties,b)}createBucket(o){return new Wh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of N_.paint.overridableProperties){if(!$m.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new xb(h),y=new rr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new dh("source",y):new up("composite",y,h.value.zoomStops),this.paint._values[o]=new ys(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&$m.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),y=N_.paint.properties[h];let b=!1;const x=I=>{for(const L of I)if(y.overrides&&y.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ao)x(p.value.value.sections);else if(p.value.kind==="source"){const I=A=>{b||(A instanceof Ga&&ri(A.value)===Gr?x(A.value.sections):A instanceof fh?x(A.sections):A.eachChild(I))},L=p.value;L._styleExpression&&I(L._styleExpression.expression)}return b}}let wb;var mL={get paint(){return wb=wb||new go({"background-color":new kt(Oe.paint_background["background-color"]),"background-pattern":new hc(Oe.paint_background["background-pattern"]),"background-opacity":new kt(Oe.paint_background["background-opacity"])})}};class gL extends _s{constructor(o){super(o,mL)}}let Sb;var yL={get paint(){return Sb=Sb||new go({"raster-opacity":new kt(Oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new kt(Oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new kt(Oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new kt(Oe.paint_raster["raster-brightness-max"]),"raster-saturation":new kt(Oe.paint_raster["raster-saturation"]),"raster-contrast":new kt(Oe.paint_raster["raster-contrast"]),"raster-resampling":new kt(Oe.paint_raster["raster-resampling"]),"raster-fade-duration":new kt(Oe.paint_raster["raster-fade-duration"])})}};class _L extends _s{constructor(o){super(o,yL)}}class vL extends _s{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class bL{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 O_=63710088e-1;class bu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new bu(ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,y=o.lat*h,b=Math.sin(p)*Math.sin(y)+Math.cos(p)*Math.cos(y)*Math.cos((o.lng-this.lng)*h);return O_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof bu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new bu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new bu(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Eb=2*Math.PI*O_;function Ib(u){return Eb*Math.cos(u*Math.PI/180)}function Cb(u){return(180+u)/360}function Tb(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function Lb(u,o){return u/Ib(o)}function z_(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class eg{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=bu.convert(o);return new eg(Cb(p.lng),Tb(p.lat),Lb(h,p.lat))}toLngLat(){return new bu(360*this.x-180,z_(this.y))}toAltitude(){return this.z*Ib(z_(this.y))}meterInMercatorCoordinateUnits(){return 1/Eb*(o=z_(this.y),1/Math.cos(o*Math.PI/180));var o}}function Pb(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 F_{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=Zp(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const y=(x=this.y,I=this.z,L=Pb(256*(b=this.x),256*(x=Math.pow(2,I)-x-1),I),A=Pb(256*(b+1),256*(x+1),I),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,I,L,A;const N=function(O,G,H){let K,te="";for(let le=O;le>0;le--)K=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,y)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new E((o.x*h-this.x)*Nr,(o.y*h-this.y)*Nr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Mb{constructor(o,h){this.wrap=o,this.canonical=h,this.key=Zp(o,h.z,h.z,h.x,h.y)}}class bs{constructor(o,h,p,y,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new F_(p,+y,+b),this.key=Zp(h,o,p,y,b)}clone(){return new bs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-o;return o>this.canonical.z?new bs(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bs(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Zp(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):Zp(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new bs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,y=2*this.canonical.y;return[new bs(h,this.wrap,h,p,y),new bs(h,this.wrap,h,p+1,y),new bs(h,this.wrap,h,p,y+1),new bs(h,this.wrap,h,p+1,y+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,I=p*this.dim+this.dim;switch(h){case-1:y=b-1;break;case 1:b=y+1}switch(p){case-1:x=I-1;break;case 1:I=x+1}const L=-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 Db{constructor(o,h,p,y,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=y,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class Rb{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new lc(Nr,16,0),this.grid3D=new lc(Nr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,y,b,x){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,y,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&L.insert(I,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new yu.VectorTile(new C_(this.rawTileData)).layers,this.sourceLayerCoder=new kb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,y){this.loadVTLayers();const b=o.params||{},x=Nr/o.tileSize/o.scale,I=_h(b.filter),L=o.queryGeometry,A=o.queryPadding*x,N=Ob(L),O=this.grid.query(N.minX-A,N.minY-A,N.maxX+A,N.maxY+A),G=Ob(o.cameraQueryGeometry),H=this.grid3D.query(G.minX-A,G.minY-A,G.maxX+A,G.maxY+A,(le,de,Ae,_e)=>function(Ce,Ye,Je,bt,Tt){for(const yt of Ce)if(Ye<=yt.x&&Je<=yt.y&&bt>=yt.x&&Tt>=yt.y)return!0;const vt=[new E(Ye,Je),new E(Ye,Tt),new E(bt,Tt),new E(bt,Je)];if(Ce.length>2){for(const yt of vt)if(Fh(Ce,yt))return!0}for(let yt=0;yt(_e||(_e=kl(Ce)),Ye.queryIntersectsFeature(L,Ce,Je,_e,this.z,o.transform,x,o.pixelPosMatrix)))}return K}loadMatchingFeature(o,h,p,y,b,x,I,L,A,N,O){const G=this.bucketLayerIDs[h];if(x&&!function(le,de){for(let Ae=0;Ae=0)return!0;return!1}(x,G))return;const H=this.sourceLayerCoder.decode(p),K=this.vtLayers[H].feature(y);if(b.needGeometry){const le=Dl(K,!0);if(!b.filter(new ur(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!b.filter(new ur(this.tileID.overscaledZ),K))return;const te=this.getId(K,H);for(let le=0;le{const I=o instanceof cc?o.get(x):null;return I&&I.evaluate?I.evaluate(h,p,y):I})}function Ob(u){let o=1/0,h=1/0,p=-1/0,y=-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),y=Math.max(y,b.y);return{minX:o,minY:h,maxX:p,maxY:y}}function xL(u,o){return o-u}function zb(u,o,h,p,y){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>=y&&O.y>=y||(N.y>=y?N=new E(N.x+(y-N.y)/(O.y-N.y)*(O.x-N.x),y)._round():O.y>=y&&(O=new E(N.x+(y-N.y)/(O.y-N.y)*(O.x-N.x),y)._round()),L&&N.equals(L[L.length-1])||(L=[N],b.push(L)),L.push(O)))))}}return b}St("FeatureIndex",Rb,{omit:["rawTileData","sourceLayerCoder"]});class xu extends E{constructor(o,h,p,y){super(o,h),this.angle=p,y!==void 0&&(this.segment=y)}clone(){return new xu(this.x,this.y,this.angle,this.segment)}}function Fb(u,o,h,p,y){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 L=[];let A=0;for(;Ip;)A-=L.shift().angleDelta;if(A>y)return!1;x++,I+=N.dist(O)}return!0}function Bb(u){let o=0;for(let h=0;hA){const K=(A-L)/H,te=eo.number(O.x,G.x,K),le=eo.number(O.y,G.y,K),de=new xu(te,le,G.angleTo(O),N);return de._round(),!x||Fb(u,de,I,x,o)?de:void 0}L+=H}}function SL(u,o,h,p,y,b,x,I,L){const A=Vb(p,b,x),N=Ub(p,y),O=N*x,G=u[0].x===0||u[0].x===L||u[0].y===0||u[0].y===L;return o-O=0&&Ce=0&&Ye=0&&G+A<=N){const Je=new xu(Ce,Ye,Ae,K);Je._round(),p&&!Fb(u,Je,b,p,y)||H.push(Je)}}O+=de}return I||H.length||x||(H=Gb(u,O/2,h,p,y,b,x,!0,L)),H}St("Anchor",xu);const Hh=Oo;function jb(u,o,h,p){const y=[],b=u.image,x=b.pixelRatio,I=b.paddedRect.w-2*Hh,L=b.paddedRect.h-2*Hh,A=u.right-u.left,N=u.bottom-u.top,O=b.stretchX||[[0,I]],G=b.stretchY||[[0,L]],H=(ht,Et)=>ht+Et[1]-Et[0],K=O.reduce(H,0),te=G.reduce(H,0),le=I-K,de=L-te;let Ae=0,_e=K,Ce=0,Ye=te,Je=0,bt=le,Tt=0,vt=de;if(b.content&&p){const ht=b.content;Ae=tg(O,0,ht[0]),Ce=tg(G,0,ht[1]),_e=tg(O,ht[0],ht[2]),Ye=tg(G,ht[1],ht[3]),Je=ht[0]-Ae,Tt=ht[1]-Ce,bt=ht[2]-ht[0]-_e,vt=ht[3]-ht[1]-Ye}const yt=(ht,Et,mt,nt)=>{const zt=ng(ht.stretch-Ae,_e,A,u.left),Mt=rg(ht.fixed-Je,bt,ht.stretch,K),dn=ng(Et.stretch-Ce,Ye,N,u.top),ir=rg(Et.fixed-Tt,vt,Et.stretch,te),hr=ng(mt.stretch-Ae,_e,A,u.left),fi=rg(mt.fixed-Je,bt,mt.stretch,K),ns=ng(nt.stretch-Ce,Ye,N,u.top),_o=rg(nt.fixed-Tt,vt,nt.stretch,te),ai=new E(zt,dn),Mi=new E(hr,dn),Fi=new E(hr,ns),vo=new E(zt,ns),bo=new E(Mt/x,ir/x),pi=new E(fi/x,_o/x),di=o*Math.PI/180;if(di){const ro=Math.sin(di),zo=Math.cos(di),Fo=[zo,-ro,ro,zo];ai._matMult(Fo),Mi._matMult(Fo),vo._matMult(Fo),Fi._matMult(Fo)}const no=ht.stretch+ht.fixed,xo=Et.stretch+Et.fixed;return{tl:ai,tr:Mi,bl:vo,br:Fi,tex:{x:b.paddedRect.x+Hh+no,y:b.paddedRect.y+Hh+xo,w:mt.stretch+mt.fixed-no,h:nt.stretch+nt.fixed-xo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:bo,pixelOffsetBR:pi,minFontScaleX:bt/x/A,minFontScaleY:vt/x/N,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ht=qb(O,le,K),Et=qb(G,de,te);for(let mt=0;mt0&&(K=Math.max(10,K),this.circleDiameter=K)}else{let O=x.top*I-L[0],G=x.bottom*I+L[2],H=x.left*I-L[3],K=x.right*I+L[1];const te=x.collisionPadding;if(te&&(H-=te[0]*I,O-=te[1]*I,K+=te[2]*I,G+=te[3]*I),N){const le=new E(H,O),de=new E(K,O),Ae=new E(H,G),_e=new E(K,G),Ce=N*Math.PI/180;le._rotate(Ce),de._rotate(Ce),Ae._rotate(Ce),_e._rotate(Ce),H=Math.min(le.x,de.x,Ae.x,_e.x),K=Math.max(le.x,de.x,Ae.x,_e.x),O=Math.min(le.y,de.y,Ae.y,_e.y),G=Math.max(le.y,de.y,Ae.y,_e.y)}o.emplaceBack(h.x,h.y,H,O,K,G,p,y,b)}this.boxEndIndex=o.length}}class EL{constructor(o=[],h=IL){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,y=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(y,x)>=0)break;h[o]=x,o=b}h[o]=y}_down(o){const{data:h,compare:p}=this,y=this.length>>1,b=h[o];for(;o=0)break;h[o]=I,o=x}h[o]=b}}function IL(u,o){return uo?1:0}function CL(u,o=1,h=!1){let p=1/0,y=1/0,b=-1/0,x=-1/0;const I=u[0];for(let H=0;Hb)&&(b=K.x),(!H||K.y>x)&&(x=K.y)}const L=Math.min(b-p,x-y);let A=L/2;const N=new EL([],TL);if(L===0)return new E(p,y);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 Zh(H.p.x-A,H.p.y-A,A,u)),N.push(new Zh(H.p.x+A,H.p.y-A,A,u)),N.push(new Zh(H.p.x-A,H.p.y+A,A,u)),N.push(new Zh(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 TL(u,o){return o.max-u.max}function Zh(u,o,h,p){this.p=new E(u,o),this.h=h,this.d=function(y,b){let x=!1,I=1/0;for(let L=0;Ly.y!=K.y>y.y&&y.x<(K.x-H.x)*(y.y-H.y)/(K.y-H.y)+H.x&&(x=!x),I=Math.min(I,T1(y,H,K))}}return(x?1:-1)*Math.sqrt(I)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var zi;c.ap=void 0,(zi=c.ap||(c.ap={}))[zi.center=1]="center",zi[zi.left=2]="left",zi[zi.right=3]="right",zi[zi.top=4]="top",zi[zi.bottom=5]="bottom",zi[zi["top-left"]=6]="top-left",zi[zi["top-right"]=7]="top-right",zi[zi["bottom-left"]=8]="bottom-left",zi[zi["bottom-right"]=9]="bottom-right";const wu=7,B_=Number.POSITIVE_INFINITY;function Wb(u,o){return o[1]!==B_?function(h,p,y){let b=0,x=0;switch(p=Math.abs(p),y=Math.abs(y),h){case"top-right":case"top-left":case"top":x=y-wu;break;case"bottom-right":case"bottom-left":case"bottom":x=-y+wu}switch(h){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(u,o[0],o[1]):function(h,p){let y=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-wu;break;case"bottom-right":case"bottom-left":b=-x+wu;break;case"bottom":b=-p+wu;break;case"top":b=p-wu}switch(h){case"top-right":case"bottom-right":y=-x;break;case"top-left":case"bottom-left":y=x;break;case"left":y=p;break;case"right":y=-p}return[y,b]}(u,o[0])}function Hb(u,o,h){var p;const y=u.layout,b=(p=y.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const I=b.values,L=[];for(let A=0;AG*hi);N.startsWith("top")?O[1]-=wu:N.startsWith("bottom")&&(O[1]+=wu),L[A+1]=O}return new Qo(L)}const x=y.get("text-variable-anchor");if(x){let I;I=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},h)*hi,B_]:y.get("text-offset").evaluate(o,{},h).map(A=>A*hi);const L=[];for(const A of x)L.push(A,Wb(A,I));return new Qo(L)}return null}function V_(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 LL(u,o,h,p,y,b,x,I,L,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),K=Xb(h.horizontal),te=x/24,le=u.tilePixelRatio*te,de=u.tilePixelRatio*O/24,Ae=u.tilePixelRatio*I,_e=u.tilePixelRatio*G.get("symbol-spacing"),Ce=G.get("text-padding")*u.tilePixelRatio,Ye=function(nt,zt,Mt,dn=1){const ir=nt.get("icon-padding").evaluate(zt,{},Mt),hr=ir&&ir.values;return[hr[0]*dn,hr[1]*dn,hr[2]*dn,hr[3]*dn]}(G,o,N,u.tilePixelRatio),Je=G.get("text-max-angle")/180*Math.PI,bt=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Tt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",vt=G.get("symbol-placement"),yt=_e/2,ht=G.get("icon-text-fit");let Et;p&&ht!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(Et=yb(p,h.vertical,ht,G.get("icon-text-fit-padding"),H,te)),K&&(p=yb(p,K,ht,G.get("icon-text-fit-padding"),H,te)));const mt=(nt,zt)=>{zt.x<0||zt.x>=Nr||zt.y<0||zt.y>=Nr||function(Mt,dn,ir,hr,fi,ns,_o,ai,Mi,Fi,vo,bo,pi,di,no,xo,ro,zo,Fo,mi,bn,io,Bi,gi,qs){const ba=Mt.addToLineVertexArray(dn,ir);let xa,Nl,Ws,xs,Bo=0,Ol=0,Kp=0,Qb=0,X_=-1,Y_=-1;const zl={};let $b=Tr("");if(Mt.allowVerticalPlacement&&hr.vertical){const oo=ai.layout.get("text-rotate").evaluate(bn,{},gi)+90;Ws=new ig(Mi,dn,Fi,vo,bo,hr.vertical,pi,di,no,oo),_o&&(xs=new ig(Mi,dn,Fi,vo,bo,_o,ro,zo,no,oo))}if(fi){const oo=ai.layout.get("icon-rotate").evaluate(bn,{}),ws=ai.layout.get("icon-text-fit")!=="none",vc=jb(fi,oo,Bi,ws),Sa=_o?jb(_o,oo,Bi,ws):void 0;Nl=new ig(Mi,dn,Fi,vo,bo,fi,ro,zo,!1,oo),Bo=4*vc.length;const bc=Mt.iconSizeData;let Qa=null;bc.kind==="source"?(Qa=[Ja*ai.layout.get("icon-size").evaluate(bn,{})],Qa[0]>vu&&Ke(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Hp}. Reduce your "icon-size".`)):bc.kind==="composite"&&(Qa=[Ja*io.compositeIconSizes[0].evaluate(bn,{},gi),Ja*io.compositeIconSizes[1].evaluate(bn,{},gi)],(Qa[0]>vu||Qa[1]>vu)&&Ke(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Hp}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,vc,Qa,mi,Fo,bn,c.ah.none,dn,ba.lineStartIndex,ba.lineLength,-1,gi),X_=Mt.icon.placedSymbolArray.length-1,Sa&&(Ol=4*Sa.length,Mt.addSymbols(Mt.icon,Sa,Qa,mi,Fo,bn,c.ah.vertical,dn,ba.lineStartIndex,ba.lineLength,-1,gi),Y_=Mt.icon.placedSymbolArray.length-1)}const ex=Object.keys(hr.horizontal);for(const oo of ex){const ws=hr.horizontal[oo];if(!xa){$b=Tr(ws.text);const Sa=ai.layout.get("text-rotate").evaluate(bn,{},gi);xa=new ig(Mi,dn,Fi,vo,bo,ws,pi,di,no,Sa)}const vc=ws.positionedLines.length===1;if(Kp+=Zb(Mt,dn,ws,ns,ai,no,bn,xo,ba,hr.vertical?c.ah.horizontal:c.ah.horizontalOnly,vc?ex:[oo],zl,X_,io,gi),vc)break}hr.vertical&&(Qb+=Zb(Mt,dn,hr.vertical,ns,ai,no,bn,xo,ba,c.ah.vertical,["vertical"],zl,Y_,io,gi));const AL=xa?xa.boxStartIndex:Mt.collisionBoxArray.length,kL=xa?xa.boxEndIndex:Mt.collisionBoxArray.length,DL=Ws?Ws.boxStartIndex:Mt.collisionBoxArray.length,RL=Ws?Ws.boxEndIndex:Mt.collisionBoxArray.length,NL=Nl?Nl.boxStartIndex:Mt.collisionBoxArray.length,OL=Nl?Nl.boxEndIndex:Mt.collisionBoxArray.length,zL=xs?xs.boxStartIndex:Mt.collisionBoxArray.length,FL=xs?xs.boxEndIndex:Mt.collisionBoxArray.length;let wa=-1;const sg=(oo,ws)=>oo&&oo.circleDiameter?Math.max(oo.circleDiameter,ws):ws;wa=sg(xa,wa),wa=sg(Ws,wa),wa=sg(Nl,wa),wa=sg(xs,wa);const tx=wa>-1?1:0;tx&&(wa*=qs/hi),Mt.glyphOffsetArray.length>=Wh.MAX_GLYPHS&&Ke("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),bn.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,bn.sortKey);const BL=Hb(ai,bn,gi),[VL,UL]=function(oo,ws){const vc=oo.length,Sa=ws==null?void 0:ws.values;if((Sa==null?void 0:Sa.length)>0)for(let bc=0;bc=0?zl.right:-1,zl.center>=0?zl.center:-1,zl.left>=0?zl.left:-1,zl.vertical||-1,X_,Y_,$b,AL,kL,DL,RL,NL,OL,zL,FL,Fi,Kp,Qb,Bo,Ol,tx,0,pi,wa,VL,UL)}(u,zt,nt,h,p,y,Et,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,le,[Ce,Ce,Ce,Ce],bt,L,Ae,Ye,Tt,H,o,b,A,N,x)};if(vt==="line")for(const nt of zb(o.geometry,0,0,Nr,Nr)){const zt=SL(nt,_e,Je,h.vertical||K,p,24,de,u.overscaling,Nr);for(const Mt of zt)K&&PL(u,K.text,yt,Mt)||mt(nt,Mt)}else if(vt==="line-center"){for(const nt of o.geometry)if(nt.length>1){const zt=wL(nt,Je,h.vertical||K,p,24,de);zt&&mt(nt,zt)}}else if(o.type==="Polygon")for(const nt of __(o.geometry,0)){const zt=CL(nt,16);mt(nt[0],new xu(zt.x,zt.y,0))}else if(o.type==="LineString")for(const nt of o.geometry)mt(nt,new xu(nt[0].x,nt[0].y,0));else if(o.type==="Point")for(const nt of o.geometry)for(const zt of nt)mt([zt],new xu(zt.x,zt.y,0))}function Zb(u,o,h,p,y,b,x,I,L,A,N,O,G,H,K){const te=function(Ae,_e,Ce,Ye,Je,bt,Tt,vt){const yt=Ye.layout.get("text-rotate").evaluate(bt,{})*Math.PI/180,ht=[];for(const Et of _e.positionedLines)for(const mt of Et.positionedGlyphs){if(!mt.rect)continue;const nt=mt.rect||{};let zt=cb+1,Mt=!0,dn=1,ir=0;const hr=(Je||vt)&&mt.vertical,fi=mt.metrics.advance*mt.scale/2;if(vt&&_e.verticalizable&&(ir=Et.lineOffset/2-(mt.imageName?-(hi-mt.metrics.width*mt.scale)/2:(mt.scale-1)*hi)),mt.imageName){const mi=Tt[mt.imageName];Mt=mi.sdf,dn=mi.pixelRatio,zt=Oo/dn}const ns=Je?[mt.x+fi,mt.y]:[0,0];let _o=Je?[0,0]:[mt.x+fi+Ce[0],mt.y+Ce[1]-ir],ai=[0,0];hr&&(ai=_o,_o=[0,0]);const Mi=mt.metrics.isDoubleResolution?2:1,Fi=(mt.metrics.left-zt)*mt.scale-fi+_o[0],vo=(-mt.metrics.top-zt)*mt.scale+_o[1],bo=Fi+nt.w/Mi*mt.scale/dn,pi=vo+nt.h/Mi*mt.scale/dn,di=new E(Fi,vo),no=new E(bo,vo),xo=new E(Fi,pi),ro=new E(bo,pi);if(hr){const mi=new E(-fi,fi-qp),bn=-Math.PI/2,io=hi/2-fi,Bi=new E(5-qp-io,-(mt.imageName?io:0)),gi=new E(...ai);di._rotateAround(bn,mi)._add(Bi)._add(gi),no._rotateAround(bn,mi)._add(Bi)._add(gi),xo._rotateAround(bn,mi)._add(Bi)._add(gi),ro._rotateAround(bn,mi)._add(Bi)._add(gi)}if(yt){const mi=Math.sin(yt),bn=Math.cos(yt),io=[bn,-mi,mi,bn];di._matMult(io),no._matMult(io),xo._matMult(io),ro._matMult(io)}const zo=new E(0,0),Fo=new E(0,0);ht.push({tl:di,tr:no,bl:xo,br:ro,tex:nt,writingMode:_e.writingMode,glyphOffset:ns,sectionIndex:mt.sectionIndex,isSDF:Mt,pixelOffsetTL:zo,pixelOffsetBR:Fo,minFontScaleX:0,minFontScaleY:0})}return ht}(0,h,I,y,b,x,p,u.allowVerticalPlacement),le=u.textSizeData;let de=null;le.kind==="source"?(de=[Ja*y.layout.get("text-size").evaluate(x,{})],de[0]>vu&&Ke(`${u.layerIds[0]}: Value for "text-size" is >= ${Hp}. Reduce your "text-size".`)):le.kind==="composite"&&(de=[Ja*H.compositeTextSizes[0].evaluate(x,{},K),Ja*H.compositeTextSizes[1].evaluate(x,{},K)],(de[0]>vu||de[1]>vu)&&Ke(`${u.layerIds[0]}: Value for "text-size" is >= ${Hp}. Reduce your "text-size".`)),u.addSymbols(u.text,te,de,I,b,x,A,o,L.lineStartIndex,L.lineLength,G,K);for(const Ae of N)O[Ae]=u.text.placedSymbolArray.length-1;return 4*te.length}function Xb(u){for(const o in u)return u[o];return null}function PL(u,o,h,p){const y=u.compareText;if(o in y){const b=y[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const b=Yb[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 U_(I,x,b,o)}constructor(o,h=64,p=Float64Array,y){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=Yb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,I=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-I%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+I+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return G_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:I}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const N=L.pop()||0,O=L.pop()||0,G=L.pop()||0;if(O-G<=I){for(let le=G;le<=O;le++){const de=x[2*le],Ae=x[2*le+1];de>=o&&de<=p&&Ae>=h&&Ae<=y&&A.push(b[le])}continue}const H=G+O>>1,K=x[2*H],te=x[2*H+1];K>=o&&K<=p&&te>=h&&te<=y&&A.push(b[H]),(N===0?o<=K:h<=te)&&(L.push(G),L.push(H-1),L.push(1-N)),(N===0?p>=K:y>=te)&&(L.push(H+1),L.push(O),L.push(1-N))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:b,nodeSize:x}=this,I=[0,y.length-1,0],L=[],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 le=G;le<=O;le++)Jb(b[2*le],b[2*le+1],o,h)<=A&&L.push(y[le]);continue}const H=G+O>>1,K=b[2*H],te=b[2*H+1];Jb(K,te,o,h)<=A&&L.push(y[H]),(N===0?o-p<=K:h-p<=te)&&(I.push(G),I.push(H-1),I.push(1-N)),(N===0?o+p>=K:h+p>=te)&&(I.push(H+1),I.push(O),I.push(1-N))}return L}}function G_(u,o,h,p,y,b){if(y-p<=h)return;const x=p+y>>1;Kb(u,o,x,p,y,b),G_(u,o,h,p,x-1,1-b),G_(u,o,h,x+1,y,1-b)}function Kb(u,o,h,p,y,b){for(;y>p;){if(y-p>600){const A=y-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);Kb(u,o,h,Math.max(p,Math.floor(h-N*G/A+H)),Math.min(y,Math.floor(h+(A-N)*G/A+H)),b)}const x=o[2*h+b];let I=p,L=y;for(Xp(u,o,p,h),o[2*y+b]>x&&Xp(u,o,p,y);Ix;)L--}o[2*p+b]===x?Xp(u,o,p,L):(L++,Xp(u,o,L,y)),L<=h&&(p=L+1),h<=L&&(y=L-1)}}function Xp(u,o,h,p){j_(u,h,p),j_(o,2*h,2*p),j_(o,2*h+1,2*p+1)}function j_(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function Jb(u,o,h,p){const y=u-h,b=o-p;return y*y+b*b}var q_;c.bd=void 0,(q_=c.bd||(c.bd={})).create="create",q_.load="load",q_.fullLoad="fullLoad";let og=null,Yp=[];const W_=1e3/60,H_="loadTime",Z_="fullLoadTime",ML={mark(u){performance.mark(u)},frame(u){const o=u;og!=null&&Yp.push(o-og),og=o},clearMetrics(){og=null,Yp=[],performance.clearMeasures(H_),performance.clearMeasures(Z_);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(H_,c.bd.create,c.bd.load),performance.measure(Z_,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(H_)[0].duration,o=performance.getEntriesByName(Z_)[0].duration,h=Yp.length,p=1/(Yp.reduce((b,x)=>b+x,0)/h/1e3),y=Yp.filter(b=>b>W_).reduce((b,x)=>b+(x-W_)/W_,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:y/(h+y)*100,totalFrames:h}}};c.$=pt,c.A=Bh,c.B=function(u){if(je==null){const o=u.navigator?u.navigator.userAgent:null;je=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return je},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 bL(()=>this.process()),this.subscription=function(h,p,y,b){return h.addEventListener(p,y,!1),{unsubscribe:()=>{h.removeEventListener(p,y,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=tt(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const I={id:y,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:y,sourceMapId:this.mapId,origin:location.origin,data:pu(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(tt(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const 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 y=this.resolveRejects[u];return delete this.resolveRejects[u],y?void(o.error?y.reject(du(o.error)):y.resolve(du(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(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=du(o.data),p=new AbortController;this.abortControllers[u]=p;try{const y=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,y)}catch(y){this.completeTask(u,y)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const y={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?pu(o):null,data:pu(h,p)};this.target.postMessage(y,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=kt,c.E=Nn,c.F=function(){var u=new Bh(16);return Bh!=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=Rn,c.H=function(u,o,h){var p,y,b,x,I,L,A,N,O,G,H,K,te=h[0],le=h[1],de=h[2];return o===u?(u[12]=o[0]*te+o[4]*le+o[8]*de+o[12],u[13]=o[1]*te+o[5]*le+o[9]*de+o[13],u[14]=o[2]*te+o[6]*le+o[10]*de+o[14],u[15]=o[3]*te+o[7]*le+o[11]*de+o[15]):(y=o[1],b=o[2],x=o[3],I=o[4],L=o[5],A=o[6],N=o[7],O=o[8],G=o[9],H=o[10],K=o[11],u[0]=p=o[0],u[1]=y,u[2]=b,u[3]=x,u[4]=I,u[5]=L,u[6]=A,u[7]=N,u[8]=O,u[9]=G,u[10]=H,u[11]=K,u[12]=p*te+I*le+O*de+o[12],u[13]=y*te+L*le+G*de+o[13],u[14]=b*te+A*le+H*de+o[14],u[15]=x*te+N*le+K*de+o[15]),u},c.I=L_,c.J=function(u,o,h){var p=h[0],y=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]*y,u[5]=o[5]*y,u[6]=o[6]*y,u[7]=o[7]*y,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=A1,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 y=window.document.createElement("source");dr(p)||(o.crossOrigin="Anonymous"),y.src=p,o.appendChild(y)}})},c.a3=function(){return oe++},c.a4=_,c.a5=Wh,c.a6=_h,c.a7=Dl,c.a8=ur,c.a9=Db,c.aA=Z,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!ln(u.version,o.version))return[{command:"setStyle",args:[o]}];ln(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),ln(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),ln(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),ln(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),ln(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),ln(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),ln(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),ln(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),ln(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),ln(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},y=[];(function(x,I,L,A){let N;for(N in I=I||{},x=x||{})Object.prototype.hasOwnProperty.call(x,N)&&(Object.prototype.hasOwnProperty.call(I,N)||ps(N,L,A));for(N in I)Object.prototype.hasOwnProperty.call(I,N)&&(Object.prototype.hasOwnProperty.call(x,N)?ln(x[N],I[N])||(x[N].type==="geojson"&&I[N].type==="geojson"&&Ua(x,I,N)?er(L,{command:"setGeoJSONSourceData",args:[N,I[N].data]}):Os(N,I,L,A)):Mo(N,I,L))})(u.sources,o.sources,y,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(y),function(x,I,L){I=I||[];const A=(x=x||[]).map(wl),N=I.map(wl),O=x.reduce(ds,{}),G=I.reduce(ds,{}),H=A.slice(),K=Object.create(null);let te,le,de,Ae,_e;for(let Ce=0,Ye=0;Ce@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,y,b)=>{const x=y||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=re,c.ad=function(u,o,h){var p=Math.sin(h),y=Math.cos(h),b=o[0],x=o[1],I=o[2],L=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*y+A*p,u[1]=x*y+N*p,u[2]=I*y+O*p,u[3]=L*y+G*p,u[4]=A*y-b*p,u[5]=N*y-x*p,u[6]=O*y-I*p,u[7]=G*y-L*p,u},c.ae=function(u){var o=new Bh(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=jm,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:y,minZoom:b,maxZoom:x}=u,I=y?re(Oi.interpolationFactor(y,o,b,x),0,1):0;u.kind==="camera"?p=eo.number(u.minSize,u.maxSize,I):h=I}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:y}){return u.kind==="source"?p/Ja:u.kind==="composite"?eo.number(p/Ja,y/Ja,h):o},c.aj=k_,c.ak=function(u,o,h,p){const y=o.y-u.y,b=o.x-u.x,x=p.y-h.y,I=p.x-h.x,L=x*b-I*y;if(L===0)return null;const A=(I*(u.y-h.y)-x*(u.x-h.x))/L;return new E(u.x+A*b,u.y+A*y)},c.al=zb,c.am=Mp,c.an=h_,c.ao=hi,c.aq=A_,c.ar=function(u,o){var h=o[0],p=o[1],y=o[2],b=o[3],x=o[4],I=o[5],L=o[6],A=o[7],N=o[8],O=o[9],G=o[10],H=o[11],K=o[12],te=o[13],le=o[14],de=o[15],Ae=h*I-p*x,_e=h*L-y*x,Ce=h*A-b*x,Ye=p*L-y*I,Je=p*A-b*I,bt=y*A-b*L,Tt=N*te-O*K,vt=N*le-G*K,yt=N*de-H*K,ht=O*le-G*te,Et=O*de-H*te,mt=G*de-H*le,nt=Ae*mt-_e*Et+Ce*ht+Ye*yt-Je*vt+bt*Tt;return nt?(u[0]=(I*mt-L*Et+A*ht)*(nt=1/nt),u[1]=(y*Et-p*mt-b*ht)*nt,u[2]=(te*bt-le*Je+de*Ye)*nt,u[3]=(G*Je-O*bt-H*Ye)*nt,u[4]=(L*yt-x*mt-A*vt)*nt,u[5]=(h*mt-y*yt+b*vt)*nt,u[6]=(le*Ce-K*bt-de*_e)*nt,u[7]=(N*bt-G*Ce+H*_e)*nt,u[8]=(x*Et-I*yt+A*Tt)*nt,u[9]=(p*yt-h*Et-b*Tt)*nt,u[10]=(K*Je-te*Ce+de*Ae)*nt,u[11]=(O*Ce-N*Je-H*Ae)*nt,u[12]=(I*vt-x*ht-L*Tt)*nt,u[13]=(h*ht-p*vt+y*Tt)*nt,u[14]=(te*_e-K*Ye-le*Ae)*nt,u[15]=(N*Ye-O*_e+G*Ae)*nt,u):null},c.as=V_,c.at=M_,c.au=U_,c.av=function(){const u={},o=Oe.$version;for(const h in Oe.$root){const p=Oe.$root[h];if(p.required){let y=null;y=h==="version"?o:p.type==="array"?[]:{},y!=null&&(u[h]=y)}}return u},c.aw=Pm,c.ax=kr,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hnt*hi)}let vt=x?"center":h.get("text-justify").evaluate(A,{},u.canonical);const yt=h.get("symbol-placement"),ht=yt==="point"?h.get("text-max-width").evaluate(A,{},u.canonical)*hi:0,Et=()=>{u.bucket.allowVerticalPlacement&&mu(Ce)&&(K.vertical=Km(te,u.glyphMap,u.glyphPositions,u.imagePositions,N,ht,b,bt,"left",Je,de,c.ah.vertical,!0,yt,G,O))};if(!x&&Tt){const mt=new Set;if(vt==="auto")for(let zt=0;ztl(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=wt})},p.onerror=()=>h(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const y=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(y):wt}),c.g=vn,c.h=(u,o)=>Sr(pe(u,{type:"json"}),o),c.i=tt,c.j=Ct,c.k=Pe,c.l=(u,o)=>Sr(pe(u,{type:"arrayBuffer"}),o),c.m=Sr,c.n=function(u){return new C_(u).readFields(oL,[])},c.o=Op,c.p=hb,c.q=go,c.r=a_,c.s=dr,c.t=fu,c.u=_t,c.v=Oe,c.w=Ke,c.x=Pl,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=eo}),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,q){for(const ie of V){this._layerConfigs[ie.id]=ie;const xe=this._layers[ie.id]=c.az(ie);xe._featureFilter=c.a6(xe.filter),this.keyCache[ie.id]&&delete this.keyCache[ie.id]}for(const ie of q)delete this.keyCache[ie],delete this._layerConfigs[ie],delete this._layers[ie];this.familiesBySource={};const J=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const ie of J){const xe=ie.map(We=>this._layers[We.id]),Q=xe[0];if(Q.visibility==="none")continue;const we=Q.source||"";let me=this.familiesBySource[we];me||(me=this.familiesBySource[we]={});const Me=Q.sourceLayer||"_geojsonTileLayer";let Ue=me[Me];Ue||(Ue=me[Me]=[]),Ue.push(xe)}}}class m{constructor(V){const q={},J=[];for(const we in V){const me=V[we],Me=q[we]={};for(const Ue in me){const We=me[+Ue];if(!We||We.bitmap.width===0||We.bitmap.height===0)continue;const Xe={x:0,y:0,w:We.bitmap.width+2,h:We.bitmap.height+2};J.push(Xe),Me[Ue]={rect:Xe,metrics:We.metrics}}}const{w:ie,h:xe}=c.p(J),Q=new c.o({width:ie||1,height:xe||1});for(const we in V){const me=V[we];for(const Me in me){const Ue=me[+Me];if(!Ue||Ue.bitmap.width===0||Ue.bitmap.height===0)continue;const We=q[we][Me].rect;c.o.copy(Ue.bitmap,Q,{x:0,y:0},{x:We.x+1,y:We.y+1},Ue.bitmap)}}this.image=Q,this.positions=q}}c.bi("GlyphAtlas",m);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,q,J,ie){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new c.a4;const xe=new c.bj(Object.keys(V.layers).sort()),Q=new c.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const we={},me={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Me=q.familiesBySource[this.source];for(const sn in Me){const Er=V.layers[sn];if(!Er)continue;Er.version===1&&c.w(`Vector tile source "${this.source}" layer "${sn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const li=xe.encode(sn),$i=[];for(let fo=0;fo=xi.maxzoom||xi.visibility!=="none"&&(S(fo,this.zoom,J),(we[xi.id]=xi.createBucket({index:Q.bucketLayerIDs.length,layers:fo,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:li,sourceID:this.source})).populate($i,me,this.tileID.canonical),Q.bucketLayerIDs.push(fo.map(zs=>zs.id)))}}const Ue=c.aE(me.glyphDependencies,sn=>Object.keys(sn).map(Number));this.inFlightDependencies.forEach(sn=>sn==null?void 0:sn.abort()),this.inFlightDependencies=[];let We=Promise.resolve({});if(Object.keys(Ue).length){const sn=new AbortController;this.inFlightDependencies.push(sn),We=ie.sendAsync({type:"GG",data:{stacks:Ue,source:this.source,tileID:this.tileID,type:"glyphs"}},sn)}const Xe=Object.keys(me.iconDependencies);let Lt=Promise.resolve({});if(Xe.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Lt=ie.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"icons"}},sn)}const Dt=Object.keys(me.patternDependencies);let Ht=Promise.resolve({});if(Dt.length){const sn=new AbortController;this.inFlightDependencies.push(sn),Ht=ie.sendAsync({type:"GI",data:{icons:Dt,source:this.source,tileID:this.tileID,type:"patterns"}},sn)}const[Zt,wn,Xn]=yield Promise.all([We,Lt,Ht]),lr=new m(Zt),ni=new c.bl(wn,Xn);for(const sn in we){const Er=we[sn];Er instanceof c.a5?(S(Er.layers,this.zoom,J),c.bm({bucket:Er,glyphMap:Zt,glyphPositions:lr.positions,imageMap:wn,imagePositions:ni.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Er.hasPattern&&(Er instanceof c.bn||Er instanceof c.bo||Er instanceof c.bp)&&(S(Er.layers,this.zoom,J),Er.addFeatures(me,this.tileID.canonical,ni.patternPositions))}return this.status="done",{buckets:Object.values(we).filter(sn=>!sn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:lr.image,imageAtlas:ni,glyphMap:this.returnDependencies?Zt:null,iconMap:this.returnDependencies?wn:null,glyphPositions:this.returnDependencies?lr.positions:null}})}}function S(ue,V,q){const J=new c.a8(V);for(const ie of ue)ie.recalculate(J,q)}class E{constructor(V,q,J){this.actor=V,this.layerIndex=q,this.availableImages=J,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,q){return c._(this,void 0,void 0,function*(){const J=yield c.l(V.request,q);try{return{vectorTile:new c.bq.VectorTile(new c.br(J.data)),rawData:J.data,cacheControl:J.cacheControl,expires:J.expires}}catch(ie){const xe=new Uint8Array(J.data);let Q=`Unable to parse the tile at ${V.request.url}, `;throw Q+=xe[0]===31&&xe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ie.messge}`,new Error(Q)}})}loadTile(V){return c._(this,void 0,void 0,function*(){const q=V.uid,J=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request),ie=new w(V);this.loading[q]=ie;const xe=new AbortController;ie.abort=xe;try{const Q=yield this.loadVectorTile(V,xe);if(delete this.loading[q],!Q)return null;const we=Q.rawData,me={};Q.expires&&(me.expires=Q.expires),Q.cacheControl&&(me.cacheControl=Q.cacheControl);const Me={};if(J){const We=J.finish();We&&(Me.resourceTiming=JSON.parse(JSON.stringify(We)))}ie.vectorTile=Q.vectorTile;const Ue=ie.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[q]=ie,this.fetching[q]={rawTileData:we,cacheControl:me,resourceTiming:Me};try{const We=yield Ue;return c.e({rawTileData:we.slice(0)},We,me,Me)}finally{delete this.fetching[q]}}catch(Q){throw delete this.loading[q],ie.status="done",this.loaded[q]=ie,Q}})}reloadTile(V){return c._(this,void 0,void 0,function*(){const q=V.uid;if(!this.loaded||!this.loaded[q])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const J=this.loaded[q];if(J.showCollisionBoxes=V.showCollisionBoxes,J.status==="parsing"){const ie=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);let xe;if(this.fetching[q]){const{rawTileData:Q,cacheControl:we,resourceTiming:me}=this.fetching[q];delete this.fetching[q],xe=c.e({rawTileData:Q.slice(0)},ie,we,me)}else xe=ie;return xe}if(J.status==="done"&&J.vectorTile)return J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return c._(this,void 0,void 0,function*(){const q=this.loading,J=V.uid;q&&q[J]&&q[J].abort&&(q[J].abort.abort(),delete q[J])})}removeTile(V){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class P{constructor(){this.loaded={}}loadTile(V){return c._(this,void 0,void 0,function*(){const{uid:q,encoding:J,rawImageData:ie,redFactor:xe,greenFactor:Q,blueFactor:we,baseShift:me}=V,Me=ie.width+2,Ue=ie.height+2,We=c.b(ie)?new c.R({width:Me,height:Ue},yield c.bt(ie,-1,-1,Me,Ue)):ie,Xe=new c.bu(q,We,J,xe,Q,we,me);return this.loaded=this.loaded||{},this.loaded[q]=Xe,Xe})}removeTile(V){const q=this.loaded,J=V.uid;q&&q[J]&&delete q[J]}}function D(ue,V){if(ue.length!==0){k(ue[0],V);for(var q=1;q=Math.abs(we)?q-me+we:we-me+q,q=me}q+J>=0!=!!V&&ue.reverse()}var U=c.bv(function ue(V,q){var J,ie=V&&V.type;if(ie==="FeatureCollection")for(J=0;J>31}function Ze(ue,V){for(var q=ue.loadGeometry(),J=ue.type,ie=0,xe=0,Q=q.length,we=0;weue},wt=Math.fround||(un=new Float32Array(1),ue=>(un[0]=+ue,un[0]));var un;const qt=3,At=5,hn=6;class Tn{constructor(V){this.options=Object.assign(Object.create(Ot),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:q,minZoom:J,maxZoom:ie}=this.options;q&&console.time("total time");const xe=`prepare ${V.length} points`;q&&console.time(xe),this.points=V;const Q=[];for(let me=0;me=J;me--){const Me=+Date.now();we=this.trees[me]=this._createTree(this._cluster(we,me)),q&&console.log("z%d: %d clusters in %dms",me,we.numItems,+Date.now()-Me)}return q&&console.timeEnd("total time"),this}getClusters(V,q){let J=((V[0]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,V[1]));let xe=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)J=-180,xe=180;else if(J>xe){const We=this.getClusters([J,ie,180,Q],q),Xe=this.getClusters([-180,ie,xe,Q],q);return We.concat(Xe)}const we=this.trees[this._limitZoom(q)],me=we.range(Rn(J),wr(Q),Rn(xe),wr(ie)),Me=we.data,Ue=[];for(const We of me){const Xe=this.stride*We;Ue.push(Me[Xe+At]>1?_n(Me,Xe,this.clusterProps):this.points[Me[Xe+qt]])}return Ue}getChildren(V){const q=this._getOriginId(V),J=this._getOriginZoom(V),ie="No cluster with the specified id.",xe=this.trees[J];if(!xe)throw new Error(ie);const Q=xe.data;if(q*this.stride>=Q.length)throw new Error(ie);const we=this.options.radius/(this.options.extent*Math.pow(2,J-1)),me=xe.within(Q[q*this.stride],Q[q*this.stride+1],we),Me=[];for(const Ue of me){const We=Ue*this.stride;Q[We+4]===V&&Me.push(Q[We+At]>1?_n(Q,We,this.clusterProps):this.points[Q[We+qt]])}if(Me.length===0)throw new Error(ie);return Me}getLeaves(V,q,J){const ie=[];return this._appendLeaves(ie,V,q=q||10,J=J||0,0),ie}getTile(V,q,J){const ie=this.trees[this._limitZoom(V)],xe=Math.pow(2,V),{extent:Q,radius:we}=this.options,me=we/Q,Me=(J-me)/xe,Ue=(J+1+me)/xe,We={features:[]};return this._addTileFeatures(ie.range((q-me)/xe,Me,(q+1+me)/xe,Ue),ie.data,q,J,xe,We),q===0&&this._addTileFeatures(ie.range(1-me/xe,Me,1,Ue),ie.data,xe,J,xe,We),q===xe-1&&this._addTileFeatures(ie.range(0,Me,me/xe,Ue),ie.data,-1,J,xe,We),We.features.length?We:null}getClusterExpansionZoom(V){let q=this._getOriginZoom(V)-1;for(;q<=this.options.maxZoom;){const J=this.getChildren(V);if(q++,J.length!==1)break;V=J[0].properties.cluster_id}return q}_appendLeaves(V,q,J,ie,xe){const Q=this.getChildren(q);for(const we of Q){const me=we.properties;if(me&&me.cluster?xe+me.point_count<=ie?xe+=me.point_count:xe=this._appendLeaves(V,me.cluster_id,J,ie,xe):xe1;let Ue,We,Xe;if(Me)Ue=vn(q,me,this.clusterProps),We=q[me],Xe=q[me+1];else{const Ht=this.points[q[me+qt]];Ue=Ht.properties;const[Zt,wn]=Ht.geometry.coordinates;We=Rn(Zt),Xe=wr(wn)}const Lt={type:1,geometry:[[Math.round(this.options.extent*(We*xe-J)),Math.round(this.options.extent*(Xe*xe-ie))]],tags:Ue};let Dt;Dt=Me||this.options.generateId?q[me+qt]:this.points[q[me+qt]].id,Dt!==void 0&&(Lt.id=Dt),Q.features.push(Lt)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,q){const{radius:J,extent:ie,reduce:xe,minPoints:Q}=this.options,we=J/(ie*Math.pow(2,q)),me=V.data,Me=[],Ue=this.stride;for(let We=0;Weq&&(Zt+=me[Xn+At])}if(Zt>Ht&&Zt>=Q){let wn,Xn=Xe*Ht,lr=Lt*Ht,ni=-1;const sn=((We/Ue|0)<<5)+(q+1)+this.points.length;for(const Er of Dt){const li=Er*Ue;if(me[li+2]<=q)continue;me[li+2]=q;const $i=me[li+At];Xn+=me[li]*$i,lr+=me[li+1]*$i,me[li+4]=sn,xe&&(wn||(wn=this._map(me,We,!0),ni=this.clusterProps.length,this.clusterProps.push(wn)),xe(wn,this._map(me,li)))}me[We+4]=sn,Me.push(Xn/Zt,lr/Zt,1/0,sn,-1,Zt),xe&&Me.push(ni)}else{for(let wn=0;wn1)for(const wn of Dt){const Xn=wn*Ue;if(!(me[Xn+2]<=q)){me[Xn+2]=q;for(let lr=0;lr>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,q,J){if(V[q+At]>1){const Q=this.clusterProps[V[q+hn]];return J?Object.assign({},Q):Q}const ie=this.points[V[q+qt]].properties,xe=this.options.map(ie);return J&&xe===ie?Object.assign({},xe):xe}}function _n(ue,V,q){return{type:"Feature",id:ue[V+qt],properties:vn(ue,V,q),geometry:{type:"Point",coordinates:[(J=ue[V],360*(J-.5)),kr(ue[V+1])]}};var J}function vn(ue,V,q){const J=ue[V+At],ie=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,xe=ue[V+hn],Q=xe===-1?{}:Object.assign({},q[xe]);return Object.assign(Q,{cluster:!0,cluster_id:ue[V+qt],point_count:J,point_count_abbreviated:ie})}function Rn(ue){return ue/360+.5}function wr(ue){const V=Math.sin(ue*Math.PI/180),q=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return q<0?0:q>1?1:q}function kr(ue){const V=(180-360*ue)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function Sr(ue,V,q,J){for(var ie,xe=J,Q=q-V>>1,we=q-V,me=ue[V],Me=ue[V+1],Ue=ue[q],We=ue[q+1],Xe=V+3;Xexe)ie=Xe,xe=Lt;else if(Lt===xe){var Dt=Math.abs(Xe-Q);DtJ&&(ie-V>3&&Sr(ue,V,ie,J),ue[ie+2]=xe,q-ie>3&&Sr(ue,ie,q,J))}function dr(ue,V,q,J,ie,xe){var Q=ie-q,we=xe-J;if(Q!==0||we!==0){var me=((ue-q)*Q+(V-J)*we)/(Q*Q+we*we);me>1?(q=ie,J=xe):me>0&&(q+=Q*me,J+=we*me)}return(Q=ue-q)*Q+(we=V-J)*we}function Qe(ue,V,q,J){var ie={id:ue===void 0?null:ue,type:V,geometry:q,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xe){var Q=xe.geometry,we=xe.type;if(we==="Point"||we==="MultiPoint"||we==="LineString")ye(xe,Q);else if(we==="Polygon"||we==="MultiLineString")for(var me=0;me0&&(Q+=J?(ie*Me-me*xe)/2:Math.sqrt(Math.pow(me-ie,2)+Math.pow(Me-xe,2))),ie=me,xe=Me}var Ue=V.length-3;V[2]=1,Sr(V,0,Ue,q),V[Ue+2]=1,V.size=Math.abs(Q),V.start=0,V.end=V.size}function Oe(ue,V,q,J){for(var ie=0;ie1?1:q}function ln(ue,V,q,J,ie,xe,Q,we){if(J/=V,xe>=(q/=V)&&Q=J)return null;for(var me=[],Me=0;Me=q&&Dt=J)){var Ht=[];if(Xe==="Point"||Xe==="MultiPoint")er(We,Ht,q,J,ie);else if(Xe==="LineString")Mo(We,Ht,q,J,ie,!1,we.lineMetrics);else if(Xe==="MultiLineString")Os(We,Ht,q,J,ie,!1);else if(Xe==="Polygon")Os(We,Ht,q,J,ie,!0);else if(Xe==="MultiPolygon")for(var Zt=0;Zt=q&&Q<=J&&(V.push(ue[xe]),V.push(ue[xe+1]),V.push(ue[xe+2]))}}function Mo(ue,V,q,J,ie,xe,Q){for(var we,me,Me=ps(ue),Ue=ie===0?Pi:wl,We=ue.start,Xe=0;Xeq&&(me=Ue(Me,Lt,Dt,Zt,wn,q),Q&&(Me.start=We+we*me)):Xn>J?lr=q&&(me=Ue(Me,Lt,Dt,Zt,wn,q),ni=!0),lr>J&&Xn<=J&&(me=Ue(Me,Lt,Dt,Zt,wn,J),ni=!0),!xe&&ni&&(Q&&(Me.end=We+we*me),V.push(Me),Me=ps(ue)),Q&&(We+=we)}var sn=ue.length-3;Lt=ue[sn],Dt=ue[sn+1],Ht=ue[sn+2],(Xn=ie===0?Lt:Dt)>=q&&Xn<=J&&Ua(Me,Lt,Dt,Ht),sn=Me.length-3,xe&&sn>=3&&(Me[sn]!==Me[0]||Me[sn+1]!==Me[1])&&Ua(Me,Me[0],Me[1],Me[2]),Me.length&&V.push(Me)}function ps(ue){var V=[];return V.size=ue.size,V.start=ue.start,V.end=ue.end,V}function Os(ue,V,q,J,ie,xe){for(var Q=0;QQ.maxX&&(Q.maxX=Ue),We>Q.maxY&&(Q.maxY=We)}return Q}function ti(ue,V,q,J){var ie=V.geometry,xe=V.type,Q=[];if(xe==="Point"||xe==="MultiPoint")for(var we=0;we0&&V.size<(ie?Q:J))q.numPoints+=V.length/3;else{for(var we=[],me=0;meQ)&&(q.numSimplified++,we.push(V[me]),we.push(V[me+1])),q.numPoints++;ie&&function(Me,Ue){for(var We=0,Xe=0,Lt=Me.length,Dt=Lt-2;Xe0===Ue)for(Xe=0,Lt=Me.length;Xe24)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 J=function(ie,xe){var Q=[];if(ie.type==="FeatureCollection")for(var we=0;we1&&console.time("creation"),Xe=this.tiles[We]=Sl(ue,V,q,J,me),this.tileCoords.push({z:V,x:q,y:J}),Me)){Me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,q,J,Xe.numFeatures,Xe.numPoints,Xe.numSimplified),console.timeEnd("creation"));var Lt="z"+V;this.stats[Lt]=(this.stats[Lt]||0)+1,this.total++}if(Xe.source=ue,ie){if(V===me.maxZoom||V===ie)continue;var Dt=1<1&&console.time("clipping");var Ht,Zt,wn,Xn,lr,ni,sn=.5*me.buffer/me.extent,Er=.5-sn,li=.5+sn,$i=1+sn;Ht=Zt=wn=Xn=null,lr=ln(ue,Ue,q-sn,q+li,0,Xe.minX,Xe.maxX,me),ni=ln(ue,Ue,q+Er,q+$i,0,Xe.minX,Xe.maxX,me),ue=null,lr&&(Ht=ln(lr,Ue,J-sn,J+li,1,Xe.minY,Xe.maxY,me),Zt=ln(lr,Ue,J+Er,J+$i,1,Xe.minY,Xe.maxY,me),lr=null),ni&&(wn=ln(ni,Ue,J-sn,J+li,1,Xe.minY,Xe.maxY,me),Xn=ln(ni,Ue,J+Er,J+$i,1,Xe.minY,Xe.maxY,me),ni=null),Me>1&&console.timeEnd("clipping"),we.push(Ht||[],V+1,2*q,2*J),we.push(Zt||[],V+1,2*q,2*J+1),we.push(wn||[],V+1,2*q+1,2*J),we.push(Xn||[],V+1,2*q+1,2*J+1)}}},tn.prototype.getTile=function(ue,V,q){var J=this.options,ie=J.extent,xe=J.debug;if(ue<0||ue>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",ue,V,q);for(var me,Me=ue,Ue=V,We=q;!me&&Me>0;)Me--,Ue=Math.floor(Ue/2),We=Math.floor(We/2),me=this.tiles[$t(Me,Ue,We)];return me&&me.source?(xe>1&&console.log("found parent tile z%d-%d-%d",Me,Ue,We),xe>1&&console.time("drilling down"),this.splitTile(me.source,Me,Ue,We,ue,V,q),xe>1&&console.timeEnd("drilling down"),this.tiles[we]?Ko(this.tiles[we],ie):null):null};class ya extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,q){return c._(this,void 0,void 0,function*(){const J=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ie=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!ie)return null;const xe=new class{constructor(we){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=we.length,this._features=we}feature(we){return new class{constructor(me){this._feature=me,this.extent=c.W,this.type=me.type,this.properties=me.tags,"id"in me&&!isNaN(me.id)&&(this.id=parseInt(me.id,10))}loadGeometry(){if(this._feature.type===1){const me=[];for(const Me of this._feature.geometry)me.push([new c.P(Me[0],Me[1])]);return me}{const me=[];for(const Me of this._feature.geometry){const Ue=[];for(const We of Me)Ue.push(new c.P(We[0],We[1]));me.push(Ue)}return me}}toGeoJSON(me,Me,Ue){return j.call(this,me,Me,Ue)}}(this._features[we])}}(ie.features);let Q=je(xe);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:xe,rawData:Q.buffer}})}loadData(V){return c._(this,void 0,void 0,function*(){var q;(q=this._pendingRequest)===null||q===void 0||q.abort();const J=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request);this._pendingRequest=new AbortController;try{let ie=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof ie!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(U(ie,!0),V.filter){const Q=c.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(me=>`${me.key}: ${me.message}`).join(", "));ie={type:"FeatureCollection",features:ie.features.filter(me=>Q.value.evaluate({zoom:0},me))}}this._geoJSONIndex=V.cluster?new Tn(function({superclusterOptions:Q,clusterProperties:we}){if(!we||!Q)return Q;const me={},Me={},Ue={accumulated:null,zoom:0},We={properties:null},Xe=Object.keys(we);for(const Lt of Xe){const[Dt,Ht]=we[Lt],Zt=c.by(Ht),wn=c.by(typeof Dt=="string"?[Dt,["accumulated"],["get",Lt]]:Dt);me[Lt]=Zt.value,Me[Lt]=wn.value}return Q.map=Lt=>{We.properties=Lt;const Dt={};for(const Ht of Xe)Dt[Ht]=me[Ht].evaluate(Ue,We);return Dt},Q.reduce=(Lt,Dt)=>{We.properties=Dt;for(const Ht of Xe)Ue.accumulated=Lt[Ht],Lt[Ht]=Me[Ht].evaluate(Ue,We)},Q}(V)).load(ie.features):function(Q,we){return new tn(Q,we)}(ie,V.geojsonVtOptions),this.loaded={};const xe={};if(J){const Q=J.finish();Q&&(xe.resourceTiming={},xe.resourceTiming[V.source]=JSON.parse(JSON.stringify(Q)))}return xe}catch(ie){if(delete this._pendingRequest,c.bz(ie))return{abandoned:!0};throw ie}})}reloadTile(V){const q=this.loaded;return q&&q[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,q){return c._(this,void 0,void 0,function*(){const{promoteId:J}=V;if(V.request){const ie=yield c.h(V.request,q);return this._dataUpdateable=Jo(ie.data,J)?Qt(ie.data,J):void 0,ie.data}if(typeof V.data=="string")try{const ie=JSON.parse(V.data);return this._dataUpdateable=Jo(ie,J)?Qt(ie,J):void 0,ie}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(ie,xe,Q){var we,me,Me,Ue;if(xe.removeAll&&ie.clear(),xe.remove)for(const We of xe.remove)ie.delete(We);if(xe.add)for(const We of xe.add){const Xe=Rr(We,Q);Xe!=null&&ie.set(Xe,We)}if(xe.update)for(const We of xe.update){let Xe=ie.get(We.id);if(Xe==null)continue;const Lt=!We.removeAllProperties&&(((we=We.removeProperties)===null||we===void 0?void 0:we.length)>0||((me=We.addOrUpdateProperties)===null||me===void 0?void 0:me.length)>0);if((We.newGeometry||We.removeAllProperties||Lt)&&(Xe=Object.assign({},Xe),ie.set(We.id,Xe),Lt&&(Xe.properties=Object.assign({},Xe.properties))),We.newGeometry&&(Xe.geometry=We.newGeometry),We.removeAllProperties)Xe.properties={};else if(((Me=We.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const Dt of We.removeProperties)Object.prototype.hasOwnProperty.call(Xe.properties,Dt)&&delete Xe.properties[Dt];if(((Ue=We.addOrUpdateProperties)===null||Ue===void 0?void 0:Ue.length)>0)for(const{key:Dt,value:Ht}of We.addOrUpdateProperties)Xe.properties[Dt]=Ht}}(this._dataUpdateable,V.dataDiff,J),{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 Gr{constructor(V){this.self=V,this.actor=new c.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(q,J)=>{if(this.externalWorkerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.externalWorkerSourceTypes[q]=J},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=q=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(q)},this.actor.registerMessageHandler("LDT",(q,J)=>this._getDEMWorkerSource(q,J.source).loadTile(J)),this.actor.registerMessageHandler("RDT",(q,J)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(q,J.source).removeTile(J)})),this.actor.registerMessageHandler("GCEZ",(q,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterExpansionZoom(J)})),this.actor.registerMessageHandler("GCC",(q,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterChildren(J)})),this.actor.registerMessageHandler("GCL",(q,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(q,J.type,J.source).getClusterLeaves(J)})),this.actor.registerMessageHandler("LD",(q,J)=>this._getWorkerSource(q,J.type,J.source).loadData(J)),this.actor.registerMessageHandler("LT",(q,J)=>this._getWorkerSource(q,J.type,J.source).loadTile(J)),this.actor.registerMessageHandler("RT",(q,J)=>this._getWorkerSource(q,J.type,J.source).reloadTile(J)),this.actor.registerMessageHandler("AT",(q,J)=>this._getWorkerSource(q,J.type,J.source).abortTile(J)),this.actor.registerMessageHandler("RMT",(q,J)=>this._getWorkerSource(q,J.type,J.source).removeTile(J)),this.actor.registerMessageHandler("RS",(q,J)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[q]||!this.workerSources[q][J.type]||!this.workerSources[q][J.type][J.source])return;const ie=this.workerSources[q][J.type][J.source];delete this.workerSources[q][J.type][J.source],ie.removeSource!==void 0&&ie.removeSource(J)})),this.actor.registerMessageHandler("RM",q=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[q],delete this.availableImages[q],delete this.workerSources[q],delete this.demWorkerSources[q]})),this.actor.registerMessageHandler("SR",(q,J)=>c._(this,void 0,void 0,function*(){this.referrer=J})),this.actor.registerMessageHandler("SRPS",(q,J)=>this._syncRTLPluginState(q,J)),this.actor.registerMessageHandler("IS",(q,J)=>c._(this,void 0,void 0,function*(){this.self.importScripts(J)})),this.actor.registerMessageHandler("SI",(q,J)=>this._setImages(q,J)),this.actor.registerMessageHandler("UL",(q,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(q).update(J.layers,J.removedIds)})),this.actor.registerMessageHandler("SL",(q,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(q).replace(J)}))}_setImages(V,q){return c._(this,void 0,void 0,function*(){this.availableImages[V]=q;for(const J in this.workerSources[V]){const ie=this.workerSources[V][J];for(const xe in ie)ie[xe].availableImages=q}})}_syncRTLPluginState(V,q){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(q.pluginStatus!=="loading")return c.bA.setState(q),q;const J=q.pluginURL;if(this.self.importScripts(J),c.bA.isParsed()){const ie={pluginStatus:"loaded",pluginURL:J};return c.bA.setState(ie),ie}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${J}`)})}_getAvailableImages(V){let q=this.availableImages[V];return q||(q=[]),q}_getLayerIndex(V){let q=this.layerIndexes[V];return q||(q=this.layerIndexes[V]=new l),q}_getWorkerSource(V,q,J){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][q]||(this.workerSources[V][q]={}),!this.workerSources[V][q][J]){const ie={sendAsync:(xe,Q)=>(xe.targetMapId=V,this.actor.sendAsync(xe,Q))};switch(q){case"vector":this.workerSources[V][q][J]=new E(ie,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][q][J]=new ya(ie,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][q][J]=new this.externalWorkerSourceTypes[q](ie,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][q][J]}_getDEMWorkerSource(V,q){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][q]||(this.demWorkerSources[V][q]=new P),this.demWorkerSources[V][q]}}return c.i(self)&&(self.worker=new Gr(self)),Gr}),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:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(l.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const 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=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],g=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,g={}},_.addThrottleControl=M=>{const R=d++;return g[R]=M,R},_.removeThrottleControl=M=>{delete g[M],C()},_.getImage=(M,R,z=!0)=>new Promise((F,Y)=>{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:ae=>{Y(ae)},onSuccess:ae=>{F(ae)}}),C()});const v=M=>l._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:R,supportImageRefresh:z,onError:F,onSuccess:Y,abortController:ae}=M,se=z===!1&&!l.i(self)&&!l.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((be,Fe)=>be&&Fe==="accept",!0));f++;const ce=se?T(R,ae):l.m(R,ae);try{const be=yield ce;delete M.abortController,M.state="completed",be.data instanceof HTMLImageElement||l.b(be.data)?Y(be):be.data&&Y({data:yield(ee=be.data,typeof createImageBitmap=="function"?l.d(ee):l.f(ee)),cacheControl:be.cacheControl,expires:be.expires})}catch(be){delete M.abortController,F(be)}finally{f--,C()}var ee}),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)}},T=(M,R)=>new Promise((z,F)=>{const Y=new Image,ae=M.url,se=M.credentials;se&&se==="include"?Y.crossOrigin="use-credentials":(se&&se==="same-origin"||!l.s(ae))&&(Y.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{Y.src="",F(l.c())}),Y.fetchPriority="high",Y.onload=()=>{Y.onerror=Y.onload=null,z({data:Y})},Y.onerror=()=>{Y.onerror=Y.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."))},Y.src=ae})}(W||(W={})),W.resetRequestQueue();class X{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const g=function(v){const C=v.match(re);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 re=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ge(_){var s=new l.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var pe,oe=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};pe=new l.A(3),l.A!=Float32Array&&(pe[0]=0,pe[1]=0,pe[2]=0);var fe=function(_){var s=_[0],f=_[1];return s*s+f*f};function Te(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:g}of _){const v=`${d}${g}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:g}))}}return s}(function(){var _=new l.A(2);l.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Z{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:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[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 ne(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Ke 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 Z(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],T=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:T,y:M},{width:z,height:F}),l.R.copy(R,g,{x:0,y:F-1},{x:T,y:M-1},{width:z,height:1}),l.R.copy(R,g,{x:0,y:0},{x:T,y:M+F},{width:z,height:1}),l.R.copy(R,g,{x:z-1,y:0},{x:T-1,y:M},{width:1,height:F}),l.R.copy(R,g,{x:0,y:0},{x:T+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||l.w(`Image with ID: "${f}" was not found`),ne(d)&&this.updateImage(f,d)}}}const Ee=1e20;function Ze(_,s,f,d,g,v,C,T,M){for(let R=s;R-1);M++,v[M]=T,C[M]=R,C[M+1]=Ee}for(let T=0,M=0;T65535)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 T=je.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const C=yield d.requests[v];for(const T in C)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=C[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(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 T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new je.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:T})}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}}}}je.loadGlyphRange=function(_,s,f,d){return l._(this,void 0,void 0,function*(){const g=256*s,v=g+255,C=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${g}-${v}`),"Glyphs"),T=yield l.l(C,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);const M={};for(const R of l.n(T.data))M[R.id]=R;return M})},je.TinySDF=class{constructor({fontSize:_=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 T=this.size=_+4*s,M=this._createCanvas(T),R=this.ctx=M.getContext("2d",{willReadFrequently:!0});R.font=`${C} ${v} ${_}px ${g}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(_),C=Math.ceil(f),T=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=T+2*this.buffer,z=M+2*this.buffer,F=Math.max(R*z,0),Y=new Uint8ClampedArray(F),ae={data:Y,width:R,height:z,glyphWidth:T,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return ae;const{ctx:se,buffer:ce,gridInner:ee,gridOuter:be}=this;se.clearRect(ce,ce,T,M),se.fillText(_,ce,ce+C);const Fe=se.getImageData(ce,ce,T,M);be.fill(Ee,0,F),ee.fill(0,0,F);for(let he=0;he0?He*He:0,ee[Ge]=He<0?He*He:0}}Ze(be,0,0,R,z,R,this.f,this.v,this.z),Ze(ee,ce,ce,T,M,R,this.f,this.v,this.z);for(let he=0;he1&&(M=s[++T]);const z=Math.abs(R-M.left),F=Math.abs(R-M.right),Y=Math.min(z,F);let ae;const se=v/d*(g+1);if(M.isDash){const ce=g-Math.abs(se);ae=Math.sqrt(Y*Y+ce*ce)}else ae=g-Math.sqrt(Y*Y+se*se);this.data[C+R]=Math.max(0,Math.min(255,ae+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],R=s[T+1];M.zeroLength?s.splice(T,1):R&&R.isDash===M.isDash&&(R.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const g=this.width*this.nextRow;let v=0,C=s[v];for(let T=0;T1&&(C=s[++v]);const M=Math.abs(T-C.left),R=Math.abs(T-C.right),z=Math.min(M,R);this.data[g+T]=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 T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[At]}numActive(){return Object.keys(this.active).length}}const Tn=Math.floor(E.hardwareConcurrency/2);let _n,vn;function Rn(){return _n||(_n=new hn),_n}hn.workerCount=l.B(globalThis)?Math.max(Math.min(Tn,3),1):1;class wr{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 kr(){return vn||(vn=new wr(Rn(),l.G),vn.registerMessageHandler("GR",(_,s,f)=>l.m(s,f))),vn}function Sr(_,s){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*_.width,.5*_.height,1]),l.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function dr(_,s,f,d,g,v){const C=function(F,Y,ae){if(F)for(const se of F){const ce=Y[se];if(ce&&ce.source===ae&&ce.type==="fill-extrusion")return!0}else for(const se in Y){const ce=Y[se];if(ce.source===ae&&ce.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,C);M.sort(Qe);const R=[];for(const F of M)R.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,g,v,T,Sr(_.transform,F.tileID))});const z=function(F){const Y={},ae={};for(const se of F){const ce=se.queryResults,ee=se.wrappedTileID,be=ae[ee]=ae[ee]||{};for(const Fe in ce){const he=ce[Fe],Le=be[Fe]=be[Fe]||{},Be=Y[Fe]=Y[Fe]||[];for(const Ge of he)Le[Ge.featureIndex]||(Le[Ge.featureIndex]=!0,Be.push(Ge))}}return Y}(R);for(const F in z)z[F].forEach(Y=>{const ae=Y.feature,se=_.getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=se});return z}function Qe(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function ye(_,s,f){return l._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield l.h(s.transformRequest(_.url,"Source"),f)).data:yield E.frameAsync(f),!d)return null;const g=l.L(l.e(d,_),["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 Pe{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 Pe))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Pe.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 Pe?s:s&&new Pe(s)}static fromLngLat(s,f=0){const d=360*f/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Pe(new l.M(s.lng-g,s.lat-d),new l.M(s.lng+g,s.lat+d))}}class Ct{constructor(s,f,d){this.bounds=Pe.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 ye(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new Ct(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 W.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 Z(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 Jt 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 W.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),T={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(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,T=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,T,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,T,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 ln=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 W.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,T=-1/0,M=-1/0;for(const Y of g)v=Math.min(v,Y.x),C=Math.min(C,Y.y),T=Math.max(T,Y.x),M=Math.max(M,Y.y);const R=Math.max(T-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+T)/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,ln.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Z(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 Mo 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,ln.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 Z(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 ps 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,ln.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 Z(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 Os={},Ua=_=>{switch(_){case"geojson":return Dr;case"image":return er;case"raster":return Oe;case"raster-dem":return Jt;case"vector":return Nn;case"video":return Mo;case"canvas":return ps}return Os[_]},Pi="RTLPluginLoaded";class wl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=kr()}_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(Pi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ds=null;function at(){return ds||(ds=new wl),ds}class Ko{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){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(R=>M.filter(z=>z.id===R)[0]));for(const R of M)C[R.id]=T}}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 Z(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Z(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,T,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:T,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 T=l.a6(f&&f.filter),{z:M,x:R,y:z}=this.tileID.canonical,F={z:M,x:R,y:z};for(let Y=0;Yd)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 Sl{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 T of Object.keys(this.deletedStates[g][C]))delete this.state[g][C][T];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 ti 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,T)=>{const M=new(Ua(v.type))(g,v,C,T);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 Qi(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Sl,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,T=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-T.y||M.x-T.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,T),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 T=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()&&(T=R)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const 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-ti.maxOverzooming,this._source.minzoom),C=Math.max(g+ti.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of d)if(F.canonical.z>this._source.minzoom){const Y=F.scaledTo(F.canonical.z-1);z[Y.key]=Y;const ae=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[ae.key]=ae}d=d.concat(Object.values(z))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(tn(this._source.type)){const z={},F={},Y=Object.keys(M),ae=E.now();for(const se of Y){const ce=M[se],ee=this._tiles[se];if(!ee||ee.fadeEndTime!==0&&ee.fadeEndTime<=ae)continue;const be=this.findLoadedParent(ce,v);be&&(this._addTile(be.tileID),z[be.tileID.key]=be.tileID),F[se]=ce}this._retainLoadedChildren(F,g,C,M);for(const se in z)M[se]||(this._coveredTiles[se]=!0,M[se]=z[se]);if(f){const se={},ce={};for(const ee of d)this._tiles[ee.key].hasData()?se[ee.key]=ee:ce[ee.key]=ee;for(const ee in ce){const be=ce[ee].children(this._source.maxzoom);this._tiles[be[0].key]&&this._tiles[be[1].key]&&this._tiles[be[2].key]&&this._tiles[be[3].key]&&(se[be[0].key]=M[be[0].key]=be[0],se[be[1].key]=M[be[1].key]=be[1],se[be[2].key]=M[be[2].key]=be[2],se[be[3].key]=M[be[3].key]=be[3],delete ce[ee])}for(const ee in ce){const be=this.findLoadedParent(ce[ee],this._source.minzoom);if(be){se[be.tileID.key]=M[be.tileID.key]=be.tileID;for(const Fe in se)se[Fe].isChildOf(be.tileID)&&delete se[Fe]}}for(const ee in this._tiles)se[ee]||(this._coveredTiles[ee]=!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-ti.maxOverzooming,this._source.minzoom),C=Math.max(f+ti.maxUnderzooming,this._source.minzoom),T={};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],Y=this.getTile(F);if(Y&&Y.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 Y=M.scaledTo(F);if(g[Y.key])break;if(g[Y.key]=!0,R=this.getTile(Y),!R&&z&&(R=this._addTile(Y)),R){const ae=R.hasData();if((z||ae)&&(d[Y.key]=Y),z=R.wasRequested(),ae)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 Ko(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new 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,T=s.map(se=>v.pointCoordinate(se,this.terrain)),M=C.map(se=>v.pointCoordinate(se,this.terrain)),R=this.getIds();let z=1/0,F=1/0,Y=-1/0,ae=-1/0;for(const se of M)z=Math.min(z,se.x),F=Math.min(F,se.y),Y=Math.max(Y,se.x),ae=Math.max(ae,se.y);for(let se=0;se=0&&he[1].y+Fe>=0){const Le=T.map(Ge=>ee.getTilePoint(Ge)),Be=M.map(Ge=>ee.getTilePoint(Ge));g.push({tile:ce,tileID:ee,queryGeometry:Le,cameraQueryGeometry:Be,scale:be})}}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(tn(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(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function tn(_){return _==="raster"||_==="image"||_==="video"}ti.maxOverzooming=10,ti.maxUnderzooming=3;class $t{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-C)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Rr(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Jo{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,T=s+d,M=f-d,R=f+d;if(T<0||C>this.width||R<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,T,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,T,M){const{seenUids:R,hitTest:z,overlapMode:F}=T,Y=this.boxCells[v];if(Y!==null){const se=this.bboxes;for(const ce of Y)if(!R.box[ce]){R.box[ce]=!0;const ee=4*ce,be=this.boxKeys[ce];if(s<=se[ee+2]&&f<=se[ee+3]&&d>=se[ee+0]&&g>=se[ee+1]&&(!M||M(be))&&(!z||!Rr(F,be.overlapMode))&&(C.push({key:be,x1:se[ee],y1:se[ee+1],x2:se[ee+2],y2:se[ee+3]}),z))return!0}}const ae=this.circleCells[v];if(ae!==null){const se=this.circles;for(const ce of ae)if(!R.circle[ce]){R.circle[ce]=!0;const ee=3*ce,be=this.circleKeys[ce];if(this._circleAndRectCollide(se[ee],se[ee+1],se[ee+2],s,f,d,g)&&(!M||M(be))&&(!z||!Rr(F,be.overlapMode))){const Fe=se[ee],he=se[ee+1],Le=se[ee+2];if(C.push({key:be,x1:Fe-Le,y1:he-Le,x2:Fe+Le,y2:he+Le}),z)return!0}}}return!1}_queryCellCircle(s,f,d,g,v,C,T,M){const{circle:R,seenUids:z,overlapMode:F}=T,Y=this.boxCells[v];if(Y!==null){const se=this.bboxes;for(const ce of Y)if(!z.box[ce]){z.box[ce]=!0;const ee=4*ce,be=this.boxKeys[ce];if(this._circleAndRectCollide(R.x,R.y,R.radius,se[ee+0],se[ee+1],se[ee+2],se[ee+3])&&(!M||M(be))&&!Rr(F,be.overlapMode))return C.push(!0),!0}}const ae=this.circleCells[v];if(ae!==null){const se=this.circles;for(const ce of ae)if(!z.circle[ce]){z.circle[ce]=!0;const ee=3*ce,be=this.circleKeys[ce];if(this._circlesCollide(se[ee],se[ee+1],se[ee+2],R.x,R.y,R.radius)&&(!M||M(be))&&!Rr(F,be.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,d,g,v,C,T,M){const R=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),Y=this._convertToYCellCoord(g);for(let ae=R;ae<=F;ae++)for(let se=z;se<=Y;se++)if(v.call(this,s,f,d,g,this.xCellCount*se+ae,C,T,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,d,g,v,C){const T=g-s,M=v-f,R=d+C;return R*R>T*T+M*M}_circleAndRectCollide(s,f,d,g,v,C,T){const M=(C-g)/2,R=Math.abs(s-(g+M));if(R>M+d)return!1;const z=(T-v)/2,F=Math.abs(f-(v+z));if(F>z+d)return!1;if(R<=M||F<=z)return!0;const Y=R-M,ae=F-z;return Y*Y+ae*ae<=d*d}}function Qt(_,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,_),v}function ya(_,s,f,d,g){if(s){const v=l.ae(_);return l.J(v,v,[g,g,1]),f||l.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Gr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],l.af(d,d,s)):(d=[_.x,_.y,0,1],Lt(d,d,s));const g=d[3];return{point:new l.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function ue(_,s){return .5+_/s*.5}function V(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function q(_,s,f,d,g,v,C,T,M,R){const z=d?_.textSizeData:_.iconSizeData,F=l.ag(z,f.transform.zoom),Y=[256/f.width*2+1,256/f.height*2+1],ae=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;ae.clear();const se=_.lineVertexArray,ce=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,ee=f.transform.width/f.transform.height;let be=!1;for(let Fe=0;FeMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===l.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function xe(_,s,f,d,g,v,C,T,M,R,z,F,Y,ae,se,ce){const ee=s/24,be=_.lineOffsetX*ee,Fe=_.lineOffsetY*ee;let he;if(_.numGlyphs>1){const Le=_.glyphStartIndex+_.numGlyphs,Be=_.lineStartIndex,Ge=_.lineStartIndex+_.lineLength,He=J(ee,T,be,Fe,f,z,F,_,M,v,Y,se,ce);if(!He)return{notEnoughRoom:!0};const et=Gr(He.first.point,C,ce).point,$e=Gr(He.last.point,C,ce).point;if(d&&!f){const ct=ie(_.writingMode,et,$e,ae);if(ct)return ct}he=[He.first];for(let ct=_.glyphStartIndex+1;ct0?et.point:Q(F,He,Be,1,g,ce),ct=ie(_.writingMode,Be,$e,ae);if(ct)return ct}const Le=Ue(ee*T.getoffsetX(_.glyphStartIndex),be,Fe,f,z,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,Y,se,ce);if(!Le)return{notEnoughRoom:!0};he=[Le]}for(const Le of he)l.aj(R,Le.point,Le.angle);return{}}function Q(_,s,f,d,g,v){const C=Gr(_.add(_.sub(s)._unit()),g,v).point,T=f.sub(C);return f.add(T._mult(d/T.mag()))}function we(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:T,previousVertex:M,direction:R,absOffsetX:z}=s;if(f.projections[_])return f.projections[_];const F=new l.P(d.getx(_),d.gety(_)),Y=Gr(F,g,T);if(Y.signedDistanceFromCamera>0)return f.projections[_]=Y.point,Y.point;const ae=_-R;return Q(C===0?v:new l.P(d.getx(ae),d.gety(ae)),F,M,z-C+1,g,T)}function me(_,s,f){return _._unit()._perp()._mult(s*f)}function Me(_,s,f,d,g,v,C,T){const{projectionCache:M,direction:R}=T;if(M.offsets[_])return M.offsets[_];const z=f.add(s);if(_+R=g)return M.offsets[_]=z,z;const F=we(_+R,T),Y=me(F.sub(f),C,R),ae=f.add(Y),se=F.add(Y);return M.offsets[_]=l.ak(v,z,ae,se)||z,M.offsets[_]}function Ue(_,s,f,d,g,v,C,T,M,R,z,F,Y,ae){const se=d?_-s:_+s;let ce=se>0?1:-1,ee=0;d&&(ce*=-1,ee=Math.PI),ce<0&&(ee+=Math.PI);let be,Fe,he=ce>0?T+C:T+C+1,Le=g,Be=g,Ge=0,He=0;const et=Math.abs(se),$e=[];let ct;for(;Ge+He<=et;){if(he+=ce,he=M)return null;Ge+=He,Be=Le,Fe=be;const dt={projectionCache:F,lineVertexArray:R,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:Ge,getElevation:ae,previousVertex:Be,direction:ce,absOffsetX:et};if(Le=we(he,dt),f===0)$e.push(Be),ct=Le.sub(Be);else{let Bt;const rn=Le.sub(Be);Bt=rn.mag()===0?me(we(he+ce,dt).sub(Le),f,ce):me(rn,f,ce),Fe||(Fe=Be.add(Bt)),be=Me(he,Bt,Le,T,M,Fe,f,dt),$e.push(Fe),ct=be.sub(Fe)}He=ct.mag()}const pt=ct._mult((et-Ge)/He)._add(Fe||Be),nn=ee+Math.atan2(Le.y-Be.y,Le.x-Be.x);return $e.push(pt),{point:pt,angle:Y?nn:0,path:$e}}const We=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xe(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(We,3*d)}}function Lt(_,s,f){const d=s[0],g=s[1];return _[0]=f[0]*d+f[4]*g+f[12],_[1]=f[1]*d+f[5]*g+f[13],_[3]=f[3]*d+f[7]*g+f[15],_}const Dt=100;class Ht{constructor(s,f=new Jo(s.width+200,s.height+200,25),d=new Jo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Dt,this.screenBottomBoundary=s.height+Dt,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,g,v,C){const T=this.projectAndGetPerspectiveRatio(g,s.anchorPointX,s.anchorPointY,C),M=d*T.perspectiveRatio,R=s.x1*M+T.point.x,z=s.y1*M+T.point.y,F=s.x2*M+T.point.x,Y=s.y2*M+T.point.y;return!this.isInsideGrid(R,z,F,Y)||f!=="always"&&this.grid.hitTest(R,z,F,Y,f,v)||T.perspectiveRatio=1;an--)rn.push(dt.path[an]);for(let an=1;anGr(fn,M,se));rn=an.some(fn=>fn.signedDistanceFromCamera<=0)?[]:an.map(fn=>fn.point)}let Wt=[];if(rn.length>0){const an=rn[0].clone(),fn=rn[0].clone();for(let Tr=1;Tr=ct.x&&fn.x<=pt.x&&an.y>=ct.y&&fn.y<=pt.y?[rn]:fn.xpt.x||fn.ypt.y?[]:l.al([rn],ct.x,ct.y,pt.x,pt.y)}for(const an of Wt){nn.reset(an,.25*$e);let fn=0;fn=nn.length<=.5*$e?1:Math.ceil(nn.paddedLength/En)+1;for(let Tr=0;Tr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,f,d,g){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function li(_,s,f,d,g){const{horizontalAlign:v,verticalAlign:C}=l.at(_);return new l.P(-(v-.5)*s+d[0]*g,-(C-.5)*f+d[1]*g)}function $i(_,s,f,d,g,v){const{x1:C,x2:T,y1:M,y2:R,anchorPointX:z,anchorPointY:F}=_,Y=new l.P(s,f);return d&&Y._rotate(g?v:-v),{x1:C+Y.x,y1:M+Y.y,x2:T+Y.x,y2:R+Y.y,anchorPointX:z,anchorPointY:F}}class fo{constructor(s,f,d,g,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Ht(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Er(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 T=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()),Y=M.get("text-pitch-alignment")==="map",ae=M.get("text-rotation-alignment")==="map",se=Zt(d,1,this.transform.zoom),ce=Qt(F,Y,ae,this.transform,se);let ee=null;if(Y){const Fe=ya(F,Y,ae,this.transform,se);ee=l.K([],this.transform.labelPlaneMatrix,Fe)}this.retainedQueryData[v.bucketInstanceId]=new sn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,d.tileID);const be={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:ce,labelToScreenMatrix:ee,scale:R,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:l.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(const Fe of v.sortKeyRanges){const{sortKey:he,symbolInstanceStart:Le,symbolInstanceEnd:Be}=Fe;s.push({sortKey:he,symbolInstanceStart:Le,symbolInstanceEnd:Be,parameters:be})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:be})}attemptAnchorPlacement(s,f,d,g,v,C,T,M,R,z,F,Y,ae,se,ce,ee){const be=l.ap[s.textAnchor],Fe=[s.textOffset0,s.textOffset1],he=li(be,d,g,Fe,v),Le=this.collisionIndex.placeCollisionBox($i(f,he.x,he.y,C,T,this.transform.angle),F,M,R,z.predicate,ee);if((!ce||this.collisionIndex.placeCollisionBox($i(ce,he.x,he.y,C,T,this.transform.angle),F,M,R,z.predicate,ee).box.length!==0)&&Le.box.length>0){let Be;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Y.crossTileID]&&this.prevPlacement.placements[Y.crossTileID]&&this.prevPlacement.placements[Y.crossTileID].text&&(Be=this.prevPlacement.variableOffsets[Y.crossTileID].anchor),Y.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Y.crossTileID]={textOffset:Fe,width:d,height:g,anchor:be,textBoxScale:v,prevAnchor:Be},this.markUsedJustification(ae,be,Y,se),ae.allowVerticalPlacement&&(this.markUsedOrientation(ae,se,Y),this.placedOrientations[Y.crossTileID]=se),{shift:he,placedGlyphBoxes:Le}}}placeLayerBucketPart(s,f,d){const{bucket:g,layout:v,posMatrix:C,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:R,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:Y,collisionGroup:ae}=s.parameters,se=v.get("text-optional"),ce=v.get("icon-optional"),ee=l.aq(v,"text-overlap","text-allow-overlap"),be=ee==="always",Fe=l.aq(v,"icon-overlap","icon-allow-overlap"),he=Fe==="always",Le=v.get("text-rotation-alignment")==="map",Be=v.get("text-pitch-alignment")==="map",Ge=v.get("icon-text-fit")!=="none",He=v.get("symbol-z-order")==="viewport-y",et=be&&(he||!g.hasIconData()||ce),$e=he&&(be||!g.hasTextData()||se);!g.collisionArrays&&F&&g.deserializeCollisionBoxes(F);const ct=this.retainedQueryData[g.bucketInstanceId].tileID,pt=this.terrain?(dt,Bt)=>this.terrain.getElevation(ct,dt,Bt):null,nn=(dt,Bt)=>{var rn,En;if(f[dt.crossTileID])return;if(z)return void(this.placements[dt.crossTileID]=new lr(!1,!1,!1));let Wt=!1,an=!1,fn=!0,Tr=null,qn={box:null,offscreen:null},Ro={box:null,offscreen:null},ui=null,gr=null,ci=null,No=0,Gs=0,Xa=0;Bt.textFeatureIndex?No=Bt.textFeatureIndex:dt.useRuntimeCollisionCircles&&(No=dt.featureIndex),Bt.verticalTextFeatureIndex&&(Gs=Bt.verticalTextFeatureIndex);const yc=Bt.textBox;if(yc){const ii=oi=>{let _r=l.ah.horizontal;if(g.allowVerticalPlacement&&!oi&&this.prevPlacement){const ts=this.prevPlacement.placedOrientations[dt.crossTileID];ts&&(this.placedOrientations[dt.crossTileID]=ts,_r=ts,this.markUsedOrientation(g,_r,dt))}return _r},yr=(oi,_r)=>{if(g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&Bt.verticalTextBox){for(const ts of g.writingModes)if(ts===l.ah.vertical?(qn=_r(),Ro=qn):qn=oi(),qn&&qn.box&&qn.box.length)break}else qn=oi()},cr=dt.textAnchorOffsetStartIndex,es=dt.textAnchorOffsetEndIndex;if(es===cr){const oi=(_r,ts)=>{const si=this.collisionIndex.placeCollisionBox(_r,ee,R,C,ae.predicate,pt);return si&&si.box&&si.box.length&&(this.markUsedOrientation(g,ts,dt),this.placedOrientations[dt.crossTileID]=ts),si};yr(()=>oi(yc,l.ah.horizontal),()=>{const _r=Bt.verticalTextBox;return g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&_r?oi(_r,l.ah.vertical):{box:null,offscreen:null}}),ii(qn&&qn.box&&qn.box.length)}else{let oi=l.ap[(En=(rn=this.prevPlacement)===null||rn===void 0?void 0:rn.variableOffsets[dt.crossTileID])===null||En===void 0?void 0:En.anchor];const _r=(si,Nr,Pp)=>{const Bm=si.x2-si.x1,kl=si.y2-si.y1,Dl=dt.textBoxScale,Oh=Ge&&Fe==="never"?Nr:null;let Ka={box:[],offscreen:!1},Mp=ee==="never"?1:2,Vm="never";oi&&Mp++;for(let Ap=0;Ap_r(yc,Bt.iconBox,l.ah.horizontal),()=>{const si=Bt.verticalTextBox;return g.allowVerticalPlacement&&!(qn&&qn.box&&qn.box.length)&&dt.numVerticalGlyphVertices>0&&si?_r(si,Bt.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),qn&&(Wt=qn.box,fn=qn.offscreen);const ts=ii(qn&&qn.box);if(!Wt&&this.prevPlacement){const si=this.prevPlacement.variableOffsets[dt.crossTileID];si&&(this.variableOffsets[dt.crossTileID]=si,this.markUsedJustification(g,si.anchor,dt,ts))}}}if(ui=qn,Wt=ui&&ui.box&&ui.box.length>0,fn=ui&&ui.offscreen,dt.useRuntimeCollisionCircles){const ii=g.text.placedSymbolArray.get(dt.centerJustifiedTextSymbolIndex),yr=l.ai(g.textSizeData,Y,ii),cr=v.get("text-padding");gr=this.collisionIndex.placeCollisionCircles(ee,ii,g.lineVertexArray,g.glyphOffsetArray,yr,C,T,M,d,Be,ae.predicate,dt.collisionCircleDiameter,cr,pt),gr.circles.length&&gr.collisionDetected&&!d&&l.w("Collisions detected, but collision boxes are not shown"),Wt=be||gr.circles.length>0&&!gr.collisionDetected,fn=fn&&gr.offscreen}if(Bt.iconFeatureIndex&&(Xa=Bt.iconFeatureIndex),Bt.iconBox){const ii=yr=>{const cr=Ge&&Tr?$i(yr,Tr.x,Tr.y,Le,Be,this.transform.angle):yr;return this.collisionIndex.placeCollisionBox(cr,Fe,R,C,ae.predicate,pt)};Ro&&Ro.box&&Ro.box.length&&Bt.verticalIconBox?(ci=ii(Bt.verticalIconBox),an=ci.box.length>0):(ci=ii(Bt.iconBox),an=ci.box.length>0),fn=fn&&ci.offscreen}const Ya=se||dt.numHorizontalGlyphVertices===0&&dt.numVerticalGlyphVertices===0,js=ce||dt.numIconVertices===0;if(Ya||js?js?Ya||(an=an&&Wt):Wt=an&&Wt:an=Wt=an&&Wt,Wt&&ui&&ui.box&&this.collisionIndex.insertCollisionBox(ui.box,ee,v.get("text-ignore-placement"),g.bucketInstanceId,Ro&&Ro.box&&Gs?Gs:No,ae.ID),an&&ci&&this.collisionIndex.insertCollisionBox(ci.box,Fe,v.get("icon-ignore-placement"),g.bucketInstanceId,Xa,ae.ID),gr&&(Wt&&this.collisionIndex.insertCollisionCircles(gr.circles,ee,v.get("text-ignore-placement"),g.bucketInstanceId,No,ae.ID),d)){const ii=g.bucketInstanceId;let yr=this.collisionCircleArrays[ii];yr===void 0&&(yr=this.collisionCircleArrays[ii]=new ni);for(let cr=0;cr=0;--Bt){const rn=dt[Bt];nn(g.symbolInstances.get(rn),g.collisionArrays[rn])}}else for(let dt=s.symbolInstanceStart;dt=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==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 T of C)s.text.placedSymbolArray.get(T).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:{},T=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 T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const 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),T=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",Y=v.get("icon-text-fit")!=="none",ae=new Xn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const se=(ce,ee,be)=>{for(let Fe=0;Fe0,Ge=this.placedOrientations[ee.crossTileID],He=Ge===l.ah.vertical,et=Ge===l.ah.horizontal||Ge===l.ah.horizontalOnly;if(be>0||Fe>0){const $e=po(Le.text);se(s.text,be,He?Yu:$e),se(s.text,Fe,et?Yu:$e);const ct=Le.text.isHidden();[ee.rightJustifiedTextSymbolIndex,ee.centerJustifiedTextSymbolIndex,ee.leftJustifiedTextSymbolIndex].forEach(dt=>{dt>=0&&(s.text.placedSymbolArray.get(dt).hidden=ct||He?1:0)}),ee.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(ee.verticalPlacedTextSymbolIndex).hidden=ct||et?1:0);const pt=this.variableOffsets[ee.crossTileID];pt&&this.markUsedJustification(s,pt.anchor,ee,Ge);const nn=this.placedOrientations[ee.crossTileID];nn&&(this.markUsedJustification(s,"left",ee,nn),this.markUsedOrientation(s,nn,ee))}if(Be){const $e=po(Le.icon),ct=!(Y&&ee.verticalPlacedIconSymbolIndex&&He);ee.placedIconSymbolIndex>=0&&(se(s.icon,ee.numIconVertices,ct?$e:Yu),s.icon.placedSymbolArray.get(ee.placedIconSymbolIndex).hidden=Le.icon.isHidden()),ee.verticalPlacedIconSymbolIndex>=0&&(se(s.icon,ee.numVerticalIconVertices,ct?Yu:$e),s.icon.placedSymbolArray.get(ee.verticalPlacedIconSymbolIndex).hidden=Le.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $e=s.collisionArrays[ce];if($e){let ct=new l.P(0,0);if($e.textBox||$e.verticalTextBox){let nn=!0;if(R){const dt=this.variableOffsets[he];dt?(ct=li(dt.anchor,dt.width,dt.height,dt.textOffset,dt.textBoxScale),z&&ct._rotate(F?this.transform.angle:-this.transform.angle)):nn=!1}$e.textBox&&xi(s.textCollisionBox.collisionVertexArray,Le.text.placed,!nn||He,ct.x,ct.y),$e.verticalTextBox&&xi(s.textCollisionBox.collisionVertexArray,Le.text.placed,!nn||et,ct.x,ct.y)}const pt=!!(!et&&$e.verticalIconBox);$e.iconBox&&xi(s.iconCollisionBox.collisionVertexArray,Le.icon.placed,pt,Y?ct.x:0,Y?ct.y:0),$e.verticalIconBox&&xi(s.iconCollisionBox.collisionVertexArray,Le.icon.placed,!pt,Y?ct.x:0,Y?ct.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 ce=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ce.invProjMatrix,s.placementViewportMatrix=ce.viewportMatrix,s.collisionCircleArray=ce.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(_,s,f,d,g){_.emplaceBack(s?1:0,f?1:0,d||0,g||0),_.emplaceBack(s?1:0,f?1:0,d||0,g||0),_.emplaceBack(s?1:0,f?1:0,d||0,g||0),_.emplaceBack(s?1:0,f?1:0,d||0,g||0)}const zs=Math.pow(2,25),nm=Math.pow(2,24),Wy=Math.pow(2,17),Gn=Math.pow(2,16),Jf=Math.pow(2,9),Qf=Math.pow(2,8),Ao=Math.pow(2,1);function po(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*zs+s*nm+f*Wy+s*Gn+f*Jf+s*Qf+f*Ao+s}const Yu=0;class Qo{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,d,g,v){const C=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&E.now()-g>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=T)&&(!C.maxzoom||C.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Qo(C)),this._inProgressLayer.continuePlacement(d[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const iu=512/l.W/2;class Jc{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*iu),y:Math.floor(M.anchorY*iu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new l.au(T.positions.length,16,Uint16Array);for(const{x:R,y:z}of T.positions)M.add(R,z);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:g,z:v}=this.tileID.canonical,{x:C,y:T,z:M}=f.canonical,R=iu/Math.pow(2,M-v),z=(T*l.W+s.anchorY)*R,F=g*l.W*iu;return{x:Math.floor((C*l.W+s.anchorX)*R-d*l.W*iu),y:Math.floor(z-F)}}findMatches(s,f,d){const g=this.tileID.canonical.zs)}}class ri{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ku{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 T=g[C];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in C){const M=C[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,g)}else{const T=C[s.scaledTo(Number(v)).key];T&&T.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 mr=(_,s)=>l.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Qc=l.av();class ko 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 wr(Rn(),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 Ke,this.imageManager.setEventedParent(this),this.glyphManager=new je(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new qt(256,512),this.crossTileSymbolIndex=new Ga,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(Pi,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 T=this._layers[C];T.source===v.id&&this._validateLayer(T)}})}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(Qc,{validate:!1})}_load(s,f,d){var g;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!mr(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 un(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,T,M){return l._(this,void 0,void 0,function*(){const R=Te(v),z=T>1?"@2x":"",F={},Y={};for(const{id:ae,url:se}of R){const ce=C.transformRequest(C.normalizeSpriteURL(se,z,".json"),"SpriteJSON");F[ae]=l.h(ce,M);const ee=C.transformRequest(C.normalizeSpriteURL(se,z,".png"),"SpriteImage");Y[ae]=W.getImage(ee,M)}return yield Promise.all([...Object.values(F),...Object.values(Y)]),function(ae,se){return l._(this,void 0,void 0,function*(){const ce={};for(const ee in ae){ce[ee]={};const be=E.getImageCanvasContext((yield se[ee]).data),Fe=(yield ae[ee]).data;for(const he in Fe){const{width:Le,height:Be,x:Ge,y:He,sdf:et,pixelRatio:$e,stretchX:ct,stretchY:pt,content:nn}=Fe[he];ce[ee][he]={data:null,pixelRatio:$e,sdf:et,stretchX:ct,stretchY:pt,content:nn,spriteData:{width:Le,height:Be,x:Ge,y:He,context:be}}}}return ce})}(F,Y)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const T=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const 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 T=this._updatedSources[C];if(T==="reload")this._reloadSource(C);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const 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)&&mr(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 T of C.operations)T();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 ti(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(mr(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 T=this._removedLayers[g];delete this._removedLayers[g],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new 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 T=this._order[C];if(f(T)){d[T]=C;for(const M of s){const R=M[T];if(R)for(const z of R)g.push(z)}}}g.sort((C,T)=>T.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const T=this._order[C];if(f(T))for(let M=g.length-1;M>=0;M--){const R=g[M].feature;if(d[R.layer.id]{const et=be.featureSortOrder;if(et){const $e=et.indexOf(Ge.featureIndex);return et.indexOf(He.featureIndex)-$e}return He.featureIndex-Ge.featureIndex});for(const Ge of Be)Le.push(Ge)}}for(const be in se)se[be].forEach(Fe=>{const he=Fe.feature,Le=R[T[be].source].getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=Le});return se}(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)),T=[],M={};for(let R=0;RY.getTileByID(ae)).sort((ae,se)=>se.tileID.overscaledZ-ae.tileID.overscaledZ||(ae.tileID.isLessThan(se.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 $o(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()),T=!0),C&&this.pauseablePlacement.placement.setStale()),T||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=[...Te(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=Te(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 Te(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 $c=l.X([{name:"a_pos",type:"Int16",components:2}]),Fs="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Ju={prelude:jn(`#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:jn(`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:jn(`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:jn(`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:jn("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:jn(`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:jn(`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:jn("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:jn("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:jn("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:jn(`#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:jn(`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:jn(`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:jn(`#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:jn(`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:jn(`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:jn(`#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:jn(`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:jn(`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:jn(`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:jn(`#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:jn(`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:jn(`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:jn(`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:jn(`#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:jn(`#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:jn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Fs),terrainDepth:jn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Fs),terrainCoords:jn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Fs)};function jn(_,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(g):g,T={};return{fragmentSource:_=_.replace(f,(M,R,z,F,Y)=>(T[Y]=!0,R==="define"?` +#ifndef HAS_UNIFORM_u_${Y} +varying ${z} ${F} ${Y}; +#else +uniform ${z} ${F} u_${Y}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${Y} + ${z} ${F} ${Y} = u_${Y}; +#endif +`)),vertexSource:s=s.replace(f,(M,R,z,F,Y)=>{const ae=F==="float"?"vec2":"vec4",se=Y.match(/color/)?"color":ae;return T[Y]?R==="define"?` +#ifndef HAS_UNIFORM_u_${Y} +uniform lowp float u_${Y}_t; +attribute ${z} ${ae} a_${Y}; +varying ${z} ${F} ${Y}; +#else +uniform ${z} ${F} u_${Y}; +#endif +`:se==="vec4"?` +#ifndef HAS_UNIFORM_u_${Y} + ${Y} = a_${Y}; +#else + ${z} ${F} ${Y} = u_${Y}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Y} + ${Y} = unpack_mix_${se}(a_${Y}, u_${Y}_t); +#else + ${z} ${F} ${Y} = u_${Y}; +#endif +`:R==="define"?` +#ifndef HAS_UNIFORM_u_${Y} +uniform lowp float u_${Y}_t; +attribute ${z} ${ae} a_${Y}; +#else +uniform ${z} ${F} u_${Y}; +#endif +`:se==="vec4"?` +#ifndef HAS_UNIFORM_u_${Y} + ${z} ${F} ${Y} = a_${Y}; +#else + ${z} ${F} ${Y} = u_${Y}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Y} + ${z} ${F} ${Y} = unpack_mix_${se}(a_${Y}, u_${Y}_t); +#else + ${z} ${F} ${Y} = u_${Y}; +#endif +`}),staticAttributes:d,staticUniforms:C}}class eh{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,T,M,R){this.context=s;let z=this.boundPaintVertexBuffers.length!==g.length;for(let F=0;!z&&F({u_depth:new l.aG(Ge,He.u_depth),u_terrain:new l.aG(Ge,He.u_terrain),u_terrain_dim:new l.aH(Ge,He.u_terrain_dim),u_terrain_matrix:new l.aI(Ge,He.u_terrain_matrix),u_terrain_unpack:new l.aJ(Ge,He.u_terrain_unpack),u_terrain_exaggeration:new l.aH(Ge,He.u_terrain_exaggeration)}))(s,Be),this.binderUniforms=d?d.getUniforms(s,Be):[]}draw(s,f,d,g,v,C,T,M,R,z,F,Y,ae,se,ce,ee,be,Fe){const he=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(he.TEXTURE2),he.bindTexture(he.TEXTURE_2D,M.depthTexture),s.activeTexture.set(he.TEXTURE3),he.bindTexture(he.TEXTURE_2D,M.texture);for(const Be in this.terrainUniforms)this.terrainUniforms[Be].set(M[Be])}for(const Be in this.fixedUniforms)this.fixedUniforms[Be].set(T[Be]);ce&&ce.setUniforms(s,this.binderUniforms,ae,{zoom:se});let Le=0;switch(f){case he.LINES:Le=2;break;case he.TRIANGLES:Le=3;break;case he.LINE_STRIP:Le=1}for(const Be of Y.get()){const Ge=Be.vaos||(Be.vaos={});(Ge[R]||(Ge[R]=new eh)).bind(s,this,z,ce?ce.getPaintVertexBuffers():[],F,Be.vertexOffset,ee,be,Fe),he.drawElements(f,Be.primitiveLength*Le,he.UNSIGNED_SHORT,Be.primitiveOffset*Le*2)}}}function th(_,s,f){const d=1/Zt(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),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[C>>16,T>>16],u_pixel_coord_lower:[65535&C,65535&T]}}const Qu=(_,s,f,d)=>{const g=s.style.light,v=g.properties.get("position"),C=[v.x,v.y,v.z],T=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),Y=Math.cos(z);R[0]=Y,R[1]=F,R[2]=0,R[3]=-F,R[4]=Y,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(T,-s.transform.angle),function(R,z,F){var Y=z[0],ae=z[1],se=z[2];R[0]=Y*F[0]+ae*F[3]+se*F[6],R[1]=Y*F[1]+ae*F[4]+se*F[7],R[2]=Y*F[2]+ae*F[5]+se*F[8]}(C,C,T);const M=g.properties.get("color");return{u_matrix:_,u_lightpos:C,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},Hy=(_,s,f,d,g,v,C)=>l.e(Qu(_,s,f,d),th(v,s,C),{u_height_factor:-Math.pow(2,g.overscaledZ)/C.tileSize/8}),rm=_=>({u_matrix:_}),nh=(_,s,f,d)=>l.e(rm(_),th(f,s,d)),Zy=(_,s)=>({u_matrix:_,u_world:s}),im=(_,s,f,d,g)=>l.e(nh(_,s,f,d),{u_world:g}),Xy=(_,s,f,d)=>{const g=_.transform;let v,C;if(d.paint.get("circle-pitch-alignment")==="map"){const T=Zt(f,1,g.zoom);v=!0,C=[T,T]}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:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:C}},om=(_,s,f)=>{const d=Zt(f,1,s.zoom),g=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:v}},sm=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),rh=_=>({u_matrix:_}),am=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:Zt(s,1,f),u_intensity:d});function lm(_,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 ih=(_,s,f,d)=>{const g=_.transform;return{u_matrix:$u(_,s,f,d),u_ratio:1/Zt(s,1,g.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},um=(_,s,f,d,g)=>l.e(ih(_,s,f,g),{u_image:0,u_image_height:d}),El=(_,s,f,d,g)=>{const v=_.transform,C=Do(s,v);return{u_matrix:$u(_,s,f,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Zt(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[C,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},oh=(_,s,f,d,g,v)=>{const C=_.lineAtlas,T=Do(s,_.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,Y=z.width*g.toScale;return l.e(ih(_,s,f,v),{u_patternscale_a:[T/F,-R.height/2],u_patternscale_b:[T/Y,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,Y)*_.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:z.y,u_mix:g.t})};function Do(_,s){return 1/Zt(_,1,s.tileZoom)}function $u(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const sh=(_,s,f,d,g)=>{return{u_matrix:_,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:ec(g.paint.get("raster-hue-rotate"))};var v,C};function ec(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const tc=(_,s,f,d,g,v,C,T,M,R)=>{const z=g.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:R,u_texture:0}},nc=(_,s,f,d,g,v,C,T,M,R,z)=>{const F=g.transform;return l.e(tc(_,s,f,d,g,v,C,T,M,R),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+z})},rc=(_,s,f,d,g,v,C,T,M,R)=>l.e(nc(_,s,f,d,g,v,C,T,!0,M,!0),{u_texsize_icon:R,u_texture_icon:1}),Yy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),Ky=(_,s,f,d,g,v)=>l.e(function(C,T,M,R){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:Y,height:ae}=M.imageManager.getPixelSize(),se=Math.pow(2,R.tileID.overscaledZ),ce=R.tileSize*Math.pow(2,M.transform.tileZoom)/se,ee=ce*(R.tileID.canonical.x+R.tileID.wrap*se),be=ce*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:[Y,ae],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/Zt(R,1,M.transform.tileZoom),u_pixel_coord_upper:[ee>>16,be>>16],u_pixel_coord_lower:[65535&ee,65535&be]}}(d,v,f,g),{u_matrix:_,u_opacity:s}),cm={fillExtrusion:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_lightpos:new l.aK(_,s.u_lightpos),u_lightintensity:new l.aH(_,s.u_lightintensity),u_lightcolor:new l.aK(_,s.u_lightcolor),u_vertical_gradient:new l.aH(_,s.u_vertical_gradient),u_opacity:new l.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_lightpos:new l.aK(_,s.u_lightpos),u_lightintensity:new l.aH(_,s.u_lightintensity),u_lightcolor:new l.aK(_,s.u_lightcolor),u_vertical_gradient:new l.aH(_,s.u_vertical_gradient),u_height_factor:new l.aH(_,s.u_height_factor),u_image:new l.aG(_,s.u_image),u_texsize:new l.aL(_,s.u_texsize),u_pixel_coord_upper:new l.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(_,s.u_pixel_coord_lower),u_scale:new l.aK(_,s.u_scale),u_fade:new l.aH(_,s.u_fade),u_opacity:new l.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_image:new l.aG(_,s.u_image),u_texsize:new l.aL(_,s.u_texsize),u_pixel_coord_upper:new l.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(_,s.u_pixel_coord_lower),u_scale:new l.aK(_,s.u_scale),u_fade:new l.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_world:new l.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_world:new l.aL(_,s.u_world),u_image:new l.aG(_,s.u_image),u_texsize:new l.aL(_,s.u_texsize),u_pixel_coord_upper:new l.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(_,s.u_pixel_coord_lower),u_scale:new l.aK(_,s.u_scale),u_fade:new l.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new l.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new l.aG(_,s.u_scale_with_map),u_pitch_with_map:new l.aG(_,s.u_pitch_with_map),u_extrude_scale:new l.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_matrix:new l.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_camera_to_center_distance:new l.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new l.aL(_,s.u_extrude_scale),u_overscale_factor:new l.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_inv_matrix:new l.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new l.aH(_,s.u_camera_to_center_distance),u_viewport_size:new l.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new l.aM(_,s.u_color),u_matrix:new l.aI(_,s.u_matrix),u_overlay:new l.aG(_,s.u_overlay),u_overlay_scale:new l.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new l.aH(_,s.u_extrude_scale),u_intensity:new l.aH(_,s.u_intensity),u_matrix:new l.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_world:new l.aL(_,s.u_world),u_image:new l.aG(_,s.u_image),u_color_ramp:new l.aG(_,s.u_color_ramp),u_opacity:new l.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_image:new l.aG(_,s.u_image),u_latrange:new l.aL(_,s.u_latrange),u_light:new l.aL(_,s.u_light),u_shadow:new l.aM(_,s.u_shadow),u_highlight:new l.aM(_,s.u_highlight),u_accent:new l.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_image:new l.aG(_,s.u_image),u_dimension:new l.aL(_,s.u_dimension),u_zoom:new l.aH(_,s.u_zoom),u_unpack:new l.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_ratio:new l.aH(_,s.u_ratio),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_ratio:new l.aH(_,s.u_ratio),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(_,s.u_units_to_pixels),u_image:new l.aG(_,s.u_image),u_image_height:new l.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_texsize:new l.aL(_,s.u_texsize),u_ratio:new l.aH(_,s.u_ratio),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_image:new l.aG(_,s.u_image),u_units_to_pixels:new l.aL(_,s.u_units_to_pixels),u_scale:new l.aK(_,s.u_scale),u_fade:new l.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_ratio:new l.aH(_,s.u_ratio),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(_,s.u_units_to_pixels),u_patternscale_a:new l.aL(_,s.u_patternscale_a),u_patternscale_b:new l.aL(_,s.u_patternscale_b),u_sdfgamma:new l.aH(_,s.u_sdfgamma),u_image:new l.aG(_,s.u_image),u_tex_y_a:new l.aH(_,s.u_tex_y_a),u_tex_y_b:new l.aH(_,s.u_tex_y_b),u_mix:new l.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_tl_parent:new l.aL(_,s.u_tl_parent),u_scale_parent:new l.aH(_,s.u_scale_parent),u_buffer_scale:new l.aH(_,s.u_buffer_scale),u_fade_t:new l.aH(_,s.u_fade_t),u_opacity:new l.aH(_,s.u_opacity),u_image0:new l.aG(_,s.u_image0),u_image1:new l.aG(_,s.u_image1),u_brightness_low:new l.aH(_,s.u_brightness_low),u_brightness_high:new l.aH(_,s.u_brightness_high),u_saturation_factor:new l.aH(_,s.u_saturation_factor),u_contrast_factor:new l.aH(_,s.u_contrast_factor),u_spin_weights:new l.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new l.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(_,s.u_is_size_feature_constant),u_size_t:new l.aH(_,s.u_size_t),u_size:new l.aH(_,s.u_size),u_camera_to_center_distance:new l.aH(_,s.u_camera_to_center_distance),u_pitch:new l.aH(_,s.u_pitch),u_rotate_symbol:new l.aG(_,s.u_rotate_symbol),u_aspect_ratio:new l.aH(_,s.u_aspect_ratio),u_fade_change:new l.aH(_,s.u_fade_change),u_matrix:new l.aI(_,s.u_matrix),u_label_plane_matrix:new l.aI(_,s.u_label_plane_matrix),u_coord_matrix:new l.aI(_,s.u_coord_matrix),u_is_text:new l.aG(_,s.u_is_text),u_pitch_with_map:new l.aG(_,s.u_pitch_with_map),u_texsize:new l.aL(_,s.u_texsize),u_texture:new l.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new l.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(_,s.u_is_size_feature_constant),u_size_t:new l.aH(_,s.u_size_t),u_size:new l.aH(_,s.u_size),u_camera_to_center_distance:new l.aH(_,s.u_camera_to_center_distance),u_pitch:new l.aH(_,s.u_pitch),u_rotate_symbol:new l.aG(_,s.u_rotate_symbol),u_aspect_ratio:new l.aH(_,s.u_aspect_ratio),u_fade_change:new l.aH(_,s.u_fade_change),u_matrix:new l.aI(_,s.u_matrix),u_label_plane_matrix:new l.aI(_,s.u_label_plane_matrix),u_coord_matrix:new l.aI(_,s.u_coord_matrix),u_is_text:new l.aG(_,s.u_is_text),u_pitch_with_map:new l.aG(_,s.u_pitch_with_map),u_texsize:new l.aL(_,s.u_texsize),u_texture:new l.aG(_,s.u_texture),u_gamma_scale:new l.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_is_halo:new l.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new l.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(_,s.u_is_size_feature_constant),u_size_t:new l.aH(_,s.u_size_t),u_size:new l.aH(_,s.u_size),u_camera_to_center_distance:new l.aH(_,s.u_camera_to_center_distance),u_pitch:new l.aH(_,s.u_pitch),u_rotate_symbol:new l.aG(_,s.u_rotate_symbol),u_aspect_ratio:new l.aH(_,s.u_aspect_ratio),u_fade_change:new l.aH(_,s.u_fade_change),u_matrix:new l.aI(_,s.u_matrix),u_label_plane_matrix:new l.aI(_,s.u_label_plane_matrix),u_coord_matrix:new l.aI(_,s.u_coord_matrix),u_is_text:new l.aG(_,s.u_is_text),u_pitch_with_map:new l.aG(_,s.u_pitch_with_map),u_texsize:new l.aL(_,s.u_texsize),u_texsize_icon:new l.aL(_,s.u_texsize_icon),u_texture:new l.aG(_,s.u_texture),u_texture_icon:new l.aG(_,s.u_texture_icon),u_gamma_scale:new l.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(_,s.u_device_pixel_ratio),u_is_halo:new l.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_opacity:new l.aH(_,s.u_opacity),u_color:new l.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_opacity:new l.aH(_,s.u_opacity),u_image:new l.aG(_,s.u_image),u_pattern_tl_a:new l.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new l.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new l.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new l.aL(_,s.u_pattern_br_b),u_texsize:new l.aL(_,s.u_texsize),u_mix:new l.aH(_,s.u_mix),u_pattern_size_a:new l.aL(_,s.u_pattern_size_a),u_pattern_size_b:new l.aL(_,s.u_pattern_size_b),u_scale_a:new l.aH(_,s.u_scale_a),u_scale_b:new l.aH(_,s.u_scale_b),u_pixel_coord_upper:new l.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_texture:new l.aG(_,s.u_texture),u_ele_delta:new l.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_ele_delta:new l.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new l.aI(_,s.u_matrix),u_texture:new l.aG(_,s.u_texture),u_terrain_coords_id:new l.aH(_,s.u_terrain_coords_id),u_ele_delta:new l.aH(_,s.u_ele_delta)})};class Jy{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 Il={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ah{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 ct=l.F(),pt=He;l.aP(ct,Ge.placementInvProjMatrix,_.transform.glCoordMatrix),l.aP(ct,ct,Ge.placementViewportMatrix),z.push({circleArray:$e,circleOffset:Y,transform:pt,invTransform:ct,coord:Le}),F+=$e.length/4,Y=F}et&&R.draw(T,M.LINES,Sn.disabled,rr.disabled,_.colorModeForRenderPass(),$n.disabled,om(He,_.transform,Be),_.style.map.terrain&&_.style.map.terrain.getTerrainData(Le),f.id,et.layoutVertexBuffer,et.indexBuffer,et.segments,null,_.transform.zoom,null,null,et.collisionVertexBuffer)}if(!C||!z.length)return;const ae=_.useProgram("collisionCircle"),se=new l.aQ;se.resize(4*F),se._trim();let ce=0;for(const he of z)for(let Le=0;Le=0&&(se[ee.associatedIconIndex]={shiftedAnchor:nn,angle:dt})}else Xe(ee.numGlyphs,Y)}if(R){ae.clear();const ce=_.icon.placedSymbolArray;for(let ee=0;ee_.style.map.terrain.getElevation(et,ts,si):null,_r=f.layout.get("text-rotation-alignment")==="map";q(ct,et.posMatrix,_,g,No,Gs,ee,R,_r,oi)}const Ya=_.translatePosMatrix(et.posMatrix,$e,v,C),js=be||g&&Ge||yc?up:No,ii=_.translatePosMatrix(Gs,$e,v,C,!0),yr=dt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let cr;cr=dt?ct.iconsInText?rc(Bt.kind,Wt,Fe,ee,_,Ya,js,ii,fn,ui):nc(Bt.kind,Wt,Fe,ee,_,Ya,js,ii,g,fn,!0):tc(Bt.kind,Wt,Fe,ee,_,Ya,js,ii,g,fn);const es={program:En,buffers:pt,uniformValues:cr,atlasTexture:Tr,atlasTextureIcon:gr,atlasInterpolation:qn,atlasInterpolationIcon:Ro,isSDF:dt,hasHalo:yr};if(he&&ct.canOverlap){Le=!0;const oi=pt.segments.get();for(const _r of oi)He.push({segments:new l.$([_r]),sortKey:_r.sortKey,state:es,terrainData:an})}else He.push({segments:pt.segments,sortKey:0,state:es,terrainData:an})}Le&&He.sort((et,$e)=>et.sortKey-$e.sortKey);for(const et of He){const $e=et.state;if(Y.activeTexture.set(ae.TEXTURE0),$e.atlasTexture.bind($e.atlasInterpolation,ae.CLAMP_TO_EDGE),$e.atlasTextureIcon&&(Y.activeTexture.set(ae.TEXTURE1),$e.atlasTextureIcon&&$e.atlasTextureIcon.bind($e.atlasInterpolationIcon,ae.CLAMP_TO_EDGE)),$e.isSDF){const ct=$e.uniformValues;$e.hasHalo&&(ct.u_is_halo=1,vm($e.buffers,et.segments,f,_,$e.program,Be,z,F,ct,et.terrainData)),ct.u_is_halo=0}vm($e.buffers,et.segments,f,_,$e.program,Be,z,F,$e.uniformValues,et.terrainData)}}function vm(_,s,f,d,g,v,C,T,M,R){const z=d.context;g.draw(z,z.gl.TRIANGLES,v,C,T,$n.disabled,M,R,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function _h(_,s,f,d,g){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let C=v[f.to.toString()],T=v[f.from.toString()];if(!C&&T&&(C=T),!T&&C&&(T=C),!C||!T){const M=g.getPaintProperty(s);C=v[M],T=v[M]}C&&T&&_.setConstantPatternPositions(C,T)}function bm(_,s,f,d,g,v,C){const T=_.context.gl,M="fill-pattern",R=f.paint.get(M),z=R&&R.constantOr(1),F=f.getCrossfadeParameters();let Y,ae,se,ce,ee;C?(ae=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Y=T.LINES):(ae=z?"fillPattern":"fill",Y=T.TRIANGLES);const be=R.constantOr(null);for(const Fe of d){const he=s.getTile(Fe);if(z&&!he.patternsLoaded())continue;const Le=he.getBucket(f);if(!Le)continue;const Be=Le.programConfigurations.get(f.id),Ge=_.useProgram(ae,Be),He=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Fe);z&&(_.context.activeTexture.set(T.TEXTURE0),he.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Be.updatePaintBuffers(F)),_h(Be,M,be,he,f);const et=He?Fe:null,$e=_.translatePosMatrix(et?et.posMatrix:Fe.posMatrix,he,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){ce=Le.indexBuffer2,ee=Le.segments2;const ct=[T.drawingBufferWidth,T.drawingBufferHeight];se=ae==="fillOutlinePattern"&&z?im($e,_,F,he,ct):Zy($e,ct)}else ce=Le.indexBuffer,ee=Le.segments,se=z?nh($e,_,F,he):rm($e);Ge.draw(_.context,Y,g,_.stencilModeForClipping(Fe),v,$n.disabled,se,He,f.id,Le.layoutVertexBuffer,ce,ee,f.paint,_.transform.zoom,Be)}}function vh(_,s,f,d,g,v,C){const T=_.context,M=T.gl,R="fill-extrusion-pattern",z=f.paint.get(R),F=z.constantOr(1),Y=f.getCrossfadeParameters(),ae=f.paint.get("fill-extrusion-opacity"),se=z.constantOr(null);for(const ce of d){const ee=s.getTile(ce),be=ee.getBucket(f);if(!be)continue;const Fe=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ce),he=be.programConfigurations.get(f.id),Le=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",he);F&&(_.context.activeTexture.set(M.TEXTURE0),ee.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),he.updatePaintBuffers(Y)),_h(he,R,se,ee,f);const Be=_.translatePosMatrix(ce.posMatrix,ee,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ge=f.paint.get("fill-extrusion-vertical-gradient"),He=F?Hy(Be,_,Ge,ae,ce,Y,ee):Qu(Be,_,Ge,ae);Le.draw(T,T.gl.TRIANGLES,g,v,C,$n.backCCW,He,Fe,f.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,f.paint,_.transform.zoom,he,_.style.map.terrain&&be.centroidVertexBuffer)}}function bh(_,s,f,d,g,v,C){const T=_.context,M=T.gl,R=f.fbo;if(!R)return;const z=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,R.colorAttachment.get()),z.draw(T,M.TRIANGLES,g,v,C,$n.disabled,((Y,ae,se,ce)=>{const ee=se.paint.get("hillshade-shadow-color"),be=se.paint.get("hillshade-highlight-color"),Fe=se.paint.get("hillshade-accent-color");let he=se.paint.get("hillshade-illumination-direction")*(Math.PI/180);se.paint.get("hillshade-illumination-anchor")==="viewport"&&(he-=Y.transform.angle);const Le=!Y.options.moving;return{u_matrix:ce?ce.posMatrix:Y.transform.calculatePosMatrix(ae.tileID.toUnwrapped(),Le),u_image:0,u_latrange:lm(0,ae.tileID),u_light:[se.paint.get("hillshade-exaggeration"),he],u_shadow:ee,u_highlight:be,u_accent:Fe}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function cp(_,s,f,d,g,v){const C=_.context,T=C.gl,M=s.dem;if(M&&M.data){const R=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(T.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(z),s.demTexture){const ae=s.demTexture;ae.update(F,{premultiply:!1}),ae.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new Z(C,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);C.activeTexture.set(T.TEXTURE0);let Y=s.fbo;if(!Y){const ae=new Z(C,{width:R,height:R,data:null},T.RGBA);ae.bind(T.LINEAR,T.CLAMP_TO_EDGE),Y=s.fbo=C.createFramebuffer(R,R,!0,!1),Y.colorAttachment.set(ae.texture)}C.bindFramebuffer.set(Y.framebuffer),C.viewport.set([0,0,R,R]),_.useProgram("hillshadePrepare").draw(C,T.TRIANGLES,d,g,v,$n.disabled,((ae,se)=>{const ce=se.stride,ee=l.F();return l.aN(ee,0,l.W,-l.W,0,0,1),l.H(ee,ee,[0,-l.W,0]),{u_matrix:ee,u_image:1,u_dimension:[ce,ce],u_zoom:ae.overscaledZ,u_unpack:se.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function xm(_,s,f,d,g,v){const C=d.paint.get("raster-fade-duration");if(!v&&C>0){const T=E.now(),M=(T-_.timeAdded)/C,R=s?(T-s.timeAdded)/C:-1,z=f.getSource(),F=g.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),Y=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),ae=Y&&_.refreshedUponExpiration?1:l.ac(Y?M:1-R,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-ae}:{opacity:ae,mix:0}}return{opacity:1,mix:0}}const wm=new l.aO(1,0,0,1),xh=new l.aO(0,1,0,1),hp=new l.aO(0,0,1,1),s_=new l.aO(1,0,1,1),Sm=new l.aO(0,1,1,1);function Ir(_,s,f,d){to(_,0,s+f/2,_.transform.width,f,d)}function qa(_,s,f,d){to(_,s-f/2,0,f,_.transform.height,d)}function to(_,s,f,d,g,v){const C=_.context,T=C.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,g*_.pixelRatio),C.clear({color:v}),T.disable(T.SCISSOR_TEST)}function fp(_,s,f){const d=_.context,g=d.gl,v=f.posMatrix,C=_.useProgram("debug"),T=Sn.disabled,M=rr.disabled,R=_.colorModeForRenderPass(),z="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(g.TEXTURE0);const Y=s.getTileByID(f.key).latestRawTileData,ae=Math.floor((Y&&Y.byteLength||0)/1024),se=s.getTile(f).tileSize,ce=512/Math.min(se,512)*(f.overscaledZ/_.transform.zoom)*.5;let ee=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(ee+=` => ${f.overscaledZ}`),function(be,Fe){be.initDebugOverlayCanvas();const he=be.debugOverlayCanvas,Le=be.context.gl,Be=be.debugOverlayCanvas.getContext("2d");Be.clearRect(0,0,he.width,he.height),Be.shadowColor="white",Be.shadowBlur=2,Be.lineWidth=1.5,Be.strokeStyle="white",Be.textBaseline="top",Be.font="bold 36px Open Sans, sans-serif",Be.fillText(Fe,5,5),Be.strokeText(Fe,5,5),be.debugOverlayTexture.update(he),be.debugOverlayTexture.bind(Le.LINEAR,Le.CLAMP_TO_EDGE)}(_,`${ee} ${ae}kB`),C.draw(d,g.TRIANGLES,T,M,jr.alphaBlended,$n.disabled,sm(v,l.aO.transparent,ce),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),C.draw(d,g.LINE_STRIP,T,M,R,$n.disabled,sm(v,l.aO.red),F,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function wh(_,s,f){const d=_.context,g=d.gl,v=_.colorModeForRenderPass(),C=new Sn(g.LEQUAL,Sn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const R of f){const z=_.renderToTexture.getTexture(R),F=s.getTerrainData(R.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,z.texture);const Y={u_matrix:_.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,g.TRIANGLES,C,rr.disabled,v,$n.backCCW,Y,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Em{constructor(s,f){this.context=new o_(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ti.maxUnderzooming+ti.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ga}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,$c.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,$c.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,ln.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,$c.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 T=new l.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new rr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=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,Sn.disabled,this.stencilClearMode,jr.disabled,$n.disabled,rh(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(jr.disabled),d.setDepthMode(Sn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const T=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(d,g.TRIANGLES,Sn.disabled,new rr({func:g.ALWAYS,mask:0},T,255,g.KEEP,g.KEEP,g.REPLACE),jr.disabled,$n.disabled,rh(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new rr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new rr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((C,T)=>T.overscaledZ-C.overscaledZ),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 T=0;T=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.currentLayeree.source&&!ee.isHidden(z)?[R.sourceCaches[ee.source]]:[]),ae=Y.filter(ee=>ee.getSource().type==="vector"),se=Y.filter(ee=>ee.getSource().type!=="vector"),ce=ee=>{(!F||F.getSource().maxzoomce(ee)),F||se.forEach(ee=>ce(ee)),F}(this.style,this.transform.zoom);M&&function(R,z,F){for(let Y=0;Y0),g&&(l.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const T=v.context,M=T.gl,R=jr.unblended,z=new Sn(M.LEQUAL,Sn.ReadWrite,[0,1]),F=C.getTerrainMesh(),Y=C.sourceCache.getRenderableTiles(),ae=v.useProgram("terrainDepth");T.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:l.aO.transparent,depth:1});for(const se of Y){const ce=C.getTerrainData(se.tileID),ee={u_matrix:v.transform.calculatePosMatrix(se.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ae.draw(T,M.TRIANGLES,z,rr.disabled,R,$n.backCCW,ee,ce,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const T=v.context,M=T.gl,R=jr.unblended,z=new Sn(M.LEQUAL,Sn.ReadWrite,[0,1]),F=C.getTerrainMesh(),Y=C.getCoordsTexture(),ae=C.sourceCache.getRenderableTiles(),se=v.useProgram("terrainCoords");T.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:l.aO.transparent,depth:1}),C.coordsIndex=[];for(const ce of ae){const ee=C.getTerrainData(ce.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,Y.texture);const be={u_matrix:v.transform.calculatePosMatrix(ce.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};se.draw(T,M.TRIANGLES,z,rr.disabled,R,$n.backCCW,be,ee,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(ce.tileID.key)}T.bindFramebuffer.set(null),T.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,T,M,R){if(v.renderPass!=="translucent")return;const z=rr.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Y,ae,se,ce,ee,be,Fe){const he=ae.transform,Le=ee==="map",Be=be==="map";for(const Ge of Y){const He=ce.getTile(Ge),et=He.getBucket(se);if(!et||!et.text||!et.text.segments.get().length)continue;const $e=l.ag(et.textSizeData,he.zoom),ct=Zt(He,1,ae.transform.zoom),pt=Qt(Ge.posMatrix,Be,Le,ae.transform,ct),nn=se.layout.get("icon-text-fit")!=="none"&&et.hasIconData();if($e){const dt=Math.pow(2,he.zoom-He.tileID.overscaledZ);mh(et,Le,Be,Fe,he,pt,Ge.posMatrix,dt,$e,nn,ae.style.map.terrain?(Bt,rn)=>ae.style.map.terrain.getElevation(Ge,Bt,rn):null)}}}(M,v,T,C,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),R),T.paint.get("icon-opacity").constantOr(1)!==0&&yh(v,C,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),z,F),T.paint.get("text-opacity").constantOr(1)!==0&&yh(v,C,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(dh(v,C,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),dh(v,C,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,g,this.style.placement.variableOffsets);break;case"circle":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const R=T.paint.get("circle-opacity"),z=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),Y=!T.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const ae=v.context,se=ae.gl,ce=v.depthModeForSublayer(0,Sn.ReadOnly),ee=rr.disabled,be=v.colorModeForRenderPass(),Fe=[];for(let he=0;hehe.sortKey-Le.sortKey);for(const he of Fe){const{programConfiguration:Le,program:Be,layoutVertexBuffer:Ge,indexBuffer:He,uniformValues:et,terrainData:$e}=he.state;Be.draw(ae,se.TRIANGLES,ce,ee,be,$n.disabled,et,$e,T.id,Ge,He,he.segments,T.paint,v.transform.zoom,Le)}})(s,f,d,g);break;case"heatmap":(function(v,C,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,z=R.gl,F=rr.disabled,Y=new jr([z.ONE,z.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(ae,se,ce){const ee=ae.gl;ae.activeTexture.set(ee.TEXTURE1),ae.viewport.set([0,0,se.width/4,se.height/4]);let be=ce.heatmapFbo;if(be)ee.bindTexture(ee.TEXTURE_2D,be.colorAttachment.get()),ae.bindFramebuffer.set(be.framebuffer);else{const Fe=ee.createTexture();ee.bindTexture(ee.TEXTURE_2D,Fe),ee.texParameteri(ee.TEXTURE_2D,ee.TEXTURE_WRAP_S,ee.CLAMP_TO_EDGE),ee.texParameteri(ee.TEXTURE_2D,ee.TEXTURE_WRAP_T,ee.CLAMP_TO_EDGE),ee.texParameteri(ee.TEXTURE_2D,ee.TEXTURE_MIN_FILTER,ee.LINEAR),ee.texParameteri(ee.TEXTURE_2D,ee.TEXTURE_MAG_FILTER,ee.LINEAR),be=ce.heatmapFbo=ae.createFramebuffer(se.width/4,se.height/4,!1,!1),function(he,Le,Be,Ge){var He,et;const $e=he.gl,ct=(He=he.HALF_FLOAT)!==null&&He!==void 0?He:$e.UNSIGNED_BYTE,pt=(et=he.RGBA16F)!==null&&et!==void 0?et:$e.RGBA;$e.texImage2D($e.TEXTURE_2D,0,pt,Le.width/4,Le.height/4,0,$e.RGBA,ct,null),Ge.colorAttachment.set(Be)}(ae,se,Fe,be)}})(R,v,T),R.clear({color:l.aO.transparent});for(let ae=0;ae{const he=l.F();l.aN(he,0,ce.width,ce.height,0,0,1);const Le=ce.context.gl;return{u_matrix:he,u_world:[Le.drawingBufferWidth,Le.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ee.paint.get("heatmap-opacity")}})(R,z),null,z.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,z.paint,R.transform.zoom)}(v,T))})(s,f,d,g);break;case"line":(function(v,C,T,M){if(v.renderPass!=="translucent")return;const R=T.paint.get("line-opacity"),z=T.paint.get("line-width");if(R.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,Sn.ReadOnly),Y=v.colorModeForRenderPass(),ae=T.paint.get("line-dasharray"),se=T.paint.get("line-pattern"),ce=se.constantOr(1),ee=T.paint.get("line-gradient"),be=T.getCrossfadeParameters(),Fe=ce?"linePattern":ae?"lineSDF":ee?"lineGradient":"line",he=v.context,Le=he.gl;let Be=!0;for(const Ge of M){const He=C.getTile(Ge);if(ce&&!He.patternsLoaded())continue;const et=He.getBucket(T);if(!et)continue;const $e=et.programConfigurations.get(T.id),ct=v.context.program.get(),pt=v.useProgram(Fe,$e),nn=Be||pt.program!==ct,dt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ge),Bt=se.constantOr(null);if(Bt&&He.imageAtlas){const Wt=He.imageAtlas,an=Wt.patternPositions[Bt.to.toString()],fn=Wt.patternPositions[Bt.from.toString()];an&&fn&&$e.setConstantPatternPositions(an,fn)}const rn=dt?Ge:null,En=ce?El(v,He,T,be,rn):ae?oh(v,He,T,ae,be,rn):ee?um(v,He,T,et.lineClipsArray.length,rn):ih(v,He,T,rn);if(ce)he.activeTexture.set(Le.TEXTURE0),He.imageAtlasTexture.bind(Le.LINEAR,Le.CLAMP_TO_EDGE),$e.updatePaintBuffers(be);else if(ae&&(nn||v.lineAtlas.dirty))he.activeTexture.set(Le.TEXTURE0),v.lineAtlas.bind(he);else if(ee){const Wt=et.gradients[T.id];let an=Wt.texture;if(T.gradientVersion!==Wt.version){let fn=256;if(T.stepInterpolant){const Tr=C.getSource().maxzoom,qn=Ge.canonical.z===Tr?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 ja(this.context,Ju[s],f,cm[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 Z(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 Wa{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(T=>{const M=1/(T=l.af([],T,s))[3]/f*g;return l.a$(T,T,[M,M,1/T[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(Y,ae){var se=ae[0],ce=ae[1],ee=ae[2],be=se*se+ce*ce+ee*ee;return be>0&&(be=1/Math.sqrt(be)),Y[0]=ae[0]*be,Y[1]=ae[1]*be,Y[2]=ae[2]*be,Y}([],function(Y,ae,se){var ce=ae[0],ee=ae[1],be=ae[2],Fe=se[0],he=se[1],Le=se[2];return Y[0]=ee*Le-be*he,Y[1]=be*Fe-ce*Le,Y[2]=ce*he-ee*Fe,Y}([],oe([],v[T[0]],v[T[1]]),oe([],v[T[2]],v[T[1]]))),R=-((z=M)[0]*(F=v[T[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(R)});return new Wa(v,C)}}class Ha{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=ge(this.min),g=ge(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 T=0;Tthis.max[g]-this.min[g])return 0}return 1}}class cu{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 cu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const pp=85.051129;class Sh{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 cu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new Sh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.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],T=g[1],M=g[2],R=g[3],z=Math.sin(v),F=Math.cos(v);d[0]=C*F+M*z,d[1]=T*F+R*z,d[2]=C*-z+M*F,d[3]=T*-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)),T=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=T-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()),T=l.Y.fromLngLat(this.center),M=Math.pow(2,g),R=[M*C.x,M*C.y,0],z=[M*T.x,M*T.y,0],F=Wa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let Y=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Y=g);const ae=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,se=he=>({aabb:new Ha([he*M,0,0],[(he+1)*M,M,0]),zoom:0,x:0,y:0,wrap:he,fullyVisible:!1}),ce=[],ee=[],be=g,Fe=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let he=1;he<=3;he++)ce.push(se(-he)),ce.push(se(he));for(ce.push(se(0));ce.length>0;){const he=ce.pop(),Le=he.x,Be=he.y;let Ge=he.fullyVisible;if(!Ge){const pt=he.aabb.intersects(F);if(pt===0)continue;Ge=pt===2}const He=s.terrain?R:z,et=he.aabb.distanceX(He),$e=he.aabb.distanceY(He),ct=Math.max(Math.abs(et),Math.abs($e));if(he.zoom===be||ct>ae+(1<=Y){const pt=be-he.zoom,nn=R[0]-.5-(Le<>1),Bt=he.zoom+1;let rn=he.aabb.quadrant(pt);if(s.terrain){const En=new l.Q(Bt,he.wrap,Bt,nn,dt),Wt=s.terrain.getMinMaxElevation(En),an=(f=Wt.minElevation)!==null&&f!==void 0?f:this.elevation,fn=(d=Wt.maxElevation)!==null&&d!==void 0?d:this.elevation;rn=new Ha([rn.min[0],rn.min[1],an],[rn.max[0],rn.max[1],fn])}ce.push({aabb:rn,zoom:Bt,x:nn,y:dt,wrap:he.wrap,fullyVisible:Ge})}}return ee.sort((he,Le)=>he.distanceSq-Le.distanceSq).map(he=>he.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,pp);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,T=Math.cos(this._pitch)*this.cameraToCenterDistance/C/l.b3(1,g.lat),M=this.scaleZoom(T/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 Y=f.pointCoordinate(s);if(Y!=null)return Y}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],T=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(T,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 Pe().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 Pe([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,pp])}calculatePosMatrix(s,f=!1){const d=s.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=l.an(new Float64Array(16));return l.H(M,M,[T*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 he=179.9999999999;g=[-he,he]}const v=this.tileSize*this.zoomScale(d.zoom);let C=0,T=v,M=0,R=v,z=0,F=0;const{x:Y,y:ae}=this.size;if(this.latRange){const he=this.latRange;C=l.O(he[1])*v,T=l.O(he[0])*v,T-CT&&(be=T-he)}if(g){const he=(M+R)/2;let Le=se;this._renderWorldCopies&&(Le=l.b1(se,he-v/2,he+v/2));const Be=Y/2;Le-BeR&&(ee=R-Be)}if(ee!==void 0||be!==void 0){const he=new l.P(ee??se,be??ce);d.center=this.unproject.call({worldSize:v},he).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),T=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?T: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)),Y=this.getHorizon(),ae=2*Math.atan(Y/this.cameraToCenterDistance)*(.5+s.y/(2*Y)),se=Math.sin(ae)*M/Math.sin(l.ac(Math.PI-R-ae,.01,Math.PI-.01)),ce=Math.min(F,se),ee=1.01*(Math.cos(Math.PI/2-this._pitch)*ce+M),be=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,be,ee),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,he=this.height%2/2,Le=Math.cos(this.angle),Be=Math.sin(this.angle),Ge=f-Math.round(f)+Le*Fe+Be*he,He=d-Math.round(d)+Le*he+Be*Fe,et=new Float64Array(g);if(l.H(et,et,[Ge>.5?Ge-1:Ge,He>.5?He-1:He,0]),this.alignedProjMatrix=et,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 T of s)d=Math.min(d,T.x),g=Math.min(g,T.y),v=Math.max(v,T.x),C=Math.max(C,T.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 dp(_,s){let f,d=!1,g=null,v=null;const C=()=>{g=null,d&&(_.apply(v,f),g=setTimeout(C,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,g||C(),g)}class mp{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=dp(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,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,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),R=this._map.getPitch();let z="";if(z+=s?`/${C}/${T}/${d}`:`${d}/${T}/${C}`,(M||R)&&(z+="/"+Math.round(10*M)/10),R&&(z+=`/${Math.round(R)}`),this._hashName){const F=this._hashName;let Y=!1;const ae=window.location.hash.slice(1).split("&").map(se=>{const ce=se.split("=")[0];return ce===F?(Y=!0,`${ce}=${z}`):se}).filter(se=>se);return Y||ae.push(`${F}=${z}`),`#${ae.join("&")}`}return`#${z}`}}const oc={linearity:.3,easing:l.b6(0,0,.3,1)},Ll=l.e({deceleration:2500,maxSpeed:1400},oc),Im=l.e({deceleration:20,maxSpeed:1400},oc),Cm=l.e({deceleration:1e3,maxSpeed:360},oc),Tm=l.e({deceleration:1e3,maxSpeed:90},oc);class Lm{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=ac(f.pan.mag(),d,l.e({},Ll,s||{}));g.offset=f.pan.mult(v.amount/f.pan.mag()),g.center=this._map.transform.center,sc(g,v)}if(f.zoom){const v=ac(f.zoom,d,Im);g.zoom=this._map.transform.zoom+v.amount,sc(g,v)}if(f.bearing){const v=ac(f.bearing,d,Cm);g.bearing=this._map.transform.bearing+l.ac(v.amount,-179,179),sc(g,v)}if(f.pitch){const v=ac(f.pitch,d,Tm);g.pitch=this._map.transform.pitch+v.amount,sc(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 sc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,R,z,F)=>M.add(R.div(F.length)),new l.P(0,0));super(s,{points:v,point:T,lngLats:C,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class gp extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class ms{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new gp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new mo(s.type,this._map,s))}mouseup(s){this._map.fire(new mo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new mo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new mo(s.type,this._map,s))}mouseover(s){this._map.fire(new mo(s.type,this._map,s))}mouseout(s){this._map.fire(new mo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Bs(s.type,this._map,s))}touchmove(s){this._map.fire(new Bs(s.type,this._map,s))}touchend(s){this._map.fire(new Bs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Bs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vs{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new mo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new mo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new mo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class gs{constructor(s,f){this._map=s,this._tr=new hu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,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&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new l.k(s,{originalEvent:f}))}}function Pl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class a_{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const v=new l.P(0,0);for(const C of g)v._add(C);return v.div(g.length)}(f),this.touches=Pl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const g=Pl(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 yp{constructor(s){this.singleTap=new a_(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 l_{constructor(s){this._tr=new hu(s),this._zoomIn=new yp({numTouches:1,numTaps:2}),this._zoomOut=new yp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const 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:T=>T.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fu{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=f.length?f[0]:f;return!this._moved&&g.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},pu=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new Us({checkCorrectEvent:g=>P.mouseButton(g)===0&&g.ctrlKey||P.mouseButton(g)===2});return new fu({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*f}),moveStateManager:d,enable:_,assignEvents:Eh})},du=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new Us({checkCorrectEvent:g=>P.mouseButton(g)===0&&g.ctrlKey||P.mouseButton(g)===2});return new fu({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*f}),moveStateManager:d,enable:_,assignEvents:Eh})};class Pm{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=Pl(d,f),v=new l.P(0,0),C=new l.P(0,0);let T=0;for(const R in g){const z=g[R],F=this._touches[R];F&&(v._add(z),C._add(z.sub(F)),T++,g[R]=z)}if(this._touches=g,TMath.abs(_.x)}class km extends _t{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Ch(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 Ch(s)&&Ch(f)&&C}}const u_={panStep:100,bearingStep:15,pitchStep:10};class Za{constructor(s){this._tr=new hu(s);const f=u_;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:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:ur,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 ur(_){return _*(2-_)}const uc=4.000244140625;class Th{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new hu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=E.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%uc==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=P.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 T=this._type==="wheel"&&Math.abs(this._delta)>uc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));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 T=Math.min((E.now()-this._lastWheelEventTime)/200,1),M=g(T);v=l.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=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,T=Math.sqrt(.0729-C*C);f=l.b6(C,T,.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 vp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Dm{constructor(s){this._tr=new hu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rm{constructor(){this._tap=new yp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,d){if(!this._swipePoint)if(this._tapTime){const 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 Nm{constructor(s,f,d){this._el=s,this._mousePan=f,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ys{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class cc{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 kt{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),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&&(P.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ft=_=>_.zoom||_.drag||_.pitch||_.rotate;class Lh extends l.k{}function hc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class bp{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,T={needsRenderFrame:!1},M={},R={},z=g.touches,F=z?this._getMapTouches(z):void 0,Y=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),g);for(const{handlerName:ce,handler:ee,allowed:be}of this._handlers){if(!ee.isEnabled())continue;let Fe;this._blockedByActive(R,be,ce)?ee.reset():ee[v||g.type]&&(Fe=ee[v||g.type](g,Y,F),this.mergeHandlerResult(T,M,Fe,ce,C),Fe&&Fe.needsRenderFrame&&this._triggerRenderFrame()),(Fe||ee.isActive())&&(R[ce]=ee)}const ae={};for(const ce in this._previousActiveHandlers)R[ce]||(ae[ce]=C);this._previousActiveHandlers=R,(Object.keys(ae).length||hc(T))&&(this._changes.push([T,M,ae]),this._triggerRenderFrame()),(Object.keys(R).length||hc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:se}=T;se&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],se(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Lm(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)P.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new ms(f,s));const g=f.boxZoom=new gs(f,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const v=f.cooperativeGestures=new kt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new l_(f),T=new Dm(f);f.doubleClickZoom=new vp(T,C),this._add("tapZoom",C),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Rm;this._add("tapDragZoom",M);const R=f.touchPitch=new km(f);this._add("touchPitch",R),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=pu(s),F=du(s);f.dragRotate=new ys(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const Y=(({enable:Fe,clickTolerance:he})=>{const Le=new Us({checkCorrectEvent:Be=>P.mouseButton(Be)===0&&!Be.ctrlKey});return new fu({clickTolerance:he,move:(Be,Ge)=>({around:Ge,panDelta:Ge.sub(Be)}),activateOnStart:!0,moveStateManager:Le,enable:Fe,assignEvents:Eh})})(s),ae=new Pm(s,f);f.dragPan=new Nm(d,Y,ae),this._add("mousePan",Y),this._add("touchPan",ae,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const se=new _p,ce=new Am;f.touchZoomRotate=new cc(d,ce,se,M),this._add("touchRotate",se,["touchPan","touchZoom"]),this._add("touchZoom",ce,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const ee=f.scrollZoom=new Th(f,()=>this._triggerRenderFrame());this._add("scrollZoom",ee,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const be=f.keyboard=new Za(f);this._add("keyboard",be),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Vs(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ft(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const 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(!(hc(s)||C&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:R,pitchDelta:z,around:F,pinchAround:Y}=s;Y!==void 0&&(F=Y),g._stop(!0),F=F||g.transform.centerPoint;const ae=v.pointLocation(T?F.sub(T):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(T)):v.setLocationAtPoint(ae,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(ae,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(g.terrain)})):v.setLocationAtPoint(ae,F),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const g=Ft(this._eventsInProgress),v=Ft(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!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 T={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:Y}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||Y,T[`${z}end`]=M)}for(const z in T)this._fireEvent(z,T[z]);const R=Ft(this._eventsInProgress);if(d&&(g||v)&&!R){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=Y=>Y!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Lh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class go 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,ee,He)),this._rotating&&(g.bearing=l.z.number(C,R,He)),this._pitching&&(g.pitch=l.z.number(T,z,He)),this._padding&&(g.interpolatePadding(M,F,He),ae=g.centerPoint.add(Y)),this.terrain&&!s.freezeElevation&&this._updateElevation(He),Le)g.setLocationAtPoint(Le,Be);else{const et=g.zoomScale(g.zoom-v),$e=ee>v?Math.min(2,he):Math.max(.5,he),ct=Math.pow($e,1-He),pt=g.unproject(be.add(Fe.mult(He*ct)).mult(et));g.setLocationAtPoint(g.renderWorldCopies?pt.wrap():pt,ae)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},He=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,He)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new 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:T}=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),T!==void 0&&(f.elevation=T),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 En=l.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(En,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(),T=this.getPitch(),M=this.getPadding(),R="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:g.padding,Y=l.P.convert(s.offset);let ae=g.centerPoint.add(Y);const se=g.pointLocation(ae),{center:ce,zoom:ee}=g.getConstrained(l.M.convert(s.center||se),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(ce);const be=g.zoomScale(ee-v),Fe=g.project(se),he=g.project(ce).sub(Fe);let Le=s.curve;const Be=Math.max(g.width,g.height),Ge=Be/be,He=he.mag();if("minZoom"in s){const En=l.ac(Math.min(s.minZoom,v,ee),g.minZoom,g.maxZoom),Wt=Be/g.zoomScale(En-v);Le=Math.sqrt(Wt/He*2)}const et=Le*Le;function $e(En){const Wt=(Ge*Ge-Be*Be+(En?-1:1)*et*et*He*He)/(2*(En?Ge:Be)*et*He);return Math.log(Math.sqrt(Wt*Wt+1)-Wt)}function ct(En){return(Math.exp(En)-Math.exp(-En))/2}function pt(En){return(Math.exp(En)+Math.exp(-En))/2}const nn=$e(!1);let dt=function(En){return pt(nn)/pt(nn+Le*En)},Bt=function(En){return Be*((pt(nn)*(ct(Wt=nn+Le*En)/pt(Wt))-ct(nn))/et)/He;var Wt},rn=($e(!0)-nn)/Le;if(Math.abs(He)<1e-6||!isFinite(rn)){if(Math.abs(Be-Ge)<1e-6)return this.easeTo(s,f);const En=Ges.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==R,this._pitching=z!==T,this._padding=!g.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(ce),this._ease(En=>{const Wt=En*rn,an=1/dt(Wt);g.zoom=En===1?ee:v+g.scaleZoom(an),this._rotating&&(g.bearing=l.z.number(C,R,En)),this._pitching&&(g.pitch=l.z.number(T,z,En)),this._padding&&(g.interpolatePadding(M,F,En),ae=g.centerPoint.add(Y)),this.terrain&&!s.freezeElevation&&this._updateElevation(En);const fn=En===1?ce:g.unproject(Fe.add(he.mult(Bt(Wt))).mult(an));g.setLocationAtPoint(g.renderWorldCopies?fn.wrap():fn,ae),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 xp={compact:!0,customAttribution:'MapLibre'};class _s{constructor(s=xp){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){P.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const d=this._map._getUIString(`AttributionControl.${f}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(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 Om{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=P.create("div","maplibregl-ctrl");const f=P.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class fc{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 Cr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class qr 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 Ko(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,T=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,[-T*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,T=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,[T*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 zm{constructor(s,f,d){this.painter=s,this.sourceCache=new qr(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 Z(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),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,T-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 Y=this._coordsTextureSize,ae=(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 _a={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class wp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new pc(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 T in C)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(C[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],v=g.source;if(_a[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const 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(_a[f]&&(this._prevType&&_a[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(_a[this._prevType]||_a[f]&&g){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(wh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const R=this.pool.getObjectForId(T.rtt[v].id);if(R.stamp===T.rtt[v].stamp){this.pool.useObject(R);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:l.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let R=0;R{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Ip={showCompass:!0,showZoom:!0,visualizePitch:!1};class Cp{constructor(s,f,d=!1){this.mousedown=C=>{this.startMouse(l.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),P.mousePos(this.element,C)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,P.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=pu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const R=new St;return new fu({clickTolerance:T,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:R,enable:C,assignEvents:Ph})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=du({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const R=new St;return new fu({clickTolerance:T,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:R,enable:C,assignEvents:Ph})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta: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;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let va;function Mh(_,s,f){const d=new l.M(_.lng,_.lat);if(_=new l.M(_.lng,_.lat),s){const g=new l.M(_.lng-360,_.lat),v=new l.M(_.lng+360,_.lat),C=f.locationPoint(_).distSqr(s);f.locationPoint(g).distSqr(s)180;){const g=f.locationPoint(_);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const mc={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 Ah(_,s,f){const d=_.classList;for(const g in mc)d.remove(`maplibregl-${f}-anchor-${g}`);d.add(`maplibregl-${f}-anchor-${s}`)}class gc 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?Mh(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${mc[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=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.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=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=P.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const be of M){const Fe=P.createNS("http://www.w3.org/2000/svg","ellipse");Fe.setAttributeNS(null,"opacity","0.04"),Fe.setAttributeNS(null,"cx","10.5"),Fe.setAttributeNS(null,"cy","5.80029008"),Fe.setAttributeNS(null,"rx",be.rx),Fe.setAttributeNS(null,"ry",be.ry),T.appendChild(Fe)}const R=P.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const z=P.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),R.appendChild(z);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Y=P.createNS("http://www.w3.org/2000/svg","path");Y.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(Y);const ae=P.createNS("http://www.w3.org/2000/svg","g");ae.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ae.setAttributeNS(null,"fill","#FFFFFF");const se=P.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ce=P.createNS("http://www.w3.org/2000/svg","circle");ce.setAttributeNS(null,"fill","#000000"),ce.setAttributeNS(null,"opacity","0.25"),ce.setAttributeNS(null,"cx","5.5"),ce.setAttributeNS(null,"cy","5.5"),ce.setAttributeNS(null,"r","5.4999962");const ee=P.createNS("http://www.w3.org/2000/svg","circle");ee.setAttributeNS(null,"fill","#FFFFFF"),ee.setAttributeNS(null,"cx","5.5"),ee.setAttributeNS(null,"cy","5.5"),ee.setAttributeNS(null,"r","5.4999962"),se.appendChild(ce),se.appendChild(ee),C.appendChild(T),C.appendChild(R),C.appendChild(F),C.appendChild(ae),C.appendChild(se),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()}),Ah(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=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 T=-this._offset.y/g.transform._pixelPerMeter,M=Math.sin(g.getPitch()*Math.PI/180)*T,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 kh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let gu=0,Ml=!1;const Dh={maxWidth:100,unit:"metric"};function Rh(_,s,f){const d=f&&f.maxWidth||100,g=_._container.clientHeight/2,v=_.unproject([0,g]),C=_.unproject([d,g]),T=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Al(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Al(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Al(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Al(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Al(s,d,T,_._getUIString("ScaleControl.Meters"))}function Al(_,s,f,d){const g=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/C;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const R=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*R)/R}(T),C*T}(f);_.style.width=s*(g/f)+"px",_.innerHTML=`${g} ${d}`}const Tp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Lp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Nh(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,_),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-_),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(_,0),right:new l.P(-_,0)}}if(_ instanceof l.P||Array.isArray(_)){const s=l.P.convert(_);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(_.center||[0,0]),top:l.P.convert(_.top||[0,0]),"top-left":l.P.convert(_["top-left"]||[0,0]),"top-right":l.P.convert(_["top-right"]||[0,0]),bottom:l.P.convert(_.bottom||[0,0]),"bottom-left":l.P.convert(_["bottom-left"]||[0,0]),"bottom-right":l.P.convert(_["bottom-right"]||[0,0]),left:l.P.convert(_.left||[0,0]),right:l.P.convert(_.right||[0,0])}}return Nh(new l.P(0,0))}const Fm=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=_s,c.BoxZoomHandler=gs,c.CanvasSource=ps,c.CooperativeGesturesHandler=kt,c.DoubleClickZoomHandler=vp,c.DragPanHandler=Nm,c.DragRotateHandler=ys,c.EdgeInsets=cu,c.FullscreenControl=class extends l.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container: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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new 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(_){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=Pe.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&&Ml)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=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){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=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new gc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new gc({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({},kh,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(s=!1){if(va!==void 0&&!s)return va;if(window.navigator.permissions===void 0)return va=!!window.navigator.geolocation,va;try{va=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{va=!!window.navigator.geolocation}return va})}().then(s=>this._setupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,gu=0,Ml=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),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":gu--,Ml=!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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),gu++,gu>1?(_={maximumAge:6e5,timeout:0},Ml=!0):(_=this.options.positionOptions,Ml=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.Hash=mp,c.ImageSource=er,c.KeyboardHandler=Za,c.LngLatBounds=Pe,c.LogoControl=Om,c.Map=class extends go{constructor(_){if(l.bc.mark(l.bd.create),(_=l.e({},dc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Sh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.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=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new fc,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},Sp,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=W.addThrottleControl(()=>this.isMoving()),this._requestManager=new X(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=dp(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bp(this,_),this._hash=_.hash&&new mp(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,l.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new _s(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Om,_.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(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.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=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],g=f[1],v=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,v),this.painter.resize(d,g,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.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",_)).fire(new l.k("move",_))),this.fire(new l.k("resize",_)),C&&this.fire(new l.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),v=_*g,C=s*g;return Math.min(v>f?f/v:1,C>d?d/C:1)*g}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(Pe.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(l.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(l.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?d||(d=!0,f.call(this,new mo(_,this,v.originalEvent,{features:C}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new mo(_,this,C.originalEvent)))},mouseout:C=>{d&&(d=!1,f.call(this,new mo(_,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:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const g=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new ko(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ko(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");l.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new l.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,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(_,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(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&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 zm(this.painter,s,_),this.painter.renderToTexture=new wp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const g=f[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:v,stretchY:C,content:T}=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(_,{data:new l.R({width:M,height:R},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:g,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:R,data:z}=E.getImageData(s);this.style.addImage(_,{data:new l.R({width:M,height:R},z),pixelRatio:d,stretchX:v,stretchY:C,content:T,sdf:g,version:0})}}updateImage(_,s){const f=this.style.getImage(_);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 T=!(s instanceof HTMLImageElement||l.b(s));return f.data.replace(C,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return W.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const g=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=P.create("div",`maplibregl-ctrl-${C} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Em(f,this.transform),D.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const 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()}),T=C.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new 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 _;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),W.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),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(_=>{l.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Ep}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=mo,c.MapTouchEvent=Bs,c.MapWheelEvent=gp,c.Marker=gc,c.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=l.e({},Ip,_),this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Cp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends l.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new 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=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Mh(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=Nh(this.options.offset);if(!g){const T=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-T/2&&R.push("right"),g=R.length===0?"bottom":R.join("-")}let C=d.add(v[g]);this.options.subpixelPositioning||(C=C.round()),P.setTransform(this._container,`${mc[g]} translate(${C.x}px,${C.y}px)`),Ah(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Tp),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=l.M.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Lp);_&&_.focus()}},c.RasterDEMTileSource=Jt,c.RasterTileSource=Oe,c.ScaleControl=class{constructor(_){this._onMove=()=>{Rh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Rh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Dh),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Th,c.Style=ko,c.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=km,c.TwoFingersTouchRotateHandler=_p,c.TwoFingersTouchZoomHandler=Am,c.TwoFingersTouchZoomRotateHandler=cc,c.VectorTileSource=Nn,c.VideoSource=Mo,c.addSourceType=(_,s)=>l._(void 0,void 0,void 0,function*(){if(Ua(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{Os[f]=d})(_,s)}),c.clearPrewarmedResources=function(){const _=_n;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(At),_n=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 Fm},c.getWorkerCount=function(){return hn.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(_){return kr().broadcast("IS",_)},c.prewarm=function(){Rn().acquire(At)},c.setMaxParallelImageRequests=function(_){l.a.MAX_PARALLEL_IMAGE_REQUESTS=_},c.setRTLTextPlugin=function(_,s){return at().setRTLTextPlugin(_,s)},c.setWorkerCount=function(_){hn.workerCount=_},c.setWorkerUrl=function(_){l.a.WORKER_URL=_}});var a=n;return a})})(CI);var oD=CI.exports;const Es=Lv(oD);var sD=Object.defineProperty,aD=(t,e,n)=>e in t?sD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zw=(t,e,n)=>(aD(t,typeof e!="symbol"?e+"":e,n),n);function wd(){}function LI(t){return t()}function Fw(){return Object.create(null)}function Cy(t){t.forEach(LI)}function PI(t){return typeof t=="function"}function lD(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function uD(t){return Object.keys(t).length===0}function cD(t,e){t.appendChild(e)}function hD(t,e,n){t.insertBefore(e,n||null)}function MI(t){t.parentNode&&t.parentNode.removeChild(t)}function Bw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Eu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function fD(t){return Array.from(t.childNodes)}function fg(t,e,n){t.classList.toggle(e,!!n)}let Kv;function yd(t){Kv=t}const rf=[],Vw=[];let cf=[];const Uw=[],pD=Promise.resolve();let ev=!1;function dD(){ev||(ev=!0,pD.then(AI))}function tv(t){cf.push(t)}const x0=new Set;let Qh=0;function AI(){if(Qh!==0)return;const t=Kv;do{try{for(;Qht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),cf=e}const yD=new Set;function _D(t,e){t&&t.i&&(yD.delete(t),t.i(e))}function vD(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),tv(()=>{const a=t.$$.on_mount.map(LI).filter(PI);t.$$.on_destroy?t.$$.on_destroy.push(...a):Cy(a),t.$$.on_mount=[]}),i.forEach(tv)}function bD(t,e){const n=t.$$;n.fragment!==null&&(gD(n.after_update),Cy(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function xD(t,e){t.$$.dirty[0]===-1&&(rf.push(t),dD(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=D.length?D[0]:P;return w.ctx&&i(w.ctx[E],w.ctx[E]=k)&&(!w.skip_bound&&w.bound[E]&&w.bound[E](k),S&&xD(t,E)),P}):[],w.update(),S=!0,Cy(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const E=fD(e.target);w.fragment&&w.fragment.l(E),E.forEach(MI)}else w.fragment&&w.fragment.c();e.intro&&_D(t.$$.fragment),vD(t,e.target,e.anchor),AI()}yd(m)}class SD{constructor(){zw(this,"$$"),zw(this,"$$set")}$destroy(){bD(this,1),this.$destroy=wd}$on(e,n){if(!PI(n))return wd;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&&!uD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ED="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ED);function ID(t){let e,n,r;return{c(){e=Bw("svg"),n=Bw("path"),Eu(n,"stroke-width","4"),Eu(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"),Eu(n,"class","svelte-gzo3ar"),Eu(e,"width",r=t[0]==="list"?20:void 0),Eu(e,"viewBox","0 0 70 85"),Eu(e,"fill","none"),Eu(e,"class","svelte-gzo3ar"),fg(e,"in-map",t[0]!=="list"),fg(e,"list-icon",t[0]==="list")},m(i,a){hD(i,e,a),cD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Eu(e,"width",r),a&1&&fg(e,"in-map",i[0]!=="list"),a&1&&fg(e,"list-icon",i[0]==="list")},i:wd,o:wd,d(i){i&&MI(e)}}}function CD(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class TD extends SD{constructor(e){super(),wD(this,e,CD,ID,lD,{displayIn:0})}}const LD=[{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"}],PD={decimalLatitude:40.123,decimalLongitude:-74.123},MD=[{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}],AD=[{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 kD(){const t=[];return LD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...PD})}),[...t,...MD,...AD]}const DD=kD();DD.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 RD(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 w0(t,e,n,r){var i=new Du(t,e);if(n===null)return i.left=i.right=null,i;n=Lu(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 Gw(t,e,n){var r=null,i=null;if(e){e=Lu(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 OD(t,e,n){return e===null?t:(t===null||(e=Lu(t.key,e,n),e.left=t),e)}function nv(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` +`);var a=e+(n?" ":"│ ");t.left&&nv(t.left,a,!1,r,i),t.right&&nv(t.right,a,!0,r,i)}}var Jv=function(){function t(e){e===void 0&&(e=ND),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=w0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new Du(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=Lu(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=Lu(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=Lu(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=Lu(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=Lu(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 FD(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&&ov(e,n,0,i-1,a),this._root===null)this._root=rv(e,n,0,i),this._size=i;else{var c=BD(this.toList(),zD(e,n),a);i=this._size+i,this._root=iv({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 nv(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=Gw(e,this._root,i),c=a.left,l=a.right;i(e,n)<0?l=w0(n,r,l,i):c=w0(n,r,c,i),this._root=OD(c,l,i)},t.prototype.split=function(e){return Gw(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return RD(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 rv(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 Du(c,l);return m.left=rv(t,e,n,a),m.right=rv(t,e,a+1,r),m}return null}function zD(t,e){for(var n=new Du(null,null),r=n,i=0;i0?(e=a=a.next=n.pop(),e=e.right):r=!0;return a.next=null,i.next}function iv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=iv(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=iv(t,i+1,n),c}return null}function BD(t,e,n){for(var r=new Du(null,null),i=r,a=t,c=e;a!==null&&c!==null;)n(a.key,c.key)<0?(i.next=a,a=a.next):(i.next=c,c=c.next),i=i.next;return a!==null?i.next=a:c!==null&&(i.next=c),r.next}function ov(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}ov(t,e,n,l,i),ov(t,e,l+1,r,i)}}function da(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){da(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return qo(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?wP?-1:0:m<0&&E<0?wP?1:0:Em?1:0}}}]),t}(),WD=0,oy=function(){qo(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 P=n.comparePoint(e.rightSE.point);return P!==0?P:-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 j=e.comparePoint(n.rightSE.point);if(j<0)return 1;if(j>0)return-1}if(a!==c){var $=w-l,B=a-r,W=S-m,X=c-i;if($>B&&WX)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){da(this,t),this.id=++WD,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 qo(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(),rl.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 rl(i,!0),w=new rl(a,!1);return new t(m,w,[r],[c])}}]),t}(),Xw=function(){function t(e,n,r){if(da(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=Sd.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(oy.fromRing(a,i,this))}return qo(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 qo(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 qo(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}(),Kw=function(){function t(e){da(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return qo(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]:oy.compare;da(this,t),this.queue=e,this.tree=new Jv(n),this.segments=[]}return qo(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),P=0,D=E.length;P0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&m){var oe=l.getIntersection(m);if(oe!==null){if(!l.isAnEndpoint(oe))for(var fe=this._splitSafely(l,oe),Te=0,Z=fe.length;TeJw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var X=new YD(k),re=k.size,ge=k.pop();ge;){var pe=ge.key;if(k.size===re){var oe=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(oe.id," ")+"[".concat(oe.leftSE.point.x,", ").concat(oe.leftSE.point.y,"] -> ")+"[".concat(oe.rightSE.point.x,", ").concat(oe.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(k.size>Jw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(X.segments.length>KD)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var fe=X.process(pe),Te=0,Z=fe.length;Te1?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[hs,Ly,fs]};Ne.prototype.getClass=function(){return Ne};Ne.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=Xt.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Wc.DimensionalComparator.get=function(){return ql};Wc.serialVersionUID.get=function(){return 6683108902428367e3};Wc.NULL_ORDINATE.get=function(){return Xt.NaN};Wc.X.get=function(){return 0};Wc.Y.get=function(){return 1};Wc.Z.get=function(){return 2};Object.defineProperties(Ne,Wc);var ql=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new ar("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};ql.prototype.compare=function(t,e){var n=t,r=e,i=ql.compare(n.x,r.x);if(i!==0)return i;var a=ql.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=ql.compare(n.z,r.z);return c};ql.prototype.interfaces_=function(){return[gf]};ql.prototype.getClass=function(){return ql};ql.compare=function(t,e){return te?1:Xt.isNaN(t)?Xt.isNaN(e)?0:-1:Xt.isNaN(e)?1:0};var yf=function(){};yf.prototype.create=function(){};yf.prototype.interfaces_=function(){return[]};yf.prototype.getClass=function(){return yf};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 ar("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 Ut=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Wo=function(){},VI={LOG_10:{configurable:!0}};Wo.prototype.interfaces_=function(){return[]};Wo.prototype.getClass=function(){return Wo};Wo.log10=function(t){var e=Math.log(t);return Xt.isInfinite(e)||Xt.isNaN(e)?e:e/Wo.LOG_10};Wo.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};Wo.wrap=function(t,e){return t<0?e- -t%e:t%e};Wo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3],m=i;return a>m&&(m=a),c>m&&(m=c),l>m&&(m=l),m}};Wo.average=function(t,e){return(t+e)/2};VI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Wo,VI);var ma=function(t){this.str=t};ma.prototype.append=function(t){this.str+=t};ma.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};ma.prototype.toString=function(t){return this.str};var na=function(t){this.value=t};na.prototype.intValue=function(){return this.value};na.prototype.compareTo=function(t){return this.valuet?1:0};na.isNaN=function(t){return Number.isNaN(t)};var Ed=function(){};Ed.isWhitespace=function(t){return t<=32&&t>=0||t===127};Ed.toUpperCase=function(t){return t.toUpperCase()};var qe=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},Rs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};qe.prototype.le=function(t){return(this._hi9?(S=!0,E="9"):E="0"+w,c.append(E),n=n.subtract(qe.valueOf(w)).multiply(qe.TEN),S&&n.selfAdd(qe.TEN);var P=!0,D=qe.magnitude(n._hi);if(D<0&&Math.abs(D)>=l-m&&(P=!1),!P)break}return e[0]=r,c.toString()};qe.prototype.sqr=function(){return this.multiply(this)};qe.prototype.doubleValue=function(){return this._hi+this._lo};qe.prototype.subtract=function(){if(arguments[0]instanceof qe){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};qe.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};qe.prototype.isZero=function(){return this._hi===0&&this._lo===0};qe.prototype.selfSubtract=function(){if(arguments[0]instanceof qe){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)}};qe.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};qe.prototype.min=function(t){return this.le(t)?this:t};qe.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof qe){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=qe.SPLIT*m,i=w-m,E=qe.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}};qe.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};qe.prototype.divide=function(){if(arguments[0]instanceof qe){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=qe.SPLIT*a,e=c-a,m=qe.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 qe(w,S)}else if(typeof arguments[0]=="number"){var E=arguments[0];return Xt.isNaN(E)?qe.createNaN():qe.copy(this).selfDivide(E,0)}};qe.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};qe.prototype.pow=function(t){if(t===0)return qe.valueOf(1);var e=new qe(this),n=qe.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};qe.prototype.ceil=function(){if(this.isNaN())return qe.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new qe(t,e)};qe.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};qe.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};qe.prototype.setValue=function(){if(arguments[0]instanceof qe){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};qe.prototype.max=function(t){return this.ge(t)?this:t};qe.prototype.sqrt=function(){if(this.isZero())return qe.valueOf(0);if(this.isNegative())return qe.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=qe.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};qe.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof qe){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,P=null,D=null,k=null,U=null,j=null,$=null;k=this._hi+m,P=this._lo+w,j=k-this._hi,$=P-this._lo,U=k-j,D=P-$,U=m-j+(this._hi-U),D=w-$+(this._lo-D),j=U+P,S=k+j,E=j+(k-S),j=D+E;var B=S+j,W=j+(S-B);return this._hi=B,this._lo=W,this}};qe.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof qe){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=qe.SPLIT*this._hi,i=m-this._hi,w=qe.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}};qe.prototype.selfSqr=function(){return this.selfMultiply(this)};qe.prototype.floor=function(){if(this.isNaN())return qe.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new qe(t,e)};qe.prototype.negate=function(){return this.isNaN()?this:new qe(-this._hi,-this._lo)};qe.prototype.clone=function(){};qe.prototype.multiply=function(){if(arguments[0]instanceof qe){var t=arguments[0];return t.isNaN()?qe.createNaN():qe.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return Xt.isNaN(e)?qe.createNaN():qe.copy(this).selfMultiply(e,0)}};qe.prototype.isNaN=function(){return Xt.isNaN(this._hi)};qe.prototype.intValue=function(){return Math.trunc(this._hi)};qe.prototype.toString=function(){var t=qe.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};qe.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."+qe.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=qe.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};qe.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=qe.SPLIT*i,t=a-i,l=qe.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 qe(m,w)};qe.prototype.toSciNotation=function(){if(this.isZero())return qe.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=qe.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};qe.prototype.abs=function(){return this.isNaN()?qe.NaN:this.isNegative()?this.negate():new qe(this)};qe.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};qe.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};qe.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};qe.prototype.trunc=function(){return this.isNaN()?qe.NaN:this.isPositive()?this.floor():this.ceil()};qe.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};qe.prototype.interfaces_=function(){return[fs,hs,Ly]};qe.prototype.getClass=function(){return qe};qe.sqr=function(t){return qe.valueOf(t).selfMultiply(t)};qe.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return qe.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new qe(e)}};qe.sqrt=function(t){return qe.valueOf(t).sqrt()};qe.parse=function(t){for(var e=0,n=t.length;Ed.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,Ed.isDigit(w)){var S=w-"0";a.selfMultiply(qe.TEN),a.selfAdd(S),c++;continue}if(w==="."){l=c;continue}if(w==="e"||w==="E"){var E=t.substring(e);try{m=na.parseInt(E)}catch(j){throw j instanceof Error?new Error("Invalid exponent "+E+" in string "+t):j}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var P=a,D=c-l-m;if(D===0)P=a;else if(D>0){var k=qe.TEN.pow(D);P=a.divide(k)}else if(D<0){var U=qe.TEN.pow(-D);P=a.multiply(U)}return r?P.negate():P};qe.createNaN=function(){return new qe(Xt.NaN,Xt.NaN)};qe.copy=function(t){return new qe(t)};qe.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};qe.stringOfChar=function(t,e){for(var n=new ma,r=0;r0){if(a<=0)return ao.signum(c);r=i+a}else if(i<0){if(a>=0)return ao.signum(c);r=-i-a}else return ao.signum(c);var l=ao.DP_SAFE_EPSILON*r;return c>=l||-c>=l?ao.signum(c):2};ao.signum=function(t){return t>0?1:t<0?-1:0};UI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(ao,UI);var In=function(){},Wd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Wd.X.get=function(){return 0};Wd.Y.get=function(){return 1};Wd.Z.get=function(){return 2};Wd.M.get=function(){return 3};In.prototype.setOrdinate=function(t,e,n){};In.prototype.size=function(){};In.prototype.getOrdinate=function(t,e){};In.prototype.getCoordinate=function(){};In.prototype.getCoordinateCopy=function(t){};In.prototype.getDimension=function(){};In.prototype.getX=function(t){};In.prototype.clone=function(){};In.prototype.expandEnvelope=function(t){};In.prototype.copy=function(){};In.prototype.getY=function(t){};In.prototype.toCoordinateArray=function(){};In.prototype.interfaces_=function(){return[Ly]};In.prototype.getClass=function(){return In};Object.defineProperties(In,Wd);var GI=function(){},Gf=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}(GI),Ii=function(){};Ii.arraycopy=function(t,e,n,r,i){for(var a=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Rt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Rt){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))}};Rt.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};Rt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Rt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Rt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Rt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Rt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Rt.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()}};Rt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Rt){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)}};Rt.prototype.centre=function(){return this.isNull()?null:new Ne((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Rt.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 Rt){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)};Rt.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};Rt.prototype.interfaces_=function(){return[hs,fs]};Rt.prototype.getClass=function(){return Rt};Rt.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)}};fr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};fr.prototype.setPrecisionModel=function(t){this._precisionModel=t};fr.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 on.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};fr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return on.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};Hc.DONT_INTERSECT.get=function(){return 0};Hc.DO_INTERSECT.get=function(){return 1};Hc.COLLINEAR.get=function(){return 2};Hc.NO_INTERSECTION.get=function(){return 0};Hc.POINT_INTERSECTION.get=function(){return 1};Hc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(fr,Hc);var Zu=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 Rt(this._inputLines[0][0],this._inputLines[0][1]),i=new Rt(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,Rt.intersects(r,i,n)&&xt.orientationIndex(r,i,n)===0&&xt.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,a,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,a.x-=c.x,a.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,a){var c=null;try{c=Is.intersection(n,r,i,a)}catch(l){if(l instanceof Gf)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&&Ii.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=Rt.intersects(n,r,i),l=Rt.intersects(n,r,a),m=Rt.intersects(i,a,n),w=Rt.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,j=wP?m:P,B=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var m=xt.orientationIndex(i,a,n),w=xt.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=xt.distancePointLine(n,i,a),m=xt.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 $s=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};$s.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,a=t.y-this._p.y,c=e.x-this._p.x,l=e.y-this._p.y,m=Pc.signOfDet2x2(i,a,c,l);if(m===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};$s.prototype.isPointInPolygon=function(){return this.getLocation()!==ze.EXTERIOR};$s.prototype.getLocation=function(){return this._isPointOnSegment?ze.BOUNDARY:this._crossingCount%2===1?ze.INTERIOR:ze.EXTERIOR};$s.prototype.isOnSegment=function(){return this._isPointOnSegment};$s.prototype.interfaces_=function(){return[]};$s.prototype.getClass=function(){return $s};$s.locatePointInRing=function(){if(arguments[0]instanceof Ne&&Ut(arguments[1],In)){for(var t=arguments[0],e=arguments[1],n=new $s(t),r=new Ne,i=new Ne,a=1;a1||m<0||m>1)&&(i=!0)}}return i?Wo.min(xt.distancePointLine(t,n,r),xt.distancePointLine(e,n,r),xt.distancePointLine(n,t,e),xt.distancePointLine(r,t,e)):0};xt.isPointInRing=function(t,e){return xt.locatePointInRing(t,e)!==ze.EXTERIOR};xt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new 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=xt.computeOrientation(m,n,w),E=!1;return S===0?E=m.x>w.x:E=S>0,E};xt.locatePointInRing=function(t,e){return $s.locatePointInRing(t,e)};xt.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};xt.computeOrientation=function(t,e,n){return xt.orientationIndex(t,e,n)};xt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new ar("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)}};xt.isOnLine=function(t,e){for(var n=new Zu,r=1;r0};vf.prototype.interfaces_=function(){return[ls]};vf.prototype.getClass=function(){return vf};var bf=function(){};bf.prototype.isInBoundary=function(t){return t>1};bf.prototype.interfaces_=function(){return[ls]};bf.prototype.getClass=function(){return bf};var xf=function(){};xf.prototype.isInBoundary=function(t){return t===1};xf.prototype.interfaces_=function(){return[ls]};xf.prototype.getClass=function(){return xf};var Hr=function(){};Hr.prototype.add=function(){};Hr.prototype.addAll=function(){};Hr.prototype.isEmpty=function(){};Hr.prototype.iterator=function(){};Hr.prototype.size=function(){};Hr.prototype.toArray=function(){};Hr.prototype.remove=function(){};function $v(t){this.message=t||""}$v.prototype=new Error;$v.prototype.name="IndexOutOfBoundsException";var jf=function(){};jf.prototype.hasNext=function(){};jf.prototype.next=function(){};jf.prototype.remove=function(){};var Cs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Hr);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 Hr&&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,Hr]},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 aR(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new $v;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 P=arguments[0],D=arguments[1],k=arguments[2];if(k)for(var U=0;U=0;j--)r.add(P[j],D);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Ne){var $=arguments[0],B=arguments[1],W=arguments[2];if(!W){var X=this.size();if(X>0){if($>0){var re=this.get($-1);if(re.equals2D(B))return null}if($Te&&(Z=-1);for(var ne=fe;ne!==Te;ne+=Z)r.add(pe[ne],oe);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),yn=function(){},My={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};My.ForwardComparator.get=function(){return Id};My.BidirectionalComparator.get=function(){return wf};My.coordArrayType.get=function(){return new Array(0).fill(null)};yn.prototype.interfaces_=function(){return[]};yn.prototype.getClass=function(){return yn};yn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};yn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};yn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};yn.extract=function(t,e,n){e=Wo.clamp(e,0,t.length),n=Wo.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=yn.compare(n,r),a=yn.isEqualReversed(n,r);return a?0:i};wf.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=yn.increasingDirection(n),a=yn.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};ki.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:il,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:il,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};ki.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Iu;t!=null&&t!==this.root_&&t.parent.color===Iu;)if(Kn(t)===S0(Kn(Kn(t)))){var n=t2(Kn(Kn(t)));e2(n)===Iu?($a(Kn(t),il),$a(n,il),$a(Kn(Kn(t)),Iu),t=Kn(Kn(t))):(t===t2(Kn(t))&&(t=Kn(t),e.rotateLeft(t)),$a(Kn(t),il),$a(Kn(Kn(t)),Iu),e.rotateRight(Kn(Kn(t))))}else{var r=S0(Kn(Kn(t)));e2(r)===Iu?($a(Kn(t),il),$a(r,il),$a(Kn(Kn(t)),Iu),t=Kn(Kn(t))):(t===S0(Kn(t))&&(t=Kn(t),e.rotateRight(t)),$a(Kn(t),il),$a(Kn(Kn(t)),Iu),e.rotateLeft(Kn(Kn(t))))}this.root_.color=il};ki.prototype.values=function(){var t=new gt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=ki.successor(e))!==null;)t.add(e.value);return t};ki.prototype.entrySet=function(){var t=new e1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=ki.successor(e))!==null;)t.add(e);return t};ki.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};ki.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};ki.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};ki.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};ki.prototype.size=function(){return this.size_};var Cd=function(){};Cd.prototype.interfaces_=function(){return[]};Cd.prototype.getClass=function(){return Cd};function qI(){}qI.prototype=new Ay;function ra(){this.array_=[],arguments[0]instanceof Hr&&this.addAll(arguments[0])}ra.prototype=new qI;ra.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(os.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Mr.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Mr.createClosedRing(t,e,4);var r=e.getOrdinate(0,In.X)===e.getOrdinate(n-1,In.X)&&e.getOrdinate(0,In.Y)===e.getOrdinate(n-1,In.Y);return r?e:Mr.createClosedRing(t,e,n+1)};Mr.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Mr.copy(e,0,r,0,i);for(var a=i;a0&&Mr.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Ln.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return xt.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Mr.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}(br),La=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};Pd.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Pd.prototype.getClass=function(){return Pd};var Md=function(){};Md.prototype.edit=function(t,e){return t instanceof ka?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof br?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Co?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Md.prototype.interfaces_=function(){return[us.GeometryEditorOperation]};Md.prototype.getClass=function(){return Md};var Lr=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 ma(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Lr(n):new Lr(n,r)}};Da.prototype.interfaces_=function(){return[yf,fs]};Da.prototype.getClass=function(){return Da};Da.instance=function(){return Da.instanceObject};n1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};n1.instanceObject.get=function(){return new Da};Object.defineProperties(Da,n1);var HI=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 e1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Xc),Mn=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 oa){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}}},r1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Mn.prototype.equals=function(t){if(!(t instanceof Mn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Mn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new na(n).compareTo(new na(r))};Mn.prototype.getScale=function(){return this._scale};Mn.prototype.isFloating=function(){return this._modelType===Mn.FLOATING||this._modelType===Mn.FLOATING_SINGLE};Mn.prototype.getType=function(){return this._modelType};Mn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Mn.FLOATING?t="Floating":this._modelType===Mn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Mn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Mn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Xt.isNaN(t))return t;if(this._modelType===Mn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Mn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Ne){var n=arguments[0];if(this._modelType===Mn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Mn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Mn.FLOATING?t=16:this._modelType===Mn.FLOATING_SINGLE?t=6:this._modelType===Mn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Mn.prototype.setScale=function(t){this._scale=Math.abs(t)};Mn.prototype.interfaces_=function(){return[fs,hs]};Mn.prototype.getClass=function(){return Mn};Mn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};r1.serialVersionUID.get=function(){return 7777263578777804e3};r1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Mn,r1);var oa=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},i1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};oa.prototype.readResolve=function(){return oa.nameToTypeMap.get(this._name)};oa.prototype.toString=function(){return this._name};oa.prototype.interfaces_=function(){return[fs]};oa.prototype.getClass=function(){return oa};i1.serialVersionUID.get=function(){return-552860263173159e4};i1.nameToTypeMap.get=function(){return new HI};Object.defineProperties(oa,i1);Mn.Type=oa;Mn.FIXED=new oa("FIXED");Mn.FLOATING=new oa("FLOATING");Mn.FLOATING_SINGLE=new oa("FLOATING SINGLE");var gn=function t(){this._precisionModel=new Mn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ut(arguments[0],yf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Mn&&(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]))},ZI={serialVersionUID:{configurable:!0}};gn.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)};gn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new br(this.getCoordinateSequenceFactory().create(t),this);if(Ut(t,In))return new br(t,this)}else return new br(this.getCoordinateSequenceFactory().create([]),this)};gn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ru(null,this);if(arguments.length===1){var t=arguments[0];return new Ru(t,this)}};gn.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(gn.toGeometryArray(t));var l=t.iterator().next(),m=t.size()>1;if(m){if(l instanceof ei)return this.createMultiPolygon(gn.toPolygonArray(t));if(l instanceof br)return this.createMultiLineString(gn.toLineStringArray(t));if(l instanceof Co)return this.createMultiPoint(gn.toPointArray(t));on.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};gn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};gn.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(Ut(arguments[0],In)){var e=arguments[0];return new Co(e,this)}}};gn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};gn.prototype.createPolygon=function(){if(arguments.length===0)return new ei(null,null,this);if(arguments.length===1){if(Ut(arguments[0],In)){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 ka){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new ei(r,i,this)}};gn.prototype.getSRID=function(){return this._SRID};gn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Xi(null,this);if(arguments.length===1){var t=arguments[0];return new Xi(t,this)}};gn.prototype.createGeometry=function(t){var e=new us(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};gn.prototype.getPrecisionModel=function(){return this._precisionModel};gn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ut(arguments[0],In)){var e=arguments[0];return new ka(e,this)}}};gn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new La(null,this);if(arguments.length===1){var t=arguments[0];return new La(t,this)}};gn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Sf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Sf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ut(arguments[0],In)){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]};ga.prototype.push=function(t){return this.array_.push(t),t};ga.prototype.pop=function(t){if(this.array_.length===0)throw new Oy;return this.array_.pop()};ga.prototype.peek=function(){if(this.array_.length===0)throw new Oy;return this.array_[this.array_.length-1]};ga.prototype.empty=function(){return this.array_.length===0};ga.prototype.isEmpty=function(){return this.empty()};ga.prototype.search=function(t){return this.array_.indexOf(t)};ga.prototype.size=function(){return this.array_.length};ga.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===xt.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};sa.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])};sa.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)};sa.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}on.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===lt.LEFT&&(this._orientedDe=this._minDe.getSym())};sa.prototype.interfaces_=function(){return[]};sa.prototype.getClass=function(){return sa};var pl=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}(hl),zy=function(){this.array_=[]};zy.prototype.addLast=function(t){this.array_.push(t)};zy.prototype.removeFirst=function(){return this.array_.shift()};zy.prototype.isEmpty=function(){return this.array_.length===0};var Yi=function(){this._finder=null,this._dirEdgeList=new gt,this._nodes=new gt,this._rightMostCoord=null,this._env=null,this._finder=new sa};Yi.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Yi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Yi.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 pl("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)}};Yi.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(lt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Yi.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Yi.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)}};Yi.prototype.computeDepths=function(t){var e=this,n=new e1,r=new zy,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))}}}};Yi.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Yi.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Rt,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};Vr.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])}};Vr.prototype.isHole=function(){return this._isHole};Vr.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Vr.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!xt.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};Vr.prototype.addHole=function(t){this._holes.add(t)};Vr.prototype.isShell=function(){return this._shell===null};Vr.prototype.getLabel=function(){return this._label};Vr.prototype.getEdges=function(){return this._edges};Vr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Vr.prototype.getShell=function(){return this._shell};Vr.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}};Vr.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Vr.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};Ho.prototype.isInResult=function(){return this._isInResult};Ho.prototype.isVisited=function(){return this._isVisited};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};var Fy=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 Fn(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 Fn(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 Fn)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}(Ho),aa=function(){this.nodeMap=new ki,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};aa.prototype.find=function(t){return this.nodeMap.get(t)};aa.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 Fy){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};aa.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};aa.prototype.iterator=function(){return this.nodeMap.values().iterator()};aa.prototype.values=function(){return this.nodeMap.values()};aa.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};aa.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};aa.prototype.interfaces_=function(){return[]};aa.prototype.getClass=function(){return aa};var Vn=function(){},Xd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Vn.prototype.interfaces_=function(){return[]};Vn.prototype.getClass=function(){return Vn};Vn.isNorthern=function(t){return t===Vn.NE||t===Vn.NW};Vn.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Vn.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};Vn.isInHalfPlane=function(t,e){return e===Vn.SE?t===Vn.SE||t===Vn.SW:t===e||t===e+1};Vn.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 ar("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Vn.NE:Vn.SE:e>=0?Vn.NW:Vn.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 ar("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Vn.NE:Vn.SE:r.y>=n.y?Vn.NW:Vn.SW}};Xd.NE.get=function(){return 0};Xd.NW.get=function(){return 1};Xd.SW.get=function(){return 2};Xd.SE.get=function(){return 3};Object.defineProperties(Vn,Xd);var Di=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],l=arguments[2],m=arguments[3];this._edge=a,this.init(c,l),this._label=m}};Di.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var 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};To.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};To.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 _R(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};To.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};To.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};To.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)&&xt.isPointInRing(i,w.getCoordinates())&&(E=!0),E&&(a===null||c.contains(S))&&(a=m)}return a};To.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return on.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};To.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];pr.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)}};To.prototype.interfaces_=function(){return[]};To.prototype.getClass=function(){return To};var If=function(){};If.prototype.getBounds=function(){};If.prototype.interfaces_=function(){return[]};If.prototype.getClass=function(){return If};var Ps=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ps.prototype.getItem=function(){return this._item};Ps.prototype.getBounds=function(){return this._bounds};Ps.prototype.interfaces_=function(){return[If,fs]};Ps.prototype.getClass=function(){return Ps};var dl=function(){this._size=null,this._items=null,this._size=0,this._items=new gt,this._items.add(null)};dl.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};dl.prototype.size=function(){return this._size};dl.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)};dl.prototype.clear=function(){this._size=0,this._items.clear()};dl.prototype.isEmpty=function(){return this._size===0};dl.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)};dl.prototype.interfaces_=function(){return[]};dl.prototype.getClass=function(){return dl};var Kl=function(){};Kl.prototype.visitItem=function(t){};Kl.prototype.interfaces_=function(){return[]};Kl.prototype.getClass=function(){return Kl};var Mc=function(){};Mc.prototype.insert=function(t,e){};Mc.prototype.remove=function(t,e){};Mc.prototype.query=function(){};Mc.prototype.interfaces_=function(){return[]};Mc.prototype.getClass=function(){return Mc};var Yr=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}},YI={serialVersionUID:{configurable:!0}};Yr.prototype.getLevel=function(){return this._level};Yr.prototype.size=function(){return this._childBoundables.size()};Yr.prototype.getChildBoundables=function(){return this._childBoundables};Yr.prototype.addChildBoundable=function(t){on.isTrue(this._bounds===null),this._childBoundables.add(t)};Yr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Yr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Yr.prototype.interfaces_=function(){return[If,fs]};Yr.prototype.getClass=function(){return Yr};YI.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Yr,YI);var Ms=function(){};Ms.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ms.min=function(t){return Ms.sort(t),t.get(0)};Ms.sort=function(t,e){var n=t.toArray();e?Au.sort(n,e):Au.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 ar("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}},By={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};_i.prototype.getNodeCapacity=function(){return this._nodeCapacity};_i.prototype.lastNode=function(t){return t.get(t.size()-1)};_i.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 Yr?n+=t.size(i):i instanceof Ps&&(n+=1)}return n}};_i.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ps&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};_i.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 Yr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof Ps?r.add(a.getItem()):on.shouldNeverReachHere()}return r.size()<=0?null:r}};_i.prototype.insert=function(t,e){on.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ps(t,e))};_i.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(on.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 Yr?t.boundablesAtLevel(r,l,a):(on.isTrue(l instanceof Ps),r===-1&&a.add(l))}return null}};_i.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(Ut(arguments[2],Kl)&&arguments[0]instanceof Object&&arguments[1]instanceof Yr)for(var a=arguments[0],c=arguments[1],l=arguments[2],m=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};_i.prototype.createParentBoundables=function(t,e){var n=this;on.isTrue(!t.isEmpty());var r=new gt;r.add(this.createNode(e));var i=new gt(t);Ms.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var c=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};_i.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};_i.prototype.interfaces_=function(){return[fs]};_i.prototype.getClass=function(){return _i};_i.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,P=k):k.expandToQueue(D,E)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var j=arguments[0],$=arguments[1],B=arguments[2],W=new Ps(j,$),X=new Or(this.getRoot(),W,B);return this.nearestNeighbour(X)[0]}},e.prototype.interfaces_=function(){return[Mc,fs]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return n2},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[gf]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[gf]},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}(_i),n2=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 Rt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yr),so=function(){};so.prototype.interfaces_=function(){return[]};so.prototype.getClass=function(){return so};so.relativeSign=function(t,e){return te?1:0};so.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=so.relativeSign(e.x,n.x),i=so.relativeSign(e.y,n.y);switch(t){case 0:return so.compareValue(r,i);case 1:return so.compareValue(i,r);case 2:return so.compareValue(i,-r);case 3:return so.compareValue(-r,i);case 4:return so.compareValue(-r,-i);case 5:return so.compareValue(-i,-r);case 6:return so.compareValue(-i,r);case 7:return so.compareValue(r,-i)}return on.shouldNeverReachHere("invalid octant value"),0};so.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Jl=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))};Jl.prototype.getCoordinate=function(){return this.coord};Jl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Jl.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:so.compare(this._segmentOctant,this.coord,e.coord)};Jl.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Jl.prototype.isInterior=function(){return this._isInterior};Jl.prototype.interfaces_=function(){return[hs]};Jl.prototype.getClass=function(){return Jl};var Ki=function(){this._nodeMap=new ki,this._edge=null;var t=arguments[0];this._edge=t};Ki.prototype.getSplitCoordinates=function(){var t=this,e=new Hd;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()};Ki.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)}};Ki.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Ki.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 ar("Cannot compute the octant for two identical points "+i);return Ac.octant(c,l)}};var Ra=function(){};Ra.prototype.getCoordinates=function(){};Ra.prototype.size=function(){};Ra.prototype.getCoordinate=function(t){};Ra.prototype.isClosed=function(){};Ra.prototype.setData=function(t){};Ra.prototype.getData=function(){};Ra.prototype.interfaces_=function(){return[]};Ra.prototype.getClass=function(){return Ra};var Ad=function(){};Ad.prototype.addIntersection=function(t,e){};Ad.prototype.interfaces_=function(){return[Ra]};Ad.prototype.getClass=function(){return Ad};var Ar=function(){this._nodeList=new Ki(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ar.prototype.getCoordinates=function(){return this._pts};Ar.prototype.size=function(){return this._pts.length};Ar.prototype.getCoordinate=function(t){return this._pts[t]};Ar.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ar.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};Ar.prototype.setData=function(t){this._data=t};Ar.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Ac.octant(t,e)};Ar.prototype.getData=function(){return this._data};Ar.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)}};Ar.prototype.toString=function(){return Ts.toLineString(new Lr(this._pts))};Ar.prototype.getNodeList=function(){return this._nodeList};Ar.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 xt.orientationIndex(this.p0,this.p1,r)}};Nt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Nt.prototype.isVertical=function(){return this.p0.x===this.p1.x};Nt.prototype.equals=function(t){if(!(t instanceof Nt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Nt.prototype.intersection=function(t){var e=new Zu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Nt.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 Nt){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 Nt(c,l)}};Nt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Nt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Nt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Nt.prototype.distancePerpendicular=function(t){return xt.distancePointLinePerpendicular(t,this.p0,this.p1)};Nt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Nt.prototype.midPoint=function(){return Nt.midPoint(this.p0,this.p1)};Nt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return Xt.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};Nt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=Xt.MAX_VALUE,i=null,a=this.closestPoint(t.p0);r=a.distance(t.p0),n[0]=a,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||Xt.isNaN(e))&&(e=1),e};Nt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Nt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Nt.prototype.distance=function(){if(arguments[0]instanceof Nt){var t=arguments[0];return xt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Ne){var e=arguments[0];return xt.distancePointLine(e,this.p0,this.p1)}};Nt.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};Nt.prototype.hashCode=function(){var t=Xt.doubleToLongBits(this.p0.x);t^=Xt.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Xt.doubleToLongBits(this.p1.x);n^=Xt.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};Nt.prototype.interfaces_=function(){return[hs,fs]};Nt.prototype.getClass=function(){return Nt};Nt.midPoint=function(t,e){return new Ne((t.x+e.x)/2,(t.y+e.y)/2)};JI.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Nt,JI);var kd=function(){this.tempEnv1=new Rt,this.tempEnv2=new Rt,this._overlapSeg1=new Nt,this._overlapSeg2=new Nt};kd.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)}};kd.prototype.interfaces_=function(){return[]};kd.prototype.getClass=function(){return kd};var Lo=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};Lo.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Lo.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=Vn.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 r2},Object.defineProperties(e,n),e}(Dd),r2=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}(kd),Pn=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)}}},xl={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}};Pn.prototype.getEndCapStyle=function(){return this._endCapStyle};Pn.prototype.isSingleSided=function(){return this._isSingleSided};Pn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Pn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Pn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Pn.JOIN_ROUND&&(this._quadrantSegments=Pn.DEFAULT_QUADRANT_SEGMENTS)};Pn.prototype.getJoinStyle=function(){return this._joinStyle};Pn.prototype.setJoinStyle=function(t){this._joinStyle=t};Pn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Pn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Pn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Pn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Pn.prototype.getMitreLimit=function(){return this._mitreLimit};Pn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Pn.prototype.setSingleSided=function(t){this._isSingleSided=t};Pn.prototype.interfaces_=function(){return[]};Pn.prototype.getClass=function(){return Pn};Pn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};xl.CAP_ROUND.get=function(){return 1};xl.CAP_FLAT.get=function(){return 2};xl.CAP_SQUARE.get=function(){return 3};xl.JOIN_ROUND.get=function(){return 1};xl.JOIN_MITRE.get=function(){return 2};xl.JOIN_BEVEL.get=function(){return 3};xl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};xl.DEFAULT_MITRE_LIMIT.get=function(){return 5};xl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Pn,xl);var xr=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=xt.COUNTERCLOCKWISE,this._inputLine=t||null},Yd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};xr.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)};xr.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};Zo.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=xn.PI_TIMES_2;for(;t<=-Math.PI;)t+=xn.PI_TIMES_2;return t};xn.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)}};xn.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};xn.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};xn.interiorAngle=function(t,e,n){var r=xn.angle(e,t),i=xn.angle(e,n);return Math.abs(i-r)};xn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=xn.PI_TIMES_2;t>=xn.PI_TIMES_2&&(t=0)}else{for(;t>=xn.PI_TIMES_2;)t-=xn.PI_TIMES_2;t<0&&(t=0)}return t};xn.angleBetween=function(t,e,n){var r=xn.angle(e,t),i=xn.angle(e,n);return xn.diff(r,i)};xn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};xn.toRadians=function(t){return t*Math.PI/180};xn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?xn.COUNTERCLOCKWISE:n<0?xn.CLOCKWISE:xn.NONE};xn.angleBetweenOriented=function(t,e,n){var r=xn.angle(e,t),i=xn.angle(e,n),a=i-r;return a<=-Math.PI?a+xn.PI_TIMES_2:a>Math.PI?a-xn.PI_TIMES_2:a};Yc.PI_TIMES_2.get=function(){return 2*Math.PI};Yc.PI_OVER_2.get=function(){return Math.PI/2};Yc.PI_OVER_4.get=function(){return Math.PI/4};Yc.COUNTERCLOCKWISE.get=function(){return xt.COUNTERCLOCKWISE};Yc.CLOCKWISE.get=function(){return xt.CLOCKWISE};Yc.NONE.get=function(){return xt.COLLINEAR};Object.defineProperties(xn,Yc);var tr=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 Nt,this._seg1=new Nt,this._offset0=new Nt,this._offset1=new Nt,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 Zu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Pn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Kd={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}};tr.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=xt.computeOrientation(this._s0,this._s1,this._s2),r=n===xt.CLOCKWISE&&this._side===lt.LEFT||n===xt.COUNTERCLOCKWISE&&this._side===lt.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};tr.prototype.addLineEndCap=function(t,e){var n=new Nt(t,e),r=new Nt;this.computeOffsetSegment(n,lt.LEFT,this._distance,r);var i=new Nt;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 Pn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,xt.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Pn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Pn.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}};tr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};tr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Is.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:a.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(l){if(l instanceof Gf)a=new Ne(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};tr.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===xt.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)};tr.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)}};tr.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()};tr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};tr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Zo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*tr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};tr.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()===Pn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Pn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,xt.CLOCKWISE,this._distance))};tr.prototype.closeRing=function(){this._segList.closeRing()};tr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};tr.prototype.interfaces_=function(){return[]};tr.prototype.getClass=function(){return tr};Kd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Kd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Kd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Kd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(tr,Kd);var lo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};lo.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&&yn.reverse(a),a};lo.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=xr.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=xr.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()};lo.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===lt.RIGHT&&(r=-r);var i=xr.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()};lo.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=xr.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=xr.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()};lo.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Pn.CAP_ROUND:e.createCircle(t);break;case Pn.CAP_SQUARE:e.createSquare(t);break}};lo.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};lo.prototype.getBufferParameters=function(){return this._bufParams};lo.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};lo.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return lo.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};lo.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=xr.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=xr.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()};lo.prototype.getSegGen=function(t){return new tr(this._precisionModel,this._bufParams,t)};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};lo.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;na.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ut(arguments[2],Cs)&&arguments[0]instanceof Ne&&arguments[1]instanceof cv)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)&&xt.computeOrientation(t._seg.p0,t._seg.p1,c)!==xt.RIGHT){var P=l.getDepth(lt.LEFT);t._seg.p0.equals(w[S])||(P=l.getDepth(lt.RIGHT));var D=new Ou(t._seg,P);m.add(D)}}else if(Ut(arguments[2],Cs)&&arguments[0]instanceof Ne&&Ut(arguments[1],Cs))for(var k=arguments[0],U=arguments[1],j=arguments[2],$=U.iterator();$.hasNext();){var B=$.next();B.isForward()&&t.findStabbedSegments(k,B,j)}}};kc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ms.min(e);return n._leftDepth};kc.prototype.interfaces_=function(){return[]};kc.prototype.getClass=function(){return kc};$I.DepthSegment.get=function(){return Ou};Object.defineProperties(kc,$I);var Ou=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Nt(t),this._leftDepth=e};Ou.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};Ou.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Ou.prototype.toString=function(){return this._upwardSeg.toString()};Ou.prototype.interfaces_=function(){return[hs]};Ou.prototype.getClass=function(){return Ou};var An=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};An.prototype.area=function(){return An.area(this.p0,this.p1,this.p2)};An.prototype.signedArea=function(){return An.signedArea(this.p0,this.p1,this.p2)};An.prototype.interpolateZ=function(t){if(t===null)throw new ar("Supplied point is null.");return An.interpolateZ(t,this.p0,this.p1,this.p2)};An.prototype.longestSideLength=function(){return An.longestSideLength(this.p0,this.p1,this.p2)};An.prototype.isAcute=function(){return An.isAcute(this.p0,this.p1,this.p2)};An.prototype.circumcentre=function(){return An.circumcentre(this.p0,this.p1,this.p2)};An.prototype.area3D=function(){return An.area3D(this.p0,this.p1,this.p2)};An.prototype.centroid=function(){return An.centroid(this.p0,this.p1,this.p2)};An.prototype.inCentre=function(){return An.inCentre(this.p0,this.p1,this.p2)};An.prototype.interfaces_=function(){return[]};An.prototype.getClass=function(){return An};An.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)};An.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};An.det=function(t,e,n,r){return t*r-e*n};An.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,P=t.y-a,D=(w*E-l*P)/S,k=(-m*E+c*P)/S,U=e.z+D*(n.z-e.z)+k*(r.z-e.z);return U};An.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};An.isAcute=function(t,e,n){return!(!xn.isAcute(t,e,n)||!xn.isAcute(e,n,t)||!xn.isAcute(n,t,e))};An.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*An.det(a,c,l,m),S=An.det(c,a*a+c*c,m,l*l+m*m),E=An.det(a,a*a+c*c,l,l*l+m*m),P=r-S/w,D=i+E/w;return new Ne(P,D)};An.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Is(t.x+n/2,t.y+r/2,1),a=new Is(t.x-r+n/2,t.y+n+r/2,1);return new Is(i,a)};An.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};An.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,P=w*w+S*S+E*E,D=Math.sqrt(P)/2;return D};An.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)};An.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 cs=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};cs.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,ze.EXTERIOR,ze.INTERIOR)};cs.prototype.addPolygon=function(t){var e=this,n=this._distance,r=lt.LEFT;this._distance<0&&(n=-this._distance,r=lt.RIGHT);var i=t.getExteriorRing(),a=yn.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)}};cs.prototype.isTriangleErodedCompletely=function(t,e){var n=new An(t[0],t[1],t[2]),r=n.inCentre(),i=xt.distancePointLine(r,n.p0,n.p1);return i=ka.MINIMUM_VALID_SIZE&&xt.isCCW(t)&&(a=i,c=r,n=lt.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,a,c)};cs.prototype.add=function(t){if(t.isEmpty())return null;t instanceof ei?this.addPolygon(t):t instanceof br?this.addLineString(t):t instanceof Co?this.addPoint(t):t instanceof Sf?this.addCollection(t):t instanceof Ru?this.addCollection(t):t instanceof La?this.addCollection(t):t instanceof Xi&&this.addCollection(t)};cs.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};cs.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new qf;var t=this._parent.getGeometryN(this._index++);return t instanceof Xi?(this._subcollectionIterator=new Pa(t),this._subcollectionIterator.next()):t};Pa.prototype.remove=function(){throw new Error(this.getClass().getName())};Pa.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)};Pa.prototype.interfaces_=function(){return[jf]};Pa.prototype.getClass=function(){return Pa};Pa.isAtomic=function(t){return!(t instanceof Xi)};var jo=function(){this._geom=null;var t=arguments[0];this._geom=t};jo.prototype.locate=function(t){return jo.locate(t,this._geom)};jo.prototype.interfaces_=function(){return[Tf]};jo.prototype.getClass=function(){return jo};jo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?xt.isPointInRing(t,e.getCoordinates()):!1};jo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!jo.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 pl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],E=arguments[2],P=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&&(on.isTrue(i!==null,"found null for first outgoing dirEdge"),on.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],c=0,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 Fn(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}(Ri),eC=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 Fy(n,new bR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ef),Ql=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Ql.prototype.compareTo=function(t){var e=t,n=Ql.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};Ql.prototype.interfaces_=function(){return[hs]};Ql.prototype.getClass=function(){return Ql};Ql.orientation=function(t){return yn.increasingDirection(t)===1};Ql.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,P=w===l;if(E&&!P)return-1;if(!E&&P)return 1;if(E&&P)return 0}};var As=function(){this._edges=new gt,this._ocaMap=new ki};As.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),a=0;a0&&t.print(","),t.print(i[a].x+" "+i[a].y);t.println(")")}t.print(") ")};As.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};As.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),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 uy(c,new Fn(this.edge._label))};Na.prototype.add=function(t,e,n){var r=new la(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Na.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Na.prototype.interfaces_=function(){return[]};Na.prototype.getClass=function(){return Na};var Fu=function(){};Fu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new gt;r.add(new na(n));do{var i=e.findChainEnd(t,n);r.add(new na(i)),n=i}while(nn?e:n};ml.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ei.prototype.getDelta=function(t){return this._depth[t][lt.RIGHT]-this._depth[t][lt.LEFT]};Ei.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?ze.EXTERIOR:ze.INTERIOR};Ei.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ei.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===ze.EXTERIOR||i===ze.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ei.depthAtLocation(i):t._depth[n][r]+=Ei.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],l=arguments[2];l===ze.INTERIOR&&this._depth[a][c]++}};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.depthAtLocation=function(t){return t===ze.EXTERIOR?0:t===ze.INTERIOR?1:Ei.NULL_VALUE};tC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ei,tC);var uy=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Na(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ei,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,Fn.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 ml(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Rt;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 on.isTrue(!(c&&l),"Found bad envelope test"),l};uo.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)};uo.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))};uo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};uo.prototype.getCoordinate=function(){return this._originalPt};uo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};uo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=uo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Rt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};uo.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()))};uo.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))};uo.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};uo.prototype.interfaces_=function(){return[]};uo.prototype.getClass=function(){return uo};rC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(uo,rC);var Rd=function(){this.tempEnv1=new Rt,this.selectedSegment=new Nt};Rd.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)}};Rd.prototype.interfaces_=function(){return[]};Rd.prototype.getClass=function(){return Rd};var Lf=function(){this._index=null;var t=arguments[0];this._index=t},iC={HotPixelSnapAction:{configurable:!0}};Lf.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 oC(e,n,r);return this._index.query(i,{interfaces_:function(){return[Kl]},visitItem:function(c){var l=c;l.select(i,a)}}),a.isNodeAdded()}};Lf.prototype.interfaces_=function(){return[]};Lf.prototype.getClass=function(){return Lf};iC.HotPixelSnapAction.get=function(){return oC};Object.defineProperties(Lf,iC);var oC=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}(Rd),Dc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new gt};Dc.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 pl)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 Mn(r);this.bufferFixedPrecision(i)}};Si.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Mn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Si.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Si.prototype.bufferOriginalPrecision=function(){try{var t=new Wi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof hl)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 Vt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],l=new Si(i);l.setQuadrantSegments(c);var m=l.getResultGeometry(a);return m}else if(arguments[2]instanceof Pn&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],E=arguments[2],P=new Si(w,E),D=P.getResultGeometry(S);return D}}else if(arguments.length===4){var k=arguments[0],U=arguments[1],j=arguments[2],$=arguments[3],B=new Si(k);B.setQuadrantSegments(j),B.setEndCapStyle($);var W=B.getResultGeometry(U);return W}};Si.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Wo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=e>0?e:0,c=i+2*a,l=Math.trunc(Math.log(c)/Math.log(10)+1),m=n-l,w=Math.pow(10,m);return w};Wf.CAP_ROUND.get=function(){return Pn.CAP_ROUND};Wf.CAP_BUTT.get=function(){return Pn.CAP_FLAT};Wf.CAP_FLAT.get=function(){return Pn.CAP_FLAT};Wf.CAP_SQUARE.get=function(){return Pn.CAP_SQUARE};Wf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Si,Wf);var Gi=function(){this._pt=[new Ne,new Ne],this._distance=Xt.NaN,this._isNull=!0};Gi.prototype.getCoordinates=function(){return this._pt};Gi.prototype.getCoordinate=function(t){return this._pt[t]};Gi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};var Ia=function(){};Ia.prototype.interfaces_=function(){return[]};Ia.prototype.getClass=function(){return Ia};Ia.computeDistance=function(){if(arguments[2]instanceof Gi&&arguments[0]instanceof br&&arguments[1]instanceof Ne)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Nt,a=0;a0||this._isIn?ze.INTERIOR:ze.EXTERIOR)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var ji=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}},sC={INSIDE_AREA:{configurable:!0}};ji.prototype.isInsideArea=function(){return this._segIndex===ji.INSIDE_AREA};ji.prototype.getCoordinate=function(){return this._pt};ji.prototype.getGeometryComponent=function(){return this._component};ji.prototype.getSegmentIndex=function(){return this._segIndex};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};sC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(ji,sC);var Hl=function(t){this._pts=t||null};Hl.prototype.filter=function(t){t instanceof Co&&this._pts.add(t)};Hl.prototype.interfaces_=function(){return[ia]};Hl.prototype.getClass=function(){return Hl};Hl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Co?Ms.singletonList(t):Hl.getPoints(t,new gt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Co?n.add(e):e instanceof Xi&&e.apply(new Hl(n)),n}};var Nc=function(){this._locations=null;var t=arguments[0];this._locations=t};Nc.prototype.filter=function(t){(t instanceof Co||t instanceof br||t instanceof ei)&&this._locations.add(new ji(t,0,t.getCoordinate()))};Nc.prototype.interfaces_=function(){return[ia]};Nc.prototype.getClass=function(){return Nc};Nc.getLocations=function(t){var e=new gt;return t.apply(new Nc(e)),e};var Ci=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ks,this._minDistanceLocation=null,this._minDistance=Xt.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ci.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=ul.getPolygons(this._geom[n]);if(a.size()>0){var c=Nc.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ut(arguments[0],Cs)&&Ut(arguments[1],Cs)){for(var 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)}};Ai.prototype.interfaces_=function(){return[]};Ai.prototype.getClass=function(){return Ai};var Ks=function(){};Ks.prototype.interfaces_=function(){return[]};Ks.prototype.getClass=function(){return Ks};Ks.computeDistance=function(){if(arguments[2]instanceof Ai&&arguments[0]instanceof br&&arguments[1]instanceof Ne)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Nt,i=t.getCoordinates(),a=0;a1||t<=0)throw new ar("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ss.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ss.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ss.prototype.computeOrientedDistance=function(t,e,n){var r=new Oc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new tu(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ss.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ss(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ss(r,i);return c.setDensifyFraction(a),c.distance()}};l1.MaxPointDistanceFilter.get=function(){return Oc};l1.MaxDensifiedByFractionDistanceFilter.get=function(){return tu};Object.defineProperties(ss,l1);var Oc=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._euclideanDist=new Ks,this._geom=null;var t=arguments[0];this._geom=t};Oc.prototype.filter=function(t){this._minPtDist.initialize(),Ks.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Oc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Oc.prototype.interfaces_=function(){return[Aa]};Oc.prototype.getClass=function(){return Oc};var tu=function(){this._maxPtDist=new Ai,this._minPtDist=new Ai,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};tu.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 "+Ts.toLineString(i[0],i[1])+")"}};So.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=So.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(),So.VERBOSE&&Ii.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};So.prototype.checkNegativeValid=function(){if(!(this._input instanceof ei||this._input instanceof La||this._input instanceof Xi))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)};So.prototype.getErrorIndicator=function(){return this._errorIndicator};So.prototype.checkMinimumDistance=function(t,e,n){var r=new Ci(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ti.prototype.report=function(t){if(!Ti.VERBOSE)return null;Ii.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Ti.prototype.getErrorMessage=function(){return this._errorMsg};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};Ti.isValidMsg=function(t,e,n){var r=new Ti(t,e,n);return r.isValid()?null:r.getErrorMessage()};Ti.isValid=function(t,e,n){var r=new Ti(t,e,n);return!!r.isValid()};c1.VERBOSE.get=function(){return!1};c1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ti,c1);var ca=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ca.prototype.getCoordinates=function(){return this._pts};ca.prototype.size=function(){return this._pts.length};ca.prototype.getCoordinate=function(t){return this._pts[t]};ca.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ca.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ac.octant(this.getCoordinate(t),this.getCoordinate(t+1))};ca.prototype.setData=function(t){this._data=t};ca.prototype.getData=function(){return this._data};ca.prototype.toString=function(){return Ts.toLineString(new Lr(this._pts))};ca.prototype.interfaces_=function(){return[Ra]};ca.prototype.getClass=function(){return ca};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[zu]};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 Ds=function(){this._li=new Zu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ds.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ds.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ds.prototype.isValid=function(){return this.execute(),this._isValid};Ds.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ds.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new s1;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ds.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new pl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ds.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ts.toLineString(t[0],t[1])+" and "+Ts.toLineString(t[2],t[3])};Ds.prototype.interfaces_=function(){return[]};Ds.prototype.getClass=function(){return Ds};Ds.computeIntersections=function(t){var e=new Ds(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Vu=function t(){this._nv=null;var e=arguments[0];this._nv=new Ds(t.toSegmentStrings(e))};Vu.prototype.checkValid=function(){this._nv.checkValid()};Vu.prototype.interfaces_=function(){return[]};Vu.prototype.getClass=function(){return Vu};Vu.toSegmentStrings=function(t){for(var e=new gt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new ca(r.getCoordinates(),r))}return e};Vu.checkValid=function(t){var e=new Vu(t);e.checkValid()};var zc=function(t){this._mapOp=t};zc.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)};co.prototype.interfaces_=function(){return[]};co.prototype.getClass=function(){return co};var za=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Nt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof br&&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}};za.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)}};za.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=Xt.MAX_VALUE,i=-1,a=0;ae&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Pr.computeOverlaySnapTolerance(i),Pr.computeOverlaySnapTolerance(a))}};Pr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Pr.SNAP_PRECISION_FACTOR;return r};Pr.snapToSelf=function(t,e,n){var r=new Pr(t);return r.snapToSelf(e,n)};aC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Pr,aC);var lC=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 za(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}(co),Ui=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Ui.prototype.getCommon=function(){return Xt.longBitsToDouble(this._commonBits)};Ui.prototype.add=function(t){var e=Xt.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Ui.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Ui.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Ui.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Ui.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Ui.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Xt.longBitsToDouble(t),n=Xt.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return a}};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.getBit=function(t,e){var n=1<>52};Ui.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Ui.getBit(t,r)!==Ui.getBit(e,r))return n;n++}return 52};var nu=function(){this._commonCoord=null,this._ccFilter=new Bc},h1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};nu.prototype.addCommonBits=function(t){var e=new ru(this._commonCoord);t.apply(e),t.geometryChanged()};nu.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 ru(e);return t.apply(n),t.geometryChanged(),t};nu.prototype.getCommonCoordinate=function(){return this._commonCoord};nu.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};nu.prototype.interfaces_=function(){return[]};nu.prototype.getClass=function(){return nu};h1.CommonCoordinateFilter.get=function(){return Bc};h1.Translater.get=function(){return ru};Object.defineProperties(nu,h1);var Bc=function(){this._commonBitsX=new Ui,this._commonBitsY=new Ui};Bc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Bc.prototype.getCommonCoordinate=function(){return new Ne(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Bc.prototype.interfaces_=function(){return[Aa]};Bc.prototype.getClass=function(){return Bc};var ru=function(){this.trans=null;var t=arguments[0];this.trans=t};ru.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)};ru.prototype.isDone=function(){return!1};ru.prototype.isGeometryChanged=function(){return!0};ru.prototype.interfaces_=function(){return[Ls]};ru.prototype.getClass=function(){return ru};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 Pr(t),n=e.snapTo(t,this._snapTolerance);return n};bi.prototype.removeCommonBits=function(t){this._cbr=new nu,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=en.overlayOp(e[0],e[1],t);return this.prepareResult(n)};bi.prototype.checkValid=function(t){t.isValid()||Ii.out.println("Snapped geometry is invalid")};bi.prototype.computeSnapTolerance=function(){this._snapTolerance=Pr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};bi.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Pr.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,en.UNION)};bi.intersection=function(t,e){return bi.overlayOp(t,e,en.INTERSECTION)};bi.symDifference=function(t,e){return bi.overlayOp(t,e,en.SYMDIFFERENCE)};bi.difference=function(t,e){return bi.overlayOp(t,e,en.DIFFERENCE)};var Ji=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Ji.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=en.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof hl)r=a;else throw a}finally{}if(!n)try{e=bi.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof hl?r:a}finally{}return e};Ji.prototype.interfaces_=function(){return[]};Ji.prototype.getClass=function(){return Ji};Ji.overlayOp=function(t,e,n){var r=new Ji(t,e);return r.getResultGeometry(n)};Ji.union=function(t,e){return Ji.overlayOp(t,e,en.UNION)};Ji.intersection=function(t,e){return Ji.overlayOp(t,e,en.INTERSECTION)};Ji.symDifference=function(t,e){return Ji.overlayOp(t,e,en.SYMDIFFERENCE)};Ji.difference=function(t,e){return Ji.overlayOp(t,e,en.DIFFERENCE)};var Nd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Nd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Nd.prototype.interfaces_=function(){return[]};Nd.prototype.getClass=function(){return Nd};var Po=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}},f1={INSERT:{configurable:!0},DELETE:{configurable:!0}};Po.prototype.isDelete=function(){return this._eventType===Po.DELETE};Po.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};Po.prototype.getObject=function(){return this._obj};Po.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};Po.prototype.getInsertEvent=function(){return this._insertEvent};Po.prototype.isInsert=function(){return this._eventType===Po.INSERT};Po.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};Po.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Po.prototype.interfaces_=function(){return[hs]};Po.prototype.getClass=function(){return Po};f1.INSERT.get=function(){return 1};f1.DELETE.get=function(){return 2};Object.defineProperties(Po,f1);var cy=function(){};cy.prototype.interfaces_=function(){return[]};cy.prototype.getClass=function(){return cy};var Li=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};Li.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Li.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Li.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Li.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Li.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Li.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Li.prototype.hasProperIntersection=function(){return this._hasProper};Li.prototype.hasIntersection=function(){return this._hasIntersection};Li.prototype.isDone=function(){return this._isDone};Li.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Li.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Li.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],a=t.getCoordinates()[e+1],c=n.getCoordinates()[r],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))))};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var xR=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;Ms.sort(this.events);for(var r=0;re||this._maxa?1:0};Od.prototype.interfaces_=function(){return[gf]};Od.prototype.getClass=function(){return Od};var wR=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}(Fa),SR=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}(Fa),Ba=function(){this._leaves=new gt,this._root=null,this._level=0};Ba.prototype.buildTree=function(){var t=this;Ms.sort(this._leaves,new Fa.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}};Ba.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 wR(t,e,n))};Ba.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};Ba.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Ba.prototype.printNode=function(t){Ii.out.println(Ts.toLineString(new Ne(t._min,this._level),new Ne(t._max,this._level)))};Ba.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Ba.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=yn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,l=i;xt.isCCW(a)&&(c=i,l=r);var m=new uy(a,new Fn(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 Fn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new xR},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 La&&(this._useBoundaryDeterminationRule=!1),n instanceof ei)this.addPolygon(n);else if(n instanceof br)this.addLineString(n);else if(n instanceof Co)this.addPoint(n);else if(n instanceof Sf)this.addCollection(n);else if(n instanceof Ru)this.addCollection(n);else if(n instanceof La)this.addCollection(n);else if(n instanceof Xi)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 Mf(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}(pr),kf=function(){if(this._li=new Zu,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 td(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=ls.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new td(0,e,r),this._arg[1]=new td(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 td(0,i,c),this._arg[1]=new td(1,a,c)}};kf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};kf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};kf.prototype.interfaces_=function(){return[]};kf.prototype.getClass=function(){return kf};var ku=function(){};ku.prototype.interfaces_=function(){return[]};ku.prototype.getClass=function(){return ku};ku.map=function(){if(arguments[0]instanceof Vt&&Ut(arguments[1],ku.MapOp)){for(var t=arguments[0],e=arguments[1],n=new gt,r=0;r=t.size()?null:t.get(e)};Br.union=function(t){var e=new Br(t);return e.union()};hC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Br,hC);var hy=function(){};hy.prototype.interfaces_=function(){return[]};hy.prototype.getClass=function(){return hy};hy.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return en.createEmptyResult(en.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Ji.overlayOp(t,e,en.UNION)};function Xu(){return new fy}function fy(){this.reset()}fy.prototype={constructor:fy,reset:function(){this.s=this.t=0},add:function(t){i2(pg,t,this.t),i2(this,pg.s,this.s),this.s?this.t+=pg.t:this.s=pg.t},valueOf:function(){return this.s}};var pg=new fy;function i2(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var vr=1e-6,Hn=Math.PI,ll=Hn/2,o2=Hn/4,gl=Hn*2,Cu=180/Hn,Zs=Hn/180,qi=Math.abs,ER=Math.atan,Rf=Math.atan2,Zr=Math.cos,Xr=Math.sin,Hf=Math.sqrt;function fC(t){return t>1?0:t<-1?Hn:Math.acos(t)}function Vc(t){return t>1?ll:t<-1?-ll:Math.asin(t)}function ud(){}function py(t,e){t&&a2.hasOwnProperty(t.type)&&a2[t.type](t,e)}var s2={Feature:function(t,e){py(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rHn?t-gl:t<-Hn?t+gl:t,e]}dv.invert=dv;function CR(t,e,n){return(t%=gl)?e||n?pC(c2(t),h2(e,n)):c2(t):e||n?h2(e,n):dv}function u2(t){return function(e,n){return e+=t,[e>Hn?e-gl:e<-Hn?e+gl:e,n]}}function c2(t){var e=u2(t);return e.invert=u2(-t),e}function h2(t,e){var n=Zr(t),r=Xr(t),i=Zr(e),a=Xr(e);function c(l,m){var w=Zr(m),S=Zr(l)*w,E=Xr(l)*w,P=Xr(m),D=P*n+S*r;return[Rf(E*i-D*a,S*n-P*r),Vc(D*i+E*a)]}return c.invert=function(l,m){var w=Zr(m),S=Zr(l)*w,E=Xr(l)*w,P=Xr(m),D=P*i-E*a;return[Rf(E*i+P*a,S*n+D*r),Vc(D*n-S*r)]},c}function TR(t,e,n,r,i,a){if(n){var c=Zr(e),l=Xr(e),m=r*n;i==null?(i=e+r*gl,a=e-m/2):(i=f2(c,i),a=f2(c,a),(r>0?ia)&&(i+=r*gl));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 LR(t,e,n,r,i,a){var c=t[0],l=t[1],m=e[0],w=e[1],S=0,E=1,P=m-c,D=w-l,k;if(k=n-c,!(!P&&k>0)){if(k/=P,P<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=i-c,!(!P&&k<0)){if(k/=P,P<0){if(k>E)return;k>S&&(S=k)}else if(P>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*P,t[1]=l+S*D),E<1&&(e[0]=c+E*P,e[1]=l+E*D),!0}}}}}function kg(t,e){return qi(t[0]-e[0])=0;--l)i.point((E=S[l])[0],E[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,D=!D}while(!P.v);i.lineEnd()}}}function p2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function PR(t){return t.length===1&&(t=MR(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 MR(t){return function(e,n){return gC(t(e),n)}}PR(gC);function yC(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 cd=1e9,yg=-cd;function AR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,E,P){var D=0,k=0;if(w==null||(D=c(w,E))!==(k=c(S,E))||m(w,S)<0^E>0)do P.point(D===0||D===3?t:n,D>1?r:e);while((D=(D+E+4)%4)!==k);else P.point(S[0],S[1])}function c(w,S){return qi(w[0]-t)0?0:3:qi(w[0]-n)0?2:1:qi(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),P=c(S,1);return E!==P?E-P: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=dC(),P,D,k,U,j,$,B,W,X,re,ge,pe={point:oe,lineStart:ne,lineEnd:Ke,polygonStart:Te,polygonEnd:Z};function oe(Ze,tt){i(Ze,tt)&&S.point(Ze,tt)}function fe(){for(var Ze=0,tt=0,je=D.length;ttr&&(Tn-At)*(r-hn)>(_n-hn)*(t-At)&&++Ze:_n<=r&&(Tn-At)*(r-hn)<(_n-hn)*(t-At)&&--Ze;return Ze}function Te(){S=E,P=[],D=[],ge=!0}function Z(){var Ze=fe(),tt=ge&&Ze,je=(P=yC(P)).length;(tt||je)&&(w.polygonStart(),tt&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),je&&mC(P,l,Ze,a,w),w.polygonEnd()),S=w,P=D=k=null}function ne(){pe.point=Ee,D&&D.push(k=[]),re=!0,X=!1,B=W=NaN}function Ke(){P&&(Ee(U,j),$&&X&&E.rejoin(),P.push(E.result())),pe.point=oe,X&&S.lineEnd()}function Ee(Ze,tt){var je=i(Ze,tt);if(D&&k.push([Ze,tt]),re)U=Ze,j=tt,$=je,re=!1,je&&(S.lineStart(),S.point(Ze,tt));else if(je&&X)S.point(Ze,tt);else{var Ot=[B=Math.max(yg,Math.min(cd,B)),W=Math.max(yg,Math.min(cd,W))],wt=[Ze=Math.max(yg,Math.min(cd,Ze)),tt=Math.max(yg,Math.min(cd,tt))];LR(Ot,wt,t,e,n,r)?(X||(S.lineStart(),S.point(Ot[0],Ot[1])),S.point(wt[0],wt[1]),je||S.lineEnd(),ge=!1):je&&(S.lineStart(),S.point(Ze,tt),ge=!1)}B=Ze,W=tt,X=je}return pe}}var I0=Xu();function kR(t,e){var n=e[0],r=e[1],i=[Xr(n),-Zr(n),0],a=0,c=0;I0.reset();for(var l=0,m=t.length;l=0?1:-1,oe=pe*ge,fe=oe>Hn,Te=k*X;if(I0.add(Rf(Te*pe*Xr(oe),U*re+Te*Zr(oe))),a+=fe?ge+pe*gl:ge,fe^P>=n^B>=n){var Z=dy(Nf(E),Nf($));pv(Z);var ne=dy(i,Z);pv(ne);var Ke=(fe^ge>=0?-1:1)*Vc(ne[2]);(r>Ke||r===Ke&&(Z[0]||Z[1]))&&(c+=fe^ge>=0?1:-1)}}return(a<-vr||azd&&(zd=t),egy&&(gy=e)}Xu();function _C(t,e,n,r){return function(i,a){var c=e(a),l=i.invert(r[0],r[1]),m=dC(),w=e(m),S=!1,E,P,D,k={point:U,lineStart:$,lineEnd:B,polygonStart:function(){k.point=W,k.lineStart=X,k.lineEnd=re,P=[],E=[]},polygonEnd:function(){k.point=U,k.lineStart=$,k.lineEnd=B,P=yC(P);var ge=kR(E,l);P.length?(S||(a.polygonStart(),S=!0),mC(P,NR,ge,n,a)):ge&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),P=E=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function U(ge,pe){var oe=i(ge,pe);t(ge=oe[0],pe=oe[1])&&a.point(ge,pe)}function j(ge,pe){var oe=i(ge,pe);c.point(oe[0],oe[1])}function $(){k.point=j,c.lineStart()}function B(){k.point=U,c.lineEnd()}function W(ge,pe){D.push([ge,pe]);var oe=i(ge,pe);w.point(oe[0],oe[1])}function X(){w.lineStart(),D=[]}function re(){W(D[0][0],D[0][1]),w.lineEnd();var ge=w.clean(),pe=m.result(),oe,fe=pe.length,Te,Z,ne;if(D.pop(),E.push(D),D=null,!!fe){if(ge&1){if(Z=pe[0],(Te=Z.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),oe=0;oe1&&ge&2&&pe.push(pe.pop().concat(pe.shift())),P.push(pe.filter(RR))}}return k}}function RR(t){return t.length>1}function NR(t,e){return((t=t.x)[0]<0?t[1]-ll-vr:ll-t[1])-((e=e.x)[0]<0?e[1]-ll-vr:ll-e[1])}const g2=_C(function(){return!0},OR,FR,[-Hn,-ll]);function OR(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,m=qi(a-e);qi(m-Hn)0?ll:-ll),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(a,n),i=0):r!==l&&m>=Hn&&(qi(e-r)vr?ER((Xr(e)*(a=Zr(r))*Xr(n)-Xr(r)*(i=Zr(e))*Xr(t))/(i*a*c)):(e+r)/2}function FR(t,e,n,r){var i;if(t==null)i=n*ll,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(qi(t[0]-e[0])>vr){var a=t[0]0,i=qi(n)>vr;function a(S,E,P,D){TR(D,t,e,P,S,E)}function c(S,E){return Zr(S)*Zr(E)>n}function l(S){var E,P,D,k,U;return{lineStart:function(){k=D=!1,U=1},point:function(j,$){var B=[j,$],W,X=c(j,$),re=r?X?0:w(j,$):X?w(j+(j<0?Hn:-Hn),$):0;if(!E&&(k=D=X)&&S.lineStart(),X!==D&&(W=m(E,B),(!W||kg(E,W)||kg(B,W))&&(B[0]+=vr,B[1]+=vr,X=c(B[0],B[1]))),X!==D)U=0,X?(S.lineStart(),W=m(B,E),S.point(W[0],W[1])):(W=m(E,B),S.point(W[0],W[1]),S.lineEnd()),E=W;else if(i&&E&&r^X){var ge;!(re&P)&&(ge=m(B,E,!0))&&(U=0,r?(S.lineStart(),S.point(ge[0][0],ge[0][1]),S.point(ge[1][0],ge[1][1]),S.lineEnd()):(S.point(ge[1][0],ge[1][1]),S.lineEnd(),S.lineStart(),S.point(ge[0][0],ge[0][1])))}X&&(!E||!kg(E,B))&&S.point(B[0],B[1]),E=B,D=X,P=re},lineEnd:function(){D&&S.lineEnd(),E=null},clean:function(){return U|(k&&D)<<1}}}function m(S,E,P){var D=Nf(S),k=Nf(E),U=[1,0,0],j=dy(D,k),$=dg(j,j),B=j[0],W=$-B*B;if(!W)return!P&&S;var X=n*$/W,re=-n*B/W,ge=dy(U,j),pe=mg(U,X),oe=mg(j,re);E0(pe,oe);var fe=ge,Te=dg(pe,fe),Z=dg(fe,fe),ne=Te*Te-Z*(dg(pe,pe)-1);if(!(ne<0)){var Ke=Hf(ne),Ee=mg(fe,(-Te-Ke)/Z);if(E0(Ee,pe),Ee=fv(Ee),!P)return Ee;var Ze=S[0],tt=E[0],je=S[1],Ot=E[1],wt;tt0^Ee[1]<(qi(Ee[0]-Ze)Hn^(Ze<=Ee[0]&&Ee[0]<=tt)){var hn=mg(fe,(-Te+Ke)/Z);return E0(hn,pe),[Ee,fv(hn)]}}}function w(S,E){var P=r?t:Hn-t,D=0;return S<-P?D|=1:S>P&&(D|=2),E<-P?D|=4:E>P&&(D|=8),D}return _C(c,l,a,r?[0,-t]:[-Hn,t-Hn])}function vC(t){return function(e){var n=new mv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function mv(){}mv.prototype={constructor:mv,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 bC(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),IR(n,t.stream(m2));var c=m2.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 VR(t,e,n){return bC(t,[[0,0],e],n)}var y2=16,UR=Zr(30*Zs);function _2(t,e){return+e?jR(t,e):GR(t)}function GR(t){return vC({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function jR(t,e){function n(r,i,a,c,l,m,w,S,E,P,D,k,U,j){var $=w-r,B=S-i,W=$*$+B*B;if(W>4*e&&U--){var X=c+P,re=l+D,ge=m+k,pe=Hf(X*X+re*re+ge*ge),oe=Vc(ge/=pe),fe=qi(qi(ge)-1)e||qi(($*Ke+B*Ee)/W-.5)>.3||c*P+l*D+m*k2?Ee[2]%360*Zs:0,ne()):[w*Cu,S*Cu,E*Cu]},fe.precision=function(Ee){return arguments.length?(ge=_2(Z,re=Ee*Ee),Ke()):Hf(re)},fe.fitExtent=function(Ee,Ze){return bC(fe,Ee,Ze)},fe.fitSize=function(Ee,Ze){return VR(fe,Ee,Ze)};function ne(){D=pC(P=CR(w,S,E),e);var Ee=e(l,m);return a=r-Ee[0]*n,c=i+Ee[1]*n,Ke()}function Ke(){return pe=oe=null,fe}return function(){return e=t.apply(this,arguments),fe.invert=e.invert&&Te,ne()}}function xC(t){return function(e,n){var r=Zr(e),i=Zr(n),a=t(r*i);return[a*i*Xr(e),a*Xr(n)]}}function wC(t){return function(e,n){var r=Hf(e*e+n*n),i=t(r),a=Xr(i),c=Zr(i);return[Rf(e*a,r*c),Vc(r&&n*a/r)]}}var ZR=xC(function(t){return Hf(2/(1+t))});ZR.invert=wC(function(t){return 2*Vc(t/2)});var SC=xC(function(t){return(t=fC(t))&&t/Xr(t)});SC.invert=wC(function(t){return t});function XR(){return WR(SC).scale(79.4188).clipAngle(180-.001)}function v2(t,e){return[t,e]}v2.invert=v2;function YR(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 FI(t,function(c){var l=Dg(c,e,r,i);l&&a.push(l)}),lv(a);case"FeatureCollection":return $w(t,function(c){var l=Dg(c,e,r,i);l&&$w(l,function(m){m&&a.push(m)})}),lv(a)}return Dg(t,e,r,i)}function Dg(t,e,n,r){var i=t.properties||{},a=t.type==="Feature"?t.geometry:t;if(a.type==="GeometryCollection"){var c=[];return FI(t,function(U){var j=Dg(U,e,n,r);j&&c.push(j)}),lv(c)}var l=KR(a),m={type:a.type,coordinates:IC(a.coordinates,l)},w=new o1,S=w.read(m),E=rR(iR(e,n),"meters"),P=Si.bufferOp(S,E,r),D=new XI;if(P=D.write(P),!EC(P.coordinates)){var k={type:P.type,coordinates:CC(P.coordinates,l)};return Ty(k,i)}}function EC(t){return Array.isArray(t[0])?EC(t[0]):isNaN(t[0])}function IC(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return IC(n,e)})}function CC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return CC(n,e)})}function KR(t){var e=sR(t).geometry.coordinates,n=[-e[0],-e[1]];return XR().rotate(n).scale(Vo)}function JR(t,e){var n=sy(t),r=sy(e),i=t.properties||{},a=DI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?NI(a[0],i):OI(a,i)}function b2(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 x2(t,e){const n=JR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=YR(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)b2(i);else for(const i of r.geometry.coordinates)for(const a of i)b2(a);e({type:"FeatureCollection",features:[r,n]})}let w2={type:"FeatureCollection",features:[]};function QR(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:w2}),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 P=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 TD({props:{displayIn:"maplibre"},target:U}),new e.Marker({element:U,offset:[1,-13]})}return{setEventHandler(k){k?(l=k,t.on("click",P)):(l=void 0,t.off("click",P))},flyTo(k,U){t.flyTo({center:k,zoom:U,...i})},fitBounds(k,U,j){t.fitBounds([[k[0],k[1]],[k[2],k[3]]],{padding:U,maxZoom:j,...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 j($){var B;(B=t.getSource("full-geom"))==null||B.setData($)}for(const $ of m)$.remove();if(m.length=0,j(w2),!!e){if(U){let $=!1;if(U.geometry.type==="GeometryCollection"){const B=U.geometry.geometries.filter(W=>W.type==="Polygon"||W.type==="MultiPolygon");if(B.length>0){let W=B.pop();for(const X of B)W=oR(W,X);x2({...U,geometry:W},j),$=!0}else{const W=U.geometry.geometries.filter(X=>X.type==="LineString"||X.type==="MultiLineString");W.length>0&&(j({...U,geometry:{type:"GeometryCollection",geometries:W}}),$=!0)}}if(!$){if(U.geometry.type==="Polygon"||U.geometry.type==="MultiPolygon")x2(U,j);else if(U.geometry.type==="LineString"||U.geometry.type==="MultiLineString"){j(U);return}}n&&m.push((typeof n=="object"?new e.Marker(n):D()).setLngLat(U.center).addTo(t))}if(r)for(const $ of k??[]){if($===U)continue;const B=(typeof r=="object"?new e.Marker(r):D(!0)).setLngLat($.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText($.place_type[0]==="reverse"?$.place_name:$.place_name.replace(/,.*/,""))).addTo(t),W=B.getElement();W.addEventListener("click",X=>{X.stopPropagation(),l==null||l({type:"markerClick",id:$.id})}),W.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:$.id}),B.togglePopup()}),W.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:$.id}),B.togglePopup()}),m.push(B)}}},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 $R(t){let e,n;return{c(){e=Wl("svg"),n=Wl("path"),Ve(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"),Ve(e,"viewBox","0 0 14 14"),Ve(e,"width","13"),Ve(e,"height","13"),Ve(e,"class","svelte-en2qvf")},m(r,i){De(r,e,i),Se(e,n)},p:ut,i:ut,o:ut,d(r){r&&ke(e)}}}class TC extends Kt{constructor(e){super(),Yt(this,e,null,$R,Gt,{})}}function eN(t){let e,n;return{c(){e=Wl("svg"),n=Wl("path"),Ve(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"),Ve(e,"viewBox","0 0 30 30"),Ve(e,"fill","none"),Ve(e,"xmlns","http://www.w3.org/2000/svg"),Ve(e,"class","svelte-d2loi5")},m(r,i){De(r,e,i),Se(e,n)},p:ut,i:ut,o:ut,d(r){r&&ke(e)}}}class LC extends Kt{constructor(e){super(),Yt(this,e,null,eN,Gt,{})}}function tN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"area.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"area.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function nN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"reverse.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"reverse.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function rN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"poi.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"poi.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function iN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"postal_code.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"postal_code.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function oN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"street.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"street.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function sN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"road.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"road.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function aN(t){let e,n;return{c(){e=Re("img"),Eo(e.src,n=t[3]+"housenumber.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){De(r,e,i)},p(r,i){i&8&&!Eo(e.src,n=r[3]+"housenumber.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&ke(e)}}}function lN(t){let e,n,r,i;return{c(){e=Re("img"),Eo(e.src,n=t[5])||Ve(e,"src",n),Ve(e,"alt",t[4]),Ve(e,"class","svelte-ltkwvy")},m(a,c){De(a,e,c),r||(i=jt(e,"error",t[14]),r=!0)},p(a,c){c&32&&!Eo(e.src,n=a[5])&&Ve(e,"src",n),c&16&&Ve(e,"alt",a[4])},d(a){a&&ke(e),r=!1,i()}}}function S2(t){let e,n;return{c(){e=Re("span"),n=It(t[6]),Ve(e,"class","secondary svelte-ltkwvy")},m(r,i){De(r,e,i),Se(e,n)},p(r,i){i&64&&Bn(n,r[6])},d(r){r&&ke(e)}}}function uN(t){var pe,oe;let e,n,r,i,a,c,l,m,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,E,P=t[2]==="always"||t[2]&&!t[0].address&&((pe=t[0].properties)==null?void 0:pe.kind)!=="road"&&((oe=t[0].properties)==null?void 0:oe.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*/,""))+"",j,$,B;function W(fe,Te){var Z,ne;return Te&1&&(n=null),Te&1&&(r=null),Te&1&&(i=null),fe[5]?lN:fe[0].address?aN:((Z=fe[0].properties)==null?void 0:Z.kind)==="road"||((ne=fe[0].properties)==null?void 0:ne.kind)==="road_relation"?sN:(n==null&&(n=!!fe[0].id.startsWith("address.")),n?oN:(r==null&&(r=!!fe[0].id.startsWith("postal_code.")),r?iN:(i==null&&(i=!!fe[0].id.startsWith("poi.")),i?rN:fe[7]?nN:tN)))}let X=W(t,-1),re=X(t),ge=P&&S2(t);return{c(){e=Re("li"),re.c(),a=rt(),c=Re("span"),l=Re("span"),m=Re("span"),S=It(w),E=rt(),ge&&ge.c(),D=rt(),k=Re("span"),j=It(U),Ve(m,"class","primary svelte-ltkwvy"),Ve(l,"class","svelte-ltkwvy"),Ve(k,"class","line2 svelte-ltkwvy"),Ve(c,"class","texts svelte-ltkwvy"),Ve(e,"tabindex","0"),Ve(e,"data-selected",t[1]),Ve(e,"class","svelte-ltkwvy"),al(e,"selected",t[1])},m(fe,Te){De(fe,e,Te),re.m(e,null),Se(e,a),Se(e,c),Se(c,l),Se(l,m),Se(m,S),Se(l,E),ge&&ge.m(l,null),Se(c,D),Se(c,k),Se(k,j),$||(B=[jt(e,"mouseenter",t[12]),jt(e,"focus",t[13])],$=!0)},p(fe,[Te]){var Z,ne;X===(X=W(fe,Te))&&re?re.p(fe,Te):(re.d(1),re=X(fe),re&&(re.c(),re.m(e,a))),Te&1&&w!==(w=(fe[7]?fe[0].place_name:fe[0].place_name.replace(/,.*/,""))+"")&&Bn(S,w),Te&37&&(P=fe[2]==="always"||fe[2]&&!fe[0].address&&((Z=fe[0].properties)==null?void 0:Z.kind)!=="road"&&((ne=fe[0].properties)==null?void 0:ne.kind)!=="road_relation"&&!fe[0].id.startsWith("address.")&&!fe[0].id.startsWith("postal_code.")&&(!fe[0].id.startsWith("poi.")||!fe[5])&&!fe[7]),P?ge?ge.p(fe,Te):(ge=S2(fe),ge.c(),ge.m(l,null)):ge&&(ge.d(1),ge=null),Te&1&&U!==(U=(fe[7]?"":fe[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Bn(j,U),Te&2&&Ve(e,"data-selected",fe[1]),Te&2&&al(e,"selected",fe[1])},i:ut,o:ut,d(fe){fe&&ke(e),re.d(),ge&&ge.d(),$=!1,Ni(B)}}}function cN(t,e,n){var W;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:m}=e,{iconsBaseUrl:w}=e;const S=(W=a.properties)==null?void 0:W.categories;let E,P,D=0,k=a.place_type[0]==="reverse";function U(X){P&&m.add(P),n(10,D++,D)}function j(X){pn.call(this,t,X)}function $(X){pn.call(this,t,X)}const B=X=>U(X.currentTarget);return t.$$set=X=>{"feature"in X&&n(0,a=X.feature),"selected"in X&&n(1,c=X.selected),"showPlaceType"in X&&n(2,l=X.showPlaceType),"missingIconsCache"in X&&n(9,m=X.missingIconsCache),"iconsBaseUrl"in X&&n(3,w=X.iconsBaseUrl)},t.$$.update=()=>{var X,re,ge,pe;if(t.$$.dirty&3640)do n(11,r--,r),n(4,E=S==null?void 0:S[r]),n(5,P=E?w+E.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||m.has(P)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(re=(X=a.properties)==null?void 0:X.categories)==null?void 0:re.join(", "):((pe=(ge=a.properties)==null?void 0:ge.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,E,P,i,k,U,m,D,r,j,$,B]}class hN extends Kt{constructor(e){super(),Yt(this,e,cN,uN,Gt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function fN(t){let e;return{c(){e=Re("div"),e.innerHTML='',Ve(e,"class","svelte-7cmwmc")},m(n,r){De(n,e,r)},p:ut,i:ut,o:ut,d(n){n&&ke(e)}}}class pN extends Kt{constructor(e){super(),Yt(this,e,null,fN,Gt,{})}}function dN(t){let e,n;return{c(){e=Wl("svg"),n=Wl("path"),Ve(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"),Ve(e,"viewBox","0 0 60.006 21.412"),Ve(e,"width","14"),Ve(e,"height","20"),Ve(e,"class","svelte-en2qvf")},m(r,i){De(r,e,i),Se(e,n)},p:ut,i:ut,o:ut,d(r){r&&ke(e)}}}class mN extends Kt{constructor(e){super(),Yt(this,e,null,dN,Gt,{})}}function gN(t){let e,n,r;return{c(){e=Wl("svg"),n=Wl("circle"),r=Wl("path"),Ve(n,"cx","4.789"),Ve(n,"cy","4.787"),Ve(n,"r","3.85"),zr(n,"stroke-width","1.875"),zr(n,"fill","none"),Ve(r,"d","M12.063 12.063 7.635 7.635"),zr(r,"stroke-width","1.875"),zr(r,"stroke-linecap","round"),Ve(e,"xmlns","http://www.w3.org/2000/svg"),Ve(e,"width","13"),Ve(e,"height","13"),Ve(e,"viewBox","0 0 13 13"),Ve(e,"class","svelte-1bpbt60")},m(i,a){De(i,e,a),Se(e,n),Se(e,r)},p:ut,i:ut,o:ut,d(i){i&&ke(e)}}}class yN extends Kt{constructor(e){super(),Yt(this,e,null,gN,Gt,{})}}function _N(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 E2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!nd.coords)break e;return nd.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&&(nd={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const I2=/(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,C2=/(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,T2=/(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,L2=/(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 bN(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=P2(e[0],t),r=P2(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 P2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=xN(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 xN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function d1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],l=!1;if(I2.test(t))if(c=I2.exec(t),l=_g(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(C2.test(t))if(c=C2.exec(t),l=_g(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(T2.test(t))if(c=T2.exec(t),l=_g(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(L2.test(t))if(c=L2.exec(t),l=_g(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 P=/[,/;\u0020]/g,D=w.match(P);if(D==null){const j=Math.floor(t.length/2);S=w.substring(0,j).trim(),E=w.substring(j).trim()}else{let j;D.length%2==1?j=Math.floor(D.length/2):j=D.length/2-1;let $=0;if(j==0)$=w.indexOf(D[0]),S=w.substring(0,$).trim(),E=w.substring($+1).trim();else{let B=0,W=0;for(;B<=j;)$=w.indexOf(D[B],W),W=$+1,B++;S=w.substring(0,$).trim(),E=w.substring($+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:wN,toCoordinateFormat:bN})}else throw new Error("coordinates pattern match failed")}function _g(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,...IN})}),[...t,...CN,...TN]}const PN=LN();d1.formats=PN.map(t=>t.verbatimCoordinates);const MN=d1;function A2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function k2(t){let e,n;return e=new pN({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function D2(t){let e,n,r,i,a;return n=new mN({}),{c(){e=Re("button"),st(n.$$.fragment),Ve(e,"type","button"),Ve(e,"title",t[9]),Ve(e,"class","svelte-zh3kmv"),al(e,"active",t[0])},m(c,l){De(c,e,l),it(n,e,null),r=!0,i||(a=jt(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Ve(e,"title",c[9]),(!r||l[0]&1)&&al(e,"active",c[0])},i(c){r||(ve(n.$$.fragment,c),r=!0)},o(c){Ie(n.$$.fragment,c),r=!1},d(c){c&&ke(e),ot(n),i=!1,a()}}}function AN(t){let e,n=[],r=new Map,i,a,c,l=Fr(t[14]);const m=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{pe=null}),Dn()),(!W||Ze[0]&2)&&al(w,"displayable",Ee[1]!==""),Ee[5]===!0?oe?(oe.p(Ee,Ze),Ze[0]&32&&ve(oe,1)):(oe=D2(Ee),oe.c(),ve(oe,1),oe.m(r,k)):oe&&(kn(),Ie(oe,1,1,()=>{oe=null}),Dn()),Te&&Te.p&&(!W||Ze[1]&134217728)&&Qr(Te,fe,Ee,Ee[58],W?Jr(fe,Ee[58],Ze,null):$r(Ee[58]),null);let tt=j;j=Ke(Ee),j===tt?~j&&ne[j].p(Ee,Ze):($&&(kn(),Ie(ne[tt],1,1,()=>{ne[tt]=null}),Dn()),~j?($=ne[j],$?$.p(Ee,Ze):($=ne[j]=Z[j](Ee),$.c()),ve($,1),$.m(n,null)):$=null),(!W||Ze[0]&4&&B!==(B=Rg(Ee[2])+" svelte-zh3kmv"))&&Ve(n,"class",B),(!W||Ze[0]&22)&&al(n,"can-collapse",Ee[4]&&Ee[1]==="")},i(Ee){W||(ve(ge),ve(a.$$.fragment,Ee),ve(E.$$.fragment,Ee),ve(pe),ve(oe),ve(Te,Ee),ve($),W=!0)},o(Ee){Ie(ge),Ie(a.$$.fragment,Ee),Ie(E.$$.fragment,Ee),Ie(pe),Ie(oe),Ie(Te,Ee),Ie($),W=!1},d(Ee){Ee&&(ke(e),ke(n)),ot(a),t[61](null),ot(E),pe&&pe.d(),oe&&oe.d(),Te&&Te.d(Ee),~j&&ne[j].d(),X=!1,Ni(re)}}}function ON(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:P=void 0}=e,{debounceSearch:D=200}=e,{enableReverse:k=!1}=e,{errorMessage:U="Something went wrong…"}=e,{filter:j=()=>!0}=e,{flyTo:$=!0}=e,{fuzzyMatch:B=!0}=e,{language:W=void 0}=e,{limit:X=void 0}=e,{mapController:re=void 0}=e,{minLength:ge=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:oe="Search"}=e,{proximity:fe=[{type:"server-geolocation"}]}=e,{reverseActive:Te=k==="always"}=e,{reverseButtonTitle:Z="toggle reverse geocoding"}=e,{searchValue:ne=""}=e,{showFullGeometry:Ke=!0}=e,{showPlaceType:Ee="ifNeeded"}=e,{showResultsWhileTyping:Ze=!0}=e,{selectFirst:tt=!0}=e,{flyToSelected:je=!1}=e,{markerOnSelected:Ot=!0}=e,{types:wt=void 0}=e,{excludeTypes:un=!1}=e,{zoom:qt=16}=e,{maxZoom:At=18}=e,{apiUrl:hn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Tn={}}=e,{iconsBaseUrl:_n="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:vn=Q=>{}}=e;function Rn(){Oe.focus()}function wr(){Oe.blur()}function kr(Q,we=!0){n(1,ne=Q),we?(n(15,Jt=-1),wl()):(ti(),setTimeout(()=>{Oe.focus(),Oe.select()}))}function Sr(){n(14,ye=void 0),n(55,Ct=void 0),n(15,Jt=-1)}function dr(){n(54,Pe=[]),n(55,Ct=void 0)}let Qe=!1,ye,Pe,Ct,Nn="",Oe,Jt=-1,Dr,ln=[],er,Mo,ps,Os;const Ua=new Set,Pi=qu();as(()=>{re&&(re.setEventHandler(void 0),re.indicateReverse(!1),re.setSelectedMarker(-1),re.setMarkers(void 0,void 0))});function wl(Q){if(Mo&&(clearTimeout(Mo),Mo=void 0),Jt>-1&&ye)n(55,Ct=ye[Jt]),n(1,ne=Ct.place_type[0]==="reverse"?Ct.place_name:Ct.place_name.replace(/,.*/,"")),n(18,Dr=void 0),n(54,Pe=void 0),n(15,Jt=-1);else if(ne){const we=Q||!ds(ne);at(ne,{exact:!0}).then(()=>{n(54,Pe=ye),n(55,Ct=void 0),we&&Ko()}).catch(me=>n(18,Dr=me))}}function ds(Q){try{return MN(Q,6)}catch{return!1}}async function at(Q,{byId:we=!1,exact:me=!1}={}){n(18,Dr=void 0),er==null||er.abort();const Me=new AbortController;n(19,er=Me);try{const Ue=ds(Q),We=new URLSearchParams;if(W!==void 0&&We.set("language",Array.isArray(W)?W.join(","):W??""),wt&&We.set("types",wt.join(",")),un&&We.set("excludeTypes",String(un)),m&&We.set("bbox",m.map(Ht=>Ht.toFixed(6)).join(",")),P&&We.set("country",Array.isArray(P)?P.join(","):P),!we&&!Ue){const Ht=await vN(re,fe,Me);Ht&&We.set("proximity",Ht),(me||!Ze)&&We.set("autocomplete","false"),We.set("fuzzyMatch",String(B))}X!==void 0&&(!Ue||(wt==null?void 0:wt.length)===1)&&We.set("limit",String(X)),We.set("key",l),vn(We);const Xe=hn+"/"+encodeURIComponent(Ue?Ue.decimalLongitude+","+Ue.decimalLatitude:Q)+".json?"+We.toString();if(Xe===Nn){we?(n(14,ye=void 0),n(55,Ct=ln[0])):n(14,ye=ln);return}Nn=Xe;const Lt=await fetch(Xe,{signal:Me.signal,...Tn});if(!Lt.ok)throw new Error(await Lt.text());const Dt=await Lt.json();Pi("response",{url:Xe,featureCollection:Dt}),we?(n(14,ye=void 0),n(55,Ct=Dt.features[0]),ln=[Ct]):(n(14,ye=Dt.features.filter(j)),Ue&&ye.unshift({type:"Feature",properties:{},id:"reverse_"+Ue.decimalLongitude+"_"+Ue.decimalLatitude,text:Ue.decimalLatitude+", "+Ue.decimalLongitude,place_name:Ue.decimalLatitude+", "+Ue.decimalLongitude,place_type:["reverse"],center:[Ue.decimalLongitude,Ue.decimalLatitude],bbox:[Ue.decimalLongitude,Ue.decimalLatitude,Ue.decimalLongitude,Ue.decimalLatitude],geometry:{type:"Point",coordinates:[Ue.decimalLongitude,Ue.decimalLatitude]}}),ln=ye,Ue&&Oe.focus())}catch(Ue){if(Ue&&typeof Ue=="object"&&"name"in Ue&&Ue.name==="AbortError")return;throw Ue}finally{Me===er&&n(19,er=void 0)}}function Ko(){var me;if(!(Pe!=null&&Pe.length)||!$)return;const Q=[180,90,-180,-90],we=!Pe.some(Me=>!Me.matching_text);for(const Me of Pe)if(we||!Me.matching_text)for(const Ue of[0,1,2,3])Q[Ue]=Math[Ue<2?"min":"max"](Q[Ue],((me=Me.bbox)==null?void 0:me[Ue])??Me.center[Ue%2]);re&&Pe.length>0&&(Ct&&Q[0]===Q[2]&&Q[1]===Q[3]?re.flyTo(Ct.center,qt):re.fitBounds(E2(Q),50,At))}function Qi(Q){n(0,Te=k==="always"),n(14,ye=void 0),n(55,Ct=void 0),n(15,Jt=-1),kr(Q[1].toFixed(6)+", "+_N(Q[0],[-180,180],!0).toFixed(6),!1)}function Sl(Q){if(!ye)return;let we=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;we&&(Jt===(tt?0:-1)&&we===-1&&n(15,Jt=ye.length),n(15,Jt+=we),Jt>=ye.length&&n(15,Jt=-1),Jt<0&&tt&&n(15,Jt=0),Q.preventDefault())}function ti(Q=!0){if(n(18,Dr=void 0),Ze){if(Mo&&clearTimeout(Mo),ne.length{at(we).catch(me=>n(18,Dr=me))},Q?D:0)}else n(14,ye=void 0),n(18,Dr=void 0)}function ft(Q){n(55,Ct=Q),n(1,ne=Q.place_name),n(15,Jt=-1)}const tn=()=>Oe.focus();function $t(Q){Un[Q?"unshift":"push"](()=>{Oe=Q,n(17,Oe)})}function Rr(){ne=this.value,n(1,ne),n(13,Qe),n(27,S)}const Jo=()=>n(13,Qe=!0),Qt=()=>n(13,Qe=!1),ya=()=>ti(),Gr=()=>{n(1,ne=""),Oe.focus()},ue=()=>n(0,Te=!Te),V=()=>n(18,Dr=void 0),q=Q=>n(15,Jt=Q),J=Q=>ft(Q),ie=()=>{tt||n(15,Jt=-1)},xe=()=>{};return t.$$set=Q=>{"class"in Q&&n(2,c=Q.class),"apiKey"in Q&&n(25,l=Q.apiKey),"bbox"in Q&&n(26,m=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,E=Q.collapsed),"country"in Q&&n(28,P=Q.country),"debounceSearch"in Q&&n(29,D=Q.debounceSearch),"enableReverse"in Q&&n(5,k=Q.enableReverse),"errorMessage"in Q&&n(6,U=Q.errorMessage),"filter"in Q&&n(30,j=Q.filter),"flyTo"in Q&&n(31,$=Q.flyTo),"fuzzyMatch"in Q&&n(32,B=Q.fuzzyMatch),"language"in Q&&n(33,W=Q.language),"limit"in Q&&n(34,X=Q.limit),"mapController"in Q&&n(35,re=Q.mapController),"minLength"in Q&&n(36,ge=Q.minLength),"noResultsMessage"in Q&&n(7,pe=Q.noResultsMessage),"placeholder"in Q&&n(8,oe=Q.placeholder),"proximity"in Q&&n(37,fe=Q.proximity),"reverseActive"in Q&&n(0,Te=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,Z=Q.reverseButtonTitle),"searchValue"in Q&&n(1,ne=Q.searchValue),"showFullGeometry"in Q&&n(38,Ke=Q.showFullGeometry),"showPlaceType"in Q&&n(10,Ee=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,Ze=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,tt=Q.selectFirst),"flyToSelected"in Q&&n(40,je=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Ot=Q.markerOnSelected),"types"in Q&&n(42,wt=Q.types),"excludeTypes"in Q&&n(43,un=Q.excludeTypes),"zoom"in Q&&n(44,qt=Q.zoom),"maxZoom"in Q&&n(45,At=Q.maxZoom),"apiUrl"in Q&&n(46,hn=Q.apiUrl),"fetchParameters"in Q&&n(47,Tn=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,_n=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,vn=Q.adjustUrlQuery),"$$scope"in Q&&n(58,a=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ps=Qe),S&&!Qe&&n(1,ne="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&ne.lengthn(18,Dr=Q)),t.$$.dirty[1]&50356241&&(re&&Ct&&Ct.id!==Os&&$&&(!Ct.bbox||Ct.bbox[0]===Ct.bbox[2]&&Ct.bbox[1]===Ct.bbox[3]?re.flyTo(Ct.center,Ct.id.startsWith("poi.")||Ct.id.startsWith("address.")?At:qt):re.fitBounds(E2(Ct.bbox),50,At),n(14,ye=void 0),n(54,Pe=void 0),n(15,Jt=-1)),n(56,Os=Ct==null?void 0:Ct.id)),t.$$.dirty[0]&18432&&tt&&ye!=null&&ye.length&&n(15,Jt=0),t.$$.dirty[0]&2050&&(tt||n(15,Jt=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Pe!==ye&&n(54,Pe=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&re&&re.setEventHandler(Q=>{switch(Q.type){case"mapClick":Te&&Qi(Q.coordinates);break;case"markerClick":{const we=ye==null?void 0:ye.find(me=>me.id===Q.id);we&&ft(we)}break;case"markerMouseEnter":Pe&&n(15,Jt=ps?(ye==null?void 0:ye.findIndex(we=>we.id===Q.id))??-1:-1);break;case"markerMouseLeave":Pe&&n(15,Jt=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ye==null?void 0:ye[Jt]),t.$$.dirty[1]&67133969&&re&&r&&$&&je&&re.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?At:qt),t.$$.dirty[1]&1040&&(Ot||re==null||re.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&re&&Ot&&!Pe&&(re.setMarkers(r?[r]:void 0,void 0),re.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&re&&re.setMarkers(Pe,Ct),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Pe&&re&&re.setSelectedMarker(Jt),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&re){const Q=ds(ne);re.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Pi("select",r),t.$$.dirty[1]&16777216&&Pi("pick",Ct),t.$$.dirty[0]&81920&&Pi("optionsVisibilityChange",ps&&!!ye),t.$$.dirty[0]&16384&&Pi("featuresListed",ye),t.$$.dirty[1]&8388608&&Pi("featuresMarked",Pe),t.$$.dirty[0]&1&&Pi("reverseToggle",Te),t.$$.dirty[0]&2&&Pi("queryChange",ne),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&re&&re.indicateReverse(Te)},[Te,ne,c,w,E,k,U,pe,oe,Z,Ee,tt,_n,Qe,ye,Jt,ps,Oe,Dr,er,Ua,wl,Sl,ti,ft,l,m,S,P,D,j,$,B,W,X,re,ge,fe,Ke,Ze,je,Ot,wt,un,qt,At,hn,Tn,vn,Rn,wr,kr,Sr,dr,Pe,Ct,Os,r,a,i,tn,$t,Rr,Jo,Qt,ya,Gr,ue,V,q,J,ie,xe]}class zN extends Kt{constructor(e){super(),Yt(this,e,ON,NN,Gt,{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 N2(t){let e,n,r;return n=new zN({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=Re("div"),st(n.$$.fragment),Ve(e,"class","svelte-ixhnie")},m(i,a){De(i,e,a),it(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){Ie(n.$$.fragment,i),r=!1},d(i){i&&ke(e),ot(n)}}}function FN(t){let e,n,r=t[1]&&N2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&ve(r,1)):(r=N2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function BN(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?QR(a,Es):null)},[i,r,a]}class VN extends Kt{constructor(e){super(),Yt(this,e,BN,FN,Gt,{apiKey:0,map:2})}}const UN=Symbol.for("svelte-maplibre");function GN(){return wv(UN)}function jN(t){return"layerType"in t&&t.layerType==="deckgl"}var Uc=qN;function qN(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}),z2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function F2(t){let e,n,r=(t[4]||t[3]instanceof Es.Marker)&&B2(t);return{c(){e=Re("div"),r&&r.c()},m(i,a){De(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Es.Marker?r?(r.p(i,a),a[0]&24&&ve(r,1)):(r=B2(i),r.c(),ve(r,1),r.m(e,null)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(),t[32](null)}}}function B2(t){let e;const n=t[30].default,r=Kr(n,t,t[29],z2);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)&&Qr(r,n,i,i[29],e?Jr(n,i[29],a,ZN):$r(i[29]),z2)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function XN(t){let e,n,r=t[9].default&&F2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&ve(r,1)):(r=F2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function YN(t,e,n){let r,i,a,c,l,m,{$$slots:w={},$$scope:S}=e;const E=ZL(w);let{closeButton:P=void 0}=e,{closeOnClickOutside:D=!0}=e,{closeOnClickInside:k=!1}=e,{closeOnMove:U=!1}=e,{openOn:j="click"}=e,{openIfTopMost:$=!0}=e,{focusAfterOpen:B=!0}=e,{anchor:W=void 0}=e,{offset:X=void 0}=e,{popupClass:re=void 0}=e,{maxWidth:ge=void 0}=e,{lngLat:pe=void 0}=e,{html:oe=void 0}=e,{open:fe=!1}=e;const Te=qu(),{map:Z,popupTarget:ne,layerEvent:Ke,layer:Ee,eventTopMost:Ze}=GN();Pt(t,Z,Pe=>n(2,a=Pe)),Pt(t,ne,Pe=>n(3,l=Pe)),Pt(t,Ke,Pe=>n(28,c=Pe)),Pt(t,Ee,Pe=>n(35,m=Pe));const tt=["click","dblclick","contextmenu"];let je,Ot=!1,wt;function un(){if(!je)return;let Pe=je.getElement();!Pe||Pe===wt||(wt=Pe,j==="hover"&&(wt.style.pointerEvents="none"),wt.addEventListener("mouseenter",()=>{n(24,Ot=!0)},{passive:!0}),wt.addEventListener("mouseleave",()=>{n(24,Ot=!1)},{passive:!0}),wt.addEventListener("click",()=>{k&&n(0,fe=!1)},{passive:!0}))}ju(()=>{if(a)return a.on("click",Sr),a.on("contextmenu",Sr),typeof l=="string"&&(a.on("click",l,Tn),a.on("dblclick",l,Tn),a.on("contextmenu",l,Tn),a.on("mousemove",l,kr),a.on("mouseleave",l,wr),a.on("touchstart",l,vn),a.on("touchend",l,Rn)),()=>{a!=null&&a.loaded()&&(je==null||je.remove(),a.off("click",Sr),a.off("contextmenu",Sr),l instanceof Es.Marker?l.getPopup()===je&&l.setPopup(void 0):typeof l=="string"&&(a.off("click",l,Tn),a.off("dblclick",l,Tn),a.off("contextmenu",l,Tn),a.off("mousemove",l,kr),a.off("mouseleave",l,wr),a.off("touchstart",l,vn),a.off("touchend",l,Rn)))}});function qt(Pe){return $?!("marker"in Pe)&&!jN(Pe)&&Ze(Pe)!==m:!1}let At=null,hn="normal";function Tn(Pe){Pe.type===j&&(qt(Pe)||("layerType"in Pe?Pe.layerType==="deckgl"?(n(10,pe=Pe.coordinate),n(4,At=Pe.object?[Pe.object]:null)):(n(10,pe=Pe.lngLat),n(4,At=Pe.features??[])):(n(10,pe=Pe.lngLat),n(4,At=Pe.features??[])),setTimeout(()=>n(0,fe=!0))))}let _n=null;function vn(Pe){_n=Pe.point}function Rn(Pe){if(!_n||j!=="hover")return;let Ct=_n.dist(Pe.point);_n=null,Ct<3&&(n(10,pe=Pe.lngLat),n(4,At=Pe.features??[]),je.isOpen()?n(25,hn="justOpened"):(n(25,hn="opening"),n(0,fe=!0)))}function wr(Pe){j!=="hover"||_n||hn!=="normal"||(n(0,fe=!1),n(4,At=null))}function kr(Pe){if(!(j!=="hover"||_n||hn!=="normal")){if(qt(Pe)){n(0,fe=!1),n(4,At=null);return}n(0,fe=!0),n(4,At=Pe.features??[]),n(10,pe=Pe.lngLat)}}function Sr(Pe){if(hn==="justOpened"){n(25,hn="normal");return}if(!D)return;let Ct=[wt,l instanceof Es.Marker?l==null?void 0:l.getElement():null];fe&&je.isOpen()&&!Ct.some(Nn=>Nn==null?void 0:Nn.contains(Pe.originalEvent.target))&&(Pe.type==="contextmenu"&&j==="contextmenu"||Pe.type!=="contextmenu")&&n(0,fe=!1)}as(()=>{a&&(je!=null&&je.isOpen())&&je.remove()});let dr;const Qe=()=>n(0,fe=!1);function ye(Pe){Un[Pe?"unshift":"push"](()=>{dr=Pe,n(1,dr)})}return t.$$set=Pe=>{"closeButton"in Pe&&n(11,P=Pe.closeButton),"closeOnClickOutside"in Pe&&n(12,D=Pe.closeOnClickOutside),"closeOnClickInside"in Pe&&n(13,k=Pe.closeOnClickInside),"closeOnMove"in Pe&&n(14,U=Pe.closeOnMove),"openOn"in Pe&&n(15,j=Pe.openOn),"openIfTopMost"in Pe&&n(16,$=Pe.openIfTopMost),"focusAfterOpen"in Pe&&n(17,B=Pe.focusAfterOpen),"anchor"in Pe&&n(18,W=Pe.anchor),"offset"in Pe&&n(19,X=Pe.offset),"popupClass"in Pe&&n(20,re=Pe.popupClass),"maxWidth"in Pe&&n(21,ge=Pe.maxWidth),"lngLat"in Pe&&n(10,pe=Pe.lngLat),"html"in Pe&&n(22,oe=Pe.html),"open"in Pe&&n(0,fe=Pe.open),"$$scope"in Pe&&n(29,S=Pe.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=P??(!D&&!k)),t.$$.dirty[0]&146685952&&(je||(n(23,je=new Es.Popup({closeButton:r,closeOnClick:!1,closeOnMove:U,focusAfterOpen:B,maxWidth:ge,className:re,anchor:W,offset:X})),wt=je.getElement(),je.on("open",()=>{n(0,fe=!0),un(),Te("open",je)}),je.on("close",()=>{n(0,fe=!1),Te("close",je)}),je.on("hover",()=>{Te("hover",je)}))),t.$$.dirty[0]&8421384&&je&&l instanceof Es.Marker&&(j==="click"?l.setPopup(je):l.getPopup()===je&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&tt.includes(j)&&(c==null?void 0:c.type)===j&&(Tn(c),Zn(Ke,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=j==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&j==="hover"&&Ke&&(i&&c&&(c.layerType==="deckgl"?(n(10,pe=c.coordinate),n(4,At=c.object?[c.object]:null)):(n(10,pe=c.lngLat),n(4,At=c.features??[]))),n(0,fe=(i||Ot)??!1)),t.$$.dirty[0]&12582914&&(dr?je.setDOMContent(dr):oe&&je.setHTML(oe)),t.$$.dirty[0]&8389632&&pe&&je.setLngLat(pe),t.$$.dirty[0]&41943045&&a){let Pe=je.isOpen();fe&&!Pe?(je.addTo(a),hn==="opening"&&n(25,hn="justOpened")):!fe&&Pe&&je.remove()}},[fe,dr,a,l,At,Z,ne,Ke,Ee,E,pe,P,D,k,U,j,$,B,W,X,re,ge,oe,je,Ot,hn,i,r,c,S,w,Qe,ye]}class KN extends Kt{constructor(e){super(),Yt(this,e,YN,XN,Gt,{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 Jd=Uint8Array,PC=Uint16Array,JN=Int32Array,QN=new Jd([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]),$N=new Jd([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]),MC=function(t,e){for(var n=new PC(31),r=0;r<31;++r)n[r]=e+=1<>1|(Qn&21845)<<1,Bl=(Bl&52428)>>2|(Bl&13107)<<2,Bl=(Bl&61680)>>4|(Bl&3855)<<4,nO[Qn]=((Bl&65280)>>8|(Bl&255)<<8)>>1;var Bl,Qn,Vy=new Jd(288);for(Qn=0;Qn<144;++Qn)Vy[Qn]=8;var Qn;for(Qn=144;Qn<256;++Qn)Vy[Qn]=9;var Qn;for(Qn=256;Qn<280;++Qn)Vy[Qn]=7;var Qn;for(Qn=280;Qn<288;++Qn)Vy[Qn]=8;var Qn,rO=new Jd(32);for(Qn=0;Qn<32;++Qn)rO[Qn]=5;var Qn,iO=new Jd(0),oO=typeof TextDecoder<"u"&&new TextDecoder,sO=0;try{oO.decode(iO,{stream:!0}),sO=1}catch{}const aO=t=>({props:t&8}),V2=t=>({props:cO(t[3])});function lO(t){let e;const n=t[1].default,r=Kr(n,t,t[2],V2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&Qr(r,n,i,i[2],e?Jr(n,i[2],a,aO):$r(i[2]),V2)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function uO(t){let e,n;return e=new KN({props:{openOn:t[0],$$slots:{default:[lO,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function cO(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function hO(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 Qd extends Kt{constructor(e){super(),Yt(this,e,hO,uO,Gt,{openOn:0})}}const fO=["==",["geometry-type"],"Polygon"],pO=["==",["geometry-type"],"LineString"];function g1(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 gv(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 gO(){let t=new Map;return xv(y1,{map:sr(null),source:Q_(null),layer:Q_(null),popupTarget:Q_(null),cluster:sr(),loadedImages:sr(new Set),minzoom:sr(0),maxzoom:sr(24),layerEvent:sr(null),layerInfo:t,eventTopMost:mO(t)})}function U2(t){return{subscribe:t.subscribe}}function _1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Xf(),a=sr(null),c=U2(a),l={...i,[t]:U2(a)};if(e&&(l.popupTarget=c),r){let m=sr(null);l.layerEvent=m,i.layerEvent=m}return n&&(l.cluster=sr()),xv(y1,l),{...i,self:a}}function yO(){return _1({key:"source",setCluster:!0})}function _O(t=!0){return _1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function vO(){return _1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function G2(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 bO(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 xO(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function $d(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),De(a,n,c),r=!0},p(a,c){c[0]&1&&Gt(e,e=a[0])?(kn(),Ie(i,1,1,ut),Dn(),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){Ie(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function q2(t){let e;const n=t[36].default,r=Kr(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)&&Qr(r,n,i,i[35],e?Jr(n,i[35],a,null):$r(i[35]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function wO(t){let e,n,r=t[0]&&j2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(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&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function SO(t,e,n){let r,i,a,c,l,m,w,S,E,P,D,k,{$$slots:U={},$$scope:j}=e,{id:$=Zf("layer")}=e,{source:B=void 0}=e,{sourceLayer:W=void 0}=e,{beforeId:X=void 0}=e,{beforeLayerType:re=void 0}=e,{type:ge}=e,{paint:pe=void 0}=e,{layout:oe=void 0}=e,{filter:fe=void 0}=e,{applyToClusters:Te=void 0}=e,{minzoom:Z=void 0}=e,{maxzoom:ne=void 0}=e,{manageHoverState:Ke=!1}=e,{hovered:Ee=null}=e,{interactive:Ze=!0}=e,{hoverCursor:tt=void 0}=e,{eventsIfTopMost:je=!1}=e;const Ot=qu(),{map:wt,source:un,self:qt,minzoom:At,maxzoom:hn,eventTopMost:Tn,layerInfo:_n}=_O();Pt(t,wt,ye=>n(31,E=ye)),Pt(t,un,ye=>n(32,P=ye)),Pt(t,qt,ye=>n(0,S=ye)),Pt(t,At,ye=>n(34,k=ye)),Pt(t,hn,ye=>n(33,D=ye)),as(()=>{S&&E&&(_n.delete(S),E==null||E.removeLayer(S))});let vn;function Rn(ye){var Oe,Jt;if(!Ze||!S||!E||je&&Tn(ye)!==S)return;let Pe=ye.features??[],Ct=(Jt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Jt.cluster_id,Nn={event:ye,map:E,clusterId:Ct,layer:S,source:l,features:Pe};Ot(ye.type,Nn)}function wr(ye){var Oe,Jt;if(!Ze||!S||!E||je&&Tn(ye)!==S)return;tt&&(E.getCanvas().style.cursor=tt);let Pe=ye.features??[];n(6,Ee=Pe[0]??null);let Ct=(Jt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Jt.cluster_id;Ot("mouseenter",{event:ye,map:E,clusterId:Ct,layer:S,source:l,features:Pe})}function kr(ye){var Oe,Jt,Dr;if(!Ze||!E)return;if(je&&Tn(ye)!==S){n(6,Ee=null),Ke&&vn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:W,id:vn},{hover:!1}),vn=void 0);return}E.getCanvas().style.cursor=tt;let Pe=ye.features??[],Ct=(Jt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Jt.cluster_id,Nn=(Dr=Pe[0])==null?void 0:Dr.id;Nn!==vn&&(Ke&&(vn!==void 0&&(E==null||E.setFeatureState({source:l,id:vn,sourceLayer:W},{hover:!1})),E==null||E.setFeatureState({source:l,id:Nn,sourceLayer:W},{hover:!0})),vn=Nn,n(6,Ee=Pe[0]??null)),Ot("mousemove",{event:ye,map:E,clusterId:Ct,layer:S,source:l,features:Pe})}function Sr(ye){if(!(!Ze||!S||!E)){if(tt&&(E.getCanvas().style.cursor=""),n(6,Ee=null),Ke&&vn!==void 0){const Pe={source:l,id:vn,sourceLayer:W};E==null||E.setFeatureState(Pe,{hover:!1}),vn=void 0}Ot("mouseleave",{map:E,layer:S,source:l})}}let dr=!0;function Qe(ye){E&&(E.off("click",ye,Rn),E.off("dblclick",ye,Rn),E.off("contextmenu",ye,Rn),E.off("mouseenter",ye,wr),E.off("mousemove",ye,kr),E.off("mouseleave",ye,Sr))}return as(()=>{E&&S&&Qe(S)}),t.$$set=ye=>{"id"in ye&&n(7,$=ye.id),"source"in ye&&n(8,B=ye.source),"sourceLayer"in ye&&n(9,W=ye.sourceLayer),"beforeId"in ye&&n(10,X=ye.beforeId),"beforeLayerType"in ye&&n(11,re=ye.beforeLayerType),"type"in ye&&n(12,ge=ye.type),"paint"in ye&&n(13,pe=ye.paint),"layout"in ye&&n(14,oe=ye.layout),"filter"in ye&&n(15,fe=ye.filter),"applyToClusters"in ye&&n(16,Te=ye.applyToClusters),"minzoom"in ye&&n(17,Z=ye.minzoom),"maxzoom"in ye&&n(18,ne=ye.maxzoom),"manageHoverState"in ye&&n(19,Ke=ye.manageHoverState),"hovered"in ye&&n(6,Ee=ye.hovered),"interactive"in ye&&n(20,Ze=ye.interactive),"hoverCursor"in ye&&n(21,tt=ye.hoverCursor),"eventsIfTopMost"in ye&&n(22,je=ye.eventsIfTopMost),"$$scope"in ye&&n(35,j=ye.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=xO(Te)),t.$$.dirty[0]&1073774592&&n(24,i=bO("all",r,fe)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Z??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=ne??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||P),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==$&&l){S&&(Qe(S),_n.delete(S));let ye=X;if(!X&&re){let Pe=E.getStyle().layers,Ct=typeof re=="function"?re:Oe=>Oe.type===re,Nn=Pe==null?void 0:Pe.find(Ct);Nn&&(ye=Nn.id)}Zn(qt,S=$,S),E.addLayer(Uc({id:S,type:ge,source:l,"source-layer":W,filter:i,paint:pe,layout:oe,minzoom:a,maxzoom:c}),ye),n(23,dr=!0),E.on("click",S,Rn),E.on("dblclick",S,Rn),E.on("contextmenu",S,Rn),E.on("mouseenter",S,wr),E.on("mousemove",S,kr),E.on("mouseleave",S,Sr)}t.$$.dirty[0]&1048577&&S&&_n.set(S,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,m=S?G2((ye,Pe)=>E==null?void 0:E.setPaintProperty(S,ye,Pe)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?G2((ye,Pe)=>E==null?void 0:E.setLayoutProperty(S,ye,Pe)):void 0),t.$$.dirty[0]&268443648&&(m==null||m(pe)),t.$$.dirty[0]&134234112&&(w==null||w(oe)),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&&(dr?n(23,dr=!1):E==null||E.setFilter(S,i))},[S,wt,un,qt,At,hn,Ee,$,B,W,X,re,ge,pe,oe,fe,Te,Z,ne,Ke,Ze,tt,je,dr,i,c,a,w,m,l,r,E,P,D,k,j,U]}let Uy=class extends Kt{constructor(e){super(),Yt(this,e,SO,wO,Gt,{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 EO(t){let e;const n=t[16].default,r=Kr(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)&&Qr(r,n,i,i[24],e?Jr(n,i[24],a,null):$r(i[24]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function IO(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:[EO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Uy({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function CO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Zf("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:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:$=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function re(ne){B=ne,n(0,B)}function ge(ne){pn.call(this,t,ne)}function pe(ne){pn.call(this,t,ne)}function oe(ne){pn.call(this,t,ne)}function fe(ne){pn.call(this,t,ne)}function Te(ne){pn.call(this,t,ne)}function Z(ne){pn.call(this,t,ne)}return t.$$set=ne=>{"id"in ne&&n(1,a=ne.id),"source"in ne&&n(2,c=ne.source),"sourceLayer"in ne&&n(3,l=ne.sourceLayer),"beforeId"in ne&&n(4,m=ne.beforeId),"beforeLayerType"in ne&&n(5,w=ne.beforeLayerType),"paint"in ne&&n(6,S=ne.paint),"layout"in ne&&n(7,E=ne.layout),"filter"in ne&&n(8,P=ne.filter),"applyToClusters"in ne&&n(9,D=ne.applyToClusters),"minzoom"in ne&&n(10,k=ne.minzoom),"maxzoom"in ne&&n(11,U=ne.maxzoom),"hoverCursor"in ne&&n(12,j=ne.hoverCursor),"manageHoverState"in ne&&n(13,$=ne.manageHoverState),"hovered"in ne&&n(0,B=ne.hovered),"eventsIfTopMost"in ne&&n(14,W=ne.eventsIfTopMost),"interactive"in ne&&n(15,X=ne.interactive),"$$scope"in ne&&n(24,i=ne.$$scope)},[B,a,c,l,m,w,S,E,P,D,k,U,j,$,W,X,r,re,ge,pe,oe,fe,Te,Z,i]}let Gy=class extends Kt{constructor(e){super(),Yt(this,e,CO,IO,Gt,{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 TO(t){let e;const n=t[15].default,r=Kr(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)&&Qr(r,n,i,i[23],e?Jr(n,i[23],a,null):$r(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function LO(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:[TO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Uy({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function PO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Zf("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:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:W=!0}=e;function X(Z){$=Z,n(0,$)}function re(Z){pn.call(this,t,Z)}function ge(Z){pn.call(this,t,Z)}function pe(Z){pn.call(this,t,Z)}function oe(Z){pn.call(this,t,Z)}function fe(Z){pn.call(this,t,Z)}function Te(Z){pn.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,l=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,U=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,$=Z.hovered),"eventsIfTopMost"in Z&&n(13,B=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[$,a,c,l,m,w,S,E,P,D,k,U,j,B,W,r,X,re,ge,pe,oe,fe,Te,i]}let kC=class extends Kt{constructor(e){super(),Yt(this,e,PO,LO,Gt,{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 MO(t,e,n){let r;const{map:i}=Xf();Pt(t,i,m=>n(4,r=m));let{position:a="top-left"}=e,{container:c=void 0}=e,l=null;return as(()=>{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 Es.FullscreenControl({container:m})),r.addControl(l,a)}},[i,a,c,l,r]}class AO extends Kt{constructor(e){super(),Yt(this,e,MO,null,Gt,{position:1,container:2})}}function kO(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 DO(t,e,n){iE().then(()=>{let r=$S(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function W2(t){let e=t[0],n,r,i=H2(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c&1&&Gt(e,e=a[0])?(kn(),Ie(i,1,1,ut),Dn(),i=H2(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Ie(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function H2(t){let e;const n=t[15].default,r=Kr(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)&&Qr(r,n,i,i[14],e?Jr(n,i[14],a,null):$r(i[14]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function RO(t){let e,n,r=t[0]&&W2(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=W2(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function NO(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:m=Zf("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:P=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:k=void 0}=e;const{map:U,cluster:j,self:$}=yO();Pt(t,U,X=>n(13,i=X)),Pt(t,j,X=>n(16,a=X)),Pt(t,$,X=>n(0,r=X));let B,W=!0;return as(()=>{r&&B&&i&&(DO(U,r,B),Zn($,r=null,r),n(11,B=void 0))}),t.$$set=X=>{"id"in X&&n(4,m=X.id),"data"in X&&n(5,w=X.data),"generateId"in X&&n(6,S=X.generateId),"promoteId"in X&&n(7,E=X.promoteId),"filter"in X&&n(8,P=X.filter),"lineMetrics"in X&&n(9,D=X.lineMetrics),"cluster"in X&&n(10,k=X.cluster),"$$scope"in X&&n(14,l=X.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Zn(j,a=k,a),t.$$.dirty&12273&&i&&r!==m&&(Zn($,r=m,r),kO(i,r,Uc({type:"geojson",data:w,filter:P,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}),X=>i&&X===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,W=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(m))})),t.$$.dirty&6176&&B&&(W?n(12,W=!1):B.setData(w)),t.$$.dirty&3072&&(B==null||B.setClusterOptions(Uc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,U,j,$,m,w,S,E,P,D,k,B,W,i,l,c]}let yl=class extends Kt{constructor(e){super(),Yt(this,e,NO,RO,Gt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}};function OO(t,e,n){let r;const{map:i}=Xf();Pt(t,i,P=>n(8,r=P));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,E=null;return as(()=>{r!=null&&r.loaded()&&E&&r.removeControl(E)}),t.$$set=P=>{"position"in P&&n(1,a=P.position),"positionOptions"in P&&n(2,c=P.positionOptions),"fitBoundsOptions"in P&&n(3,l=P.fitBoundsOptions),"trackUserLocation"in P&&n(4,m=P.trackUserLocation),"showAccuracyCircle"in P&&n(5,w=P.showAccuracyCircle),"showUserLocation"in P&&n(6,S=P.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&r&&!E&&(n(7,E=new Es.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:m,showAccuracyCircle:w,showUserLocation:S})),r.addControl(E,a))},[i,a,c,l,m,w,S,E,r]}class zO extends Kt{constructor(e){super(),Yt(this,e,OO,null,Gt,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function FO(t){let e;const n=t[15].default,r=Kr(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)&&Qr(r,n,i,i[23],e?Jr(n,i[23],a,null):$r(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function BO(t){let e,n,r;function i(c){t[16](c)}let a={id:t[1],type:"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:[FO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Uy({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function VO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Zf("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:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:W=!0}=e;function X(Z){$=Z,n(0,$)}function re(Z){pn.call(this,t,Z)}function ge(Z){pn.call(this,t,Z)}function pe(Z){pn.call(this,t,Z)}function oe(Z){pn.call(this,t,Z)}function fe(Z){pn.call(this,t,Z)}function Te(Z){pn.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,l=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,U=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,$=Z.hovered),"eventsIfTopMost"in Z&&n(13,B=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[$,a,c,l,m,w,S,E,P,D,k,U,j,B,W,r,X,re,ge,pe,oe,fe,Te,i]}let Kc=class extends Kt{constructor(e){super(),Yt(this,e,VO,BO,Gt,{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 UO(t,e,n){let r;const i=qu();let{layer:a=void 0}=e;const{map:c}=Xf();Pt(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 as(()=>{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 GO extends Kt{constructor(e){super(),Yt(this,e,UO,null,Gt,{layer:1})}}function jO(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 qO(t){return t.replace("#","").split("/").map(parseFloat)}function WO(t,e,n){let r;const{map:i}=Xf();Pt(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 as(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),t.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,l=S.showZoom),"visualizePitch"in S&&n(4,m=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Es.NavigationControl({showCompass:c,showZoom:l,visualizePitch:m})),r.addControl(w,a))},[i,a,c,l,m,w,r]}class HO extends Kt{constructor(e){super(),Yt(this,e,WO,null,Gt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function ZO(t,e,n){let r;const{map:i}=Xf();Pt(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 as(()=>{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 Es.ScaleControl({maxWidth:c,unit:l})),r.addControl(m,a))},[i,a,c,l,m,r]}class XO extends Kt{constructor(e){super(),Yt(this,e,ZO,null,Gt,{position:1,maxWidth:2,unit:3})}}const{window:YO}=XL,KO=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),Z2=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function X2(t){let e,n,r=t[3]&&Y2(t);const i=t[39].default,a=Kr(i,t,t[38],Z2);return{c(){r&&r.c(),e=rt(),a&&a.c()},m(c,l){r&&r.m(c,l),De(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=Y2(c),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn()),a&&a.p&&(!n||l[0]&112|l[1]&128)&&Qr(a,i,c,c[38],n?Jr(i,c[38],l,KO):$r(c[38]),Z2)},i(c){n||(ve(r),ve(a,c),n=!0)},o(c){Ie(r),Ie(a,c),n=!1},d(c){c&&ke(e),r&&r.d(c),a&&a.d(c)}}}function Y2(t){let e,n,r,i,a,c,l,m;return e=new HO({props:{position:t[7]}}),r=new zO({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new AO({props:{position:t[7]}}),l=new XO({props:{position:t[7]}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment),c=rt(),st(l.$$.fragment)},m(w,S){it(e,w,S),De(w,n,S),it(r,w,S),De(w,i,S),it(a,w,S),De(w,c,S),it(l,w,S),m=!0},p(w,S){const E={};S[0]&128&&(E.position=w[7]),e.$set(E);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const D={};S[0]&128&&(D.position=w[7]),a.$set(D);const k={};S[0]&128&&(k.position=w[7]),l.$set(k)},i(w){m||(ve(e.$$.fragment,w),ve(r.$$.fragment,w),ve(a.$$.fragment,w),ve(l.$$.fragment,w),m=!0)},o(w){Ie(e.$$.fragment,w),Ie(r.$$.fragment,w),Ie(a.$$.fragment,w),Ie(l.$$.fragment,w),m=!1},d(w){w&&(ke(n),ke(i),ke(c)),ot(e,w),ot(r,w),ot(a,w),ot(l,w)}}}function JO(t){let e,n,r,i,a,c=t[4]&&t[0]&&X2(t);return{c(){e=Re("div"),c&&c.c(),Ve(e,"class",n=Rg(t[2])+" svelte-p00lfq"),Ve(e,"data-testid","map-container"),al(e,"expand-map",!t[2])},m(l,m){De(l,e,m),c&&c.m(e,null),t[40](e),r=!0,i||(a=[jt(YO,"hashchange",t[11]),T0(t[10].call(null,e))],i=!0)},p(l,m){l[4]&&l[0]?c?(c.p(l,m),m[0]&17&&ve(c,1)):(c=X2(l),c.c(),ve(c,1),c.m(e,null)):c&&(kn(),Ie(c,1,1,()=>{c=null}),Dn()),(!r||m[0]&4&&n!==(n=Rg(l[2])+" svelte-p00lfq"))&&Ve(e,"class",n),(!r||m[0]&4)&&al(e,"expand-map",!l[2])},i(l){r||(ve(c),r=!0)},o(l){Ie(c),r=!1},d(l){l&&ke(e),c&&c.d(),t[40](null),i=!1,Ni(a)}}}function QO(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:P}=e,{diffStyleUpdates:D=!1}=e,{center:k=void 0}=e,{zoom:U=void 0}=e,{pitch:j=0}=e,{bearing:$=0}=e,{bounds:B=void 0}=e,{hash:W=!1}=e,{loaded:X=!1}=e,{minZoom:re=0}=e,{maxZoom:ge=22}=e,{antialias:pe=void 0}=e,{zoomOnDoubleClick:oe=!0}=e,{locale:fe=void 0}=e,{interactive:Te=!0}=e,{attributionControl:Z=!0}=e,{cooperativeGestures:ne=!1}=e,{preserveDrawingBuffer:Ke=!1}=e,{maxBounds:Ee=void 0}=e,{images:Ze=[]}=e,{standardControls:tt=!1}=e,{filterLayers:je=void 0}=e,{transformRequest:Ot=void 0}=e;const wt=qu(),{map:un,loadedImages:qt}=gO();Pt(t,un,Qe=>n(4,a=Qe)),Pt(t,qt,Qe=>n(5,c=Qe));let At=new Set;async function hn(Qe,ye=!1){if(a&&!(!a.loaded()&&!ye))if("url"in Qe){At.add(Qe.id);try{let Pe=await a.loadImage(Qe.url);a==null||a.addImage(Qe.id,Pe.data,Qe.options),c.add(Qe.id),qt.set(c)}catch(Pe){wt("error",Pe)}finally{At.delete(Qe.id)}}else a.addImage(Qe.id,Qe.data,Qe.options),c.add(Qe.id),qt.set(c)}let Tn,_n,vn,Rn;function wr(Qe){return Sr(),Zn(un,a=new Es.Map(Uc({container:Qe,style:P,locale:fe,center:k,zoom:U,pitch:j,bearing:$,minZoom:re,maxZoom:ge,antialias:pe,interactive:Te,preserveDrawingBuffer:Ke,maxBounds:Ee,bounds:B,attributionControl:Z,transformRequest:Ot,cooperativeGestures:ne})),a),a.on("load",ye=>{ye.target.getContainer().setAttribute("data-testid","map"),ye.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,X=!0),wt("load",a)}),a.on("error",ye=>wt("error",{...ye,map:a})),a.on("movestart",ye=>wt("movestart",{...ye,map:a})),a.on("moveend",ye=>{if(n(12,k=ye.target.getCenter()),n(13,U=ye.target.getZoom()),n(14,B=ye.target.getBounds()),wt("moveend",{...ye,map:a}),W){let Pe=window.location.href.replace(/(#.+)?$/,jO(a));window.history.replaceState(window.history.state,"",Pe)}}),a.on("click",ye=>wt("click",{...ye,map:a})),a.on("dblclick",ye=>wt("dblclick",{...ye,map:a})),a.on("contextmenu",ye=>wt("contextmenu",{...ye,map:a})),a.on("zoomstart",ye=>wt("zoomstart",{...ye,map:a})),a.on("zoom",ye=>{n(13,U=ye.target.getZoom()),wt("zoom",{...ye,map:a})}),a.on("zoomend",ye=>{n(13,U=ye.target.getZoom()),wt("zoomend",{...ye,map:a})}),a.on("style.load",()=>{if(a){const ye=a.getStyle();if(n(35,Tn=ye.layers.map(Pe=>Pe.id)),n(36,_n=Object.keys(ye.sources)),Rn)for(const[Pe,Ct]of Object.entries(Rn))a.addSource(Pe,Ct);if(vn)for(const Pe of vn)a.addLayer(Pe);for(const Pe of Ze)hn(Pe,!0)}}),a.on("styledata",ye=>{if(a&&je){const Pe=a.getStyle().layers;if(Pe)for(let Ct of Pe)je(Ct)||a.setLayoutProperty(Ct.id,"visibility","none")}wt("styledata",{...ye,map:a})}),{destroy(){n(0,X=!1),a==null||a.remove(),Zn(un,a=null,a)}}}let kr=P;function Sr(){if(W){let Qe=qO(window.location.hash);Qe.length>=3&&(n(13,U=Qe[0]),n(12,k=[Qe[2],Qe[1]])),Qe.length==5&&(n(17,$=Qe[3]),n(16,j=Qe[4]))}}function dr(Qe){Un[Qe?"unshift":"push"](()=>{S=Qe,n(1,S)})}return t.$$set=Qe=>{"map"in Qe&&n(15,w=Qe.map),"mapContainer"in Qe&&n(1,S=Qe.mapContainer),"class"in Qe&&n(2,E=Qe.class),"style"in Qe&&n(18,P=Qe.style),"diffStyleUpdates"in Qe&&n(19,D=Qe.diffStyleUpdates),"center"in Qe&&n(12,k=Qe.center),"zoom"in Qe&&n(13,U=Qe.zoom),"pitch"in Qe&&n(16,j=Qe.pitch),"bearing"in Qe&&n(17,$=Qe.bearing),"bounds"in Qe&&n(14,B=Qe.bounds),"hash"in Qe&&n(20,W=Qe.hash),"loaded"in Qe&&n(0,X=Qe.loaded),"minZoom"in Qe&&n(21,re=Qe.minZoom),"maxZoom"in Qe&&n(22,ge=Qe.maxZoom),"antialias"in Qe&&n(23,pe=Qe.antialias),"zoomOnDoubleClick"in Qe&&n(24,oe=Qe.zoomOnDoubleClick),"locale"in Qe&&n(25,fe=Qe.locale),"interactive"in Qe&&n(26,Te=Qe.interactive),"attributionControl"in Qe&&n(27,Z=Qe.attributionControl),"cooperativeGestures"in Qe&&n(28,ne=Qe.cooperativeGestures),"preserveDrawingBuffer"in Qe&&n(29,Ke=Qe.preserveDrawingBuffer),"maxBounds"in Qe&&n(30,Ee=Qe.maxBounds),"images"in Qe&&n(31,Ze=Qe.images),"standardControls"in Qe&&n(3,tt=Qe.standardControls),"filterLayers"in Qe&&n(32,je=Qe.filterLayers),"transformRequest"in Qe&&n(33,Ot=Qe.transformRequest),"$$scope"in Qe&&n(38,m=Qe.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof tt=="boolean"?void 0:tt),t.$$.dirty[0]&16&&n(15,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&112&&a&&!vg(P,kr)){const Qe=a.getStyle();if(Tn&&(vn=Qe.layers.filter(ye=>!Tn.includes(ye.id))),_n){const ye=Object.keys(Qe.sources).filter(Pe=>!_n.includes(Pe));Rn={};for(const Pe of ye)Rn[Pe]=Qe.sources[Pe]}n(37,kr=P),a.setStyle(P,{diff:D}),Zn(qt,c=new Set,c),n(34,At=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&9&&X&&a!=null&&a.loaded())for(let Qe of Ze)!c.has(Qe.id)&&!At.has(Qe.id)&&!a.hasImage(Qe.id)&&hn(Qe);t.$$.dirty[0]&32|t.$$.dirty[1]&1&&n(6,i=Ze.every(Qe=>c.has(Qe.id))),t.$$.dirty[0]&4112&&k&&!vg(k,a==null?void 0:a.getCenter())&&(a==null||a.panTo(k)),t.$$.dirty[0]&8208&&U&&!vg(U,a==null?void 0:a.getZoom())&&(a==null||a.zoomTo(U)),t.$$.dirty[0]&16400&&B&&!vg(B,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(B)),t.$$.dirty[0]&16777232&&(oe?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[X,S,E,tt,a,c,i,r,un,qt,wr,Sr,k,U,B,w,j,$,P,D,W,re,ge,pe,oe,fe,Te,Z,ne,Ke,Ee,Ze,je,Ot,At,Tn,_n,kr,m,l,dr]}class $O extends Kt{constructor(e){super(),Yt(this,e,QO,JO,Gt,{map:15,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:16,bearing:17,bounds:14,hash:20,loaded:0,minZoom:21,maxZoom:22,antialias:23,zoomOnDoubleClick:24,locale:25,interactive:26,attributionControl:27,cooperativeGestures:28,preserveDrawingBuffer:29,maxBounds:30,images:31,standardControls:3,filterLayers:32,transformRequest:33},null,[-1,-1])}}const e5=t=>({marker:t&8}),K2=t=>({marker:t[3]});function t5(t){let e,n,r,i,a,c,l;const m=t[19].default,w=Kr(m,t,t[18],K2);return{c(){e=Re("div"),w&&w.c(),Ve(e,"tabindex",n=t[1]?0:void 0),Ve(e,"role",r=t[1]?"button":void 0),zr(e,"z-index",t[2])},m(S,E){De(S,e,E),w&&w.m(e,null),a=!0,c||(l=[T0(t[7].call(null,e)),T0(i=n5.call(null,e,t[0])),jt(e,"click",K_(t[20])),jt(e,"dblclick",K_(t[21])),jt(e,"contextmenu",K_(t[22])),jt(e,"mouseenter",t[23]),jt(e,"mouseleave",t[24]),jt(e,"mousemove",t[25]),jt(e,"keydown",t[8])],c=!0)},p(S,[E]){w&&w.p&&(!a||E&262152)&&Qr(w,m,S,S[18],a?Jr(m,S[18],E,e5):$r(S[18]),K2),(!a||E&2&&n!==(n=S[1]?0:void 0))&&Ve(e,"tabindex",n),(!a||E&2&&r!==(r=S[1]?"button":void 0))&&Ve(e,"role",r),i&&vy(i.update)&&E&1&&i.update.call(null,S[0]),E&4&&zr(e,"z-index",S[2])},i(S){a||(ve(w,S),a=!0)},o(S){Ie(w,S),a=!1},d(S){S&&ke(e),w&&w.d(S),c=!1,Ni(l)}}}function n5(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function r5(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:P=!1}=e,{draggable:D=!1}=e,{feature:k=null}=e,{offset:U=void 0}=e,{zIndex:j=void 0}=e,{rotation:$=0}=e,{opacity:B=1}=e;const W=qu(),{map:X,layerEvent:re,self:ge}=vO();Pt(t,X,je=>n(27,a=je)),Pt(t,re,je=>n(26,r=je)),Pt(t,ge,je=>n(3,i=je));function pe(je){Zn(ge,i=new Es.Marker({element:je,rotation:$,draggable:D,offset:U,opacity:B.toString()}).setLngLat(w).addTo(a),i),n(11,m=i);const Ot=()=>Te("dragstart"),wt=()=>{oe(),Te("drag")},un=()=>{oe(),Te("dragend")};return D&&(i.on("dragstart",Ot),i.on("drag",wt),i.on("dragend",un)),{destroy(){D&&(i==null||i.off("dragstart",Ot),i==null||i.off("drag",wt),i==null||i.off("dragend",un)),n(11,m=void 0),i==null||i.remove()}}}function oe(){let je=i==null?void 0:i.getLngLat();je&&(Array.isArray(w)?n(10,w=[je.lng,je.lat]):w&&"lon"in w?n(10,w={lon:je.lng,lat:je.lat}):n(10,w=je))}function fe(je){je.key===" "&&(je.preventDefault(),je.stopPropagation(),Te("click"))}function Te(je){if(!E)return;let Ot=i==null?void 0:i.getLngLat();if(!Ot)return;const wt=[Ot.lng,Ot.lat];let un={map:a,marker:i,lngLat:wt,features:[{type:"Feature",properties:(k==null?void 0:k.properties)??{},geometry:{type:"Point",coordinates:wt}}]};Zn(re,r={...un,layerType:"marker",type:je},r),W(je,un)}const Z=()=>Te("click"),ne=()=>Te("dblclick"),Ke=()=>Te("contextmenu"),Ee=je=>{Te("mouseenter")},Ze=()=>{Te("mouseleave")},tt=()=>Te("mousemove");return t.$$set=je=>{"marker"in je&&n(11,m=je.marker),"lngLat"in je&&n(10,w=je.lngLat),"class"in je&&n(0,S=je.class),"interactive"in je&&n(12,E=je.interactive),"asButton"in je&&n(1,P=je.asButton),"draggable"in je&&n(13,D=je.draggable),"feature"in je&&n(14,k=je.feature),"offset"in je&&n(15,U=je.offset),"zIndex"in je&&n(2,j=je.zIndex),"rotation"in je&&n(16,$=je.rotation),"opacity"in je&&n(17,B=je.opacity),"$$scope"in je&&n(18,l=je.$$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($)),t.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,P,j,i,X,re,ge,pe,fe,Te,w,m,E,D,k,U,$,B,l,c,Z,ne,Ke,Ee,Ze,tt]}class Fd extends Kt{constructor(e){super(),Yt(this,e,r5,t5,Gt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function i5(t){let e;const n=t[16].default,r=Kr(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)&&Qr(r,n,i,i[24],e?Jr(n,i[24],a,null):$r(i[24]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function o5(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:[i5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Uy({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function s5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=Zf("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:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:$=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function re(ne){B=ne,n(0,B)}function ge(ne){pn.call(this,t,ne)}function pe(ne){pn.call(this,t,ne)}function oe(ne){pn.call(this,t,ne)}function fe(ne){pn.call(this,t,ne)}function Te(ne){pn.call(this,t,ne)}function Z(ne){pn.call(this,t,ne)}return t.$$set=ne=>{"id"in ne&&n(1,a=ne.id),"source"in ne&&n(2,c=ne.source),"sourceLayer"in ne&&n(3,l=ne.sourceLayer),"beforeId"in ne&&n(4,m=ne.beforeId),"beforeLayerType"in ne&&n(5,w=ne.beforeLayerType),"paint"in ne&&n(6,S=ne.paint),"layout"in ne&&n(7,E=ne.layout),"filter"in ne&&n(8,P=ne.filter),"applyToClusters"in ne&&n(9,D=ne.applyToClusters),"minzoom"in ne&&n(10,k=ne.minzoom),"maxzoom"in ne&&n(11,U=ne.maxzoom),"hoverCursor"in ne&&n(12,j=ne.hoverCursor),"manageHoverState"in ne&&n(13,$=ne.manageHoverState),"hovered"in ne&&n(0,B=ne.hovered),"eventsIfTopMost"in ne&&n(14,W=ne.eventsIfTopMost),"interactive"in ne&&n(15,X=ne.interactive),"$$scope"in ne&&n(24,i=ne.$$scope)},[B,a,c,l,m,w,S,E,P,D,k,U,j,$,W,X,r,re,ge,pe,oe,fe,Te,Z,i]}class a5 extends Kt{constructor(e){super(),Yt(this,e,s5,o5,Gt,{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 l5=t=>({}),J2=t=>({}),u5=t=>({}),Q2=t=>({}),c5=t=>({}),$2=t=>({});function h5(t){let e,n,r,i,a,c;const l=t[1].top,m=Kr(l,t,t[0],$2),w=t[1].left,S=Kr(w,t,t[0],Q2),E=t[1].main,P=Kr(E,t,t[0],J2);return{c(){e=Re("div"),m&&m.c(),n=rt(),r=Re("div"),S&&S.c(),i=rt(),a=Re("div"),P&&P.c(),Ve(e,"class","top svelte-mpick2"),Ve(r,"class","left svelte-mpick2"),Ve(a,"class","main svelte-mpick2")},m(D,k){De(D,e,k),m&&m.m(e,null),De(D,n,k),De(D,r,k),S&&S.m(r,null),De(D,i,k),De(D,a,k),P&&P.m(a,null),c=!0},p(D,[k]){m&&m.p&&(!c||k&1)&&Qr(m,l,D,D[0],c?Jr(l,D[0],k,c5):$r(D[0]),$2),S&&S.p&&(!c||k&1)&&Qr(S,w,D,D[0],c?Jr(w,D[0],k,u5):$r(D[0]),Q2),P&&P.p&&(!c||k&1)&&Qr(P,E,D,D[0],c?Jr(E,D[0],k,l5):$r(D[0]),J2)},i(D){c||(ve(m,D),ve(S,D),ve(P,D),c=!0)},o(D){Ie(m,D),Ie(S,D),Ie(P,D),c=!1},d(D){D&&(ke(e),ke(n),ke(r),ke(i),ke(a)),m&&m.d(D),S&&S.d(D),P&&P.d(D)}}}function f5(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class p5 extends Kt{constructor(e){super(),Yt(this,e,f5,h5,Gt,{})}}const d5=t=>({}),eS=t=>({}),m5=t=>({}),tS=t=>({}),g5=t=>({}),nS=t=>({});function y5(t){let e,n,r,i,a,c;const l=t[4].top,m=Kr(l,t,t[3],nS),w=t[4].sidebar,S=Kr(w,t,t[3],tS),E=t[4].map,P=Kr(E,t,t[3],eS);return{c(){e=Re("div"),m&&m.c(),n=rt(),r=Re("div"),S&&S.c(),i=rt(),a=Re("div"),P&&P.c()},m(D,k){De(D,e,k),m&&m.m(e,null),t[5](e),De(D,n,k),De(D,r,k),S&&S.m(r,null),t[6](r),De(D,i,k),De(D,a,k),P&&P.m(a,null),t[7](a),c=!0},p(D,[k]){m&&m.p&&(!c||k&8)&&Qr(m,l,D,D[3],c?Jr(l,D[3],k,g5):$r(D[3]),nS),S&&S.p&&(!c||k&8)&&Qr(S,w,D,D[3],c?Jr(w,D[3],k,m5):$r(D[3]),tS),P&&P.p&&(!c||k&8)&&Qr(P,E,D,D[3],c?Jr(E,D[3],k,d5):$r(D[3]),eS)},i(D){c||(ve(m,D),ve(S,D),ve(P,D),c=!0)},o(D){Ie(m,D),Ie(S,D),Ie(P,D),c=!1},d(D){D&&(ke(e),ke(n),ke(r),ke(i),ke(a)),m&&m.d(D),t[5](null),S&&S.d(D),t[6](null),P&&P.d(D),t[7](null)}}}function _5(t,e,n){let r,i,a;Pt(t,yv,E=>n(0,r=E)),Pt(t,_v,E=>n(1,i=E)),Pt(t,vv,E=>n(2,a=E));let{$$slots:c={},$$scope:l}=e;function m(E){Un[E?"unshift":"push"](()=>{r=E,yv.set(r)})}function w(E){Un[E?"unshift":"push"](()=>{i=E,_v.set(i)})}function S(E){Un[E?"unshift":"push"](()=>{a=E,vv.set(a)})}return t.$$set=E=>{"$$scope"in E&&n(3,l=E.$$scope)},[r,i,a,l,c,m,w,S]}class Yf extends Kt{constructor(e){super(),Yt(this,e,_5,y5,Gt,{})}}let yv=sr(null),_v=sr(null),vv=sr(null);function rS(t){let e,n;return e=new Qd({props:{openOn:"hover",$$slots:{default:[v5,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function v5(t){let e,n;return e=new Iv({props:{properties:t[4]}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function b5(t){let e,n,r=t[1]&&rS(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[1]?r?(r.p(i,a),a&2&&ve(r,1)):(r=rS(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function x5(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":$d("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[b5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Gy({props:a}),Un.push(()=>Zi(e,"hovered",i)),e.$on("click",t[3]),{c(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function w5(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(ta(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 DC extends Kt{constructor(e){super(),Yt(this,e,w5,x5,Gt,{hovered:0,popups:1})}}function iS(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function oS(t,e,n){const r=t.slice();return r[6]=e[n],r}function sS(t){let e,n,r=Gg(t[6])+"",i,a,c;return{c(){e=Re("li"),n=Re("a"),i=It(r),c=rt(),Ve(n,"href",a=t[6].properties.osm_id),Ve(n,"target","_blank")},m(l,m){De(l,e,m),Se(e,n),Se(n,i),Se(e,c)},p(l,m){m&1&&r!==(r=Gg(l[6])+"")&&Bn(i,r),m&1&&a!==(a=l[6].properties.osm_id)&&Ve(n,"href",a)},d(l){l&&ke(e)}}}function aS(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",l,m,w,S,E,P=Fr(t[3]),D=[];for(let k=0;ki[1].length-r[1].length),n}function E5(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 RC extends Kt{constructor(e){super(),Yt(this,e,E5,S5,Gt,{gj:1})}}function uS(t,e,n){const r=t.slice();return r[3]=e[n],r}function cS(t){let e,n,r=Fr(t[0]),i=[];for(let a=0;a0&&cS(t);return{c(){n&&n.c(),e=Ur()},m(r,i){n&&n.m(r,i),De(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=cS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:ut,o:ut,d(r){r&&ke(e),n&&n.d(r)}}}function C5(t,e,n){let{loading:r}=e,i;function a(c){Un[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 NC extends Kt{constructor(e){super(),Yt(this,e,C5,I5,Gt,{loading:0})}}function T5(t){let e,n,r,i,a,c,l,m,w,S,E,P,D,k,U,j,$,B,W,X,re,ge,pe,oe,fe,Te;return{c(){e=Re("nav"),n=Re("ul"),r=Re("li"),i=Re("button"),i.textContent="Change study area",a=rt(),c=Re("li"),l=Re("button"),m=It("Isochrone"),S=rt(),E=Re("li"),P=Re("button"),D=It("Route"),U=rt(),j=Re("li"),$=Re("button"),B=It("Score"),X=rt(),re=Re("li"),ge=Re("button"),pe=It("Debug network"),l.disabled=w=t[0].kind=="isochrone",P.disabled=k=t[0].kind=="route",$.disabled=W=t[0].kind=="score",ge.disabled=oe=t[0].kind=="debug"},m(Z,ne){De(Z,e,ne),Se(e,n),Se(n,r),Se(r,i),Se(n,a),Se(n,c),Se(c,l),Se(l,m),Se(n,S),Se(n,E),Se(E,P),Se(P,D),Se(n,U),Se(n,j),Se(j,$),Se($,B),Se(n,X),Se(n,re),Se(re,ge),Se(ge,pe),fe||(Te=[jt(i,"click",t[1]),jt(l,"click",t[2]),jt(P,"click",t[3]),jt($,"click",t[4]),jt(ge,"click",t[5])],fe=!0)},p(Z,[ne]){ne&1&&w!==(w=Z[0].kind=="isochrone")&&(l.disabled=w),ne&1&&k!==(k=Z[0].kind=="route")&&(P.disabled=k),ne&1&&W!==(W=Z[0].kind=="score")&&($.disabled=W),ne&1&&oe!==(oe=Z[0].kind=="debug")&&(ge.disabled=oe)},i:ut,o:ut,d(Z){Z&&ke(e),fe=!1,Ni(Te)}}}function L5(t,e,n){let r;return Pt(t,Ys,w=>n(0,r=w)),[r,()=>Zn(Ys,r={kind:"title"},r),()=>Zn(Ys,r={kind:"isochrone"},r),()=>Zn(Ys,r={kind:"route"},r),()=>Zn(Ys,r={kind:"score"},r),()=>Zn(Ys,r={kind:"debug"},r)]}class jy extends Kt{constructor(e){super(),Yt(this,e,L5,T5,Gt,{})}}function fS(t,e,n){const r=t.slice();return r[9]=e[n],r[10]=e,r[11]=n,r}function P5(t){let e,n,r=t[0].join(", ")+"",i,a,c,l,m;return{c(){e=Re("p"),n=It("Amenities: "),i=It(r),a=rt(),c=Re("button"),c.textContent="Choose"},m(w,S){De(w,e,S),Se(e,n),Se(e,i),De(w,a,S),De(w,c,S),l||(m=jt(c,"click",t[6]),l=!0)},p(w,S){S&1&&r!==(r=w[0].join(", ")+"")&&Bn(i,r)},i:ut,o:ut,d(w){w&&(ke(e),ke(a),ke(c)),l=!1,m()}}}function M5(t){let e,n;return e=new Ev({props:{$$slots:{default:[A5,({dialog:r})=>({8:r}),({dialog:r})=>r?256:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&4354&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function pS(t){let e,n,r,i=t[9]+"",a,c,l,m;function w(){t[3].call(n,t[9])}return{c(){e=Re("label"),n=Re("input"),r=rt(),a=It(i),c=rt(),Ve(n,"type","checkbox")},m(S,E){De(S,e,E),Se(e,n),n.checked=t[1][t[9]],Se(e,r),Se(e,a),Se(e,c),l||(m=jt(n,"change",w),l=!0)},p(S,E){t=S,E&2&&(n.checked=t[1][t[9]]),E&2&&i!==(i=t[9]+"")&&Bn(a,i)},d(S){S&&ke(e),l=!1,m()}}}function A5(t){let e,n,r,i,a,c,l,m,w,S,E=Fr(Object.keys(t[1])),P=[];for(let k=0;k{c[S]=null}),Dn(),n=c[e],n?n.p(m,w):(n=c[e]=a[e](m),n.c()),ve(n,1),n.m(r.parentNode,r))},i(m){i||(ve(n),i=!0)},o(m){Ie(n),i=!1},d(m){m&&ke(r),c[e].d(m)}}}function D5(t){return Object.entries(t).filter(e=>e[1]).map(e=>e[0])}function R5(t,e,n){let r;Pt(t,Xl,E=>n(7,r=E));let i={},a=!1,{enabled:c}=e;ju(async()=>{let E=await r.renderDebug(),P=new Set;for(let D of E.features){let k=D.properties.amenity_kind;k&&P.add(k)}for(let D of[...P].sort())n(1,i[D]=!1,i);n(1,i)});function l(E){i[E]=this.checked,n(1,i)}const m=E=>ta(E).close(),w=()=>n(2,a=!1),S=()=>n(2,a=!0);return t.$$set=E=>{"enabled"in E&&n(0,c=E.enabled)},t.$$.update=()=>{t.$$.dirty&2&&n(0,c=D5(i))},[c,i,a,l,m,w,S]}class N5 extends Kt{constructor(e){super(),Yt(this,e,R5,k5,Gt,{enabled:0})}}function O5(t){let e,n,r,i,a,c,l,m,w;return{c(){e=Re("label"),n=It(`Mode: + `),r=Re("select"),i=Re("option"),i.textContent="Car",a=Re("option"),a.textContent="Bicycle",c=Re("option"),c.textContent="Foot",l=Re("option"),l.textContent="Public transit",i.__value="car",Go(i,i.__value),a.__value="bicycle",Go(a,a.__value),c.__value="foot",Go(c,c.__value),l.__value="transit",Go(l,l.__value),t[0]===void 0&&bd(()=>t[1].call(r))},m(S,E){De(S,e,E),Se(e,n),Se(e,r),Se(r,i),Se(r,a),Se(r,c),Se(r,l),Ng(r,t[0],!0),m||(w=jt(r,"change",t[1]),m=!0)},p(S,[E]){E&1&&Ng(r,S[0])},i:ut,o:ut,d(S){S&&ke(e),m=!1,w()}}}function z5(t,e,n){let{travelMode:r}=e;function i(){r=tE(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class v1 extends Kt{constructor(e){super(),Yt(this,e,z5,O5,Gt,{travelMode:0})}}function dS(t,e,n){const r=t.slice();return r[3]=e[n],r}function F5(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=It(e),r=It(" has "),a=It(i),c=It(" next steps (arrivals)")},m(l,m){De(l,n,m),De(l,r,m),De(l,a,m),De(l,c,m)},p(l,m){m&64&&e!==(e=l[6].name+"")&&Bn(n,e),m&64&&i!==(i=JSON.parse(l[6].next_steps).length+"")&&Bn(a,i)},d(l){l&&(ke(n),ke(r),ke(a),ke(c))}}}function B5(t){let e,n;return e=new Qd({props:{openOn:"hover",$$slots:{default:[F5,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function mS(t){let e,n;return e=new Ev({props:{$$slots:{default:[V5]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function gS(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=Re("p"),r=It(n)},m(i,a){De(i,e,a),Se(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&Bn(r,n)},d(i){i&&ke(e)}}}function V5(t){let e,n=Fr(t[0]),r=[];for(let i=0;i{a=null}),Dn())},i(c){i||(ve(e.$$.fragment,c),ve(a),i=!0)},o(c){Ie(e.$$.fragment,c),Ie(a),i=!1},d(c){c&&(ke(n),ke(r)),ot(e,c),a&&a.d(c)}}}function G5(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(ta(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class j5 extends Kt{constructor(e){super(),Yt(this,e,G5,U5,Gt,{})}}function q5(t){let e,n,r;return n=new jy({}),{c(){e=Re("div"),st(n.$$.fragment),Ve(e,"slot","top")},m(i,a){De(i,e,a),it(n,e,null),r=!0},p:ut,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Ie(n.$$.fragment,i),r=!1},d(i){i&&ke(e),ot(n)}}}function yS(t){let e,n;return e=new RC({props:{gj:t[0]}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function W5(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 v1({props:E}),Un.push(()=>Zi(c,"travelMode",S));let P=t[0]&&yS(t);return{c(){e=Re("div"),n=Re("h2"),n.textContent="Debug mode",r=rt(),i=Re("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=rt(),st(c.$$.fragment),m=rt(),P&&P.c(),Ve(e,"slot","sidebar")},m(D,k){De(D,e,k),Se(e,n),Se(e,r),Se(e,i),Se(e,a),it(c,e,null),Se(e,m),P&&P.m(e,null),w=!0},p(D,k){const U={};!l&&k&2&&(l=!0,U.travelMode=D[1],Hi(()=>l=!1)),c.$set(U),D[0]?P?(P.p(D,k),k&1&&ve(P,1)):(P=yS(D),P.c(),ve(P,1),P.m(e,null)):P&&(kn(),Ie(P,1,1,()=>{P=null}),Dn())},i(D){w||(ve(c.$$.fragment,D),ve(P),w=!0)},o(D){Ie(c.$$.fragment,D),Ie(P),w=!1},d(D){D&&ke(e),ot(c),P&&P.d()}}}function _S(t){let e,n;return e=new yl({props:{data:t[0],generateId:!0,$$slots:{default:[X5]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function H5(t){let e,n;return e=new Iv({props:{properties:t[5]}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Z5(t){let e,n;return e=new Qd({props:{openOn:"hover",$$slots:{default:[H5,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function X5(t){let e,n,r,i,a,c;return e=new Kc({props:{id:"network",paint:{"line-width":$d(5,7),"line-color":"black"},filter:fx(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[Z5]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new DC({props:{popups:!0}}),a=new j5({}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment)},m(l,m){it(e,l,m),De(l,n,m),it(r,l,m),De(l,i,m),it(a,l,m),c=!0},p(l,m){const w={};m&2&&(w.filter=fx(l[1])),m&64&&(w.$$scope={dirty:m,ctx:l}),e.$set(w)},i(l){c||(ve(e.$$.fragment,l),ve(r.$$.fragment,l),ve(a.$$.fragment,l),c=!0)},o(l){Ie(e.$$.fragment,l),Ie(r.$$.fragment,l),Ie(a.$$.fragment,l),c=!1},d(l){l&&(ke(n),ke(i)),ot(e,l),ot(r,l),ot(a,l)}}}function Y5(t){let e,n,r=t[0]&&_S(t);return{c(){e=Re("div"),r&&r.c(),Ve(e,"slot","map")},m(i,a){De(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=_S(i),r.c(),ve(r,1),r.m(e,null)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d()}}}function K5(t){let e,n;return e=new Yf({props:{$$slots:{map:[Y5],sidebar:[W5],top:[q5]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function J5(t,e,n){let r,i;Pt(t,Xl,m=>n(4,r=m)),Pt(t,hf,m=>n(1,i=m));let a=null;ju(async()=>{n(0,a=await r.renderDebug())});const c=m=>window.open(ta(m.detail.features[0].properties).way,"_blank");function l(m){i=m,hf.set(i)}return[a,i,c,l]}class Q5 extends Kt{constructor(e){super(),Yt(this,e,J5,K5,Gt,{})}}const Bd=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"];function vS(t){let e,n=Gg(t[2])+"",r,i,a=t[2].properties.amenity_kind+"",c,l;return{c(){e=Re("span"),r=It(n),i=It(" ("),c=It(a),l=It(")")},m(m,w){De(m,e,w),Se(e,r),Se(e,i),Se(e,c),Se(e,l)},p(m,w){w&4&&n!==(n=Gg(m[2])+"")&&Bn(r,n),w&4&&a!==(a=m[2].properties.amenity_kind+"")&&Bn(c,a)},d(m){m&&ke(e)}}}function $5(t){let e,n,r,i;n=new jy({});let a=t[2]&&vS(t);return{c(){e=Re("div"),st(n.$$.fragment),r=rt(),a&&a.c(),Ve(e,"slot","top"),zr(e,"display","flex"),zr(e,"justify-content","space-between")},m(c,l){De(c,e,l),it(n,e,null),Se(e,r),a&&a.m(e,null),i=!0},p(c,l){c[2]?a?a.p(c,l):(a=vS(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i(c){i||(ve(n.$$.fragment,c),i=!0)},o(c){Ie(n.$$.fragment,c),i=!1},d(c){c&&ke(e),ot(n),a&&a.d()}}}function bS(t){let e,n;return{c(){e=Re("p"),n=It(t[7])},m(r,i){De(r,e,i),Se(e,n)},p(r,i){i&128&&Bn(n,r[7])},d(r){r&&ke(e)}}}function xS(t){let e,n;return e=new RC({props:{gj:t[5]}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function ez(t){let e,n,r,i,a,c,l,m,w,S,E,P,D,k,U,j,$,B,W,X,re,ge,pe;function oe(ne){t[12](ne)}let fe={};t[4]!==void 0&&(fe.travelMode=t[4]),c=new v1({props:fe}),Un.push(()=>Zi(c,"travelMode",oe)),B=new sE({props:{colorScale:Bd,limits:t[8]}});let Te=t[7]&&bS(t),Z=t[5]&&xS(t);return{c(){e=Re("div"),n=Re("h2"),n.textContent="Isochrone mode",r=rt(),i=Re("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time + in seconds.`,a=rt(),st(c.$$.fragment),m=rt(),w=Re("label"),S=It(`Start time (PT only) + `),E=Re("input"),D=rt(),k=Re("label"),U=Re("input"),j=It("Contours"),$=rt(),st(B.$$.fragment),W=rt(),Te&&Te.c(),X=rt(),Z&&Z.c(),Ve(E,"type","time"),E.disabled=P=t[4]!="transit",Ve(U,"type","checkbox"),Ve(e,"slot","sidebar")},m(ne,Ke){De(ne,e,Ke),Se(e,n),Se(e,r),Se(e,i),Se(e,a),it(c,e,null),Se(e,m),Se(e,w),Se(w,S),Se(w,E),Go(E,t[3]),Se(e,D),Se(e,k),Se(k,U),U.checked=t[1],Se(k,j),Se(e,$),it(B,e,null),Se(e,W),Te&&Te.m(e,null),Se(e,X),Z&&Z.m(e,null),re=!0,ge||(pe=[jt(E,"input",t[13]),jt(U,"change",t[14])],ge=!0)},p(ne,Ke){const Ee={};!l&&Ke&16&&(l=!0,Ee.travelMode=ne[4],Hi(()=>l=!1)),c.$set(Ee),(!re||Ke&16&&P!==(P=ne[4]!="transit"))&&(E.disabled=P),Ke&8&&Go(E,ne[3]),Ke&2&&(U.checked=ne[1]),ne[7]?Te?Te.p(ne,Ke):(Te=bS(ne),Te.c(),Te.m(e,X)):Te&&(Te.d(1),Te=null),ne[5]?Z?(Z.p(ne,Ke),Ke&32&&ve(Z,1)):(Z=xS(ne),Z.c(),ve(Z,1),Z.m(e,null)):Z&&(kn(),Ie(Z,1,1,()=>{Z=null}),Dn())},i(ne){re||(ve(c.$$.fragment,ne),ve(B.$$.fragment,ne),ve(Z),re=!0)},o(ne){Ie(c.$$.fragment,ne),Ie(B.$$.fragment,ne),Ie(Z),re=!1},d(ne){ne&&ke(e),ot(c),ot(B),Te&&Te.d(),Z&&Z.d(),ge=!1,Ni(pe)}}}function wS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[tz]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Fd({props:a}),Un.push(()=>Zi(e,"lngLat",i)),{c(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function tz(t){let e;return{c(){e=Re("span"),e.textContent="X",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function SS(t){let e,n;return e=new yl({props:{data:t[5],generateId:!0,$$slots:{default:[iz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function nz(t){let e=(t[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=It(e),r=It(" minutes away")},m(i,a){De(i,n,a),De(i,r,a)},p(i,a){a&262144&&e!==(e=(i[18].cost_seconds/60).toFixed(1)+"")&&Bn(n,e)},d(i){i&&(ke(n),ke(r))}}}function rz(t){let e,n;return e=new Qd({props:{openOn:"hover",$$slots:{default:[nz,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function iz(t){let e,n,r,i,a,c,l;e=new Kc({props:{id:"isochrone",filter:pO,paint:{"line-width":20,"line-color":gv(["get","cost_seconds"],t[9],Bd),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[rz]},$$scope:{ctx:t}}}),r=new kC({props:{id:"isochrone-contours",filter:fO,paint:{"fill-color":gv(["get","min_seconds"],t[9],Bd),"fill-opacity":.5}}});function m(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new DC({props:w}),Un.push(()=>Zi(a,"hovered",m)),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment)},m(S,E){it(e,S,E),De(S,n,E),it(r,S,E),De(S,i,E),it(a,S,E),l=!0},p(S,E){const P={};E&524288&&(P.$$scope={dirty:E,ctx:S}),e.$set(P);const D={};!c&&E&4&&(c=!0,D.hovered=S[2],Hi(()=>c=!1)),a.$set(D)},i(S){l||(ve(e.$$.fragment,S),ve(r.$$.fragment,S),ve(a.$$.fragment,S),l=!0)},o(S){Ie(e.$$.fragment,S),Ie(r.$$.fragment,S),Ie(a.$$.fragment,S),l=!1},d(S){S&&(ke(n),ke(i)),ot(e,S),ot(r,S),ot(a,S)}}}function ES(t){let e,n;return e=new yl({props:{data:t[6],$$slots:{default:[oz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function oz(t){let e,n;return e=new Kc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function sz(t){let e,n,r,i,a=t[0]&&wS(t),c=t[5]&&SS(t),l=t[6]&&ES(t);return{c(){e=Re("div"),a&&a.c(),n=rt(),c&&c.c(),r=rt(),l&&l.c(),Ve(e,"slot","map")},m(m,w){De(m,e,w),a&&a.m(e,null),Se(e,n),c&&c.m(e,null),Se(e,r),l&&l.m(e,null),i=!0},p(m,w){m[0]?a?(a.p(m,w),w&1&&ve(a,1)):(a=wS(m),a.c(),ve(a,1),a.m(e,n)):a&&(kn(),Ie(a,1,1,()=>{a=null}),Dn()),m[5]?c?(c.p(m,w),w&32&&ve(c,1)):(c=SS(m),c.c(),ve(c,1),c.m(e,r)):c&&(kn(),Ie(c,1,1,()=>{c=null}),Dn()),m[6]?l?(l.p(m,w),w&64&&ve(l,1)):(l=ES(m),l.c(),ve(l,1),l.m(e,null)):l&&(kn(),Ie(l,1,1,()=>{l=null}),Dn())},i(m){i||(ve(a),ve(c),ve(l),i=!0)},o(m){Ie(a),Ie(c),Ie(l),i=!1},d(m){m&&ke(e),a&&a.d(),c&&c.d(),l&&l.d()}}}function az(t){let e,n;return e=new Yf({props:{$$slots:{map:[sz],sidebar:[ez],top:[$5]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function IS(t,e,n){return e+t*(n-e)}function lz(t,e,n){let r,i,a;Pt(t,Ug,re=>n(3,r=re)),Pt(t,hf,re=>n(4,i=re)),Pt(t,Xl,re=>n(15,a=re));let c=null;ju(async()=>{let re=await a.getBounds();n(0,c={lng:IS(.5,re[0],re[2]),lat:IS(.5,re[1],re[3])})});let l=!0,m=null,w=null,S="",E;async function P(re,ge,pe,oe){if(c)try{n(5,m=await a.isochrone({start:c,mode:i,contours:l,startTime:r})),n(7,S="")}catch(fe){n(5,m=null),fe=fe.toString()}}async function D(re,ge,pe){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(oe){n(6,w=null),oe=oe.toString()}else n(6,w=null)}let k=[0,3,6,9,12,15],U=k.map(re=>re*60);function j(re){c=re,n(0,c)}function $(re){E=re,n(2,E)}function B(re){i=re,hf.set(i)}function W(){r=this.value,Ug.set(r)}function X(){l=this.checked,n(1,l)}return t.$$.update=()=>{t.$$.dirty&27&&P(),t.$$.dirty&13&&D()},[c,l,E,r,i,m,w,S,k,U,j,$,B,W,X]}class uz extends Kt{constructor(e){super(),Yt(this,e,lz,az,Gt,{})}}function CS(t,e,n){const r=t.slice();r[18]=e[n];const i=ta(r[18].properties);return r[17]=i,r}function cz(t){let e,n,r;return n=new jy({}),{c(){e=Re("div"),st(n.$$.fragment),Ve(e,"slot","top")},m(i,a){De(i,e,a),it(n,e,null),r=!0},p:ut,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Ie(n.$$.fragment,i),r=!1},d(i){i&&ke(e),ot(n)}}}function hz(t){let e,n,r,i,a,c=Fr(t[5].features),l=[];for(let m=0;mZi(i,"travelMode",ge));function oe(Z,ne){if(Z[6])return fz;if(Z[5])return hz}let fe=oe(t),Te=fe&&fe(t);return{c(){e=Re("div"),n=Re("h2"),n.textContent="Route mode",r=rt(),st(i.$$.fragment),c=rt(),l=Re("label"),m=Re("input"),S=It(` + Use heuristic (PT only)`),E=rt(),P=Re("label"),D=It(`Start time (PT only) + `),k=Re("input"),j=rt(),$=Re("p"),$.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to + set the first pin somewhere.)`,B=rt(),Te&&Te.c(),Ve(m,"type","checkbox"),m.disabled=w=t[4]!="transit",Ve(k,"type","time"),k.disabled=U=t[4]!="transit",Ve(e,"slot","sidebar")},m(Z,ne){De(Z,e,ne),Se(e,n),Se(e,r),it(i,e,null),Se(e,c),Se(e,l),Se(l,m),m.checked=t[3],Se(l,S),Se(e,E),Se(e,P),Se(P,D),Se(P,k),Go(k,t[2]),Se(e,j),Se(e,$),Se(e,B),Te&&Te.m(e,null),W=!0,X||(re=[jt(m,"change",t[12]),jt(k,"input",t[13])],X=!0)},p(Z,ne){const Ke={};!a&&ne&16&&(a=!0,Ke.travelMode=Z[4],Hi(()=>a=!1)),i.$set(Ke),(!W||ne&16&&w!==(w=Z[4]!="transit"))&&(m.disabled=w),ne&8&&(m.checked=Z[3]),(!W||ne&16&&U!==(U=Z[4]!="transit"))&&(k.disabled=U),ne&4&&Go(k,Z[2]),fe===(fe=oe(Z))&&Te?Te.p(Z,ne):(Te&&Te.d(1),Te=fe&&fe(Z),Te&&(Te.c(),Te.m(e,null)))},i(Z){W||(ve(i.$$.fragment,Z),W=!0)},o(Z){Ie(i.$$.fragment,Z),W=!1},d(Z){Z&&ke(e),ot(i),Te&&Te.d(),X=!1,Ni(re)}}}function _z(t){let e;return{c(){e=Re("span"),e.textContent="A",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function vz(t){let e;return{c(){e=Re("span"),e.textContent="B",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function LS(t){let e,n;return e=new yl({props:{data:t[5],generateId:!0,$$slots:{default:[wz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function bz(t){let e,n;return e=new Iv({props:{properties:t[17]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&131072&&(a.properties=r[17]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function xz(t){let e,n;return e=new Qd({props:{openOn:"hover",$$slots:{default:[bz,({props:r})=>({17:r}),({props:r})=>r?131072:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&2228224&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function wz(t){let e,n;return e=new Kc({props:{id:"route",paint:{"line-width":20,"line-color":g1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":$d(.5,1)},manageHoverState:!0,$$slots:{default:[xz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&2097152&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Sz(t){let e,n,r,i,a,c,l,m,w,S;n=new GO({}),n.$on("contextmenu",t[7]);function E(j){t[9](j)}let P={draggable:!0,$$slots:{default:[_z]},$$scope:{ctx:t}};t[1]!==void 0&&(P.lngLat=t[1]),i=new Fd({props:P}),Un.push(()=>Zi(i,"lngLat",E));function D(j){t[10](j)}let k={draggable:!0,$$slots:{default:[vz]},$$scope:{ctx:t}};t[0]!==void 0&&(k.lngLat=t[0]),l=new Fd({props:k}),Un.push(()=>Zi(l,"lngLat",D));let U=t[5]&&LS(t);return{c(){e=Re("div"),st(n.$$.fragment),r=rt(),st(i.$$.fragment),c=rt(),st(l.$$.fragment),w=rt(),U&&U.c(),Ve(e,"slot","map")},m(j,$){De(j,e,$),it(n,e,null),Se(e,r),it(i,e,null),Se(e,c),it(l,e,null),Se(e,w),U&&U.m(e,null),S=!0},p(j,$){const B={};$&2097152&&(B.$$scope={dirty:$,ctx:j}),!a&&$&2&&(a=!0,B.lngLat=j[1],Hi(()=>a=!1)),i.$set(B);const W={};$&2097152&&(W.$$scope={dirty:$,ctx:j}),!m&&$&1&&(m=!0,W.lngLat=j[0],Hi(()=>m=!1)),l.$set(W),j[5]?U?(U.p(j,$),$&32&&ve(U,1)):(U=LS(j),U.c(),ve(U,1),U.m(e,null)):U&&(kn(),Ie(U,1,1,()=>{U=null}),Dn())},i(j){S||(ve(n.$$.fragment,j),ve(i.$$.fragment,j),ve(l.$$.fragment,j),ve(U),S=!0)},o(j){Ie(n.$$.fragment,j),Ie(i.$$.fragment,j),Ie(l.$$.fragment,j),Ie(U),S=!1},d(j){j&&ke(e),ot(n),ot(i),ot(l),U&&U.d()}}}function Ez(t){let e,n;return e=new Yf({props:{$$slots:{map:[Sz],sidebar:[yz],top:[cz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&2097279&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Iz(t,e,n){let r,i,a,c,l,m,w;Pt(t,ff,X=>n(0,r=X)),Pt(t,Ic,X=>n(1,i=X)),Pt(t,Ys,X=>n(14,a=X)),Pt(t,Ug,X=>n(2,c=X)),Pt(t,px,X=>n(3,l=X)),Pt(t,hf,X=>n(4,m=X)),Pt(t,Xl,X=>n(15,w=X));let S=null,E="";async function P(X,re,ge,pe,oe){try{n(5,S=await w.route({start:X,end:[re.lng,re.lat],mode:ge,debugSearch:!1,useHeuristic:l,startTime:c})),n(6,E="")}catch(fe){n(5,S=null),n(6,E=fe.toString())}}function D(X){Zn(Ic,i=X.detail.lngLat,i)}async function k(){try{let X=await w.route({start:i,end:[r.lng,r.lat],mode:m,debugSearch:!0,useHeuristic:l,startTime:c});Zn(Ys,a={kind:"debug-route",debugGj:X,start:i,end:r,routeGj:S},a)}catch(X){n(6,E=X.toString())}}function U(X){i=X,Ic.set(i)}function j(X){r=X,ff.set(r)}function $(X){m=X,hf.set(m)}function B(){l=this.checked,px.set(l)}function W(){c=this.value,Ug.set(c)}return t.$$.update=()=>{t.$$.dirty&31&&P(i,r,m)},[r,i,c,l,m,S,E,D,k,U,j,$,B,W]}class Cz extends Kt{constructor(e){super(),Yt(this,e,Iz,Ez,Gt,{})}}function Tz(t){let e,n,r,i;return{c(){e=Re("div"),n=Re("button"),n.textContent="Back",Ve(e,"slot","top")},m(a,c){De(a,e,c),Se(e,n),r||(i=jt(n,"click",t[10]),r=!0)},p:ut,d(a){a&&ke(e),r=!1,i()}}}function Lz(t){let e,n,r,i,a,c,l,m,w,S=ta(t[4].features[t[4].features.length-1].properties).time+"",E,P,D;return{c(){e=Re("div"),n=Re("h2"),n.textContent="Debugging a route",r=rt(),i=Re("p"),i.textContent=`${t[6]} total nodes searched`,a=rt(),c=Re("input"),l=rt(),m=Re("p"),w=It("Search is currently at "),E=It(S),Ve(c,"type","range"),Ve(c,"min","1"),Ve(c,"max",t[6]),Ve(e,"slot","sidebar")},m(k,U){De(k,e,U),Se(e,n),Se(e,r),Se(e,i),Se(e,a),Se(e,c),Go(c,t[3]),Se(e,l),Se(e,m),Se(m,w),Se(m,E),P||(D=[jt(c,"change",t[9]),jt(c,"input",t[9])],P=!0)},p(k,U){U&8&&Go(c,k[3]),U&16&&S!==(S=ta(k[4].features[k[4].features.length-1].properties).time+"")&&Bn(E,S)},d(k){k&&ke(e),P=!1,Ni(D)}}}function Pz(t){let e;return{c(){e=Re("span"),e.textContent="A",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function Mz(t){let e;return{c(){e=Re("span"),e.textContent="B",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function Az(t){let e,n;return e=new Kc({props:{paint:{"line-width":20,"line-color":g1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function kz(t){let e,n,r,i;return e=new Gy({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new Kc({props:{paint:{"line-width":5,"line-color":g1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment)},m(a,c){it(e,a,c),De(a,n,c),it(r,a,c),i=!0},p:ut,i(a){i||(ve(e.$$.fragment,a),ve(r.$$.fragment,a),i=!0)},o(a){Ie(e.$$.fragment,a),Ie(r.$$.fragment,a),i=!1},d(a){a&&ke(n),ot(e,a),ot(r,a)}}}function Dz(t){let e,n,r,i,a,c,l,m,w;return n=new Fd({props:{lngLat:t[0],$$slots:{default:[Pz]},$$scope:{ctx:t}}}),i=new Fd({props:{lngLat:t[1],$$slots:{default:[Mz]},$$scope:{ctx:t}}}),c=new yl({props:{data:t[2],$$slots:{default:[Az]},$$scope:{ctx:t}}}),m=new yl({props:{data:t[4],generateId:!0,$$slots:{default:[kz]},$$scope:{ctx:t}}}),{c(){e=Re("div"),st(n.$$.fragment),r=rt(),st(i.$$.fragment),a=rt(),st(c.$$.fragment),l=rt(),st(m.$$.fragment),Ve(e,"slot","map")},m(S,E){De(S,e,E),it(n,e,null),Se(e,r),it(i,e,null),Se(e,a),it(c,e,null),Se(e,l),it(m,e,null),w=!0},p(S,E){const P={};E&1&&(P.lngLat=S[0]),E&4096&&(P.$$scope={dirty:E,ctx:S}),n.$set(P);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||(ve(n.$$.fragment,S),ve(i.$$.fragment,S),ve(c.$$.fragment,S),ve(m.$$.fragment,S),w=!0)},o(S){Ie(n.$$.fragment,S),Ie(i.$$.fragment,S),Ie(c.$$.fragment,S),Ie(m.$$.fragment,S),w=!1},d(S){S&&ke(e),ot(n),ot(i),ot(c),ot(m)}}}function Rz(t){let e,n,r,i;return e=new Yf({props:{$$slots:{map:[Dz],sidebar:[Lz],top:[Tz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(a,c){it(e,a,c),n=!0,r||(i=jt(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){Ie(e.$$.fragment,a),n=!1},d(a){ot(e,a),r=!1,i()}}}function Nz(t,e,n){let r,i,a;Pt(t,by,U=>n(11,i=U)),Pt(t,Ys,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 P(U){U.key=="ArrowLeft"&&E>1&&(U.stopPropagation(),n(3,E--,E)),U.key=="ArrowRight"&&E{i==null||i.keyboard.disable()}),as(()=>{i==null||i.keyboard.enable()});function D(){E=KL(this.value),n(3,E)}const k=()=>Zn(Ys,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,P,c,D,k]}class Oz extends Kt{constructor(e){super(),Yt(this,e,Nz,Rz,Gt,{debugGj:8,start:0,end:1,routeGj:2})}}function PS(t){let e,n;return e=new NC({props:{loading:t[2]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&4&&(a.loading=r[2]),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function MS(t){let e,n,r=t[1].properties.poi+"",i,a,c=t[1].properties.cost+"",l,m;return{c(){e=Re("span"),n=It("From "),i=It(r),a=It(", it's "),l=It(c),m=It(" seconds to the nearest parking")},m(w,S){De(w,e,S),Se(e,n),Se(e,i),Se(e,a),Se(e,l),Se(e,m)},p(w,S){S&2&&r!==(r=w[1].properties.poi+"")&&Bn(i,r),S&2&&c!==(c=w[1].properties.cost+"")&&Bn(l,c)},d(w){w&&ke(e)}}}function zz(t){let e,n,r,i;n=new jy({});let a=t[1]&&MS(t);return{c(){e=Re("div"),st(n.$$.fragment),r=rt(),a&&a.c(),Ve(e,"slot","top"),zr(e,"display","flex"),zr(e,"justify-content","space-between")},m(c,l){De(c,e,l),it(n,e,null),Se(e,r),a&&a.m(e,null),i=!0},p(c,l){c[1]?a?a.p(c,l):(a=MS(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i(c){i||(ve(n.$$.fragment,c),i=!0)},o(c){Ie(n.$$.fragment,c),i=!1},d(c){c&&ke(e),ot(n),a&&a.d()}}}function Fz(t){let e,n,r,i,a,c,l,m,w,S,E,P,D,k,U,j,$,B;function W(re){t[9](re)}let X={};return t[0]!==void 0&&(X.enabled=t[0]),i=new N5({props:X}),Un.push(()=>Zi(i,"enabled",W)),l=new sE({props:{colorScale:Bd,limits:t[7]}}),{c(){e=Re("div"),n=Re("h2"),n.textContent="Score mode",r=rt(),st(i.$$.fragment),c=rt(),st(l.$$.fragment),m=rt(),w=Re("label"),S=Re("input"),E=It(` + Show parking`),P=rt(),D=Re("p"),D.textContent=`This is an early experiment of a mode to show an "access score". Right + now, it's starting from every POI based on the types chosen below and + walking up to 10 minutes 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.`,k=rt(),U=Re("p"),U.innerHTML='Parking icon from OpenStreetMap Carto',Ve(S,"type","checkbox"),Ve(e,"slot","sidebar")},m(re,ge){De(re,e,ge),Se(e,n),Se(e,r),it(i,e,null),Se(e,c),it(l,e,null),Se(e,m),Se(e,w),Se(w,S),S.checked=t[3],Se(w,E),Se(e,P),Se(e,D),Se(e,k),Se(e,U),j=!0,$||(B=jt(S,"change",t[10]),$=!0)},p(re,ge){const pe={};!a&&ge&1&&(a=!0,pe.enabled=re[0],Hi(()=>a=!1)),i.$set(pe),ge&8&&(S.checked=re[3])},i(re){j||(ve(i.$$.fragment,re),ve(l.$$.fragment,re),j=!0)},o(re){Ie(i.$$.fragment,re),Ie(l.$$.fragment,re),j=!1},d(re){re&&ke(e),ot(i),ot(l),$=!1,B()}}}function AS(t){let e,n;return e=new yl({props:{data:t[4],generateId:!0,$$slots:{default:[Bz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.data=r[4]),i&32770&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Bz(t){let e,n,r;function i(c){t[8](c)}let a={paint:{"circle-radius":15,"circle-color":gv(["get","cost"],t[7],Bd),"circle-stroke-width":$d(1,3),"circle-stroke-color":"black"},manageHoverState:!0};return t[1]!==void 0&&(a.hovered=t[1]),e=new Gy({props:a}),Un.push(()=>Zi(e,"hovered",i)),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,l){const m={};!n&&l&2&&(n=!0,m.hovered=c[1],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function kS(t){let e,n;return e=new yl({props:{data:t[5],$$slots:{default:[Vz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&32768&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Vz(t){let e,n;return e=new Kc({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Uz(t){return{c:ut,m:ut,p:ut,i:ut,o:ut,d:ut}}function Gz(t){let e,n;return e=new yl({props:{data:t[14],$$slots:{default:[jz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[14]),i&32776&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function jz(t){let e,n;return e=new a5({props:{filter:["==",["get","amenity_kind"],"bicycle_parking"],layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:t[3]?"visible":"none"}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.layout={"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[3]?"visible":"none"}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function qz(t){return{c:ut,m:ut,p:ut,i:ut,o:ut,d:ut}}function Wz(t){let e,n,r,i,a,c=t[4]&&AS(t),l=t[5]&&kS(t),m={ctx:t,current:null,token:null,hasCatch:!1,pending:qz,then:Gz,catch:Uz,value:14,blocks:[,,,]};return Og(i=ta(t[6]).renderDebug(),m),{c(){e=Re("div"),c&&c.c(),n=rt(),l&&l.c(),r=rt(),m.block.c(),Ve(e,"slot","map")},m(w,S){De(w,e,S),c&&c.m(e,null),Se(e,n),l&&l.m(e,null),Se(e,r),m.block.m(e,m.anchor=null),m.mount=()=>e,m.anchor=null,a=!0},p(w,S){t=w,t[4]?c?(c.p(t,S),S&16&&ve(c,1)):(c=AS(t),c.c(),ve(c,1),c.m(e,n)):c&&(kn(),Ie(c,1,1,()=>{c=null}),Dn()),t[5]?l?(l.p(t,S),S&32&&ve(l,1)):(l=kS(t),l.c(),ve(l,1),l.m(e,r)):l&&(kn(),Ie(l,1,1,()=>{l=null}),Dn()),m.ctx=t,S&64&&i!==(i=ta(t[6]).renderDebug())&&Og(i,m)||oE(m,t,S)},i(w){a||(ve(c),ve(l),ve(m.block),a=!0)},o(w){Ie(c),Ie(l);for(let S=0;S<3;S+=1){const E=m.blocks[S];Ie(E)}a=!1},d(w){w&&ke(e),c&&c.d(),l&&l.d(),m.block.d(),m.token=null,m=null}}}function Hz(t){let e,n,r,i=t[4]==null&&PS(t);return n=new Yf({props:{$$slots:{map:[Wz],sidebar:[Fz],top:[zz]},$$scope:{ctx:t}}}),{c(){i&&i.c(),e=rt(),st(n.$$.fragment)},m(a,c){i&&i.m(a,c),De(a,e,c),it(n,a,c),r=!0},p(a,[c]){a[4]==null?i?(i.p(a,c),c&16&&ve(i,1)):(i=PS(a),i.c(),ve(i,1),i.m(e.parentNode,e)):i&&(kn(),Ie(i,1,1,()=>{i=null}),Dn());const l={};c&32891&&(l.$$scope={dirty:c,ctx:a}),n.$set(l)},i(a){r||(ve(i),ve(n.$$.fragment,a),r=!0)},o(a){Ie(i),Ie(n.$$.fragment,a),r=!1},d(a){a&&ke(e),i&&i.d(a),ot(n,a)}}}function Zz(t,e,n){let r;Pt(t,Xl,$=>n(6,r=$));let i=[],a=[],c=!0,l=null;async function m($){n(2,i=[...i,"Calculating scores"]),n(4,l=await r.score({poiKinds:a},Tv(w))),n(2,i=[])}function w($){n(2,i=[...i,$])}let S=null,E=Array.from(Array(6).keys()).map($=>60*10/(6-1)*$),P;async function D($){if(P)try{n(5,S=await r.route({start:{lng:P.geometry.coordinates[0],lat:P.geometry.coordinates[1]},end:[P.properties.closest_lon,P.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(B){console.log(`No route: ${B}`),n(5,S=null)}else n(5,S=null)}function k($){P=$,n(1,P)}function U($){a=$,n(0,a)}function j(){c=this.checked,n(3,c)}return t.$$.update=()=>{t.$$.dirty&1&&m(),t.$$.dirty&2&&D()},[a,P,i,c,l,S,r,E,k,U,j]}class Xz extends Kt{constructor(e){super(),Yt(this,e,Zz,Hz,Gt,{})}}var wo=63710088e-1,b1={centimeters:wo*100,centimetres:wo*100,degrees:wo/111325,feet:wo*3.28084,inches:wo*39.37,kilometers:wo/1e3,kilometres:wo/1e3,meters:wo,metres:wo,miles:wo/1609.344,millimeters:wo*1e3,millimetres:wo*1e3,nauticalmiles:wo/1852,radians:1,yards:wo*1.0936},Yz={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/wo,yards:1.0936133},bv={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 fa(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 Kz(t,e,n){switch(t){case"Point":return rs(e).geometry;case"LineString":return Js(e).geometry;case"Polygon":return x1(e).geometry;case"MultiPoint":return zC(e).geometry;case"MultiLineString":return OC(e).geometry;case"MultiPolygon":return FC(e).geometry;default:throw new Error(t+" is invalid")}}function rs(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!yy(t[0])||!yy(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return fa(r,e,n)}function Jz(t,e,n){return n===void 0&&(n={}),Gc(t.map(function(r){return rs(r,e)}),n)}function x1(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 w1(t,e){e===void 0&&(e="kilometers");var n=b1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function qy(t,e){e===void 0&&(e="kilometers");var n=b1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function nF(t,e){return Vd(qy(t,e))}function rF(t){var e=t%360;return e<0&&(e+=360),e}function Vd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function Qs(t){var e=t%360;return e*Math.PI/180}function iF(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 w1(qy(t,e),n)}function oF(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=bv[e];if(!r)throw new Error("invalid original units");var i=bv[n];if(!i)throw new Error("invalid final units");return t/r*i}function yy(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function S1(t){return!!t&&t.constructor===Object}function sF(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(!yy(e))throw new Error("bbox must only contain numbers")})}function aF(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 lF=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:bv,bearingToAzimuth:rF,convertArea:oF,convertLength:iF,degreesToRadians:Qs,earthRadius:wo,factors:b1,feature:fa,featureCollection:Gc,geometry:Kz,geometryCollection:eF,isNumber:yy,isObject:S1,lengthToDegrees:nF,lengthToRadians:qy,lineString:Js,lineStrings:$z,multiLineString:OC,multiPoint:zC,multiPolygon:FC,point:rs,points:Jz,polygon:x1,polygons:Qz,radiansToDegrees:Vd,radiansToLength:w1,round:tF,unitsFactors:Yz,validateBBox:sF,validateId:aF},Symbol.toStringTag,{value:"Module"}));function Ud(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 zf(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 BC(t,e,n){if(n===void 0&&(n={}),n.final===!0)return uF(t,e);var r=Ud(t),i=Ud(e),a=Qs(r[0]),c=Qs(i[0]),l=Qs(r[1]),m=Qs(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 Vd(Math.atan2(w,S))}function uF(t,e){var n=BC(e,t);return n=(n+180)%360,n}function rd(t,e,n){n===void 0&&(n={});var r=Ud(t),i=Ud(e),a=Qs(i[1]-r[1]),c=Qs(i[0]-r[0]),l=Qs(r[1]),m=Qs(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(m);return w1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function DS(t,e,n,r){r===void 0&&(r={});var i=Ud(t),a=Qs(i[0]),c=Qs(i[1]),l=Qs(n),m=qy(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=Vd(S),P=Vd(w);return rs([E,P],r.properties)}function em(t,e,n){if(t!==null)for(var r,i,a,c,l,m,w,S=0,E=0,P,D=t.type,k=D==="FeatureCollection",U=D==="Feature",j=k?t.features.length:1,$=0;$m||k>w||U>S){l=E,m=r,w=k,S=U,a=0;return}var j=Js([l,E],n.properties);if(e(j,r,i,U,a)===!1)return!1;a++,l=E})===!1)return!1}}})}function gF(t,e,n){var r=n,i=!1;return UC(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 GC(t,e){if(!t)throw new Error("geojson is required");Kf(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 I1={exports:{}},jC={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Gd,function(){function n(B,W,X,re,ge){(function pe(oe,fe,Te,Z,ne){for(;Z>Te;){if(Z-Te>600){var Ke=Z-Te+1,Ee=fe-Te+1,Ze=Math.log(Ke),tt=.5*Math.exp(2*Ze/3),je=.5*Math.sqrt(Ze*tt*(Ke-tt)/Ke)*(Ee-Ke/2<0?-1:1),Ot=Math.max(Te,Math.floor(fe-Ee*tt/Ke+je)),wt=Math.min(Z,Math.floor(fe+(Ke-Ee)*tt/Ke+je));pe(oe,fe,Ot,wt,ne)}var un=oe[fe],qt=Te,At=Z;for(r(oe,Te,fe),ne(oe[Z],un)>0&&r(oe,Te,Z);qt0;)At--}ne(oe[Te],un)===0?r(oe,Te,At):r(oe,++At,Z),At<=fe&&(Te=At+1),fe<=At&&(Z=At-1)}})(B,W,X||0,re||B.length-1,ge||i)}function r(B,W,X){var re=B[W];B[W]=B[X],B[X]=re}function i(B,W){return BW?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,W,X){if(!X)return W.indexOf(B);for(var re=0;re=B.minX&&W.maxY>=B.minY}function j(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function $(B,W,X,re,ge){for(var pe=[W,X];pe.length;)if(!((X=pe.pop())-(W=pe.pop())<=re)){var oe=W+Math.ceil((X-W)/re/2)*re;n(B,oe,W,X,ge),pe.push(W,oe,oe,X)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(B){var W=this.data,X=[];if(!U(B,W))return X;for(var re=this.toBBox,ge=[];W;){for(var pe=0;pe=0&&ge[W].children.length>this._maxEntries;)this._split(ge,W),W--;this._adjustParentBBoxes(re,ge,W)},a.prototype._split=function(B,W){var X=B[W],re=X.children.length,ge=this._minEntries;this._chooseSplitAxis(X,ge,re);var pe=this._chooseSplitIndex(X,ge,re),oe=j(X.children.splice(pe,X.children.length-pe));oe.height=X.height,oe.leaf=X.leaf,l(X,this.toBBox),l(oe,this.toBBox),W?B[W-1].children.push(oe):this._splitRoot(X,oe)},a.prototype._splitRoot=function(B,W){this.data=j([B,W]),this.data.height=B.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(B,W,X){for(var re,ge,pe,oe,fe,Te,Z,ne=1/0,Ke=1/0,Ee=W;Ee<=X-W;Ee++){var Ze=m(B,0,Ee,this.toBBox),tt=m(B,Ee,X,this.toBBox),je=(ge=Ze,pe=tt,oe=void 0,fe=void 0,Te=void 0,Z=void 0,oe=Math.max(ge.minX,pe.minX),fe=Math.max(ge.minY,pe.minY),Te=Math.min(ge.maxX,pe.maxX),Z=Math.min(ge.maxY,pe.maxY),Math.max(0,Te-oe)*Math.max(0,Z-fe)),Ot=P(Ze)+P(tt);je=W;ne--){var Ke=B.children[ne];w(oe,B.leaf?ge(Ke):Ke),fe+=D(oe)}return fe},a.prototype._adjustParentBBoxes=function(B,W,X){for(var re=X;re>=0;re--)w(W[re],B)},a.prototype._condense=function(B){for(var W=B.length-1,X=void 0;W>=0;W--)B[W].children.length===0?W>0?(X=B[W-1].children).splice(X.indexOf(B[W]),1):this.clear():l(B[W],this.toBBox)},a})})(jC);var EF=jC.exports;const IF=xy(lF),CF=xy(bF),TF=xy(iD);var el=EF,qC=IF,WC=CF,$h=TF.default,LF=WC.featureEach;WC.coordEach;qC.polygon;var NS=qC.featureCollection;function HC(t){var e=new el(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:$h(n),el.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:$h(i),r.push(i)}):LF(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:$h(i),r.push(i)}),el.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:$h(n),el.prototype.remove.call(this,n,r)},e.clear=function(){return el.prototype.clear.call(this)},e.search=function(n){var r=el.prototype.search.call(this,this.toBBox(n));return NS(r)},e.collides=function(n){return el.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=el.prototype.all.call(this);return NS(n)},e.toJSON=function(){return el.prototype.toJSON.call(this)},e.fromJSON=function(n){return el.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=$h(n);else if(n.type==="FeatureCollection")r=$h(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}I1.exports=HC;I1.exports.default=HC;var PF=I1.exports;const MF=Lv(PF);function AF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=fa(t)),e.type==="LineString"&&(e=fa(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=OS(t,e);return i&&r.push(i),Gc(r)}var a=MF();return a.load(RS(e)),_y(RS(t),function(c){_y(a.search(c),function(l){var m=OS(c,l);if(m){var w=zf(m).join(",");n[w]||(n[w]=!0,r.push(m))}})}),Gc(r)}function OS(t,e){var n=zf(t),r=zf(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],P=(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(P===0)return null;var U=D/P,j=k/P;if(U>=0&&U<=1&&j>=0&&j<=1){var $=i+U*(c-i),B=a+U*(l-a);return rs([$,B])}return null}function kF(t,e,n){n===void 0&&(n={});var r=rs([1/0,1/0],{dist:1/0}),i=0;return Kf(t,function(a){for(var c=zf(a),l=0;l0&&(j=U.features[0],j.properties.dist=rd(e,j,n),j.properties.location=i+rd(m,j,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()}});yi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(zS(this.points).forEach((r,i)=>{n.push([i+1,kF(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))});yi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=C0(e.lngLat.toArray()),this.onClick(e),this.finish())});yi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});yi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});yi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});yi(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=C0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat(zS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),XC.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,YC.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=C0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(ZC),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 zS(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 FF(t){let e,n,r;return{c(){e=It("Undo ("),n=It(t[1]),r=It(")")},m(i,a){De(i,e,a),De(i,n,a),De(i,r,a)},p(i,a){a&2&&Bn(n,i[1])},d(i){i&&(ke(e),ke(n),ke(r))}}}function BF(t){let e;return{c(){e=It("Undo")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function VF(t){let e,n,r,i,a,c,l,m,w,S,E;function P(U,j){return U[1]==0?BF:FF}let D=P(t),k=D(t);return{c(){e=Re("div"),n=Re("button"),n.textContent="Finish",r=rt(),i=Re("button"),i.textContent="Cancel",a=rt(),c=Re("button"),k.c(),m=rt(),w=Re("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,zr(e,"display","flex"),zr(e,"justify-content","space-between")},m(U,j){De(U,e,j),Se(e,n),Se(e,r),Se(e,i),Se(e,a),Se(e,c),k.m(c,null),De(U,m,j),De(U,w,j),S||(E=[jt(n,"click",t[2]),jt(i,"click",t[3]),jt(c,"click",t[4])],S=!0)},p(U,[j]){D===(D=P(U))&&k?k.p(U,j):(k.d(1),k=D(U),k&&(k.c(),k.m(c,null))),j&2&&l!==(l=U[1]==0)&&(c.disabled=l)},i:ut,o:ut,d(U){U&&(ke(e),ke(m),ke(w)),k.d(),S=!1,Ni(E)}}}function UF(t,e,n){let r;Pt(t,YC,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 GF extends Kt{constructor(e){super(),Yt(this,e,UF,VF,Gt,{polygonTool:0})}}let jF=Date.now();function tm(t){return`${t}-${jF++}`}const KC=Symbol.for("svelte-maplibre");function qF(){return wv(KC)}function FS(t){return{subscribe:t.subscribe}}function JC({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=qF(),a=sr(null),c=FS(a),l={...i,[t]:FS(a)};if(e&&(l.popupTarget=c),r){let m=sr(null);l.layerEvent=m,i.layerEvent=m}return n&&(l.cluster=sr()),xv(KC,l),{...i,self:a}}function WF(){return JC({key:"source",setCluster:!0})}function HF(t=!0){return JC({key:"layer",setPopupTarget:t,setMouseEvent:t})}function BS(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 ZF(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 VS(t){let e=t[0],n,r,i=US(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c[0]&1&&Gt(e,e=a[0])?(kn(),Ie(i,1,1,ut),Dn(),i=US(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Ie(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function US(t){let e;const n=t[36].default,r=Kr(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)&&Qr(r,n,i,i[35],e?Jr(n,i[35],a,null):$r(i[35]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function YF(t){let e,n,r=t[0]&&VS(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&ve(r,1)):(r=VS(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function KF(t,e,n){let r,i,a,c,l,m,w,S,E,P,D,k,{$$slots:U={},$$scope:j}=e,{id:$=tm("layer")}=e,{source:B=void 0}=e,{sourceLayer:W=void 0}=e,{beforeId:X=void 0}=e,{beforeLayerType:re=void 0}=e,{type:ge}=e,{paint:pe=void 0}=e,{layout:oe=void 0}=e,{filter:fe=void 0}=e,{applyToClusters:Te=void 0}=e,{minzoom:Z=void 0}=e,{maxzoom:ne=void 0}=e,{manageHoverState:Ke=!1}=e,{hovered:Ee=null}=e,{interactive:Ze=!0}=e,{hoverCursor:tt=void 0}=e,{eventsIfTopMost:je=!1}=e;const Ot=qu(),{map:wt,source:un,self:qt,minzoom:At,maxzoom:hn,eventTopMost:Tn,layerInfo:_n}=HF();Pt(t,wt,ye=>n(31,E=ye)),Pt(t,un,ye=>n(32,P=ye)),Pt(t,qt,ye=>n(0,S=ye)),Pt(t,At,ye=>n(34,k=ye)),Pt(t,hn,ye=>n(33,D=ye)),as(()=>{S&&E&&(_n.delete(S),E==null||E.removeLayer(S))});let vn;function Rn(ye){var Oe,Jt;if(!Ze||!S||!E||je&&Tn(ye)!==S)return;let Pe=ye.features??[],Ct=(Jt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Jt.cluster_id,Nn={event:ye,map:E,clusterId:Ct,layer:S,source:l,features:Pe};Ot(ye.type,Nn)}function wr(ye){var Oe,Jt;if(!Ze||!S||!E||je&&Tn(ye)!==S)return;tt&&(E.getCanvas().style.cursor=tt);let Pe=ye.features??[];n(6,Ee=Pe[0]??null);let Ct=(Jt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Jt.cluster_id;Ot("mouseenter",{event:ye,map:E,clusterId:Ct,layer:S,source:l,features:Pe})}function kr(ye){var Oe,Jt,Dr;if(!Ze||!E)return;if(je&&Tn(ye)!==S){n(6,Ee=null),Ke&&vn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:W,id:vn},{hover:!1}),vn=void 0);return}E.getCanvas().style.cursor=tt;let Pe=ye.features??[],Ct=(Jt=(Oe=Pe[0])==null?void 0:Oe.properties)==null?void 0:Jt.cluster_id,Nn=(Dr=Pe[0])==null?void 0:Dr.id;Nn!==vn&&(Ke&&(vn!==void 0&&(E==null||E.setFeatureState({source:l,id:vn,sourceLayer:W},{hover:!1})),E==null||E.setFeatureState({source:l,id:Nn,sourceLayer:W},{hover:!0})),vn=Nn,n(6,Ee=Pe[0]??null)),Ot("mousemove",{event:ye,map:E,clusterId:Ct,layer:S,source:l,features:Pe})}function Sr(ye){if(!(!Ze||!S||!E)){if(tt&&(E.getCanvas().style.cursor=""),n(6,Ee=null),Ke&&vn!==void 0){const Pe={source:l,id:vn,sourceLayer:W};E==null||E.setFeatureState(Pe,{hover:!1}),vn=void 0}Ot("mouseleave",{map:E,layer:S,source:l})}}let dr=!0;function Qe(ye){E&&(E.off("click",ye,Rn),E.off("dblclick",ye,Rn),E.off("contextmenu",ye,Rn),E.off("mouseenter",ye,wr),E.off("mousemove",ye,kr),E.off("mouseleave",ye,Sr))}return as(()=>{E&&S&&Qe(S)}),t.$$set=ye=>{"id"in ye&&n(7,$=ye.id),"source"in ye&&n(8,B=ye.source),"sourceLayer"in ye&&n(9,W=ye.sourceLayer),"beforeId"in ye&&n(10,X=ye.beforeId),"beforeLayerType"in ye&&n(11,re=ye.beforeLayerType),"type"in ye&&n(12,ge=ye.type),"paint"in ye&&n(13,pe=ye.paint),"layout"in ye&&n(14,oe=ye.layout),"filter"in ye&&n(15,fe=ye.filter),"applyToClusters"in ye&&n(16,Te=ye.applyToClusters),"minzoom"in ye&&n(17,Z=ye.minzoom),"maxzoom"in ye&&n(18,ne=ye.maxzoom),"manageHoverState"in ye&&n(19,Ke=ye.manageHoverState),"hovered"in ye&&n(6,Ee=ye.hovered),"interactive"in ye&&n(20,Ze=ye.interactive),"hoverCursor"in ye&&n(21,tt=ye.hoverCursor),"eventsIfTopMost"in ye&&n(22,je=ye.eventsIfTopMost),"$$scope"in ye&&n(35,j=ye.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=XF(Te)),t.$$.dirty[0]&1073774592&&n(24,i=ZF("all",r,fe)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Z??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=ne??D),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||P),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==$&&l){S&&(Qe(S),_n.delete(S));let ye=X;if(!X&&re){let Pe=E.getStyle().layers,Ct=typeof re=="function"?re:Oe=>Oe.type===re,Nn=Pe==null?void 0:Pe.find(Ct);Nn&&(ye=Nn.id)}Zn(qt,S=$,S),E.addLayer(Uc({id:S,type:ge,source:l,"source-layer":W,filter:i,paint:pe,layout:oe,minzoom:a,maxzoom:c}),ye),n(23,dr=!0),E.on("click",S,Rn),E.on("dblclick",S,Rn),E.on("contextmenu",S,Rn),E.on("mouseenter",S,wr),E.on("mousemove",S,kr),E.on("mouseleave",S,Sr)}t.$$.dirty[0]&1048577&&S&&_n.set(S,{interactive:Ze}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,m=S?BS((ye,Pe)=>E==null?void 0:E.setPaintProperty(S,ye,Pe)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?BS((ye,Pe)=>E==null?void 0:E.setLayoutProperty(S,ye,Pe)):void 0),t.$$.dirty[0]&268443648&&(m==null||m(pe)),t.$$.dirty[0]&134234112&&(w==null||w(oe)),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&&(dr?n(23,dr=!1):E==null||E.setFilter(S,i))},[S,wt,un,qt,At,hn,Ee,$,B,W,X,re,ge,pe,oe,fe,Te,Z,ne,Ke,Ze,tt,je,dr,i,c,a,w,m,l,r,E,P,D,k,j,U]}class C1 extends Kt{constructor(e){super(),Yt(this,e,KF,YF,Gt,{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 JF(t){let e;const n=t[16].default,r=Kr(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)&&Qr(r,n,i,i[24],e?Jr(n,i[24],a,null):$r(i[24]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function QF(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:[JF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new C1({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function $F(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tm("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:P=void 0}=e,{applyToClusters:D=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:$=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function re(ne){B=ne,n(0,B)}function ge(ne){pn.call(this,t,ne)}function pe(ne){pn.call(this,t,ne)}function oe(ne){pn.call(this,t,ne)}function fe(ne){pn.call(this,t,ne)}function Te(ne){pn.call(this,t,ne)}function Z(ne){pn.call(this,t,ne)}return t.$$set=ne=>{"id"in ne&&n(1,a=ne.id),"source"in ne&&n(2,c=ne.source),"sourceLayer"in ne&&n(3,l=ne.sourceLayer),"beforeId"in ne&&n(4,m=ne.beforeId),"beforeLayerType"in ne&&n(5,w=ne.beforeLayerType),"paint"in ne&&n(6,S=ne.paint),"layout"in ne&&n(7,E=ne.layout),"filter"in ne&&n(8,P=ne.filter),"applyToClusters"in ne&&n(9,D=ne.applyToClusters),"minzoom"in ne&&n(10,k=ne.minzoom),"maxzoom"in ne&&n(11,U=ne.maxzoom),"hoverCursor"in ne&&n(12,j=ne.hoverCursor),"manageHoverState"in ne&&n(13,$=ne.manageHoverState),"hovered"in ne&&n(0,B=ne.hovered),"eventsIfTopMost"in ne&&n(14,W=ne.eventsIfTopMost),"interactive"in ne&&n(15,X=ne.interactive),"$$scope"in ne&&n(24,i=ne.$$scope)},[B,a,c,l,m,w,S,E,P,D,k,U,j,$,W,X,r,re,ge,pe,oe,fe,Te,Z,i]}class e6 extends Kt{constructor(e){super(),Yt(this,e,$F,QF,Gt,{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 t6(t){let e;const n=t[15].default,r=Kr(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)&&Qr(r,n,i,i[23],e?Jr(n,i[23],a,null):$r(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function n6(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:[t6]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new C1({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function r6(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tm("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:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:W=!0}=e;function X(Z){$=Z,n(0,$)}function re(Z){pn.call(this,t,Z)}function ge(Z){pn.call(this,t,Z)}function pe(Z){pn.call(this,t,Z)}function oe(Z){pn.call(this,t,Z)}function fe(Z){pn.call(this,t,Z)}function Te(Z){pn.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,l=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,U=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,$=Z.hovered),"eventsIfTopMost"in Z&&n(13,B=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[$,a,c,l,m,w,S,E,P,D,k,U,j,B,W,r,X,re,ge,pe,oe,fe,Te,i]}class i6 extends Kt{constructor(e){super(),Yt(this,e,r6,n6,Gt,{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 o6(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 s6(t,e,n){iE().then(()=>{let r=$S(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function GS(t){let e=t[0],n,r,i=jS(t);return{c(){i.c(),n=Ur()},m(a,c){i.m(a,c),De(a,n,c),r=!0},p(a,c){c&1&&Gt(e,e=a[0])?(kn(),Ie(i,1,1,ut),Dn(),i=jS(a),i.c(),ve(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ve(i),r=!0)},o(a){Ie(i),r=!1},d(a){a&&ke(n),i.d(a)}}}function jS(t){let e;const n=t[15].default,r=Kr(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)&&Qr(r,n,i,i[14],e?Jr(n,i[14],a,null):$r(i[14]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function a6(t){let e,n,r=t[0]&&GS(t);return{c(){r&&r.c(),e=Ur()},m(i,a){r&&r.m(i,a),De(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ve(r,1)):(r=GS(i),r.c(),ve(r,1),r.m(e.parentNode,e)):r&&(kn(),Ie(r,1,1,()=>{r=null}),Dn())},i(i){n||(ve(r),n=!0)},o(i){Ie(r),n=!1},d(i){i&&ke(e),r&&r.d(i)}}}function l6(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:m=tm("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:P=void 0}=e,{lineMetrics:D=void 0}=e,{cluster:k=void 0}=e;const{map:U,cluster:j,self:$}=WF();Pt(t,U,X=>n(13,i=X)),Pt(t,j,X=>n(16,a=X)),Pt(t,$,X=>n(0,r=X));let B,W=!0;return as(()=>{r&&B&&i&&(s6(U,r,B),Zn($,r=null,r),n(11,B=void 0))}),t.$$set=X=>{"id"in X&&n(4,m=X.id),"data"in X&&n(5,w=X.data),"generateId"in X&&n(6,S=X.generateId),"promoteId"in X&&n(7,E=X.promoteId),"filter"in X&&n(8,P=X.filter),"lineMetrics"in X&&n(9,D=X.lineMetrics),"cluster"in X&&n(10,k=X.cluster),"$$scope"in X&&n(14,l=X.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Zn(j,a=k,a),t.$$.dirty&12273&&i&&r!==m&&(Zn($,r=m,r),o6(i,r,Uc({type:"geojson",data:w,filter:P,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}),X=>i&&X===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,W=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(m))})),t.$$.dirty&6176&&B&&(W?n(12,W=!1):B.setData(w)),t.$$.dirty&3072&&(B==null||B.setClusterOptions(Uc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,U,j,$,m,w,S,E,P,D,k,B,W,i,l,c]}class u6 extends Kt{constructor(e){super(),Yt(this,e,l6,a6,Gt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function c6(t){let e;const n=t[15].default,r=Kr(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)&&Qr(r,n,i,i[23],e?Jr(n,i[23],a,null):$r(i[23]),null)},i(i){e||(ve(r,i),e=!0)},o(i){Ie(r,i),e=!1},d(i){r&&r.d(i)}}}function h6(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:[c6]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new C1({props:a}),Un.push(()=>Zi(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(){st(e.$$.fragment)},m(c,l){it(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],Hi(()=>n=!1)),e.$set(m)},i(c){r||(ve(e.$$.fragment,c),r=!0)},o(c){Ie(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function f6(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tm("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:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:W=!0}=e;function X(Z){$=Z,n(0,$)}function re(Z){pn.call(this,t,Z)}function ge(Z){pn.call(this,t,Z)}function pe(Z){pn.call(this,t,Z)}function oe(Z){pn.call(this,t,Z)}function fe(Z){pn.call(this,t,Z)}function Te(Z){pn.call(this,t,Z)}return t.$$set=Z=>{"id"in Z&&n(1,a=Z.id),"source"in Z&&n(2,c=Z.source),"sourceLayer"in Z&&n(3,l=Z.sourceLayer),"beforeId"in Z&&n(4,m=Z.beforeId),"beforeLayerType"in Z&&n(5,w=Z.beforeLayerType),"paint"in Z&&n(6,S=Z.paint),"layout"in Z&&n(7,E=Z.layout),"filter"in Z&&n(8,P=Z.filter),"minzoom"in Z&&n(9,D=Z.minzoom),"maxzoom"in Z&&n(10,k=Z.maxzoom),"hoverCursor"in Z&&n(11,U=Z.hoverCursor),"manageHoverState"in Z&&n(12,j=Z.manageHoverState),"hovered"in Z&&n(0,$=Z.hovered),"eventsIfTopMost"in Z&&n(13,B=Z.eventsIfTopMost),"interactive"in Z&&n(14,W=Z.interactive),"$$scope"in Z&&n(23,i=Z.$$scope)},[$,a,c,l,m,w,S,E,P,D,k,U,j,B,W,r,X,re,ge,pe,oe,fe,Te,i]}class p6 extends Kt{constructor(e){super(),Yt(this,e,f6,h6,Gt,{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 d6(t){let e,n,r,i,a,c;return e=new i6({props:{id:"edit-polygon-fill",filter:DF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new p6({props:{id:"edit-polygon-lines",filter:RF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new e6({props:{id:"edit-polygon-vertices",filter:NF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment)},m(l,m){it(e,l,m),De(l,n,m),it(r,l,m),De(l,i,m),it(a,l,m),c=!0},p:ut,i(l){c||(ve(e.$$.fragment,l),ve(r.$$.fragment,l),ve(a.$$.fragment,l),c=!0)},o(l){Ie(e.$$.fragment,l),Ie(r.$$.fragment,l),Ie(a.$$.fragment,l),c=!1},d(l){l&&(ke(n),ke(i)),ot(e,l),ot(r,l),ot(a,l)}}}function m6(t){let e,n;return e=new u6({props:{data:t[0],$$slots:{default:[d6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function g6(t,e,n){let r;return Pt(t,XC,i=>n(0,r=i)),[r]}class y6 extends Kt{constructor(e){super(),Yt(this,e,g6,m6,Gt,{})}}function _6(t){let e,n,r,i,a,c,l;return{c(){e=Re("button"),e.textContent="Import current view",n=rt(),r=Re("i"),r.textContent="or...",i=rt(),a=Re("button"),a.textContent="Draw an area to import on the map",Ve(e,"type","button"),Ve(a,"type","button")},m(m,w){De(m,e,w),De(m,n,w),De(m,r,w),De(m,i,w),De(m,a,w),c||(l=[jt(e,"click",t[1]),jt(a,"click",t[2])],c=!0)},p:ut,i:ut,o:ut,d(m){m&&(ke(e),ke(n),ke(r),ke(i),ke(a)),c=!1,Ni(l)}}}function v6(t){let e,n;return e=new GF({props:{polygonTool:t[0]}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function b6(t){let e,n,r,i;const a=[v6,_6],c=[];function l(m,w){return m[0]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=Ur()},m(m,w){c[e].m(m,w),De(m,r,w),i=!0},p(m,[w]){let S=e;e=l(m),e===S?c[e].p(m,w):(kn(),Ie(c[S],1,1,()=>{c[S]=null}),Dn(),n=c[e],n?n.p(m,w):(n=c[e]=a[e](m),n.c()),ve(n,1),n.m(r.parentNode,r))},i(m){i||(ve(n),i=!0)},o(m){Ie(n),i=!1},d(m){m&&ke(r),c[e].d(m)}}}function id(t){return[t.lng,t.lat]}function x6(t,e,n){let{map:r}=e;const i=qu();let a=null;async function c(S){try{i("loading","Loading from Overpass");let P=await(await fetch(S6(S))).text();i("gotXml",P)}catch(E){i("error",E.toString())}}function l(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[id(S.getSouthWest()),id(S.getNorthWest()),id(S.getNorthEast()),id(S.getSouthEast()),id(S.getSouthWest())]],type:"Polygon"}}}async function 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 zF(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 w6 extends Kt{constructor(e){super(),Yt(this,e,x6,b6,Gt,{map:3})}}function S6(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 qS(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function WS(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function HS(t){let e,n=t[26]+"",r,i;return{c(){e=Re("option"),r=It(n),e.__value=i=t[25],Go(e,e.__value)},m(a,c){De(a,e,c),Se(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&Bn(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,Go(e,e.__value))},d(a){a&&ke(e)}}}function ZS(t){let e,n,r=Fr(t[22]),i=[];for(let a=0;at[9].call(c)),Ve(k,"type","file"),Ve(fe,"type","file")},m(Ze,tt){it(e,Ze,tt),De(Ze,n,tt),De(Ze,r,tt),Se(r,i),Se(i,a),Se(i,c),Se(c,l);for(let je=0;jen(15,r=oe)),Pt(t,Xl,oe=>n(16,i=oe)),Pt(t,by,oe=>n(5,a=oe));let c="",l=[],m=!1,w=[];ju(async()=>{try{let oe=await fetch("/osm/areas.json");if(oe.ok)m=!0,console.log("Using local cache, not od2net.org"),n(2,w=await oe.json());else{let fe=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await fe.json())}}catch{}});let S;async function E(oe){try{await k(await S.files[0].arrayBuffer()),n(0,c="")}catch(fe){window.alert(`Couldn't open this file: ${fe}`)}n(1,l=[])}let P;async function D(oe){try{n(1,l=["Loading pre-built file"]);let fe=await P.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(fe)),console.timeEnd("load"),Zn(lf,r=!0,r),n(0,c="")}catch(fe){window.alert(`Couldn't open this file: ${fe}`)}n(1,l=[])}async function k(oe){n(1,l=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(oe),Tv(U)),console.timeEnd("load"),Zn(lf,r=!0,r)}function U(oe){n(1,l=[...l,oe])}async function j(oe){try{await k(new TextEncoder().encode(oe.detail)),n(0,c="")}catch(fe){window.alert(`Couldn't import from Overpass: ${fe}`)}n(1,l=[])}async function $(oe){oe!=""&&(m?await B(`/osm/${oe}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${oe}.pbf`))}async function B(oe){try{n(1,l=[`Downloading ${oe}`]);let fe=await fetch(oe);await k(await fe.arrayBuffer())}catch(fe){window.alert(`Couldn't open from URL ${oe}: ${fe}`)}n(1,l=[])}function W(){c=tE(this),n(0,c),n(2,w)}function X(oe){Un[oe?"unshift":"push"](()=>{S=oe,n(3,S)})}const re=oe=>n(1,l=[...l,oe.detail]),ge=oe=>window.alert(oe.detail);function pe(oe){Un[oe?"unshift":"push"](()=>{P=oe,n(4,P)})}return t.$$.update=()=>{t.$$.dirty&1&&$(c)},[c,l,w,S,P,a,E,D,j,W,X,re,ge,pe]}class C6 extends Kt{constructor(e){super(),Yt(this,e,I6,E6,Gt,{})}}function T6(t){let e;return{c(){e=Re("div"),Ve(e,"slot","top")},m(n,r){De(n,e,r)},p:ut,d(n){n&&ke(e)}}}function L6(t){let e;return{c(){e=Re("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){De(n,e,r)},i:ut,o:ut,d(n){n&&ke(e)}}}function P6(t){let e,n;return e=new C6({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function M6(t){let e,n,r,i,a,c;const l=[P6,L6],m=[];function w(S,E){return S[0]?0:1}return i=w(t),a=m[i]=l[i](t),{c(){e=Re("div"),n=Re("h2"),n.textContent="Choose your study area",r=rt(),a.c(),Ve(e,"slot","sidebar")},m(S,E){De(S,e,E),Se(e,n),Se(e,r),m[i].m(e,null),c=!0},p(S,E){let P=i;i=w(S),i!==P&&(kn(),Ie(m[P],1,1,()=>{m[P]=null}),Dn(),a=m[i],a||(a=m[i]=l[i](S),a.c()),ve(a,1),a.m(e,null))},i(S){c||(ve(a),c=!0)},o(S){Ie(a),c=!1},d(S){S&&ke(e),m[i].d()}}}function A6(t){let e,n,r;return n=new y6({}),{c(){e=Re("div"),st(n.$$.fragment),Ve(e,"slot","map")},m(i,a){De(i,e,a),it(n,e,null),r=!0},p:ut,i(i){r||(ve(n.$$.fragment,i),r=!0)},o(i){Ie(n.$$.fragment,i),r=!1},d(i){i&&ke(e),ot(n)}}}function k6(t){let e,n;return e=new Yf({props:{$$slots:{map:[A6],sidebar:[M6],top:[T6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function D6(t,e,n){let r,i,a,c,l;return Pt(t,ff,m=>n(1,r=m)),Pt(t,Ic,m=>n(2,i=m)),Pt(t,Xl,m=>n(3,a=m)),Pt(t,lf,m=>n(4,c=m)),Pt(t,by,m=>n(0,l=m)),ju(async()=>{Zn(lf,c=!1,c),await a.unset(),Zn(Ic,i=null,i),Zn(ff,r=null,r)}),[l]}class R6 extends Kt{constructor(e){super(),Yt(this,e,D6,k6,Gt,{})}}function N6(){return new Worker("/15m/assets/worker-e9143c35.js")}function O6(t){let e,n,r,i,a,c;return{c(){e=Re("div"),n=Re("button"),n.innerHTML=`A/B Street logo`,r=rt(),i=Re("span"),Ve(n,"class","outline"),zr(i,"width","100%"),Ve(e,"slot","top"),zr(e,"display","flex")},m(l,m){De(l,e,m),Se(e,n),Se(e,r),Se(e,i),t[17](i),a||(c=jt(n,"click",t[16]),a=!0)},p:ut,d(l){l&&ke(e),t[17](null),a=!1,c()}}}function XS(t){let e,n,r,i,a,c;return{c(){e=Re("hr"),n=rt(),r=Re("div"),i=Re("button"),i.textContent="Zoom to fit"},m(l,m){De(l,e,m),De(l,n,m),De(l,r,m),Se(r,i),a||(c=jt(i,"click",t[8]),a=!0)},p:ut,d(l){l&&(ke(e),ke(n),ke(r)),a=!1,c()}}}function z6(t){let e,n,r,i,a,c=t[5].kind!="title"&&XS(t);return{c(){e=Re("div"),n=Re("h1"),n.textContent="15-minute neighbourhood tool",r=rt(),i=Re("div"),a=rt(),c&&c.c(),Ve(e,"slot","left")},m(l,m){De(l,e,m),Se(e,n),Se(e,r),Se(e,i),t[15](i),Se(e,a),c&&c.m(e,null)},p(l,m){l[5].kind!="title"?c?c.p(l,m):(c=XS(l),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(l){l&&ke(e),t[15](null),c&&c.d()}}}function YS(t){let e,n;return e=new R6({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function KS(t){let e,n,r,i,a,c,l={ctx:t,current:null,token:null,hasCatch:!1,pending:U6,then:B6,catch:F6,value:21,blocks:[,,,]};Og(e=ta(t[6]).getInvertedBoundary(),l);const m=[H6,W6,q6,j6,G6],w=[];function S(E,P){return E[5].kind=="debug"?0:E[5].kind=="isochrone"?1:E[5].kind=="route"?2:E[5].kind=="score"?3:E[5].kind=="debug-route"?4:-1}return~(r=S(t))&&(i=w[r]=m[r](t)),{c(){l.block.c(),n=rt(),i&&i.c(),a=Ur()},m(E,P){l.block.m(E,l.anchor=P),l.mount=()=>n.parentNode,l.anchor=n,De(E,n,P),~r&&w[r].m(E,P),De(E,a,P),c=!0},p(E,P){t=E,l.ctx=t,P&64&&e!==(e=ta(t[6]).getInvertedBoundary())&&Og(e,l)||oE(l,t,P);let D=r;r=S(t),r===D?~r&&w[r].p(t,P):(i&&(kn(),Ie(w[D],1,1,()=>{w[D]=null}),Dn()),~r?(i=w[r],i?i.p(t,P):(i=w[r]=m[r](t),i.c()),ve(i,1),i.m(a.parentNode,a)):i=null)},i(E){c||(ve(l.block),ve(i),c=!0)},o(E){for(let P=0;P<3;P+=1){const D=l.blocks[P];Ie(D)}Ie(i),c=!1},d(E){E&&(ke(n),ke(a)),l.block.d(E),l.token=null,l=null,~r&&w[r].d(E)}}}function F6(t){return{c:ut,m:ut,p:ut,i:ut,o:ut,d:ut}}function B6(t){let e,n;return e=new yl({props:{data:t[21],$$slots:{default:[V6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[21]),i&4194304&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function V6(t){let e,n;return e=new kC({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function U6(t){return{c:ut,m:ut,p:ut,i:ut,o:ut,d:ut}}function G6(t){let e,n;return e=new Oz({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){st(e.$$.fragment)},m(r,i){it(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){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function j6(t){let e,n;return e=new Xz({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function q6(t){let e,n;return e=new Cz({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function W6(t){let e,n;return e=new uz({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function H6(t){let e,n;return e=new Q5({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:ut,i(r){n||(ve(e.$$.fragment,r),n=!0)},o(r){Ie(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Z6(t){let e,n,r,i,a,c,l;e=new VN({props:{map:t[0],apiKey:gE}});let m=t[5].kind=="title"&&YS(),w=t[4]&&KS(t);return{c(){st(e.$$.fragment),n=rt(),r=Re("div"),i=rt(),m&&m.c(),a=rt(),w&&w.c(),c=Ur()},m(S,E){it(e,S,E),De(S,n,E),De(S,r,E),t[12](r),De(S,i,E),m&&m.m(S,E),De(S,a,E),w&&w.m(S,E),De(S,c,E),l=!0},p(S,E){const P={};E&1&&(P.map=S[0]),e.$set(P),S[5].kind=="title"?m?E&32&&ve(m,1):(m=YS(),m.c(),ve(m,1),m.m(a.parentNode,a)):m&&(kn(),Ie(m,1,1,()=>{m=null}),Dn()),S[4]?w?(w.p(S,E),E&16&&ve(w,1)):(w=KS(S),w.c(),ve(w,1),w.m(c.parentNode,c)):w&&(kn(),Ie(w,1,1,()=>{w=null}),Dn())},i(S){l||(ve(e.$$.fragment,S),ve(m),ve(w),l=!0)},o(S){Ie(e.$$.fragment,S),Ie(m),Ie(w),l=!1},d(S){S&&(ke(n),ke(r),ke(i),ke(a),ke(c)),ot(e,S),t[12](null),m&&m.d(S),w&&w.d(S)}}}function X6(t){let e,n,r,i;function a(l){t[13](l)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${gE}`,standardControls:!0,hash:!0,images:[{id:"cycle_parking",url:oP}],$$slots:{default:[Z6]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new $O({props:c}),Un.push(()=>Zi(n,"map",a)),n.$on("error",t[14]),{c(){e=Re("div"),st(n.$$.fragment),Ve(e,"slot","main"),zr(e,"position","relative"),zr(e,"width","100%"),zr(e,"height","100vh")},m(l,m){De(l,e,m),it(n,e,null),i=!0},p(l,m){const w={};m&4194425&&(w.$$scope={dirty:m,ctx:l}),!r&&m&1&&(r=!0,w.map=l[0],Hi(()=>r=!1)),n.$set(w)},i(l){i||(ve(n.$$.fragment,l),i=!0)},o(l){Ie(n.$$.fragment,l),i=!1},d(l){l&&ke(e),ot(n)}}}function Y6(t){let e,n,r,i;return e=new BP({}),r=new p5({props:{$$slots:{main:[X6],left:[z6],top:[O6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment)},m(a,c){it(e,a,c),De(a,n,c),it(r,a,c),i=!0},p(a,[c]){const l={};c&4194559&&(l.$$scope={dirty:c,ctx:a}),r.$set(l)},i(a){i||(ve(e.$$.fragment,a),ve(r.$$.fragment,a),i=!0)},o(a){Ie(e.$$.fragment,a),Ie(r.$$.fragment,a),i=!1},d(a){a&&ke(n),ot(e,a),ot(r,a)}}}function bg(t,e,n){return e+t*(n-e)}function K6(t,e,n){let r,i,a,c,l,m,w,S,E;Pt(t,vv,oe=>n(9,r=oe)),Pt(t,_v,oe=>n(10,i=oe)),Pt(t,yv,oe=>n(11,a=oe)),Pt(t,lf,oe=>n(4,c=oe)),Pt(t,Ys,oe=>n(5,l=oe)),Pt(t,ff,oe=>n(18,m=oe)),Pt(t,Ic,oe=>n(19,w=oe)),Pt(t,Xl,oe=>n(6,S=oe)),Pt(t,Vg,oe=>n(7,E=oe)),ju(async()=>{const oe=hE(new N6);let fe=await new oe;Xl.set(fe)});let P;async function D(){P&&c&&P.fitBounds(await S.getBounds(),{animate:!1})}async function k(oe){if(oe){console.log("New map model loaded");let fe=await S.getBounds();Zn(Ic,w={lng:bg(.4,fe[0],fe[2]),lat:bg(.4,fe[1],fe[3])},w),Zn(ff,m={lng:bg(.6,fe[0],fe[2]),lat:bg(.6,fe[1],fe[3])},m),await D(),Zn(Ys,l={kind:"isochrone"},l)}}let U,j,$;function B(oe){Un[oe?"unshift":"push"](()=>{$=oe,n(3,$),n(9,r)})}function W(oe){P=oe,n(0,P)}const X=oe=>{console.log(oe.detail.error)};function re(oe){Un[oe?"unshift":"push"](()=>{j=oe,n(2,j),n(10,i)})}const ge=()=>Zn(Vg,E=!0,E);function pe(oe){Un[oe?"unshift":"push"](()=>{U=oe,n(1,U),n(11,a)})}return t.$$.update=()=>{t.$$.dirty&1&&P&&by.set(P),t.$$.dirty&16&&k(c),t.$$.dirty&2050&&U&&a&&(n(1,U.innerHTML="",U),U.appendChild(a)),t.$$.dirty&1028&&j&&i&&(n(2,j.innerHTML="",j),j.appendChild(i)),t.$$.dirty&520&&$&&r&&(n(3,$.innerHTML="",$),$.appendChild(r))},[P,U,j,$,c,l,S,E,D,r,i,a,B,W,X,re,ge,pe]}class J6 extends Kt{constructor(e){super(),Yt(this,e,K6,Y6,Gt,{})}}new J6({target:document.getElementById("app")}); diff --git a/index.html b/index.html index 1370c26..3eb154b 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ 15-minute neighborhood tool - +