mates 0.4.0-beta.13 → 0.4.0-beta.14

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/dist/index.js CHANGED
@@ -96,7 +96,7 @@ ${s}</pre
96
96
  >
97
97
  </details>`:null}
98
98
  </div>
99
- `;i.__isErrorView__=!0,i.skipDevToolsRender=!0,this.view=i,this.name=e,this._errorState=t}}Ve()&&window.addEventListener("mates:component-hot-update",t=>{const e=new Set(t.detail??[]);0!==e.size&&document.querySelectorAll("x-view").forEach(t=>{if(!(t instanceof Ye))return;const n=function(t){if(!Ve())return null;const e=t?.__mates_hmr_id;return"string"==typeof e?e:null}(t.view);n&&e.has(n)&&t._hotRefresh()})}),customElements.get("x-view")||customElements.define("x-view",Ye);class qe extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,n=e.detail?.context.id;n&&null!=this.id&&n===this.id&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}set context(t){this.id=t.id}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}function Xe(t){let e=-1===t.indexOf("\0")?t:t.replace(/\0/g,"");const n=function(t){const e=t.indexOf("{"),n=t.indexOf("}");return-1===e&&-1===n?-1:-1===e?n:-1===n?e:Math.min(e,n)}(e);return-1!==n&&(e=e.slice(0,n)),/url\s*\(/i.test(e)&&(e=e.replace(/\burl\s*\(\s*(['"]?)\s*(?:javascript:|vbscript:|data:text\/html[,;])/gi,"url($1")),e}function Ze(t){return t.length>0&&/^[a-zA-Z-]+$/.test(t)}customElements.get("x-provider")||customElements.define("x-provider",qe);let Ge=0;function Ke(){return`_m${(Ge++).toString(36)}`}const Qe=Object.create(null),Je={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function tn(t){const e=Qe[t];if(void 0!==e)return e;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return Qe[t]=n,n}function en(t,e,n){if(!n)return`.${t} {\n${e}}`;if(n.startsWith("&")){return`.${t}${n.slice(1)} {\n${e}}`}return`${n} {\n .${t} {\n${e.replace(/^ {2}/gm," ")} }\n}`}function nn(t){return t.startsWith("&")||t.startsWith("@media")?t:Object.prototype.hasOwnProperty.call(Je,t)?`@media (min-width: ${Je[t]})`:null}function sn(t,e,n){const s=Object.create(null);for(const i in t){const o=t[i];let r="",a=null;for(const t in o){const e=o[t];if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const n=nn(t);if(null===n)throw new Error(`[css-in-js] Unknown nested key "${t}" in block "${i}". Use "&:pseudo", "@media (...)", or a configured breakpoint key.`);let s="";const o=e;for(const t in o){const e=o[t];null!=e&&(Ze(t)?s+=` ${tn(t)}: ${Xe(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`))}s.length>0&&(null===a&&(a=[]),a.push([s,n]));continue}Ze(t)?r+=` ${tn(t)}: ${Xe(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`)}}if(0===r.length&&null===a){s[i]="";continue}const l=n?.literal?i:`${i}${Ke()}`;if(r.length>0&&e.push(en(l,r,"")),null!==a)for(let t=0;t<a.length;t++)e.push(en(l,a[t][0],a[t][1]));s[i]=l}return s}function on(t){return Object.freeze(t)}var rn,an,ln,cn,hn,un,dn,fn;function pn(t){if(te.templateInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a template function.`);if(te.viewOuterInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a component outer function. Move it outside the component function.`);if(te.setupInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a setup function.`)}let mn=0;function _n(t){return`${t}_kf${(mn++).toString(36)}`}function gn(t,e){let n="";for(const t in e){const s=e[t];let i="";for(const t in s){const e=s[t];if(null==e)continue;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);i+=` ${n}: ${String(e)};\n`}i&&(n+=` ${t} {\n${i} }\n`)}return`@keyframes ${t} {\n${n}}`}const yn=new Set;class wn{constructor(){rn.add(this),an.set(this,""),ln.set(this,0),cn.set(this,null),hn.set(this,[]),yn.add(this)}keyframes(t,e){const n=_n(t);return this.appendRules(gn(n,e)),n}appendRules(t){""!==t&&(ce(this,hn,"f").push(t),ce(this,ln,"f")>0&&ce(this,rn,"m",un).call(this))}mount(){var t;he(this,ln,(t=ce(this,ln,"f"),++t),"f"),1===ce(this,ln,"f")&&(ce(this,rn,"m",un).call(this),ce(this,cn,"f")||ce(this,rn,"m",dn).call(this))}unmount(){var t;ce(this,ln,"f")<=0||(he(this,ln,(t=ce(this,ln,"f"),--t),"f"),0===ce(this,ln,"f")&&ce(this,rn,"m",fn).call(this))}get refCount(){return ce(this,ln,"f")}get cssText(){return ce(this,an,"f")}get isMounted(){return ce(this,ln,"f")>0}get sheet(){return ce(this,cn,"f")}getAllCSS(){const t=[];return ce(this,an,"f")&&t.push(ce(this,an,"f")),ce(this,hn,"f").length>0&&t.push(ce(this,hn,"f").join("\n")),t.join("\n")}}an=new WeakMap,ln=new WeakMap,cn=new WeakMap,hn=new WeakMap,rn=new WeakSet,un=function(){if(0===ce(this,hn,"f").length)return;const t=ce(this,hn,"f").join("\n");he(this,hn,[],"f"),he(this,an,ce(this,an,"f")+(ce(this,an,"f")?"\n":"")+t,"f"),ce(this,rn,"m",dn).call(this)},dn=function(){ce(this,cn,"f")||(he(this,cn,new CSSStyleSheet,"f"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,ce(this,cn,"f")]),ce(this,cn,"f").replaceSync(ce(this,an,"f"))},fn=function(){ce(this,cn,"f")&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==ce(this,cn,"f")),he(this,cn,null,"f")),ce(this,an,"f")&&(ce(this,hn,"f").unshift(ce(this,an,"f")),he(this,an,"","f"))};let vn=null,bn=!1;function Sn(){return vn||(vn=new wn),vn}function xn(){vn||(vn=new wn),bn||(bn=!0,queueMicrotask(()=>{bn=!1,vn.mount()}))}function Cn(t,e){if(pn("globalCSS"),Ce())return{};xn();const n=[],s=sn(t,n,e);return n.length>0&&vn.appendRules(n.join("\n")),on(s)}function En(t){pn("globalRawCSS"),xn(),vn.appendRules(t)}let An=!1;function kn(){An||(An=!0,En('\n[class*="mates-"] {\n --mates-duration : 300ms;\n --mates-easing : ease;\n --mates-distance : 24px;\n animation-duration : var(--mates-duration);\n animation-timing-function : var(--mates-easing);\n animation-fill-mode : both;\n}\n'),En("\n@keyframes mates-kf-fade-in { from { opacity: 0 } to { opacity: 1 } }\n@keyframes mates-kf-fade-out { from { opacity: 1 } to { opacity: 0 } }\n\n@keyframes mates-kf-slide-in-up {\n from { opacity: 0; transform: translateY(var(--mates-distance)) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-up {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-down {\n from { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-down {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(var(--mates-distance)) }\n}\n@keyframes mates-kf-slide-in-left {\n from { opacity: 0; transform: translateX(var(--mates-distance)) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-left {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-right {\n from { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-right {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(var(--mates-distance)) }\n}\n\n@keyframes mates-kf-scale-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n@keyframes mates-kf-scale-out {\n from { opacity: 1; transform: scale(1) }\n to { opacity: 0; transform: scale(0.92) }\n}\n\n@keyframes mates-kf-spring-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n\n@keyframes mates-kf-flip-in-x {\n from { opacity: 0; transform: rotateX(90deg) }\n to { opacity: 1; transform: rotateX(0deg) }\n}\n@keyframes mates-kf-flip-in-y {\n from { opacity: 0; transform: rotateY(90deg) }\n to { opacity: 1; transform: rotateY(0deg) }\n}\n\n@keyframes mates-kf-blur-in {\n from { opacity: 0; filter: blur(10px) }\n to { opacity: 1; filter: blur(0) }\n}\n@keyframes mates-kf-blur-out {\n from { opacity: 1; filter: blur(0) }\n to { opacity: 0; filter: blur(10px) }\n}\n\n@keyframes mates-kf-shake {\n 0%, 100% { transform: translateX(0) }\n 15% { transform: translateX(calc(-1 * var(--mates-distance))) }\n 30% { transform: translateX(calc( 1 * var(--mates-distance))) }\n 45% { transform: translateX(calc(-0.6 * var(--mates-distance))) }\n 60% { transform: translateX(calc( 0.6 * var(--mates-distance))) }\n 75% { transform: translateX(calc(-0.3 * var(--mates-distance))) }\n 90% { transform: translateX(calc( 0.3 * var(--mates-distance))) }\n}\n\n@keyframes mates-kf-pulse {\n 0%, 100% { transform: scale(1) }\n 50% { transform: scale(1.08) }\n}\n\n@keyframes mates-kf-bounce {\n 0% { transform: translateY(0) }\n 20% { transform: translateY(calc(-0.40 * var(--mates-distance))) }\n 40% { transform: translateY(0) }\n 60% { transform: translateY(calc(-0.20 * var(--mates-distance))) }\n 80% { transform: translateY(0) }\n 90% { transform: translateY(calc(-0.08 * var(--mates-distance))) }\n 100% { transform: translateY(0) }\n}\n\n@keyframes mates-kf-spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n}\n"),Cn({"mates-fade-in":{animationName:"mates-kf-fade-in"},"mates-fade-out":{animationName:"mates-kf-fade-out"},"mates-slide-in-up":{animationName:"mates-kf-slide-in-up"},"mates-slide-out-up":{animationName:"mates-kf-slide-out-up"},"mates-slide-in-down":{animationName:"mates-kf-slide-in-down"},"mates-slide-out-down":{animationName:"mates-kf-slide-out-down"},"mates-slide-in-left":{animationName:"mates-kf-slide-in-left"},"mates-slide-out-left":{animationName:"mates-kf-slide-out-left"},"mates-slide-in-right":{animationName:"mates-kf-slide-in-right"},"mates-slide-out-right":{animationName:"mates-kf-slide-out-right"},"mates-scale-in":{animationName:"mates-kf-scale-in"},"mates-scale-out":{animationName:"mates-kf-scale-out"},"mates-spring-in":{animationName:"mates-kf-spring-in","--mates-easing":"cubic-bezier(0.34, 1.56, 0.64, 1)"},"mates-flip-in-x":{animationName:"mates-kf-flip-in-x"},"mates-flip-in-y":{animationName:"mates-kf-flip-in-y"},"mates-blur-in":{animationName:"mates-kf-blur-in"},"mates-blur-out":{animationName:"mates-kf-blur-out"},"mates-shake":{animationName:"mates-kf-shake","--mates-duration":"500ms","--mates-easing":"ease-in-out"},"mates-pulse":{animationName:"mates-kf-pulse","--mates-duration":"600ms","--mates-easing":"ease-in-out"},"mates-bounce":{animationName:"mates-kf-bounce","--mates-duration":"700ms"},"mates-spin":{animationName:"mates-kf-spin","--mates-easing":"linear"}},{literal:!0}))}function Mn(t=300,e="ease"){return{keyframes:[{opacity:0},{opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function Rn(t=300,e="ease"){return{keyframes:[{opacity:1},{opacity:0}],options:{duration:t,easing:e,fill:"both"}}}kn();const Tn={up:"translateY(-100%)",down:"translateY(100%)",left:"translateX(-100%)",right:"translateX(100%)"};function $n(t,e){switch(t){case"up":return`translateY(-${e})`;case"down":return`translateY(${e})`;case"left":return`translateX(-${e})`;case"right":return`translateX(${e})`}}function On(t){if(null==t||"object"!=typeof t)return t;try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||On(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function In(t,e,n){const s=Kt();let i;qt();try{i=t()}finally{Xt();Qt(s).forEach(t=>{"function"==typeof t.__subscribe&&e(t,n)})}return i}function Pn(t,e){if(ee(t),"AsyncFunction"===e.constructor.name)throw new Error(`${t.toLowerCase()}() does not support async functions.`);if(Ht())throw new Error(`${t.toLowerCase()}() cannot be nested inside an effect() or memo().`)}function zn(t){const{name:e,fn:n,onRun:s,supportsCleanup:i}=t;Pn(e,n);const o=new Set;let r,a=!1;const l=()=>{if(i&&r){try{r()}catch(t){console.error("Error in effect cleanup:",t)}r=void 0}},c=()=>{if(a)return;l();const t=new Set(o);o.clear();const e=()=>{a||Ie.schedule(c)};let h;try{h=In(n,t=>{o.add(t.__subscribe(e))},e)}finally{t.forEach(t=>t())}if(a)return o.forEach(t=>t()),void o.clear();i&&"function"==typeof h&&(r=h),s(h)},h=()=>{a||(a=!0,l(),o.forEach(t=>t()),o.clear())};return c(),ve(n,h),h}let Dn=0;function Nn(t,e){if("function"==typeof t){const e=t;let n;const s=Symbol("skip");return zn({name:"Memo",fn:()=>{try{return e()}catch(t){return console.error("[atom] Error in derived function:",t),s}},onRun:t=>{t!==s&&(n?(n.unlock("initial"),n.set(()=>t),n.lock("initial")):(n=jn(t,{skipRestrictedContextCheck:!0}),n.lock("initial")))}}),n}e?.skipRestrictedContextCheck||ee("Atom");let n=t;const s=++Dn,i=new pe;function o(){return Ue(o,!1),Bt()&&Yt(o),n}return o.get=function(){return o()},o.set=function(t,e=!1){var r,a;n="function"==typeof t?t(n):t,o.skipDevToolsLog||(r=String(s),a=n,Dt.logAtomSet(r,a)),e||i.notify()},o.update=function(t,e=!1){var r;"object"==typeof n&&null!==n&&(t(n),o.skipDevToolsLog||(r=String(s),Dt.logAtomUpdate(r)),e||i.notify())},o.__subscribe=function(t){return i.subscribe(t)},o.toJSON=function(){return JSON.stringify(n)},Object.defineProperty(o,"name",{value:"atom",writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(o,"val",{get:()=>o(),set:t=>o.set(t),enumerable:!1,configurable:!0}),Object.defineProperty(o,"__version__",{get:()=>i.getVersion(),enumerable:!1}),Object.defineProperty(o,"__isAtom___",{value:!0,writable:!1,enumerable:!1}),Object.defineProperty(o,"__id__",{value:s,writable:!1,enumerable:!1}),o}function Ln(t,e){e?.skipRestrictedContextCheck||ee("iAtom");const n=Nn(Un(t),{skipRestrictedContextCheck:!0}),s=n.set;n.set=function(t,e=!1){const i="function"==typeof t?t(n.get()):t;s(Un(i),e)};const i=n;return delete i.update,i.name="iAtom",i}function jn(t,e={}){e.skipRestrictedContextCheck||ee("superAtom"),ze();const n=e.freeze??!1,s=n?Un(Fn(t)):t;let i=!1,o="default";const r=Nn(n?Un(t):t,{skipRestrictedContextCheck:!0}),a=r.set;r.set=function(t,e=!1){if(i)return void le("Cannot mutate a locked atom.","superAtom");const s="function"==typeof t?t(r.get()):t;a(n?Un(s):s,e)};const l=r.update;r.update=function(t,e=!1){if(i)le("Cannot mutate a locked atom.","superAtom");else{if(n)throw new Error("update() is not supported when freeze is enabled — use set() with a new value.");l(t,e)}};const c=r;return c.lock=function(t="default"){i=!0,o=t},c.unlock=function(t="default"){if(o!==t)throw new Error("Incorrect passcode. Cannot unlock atom.");i=!1},c.reset=function(){i||r.set(n?Un(Fn(s)):s)},c.freeze=function(){On(r.get())},c.name="superAtom",c}function Un(t){return"object"==typeof t&&null!==t?On(t):t}function Fn(t){try{return structuredClone(t)}catch{return t}}function Vn(t){const e=new Map,n=[],s=t=>JSON.stringify(t),i=t=>{e.delete(t);const s=n.indexOf(t);s>-1&&n.splice(s,1)};return{getCacheKey:s,removeCacheEntry:i,createCacheMethod:(o,r,a,l)=>async(...c)=>{const h=s(c),u=e.get(h);if(u){const e=Date.now();if(!(void 0!==t?.cacheDuration&&e-u.timestamp>t.cacheDuration)){const t=n.indexOf(h);return t>-1&&n.splice(t,1),n.push(h),o.set(u.result),r.set(null),a.set("success"),u.result}i(h)}const d=await l(this,c);e.set(h,{result:d,timestamp:Date.now()});const f=n.indexOf(h);if(f>-1&&n.splice(f,1),n.push(h),t?.cacheLimit&&n.length>t.cacheLimit){const t=n.shift();t&&e.delete(t)}return d},createClearCacheMethod:()=>(...t)=>{if(0===t.length)e.clear(),n.length=0;else{const e=s(t);i(e)}}}}function Wn(t){let e=null,n=null;const s=()=>{e&&(clearInterval(e),e=null,n=null)};return{createStartPollingMethod:i=>(...o)=>{t?.pollInterval?(s(),n=o,i(...o),e=setInterval(()=>{n&&i(...n)},t.pollInterval)):le(new Error("pollInterval not specified in asyncAction options"))},createStopPollingMethod:()=>s,stopPolling:s}}function Bn(t,e){e?.allowInRestrictedContext||ee("Async Action");const n={...{cacheLimit:10,pollInterval:5e3},...e};let s=t;const i=new Set;let o=null,r=null,a=null,l=null;const c=Vn(n),h=Wn(n),u=Nn(null),d=Nn(null),f=Nn(!1),p=Nn("init"),m=t=>{i.forEach(e=>{if(void 0===e.filter||void 0===t||e.filter===t)try{e.fn()}catch(t){le(t)}})},_=()=>{r?.isActive()&&(r.cancel(),r=null),o&&(o.abort(),o=null),f.set(!1),p.set("init")},g=async(t,e)=>{_(),f.set(!0),p.set("loading"),o=new AbortController;const n=o;try{let i;if(a){i=a((...e)=>s.call(t,...e),...e)}else i=s.call(t,...e);i?.__isZeroPromise__&&(r=i);let c=await i;if(n.signal.aborted||o!==n)throw new Error("Operation was cancelled");return l&&(c=l(c)),u.set(c),d.set(null),p.set("success"),m(!0),c}catch(t){if(n.signal.aborted||o!==n)throw t;const e=t instanceof Error?t:new Error(String(t));throw u.set(null),d.set(e),p.set("error"),m(!1),e}finally{o===n&&(o=null),f.set(!1),r&&!r.isActive()&&(r=null)}},y=async(...t)=>{const e=this;if(Ce()){const n=we(!1);Me();const s=g(e,t).catch(()=>{}).finally(()=>{Re()});return n?._ssrPromiseQueue&&n._ssrPromiseQueue.push(s),s}return g(e,t)},w=c.createCacheMethod(u,d,p,g),v=c.createClearCacheMethod(),b=h.createStartPollingMethod(y),S=h.createStopPollingMethod(),x=Object.assign(y,{data:u,error:d,isLoading:f,status:p,val:()=>s,set:t=>{s=t},params:{page:1},cancel:_,subscribe:(t,e)=>{ee("subscribe");const n={fn:t,filter:e};i.add(n);const s=()=>i.delete(n);return ve(t,s),s},cache:w,clearCache:v,startPolling:b,stopPolling:S,interceptBefore:t=>{a=t},interceptAfter:t=>{l=t},__isAsyncAction___:!0,__isAction___:!1});return Object.defineProperty(x,"abortController",{get:()=>o,enumerable:!0,configurable:!0}),ve(x,()=>{i.clear(),h.stopPolling(),_()}),x}const Hn=(t,e,n)=>{const s="timeout"===n?setTimeout(()=>t(),e):setInterval(()=>t(),e);return ve(s,"timeout"===n?()=>clearTimeout(s):()=>clearInterval(s)),s};class Yn{constructor(){this.timeoutId=null,this.pendingArgs=null,this.pendingContext=null}clearPending(){this.pendingArgs=null,this.pendingContext=null}setPending(t,e){this.pendingArgs=t,this.pendingContext=e}clearTimer(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}setTimer(t,e){this.timeoutId=((t,e)=>Hn(t,e,"timeout"))(t,e)}executePending(t){return this.pendingArgs&&(this.lastResult=t.apply(this.pendingContext,this.pendingArgs),this.clearPending()),this.lastResult}}function qn(t,e){return()=>{t.clearTimer(),t.clearPending(),e?.()}}function Xn(t,e){return()=>{if(t.pendingArgs&&t.timeoutId){t.clearTimer();return t.executePending(e)}return t.lastResult}}function Zn(t,e){const n=new Yn,s=function(...s){return n.setPending(s,this),n.clearTimer(),n.setTimer(()=>{n.lastResult=n.executePending(t),n.timeoutId=null},e),n.lastResult};return s.cancel=qn(n),s.flush=Xn(n,t),s}function Gn(t,e){const n=new Yn;let s=0;const i=function(...i){const o=Date.now(),r=o-s;return r>=e?(s=o,n.lastResult=t.apply(this,i),n.clearPending(),n.clearTimer()):(n.setPending(i,this),n.timeoutId||n.setTimer(()=>{s=Date.now(),n.lastResult=n.executePending(t),n.timeoutId=null},e-r)),n.lastResult};return i.cancel=qn(n,()=>{s=0}),i.flush=Xn(n,t),i}function Kn(...t){const[e,n]=t;return e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,e)=>{if(!n||!(e in n))throw new Error(`Missing parameter: "${e}"`);return String(n[e])})}let Qn=null,Jn=null;function ts(){return Qn}function es(){return Jn}class ns{constructor(){this.state="idle",this.__isZeroPromise__=!0,this.toActive()}isActive(){return"active"===this.state}isResolved(){return"resolved"===this.state}isRejected(){return"rejected"===this.state}isCancelled(){return"cancelled"===this.state}get signal(){return this.controller.signal}toActive(){return"active"===this.state||(this.state="active",this.controller=new AbortController,this.promise=new Promise((t,e)=>{this.resolveFn=t,this.rejectFn=e,this.controller.signal.addEventListener("abort",()=>{"active"===this.state&&(this.state="cancelled",e(new DOMException("Cancelled","AbortError")))})})),this}resolve(t){this.isActive()&&(this.state="resolved",this.resolveFn(t))}reject(t){this.isActive()&&(this.state="rejected",this.rejectFn(t))}cancel(t){this.isActive()&&this.controller.abort(t)}then(t,e){return this.promise.then(t,e)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}get[Symbol.toStringTag](){return"ZeroPromise"}}const ss={100:"CONTINUE",101:"SWITCHING_PROTOCOLS",102:"PROCESSING",103:"EARLY_HINTS",200:"OK",201:"CREATED",202:"ACCEPTED",203:"NON_AUTHORITATIVE_INFORMATION",204:"NO_CONTENT",205:"RESET_CONTENT",206:"PARTIAL_CONTENT",207:"MULTI_STATUS",208:"ALREADY_REPORTED",226:"IM_USED",300:"MULTIPLE_CHOICES",301:"MOVED_PERMANENTLY",302:"FOUND",303:"SEE_OTHER",304:"NOT_MODIFIED",305:"USE_PROXY",307:"TEMPORARY_REDIRECT",308:"PERMANENT_REDIRECT",400:"BAD_REQUEST",401:"UNAUTHORIZED",402:"PAYMENT_REQUIRED",403:"FORBIDDEN",404:"NOT_FOUND",405:"METHOD_NOT_ALLOWED",406:"NOT_ACCEPTABLE",407:"PROXY_AUTHENTICATION_REQUIRED",408:"REQUEST_TIMEOUT",409:"CONFLICT",410:"GONE",411:"LENGTH_REQUIRED",412:"PRECONDITION_FAILED",413:"PAYLOAD_TOO_LARGE",414:"URI_TOO_LONG",415:"UNSUPPORTED_MEDIA_TYPE",416:"RANGE_NOT_SATISFIABLE",417:"EXPECTATION_FAILED",418:"IM_A_TEAPOT",421:"MISDIRECTED_REQUEST",422:"UNPROCESSABLE_ENTITY",423:"LOCKED",424:"FAILED_DEPENDENCY",425:"TOO_EARLY",426:"UPGRADE_REQUIRED",428:"PRECONDITION_REQUIRED",429:"TOO_MANY_REQUESTS",431:"REQUEST_HEADER_FIELDS_TOO_LARGE",451:"UNAVAILABLE_FOR_LEGAL_REASONS",500:"INTERNAL_SERVER_ERROR",501:"NOT_IMPLEMENTED",502:"BAD_GATEWAY",503:"SERVICE_UNAVAILABLE",504:"GATEWAY_TIMEOUT",505:"HTTP_VERSION_NOT_SUPPORTED",506:"VARIANT_ALSO_NEGOTIATES",507:"INSUFFICIENT_STORAGE",508:"LOOP_DETECTED",510:"NOT_EXTENDED",511:"NETWORK_AUTHENTICATION_REQUIRED"};function is(t){const{url:e="",host:n="",path:s,params:i={}}=t,o=e||s||"",r=/^https?:\/\//i.test(o)?o:`${n}${o}`,{pathParams:a,qsParams:l}=function(t,e){const n=new Set;for(const[,e]of t.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))n.add(e);const s={},i={};for(const[t,o]of Object.entries(e))n.has(t)?s[t]=o:i[t]=o;return{pathParams:s,qsParams:i}}(r,i),c=Object.keys(a).length>0?Kn(r,a):r;if(0===Object.keys(l).length)return c;let h,u;if(/^https?:\/\//i.test(c)){const t=new URL(c);h=t.origin+t.pathname,u=t.search}else{const t=c.indexOf("?");h=-1===t?c:c.slice(0,t),u=-1===t?"":c.slice(t)}const d=new URLSearchParams(u);for(const[t,e]of Object.entries(l))null!=e&&(Array.isArray(e)?e.forEach(e=>d.append(t,String(e))):d.set(t,String(e)));const f=d.toString();return f?`${h}?${f}`:h}const os=new Set,rs=new Set,as=new Set;class ls{constructor(t={},e,n,s){this.instanceBeforeFns=[],this.instanceAfterFns=[],this.instanceErrorFns=[],this.baseRequest=t,this._scopeBeforeFns=e,this._scopeAfterFns=n,this._scopeErrorFns=s}interceptBefore(t){return this.instanceBeforeFns.push(t),()=>{const e=this.instanceBeforeFns.indexOf(t);-1!==e&&this.instanceBeforeFns.splice(e,1)}}interceptAfter(t){return this.instanceAfterFns.push(t),()=>{const e=this.instanceAfterFns.indexOf(t);-1!==e&&this.instanceAfterFns.splice(e,1)}}interceptError(t){return this.instanceErrorFns.push(t),()=>{const e=this.instanceErrorFns.indexOf(t);-1!==e&&this.instanceErrorFns.splice(e,1)}}clearInterceptors(){this.instanceBeforeFns.length=0,this.instanceAfterFns.length=0,this.instanceErrorFns.length=0}get _beforeFns(){return this._scopeBeforeFns??os}get _afterFns(){return this._scopeAfterFns??rs}get _errorFns(){return this._scopeErrorFns??as}fetch(t){const e=new ns,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:o,params:r,path:a,...l}=n,c=is(n),h=function(t){return null==t?{}:"string"==typeof t||t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof URLSearchParams||t instanceof ReadableStream?{body:t}:{body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}}(s),u=(n.method??"GET").toUpperCase(),d=ts(),f=es();if(Ce()&&d){let t;try{t=c.startsWith("http")?new URL(c).pathname:c.split("?")[0]}catch{t=c.split("?")[0]}if(t.startsWith("/api")){const s=d(u,t);if(s){Me();const t={"content-type":"application/json",...l.headers,...h.headers};if(f){const e=f.headers.get("cookie"),n=f.headers.get("authorization");e&&(t.cookie=e),n&&(t.authorization=n)}const i=new Request(c.startsWith("http")?c:`http://localhost${c}`,{method:u,headers:t,body:h.body??null}),o=(()=>{const t=n.params||{},e=n.url||n.path||"",s=/^https?:\/\//i.test(e)?e:`${n.host||""}${e}`,i={};for(const[,e]of s.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))e in t&&(i[e]=String(t[e]));return i})(),r={...s.ctx,params:{...o,...s.ctx?.params||{}}};return s.handler(i,r).then(async t=>{if(!t.ok){const n=ss[t.status]||"UNKNOWN_ERROR";return e.reject(new Error(`${n}: ${t.statusText}`)),void Re()}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t),Re()}).catch(t=>{e.reject(t),Re()}),e}}}return(async()=>{let t,n=c,s={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(s.headers).length&&delete s.headers;for(const t of this.instanceBeforeFns){const e=await t(n,s);n=e.url,s=e.options}for(const t of this._beforeFns){const e=await t(n,s);n=e.url,s=e.options}try{t=await fetch(n,{...s,signal:e.signal})}catch(t){for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of this._errorFns)try{e(t)}catch(t){}return void e.reject(t)}let i=t;for(const t of this.instanceAfterFns)i=await t(i);for(const t of this._afterFns)i=await t(i);if(!i.ok){const t=ss[i.status]||"UNKNOWN_ERROR",n=new Error(`${t}: ${i.statusText}`);for(const t of this.instanceErrorFns)try{t(n)}catch(t){}for(const t of this._errorFns)try{t(n)}catch(t){}return void e.reject(n)}const o=i.headers.get("content-type");if(o?.includes("application/json")){const t=await i.json();if(t&&"object"==typeof t&&"Redirect"===t.__type&&"string"==typeof t.url){const n=t.url;return"undefined"!=typeof window&&(window.location.href=n),void e.resolve(void 0)}e.resolve(t)}else e.resolve(i)})().catch(t=>e.reject(t)),e}Fetch(t){return this.fetch(t)}Get(t){return this.fetch({...t,method:"GET"})}Post(t){return this.fetch({...t,method:"POST"})}Put(t){return this.fetch({...t,method:"PUT"})}Patch(t){return this.fetch({...t,method:"PATCH"})}Delete(t){return this.fetch({...t,method:"DELETE"})}fetchAction(t){const{baseRequest:e,options:n}=function(t){if(!t)return{baseRequest:{},options:{}};const{cacheDuration:e,cacheLimit:n,pollInterval:s,allowInRestrictedContext:i,...o}=t;return{baseRequest:o,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Bn(t=>this.fetch({...e,params:{...e.params,...t}}),n)}getAction(t){return this.fetchAction({...t,method:"GET"})}postAction(t){return this.fetchAction({...t,method:"POST"})}putAction(t){return this.fetchAction({...t,method:"PUT"})}patchAction(t){return this.fetchAction({...t,method:"PATCH"})}deleteAction(t){return this.fetchAction({...t,method:"DELETE"})}}const cs=new ls({});function hs(t){return t.startsWith("--")?t:`--${t}`}function us(t,e){let n="";for(const t in e){n+=` ${hs(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function ds(t){if(null==t)return{action:"remove"};if("boolean"==typeof t)return t?{action:"set",value:""}:{action:"remove"};if("string"==typeof t)return{action:"set",value:t};if("number"==typeof t)return{action:"set",value:String(t)};if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?"boolean"==typeof n?n?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(n)}:{action:"remove"}}if(3===t.length){const[e,n,s]=t,i=e?n:s;return"boolean"==typeof i?i?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(i)}}}return{action:"remove"}}function fs(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ps(t){if(null==t||!1===t)return null;if("string"==typeof t)return t;if("number"==typeof t)return String(t);if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?String(n):null}if(3===t.length){const[e,n,s]=t;return String(e?n:s)}}return null}const ms=new WeakMap,_s=new WeakMap,gs=new WeakMap,ys=new WeakMap;class ws{constructor(t){this.el=t}attr(t){const e=this.el;ms.has(e)||ms.set(e,new Map);const n=ms.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=ds(o);"set"===t.action?(n.get(i)!==t.value&&e.setAttribute(i,t.value),s.set(i,t.value)):n.has(i)&&e.removeAttribute(i)}for(const t of n.keys())s.has(t)||e.removeAttribute(t);return ms.set(e,s),this}updateAttr(t){const e=this.el;ms.has(e)||ms.set(e,new Map);const n=ms.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,o]of Object.entries(s))n.get(t)!==o&&e.setAttribute(t,o),i.set(t,o);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return ms.set(e,i),this}style(t){const e=this.el;_s.has(e)||_s.set(e,new Map);const n=_s.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=ps(o),r=fs(i);null!==t?(n.get(r)!==t&&e.style.setProperty(r,t),s.set(r,t)):n.has(r)&&e.style.removeProperty(r)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return _s.set(e,s),this}classes(t){const e=this.el;gs.has(e)||gs.set(e,new Set);const n=gs.get(e),s=function(t){const e=new Set,n=t=>{for(const n of t.split(/\s+/))n&&e.add(n)};if("string"==typeof t)return n(t),e;if(Array.isArray(t)){for(const e of t)if(e||0===e)if("string"!=typeof e){if(Array.isArray(e))if(2===e.length){const[t,s]=e;t&&s&&n(s)}else if(3===e.length){const[t,s,i]=e;n(t?s:i)}}else n(e);return e}if("object"==typeof t&&null!==t)for(const[e,s]of Object.entries(t))s&&n(e);return e}(t);for(const t of s)n.has(t)||e.classList.add(t);for(const t of n)s.has(t)||e.classList.remove(t);return gs.set(e,s),this}addClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.add(n);return this}removeClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.remove(n);return this}toggleClass(t,e){const n=this.el;for(const s of t.split(/\s+/))s&&n.classList.toggle(s,e);return this}html(t){if(null==t)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return F(t,this.el),this}text(t){return this.el.textContent=String(t),this}focus(t){return this.el.focus(t),this}blur(){return this.el.blur(),this}scroll(t){const e=this.el;return"string"==typeof t?e.scrollTo({top:0,behavior:t}):t?e.scrollTo(t):e.scrollTo({top:0}),this}scrollIntoView(t){return this.el.scrollIntoView(t),this}measure(t){const e=this.el.getBoundingClientRect();return t({width:e.width,height:e.height,top:e.top,left:e.left,right:e.right,bottom:e.bottom,x:e.x,y:e.y}),this}on(t,e,n){const s=this.el;ys.has(s)||ys.set(s,new Map);const i=ys.get(s),o=i.get(t);o&&s.removeEventListener(t,o.handler,o.options);const r=e;return s.addEventListener(t,r,n),i.set(t,{handler:r,options:n}),this}off(t,e){const n=this.el,s=ys.get(n);if(!s)return this;if(e){const i=s.get(t);i&&i.handler===e&&(n.removeEventListener(t,i.handler,i.options),s.delete(t))}else{const e=s.get(t);e&&(n.removeEventListener(t,e.handler,e.options),s.delete(t))}return this}once(t,e,n){const s="object"==typeof n?{...n,once:!0}:{once:!0};return this.el.addEventListener(t,e,s),this}delegate(t,e,n,s){const i=t=>{const s=t.target?.closest(e);s&&this.el.contains(s)&&n(t,s)};return this.el.addEventListener(t,i,s),ys.has(this.el)||ys.set(this.el,new Map),ys.get(this.el).set(`${t}:delegate:${e}`,{handler:i,options:s}),this}aria(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,String(s))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,i=n.startsWith("data-")?n:`data-${n}`;null==s?e.removeAttribute(i):e.setAttribute(i,String(s));const o=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[o]:e.dataset[o]=String(s)}return this}}function vs(t){if(null!==t&&"object"==typeof t&&!0===t.__isMatesRef__){const e=t;if(void 0===e.value)throw new Error("$(ref): the ref has no element attached yet (ref.value is undefined).\nDOM manipulation via $() must happen after the element has mounted.\nUse one of the lifecycle hooks where the element is guaranteed to exist:\n • onMount() — runs once after the component's first render\n • onPaint() — runs after the browser has painted\n • onUpdate() — runs after every subsequent re-render\n\nExample:\n const inputRef = ref<HTMLInputElement>();\n onMount(() => { $(inputRef).focus(); });");return new ws(e.value)}return new ws(t)}function bs(t,e){return"function"!=typeof t.animate?Promise.resolve():("function"==typeof t.getAnimations&&t.getAnimations().forEach(t=>t.cancel()),new Promise(n=>{const s=t.animate(e.keyframes,{duration:300,easing:"ease",fill:"both",...e.options});s.onfinish=()=>n(),s.oncancel=()=>n()}))}async function Ss(t){const{el:e,exit:n,enter:s,swap:i,getEl:o,isStale:r}=t;if(!e)return void i();if(await bs(e,n),r?.())return;if(i(),await("function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t())))),r?.())return;const a=o?.()??e;a&&await bs(a,s)}function xs(t){return t.__isEffect__=!0,zn({name:"Effect",fn:t,onRun:()=>{},supportsCleanup:!0})}const Cs=new WeakMap,Es=q(class extends dt{render(t){return E}update(t,[e]){const n=e!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),E}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.Y){const e=this.ht??globalThis;let n=Cs.get(e);void 0===n&&(n=new WeakMap,Cs.set(e,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return"function"==typeof this.Y?Cs.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function As(){const t=new me;let e;const n={get value(){return e},__subscribe:e=>t.subscribe(e),__isMatesRef__:!0,__set:n=>{e!==n&&(e=n,t.trigger(n))}};return n}function ks(t){if(t&&t.__isMatesRef__){const e=t;return Es(t=>{e.__set(t)})}return Es(t)}function Ms(t,e){return t.add(e),()=>t.delete(e)}class Rs{constructor(){this._beforeFns=new Set,this._afterFns=new Set,this._errorFns=new Set,this.fetchClient=new ls({},this._beforeFns,this._afterFns,this._errorFns)}interceptBefore(t){return Ms(this._beforeFns,t)}interceptAfter(t){return Ms(this._afterFns,t)}interceptError(t){return Ms(this._errorFns,t)}clearInterceptors(){this._beforeFns.clear(),this._afterFns.clear(),this._errorFns.clear()}}const Ts=()=>{if("undefined"==typeof window)return{};const t=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,e=new URLSearchParams(t),n={};for(const[t,s]of e)try{n[t]=JSON.parse(s)}catch{n[t]=s}return n};function $s(t){const e=Nn(Ts());let n=!1;xs(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+window.location.search+(n?`#${n}`:"");window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(Ts()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("hashchange",s),e}const Os=()=>{if("undefined"==typeof window)return{};const t=new URLSearchParams(window.location.search),e={};for(const[n,s]of t)try{e[n]=JSON.parse(s)}catch{e[n]=s}return e};function Is(t){const e=Nn(Os());let n=!1;xs(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(Os()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("popstate",s),e}function Ps(t){return new Promise(e=>{const n=()=>{t?.(),e()};Ce()?queueMicrotask(n):"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>n(),{timeout:300}):requestAnimationFrame(n)})}class zs{constructor(){this.navigationLocked=Nn(!1),this.navigationRequestEvent=be("router:navigation-request"),this.historyStateAtom=Nn("undefined"!=typeof window?window.history.state:null),this.pathAtom=function(t,e,n){const s=jn("undefined"!=typeof window?window.location.pathname:"/");function i(t){t.preventDefault(),t.returnValue=""}return xs(()=>(t()?"undefined"!=typeof window&&window.addEventListener("beforeunload",i):"undefined"!=typeof window&&window.removeEventListener("beforeunload",i),()=>{"undefined"!=typeof window&&window.removeEventListener("beforeunload",i)})),"undefined"!=typeof window&&(window.addEventListener("popstate",i=>{if(t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);const o=window.location.pathname;if(o!==s.get()&&n.trigger({to:o,from:s.get()}),t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);e.set(i.state??null),o!==s.get()&&s.set(o)}),window.addEventListener("hashchange",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)}),window.addEventListener("navigate",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)})),s}(this.navigationLocked,this.historyStateAtom,this.navigationRequestEvent),this.qsAtom=Is(this.navigationLocked),this.hashAtom=$s(this.navigationLocked)}navigateTo(t,e,n){var s,i,o,r;(s=this.pathAtom,i=this.navigationLocked,o=this.historyStateAtom,r=this.navigationRequestEvent,function(t,e,n){if(i())return;if(t===s.get())return;const a=t.includes("?"),l=t.includes("#");let c=t;if(a||l)if(l){if(!a){const e=t.indexOf("#");c=t.slice(0,e)+window.location.search+t.slice(e)}}else c=t+window.location.hash;else c=t+window.location.search+window.location.hash;r.trigger({to:t,from:s.get()}),i()||(o.set(n??null),e?window.history.replaceState(n,"",c):window.history.pushState(n,"",c),s.set(t))})(t,e,n)}lockNavigation(){this.navigationLocked.set(!0)}unlockNavigation(){this.navigationLocked.set(!1)}get location(){return t=this.pathAtom,e=this.hashAtom,n=this.qsAtom,{get path(){return t.get()},get hash(){return e()},get qsObj(){return n()}};var t,e,n}onNavigationRequest(t){if(Ce())return;ze();let e=!1;const n=this.navigationRequestEvent.__subscribe(n=>{if(e)return;const{to:s,from:i}=n;this.lockNavigation();let o=!1;const r=t({to:s,from:i,next:()=>{o||(o=!0,e=!0,this.unlockNavigation(),Ps(()=>{this.navigateTo(s),e=!1}))}});r instanceof Promise?r.then(()=>{o||this.unlockNavigation()}).catch(()=>{o||this.unlockNavigation()}):o||this.unlockNavigation()});ve(t,n)}}const Ds="mates";function Ns(t,e){try{null===e?t.removeItem(Ds):t.setItem(Ds,JSON.stringify(e))}catch{}}function Ls(t,e){const n=Nn((()=>{try{return function(t){try{const e=t.getItem(Ds);if(e)return JSON.parse(e)}catch{}return null}(t())}catch{return null}})()),s=n.set;n.set=function(e,i=!1){s(e,i);try{Ns(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{Ns(t(),n.get())}catch{}}},e(t=>{if(t.key===Ds)if(t.newValue)try{s(JSON.parse(t.newValue))}catch{}else s(null)}),Object.defineProperty(n,"name",{value:"storageAtom",writable:!0,configurable:!0,enumerable:!1}),n}function js(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}class Us{constructor(){this.lsAtom=Ls(()=>localStorage,t=>js(e=>{e.storageArea===localStorage&&t(e)})),this.ssAtom=Ls(()=>sessionStorage,t=>js(e=>{e.storageArea===sessionStorage&&t(e)}))}}const Fs="mates-theme";function Vs(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}const Ws=function(){const t=Nn(function(){try{const t=localStorage.getItem(Fs);return"light"===t||"dark"===t||"auto"===t?t:null}catch{return null}}()??"auto",{skipRestrictedContextCheck:!0}),e=t;if(e.setToLight=()=>{t.set("light")},e.setToDark=()=>{t.set("dark")},e.setToAuto=()=>{t.set("auto")},e.toggle=()=>{const e=Vs(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>Vs(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),xs(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",Vs(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(Fs):localStorage.setItem(Fs,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia)try{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")})}catch{}return e};class Bs{constructor(){this.themeAtom=Ws(),this.titleAtom=function(){const t=Nn("undefined"!=typeof document?document.title:"");return xs(()=>{"undefined"!=typeof document&&(document.title=t.get())}),t}()}}class Hs{constructor(){this._router=new zs,this._fetch=new Rs,this._storage=new Us,this._theme=new Bs}get pathAtom(){return this._router.pathAtom}get qsAtom(){return this._router.qsAtom}get hashAtom(){return this._router.hashAtom}get historyStateAtom(){return this._router.historyStateAtom}get navigationLocked(){return this._router.navigationLocked}get navigationRequestEvent(){return this._router.navigationRequestEvent}get location(){return this._router.location}navigateTo(t,e,n){return this._router.navigateTo(t,e,n)}lockNavigation(){return this._router.lockNavigation()}unlockNavigation(){return this._router.unlockNavigation()}onNavigationRequest(t){return this._router.onNavigationRequest(t)}get fetchClient(){return this._fetch.fetchClient}interceptBefore(t){return this._fetch.interceptBefore(t)}interceptAfter(t){return this._fetch.interceptAfter(t)}interceptError(t){return this._fetch.interceptError(t)}clearInterceptors(){return this._fetch.clearInterceptors()}get lsAtom(){return this._storage.lsAtom}get ssAtom(){return this._storage.ssAtom}get themeAtom(){return this._theme.themeAtom}get titleAtom(){return this._theme.titleAtom}}const Ys=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,qs=t=>"function"==typeof t,Xs=t=>"AsyncFunction"===t.constructor.name,Zs=(t,e,n,s)=>{if(Ys(t)){const i=t,o=Nn(i(),s),r=n(o.set,e),a=n(o.update,e);return o.set=r,o.update=a,i.__subscribe(()=>{Ie.schedule(()=>o.set(i()))}),ve(o,()=>{r.cancel(),a.cancel()}),o}const i=Nn(t,s),o=n(i.set,e),r=n(i.update,e);return i.set=o,i.update=r,ve(i,()=>{o.cancel(),r.cancel()}),i};const Gs=(t=[],e)=>{const n=new Map(t),s=Nn(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const o=n.delete.bind(n);n.delete=t=>{const e=o(t);return s.update(()=>{}),e};const r=n.clear.bind(n);n.clear=()=>{r(),s.update(()=>{})};const a=n.get.bind(n);n.get=t=>(s.get(),a(t));const l=n.has.bind(n);n.has=t=>(s.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(s.get(),h());const u=n.values.bind(n);n.values=()=>(s.get(),u());const d=n.keys.bind(n);n.keys=()=>(s.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),p()),n.update=t=>{const e={set:(t,n)=>(i(t,n),e),delete:t=>o(t),clear:()=>{r()},get:t=>a(t),has:t=>l(t),entries:()=>h(),values:()=>u(),keys:()=>d(),forEach:(t,e)=>f(t,e),[Symbol.iterator]:()=>p(),get size(){return c.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>{const i=a(t);return null==i||"object"!=typeof i||(e(i),s.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n};function Ks(t,e=2){let n=parseFloat(String(t).trim());Number.isFinite(n)||(n=0);const s=10**e;return Math.round(n*s)/s}function Qs(t,e,n){const s=jn(t,{skipRestrictedContextCheck:!0,...n}),i=jn([],{skipRestrictedContextCheck:!0,...n});function o(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const r=s.set;s.set=function(t,e=!1){r(t,e),o()};const a=s.update;s.update=function(t,e=!1){a(t,e),o()};const l=s;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>i.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===i.get().length,enumerable:!1,configurable:!0}),l.validate=o,l.toFloat=()=>Ks(s.get()),l.toFloatString=()=>Ks(s.get()).toString(),l.toValidNumber=()=>function(t){const e=Number(t);return Number.isFinite(e)?e:0}(s.get()),Object.defineProperty(l,"name",{value:"formAtom",writable:!0,configurable:!0,enumerable:!1}),l}function Js(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ti(t){return null==t||("string"==typeof t||Array.isArray(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"object"==typeof t&&0===Object.keys(t).length)}function ei(t){const e=new Set,n=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];let s=t;for(;s&&!n.includes(s);){for(const t of Reflect.ownKeys(s))"constructor"!==t&&e.add(t);s=Object.getPrototypeOf(s)}return Array.from(e)}const ni=t=>{const e=we();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;te.viewOuterInProgress=!0;try{n=new t}finally{te.viewOuterInProgress=!1}const s=te.setupInProgress;try{if((()=>{ei(n).forEach(t=>{const e=Object.getOwnPropertyDescriptor(n,t)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),t);if(e&&(e.get||e.set))return;const s=n[t];"function"!=typeof s||s.__version__||(n[t]=s.bind(n))})})(),"function"==typeof n.setup){Xs(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),te.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{te.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{te.setupInProgress=s}return n},si=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}}),s=we(!1);if(s)s.dispatchEvent(n);else if("undefined"!=typeof document){const t=document.querySelector("x-view");t&&t.dispatchEvent(n)}if(e)return e;throw new Error(`No parent scope found for ${t.name}`)},ii=new Set;function oi(){return[...ii]}function ri(t,e){let n=t;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=Object.getPrototypeOf(n)}}const ai=(t,e,n)=>{const s=ei(t);s.forEach(s=>{const i=ri(t,s);if(i?.get){let n,o=-1;const r=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==o&&(o=s,n=r.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(qs(t[s])){if(Xs(t[s]))throw new Error(`Async functions are not supported inside ${n}`);const i=t[s];t[s]=(...n)=>{e.update(()=>i.apply(t,n))}}});const i=Object.create(t);return s.forEach(n=>{const s=ri(t,n);if(!s)return;const o=!!s.get,r=!o&&qs(s.value);o||r||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i},li=(t,e={})=>S`<x-view .view=${t} .props=${e}></x-view>`,ci=li,hi=li,ui=(t,e)=>F(li(di,{viewFn:t}),e),di=t=>{ni(zs),ni(Rs),ni(Us),ni(Bs),ni(Hs);for(const t of oi())ni(t);const e=t().viewFn;return()=>li(e)},fi=ui,pi=t=>{const e=As(),n=t().condition,s=Nn(n),i=Nn(n);return xs(()=>{const n=i();if(n===s.get())return;const o=e.value;if(!o)return void s.set(n);const r=t().config;Ss({el:o,exit:r?.exit??Rn(200),enter:r?.enter??Mn(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Ne(()=>{const n=e.value;if(!n)return;const s=t().config;bs(n,s?.enter??Mn(250))}),()=>{const n=s(),{condition:o,trueTpl:r,falseTpl:a}=t();return i.get()!==o&&i.set(o),S`
99
+ `;i.__isErrorView__=!0,i.skipDevToolsRender=!0,this.view=i,this.name=e,this._errorState=t}}Ve()&&window.addEventListener("mates:component-hot-update",t=>{const e=new Set(t.detail??[]);0!==e.size&&document.querySelectorAll("x-view").forEach(t=>{if(!(t instanceof Ye))return;const n=function(t){if(!Ve())return null;const e=t?.__mates_hmr_id;return"string"==typeof e?e:null}(t.view);n&&e.has(n)&&t._hotRefresh()})}),customElements.get("x-view")||customElements.define("x-view",Ye);class qe extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,n=e.detail?.context.id;n&&null!=this.id&&n===this.id&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}set context(t){this.id=t.id}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}function Xe(t){let e=-1===t.indexOf("\0")?t:t.replace(/\0/g,"");const n=function(t){const e=t.indexOf("{"),n=t.indexOf("}");return-1===e&&-1===n?-1:-1===e?n:-1===n?e:Math.min(e,n)}(e);return-1!==n&&(e=e.slice(0,n)),/url\s*\(/i.test(e)&&(e=e.replace(/\burl\s*\(\s*(['"]?)\s*(?:javascript:|vbscript:|data:text\/html[,;])/gi,"url($1")),e}function Ze(t){return t.length>0&&/^[a-zA-Z-]+$/.test(t)}customElements.get("x-provider")||customElements.define("x-provider",qe);let Ge=0;function Ke(){return`_m${(Ge++).toString(36)}`}const Qe=Object.create(null),Je={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function tn(t){const e=Qe[t];if(void 0!==e)return e;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return Qe[t]=n,n}function en(t,e,n){if(!n)return`.${t} {\n${e}}`;if(n.startsWith("&")){return`.${t}${n.slice(1)} {\n${e}}`}return`${n} {\n .${t} {\n${e.replace(/^ {2}/gm," ")} }\n}`}function nn(t){return t.startsWith("&")||t.startsWith("@media")?t:Object.prototype.hasOwnProperty.call(Je,t)?`@media (min-width: ${Je[t]})`:null}function sn(t,e,n){const s=Object.create(null);for(const i in t){const o=t[i];let r="",a=null;for(const t in o){const e=o[t];if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const n=nn(t);if(null===n)throw new Error(`[css-in-js] Unknown nested key "${t}" in block "${i}". Use "&:pseudo", "@media (...)", or a configured breakpoint key.`);let s="";const o=e;for(const t in o){const e=o[t];null!=e&&(Ze(t)?s+=` ${tn(t)}: ${Xe(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`))}s.length>0&&(null===a&&(a=[]),a.push([s,n]));continue}Ze(t)?r+=` ${tn(t)}: ${Xe(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`)}}if(0===r.length&&null===a){s[i]="";continue}const l=n?.literal?i:`${i}${Ke()}`;if(r.length>0&&e.push(en(l,r,"")),null!==a)for(let t=0;t<a.length;t++)e.push(en(l,a[t][0],a[t][1]));s[i]=l}return s}function on(t){return Object.freeze(t)}var rn,an,ln,cn,hn,un,dn,fn;function pn(t){if(te.templateInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a template function.`);if(te.viewOuterInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a component outer function. Move it outside the component function.`);if(te.setupInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a setup function.`)}let mn=0;function _n(t){return`${t}_kf${(mn++).toString(36)}`}function gn(t,e){let n="";for(const t in e){const s=e[t];let i="";for(const t in s){const e=s[t];if(null==e)continue;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);i+=` ${n}: ${String(e)};\n`}i&&(n+=` ${t} {\n${i} }\n`)}return`@keyframes ${t} {\n${n}}`}const yn=new Set;class wn{constructor(){rn.add(this),an.set(this,""),ln.set(this,0),cn.set(this,null),hn.set(this,[]),yn.add(this)}keyframes(t,e){const n=_n(t);return this.appendRules(gn(n,e)),n}appendRules(t){""!==t&&(ce(this,hn,"f").push(t),ce(this,ln,"f")>0&&ce(this,rn,"m",un).call(this))}mount(){var t;he(this,ln,(t=ce(this,ln,"f"),++t),"f"),1===ce(this,ln,"f")&&(ce(this,rn,"m",un).call(this),ce(this,cn,"f")||ce(this,rn,"m",dn).call(this))}unmount(){var t;ce(this,ln,"f")<=0||(he(this,ln,(t=ce(this,ln,"f"),--t),"f"),0===ce(this,ln,"f")&&ce(this,rn,"m",fn).call(this))}get refCount(){return ce(this,ln,"f")}get cssText(){return ce(this,an,"f")}get isMounted(){return ce(this,ln,"f")>0}get sheet(){return ce(this,cn,"f")}getAllCSS(){const t=[];return ce(this,an,"f")&&t.push(ce(this,an,"f")),ce(this,hn,"f").length>0&&t.push(ce(this,hn,"f").join("\n")),t.join("\n")}}an=new WeakMap,ln=new WeakMap,cn=new WeakMap,hn=new WeakMap,rn=new WeakSet,un=function(){if(0===ce(this,hn,"f").length)return;const t=ce(this,hn,"f").join("\n");he(this,hn,[],"f"),he(this,an,ce(this,an,"f")+(ce(this,an,"f")?"\n":"")+t,"f"),ce(this,rn,"m",dn).call(this)},dn=function(){ce(this,cn,"f")||(he(this,cn,new CSSStyleSheet,"f"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,ce(this,cn,"f")]),ce(this,cn,"f").replaceSync(ce(this,an,"f"))},fn=function(){ce(this,cn,"f")&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==ce(this,cn,"f")),he(this,cn,null,"f")),ce(this,an,"f")&&(ce(this,hn,"f").unshift(ce(this,an,"f")),he(this,an,"","f"))};let vn=null,bn=!1;function Sn(){return vn||(vn=new wn),vn}function xn(){vn||(vn=new wn),bn||(bn=!0,queueMicrotask(()=>{bn=!1,vn.mount()}))}function Cn(t,e){if(pn("globalCSS"),Ce())return{};xn();const n=[],s=sn(t,n,e);return n.length>0&&vn.appendRules(n.join("\n")),on(s)}function En(t){pn("globalRawCSS"),xn(),vn.appendRules(t)}let An=!1;function kn(){An||(An=!0,En('\n[class*="mates-"] {\n --mates-duration : 300ms;\n --mates-easing : ease;\n --mates-distance : 24px;\n animation-duration : var(--mates-duration);\n animation-timing-function : var(--mates-easing);\n animation-fill-mode : both;\n}\n'),En("\n@keyframes mates-kf-fade-in { from { opacity: 0 } to { opacity: 1 } }\n@keyframes mates-kf-fade-out { from { opacity: 1 } to { opacity: 0 } }\n\n@keyframes mates-kf-slide-in-up {\n from { opacity: 0; transform: translateY(var(--mates-distance)) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-up {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-down {\n from { opacity: 0; transform: translateY(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateY(0) }\n}\n@keyframes mates-kf-slide-out-down {\n from { opacity: 1; transform: translateY(0) }\n to { opacity: 0; transform: translateY(var(--mates-distance)) }\n}\n@keyframes mates-kf-slide-in-left {\n from { opacity: 0; transform: translateX(var(--mates-distance)) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-left {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n}\n@keyframes mates-kf-slide-in-right {\n from { opacity: 0; transform: translateX(calc(-1 * var(--mates-distance))) }\n to { opacity: 1; transform: translateX(0) }\n}\n@keyframes mates-kf-slide-out-right {\n from { opacity: 1; transform: translateX(0) }\n to { opacity: 0; transform: translateX(var(--mates-distance)) }\n}\n\n@keyframes mates-kf-scale-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n@keyframes mates-kf-scale-out {\n from { opacity: 1; transform: scale(1) }\n to { opacity: 0; transform: scale(0.92) }\n}\n\n@keyframes mates-kf-spring-in {\n from { opacity: 0; transform: scale(0.92) }\n to { opacity: 1; transform: scale(1) }\n}\n\n@keyframes mates-kf-flip-in-x {\n from { opacity: 0; transform: rotateX(90deg) }\n to { opacity: 1; transform: rotateX(0deg) }\n}\n@keyframes mates-kf-flip-in-y {\n from { opacity: 0; transform: rotateY(90deg) }\n to { opacity: 1; transform: rotateY(0deg) }\n}\n\n@keyframes mates-kf-blur-in {\n from { opacity: 0; filter: blur(10px) }\n to { opacity: 1; filter: blur(0) }\n}\n@keyframes mates-kf-blur-out {\n from { opacity: 1; filter: blur(0) }\n to { opacity: 0; filter: blur(10px) }\n}\n\n@keyframes mates-kf-shake {\n 0%, 100% { transform: translateX(0) }\n 15% { transform: translateX(calc(-1 * var(--mates-distance))) }\n 30% { transform: translateX(calc( 1 * var(--mates-distance))) }\n 45% { transform: translateX(calc(-0.6 * var(--mates-distance))) }\n 60% { transform: translateX(calc( 0.6 * var(--mates-distance))) }\n 75% { transform: translateX(calc(-0.3 * var(--mates-distance))) }\n 90% { transform: translateX(calc( 0.3 * var(--mates-distance))) }\n}\n\n@keyframes mates-kf-pulse {\n 0%, 100% { transform: scale(1) }\n 50% { transform: scale(1.08) }\n}\n\n@keyframes mates-kf-bounce {\n 0% { transform: translateY(0) }\n 20% { transform: translateY(calc(-0.40 * var(--mates-distance))) }\n 40% { transform: translateY(0) }\n 60% { transform: translateY(calc(-0.20 * var(--mates-distance))) }\n 80% { transform: translateY(0) }\n 90% { transform: translateY(calc(-0.08 * var(--mates-distance))) }\n 100% { transform: translateY(0) }\n}\n\n@keyframes mates-kf-spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n}\n"),Cn({"mates-fade-in":{animationName:"mates-kf-fade-in"},"mates-fade-out":{animationName:"mates-kf-fade-out"},"mates-slide-in-up":{animationName:"mates-kf-slide-in-up"},"mates-slide-out-up":{animationName:"mates-kf-slide-out-up"},"mates-slide-in-down":{animationName:"mates-kf-slide-in-down"},"mates-slide-out-down":{animationName:"mates-kf-slide-out-down"},"mates-slide-in-left":{animationName:"mates-kf-slide-in-left"},"mates-slide-out-left":{animationName:"mates-kf-slide-out-left"},"mates-slide-in-right":{animationName:"mates-kf-slide-in-right"},"mates-slide-out-right":{animationName:"mates-kf-slide-out-right"},"mates-scale-in":{animationName:"mates-kf-scale-in"},"mates-scale-out":{animationName:"mates-kf-scale-out"},"mates-spring-in":{animationName:"mates-kf-spring-in","--mates-easing":"cubic-bezier(0.34, 1.56, 0.64, 1)"},"mates-flip-in-x":{animationName:"mates-kf-flip-in-x"},"mates-flip-in-y":{animationName:"mates-kf-flip-in-y"},"mates-blur-in":{animationName:"mates-kf-blur-in"},"mates-blur-out":{animationName:"mates-kf-blur-out"},"mates-shake":{animationName:"mates-kf-shake","--mates-duration":"500ms","--mates-easing":"ease-in-out"},"mates-pulse":{animationName:"mates-kf-pulse","--mates-duration":"600ms","--mates-easing":"ease-in-out"},"mates-bounce":{animationName:"mates-kf-bounce","--mates-duration":"700ms"},"mates-spin":{animationName:"mates-kf-spin","--mates-easing":"linear"}},{literal:!0}))}function Mn(t=300,e="ease"){return{keyframes:[{opacity:0},{opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function Rn(t=300,e="ease"){return{keyframes:[{opacity:1},{opacity:0}],options:{duration:t,easing:e,fill:"both"}}}kn();const Tn={up:"translateY(-100%)",down:"translateY(100%)",left:"translateX(-100%)",right:"translateX(100%)"};function $n(t,e){switch(t){case"up":return`translateY(-${e})`;case"down":return`translateY(${e})`;case"left":return`translateX(-${e})`;case"right":return`translateX(${e})`}}function On(t){if(null==t||"object"!=typeof t)return t;try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||On(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function In(t,e,n){const s=Kt();let i;qt();try{i=t()}finally{Xt();Qt(s).forEach(t=>{"function"==typeof t.__subscribe&&e(t,n)})}return i}function Pn(t,e){if(ee(t),"AsyncFunction"===e.constructor.name)throw new Error(`${t.toLowerCase()}() does not support async functions.`);if(Ht())throw new Error(`${t.toLowerCase()}() cannot be nested inside an effect() or memo().`)}function zn(t){const{name:e,fn:n,onRun:s,supportsCleanup:i}=t;Pn(e,n);const o=new Set;let r,a=!1;const l=()=>{if(i&&r){try{r()}catch(t){console.error("Error in effect cleanup:",t)}r=void 0}},c=()=>{if(a)return;l();const t=new Set(o);o.clear();const e=()=>{a||Ie.schedule(c)};let h;try{h=In(n,t=>{o.add(t.__subscribe(e))},e)}finally{t.forEach(t=>t())}if(a)return o.forEach(t=>t()),void o.clear();i&&"function"==typeof h&&(r=h),s(h)},h=()=>{a||(a=!0,l(),o.forEach(t=>t()),o.clear())};return c(),ve(n,h),h}let Dn=0;function Nn(t,e){if("function"==typeof t){const e=t;let n;const s=Symbol("skip");return zn({name:"Memo",fn:()=>{try{return e()}catch(t){return console.error("[atom] Error in derived function:",t),s}},onRun:t=>{t!==s&&(n?(n.unlock("initial"),n.set(()=>t),n.lock("initial")):(n=jn(t,{skipRestrictedContextCheck:!0}),n.lock("initial")))}}),n}e?.skipRestrictedContextCheck||ee("Atom");let n=t;const s=++Dn,i=new pe;function o(){return Ue(o,!1),Bt()&&Yt(o),n}return o.get=function(){return o()},o.set=function(t,e=!1){var r,a;n="function"==typeof t?t(n):t,o.skipDevToolsLog||(r=String(s),a=n,Dt.logAtomSet(r,a)),e||i.notify()},o.update=function(t,e=!1){var r;"object"==typeof n&&null!==n&&(t(n),o.skipDevToolsLog||(r=String(s),Dt.logAtomUpdate(r)),e||i.notify())},o.__subscribe=function(t){return i.subscribe(t)},o.toJSON=function(){return JSON.stringify(n)},Object.defineProperty(o,"name",{value:"atom",writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(o,"val",{get:()=>o(),set:t=>o.set(t),enumerable:!1,configurable:!0}),Object.defineProperty(o,"__version__",{get:()=>i.getVersion(),enumerable:!1}),Object.defineProperty(o,"__isAtom___",{value:!0,writable:!1,enumerable:!1}),Object.defineProperty(o,"__id__",{value:s,writable:!1,enumerable:!1}),o}function Ln(t,e){e?.skipRestrictedContextCheck||ee("iAtom");const n=Nn(Un(t),{skipRestrictedContextCheck:!0}),s=n.set;n.set=function(t,e=!1){const i="function"==typeof t?t(n.get()):t;s(Un(i),e)};const i=n;return delete i.update,i.name="iAtom",i}function jn(t,e={}){e.skipRestrictedContextCheck||ee("superAtom"),ze();const n=e.freeze??!1,s=n?Un(Fn(t)):t;let i=!1,o="default";const r=Nn(n?Un(t):t,{skipRestrictedContextCheck:!0}),a=r.set;r.set=function(t,e=!1){if(i)return void le("Cannot mutate a locked atom.","superAtom");const s="function"==typeof t?t(r.get()):t;a(n?Un(s):s,e)};const l=r.update;r.update=function(t,e=!1){if(i)le("Cannot mutate a locked atom.","superAtom");else{if(n)throw new Error("update() is not supported when freeze is enabled — use set() with a new value.");l(t,e)}};const c=r;return c.lock=function(t="default"){i=!0,o=t},c.unlock=function(t="default"){if(o!==t)throw new Error("Incorrect passcode. Cannot unlock atom.");i=!1},c.reset=function(){i||r.set(n?Un(Fn(s)):s)},c.freeze=function(){On(r.get())},c.name="superAtom",c}function Un(t){return"object"==typeof t&&null!==t?On(t):t}function Fn(t){try{return structuredClone(t)}catch{return t}}function Vn(t){const e=new Map,n=[],s=t=>JSON.stringify(t),i=t=>{e.delete(t);const s=n.indexOf(t);s>-1&&n.splice(s,1)};return{getCacheKey:s,removeCacheEntry:i,createCacheMethod:(o,r,a,l)=>async(...c)=>{const h=s(c),u=e.get(h);if(u){const e=Date.now();if(!(void 0!==t?.cacheDuration&&e-u.timestamp>t.cacheDuration)){const t=n.indexOf(h);return t>-1&&n.splice(t,1),n.push(h),o.set(u.result),r.set(null),a.set("success"),u.result}i(h)}const d=await l(this,c);e.set(h,{result:d,timestamp:Date.now()});const f=n.indexOf(h);if(f>-1&&n.splice(f,1),n.push(h),t?.cacheLimit&&n.length>t.cacheLimit){const t=n.shift();t&&e.delete(t)}return d},createClearCacheMethod:()=>(...t)=>{if(0===t.length)e.clear(),n.length=0;else{const e=s(t);i(e)}}}}function Wn(t){let e=null,n=null;const s=()=>{e&&(clearInterval(e),e=null,n=null)};return{createStartPollingMethod:i=>(...o)=>{t?.pollInterval?(s(),n=o,i(...o),e=setInterval(()=>{n&&i(...n)},t.pollInterval)):le(new Error("pollInterval not specified in asyncAction options"))},createStopPollingMethod:()=>s,stopPolling:s}}function Bn(t,e){e?.allowInRestrictedContext||ee("Async Action");const n={...{cacheLimit:10,pollInterval:5e3},...e};let s=t;const i=new Set;let o=null,r=null,a=null,l=null;const c=Vn(n),h=Wn(n),u=Nn(null),d=Nn(null),f=Nn(!1),p=Nn("init"),m=t=>{i.forEach(e=>{if(void 0===e.filter||void 0===t||e.filter===t)try{e.fn()}catch(t){le(t)}})},_=()=>{r?.isActive()&&(r.cancel(),r=null),o&&(o.abort(),o=null),f.set(!1),p.set("init")},g=async(t,e)=>{_(),f.set(!0),p.set("loading"),o=new AbortController;const n=o;try{let i;if(a){i=a((...e)=>s.call(t,...e),...e)}else i=s.call(t,...e);i?.__isZeroPromise__&&(r=i);let c=await i;if(n.signal.aborted||o!==n)throw new Error("Operation was cancelled");return l&&(c=l(c)),u.set(c),d.set(null),p.set("success"),m(!0),c}catch(t){if(n.signal.aborted||o!==n)throw t;const e=t instanceof Error?t:new Error(String(t));throw u.set(null),d.set(e),p.set("error"),m(!1),e}finally{o===n&&(o=null),f.set(!1),r&&!r.isActive()&&(r=null)}},y=async(...t)=>{const e=this;if(Ce()){const n=we(!1);Me();const s=g(e,t).catch(()=>{}).finally(()=>{Re()});return n?._ssrPromiseQueue&&n._ssrPromiseQueue.push(s),s}return g(e,t)},w=c.createCacheMethod(u,d,p,g),v=c.createClearCacheMethod(),b=h.createStartPollingMethod(y),S=h.createStopPollingMethod(),x=Object.assign(y,{data:u,error:d,isLoading:f,status:p,val:()=>s,set:t=>{s=t},params:{page:1},cancel:_,subscribe:(t,e)=>{ee("subscribe");const n={fn:t,filter:e};i.add(n);const s=()=>i.delete(n);return ve(t,s),s},cache:w,clearCache:v,startPolling:b,stopPolling:S,interceptBefore:t=>{a=t},interceptAfter:t=>{l=t},__isAsyncAction___:!0,__isAction___:!1});return Object.defineProperty(x,"abortController",{get:()=>o,enumerable:!0,configurable:!0}),ve(x,()=>{i.clear(),h.stopPolling(),_()}),x}const Hn=(t,e,n)=>{const s="timeout"===n?setTimeout(()=>t(),e):setInterval(()=>t(),e);return ve(s,"timeout"===n?()=>clearTimeout(s):()=>clearInterval(s)),s};class Yn{constructor(){this.timeoutId=null,this.pendingArgs=null,this.pendingContext=null}clearPending(){this.pendingArgs=null,this.pendingContext=null}setPending(t,e){this.pendingArgs=t,this.pendingContext=e}clearTimer(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}setTimer(t,e){this.timeoutId=((t,e)=>Hn(t,e,"timeout"))(t,e)}executePending(t){return this.pendingArgs&&(this.lastResult=t.apply(this.pendingContext,this.pendingArgs),this.clearPending()),this.lastResult}}function qn(t,e){return()=>{t.clearTimer(),t.clearPending(),e?.()}}function Xn(t,e){return()=>{if(t.pendingArgs&&t.timeoutId){t.clearTimer();return t.executePending(e)}return t.lastResult}}function Zn(t,e){const n=new Yn,s=function(...s){return n.setPending(s,this),n.clearTimer(),n.setTimer(()=>{n.lastResult=n.executePending(t),n.timeoutId=null},e),n.lastResult};return s.cancel=qn(n),s.flush=Xn(n,t),s}function Gn(t,e){const n=new Yn;let s=0;const i=function(...i){const o=Date.now(),r=o-s;return r>=e?(s=o,n.lastResult=t.apply(this,i),n.clearPending(),n.clearTimer()):(n.setPending(i,this),n.timeoutId||n.setTimer(()=>{s=Date.now(),n.lastResult=n.executePending(t),n.timeoutId=null},e-r)),n.lastResult};return i.cancel=qn(n,()=>{s=0}),i.flush=Xn(n,t),i}function Kn(...t){const[e,n]=t;return e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,e)=>{if(!n||!(e in n))throw new Error(`Missing parameter: "${e}"`);return String(n[e])})}let Qn=null,Jn=null;function ts(){return Qn}function es(){return Jn}class ns{constructor(){this.state="idle",this.__isZeroPromise__=!0,this.toActive()}isActive(){return"active"===this.state}isResolved(){return"resolved"===this.state}isRejected(){return"rejected"===this.state}isCancelled(){return"cancelled"===this.state}get signal(){return this.controller.signal}toActive(){return"active"===this.state||(this.state="active",this.controller=new AbortController,this.promise=new Promise((t,e)=>{this.resolveFn=t,this.rejectFn=e,this.controller.signal.addEventListener("abort",()=>{"active"===this.state&&(this.state="cancelled",e(new DOMException("Cancelled","AbortError")))})})),this}resolve(t){this.isActive()&&(this.state="resolved",this.resolveFn(t))}reject(t){this.isActive()&&(this.state="rejected",this.rejectFn(t))}cancel(t){this.isActive()&&this.controller.abort(t)}then(t,e){return this.promise.then(t,e)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}get[Symbol.toStringTag](){return"ZeroPromise"}}const ss={100:"CONTINUE",101:"SWITCHING_PROTOCOLS",102:"PROCESSING",103:"EARLY_HINTS",200:"OK",201:"CREATED",202:"ACCEPTED",203:"NON_AUTHORITATIVE_INFORMATION",204:"NO_CONTENT",205:"RESET_CONTENT",206:"PARTIAL_CONTENT",207:"MULTI_STATUS",208:"ALREADY_REPORTED",226:"IM_USED",300:"MULTIPLE_CHOICES",301:"MOVED_PERMANENTLY",302:"FOUND",303:"SEE_OTHER",304:"NOT_MODIFIED",305:"USE_PROXY",307:"TEMPORARY_REDIRECT",308:"PERMANENT_REDIRECT",400:"BAD_REQUEST",401:"UNAUTHORIZED",402:"PAYMENT_REQUIRED",403:"FORBIDDEN",404:"NOT_FOUND",405:"METHOD_NOT_ALLOWED",406:"NOT_ACCEPTABLE",407:"PROXY_AUTHENTICATION_REQUIRED",408:"REQUEST_TIMEOUT",409:"CONFLICT",410:"GONE",411:"LENGTH_REQUIRED",412:"PRECONDITION_FAILED",413:"PAYLOAD_TOO_LARGE",414:"URI_TOO_LONG",415:"UNSUPPORTED_MEDIA_TYPE",416:"RANGE_NOT_SATISFIABLE",417:"EXPECTATION_FAILED",418:"IM_A_TEAPOT",421:"MISDIRECTED_REQUEST",422:"UNPROCESSABLE_ENTITY",423:"LOCKED",424:"FAILED_DEPENDENCY",425:"TOO_EARLY",426:"UPGRADE_REQUIRED",428:"PRECONDITION_REQUIRED",429:"TOO_MANY_REQUESTS",431:"REQUEST_HEADER_FIELDS_TOO_LARGE",451:"UNAVAILABLE_FOR_LEGAL_REASONS",500:"INTERNAL_SERVER_ERROR",501:"NOT_IMPLEMENTED",502:"BAD_GATEWAY",503:"SERVICE_UNAVAILABLE",504:"GATEWAY_TIMEOUT",505:"HTTP_VERSION_NOT_SUPPORTED",506:"VARIANT_ALSO_NEGOTIATES",507:"INSUFFICIENT_STORAGE",508:"LOOP_DETECTED",510:"NOT_EXTENDED",511:"NETWORK_AUTHENTICATION_REQUIRED"};function is(t){const{url:e="",host:n="",path:s,params:i={}}=t,o=e||s||"",r=/^https?:\/\//i.test(o)?o:`${n}${o}`,{pathParams:a,qsParams:l}=function(t,e){const n=new Set;for(const[,e]of t.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))n.add(e);const s={},i={};for(const[t,o]of Object.entries(e))n.has(t)?s[t]=o:i[t]=o;return{pathParams:s,qsParams:i}}(r,i),c=Object.keys(a).length>0?Kn(r,a):r;if(0===Object.keys(l).length)return c;let h,u;if(/^https?:\/\//i.test(c)){const t=new URL(c);h=t.origin+t.pathname,u=t.search}else{const t=c.indexOf("?");h=-1===t?c:c.slice(0,t),u=-1===t?"":c.slice(t)}const d=new URLSearchParams(u);for(const[t,e]of Object.entries(l))null!=e&&(Array.isArray(e)?e.forEach(e=>d.append(t,String(e))):d.set(t,String(e)));const f=d.toString();return f?`${h}?${f}`:h}const os=new Set,rs=new Set,as=new Set;class ls{constructor(t={},e,n,s){this.instanceBeforeFns=[],this.instanceAfterFns=[],this.instanceErrorFns=[],this.baseRequest=t,this._scopeBeforeFns=e,this._scopeAfterFns=n,this._scopeErrorFns=s}interceptBefore(t){return this.instanceBeforeFns.push(t),()=>{const e=this.instanceBeforeFns.indexOf(t);-1!==e&&this.instanceBeforeFns.splice(e,1)}}interceptAfter(t){return this.instanceAfterFns.push(t),()=>{const e=this.instanceAfterFns.indexOf(t);-1!==e&&this.instanceAfterFns.splice(e,1)}}interceptError(t){return this.instanceErrorFns.push(t),()=>{const e=this.instanceErrorFns.indexOf(t);-1!==e&&this.instanceErrorFns.splice(e,1)}}clearInterceptors(){this.instanceBeforeFns.length=0,this.instanceAfterFns.length=0,this.instanceErrorFns.length=0}get _beforeFns(){return this._scopeBeforeFns??os}get _afterFns(){return this._scopeAfterFns??rs}get _errorFns(){return this._scopeErrorFns??as}fetch(t){const e=new ns,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:o,params:r,path:a,...l}=n,c=is(n),h=function(t){return null==t?{}:"string"==typeof t||t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof URLSearchParams||t instanceof ReadableStream?{body:t}:{body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}}(s),u=(n.method??"GET").toUpperCase(),d=ts(),f=es();if(Ce()&&d){let t;try{t=c.startsWith("http")?new URL(c).pathname:c.split("?")[0]}catch{t=c.split("?")[0]}if(t.startsWith("/api")){const s=d(u,t);if(s){Me();const t={"content-type":"application/json",...l.headers,...h.headers};if(f){const e=f.headers.get("cookie"),n=f.headers.get("authorization");e&&(t.cookie=e),n&&(t.authorization=n)}const i=new Request(c.startsWith("http")?c:`http://localhost${c}`,{method:u,headers:t,body:h.body??null}),o=(()=>{const t=n.params||{},e=n.url||n.path||"",s=/^https?:\/\//i.test(e)?e:`${n.host||""}${e}`,i={};for(const[,e]of s.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))e in t&&(i[e]=String(t[e]));return i})(),r={...s.ctx,params:{...o,...s.ctx?.params||{}}};return s.handler(i,r).then(async t=>{if(!t.ok){const n=ss[t.status]||"UNKNOWN_ERROR";return e.reject(new Error(`${n}: ${t.statusText}`)),void Re()}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t),Re()}).catch(t=>{e.reject(t),Re()}),e}}}return(async()=>{let t,n=c,s={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(s.headers).length&&delete s.headers;for(const t of this.instanceBeforeFns){const e=await t(n,s);n=e.url,s=e.options}for(const t of this._beforeFns){const e=await t(n,s);n=e.url,s=e.options}try{t=await fetch(n,{...s,signal:e.signal})}catch(t){for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of this._errorFns)try{e(t)}catch(t){}return void e.reject(t)}let i=t;for(const t of this.instanceAfterFns)i=await t(i);for(const t of this._afterFns)i=await t(i);if(!i.ok){const t=ss[i.status]||"UNKNOWN_ERROR",n=new Error(`${t}: ${i.statusText}`);for(const t of this.instanceErrorFns)try{t(n)}catch(t){}for(const t of this._errorFns)try{t(n)}catch(t){}return void e.reject(n)}const o=i.headers.get("content-type");if(o?.includes("application/json")){const t=await i.json();if(t&&"object"==typeof t&&"Redirect"===t.__type&&"string"==typeof t.url){const n=t.url;return"undefined"!=typeof window&&(window.location.href=n),void e.resolve(void 0)}e.resolve(t)}else e.resolve(i)})().catch(t=>e.reject(t)),e}Fetch(t){return this.fetch(t)}Get(t){return this.fetch({...t,method:"GET"})}Post(t){return this.fetch({...t,method:"POST"})}Put(t){return this.fetch({...t,method:"PUT"})}Patch(t){return this.fetch({...t,method:"PATCH"})}Delete(t){return this.fetch({...t,method:"DELETE"})}fetchAction(t){const{baseRequest:e,options:n}=function(t){if(!t)return{baseRequest:{},options:{}};const{cacheDuration:e,cacheLimit:n,pollInterval:s,allowInRestrictedContext:i,...o}=t;return{baseRequest:o,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Bn(t=>this.fetch({...e,params:{...e.params,...t}}),n)}getAction(t){return this.fetchAction({...t,method:"GET"})}postAction(t){return this.fetchAction({...t,method:"POST"})}putAction(t){return this.fetchAction({...t,method:"PUT"})}patchAction(t){return this.fetchAction({...t,method:"PATCH"})}deleteAction(t){return this.fetchAction({...t,method:"DELETE"})}}const cs=new ls({});function hs(t){return t.startsWith("--")?t:`--${t}`}function us(t,e){let n="";for(const t in e){n+=` ${hs(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function ds(t){if(null==t)return{action:"remove"};if("boolean"==typeof t)return t?{action:"set",value:""}:{action:"remove"};if("string"==typeof t)return{action:"set",value:t};if("number"==typeof t)return{action:"set",value:String(t)};if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?"boolean"==typeof n?n?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(n)}:{action:"remove"}}if(3===t.length){const[e,n,s]=t,i=e?n:s;return"boolean"==typeof i?i?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(i)}}}return{action:"remove"}}function fs(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ps(t){if(null==t||!1===t)return null;if("string"==typeof t)return t;if("number"==typeof t)return String(t);if(Array.isArray(t)){if(2===t.length){const[e,n]=t;return e?String(n):null}if(3===t.length){const[e,n,s]=t;return String(e?n:s)}}return null}const ms=new WeakMap,_s=new WeakMap,gs=new WeakMap,ys=new WeakMap;class ws{constructor(t){this.el=t}attr(t){const e=this.el;ms.has(e)||ms.set(e,new Map);const n=ms.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=ds(o);"set"===t.action?(n.get(i)!==t.value&&e.setAttribute(i,t.value),s.set(i,t.value)):n.has(i)&&e.removeAttribute(i)}for(const t of n.keys())s.has(t)||e.removeAttribute(t);return ms.set(e,s),this}updateAttr(t){const e=this.el;ms.has(e)||ms.set(e,new Map);const n=ms.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,o]of Object.entries(s))n.get(t)!==o&&e.setAttribute(t,o),i.set(t,o);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return ms.set(e,i),this}style(t){const e=this.el;_s.has(e)||_s.set(e,new Map);const n=_s.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=ps(o),r=fs(i);null!==t?(n.get(r)!==t&&e.style.setProperty(r,t),s.set(r,t)):n.has(r)&&e.style.removeProperty(r)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return _s.set(e,s),this}classes(t){const e=this.el;gs.has(e)||gs.set(e,new Set);const n=gs.get(e),s=function(t){const e=new Set,n=t=>{for(const n of t.split(/\s+/))n&&e.add(n)};if("string"==typeof t)return n(t),e;if(Array.isArray(t)){for(const e of t)if(e||0===e)if("string"!=typeof e){if(Array.isArray(e))if(2===e.length){const[t,s]=e;t&&s&&n(s)}else if(3===e.length){const[t,s,i]=e;n(t?s:i)}}else n(e);return e}if("object"==typeof t&&null!==t)for(const[e,s]of Object.entries(t))s&&n(e);return e}(t);for(const t of s)n.has(t)||e.classList.add(t);for(const t of n)s.has(t)||e.classList.remove(t);return gs.set(e,s),this}addClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.add(n);return this}removeClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.remove(n);return this}toggleClass(t,e){const n=this.el;for(const s of t.split(/\s+/))s&&n.classList.toggle(s,e);return this}html(t){if(null==t)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return F(t,this.el),this}text(t){return this.el.textContent=String(t),this}focus(t){return this.el.focus(t),this}blur(){return this.el.blur(),this}scroll(t){const e=this.el;return"string"==typeof t?e.scrollTo({top:0,behavior:t}):t?e.scrollTo(t):e.scrollTo({top:0}),this}scrollIntoView(t){return this.el.scrollIntoView(t),this}measure(t){const e=this.el.getBoundingClientRect();return t({width:e.width,height:e.height,top:e.top,left:e.left,right:e.right,bottom:e.bottom,x:e.x,y:e.y}),this}on(t,e,n){const s=this.el;ys.has(s)||ys.set(s,new Map);const i=ys.get(s),o=i.get(t);o&&s.removeEventListener(t,o.handler,o.options);const r=e;return s.addEventListener(t,r,n),i.set(t,{handler:r,options:n}),this}off(t,e){const n=this.el,s=ys.get(n);if(!s)return this;if(e){const i=s.get(t);i&&i.handler===e&&(n.removeEventListener(t,i.handler,i.options),s.delete(t))}else{const e=s.get(t);e&&(n.removeEventListener(t,e.handler,e.options),s.delete(t))}return this}once(t,e,n){const s="object"==typeof n?{...n,once:!0}:{once:!0};return this.el.addEventListener(t,e,s),this}delegate(t,e,n,s){const i=t=>{const s=t.target?.closest(e);s&&this.el.contains(s)&&n(t,s)};return this.el.addEventListener(t,i,s),ys.has(this.el)||ys.set(this.el,new Map),ys.get(this.el).set(`${t}:delegate:${e}`,{handler:i,options:s}),this}aria(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,String(s))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,i=n.startsWith("data-")?n:`data-${n}`;null==s?e.removeAttribute(i):e.setAttribute(i,String(s));const o=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[o]:e.dataset[o]=String(s)}return this}}function vs(t){if(null!==t&&"object"==typeof t&&!0===t.__isMatesRef__){const e=t;if(void 0===e.value)throw new Error("$(ref): the ref has no element attached yet (ref.value is undefined).\nDOM manipulation via $() must happen after the element has mounted.\nUse one of the lifecycle hooks where the element is guaranteed to exist:\n • onMount() — runs once after the component's first render\n • onPaint() — runs after the browser has painted\n • onUpdate() — runs after every subsequent re-render\n\nExample:\n const inputRef = ref<HTMLInputElement>();\n onMount(() => { $(inputRef).focus(); });");return new ws(e.value)}return new ws(t)}function bs(t,e){return"function"!=typeof t.animate?Promise.resolve():("function"==typeof t.getAnimations&&t.getAnimations().forEach(t=>t.cancel()),new Promise(n=>{const s=t.animate(e.keyframes,{duration:300,easing:"ease",fill:"both",...e.options});s.onfinish=()=>n(),s.oncancel=()=>n()}))}async function Ss(t){const{el:e,exit:n,enter:s,swap:i,getEl:o,isStale:r}=t;if(!e)return void i();if(await bs(e,n),r?.())return;if(i(),await("function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t())))),r?.())return;const a=o?.()??e;a&&await bs(a,s)}function xs(t){return t.__isEffect__=!0,zn({name:"Effect",fn:t,onRun:()=>{},supportsCleanup:!0})}const Cs=new WeakMap,Es=q(class extends dt{render(t){return E}update(t,[e]){const n=e!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),E}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.Y){const e=this.ht??globalThis;let n=Cs.get(e);void 0===n&&(n=new WeakMap,Cs.set(e,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return"function"==typeof this.Y?Cs.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function As(){const t=new me;let e;const n={get value(){return e},__subscribe:e=>t.subscribe(e),__isMatesRef__:!0,__set:n=>{e!==n&&(e=n,t.trigger(n))}};return n}function ks(t){if(t&&t.__isMatesRef__){const e=t;return Es(t=>{e.__set(t)})}return Es(t)}function Ms(t,e){return t.add(e),()=>t.delete(e)}class Rs{constructor(){this._beforeFns=new Set,this._afterFns=new Set,this._errorFns=new Set,this.fetchClient=new ls({},this._beforeFns,this._afterFns,this._errorFns)}interceptBefore(t){return Ms(this._beforeFns,t)}interceptAfter(t){return Ms(this._afterFns,t)}interceptError(t){return Ms(this._errorFns,t)}clearInterceptors(){this._beforeFns.clear(),this._afterFns.clear(),this._errorFns.clear()}}const Ts=()=>{if("undefined"==typeof window)return{};const t=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,e=new URLSearchParams(t),n={};for(const[t,s]of e)try{n[t]=JSON.parse(s)}catch{n[t]=s}return n};function $s(t){const e=Nn(Ts());let n=!1;xs(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+window.location.search+(n?`#${n}`:"");window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(Ts()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("hashchange",s),e}const Os=()=>{if("undefined"==typeof window)return{};const t=new URLSearchParams(window.location.search),e={};for(const[n,s]of t)try{e[n]=JSON.parse(s)}catch{e[n]=s}return e};function Is(t){const e=Nn(Os());let n=!1;xs(()=>{const s=e();n||t()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const s=t[n];null!=s&&e.set(n,"object"==typeof s?JSON.stringify(s):String(s))}const n=e.toString(),s=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(null,"",s)})(s)});const s=()=>{t()||(n=!0,e.set(Os()),n=!1)};return"undefined"!=typeof window&&window.addEventListener("popstate",s),e}function Ps(t){return new Promise(e=>{const n=()=>{t?.(),e()};Ce()?queueMicrotask(n):"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>n(),{timeout:300}):requestAnimationFrame(n)})}class zs{constructor(){this.navigationLocked=Nn(!1),this.navigationRequestEvent=be("router:navigation-request"),this.historyStateAtom=Nn("undefined"!=typeof window?window.history.state:null),this.pathAtom=function(t,e,n){const s=jn("undefined"!=typeof window?window.location.pathname:"/");function i(t){t.preventDefault(),t.returnValue=""}return xs(()=>(t()?"undefined"!=typeof window&&window.addEventListener("beforeunload",i):"undefined"!=typeof window&&window.removeEventListener("beforeunload",i),()=>{"undefined"!=typeof window&&window.removeEventListener("beforeunload",i)})),"undefined"!=typeof window&&(window.addEventListener("popstate",i=>{if(t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);const o=window.location.pathname;if(o!==s.get()&&n.trigger({to:o,from:s.get()}),t())return window.history.pushState(window.history.state,"",s.get()),void e.set(window.history.state??null);e.set(i.state??null),o!==s.get()&&s.set(o)}),window.addEventListener("hashchange",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)}),window.addEventListener("navigate",()=>{if(t())return;const e=window.location.pathname;e!==s.get()&&s.set(e)})),s}(this.navigationLocked,this.historyStateAtom,this.navigationRequestEvent),this.qsAtom=Is(this.navigationLocked),this.hashAtom=$s(this.navigationLocked)}navigateTo(t,e,n){var s,i,o,r;(s=this.pathAtom,i=this.navigationLocked,o=this.historyStateAtom,r=this.navigationRequestEvent,function(t,e,n){if(i())return;if(t===s.get())return;const a=t.includes("?"),l=t.includes("#");let c=t;if(a||l)if(l){if(!a){const e=t.indexOf("#");c=t.slice(0,e)+window.location.search+t.slice(e)}}else c=t+window.location.hash;else c=t+window.location.search+window.location.hash;r.trigger({to:t,from:s.get()}),i()||(o.set(n??null),e?window.history.replaceState(n,"",c):window.history.pushState(n,"",c),s.set(t))})(t,e,n)}lockNavigation(){this.navigationLocked.set(!0)}unlockNavigation(){this.navigationLocked.set(!1)}get location(){return t=this.pathAtom,e=this.hashAtom,n=this.qsAtom,{get path(){return t.get()},get hash(){return e()},get qsObj(){return n()}};var t,e,n}onNavigationRequest(t){if(Ce())return;ze();let e=!1;const n=this.navigationRequestEvent.__subscribe(n=>{if(e)return;const{to:s,from:i}=n;this.lockNavigation();let o=!1;const r=t({to:s,from:i,next:()=>{o||(o=!0,e=!0,this.unlockNavigation(),Ps(()=>{this.navigateTo(s),e=!1}))}});r instanceof Promise?r.then(()=>{o||this.unlockNavigation()}).catch(()=>{o||this.unlockNavigation()}):o||this.unlockNavigation()});ve(t,n)}}const Ds="mates";function Ns(t,e){try{null===e?t.removeItem(Ds):t.setItem(Ds,JSON.stringify(e))}catch{}}function Ls(t,e){const n=Nn((()=>{try{return function(t){try{const e=t.getItem(Ds);if(e)return JSON.parse(e)}catch{}return null}(t())}catch{return null}})()),s=n.set;n.set=function(e,i=!1){s(e,i);try{Ns(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{Ns(t(),n.get())}catch{}}},e(t=>{if(t.key===Ds)if(t.newValue)try{s(JSON.parse(t.newValue))}catch{}else s(null)}),Object.defineProperty(n,"name",{value:"storageAtom",writable:!0,configurable:!0,enumerable:!1}),n}function js(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}class Us{constructor(){this.lsAtom=Ls(()=>localStorage,t=>js(e=>{e.storageArea===localStorage&&t(e)})),this.ssAtom=Ls(()=>sessionStorage,t=>js(e=>{e.storageArea===sessionStorage&&t(e)}))}}const Fs="mates-theme";function Vs(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}const Ws=function(){const t=Nn(function(){try{const t=localStorage.getItem(Fs);return"light"===t||"dark"===t||"auto"===t?t:null}catch{return null}}()??"auto",{skipRestrictedContextCheck:!0}),e=t;if(e.setToLight=()=>{t.set("light")},e.setToDark=()=>{t.set("dark")},e.setToAuto=()=>{t.set("auto")},e.toggle=()=>{const e=Vs(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>Vs(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),xs(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",Vs(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(Fs):localStorage.setItem(Fs,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia)try{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")})}catch{}return e};class Bs{constructor(){this.themeAtom=Ws(),this.titleAtom=function(){const t=Nn("undefined"!=typeof document?document.title:"");return xs(()=>{"undefined"!=typeof document&&(document.title=t.get())}),t}()}}class Hs{constructor(){this._router=new zs,this._fetch=new Rs,this._storage=new Us,this._theme=new Bs}get pathAtom(){return this._router.pathAtom}get qsAtom(){return this._router.qsAtom}get hashAtom(){return this._router.hashAtom}get historyStateAtom(){return this._router.historyStateAtom}get navigationLocked(){return this._router.navigationLocked}get navigationRequestEvent(){return this._router.navigationRequestEvent}get location(){return this._router.location}navigateTo(t,e,n){return this._router.navigateTo(t,e,n)}lockNavigation(){return this._router.lockNavigation()}unlockNavigation(){return this._router.unlockNavigation()}onNavigationRequest(t){return this._router.onNavigationRequest(t)}get fetchClient(){return this._fetch.fetchClient}interceptBefore(t){return this._fetch.interceptBefore(t)}interceptAfter(t){return this._fetch.interceptAfter(t)}interceptError(t){return this._fetch.interceptError(t)}clearInterceptors(){return this._fetch.clearInterceptors()}get lsAtom(){return this._storage.lsAtom}get ssAtom(){return this._storage.ssAtom}get themeAtom(){return this._theme.themeAtom}get titleAtom(){return this._theme.titleAtom}}const Ys=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,qs=t=>"function"==typeof t,Xs=t=>"AsyncFunction"===t.constructor.name,Zs=(t,e,n,s)=>{if(Ys(t)){const i=t,o=Nn(i(),s),r=n(o.set,e),a=n(o.update,e);return o.set=r,o.update=a,i.__subscribe(()=>{Ie.schedule(()=>o.set(i()))}),ve(o,()=>{r.cancel(),a.cancel()}),o}const i=Nn(t,s),o=n(i.set,e),r=n(i.update,e);return i.set=o,i.update=r,ve(i,()=>{o.cancel(),r.cancel()}),i};const Gs=(t=[],e)=>{const n=new Map(t),s=Nn(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const o=n.delete.bind(n);n.delete=t=>{const e=o(t);return s.update(()=>{}),e};const r=n.clear.bind(n);n.clear=()=>{r(),s.update(()=>{})};const a=n.get.bind(n);n.get=t=>(s.get(),a(t));const l=n.has.bind(n);n.has=t=>(s.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(s.get(),h());const u=n.values.bind(n);n.values=()=>(s.get(),u());const d=n.keys.bind(n);n.keys=()=>(s.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),p()),n.update=t=>{const e={set:(t,n)=>(i(t,n),e),delete:t=>o(t),clear:()=>{r()},get:t=>a(t),has:t=>l(t),entries:()=>h(),values:()=>u(),keys:()=>d(),forEach:(t,e)=>f(t,e),[Symbol.iterator]:()=>p(),get size(){return c.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>{const i=a(t);return null==i||"object"!=typeof i||(e(i),s.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n};function Ks(t,e=2){let n=parseFloat(String(t).trim());Number.isFinite(n)||(n=0);const s=10**e;return Math.round(n*s)/s}function Qs(t,e,n){const s=jn(t,{skipRestrictedContextCheck:!0,...n}),i=jn([],{skipRestrictedContextCheck:!0,...n});function o(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const r=s.set;s.set=function(t,e=!1){r(t,e),o()};const a=s.update;s.update=function(t,e=!1){a(t,e),o()};const l=s;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>i.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===i.get().length,enumerable:!1,configurable:!0}),l.validate=o,l.toFloat=()=>Ks(s.get()),l.toFloatString=()=>Ks(s.get()).toString(),l.toValidNumber=()=>function(t){const e=Number(t);return Number.isFinite(e)?e:0}(s.get()),Object.defineProperty(l,"name",{value:"formAtom",writable:!0,configurable:!0,enumerable:!1}),l}function Js(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ti(t){return null==t||("string"==typeof t||Array.isArray(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"object"==typeof t&&0===Object.keys(t).length)}function ei(t){const e=new Set,n=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];let s=t;for(;s&&!n.includes(s);){for(const t of Reflect.ownKeys(s))"constructor"!==t&&e.add(t);s=Object.getPrototypeOf(s)}return Array.from(e)}const ni=t=>{const e=we();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;te.viewOuterInProgress=!0;try{n=new t}finally{te.viewOuterInProgress=!1}const s=te.setupInProgress;try{if((()=>{ei(n).forEach(t=>{const e=Object.getOwnPropertyDescriptor(n,t)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),t);if(e&&(e.get||e.set))return;const s=n[t];"function"!=typeof s||s.__version__||(n[t]=s.bind(n))})})(),"function"==typeof n.setup){Xs(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),te.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{te.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{te.setupInProgress=s}return n},si=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}}),s=we(!1);if(s)try{s.dispatchEvent(n)}catch{s.scopes?.has(t)&&(e=s.scopes.get(t))}else if("undefined"!=typeof document){const t=document.querySelector("x-view");t&&t.dispatchEvent(n)}if(e)return e;throw new Error(`No parent scope found for ${t.name}`)},ii=new Set;function oi(){return[...ii]}function ri(t,e){let n=t;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=Object.getPrototypeOf(n)}}const ai=(t,e,n)=>{const s=ei(t);s.forEach(s=>{const i=ri(t,s);if(i?.get){let n,o=-1;const r=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==o&&(o=s,n=r.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(qs(t[s])){if(Xs(t[s]))throw new Error(`Async functions are not supported inside ${n}`);const i=t[s];t[s]=(...n)=>{e.update(()=>i.apply(t,n))}}});const i=Object.create(t);return s.forEach(n=>{const s=ri(t,n);if(!s)return;const o=!!s.get,r=!o&&qs(s.value);o||r||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i},li=(t,e={})=>S`<x-view .view=${t} .props=${e}></x-view>`,ci=li,hi=li,ui=(t,e)=>F(li(di,{viewFn:t}),e),di=t=>{ni(zs),ni(Rs),ni(Us),ni(Bs),ni(Hs);for(const t of oi())ni(t);const e=t().viewFn;return()=>li(e)},fi=ui,pi=t=>{const e=As(),n=t().condition,s=Nn(n),i=Nn(n);return xs(()=>{const n=i();if(n===s.get())return;const o=e.value;if(!o)return void s.set(n);const r=t().config;Ss({el:o,exit:r?.exit??Rn(200),enter:r?.enter??Mn(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Ne(()=>{const n=e.value;if(!n)return;const s=t().config;bs(n,s?.enter??Mn(250))}),()=>{const n=s(),{condition:o,trueTpl:r,falseTpl:a}=t();return i.get()!==o&&i.set(o),S`
100
100
  <div ${ks(e)} style="position:relative">
101
101
  ${n?r:a}
102
102
  </div>