@arenarium/maps 1.0.136 → 1.0.138
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.
- package/LICENSE.txt +1 -122
- package/dist/google.cjs.js +1 -1
- package/dist/google.d.ts +70 -8
- package/dist/google.es.js +30 -30
- package/dist/index.css +1 -1
- package/dist/index.d.ts +262 -146
- package/dist/index.js +2 -2
- package/dist/main.cjs.js +2 -2
- package/dist/main.d.ts +236 -139
- package/dist/main.es.js +1992 -1801
- package/dist/maplibre.cjs.js +1 -1
- package/dist/maplibre.d.ts +70 -8
- package/dist/maplibre.es.js +21 -23
- package/dist/style.css +1 -1
- package/package.json +15 -15
package/dist/main.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Dn=Object.defineProperty;var cr=r=>{throw TypeError(r)};var Zn=(r,e,t)=>e in r?Dn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var g=(r,e,t)=>Zn(r,typeof e!="symbol"?e+"":e,t),fr=(r,e,t)=>e.has(r)||cr("Cannot "+t);var $=(r,e,t)=>(fr(r,e,"read from private field"),t?t.call(r):e.get(r)),ze=(r,e,t)=>e.has(r)?cr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Fe=(r,e,t,n)=>(fr(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const hr=!1;var Ur=Array.isArray,Ln=Array.prototype.indexOf,jn=Array.from,zn=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Fn=Object.prototype,Vn=Array.prototype,$n=Object.getPrototypeOf,pr=Object.isExtensible;function Un(r){for(var e=0;e<r.length;e++)r[e]()}const X=2,Br=4,yt=8,qt=16,ge=32,Ze=64,Wt=128,z=256,it=512,H=1024,ae=2048,we=4096,ot=8192,Yt=16384,qr=32768,Bn=65536,qn=1<<19,Wr=1<<20,Tt=1<<21,nt=Symbol("$state");function Yr(r){return r===this.v}function Wn(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Yn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Hn(r){throw new Error("https://svelte.dev/e/effect_orphan")}function Xn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Jn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Gn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Kn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Qn=!1;const L=Symbol();let W=null;function mr(r){W=r}function Ht(r,e=!1,t){var n=W={p:W,c:null,d:!1,e:null,m:!1,s:r,x:null,l:null};ua(()=>{n.d=!0})}function Xt(r){const e=W;if(e!==null){r!==void 0&&(e.x=r);const i=e.e;if(i!==null){var t=M,n=S;e.e=null;try{for(var a=0;a<i.length;a++){var s=i[a];Oe(s.effect),pe(s.reaction),Jt(s.fn)}}finally{Oe(t),pe(n)}}W=e.p,e.m=!0}return r||{}}function Hr(){return!0}function Ve(r){if(typeof r!="object"||r===null||nt in r)return r;const e=$n(r);if(e!==Fn&&e!==Vn)return r;var t=new Map,n=Ur(r),a=B(0),s=S,i=o=>{var l=S;pe(s);var u=o();return pe(l),u};return n&&t.set("length",B(r.length)),new Proxy(r,{defineProperty(o,l,u){return(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Jn(),i(()=>{var c=t.get(l);c===void 0?(c=B(u.value),t.set(l,c)):R(c,u.value,!0)}),!0},deleteProperty(o,l){var u=t.get(l);if(u===void 0){if(l in o){const h=i(()=>B(L));t.set(l,h),Ct(a)}}else{if(n&&typeof l=="string"){var c=t.get("length"),f=Number(l);Number.isInteger(f)&&f<c.v&&R(c,f)}R(u,L),Ct(a)}return!0},get(o,l,u){var x;if(l===nt)return r;var c=t.get(l),f=l in o;if(c===void 0&&(!f||(x=Ue(o,l))!=null&&x.writable)&&(c=i(()=>{var E=Ve(f?o[l]:L),I=B(E);return I}),t.set(l,c)),c!==void 0){var h=O(c);return h===L?void 0:h}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var c=t.get(l);c&&(u.value=O(c))}else if(u===void 0){var f=t.get(l),h=f==null?void 0:f.v;if(f!==void 0&&h!==L)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(o,l){var h;if(l===nt)return!0;var u=t.get(l),c=u!==void 0&&u.v!==L||Reflect.has(o,l);if(u!==void 0||M!==null&&(!c||(h=Ue(o,l))!=null&&h.writable)){u===void 0&&(u=i(()=>{var x=c?Ve(o[l]):L,E=B(x);return E}),t.set(l,u));var f=O(u);if(f===L)return!1}return c},set(o,l,u,c){var V;var f=t.get(l),h=l in o;if(n&&l==="length")for(var x=u;x<f.v;x+=1){var E=t.get(x+"");E!==void 0?R(E,L):x in o&&(E=i(()=>B(L)),t.set(x+"",E))}if(f===void 0)(!h||(V=Ue(o,l))!=null&&V.writable)&&(f=i(()=>{var be=B(void 0);return R(be,Ve(u)),be}),t.set(l,f));else{h=f.v!==L;var I=i(()=>Ve(u));R(f,I)}var C=Reflect.getOwnPropertyDescriptor(o,l);if(C!=null&&C.set&&C.set.call(c,u),!h){if(n&&typeof l=="string"){var ie=t.get("length"),oe=Number(l);Number.isInteger(oe)&&oe>=ie.v&&R(ie,oe+1)}Ct(a)}return!0},ownKeys(o){O(a);var l=Reflect.ownKeys(o).filter(f=>{var h=t.get(f);return h===void 0||h.v!==L});for(var[u,c]of t)c.v!==L&&!(u in o)&&l.push(u);return l},setPrototypeOf(){Gn()}})}function Ct(r,e=1){R(r,r.v+e)}function ea(r){var e=X|ae,t=S!==null&&(S.f&X)!==0?S:null;return M===null||t!==null&&(t.f&z)!==0?e|=z:M.f|=Wr,{ctx:W,deps:null,effects:null,equals:Yr,f:e,fn:r,reactions:null,rv:0,v:null,wv:0,parent:t??M}}function Xr(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)ke(e[t])}}function ta(r){for(var e=r.parent;e!==null;){if((e.f&X)===0)return e;e=e.parent}return null}function Jr(r){var e,t=M;Oe(ta(r));try{Xr(r),e=mn(r)}finally{Oe(t)}return e}function Gr(r){var e=Jr(r);if(r.equals(e)||(r.v=e,r.wv=hn()),!je){var t=(ce||(r.f&z)!==0)&&r.deps!==null?we:H;ee(r,t)}}const qe=new Map;function Ot(r,e){var t={f:0,v:r,reactions:null,equals:Yr,rv:0,wv:0};return t}function B(r,e){const t=Ot(r);return ya(t),t}function R(r,e,t=!1){S!==null&&!J&&Hr()&&(S.f&(X|qt))!==0&&!(D!=null&&D.includes(r))&&Kn();let n=t?Ve(e):e;return ra(r,n)}function ra(r,e){if(!r.equals(e)){var t=r.v;je?qe.set(r,e):qe.set(r,t),r.v=e,(r.f&X)!==0&&((r.f&ae)!==0&&Jr(r),ee(r,(r.f&z)===0?H:we)),r.wv=hn(),Kr(r,ae),M!==null&&(M.f&H)!==0&&(M.f&(ge|Ze))===0&&(U===null?xa([r]):U.push(r))}return e}function Kr(r,e){var t=r.reactions;if(t!==null)for(var n=t.length,a=0;a<n;a++){var s=t[a],i=s.f;(i&ae)===0&&(ee(s,e),(i&(H|z))!==0&&((i&X)!==0?Kr(s,we):Kt(s)))}}var vr,Qr,en,tn;function na(){if(vr===void 0){vr=window,Qr=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;en=Ue(e,"firstChild").get,tn=Ue(e,"nextSibling").get,pr(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),pr(t)&&(t.__t=void 0)}}function aa(r=""){return document.createTextNode(r)}function rn(r){return en.call(r)}function nn(r){return tn.call(r)}function Nt(r,e){return rn(r)}function sa(r,e=1,t=!1){let n=r;for(;e--;)n=nn(n);return n}function ia(r){M===null&&S===null&&Hn(),S!==null&&(S.f&z)!==0&&M===null&&Yn(),je&&Wn()}function oa(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Le(r,e,t,n=!0){var a=M,s={ctx:W,deps:null,nodes_start:null,nodes_end:null,f:r|ae,first:null,fn:e,last:null,next:null,parent:a,prev:null,teardown:null,transitions:null,wv:0};if(t)try{Gt(s),s.f|=qr}catch(l){throw ke(s),l}else e!==null&&Kt(s);var i=t&&s.deps===null&&s.first===null&&s.nodes_start===null&&s.teardown===null&&(s.f&(Wr|Wt))===0;if(!i&&n&&(a!==null&&oa(s,a),S!==null&&(S.f&X)!==0)){var o=S;(o.effects??(o.effects=[])).push(s)}return s}function ua(r){const e=Le(yt,null,!1);return ee(e,H),e.teardown=r,e}function re(r){ia();var e=M!==null&&(M.f&ge)!==0&&W!==null&&!W.m;if(e){var t=W;(t.e??(t.e=[])).push({fn:r,effect:M,reaction:S})}else{var n=Jt(r);return n}}function la(r){const e=Le(Ze,r,!0);return(t={})=>new Promise(n=>{t.outro?pa(e,()=>{ke(e),n(void 0)}):(ke(e),n(void 0))})}function Jt(r){return Le(Br,r,!1)}function an(r){return Le(yt,r,!0)}function sn(r,e=[],t=ea){const n=e.map(t);return da(()=>r(...n.map(O)))}function da(r,e=0){return Le(yt|qt|e,r,!0)}function ca(r,e=!0){return Le(yt|ge,r,!0,e)}function on(r){var e=r.teardown;if(e!==null){const t=je,n=S;gr(!0),pe(null);try{e.call(null)}finally{gr(t),pe(n)}}}function un(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){var n=t.next;(t.f&Ze)!==0?t.parent=null:ke(t,e),t=n}}function fa(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&ge)===0&&ke(e),e=t}}function ke(r,e=!0){var t=!1;(e||(r.f&qn)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(ha(r.nodes_start,r.nodes_end),t=!0),un(r,e&&!t),ct(r,0),ee(r,Yt);var n=r.transitions;if(n!==null)for(const s of n)s.stop();on(r);var a=r.parent;a!==null&&a.first!==null&&ln(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=null}function ha(r,e){for(;r!==null;){var t=r===e?null:nn(r);r.remove(),r=t}}function ln(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function pa(r,e){var t=[];dn(r,t,!0),ma(t,()=>{ke(r),e&&e()})}function ma(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var a of r)a.out(n)}else e()}function dn(r,e,t){if((r.f&ot)===0){if(r.f^=ot,r.transitions!==null)for(const i of r.transitions)(i.is_global||t)&&e.push(i);for(var n=r.first;n!==null;){var a=n.next,s=(n.f&Bn)!==0||(n.f&ge)!==0;dn(n,e,s?t:!1),n=a}}}let ut=[];function va(){var r=ut;ut=[],Un(r)}function ga(r){ut.length===0&&queueMicrotask(va),ut.push(r)}function _a(r){var e=M;if((e.f&qr)===0){if((e.f&Wt)===0)throw r;e.fn(r)}else cn(r,e)}function cn(r,e){for(;e!==null;){if((e.f&Wt)!==0)try{e.fn(r);return}catch{}e=e.parent}throw r}let Rt=!1,lt=null,xe=!1,je=!1;function gr(r){je=r}let at=[];let S=null,J=!1;function pe(r){S=r}let M=null;function Oe(r){M=r}let D=null;function ya(r){S!==null&&S.f&Tt&&(D===null?D=[r]:D.push(r))}let P=null,j=0,U=null;function xa(r){U=r}let fn=1,dt=0,ce=!1;function hn(){return++fn}function xt(r){var f;var e=r.f;if((e&ae)!==0)return!0;if((e&we)!==0){var t=r.deps,n=(e&z)!==0;if(t!==null){var a,s,i=(e&it)!==0,o=n&&M!==null&&!ce,l=t.length;if(i||o){var u=r,c=u.parent;for(a=0;a<l;a++)s=t[a],(i||!((f=s==null?void 0:s.reactions)!=null&&f.includes(u)))&&(s.reactions??(s.reactions=[])).push(u);i&&(u.f^=it),o&&c!==null&&(c.f&z)===0&&(u.f^=z)}for(a=0;a<l;a++)if(s=t[a],xt(s)&&Gr(s),s.wv>r.wv)return!0}(!n||M!==null&&!ce)&&ee(r,H)}return!1}function pn(r,e,t=!0){var n=r.reactions;if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];D!=null&&D.includes(r)||((s.f&X)!==0?pn(s,e,!1):e===s&&(t?ee(s,ae):(s.f&H)!==0&&ee(s,we),Kt(s)))}}function mn(r){var x;var e=P,t=j,n=U,a=S,s=ce,i=D,o=W,l=J,u=r.f;P=null,j=0,U=null,ce=(u&z)!==0&&(J||!xe||S===null),S=(u&(ge|Ze))===0?r:null,D=null,mr(r.ctx),J=!1,dt++,r.f|=Tt;try{var c=(0,r.fn)(),f=r.deps;if(P!==null){var h;if(ct(r,j),f!==null&&j>0)for(f.length=j+P.length,h=0;h<P.length;h++)f[j+h]=P[h];else r.deps=f=P;if(!ce)for(h=j;h<f.length;h++)((x=f[h]).reactions??(x.reactions=[])).push(r)}else f!==null&&j<f.length&&(ct(r,j),f.length=j);if(Hr()&&U!==null&&!J&&f!==null&&(r.f&(X|we|ae))===0)for(h=0;h<U.length;h++)pn(U[h],r);return a!==null&&a!==r&&(dt++,U!==null&&(n===null?n=U:n.push(...U))),c}catch(E){_a(E)}finally{P=e,j=t,U=n,S=a,ce=s,D=i,mr(o),J=l,r.f^=Tt}}function ka(r,e){let t=e.reactions;if(t!==null){var n=Ln.call(t,r);if(n!==-1){var a=t.length-1;a===0?t=e.reactions=null:(t[n]=t[a],t.pop())}}t===null&&(e.f&X)!==0&&(P===null||!P.includes(e))&&(ee(e,we),(e.f&(z|it))===0&&(e.f^=it),Xr(e),ct(e,0))}function ct(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)ka(r,t[n])}function Gt(r){var e=r.f;if((e&Yt)===0){ee(r,H);var t=M,n=xe;M=r,xe=!0;try{(e&qt)!==0?fa(r):un(r),on(r);var a=mn(r);r.teardown=typeof a=="function"?a:null,r.wv=fn;var s;hr&&Qn&&(r.f&ae)!==0&&r.deps}finally{xe=n,M=t}}}function wa(){try{Xn()}catch(r){if(lt!==null)cn(r,lt);else throw r}}function ba(){var r=xe;try{var e=0;for(xe=!0;at.length>0;){e++>1e3&&wa();var t=at,n=t.length;at=[];for(var a=0;a<n;a++){var s=Ea(t[a]);Ca(s)}qe.clear()}}finally{Rt=!1,xe=r,lt=null}}function Ca(r){var e=r.length;if(e!==0)for(var t=0;t<e;t++){var n=r[t];(n.f&(Yt|ot))===0&&xt(n)&&(Gt(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?ln(n):n.fn=null))}}function Kt(r){Rt||(Rt=!0,queueMicrotask(ba));for(var e=lt=r;e.parent!==null;){e=e.parent;var t=e.f;if((t&(Ze|ge))!==0){if((t&H)===0)return;e.f^=H}}at.push(e)}function Ea(r){for(var e=[],t=r;t!==null;){var n=t.f,a=(n&(ge|Ze))!==0,s=a&&(n&H)!==0;if(!s&&(n&ot)===0){(n&Br)!==0?e.push(t):a?t.f^=H:xt(t)&&Gt(t);var i=t.first;if(i!==null){t=i;continue}}var o=t.parent;for(t=t.next;t===null&&o!==null;)t=o.next,o=o.parent}return e}function O(r){var e=r.f,t=(e&X)!==0;if(S!==null&&!J){if(!(D!=null&&D.includes(r))){var n=S.deps;r.rv<dt&&(r.rv=dt,P===null&&n!==null&&n[j]===r?j++:P===null?P=[r]:(!ce||!P.includes(r))&&P.push(r))}}else if(t&&r.deps===null&&r.effects===null){var a=r,s=a.parent;s!==null&&(s.f&z)===0&&(a.f^=z)}return t&&(a=r,xt(a)&&Gr(a)),je&&qe.has(r)?qe.get(r):r.v}function Aa(r){var e=J;try{return J=!0,r()}finally{J=e}}const Sa=-7169;function ee(r,e){r.f=r.f&Sa|e}const Ma=["touchstart","touchmove"];function Ta(r){return Ma.includes(r)}const Oa=new Set,_r=new Set;function tt(r){var oe;var e=this,t=e.ownerDocument,n=r.type,a=((oe=r.composedPath)==null?void 0:oe.call(r))||[],s=a[0]||r.target,i=0,o=r.__root;if(o){var l=a.indexOf(o);if(l!==-1&&(e===document||e===window)){r.__root=e;return}var u=a.indexOf(e);if(u===-1)return;l<=u&&(i=l)}if(s=a[i]||r.target,s!==e){zn(r,"currentTarget",{configurable:!0,get(){return s||t}});var c=S,f=M;pe(null),Oe(null);try{for(var h,x=[];s!==null;){var E=s.assignedSlot||s.parentNode||s.host||null;try{var I=s["__"+n];if(I!=null&&(!s.disabled||r.target===s))if(Ur(I)){var[C,...ie]=I;C.apply(s,[r,...ie])}else I.call(s,r)}catch(V){h?x.push(V):h=V}if(r.cancelBubble||E===e||E===null)break;s=E}if(h){for(let V of x)queueMicrotask(()=>{throw V});throw h}}finally{r.__root=e,delete r.currentTarget,pe(c),Oe(f)}}}function Na(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function Ra(r,e){var t=M;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function vn(r,e){var t,n=!r.startsWith("<!>");return()=>{t===void 0&&(t=Na(n?r:"<!>"+r),t=rn(t));var a=Qr?document.importNode(t,!0):t.cloneNode(!0);return Ra(a,a),a}}function gn(r,e){r!==null&&r.before(e)}function _n(r,e){return Ia(r,e)}const Ee=new Map;function Ia(r,{target:e,anchor:t,props:n={},events:a,context:s,intro:i=!0}){na();var o=new Set,l=f=>{for(var h=0;h<f.length;h++){var x=f[h];if(!o.has(x)){o.add(x);var E=Ta(x);e.addEventListener(x,tt,{passive:E});var I=Ee.get(x);I===void 0?(document.addEventListener(x,tt,{passive:E}),Ee.set(x,1)):Ee.set(x,I+1)}}};l(jn(Oa)),_r.add(l);var u=void 0,c=la(()=>{var f=t??e.appendChild(aa());return ca(()=>{if(s){Ht({});var h=W;h.c=s}a&&(n.$$events=a),u=r(f,n)||{},s&&Xt()}),()=>{var E;for(var h of o){e.removeEventListener(h,tt);var x=Ee.get(h);--x===0?(document.removeEventListener(h,tt),Ee.delete(h)):Ee.set(h,x)}_r.delete(l),f!==t&&((E=f.parentNode)==null||E.removeChild(f))}});return Pa.set(u,c),u}let Pa=new WeakMap;const yr=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Da(r,e,t){var n=r==null?"":""+r;if(t){for(var a in t)if(t[a])n=n?n+" "+a:a;else if(n.length)for(var s=a.length,i=0;(i=n.indexOf(a,i))>=0;){var o=i+s;(i===0||yr.includes(n[i-1]))&&(o===n.length||yr.includes(n[o]))?n=(i===0?"":n.substring(0,i))+n.substring(o+1):i=o}}return n===""?null:n}function xr(r,e=!1){var t=e?" !important;":";",n="";for(var a in r){var s=r[a];s!=null&&s!==""&&(n+=" "+a+": "+s+t)}return n}function Za(r,e){if(e){var t="",n,a;return Array.isArray(e)?(n=e[0],a=e[1]):n=e,n&&(t+=xr(n)),a&&(t+=xr(a,!0)),t=t.trim(),t===""?null:t}return String(r)}function yn(r,e,t,n,a,s){var i=r.__className;if(i!==t||i===void 0){var o=Da(t,n,s);o==null?r.removeAttribute("class"):r.className=o,r.__className=t}else if(s&&a!==s)for(var l in s){var u=!!s[l];(a==null||u!==!!a[l])&&r.classList.toggle(l,u)}return s}function Et(r,e={},t,n){for(var a in t){var s=t[a];e[a]!==s&&(t[a]==null?r.style.removeProperty(a):r.style.setProperty(a,s,n))}}function kr(r,e,t,n){var a=r.__style;if(a!==e){var s=Za(e,n);s==null?r.removeAttribute("style"):r.style.cssText=s,r.__style=e}else n&&(Array.isArray(n)?(Et(r,t==null?void 0:t[0],n[0]),Et(r,t==null?void 0:t[1],n[1],"important")):Et(r,t,n));return n}const La=()=>performance.now(),G={tick:r=>requestAnimationFrame(r),now:()=>La(),tasks:new Set};function xn(){const r=G.now();G.tasks.forEach(e=>{e.c(r)||(G.tasks.delete(e),e.f())}),G.tasks.size!==0&&G.tick(xn)}function ja(r){let e;return G.tasks.size===0&&G.tick(xn),{promise:new Promise(t=>{G.tasks.add(e={c:r,f:t})}),abort(){G.tasks.delete(e)}}}function wr(r,e){return r===e||(r==null?void 0:r[nt])===e}function Se(r={},e,t,n){return Jt(()=>{var a,s;return an(()=>{a=s,s=[],Aa(()=>{r!==t(...s)&&(e(r,...s),a&&wr(t(...a),r)&&e(null,...a))})}),()=>{ga(()=>{s&&wr(t(...s),r)&&e(null,...s)})}}),r}const za="5";var $r;typeof window<"u"&&(($r=window.__svelte??(window.__svelte={})).v??($r.v=new Set)).add(za);function Fa(r){return r}function It(r){return-.5*(Math.cos(Math.PI*r)-1)}function Va(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function $a(r){return Math.sin(r*Math.PI/2)}const Ua=128,Ba=0,At=1,qa=2;class Wa{constructor(){g(this,"animationsStarted",!1);g(this,"animationsCount",0);g(this,"animationsLimit",Ua);g(this,"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 t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let a=0;a<n.length;a++){const s=n[a];if(s!=null){for(const i of s.values())if(!i.executed&&(i.executed=!0,i.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,a){let s=this.layers[e];s==null&&(s=this.layers[e]={animations:new Array});let i=s.animations[t];i==null&&(i=s.animations[t]=new Map);let o={id:n,priority:t,executed:!1,function:a};i.set(n,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let a=this.layers[n];if(a==null)continue;let s=a.animations[e];if(s==null)return;let i=s.get(t);if(i==null||i.executed==!1)return;s.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const de=new Wa;function br(r){return Object.prototype.toString.call(r)==="[object Date]"}function Pt(r,e){if(r===e||r!==r)return()=>r;const t=typeof r;if(t!==typeof e||Array.isArray(r)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(r)){const n=e.map((a,s)=>Pt(r[s],a));return a=>n.map(s=>s(a))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(br(r)&&br(e)){const s=r.getTime(),o=e.getTime()-s;return l=>new Date(s+l*o)}const n=Object.keys(e),a={};return n.forEach(s=>{a[s]=Pt(r[s],e[s])}),s=>{const i={};return n.forEach(o=>{i[o]=a[o](s)}),i}}if(t==="number"){const n=e-r;return a=>r+a*n}return()=>e}var ne,Te,Je,ye;const rr=class rr{constructor(e,t={}){ze(this,ne);ze(this,Te);ze(this,Je);ze(this,ye,null);Fe(this,ne,Ot(e)),Fe(this,Te,Ot(e)),Fe(this,Je,t)}static of(e,t){const n=new rr(e(),t);return an(()=>{n.set(e())}),n}set(e,t){var f;R($(this,Te),e);let{delay:n=0,duration:a=400,easing:s=Fa,interpolate:i=Pt}={...$(this,Je),...t};if(a===0)return(f=$(this,ye))==null||f.abort(),R($(this,ne),e),Promise.resolve();const o=G.now()+n;let l,u=!1,c=$(this,ye);return Fe(this,ye,ja(h=>{if(h<o)return!0;if(!u){u=!0;const E=$(this,ne).v;l=i(E,e),typeof a=="function"&&(a=a(E,e)),c==null||c.abort()}const x=h-o;return x>a?(R($(this,ne),e),!1):(R($(this,ne),l(s(x/a))),!0)})),$(this,ye).promise}get current(){return O($(this,ne))}get target(){return O($(this,Te))}set target(e){this.set(e)}};ne=new WeakMap,Te=new WeakMap,Je=new WeakMap,ye=new WeakMap;let Dt=rr;class st{constructor(e,t){g(this,"value");g(this,"motion");this.value=e,this.motion=new Dt(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var ft;(r=>{function e(t,n,a){const s=t/2,i=n/2,o=Math.sqrt(s*s+i*i),l=Math.atan(i/s)*(180/Math.PI),u=a*(Math.PI/180);return a<180?a<90?a<l?{offsetX:0,offsetY:o*Math.sin(u)-i}:{offsetX:o*Math.cos(u)-s,offsetY:0}:a<180-l?{offsetX:o*Math.cos(u)-s,offsetY:0}:{offsetX:-t,offsetY:o*Math.sin(u)-i}:a<270?a<180+l?{offsetX:-t,offsetY:o*Math.sin(u)-i}:{offsetX:o*Math.cos(u)-s,offsetY:-n}:a<360-l?{offsetX:o*Math.cos(u)-s,offsetY:-n}:{offsetX:0,offsetY:o*Math.sin(u)-i}}r.getOffsets=e})(ft||(ft={}));var Ya=vn('<div><div class="pin svelte-1d2w496"></div> <div class="marker svelte-1d2w496"><div class="body svelte-1d2w496"></div></div></div>');function Ha(r,e){Ht(e,!0);let t,n,a,s;const i=e.width+2*e.padding,o=e.height+2*e.padding,l=()=>s;re(()=>{a.style.width=`${Math.min(i,o)/4}px`,a.style.height=`${Math.min(i,o)/4}px`});let u=B(!0);function c(A){R(u,A,!0)}function f(){return O(u)}let h=B(!0);function x(A){R(h,A,!0)}function E(){return C.motion.current==0}function I(){return O(h)==!1}let C=new st(0),ie=At;re(()=>{oe(C.motion.current)}),re(()=>{O(u)==!1&&(C.snap(),de.clear(e.priority,e.id+"_scale"))}),re(()=>{O(h)==!0&&C.value!=0&&(ie=Ba,de.stacked()?C.set(0,{duration:0}):C.set(0,{duration:150,easing:Va})),O(h)==!1&&C.value!=1&&(ie=At,C.set(1,{duration:150,easing:$a}))});function oe(A){!t||!n||!a||de.equeue(ie,e.priority,e.id+"_scale",()=>{t.style.opacity=`${A}`,n.style.scale=`${A}`,a.style.scale=`${A}`})}let V=NaN,be=B(!1),ue=new st(-i/2,{easing:It}),Ge=new st(-o/2,{easing:It});re(()=>{nr(ue.motion.current,Ge.motion.current)}),re(()=>{O(u)==!1&&(ue.snap(),ue.snap(),de.clear(e.priority,e.id+"_angle"))}),re(()=>{O(h)==!0&&O(be)&&(ue.update({duration:75}),ue.update({duration:75}))});function nr(A,te){if(!t||!n||!a)return;const Ce=A+i/2,_e=te+o/2,Qe=o<i?Ce*o/i:Ce,Tn=o>i?_e*i/o:_e,On=Math.atan2(Tn,Qe)/Math.PI*180-45,lr=0,Nn=30,bt=Math.sqrt(Ce*Ce+_e*_e),et=Math.min(i,o)/2,Rn=Math.sqrt(i*i+o*o)/2,In=(bt-et)/(Rn-et),dr=lr+In*(Nn-lr),Pn=bt<et?bt/et:1;de.equeue(At,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(A)}px, ${Math.round(te)}px)`,a.style.transform=`scale(${Pn}) rotate(${On}deg) skew(${dr}deg, ${dr}deg)`})}function Mn(A){if(O(be)==!1){let te=ft.getOffsets(i,o,A);ue.set(Math.round(te.offsetX),{duration:0}),Ge.set(Math.round(te.offsetY),{duration:0}),nr(ue.value,Ge.value),V=A,R(be,!0)}else if(A!=V){let te=Math.abs(A-V),Ce=te<180?te:360-te,_e=Math.log(Ce)*75,Qe=ft.getOffsets(i,o,A);ue.set(Math.round(Qe.offsetX),{duration:_e}),Ge.set(Math.round(Qe.offsetY),{duration:_e}),V=A}}var Ke=Ya();let ar;var sr=Nt(Ke);Se(sr,A=>a=A,()=>a);var wt=sa(sr,2);let ir;var or=Nt(wt);let ur;return Se(or,A=>s=A,()=>s),Se(wt,A=>n=A,()=>n),Se(Ke,A=>t=A,()=>t),sn(A=>{ar=yn(Ke,1,"anchor svelte-1d2w496",null,ar,A),ir=kr(wt,"",ir,{padding:e.padding+"px"}),ur=kr(or,"",ur,{width:`${e.width}px`,height:`${e.height}px`})},[()=>({displayed:O(u)})]),gn(r,Ke),Xt({getBody:l,setDisplayed:c,getDisplayed:f,setCollapsed:x,getCollapsed:E,getExpanded:I,setAngle:Mn})}var Xa=vn('<div><div class="body svelte-piqgmq"></div></div>');function Ja(r,e){Ht(e,!0);let t,n;function a(){return n}let s=B(!1);function i(C){R(s,C,!0)}function o(){return O(s)}let l=new st(0,{easing:It});re(()=>{u(l.motion.current)}),re(()=>{O(s)==!1&&(l.snap(),de.clear(e.priority,e.id))});function u(C){t&&de.equeue(qa,e.priority,e.id,()=>{t.style.scale=C.toString(),t.style.filter=`brightness(${.25+.75*C})`,n.style.opacity=C.toString()})}function c(C){C!=l.value&&l.set(C,{duration:75})}function f(){return l.motion.current==0}function h(){return l.value}var x=Xa();let E;var I=Nt(x);return Se(I,C=>n=C,()=>n),Se(x,C=>t=C,()=>t),sn(C=>E=yn(x,1,"circle svelte-piqgmq",null,E,C),[()=>({displayed:O(s)})]),gn(r,x),Xt({getBody:a,setDisplayed:i,getDisplayed:o,setScale:c,getCollapsed:f,getScale:h})}async function rt(r,e){try{await fetch("https://arenarium.dev/api/public/v1/log?log="+encodeURIComponent(JSON.stringify({title:r,content:e})))}catch(t){console.error(t)}}var b;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},r.getValidEnumValues=a=>{const s=r.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return r.objectValues(i)},r.objectValues=a=>r.objectKeys(a).map(function(s){return a[s]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},r.find=(a,s)=>{for(const i of a)if(s(i))return i},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(b||(b={}));var Cr;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Cr||(Cr={}));const m=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),le=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return a(this),n}static assert(e){if(!(e instanceof Y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Y.create=r=>new Y(r);const We=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}};let Ga=We;function Zt(){return Ga}const Lt=r=>{const{data:e,path:t,errorMaps:n,issueData:a}=r,s=[...t,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function p(r,e){const t=Zt(),n=Lt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===We?void 0:We].filter(a=>!!a)});r.common.issues.push(n)}class F{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if(a.status==="aborted")return _;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const a of t){const s=await a.key,i=await a.value;n.push({key:s,value:i})}return F.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return _;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),$e=r=>({status:"dirty",value:r}),Z=r=>({status:"valid",value:r}),Er=r=>r.status==="aborted",Ar=r=>r.status==="dirty",Ne=r=>r.status==="valid",ht=r=>typeof Promise<"u"&&r instanceof Promise;var v;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(v||(v={}));class me{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Sr=(r,e)=>{if(Ne(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Y(r.common.issues);return this._error=t,this._error}}};function k(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:a}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:a}}class w{get description(){return this._def.description}_getType(e){return le(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new F,ctx:{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ht(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Sr(n,a)}"~validate"(e){var n,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Ne(s)?{value:s.value}:{issues:t.common.issues}}catch(s){(a=(n=s==null?void 0:s.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Ne(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(ht(a)?a:Promise.resolve(a));return Sr(n,s)}refine(e,t){const n=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:d.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof t=="function"?t(n,a):t),!1))}_refinement(e){return new Pe({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return he.create(this,this._def)}nullable(){return De.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q.create(this)}promise(){return Xe.create(this,this._def)}or(e){return mt.create([this,e],this._def)}and(e){return vt.create(this,e,this._def)}transform(e){return new Pe({...k(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new $t({...k(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new xs({typeName:y.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ut({...k(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Qt.create(this,e)}readonly(){return Bt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ka=/^c[^\s-]{8,}$/i,Qa=/^[0-9a-z]+$/,es=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ts=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rs=/^[a-z0-9_-]{21}$/i,ns=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,as=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ss=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,is="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let St;const os=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,us=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ls=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ds=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hs=new RegExp(`^${kn}$`);function wn(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ps(r){return new RegExp(`^${wn(r)}$`)}function ms(r){let e=`${kn}T${wn(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function vs(r,e){return!!((e==="v4"||!e)&&os.test(r)||(e==="v6"||!e)&&ls.test(r))}function gs(r,e){if(!ns.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function _s(r,e){return!!((e==="v4"||!e)&&us.test(r)||(e==="v6"||!e)&&ds.test(r))}class fe extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:m.string,received:s.parsedType}),_}const n=new F;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?p(a,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&p(a,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ss.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"email",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")St||(St=new RegExp(is,"u")),St.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"emoji",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")ts.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"uuid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")rs.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"nanoid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Ka.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cuid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Qa.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cuid2",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")es.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"ulid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),p(a,{validation:"url",code:d.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"regex",code:d.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),p(a,{code:d.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),p(a,{code:d.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),p(a,{code:d.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?ms(s).test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:d.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?hs.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:d.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ps(s).test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{code:d.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?as.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"duration",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?vs(e.data,s.version)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"ip",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?gs(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"jwt",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?_s(e.data,s.version)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"cidr",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?cs.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"base64",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?fs.test(e.data)||(a=this._getOrReturnCtx(e,a),p(a,{validation:"base64url",code:d.invalid_string,message:s.message}),n.dirty()):b.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(a=>e.test(a),{validation:t,code:d.invalid_string,...v.errToObj(n)})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...v.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...v.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...v.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new fe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}fe.create=r=>new fe({checks:[],typeName:y.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});function ys(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=t>n?t:n,s=Number.parseInt(r.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}class Re extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:m.number,received:s.parsedType}),_}let n;const a=new F;for(const s of this._def.checks)s.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?ys(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_finite,message:s.message}),a.dirty()):b.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,a){return new Re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(a)}]})}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Re.create=r=>new Re({checks:[],typeName:y.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class Ye extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const a=new F;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):b.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,a){return new Ye({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(a)}]})}_addCheck(e){return new Ye({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ye.create=r=>new Ye({checks:[],typeName:y.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});class jt extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),_}return Z(e.data)}}jt.create=r=>new jt({typeName:y.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class pt extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_type,expected:m.date,received:s.parsedType}),_}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return p(s,{code:d.invalid_date}),_}const n=new F;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:d.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:d.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):b.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}pt.create=r=>new pt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:y.ZodDate,...k(r)});class Mr extends w{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),_}return Z(e.data)}}Mr.create=r=>new Mr({typeName:y.ZodSymbol,...k(r)});class Tr extends w{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),_}return Z(e.data)}}Tr.create=r=>new Tr({typeName:y.ZodUndefined,...k(r)});class Or extends w{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),_}return Z(e.data)}}Or.create=r=>new Or({typeName:y.ZodNull,...k(r)});class zt extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}zt.create=r=>new zt({typeName:y.ZodAny,...k(r)});class Me extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}Me.create=r=>new Me({typeName:y.ZodUnknown,...k(r)});class ve extends w{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),_}}ve.create=r=>new ve({typeName:y.ZodNever,...k(r)});class Ft extends w{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),_}return Z(e.data)}}Ft.create=r=>new Ft({typeName:y.ZodVoid,...k(r)});class Q extends w{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==m.array)return p(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),_;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(i||o)&&(p(t,{code:i?d.too_big:d.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(p(t,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(p(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>a.type._parseAsync(new me(t,i,t.path,o)))).then(i=>F.mergeArray(n,i));const s=[...t.data].map((i,o)=>a.type._parseSync(new me(t,i,t.path,o)));return F.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new Q({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new Q({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new Q({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}Q.create=(r,e)=>new Q({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...k(e)});function Ae(r){if(r instanceof N){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=he.create(Ae(n))}return new N({...r._def,shape:()=>e})}else return r instanceof Q?new Q({...r._def,type:Ae(r.element)}):r instanceof he?he.create(Ae(r.unwrap())):r instanceof De?De.create(Ae(r.unwrap())):r instanceof se?se.create(r.items.map(e=>Ae(e))):r}class N extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const u=this._getOrReturnCtx(e);return p(u,{code:d.invalid_type,expected:m.object,received:u.parsedType}),_}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ve&&this._def.unknownKeys==="strip"))for(const u in a.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const c=s[u],f=a.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new me(a,f,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof ve){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of o)l.push({key:{status:"valid",value:c},value:{status:"valid",value:a.data[c]}});else if(u==="strict")o.length>0&&(p(a,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of o){const f=a.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new me(a,f,a.path,c)),alwaysSet:c in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const f=await c.key,h=await c.value;u.push({key:f,value:h,alwaysSet:c.alwaysSet})}return u}).then(u=>F.mergeObjectSync(n,u)):F.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,i;const a=((i=(s=this._def).errorMap)==null?void 0:i.call(s,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:v.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new N({...this._def,catchall:e})}pick(e){const t={};for(const n of b.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new N({...this._def,shape:()=>t})}omit(e){const t={};for(const n of b.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new N({...this._def,shape:()=>t})}deepPartial(){return Ae(this)}partial(e){const t={};for(const n of b.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()}return new N({...this._def,shape:()=>t})}required(e){const t={};for(const n of b.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof he;)s=s._def.innerType;t[n]=s}return new N({...this._def,shape:()=>t})}keyof(){return bn(b.objectKeys(this.shape))}}N.create=(r,e)=>new N({shape:()=>r,unknownKeys:"strip",catchall:ve.create(),typeName:y.ZodObject,...k(e)});N.strictCreate=(r,e)=>new N({shape:()=>r,unknownKeys:"strict",catchall:ve.create(),typeName:y.ZodObject,...k(e)});N.lazycreate=(r,e)=>new N({shape:r,unknownKeys:"strip",catchall:ve.create(),typeName:y.ZodObject,...k(e)});class mt extends w{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new Y(o.ctx.common.issues));return p(t,{code:d.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(n.map(async s=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},c=l._parseSync({data:t.data,path:t.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!s&&(s={result:c,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(l=>new Y(l));return p(t,{code:d.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}mt.create=(r,e)=>new mt({options:r,typeName:y.ZodUnion,...k(e)});function Vt(r,e){const t=le(r),n=le(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){const a=b.objectKeys(e),s=b.objectKeys(r).filter(o=>a.indexOf(o)!==-1),i={...r,...e};for(const o of s){const l=Vt(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<r.length;s++){const i=r[s],o=e[s],l=Vt(i,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class vt extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(Er(s)||Er(i))return _;const o=Vt(s.value,i.value);return o.valid?((Ar(s)||Ar(i))&&t.dirty(),{status:t.value,value:o.data}):(p(n,{code:d.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}vt.create=(r,e,t)=>new vt({left:r,right:e,typeName:y.ZodIntersection,...k(t)});class se extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return p(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return p(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new me(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>F.mergeArray(t,i)):F.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new se({...this._def,rest:e})}}se.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new se({items:r,typeName:y.ZodTuple,rest:null,...k(e)})};class Nr extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return p(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),_;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:a._parse(new me(n,o,n.path,[u,"key"])),value:s._parse(new me(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return _;(u.status==="dirty"||c.status==="dirty")&&t.dirty(),o.set(u.value,c.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return _;(u.status==="dirty"||c.status==="dirty")&&t.dirty(),o.set(u.value,c.value)}return{status:t.value,value:o}}}}Nr.create=(r,e,t)=>new Nr({valueType:e,keyType:r,typeName:y.ZodMap,...k(t)});class He extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return p(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),_;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(p(n,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(p(n,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const s=this._def.valueType;function i(l){const u=new Set;for(const c of l){if(c.status==="aborted")return _;c.status==="dirty"&&t.dirty(),u.add(c.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>s._parse(new me(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new He({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new He({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}He.create=(r,e)=>new He({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...k(e)});class Be extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return p(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),_;function n(o,l){return Lt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zt(),We].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:l}})}function a(o,l){return Lt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zt(),We].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:l}})}const s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Xe){const o=this;return Z(async function(...l){const u=new Y([]),c=await o._def.args.parseAsync(l,s).catch(x=>{throw u.addIssue(n(l,x)),u}),f=await Reflect.apply(i,this,c);return await o._def.returns._def.type.parseAsync(f,s).catch(x=>{throw u.addIssue(a(f,x)),u})})}else{const o=this;return Z(function(...l){const u=o._def.args.safeParse(l,s);if(!u.success)throw new Y([n(l,u.error)]);const c=Reflect.apply(i,this,u.data),f=o._def.returns.safeParse(c,s);if(!f.success)throw new Y([a(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Be({...this._def,args:se.create(e).rest(Me.create())})}returns(e){return new Be({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Be({args:e||se.create([]).rest(Me.create()),returns:t||Me.create(),typeName:y.ZodFunction,...k(n)})}}class Rr extends w{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Rr.create=(r,e)=>new Rr({getter:r,typeName:y.ZodLazy,...k(e)});class Ir extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ir.create=(r,e)=>new Ir({value:r,typeName:y.ZodLiteral,...k(e)});function bn(r,e){return new Ie({values:r,typeName:y.ZodEnum,...k(e)})}class Ie extends w{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:b.joinValues(n),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:d.invalid_enum_value,options:n}),_}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ie.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ie.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}Ie.create=bn;class Pr extends w{_parse(e){const t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const a=b.objectValues(t);return p(n,{expected:b.joinValues(a),received:n.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=b.objectValues(t);return p(n,{received:n.data,code:d.invalid_enum_value,options:a}),_}return Z(e.data)}get enum(){return this._def.values}}Pr.create=(r,e)=>new Pr({values:r,typeName:y.ZodNativeEnum,...k(e)});class Xe extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return p(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),_;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return Z(n.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Xe.create=(r,e)=>new Xe({type:r,typeName:y.ZodPromise,...k(e)});class Pe extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{p(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?_:l.status==="dirty"||t.value==="dirty"?$e(l.value):l});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?$e(o.value):o}}if(a.type==="refinement"){const i=o=>{const l=a.refinement(o,s);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ne(i))return _;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ne(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:t.value,value:o})):_);b.assertNever(a)}}Pe.create=(r,e,t)=>new Pe({schema:r,typeName:y.ZodEffects,effect:e,...k(t)});Pe.createWithPreprocess=(r,e,t)=>new Pe({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...k(t)});class he extends w{_parse(e){return this._getType(e)===m.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(r,e)=>new he({innerType:r,typeName:y.ZodOptional,...k(e)});class De extends w{_parse(e){return this._getType(e)===m.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}De.create=(r,e)=>new De({innerType:r,typeName:y.ZodNullable,...k(e)});class $t extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$t.create=(r,e)=>new $t({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class Ut extends w{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ht(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Y(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ut.create=(r,e)=>new Ut({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class Dr extends w{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}Dr.create=r=>new Dr({typeName:y.ZodNaN,...k(r)});class xs extends w{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Qt extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"?(t.dirty(),$e(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?_:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,t){return new Qt({in:e,out:t,typeName:y.ZodPipeline})}}class Bt extends w{_parse(e){const t=this._def.innerType._parse(e),n=a=>(Ne(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>n(a)):n(t)}unwrap(){return this._def.innerType}}Bt.create=(r,e)=>new Bt({innerType:r,typeName:y.ZodReadonly,...k(e)});var y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(y||(y={}));const kt=fe.create,T=Re.create,Cn=jt.create,er=zt.create;Me.create;ve.create;const Mt=Ft.create,tr=Q.create,q=N.create;mt.create;vt.create;const Zr=se.create,K=Be.create;Ie.create;const ks=Xe.create;he.create;De.create;q({pin:q({fade:Cn().optional(),maxCount:T().optional(),maxZoom:T().optional()}).optional(),animation:q({queue:q({limit:T().optional()}).optional()}).optional(),states:q({api:kt().optional()}).optional()});const ws=T().min(-90).max(90),bs=T().min(-180).max(180),Lr=er().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),En=q({mapSize:T(),zoomMin:T(),zoomMax:T(),zoomScale:T()}),Cs=q({instance:er(),inserted:K().args().returns(Cn()),insert:K().args().returns(Mt()),remove:K().args().returns(Mt()),update:K().args(T()).returns(Mt())}),Es=q({parameters:En,getContainer:K().args().returns(Lr),getZoom:K().args().returns(T()),getWidth:K().args().returns(T()),getHeight:K().args().returns(T()),createMarker:K().args(Lr,ws,bs,T()).returns(Cs)}),An=q({id:kt().min(1),rank:T(),lat:T().min(-90).max(90),lng:T().min(-180).max(180),width:T(),height:T(),padding:T()}).refine(r=>Math.min(r.width,r.height)/r.padding>=4,"Popup width and height must be at least 4 times the padding");Zr([T(),tr(Zr([T(),T()]))]);const jr=K().args(kt()).returns(ks(er())),As=q({data:An,callbacks:q({body:jr,pin:jr.optional()})}),Ss=tr(As);q({key:kt(),parameters:En,data:tr(An)});var gt;(r=>{function e(o,l,u){return{x:n(l)*u,y:a(o)*u}}r.project=e;function t(o,l,u){return{lat:i(l/u),lng:s(o/u)}}r.unproject=t;function n(o){return(180+o)/360}function a(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function s(o){return o*360-180}function i(o){return 360/Math.PI*Math.atan(Math.exp((180-o*360)*Math.PI/180))-90}})(gt||(gt={}));var _t;(r=>{r.COUNT=12,r.DEFAULT=270,r.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(_t||(_t={}));const Ms=1e6,Ts=2,Os=128,zr="https://arenarium.dev/api/public/v1/popup/states";class Ns{constructor(e,t,n){g(this,"key");g(this,"provider");g(this,"popupDataArray",new Array);g(this,"popupDataMap",new Map);g(this,"popupDataUpdating",!1);g(this,"popupMaxWidth",0);g(this,"popupMaxHeight",0);g(this,"configurationPinFade",!1);g(this,"configurationPinMaxCount",0);g(this,"configurationPinMaxZoomDelta",0);g(this,"configurationApiUrl",zr);Es.parse(t),this.key=e,this.provider=t,this.configuration=n}set configuration(e){var t,n,a,s,i,o;this.configurationPinFade=((t=e==null?void 0:e.pin)==null?void 0:t.fade)??!0,this.configurationPinMaxCount=((n=e==null?void 0:e.pin)==null?void 0:n.maxCount)??Math.max(Os,8*navigator.hardwareConcurrency),this.configurationPinMaxZoomDelta=((a=e==null?void 0:e.pin)==null?void 0:a.maxZoom)??Ts,this.configurationApiUrl=((s=e==null?void 0:e.states)==null?void 0:s.api)??zr,de.setLimit(((o=(i=e==null?void 0:e.animation)==null?void 0:i.queue)==null?void 0:o.limit)??8*navigator.hardwareConcurrency)}setColors(e,t,n){const a=this.provider.getContainer();a.style.setProperty("--map-style-primary",e),a.style.setProperty("--map-style-background",t),a.style.setProperty("--map-style-text",n)}async updatePopups(e){try{await Ss.parseAsync(e);const t={key:this.key,parameters:this.provider.parameters,data:e.map(s=>s.data)},n=await fetch(this.configurationApiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok||!n.body)throw new Error("Failed to get popup states");const a=await n.json();await this.updatePopupData(e,a),this.popupMaxWidth=this.popupDataArray.reduce((s,i)=>Math.max(s,i.marker.width),0),this.popupMaxHeight=this.popupDataArray.reduce((s,i)=>Math.max(s,i.marker.height),0),this.processPopupDataCallback()}catch(t){throw console.error(t),rt("[Error] Failed to update popups",{message:t.message,stack:t.stack}),t}}removePopups(){try{this.removePopupData()}catch(e){throw console.error(e),rt("[Error] Failed to remove popups",{message:e.message,stack:e.stack}),e}}togglePopups(e){try{this.togglePopupData(e)}catch(t){throw console.error(t),rt("[Error] Failed to toggle popups",{message:t.message,stack:t.stack}),t}}processPopupDataCallback(){if(this.popupDataArray.length!=0)try{this.processPopupData(),window.setTimeout(this.processPopupDataCallback.bind(this),25)}catch(e){console.error(e),rt("[Error] Failed to process popups",{message:e.message,stack:e.stack})}}processPopupData(){if(this.popupDataUpdating)return;const e=this.provider.getZoom();if(!e)return;const t=this.provider.getWidth(),n=this.provider.getHeight(),a=this.popupMaxWidth*2,s=this.popupMaxHeight*2,i=new Vr(-a,n+s,t+a,-s,this.provider.parameters),o=new Vr(0,n,t,0,this.provider.parameters);let l=0;for(const u of this.popupDataArray){const c=u.supressed?-1:e,f=u.circle;o.contains(f.lat,f.lng)?c<=f.zoom&&f.zoom<=e+this.configurationPinMaxZoomDelta?(l<this.configurationPinMaxCount&&(this.configurationPinFade==!0?f.updateState(e):f.setExpanded(),f.updateMap(!0),f.isPinLoaded()==!1&&f.updatePin()),l++):(f.setCollapsed(),f.isCollapsed()&&f.updateMap(!1)):f.updateMap(!1);const h=u.marker;i.contains(h.lat,h.lng)?h.zoom<=c?(h.updateState(e),h.setCollapsed(!1),h.updateMap(!0),h.isExpanded()&&h.isBodyLoaded()==!1&&h.updateBody()):(h.setCollapsed(!0),h.isCollapsed()&&h.updateMap(!1)):h.updateMap(!1)}}async updatePopupData(e,t){try{this.popupDataUpdating=!0;const n=new Map(e.map((s,i)=>[s.data.id,new Fr(this.provider,s,t[i])])),a=Array.from(this.popupDataArray);for(const s of a)n.has(s.id)==!1&&(s.remove(),this.popupDataMap.delete(s.id),this.popupDataArray.splice(this.popupDataArray.indexOf(s),1));for(let s=0;s<e.length;s++){const i=e[s],o=t[s],l=this.popupDataMap.get(i.data.id);if(l)l.update(o);else{const u=new Fr(this.provider,i,o);u.create(),this.popupDataMap.set(i.data.id,u),this.popupDataArray.push(u)}}this.popupDataArray.sort((s,i)=>s.zoom-i.zoom)}catch(n){throw console.error(n),this.popupDataArray.length=0,this.popupDataMap.clear(),n}finally{this.popupDataUpdating=!1}}removePopupData(){try{this.popupDataUpdating=!0,this.popupDataArray.forEach(e=>e.remove()),this.popupDataArray.length=0,this.popupDataMap.clear()}catch(e){throw console.error(e),this.popupDataArray.forEach(t=>t.remove()),this.popupDataArray.length=0,this.popupDataMap.clear(),e}finally{this.popupDataUpdating=!1}}togglePopupData(e){e.forEach(t=>{const n=this.popupDataMap.get(t.id);n&&(n.supressed=!t.toggled)})}}class Sn{constructor(e,t,n){g(this,"provider");g(this,"id");g(this,"lat");g(this,"lng");g(this,"zoom");g(this,"element");g(this,"component");g(this,"marker");this.provider=e,this.id=t.data.id,this.lat=t.data.lat,this.lng=t.data.lng,this.zoom=n[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 marker");this.marker=this.provider.createMarker(e,this.lat,this.lng,this.getZindex())}update(e){this.zoom=e[0],this.updateZIndex()}updateZIndex(){if(this.marker==null)throw new Error("Failed to update marker z-index");this.marker.update(this.getZindex())}updateMap(e){const t=this.marker,n=this.component;if(t==null||n==null)throw new Error("Failed to update popup map");e?t.inserted()==!1&&t.insert():t.inserted()==!0&&t.remove()}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)}isInBlock(e,t){return this.zoom<=e&&t.contains(this.lat,this.lng)}remove(){var e,t;(e=this.marker)==null||e.remove(),(t=this.element)==null||t.remove()}}class Rs extends Sn{constructor(t,n,a){super(t,n,a);g(this,"pinLoading",!1);g(this,"pinLoaded",!1);g(this,"pinCallback");this.pinCallback=n.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=_n(Ja,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*this.provider.parameters.zoomScale}})}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){const n=this.component;if(!n)throw new Error("Failed to update circle state");n.setScale(this.getScale(t))}updatePin(){var n;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(a=>{t.appendChild(a),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Is extends Sn{constructor(t,n,a){super(t,n,a);g(this,"width");g(this,"height");g(this,"padding");g(this,"states");g(this,"bodyLoading",!1);g(this,"bodyLoaded",!1);g(this,"bodyCallback");this.id=n.data.id,this.width=n.data.width,this.height=n.data.height,this.padding=n.data.padding,this.states=a[1].map(s=>[s[0],_t.DEGREES[s[1]]]),this.bodyCallback=n.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=_n(Ha,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,padding:this.padding}})}update(t){super.update(t),this.states=t[1].map(n=>[n[0],_t.DEGREES[n[1]]])}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){const n=this.component;if(!n)throw new Error("Failed to update marker state");n.setAngle(this.getAngle(t))}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(a=>{t.appendChild(a),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(t){const n=this.states.findLast(a=>a[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}getZindex(){return super.getZindex()+Ms}setCollapsed(t){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class Fr{constructor(e,t,n){g(this,"id");g(this,"rank");g(this,"lat");g(this,"lng");g(this,"zoom");g(this,"supressed");g(this,"circle");g(this,"marker");this.id=t.data.id,this.rank=t.data.rank,this.lat=t.data.lat,this.lng=t.data.lng,this.zoom=n[0],this.supressed=!1,this.circle=new Rs(e,t,n),this.marker=new Is(e,t,n)}create(){this.circle.create(),this.marker.create()}update(e){this.circle.update(e),this.marker.update(e)}remove(){this.circle.remove(),this.marker.remove()}}class Vr{constructor(e,t,n,a,s){g(this,"swLat");g(this,"swLng");g(this,"neLat");g(this,"neLng");g(this,"contains",(e,t)=>this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=t&&t<=this.neLng:t<=this.neLng||this.swLng<=t:!1);const i=gt.unproject(e,t,s.mapSize),o=gt.unproject(n,a,s.mapSize);this.swLat=i.lat,this.swLng=i.lng,this.neLat=o.lat,this.neLng=o.lng}}exports.MapManager=Ns;
|
|
1
|
+
"use strict";var Bn=Object.defineProperty;var Er=r=>{throw TypeError(r)};var $n=(r,e,t)=>e in r?Bn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e,t)=>$n(r,typeof e!="symbol"?e+"":e,t),Cr=(r,e,t)=>e.has(r)||Er("Cannot "+t);var B=(r,e,t)=>(Cr(r,e,"read from private field"),t?t.call(r):e.get(r)),Ue=(r,e,t)=>e.has(r)?Er("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Be=(r,e,t,n)=>(Cr(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ar=!1;var Qr=Array.isArray,qn=Array.prototype.indexOf,Wn=Array.from,Yn=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Xn=Object.prototype,Hn=Array.prototype,Jn=Object.getPrototypeOf,Mr=Object.isExtensible;function Gn(r){for(var e=0;e<r.length;e++)r[e]()}const J=2,Kr=4,Et=8,nr=16,ge=32,Pe=64,sr=128,V=256,dt=512,X=1024,ie=2048,we=4096,ct=8192,ar=16384,en=32768,Qn=65536,Kn=1<<19,tn=1<<20,Lt=1<<21,ot=Symbol("$state");function rn(r){return r===this.v}function es(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ts(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function rs(r){throw new Error("https://svelte.dev/e/effect_orphan")}function ns(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ss(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function as(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function is(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let os=!1;const F=Symbol();let W=null;function Sr(r){W=r}function ir(r,e=!1,t){var n=W={p:W,c:null,d:!1,e:null,m:!1,s:r,x:null,l:null};vs(()=>{n.d=!0})}function or(r){const e=W;if(e!==null){r!==void 0&&(e.x=r);const i=e.e;if(i!==null){var t=T,n=A;e.e=null;try{for(var s=0;s<i.length;s++){var a=i[s];Ne(a.effect),pe(a.reaction),lr(a.fn)}}finally{Ne(t),pe(n)}}W=e.p,e.m=!0}return r||{}}function nn(){return!0}function qe(r){if(typeof r!="object"||r===null||ot in r)return r;const e=Jn(r);if(e!==Xn&&e!==Hn)return r;var t=new Map,n=Qr(r),s=q(0),a=A,i=o=>{var l=A;pe(a);var u=o();return pe(l),u};return n&&t.set("length",q(r.length)),new Proxy(r,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&ss();var c=t.get(l);return c===void 0?c=i(()=>{var h=q(u.value);return t.set(l,h),h}):Z(c,u.value,!0),!0},deleteProperty(o,l){var u=t.get(l);if(u===void 0){if(l in o){const m=i(()=>q(F));t.set(l,m),Tt(s)}}else{if(n&&typeof l=="string"){var c=t.get("length"),h=Number(l);Number.isInteger(h)&&h<c.v&&Z(c,h)}Z(u,F),Tt(s)}return!0},get(o,l,u){var _;if(l===ot)return r;var c=t.get(l),h=l in o;if(c===void 0&&(!h||(_=Ye(o,l))!=null&&_.writable)&&(c=i(()=>{var C=qe(h?o[l]:F),D=q(C);return D}),t.set(l,c)),c!==void 0){var m=O(c);return m===F?void 0:m}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var c=t.get(l);c&&(u.value=O(c))}else if(u===void 0){var h=t.get(l),m=h==null?void 0:h.v;if(h!==void 0&&m!==F)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return u},has(o,l){var m;if(l===ot)return!0;var u=t.get(l),c=u!==void 0&&u.v!==F||Reflect.has(o,l);if(u!==void 0||T!==null&&(!c||(m=Ye(o,l))!=null&&m.writable)){u===void 0&&(u=i(()=>{var _=c?qe(o[l]):F,C=q(_);return C}),t.set(l,u));var h=O(u);if(h===F)return!1}return c},set(o,l,u,c){var H;var h=t.get(l),m=l in o;if(n&&l==="length")for(var _=u;_<h.v;_+=1){var C=t.get(_+"");C!==void 0?Z(C,F):_ in o&&(C=i(()=>q(F)),t.set(_+"",C))}if(h===void 0)(!m||(H=Ye(o,l))!=null&&H.writable)&&(h=i(()=>q(void 0)),Z(h,qe(u)),t.set(l,h));else{m=h.v!==F;var D=i(()=>qe(u));Z(h,D)}var R=Reflect.getOwnPropertyDescriptor(o,l);if(R!=null&&R.set&&R.set.call(c,u),!m){if(n&&typeof l=="string"){var te=t.get("length"),S=Number(l);Number.isInteger(S)&&S>=te.v&&Z(te,S+1)}Tt(s)}return!0},ownKeys(o){O(s);var l=Reflect.ownKeys(o).filter(h=>{var m=t.get(h);return m===void 0||m.v!==F});for(var[u,c]of t)c.v!==F&&!(u in o)&&l.push(u);return l},setPrototypeOf(){as()}})}function Tt(r,e=1){Z(r,r.v+e)}function ls(r){var e=J|ie,t=A!==null&&(A.f&J)!==0?A:null;return T===null||t!==null&&(t.f&V)!==0?e|=V:T.f|=tn,{ctx:W,deps:null,effects:null,equals:rn,f:e,fn:r,reactions:null,rv:0,v:null,wv:0,parent:t??T}}function sn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)ke(e[t])}}function us(r){for(var e=r.parent;e!==null;){if((e.f&J)===0)return e;e=e.parent}return null}function an(r){var e,t=T;Ne(us(r));try{sn(r),e=En(r)}finally{Ne(t)}return e}function on(r){var e=an(r);if(r.equals(e)||(r.v=e,r.wv=xn()),!Fe){var t=(ce||(r.f&V)!==0)&&r.deps!==null?we:X;ee(r,t)}}const He=new Map;function Dt(r,e){var t={f:0,v:r,reactions:null,equals:rn,rv:0,wv:0};return t}function q(r,e){const t=Dt(r);return Ms(t),t}function Z(r,e,t=!1){A!==null&&!G&&nn()&&(A.f&(J|nr))!==0&&!(L!=null&&L[1].includes(r)&&L[0]===A)&&is();let n=t?qe(e):e;return ds(r,n)}function ds(r,e){if(!r.equals(e)){var t=r.v;Fe?He.set(r,e):He.set(r,t),r.v=e,(r.f&J)!==0&&((r.f&ie)!==0&&an(r),ee(r,(r.f&V)===0?X:we)),r.wv=xn(),ln(r,ie),T!==null&&(T.f&X)!==0&&(T.f&(ge|Pe))===0&&($===null?Ss([r]):$.push(r))}return e}function ln(r,e){var t=r.reactions;if(t!==null)for(var n=t.length,s=0;s<n;s++){var a=t[s],i=a.f;(i&ie)===0&&(ee(a,e),(i&(X|V))!==0&&((i&J)!==0?ln(a,we):dr(a)))}}var Tr,un,dn,cn;function cs(){if(Tr===void 0){Tr=window,un=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;dn=Ye(e,"firstChild").get,cn=Ye(e,"nextSibling").get,Mr(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),Mr(t)&&(t.__t=void 0)}}function fs(r=""){return document.createTextNode(r)}function fn(r){return dn.call(r)}function hn(r){return cn.call(r)}function Zt(r,e){return fn(r)}function hs(r,e=1,t=!1){let n=r;for(;e--;)n=hn(n);return n}function ps(r){T===null&&A===null&&rs(),A!==null&&(A.f&V)!==0&&T===null&&ts(),Fe&&es()}function ms(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function je(r,e,t,n=!0){var s=T,a={ctx:W,deps:null,nodes_start:null,nodes_end:null,f:r|ie,first:null,fn:e,last:null,next:null,parent:s,prev:null,teardown:null,transitions:null,wv:0};if(t)try{ur(a),a.f|=en}catch(l){throw ke(a),l}else e!==null&&dr(a);var i=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&(tn|sr))===0;if(!i&&n&&(s!==null&&ms(a,s),A!==null&&(A.f&J)!==0)){var o=A;(o.effects??(o.effects=[])).push(a)}return a}function vs(r){const e=je(Et,null,!1);return ee(e,X),e.teardown=r,e}function ne(r){ps();var e=T!==null&&(T.f&ge)!==0&&W!==null&&!W.m;if(e){var t=W;(t.e??(t.e=[])).push({fn:r,effect:T,reaction:A})}else{var n=lr(r);return n}}function gs(r){const e=je(Pe,r,!0);return(t={})=>new Promise(n=>{t.outro?xs(e,()=>{ke(e),n(void 0)}):(ke(e),n(void 0))})}function lr(r){return je(Kr,r,!1)}function pn(r){return je(Et,r,!0)}function mn(r,e=[],t=ls){const n=e.map(t);return _s(()=>r(...n.map(O)))}function _s(r,e=0){return je(Et|nr|e,r,!0)}function ys(r,e=!0){return je(Et|ge,r,!0,e)}function vn(r){var e=r.teardown;if(e!==null){const t=Fe,n=A;Or(!0),pe(null);try{e.call(null)}finally{Or(t),pe(n)}}}function gn(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){var n=t.next;(t.f&Pe)!==0?t.parent=null:ke(t,e),t=n}}function ks(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&ge)===0&&ke(e),e=t}}function ke(r,e=!0){var t=!1;(e||(r.f&Kn)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(ws(r.nodes_start,r.nodes_end),t=!0),gn(r,e&&!t),mt(r,0),ee(r,ar);var n=r.transitions;if(n!==null)for(const a of n)a.stop();vn(r);var s=r.parent;s!==null&&s.first!==null&&_n(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=null}function ws(r,e){for(;r!==null;){var t=r===e?null:hn(r);r.remove(),r=t}}function _n(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function xs(r,e){var t=[];yn(r,t,!0),bs(t,()=>{ke(r),e&&e()})}function bs(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var s of r)s.out(n)}else e()}function yn(r,e,t){if((r.f&ct)===0){if(r.f^=ct,r.transitions!==null)for(const i of r.transitions)(i.is_global||t)&&e.push(i);for(var n=r.first;n!==null;){var s=n.next,a=(n.f&Qn)!==0||(n.f&ge)!==0;yn(n,e,a?t:!1),n=s}}}let ft=[];function Es(){var r=ft;ft=[],Gn(r)}function Cs(r){ft.length===0&&queueMicrotask(Es),ft.push(r)}function As(r){var e=T;if((e.f&en)===0){if((e.f&sr)===0)throw r;e.fn(r)}else kn(r,e)}function kn(r,e){for(;e!==null;){if((e.f&sr)!==0)try{e.fn(r);return}catch{}e=e.parent}throw r}let Pt=!1,ht=null,ye=!1,Fe=!1;function Or(r){Fe=r}let lt=[];let A=null,G=!1;function pe(r){A=r}let T=null;function Ne(r){T=r}let L=null;function Ms(r){A!==null&&A.f&Lt&&(L===null?L=[A,[r]]:L[1].push(r))}let P=null,z=0,$=null;function Ss(r){$=r}let wn=1,pt=0,ce=!1;function xn(){return++wn}function Ct(r){var h;var e=r.f;if((e&ie)!==0)return!0;if((e&we)!==0){var t=r.deps,n=(e&V)!==0;if(t!==null){var s,a,i=(e&dt)!==0,o=n&&T!==null&&!ce,l=t.length;if(i||o){var u=r,c=u.parent;for(s=0;s<l;s++)a=t[s],(i||!((h=a==null?void 0:a.reactions)!=null&&h.includes(u)))&&(a.reactions??(a.reactions=[])).push(u);i&&(u.f^=dt),o&&c!==null&&(c.f&V)===0&&(u.f^=V)}for(s=0;s<l;s++)if(a=t[s],Ct(a)&&on(a),a.wv>r.wv)return!0}(!n||T!==null&&!ce)&&ee(r,X)}return!1}function bn(r,e,t=!0){var n=r.reactions;if(n!==null)for(var s=0;s<n.length;s++){var a=n[s];L!=null&&L[1].includes(r)&&L[0]===A||((a.f&J)!==0?bn(a,e,!1):e===a&&(t?ee(a,ie):(a.f&X)!==0&&ee(a,we),dr(a)))}}function En(r){var _;var e=P,t=z,n=$,s=A,a=ce,i=L,o=W,l=G,u=r.f;P=null,z=0,$=null,ce=(u&V)!==0&&(G||!ye||A===null),A=(u&(ge|Pe))===0?r:null,L=null,Sr(r.ctx),G=!1,pt++,r.f|=Lt;try{var c=(0,r.fn)(),h=r.deps;if(P!==null){var m;if(mt(r,z),h!==null&&z>0)for(h.length=z+P.length,m=0;m<P.length;m++)h[z+m]=P[m];else r.deps=h=P;if(!ce)for(m=z;m<h.length;m++)((_=h[m]).reactions??(_.reactions=[])).push(r)}else h!==null&&z<h.length&&(mt(r,z),h.length=z);if(nn()&&$!==null&&!G&&h!==null&&(r.f&(J|we|ie))===0)for(m=0;m<$.length;m++)bn($[m],r);return s!==null&&s!==r&&(pt++,$!==null&&(n===null?n=$:n.push(...$))),c}catch(C){As(C)}finally{P=e,z=t,$=n,A=s,ce=a,L=i,Sr(o),G=l,r.f^=Lt}}function Ts(r,e){let t=e.reactions;if(t!==null){var n=qn.call(t,r);if(n!==-1){var s=t.length-1;s===0?t=e.reactions=null:(t[n]=t[s],t.pop())}}t===null&&(e.f&J)!==0&&(P===null||!P.includes(e))&&(ee(e,we),(e.f&(V|dt))===0&&(e.f^=dt),sn(e),mt(e,0))}function mt(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)Ts(r,t[n])}function ur(r){var e=r.f;if((e&ar)===0){ee(r,X);var t=T,n=ye;T=r,ye=!0;try{(e&nr)!==0?ks(r):gn(r),vn(r);var s=En(r);r.teardown=typeof s=="function"?s:null,r.wv=wn;var a;Ar&&os&&(r.f&ie)!==0&&r.deps}finally{ye=n,T=t}}}function Os(){try{ns()}catch(r){if(ht!==null)kn(r,ht);else throw r}}function Ns(){var r=ye;try{var e=0;for(ye=!0;lt.length>0;){e++>1e3&&Os();var t=lt,n=t.length;lt=[];for(var s=0;s<n;s++){var a=Rs(t[s]);Is(a)}He.clear()}}finally{Pt=!1,ye=r,ht=null}}function Is(r){var e=r.length;if(e!==0)for(var t=0;t<e;t++){var n=r[t];(n.f&(ar|ct))===0&&Ct(n)&&(ur(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?_n(n):n.fn=null))}}function dr(r){Pt||(Pt=!0,queueMicrotask(Ns));for(var e=ht=r;e.parent!==null;){e=e.parent;var t=e.f;if((t&(Pe|ge))!==0){if((t&X)===0)return;e.f^=X}}lt.push(e)}function Rs(r){for(var e=[],t=r;t!==null;){var n=t.f,s=(n&(ge|Pe))!==0,a=s&&(n&X)!==0;if(!a&&(n&ct)===0){(n&Kr)!==0?e.push(t):s?t.f^=X:Ct(t)&&ur(t);var i=t.first;if(i!==null){t=i;continue}}var o=t.parent;for(t=t.next;t===null&&o!==null;)t=o.next,o=o.parent}return e}function O(r){var e=r.f,t=(e&J)!==0;if(A!==null&&!G){if(!(L!=null&&L[1].includes(r))||L[0]!==A){var n=A.deps;r.rv<pt&&(r.rv=pt,P===null&&n!==null&&n[z]===r?z++:P===null?P=[r]:(!ce||!P.includes(r))&&P.push(r))}}else if(t&&r.deps===null&&r.effects===null){var s=r,a=s.parent;a!==null&&(a.f&V)===0&&(s.f^=V)}return t&&(s=r,Ct(s)&&on(s)),Fe&&He.has(r)?He.get(r):r.v}function Ls(r){var e=G;try{return G=!0,r()}finally{G=e}}const Ds=-7169;function ee(r,e){r.f=r.f&Ds|e}const Zs=["touchstart","touchmove"];function Ps(r){return Zs.includes(r)}const js=new Set,Nr=new Set;function it(r){var S;var e=this,t=e.ownerDocument,n=r.type,s=((S=r.composedPath)==null?void 0:S.call(r))||[],a=s[0]||r.target,i=0,o=r.__root;if(o){var l=s.indexOf(o);if(l!==-1&&(e===document||e===window)){r.__root=e;return}var u=s.indexOf(e);if(u===-1)return;l<=u&&(i=l)}if(a=s[i]||r.target,a!==e){Yn(r,"currentTarget",{configurable:!0,get(){return a||t}});var c=A,h=T;pe(null),Ne(null);try{for(var m,_=[];a!==null;){var C=a.assignedSlot||a.parentNode||a.host||null;try{var D=a["__"+n];if(D!=null&&(!a.disabled||r.target===a))if(Qr(D)){var[R,...te]=D;R.apply(a,[r,...te])}else D.call(a,r)}catch(H){m?_.push(H):m=H}if(r.cancelBubble||C===e||C===null)break;a=C}if(m){for(let H of _)queueMicrotask(()=>{throw H});throw m}}finally{r.__root=e,delete r.currentTarget,pe(c),Ne(h)}}}function Fs(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function zs(r,e){var t=T;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function Cn(r,e){var t,n=!r.startsWith("<!>");return()=>{t===void 0&&(t=Fs(n?r:"<!>"+r),t=fn(t));var s=un?document.importNode(t,!0):t.cloneNode(!0);return zs(s,s),s}}function An(r,e){r!==null&&r.before(e)}function cr(r,e){return Vs(r,e)}const be=new Map;function Vs(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){cs();var o=new Set,l=h=>{for(var m=0;m<h.length;m++){var _=h[m];if(!o.has(_)){o.add(_);var C=Ps(_);e.addEventListener(_,it,{passive:C});var D=be.get(_);D===void 0?(document.addEventListener(_,it,{passive:C}),be.set(_,1)):be.set(_,D+1)}}};l(Wn(js)),Nr.add(l);var u=void 0,c=gs(()=>{var h=t??e.appendChild(fs());return ys(()=>{if(a){ir({});var m=W;m.c=a}s&&(n.$$events=s),u=r(h,n)||{},a&&or()}),()=>{var C;for(var m of o){e.removeEventListener(m,it);var _=be.get(m);--_===0?(document.removeEventListener(m,it),be.delete(m)):be.set(m,_)}Nr.delete(l),h!==t&&((C=h.parentNode)==null||C.removeChild(h))}});return Us.set(u,c),u}let Us=new WeakMap;const Ir=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function Bs(r,e,t){var n=r==null?"":""+r;if(t){for(var s in t)if(t[s])n=n?n+" "+s:s;else if(n.length)for(var a=s.length,i=0;(i=n.indexOf(s,i))>=0;){var o=i+a;(i===0||Ir.includes(n[i-1]))&&(o===n.length||Ir.includes(n[o]))?n=(i===0?"":n.substring(0,i))+n.substring(o+1):i=o}}return n===""?null:n}function Rr(r,e=!1){var t=e?" !important;":";",n="";for(var s in r){var a=r[s];a!=null&&a!==""&&(n+=" "+s+": "+a+t)}return n}function $s(r,e){if(e){var t="",n,s;return Array.isArray(e)?(n=e[0],s=e[1]):n=e,n&&(t+=Rr(n)),s&&(t+=Rr(s,!0)),t=t.trim(),t===""?null:t}return String(r)}function Mn(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Bs(t,n,a);o==null?r.removeAttribute("class"):r.className=o,r.__className=t}else if(a&&s!==a)for(var l in a){var u=!!a[l];(s==null||u!==!!s[l])&&r.classList.toggle(l,u)}return a}function Ot(r,e={},t,n){for(var s in t){var a=t[s];e[s]!==a&&(t[s]==null?r.style.removeProperty(s):r.style.setProperty(s,a,n))}}function vt(r,e,t,n){var s=r.__style;if(s!==e){var a=$s(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(Ot(r,t==null?void 0:t[0],n[0]),Ot(r,t==null?void 0:t[1],n[1],"important")):Ot(r,t,n));return n}const qs=()=>performance.now(),Q={tick:r=>requestAnimationFrame(r),now:()=>qs(),tasks:new Set};function Sn(){const r=Q.now();Q.tasks.forEach(e=>{e.c(r)||(Q.tasks.delete(e),e.f())}),Q.tasks.size!==0&&Q.tick(Sn)}function Ws(r){let e;return Q.tasks.size===0&&Q.tick(Sn),{promise:new Promise(t=>{Q.tasks.add(e={c:r,f:t})}),abort(){Q.tasks.delete(e)}}}function Lr(r,e){return r===e||(r==null?void 0:r[ot])===e}function Ce(r={},e,t,n){return lr(()=>{var s,a;return pn(()=>{s=a,a=[],Ls(()=>{r!==t(...a)&&(e(r,...a),s&&Lr(t(...s),r)&&e(null,...s))})}),()=>{Cs(()=>{a&&Lr(t(...a),r)&&e(null,...a)})}}),r}const Ys="5";var Gr;typeof window<"u"&&((Gr=window.__svelte??(window.__svelte={})).v??(Gr.v=new Set)).add(Ys);function Xs(r){return r}function jt(r){return-.5*(Math.cos(Math.PI*r)-1)}function Hs(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function Js(r){return Math.sin(r*Math.PI/2)}const Gs=128,Qs=0,Ks=1,ea=2;class ta{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",Gs);f(this,"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 t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let s=0;s<n.length;s++){const a=n[s];if(a!=null){for(const i of a.values())if(!i.executed&&(i.executed=!0,i.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,s){let a=this.layers[e];a==null&&(a=this.layers[e]={animations:new Array});let i=a.animations[t];i==null&&(i=a.animations[t]=new Map);let o={id:n,priority:t,executed:!1,function:s};i.set(n,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let s=this.layers[n];if(s==null)continue;let a=s.animations[e];if(a==null)return;let i=a.get(t);if(i==null||i.executed==!1)return;a.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const de=new ta;function Dr(r){return Object.prototype.toString.call(r)==="[object Date]"}function Ft(r,e){if(r===e||r!==r)return()=>r;const t=typeof r;if(t!==typeof e||Array.isArray(r)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(r)){const n=e.map((s,a)=>Ft(r[a],s));return s=>n.map(a=>a(s))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(Dr(r)&&Dr(e)){const a=r.getTime(),o=e.getTime()-a;return l=>new Date(a+l*o)}const n=Object.keys(e),s={};return n.forEach(a=>{s[a]=Ft(r[a],e[a])}),a=>{const i={};return n.forEach(o=>{i[o]=s[o](a)}),i}}if(t==="number"){const n=e-r;return s=>r+s*n}return()=>e}var se,Oe,tt,_e;const mr=class mr{constructor(e,t={}){Ue(this,se);Ue(this,Oe);Ue(this,tt);Ue(this,_e,null);Be(this,se,Dt(e)),Be(this,Oe,Dt(e)),Be(this,tt,t)}static of(e,t){const n=new mr(e(),t);return pn(()=>{n.set(e())}),n}set(e,t){var h;Z(B(this,Oe),e);let{delay:n=0,duration:s=400,easing:a=Xs,interpolate:i=Ft}={...B(this,tt),...t};if(s===0)return(h=B(this,_e))==null||h.abort(),Z(B(this,se),e),Promise.resolve();const o=Q.now()+n;let l,u=!1,c=B(this,_e);return Be(this,_e,Ws(m=>{if(m<o)return!0;if(!u){u=!0;const C=B(this,se).v;l=i(C,e),typeof s=="function"&&(s=s(C,e)),c==null||c.abort()}const _=m-o;return _>s?(Z(B(this,se),e),!1):(Z(B(this,se),l(a(_/s))),!0)})),B(this,_e).promise}get current(){return O(B(this,se))}get target(){return O(B(this,Oe))}set target(e){this.set(e)}};se=new WeakMap,Oe=new WeakMap,tt=new WeakMap,_e=new WeakMap;let zt=mr;class ut{constructor(e,t){f(this,"value");f(this,"motion");this.value=e,this.motion=new zt(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var ra=Cn('<div><div class="body svelte-1nfn9j8"></div></div>');function na(r,e){ir(e,!0);let t,n;function s(){return n}let a=q(!1);function i(S){Z(a,S,!0)}function o(){return O(a)}let l=new ut(0,{easing:jt});ne(()=>{u(l.motion.current)}),ne(()=>{O(a)==!1&&(l.snap(),de.clear(e.priority,e.id))});function u(S){t&&de.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=S.toString(),t.style.filter=`brightness(${.25+.75*S})`,n.style.opacity=S.toString()})}function c(S){S!=l.value&&l.set(S,{duration:75})}function h(){return l.motion.current==0}function m(){return l.value}var _=ra();let C,D;var R=Zt(_);let te;return Ce(R,S=>n=S,()=>n),Ce(_,S=>t=S,()=>t),mn(S=>{C=Mn(_,1,"pin svelte-1nfn9j8",null,C,S),D=vt(_,"",D,{"border-radius":`${e.radius+4}px`}),te=vt(R,"",te,{width:`${e.width}px`,height:`${e.height}px`,"border-radius":`${e.radius}px`})},[()=>({displayed:O(a)})]),An(r,_),or({getBody:s,setDisplayed:i,getDisplayed:o,setScale:c,getCollapsed:h,getScale:m})}var gt;(r=>{function e(t,n,s){const a=t/2,i=n/2,o=Math.sqrt(a*a+i*i),l=Math.atan(i/a)*(180/Math.PI),u=s*(Math.PI/180);return s<180?s<90?s<l?{offsetX:0,offsetY:o*Math.sin(u)-i}:{offsetX:o*Math.cos(u)-a,offsetY:0}:s<180-l?{offsetX:o*Math.cos(u)-a,offsetY:0}:{offsetX:-t,offsetY:o*Math.sin(u)-i}:s<270?s<180+l?{offsetX:-t,offsetY:o*Math.sin(u)-i}:{offsetX:o*Math.cos(u)-a,offsetY:-n}:s<360-l?{offsetX:o*Math.cos(u)-a,offsetY:-n}:{offsetX:0,offsetY:o*Math.sin(u)-i}}r.getOffsets=e})(gt||(gt={}));var sa=Cn('<div><div class="pointer svelte-dho8xv"></div> <div class="bubble svelte-dho8xv"><div class="body svelte-dho8xv"></div></div></div>');function Tn(r,e){ir(e,!0);let t,n,s,a;const i=e.width+2*e.margin,o=e.height+2*e.margin,l=()=>a;ne(()=>{s.style.width=`${e.margin*4}px`,s.style.height=`${e.margin*4}px`});let u=q(!0);function c(M){Z(u,M,!0)}function h(){return O(u)}let m=q(!0);function _(M){Z(m,M,!0)}function C(){return R.motion.current==0}function D(){return O(m)==!1}let R=new ut(0);ne(()=>{te(R.motion.current)}),ne(()=>{O(u)==!1&&(R.snap(),de.clear(e.priority,e.id+"_scale"))}),ne(()=>{O(m)==!0&&R.value!=0&&(de.stacked()?R.set(0,{duration:0}):R.set(0,{duration:150,easing:Hs})),O(m)==!1&&R.value!=1&&R.set(1,{duration:150,easing:Js})});function te(M){!t||!n||!s||de.equeue(O(m)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${M}`,n.style.scale=`${M}`,s.style.scale=`${M}`})}let S=NaN,H=q(!1),le=new ut(-i/2,{easing:jt}),nt=new ut(-o/2,{easing:jt});ne(()=>{vr(le.motion.current,nt.motion.current)}),ne(()=>{O(u)==!1&&(le.snap(),le.snap(),de.clear(e.priority,e.id+"_angle"))}),ne(()=>{O(m)==!0&&O(H)&&(le.update({duration:75}),le.update({duration:75}))});function vr(M,re){if(!t||!n||!s)return;const at=M+i/2,ze=re+o/2,xe=o<i?at*o/i:at,Mt=o>i?ze*i/o:ze,jn=Math.atan2(Mt,xe)/Math.PI*180-45,xr=0,Fn=30,St=Math.sqrt(xe*xe+Mt*Mt),Ve=Math.min(i,o)/2,zn=Ve*Math.SQRT2,Vn=(St-Ve)/(zn-Ve),br=xr+Vn*(Fn-xr),Un=St<Ve?St/Ve:1;de.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(M)}px, ${Math.round(re)}px)`,s.style.transform=`scale(${Un}) rotate(${jn}deg) skew(${br}deg, ${br}deg)`})}function Pn(M){if(O(H)==!1){let re=gt.getOffsets(i,o,M);le.set(Math.round(re.offsetX),{duration:0}),nt.set(Math.round(re.offsetY),{duration:0}),vr(le.value,nt.value),S=M,Z(H,!0)}else if(M!=S){let re=Math.abs(M-S),at=re<180?re:360-re,ze=Math.log(at)*75,xe=gt.getOffsets(i,o,M);le.set(Math.round(xe.offsetX),{duration:ze}),nt.set(Math.round(xe.offsetY),{duration:ze}),S=M}}var st=sa();let gr;var _r=Zt(st);Ce(_r,M=>s=M,()=>s);var At=hs(_r,2);let yr;var kr=Zt(At);let wr;return Ce(kr,M=>a=M,()=>a),Ce(At,M=>n=M,()=>n),Ce(st,M=>t=M,()=>t),mn(M=>{gr=Mn(st,1,"anchor svelte-dho8xv",null,gr,M),yr=vt(At,"",yr,{padding:e.margin+"px"}),wr=vt(kr,"",wr,{width:`${e.width}px`,height:`${e.height}px`,"border-radius":e.radius+"px"})},[()=>({displayed:O(u)})]),An(r,st),or({getBody:l,setDisplayed:c,getDisplayed:h,setCollapsed:_,getCollapsed:C,getExpanded:D,setAngle:Pn})}var Ae;(r=>{function e(o,l,u){return{x:n(l)*u,y:s(o)*u}}r.project=e;function t(o,l,u){return{lat:i(l/u),lng:a(o/u)}}r.unproject=t;function n(o){return(180+o)/360}function s(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function a(o){return o*360-180}function i(o){return 360/Math.PI*Math.atan(Math.exp((180-o*360)*Math.PI/180))-90}})(Ae||(Ae={}));class On{constructor(e,t,n,s,a){f(this,"swLat");f(this,"swLng");f(this,"neLat");f(this,"neLng");f(this,"contains",(e,t)=>this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=t&&t<=this.neLng:t<=this.neLng||this.swLng<=t:!1);const i=n*Math.pow(2,t),o=Ae.project(e.sw.lat,e.sw.lng,i),l=Ae.project(e.ne.lat,e.ne.lng,i),u=o.x-s,c=o.y+a,h=l.x+s,m=l.y-a,_=Ae.unproject(u,c,i),C=Ae.unproject(h,m,i);this.swLat=_.lat,this.swLng=_.lng,this.neLat=C.lat,this.neLng=C.lng}}async function $e(r,e){try{await fetch("https://arenarium.dev/api/public/v1/log?log="+encodeURIComponent(JSON.stringify({title:r,content:e})))}catch(t){console.error(t)}}var E;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(E||(E={}));var Zr;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Zr||(Zr={}));const v=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ue=r=>{switch(typeof r){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(r)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(r)?v.array:r===null?v.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?v.promise:typeof Map<"u"&&r instanceof Map?v.map:typeof Set<"u"&&r instanceof Set?v.set:typeof Date<"u"&&r instanceof Date?v.date:v.object;default:return v.unknown}},d=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),n}static assert(e){if(!(e instanceof Y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Y.create=r=>new Y(r);const Je=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===v.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,E.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${E.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${E.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${E.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:E.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,E.assertNever(r)}return{message:t}};let aa=Je;function Vt(){return aa}const Ut=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function p(r,e){const t=Vt(),n=Ut({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Je?void 0:Je].filter(s=>!!s)});r.common.issues.push(n)}class U{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return U.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),We=r=>({status:"dirty",value:r}),j=r=>({status:"valid",value:r}),Pr=r=>r.status==="aborted",jr=r=>r.status==="dirty",Ie=r=>r.status==="valid",_t=r=>typeof Promise<"u"&&r instanceof Promise;var g;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(g||(g={}));class me{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Fr=(r,e)=>{if(Ie(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Y(r.common.issues);return this._error=t,this._error}}};function w(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return ue(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U,ctx:{common:e.parent.common,data:e.data,parsedType:ue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(_t(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ue(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Fr(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ue(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Ie(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Ie(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ue(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(_t(s)?s:Promise.resolve(s));return Fr(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new De({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return he.create(this,this._def)}nullable(){return Ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return K.create(this)}promise(){return Ke.create(this,this._def)}or(e){return kt.create([this,e],this._def)}and(e){return wt.create(this,e,this._def)}transform(e){return new De({...w(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Yt({...w(this._def),innerType:this,defaultValue:t,typeName:k.ZodDefault})}brand(){return new Sa({typeName:k.ZodBranded,type:this,...w(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Xt({...w(this._def),innerType:this,catchValue:t,typeName:k.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fr.create(this,e)}readonly(){return Ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ia=/^c[^\s-]{8,}$/i,oa=/^[0-9a-z]+$/,la=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ua=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,da=/^[a-z0-9_-]{21}$/i,ca=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ha=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Nt;const ma=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,va=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ga=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,_a=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ya=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ka=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wa=new RegExp(`^${Nn}$`);function In(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function xa(r){return new RegExp(`^${In(r)}$`)}function ba(r){let e=`${Nn}T${In(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ea(r,e){return!!((e==="v4"||!e)&&ma.test(r)||(e==="v6"||!e)&&ga.test(r))}function Ca(r,e){if(!ca.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Aa(r,e){return!!((e==="v4"||!e)&&va.test(r)||(e==="v6"||!e)&&_a.test(r))}class fe extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_type,expected:v.string,received:a.parsedType}),y}const n=new U;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?p(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&p(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ha.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Nt||(Nt=new RegExp(pa,"u")),Nt.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")ua.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")da.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ia.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")oa.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")la.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),p(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ba(a).test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?wa.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?xa(a).test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?fa.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ea(e.data,a.version)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Ca(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Aa(e.data,a.version)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ya.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?ka.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"base64url",code:d.invalid_string,message:a.message}),n.dirty()):E.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...g.errToObj(n)})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...g.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...g.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...g.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new fe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}fe.create=r=>new fe({checks:[],typeName:k.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...w(r)});function Ma(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class Re extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_type,expected:v.number,received:a.parsedType}),y}let n;const s=new U;for(const a of this._def.checks)a.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Ma(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_finite,message:a.message}),s.dirty()):E.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,s){return new Re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(s)}]})}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Re.create=r=>new Re({checks:[],typeName:k.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...w(r)});class Ge extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let n;const s=new U;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):E.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:v.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,s){return new Ge({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(s)}]})}_addCheck(e){return new Ge({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ge.create=r=>new Ge({checks:[],typeName:k.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...w(r)});class Bt extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:v.boolean,received:n.parsedType}),y}return j(e.data)}}Bt.create=r=>new Bt({typeName:k.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...w(r)});class yt extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_type,expected:v.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_date}),y}const n=new U;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):E.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new yt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}yt.create=r=>new yt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:k.ZodDate,...w(r)});class zr extends b{_parse(e){if(this._getType(e)!==v.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:v.symbol,received:n.parsedType}),y}return j(e.data)}}zr.create=r=>new zr({typeName:k.ZodSymbol,...w(r)});class Vr extends b{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:v.undefined,received:n.parsedType}),y}return j(e.data)}}Vr.create=r=>new Vr({typeName:k.ZodUndefined,...w(r)});class Ur extends b{_parse(e){if(this._getType(e)!==v.null){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:v.null,received:n.parsedType}),y}return j(e.data)}}Ur.create=r=>new Ur({typeName:k.ZodNull,...w(r)});class $t extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}$t.create=r=>new $t({typeName:k.ZodAny,...w(r)});class Te extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}Te.create=r=>new Te({typeName:k.ZodUnknown,...w(r)});class ve extends b{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:v.never,received:t.parsedType}),y}}ve.create=r=>new ve({typeName:k.ZodNever,...w(r)});class qt extends b{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:v.void,received:n.parsedType}),y}return j(e.data)}}qt.create=r=>new qt({typeName:k.ZodVoid,...w(r)});class K extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==v.array)return p(t,{code:d.invalid_type,expected:v.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(p(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(p(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(p(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new me(t,i,t.path,o)))).then(i=>U.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new me(t,i,t.path,o)));return U.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new K({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new K({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new K({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}K.create=(r,e)=>new K({type:r,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...w(e)});function Ee(r){if(r instanceof N){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=he.create(Ee(n))}return new N({...r._def,shape:()=>e})}else return r instanceof K?new K({...r._def,type:Ee(r.element)}):r instanceof he?he.create(Ee(r.unwrap())):r instanceof Ze?Ze.create(Ee(r.unwrap())):r instanceof oe?oe.create(r.items.map(e=>Ee(e))):r}class N extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=E.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==v.object){const u=this._getOrReturnCtx(e);return p(u,{code:d.invalid_type,expected:v.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ve&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const c=a[u],h=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new me(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof ve){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of o)l.push({key:{status:"valid",value:c},value:{status:"valid",value:s.data[c]}});else if(u==="strict")o.length>0&&(p(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of o){const h=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new me(s,h,s.path,c)),alwaysSet:c in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const h=await c.key,m=await c.value;u.push({key:h,value:m,alwaysSet:c.alwaysSet})}return u}).then(u=>U.mergeObjectSync(n,u)):U.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:g.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new N({...this._def,catchall:e})}pick(e){const t={};for(const n of E.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new N({...this._def,shape:()=>t})}omit(e){const t={};for(const n of E.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new N({...this._def,shape:()=>t})}deepPartial(){return Ee(this)}partial(e){const t={};for(const n of E.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new N({...this._def,shape:()=>t})}required(e){const t={};for(const n of E.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof he;)a=a._def.innerType;t[n]=a}return new N({...this._def,shape:()=>t})}keyof(){return Rn(E.objectKeys(this.shape))}}N.create=(r,e)=>new N({shape:()=>r,unknownKeys:"strip",catchall:ve.create(),typeName:k.ZodObject,...w(e)});N.strictCreate=(r,e)=>new N({shape:()=>r,unknownKeys:"strict",catchall:ve.create(),typeName:k.ZodObject,...w(e)});N.lazycreate=(r,e)=>new N({shape:r,unknownKeys:"strip",catchall:ve.create(),typeName:k.ZodObject,...w(e)});class kt extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Y(o.ctx.common.issues));return p(t,{code:d.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},c=l._parseSync({data:t.data,path:t.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(l=>new Y(l));return p(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}kt.create=(r,e)=>new kt({options:r,typeName:k.ZodUnion,...w(e)});function Wt(r,e){const t=ue(r),n=ue(e);if(r===e)return{valid:!0,data:r};if(t===v.object&&n===v.object){const s=E.objectKeys(e),a=E.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=Wt(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===v.array&&n===v.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],l=Wt(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===v.date&&n===v.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class wt extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Pr(a)||Pr(i))return y;const o=Wt(a.value,i.value);return o.valid?((jr(a)||jr(i))&&t.dirty(),{status:t.value,value:o.data}):(p(n,{code:d.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}wt.create=(r,e,t)=>new wt({left:r,right:e,typeName:k.ZodIntersection,...w(t)});class oe extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.array)return p(n,{code:d.invalid_type,expected:v.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return p(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new me(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>U.mergeArray(t,i)):U.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new oe({...this._def,rest:e})}}oe.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oe({items:r,typeName:k.ZodTuple,rest:null,...w(e)})};class Br extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.map)return p(n,{code:d.invalid_type,expected:v.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new me(n,o,n.path,[u,"key"])),value:a._parse(new me(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return y;(u.status==="dirty"||c.status==="dirty")&&t.dirty(),o.set(u.value,c.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return y;(u.status==="dirty"||c.status==="dirty")&&t.dirty(),o.set(u.value,c.value)}return{status:t.value,value:o}}}}Br.create=(r,e,t)=>new Br({valueType:e,keyType:r,typeName:k.ZodMap,...w(t)});class Qe extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.set)return p(n,{code:d.invalid_type,expected:v.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(p(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(p(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const c of l){if(c.status==="aborted")return y;c.status==="dirty"&&t.dirty(),u.add(c.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new me(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new Qe({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new Qe({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Qe.create=(r,e)=>new Qe({valueType:r,minSize:null,maxSize:null,typeName:k.ZodSet,...w(e)});class Xe extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.function)return p(t,{code:d.invalid_type,expected:v.function,received:t.parsedType}),y;function n(o,l){return Ut({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Vt(),Je].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:l}})}function s(o,l){return Ut({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Vt(),Je].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ke){const o=this;return j(async function(...l){const u=new Y([]),c=await o._def.args.parseAsync(l,a).catch(_=>{throw u.addIssue(n(l,_)),u}),h=await Reflect.apply(i,this,c);return await o._def.returns._def.type.parseAsync(h,a).catch(_=>{throw u.addIssue(s(h,_)),u})})}else{const o=this;return j(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new Y([n(l,u.error)]);const c=Reflect.apply(i,this,u.data),h=o._def.returns.safeParse(c,a);if(!h.success)throw new Y([s(c,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xe({...this._def,args:oe.create(e).rest(Te.create())})}returns(e){return new Xe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Xe({args:e||oe.create([]).rest(Te.create()),returns:t||Te.create(),typeName:k.ZodFunction,...w(n)})}}class $r extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}$r.create=(r,e)=>new $r({getter:r,typeName:k.ZodLazy,...w(e)});class qr extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}qr.create=(r,e)=>new qr({value:r,typeName:k.ZodLiteral,...w(e)});function Rn(r,e){return new Le({values:r,typeName:k.ZodEnum,...w(e)})}class Le extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:E.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Le.create(e,{...this._def,...t})}exclude(e,t=this._def){return Le.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}Le.create=Rn;class Wr extends b{_parse(e){const t=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){const s=E.objectValues(t);return p(n,{expected:E.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(E.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=E.objectValues(t);return p(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return j(e.data)}get enum(){return this._def.values}}Wr.create=(r,e)=>new Wr({values:r,typeName:k.ZodNativeEnum,...w(e)});class Ke extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.promise&&t.common.async===!1)return p(t,{code:d.invalid_type,expected:v.promise,received:t.parsedType}),y;const n=t.parsedType===v.promise?t.data:Promise.resolve(t.data);return j(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ke.create=(r,e)=>new Ke({type:r,typeName:k.ZodPromise,...w(e)});class De extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{p(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?We(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?We(o.value):o}}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ie(i))return y;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ie(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);E.assertNever(s)}}De.create=(r,e,t)=>new De({schema:r,typeName:k.ZodEffects,effect:e,...w(t)});De.createWithPreprocess=(r,e,t)=>new De({schema:e,effect:{type:"preprocess",transform:r},typeName:k.ZodEffects,...w(t)});class he extends b{_parse(e){return this._getType(e)===v.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(r,e)=>new he({innerType:r,typeName:k.ZodOptional,...w(e)});class Ze extends b{_parse(e){return this._getType(e)===v.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:k.ZodNullable,...w(e)});class Yt extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===v.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Yt.create=(r,e)=>new Yt({innerType:r,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...w(e)});class Xt extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return _t(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Y(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Xt.create=(r,e)=>new Xt({innerType:r,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...w(e)});class Yr extends b{_parse(e){if(this._getType(e)!==v.nan){const n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:v.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Yr.create=r=>new Yr({typeName:k.ZodNaN,...w(r)});class Sa extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class fr extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),We(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new fr({in:e,out:t,typeName:k.ZodPipeline})}}class Ht extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(Ie(s)&&(s.value=Object.freeze(s.value)),s);return _t(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ht.create=(r,e)=>new Ht({innerType:r,typeName:k.ZodReadonly,...w(e)});var k;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(k||(k={}));const rt=fe.create,x=Re.create,Ln=Bt.create,Dn=$t.create;Te.create;ve.create;const It=qt.create,hr=K.create,I=N.create;kt.create;wt.create;const Xr=oe.create,ae=Xe.create;Le.create;const Ta=Ke.create;he.create;Ze.create;I({pin:I({fade:Ln().optional(),maxCount:x().optional(),maxZoom:x().optional()}).optional(),animation:I({queue:I({limit:x().optional()}).optional()}).optional(),states:I({api:rt().optional()}).optional()});const Jt=x().min(-90).max(90),Gt=x().min(-180).max(180),Oa=I({sw:I({lat:Jt,lng:Gt}),ne:I({lat:Jt,lng:Gt})}),Qt=Dn().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),Zn=I({mapSize:x(),zoomMin:x(),zoomMax:x(),zoomScale:x()}),Na=I({instance:Dn(),inserted:ae().returns(Ln()),insert:ae().returns(It()),remove:ae().returns(It()),update:ae().args(x()).returns(It())}),Ia=I({parameters:Zn,getContainer:ae().args().returns(Qt),getZoom:ae().args().returns(x()),getBounds:ae().args().returns(Oa),createMarker:ae().args(Qt,Jt,Gt,x()).returns(Na)}),Rt=ae().args(rt()).returns(Ta(Qt)),Ra=I({id:rt().min(1),rank:x(),lat:x().min(-90).max(90),lng:x().min(-180).max(180),tooltip:I({style:I({width:x(),height:x(),margin:x(),radius:x()}).refine(r=>Math.min(r.width,r.height)/r.margin>=4,"Tooltip width and height must be at least 4 times the margin"),body:Rt}),pin:I({style:I({width:x(),height:x(),radius:x()}),body:Rt}).optional(),popup:I({style:I({width:x(),height:x(),radius:x(),margin:x()}),body:Rt}).optional()}),La=hr(Ra);Xr([x(),hr(Xr([x(),x()]))]);const Da=I({id:rt(),rank:x(),lat:x(),lng:x(),width:x(),height:x(),margin:x()});I({key:rt(),parameters:Zn,input:hr(Da)});var et;(r=>{r.COUNT=12,r.DEFAULT=270,r.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(et||(et={}));const Hr="https://arenarium.dev/api/public/v1/tooltip/states";class Za{constructor(e,t,n){f(this,"key");f(this,"provider");f(this,"apiUrl",Hr);f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");Ia.parse(t),this.key=e,this.provider=t,this.markerPinProcessor=new er(t),this.markerTooltipProcessor=new Pa(t),this.markerPopupProcessor=new ja(t),this.configuration=n}set configuration(e){var t,n,s;this.apiUrl=((t=e==null?void 0:e.states)==null?void 0:t.api)??Hr,this.markerPinProcessor.setConfiguration(e),de.setLimit(((s=(n=e==null?void 0:e.animation)==null?void 0:n.queue)==null?void 0:s.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(e){try{await La.parseAsync(e);const t={key:this.key,parameters:this.provider.parameters,input:e.map(a=>({id:a.id,rank:a.rank,lat:a.lat,lng:a.lng,width:a.tooltip.style.width,height:a.tooltip.style.height,margin:a.tooltip.style.margin}))},n=await fetch(this.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok||!n.body)throw new Error("Failed to get marker states");const s=await n.json();this.updateMarkerData(e,s),this.processMarkerDataCallback()}catch(t){throw console.error(t),$e("[Error] Failed to update markers",{message:t.message,stack:t.stack}),t}}removeMarkers(){try{this.removeMarkerData()}catch(e){throw console.error(e),$e("[Error] Failed to remove markers",{message:e.message,stack:e.stack}),e}}showPopup(e){try{for(const t of this.markerDataArray)t.marker.id==e?this.markerPopupProcessor.show(t):this.markerPopupProcessor.hide(t)}catch(t){console.error(t),$e("[Error] Failed to show popup",{message:t.message,stack:t.stack});for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t}}hidePopup(e){try{if(e){const t=this.markerDataMap.get(e);if(t==null)return;this.markerPopupProcessor.hide(t)}else for(const t of this.markerDataArray)this.markerPopupProcessor.hide(t)}catch(t){console.error(t),$e("[Error] Failed to hide popup",{message:t.message,stack:t.stack});for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t}}updateMarkerData(e,t){try{this.markerDataUpdating=!0;const n=new Map(e.map((a,i)=>[a.id,new Jr(this.provider,a,t[i])])),s=Array.from(this.markerDataArray);for(const a of s)n.has(a.marker.id)==!1&&(a.remove(),this.markerDataMap.delete(a.marker.id),this.markerDataArray.splice(this.markerDataArray.indexOf(a),1));for(let a=0;a<e.length;a++){const i=e[a],o=t[a],l=this.markerDataMap.get(i.id);if(l)l.update(o);else{const u=new Jr(this.provider,i,o);u.create(),this.markerDataMap.set(i.id,u),this.markerDataArray.push(u)}}this.markerDataArray.sort((a,i)=>a.zoom-i.zoom),this.markerPinProcessor.setElements(this.markerDataArray.map(a=>a.pin)),this.markerTooltipProcessor.setElements(this.markerDataArray.map(a=>a.tooltip))}catch(n){throw console.error(n),this.markerDataArray.forEach(s=>s.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),n}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerDataArray.forEach(e=>e.remove()),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(e){throw console.error(e),e}finally{this.markerDataUpdating=!1}}processMarkerDataCallback(){if(this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(e){console.error(e),$e("[Error] Failed to process markers",{message:e.message,stack:e.stack})}}processMarkerData(){if(this.markerDataUpdating)return;const e=this.provider.getBounds(),t=this.provider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}}class Jr{constructor(e,t,n){f(this,"marker");f(this,"zoom");f(this,"pin");f(this,"tooltip");this.marker=t,this.zoom=n[0],this.pin=new Kt(e,t,n),this.tooltip=new tr(e,t,n)}create(){this.pin.create(),this.tooltip.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){this.pin.remove(),this.tooltip.remove()}}class pr{constructor(e,t){f(this,"provider");f(this,"id");f(this,"lat");f(this,"lng");f(this,"shown");f(this,"element");f(this,"component");f(this,"marker");this.provider=e,this.id=t.id,this.lat=t.lat,this.lng=t.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 t=this.marker,n=this.component;if(t==null||n==null)throw new Error("Failed to update provider marker map");e?t.inserted()==!1&&t.insert():t.inserted()==!0&&t.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){var e,t;(e=this.marker)==null||e.remove(),(t=this.element)==null||t.remove()}}const Me=class Me extends pr{constructor(t,n,s){var a,i,o,l;super(t,n);f(this,"width");f(this,"height");f(this,"radius");f(this,"zoom");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(this,"bodyCallback");this.width=((a=n.pin)==null?void 0:a.style.width)??Me.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Me.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Me.DEFAULT_SIZE/2,this.zoom=s[0],this.bodyCallback=(l=n.pin)==null?void 0:l.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=cr(na,{target:this.element,props:{id:this.id+"_pin",layer:ea,priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,radius:this.radius}})}update(t){this.zoom=t[0],this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update pin state");this.component.setScale(this.getScale(t))}updateBody(){var n;if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{t.appendChild(s),this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(t){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setScale(t?0:1)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};f(Me,"DEFAULT_SIZE",14);let Kt=Me;const Se=class Se{constructor(e){f(this,"provider");f(this,"pinElements",new Array);f(this,"pinMaxWidth",0);f(this,"pinMaxHeight",0);f(this,"pinFade",!1);f(this,"pinMaxCount",0);f(this,"pinMaxZoomDelta",0);this.provider=e}setConfiguration(e){var t,n,s;this.pinFade=((t=e==null?void 0:e.pin)==null?void 0:t.fade)??!0,this.pinMaxCount=((n=e==null?void 0:e.pin)==null?void 0:n.maxCount)??Math.max(Se.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Se.MAP_PINS_MAX_ZOOM}setElements(e){this.pinElements=e,this.pinMaxWidth=e.reduce((t,n)=>Math.max(t,n.width),0),this.pinMaxHeight=e.reduce((t,n)=>Math.max(t,n.height),0)}process(e,t){const n=this.provider.parameters.mapSize,s=new On(e,t,n,this.pinMaxWidth*2,this.pinMaxHeight*2);let a=0;for(const i of this.pinElements)s.contains(i.lat,i.lng)?i.shown&&t<=i.zoom&&i.zoom<=t+this.pinMaxZoomDelta?(a<this.pinMaxCount&&(this.pinFade==!0?i.updateState(t):i.setCollapsed(!1),i.updateMap(!0),i.isBodyLoaded()==!1&&i.updateBody()),a++):(i.setCollapsed(!0),i.isCollapsed()&&i.updateMap(!1)):i.updateMap(!1)}};f(Se,"MAP_PINS_MAX_ZOOM",2),f(Se,"MAP_PINS_MAX_COUNT",128);let er=Se;const xt=class xt extends pr{constructor(t,n,s){super(t,n);f(this,"width");f(this,"height");f(this,"margin");f(this,"radius");f(this,"zoom");f(this,"states");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(this,"bodyCallback");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=s[0],this.states=s[1].map(a=>[a[0],et.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=cr(Tn,{target:this.element,props:{id:this.id+"_tooltip",layer:Ks,priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}update(t){this.zoom=t[0],this.states=t[1].map(n=>[n[0],et.DEGREES[n[1]]]),this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update tooltip state");this.component.setAngle(this.getAngle(t))}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{t.appendChild(s),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(t){const n=this.states.findLast(s=>s[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)+xt.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(xt,"Z_INDEX_OFFSET",1e6);let tr=xt;class Pa{constructor(e){f(this,"provider");f(this,"tooltipElements",new Array);f(this,"tooltipMaxWidth",0);f(this,"tooltipMaxHeight",0);this.provider=e}setElements(e){this.tooltipElements=e,this.tooltipMaxWidth=this.tooltipElements.reduce((t,n)=>Math.max(t,n.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((t,n)=>Math.max(t,n.height),0)}process(e,t){const n=this.provider.parameters.mapSize,s=new On(e,t,n,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const a of this.tooltipElements)s.contains(a.lat,a.lng)?a.shown&&a.zoom<=t?(a.updateState(t),a.setCollapsed(!1),a.updateMap(!0),a.isExpanded()&&a.isBodyLoaded()==!1&&a.updateBody()):(a.setCollapsed(!0),a.isCollapsed()&&a.updateMap(!1)):a.updateMap(!1)}}const bt=class bt extends pr{constructor(t,n){if(n.popup==null)throw new Error("Failed to create popup");super(t,n);f(this,"width");f(this,"height");f(this,"margin");f(this,"radius");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(this,"bodyCallback");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=cr(Tn,{target:this.element,props:{id:this.id+"_popup",layer:Qs,priority:0,width:this.width,height:this.height,margin:this.margin,radius:this.radius}}),this.component.setAngle(et.DEFAULT)}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{t.appendChild(s),this.bodyLoading=!1,this.bodyLoaded=!0}))}getZindex(){return bt.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(bt,"Z_INDEX_OFFSET",2e6);let rr=bt;class ja{constructor(e){f(this,"provider");f(this,"popupElements",new Map);this.provider=e}show(e){e.pin.shown=!1,e.tooltip.shown=!1;const t=new rr(this.provider,e.marker);this.popupElements.set(e.marker.id,t),t.create(),t.shown=!0}hide(e){e.pin.shown=!0,e.tooltip.shown=!0;const t=this.popupElements.get(e.marker.id);t!=null&&(t.shown=!1)}process(){for(const e of this.popupElements.values())e.shown?(e.setCollapsed(!1),e.updateMap(!0),e.isExpanded()&&e.isBodyLoaded()==!1&&e.updateBody()):(e.setCollapsed(!0),e.isCollapsed()&&(e.updateMap(!1),e.remove(),this.popupElements.delete(e.id)))}}exports.MapManager=Za;
|