@arenarium/maps 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (function(ne,Xe){typeof exports=="object"&&typeof module<"u"?Xe(exports):typeof define=="function"&&define.amd?define(["exports"],Xe):(ne=typeof globalThis<"u"?globalThis:ne||self,Xe(ne.ArenariumMaps={}))})(this,(function(ne){"use strict";var Xt=Array.isArray,ir=Array.prototype.indexOf,sr=Array.from,ht=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,or=Object.prototype,ar=Array.prototype,lr=Object.getPrototypeOf,Wt=Object.isExtensible;function ur(t){for(var e=0;e<t.length;e++)t[e]()}function fr(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}const I=2,pt=4,Gt=8,ge=16,re=32,ce=64,dt=128,N=256,We=512,C=1024,V=2048,ie=4096,_e=8192,we=16384,vt=32768,Kt=65536,Jt=1<<17,cr=1<<18,be=1<<19,hr=1<<20,mt=1<<21,yt=1<<22,he=1<<23,Ge=Symbol("$state"),gt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function pr(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function dr(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function vr(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function mr(t){throw new Error("https://svelte.dev/e/effect_orphan")}function yr(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function gr(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function _r(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function wr(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function br(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Er=2,M=Symbol();function kr(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Qt(t){return t===this.v}let $i=!1,j=null;function Ee(t){j=t}function _t(t,e=!1,n){j={p:j,c:null,e:null,s:t,x:null,l:null}}function wt(t){var e=j,n=e.e;if(n!==null){e.e=null;for(var r of n)dn(r)}return t!==void 0&&(e.x=t),j=e.p,t??{}}function $t(){return!0}let ke=[];function Mr(){var t=ke;ke=[],ur(t)}function Ke(t){if(ke.length===0){var e=ke;queueMicrotask(()=>{e===ke&&Mr()})}ke.push(t)}const xr=new WeakMap;function en(t){var e=m;if(e===null)return v.f|=he,t;if((e.f&vt)===0){if((e.f&dt)===0)throw!e.parent&&t instanceof Error&&tn(t),t;e.b.error(t)}else Me(t,e)}function Me(t,e){for(;e!==null;){if((e.f&dt)!==0)try{e.b.error(t);return}catch(n){t=n}e=e.parent}throw t instanceof Error&&tn(t),t}function tn(t){const e=xr.get(t);e&&(ht(t,"message",{value:e.message}),ht(t,"stack",{value:e.stack}))}const bt=new Set;let S=null,Et=new Set,Fe=[],kt=null,Mt=!1;class ${current=new Map;#e=new Map;#t=new Set;#a=0;#r=null;#c=!1;#o=[];#i=[];#n=[];#s=[];#l=[];#h=[];#f=[];skipped_effects=new Set;process(e){Fe=[];for(const i of e)this.#p(i);if(this.#o.length===0&&this.#a===0){this.#d();var n=this.#n,r=this.#s;this.#n=[],this.#s=[],this.#l=[],S=null,nn(n),nn(r),S===null?S=this:bt.delete(this),this.#r?.resolve()}else this.#u(this.#n),this.#u(this.#s),this.#u(this.#l);for(const i of this.#o)Se(i);for(const i of this.#i)Se(i);this.#o=[],this.#i=[]}#p(e){e.f^=C;for(var n=e.first;n!==null;){var r=n.f,i=(r&(re|ce))!==0,s=i&&(r&C)!==0,o=s||(r&_e)!==0||this.skipped_effects.has(n);if(!o&&n.fn!==null){if(i)n.f^=C;else if((r&pt)!==0)this.#s.push(n);else if((r&C)===0)if((r&yt)!==0){var a=n.b?.is_pending()?this.#i:this.#o;a.push(n)}else et(n)&&((n.f&ge)!==0&&this.#l.push(n),Se(n));var l=n.first;if(l!==null){n=l;continue}}var u=n.parent;for(n=n.next;n===null&&u!==null;)n=u.next,u=u.parent}}#u(e){for(const n of e)((n.f&V)!==0?this.#h:this.#f).push(n),B(n,C);e.length=0}capture(e,n){this.#e.has(e)||this.#e.set(e,n),this.current.set(e,e.v)}activate(){S=this}deactivate(){S=null;for(const e of Et)if(Et.delete(e),e(),S!==null)break}neuter(){this.#c=!0}flush(){Fe.length>0?Pr():this.#d(),S===this&&(this.#a===0&&bt.delete(this),this.deactivate())}#d(){if(!this.#c)for(const e of this.#t)e();this.#t.clear()}increment(){this.#a+=1}decrement(){if(this.#a-=1,this.#a===0){for(const e of this.#h)B(e,V),Re(e);for(const e of this.#f)B(e,ie),Re(e);this.#n=[],this.#s=[],this.flush()}else this.deactivate()}add_callback(e){this.#t.add(e)}settled(){return(this.#r??=fr()).promise}static ensure(){if(S===null){const e=S=new $;bt.add(S),$.enqueue(()=>{S===e&&e.flush()})}return S}static enqueue(e){Ke(e)}}function Pr(){var t=xe;Mt=!0;try{var e=0;for(wn(!0);Fe.length>0;){var n=$.ensure();if(e++>1e3){var r,i;Sr()}n.process(Fe),se.clear()}}finally{Mt=!1,wn(t),kt=null}}function Sr(){try{yr()}catch(t){Me(t,kt)}}let pe=null;function nn(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(we|_e))===0&&et(r)&&(pe=[],Se(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null&&r.ac===null?gn(r):r.fn=null),pe?.length>0)){se.clear();for(const i of pe)Se(i);pe=[]}}pe=null}}function Re(t){for(var e=kt=t;e.parent!==null;){e=e.parent;var n=e.f;if(Mt&&e===m&&(n&ge)!==0)return;if((n&(ce|re))!==0){if((n&C)===0)return;e.f^=C}}Fe.push(e)}function Ar(t){let e=0,n=Je(0),r;return()=>{qr()&&(_(n),At(()=>(e===0&&(r=An(()=>t(()=>Ne(n)))),e+=1,()=>{Ke(()=>{e-=1,e===0&&(r?.(),r=void 0,Ne(n))})})))}}var Dr=Kt|be|dt;function Cr(t,e,n){new Tr(t,e,n)}class Tr{parent;#e=!1;#t;#a=null;#r;#c;#o;#i=null;#n=null;#s=null;#l=null;#h=0;#f=0;#p=!1;#u=null;#d=()=>{this.#u&&Qe(this.#u,this.#h)};#g=Ar(()=>(this.#u=Je(this.#h),()=>{this.#u=null}));constructor(e,n,r){this.#t=e,this.#r=n,this.#c=r,this.parent=m.b,this.#e=!!this.#r.pending,this.#o=Xr(()=>{m.b=this;{try{this.#i=de(()=>r(this.#t))}catch(i){this.error(i)}this.#f>0?this.#m():this.#e=!1}},Dr)}#_(){try{this.#i=de(()=>this.#c(this.#t))}catch(e){this.error(e)}this.#e=!1}#w(){const e=this.#r.pending;e&&(this.#n=de(()=>e(this.#t)),$.enqueue(()=>{this.#i=this.#v(()=>($.ensure(),de(()=>this.#c(this.#t)))),this.#f>0?this.#m():($e(this.#n,()=>{this.#n=null}),this.#e=!1)}))}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#v(e){var n=m,r=v,i=j;G(this.#o),T(this.#o),Ee(this.#o.ctx);try{return e()}catch(s){return en(s),null}finally{G(n),T(r),Ee(i)}}#m(){const e=this.#r.pending;this.#i!==null&&(this.#l=document.createDocumentFragment(),Lr(this.#i,this.#l)),this.#n===null&&(this.#n=de(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#f+=e,this.#f===0&&(this.#e=!1,this.#n&&$e(this.#n,()=>{this.#n=null}),this.#l&&(this.#t.before(this.#l),this.#l=null))}update_pending_count(e){this.#y(e),this.#h+=e,Et.add(this.#d)}get_effect_pending(){return this.#g(),_(this.#u)}error(e){var n=this.#r.onerror;let r=this.#r.failed;if(this.#p||!n&&!r)throw e;this.#i&&(W(this.#i),this.#i=null),this.#n&&(W(this.#n),this.#n=null),this.#s&&(W(this.#s),this.#s=null);var i=!1,s=!1;const o=()=>{if(i){kr();return}i=!0,s&&br(),$.ensure(),this.#h=0,this.#s!==null&&$e(this.#s,()=>{this.#s=null}),this.#e=this.has_pending_snippet(),this.#i=this.#v(()=>(this.#p=!1,de(()=>this.#c(this.#t)))),this.#f>0?this.#m():this.#e=!1};var a=v;try{T(null),s=!0,n?.(e,o),s=!1}catch(l){Me(l,this.#o&&this.#o.parent)}finally{T(a)}r&&Ke(()=>{this.#s=this.#v(()=>{this.#p=!0;try{return de(()=>{r(this.#t,()=>e,()=>o)})}catch(l){return Me(l,this.#o.parent),null}finally{this.#p=!1}})})}}function Lr(t,e){for(var n=t.nodes_start,r=t.nodes_end;n!==null;){var i=n===r?null:Pt(n);e.append(n),n=i}}function Ir(t,e,n){const r=Fr;if(e.length===0){n(t.map(r));return}var i=S,s=m,o=Or();Promise.all(e.map(a=>Rr(a))).then(a=>{i?.activate(),o();try{n([...t.map(r),...a])}catch(l){(s.f&we)===0&&Me(l,s)}i?.deactivate(),rn()}).catch(a=>{Me(a,s)})}function Or(){var t=m,e=v,n=j,r=S;return function(){G(t),T(e),Ee(n),r?.activate()}}function rn(){G(null),T(null),Ee(null)}function Fr(t){var e=I|V,n=v!==null&&(v.f&I)!==0?v:null;return m===null||n!==null&&(n.f&N)!==0?e|=N:m.f|=be,{ctx:j,deps:null,effects:null,equals:Qt,f:e,fn:t,reactions:null,rv:0,v:M,wv:0,parent:n??m,ac:null}}function Rr(t,e){let n=m;n===null&&pr();var r=n.b,i=void 0,s=Je(M),o=null,a=!v;return Vr(()=>{try{var l=t();o&&Promise.resolve(l).catch(()=>{})}catch(c){l=Promise.reject(c)}var u=()=>l;i=o?.then(u,u)??Promise.resolve(l),o=i;var f=S,h=r.is_pending();a&&(r.update_pending_count(1),h||f.increment());const p=(c,d=void 0)=>{o=null,h||f.activate(),d?d!==gt&&(s.f|=he,Qe(s,d)):((s.f&he)!==0&&(s.f^=he),Qe(s,c)),a&&(r.update_pending_count(-1),h||f.decrement()),rn()};if(i.then(p,c=>p(null,c||"unknown")),f)return()=>{queueMicrotask(()=>f.neuter())}}),new Promise(l=>{function u(f){function h(){f===i?l(s):u(i)}f.then(h,h)}u(i)})}function sn(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)W(e[n])}}function Nr(t){for(var e=t.parent;e!==null;){if((e.f&I)===0)return e;e=e.parent}return null}function xt(t){var e,n=m;G(Nr(t));try{sn(t),e=Pn(t)}finally{G(n)}return e}function on(t){var e=xt(t);if(t.equals(e)||(t.v=e,t.wv=Mn()),!Pe){var n=(ae||(t.f&N)!==0)&&t.deps!==null?ie:C;B(t,n)}}const se=new Map;function Je(t,e){var n={f:0,v:t,reactions:null,equals:Qt,rv:0,wv:0};return n}function A(t,e){const n=Je(t);return Jr(n),n}function x(t,e,n=!1){v!==null&&(!H||(v.f&Jt)!==0)&&$t()&&(v.f&(I|ge|yt|Jt))!==0&&!ee?.includes(t)&&wr();let r=n?je(e):e;return Qe(t,r)}function Qe(t,e){if(!t.equals(e)){var n=t.v;Pe?se.set(t,e):se.set(t,n),t.v=e;var r=$.ensure();r.capture(t,n),(t.f&I)!==0&&((t.f&V)!==0&&xt(t),B(t,(t.f&N)===0?C:ie)),t.wv=Mn(),an(t,V),m!==null&&(m.f&C)!==0&&(m.f&(re|ce))===0&&(z===null?Qr([t]):z.push(t))}return e}function Ne(t){x(t,t.v+1)}function an(t,e){var n=t.reactions;if(n!==null)for(var r=n.length,i=0;i<r;i++){var s=n[i],o=s.f,a=(o&V)===0;a&&B(s,e),(o&I)!==0?an(s,ie):a&&((o&ge)!==0&&pe!==null&&pe.push(s),Re(s))}}function je(t){if(typeof t!="object"||t===null||Ge in t)return t;const e=lr(t);if(e!==or&&e!==ar)return t;var n=new Map,r=Xt(t),i=A(0),s=ve,o=a=>{if(ve===s)return a();var l=v,u=ve;T(null),kn(s);var f=a();return T(l),kn(u),f};return r&&n.set("length",A(t.length)),new Proxy(t,{defineProperty(a,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&gr();var f=n.get(l);return f===void 0?f=o(()=>{var h=A(u.value);return n.set(l,h),h}):x(f,u.value,!0),!0},deleteProperty(a,l){var u=n.get(l);if(u===void 0){if(l in a){const f=o(()=>A(M));n.set(l,f),Ne(i)}}else x(u,M),Ne(i);return!0},get(a,l,u){if(l===Ge)return t;var f=n.get(l),h=l in a;if(f===void 0&&(!h||Oe(a,l)?.writable)&&(f=o(()=>{var c=je(h?a[l]:M),d=A(c);return d}),n.set(l,f)),f!==void 0){var p=_(f);return p===M?void 0:p}return Reflect.get(a,l,u)},getOwnPropertyDescriptor(a,l){var u=Reflect.getOwnPropertyDescriptor(a,l);if(u&&"value"in u){var f=n.get(l);f&&(u.value=_(f))}else if(u===void 0){var h=n.get(l),p=h?.v;if(h!==void 0&&p!==M)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(a,l){if(l===Ge)return!0;var u=n.get(l),f=u!==void 0&&u.v!==M||Reflect.has(a,l);if(u!==void 0||m!==null&&(!f||Oe(a,l)?.writable)){u===void 0&&(u=o(()=>{var p=f?je(a[l]):M,c=A(p);return c}),n.set(l,u));var h=_(u);if(h===M)return!1}return f},set(a,l,u,f){var h=n.get(l),p=l in a;if(r&&l==="length")for(var c=u;c<h.v;c+=1){var d=n.get(c+"");d!==void 0?x(d,M):c in a&&(d=o(()=>A(M)),n.set(c+"",d))}if(h===void 0)(!p||Oe(a,l)?.writable)&&(h=o(()=>A(void 0)),x(h,je(u)),n.set(l,h));else{p=h.v!==M;var k=o(()=>je(u));x(h,k)}var R=Reflect.getOwnPropertyDescriptor(a,l);if(R?.set&&R.set.call(f,u),!p){if(r&&typeof l=="string"){var Q=n.get("length"),b=Number(l);Number.isInteger(b)&&b>=Q.v&&x(Q,b+1)}Ne(i)}return!0},ownKeys(a){_(i);var l=Reflect.ownKeys(a).filter(h=>{var p=n.get(h);return p===void 0||p.v!==M});for(var[u,f]of n)f.v!==M&&!(u in a)&&l.push(u);return l},setPrototypeOf(){_r()}})}var ln,un,fn,cn;function jr(){if(ln===void 0){ln=window,un=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;fn=Oe(e,"firstChild").get,cn=Oe(e,"nextSibling").get,Wt(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Wt(n)&&(n.__t=void 0)}}function zr(t=""){return document.createTextNode(t)}function hn(t){return fn.call(t)}function Pt(t){return cn.call(t)}function St(t,e){return hn(t)}function Br(t,e=1,n=!1){let r=t;for(;e--;)r=Pt(r);return r}function pn(t){var e=v,n=m;T(null),G(null);try{return t()}finally{T(e),G(n)}}function Ur(t){m===null&&v===null&&mr(),v!==null&&(v.f&N)!==0&&m===null&&vr(),Pe&&dr()}function Zr(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function oe(t,e,n,r=!0){var i=m;i!==null&&(i.f&_e)!==0&&(t|=_e);var s={ctx:j,deps:null,nodes_start:null,nodes_end:null,f:t|V,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{Se(s),s.f|=vt}catch(l){throw W(s),l}else e!==null&&Re(s);if(r){var o=s;if(n&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&be)===0&&(o=o.first),o!==null&&(o.parent=i,i!==null&&Zr(o,i),v!==null&&(v.f&I)!==0&&(t&ce)===0)){var a=v;(a.effects??=[]).push(o)}}return s}function qr(){return v!==null&&!H}function X(t){Ur();var e=m.f,n=!v&&(e&re)!==0&&(e&vt)===0;if(n){var r=j;(r.e??=[]).push(t)}else return dn(t)}function dn(t){return oe(pt|hr,t,!1)}function Hr(t){$.ensure();const e=oe(ce|be,t,!0);return(n={})=>new Promise(r=>{n.outro?$e(e,()=>{W(e),r(void 0)}):(W(e),r(void 0))})}function Yr(t){return oe(pt,t,!1)}function Vr(t){return oe(yt|be,t,!0)}function At(t,e=0){return oe(Gt|e,t,!0)}function vn(t,e=[],n=[]){Ir(e,n,r=>{oe(Gt,()=>t(...r.map(_)),!0)})}function Xr(t,e=0){var n=oe(ge|e,t,!0);return n}function de(t,e=!0){return oe(re|be,t,!0,e)}function mn(t){var e=t.teardown;if(e!==null){const n=Pe,r=v;bn(!0),T(null);try{e.call(null)}finally{bn(n),T(r)}}}function yn(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&pn(()=>{i.abort(gt)});var r=n.next;(n.f&ce)!==0?n.parent=null:W(n,e),n=r}}function Wr(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&re)===0&&W(e),e=n}}function W(t,e=!0){var n=!1;(e||(t.f&cr)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(Gr(t.nodes_start,t.nodes_end),n=!0),yn(t,e&&!n),tt(t,0),B(t,we);var r=t.transitions;if(r!==null)for(const s of r)s.stop();mn(t);var i=t.parent;i!==null&&i.first!==null&&gn(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function Gr(t,e){for(;t!==null;){var n=t===e?null:Pt(t);t.remove(),t=n}}function gn(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function $e(t,e){var n=[];_n(t,n,!0),Kr(n,()=>{W(t),e&&e()})}function Kr(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var i of t)i.out(r)}else e()}function _n(t,e,n){if((t.f&_e)===0){if(t.f^=_e,t.transitions!==null)for(const o of t.transitions)(o.is_global||n)&&e.push(o);for(var r=t.first;r!==null;){var i=r.next,s=(r.f&Kt)!==0||(r.f&re)!==0;_n(r,e,s?n:!1),r=i}}}let xe=!1;function wn(t){xe=t}let Pe=!1;function bn(t){Pe=t}let v=null,H=!1;function T(t){v=t}let m=null;function G(t){m=t}let ee=null;function Jr(t){v!==null&&(ee===null?ee=[t]:ee.push(t))}let D=null,O=0,z=null;function Qr(t){z=t}let En=1,ze=0,ve=ze;function kn(t){ve=t}let ae=!1;function Mn(){return++En}function et(t){var e=t.f;if((e&V)!==0)return!0;if((e&ie)!==0){var n=t.deps,r=(e&N)!==0;if(n!==null){var i,s,o=(e&We)!==0,a=r&&m!==null&&!ae,l=n.length;if((o||a)&&(m===null||(m.f&we)===0)){var u=t,f=u.parent;for(i=0;i<l;i++)s=n[i],(o||!s?.reactions?.includes(u))&&(s.reactions??=[]).push(u);o&&(u.f^=We),a&&f!==null&&(f.f&N)===0&&(u.f^=N)}for(i=0;i<l;i++)if(s=n[i],et(s)&&on(s),s.wv>t.wv)return!0}(!r||m!==null&&!ae)&&B(t,C)}return!1}function xn(t,e,n=!0){var r=t.reactions;if(r!==null&&!ee?.includes(t))for(var i=0;i<r.length;i++){var s=r[i];(s.f&I)!==0?xn(s,e,!1):e===s&&(n?B(s,V):(s.f&C)!==0&&B(s,ie),Re(s))}}function Pn(t){var e=D,n=O,r=z,i=v,s=ae,o=ee,a=j,l=H,u=ve,f=t.f;D=null,O=0,z=null,ae=(f&N)!==0&&(H||!xe||v===null),v=(f&(re|ce))===0?t:null,ee=null,Ee(t.ctx),H=!1,ve=++ze,t.ac!==null&&(pn(()=>{t.ac.abort(gt)}),t.ac=null);try{t.f|=mt;var h=t.fn,p=h(),c=t.deps;if(D!==null){var d;if(tt(t,O),c!==null&&O>0)for(c.length=O+D.length,d=0;d<D.length;d++)c[O+d]=D[d];else t.deps=c=D;if(!ae||(f&I)!==0&&t.reactions!==null)for(d=O;d<c.length;d++)(c[d].reactions??=[]).push(t)}else c!==null&&O<c.length&&(tt(t,O),c.length=O);if($t()&&z!==null&&!H&&c!==null&&(t.f&(I|ie|V))===0)for(d=0;d<z.length;d++)xn(z[d],t);return i!==null&&i!==t&&(ze++,z!==null&&(r===null?r=z:r.push(...z))),(t.f&he)!==0&&(t.f^=he),p}catch(k){return en(k)}finally{t.f^=mt,D=e,O=n,z=r,v=i,ae=s,ee=o,Ee(a),H=l,ve=u}}function $r(t,e){let n=e.reactions;if(n!==null){var r=ir.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}n===null&&(e.f&I)!==0&&(D===null||!D.includes(e))&&(B(e,ie),(e.f&(N|We))===0&&(e.f^=We),sn(e),tt(e,0))}function tt(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)$r(t,n[r])}function Se(t){var e=t.f;if((e&we)===0){B(t,C);var n=m,r=xe;m=t,xe=!0;try{(e&ge)!==0?Wr(t):yn(t),mn(t);var i=Pn(t);t.teardown=typeof i=="function"?i:null,t.wv=En;var s}finally{xe=r,m=n}}}function _(t){var e=t.f,n=(e&I)!==0;if(v!==null&&!H){var r=m!==null&&(m.f&we)!==0;if(!r&&!ee?.includes(t)){var i=v.deps;if((v.f&mt)!==0)t.rv<ze&&(t.rv=ze,D===null&&i!==null&&i[O]===t?O++:D===null?D=[t]:(!ae||!D.includes(t))&&D.push(t));else{(v.deps??=[]).push(t);var s=t.reactions;s===null?t.reactions=[v]:s.includes(v)||s.push(v)}}}else if(n&&t.deps===null&&t.effects===null){var o=t,a=o.parent;a!==null&&(a.f&N)===0&&(o.f^=N)}if(Pe){if(se.has(t))return se.get(t);if(n){o=t;var l=o.v;return((o.f&C)===0&&o.reactions!==null||Sn(o))&&(l=xt(o)),se.set(o,l),l}}else n&&(o=t,et(o)&&on(o));if((t.f&he)!==0)throw t.v;return t.v}function Sn(t){if(t.v===M)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(se.has(e)||(e.f&I)!==0&&Sn(e))return!0;return!1}function An(t){var e=H;try{return H=!0,t()}finally{H=e}}const ei=-7169;function B(t,e){t.f=t.f&ei|e}const ti=["touchstart","touchmove"];function ni(t){return ti.includes(t)}const ri=new Set,Dn=new Set;let Cn=null;function nt(t){var e=this,n=e.ownerDocument,r=t.type,i=t.composedPath?.()||[],s=i[0]||t.target;Cn=t;var o=0,a=Cn===t&&t.__root;if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;l<=u&&(o=l)}if(s=i[o]||t.target,s!==e){ht(t,"currentTarget",{configurable:!0,get(){return s||n}});var f=v,h=m;T(null),G(null);try{for(var p,c=[];s!==null;){var d=s.assignedSlot||s.parentNode||s.host||null;try{var k=s["__"+r];if(k!=null&&(!s.disabled||t.target===s))if(Xt(k)){var[R,...Q]=k;R.apply(s,[t,...Q])}else k.call(s,t)}catch(b){p?c.push(b):p=b}if(t.cancelBubble||d===e||d===null)break;s=d}if(p){for(let b of c)queueMicrotask(()=>{throw b});throw p}}finally{t.__root=e,delete t.currentTarget,T(f),G(h)}}}function ii(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function si(t,e){var n=m;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function Tn(t,e){var n=(e&Er)!==0,r,i=!t.startsWith("<!>");return()=>{r===void 0&&(r=ii(i?t:"<!>"+t),r=hn(r));var s=n||un?document.importNode(r,!0):r.cloneNode(!0);return si(s,s),s}}function Ln(t,e){t!==null&&t.before(e)}function Dt(t,e){return oi(t,e)}const Ae=new Map;function oi(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0}){jr();var a=new Set,l=h=>{for(var p=0;p<h.length;p++){var c=h[p];if(!a.has(c)){a.add(c);var d=ni(c);e.addEventListener(c,nt,{passive:d});var k=Ae.get(c);k===void 0?(document.addEventListener(c,nt,{passive:d}),Ae.set(c,1)):Ae.set(c,k+1)}}};l(sr(ri)),Dn.add(l);var u=void 0,f=Hr(()=>{var h=n??e.appendChild(zr());return Cr(h,{pending:()=>{}},p=>{if(s){_t({});var c=j;c.c=s}i&&(r.$$events=i),u=t(p,r)||{},s&&wt()}),()=>{for(var p of a){e.removeEventListener(p,nt);var c=Ae.get(p);--c===0?(document.removeEventListener(p,nt),Ae.delete(p)):Ae.set(p,c)}Dn.delete(l),h!==n&&h.parentNode?.removeChild(h)}});return ai.set(u,f),u}let ai=new WeakMap;function In(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=In(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function li(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=In(t))&&(r&&(r+=" "),r+=e);return r}function On(t){return typeof t=="object"?li(t):t??""}function ui(t,e,n){var r=t==null?"":""+t;return e&&(r=r?r+" "+e:e),r===""?null:r}function fi(t,e){return t==null?null:String(t)}function Fn(t,e,n,r,i,s){var o=t.__className;if(o!==n||o===void 0){var a=ui(n,r);a==null?t.removeAttribute("class"):t.className=a,t.__className=n}return s}function rt(t,e,n,r){var i=t.__style;if(i!==e){var s=fi(e);s==null?t.removeAttribute("style"):t.style.cssText=s,t.__style=e}return r}const ci=()=>performance.now(),K={tick:t=>requestAnimationFrame(t),now:()=>ci(),tasks:new Set};function Rn(){const t=K.now();K.tasks.forEach(e=>{e.c(t)||(K.tasks.delete(e),e.f())}),K.tasks.size!==0&&K.tick(Rn)}function hi(t){let e;return K.tasks.size===0&&K.tick(Rn),{promise:new Promise(n=>{K.tasks.add(e={c:t,f:n})}),abort(){K.tasks.delete(e)}}}function Nn(t,e){return t===e||t?.[Ge]===e}function De(t={},e,n,r){return Yr(()=>{var i,s;return At(()=>{i=s,s=[],An(()=>{t!==n(...s)&&(e(t,...s),i&&Nn(n(...i),t)&&e(null,...i))})}),()=>{Ke(()=>{s&&Nn(n(...s),t)&&e(null,...s)})}}),t}const pi="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(pi);function di(t){return t}function Ct(t){return-.5*(Math.cos(Math.PI*t)-1)}function vi(t){const e=Math.cos(t*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function mi(t){return Math.sin(t*Math.PI/2)}const yi=128,gi=0,_i=1,wi=2;class bi{animationsStarted=!1;animationsCount=0;animationsLimit=yi;layers=new Array;start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const n=this.layers[e];if(n==null)continue;const r=n.animations;if(r!=null)for(let i=0;i<r.length;i++){const s=r[i];if(s!=null){for(const o of s.values())if(!o.executed&&(o.executed=!0,o.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,n,r,i){let s=this.layers[e];s==null&&(s=this.layers[e]={animations:new Array});let o=s.animations[n];o==null&&(o=s.animations[n]=new Map);let a={id:r,priority:n,executed:!1,function:i};o.set(r,a),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,n){for(let r=0;r<this.layers.length;r++){let i=this.layers[r];if(i==null)continue;let s=i.animations[e];if(s==null)return;let o=s.get(n);if(o==null||o.executed==!1)return;s.delete(n)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const le=new bi;function jn(t){return Object.prototype.toString.call(t)==="[object Date]"}function Tt(t,e){if(t===e||t!==t)return()=>t;const n=typeof t;if(n!==typeof e||Array.isArray(t)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(t)){const r=e.map((i,s)=>Tt(t[s],i));return i=>r.map(s=>s(i))}if(n==="object"){if(!t||!e)throw new Error("Object cannot be null");if(jn(t)&&jn(e)){const s=t.getTime(),a=e.getTime()-s;return l=>new Date(s+l*a)}const r=Object.keys(e),i={};return r.forEach(s=>{i[s]=Tt(t[s],e[s])}),s=>{const o={};return r.forEach(a=>{o[a]=i[a](s)}),o}}if(n==="number"){const r=e-t;return i=>t+i*r}return()=>e}class Lt{#e;#t;#a;#r=null;constructor(e,n={}){this.#e=A(e),this.#t=A(e),this.#a=n}static of(e,n){const r=new Lt(e(),n);return At(()=>{r.set(e())}),r}set(e,n){x(this.#t,e);let{delay:r=0,duration:i=400,easing:s=di,interpolate:o=Tt}={...this.#a,...n};if(i===0)return this.#r?.abort(),x(this.#e,e),Promise.resolve();const a=K.now()+r;let l,u=!1,f=this.#r;return this.#r=hi(h=>{if(h<a)return!0;if(!u){u=!0;const c=this.#e.v;l=o(c,e),typeof i=="function"&&(i=i(c,e)),f?.abort()}const p=h-a;return p>i?(x(this.#e,e),!1):(x(this.#e,l(s(p/i))),!0)}),this.#r.promise}get current(){return _(this.#e)}get target(){return _(this.#t)}set target(e){this.set(e)}}class it{value;motion;constructor(e,n){this.value=e,this.motion=new Lt(e,n)}set(e,n){this.value=e,this.motion.set(e,n)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var Ei=Tn('<div><div class="body svelte-zz3jrb"></div></div>');function ki(t,e){_t(e,!0);let n,r;function i(){return r}let s=A(!1);function o(E){x(s,E,!0)}function a(){return _(s)}let l=A(!0),u=0,f=150;function h(E){E!=_(l)&&(x(l,E,!0),u=performance.now())}function p(){return performance.now()-u<f?d.motion.current==0:d.value==0}let c=0,d=new it(0,{easing:Ct});X(()=>{_(s)==!1&&(d.snap(),le.clear(e.priority,e.id))}),X(()=>{d.set(_(l)?0:c,{duration:75})}),X(()=>{k(d.motion.current)});function k(E){n&&le.equeue(e.layer,e.priority,e.id,()=>{n.style.scale=E.toString(),n.style.filter=`brightness(${.25+.75*E})`,r.style.opacity=E.toString()})}function R(E){E!=c&&(c=E,d.set(E,{duration:75}))}function Q(){return d.value}var b={getBody:i,setDisplayed:o,getDisplayed:a,setCollapsed:h,getCollapsed:p,setScale:R,getScale:Q},ye=Ei(),ue=St(ye);return De(ue,E=>r=E,()=>r),De(ye,E=>n=E,()=>n),vn(()=>{Fn(ye,1,On(["pin",_(s)&&"displayed"]),"svelte-zz3jrb"),rt(ye,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px`),rt(ue,`width: ${e.width-4}px; height: ${e.height-4}px; border-radius: ${e.radius-2}px`)}),Ln(t,ye),wt(b)}var Be;(t=>{function e(n,r,i){const s=n/2,o=r/2,a=Math.sqrt(s*s+o*o),l=Math.atan(o/s)*(180/Math.PI),u=i*(Math.PI/180);return i<180?i<90?i<l?{x:0,y:a*Math.sin(u)-o}:{x:a*Math.cos(u)-s,y:0}:i<180-l?{x:a*Math.cos(u)-s,y:0}:{x:-n,y:a*Math.sin(u)-o}:i<270?i<180+l?{x:-n,y:a*Math.sin(u)-o}:{x:a*Math.cos(u)-s,y:-r}:i<360-l?{x:a*Math.cos(u)-s,y:-r}:{x:0,y:a*Math.sin(u)-o}}t.getOffsets=e})(Be||(Be={}));var Mi=Tn('<div><div class="pointer svelte-11extwn"></div> <div class="bubble svelte-11extwn"><div class="body svelte-11extwn"></div></div></div>');function zn(t,e){_t(e,!0);let n,r,i,s;const o=e.width+2*e.margin,a=e.height+2*e.margin,l=()=>s;X(()=>{i.style.width=`${e.margin*4}px`,i.style.height=`${e.margin*4}px`});let u=A(!0);function f(y){x(u,y,!0)}function h(){return _(u)}let p=A(!0),c=0,d=300;function k(y){y!=_(p)&&(x(p,y,!0),c=performance.now())}function R(){return performance.now()-c<d?b.motion.current==0:b.value==0}function Q(){return performance.now()-c<d?b.motion.current==1:b.value==1}let b=new it(0);X(()=>{_(u)==!1&&(b.snap(),le.clear(e.priority,e.id+"_scale"))}),X(()=>{_(p)==!0&&b.value!=0&&(le.stacked()?b.set(0,{duration:0}):b.set(0,{duration:150,easing:vi})),_(p)==!1&&b.value!=1&&b.set(1,{duration:150,easing:mi})}),X(()=>{ye(b.motion.current)});function ye(y){!n||!r||!i||le.equeue(_(p)?0:e.layer,e.priority,e.id+"_scale",()=>{n.style.opacity=`${y}`,r.style.scale=`${y}`,i.style.scale=`${y}`})}let ue=NaN,E=A(!1),fe=new it(-o/2,{easing:Ct}),lt=new it(-a/2,{easing:Ct});X(()=>{_(u)==!1&&(fe.snap(),fe.snap(),le.clear(e.priority,e.id+"_angle"))}),X(()=>{_(p)==!0&&_(E)&&(fe.update({duration:75}),fe.update({duration:75}))}),X(()=>{$n(fe.motion.current,lt.motion.current)});function $n(y,ft){if(!n||!r||!i)return;const te=y+o/2,ct=ft+a/2,Le=a<o?te*a/o:te,Ie=a>o?ct*o/a:ct,Wi=Math.atan2(Ie,Le)/Math.PI*180-45,nr=0,Gi=30,Vt=Math.sqrt(Le*Le+Ie*Ie),Ve=Math.min(o,a)/2,Ki=Ve*Math.SQRT2,Ji=(Vt-Ve)/(Ki-Ve),rr=nr+Ji*(Gi-nr),Qi=Vt<Ve?Vt/Ve:1;le.equeue(e.layer,e.priority,e.id+"_angle",()=>{r.style.transform=`translate(${Math.round(y)}px, ${Math.round(ft)}px)`,i.style.transform=`scale(${Qi}) rotate(${Wi}deg) skew(${rr}deg, ${rr}deg)`})}function Yi(y,ft){if(_(E)==!1||ft==!0){let te=Be.getOffsets(o,a,y);fe.set(Math.round(te.x),{duration:0}),lt.set(Math.round(te.y),{duration:0}),$n(fe.value,lt.value),ue=y,x(E,!0)}else if(y!=ue){let te=Math.abs(y-ue),ct=te<180?te:360-te,Le=Math.log(ct)*75,Ie=Be.getOffsets(o,a,y);fe.set(Math.round(Ie.x),{duration:Le}),lt.set(Math.round(Ie.y),{duration:Le}),ue=y}}function Vi(){return Be.getOffsets(o,a,ue)}var Xi={getBody:l,setDisplayed:f,getDisplayed:h,setCollapsed:k,getCollapsed:R,getExpanded:Q,setAngle:Yi,getOffsets:Vi},ut=Mi(),er=St(ut);De(er,y=>i=y,()=>i);var Yt=Br(er,2),tr=St(Yt);return De(tr,y=>s=y,()=>s),De(Yt,y=>r=y,()=>r),De(ut,y=>n=y,()=>n),vn(()=>{Fn(ut,1,On(["anchor",_(u)&&"displayed"]),"svelte-11extwn"),rt(Yt,`margin: ${e.margin}px;`),rt(tr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)}),Ln(t,ut),wt(Xi)}var Ue;(t=>{async function e(r,i){const s=await fetch(r,i);if(!s.ok)throw new Error(s.statusText);return s.json()}t.get=e;async function n(r,i,s){const o=await fetch(r,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json",...s?.headers},...s});if(!o.ok)throw new Error(o.statusText);return o.json()}t.post=n})(Ue||(Ue={}));var Ce;(t=>{function e(a,l,u){return{x:r(l)*u,y:i(a)*u}}t.project=e;function n(a,l,u){return{lat:o(l/u),lng:s(a/u)}}t.unproject=n;function r(a){return(180+a)/360}function i(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function s(a){return a*360-180}function o(a){return 360/Math.PI*Math.atan(Math.exp((180-a*360)*Math.PI/180))-90}})(Ce||(Ce={}));class Bn{swLat;swLng;neLat;neLng;constructor(e,n,r,i,s){const o=r*Math.pow(2,n),a=Ce.project(e.sw.lat,e.sw.lng,o),l=Ce.project(e.ne.lat,e.ne.lng,o),u=a.x-i,f=a.y+s,h=l.x+i,p=l.y-s,c=Ce.unproject(u,f,o),d=Ce.unproject(h,p,o);this.swLat=c.lat,this.swLng=c.lng,this.neLat=d.lat,this.neLng=d.lng}contains(e,n){return this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=n&&n<=this.neLng:n<=this.neLng||this.swLng<=n:!1}}var It;function Un(t){return{lang:t?.lang??It?.lang,message:t?.message,abortEarly:t?.abortEarly??It?.abortEarly,abortPipeEarly:t?.abortPipeEarly??It?.abortPipeEarly}}var xi;function Pi(t){return xi?.get(t)}var Si;function Ai(t){return Si?.get(t)}var Di;function Ci(t,e){return Di?.get(t)?.get(e)}function Ze(t){const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&Object.getPrototypeOf(t)?.constructor?.name)??"null":e}function P(t,e,n,r,i){const s=i&&"input"in i?i.input:n.value,o=i?.expected??t.expects??null,a=i?.received??Ze(s),l={kind:t.kind,type:t.type,input:s,expected:o,received:a,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${a}`,requirement:t.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},u=t.kind==="schema",f=i?.message??t.message??Ci(t.reference,l.lang)??(u?Ai(l.lang):null)??r.message??Pi(l.lang);f!==void 0&&(l.message=typeof f=="function"?f(l):f),u&&(n.typed=!1),n.issues?n.issues.push(l):n.issues=[l]}function F(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},Un())}}}var st=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function U(t){return{kind:"transformation",type:"args",reference:U,async:!1,schema:t,"~run"(e,n){const r=e.value;return e.value=(...i)=>{const s=this.schema["~run"]({value:i},n);if(s.issues)throw new st(s.issues);return r(...s.value)},e}}}function Zn(){return{kind:"transformation",type:"await",reference:Zn,async:!0,async"~run"(t){return t.value=await t.value,t}}}function qn(t,e){return{kind:"validation",type:"check",reference:qn,async:!1,expects:null,requirement:t,message:e,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&P(this,"input",n,r),n}}}function Hn(t,e){return{kind:"validation",type:"length",reference:Hn,async:!1,expects:`${t}`,requirement:t,message:e,"~run"(n,r){return n.typed&&n.value.length!==this.requirement&&P(this,"length",n,r,{received:`${n.value.length}`}),n}}}function Te(t,e){return{kind:"validation",type:"max_value",reference:Te,async:!1,expects:`<=${t instanceof Date?t.toJSON():Ze(t)}`,requirement:t,message:e,"~run"(n,r){return n.typed&&!(n.value<=this.requirement)&&P(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():Ze(n.value)}),n}}}function Ot(t,e){return{kind:"validation",type:"min_length",reference:Ot,async:!1,expects:`>=${t}`,requirement:t,message:e,"~run"(n,r){return n.typed&&n.value.length<this.requirement&&P(this,"length",n,r,{received:`${n.value.length}`}),n}}}function J(t,e){return{kind:"validation",type:"min_value",reference:J,async:!1,expects:`>=${t instanceof Date?t.toJSON():Ze(t)}`,requirement:t,message:e,"~run"(n,r){return n.typed&&!(n.value>=this.requirement)&&P(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():Ze(n.value)}),n}}}function Y(t){return{kind:"transformation",type:"returns",reference:Y,async:!1,schema:t,"~run"(e,n){const r=e.value;return e.value=(...i)=>{const s=this.schema["~run"]({value:r(...i)},n);if(s.issues)throw new st(s.issues);return s.value},e}}}function Yn(t){return{kind:"transformation",type:"returns",reference:Yn,async:!1,schema:t,"~run"(e,n){const r=e.value;return e.value=async(...i)=>{const s=await this.schema["~run"]({value:await r(...i)},n);if(s.issues)throw new st(s.issues);return s.value},e}}}function Ti(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function Vn(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function Xn(t,e){return{kind:"schema",type:"array",reference:Xn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return F(this)},"~run"(n,r){const i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let s=0;s<i.length;s++){const o=i[s],a=this.item["~run"]({value:o},r);if(a.issues){const l={type:"array",origin:"value",input:i,key:s,value:o};for(const u of a.issues)u.path?u.path.unshift(l):u.path=[l],n.issues?.push(u);if(n.issues||(n.issues=a.issues),r.abortEarly){n.typed=!1;break}}a.typed||(n.typed=!1),n.value.push(a.value)}}else P(this,"type",n,r);return n}}}function Wn(t){return{kind:"schema",type:"boolean",reference:Wn,expects:"boolean",async:!1,message:t,get"~standard"(){return F(this)},"~run"(e,n){return typeof e.value=="boolean"?e.typed=!0:P(this,"type",e,n),e}}}function Gn(t,e){return{kind:"schema",type:"custom",reference:Gn,expects:"unknown",async:!1,check:t,message:e,get"~standard"(){return F(this)},"~run"(n,r){return this.check(n.value)?n.typed=!0:P(this,"type",n,r),n}}}function Z(t){return{kind:"schema",type:"function",reference:Z,expects:"Function",async:!1,message:t,get"~standard"(){return F(this)},"~run"(e,n){return typeof e.value=="function"?e.typed=!0:P(this,"type",e,n),e}}}function g(t){return{kind:"schema",type:"number",reference:g,expects:"number",async:!1,message:t,get"~standard"(){return F(this)},"~run"(e,n){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:P(this,"type",e,n),e}}}function L(t,e){return{kind:"schema",type:"object",reference:L,expects:"Object",async:!1,entries:t,message:e,get"~standard"(){return F(this)},"~run"(n,r){const i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(const s in this.entries){const o=this.entries[s];if(s in i||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const a=s in i?i[s]:Vn(o),l=o["~run"]({value:a},r);if(l.issues){const u={type:"object",origin:"value",input:i,key:s,value:a};for(const f of l.issues)f.path?f.path.unshift(u):f.path=[u],n.issues?.push(f);if(n.issues||(n.issues=l.issues),r.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value[s]=l.value}else if(o.fallback!==void 0)n.value[s]=Ti(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(P(this,"key",n,r,{input:void 0,expected:`"${s}"`,path:[{type:"object",origin:"key",input:i,key:s,value:i[s]}]}),r.abortEarly))break}}else P(this,"type",n,r);return n}}}function Ft(t,e){return{kind:"schema",type:"optional",reference:Ft,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return F(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Vn(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function Kn(t){return{kind:"schema",type:"promise",reference:Kn,expects:"Promise",async:!1,message:t,get"~standard"(){return F(this)},"~run"(e,n){return e.value instanceof Promise?e.typed=!0:P(this,"type",e,n),e}}}function qe(t){return{kind:"schema",type:"string",reference:qe,expects:"string",async:!1,message:t,get"~standard"(){return F(this)},"~run"(e,n){return typeof e.value=="string"?e.typed=!0:P(this,"type",e,n),e}}}function q(t,e){return{kind:"schema",type:"tuple",reference:q,expects:"Array",async:!1,items:t,message:e,get"~standard"(){return F(this)},"~run"(n,r){const i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let s=0;s<this.items.length;s++){const o=i[s],a=this.items[s]["~run"]({value:o},r);if(a.issues){const l={type:"array",origin:"value",input:i,key:s,value:o};for(const u of a.issues)u.path?u.path.unshift(l):u.path=[l],n.issues?.push(u);if(n.issues||(n.issues=a.issues),r.abortEarly){n.typed=!1;break}}a.typed||(n.typed=!1),n.value.push(a.value)}}else P(this,"type",n,r);return n}}}function He(t){return{kind:"schema",type:"void",reference:He,expects:"void",async:!1,message:t,get"~standard"(){return F(this)},"~run"(e,n){return e.value===void 0?e.typed=!0:P(this,"type",e,n),e}}}function ot(t,e,n){const r=t["~run"]({value:e},Un(n));if(r.issues)throw new st(r.issues);return r.value}function w(...t){return{...t[0],pipe:t,get"~standard"(){return F(this)},"~run"(e,n){for(const r of t)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=r["~run"](e,n))}return e}}}function Li(...t){return{...t[0],pipe:t,async:!0,get"~standard"(){return F(this)},async"~run"(e,n){for(const r of t)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=await r["~run"](e,n))}return e}}}const Rt=w(g(),J(-90),Te(90)),Nt=w(g(),J(-180),Te(180)),Ii=L({sw:L({lat:Rt,lng:Nt}),ne:L({lat:Rt,lng:Nt})}),jt=Gn(t=>t instanceof HTMLElement,"Must be an HTMLElement"),Oi=L({getParameters:w(Z(),U(q([])),Y(L({mapSize:w(g(),J(1)),zoomMin:w(g(),J(0)),zoomMax:w(g(),J(0)),zoomScale:w(g(),J(1),Te(10))}))),getContainer:w(Z(),U(q([])),Y(jt)),getZoom:w(Z(),U(q([])),Y(g())),getBounds:w(Z(),U(q([])),Y(Ii)),panBy:w(Z(),U(q([g(),g()])),Y(He())),createMarker:w(Z(),U(q([jt,Rt,Nt,g()])),Y(L({inserted:w(Z(),U(q([])),Y(Wn())),insert:w(Z(),U(q([])),Y(He())),remove:w(Z(),U(q([])),Y(He())),update:w(Z(),U(q([g()])),Y(He()))})))}),zt=w(Z(),U(q([qe()])),Yn(Li(Kn(),Zn(),jt))),Fi=Xn(L({id:w(qe(),Ot(1)),rank:w(g(),J(0)),lat:w(g(),J(-90),Te(90)),lng:w(g(),J(-180),Te(180)),tooltip:L({style:w(L({width:g(),height:g(),margin:g(),radius:g()}),qn(t=>Math.min(t.width,t.height)/t.margin>=6,"Tooltip: minimum of width or height must be greater than or equal to 6 * margin")),body:zt}),pin:Ft(L({style:L({width:g(),height:g(),radius:g()}),body:zt})),popup:Ft(L({style:L({width:g(),height:g(),radius:g(),margin:g()}),body:zt}))}));var me;(t=>{t.COUNT=12,t.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],t.DEGREES_DEFAULT=270})(me||(me={}));const Ri=w(qe(),Hn(32)),Ni=w(qe(),Ot(1)),Jn="1.1.4",Bt="https://maps.api.arenarium.dev",ji=`${Bt}/auth`,zi=`${Bt}/states`,Bi=`${Bt}/log`;class Ut{apiKey;apiToken;apiDevEnvironment;mapProvider;markerDataArray=new Array;markerDataMap=new Map;markerDataUpdating=!1;markerPinProcessor;markerTooltipProcessor;markerPopupProcessor;constructor(e,n,r,i){ot(Ri,e),ot(Ni,n),ot(Oi,r),this.apiKey=e,this.apiToken=n,this.apiDevEnvironment=window?.location.host.startsWith("localhost")||window?.location.host.startsWith("127.0.0.1"),this.mapProvider=r,this.markerPinProcessor=new at(r),this.markerTooltipProcessor=new Zi(r),this.markerPopupProcessor=new qi(r),this.setConfiguration(i)}static async create(e,n,r){const i={key:e,version:Jn};let o=(await Ue.post(ji,i)).token;if(!o)throw new Error("Failed to get api token");return new Ut(e,o,n,r)}setConfiguration(e){le.setLimit(e?.animation?.queue?.limit??8*navigator.hardwareConcurrency),this.markerPinProcessor.setConfiguration(e)}async updateMarkers(e){ot(Fi,e);try{await this.updateMarkerData(e),this.processMarkerDataCallback()}catch(n){throw console.error(n),this.removeMarkerData(),n instanceof Error&&this.log("error","Failed to update markers",n),n}}removeMarkers(){try{this.removeMarkerData()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove markers",e),e}}showPopup(e){try{for(const n of this.markerDataArray)n.marker.id==e?this.markerPopupProcessor.show(n):this.markerPopupProcessor.hide(n)}catch(n){console.error(n);for(const r of this.markerDataArray)this.markerPopupProcessor.hide(r);throw n instanceof Error&&this.log("error","Failed to show popup",n),n}}hidePopup(e){try{if(e){const n=this.markerDataMap.get(e);if(n==null)return;this.markerPopupProcessor.hide(n)}else for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n)}catch(n){console.error(n);for(const r of this.markerDataArray)this.markerPopupProcessor.hide(r);throw n instanceof Error&&this.log("error","Failed to hide popup",n),n}}async updateMarkerData(e){try{let n=this.markerDataArray.map(i=>i.marker);for(let i=0;i<e.length;i++){const s=e[i];this.markerDataMap.get(s.id)||n.push(s)}const r=await this.getMarkerStates(n);try{this.markerDataUpdating=!0;for(let i=0;i<n.length;i++){const s=n[i],o=r[i],a=this.markerDataMap.get(s.id);if(a)a.update(o);else{const l=new Ui(this.mapProvider,s,o);l.create(),this.markerDataMap.set(s.id,l),this.markerDataArray.push(l)}}this.markerDataArray.sort((i,s)=>i.zoom-s.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(i=>i.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(i=>i.tooltip)),this.markerPopupProcessor.updateElements(this.markerDataArray.map(i=>i.popup).filter(i=>i!=null))}finally{this.markerDataUpdating=!1}}catch(n){throw console.error(n),this.markerDataArray.forEach(r=>r.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),n instanceof Error&&this.log("error","Failed to update marker data",n),n}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.removeElements(),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove marker data",e),e}finally{this.markerDataUpdating=!1}}async getMarkerStates(e){if(e.length==0)return[];if(e.length==1)return[[0,[[0,me.DEGREES.indexOf(me.DEGREES_DEFAULT)]]]];const n=e.map(s=>({id:s.id,rank:s.rank,lat:s.lat,lng:s.lng,width:s.tooltip.style.width,height:s.tooltip.style.height,margin:s.tooltip.style.margin})),r={key:this.apiKey,token:this.apiToken,parameters:this.mapProvider.getParameters(),input:n},i=await Ue.post(zi,r,{headers:{"Cache-Control":this.apiDevEnvironment?"no-cache":""}});return i.token&&(this.apiToken=i.token),i.states}processMarkerDataCallback(){if(this.mapProvider.getContainer().parentElement!=null&&this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(e){console.error(e),e instanceof Error&&this.log("error","Failed to process marker data",e)}}processMarkerData(){if(this.markerDataUpdating)return;const e=this.mapProvider.getBounds(),n=this.mapProvider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,n),this.markerPinProcessor.process(e,n)}async log(e,n,r){if(!this.apiDevEnvironment)try{const i={key:this.apiKey,title:n,level:e,content:{version:Jn,...r}};await Ue.post(Bi,i)}catch(i){console.error(i)}}}class Ui{marker;zoom;pin;tooltip;popup;constructor(e,n,r){this.marker=n,this.zoom=r[0],this.pin=new Ye(e,n,r),this.tooltip=new qt(e,n,r),n.popup&&(this.popup=new Ht(e,n))}create(){this.pin.create(),this.tooltip.create(),this.popup?.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){this.pin.remove(),this.tooltip.remove(),this.popup?.remove()}}class Zt{provider;id;lat;lng;shown;element;component;marker;constructor(e,n){this.provider=e,this.id=n.id,this.lat=n.lat,this.lng=n.lng,this.shown=!0}create(){this.createElement(),this.createMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createMarker(){const e=this.element;if(!e)throw new Error("Failed to create provider marker");this.marker=this.provider.createMarker(e,this.lat,this.lng,this.getZindex())}updateZIndex(){if(this.marker==null)throw new Error("Failed to update provider marker z-index");this.marker.update(this.getZindex())}updateMap(e){const n=this.marker,r=this.component;if(n==null||r==null)throw new Error("Failed to update provider marker map");e?n.inserted()==!1&&n.insert():n.inserted()==!0&&n.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){this.marker?.remove()}}class Ye extends Zt{static DEFAULT_SIZE=16;width;height;radius;zoom;bodyLoading=!1;bodyLoaded=!1;bodyCallback;constructor(e,n,r){super(e,n),this.width=n.pin?.style.width??Ye.DEFAULT_SIZE,this.height=n.pin?.style.height??Ye.DEFAULT_SIZE,this.radius=n.pin?.style.radius??Ye.DEFAULT_SIZE,this.zoom=r[0],this.bodyCallback=n.pin?.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=Dt(ki,{target:this.element,props:{id:this.id+"_pin",layer:wi,priority:this.zoom*this.provider.getParameters().zoomScale,width:this.width,height:this.height,radius:this.radius}})}update(e){this.zoom=e[0],this.updateZIndex()}updateMap(e){super.updateMap(e),this.component?.setDisplayed(e)}updateBody(){if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const e=this.component?.getBody();e!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(n=>{n instanceof HTMLElement?e.appendChild(n):console.error("Failed to load pin body")}).catch(n=>console.error(n)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(e){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setCollapsed(e)}setScale(e){if(this.component==null)throw new Error("Failed to set pin scale");this.component.setScale(e)}getScaleFromZoomDistance(e){return this.zoom<e?1:Math.max(0,1-(this.zoom-e)*.125)}getZindex(){const e=this.provider.getParameters();return Math.round((e.zoomMax-this.zoom)*e.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}}class at{static MAP_PINS_MAX_ZOOM=2;static MAP_PINS_MAX_COUNT=128;provider;pinElements=new Array;pinMaxWidth=0;pinMaxHeight=0;pinFade=!1;pinMaxCount=0;pinMaxZoomDelta=0;constructor(e){this.provider=e}setConfiguration(e){this.pinFade=e?.pin?.fade??!0,this.pinMaxCount=e?.pin?.maxCount??Math.max(at.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=e?.pin?.maxZoom??at.MAP_PINS_MAX_ZOOM}updateElements(e){this.pinElements=e,this.pinMaxWidth=e.reduce((n,r)=>Math.max(n,r.width),0),this.pinMaxHeight=e.reduce((n,r)=>Math.max(n,r.height),0)}removeElements(){this.pinElements.forEach(e=>e.remove()),this.pinElements.length=0}process(e,n){const r=this.provider.getParameters().mapSize,i=new Bn(e,n,r,this.pinMaxWidth*2,this.pinMaxHeight*2);let s=0;for(const o of this.pinElements)i.contains(o.lat,o.lng)?o.shown&&n<o.zoom&&o.zoom<n+this.pinMaxZoomDelta?(s<this.pinMaxCount&&(o.setCollapsed(!1),o.setScale(this.pinFade?o.getScaleFromZoomDistance(n):1),o.updateMap(!0),o.isBodyLoaded()==!1&&o.updateBody()),s++):(o.setCollapsed(!0),o.isCollapsed()&&o.updateMap(!1)):o.updateMap(!1)}}class qt extends Zt{static Z_INDEX_OFFSET=1e6;width;height;margin;radius;zoom;angle;states;bodyLoading=!1;bodyLoaded=!1;bodyCallback;constructor(e,n,r){super(e,n),this.width=n.tooltip.style.width,this.height=n.tooltip.style.height,this.margin=n.tooltip.style.margin,this.radius=n.tooltip.style.radius,this.zoom=r[0],this.angle=me.DEGREES_DEFAULT,this.states=r[1].map(i=>[i[0],me.DEGREES[i[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=Dt(zn,{target:this.element,props:{id:this.id+"_tooltip",layer:_i,priority:this.zoom*this.provider.getParameters().zoomScale,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}update(e){this.zoom=e[0],this.states=e[1].map(n=>[n[0],me.DEGREES[n[1]]]),this.updateZIndex()}updateMap(e){super.updateMap(e),this.component?.setDisplayed(e)}updateState(e){if(this.component==null)throw new Error("Failed to update tooltip state");this.angle=this.getAngle(e),this.component.setAngle(this.angle)}updateBody(){if(this.bodyLoaded||this.bodyLoading)return;const e=this.component?.getBody();e!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(n=>{n instanceof HTMLElement?e.appendChild(n):console.error("Failed to load tooltip body")}).catch(n=>console.error(n)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getAngle(e){const n=this.states.findLast(r=>r[0]<=e);if(!n)throw new Error("Angle not found");return n[1]}getZindex(){const e=this.provider.getParameters();return Math.round((e.zoomMax-this.zoom)*e.zoomScale)+qt.Z_INDEX_OFFSET}setCollapsed(e){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(e)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}}class Zi{provider;tooltipElements=new Array;tooltipMaxWidth=0;tooltipMaxHeight=0;constructor(e){this.provider=e}updateElements(e){this.tooltipElements=e,this.tooltipMaxWidth=this.tooltipElements.reduce((n,r)=>Math.max(n,r.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((n,r)=>Math.max(n,r.height),0)}removeElements(){this.tooltipElements.forEach(e=>e.remove()),this.tooltipElements.length=0}process(e,n){const r=this.provider.getParameters().mapSize,i=new Bn(e,n,r,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const s of this.tooltipElements)i.contains(s.lat,s.lng)?s.shown&&s.zoom<=n?(s.updateState(n),s.setCollapsed(!1),s.updateMap(!0),s.isCollapsed()==!1&&s.isBodyLoaded()==!1&&s.updateBody()):(s.setCollapsed(!0),s.isCollapsed()&&s.updateMap(!1)):s.updateMap(!1)}}class Ht extends Zt{static Z_INDEX_OFFSET=2e6;width;height;margin;radius;bodyLoading=!1;bodyLoaded=!1;bodyCallback;constructor(e,n){if(n.popup==null)throw new Error("Failed to create popup");super(e,n),this.shown=!1,this.width=n.popup.style.width,this.height=n.popup.style.height,this.margin=n.popup.style.margin,this.radius=n.popup.style.radius,this.bodyCallback=n.popup.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("popup"),this.component=Dt(zn,{target:this.element,props:{id:this.id+"_popup",layer:gi,priority:0,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}updateMap(e){super.updateMap(e),this.component?.setDisplayed(e)}updateBody(){if(this.bodyLoaded||this.bodyLoading)return;const e=this.component?.getBody();e!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(n=>{n instanceof HTMLElement?e.appendChild(n):console.error("Failed to load popup body")}).catch(n=>console.error(n)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getZindex(){return Ht.Z_INDEX_OFFSET}setCollapsed(e){if(this.component==null)throw new Error("Failed to set popup collapsed");this.component.setCollapsed(e)}setAngle(e){if(this.component==null)throw new Error("Failed to set popup angle");this.component.setAngle(e,!0)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}}class qi{provider;popupElements=new Array;popupPositioned=new Map;constructor(e){this.provider=e}show(e){e.popup&&(e.pin.shown=!1,e.tooltip.shown=!1,this.popupPositioned.set(e.marker.id,!1),e.popup.setAngle(e.tooltip.angle),e.popup.shown=!0)}hide(e){e.popup&&(e.pin.shown=!0,e.tooltip.shown=!0,e.popup.shown=!1)}updateElements(e){this.popupElements=e,this.popupPositioned=new Map(e.map(n=>[n.id,!1]))}removeElements(){this.popupElements.forEach(e=>e.remove()),this.popupElements.length=0,this.popupPositioned.clear()}process(){for(const e of this.popupElements)if(e.shown){if(e.setCollapsed(!1),e.updateMap(!0),e.isExpanded()&&e.isBodyLoaded()==!1&&e.updateBody(),e.isCollapsed()==!1&&this.popupPositioned.get(e.id)==!1){const n=e.component?.getBody();if(n==null)continue;const r=e.component?.getOffsets();if(r==null)continue;const i=n.getBoundingClientRect();if(i.x==0&&i.y==0&&i.width==0&&i.height==0)continue;const s=i.x+i.width/2,o=i.y+i.height/2,a=s+r.x,l=o+r.y,u=a+e.width,f=l+e.height,h=this.provider.getContainer().getBoundingClientRect(),p=a-h.left,c=h.right-u,d=l-h.top,k=h.bottom-f,R=Math.min(e.width,e.height)/4,Q=p<0?p-R:c<0?-c+R:0,b=d<0?d-R:k<0?-k+R:0;this.provider.panBy(Q,b),this.popupPositioned.set(e.id,!0)}}else e.setCollapsed(!0),e.isCollapsed()&&e.updateMap(!1)}}const Qn=()=>'<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />',Hi=()=>`<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${Qn()}<span>&nbsp;@arenarium/maps</span></a>`;ne.MapManager=Ut,ne.getAttributionHtml=Hi,ne.getImageHtml=Qn,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arenarium/maps",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "author": "arenarium.dev",
6
6
  "description": "Visualize complex map markers clearly. A JavaScript lib for effective display of map markers, compatible with MapLibre, Mapbox, and Google Maps.",
@@ -15,8 +15,8 @@
15
15
  "module": "./dist/main.es.js",
16
16
  "svelte": "./dist/main.es.js",
17
17
  "types": "./dist/main.d.ts",
18
- "unpkg": "./dist/index.js",
19
- "jsdelivr": "./dist/index.js",
18
+ "unpkg": "./dist/main.js",
19
+ "jsdelivr": "./dist/main.js",
20
20
  "exports": {
21
21
  ".": {
22
22
  "types": "./dist/main.d.ts",
@@ -24,24 +24,6 @@
24
24
  "import": "./dist/main.es.js",
25
25
  "require": "./dist/main.cjs.js"
26
26
  },
27
- "./maplibre": {
28
- "types": "./dist/maplibre.d.ts",
29
- "svelte": "./dist/maplibre.es.js",
30
- "import": "./dist/maplibre.es.js",
31
- "require": "./dist/maplibre.cjs.js"
32
- },
33
- "./mapbox": {
34
- "types": "./dist/mapbox.d.ts",
35
- "svelte": "./dist/mapbox.es.js",
36
- "import": "./dist/mapbox.es.js",
37
- "require": "./dist/mapbox.cjs.js"
38
- },
39
- "./google": {
40
- "types": "./dist/google.d.ts",
41
- "svelte": "./dist/google.es.js",
42
- "import": "./dist/google.es.js",
43
- "require": "./dist/google.cjs.js"
44
- },
45
27
  "./dist/style.css": {
46
28
  "import": "./dist/style.css",
47
29
  "require": "./dist/style.css"
@@ -56,61 +38,46 @@
56
38
  "**/*.css"
57
39
  ],
58
40
  "devDependencies": {
41
+ "@googlemaps/js-api-loader": "^1.16.10",
59
42
  "@rollup/plugin-typescript": "^12.1.4",
60
43
  "@sveltejs/adapter-auto": "^6.1.0",
61
- "@sveltejs/kit": "^2.39.1",
62
- "@sveltejs/package": "^2.5.1",
63
- "@sveltejs/vite-plugin-svelte": "^5.1.1",
64
- "@types/node": "^24.4.0",
44
+ "@sveltejs/kit": "^2.43.4",
45
+ "@sveltejs/package": "^2.5.4",
46
+ "@sveltejs/vite-plugin-svelte": "^6.2.1",
47
+ "@types/google.maps": "^3.58.1",
48
+ "@types/node": "^24.5.2",
65
49
  "dts-bundle-generator": "^9.5.1",
66
- "eslint": "^9.35.0",
50
+ "eslint": "^9.36.0",
67
51
  "eslint-config-prettier": "^10.1.8",
68
- "eslint-plugin-svelte": "^3.12.3",
52
+ "eslint-plugin-svelte": "^3.12.4",
69
53
  "globals": "^16.4.0",
70
54
  "less": "^4.4.1",
55
+ "mapbox-gl": "^3.15.0",
56
+ "maplibre-gl": "^5.7.3",
71
57
  "prettier": "^3.6.2",
72
58
  "prettier-plugin-svelte": "^3.4.0",
73
- "publint": "^0.3.12",
74
- "svelte": "^5.38.10",
75
- "svelte-check": "^4.3.1",
59
+ "publint": "^0.3.13",
60
+ "svelte": "^5.39.6",
61
+ "svelte-check": "^4.3.2",
76
62
  "typescript": "^5.9.2",
77
- "typescript-eslint": "^8.43.0",
78
- "vite": "^6.3.6",
63
+ "typescript-eslint": "^8.44.1",
64
+ "vite": "^7.1.7",
79
65
  "vite-plugin-dts": "^4.5.4",
80
- "arenarium-maps-shared": "1.0.0"
81
- },
82
- "peerDependencies": {
83
- "@googlemaps/js-api-loader": "^1.16.10",
84
- "@types/google.maps": "^3.58.1",
85
- "mapbox-gl": "^3.13.0",
86
- "maplibre-gl": "^5.6.1"
87
- },
88
- "peerDependenciesMeta": {
89
- "@googlemaps/js-api-loader": {
90
- "optional": true
91
- },
92
- "@types/google.maps": {
93
- "optional": true
94
- },
95
- "mapbox-gl": {
96
- "optional": true
97
- },
98
- "maplibre-gl": {
99
- "optional": true
100
- }
66
+ "@arenarium/maps-integration-google": "1.0.0",
67
+ "@arenarium/maps-integration-maplibre": "1.0.0",
68
+ "@arenarium/maps-integration-mapbox": "1.0.0",
69
+ "@arenarium/maps-shared": "1.0.0"
101
70
  },
102
71
  "dependencies": {
103
- "zod": "^3.25.76"
72
+ "valibot": "^1.1.0"
104
73
  },
105
74
  "scripts": {
106
75
  "lib_dev": "vite dev --host",
107
76
  "lib_dev_browser": "vite dev --mode browser --host",
108
77
  "lib_check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
109
78
  "lib_check_watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
110
- "lib_build_vite_modular": "vite build -c ./vite/modular/vite.config.ts",
111
- "lib_build_vite_browser": "vite build -c ./vite/browser/vite.config.ts",
112
- "lib_build_types_browser": "dts-bundle-generator --export-referenced-types --umd-module-name=arenarium -o ./dist/index.d.ts ./src/lib/index.ts",
113
- "lib_build": "pnpm run lib_build_vite_modular && pnpm run lib_build_vite_browser && pnpm run lib_build_types_browser",
79
+ "lib_build": "vite build -c ./vite/vite.config.ts",
80
+ "lib_build_dev": "vite build -c ./vite/vite.config.ts --mode development",
114
81
  "lib_patch": "pnpm version patch --no-git-tag-version",
115
82
  "lib_publish_public": "pnpm publish --access public",
116
83
  "lib_build_patch_commit_publish": "pnpm run build && pnpm run lib_patch_push && pnpm run lib_publish_public",
@@ -1 +0,0 @@
1
- "use strict";const t=()=>'<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />',e=()=>`<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${t()}<span>&nbsp;@arenarium/maps</span></a>`;exports.getAttributionHtml=e;
@@ -1,4 +0,0 @@
1
- const t = () => '<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />', a = () => `<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${t()}<span>&nbsp;@arenarium/maps</span></a>`;
2
- export {
3
- a as g
4
- };
@@ -1 +0,0 @@
1
- "use strict";var l=Object.defineProperty;var m=(a,t,e)=>t in a?l(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var r=(a,t,e)=>m(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./attribution-3vg4I3xA.cjs");class p{constructor(t,e,s,i){r(this,"MapClass");r(this,"MapMarkerClass");r(this,"map");r(this,"options");r(this,"attributionObserver");r(this,"attributionElement");this.MapClass=t,this.MapMarkerClass=e,this.options=i,this.map=new this.MapClass(s,{...i}),(i.attribution||i.attribution==null)&&(this.map.addListener("idle",()=>{this.attributionObserver||(this.attributionObserver=new MutationObserver((n,o)=>{this.insertAttributionElement(),this.attributionElement!=null&&(this.updateAttributionElement(),o.disconnect())}),this.attributionObserver.observe(s,{childList:!0,subtree:!0}))}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()}))}insertAttributionElement(){var n,o;const t=this.map.getDiv();if(t==null)return;const e=t.getElementsByClassName("gmnoprint")[0];if(e==null||e.parentElement==null)return;const s=e.cloneNode(!0),i=(o=(n=s.childNodes.item(0))==null?void 0:n.childNodes.item(1))==null?void 0:o.childNodes.item(0);i!=null&&(i.title="",i.innerHTML=u.getAttributionHtml(),e.parentElement.insertBefore(s,e),this.attributionElement=i)}updateAttributionElement(){var s,i;const t=this.map.getDiv();if(t==null)return;const e=(i=(s=this.attributionElement)==null?void 0:s.childNodes.item(0))==null?void 0:i.childNodes.item(1);e!=null&&(e.style.display=t.clientWidth>500?"initial":"none")}getParameters(){return{mapSize:256,zoomMin:this.options.minZoom??0,zoomMax:this.options.maxZoom??24,zoomScale:10}}getMap(){return this.map}getContainer(){return this.map.getDiv()}getZoom(){return this.map.getZoom()??NaN}getBounds(){const t=this.map.getBounds();if(t==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};const e=t.getSouthWest(),s=t.getNorthEast();return{sw:{lat:e.lat(),lng:e.lng()},ne:{lat:s.lat(),lng:s.lng()}}}panBy(t,e){this.map.panBy(t,e)}createMarker(t,e,s,i){const n=new this.MapMarkerClass({position:{lat:e,lng:s},content:t,zIndex:i});return{instance:n,inserted:()=>n.map!=null&&n.map==this.map,insert:()=>n.map=this.map,remove:()=>n.map=void 0,update:o=>n.zIndex=o}}}const d=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:"landscape",stylers:[{lightness:30}]},{featureType:"road",elementType:"geometry",stylers:[{saturation:-100}]}],h=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100}]},{elementType:"geometry",stylers:[{lightness:-45}]},{elementType:"labels.text.fill",stylers:[{lightness:-100}]},{elementType:"labels.text.stroke",stylers:[{lightness:-15}]},{featureType:"water",elementType:"geometry",stylers:[{lightness:-50}]}];exports.GoogleMapDarkStyle=h;exports.GoogleMapLightStyle=d;exports.GoogleMapsProvider=p;
package/dist/google.d.ts DELETED
@@ -1,311 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export declare const GoogleMapDarkStyle: ({
4
- elementType: string;
5
- stylers: {
6
- visibility: string;
7
- }[];
8
- featureType?: undefined;
9
- } | {
10
- stylers: {
11
- saturation: number;
12
- }[];
13
- elementType?: undefined;
14
- featureType?: undefined;
15
- } | {
16
- elementType: string;
17
- stylers: {
18
- lightness: number;
19
- }[];
20
- featureType?: undefined;
21
- } | {
22
- featureType: string;
23
- elementType: string;
24
- stylers: {
25
- lightness: number;
26
- }[];
27
- })[];
28
-
29
- export declare const GoogleMapLightStyle: ({
30
- elementType: string;
31
- stylers: {
32
- visibility: string;
33
- }[];
34
- featureType?: undefined;
35
- } | {
36
- stylers: ({
37
- saturation: number;
38
- lightness?: undefined;
39
- } | {
40
- lightness: number;
41
- saturation?: undefined;
42
- })[];
43
- elementType?: undefined;
44
- featureType?: undefined;
45
- } | {
46
- featureType: string;
47
- stylers: {
48
- lightness: number;
49
- }[];
50
- elementType?: undefined;
51
- } | {
52
- featureType: string;
53
- elementType: string;
54
- stylers: {
55
- saturation: number;
56
- }[];
57
- })[];
58
-
59
- declare interface GoogleMapsClass {
60
- new (container: HTMLElement, options: google.maps.MapOptions): google.maps.Map;
61
- }
62
-
63
- declare interface GoogleMapsMarkerClass {
64
- new (options: google.maps.marker.AdvancedMarkerElementOptions): google.maps.marker.AdvancedMarkerElement;
65
- }
66
-
67
- declare interface GoogleMapsOptions extends google.maps.MapOptions {
68
- attribution?: boolean;
69
- }
70
-
71
- export declare class GoogleMapsProvider implements MapProvider {
72
- private MapClass;
73
- private MapMarkerClass;
74
- private map;
75
- private options;
76
- private attributionObserver;
77
- private attributionElement;
78
- constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: GoogleMapsOptions);
79
- private insertAttributionElement;
80
- private updateAttributionElement;
81
- getParameters(): MapProviderParameters;
82
- getMap(): google.maps.Map;
83
- getContainer(): HTMLElement;
84
- getZoom(): number;
85
- getBounds(): MapBounds;
86
- panBy(x: number, y: number): void;
87
- createMarker(element: HTMLElement, lat: number, lng: number, zIndex: number): MapProviderMarker;
88
- }
89
-
90
- declare type MapBounds = z.infer<typeof mapBoundsSchema>;
91
-
92
- declare const mapBoundsSchema: z.ZodObject<{
93
- sw: z.ZodObject<{
94
- lat: z.ZodNumber;
95
- lng: z.ZodNumber;
96
- }, "strip", z.ZodTypeAny, {
97
- lat: number;
98
- lng: number;
99
- }, {
100
- lat: number;
101
- lng: number;
102
- }>;
103
- ne: z.ZodObject<{
104
- lat: z.ZodNumber;
105
- lng: z.ZodNumber;
106
- }, "strip", z.ZodTypeAny, {
107
- lat: number;
108
- lng: number;
109
- }, {
110
- lat: number;
111
- lng: number;
112
- }>;
113
- }, "strip", z.ZodTypeAny, {
114
- sw: {
115
- lat: number;
116
- lng: number;
117
- };
118
- ne: {
119
- lat: number;
120
- lng: number;
121
- };
122
- }, {
123
- sw: {
124
- lat: number;
125
- lng: number;
126
- };
127
- ne: {
128
- lat: number;
129
- lng: number;
130
- };
131
- }>;
132
-
133
- declare type MapProvider = z.infer<typeof mapProviderSchema>;
134
-
135
- declare type MapProviderMarker = z.infer<typeof mapProviderMarkerSchema>;
136
-
137
- declare const mapProviderMarkerSchema: z.ZodObject<{
138
- instance: z.ZodAny;
139
- inserted: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodBoolean>;
140
- insert: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>;
141
- remove: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>;
142
- update: z.ZodFunction<z.ZodTuple<[z.ZodNumber], z.ZodUnknown>, z.ZodVoid>;
143
- }, "strip", z.ZodTypeAny, {
144
- inserted: (...args: unknown[]) => boolean;
145
- insert: (...args: unknown[]) => void;
146
- remove: (...args: unknown[]) => void;
147
- update: (args_0: number, ...args: unknown[]) => void;
148
- instance?: any;
149
- }, {
150
- inserted: (...args: unknown[]) => boolean;
151
- insert: (...args: unknown[]) => void;
152
- remove: (...args: unknown[]) => void;
153
- update: (args_0: number, ...args: unknown[]) => void;
154
- instance?: any;
155
- }>;
156
-
157
- declare type MapProviderParameters = z.infer<typeof mapProviderParametersSchema>;
158
-
159
- declare const mapProviderParametersSchema: z.ZodObject<{
160
- mapSize: z.ZodNumber;
161
- zoomMin: z.ZodNumber;
162
- zoomMax: z.ZodNumber;
163
- zoomScale: z.ZodNumber;
164
- }, "strip", z.ZodTypeAny, {
165
- mapSize: number;
166
- zoomMin: number;
167
- zoomMax: number;
168
- zoomScale: number;
169
- }, {
170
- mapSize: number;
171
- zoomMin: number;
172
- zoomMax: number;
173
- zoomScale: number;
174
- }>;
175
-
176
- declare const mapProviderSchema: z.ZodObject<{
177
- getParameters: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodObject<{
178
- mapSize: z.ZodNumber;
179
- zoomMin: z.ZodNumber;
180
- zoomMax: z.ZodNumber;
181
- zoomScale: z.ZodNumber;
182
- }, "strip", z.ZodTypeAny, {
183
- mapSize: number;
184
- zoomMin: number;
185
- zoomMax: number;
186
- zoomScale: number;
187
- }, {
188
- mapSize: number;
189
- zoomMin: number;
190
- zoomMax: number;
191
- zoomScale: number;
192
- }>>;
193
- getContainer: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodEffects<z.ZodAny, HTMLElement, any>>;
194
- getZoom: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodNumber>;
195
- getBounds: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodObject<{
196
- sw: z.ZodObject<{
197
- lat: z.ZodNumber;
198
- lng: z.ZodNumber;
199
- }, "strip", z.ZodTypeAny, {
200
- lat: number;
201
- lng: number;
202
- }, {
203
- lat: number;
204
- lng: number;
205
- }>;
206
- ne: z.ZodObject<{
207
- lat: z.ZodNumber;
208
- lng: z.ZodNumber;
209
- }, "strip", z.ZodTypeAny, {
210
- lat: number;
211
- lng: number;
212
- }, {
213
- lat: number;
214
- lng: number;
215
- }>;
216
- }, "strip", z.ZodTypeAny, {
217
- sw: {
218
- lat: number;
219
- lng: number;
220
- };
221
- ne: {
222
- lat: number;
223
- lng: number;
224
- };
225
- }, {
226
- sw: {
227
- lat: number;
228
- lng: number;
229
- };
230
- ne: {
231
- lat: number;
232
- lng: number;
233
- };
234
- }>>;
235
- panBy: z.ZodFunction<z.ZodTuple<[z.ZodNumber, z.ZodNumber], z.ZodUnknown>, z.ZodVoid>;
236
- createMarker: z.ZodFunction<z.ZodTuple<[z.ZodEffects<z.ZodAny, HTMLElement, any>, z.ZodNumber, z.ZodNumber, z.ZodNumber], z.ZodUnknown>, z.ZodObject<{
237
- instance: z.ZodAny;
238
- inserted: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodBoolean>;
239
- insert: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>;
240
- remove: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>;
241
- update: z.ZodFunction<z.ZodTuple<[z.ZodNumber], z.ZodUnknown>, z.ZodVoid>;
242
- }, "strip", z.ZodTypeAny, {
243
- inserted: (...args: unknown[]) => boolean;
244
- insert: (...args: unknown[]) => void;
245
- remove: (...args: unknown[]) => void;
246
- update: (args_0: number, ...args: unknown[]) => void;
247
- instance?: any;
248
- }, {
249
- inserted: (...args: unknown[]) => boolean;
250
- insert: (...args: unknown[]) => void;
251
- remove: (...args: unknown[]) => void;
252
- update: (args_0: number, ...args: unknown[]) => void;
253
- instance?: any;
254
- }>>;
255
- }, "strip", z.ZodTypeAny, {
256
- getParameters: (...args: unknown[]) => {
257
- mapSize: number;
258
- zoomMin: number;
259
- zoomMax: number;
260
- zoomScale: number;
261
- };
262
- getContainer: (...args: unknown[]) => HTMLElement;
263
- getZoom: (...args: unknown[]) => number;
264
- getBounds: (...args: unknown[]) => {
265
- sw: {
266
- lat: number;
267
- lng: number;
268
- };
269
- ne: {
270
- lat: number;
271
- lng: number;
272
- };
273
- };
274
- panBy: (args_0: number, args_1: number, ...args: unknown[]) => void;
275
- createMarker: (args_0: any, args_1: number, args_2: number, args_3: number, ...args: unknown[]) => {
276
- inserted: (...args: unknown[]) => boolean;
277
- insert: (...args: unknown[]) => void;
278
- remove: (...args: unknown[]) => void;
279
- update: (args_0: number, ...args: unknown[]) => void;
280
- instance?: any;
281
- };
282
- }, {
283
- getParameters: (...args: unknown[]) => {
284
- mapSize: number;
285
- zoomMin: number;
286
- zoomMax: number;
287
- zoomScale: number;
288
- };
289
- getContainer: (...args: unknown[]) => any;
290
- getZoom: (...args: unknown[]) => number;
291
- getBounds: (...args: unknown[]) => {
292
- sw: {
293
- lat: number;
294
- lng: number;
295
- };
296
- ne: {
297
- lat: number;
298
- lng: number;
299
- };
300
- };
301
- panBy: (args_0: number, args_1: number, ...args: unknown[]) => void;
302
- createMarker: (args_0: HTMLElement, args_1: number, args_2: number, args_3: number, ...args: unknown[]) => {
303
- inserted: (...args: unknown[]) => boolean;
304
- insert: (...args: unknown[]) => void;
305
- remove: (...args: unknown[]) => void;
306
- update: (args_0: number, ...args: unknown[]) => void;
307
- instance?: any;
308
- };
309
- }>;
310
-
311
- export { }