mates 0.1.0-beta.6 → 0.1.0-beta.8

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.esm.js CHANGED
@@ -1,16 +1,22 @@
1
- import{render as t,html as e,nothing as n,noChange as i}from"lit-html";export{html,noChange,nothing,render,svg}from"lit-html";export{unsafeHTML}from"lit-html/directives/unsafe-html.js";export{asyncAppend}from"lit-html/directives/async-append.js";export{asyncReplace}from"lit-html/directives/async-replace.js";export{cache as litCache}from"lit-html/directives/cache.js";export{classMap}from"lit-html/directives/class-map.js";export{guard}from"lit-html/directives/guard.js";export{ifDefined}from"lit-html/directives/if-defined.js";export{join}from"lit-html/directives/join.js";export{keyed}from"lit-html/directives/keyed.js";export{live}from"lit-html/directives/live.js";export{range}from"lit-html/directives/range.js";import{repeat as s}from"lit-html/directives/repeat.js";export{repeat}from"lit-html/directives/repeat.js";export{styleMap}from"lit-html/directives/style-map.js";export{until}from"lit-html/directives/until.js";export{when}from"lit-html/directives/when.js";import{ref as r}from"lit-html/directives/ref.js";import{AsyncDirective as o}from"lit-html/async-directive.js";import{directive as a,PartType as l,Directive as c}from"lit-html/directive.js";const h=()=>{},u={registerComponent:h,unregisterComponent:h,notifyRender:h,getComponentName:()=>"Anonymous",logComponentMount:h,logComponentRender:h,logComponentUnmount:h,logAtomSet:h,logAtomUpdate:h,logEventTrigger:h,logCleanupEventTrigger:h,logFetchRequest:h,logFetchResponse:h,logFetchError:h,recordRender:h};function d(t,e){u.registerComponent(t,e)}function f(t){return u.getComponentName(t)}function p(t,e){u.logEventTrigger(t,e)}function m(t,e,n){u.recordRender(t,e,n)}function _(t){t.registerComponent&&(u.registerComponent=t.registerComponent),t.unregisterComponent&&(u.unregisterComponent=t.unregisterComponent),t.notifyRender&&(u.notifyRender=t.notifyRender),t.getComponentName&&(u.getComponentName=t.getComponentName),t.logComponentMount&&(u.logComponentMount=t.logComponentMount),t.logComponentRender&&(u.logComponentRender=t.logComponentRender),t.logComponentUnmount&&(u.logComponentUnmount=t.logComponentUnmount),t.logAtomSet&&(u.logAtomSet=t.logAtomSet),t.logAtomUpdate&&(u.logAtomUpdate=t.logAtomUpdate),t.logEventTrigger&&(u.logEventTrigger=t.logEventTrigger),t.logCleanupEventTrigger&&(u.logCleanupEventTrigger=t.logCleanupEventTrigger),t.logFetchRequest&&(u.logFetchRequest=t.logFetchRequest),t.logFetchResponse&&(u.logFetchResponse=t.logFetchResponse),t.logFetchError&&(u.logFetchError=t.logFetchError),t.recordRender&&(u.recordRender=t.recordRender)}function g(){return u.registerComponent!==h}let y=!1,w=new Set,v=!1;function b(){return y}function S(){return w}function E(){return v}function C(t){w.add(t)}function M(){v=!0}function k(){v=!1}function x(){const t={prevEnabled:y,prevStores:w};return y=!0,w=new Set,t}function A(t){const e=w;return y=t.prevEnabled,w=t.prevStores,e}const R=x,O=A,z={setupInProgress:!1,templateInProgress:!1,viewOuterInProgress:!1,isHookRunning:!1};function T(){return!z.isHookRunning&&(z.templateInProgress||E())}function I(t){if(!z.isHookRunning){if(z.templateInProgress)throw new Error(`${t} cannot be created during template function execution. Only scopes (useScope) are allowed in templates.`);if(E())throw new Error(`${t} cannot be created inside a memo() or effect(). They should only read state, not create new reactive primitives.`)}}function P(t){if(!z.viewOuterInProgress){if(z.templateInProgress)throw new Error(`${t} cannot be called during template function execution. Move it to the component's outer function.`);if(E())throw new Error(`${t} cannot be called inside a memo() or effect(). Move it to the component's outer function.`);throw new Error(`${t} must be called inside a component's outer function. It cannot be used at module level or inside inner functions (e.g. event handlers, timers, or callbacks).`)}}function D(t,e){(function(){if("undefined"==typeof window)return!0;const t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local")})()&&(e?console.error(`[${e}]`,t):console.error(t))}function L(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)}function j(t,e,n,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(t,n):s?s.value=n:e.set(t,n),n}var N,$,U;"function"==typeof SuppressedError&&SuppressedError;class F{constructor(){N.set(this,new Set),$.set(this,1)}subscribe(t){return L(this,N,"f").add(t),()=>L(this,N,"f").delete(t)}notify(){var t;j(this,$,(t=L(this,$,"f"),++t),"f"),[...L(this,N,"f")].forEach(t=>{try{t?.()}catch(t){console.error(t)}})}getVersion(){return L(this,$,"f")}get subscriberCount(){return L(this,N,"f").size}clear(){L(this,N,"f").clear()}}N=new WeakMap,$=new WeakMap;class V{constructor(){U.set(this,new Set)}subscribe(t){return I("subscribe"),L(this,U,"f").has(t)?()=>{}:(L(this,U,"f").add(t),()=>L(this,U,"f").delete(t))}trigger(t){L(this,U,"f").forEach(e=>{try{e(t)}catch(t){console.error("Error in event handler:",t)}})}get handlerCount(){return L(this,U,"f").size}clear(){L(this,U,"f").clear()}}U=new WeakMap;const W=[];function Y(t,e){W.push(t);let n=null;try{n=e()}finally{W.pop()}return n}function H(t){const e=W[W.length-1];if(!e){if(!1!==t)throw new Error("getCurrentHost(): No active host context");return null}return e}let B=!1;function q(t){B=t}function G(){return B}function X(t){t.DOMReadyEvent?.cleanupAndClearSubs(),t.PaintEvent?.cleanupAndClearSubs(),t.cleanups.forEach(t=>t.forEach(t=>{try{t()}catch(t){console.error("Error during cleanup:",t)}})),t.cleanups.clear(),t.onEachUpdateCallbacks.clear(),t.scopes=new Map,t._templateFn=null,t._xviewRender=()=>{},t._hasMounted=!1,t._errorState=null,t._errorHandlers=[]}const Z=new class{constructor(){this.pending=new Set,this.isScheduled=!1}scheduleDisconnect(t){this.pending.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}cancelDisconnect(t){this.pending.delete(t)}flush(){const t=Array.from(this.pending);this.pending.clear(),this.isScheduled=!1;for(const e of t)e.isConnected||(X(e),e._view=null,e._props={},e.oldView=void 0)}reset(){this.pending.clear(),this.isScheduled=!1}},J=new class{constructor(){this.pendingEffects=new Set,this.isScheduled=!1,this._isFlushing=!1}get isFlushing(){return this._isFlushing}reset(){this.pendingEffects.clear(),this.isScheduled=!1,this._isFlushing=!1}schedule(t){this.pendingEffects.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this._isFlushing=!0;let t=0;for(;this.pendingEffects.size>0;){if(t++>=500){this.pendingEffects.clear(),console.error("EffectScheduler: Maximum iteration limit (500) reached. This likely means an effect is infinitely updating its own dependency. Remaining effects have been dropped.");break}const e=Array.from(this.pendingEffects);this.pendingEffects.clear();for(const t of e)try{t()}catch(t){D(t,"Effect")}}this._isFlushing=!1,this.isScheduled=!1,Q.flush()}},Q=new class{constructor(){this.pendingComponents=new Set,this.nextPendingComponents=new Set,this._currentWave=new Set,this.isScheduled=!1,this._isFlushing=!1,this._flushVersion=0,this._onIdleCallbacks=[]}get flushVersion(){return this._flushVersion}onceIdle(t){this._onIdleCallbacks.push(t),this._isFlushing||this.isScheduled||queueMicrotask(()=>this._drainIdleCallbacks())}_drainIdleCallbacks(){if(this._isFlushing||this.isScheduled)return;if(this.pendingComponents.size>0||this.nextPendingComponents.size>0)return;const t=this._onIdleCallbacks.splice(0);for(const e of t)try{e()}catch(t){console.error(t)}}reset(){this.pendingComponents.clear(),this.nextPendingComponents.clear(),this._currentWave.clear(),this._onIdleCallbacks.length=0,this.isScheduled=!1,this._isFlushing=!1}schedule(t){if(this._isFlushing){if(this._currentWave.has(t)&&t._renderVersion!==this._flushVersion)return;this.nextPendingComponents.add(t)}else this.pendingComponents.add(t);this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{J.isScheduled||J.isFlushing||this.flush()}))}flush(){for(this.nextPendingComponents.size>0&&(this.nextPendingComponents.forEach(t=>this.pendingComponents.add(t)),this.nextPendingComponents.clear()),this._isFlushing=!0,this._flushVersion++;this.pendingComponents.size>0;){const t=Array.from(this.pendingComponents);this.pendingComponents.clear(),t.sort((t,e)=>t._depth-e._depth),this._currentWave=new Set(t);for(const e of t)if(e.isConnected)try{e._render()}catch(t){D(t,"Component render")}this._currentWave.clear()}this._isFlushing=!1,this.isScheduled=!1,this.nextPendingComponents.size>0?(this.isScheduled=!0,queueMicrotask(()=>{J.isScheduled||J.isFlushing||this.flush()})):this._drainIdleCallbacks()}},K=()=>{if(z.templateInProgress&&!z.setupInProgress)throw Error("Providers such as atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")},tt=()=>{},et=t=>{K(),t.__isOnMount__=!0;const e=H();e.addToCleanUps(t,tt);if("AsyncFunction"===t.constructor.name&&G())return e._asyncMountQueue=e._asyncMountQueue??[],void e._asyncMountQueue.push(t);let n=!1;e.DOMReadyEvent.__subscribe(()=>{if(n)return;n=!0;const i=t();if(i&&"object"==typeof i&&"function"==typeof i.then)return;const s=i;s&&e.addToCleanUps(t,s)})},nt=t=>{K(),t.__isOnPaint__=!0;const e=H();e.addToCleanUps(t,tt),e.PaintEvent.__subscribe(()=>t())},it=t=>{K(),t.__isOnAllMount__=!0;const e=H();e.addToCleanUps(t,tt),Q.onceIdle(()=>{if(!e.isConnected)return;const n=t();n&&e.addToCleanUps(t,n)})},st=t=>{K(),t.__isOnCleanup__=!0;H().addToCleanUps(t,t)},rt=(t,e=!0)=>{if(e&&I("Setter"),z.setupInProgress&&e)throw new Error("Setter cannot be created inside setup function. Define setters as class properties before setup runs.");let n=t;const i=H();e&&K();const s=new Set;try{const t=(...t)=>{const e=n(...t);return[...s].forEach(t=>{try{J.schedule(()=>t?.())}catch(t){console.error(t)}}),i?.isConnected&&Q.schedule(i),e};return t.__subscribe=t=>(I("subscribe"),s.add(t),()=>s.delete(t)),t.__isSetter___=!0,t.set=t=>{n=t},Object.defineProperty(t,"__version__",{get:()=>0}),t}catch(t){throw new Error("You can only use setter or _ inside a scope or useState or view component's outer function")}},ot=rt;function at(t,e=!0,n){if(E())return;const i=H(e);if(i&&t&&!i.cleanups.has(t)){const e=n||t.__subscribe||t.subscribe,s=e?.(()=>{Q.schedule(i)});i.addToCleanUps(t,s)}}function lt(t){return at(t,!0),t}const ct=(t,e)=>{t.__isOn__=!0,I("on");const n=new Set;let i;const s=()=>{if(i){try{i()}catch(t){console.error("Error in on() cleanup:",t)}i=void 0}const e=t();"function"==typeof e&&(i=e)},r=()=>J.schedule(s);e.forEach(t=>{n.add(t.__subscribe(r))});const o=()=>{if(n.forEach(t=>t()),i){try{i()}catch(t){console.error("Error in on() cleanup:",t)}i=void 0}};return ut(t,o),o};function ht(t){let e=null;const n=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{context:t,resolve(t=null){e=t}}});return H().dispatchEvent(n),e}const ut=(t,e)=>{const n=H(!1);n&&n.addToCleanUps(t,e)},dt=t=>{I("xTabEvent");const e=new Set,n=n=>{e.forEach(e=>{try{e(n)}catch(e){D(e,`xTabEvent(${t}) handler`)}})},i="undefined"!=typeof BroadcastChannel?new BroadcastChannel(t):null;i&&(i.onmessage=t=>{n(t.data)});return{trigger:e=>{if(p(t,e),i)try{i.postMessage(e)}catch(e){D(e,`xTabEvent(${t}) postMessage`)}n(e)},__subscribe:t=>{e.add(t);const n=()=>{e.delete(t)};return ut(t,n),n},close:()=>{i&&i.close()},name:t,__isEvent___:!0,__isXTabEvent___:!0}},ft=t=>{I("event");const e=t||Math.random().toString(36).substring(2,15),n=new V;return{trigger:t=>{p(e,t),n.trigger(t)},__subscribe:t=>n.subscribe(t),name:e,__isEvent___:!0}},pt=t=>{I("cleanupEvent");const e=t||Math.random().toString(36).substring(2,15),n=new Map,i=()=>{n.forEach(t=>{if(t)try{t()}catch(t){D(t,"cleanupEvent cleanup")}})},s={trigger:t=>{!function(t,e){u.logCleanupEventTrigger(t,e)}(e,t),n.forEach((e,i)=>{if(e)try{e()}catch(t){D(t,"cleanupEvent cleanup")}try{const e=i(t);n.set(i,e)}catch(t){D(t,"cleanupEvent handler"),n.set(i,void 0)}})},__subscribe:t=>(n.set(t,void 0),()=>{const e=n.get(t);if(e)try{e()}catch(t){D(t,"cleanupEvent unsubscribe")}n.delete(t)}),cleanup:i,cleanupAndClearSubs:()=>{i(),n.clear()},get hasSubscribers(){return n.size>0},name:e,__isCleanupEvent___:!0,__isEvent___:!0};return s};function mt(t){return!!t&&("AsyncFunction"===t.constructor?.name||t instanceof Promise||"object"==typeof t&&null!==t&&"then"in t||"function"==typeof t.then)}function _t(t){return"function"==typeof t?t():t}function gt(t){return t.default||t}function yt(){if("undefined"==typeof window)return!0;const t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local")}class wt extends HTMLElement{addScope(t,e){this.scopes.set(t,e)}onEachUpdate(t){this.onEachUpdateCallbacks.add(t)}constructor(){super(),this.name="Anonymous",this.scopes=new Map,this._useStates=[],this.lastVersion=-1,this._depth=0,this._parentComponent=null,this._renderVersion=0,this._errorHandlers=[],this._errorState=null,this.onEachUpdateCallbacks=new Set,this.DOMReadyEvent=null,this.PaintEvent=null,this._isViewLoading=!1,this._onRequestParentScope=t=>{const e=t,n=e.detail?.ScopeClass;if(n&&this.scopes.has(n)){const t=this.scopes.get(n);t&&(e.stopPropagation(),e.detail.resolve(t))}},this._props={},this._propsFn=()=>this._props,this._view=null,this._templateFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{};const t=z.templateInProgress;z.templateInProgress=!1,Y(this,()=>{this.DOMReadyEvent=pt("DOMReady"),this.PaintEvent=pt("Paint")}),z.templateInProgress=t}set props(t){this._props=t,Q.schedule(this)}get props(){return this._props}_applyViewChange(t,e){this.oldView!==t&&(this.oldView=t,e(t),(this._hasMounted||this._errorState)&&X(this))}set view(t){if(null!==t){if(mt(t))return this._isViewLoading=!0,void _t(t).then(t=>{this._isViewLoading=!1,this.view=gt(t)},t=>{this._isViewLoading=!1,this._handleRenderError(t)});"function"==typeof t&&(this.name=t.name||"Anonymous"),this._applyViewChange(t,()=>{this._view=t}),Q.schedule(this)}}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}connectedCallback(){this.addEventListener("request-parent-scope",this._onRequestParentScope);let t=0,e=null,n=this.parentElement;for(;n;){if(n instanceof wt){e=n,t=n._depth+1;break}n=n.parentElement}this._depth=t,this._parentComponent=e,Z.cancelDisconnect(this),this._hasMounted&&(yt()&&!this._view?.skipDevToolsRender&&d(this,this._view),Q.schedule(this))}disconnectedCallback(){var t,e,n;this.removeEventListener("request-parent-scope",this._onRequestParentScope),yt()&&(this._view?.__devtools__||this._view?.skipDevToolsRender||(n=f(this),u.logComponentUnmount(n)),this._view?.skipDevToolsRender||(t=this,e=this._view,u.unregisterComponent(t,e))),Z.scheduleDisconnect(this)}addToCleanUps(t,e){const n=this.cleanups.get(t);n?n.push(e):this.cleanups.set(t,[e])}_render(){var t,e,n;if(!(this._errorState||this._isViewLoading||this._renderScheduled)&&this._view)if(this._renderVersion=Q.flushVersion,this._hasMounted){if(this._xviewRender){this.callOnEachUpdate();let i=0;if(yt()){const s=this._view?.__devtools__,r=this._view?.skipDevToolsRender,o=performance.now();this._xviewRender(),i=performance.now()-o,s||r||(m(f(this),this.componentId,i),e=f(this),n=i,u.logComponentRender(e,n)),r||(t=this,u.notifyRender(t))}else this._xviewRender()}}else this._mountComponent()}_mountComponent(){const n=this._view;t(e``,this),z.viewOuterInProgress=!0;try{this._templateFn=Y(this,()=>n(this._propsFn))}catch(t){return z.viewOuterInProgress=!1,void this._handleRenderError(t)}if(z.viewOuterInProgress=!1,"function"==typeof this._templateFn){if(this._xviewRender=()=>{z.templateInProgress=!0;try{if(!this._templateFn)return;Y(this,()=>{const e=this._templateFn(this._propsFn);t(e,this)}),this.DOMReadyEvent?.trigger(),this.PaintEvent?.hasSubscribers&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&this.PaintEvent?.trigger()})})}catch(t){this._handleRenderError(t)}finally{z.templateInProgress=!1}},this.callOnEachUpdate(),yt()){const t=n?.__devtools__,e=n?.skipDevToolsRender,i=performance.now();this._xviewRender();const s=performance.now()-i;t||e||m(n?.name||"Anonymous",this.componentId,s)}else this._xviewRender();this._view===n&&(this._hasMounted=!0,yt()&&(n?.skipDevToolsRender||d(this,n),n?.__devtools__||n?.skipDevToolsRender||(i=n?.name||"Anonymous",u.logComponentMount(i))))}else this._handleRenderError(new Error("inner function must be a template function that returns html result"));var i}_handleRenderError(t){this._errorState=t;for(const e of this._errorHandlers)try{e(t)}catch(t){}if(D(t,`Component "${this.name}"`),this._view?.__isErrorView__)return;const n=this.name,i=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.stack?t.stack.split("\n").slice(1).map(t=>t.trim()).filter(Boolean).join("\n"):null,r=()=>()=>e`
1
+ "use strict";var t=require("lit-html/directives/unsafe-html.js"),e=require("lit-html/directives/async-append.js"),n=require("lit-html/directives/async-replace.js"),s=require("lit-html/directives/cache.js"),i=require("lit-html/directives/class-map.js"),r=require("lit-html/directives/guard.js"),o=require("lit-html/directives/if-defined.js"),a=require("lit-html/directives/join.js"),l=require("lit-html/directives/keyed.js"),c=require("lit-html/directives/live.js"),h=require("lit-html/directives/range.js"),u=require("lit-html/directives/repeat.js"),d=require("lit-html/directives/style-map.js"),f=require("lit-html/directives/until.js"),p=require("lit-html/directives/when.js"),m=require("lit-html/directives/ref.js"),_=require("lit-html/async-directive.js"),g=require("lit-html/directive.js");
2
+ /**
3
+ * @license
4
+ * Copyright 2017 Google LLC
5
+ * SPDX-License-Identifier: BSD-3-Clause
6
+ */
7
+ const y=globalThis,v=y.trustedTypes,w=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,b="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,x="?"+S,E=`<${x}>`,C=document,A=()=>C.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,R="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,P=/>/g,z=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,$=/"/g,D=/^(?:script|style|textarea|title)$/i,L=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),j=L(1),N=L(2),U=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),V=new WeakMap,W=C.createTreeWalker(C,129);function H(t,e){if(!k(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==w?w.createHTML(e):e}class Y{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let i=0,r=0;const o=t.length-1,a=this.parts,[l,c]=((t,e)=>{const n=t.length-1,s=[];let i,r=2===e?"<svg>":3===e?"<math>":"",o=T;for(let e=0;e<n;e++){const n=t[e];let a,l,c=-1,h=0;for(;h<n.length&&(o.lastIndex=h,l=o.exec(n),null!==l);)h=o.lastIndex,o===T?"!--"===l[1]?o=O:void 0!==l[1]?o=P:void 0!==l[2]?(D.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=z):void 0!==l[3]&&(o=z):o===z?">"===l[0]?(o=i??T,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?z:'"'===l[3]?$:I):o===$||o===I?o=z:o===O||o===P?o=T:(o=z,i=void 0);const u=o===z&&t[e+1].startsWith("/>")?" ":"";r+=o===T?n+E:c>=0?(s.push(a),n.slice(0,c)+b+n.slice(c)+S+u):n+S+(-2===c?e:u)}return[H(t,r+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]})(t,e);if(this.el=Y.createElement(l,n),W.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=W.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(b)){const e=c[r++],n=s.getAttribute(t).split(S),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:i,name:o[2],strings:n,ctor:"."===o[1]?Z:"?"===o[1]?J:"@"===o[1]?Q:X}),s.removeAttribute(t)}else t.startsWith(S)&&(a.push({type:6,index:i}),s.removeAttribute(t));if(D.test(s.tagName)){const t=s.textContent.split(S),e=t.length-1;if(e>0){s.textContent=v?v.emptyScript:"";for(let n=0;n<e;n++)s.append(t[n],A()),W.nextNode(),a.push({type:2,index:++i});s.append(t[e],A())}}}else if(8===s.nodeType)if(s.data===x)a.push({type:2,index:i});else{let t=-1;for(;-1!==(t=s.data.indexOf(S,t+1));)a.push({type:7,index:i}),t+=S.length-1}i++}}static createElement(t,e){const n=C.createElement("template");return n.innerHTML=t,n}}function B(t,e,n=t,s){if(e===U)return e;let i=void 0!==s?n.o?.[s]:n.l;const r=M(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),void 0===r?i=void 0:(i=new r(t),i._$AT(t,n,s)),void 0!==s?(n.o??=[])[s]=i:n.l=i),void 0!==i&&(e=B(t,i._$AS(t,e.values),i,s)),e}class q{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,s=(t?.creationScope??C).importNode(e,!0);W.currentNode=s;let i=W.nextNode(),r=0,o=0,a=n[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new G(i,i.nextSibling,this,t):1===a.type?e=new a.ctor(i,a.name,a.strings,this,t):6===a.type&&(e=new K(i,this,t)),this._$AV.push(e),a=n[++o]}r!==a?.index&&(i=W.nextNode(),r++)}return W.currentNode=C,s}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class G{get _$AU(){return this._$AM?._$AU??this.v}constructor(t,e,n,s){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this.v=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=B(this,t,e),M(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==U&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>k(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==F&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Y.createElement(H(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new q(s,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new Y(t)),e}k(t){k(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,s=0;for(const i of t)s===e.length?e.push(n=new G(this.O(A()),this.O(A()),this,this.options)):n=e[s],n._$AI(i),s++;s<e.length&&(this._$AR(n&&n._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this.v=t,this._$AP?.(t))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,s,i){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=F}_$AI(t,e=this,n,s){const i=this.strings;let r=!1;if(void 0===i)t=B(this,t,e,0),r=!M(t)||t!==this._$AH&&t!==U,r&&(this._$AH=t);else{const s=t;let o,a;for(t=i[0],o=0;o<i.length-1;o++)a=B(this,s[n+o],e,o),a===U&&(a=this._$AH[o]),r||=!M(a)||a!==this._$AH[o],a===F?t=F:t!==F&&(t+=(a??"")+i[o+1]),this._$AH[o]=a}r&&!s&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Z extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}class J extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==F)}}class Q extends X{constructor(t,e,n,s,i){super(t,e,n,s,i),this.type=5}_$AI(t,e=this){if((t=B(this,t,e,0)??F)===U)return;const n=this._$AH,s=t===F&&n!==F||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==F&&(n===F||s);s&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class K{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){B(this,t)}}const tt=y.litHtmlPolyfillSupport;tt?.(Y,G),(y.litHtmlVersions??=[]).push("3.2.0");const et=(t,e,n)=>{const s=n?.renderBefore??e;let i=s._$litPart$;if(void 0===i){const t=n?.renderBefore??null;s._$litPart$=i=new G(e.insertBefore(A(),t),t,void 0,n??{})}return i._$AI(t),i},nt=()=>{},st={registerComponent:nt,unregisterComponent:nt,notifyRender:nt,getComponentName:()=>"Anonymous",logComponentMount:nt,logComponentRender:nt,logComponentUnmount:nt,logAtomSet:nt,logAtomUpdate:nt,logEventTrigger:nt,logCleanupEventTrigger:nt,logFetchRequest:nt,logFetchResponse:nt,logFetchError:nt,recordRender:nt};function it(t,e){st.registerComponent(t,e)}function rt(t){return st.getComponentName(t)}function ot(t,e){st.logEventTrigger(t,e)}function at(t,e,n){st.recordRender(t,e,n)}let lt=!1,ct=new Set,ht=!1;function ut(){return lt}function dt(){return ht}function ft(t){ct.add(t)}function pt(){ht=!0}function mt(){ht=!1}function _t(){const t={prevEnabled:lt,prevStores:ct};return lt=!0,ct=new Set,t}function gt(t){const e=ct;return lt=t.prevEnabled,ct=t.prevStores,e}const yt=_t,vt=gt,wt={setupInProgress:!1,templateInProgress:!1,viewOuterInProgress:!1,isHookRunning:!1};function bt(t){if(!wt.isHookRunning){if(wt.templateInProgress)throw new Error(`${t} cannot be created during template function execution. Only scopes (useScope) are allowed in templates.`);if(dt())throw new Error(`${t} cannot be created inside a memo() or effect(). They should only read state, not create new reactive primitives.`)}}function St(t){if(!wt.viewOuterInProgress){if(wt.templateInProgress)throw new Error(`${t} cannot be called during template function execution. Move it to the component's outer function.`);if(dt())throw new Error(`${t} cannot be called inside a memo() or effect(). Move it to the component's outer function.`);throw new Error(`${t} must be called inside a component's outer function. It cannot be used at module level or inside inner functions (e.g. event handlers, timers, or callbacks).`)}}function xt(t,e){(function(){if("undefined"==typeof window)return!0;const t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local")})()&&(e?console.error(`[${e}]`,t):console.error(t))}function Et(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)}function Ct(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n}var At,Mt,kt;"function"==typeof SuppressedError&&SuppressedError;class Rt{constructor(){At.set(this,new Set),Mt.set(this,1)}subscribe(t){return Et(this,At,"f").add(t),()=>Et(this,At,"f").delete(t)}notify(){var t;Ct(this,Mt,(t=Et(this,Mt,"f"),++t),"f"),[...Et(this,At,"f")].forEach(t=>{try{t?.()}catch(t){console.error(t)}})}getVersion(){return Et(this,Mt,"f")}get subscriberCount(){return Et(this,At,"f").size}clear(){Et(this,At,"f").clear()}}At=new WeakMap,Mt=new WeakMap;class Tt{constructor(){kt.set(this,new Set)}subscribe(t){return bt("subscribe"),Et(this,kt,"f").has(t)?()=>{}:(Et(this,kt,"f").add(t),()=>Et(this,kt,"f").delete(t))}trigger(t){Et(this,kt,"f").forEach(e=>{try{e(t)}catch(t){console.error("Error in event handler:",t)}})}get handlerCount(){return Et(this,kt,"f").size}clear(){Et(this,kt,"f").clear()}}kt=new WeakMap;const Ot=[];function Pt(t,e){Ot.push(t);let n=null;try{n=e()}finally{Ot.pop()}return n}function zt(t){const e=Ot[Ot.length-1];if(!e){if(!1!==t)throw new Error("getCurrentHost(): No active host context");return null}return e}let It=!1;function $t(){return It}function Dt(t){t.DOMReadyEvent?.cleanupAndClearSubs(),t.PaintEvent?.cleanupAndClearSubs(),t.cleanups.forEach(t=>t.forEach(t=>{try{t()}catch(t){console.error("Error during cleanup:",t)}})),t.cleanups.clear(),t.onEachUpdateCallbacks.clear(),t.scopes=new Map,t._templateFn=null,t._xviewRender=()=>{},t._hasMounted=!1,t._errorState=null,t._errorHandlers=[]}const Lt=new class{constructor(){this.pending=new Set,this.isScheduled=!1}scheduleDisconnect(t){this.pending.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}cancelDisconnect(t){this.pending.delete(t)}flush(){const t=Array.from(this.pending);this.pending.clear(),this.isScheduled=!1;for(const e of t)e.isConnected||(Dt(e),e._view=null,e._props={},e.oldView=void 0)}reset(){this.pending.clear(),this.isScheduled=!1}},jt=new class{constructor(){this.pendingEffects=new Set,this.isScheduled=!1,this._isFlushing=!1}get isFlushing(){return this._isFlushing}reset(){this.pendingEffects.clear(),this.isScheduled=!1,this._isFlushing=!1}schedule(t){this.pendingEffects.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this._isFlushing=!0;let t=0;for(;this.pendingEffects.size>0;){if(t++>=500){this.pendingEffects.clear(),console.error("EffectScheduler: Maximum iteration limit (500) reached. This likely means an effect is infinitely updating its own dependency. Remaining effects have been dropped.");break}const e=Array.from(this.pendingEffects);this.pendingEffects.clear();for(const t of e)try{t()}catch(t){xt(t,"Effect")}}this._isFlushing=!1,this.isScheduled=!1,Nt.flush()}},Nt=new class{constructor(){this.pendingComponents=new Set,this.nextPendingComponents=new Set,this._currentWave=new Set,this.isScheduled=!1,this._isFlushing=!1,this._flushVersion=0,this._onIdleCallbacks=[]}get flushVersion(){return this._flushVersion}onceIdle(t){this._onIdleCallbacks.push(t),this._isFlushing||this.isScheduled||queueMicrotask(()=>this._drainIdleCallbacks())}_drainIdleCallbacks(){if(this._isFlushing||this.isScheduled)return;if(this.pendingComponents.size>0||this.nextPendingComponents.size>0)return;const t=this._onIdleCallbacks.splice(0);for(const e of t)try{e()}catch(t){console.error(t)}}reset(){this.pendingComponents.clear(),this.nextPendingComponents.clear(),this._currentWave.clear(),this._onIdleCallbacks.length=0,this.isScheduled=!1,this._isFlushing=!1}schedule(t){if(this._isFlushing){if(this._currentWave.has(t)&&t._renderVersion!==this._flushVersion)return;this.nextPendingComponents.add(t)}else this.pendingComponents.add(t);this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{jt.isScheduled||jt.isFlushing||this.flush()}))}flush(){for(this.nextPendingComponents.size>0&&(this.nextPendingComponents.forEach(t=>this.pendingComponents.add(t)),this.nextPendingComponents.clear()),this._isFlushing=!0,this._flushVersion++;this.pendingComponents.size>0;){const t=Array.from(this.pendingComponents);this.pendingComponents.clear(),t.sort((t,e)=>t._depth-e._depth),this._currentWave=new Set(t);for(const e of t)if(e.isConnected)try{e._render()}catch(t){xt(t,"Component render")}this._currentWave.clear()}this._isFlushing=!1,this.isScheduled=!1,this.nextPendingComponents.size>0?(this.isScheduled=!0,queueMicrotask(()=>{jt.isScheduled||jt.isFlushing||this.flush()})):this._drainIdleCallbacks()}},Ut=()=>{if(wt.templateInProgress&&!wt.setupInProgress)throw Error("Providers such as atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")},Ft=()=>{},Vt=t=>{Ut(),t.__isOnMount__=!0;const e=zt();e.addToCleanUps(t,Ft);if("AsyncFunction"===t.constructor.name&&$t())return e._asyncMountQueue=e._asyncMountQueue??[],void e._asyncMountQueue.push(t);let n=!1;e.DOMReadyEvent.__subscribe(()=>{if(n)return;n=!0;const s=t();if(s&&"object"==typeof s&&"function"==typeof s.then)return;const i=s;i&&e.addToCleanUps(t,i)})},Wt=(t,e=!0)=>{if(e&&bt("Setter"),wt.setupInProgress&&e)throw new Error("Setter cannot be created inside setup function. Define setters as class properties before setup runs.");let n=t;const s=zt();e&&Ut();const i=new Set;try{const t=(...t)=>{const e=n(...t);return[...i].forEach(t=>{try{jt.schedule(()=>t?.())}catch(t){console.error(t)}}),s?.isConnected&&Nt.schedule(s),e};return t.__subscribe=t=>(bt("subscribe"),i.add(t),()=>i.delete(t)),t.__isSetter___=!0,t.set=t=>{n=t},Object.defineProperty(t,"__version__",{get:()=>0}),t}catch(t){throw new Error("You can only use setter or _ inside a scope or useState or view component's outer function")}},Ht=Wt;function Yt(t,e=!0,n){if(dt())return;const s=zt(e);if(s&&t&&!s.cleanups.has(t)){const e=n||t.__subscribe||t.subscribe,i=e?.(()=>{Nt.schedule(s)});s.addToCleanUps(t,i)}}const Bt=(t,e)=>{const n=zt(!1);n&&n.addToCleanUps(t,e)},qt=t=>{bt("cleanupEvent");const e=t||Math.random().toString(36).substring(2,15),n=new Map,s=()=>{n.forEach(t=>{if(t)try{t()}catch(t){xt(t,"cleanupEvent cleanup")}})},i={trigger:t=>{!function(t,e){st.logCleanupEventTrigger(t,e)}(e,t),n.forEach((e,s)=>{if(e)try{e()}catch(t){xt(t,"cleanupEvent cleanup")}try{const e=s(t);n.set(s,e)}catch(t){xt(t,"cleanupEvent handler"),n.set(s,void 0)}})},__subscribe:t=>(n.set(t,void 0),()=>{const e=n.get(t);if(e)try{e()}catch(t){xt(t,"cleanupEvent unsubscribe")}n.delete(t)}),cleanup:s,cleanupAndClearSubs:()=>{s(),n.clear()},get hasSubscribers(){return n.size>0},name:e,__isCleanupEvent___:!0,__isEvent___:!0};return i};function Gt(t){return!!t&&("AsyncFunction"===t.constructor?.name||t instanceof Promise||"object"==typeof t&&null!==t&&"then"in t||"function"==typeof t.then)}function Xt(t){return"function"==typeof t?t():t}function Zt(t){return t.default||t}function Jt(){if("undefined"==typeof window)return!0;const t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t||"[::1]"===t||t.startsWith("192.168.")||t.startsWith("10.")||t.endsWith(".local")}class Qt extends HTMLElement{addScope(t,e){this.scopes.set(t,e)}onEachUpdate(t){this.onEachUpdateCallbacks.add(t)}constructor(){super(),this.name="Anonymous",this.scopes=new Map,this._useStates=[],this.lastVersion=-1,this._depth=0,this._parentComponent=null,this._renderVersion=0,this._errorHandlers=[],this._errorState=null,this.onEachUpdateCallbacks=new Set,this.DOMReadyEvent=null,this.PaintEvent=null,this._isViewLoading=!1,this._onRequestParentScope=t=>{const e=t,n=e.detail?.ScopeClass;if(n&&this.scopes.has(n)){const t=this.scopes.get(n);t&&(e.stopPropagation(),e.detail.resolve(t))}},this._props={},this._propsFn=()=>this._props,this._view=null,this._templateFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{};const t=wt.templateInProgress;wt.templateInProgress=!1,Pt(this,()=>{this.DOMReadyEvent=qt("DOMReady"),this.PaintEvent=qt("Paint")}),wt.templateInProgress=t}set props(t){this._props=t,Nt.schedule(this)}get props(){return this._props}_applyViewChange(t,e){this.oldView!==t&&(this.oldView=t,e(t),(this._hasMounted||this._errorState)&&Dt(this))}set view(t){if(null!==t){if(Gt(t))return this._isViewLoading=!0,void Xt(t).then(t=>{this._isViewLoading=!1,this.view=Zt(t)},t=>{this._isViewLoading=!1,this._handleRenderError(t)});"function"==typeof t&&(this.name=t.name||"Anonymous"),this._applyViewChange(t,()=>{this._view=t}),Nt.schedule(this)}}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}connectedCallback(){this.addEventListener("request-parent-scope",this._onRequestParentScope);let t=0,e=null,n=this.parentElement;for(;n;){if(n instanceof Qt){e=n,t=n._depth+1;break}n=n.parentElement}this._depth=t,this._parentComponent=e,Lt.cancelDisconnect(this),this._hasMounted&&(Jt()&&!this._view?.skipDevToolsRender&&it(this,this._view),Nt.schedule(this))}disconnectedCallback(){var t,e,n;this.removeEventListener("request-parent-scope",this._onRequestParentScope),Jt()&&(this._view?.__devtools__||this._view?.skipDevToolsRender||(n=rt(this),st.logComponentUnmount(n)),this._view?.skipDevToolsRender||(t=this,e=this._view,st.unregisterComponent(t,e))),Lt.scheduleDisconnect(this)}addToCleanUps(t,e){const n=this.cleanups.get(t);n?n.push(e):this.cleanups.set(t,[e])}_render(){var t,e,n;if(!(this._errorState||this._isViewLoading||this._renderScheduled)&&this._view)if(this._renderVersion=Nt.flushVersion,this._hasMounted){if(this._xviewRender){this.callOnEachUpdate();let s=0;if(Jt()){const i=this._view?.__devtools__,r=this._view?.skipDevToolsRender,o=performance.now();this._xviewRender(),s=performance.now()-o,i||r||(at(rt(this),this.componentId,s),e=rt(this),n=s,st.logComponentRender(e,n)),r||(t=this,st.notifyRender(t))}else this._xviewRender()}}else this._mountComponent()}_mountComponent(){const t=this._view;et(j``,this),wt.viewOuterInProgress=!0;try{this._templateFn=Pt(this,()=>t(this._propsFn))}catch(t){return wt.viewOuterInProgress=!1,void this._handleRenderError(t)}if(wt.viewOuterInProgress=!1,"function"==typeof this._templateFn){if(this._xviewRender=()=>{wt.templateInProgress=!0;try{if(!this._templateFn)return;Pt(this,()=>{const t=this._templateFn(this._propsFn);et(t,this)}),this.DOMReadyEvent?.trigger(),this.PaintEvent?.hasSubscribers&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&this.PaintEvent?.trigger()})})}catch(t){this._handleRenderError(t)}finally{wt.templateInProgress=!1}},this.callOnEachUpdate(),Jt()){const e=t?.__devtools__,n=t?.skipDevToolsRender,s=performance.now();this._xviewRender();const i=performance.now()-s;e||n||at(t?.name||"Anonymous",this.componentId,i)}else this._xviewRender();this._view===t&&(this._hasMounted=!0,Jt()&&(t?.skipDevToolsRender||it(this,t),t?.__devtools__||t?.skipDevToolsRender||(e=t?.name||"Anonymous",st.logComponentMount(e))))}else this._handleRenderError(new Error("inner function must be a template function that returns html result"));var e}_handleRenderError(t){this._errorState=t;for(const e of this._errorHandlers)try{e(t)}catch(t){}if(xt(t,`Component "${this.name}"`),this._view?.__isErrorView__)return;const e=this.name,n=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.stack?t.stack.split("\n").slice(1).map(t=>t.trim()).filter(Boolean).join("\n"):null,i=()=>()=>j`
2
8
  <div
3
9
  style="padding:14px 16px;margin:4px;border:2px solid #e74c3c;border-radius:6px;background:#fdf0ef;color:#c0392b;font-family:monospace;font-size:13px;line-height:1.5"
4
10
  >
5
11
  <strong style="display:block;margin-bottom:6px;font-size:14px">
6
- ⚠ ${n} crashed
12
+ ⚠ ${e} crashed
7
13
  </strong>
8
14
  <div
9
15
  style="margin-bottom:${s?"10px":"0"};word-break:break-word"
10
16
  >
11
- ${i}
17
+ ${n}
12
18
  </div>
13
- ${s?e`<details>
19
+ ${s?j`<details>
14
20
  <summary
15
21
  style="cursor:pointer;opacity:0.75;font-size:11px;margin-bottom:4px"
16
22
  >
@@ -23,79 +29,82 @@ ${s}</pre
23
29
  >
24
30
  </details>`:null}
25
31
  </div>
26
- `;r.__isErrorView__=!0,r.skipDevToolsRender=!0,this.view=r,this.name=n}}customElements.get("x-view")||customElements.define("x-view",wt);class vt 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 bt(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 St(t){return t.length>0&&/^[a-zA-Z-]+$/.test(t)}customElements.get("x-provider")||customElements.define("x-provider",vt);let Et=0;function Ct(){return`_m${(Et++).toString(36)}`}const Mt=Object.create(null),kt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function xt(t){t.breakpoints&&Object.assign(kt,t.breakpoints)}function At(t){const e=Mt[t];if(void 0!==e)return e;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return Mt[t]=n,n}function Rt(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 Ot(t){return t.startsWith("&")||t.startsWith("@media")?t:Object.prototype.hasOwnProperty.call(kt,t)?`@media (min-width: ${kt[t]})`:null}function zt(t,e,n){const i=Object.create(null);for(const s in t){const r=t[s];let o="",a=null;for(const t in r){const e=r[t];if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const n=Ot(t);if(null===n)throw new Error(`[css-in-js] Unknown nested key "${t}" in block "${s}". Use "&:pseudo", "@media (...)", or a configured breakpoint key.`);let i="";const r=e;for(const t in r){const e=r[t];null!=e&&(St(t)?i+=` ${At(t)}: ${bt(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`))}i.length>0&&(null===a&&(a=[]),a.push([i,n]));continue}St(t)?o+=` ${At(t)}: ${bt(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`)}}if(0===o.length&&null===a){i[s]="";continue}const l=n?.literal?s:`${s}${Ct()}`;if(o.length>0&&e.push(Rt(l,o,"")),null!==a)for(let t=0;t<a.length;t++)e.push(Rt(l,a[t][0],a[t][1]));i[s]=l}return i}function Tt(t){return Object.freeze(t)}var It,Pt,Dt,Lt,jt,Nt,$t,Ut;function Ft(t){if(z.templateInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a template function.`);if(z.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(z.setupInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a setup function.`)}let Vt=0;function Wt(t){return`${t}_kf${(Vt++).toString(36)}`}function Yt(t,e){let n="";for(const t in e){const i=e[t];let s="";for(const t in i){const e=i[t];if(null==e)continue;s+=` ${t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}: ${String(e)};\n`}s&&(n+=` ${t} {\n${s} }\n`)}return`@keyframes ${t} {\n${n}}`}class Ht{constructor(){It.add(this),Pt.set(this,""),Dt.set(this,0),Lt.set(this,null),jt.set(this,[])}keyframes(t,e){const n=Wt(t);return this.appendRules(Yt(n,e)),n}appendRules(t){""!==t&&(L(this,jt,"f").push(t),L(this,Dt,"f")>0&&L(this,It,"m",Nt).call(this))}mount(){var t;j(this,Dt,(t=L(this,Dt,"f"),++t),"f"),1===L(this,Dt,"f")&&(L(this,It,"m",Nt).call(this),L(this,Lt,"f")||L(this,It,"m",$t).call(this))}unmount(){var t;L(this,Dt,"f")<=0||(j(this,Dt,(t=L(this,Dt,"f"),--t),"f"),0===L(this,Dt,"f")&&L(this,It,"m",Ut).call(this))}get refCount(){return L(this,Dt,"f")}get cssText(){return L(this,Pt,"f")}get isMounted(){return L(this,Dt,"f")>0}get sheet(){return L(this,Lt,"f")}}function Bt(){Ft("stylesheet");const t=new Ht;return{css:function(e){Ft("css");const n=[],i=zt(e,n);return n.length>0&&t.appendRules(n.join("\n")),Tt(i)},mount:function(){if(function(t){if(z.templateInProgress)throw new Error(`[css-in-js] ${t}() must not be called inside a template function. Call it in the component outer function or at module level.`)}("mount"),null===H(!1))return t.mount(),()=>t.unmount();et(()=>(t.mount(),()=>t.unmount()))},keyframes:function(e,n){return Ft("keyframes"),t.keyframes(e,n)}}}Pt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,jt=new WeakMap,It=new WeakSet,Nt=function(){if(0===L(this,jt,"f").length)return;const t=L(this,jt,"f").join("\n");j(this,jt,[],"f"),j(this,Pt,L(this,Pt,"f")+(L(this,Pt,"f")?"\n":"")+t,"f"),L(this,It,"m",$t).call(this)},$t=function(){L(this,Lt,"f")||(j(this,Lt,new CSSStyleSheet,"f"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,L(this,Lt,"f")]),L(this,Lt,"f").replaceSync(L(this,Pt,"f"))},Ut=function(){L(this,Lt,"f")&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==L(this,Lt,"f")),j(this,Lt,null,"f")),L(this,Pt,"f")&&(L(this,jt,"f").unshift(L(this,Pt,"f")),j(this,Pt,"","f"))};let qt=null,Gt=!1;function Xt(){return qt||(qt=new Ht),qt}function Zt(){qt||(qt=new Ht),Gt||(Gt=!0,queueMicrotask(()=>{Gt=!1,qt.mount()}))}function Jt(t,e){Ft("keyframes"),Zt();const n=Wt(t);return qt.appendRules(Yt(n,e)),n}function Qt(t,e){Ft("globalCSS"),Zt();const n=[],i=zt(t,n,e);return n.length>0&&qt.appendRules(n.join("\n")),Tt(i)}function Kt(t){Ft("globalRawCSS"),Zt(),qt.appendRules(t)}const te="__matesAnimationsInjected";function ee(){globalThis[te]||(globalThis[te]=!0,Kt('\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'),Kt("\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"),Qt({"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}))}const ne={fadeIn:"mates-fade-in",fadeOut:"mates-fade-out",slideInUp:"mates-slide-in-up",slideOutUp:"mates-slide-out-up",slideInDown:"mates-slide-in-down",slideOutDown:"mates-slide-out-down",slideInLeft:"mates-slide-in-left",slideOutLeft:"mates-slide-out-left",slideInRight:"mates-slide-in-right",slideOutRight:"mates-slide-out-right",scaleIn:"mates-scale-in",scaleOut:"mates-scale-out",springIn:"mates-spring-in",flipInX:"mates-flip-in-x",flipInY:"mates-flip-in-y",blurIn:"mates-blur-in",blurOut:"mates-blur-out",shake:"mates-shake",pulse:"mates-pulse",bounce:"mates-bounce",spin:"mates-spin"};ee();class ie{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 se=(t,e,n)=>{const i="timeout"===n?setTimeout(()=>t(),e):setInterval(()=>t(),e);return ut(i,"timeout"===n?()=>clearTimeout(i):()=>clearInterval(i)),i};function re(t){I("Action");let e=t;const n=new Set;let i=null,s=null;const r=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},o=Object.assign(function(...t){return((t,n)=>{try{let o;return o=i?i((...n)=>e.call(t,...n),...n):e.call(t,...n),s&&(o=s(o)),r(o),o}catch(t){const e=t instanceof Error?t:new Error(String(t));throw r(void 0),e}})(this,t)},{val:()=>e,set:t=>{e=t},__isAction___:!0,__subscribe:t=>(I("subscribe"),n.add(t),()=>n.delete(t)),interceptBefore:t=>{i=t},interceptAfter:t=>{s=t}});return o}function oe(t=300,e="ease"){return{keyframes:[{opacity:0},{opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function ae(t=300,e="ease"){return{keyframes:[{opacity:1},{opacity:0}],options:{duration:t,easing:e,fill:"both"}}}const le={up:"translateY(-100%)",down:"translateY(100%)",left:"translateX(-100%)",right:"translateX(100%)"};function ce(t="up",e,n=400,i="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:e?ue(t,e):le[t],opacity:0},{transform:"translate(0, 0)",opacity:1}],options:{duration:n,easing:i,fill:"both"}}}function he(t="down",e,n=400,i="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"translate(0, 0)",opacity:1},{transform:e?ue(t,e):le[t],opacity:0}],options:{duration:n,easing:i,fill:"both"}}}function ue(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 de(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:`scale(${t})`,opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function fe(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"scale(1)",opacity:1},{transform:`scale(${t})`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function pe(t=1,e=600,n="linear"){return{keyframes:[{transform:"rotate(0deg)"},{transform:`rotate(${360*t}deg)`}],options:{duration:e,easing:n,fill:"both"}}}function me(t=600){return{keyframes:[{transform:"translateY(0)",offset:0},{transform:"translateY(-30%)",offset:.3},{transform:"translateY(0)",offset:.5},{transform:"translateY(-15%)",offset:.7},{transform:"translateY(0)",offset:.85},{transform:"translateY(-5%)",offset:.95},{transform:"translateY(0)",offset:1}],options:{duration:t,easing:"ease",fill:"both"}}}function _e(t=500,e="cubic-bezier(0.34, 1.56, 0.64, 1)"){return{keyframes:[{transform:"scale(0)",opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function ge(t=10,e=400){return{keyframes:[{transform:"translateX(0)"},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:"translateX(0)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}}function ye(t=1.05,e=400){return{keyframes:[{transform:"scale(1)"},{transform:`scale(${t})`},{transform:"scale(1)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}}function we(t="y",e=500,n="ease-out"){const i="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${i}(90deg)`,opacity:0},{transform:`${i}(0deg)`,opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function ve(t="y",e=500,n="ease-in"){const i="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${i}(0deg)`,opacity:1},{transform:`${i}(90deg)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function be(t=10,e=400,n="ease-out"){return{keyframes:[{filter:`blur(${t}px)`,opacity:0},{filter:"blur(0px)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}}function Se(t=10,e=400,n="ease-in"){return{keyframes:[{filter:"blur(0px)",opacity:1},{filter:`blur(${t}px)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}}function Ee(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"0",overflow:"hidden"},{width:"auto",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}}function Ce(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"auto",overflow:"hidden"},{width:"0",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}}function Me(t,e,n=50){return{keyframes:t.keyframes,options:{...t.options,delay:(t.options.delay??0)+e*n}}}function ke(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])||ke(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function xe(t,e,n){const i=R();let s;M();try{s=t()}finally{k();O(i).forEach(t=>{"function"==typeof t.__subscribe&&e(t,n)})}return s}function Ae(t,e){if(I(t),"AsyncFunction"===e.constructor.name)throw new Error(`${t.toLowerCase()}() does not support async functions.`);if(E())throw new Error(`${t.toLowerCase()}() cannot be nested inside an effect() or memo().`)}function Re(t){const{name:e,fn:n,onRun:i,supportsCleanup:s}=t;Ae(e,n);const r=new Set;let o,a=!1;const l=()=>{if(s&&o){try{o()}catch(t){console.error("Error in effect cleanup:",t)}o=void 0}},c=()=>{if(a)return;l();const t=new Set(r);r.clear();const e=()=>{a||J.schedule(c)};let h;try{h=xe(n,t=>{r.add(t.__subscribe(e))},e)}finally{t.forEach(t=>t())}if(a)return r.forEach(t=>t()),void r.clear();s&&"function"==typeof h&&(o=h),i(h)},h=()=>{a||(a=!0,l(),r.forEach(t=>t()),r.clear())};return c(),ut(n,h),h}let Oe=0;function ze(t,e){if("function"==typeof t){let e;return Re({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):e=ze(t,{skipRestrictedContextCheck:!0})}}),e}e?.skipRestrictedContextCheck||I("Atom");let n=t;const i=++Oe,s=new F;function r(){return at(r,!1),b()&&C(r),n}return r.get=function(){return r()},r.set=function(t,e=!1){var o,a;n="function"==typeof t?t(n):t,r.skipDevToolsLog||(o=String(i),a=n,u.logAtomSet(o,a)),e||s.notify()},r.update=function(t,e=!1){var o;"object"==typeof n&&null!==n&&(t(n),r.skipDevToolsLog||(o=String(i),u.logAtomUpdate(o)),e||s.notify())},r.__subscribe=function(t){return s.subscribe(t)},r.toJSON=function(){return JSON.stringify(n)},Object.defineProperty(r,"name",{value:"atom",writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(r,"val",{get:()=>r(),set:t=>r.set(t),enumerable:!1,configurable:!0}),Object.defineProperty(r,"__version__",{get:()=>s.getVersion(),enumerable:!1}),Object.defineProperty(r,"__isAtom___",{value:!0,writable:!1,enumerable:!1}),Object.defineProperty(r,"__id__",{value:i,writable:!1,enumerable:!1}),r}function Te(t,e){e?.skipRestrictedContextCheck||I("iAtom");const n=ze(Pe(t),{skipRestrictedContextCheck:!0}),i=n.set;n.set=function(t,e=!1){const s="function"==typeof t?t(n.get()):t;i(Pe(s),e)};const s=n;return delete s.update,s.name="iAtom",s}function Ie(t,e={}){e.skipRestrictedContextCheck||I("superAtom"),K();const n=e.freeze??!1,i=n?Pe(De(t)):t;let s=!1,r="default";const o=ze(n?Pe(t):t,{skipRestrictedContextCheck:!0}),a=o.set;o.set=function(t,e=!1){if(s)return;const i="function"==typeof t?t(o.get()):t;a(n?Pe(i):i,e)};const l=o.update;o.update=function(t,e=!1){if(!s){if(n)throw new Error("update() is not supported when freeze is enabled — use set() with a new value.");l(t,e)}};const c=o;return c.lock=function(t="default"){s=!0,r=t},c.unlock=function(t="default"){if(r!==t)throw new Error("Incorrect passcode. Cannot unlock atom.");s=!1},c.reset=function(){s||o.set(n?Pe(De(i)):i)},c.freeze=function(){ke(o.get())},c.name="superAtom",c}function Pe(t){return"object"==typeof t&&null!==t?ke(t):t}function De(t){try{return structuredClone(t)}catch{return t}}function Le(t){const e=new Map,n=[],i=t=>JSON.stringify(t),s=t=>{e.delete(t);const i=n.indexOf(t);i>-1&&n.splice(i,1)};return{getCacheKey:i,removeCacheEntry:s,createCacheMethod:(r,o,a,l)=>async(...c)=>{const h=i(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),r.set(u.result),o.set(null),a.set("success"),u.result}s(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=i(t);s(e)}}}}function je(t){let e=null,n=null;const i=()=>{e&&(clearInterval(e),e=null,n=null)};return{createStartPollingMethod:s=>(...r)=>{t?.pollInterval?(i(),n=r,s(...r),e=setInterval(()=>{n&&s(...n)},t.pollInterval)):D(new Error("pollInterval not specified in asyncAction options"))},createStopPollingMethod:()=>i,stopPolling:i}}function Ne(t,e){e?.allowInRestrictedContext||I("Async Action");const n={...{cacheLimit:10,pollInterval:5e3},...e};let i=t;const s=new Set;let r=null,o=null,a=null,l=null;const c=Le(n),h=je(n),u=ze(null),d=ze(null),f=ze(!1),p=ze("init"),m=t=>{s.forEach(e=>{if(void 0===e.filter||void 0===t||e.filter===t)try{e.fn()}catch(t){D(t)}})},_=()=>{o?.isActive()&&(o.cancel(),o=null),r&&(r.abort(),r=null),f.set(!1),p.set("init")},g=async(t,e)=>{_(),f.set(!0),p.set("loading"),r=new AbortController;const n=r;try{let s;if(a){s=a((...e)=>i.call(t,...e),...e)}else s=i.call(t,...e);s?.__isZeroPromise__&&(o=s);let c=await s;if(n.signal.aborted||r!==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||r!==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{r===n&&(r=null),f.set(!1),o&&!o.isActive()&&(o=null)}},y=async(...t)=>{const e=this;if(G()){const n=H(!1);if(n?._ssrPromiseQueue){const i=g(e,t).catch(()=>{});return n._ssrPromiseQueue.push(i),i}}return g(e,t)},w=c.createCacheMethod(u,d,p,g),v=c.createClearCacheMethod(),b=h.createStartPollingMethod(y),S=h.createStopPollingMethod(),E=Object.assign(y,{data:u,error:d,isLoading:f,status:p,val:()=>i,set:t=>{i=t},params:{page:1},cancel:_,subscribe:(t,e)=>{I("subscribe");const n={fn:t,filter:e};s.add(n);const i=()=>s.delete(n);return ut(t,i),i},cache:w,clearCache:v,startPolling:b,stopPolling:S,interceptBefore:t=>{a=t},interceptAfter:t=>{l=t},__isAsyncAction___:!0,__isAction___:!1});return Object.defineProperty(E,"abortController",{get:()=>r,enumerable:!0,configurable:!0}),ut(E,()=>{s.clear(),h.stopPolling(),_()}),E}class $e{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)=>se(t,e,"timeout"))(t,e)}executePending(t){return this.pendingArgs&&(this.lastResult=t.apply(this.pendingContext,this.pendingArgs),this.clearPending()),this.lastResult}}function Ue(t,e){return()=>{t.clearTimer(),t.clearPending(),e?.()}}function Fe(t,e){return()=>{if(t.pendingArgs&&t.timeoutId){t.clearTimer();return t.executePending(e)}return t.lastResult}}function Ve(t,e){const n=new $e,i=function(...i){return n.setPending(i,this),n.clearTimer(),n.setTimer(()=>{n.lastResult=n.executePending(t),n.timeoutId=null},e),n.lastResult};return i.cancel=Ue(n),i.flush=Fe(n,t),i}function We(t,e){const n=!!e?.allowInRestrictedContext,i=Ne(t,e),s=ze(1,{skipRestrictedContextCheck:n}),r=ze(-1,{skipRestrictedContextCheck:n});return Object.assign(i,{page:s,totalPages:r,next:(...t)=>{if(!(-1!==r.val&&s.val>=r.val))return s.update(t=>t+1),i(...t)}})}function Ye(t){I("taskAction");const e=[];let n=0,i=1,s=!1;const r={skipRestrictedContextCheck:!0},o=ze([],r),a=ze("idle",r),l=ze(0,r);function c(){if(o.set([...e]),0===e.length)return void l.set(0);let t=0;for(const n of e)"running"===n.status?t+=.5:"pending"!==n.status&&(t+=1);l.set(Math.round(t/e.length*100))}function h(){if(s){return void(e.some(t=>"running"===t.status)||a.set("idle"))}if("running"!==a.get())return;const n=e.filter(t=>"running"===t.status).length,r=e.filter(t=>"pending"===t.status);if(0===r.length&&0===n)return void a.set("idle");const o=-1===i?r.length:Math.max(0,i-n);0!==o&&r.slice(0,o).forEach(e=>function(e){const n=new AbortController;e.status="running",e.abortController=n;const i=t(e.input,n.signal);if(i?.__isZeroPromise__){const t=i;e.abortController={signal:t.signal,abort:()=>{t.cancel()}}}c(),Promise.resolve(i).then(t=>{"cancelled"===e.status||(e.status="success",e.result.data=t),e.abortController=null,c(),h()}).catch(t=>{if("cancelled"===e.status||!0===e.abortController?.signal?.aborted)e.status="cancelled",e.abortController=null;else{const n=t instanceof Error?t:new Error(String(t));e.status="failed",e.result.error=n,e.abortController=null,D(n,"taskAction")}c(),h()})}(e))}function u(t){return{id:++n,input:t,status:"pending",result:{data:null,error:null},abortController:null}}function d(t){const n=Array.isArray(t)?t:[t];for(const t of n)e.push(u(t));c(),"running"!==a.get()||s||h()}function f(t=1){"running"!==a.get()&&(i=t,s=!1,a.set("running"),h())}function p(){s=!0,function(){for(const t of e)"running"===t.status&&(t.status="cancelled",t.abortController?.abort(),t.abortController=null)}(),a.set("idle"),c()}function m(t){p(),e.length=0,n=0,c(),d(t)}const _={add:d,start:f,pause:function(){s||(s=!0)},stop:p,delete:function(t){const n=Array.isArray(t)?t:[t],i=new Set(n.map(t=>t.id));for(let t=e.length-1;t>=0;t--){const n=e[t];i.has(n.id)&&("running"===n.status&&(n.status="cancelled",n.abortController?.abort(),n.abortController=null),e.splice(t,1))}c(),"running"!==a.get()||s||h()},clearAndAdd:m,addAndStart:function(t,e=1){d(t),f(e)},clearAndStart:function(t,e=1){m(t),f(e)},isRunning:function(){return"running"===a.val},progress:l,tasks:o,pendingTasks:function(){return o.val.filter(t=>"pending"===t.status)},runningTasks:function(){return o.val.filter(t=>"running"===t.status)},successTasks:function(){return o.val.filter(t=>"success"===t.status)},failedTasks:function(){return o.val.filter(t=>"failed"===t.status)},cancelledTasks:function(){return o.val.filter(t=>"cancelled"===t.status)},__isTaskAction__:!0};return ut(_,p),_}function He(t,e){const n=new $e;let i=0;const s=function(...s){const r=Date.now(),o=r-i;return o>=e?(i=r,n.lastResult=t.apply(this,s),n.clearPending(),n.clearTimer()):(n.setPending(s,this),n.timeoutId||n.setTimer(()=>{i=Date.now(),n.lastResult=n.executePending(t),n.timeoutId=null},e-o)),n.lastResult};return s.cancel=Ue(n,()=>{i=0}),s.flush=Fe(n,t),s}function Be(t,e){return"function"!=typeof t.animate?Promise.resolve():("function"==typeof t.getAnimations&&t.getAnimations().forEach(t=>t.cancel()),new Promise(n=>{const i=t.animate(e.keyframes,{duration:300,easing:"ease",fill:"both",...e.options});i.onfinish=()=>n(),i.oncancel=()=>n()}))}async function qe(t){const{el:e,exit:n,enter:i,swap:s,getEl:r,isStale:o}=t;if(!e)return void s();if(await Be(e,n),o?.())return;if(s(),await("function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t())))),o?.())return;const a=r?.()??e;a&&await Be(a,i)}function Ge(t){return t.__isEffect__=!0,Re({name:"Effect",fn:t,onRun:()=>{},supportsCleanup:!0})}function Xe(){const t=new V;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 Ze(t){if(t&&t.__isMatesRef__){const e=t;return r(t=>{e.__set(t)})}return r(t)}const Je=(t,n={})=>e`<x-view .view=${t} .props=${n}></x-view>`,Qe=Je,Ke=(e,n,i={})=>t(Je(e,i),n),tn=ze(!1),en=()=>tn.set(!0),nn=()=>tn.set(!1),sn=Ie("undefined"!=typeof window?window.location.pathname:"/");Ge(()=>{tn()?sn.lock():sn.unlock()}),"undefined"!=typeof window&&(window.addEventListener("popstate",()=>{const t=window.location.pathname;t!==sn.get()&&sn.set(t)}),window.addEventListener("hashchange",()=>{const t=window.location.pathname;t!==sn.get()&&sn.set(t)}),window.addEventListener("navigate",()=>{const t=window.location.pathname;t!==sn.get()&&sn.set(t)}));const rn=t=>{const e=sn.get();if(e===t)return!0;const n=t.split("/").filter(Boolean),i=e.split("/").filter(Boolean);if(n.length!==i.length)return!1;for(let t=0;t<n.length;t++){const e=n[t],s=i[t];if(e.startsWith(":")){if(!s)return!1}else if(e!==s)return!1}return!0},on=t=>{const i=Xe(),s=()=>t().options,r=t().options.notFound?{path:"*",component:t().options.notFound}:null,o=()=>{const{routes:e}=t();return e.find(t=>rn(t.path))??r},a=o(),l=ze(a),c=ze(a);return Ge(()=>{const t=c();if(t===l.get())return;const e=i.value;if(!e)return void l.set(t);const n=s(),r=l.get();qe({el:e,exit:r?.exit??n.exit??ae(200),enter:t?.enter??n.enter??oe(250),swap:()=>l.set(t),getEl:()=>i.value,isStale:()=>c.get()!==t})}),Ge(()=>{sn(),function(t){c.get()!==t&&c.set(t)}(o())}),et(()=>{const t=i.value;if(!t)return;const e=l.get(),n=s();Be(t,e?.enter??n.enter??oe(250))}),()=>{const t=l();return e`
32
+ `;i.__isErrorView__=!0,i.skipDevToolsRender=!0,this.view=i,this.name=e}}customElements.get("x-view")||customElements.define("x-view",Qt);class Kt 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 te(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 ee(t){return t.length>0&&/^[a-zA-Z-]+$/.test(t)}customElements.get("x-provider")||customElements.define("x-provider",Kt);let ne=0;function se(){return`_m${(ne++).toString(36)}`}const ie=Object.create(null),re={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function oe(t){const e=ie[t];if(void 0!==e)return e;const n=t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return ie[t]=n,n}function ae(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 le(t){return t.startsWith("&")||t.startsWith("@media")?t:Object.prototype.hasOwnProperty.call(re,t)?`@media (min-width: ${re[t]})`:null}function ce(t,e,n){const s=Object.create(null);for(const i in t){const r=t[i];let o="",a=null;for(const t in r){const e=r[t];if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const n=le(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 r=e;for(const t in r){const e=r[t];null!=e&&(ee(t)?s+=` ${oe(t)}: ${te(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`))}s.length>0&&(null===a&&(a=[]),a.push([s,n]));continue}ee(t)?o+=` ${oe(t)}: ${te(String(e))};\n`:console.warn(`[css-in-js] invalid property name skipped: "${t}"`)}}if(0===o.length&&null===a){s[i]="";continue}const l=n?.literal?i:`${i}${se()}`;if(o.length>0&&e.push(ae(l,o,"")),null!==a)for(let t=0;t<a.length;t++)e.push(ae(l,a[t][0],a[t][1]));s[i]=l}return s}function he(t){return Object.freeze(t)}var ue,de,fe,pe,me,_e,ge,ye;function ve(t){if(wt.templateInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a template function.`);if(wt.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(wt.setupInProgress)throw new Error(`[css-in-js] ${t}() must be called at module level, not inside a setup function.`)}let we=0;function be(t){return`${t}_kf${(we++).toString(36)}`}function Se(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}}`}class xe{constructor(){ue.add(this),de.set(this,""),fe.set(this,0),pe.set(this,null),me.set(this,[])}keyframes(t,e){const n=be(t);return this.appendRules(Se(n,e)),n}appendRules(t){""!==t&&(Et(this,me,"f").push(t),Et(this,fe,"f")>0&&Et(this,ue,"m",_e).call(this))}mount(){var t;Ct(this,fe,(t=Et(this,fe,"f"),++t),"f"),1===Et(this,fe,"f")&&(Et(this,ue,"m",_e).call(this),Et(this,pe,"f")||Et(this,ue,"m",ge).call(this))}unmount(){var t;Et(this,fe,"f")<=0||(Ct(this,fe,(t=Et(this,fe,"f"),--t),"f"),0===Et(this,fe,"f")&&Et(this,ue,"m",ye).call(this))}get refCount(){return Et(this,fe,"f")}get cssText(){return Et(this,de,"f")}get isMounted(){return Et(this,fe,"f")>0}get sheet(){return Et(this,pe,"f")}}de=new WeakMap,fe=new WeakMap,pe=new WeakMap,me=new WeakMap,ue=new WeakSet,_e=function(){if(0===Et(this,me,"f").length)return;const t=Et(this,me,"f").join("\n");Ct(this,me,[],"f"),Ct(this,de,Et(this,de,"f")+(Et(this,de,"f")?"\n":"")+t,"f"),Et(this,ue,"m",ge).call(this)},ge=function(){Et(this,pe,"f")||(Ct(this,pe,new CSSStyleSheet,"f"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,Et(this,pe,"f")]),Et(this,pe,"f").replaceSync(Et(this,de,"f"))},ye=function(){Et(this,pe,"f")&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==Et(this,pe,"f")),Ct(this,pe,null,"f")),Et(this,de,"f")&&(Et(this,me,"f").unshift(Et(this,de,"f")),Ct(this,de,"","f"))};let Ee=null,Ce=!1;function Ae(){return Ee||(Ee=new xe),Ee}function Me(){Ee||(Ee=new xe),Ce||(Ce=!0,queueMicrotask(()=>{Ce=!1,Ee.mount()}))}function ke(t,e){ve("globalCSS"),Me();const n=[],s=ce(t,n,e);return n.length>0&&Ee.appendRules(n.join("\n")),he(s)}function Re(t){ve("globalRawCSS"),Me(),Ee.appendRules(t)}const Te="__matesAnimationsInjected";function Oe(){globalThis[Te]||(globalThis[Te]=!0,Re('\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'),Re("\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"),ke({"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}))}Oe();class Pe{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 ze=(t,e,n)=>{const s="timeout"===n?setTimeout(()=>t(),e):setInterval(()=>t(),e);return Bt(s,"timeout"===n?()=>clearTimeout(s):()=>clearInterval(s)),s};function Ie(t=300,e="ease"){return{keyframes:[{opacity:0},{opacity:1}],options:{duration:t,easing:e,fill:"both"}}}function $e(t=300,e="ease"){return{keyframes:[{opacity:1},{opacity:0}],options:{duration:t,easing:e,fill:"both"}}}const De={up:"translateY(-100%)",down:"translateY(100%)",left:"translateX(-100%)",right:"translateX(100%)"};function Le(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 je(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])||je(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function Ne(t,e,n){const s=yt();let i;pt();try{i=t()}finally{mt();vt(s).forEach(t=>{"function"==typeof t.__subscribe&&e(t,n)})}return i}function Ue(t,e){if(bt(t),"AsyncFunction"===e.constructor.name)throw new Error(`${t.toLowerCase()}() does not support async functions.`);if(dt())throw new Error(`${t.toLowerCase()}() cannot be nested inside an effect() or memo().`)}function Fe(t){const{name:e,fn:n,onRun:s,supportsCleanup:i}=t;Ue(e,n);const r=new Set;let o,a=!1;const l=()=>{if(i&&o){try{o()}catch(t){console.error("Error in effect cleanup:",t)}o=void 0}},c=()=>{if(a)return;l();const t=new Set(r);r.clear();const e=()=>{a||jt.schedule(c)};let h;try{h=Ne(n,t=>{r.add(t.__subscribe(e))},e)}finally{t.forEach(t=>t())}if(a)return r.forEach(t=>t()),void r.clear();i&&"function"==typeof h&&(o=h),s(h)},h=()=>{a||(a=!0,l(),r.forEach(t=>t()),r.clear())};return c(),Bt(n,h),h}let Ve=0;function We(t,e){if("function"==typeof t){let e;return Fe({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):e=We(t,{skipRestrictedContextCheck:!0})}}),e}e?.skipRestrictedContextCheck||bt("Atom");let n=t;const s=++Ve,i=new Rt;function r(){return Yt(r,!1),ut()&&ft(r),n}return r.get=function(){return r()},r.set=function(t,e=!1){var o,a;n="function"==typeof t?t(n):t,r.skipDevToolsLog||(o=String(s),a=n,st.logAtomSet(o,a)),e||i.notify()},r.update=function(t,e=!1){var o;"object"==typeof n&&null!==n&&(t(n),r.skipDevToolsLog||(o=String(s),st.logAtomUpdate(o)),e||i.notify())},r.__subscribe=function(t){return i.subscribe(t)},r.toJSON=function(){return JSON.stringify(n)},Object.defineProperty(r,"name",{value:"atom",writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(r,"val",{get:()=>r(),set:t=>r.set(t),enumerable:!1,configurable:!0}),Object.defineProperty(r,"__version__",{get:()=>i.getVersion(),enumerable:!1}),Object.defineProperty(r,"__isAtom___",{value:!0,writable:!1,enumerable:!1}),Object.defineProperty(r,"__id__",{value:s,writable:!1,enumerable:!1}),r}function He(t,e){e?.skipRestrictedContextCheck||bt("iAtom");const n=We(Be(t),{skipRestrictedContextCheck:!0}),s=n.set;n.set=function(t,e=!1){const i="function"==typeof t?t(n.get()):t;s(Be(i),e)};const i=n;return delete i.update,i.name="iAtom",i}function Ye(t,e={}){e.skipRestrictedContextCheck||bt("superAtom"),Ut();const n=e.freeze??!1,s=n?Be(qe(t)):t;let i=!1,r="default";const o=We(n?Be(t):t,{skipRestrictedContextCheck:!0}),a=o.set;o.set=function(t,e=!1){if(i)return;const s="function"==typeof t?t(o.get()):t;a(n?Be(s):s,e)};const l=o.update;o.update=function(t,e=!1){if(!i){if(n)throw new Error("update() is not supported when freeze is enabled — use set() with a new value.");l(t,e)}};const c=o;return c.lock=function(t="default"){i=!0,r=t},c.unlock=function(t="default"){if(r!==t)throw new Error("Incorrect passcode. Cannot unlock atom.");i=!1},c.reset=function(){i||o.set(n?Be(qe(s)):s)},c.freeze=function(){je(o.get())},c.name="superAtom",c}function Be(t){return"object"==typeof t&&null!==t?je(t):t}function qe(t){try{return structuredClone(t)}catch{return t}}function Ge(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:(r,o,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),r.set(u.result),o.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 Xe(t){let e=null,n=null;const s=()=>{e&&(clearInterval(e),e=null,n=null)};return{createStartPollingMethod:i=>(...r)=>{t?.pollInterval?(s(),n=r,i(...r),e=setInterval(()=>{n&&i(...n)},t.pollInterval)):xt(new Error("pollInterval not specified in asyncAction options"))},createStopPollingMethod:()=>s,stopPolling:s}}function Ze(t,e){e?.allowInRestrictedContext||bt("Async Action");const n={...{cacheLimit:10,pollInterval:5e3},...e};let s=t;const i=new Set;let r=null,o=null,a=null,l=null;const c=Ge(n),h=Xe(n),u=We(null),d=We(null),f=We(!1),p=We("init"),m=t=>{i.forEach(e=>{if(void 0===e.filter||void 0===t||e.filter===t)try{e.fn()}catch(t){xt(t)}})},_=()=>{o?.isActive()&&(o.cancel(),o=null),r&&(r.abort(),r=null),f.set(!1),p.set("init")},g=async(t,e)=>{_(),f.set(!0),p.set("loading"),r=new AbortController;const n=r;try{let i;if(a){i=a((...e)=>s.call(t,...e),...e)}else i=s.call(t,...e);i?.__isZeroPromise__&&(o=i);let c=await i;if(n.signal.aborted||r!==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||r!==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{r===n&&(r=null),f.set(!1),o&&!o.isActive()&&(o=null)}},y=async(...t)=>{const e=this;if($t()){const n=zt(!1);if(n?._ssrPromiseQueue){const s=g(e,t).catch(()=>{});return n._ssrPromiseQueue.push(s),s}}return g(e,t)},v=c.createCacheMethod(u,d,p,g),w=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)=>{bt("subscribe");const n={fn:t,filter:e};i.add(n);const s=()=>i.delete(n);return Bt(t,s),s},cache:v,clearCache:w,startPolling:b,stopPolling:S,interceptBefore:t=>{a=t},interceptAfter:t=>{l=t},__isAsyncAction___:!0,__isAction___:!1});return Object.defineProperty(x,"abortController",{get:()=>r,enumerable:!0,configurable:!0}),Bt(x,()=>{i.clear(),h.stopPolling(),_()}),x}class Je{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)=>ze(t,e,"timeout"))(t,e)}executePending(t){return this.pendingArgs&&(this.lastResult=t.apply(this.pendingContext,this.pendingArgs),this.clearPending()),this.lastResult}}function Qe(t,e){return()=>{t.clearTimer(),t.clearPending(),e?.()}}function Ke(t,e){return()=>{if(t.pendingArgs&&t.timeoutId){t.clearTimer();return t.executePending(e)}return t.lastResult}}function tn(t,e){const n=new Je,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=Qe(n),s.flush=Ke(n,t),s}function en(t,e){const n=new Je;let s=0;const i=function(...i){const r=Date.now(),o=r-s;return o>=e?(s=r,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-o)),n.lastResult};return i.cancel=Qe(n,()=>{s=0}),i.flush=Ke(n,t),i}function nn(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 sn(t){const{el:e,exit:n,enter:s,swap:i,getEl:r,isStale:o}=t;if(!e)return void i();if(await nn(e,n),o?.())return;if(i(),await("function"!=typeof requestAnimationFrame?Promise.resolve():new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t())))),o?.())return;const a=r?.()??e;a&&await nn(a,s)}function rn(t){return t.__isEffect__=!0,Fe({name:"Effect",fn:t,onRun:()=>{},supportsCleanup:!0})}function on(){const t=new Tt;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 an(t){if(t&&t.__isMatesRef__){const e=t;return m.ref(t=>{e.__set(t)})}return m.ref(t)}const ln=(t,e={})=>j`<x-view .view=${t} .props=${e}></x-view>`,cn=ln,hn=We(!1),un=Ye("undefined"!=typeof window?window.location.pathname:"/");rn(()=>{hn()?un.lock():un.unlock()}),"undefined"!=typeof window&&(window.addEventListener("popstate",()=>{const t=window.location.pathname;t!==un.get()&&un.set(t)}),window.addEventListener("hashchange",()=>{const t=window.location.pathname;t!==un.get()&&un.set(t)}),window.addEventListener("navigate",()=>{const t=window.location.pathname;t!==un.get()&&un.set(t)}));const dn=t=>{const e=un.get();if(e===t)return!0;const n=t.split("/").filter(Boolean),s=e.split("/").filter(Boolean);if(n.length!==s.length)return!1;for(let t=0;t<n.length;t++){const e=n[t],i=s[t];if(e.startsWith(":")){if(!i)return!1}else if(e!==i)return!1}return!0},fn=t=>{const e=on(),n=()=>t().options,s=t().options.notFound?{path:"*",component:t().options.notFound}:null,i=()=>{const{routes:e}=t();return e.find(t=>dn(t.path))??s},r=i(),o=We(r),a=We(r);return rn(()=>{const t=a();if(t===o.get())return;const s=e.value;if(!s)return void o.set(t);const i=n(),r=o.get();sn({el:s,exit:r?.exit??i.exit??$e(200),enter:t?.enter??i.enter??Ie(250),swap:()=>o.set(t),getEl:()=>e.value,isStale:()=>a.get()!==t})}),rn(()=>{un(),function(t){a.get()!==t&&a.set(t)}(i())}),Vt(()=>{const t=e.value;if(!t)return;const s=o.get(),i=n();nn(t,s?.enter??i.enter??Ie(250))}),()=>{const t=o();return j`
27
33
  <div style="position:relative;overflow:hidden">
28
- <div ${Ze(i)}>
29
- ${t?Je(t.component,t.props??{}):n}
34
+ <div ${an(e)}>
35
+ ${t?ln(t.component,t.props??{}):F}
30
36
  </div>
31
37
  </div>
32
- `}};function an(t,e={}){return Je(on,{routes:t,options:e})}function ln(...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])})}const cn=()=>{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,i]of e)try{n[t]=JSON.parse(i)}catch{n[t]=i}return n},hn=ze(cn());let un=!1;Ge(()=>{const t=hn();un||tn()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const i=t[n];null!=i&&e.set(n,"object"==typeof i?JSON.stringify(i):String(i))}const n=e.toString(),i=window.location.pathname+window.location.search+(n?`#${n}`:"");window.history.replaceState(null,"",i)})(t)});const dn=()=>{tn()||(un=!0,hn.set(cn()),un=!1)};"undefined"!=typeof window&&window.addEventListener("hashchange",dn);const fn=()=>{if("undefined"==typeof window)return{};const t=new URLSearchParams(window.location.search),e={};for(const[n,i]of t)try{e[n]=JSON.parse(i)}catch{e[n]=i}return e},pn=ze(fn());let mn=!1;Ge(()=>{const t=pn();mn||tn()||(t=>{if("undefined"==typeof window)return;const e=new URLSearchParams;for(const n in t){const i=t[n];null!=i&&e.set(n,"object"==typeof i?JSON.stringify(i):String(i))}const n=e.toString(),i=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(null,"",i)})(t)});const _n=()=>{tn()||(mn=!0,pn.set(fn()),mn=!1)};"undefined"!=typeof window&&window.addEventListener("popstate",_n);const gn={get path(){return sn.get()},get hash(){return hn()},get qsObj(){return pn()}};function yn(t,e,n){tn()||(e?window.history.replaceState(n,"",t):window.history.pushState(n,"",t),sn.set(t))}const wn=(t,{view:e})=>rn(t)?e?Qe(e,{}):n:null,vn=(t,e)=>{const i=t.find(t=>rn(t.path));if(void 0===i)return e?()=>Je(e):()=>n;const{component:s}=i;return mt(s),()=>Je(s)};let bn=null,Sn=null;function En(t){bn=t}function Cn(t){Sn=t}function Mn(){return bn}function kn(){return Sn}const xn={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 An(t){return t>=200&&t<300}function Rn(t){return"string"==typeof t?{url:t}:t}function On(t){const{url:e="",host:n="",path:i,params:s={}}=t,r=e||i||"",o=/^https?:\/\//i.test(r)?r:`${n}${r}`,{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 i={},s={};for(const[t,r]of Object.entries(e))n.has(t)?i[t]=r:s[t]=r;return{pathParams:i,qsParams:s}}(o,s),c=Object.keys(a).length>0?ln(o,a):o;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}function zn(t,e){return t.add(e),()=>t.delete(e)}const Tn=new Set,In=new Set,Pn=new Set,Dn=t=>zn(Tn,t),Ln=t=>zn(In,t),jn=t=>zn(Pn,t),Nn=()=>{Tn.clear(),In.clear(),Pn.clear()};class $n{constructor(t={}){this.instanceBeforeFns=[],this.instanceAfterFns=[],this.instanceErrorFns=[],this.baseRequest=t}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}fetch(t){const e=new ie,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:i,url:s,host:r,params:o,path:a,...l}=n,c=On(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"}}}(i),u=(n.method??"GET").toUpperCase(),d=Mn(),f=kn();if(G()&&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 n=d(u,t);if(n){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});return n.handler(i,n.ctx).then(async t=>{if(!t.ok){const n=xn[t.status]||"UNKNOWN_ERROR";return void e.reject(new Error(`${n}: ${t.statusText}`))}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t)}).catch(t=>e.reject(t)),e}}}let p=c,m={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(m.headers).length&&delete m.headers;for(const t of this.instanceBeforeFns){const e=t(p,m);p=e.url,m=e.options}for(const t of Tn){const e=t(p,m);p=e.url,m=e.options}return fetch(p,{...m,signal:e.signal}).then(async t=>{let n=t;for(const t of this.instanceAfterFns)n=t(n);for(const t of In)n=t(n);if(!n.ok){const t=xn[n.status]||"UNKNOWN_ERROR",i=new Error(`${t}: ${n.statusText}`);for(const t of this.instanceErrorFns)try{t(i)}catch(t){}for(const t of Pn)try{t(i)}catch(t){}return void e.reject(i)}const i=n.headers.get("content-type");if(i?.includes("application/json")){const t=await n.json();e.resolve(t)}else e.resolve(n)}).catch(t=>{for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of Pn)try{e(t)}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:i,allowInRestrictedContext:s,...r}=t;return{baseRequest:r,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==i&&{pollInterval:i},...void 0!==s&&{allowInRestrictedContext:s}}}}(t);return Ne(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 Un=new $n,Fn=t=>Un.fetch(Rn(t)),Vn=t=>Un.Get(Rn(t)),Wn=t=>Un.Post(Rn(t)),Yn=t=>Un.Put(Rn(t)),Hn=t=>Un.Patch(Rn(t)),Bn=t=>Un.Delete(Rn(t)),qn=t=>Un.fetchAction(t),Gn=t=>Un.getAction(t),Xn=t=>Un.postAction(t),Zn=t=>Un.putAction(t),Jn=t=>Un.patchAction(t),Qn=t=>Un.deleteAction(t),Kn="mates-theme";function ti(t){return t.startsWith("--")?t:`--${t}`}function ei(t,e){let n="";for(const t in e){n+=` ${ti(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function ni(t){const e=Object.keys(t);if(0===e.length)throw new Error("[globalTheme] themes object must have at least one entry.");const n=e[0],i=e[1],s=t[n],r=[];r.push(ei(":root",s));for(const n of e)r.push(ei(`[data-theme="${n}"]`,t[n]));void 0!==i&&r.push(function(t){let e="";for(const n in t)e+=` ${ti(n)}: ${t[n]};\n`;return e?`@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n${e} }\n}`:""}(t[i])),Zt();const o=Xt(),a=r.filter(Boolean).join("\n");a&&o.appendRules(a);const l=Object.create(null);for(const t in s)l[t]=ti(t);const c=Object.freeze(l),h=function(){try{return localStorage.getItem(Kn)}catch{return null}}(),u=new Set(["auto",...e]),d=ze(null!==h&&u.has(h)?h:"auto",{skipRestrictedContextCheck:!0});return Object.defineProperty(d,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),Ge(()=>{const t=d();!function(t){"undefined"!=typeof document&&("auto"===t?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",t))}(t),function(t){try{"auto"===t?localStorage.removeItem(Kn):localStorage.setItem(Kn,t)}catch{}}(t)}),{cssVars:c,themeAtom:d}}function ii(t){Zt();const e=Xt(),n=ei(":root",t);n&&e.appendRules(n)}function si(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,i]=t,s=e?n:i;return"boolean"==typeof s?s?{action:"set",value:""}:{action:"remove"}:{action:"set",value:String(s)}}}return{action:"remove"}}function ri(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function oi(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,i]=t;return String(e?n:i)}}return null}const ai=new WeakMap,li=new WeakMap,ci=new WeakMap,hi=new WeakMap;class ui{constructor(t){this.el=t}attr(t){const e=this.el;ai.has(e)||ai.set(e,new Map);const n=ai.get(e),i=new Map;for(const[s,r]of Object.entries(t)){const t=si(r);"set"===t.action?(n.get(s)!==t.value&&e.setAttribute(s,t.value),i.set(s,t.value)):n.has(s)&&e.removeAttribute(s)}for(const t of n.keys())i.has(t)||e.removeAttribute(t);return ai.set(e,i),this}updateAttr(t){const e=this.el;ai.has(e)||ai.set(e,new Map);const n=ai.get(e),i=Object.fromEntries(n);t(i);const s=new Map;for(const[t,r]of Object.entries(i))n.get(t)!==r&&e.setAttribute(t,r),s.set(t,r);for(const t of n.keys())s.has(t)||e.removeAttribute(t);return ai.set(e,s),this}style(t){const e=this.el;li.has(e)||li.set(e,new Map);const n=li.get(e),i=new Map;for(const[s,r]of Object.entries(t)){const t=oi(r),o=ri(s);null!==t?(n.get(o)!==t&&e.style.setProperty(o,t),i.set(o,t)):n.has(o)&&e.style.removeProperty(o)}for(const t of n.keys())i.has(t)||e.style.removeProperty(t);return li.set(e,i),this}classes(t){const e=this.el;ci.has(e)||ci.set(e,new Set);const n=ci.get(e),i=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,i]=e;t&&i&&n(i)}else if(3===e.length){const[t,i,s]=e;n(t?i:s)}}else n(e);return e}if("object"==typeof t&&null!==t)for(const[e,i]of Object.entries(t))i&&n(e);return e}(t);for(const t of i)n.has(t)||e.classList.add(t);for(const t of n)i.has(t)||e.classList.remove(t);return ci.set(e,i),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 i of t.split(/\s+/))i&&n.classList.toggle(i,e);return this}html(e){if(null==e)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return t(e,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 i=this.el;hi.has(i)||hi.set(i,new Map);const s=hi.get(i),r=s.get(t);r&&i.removeEventListener(t,r.handler,r.options);const o=e;return i.addEventListener(t,o,n),s.set(t,{handler:o,options:n}),this}off(t,e){const n=this.el,i=hi.get(n);if(!i)return this;if(e){const s=i.get(t);s&&s.handler===e&&(n.removeEventListener(t,s.handler,s.options),i.delete(t))}else{const e=i.get(t);e&&(n.removeEventListener(t,e.handler,e.options),i.delete(t))}return this}once(t,e,n){const i="object"==typeof n?{...n,once:!0}:{once:!0};return this.el.addEventListener(t,e,i),this}delegate(t,e,n,i){const s=t=>{const i=t.target?.closest(e);i&&this.el.contains(i)&&n(t,i)};return this.el.addEventListener(t,s,i),hi.has(this.el)||hi.set(this.el,new Map),hi.get(this.el).set(`${t}:delegate:${e}`,{handler:s,options:i}),this}aria(t){const e=this.el;for(const[n,i]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==i||!1===i?e.removeAttribute(t):e.setAttribute(t,String(i))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,i]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,s=n.startsWith("data-")?n:`data-${n}`;null==i?e.removeAttribute(s):e.setAttribute(s,String(i));const r=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==i?delete e.dataset[r]:e.dataset[r]=String(i)}return this}}function di(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 ui(e.value)}return new ui(t)}const fi=t=>{const n=Xe(),i=t().condition,s=ze(i),r=ze(i);return Ge(()=>{const e=r();if(e===s.get())return;const i=n.value;if(!i)return void s.set(e);const o=t().config;qe({el:i,exit:o?.exit??ae(200),enter:o?.enter??oe(250),swap:()=>s.set(e),getEl:()=>n.value,isStale:()=>r.get()!==e})}),et(()=>{const e=n.value;if(!e)return;const i=t().config;Be(e,i?.enter??oe(250))}),()=>{const i=s(),{condition:o,trueTpl:a,falseTpl:l}=t();return r.get()!==o&&r.set(o),e`
33
- <div ${Ze(n)} style="position:relative">
34
- ${i?a:l}
38
+ `}};function pn(...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])})}const mn=()=>{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},_n=We(mn());let gn=!1;rn(()=>{const t=_n();gn||hn()||(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)})(t)});const yn=()=>{hn()||(gn=!0,_n.set(mn()),gn=!1)};"undefined"!=typeof window&&window.addEventListener("hashchange",yn);const vn=()=>{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},wn=We(vn());let bn=!1;rn(()=>{const t=wn();bn||hn()||(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)})(t)});const Sn=()=>{hn()||(bn=!0,wn.set(vn()),bn=!1)};"undefined"!=typeof window&&window.addEventListener("popstate",Sn);const xn={get path(){return un.get()},get hash(){return _n()},get qsObj(){return wn()}};let En=null,Cn=null;function An(){return En}function Mn(){return Cn}const kn={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 Rn(t){return"string"==typeof t?{url:t}:t}function Tn(t){const{url:e="",host:n="",path:s,params:i={}}=t,r=e||s||"",o=/^https?:\/\//i.test(r)?r:`${n}${r}`,{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,r]of Object.entries(e))n.has(t)?s[t]=r:i[t]=r;return{pathParams:s,qsParams:i}}(o,i),c=Object.keys(a).length>0?pn(o,a):o;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}function On(t,e){return t.add(e),()=>t.delete(e)}const Pn=new Set,zn=new Set,In=new Set;class $n{constructor(t={}){this.instanceBeforeFns=[],this.instanceAfterFns=[],this.instanceErrorFns=[],this.baseRequest=t}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}fetch(t){const e=new Pe,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:r,params:o,path:a,...l}=n,c=Tn(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=An(),f=Mn();if($t()&&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 n=d(u,t);if(n){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 s=new Request(c.startsWith("http")?c:`http://localhost${c}`,{method:u,headers:t,body:h.body??null});return n.handler(s,n.ctx).then(async t=>{if(!t.ok){const n=kn[t.status]||"UNKNOWN_ERROR";return void e.reject(new Error(`${n}: ${t.statusText}`))}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t)}).catch(t=>e.reject(t)),e}}}let p=c,m={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(m.headers).length&&delete m.headers;for(const t of this.instanceBeforeFns){const e=t(p,m);p=e.url,m=e.options}for(const t of Pn){const e=t(p,m);p=e.url,m=e.options}return fetch(p,{...m,signal:e.signal}).then(async t=>{let n=t;for(const t of this.instanceAfterFns)n=t(n);for(const t of zn)n=t(n);if(!n.ok){const t=kn[n.status]||"UNKNOWN_ERROR",s=new Error(`${t}: ${n.statusText}`);for(const t of this.instanceErrorFns)try{t(s)}catch(t){}for(const t of In)try{t(s)}catch(t){}return void e.reject(s)}const s=n.headers.get("content-type");if(s?.includes("application/json")){const t=await n.json();e.resolve(t)}else e.resolve(n)}).catch(t=>{for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of In)try{e(t)}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,...r}=t;return{baseRequest:r,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Ze(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 Dn=new $n,Ln="mates-theme";function jn(t){return t.startsWith("--")?t:`--${t}`}function Nn(t,e){let n="";for(const t in e){n+=` ${jn(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function Un(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 Fn(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Vn(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 Wn=new WeakMap,Hn=new WeakMap,Yn=new WeakMap,Bn=new WeakMap;class qn{constructor(t){this.el=t}attr(t){const e=this.el;Wn.has(e)||Wn.set(e,new Map);const n=Wn.get(e),s=new Map;for(const[i,r]of Object.entries(t)){const t=Un(r);"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 Wn.set(e,s),this}updateAttr(t){const e=this.el;Wn.has(e)||Wn.set(e,new Map);const n=Wn.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,r]of Object.entries(s))n.get(t)!==r&&e.setAttribute(t,r),i.set(t,r);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return Wn.set(e,i),this}style(t){const e=this.el;Hn.has(e)||Hn.set(e,new Map);const n=Hn.get(e),s=new Map;for(const[i,r]of Object.entries(t)){const t=Vn(r),o=Fn(i);null!==t?(n.get(o)!==t&&e.style.setProperty(o,t),s.set(o,t)):n.has(o)&&e.style.removeProperty(o)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return Hn.set(e,s),this}classes(t){const e=this.el;Yn.has(e)||Yn.set(e,new Set);const n=Yn.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 Yn.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 et(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;Bn.has(s)||Bn.set(s,new Map);const i=Bn.get(s),r=i.get(t);r&&s.removeEventListener(t,r.handler,r.options);const o=e;return s.addEventListener(t,o,n),i.set(t,{handler:o,options:n}),this}off(t,e){const n=this.el,s=Bn.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),Bn.has(this.el)||Bn.set(this.el,new Map),Bn.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 r=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[r]:e.dataset[r]=String(s)}return this}}function Gn(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 qn(e.value)}return new qn(t)}const Xn=t=>{const e=on(),n=t().condition,s=We(n),i=We(n);return rn(()=>{const n=i();if(n===s.get())return;const r=e.value;if(!r)return void s.set(n);const o=t().config;sn({el:r,exit:o?.exit??$e(200),enter:o?.enter??Ie(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Vt(()=>{const n=e.value;if(!n)return;const s=t().config;nn(n,s?.enter??Ie(250))}),()=>{const n=s(),{condition:r,trueTpl:o,falseTpl:a}=t();return i.get()!==r&&i.set(r),j`
39
+ <div ${an(e)} style="position:relative">
40
+ ${n?o:a}
35
41
  </div>
36
- `}};function pi(t,e,i=n,s){return Je(fi,{condition:t,trueTpl:e,falseTpl:i,config:s})}function mi(t,i,s){const{show:r,...o}=s;return pi(r,e`<x-view .view=${t} .props=${i}></x-view>`,n,o)}function _i(t){const e=z.isHookRunning;z.isHookRunning=!0;try{return t()}finally{z.isHookRunning=e}}function gi(t){var e,n,i,s;e=new WeakMap,n=new WeakMap,i=new WeakMap,s=new WeakMap;const r=a(class extends o{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),i.set(this,null),s.set(this,!1),t.type!==l.ELEMENT)throw new Error("eleHook() must be used as an element expression, e.g. html`<div ${myHook()}>`")}update(s,r){if(!L(this,n,"f")){j(this,i,s.element,"f");const o=di(L(this,i,"f")),a=_i(()=>t(o,...r));return j(this,e,a??null,"f"),void j(this,n,!0,"f")}L(this,e,"f")?.onUpdate&&_i(()=>L(this,e,"f").onUpdate(...r))}render(...t){}disconnected(){j(this,s,!0,"f"),L(this,e,"f")?.onCleanup&&L(this,e,"f").onCleanup()}reconnected(){L(this,s,"f")&&(j(this,s,!1,"f"),j(this,n,!1,"f"),j(this,e,null,"f"))}});return(...t)=>r(...t)}const yi=gi((t,e)=>(t.attr(e),{onUpdate(e){t.attr(e)},onCleanup(){t.attr({})}}));function wi(t){return yi(t)}function vi(t){}const bi=gi((t,e)=>{const n=t.el;let i=new Set;const s=t=>{const e=(t=>{const e=new Set;if(Array.isArray(t))for(const n of t)if(Array.isArray(n)){if(2===n.length){const[t,i]=n;t&&i&&e.add(i)}else if(3===n.length){const[t,i,s]=n,r=t?i:s;r&&e.add(r)}}else"string"==typeof n&&n&&e.add(n);else for(const[n,i]of Object.entries(t))i&&e.add(n);return e})(t);for(const t of i)e.has(t)||n.classList.remove(t);for(const t of e)i.has(t)||n.classList.add(t);i=e};return s(e),{onUpdate(t){s(t)},onCleanup(){for(const t of i)n.classList.remove(t);i=new Set}}});function Si(t){return bi(t)}function Ei(t){}function Ci(t){const e=z.isHookRunning;z.isHookRunning=!0;try{return t()}finally{z.isHookRunning=e}}function Mi(t){var e,n,i,s,r,c;e=new WeakMap,n=new WeakMap,i=new WeakMap,s=new WeakMap,r=new WeakMap,c=new WeakMap;const h=a(class extends o{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),i.set(this,!1),s.set(this,!1),r.set(this,null),c.set(this,t=>{L(this,s,"f")?j(this,r,t,"f"):this.setValue(t)}),t.type!==l.CHILD)throw new Error("htmlHook() must be used as a child expression, e.g. html`<div>${myHook()}</div>`")}update(i,o){if(j(this,s,!0,"f"),j(this,r,null,"f"),L(this,n,"f"))L(this,e,"f")?.onUpdate&&Ci(()=>L(this,e,"f").onUpdate(...o));else{const i=Ci(()=>t(L(this,c,"f"),...o));j(this,e,i??null,"f"),j(this,n,!0,"f")}if(j(this,s,!1,"f"),null!==L(this,r,"f")){const t=L(this,r,"f");return j(this,r,null,"f"),t}}render(...t){}disconnected(){j(this,i,!0,"f"),L(this,e,"f")?.onCleanup&&L(this,e,"f").onCleanup(),j(this,n,!1,"f"),j(this,e,null,"f")}reconnected(){L(this,i,"f")&&(j(this,i,!1,"f"),j(this,n,!1,"f"),j(this,e,null,"f"))}});return(...t)=>h(...t)}const ki=gi((t,e)=>{let n=e;const i=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?n.onVisible?.():n.onHidden?.()},{rootMargin:e.rootMargin??"0px",threshold:e.threshold??0});return i.observe(t.el),{onUpdate(t){n=t},onCleanup(){i.disconnect()}}});function xi(t){return ki(t)}function Ai(t,e){return ki({onVisible:t,...e})}function Ri(t,e){return ki({onHidden:t,...e})}const Oi=gi((t,e,n)=>{let i=e,s=!1,r=!0;const o=new IntersectionObserver(t=>{for(const e of t){const t=e.isIntersecting;if(r)return r=!1,void(s=t);t&&!s&&i(),s=t}},{rootMargin:n?.rootMargin??"0px",threshold:n?.threshold??0});return o.observe(t.el),{onUpdate(t,e){i=t},onCleanup(){o.disconnect(),s=!1,r=!0}}});function zi(t,e){return Oi(t,e)}function Ti(t,e){return Oi(t,e)}const Ii=gi((t,e)=>{e(t.el)}),Pi=gi((t,e)=>{let n=e;return{onUpdate(t){n=t},onCleanup(){n(t.el)}}});function Di(t){return Ii(t)}function Li(t){return Pi(t)}gi((t,e)=>({onUpdate(e){e(t.el)}}));const ji=Mi((t,n,i,r,o)=>{function a(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n??{}}:{keyFn:null,template:t,opts:e??{}}}function l(t,n,i,r){const o=r.columns??3,a=r.gap??12,l=r.containerClass??"",c=[`column-count:${o}`,`column-gap:${a}px`,r.containerStyle??""].filter(Boolean).join(";"),h=["break-inside:avoid",`margin-bottom:${a}px`,"display:inline-block","width:100%","box-sizing:border-box"].join(";"),u=t,d=s(u,n||((t,e)=>e),(t,n)=>e`
37
- <div style="${h}">${i(t,n)}</div>
38
- `);return e`
39
- <div class="${l}" style="${c}">
40
- ${d}
42
+ `}};function Zn(t,e,n=F,s){return ln(Xn,{condition:t,trueTpl:e,falseTpl:n,config:s})}function Jn(t){const e=wt.isHookRunning;wt.isHookRunning=!0;try{return t()}finally{wt.isHookRunning=e}}function Qn(t){var e,n,s,i;class r extends _.AsyncDirective{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,null),i.set(this,!1),t.type!==g.PartType.ELEMENT)throw new Error("eleHook() must be used as an element expression, e.g. html`<div ${myHook()}>`")}update(i,r){if(!Et(this,n,"f")){Ct(this,s,i.element,"f");const o=Gn(Et(this,s,"f")),a=Jn(()=>t(o,...r));return Ct(this,e,a??null,"f"),void Ct(this,n,!0,"f")}Et(this,e,"f")?.onUpdate&&Jn(()=>Et(this,e,"f").onUpdate(...r))}render(...t){}disconnected(){Ct(this,i,!0,"f"),Et(this,e,"f")?.onCleanup&&Et(this,e,"f").onCleanup()}reconnected(){Et(this,i,"f")&&(Ct(this,i,!1,"f"),Ct(this,n,!1,"f"),Ct(this,e,null,"f"))}}e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap;const o=g.directive(r);return(...t)=>o(...t)}const Kn=Qn((t,e)=>(t.attr(e),{onUpdate(e){t.attr(e)},onCleanup(){t.attr({})}}));const ts=Qn((t,e)=>{const n=t.el;let s=new Set;const i=t=>{const e=(t=>{const e=new Set;if(Array.isArray(t))for(const n of t)if(Array.isArray(n)){if(2===n.length){const[t,s]=n;t&&s&&e.add(s)}else if(3===n.length){const[t,s,i]=n,r=t?s:i;r&&e.add(r)}}else"string"==typeof n&&n&&e.add(n);else for(const[n,s]of Object.entries(t))s&&e.add(n);return e})(t);for(const t of s)e.has(t)||n.classList.remove(t);for(const t of e)s.has(t)||n.classList.add(t);s=e};return i(e),{onUpdate(t){i(t)},onCleanup(){for(const t of s)n.classList.remove(t);s=new Set}}});function es(t){const e=wt.isHookRunning;wt.isHookRunning=!0;try{return t()}finally{wt.isHookRunning=e}}function ns(t){var e,n,s,i,r,o;class a extends _.AsyncDirective{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,!1),i.set(this,!1),r.set(this,null),o.set(this,t=>{Et(this,i,"f")?Ct(this,r,t,"f"):this.setValue(t)}),t.type!==g.PartType.CHILD)throw new Error("htmlHook() must be used as a child expression, e.g. html`<div>${myHook()}</div>`")}update(s,a){if(Ct(this,i,!0,"f"),Ct(this,r,null,"f"),Et(this,n,"f"))Et(this,e,"f")?.onUpdate&&es(()=>Et(this,e,"f").onUpdate(...a));else{const s=es(()=>t(Et(this,o,"f"),...a));Ct(this,e,s??null,"f"),Ct(this,n,!0,"f")}if(Ct(this,i,!1,"f"),null!==Et(this,r,"f")){const t=Et(this,r,"f");return Ct(this,r,null,"f"),t}}render(...t){}disconnected(){Ct(this,s,!0,"f"),Et(this,e,"f")?.onCleanup&&Et(this,e,"f").onCleanup(),Ct(this,n,!1,"f"),Ct(this,e,null,"f")}reconnected(){Et(this,s,"f")&&(Ct(this,s,!1,"f"),Ct(this,n,!1,"f"),Ct(this,e,null,"f"))}}e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap;const l=g.directive(a);return(...t)=>l(...t)}const ss=Qn((t,e)=>{let n=e;const s=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?n.onVisible?.():n.onHidden?.()},{rootMargin:e.rootMargin??"0px",threshold:e.threshold??0});return s.observe(t.el),{onUpdate(t){n=t},onCleanup(){s.disconnect()}}});const is=Qn((t,e,n)=>{let s=e,i=!1,r=!0;const o=new IntersectionObserver(t=>{for(const e of t){const t=e.isIntersecting;if(r)return r=!1,void(i=t);t&&!i&&s(),i=t}},{rootMargin:n?.rootMargin??"0px",threshold:n?.threshold??0});return o.observe(t.el),{onUpdate(t,e){s=t},onCleanup(){o.disconnect(),i=!1,r=!0}}});const rs=Qn((t,e)=>{e(t.el)}),os=Qn((t,e)=>{let n=e;return{onUpdate(t){n=t},onCleanup(){n(t.el)}}});Qn((t,e)=>({onUpdate(e){e(t.el)}}));const as=ns((t,e,n,s,i)=>{function r(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n??{}}:{keyFn:null,template:t,opts:e??{}}}function o(t,e,n,s){const i=s.columns??3,r=s.gap??12,o=s.containerClass??"",a=[`column-count:${i}`,`column-gap:${r}px`,s.containerStyle??""].filter(Boolean).join(";"),l=["break-inside:avoid",`margin-bottom:${r}px`,"display:inline-block","width:100%","box-sizing:border-box"].join(";"),c=t,h=e?u.repeat(c,e,(t,e)=>j`
43
+ <div style="${l}">${n(t,e)}</div>
44
+ `):u.repeat(c,(t,e)=>e,(t,e)=>j`
45
+ <div style="${l}">${n(t,e)}</div>
46
+ `);return j`
47
+ <div class="${o}" style="${a}">
48
+ ${h}
41
49
  </div>
42
- `}const{keyFn:c,template:h,opts:u}=a(i,r,o);return t(l(n,c,h,u)),{onUpdate(e,n,i,s){const{keyFn:r,template:o,opts:c}=a(n,i,s);t(l(e,r,o,c))}}});function Ni(t,e,n,i){return ji(t,e,n,i)}var $i,Ui;$i=new WeakMap,Ui=new WeakMap;const Fi=a(class extends o{constructor(t){if(super(t),$i.set(this,null),Ui.set(this,null),t.type!==l.CHILD)throw new Error("memoTemplate() must be used as a child expression, e.g. html`<div>${memoTemplate(keys, () => html`...`)}</div>`")}update(t,[e,n]){return null!==L(this,$i,"f")&&function(t,e){if(t.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(t[n],e[n]))return!1;return!0}(L(this,$i,"f"),e)||(j(this,Ui,n(),"f"),j(this,$i,e.slice(),"f")),L(this,Ui,"f")}render(t,e){return e()}disconnected(){}reconnected(){}});function Vi(t,e){return Fi(t,e)}function Wi(t,e,n){const i={current:n},s=t=>{i.current?.(t)};return t.addEventListener(e,s),{handler:n,handlerRef:i,cleanup:()=>t.removeEventListener(e,s)}}function Yi(t){t.cleanup()}function Hi(t){for(const e of t.values())e.cleanup();t.clear()}function Bi(t,e){const n={current:e},i=e=>{const i=e.target;i&&!t.contains(i)&&n.current?.(e)};return document.addEventListener("mousedown",i,!0),{handler:e,cleanup:()=>document.removeEventListener("mousedown",i,!0),handlerRef:n}}const qi="__viewport__",Gi=new WeakMap;function Xi(t,e,n){const i=new Set;let s,r,o=!1;for(const[a,l]of Object.entries(e)){if(!l)continue;if("enterViewport"===a){s=l,o=!0;continue}if("exitViewport"===a){r=l,o=!0;continue}i.add(a);const e=n.get(a);e?e.handler!==l&&(e.handlerRef&&(e.handlerRef.current=l),e.handler=l):n.set(a,"clickOutside"===a?Bi(t,l):Wi(t,a,l))}if(o){i.add(qi);const e=n.get(qi);if(e){const t=e;t.enterRef&&(t.enterRef.current=s),t.exitRef&&(t.exitRef.current=r)}else n.set(qi,function(t,e,n){const i={current:e},s={current:n},r=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?i.current?.(e):s.current?.(e)},{threshold:0});return r.observe(t),{handler:e??n??(()=>{}),cleanup:()=>r.disconnect(),enterRef:i,exitRef:s}}(t,s,r))}for(const[t,e]of n)i.has(t)||(Yi(e),n.delete(t))}const Zi=gi((t,e)=>{const n=new Map,i=t.el;Xi(i,e,n);const s=()=>{Hi(n),Gi.delete(i)};return Gi.set(i,s),{onUpdate(t){Xi(i,t,n)},onCleanup(){s()}}});function Ji(t){return Zi(t)}function Qi(t){Gi.get(t)?.()}const Ki=gi((t,e,n)=>{const i=new Map;let s=null,r=n;const o=(t,e)=>{t!==s&&(Hi(i),s=t),function(t,e,n){const i=new Set;for(const[s,r]of Object.entries(e)){if(!r)continue;i.add(s);const e=n.get(s);e?e.handler!==r&&(e.handlerRef&&(e.handlerRef.current=r),e.handler=r):n.set(s,Wi(t,s,r))}for(const[t,e]of n)i.has(t)||(Yi(e),n.delete(t))}(t,e,i)},a=()=>{Hi(i),s=null},l=e.__subscribe(t=>{t?o(t,r):a()});return e.value&&o(e.value,n),{onUpdate(t,n){r=n,e.value&&o(e.value,n)},onCleanup(){a(),l()}}});function ts(t,e){return Ki(t,e)}function es(t){for(const e of t){if(!Array.isArray(e))return e;{const[t,n]=e;if(t)return n}}return n}const ns=gi((t,e)=>(t.style(e),{onUpdate(e){t.style(e)}}));function is(t){return ns(t)}function ss(t){}const rs=Mi((t,e,n)=>{if(n<16)throw new Error(`timer() ms must be at least 16ms (one frame at 60fps), got ${n}`);let i=e,s=n,r=null;const o=()=>t(i()),a=()=>{r=setInterval(o,s)};return o(),a(),{onUpdate(t,e){i=t,e!==s&&(s=e,null!==r&&(clearInterval(r),r=null),a())},onCleanup(){null!==r&&(clearInterval(r),r=null)}}});function os(t,e){return rs(t,e)}
50
+ `}const{keyFn:a,template:l,opts:c}=r(n,s,i);return t(o(e,a,l,c)),{onUpdate(e,n,s,i){const{keyFn:a,template:l,opts:c}=r(n,s,i);t(o(e,a,l,c))}}});var ls,cs;class hs extends _.AsyncDirective{constructor(t){if(super(t),ls.set(this,null),cs.set(this,null),t.type!==g.PartType.CHILD)throw new Error("memoTemplate() must be used as a child expression, e.g. html`<div>${memoTemplate(keys, () => html`...`)}</div>`")}update(t,[e,n]){return null!==Et(this,ls,"f")&&function(t,e){if(t.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(t[n],e[n]))return!1;return!0}(Et(this,ls,"f"),e)||(Ct(this,cs,n(),"f"),Ct(this,ls,e.slice(),"f")),Et(this,cs,"f")}render(t,e){return e()}disconnected(){}reconnected(){}}ls=new WeakMap,cs=new WeakMap;const us=g.directive(hs);function ds(t,e,n){const s={current:n},i=t=>{s.current?.(t)};return t.addEventListener(e,i),{handler:n,handlerRef:s,cleanup:()=>t.removeEventListener(e,i)}}function fs(t){t.cleanup()}function ps(t){for(const e of t.values())e.cleanup();t.clear()}function ms(t,e){const n={current:e},s=e=>{const s=e.target;s&&!t.contains(s)&&n.current?.(e)};return document.addEventListener("mousedown",s,!0),{handler:e,cleanup:()=>document.removeEventListener("mousedown",s,!0),handlerRef:n}}const _s="__viewport__",gs=new WeakMap;function ys(t,e,n){const s=new Set;let i,r,o=!1;for(const[a,l]of Object.entries(e)){if(!l)continue;if("enterViewport"===a){i=l,o=!0;continue}if("exitViewport"===a){r=l,o=!0;continue}s.add(a);const e=n.get(a);e?e.handler!==l&&(e.handlerRef&&(e.handlerRef.current=l),e.handler=l):n.set(a,"clickOutside"===a?ms(t,l):ds(t,a,l))}if(o){s.add(_s);const e=n.get(_s);if(e){const t=e;t.enterRef&&(t.enterRef.current=i),t.exitRef&&(t.exitRef.current=r)}else n.set(_s,function(t,e,n){const s={current:e},i={current:n},r=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?s.current?.(e):i.current?.(e)},{threshold:0});return r.observe(t),{handler:e??n??(()=>{}),cleanup:()=>r.disconnect(),enterRef:s,exitRef:i}}(t,i,r))}for(const[t,e]of n)s.has(t)||(fs(e),n.delete(t))}const vs=Qn((t,e)=>{const n=new Map,s=t.el;ys(s,e,n);const i=()=>{ps(n),gs.delete(s)};return gs.set(s,i),{onUpdate(t){ys(s,t,n)},onCleanup(){i()}}});const ws=Qn((t,e,n)=>{const s=new Map;let i=null,r=n;const o=(t,e)=>{t!==i&&(ps(s),i=t),function(t,e,n){const s=new Set;for(const[i,r]of Object.entries(e)){if(!r)continue;s.add(i);const e=n.get(i);e?e.handler!==r&&(e.handlerRef&&(e.handlerRef.current=r),e.handler=r):n.set(i,ds(t,i,r))}for(const[t,e]of n)s.has(t)||(fs(e),n.delete(t))}(t,e,s)},a=()=>{ps(s),i=null},l=e.__subscribe(t=>{t?o(t,r):a()});return e.value&&o(e.value,n),{onUpdate(t,n){r=n,e.value&&o(e.value,n)},onCleanup(){a(),l()}}});const bs=Qn((t,e)=>(t.style(e),{onUpdate(e){t.style(e)}}));const Ss=ns((t,e,n)=>{if(n<16)throw new Error(`timer() ms must be at least 16ms (one frame at 60fps), got ${n}`);let s=e,i=n,r=null;const o=()=>t(s()),a=()=>{r=setInterval(o,i)};return o(),a(),{onUpdate(t,e){s=t,e!==i&&(i=e,null!==r&&(clearInterval(r),r=null),a())},onCleanup(){null!==r&&(clearInterval(r),r=null)}}});
43
51
  /**
44
52
  * @license
45
53
  * Copyright 2021 Google LLC
46
54
  * SPDX-License-Identifier: BSD-3-Clause
47
- */function as(t){return"horizontal"===t?"width":"height"}function ls(t){return"horizontal"===t?"height":"width"}class cs{_getDefaultConfig(){return{direction:"vertical"}}constructor(t,e){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then(()=>this.config=e||this._getDefaultConfig())}set config(t){Object.assign(this,Object.assign({},this._getDefaultConfig(),t))}get config(){return{direction:this.direction}}get items(){return this._items}set items(t){this._setItems(t)}_setItems(t){t!==this._items&&(this._items=t,this._scheduleReflow())}get direction(){return this._direction}set direction(t){(t="horizontal"===t?t:"vertical")!==this._direction&&(this._direction=t,this._sizeDim="horizontal"===t?"width":"height",this._secondarySizeDim="horizontal"===t?"height":"width",this._positionDim="horizontal"===t?"left":"top",this._secondaryPositionDim="horizontal"===t?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(t){const{_viewDim1:e,_viewDim2:n}=this;Object.assign(this._viewportSize,t),n!==this._viewDim2?this._scheduleLayoutUpdate():e!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(t){Object.assign(this._latestCoords,t);const e=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim];Math.abs(e-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(t=!1){(t||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(t){this._pin=t,this._triggerReflow()}get pin(){if(null!==this._pin){const{index:t,block:e}=this._pin;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null}_clampScrollPosition(t){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(t,this.totalScrollSize[as(this.direction)]-this._viewDim1))}unpin(){null!==this._pin&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then(()=>this.reflowIfNeeded())}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(null!==this.pin){const t=this._scrollPosition,{index:e,block:n}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:n||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=t-this._scrollPosition}}_calculateScrollIntoViewPosition(t){const{block:e}=t,n=Math.min(this.items.length,Math.max(0,t.index)),i=this._getItemPosition(n)[this._positionDim];let s=i;if("start"!==e){const t=this._getItemSize(n)[this._sizeDim];if("center"===e)s=i-.5*this._viewDim1+.5*t;else{const n=i-this._viewDim1+t;if("end"===e)s=n;else{const t=this._scrollPosition;s=Math.abs(t-i)<Math.abs(t-n)?i:n}}}return s+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(s)}getScrollIntoViewCoordinates(t){return{[this._positionDim]:this._calculateScrollIntoViewPosition(t)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){const t=new Map;if(-1!==this._first&&-1!==this._last)for(let e=this._first;e<=this._last;e++)t.set(e,this._getItemPosition(e));const e={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:t};this._scrollError&&(e.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(e)}get _num(){return-1===this._first||-1===this._last?0:this._last-this._first+1}_checkThresholds(){if(0===this._viewDim1&&this._num>0||null!==this._pin)this._scheduleReflow();else{const t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>t||this._physicalMax<e?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(t){if(-1===this._first||-1===this._last)return;let e=this._first;for(;e<this._last&&Math.round(this._getItemPosition(e)[this._positionDim]+this._getItemSize(e)[this._sizeDim])<=Math.round(this._scrollPosition);)e++;let n=this._last;for(;n>this._first&&Math.round(this._getItemPosition(n)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)n--;e===this._firstVisible&&n===this._lastVisible||(this._firstVisible=e,this._lastVisible=n,t?.emit&&this._sendVisibilityChangedMessage())}}
55
+ */
56
+ function xs(t){return"horizontal"===t?"width":"height"}function Es(t){return"horizontal"===t?"height":"width"}class Cs{_getDefaultConfig(){return{direction:"vertical"}}constructor(t,e){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then(()=>this.config=e||this._getDefaultConfig())}set config(t){Object.assign(this,Object.assign({},this._getDefaultConfig(),t))}get config(){return{direction:this.direction}}get items(){return this._items}set items(t){this._setItems(t)}_setItems(t){t!==this._items&&(this._items=t,this._scheduleReflow())}get direction(){return this._direction}set direction(t){(t="horizontal"===t?t:"vertical")!==this._direction&&(this._direction=t,this._sizeDim="horizontal"===t?"width":"height",this._secondarySizeDim="horizontal"===t?"height":"width",this._positionDim="horizontal"===t?"left":"top",this._secondaryPositionDim="horizontal"===t?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(t){const{_viewDim1:e,_viewDim2:n}=this;Object.assign(this._viewportSize,t),n!==this._viewDim2?this._scheduleLayoutUpdate():e!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(t){Object.assign(this._latestCoords,t);const e=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim];Math.abs(e-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(t=!1){(t||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(t){this._pin=t,this._triggerReflow()}get pin(){if(null!==this._pin){const{index:t,block:e}=this._pin;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null}_clampScrollPosition(t){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(t,this.totalScrollSize[xs(this.direction)]-this._viewDim1))}unpin(){null!==this._pin&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then(()=>this.reflowIfNeeded())}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(null!==this.pin){const t=this._scrollPosition,{index:e,block:n}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:n||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=t-this._scrollPosition}}_calculateScrollIntoViewPosition(t){const{block:e}=t,n=Math.min(this.items.length,Math.max(0,t.index)),s=this._getItemPosition(n)[this._positionDim];let i=s;if("start"!==e){const t=this._getItemSize(n)[this._sizeDim];if("center"===e)i=s-.5*this._viewDim1+.5*t;else{const n=s-this._viewDim1+t;if("end"===e)i=n;else{const t=this._scrollPosition;i=Math.abs(t-s)<Math.abs(t-n)?s:n}}}return i+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(i)}getScrollIntoViewCoordinates(t){return{[this._positionDim]:this._calculateScrollIntoViewPosition(t)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){const t=new Map;if(-1!==this._first&&-1!==this._last)for(let e=this._first;e<=this._last;e++)t.set(e,this._getItemPosition(e));const e={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:t};this._scrollError&&(e.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(e)}get _num(){return-1===this._first||-1===this._last?0:this._last-this._first+1}_checkThresholds(){if(0===this._viewDim1&&this._num>0||null!==this._pin)this._scheduleReflow();else{const t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>t||this._physicalMax<e?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(t){if(-1===this._first||-1===this._last)return;let e=this._first;for(;e<this._last&&Math.round(this._getItemPosition(e)[this._positionDim]+this._getItemSize(e)[this._sizeDim])<=Math.round(this._scrollPosition);)e++;let n=this._last;for(;n>this._first&&Math.round(this._getItemPosition(n)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)n--;e===this._firstVisible&&n===this._lastVisible||(this._firstVisible=e,this._lastVisible=n,t?.emit&&this._sendVisibilityChangedMessage())}}
48
57
  /**
49
58
  * @license
50
59
  * Copyright 2021 Google LLC
51
60
  * SPDX-License-Identifier: BSD-3-Clause
52
- */class hs{constructor(t){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,!0===t?.roundAverageSize&&(this._roundAverageSize=!0)}set(t,e){const n=this._map.get(t)||0;this._map.set(t,e),this.totalSize+=e-n}get averageSize(){if(this._map.size>0){const t=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(t):t}return 0}getSize(t){return this._map.get(t)}clear(){this._map.clear(),this.totalSize=0}}
61
+ */class As{constructor(t){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,!0===t?.roundAverageSize&&(this._roundAverageSize=!0)}set(t,e){const n=this._map.get(t)||0;this._map.set(t,e),this.totalSize+=e-n}get averageSize(){if(this._map.size>0){const t=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(t):t}return 0}getSize(t){return this._map.get(t)}clear(){this._map.clear(),this.totalSize=0}}
53
62
  /**
54
63
  * @license
55
64
  * Copyright 2021 Google LLC
56
65
  * SPDX-License-Identifier: BSD-3-Clause
57
- */const us=t=>Object.assign({type:gs},t);function ds(t){return"horizontal"===t?"marginLeft":"marginTop"}function fs(t){return"horizontal"===t?"marginRight":"marginBottom"}function ps(t){return"horizontal"===t?"xOffset":"yOffset"}function ms(t,e){const n=[t,e].sort();return n[1]<=0?Math.min(...n):n[0]>=0?Math.max(...n):n[0]+n[1]}class _s{constructor(){this._childSizeCache=new hs,this._marginSizeCache=new hs,this._metricsCache=new Map}update(t,e){const n=new Set;Object.keys(t).forEach(i=>{const s=Number(i);this._metricsCache.set(s,t[s]),this._childSizeCache.set(s,t[s][as(e)]),n.add(s),n.add(s+1)});for(const t of n){const n=this._metricsCache.get(t)?.[ds(e)]||0,i=this._metricsCache.get(t-1)?.[fs(e)]||0;this._marginSizeCache.set(t,ms(n,i))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(t,e){return this._metricsCache.get(t)?.[ds(e)]||0}getChildSize(t){return this._childSizeCache.getSize(t)}getMarginSize(t){return this._marginSizeCache.getSize(t)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}class gs extends cs{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new _s,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(t){this._metricsCache.update(t,this.direction),this._scheduleReflow()}_getPhysicalItem(t){return this._newPhysicalItems.get(t)??this._physicalItems.get(t)}_getSize(t){return this._getPhysicalItem(t)&&this._metricsCache.getChildSize(t)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(t){const e=this._metricsCache;if(-1===this._first||-1===this._last)return e.averageMarginSize+t*(e.averageMarginSize+this._getAverageSize());if(t<this._first){const n=this._first-t;return this._getPhysicalItem(this._first).pos-(e.getMarginSize(this._first-1)||e.averageMarginSize)-(n*e.averageChildSize+(n-1)*e.averageMarginSize)}{const n=t-this._last;return this._getPhysicalItem(this._last).pos+(e.getChildSize(this._last)||e.averageChildSize)+(e.getMarginSize(this._last)||e.averageMarginSize)+n*(e.averageChildSize+e.averageMarginSize)}}_getPosition(t){const e=this._getPhysicalItem(t),{averageMarginSize:n}=this._metricsCache;return 0===t?this._metricsCache.getMarginSize(0)??n:e?e.pos:this._estimatePosition(t)}_calculateAnchor(t,e){return t<=0?0:e>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((t+e)/2/this._delta)))}_getAnchor(t,e){if(0===this._physicalItems.size)return this._calculateAnchor(t,e);if(this._first<0)return this._calculateAnchor(t,e);if(this._last<0)return this._calculateAnchor(t,e);const n=this._getPhysicalItem(this._first),i=this._getPhysicalItem(this._last),s=n.pos;if(i.pos+this._metricsCache.getChildSize(this._last)<t)return this._calculateAnchor(t,e);if(s>e)return this._calculateAnchor(t,e);let r=this._firstVisible-1,o=-1/0;for(;o<t;){o=this._getPhysicalItem(++r).pos+this._metricsCache.getChildSize(r)}return r}_getActiveItems(){0===this._viewDim1||0===this.items.length?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;const t=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t,this._stable=!0}_getItems(){const t=this._newPhysicalItems;let e,n;if(this._stable=!0,null!==this.pin){const{index:t}=this.pin;this._anchorIdx=t,this._anchorPos=this._getPosition(t)}if(e=this._scrollPosition-this._overhang,n=this._scrollPosition+this._viewDim1+this._overhang,n<0||e>this._scrollSize)return void this._clearItems();null!==this._anchorIdx&&null!==this._anchorPos||(this._anchorIdx=this._getAnchor(e,n),this._anchorPos=this._getPosition(this._anchorIdx));let i=this._getSize(this._anchorIdx);void 0===i&&(this._stable=!1,i=this._getAverageSize());const s=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,r=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;0===this._anchorIdx&&(this._anchorPos=s),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-r-i);let o=0;for(this._anchorPos+i+r<e&&(o=e-(this._anchorPos+i+r)),this._anchorPos-s>n&&(o=n-(this._anchorPos-s)),o&&(this._scrollPosition-=o,e-=o,n-=o,this._scrollError+=o),t.set(this._anchorIdx,{pos:this._anchorPos,size:i}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-s,this._physicalMax=this._anchorPos+i+r;this._physicalMin>e&&this._first>0;){let e=this._getSize(--this._first);void 0===e&&(this._stable=!1,e=this._getAverageSize());let n=this._metricsCache.getMarginSize(this._first);void 0===n&&(this._stable=!1,n=this._metricsCache.averageMarginSize),this._physicalMin-=e;const i=this._physicalMin;if(t.set(this._first,{pos:i,size:e}),this._physicalMin-=n,!1===this._stable&&!1===this._estimate)break}for(;this._physicalMax<n&&this._last<this.items.length-1;){let e=this._getSize(++this._last);void 0===e&&(this._stable=!1,e=this._getAverageSize());let n=this._metricsCache.getMarginSize(this._last);void 0===n&&(this._stable=!1,n=this._metricsCache.averageMarginSize);const i=this._physicalMax;if(t.set(this._last,{pos:i,size:e}),this._physicalMax+=e+n,!this._stable&&!this._estimate)break}const a=this._calculateError();a&&(this._physicalMin-=a,this._physicalMax-=a,this._anchorPos-=a,this._scrollPosition-=a,t.forEach(t=>t.pos-=a),this._scrollError+=a),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t)}_calculateError(){return 0===this._first?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){const{_first:t,_last:e}=this;super._reflow(),(-1===this._first&&-1===this._last||this._first===t&&this._last===e)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){const{averageMarginSize:t}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(t+this._getAverageSize())+t)}get _delta(){const{averageMarginSize:t}=this._metricsCache;return this._getAverageSize()+t}_getItemPosition(t){return{[this._positionDim]:this._getPosition(t),[this._secondaryPositionDim]:0,[ps(this.direction)]:-(this._metricsCache.getLeadingMarginValue(t,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(t){return{[this._sizeDim]:this._getSize(t)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}var ys=Object.freeze({__proto__:null,FlowLayout:gs,flow:us});
66
+ */const Ms=t=>Object.assign({type:zs},t);function ks(t){return"horizontal"===t?"marginLeft":"marginTop"}function Rs(t){return"horizontal"===t?"marginRight":"marginBottom"}function Ts(t){return"horizontal"===t?"xOffset":"yOffset"}function Os(t,e){const n=[t,e].sort();return n[1]<=0?Math.min(...n):n[0]>=0?Math.max(...n):n[0]+n[1]}class Ps{constructor(){this._childSizeCache=new As,this._marginSizeCache=new As,this._metricsCache=new Map}update(t,e){const n=new Set;Object.keys(t).forEach(s=>{const i=Number(s);this._metricsCache.set(i,t[i]),this._childSizeCache.set(i,t[i][xs(e)]),n.add(i),n.add(i+1)});for(const t of n){const n=this._metricsCache.get(t)?.[ks(e)]||0,s=this._metricsCache.get(t-1)?.[Rs(e)]||0;this._marginSizeCache.set(t,Os(n,s))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(t,e){return this._metricsCache.get(t)?.[ks(e)]||0}getChildSize(t){return this._childSizeCache.getSize(t)}getMarginSize(t){return this._marginSizeCache.getSize(t)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}class zs extends Cs{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new Ps,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(t){this._metricsCache.update(t,this.direction),this._scheduleReflow()}_getPhysicalItem(t){return this._newPhysicalItems.get(t)??this._physicalItems.get(t)}_getSize(t){return this._getPhysicalItem(t)&&this._metricsCache.getChildSize(t)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(t){const e=this._metricsCache;if(-1===this._first||-1===this._last)return e.averageMarginSize+t*(e.averageMarginSize+this._getAverageSize());if(t<this._first){const n=this._first-t;return this._getPhysicalItem(this._first).pos-(e.getMarginSize(this._first-1)||e.averageMarginSize)-(n*e.averageChildSize+(n-1)*e.averageMarginSize)}{const n=t-this._last;return this._getPhysicalItem(this._last).pos+(e.getChildSize(this._last)||e.averageChildSize)+(e.getMarginSize(this._last)||e.averageMarginSize)+n*(e.averageChildSize+e.averageMarginSize)}}_getPosition(t){const e=this._getPhysicalItem(t),{averageMarginSize:n}=this._metricsCache;return 0===t?this._metricsCache.getMarginSize(0)??n:e?e.pos:this._estimatePosition(t)}_calculateAnchor(t,e){return t<=0?0:e>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((t+e)/2/this._delta)))}_getAnchor(t,e){if(0===this._physicalItems.size)return this._calculateAnchor(t,e);if(this._first<0)return this._calculateAnchor(t,e);if(this._last<0)return this._calculateAnchor(t,e);const n=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),i=n.pos;if(s.pos+this._metricsCache.getChildSize(this._last)<t)return this._calculateAnchor(t,e);if(i>e)return this._calculateAnchor(t,e);let r=this._firstVisible-1,o=-1/0;for(;o<t;){o=this._getPhysicalItem(++r).pos+this._metricsCache.getChildSize(r)}return r}_getActiveItems(){0===this._viewDim1||0===this.items.length?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;const t=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t,this._stable=!0}_getItems(){const t=this._newPhysicalItems;let e,n;if(this._stable=!0,null!==this.pin){const{index:t}=this.pin;this._anchorIdx=t,this._anchorPos=this._getPosition(t)}if(e=this._scrollPosition-this._overhang,n=this._scrollPosition+this._viewDim1+this._overhang,n<0||e>this._scrollSize)return void this._clearItems();null!==this._anchorIdx&&null!==this._anchorPos||(this._anchorIdx=this._getAnchor(e,n),this._anchorPos=this._getPosition(this._anchorIdx));let s=this._getSize(this._anchorIdx);void 0===s&&(this._stable=!1,s=this._getAverageSize());const i=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,r=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;0===this._anchorIdx&&(this._anchorPos=i),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-r-s);let o=0;for(this._anchorPos+s+r<e&&(o=e-(this._anchorPos+s+r)),this._anchorPos-i>n&&(o=n-(this._anchorPos-i)),o&&(this._scrollPosition-=o,e-=o,n-=o,this._scrollError+=o),t.set(this._anchorIdx,{pos:this._anchorPos,size:s}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-i,this._physicalMax=this._anchorPos+s+r;this._physicalMin>e&&this._first>0;){let e=this._getSize(--this._first);void 0===e&&(this._stable=!1,e=this._getAverageSize());let n=this._metricsCache.getMarginSize(this._first);void 0===n&&(this._stable=!1,n=this._metricsCache.averageMarginSize),this._physicalMin-=e;const s=this._physicalMin;if(t.set(this._first,{pos:s,size:e}),this._physicalMin-=n,!1===this._stable&&!1===this._estimate)break}for(;this._physicalMax<n&&this._last<this.items.length-1;){let e=this._getSize(++this._last);void 0===e&&(this._stable=!1,e=this._getAverageSize());let n=this._metricsCache.getMarginSize(this._last);void 0===n&&(this._stable=!1,n=this._metricsCache.averageMarginSize);const s=this._physicalMax;if(t.set(this._last,{pos:s,size:e}),this._physicalMax+=e+n,!this._stable&&!this._estimate)break}const a=this._calculateError();a&&(this._physicalMin-=a,this._physicalMax-=a,this._anchorPos-=a,this._scrollPosition-=a,t.forEach(t=>t.pos-=a),this._scrollError+=a),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=t)}_calculateError(){return 0===this._first?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){const{_first:t,_last:e}=this;super._reflow(),(-1===this._first&&-1===this._last||this._first===t&&this._last===e)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){const{averageMarginSize:t}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(t+this._getAverageSize())+t)}get _delta(){const{averageMarginSize:t}=this._metricsCache;return this._getAverageSize()+t}_getItemPosition(t){return{[this._positionDim]:this._getPosition(t),[this._secondaryPositionDim]:0,[Ts(this.direction)]:-(this._metricsCache.getLeadingMarginValue(t,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(t){return{[this._sizeDim]:this._getSize(t)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}var Is=Object.freeze({__proto__:null,FlowLayout:zs,flow:Ms});
58
67
  /**
59
68
  * @license
60
69
  * Copyright 2021 Google LLC
61
70
  * SPDX-License-Identifier: BSD-3-Clause
62
- */function ws(t){return"horizontal"===t?"row":"column"}class vs extends cs{constructor(){super(...arguments),this._itemSize={},this._gaps={},this._padding={}}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{itemSize:{width:"300px",height:"300px"},gap:"8px",padding:"match-gap"})}get _gap(){return this._gaps.row}get _idealSize(){return this._itemSize[as(this.direction)]}get _idealSize1(){return this._itemSize[as(this.direction)]}get _idealSize2(){return this._itemSize[ls(this.direction)]}get _gap1(){return this._gaps[(t=this.direction,"horizontal"===t?"column":"row")];var t}get _gap2(){return this._gaps[ws(this.direction)]}get _padding1(){const t=this._padding,[e,n]="horizontal"===this.direction?["left","right"]:["top","bottom"];return[t[e],t[n]]}get _padding2(){const t=this._padding,[e,n]="horizontal"===this.direction?["top","bottom"]:["left","right"];return[t[e],t[n]]}set itemSize(t){const e=this._itemSize;"string"==typeof t&&(t={width:t,height:t});const n=parseInt(t.width,10),i=parseInt(t.height,10);n!==e.width&&(e.width=n,this._triggerReflow()),i!==e.height&&(e.height=i,this._triggerReflow())}set gap(t){this._setGap(t)}_setGap(t){const e=t.split(" ").map(t=>function(t){return"auto"===t?1/0:parseInt(t,10)}(t)),n=this._gaps;e[0]!==n.row&&(n.row=e[0],this._triggerReflow()),void 0===e[1]?e[0]!==n.column&&(n.column=e[0],this._triggerReflow()):e[1]!==n.column&&(n.column=e[1],this._triggerReflow())}set padding(t){const e=this._padding,n=t.split(" ").map(t=>function(t){return"match-gap"===t?1/0:parseInt(t,10)}(t));1===n.length?(e.top=e.right=e.bottom=e.left=n[0],this._triggerReflow()):2===n.length?(e.top=e.bottom=n[0],e.right=e.left=n[1],this._triggerReflow()):3===n.length?(e.top=n[0],e.right=e.left=n[1],e.bottom=n[2],this._triggerReflow()):4===n.length&&(["top","right","bottom","left"].forEach((t,i)=>e[t]=n[i]),this._triggerReflow())}}
71
+ */function $s(t){return"horizontal"===t?"row":"column"}class Ds extends Cs{constructor(){super(...arguments),this._itemSize={},this._gaps={},this._padding={}}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{itemSize:{width:"300px",height:"300px"},gap:"8px",padding:"match-gap"})}get _gap(){return this._gaps.row}get _idealSize(){return this._itemSize[xs(this.direction)]}get _idealSize1(){return this._itemSize[xs(this.direction)]}get _idealSize2(){return this._itemSize[Es(this.direction)]}get _gap1(){return this._gaps[(t=this.direction,"horizontal"===t?"column":"row")];var t}get _gap2(){return this._gaps[$s(this.direction)]}get _padding1(){const t=this._padding,[e,n]="horizontal"===this.direction?["left","right"]:["top","bottom"];return[t[e],t[n]]}get _padding2(){const t=this._padding,[e,n]="horizontal"===this.direction?["top","bottom"]:["left","right"];return[t[e],t[n]]}set itemSize(t){const e=this._itemSize;"string"==typeof t&&(t={width:t,height:t});const n=parseInt(t.width,10),s=parseInt(t.height,10);n!==e.width&&(e.width=n,this._triggerReflow()),s!==e.height&&(e.height=s,this._triggerReflow())}set gap(t){this._setGap(t)}_setGap(t){const e=t.split(" ").map(t=>function(t){return"auto"===t?1/0:parseInt(t,10)}(t)),n=this._gaps;e[0]!==n.row&&(n.row=e[0],this._triggerReflow()),void 0===e[1]?e[0]!==n.column&&(n.column=e[0],this._triggerReflow()):e[1]!==n.column&&(n.column=e[1],this._triggerReflow())}set padding(t){const e=this._padding,n=t.split(" ").map(t=>function(t){return"match-gap"===t?1/0:parseInt(t,10)}(t));1===n.length?(e.top=e.right=e.bottom=e.left=n[0],this._triggerReflow()):2===n.length?(e.top=e.bottom=n[0],e.right=e.left=n[1],this._triggerReflow()):3===n.length?(e.top=n[0],e.right=e.left=n[1],e.bottom=n[2],this._triggerReflow()):4===n.length&&(["top","right","bottom","left"].forEach((t,s)=>e[t]=n[s]),this._triggerReflow())}}
63
72
  /**
64
73
  * @license
65
74
  * Copyright 2021 Google LLC
66
75
  * SPDX-License-Identifier: BSD-3-Clause
67
- */class bs extends vs{constructor(){super(...arguments),this._metrics=null,this.flex=null,this.justify=null}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{flex:!1,justify:"start"})}set gap(t){super._setGap(t)}_updateLayout(){const t=this.justify,[e,n]=this._padding1,[i,s]=this._padding2;["_gap1","_gap2"].forEach(e=>{const n=this[e];if(n===1/0&&!["space-between","space-around","space-evenly"].includes(t))throw new Error("grid layout: gap can only be set to 'auto' when justify is set to 'space-between', 'space-around' or 'space-evenly'");if(n===1/0&&"_gap2"===e)throw new Error(`grid layout: ${ws(this.direction)}-gap cannot be set to 'auto' when direction is set to ${this.direction}`)});const r=this.flex||["start","center","end"].includes(t),o={rolumns:-1,itemSize1:-1,itemSize2:-1,gap1:this._gap1===1/0?-1:this._gap1,gap2:r?this._gap2:0,padding1:{start:e===1/0?this._gap1:e,end:n===1/0?this._gap1:n},padding2:r?{start:i===1/0?this._gap2:i,end:s===1/0?this._gap2:s}:{start:0,end:0},positions:[]},a=this._viewDim2-o.padding2.start-o.padding2.end;if(a<=0)o.rolumns=0;else{const i=r?o.gap2:0;let s,l=0,c=0;if(a>=this._idealSize2&&(l=Math.floor((a-this._idealSize2)/(this._idealSize2+i))+1,c=l*this._idealSize2+(l-1)*i),this.flex){(a-c)/(this._idealSize2+i)>=.5&&(l+=1),o.rolumns=l,o.itemSize2=Math.round((a-i*(l-1))/l);switch(!0===this.flex?"area":this.flex.preserve){case"aspect-ratio":o.itemSize1=Math.round(this._idealSize1/this._idealSize2*o.itemSize2);break;case as(this.direction):o.itemSize1=Math.round(this._idealSize1);break;default:o.itemSize1=Math.round(this._idealSize1*this._idealSize2/o.itemSize2)}}else o.itemSize1=this._idealSize1,o.itemSize2=this._idealSize2,o.rolumns=l;if(r){const e=o.rolumns*o.itemSize2+(o.rolumns-1)*o.gap2;s=this.flex||"start"===t?o.padding2.start:"end"===t?this._viewDim2-o.padding2.end-e:Math.round(this._viewDim2/2-e/2)}else{const i=a-o.rolumns*o.itemSize2;"space-between"===t?(o.gap2=Math.round(i/(o.rolumns-1)),s=0):"space-around"===t?(o.gap2=Math.round(i/o.rolumns),s=Math.round(o.gap2/2)):(o.gap2=Math.round(i/(o.rolumns+1)),s=o.gap2),this._gap1===1/0&&(o.gap1=o.gap2,e===1/0&&(o.padding1.start=s),n===1/0&&(o.padding1.end=s))}for(let t=0;t<o.rolumns;t++)o.positions.push(s),s+=o.itemSize2+o.gap2}this._metrics=o}}
76
+ */class Ls extends Ds{constructor(){super(...arguments),this._metrics=null,this.flex=null,this.justify=null}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{flex:!1,justify:"start"})}set gap(t){super._setGap(t)}_updateLayout(){const t=this.justify,[e,n]=this._padding1,[s,i]=this._padding2;["_gap1","_gap2"].forEach(e=>{const n=this[e];if(n===1/0&&!["space-between","space-around","space-evenly"].includes(t))throw new Error("grid layout: gap can only be set to 'auto' when justify is set to 'space-between', 'space-around' or 'space-evenly'");if(n===1/0&&"_gap2"===e)throw new Error(`grid layout: ${$s(this.direction)}-gap cannot be set to 'auto' when direction is set to ${this.direction}`)});const r=this.flex||["start","center","end"].includes(t),o={rolumns:-1,itemSize1:-1,itemSize2:-1,gap1:this._gap1===1/0?-1:this._gap1,gap2:r?this._gap2:0,padding1:{start:e===1/0?this._gap1:e,end:n===1/0?this._gap1:n},padding2:r?{start:s===1/0?this._gap2:s,end:i===1/0?this._gap2:i}:{start:0,end:0},positions:[]},a=this._viewDim2-o.padding2.start-o.padding2.end;if(a<=0)o.rolumns=0;else{const s=r?o.gap2:0;let i,l=0,c=0;if(a>=this._idealSize2&&(l=Math.floor((a-this._idealSize2)/(this._idealSize2+s))+1,c=l*this._idealSize2+(l-1)*s),this.flex){(a-c)/(this._idealSize2+s)>=.5&&(l+=1),o.rolumns=l,o.itemSize2=Math.round((a-s*(l-1))/l);switch(!0===this.flex?"area":this.flex.preserve){case"aspect-ratio":o.itemSize1=Math.round(this._idealSize1/this._idealSize2*o.itemSize2);break;case xs(this.direction):o.itemSize1=Math.round(this._idealSize1);break;default:o.itemSize1=Math.round(this._idealSize1*this._idealSize2/o.itemSize2)}}else o.itemSize1=this._idealSize1,o.itemSize2=this._idealSize2,o.rolumns=l;if(r){const e=o.rolumns*o.itemSize2+(o.rolumns-1)*o.gap2;i=this.flex||"start"===t?o.padding2.start:"end"===t?this._viewDim2-o.padding2.end-e:Math.round(this._viewDim2/2-e/2)}else{const s=a-o.rolumns*o.itemSize2;"space-between"===t?(o.gap2=Math.round(s/(o.rolumns-1)),i=0):"space-around"===t?(o.gap2=Math.round(s/o.rolumns),i=Math.round(o.gap2/2)):(o.gap2=Math.round(s/(o.rolumns+1)),i=o.gap2),this._gap1===1/0&&(o.gap1=o.gap2,e===1/0&&(o.padding1.start=i),n===1/0&&(o.padding1.end=i))}for(let t=0;t<o.rolumns;t++)o.positions.push(i),i+=o.itemSize2+o.gap2}this._metrics=o}}
68
77
  /**
69
78
  * @license
70
79
  * Copyright 2021 Google LLC
71
80
  * SPDX-License-Identifier: BSD-3-Clause
72
- */class Ss extends bs{get _delta(){return this._metrics.itemSize1+this._metrics.gap1}_getItemSize(t){return{[this._sizeDim]:this._metrics.itemSize1,[this._secondarySizeDim]:this._metrics.itemSize2}}_getActiveItems(){const t=this._metrics,{rolumns:e}=t;if(0===e)this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;else{const{padding1:n}=t,i=Math.max(0,this._scrollPosition-this._overhang),s=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang),r=Math.max(0,Math.floor((i-n.start)/this._delta)),o=Math.max(0,Math.ceil((s-n.start)/this._delta));this._first=r*e,this._last=Math.min(o*e-1,this.items.length-1),this._physicalMin=n.start+this._delta*r,this._physicalMax=n.start+this._delta*o}}_getItemPosition(t){const{rolumns:e,padding1:n,positions:i,itemSize1:s,itemSize2:r}=this._metrics;return{[this._positionDim]:n.start+Math.floor(t/e)*this._delta,[this._secondaryPositionDim]:i[t%e],[as(this.direction)]:s,[ls(this.direction)]:r}}_updateScrollSize(){const{rolumns:t,gap1:e,padding1:n,itemSize1:i}=this._metrics;let s=1;if(t>0){const r=Math.ceil(this.items.length/t);s=n.start+r*i+(r-1)*e+n.end}this._scrollSize=s}}
81
+ */class js extends Ls{get _delta(){return this._metrics.itemSize1+this._metrics.gap1}_getItemSize(t){return{[this._sizeDim]:this._metrics.itemSize1,[this._secondarySizeDim]:this._metrics.itemSize2}}_getActiveItems(){const t=this._metrics,{rolumns:e}=t;if(0===e)this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;else{const{padding1:n}=t,s=Math.max(0,this._scrollPosition-this._overhang),i=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang),r=Math.max(0,Math.floor((s-n.start)/this._delta)),o=Math.max(0,Math.ceil((i-n.start)/this._delta));this._first=r*e,this._last=Math.min(o*e-1,this.items.length-1),this._physicalMin=n.start+this._delta*r,this._physicalMax=n.start+this._delta*o}}_getItemPosition(t){const{rolumns:e,padding1:n,positions:s,itemSize1:i,itemSize2:r}=this._metrics;return{[this._positionDim]:n.start+Math.floor(t/e)*this._delta,[this._secondaryPositionDim]:s[t%e],[xs(this.direction)]:i,[Es(this.direction)]:r}}_updateScrollSize(){const{rolumns:t,gap1:e,padding1:n,itemSize1:s}=this._metrics;let i=1;if(t>0){const r=Math.ceil(this.items.length/t);i=n.start+r*s+(r-1)*e+n.end}this._scrollSize=i}}
73
82
  /**
74
83
  * @license
75
84
  * Copyright 2021 Google LLC
76
85
  * SPDX-License-Identifier: BSD-3-Clause
77
- */const Es="MIN";class Cs extends bs{constructor(){super(...arguments),this._RANGE_MAP_GRANULARITY=100,this._positions=new Map,this._rangeMap=new Map}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{getAspectRatio:()=>1})}set getAspectRatio(t){this._getAspectRatio=t}_setItems(t){t!==this._items&&this._scheduleLayoutUpdate(),super._setItems(t)}_getItemSize(t){return{[this._sizeDim]:this._metrics.itemSize1,[this._secondarySizeDim]:this._metrics.itemSize2}}_updateLayout(){super._updateLayout(),this._layOutChildren()}_getRangeMapKey(t,e){const n=this._RANGE_MAP_GRANULARITY;return e===Es?Math.floor(t/n)*n:Math.ceil(t/n)*n}_layOutChildren(){const t=this._RANGE_MAP_GRANULARITY;this._positions.clear(),this._rangeMap.clear();const{rolumns:e,padding1:n,itemSize2:i,gap1:s,positions:r}=this._metrics;let o=n.start;const a=new Array(e).fill(null).map(t=>o);let l=0,c=0,h=1/0,u=-1/0;if(this.items.forEach((e,d)=>{const f=this._getAspectRatio(e),p="horizontal"===this.direction?i*f:i/f,m=a[l],_=r[l];this._positions.set(d,{[this._positionDim]:m,[this._secondaryPositionDim]:_,[this._sizeDim]:p,[this._secondarySizeDim]:i});const g=m+p,y=this._getRangeMapKey(m,Es);y<h&&(h=y);const w=this._getRangeMapKey(g,"MAX");w>u&&(u=w);for(let e=y;e<=w;e+=t){const[t,n]=this._rangeMap.get(e)??[1/0,-1/0];this._rangeMap.set(e,[Math.min(d,t),Math.max(d,n)])}c=Math.max(c,g+n.end),a[l]+=p+s,o=1/0,a.forEach((t,e)=>{t<o&&(o=t,l=e)})}),h!==1/0)for(let e=0;e<h;e+=t)this._rangeMap.set(e,[-1,-1]);if(u!==-1/0){const e=this._rangeMap.get(u);for(let n=u+t;n<c+t;n+=t)this._rangeMap.set(n,e)}this._scrollSize=c}_getActiveItems(){const t=this._metrics,{rolumns:e}=t;if(0===e||0===this._rangeMap.size)this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;else{const t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang),n=this.items.length-1,i=this._getRangeMapKey(t,Es),s=this._getRangeMapKey(e,"MAX");let r=n,o=0;for(let t=i;t<=s;t+=this._RANGE_MAP_GRANULARITY){const[e,i]=this._rangeMap.get(t)??[n,0];r=Math.min(r,e),o=Math.max(o,i)}this._first=r,this._last=o}}_getItemPosition(t){return this._positions.get(t)}_updateScrollSize(){}}
86
+ */const Ns="MIN";class Us extends Ls{constructor(){super(...arguments),this._RANGE_MAP_GRANULARITY=100,this._positions=new Map,this._rangeMap=new Map}_getDefaultConfig(){return Object.assign({},super._getDefaultConfig(),{getAspectRatio:()=>1})}set getAspectRatio(t){this._getAspectRatio=t}_setItems(t){t!==this._items&&this._scheduleLayoutUpdate(),super._setItems(t)}_getItemSize(t){return{[this._sizeDim]:this._metrics.itemSize1,[this._secondarySizeDim]:this._metrics.itemSize2}}_updateLayout(){super._updateLayout(),this._layOutChildren()}_getRangeMapKey(t,e){const n=this._RANGE_MAP_GRANULARITY;return e===Ns?Math.floor(t/n)*n:Math.ceil(t/n)*n}_layOutChildren(){const t=this._RANGE_MAP_GRANULARITY;this._positions.clear(),this._rangeMap.clear();const{rolumns:e,padding1:n,itemSize2:s,gap1:i,positions:r}=this._metrics;let o=n.start;const a=new Array(e).fill(null).map(t=>o);let l=0,c=0,h=1/0,u=-1/0;if(this.items.forEach((e,d)=>{const f=this._getAspectRatio(e),p="horizontal"===this.direction?s*f:s/f,m=a[l],_=r[l];this._positions.set(d,{[this._positionDim]:m,[this._secondaryPositionDim]:_,[this._sizeDim]:p,[this._secondarySizeDim]:s});const g=m+p,y=this._getRangeMapKey(m,Ns);y<h&&(h=y);const v=this._getRangeMapKey(g,"MAX");v>u&&(u=v);for(let e=y;e<=v;e+=t){const[t,n]=this._rangeMap.get(e)??[1/0,-1/0];this._rangeMap.set(e,[Math.min(d,t),Math.max(d,n)])}c=Math.max(c,g+n.end),a[l]+=p+i,o=1/0,a.forEach((t,e)=>{t<o&&(o=t,l=e)})}),h!==1/0)for(let e=0;e<h;e+=t)this._rangeMap.set(e,[-1,-1]);if(u!==-1/0){const e=this._rangeMap.get(u);for(let n=u+t;n<c+t;n+=t)this._rangeMap.set(n,e)}this._scrollSize=c}_getActiveItems(){const t=this._metrics,{rolumns:e}=t;if(0===e||0===this._rangeMap.size)this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;else{const t=Math.max(0,this._scrollPosition-this._overhang),e=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang),n=this.items.length-1,s=this._getRangeMapKey(t,Ns),i=this._getRangeMapKey(e,"MAX");let r=n,o=0;for(let t=s;t<=i;t+=this._RANGE_MAP_GRANULARITY){const[e,s]=this._rangeMap.get(t)??[n,0];r=Math.min(r,e),o=Math.max(o,s)}this._first=r,this._last=o}}_getItemPosition(t){return this._positions.get(t)}_updateScrollSize(){}}
78
87
  /**
79
88
  * @license
80
89
  * Copyright 2021 Google LLC
81
90
  * SPDX-License-Identifier: BSD-3-Clause
82
- */class Ms extends Event{constructor(t){super(Ms.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}Ms.eventName="rangeChanged";class ks extends Event{constructor(t){super(ks.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}ks.eventName="visibilityChanged";class xs extends Event{constructor(){super(xs.eventName,{bubbles:!1})}}xs.eventName="unpinned";
91
+ */class Fs extends Event{constructor(t){super(Fs.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}Fs.eventName="rangeChanged";class Vs extends Event{constructor(t){super(Vs.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}Vs.eventName="visibilityChanged";class Ws extends Event{constructor(){super(Ws.eventName,{bubbles:!1})}}Ws.eventName="unpinned";
83
92
  /**
84
93
  * @license
85
94
  * Copyright 2021 Google LLC
86
95
  * SPDX-License-Identifier: BSD-3-Clause
87
96
  */
88
- class As{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class Rs extends As{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.__destination=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);const n=this._node;this._originalScrollTo=n.scrollTo,this._originalScrollBy=n.scrollBy,this._originalScroll=n.scroll,this._attach(t)}get _destination(){return this.__destination}get scrolling(){return null!==this._destination}scrollTo(t,e){const n="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;this._scrollTo(n)}scrollBy(t,e){const n="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;void 0!==n.top&&(n.top+=this.scrollTop),void 0!==n.left&&(n.left+=this.scrollLeft),this._scrollTo(n)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,n=null){null!==this._end&&this._end(),"smooth"===t.behavior?(this._setDestination(t),this._retarget=e,this._end=n):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:n}=t;return e=void 0===e?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),n=void 0===n?void 0:Math.max(0,Math.min(n,this.maxScrollLeft)),(null===this._destination||n!==this._destination.left||e!==this._destination.top)&&(this.__destination={top:e,left:n,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,n){return this._scrollTo(t,e,n),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(null!==this._destination){const{scrollTop:t,scrollLeft:e}=this;let{top:n,left:i}=this._destination;n=Math.min(n||0,this.maxScrollTop),i=Math.min(i||0,this.maxScrollLeft);const s=Math.abs(n-t),r=Math.abs(i-e);s<1&&r<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),0===this._clients.size&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),1===this._clients.size&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}}
97
+ class Hs{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class Ys extends Hs{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.__destination=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);const n=this._node;this._originalScrollTo=n.scrollTo,this._originalScrollBy=n.scrollBy,this._originalScroll=n.scroll,this._attach(t)}get _destination(){return this.__destination}get scrolling(){return null!==this._destination}scrollTo(t,e){const n="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;this._scrollTo(n)}scrollBy(t,e){const n="number"==typeof t&&"number"==typeof e?{left:t,top:e}:t;void 0!==n.top&&(n.top+=this.scrollTop),void 0!==n.left&&(n.left+=this.scrollLeft),this._scrollTo(n)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,n=null){null!==this._end&&this._end(),"smooth"===t.behavior?(this._setDestination(t),this._retarget=e,this._end=n):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:n}=t;return e=void 0===e?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),n=void 0===n?void 0:Math.max(0,Math.min(n,this.maxScrollLeft)),(null===this._destination||n!==this._destination.left||e!==this._destination.top)&&(this.__destination={top:e,left:n,behavior:"smooth"},!0)}_resetScrollState(){this.__destination=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,n){return this._scrollTo(t,e,n),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(null!==this._destination){const{scrollTop:t,scrollLeft:e}=this;let{top:n,left:s}=this._destination;n=Math.min(n||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);const i=Math.abs(n-t),r=Math.abs(s-e);i<1&&r<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),0===this._clients.size&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),1===this._clients.size&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}}
89
98
  /**
90
99
  * @license
91
100
  * Copyright 2021 Google LLC
92
101
  * SPDX-License-Identifier: BSD-3-Clause
93
- */let Os="undefined"!=typeof window?window.ResizeObserver:void 0;const zs=Symbol("virtualizerRef"),Ts="virtualizer-sizer";let Is;class Ps{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new Os(()=>this._hostElementSizeChanged()),this._childrenRO=new Os(this._childrenSizeChanged.bind(this))}_initHostElement(t){this._hostElement=t.hostElement;const e=this._hostElement;this._applyVirtualizerStyles(),e[zs]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=function(t,e=!1){let n=!1;return function(t,e=!1){const n=[];let i=e?t:Ls(t);for(;null!==i;)n.push(i),i=Ls(i);return n}(t,e).filter(t=>{if(n)return!1;const e=getComputedStyle(t);return n="fixed"===e.position,"visible"!==e.overflow})}
102
+ */let Bs="undefined"!=typeof window?window.ResizeObserver:void 0;const qs=Symbol("virtualizerRef"),Gs="virtualizer-sizer";let Xs;class Zs{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new Bs(()=>this._hostElementSizeChanged()),this._childrenRO=new Bs(this._childrenSizeChanged.bind(this))}_initHostElement(t){this._hostElement=t.hostElement;const e=this._hostElement;this._applyVirtualizerStyles(),e[qs]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=function(t,e=!1){let n=!1;return function(t,e=!1){const n=[];let s=e?t:Qs(t);for(;null!==s;)n.push(s),s=Qs(s);return n}(t,e).filter(t=>{if(n)return!1;const e=getComputedStyle(t);return n="fixed"===e.position,"visible"!==e.overflow})}
94
103
  /**
95
104
  * @license
96
105
  * Copyright 2021 Google LLC
97
106
  * SPDX-License-Identifier: BSD-3-Clause
98
- */(this._hostElement,t),this._scrollerController=new Rs(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${Ts}]`);e||(e=document.createElement("div"),e.setAttribute(Ts,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent="&nbsp;",e.setAttribute(Ts,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||Is;if("function"==typeof e&&this._layout instanceof e){const e={...t};return delete e.type,this._layout.config=e,!0}return!1}async _initLayout(t){let e,n;if("function"==typeof t.type){n=t.type;const i={...t};delete i.type,e=i}else e=t;void 0===n&&(Is=n=(await Promise.resolve().then(function(){return ys})).FlowLayout),this._layout=new n(t=>this._handleLayoutMessage(t),e),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const t=window.performance.now(),e=t-this._benchmarkStart,n=performance.getEntriesByName("uv-virtualizing","measure").filter(e=>e.startTime>=this._benchmarkStart&&e.startTime<t).reduce((t,e)=>t+e.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:n}}return null}_measureChildren(){const t={},e=this._children,n=this._measureChildOverride||this._measureChild;for(let i=0;i<e.length;i++){const s=e[i],r=this._first+i;(this._itemsChanged||this._toBeMeasured.has(s))&&(t[r]=n.call(this,s,this._items[r]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:n}=t.getBoundingClientRect();return Object.assign({width:e,height:n},function(t){const e=window.getComputedStyle(t);return{marginTop:Ds(e.marginTop),marginRight:Ds(e.marginRight),marginBottom:Ds(e.marginBottom),marginLeft:Ds(e.marginLeft)}}(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:n}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||n)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(t){if("scroll"===t.type)(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",t)}_handleLayoutMessage(t){"stateChanged"===t.type?this._updateDOM(t):"visibilityChanged"===t.type?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):"unpinned"===t.type&&this._hostElement.dispatchEvent(new xs)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(Ts)||t.push(e),e=e.nextElementSibling;return t}_updateView(){const t=this._hostElement,e=this._scrollerController?.element,n=this._layout;if(t&&e&&n){let i,s,r,o;const a=t.getBoundingClientRect();i=0,s=0,r=window.innerHeight,o=window.innerWidth;const l=this._clippingAncestors.map(t=>t.getBoundingClientRect());l.unshift(a);for(const t of l)i=Math.max(i,t.top),s=Math.max(s,t.left),r=Math.min(r,t.bottom),o=Math.min(o,t.right);const c=e.getBoundingClientRect(),h={left:a.left-c.left,top:a.top-c.top},u={width:e.scrollWidth,height:e.scrollHeight},d=i-a.top+t.scrollTop,f=s-a.left+t.scrollLeft,p=Math.max(0,r-i),m=Math.max(0,o-s);n.viewportSize={width:m,height:p},n.viewportScroll={top:d,left:f},n.totalScrollSize=u,n.offsetWithinScroller=h}}_sizeHostElement(t){const e=82e5,n=t&&null!==t.width?Math.min(e,t.width):0,i=t&&null!==t.height?Math.min(e,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${n}px, ${i}px)`;else{const t=this._hostElement.style;t.minWidth=n?`${n}px`:"100%",t.minHeight=i?`${i}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:t,left:e,width:n,height:i,xOffset:s,yOffset:r},o)=>{const a=this._children[o-this._first];a&&(a.style.position="absolute",a.style.boxSizing="border-box",a.style.transform=`translate(${e}px, ${t}px)`,void 0!==n&&(a.style.width=`${n}px`),void 0!==i&&(a.style.height=`${i}px`),a.style.left=void 0===s?null:`${s}px`,a.style.top=void 0===r?null:`${r}px`)})}async _adjustRange(t){const{_first:e,_last:n,_firstVisible:i,_lastVisible:s}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==n,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==i||this._lastVisible!==s}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:n,left:i}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-n,left:e-i})}}element(t){return t===1/0&&(t=this._items.length-1),void 0===this._items?.[t]?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),"smooth"===t.behavior){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:n}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:n}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new Ms({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new ks({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(const e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function Ds(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function Ls(t){if(null!==t.assignedSlot)return t.assignedSlot;if(null!==t.parentElement)return t.parentElement;const e=t.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}const js=a(class extends o{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,n)=>((t,n)=>e`${n}: ${JSON.stringify(t,null,2)}`)(t,n+this._first),this._keyFunction=(t,e)=>(t=>t)(t,this._first),this._items=[],t.type!==l.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let t=this._first;t<=this._last;t++)e.push(this._items[t]);return s(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);const n=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),n?i:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const n=t.parentNode;this._makeVirtualizer(n,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:n}=t;e&&(this._renderItem=(t,n)=>e(t,n+this._first)),n&&(this._keyFunction=(t,e)=>n(t,e+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:n,scroller:i,items:s}=e;this._virtualizer=new Ps({hostElement:t,layout:n,scroller:i}),this._virtualizer.items=s,this._virtualizer.connected()}_initialize(t,e){const n=t.parentNode;n&&1===n.nodeType&&(n.addEventListener("rangeChanged",t=>{this._first=t.first,this._last=t.last,this.setValue(this.render())}),this._makeVirtualizer(n,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});
107
+ */(this._hostElement,t),this._scrollerController=new Ys(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){this._scrollEventListeners.forEach(t=>t.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${Gs}]`);e||(e=document.createElement("div"),e.setAttribute(Gs,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent="&nbsp;",e.setAttribute(Gs,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||Xs;if("function"==typeof e&&this._layout instanceof e){const e={...t};return delete e.type,this._layout.config=e,!0}return!1}async _initLayout(t){let e,n;if("function"==typeof t.type){n=t.type;const s={...t};delete s.type,e=s}else e=t;void 0===n&&(Xs=n=(await Promise.resolve().then(function(){return Is})).FlowLayout),this._layout=new n(t=>this._handleLayoutMessage(t),e),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const t=window.performance.now(),e=t-this._benchmarkStart,n=performance.getEntriesByName("uv-virtualizing","measure").filter(e=>e.startTime>=this._benchmarkStart&&e.startTime<t).reduce((t,e)=>t+e.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:n}}return null}_measureChildren(){const t={},e=this._children,n=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){const i=e[s],r=this._first+s;(this._itemsChanged||this._toBeMeasured.has(i))&&(t[r]=n.call(this,i,this._items[r]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:n}=t.getBoundingClientRect();return Object.assign({width:e,height:n},function(t){const e=window.getComputedStyle(t);return{marginTop:Js(e.marginTop),marginRight:Js(e.marginRight),marginBottom:Js(e.marginBottom),marginLeft:Js(e.marginLeft)}}(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:n}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||n)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(t){console.warn("Error measuring performance data: ",t)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(t){if("scroll"===t.type)(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",t)}_handleLayoutMessage(t){"stateChanged"===t.type?this._updateDOM(t):"visibilityChanged"===t.type?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):"unpinned"===t.type&&this._hostElement.dispatchEvent(new Ws)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(Gs)||t.push(e),e=e.nextElementSibling;return t}_updateView(){const t=this._hostElement,e=this._scrollerController?.element,n=this._layout;if(t&&e&&n){let s,i,r,o;const a=t.getBoundingClientRect();s=0,i=0,r=window.innerHeight,o=window.innerWidth;const l=this._clippingAncestors.map(t=>t.getBoundingClientRect());l.unshift(a);for(const t of l)s=Math.max(s,t.top),i=Math.max(i,t.left),r=Math.min(r,t.bottom),o=Math.min(o,t.right);const c=e.getBoundingClientRect(),h={left:a.left-c.left,top:a.top-c.top},u={width:e.scrollWidth,height:e.scrollHeight},d=s-a.top+t.scrollTop,f=i-a.left+t.scrollLeft,p=Math.max(0,r-s),m=Math.max(0,o-i);n.viewportSize={width:m,height:p},n.viewportScroll={top:d,left:f},n.totalScrollSize=u,n.offsetWithinScroller=h}}_sizeHostElement(t){const e=82e5,n=t&&null!==t.width?Math.min(e,t.width):0,s=t&&null!==t.height?Math.min(e,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${n}px, ${s}px)`;else{const t=this._hostElement.style;t.minWidth=n?`${n}px`:"100%",t.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:t,left:e,width:n,height:s,xOffset:i,yOffset:r},o)=>{const a=this._children[o-this._first];a&&(a.style.position="absolute",a.style.boxSizing="border-box",a.style.transform=`translate(${e}px, ${t}px)`,void 0!==n&&(a.style.width=`${n}px`),void 0!==s&&(a.style.height=`${s}px`),a.style.left=void 0===i?null:`${i}px`,a.style.top=void 0===r?null:`${r}px`)})}async _adjustRange(t){const{_first:e,_last:n,_firstVisible:s,_lastVisible:i}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==n,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==i}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:n,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-n,left:e-s})}}element(t){return t===1/0&&(t=this._items.length-1),void 0===this._items?.[t]?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),"smooth"===t.behavior){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:n}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:n}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&t?.has(e)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new Fs({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new Vs({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){if(this._layout?.measureChildren){for(const e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function Js(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function Qs(t){if(null!==t.assignedSlot)return t.assignedSlot;if(null!==t.parentElement)return t.parentElement;const e=t.parentNode;return e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host||null}class Ks extends _.AsyncDirective{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,e)=>((t,e)=>j`${e}: ${JSON.stringify(t,null,2)}`)(t,e+this._first),this._keyFunction=(t,e)=>(t=>t)(t,this._first),this._items=[],t.type!==g.PartType.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let t=this._first;t<=this._last;t++)e.push(this._items[t]);return u.repeat(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);const n=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),n?U:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const n=t.parentNode;this._makeVirtualizer(n,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:n}=t;e&&(this._renderItem=(t,n)=>e(t,n+this._first)),n&&(this._keyFunction=(t,e)=>n(t,e+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:n,scroller:s,items:i}=e;this._virtualizer=new Zs({hostElement:t,layout:n,scroller:s}),this._virtualizer.items=i,this._virtualizer.connected()}_initialize(t,e){const n=t.parentNode;n&&1===n.nodeType&&(n.addEventListener("rangeChanged",t=>{this._first=t.first,this._last=t.last,this.setValue(this.render())}),this._makeVirtualizer(n,e))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}}const ti=g.directive(Ks);
99
108
  /**
100
109
  * @license
101
110
  * Copyright 2021 Google LLC
@@ -114,5 +123,5 @@ class As{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(th
114
123
  * can change height dynamically.
115
124
  * - `virtualGrid` and `virtualMasonry` still accept explicit sizes since
116
125
  * the grid/masonry layouts need them for position pre-computation.
117
- */function Ns(t,e,n,i){const{keyFn:s,template:r,opts:o}=Fs(e,n,i),a={direction:o?.direction??"vertical",...o?.pin?{pin:o.pin}:{}};return js({items:t,renderItem:r,keyFunction:s,scroller:o?.scroller,layout:us(a)})}function $s(t,e,n,i){const{keyFn:s,template:r,opts:o}=Fs(e,n,i),a={direction:o.direction??"vertical",itemSize:{width:o.itemWidth,height:o.itemHeight},gap:o.gap??"8px",flex:o.flex??!1,...o.pin?{pin:o.pin}:{}};return js({items:t,renderItem:r,keyFunction:s,scroller:o.scroller,layout:(l=a,Object.assign({type:Ss},l))});var l}function Us(t,e,n,i){const{keyFn:s,template:r,opts:o}=Fs(e,n,i),a={direction:o.direction??"vertical",getAspectRatio:o.getAspectRatio,gap:o.gap??"8px",flex:!0,...o.itemSize?{itemSize:o.itemSize}:{},...o.pin?{pin:o.pin}:{}};return js({items:t,renderItem:r,keyFunction:s,scroller:o.scroller,layout:(l=a,Object.assign({type:Cs},l))});var l}function Fs(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n}:{keyFn:void 0,template:t,opts:e}}const Vs=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,Ws=t=>"object"==typeof t&&null!==t&&!0===t.__isUnit___&&"function"==typeof t.__subscribe&&"function"==typeof t.__reset,Ys=t=>"function"==typeof t&&!0===t.__isAction___&&"function"==typeof t.__subscribe,Hs=t=>"function"==typeof t&&!0===t.__isAsyncAction___&&"function"==typeof t.subscribe,Bs=t=>"function"==typeof t&&!0===t.__isSetter___&&"function"==typeof t.__subscribe,qs=t=>"object"==typeof t&&null!==t&&!0===t.__isEvent___&&"function"==typeof t.__subscribe&&"function"==typeof t.trigger,Gs=t=>"object"==typeof t&&null!==t&&!0===t.__isConfirmationEvent___&&"function"==typeof t.requestConfirmation&&"function"==typeof t.onConfirmRequest,Xs=t=>"object"==typeof t&&null!==t&&!0===t.__isChannel___&&"function"==typeof t.join,Zs=t=>"function"==typeof t&&!0===t.__isSelector___&&"function"==typeof t.areVersionsChanged,Js=t=>"function"==typeof t,Qs=t=>"AsyncFunction"===t.constructor.name,Ks=(t,e,n,i)=>{if(Vs(t)){const s=t,r=ze(s(),i),o=n(r.set,e),a=n(r.update,e);return r.set=o,r.update=a,s.__subscribe(()=>{J.schedule(()=>r.set(s()))}),ut(r,()=>{o.cancel(),a.cancel()}),r}const s=ze(t,i),r=n(s.set,e),o=n(s.update,e);return s.set=r,s.update=o,ut(s,()=>{r.cancel(),o.cancel()}),s},tr=(t,e,n)=>Ks(t,e,Ve,n),er=(t=[],e)=>{const n=new Map(t),i=ze(n,e),s=n.set.bind(n);n.set=(t,e)=>(s(t,e),i.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return i.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),i.update(()=>{})};const a=n.get.bind(n);n.get=t=>(i.get(),a(t));const l=n.has.bind(n);n.has=t=>(i.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(i.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(i.get(),h());const u=n.values.bind(n);n.values=()=>(i.get(),u());const d=n.keys.bind(n);n.keys=()=>(i.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(i.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(i.get(),p()),n.update=t=>{const e={set:(t,n)=>(s(t,n),e),delete:t=>r(t),clear:()=>{o()},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),i.update(()=>{}),n},n.updateItem=(t,e)=>{const s=a(t);return null==s||"object"!=typeof s||(e(s),i.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:i,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>i.__version__,enumerable:!1}),n},nr=(t=[],e)=>{const n=new Set(t),i=ze(n,e),s=n.add.bind(n);n.add=t=>(s(t),i.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return i.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),i.update(()=>{})};const a=n.has.bind(n);n.has=t=>(i.get(),a(t));const l=Object.getOwnPropertyDescriptor(Set.prototype,"size");Object.defineProperty(n,"size",{get:()=>(i.get(),l.get.call(n))});const c=n.entries.bind(n);n.entries=()=>(i.get(),c());const h=n.values.bind(n);n.values=()=>(i.get(),h());const u=n.keys.bind(n);n.keys=()=>(i.get(),u());const d=n.forEach.bind(n);n.forEach=(t,e)=>(i.get(),d(t,e));const f=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(i.get(),f()),n.update=t=>{const e={add:t=>(s(t),e),delete:t=>r(t),clear:()=>{o()},has:t=>a(t),entries:()=>c(),values:()=>h(),keys:()=>u(),forEach:(t,e)=>d(t,e),[Symbol.iterator]:()=>f(),get size(){return l.get.call(n)}};return t(e),i.update(()=>{}),n},n.updateItem=(t,e)=>(null==t||"object"!=typeof t||(e(t),i.update(()=>{})),n),Object.defineProperty(n,"__isAtom___",{value:i,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>i.__version__,enumerable:!1}),n},ir="mates_storage";function sr(t,e){try{null===e?t.removeItem(ir):t.setItem(ir,JSON.stringify(e))}catch{}}function rr(t,e){const n=ze((()=>{try{return function(t){try{const e=t.getItem(ir);if(e)return JSON.parse(e)}catch{}return null}(t())}catch{return null}})()),i=n.set;n.set=function(e,s=!1){i(e,s);try{sr(t(),n.get())}catch{}};const s=n.update;return n.update=function(e,i=!1){if(null!==n.get()){s(e,i);try{sr(t(),n.get())}catch{}}},e(t=>{if(t.key===ir)if(t.newValue)try{i(JSON.parse(t.newValue))}catch{}else i(null)}),Object.defineProperty(n,"name",{value:"storageAtom",writable:!0,configurable:!0,enumerable:!1}),n}function or(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}const ar=rr(()=>localStorage,t=>or(e=>{e.storageArea===localStorage&&t(e)})),lr=rr(()=>sessionStorage,t=>or(e=>{e.storageArea===sessionStorage&&t(e)})),cr=(t,e,n)=>Ks(t,e,He,n),hr=ze("undefined"!=typeof document?document.title:"");function ur(t){const e=new Map,n=new Map,i=ze(e,t),s=i.get.bind(i),r=i;return r.add=(t,s,r)=>{if(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),i.update(e=>{e.set(t,s)}),void 0!==r&&-1!==r&&r>0){const s=setTimeout(()=>{e.delete(t),n.delete(t),i.update(()=>{})},r);n.set(t,s)}},r.get=t=>(s(),e.get(t)),r.remove=t=>!!e.has(t)&&(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),e.delete(t),i.update(()=>{}),!0),r.has=t=>(s(),e.has(t)),r.getAll=()=>(s(),Array.from(e.values())),r.clearAll=()=>{n.forEach(t=>clearTimeout(t)),n.clear(),e.clear(),i.update(()=>{})},Object.defineProperty(r,"size",{get:()=>(s(),e.size),enumerable:!0,configurable:!0}),Object.defineProperty(r,"name",{get:()=>"cacheAtom",enumerable:!0,configurable:!0}),ut(i,r.clearAll),r}Ge(()=>{var t;t=hr.get(),"undefined"!=typeof document&&(document.title=t)});const dr=(t=1,e)=>{const n=ze(t,e),i=n;return i.next=()=>{n.set(t=>t+1)},i.prev=()=>{n.set(t=>t>1?t-1:t)},i.reset=()=>{n.set(1)},Object.defineProperty(i,"currentPage",{get:()=>n.get(),enumerable:!1,configurable:!0}),Object.defineProperty(i,"name",{value:"paginationAtom",writable:!0,configurable:!0,enumerable:!1}),i},fr="mates-theme";function pr(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}let mr=null;function _r(){if(mr)return mr;const t=ze(function(){try{const t=localStorage.getItem(fr);return"light"===t||"dark"===t||"auto"===t?t:null}catch{return null}}()??"auto",{skipRestrictedContextCheck:!0}),e=t;return e.setToLight=()=>{t.set("light")},e.setToDark=()=>{t.set("dark")},e.setToAuto=()=>{t.set("auto")},e.toggle=()=>{const e=pr(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>pr(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),Ge(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",pr(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(fr):localStorage.setItem(fr,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")}),mr=e,e}function gr(t,e=2){let n=parseFloat(String(t).trim());Number.isFinite(n)||(n=0);const i=10**e;return Math.round(n*i)/i}function yr(t,e,n){const i=ze(t,n),s=ze([],n);function r(){const t=i.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return s.set(n),n}const o=i.set;i.set=function(t,e=!1){o(t,e),r()};const a=i.update;i.update=function(t,e=!1){a(t,e),r()};const l=i;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>s.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===s.get().length,enumerable:!1,configurable:!0}),l.validate=r,l.toFloat=()=>gr(i.get()),l.toFloatString=()=>gr(i.get()).toString(),l.toValidNumber=()=>function(t){const e=Number(t);return Number.isFinite(e)?e:0}(i.get()),Object.defineProperty(l,"name",{value:"formAtom",writable:!0,configurable:!0,enumerable:!1}),l}const wr=(t,e=[],n)=>yr(t,e,n);function vr(t){const e=[],n={},i=new WeakSet;return function t(s,r){if(null==s)return;const o=typeof s;if("object"!==o&&"function"!==o)return;if(i.has(s))return;if(i.add(s),function(t){if(null==t)return!1;const e=typeof t;return("object"===e||"function"===e)&&!0===t.__isFormAtom__}(s)){const t=s.validate();return void(t.length>0&&(e.push(...t),n[r]=t))}if(Array.isArray(s)){for(let e=0;e<s.length;e++){const n=r?`${r}[${e}]`:`[${e}]`;t(s[e],n)}return}const a=Object.keys(s);for(const e of a){const n=r?`${r}.${e}`:e;t(s[e],n)}}(t,""),{isValid:0===e.length,errors:e,errorsByField:n}}function br(t,e,n){const i=e.replace(/\[(\d+)]/g,".$1").split(".");let s=t;for(const t of i){if(null==s)return n;s=s[t]}return void 0===s?n:s}function Sr(t,e){const n={};for(const i of e)i in t&&(n[i]=t[i]);return n}function Er(t,e){const n={...t};for(const t of e)delete n[t];return n}function Cr(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function Mr(t,...e){const n={...t};for(const t of e)for(const e of Object.keys(t))Cr(n[e])&&Cr(t[e])?n[e]=Mr(n[e],t[e]):n[e]=t[e];return n}function kr(t,e,n){return Math.min(Math.max(t,e),n)}function xr(t,e,n){if(void 0===e&&(e=t,t=0),void 0===n&&(n=t<=e?1:-1),0===n)return[];const i=[];if(n>0)for(let s=t;s<e;s+=n)i.push(s);else for(let s=t;s>e;s+=n)i.push(s);return i}function Ar(t,e){if(e<1)return[];const n=[];for(let i=0;i<t.length;i+=e)n.push(t.slice(i,i+e));return n}function Rr(t,e){const n=new Set,i=[];for(const s of t){const t=e(s);n.has(t)||(n.add(t),i.push(s))}return i}function Or(t,e){const n={};for(const i of t){const t=String(e(i));n[t]||(n[t]=[]),n[t].push(i)}return n}function zr(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 Tr(t,e){if(null==t||"object"!=typeof t)return;const n=Array.isArray(t)?t.map((t,e)=>e):Object.keys(t);for(const i of n){const n=e(i,t[i],t);void 0!==n&&(t[i]=n);const s=t[i];null!==s&&"object"==typeof s&&Tr(s,e)}}const Ir=t=>(t=>"number"==typeof t||"boolean"==typeof t||!zr(t))(t)?null:"Required",Pr=t=>(t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))(t)?null:"Invalid email",Dr=t=>e=>((t,e)=>t.length>=e)(e,t)?null:`Min ${t} characters`,Lr=t=>e=>((t,e)=>t.length<=e)(e,t)?null:`Max ${t} characters`,jr=(t,e="Invalid format")=>n=>((t,e)=>e.test(t))(n,t)?null:e,Nr=t=>e=>((t,e)=>t>=e)(e,t)?null:`Min is ${t}`,$r=t=>e=>((t,e)=>t<=e)(e,t)?null:`Max is ${t}`;function Ur(t){let e;return Re({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):(e=ze(void 0,{skipRestrictedContextCheck:!0}),e.set(()=>t,!0))}}),e}function Fr(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 i=t;for(;i&&!n.includes(i);){for(const t of Reflect.ownKeys(i))"constructor"!==t&&e.add(t);i=Object.getPrototypeOf(i)}return Array.from(e)}const Vr=t=>{const e=H();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;z.viewOuterInProgress=!0;try{n=new t}finally{z.viewOuterInProgress=!1}const i=z.setupInProgress;try{if((()=>{Fr(n).forEach(t=>{const e=Object.getOwnPropertyDescriptor(n,t)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),t);if(e&&(e.get||e.set))return;const i=n[t];"function"!=typeof i||i.__version__||(n[t]=i.bind(n))})})(),"function"==typeof n.setup){Qs(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),z.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{z.setupInProgress=i}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{z.setupInProgress=i}return n},Wr=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}});if(H().dispatchEvent(n),e)return e;throw new Error(`No parent scope found for ${t.name}`)};function Yr(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 Hr=t=>{const e=H();if("object"!=typeof t||null===t)throw new Error("stateObj must be an object");const n=ze(t),i=((t,e,n)=>{const i=Fr(t);i.forEach(i=>{const s=Yr(t,i);if(s?.get){let n,r=-1;const o=s.get;Object.defineProperty(t,i,{get(){const i=e.__version__;return i!==r&&(r=i,n=o.call(t)),n},configurable:!0,enumerable:s.enumerable})}else if(Js(t[i])){if(Qs(t[i]))throw new Error(`Async functions are not supported inside ${n}`);const s=t[i];t[i]=(...n)=>{e.update(()=>s.apply(t,n))}}});const s=Object.create(t);return i.forEach(n=>{const i=Yr(t,n);if(!i)return;const r=!!i.get,o=!r&&Js(i.value);r||o||Object.defineProperty(s,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),s})(t,n,"useState");return e?._useStates&&e._useStates.push({state:t,atom:n}),[i,n.update]},Br=t=>{K();const e=H();e._errorHandlers||(e._errorHandlers=[]),e._errorHandlers.push(t)},qr=(t,e)=>{const n=H();if(K(),!n)throw new Error("onReferenceChange must be called inside a component");let i=[];t(),i=e(),n.onEachUpdate(()=>{const n=e();i.some((t,e)=>t!==n[e])&&(t(),i=n)})};function Gr(t,e,n,i=!1){document.addEventListener(t,e,{capture:i}),n.addToCleanUps(e,()=>{document.removeEventListener(t,e,{capture:i})})}function Xr(t,e,n,i){let s;if("wheelUp"===t||"wheelDown"===t){const r="wheelUp"===t,o=e,a=t=>{(r?t.deltaY>=0:t.deltaY<=0)||(s&&s(),s=o(t))};return window.addEventListener("wheel",a,{capture:n,passive:!0}),void i.addToCleanUps(e,()=>{window.removeEventListener("wheel",a,{capture:n}),s&&s()})}const r="scroll"===t||"touchstart"===t||"touchmove"===t,o=e,a=t=>{s&&s(),s=o(t)};window.addEventListener(t,a,{capture:n,passive:r}),i.addToCleanUps(e,()=>{window.removeEventListener(t,a,{capture:n}),s&&s()})}function Zr(t,e){G()||(K(),Xr(t,e,!1,H()))}function Jr(t,e){G()||(K(),Xr(t,e,!0,H()))}const Qr=t=>{Jr("scroll",t)},Kr=t=>{Zr("blur",t)},to=t=>{Zr("focus",t)},eo=t=>{Zr("online",t)},no=t=>{Zr("offline",t)},io=t=>{Zr("resize",t)},so=t=>{Zr("paste",t)},ro=t=>{Zr("copy",t)},oo=t=>{Zr("cut",t)},ao=t=>{Zr("keydown",t)},lo=t=>{Zr("keyup",t)},co=t=>{if(G())return;K();let e;Gr("visibilitychange",()=>{e&&e(),e=t(document.hidden)},H())},ho=t=>{if(G())return;K();let e;Gr("selectionchange",()=>{e&&e(),e=t(window.getSelection())},H())},uo=t=>{Zr("storage",t)},fo=t=>{if(G())return;K();const e=H();let n;const i=t=>t.preventDefault(),s=e=>{e.preventDefault(),n&&n(),n=t(e)};window.addEventListener("dragover",i),window.addEventListener("drop",s),e.addToCleanUps(t,()=>{window.removeEventListener("dragover",i),window.removeEventListener("drop",s),n&&n()})},po=t=>{if(G())return;K();const e=H(!0),n=n=>{const i=n.target;i&&!e.contains(i)&&t(n)};document.addEventListener("mousedown",n,!0),e.addToCleanUps(t,()=>{document.removeEventListener("mousedown",n,!0)})},mo=(t,e=window)=>{if(G())return;K();const n=H();let i;const s=e=>{i&&i(),i=t(e)};e.addEventListener("scroll",s,{passive:!0}),n.addToCleanUps(t,()=>{e.removeEventListener("scroll",s),i&&i()})},_o=(t,e)=>{if(G())return;K();const n=H();let i;const s=new ResizeObserver(e=>{for(const n of e)i&&i(),i=t(n)}),r=e||n;s.observe(r),n.addToCleanUps(t,()=>{s.disconnect(),i&&i()})},go=t=>{if(G())return;K();const e=H();let n;const i=sn.__subscribe(()=>{n&&n(),n=t(sn.get())||null});e.addToCleanUps(t,()=>{i(),n&&n()})},yo=(t,e)=>{if(G())return;K();const n=H();let i;const s=setInterval(()=>{i&&i(),i=t()},e);n.addToCleanUps(t,()=>{clearInterval(s),i&&i()})},wo=(t,e)=>{if(G())return;K();const n=H();let i;const s=setTimeout(()=>{i=t()},e);n.addToCleanUps(t,()=>{clearTimeout(s),i&&i()})};function vo(t,e){K();const n=H(),i=e.map(e=>e.__subscribe(t));n.addToCleanUps(t,()=>{i.forEach(t=>t())})}const bo=t=>{K();const e=H();let n;e.onEachUpdate(()=>{n&&n(),n=t()}),e.addToCleanUps(t,()=>{n&&n()})},So=t=>{const e=H();if(!e)throw new Error("onDOMReady must be called within a component context");return e.DOMReadyEvent.__subscribe(t)},Eo=Mi((e,n,i)=>{const s=document.createElement("div");Object.assign(s.style,{position:"fixed",inset:"0",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.5)"}),i?.style&&Object.assign(s.style,i.style),i?.onBackdropClick&&s.addEventListener("click",t=>{t.target===s&&i.onBackdropClick()});const r=document.createElement("div");i?.dialogStyle&&Object.assign(r.style,i.dialogStyle),r.addEventListener("click",t=>t.stopPropagation()),t(n,r),s.appendChild(r),document.body.appendChild(s);const o=document.body.style.overflow;return document.body.style.overflow="hidden",{onUpdate(e){t(e,r)},onCleanup(){s.remove(),document.body.style.overflow=o}}});function Co(t,e){return Eo(t,e)}function Mo(t,e,n,i,s,r,o){return t.startsWith("top")?i>=n:t.startsWith("bottom")?s>=n:t.startsWith("left")?r>=e:!!t.startsWith("right")&&o>=e}const ko=gi((e,n,i)=>{const s=e.el;let r=!1,o=n,a=i;const l=document.createElement("div");l.style.cssText="position:fixed;z-index:9999;margin:0;display:none;background:var(--md-color-surface-raised,#fff);box-shadow:var(--md-shadow-dropdown,0 5px 5px -3px rgba(0,0,0,.20),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12));min-width:160px;",a.style&&Object.assign(l.style,a.style),document.body.appendChild(l),t(o,l);const c=()=>{const t=s.getBoundingClientRect();l.style.visibility="hidden",l.style.display="block",a.matchAnchorWidth&&(l.style.width=`${t.width}px`);const e=l.offsetWidth,n=l.offsetHeight,i=function(t,e,n,i,s){const r=window.innerWidth,o=window.innerHeight,a=t.top-i,l=o-t.bottom-i,c=t.left-i,h=r-t.right-i;if("auto"===s){const t=["bottom-start","top-start","right","left"];for(const i of t)if(Mo(i,e,n,a,l,c,h))return i;return"bottom-start"}if(Mo(s,e,n,a,l,c,h))return s;const u=(d=s).startsWith("top")?d.replace("top","bottom"):d.startsWith("bottom")?d.replace("bottom","top"):d.startsWith("left")?d.replace("left","right"):d.startsWith("right")?d.replace("right","left"):d;var d;return Mo(u,e,n,a,l,c,h)?u:s}(t,e,n,a.gap??4,a.position??"bottom-start");!function(t,e,n,i,s,r){const o=window.innerWidth,a=window.innerHeight;let l=0,c=0;n.startsWith("bottom")?l=e.bottom+r:n.startsWith("top")?l=e.top-r-s:"right"===n||"left"===n?l=e.top+e.height/2-s/2:n.endsWith("-start")?l=e.top:n.endsWith("-end")&&(l=e.bottom-s),"bottom"===n||"top"===n?c=e.left+e.width/2-i/2:n.endsWith("-start")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-i:e.left:n.endsWith("-end")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-i:e.right-i:n.startsWith("right")?c=e.right+r:n.startsWith("left")&&(c=e.left-r-i),t.style.left=`${Math.max(4,Math.min(c,o-i-4))}px`,t.style.top=`${Math.max(4,Math.min(l,a-s-4))}px`}(l,t,i,e,n,a.gap??4),l.style.visibility=""},h=()=>{r&&c()},u=t=>{const e=t.target;l.contains(e)||s.contains(e)||f()},d=t=>{"Escape"===t.key&&f()},f=()=>{r=!1,l.style.display="none",a.onClose?.(s),document.removeEventListener("click",u,{capture:!0}),document.removeEventListener("keydown",d),window.removeEventListener("scroll",h,{capture:!0}),window.removeEventListener("resize",h)},p=t=>{t.stopPropagation(),r?f():(r=!0,c(),a.onOpen?.(l),document.addEventListener("click",u,{capture:!0}),document.addEventListener("keydown",d),window.addEventListener("scroll",h,{passive:!0,capture:!0}),window.addEventListener("resize",h,{passive:!0}))};return s.addEventListener("click",p),{onUpdate(e,n){o=e,a=n,t(e,l),n.style&&Object.assign(l.style,n.style),r&&c()},onCleanup(){r&&f(),s.removeEventListener("click",p),l.remove()}}});function xo(t,e){return ko(t,"string"==typeof e?{position:e}:e??{})}function Ao(t,e,n){switch(e){case"top":case"top-start":return{top:t.top-n,left:t.left};case"top-end":return{top:t.top-n,left:t.right};case"bottom":case"bottom-start":default:return{top:t.bottom+n,left:t.left};case"bottom-end":return{top:t.bottom+n,left:t.right};case"right":case"right-start":return{top:t.top,left:t.right+n};case"right-end":return{top:t.bottom,left:t.right+n};case"left":case"left-start":return{top:t.top,left:t.left-n};case"left-end":return{top:t.bottom,left:t.left-n}}}function Ro(t){return"top"===t||"top-start"===t||"top-end"===t?"translateY(-100%)":"left"===t||"left-start"===t||"left-end"===t?"translateX(-100%)":""}function Oo(t,e,n,i){const s=window.innerHeight-t.bottom-i,r=t.top-i,o=window.innerWidth-t.right-i,a=t.left-i;if(s>=n)return"bottom";if(r>=n)return"top";if(o>=e)return"right";if(a>=e)return"left";return[["bottom",s],["top",r],["right",o],["left",a]].reduce((t,e)=>e[1]>t[1]?e:t)[0]}const zo=Mi((e,n,i)=>{const s=document.createElement("div");if(s.style.position="fixed",s.style.zIndex="9999",i?.style&&Object.assign(s.style,i.style),i?.on)for(const[t,e]of Object.entries(i.on))s.addEventListener(t,e);return function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(i?.target).appendChild(s),t(n,s),{onUpdate(e){t(e,s)},onCleanup(){s.remove()}}});function To(t,e){return zo(t,e)}let Io=null,Po=null,Do=null;function Lo(){return Io||(Io=document.createElement("div"),Io.id="mates-tip",Io.setAttribute("role","tooltip"),Io.style.cssText="position:fixed;z-index:10000;pointer-events:none;padding:6px 12px;border-radius:4px;font-size:0.8rem;font-family:system-ui,-apple-system,sans-serif;font-weight:500;line-height:1.4;max-width:300px;width:max-content;background:var(--md-sys-color-inverse-surface,#2e3036);color:var(--md-sys-color-inverse-on-surface,#f0f0f8);box-shadow:0 1px 3px rgba(0,0,0,.20),0 2px 6px rgba(0,0,0,.14);letter-spacing:0.01em;white-space:nowrap;display:none;",document.body.appendChild(Io)),Io}const jo=["maxWidth","padding","borderRadius","fontSize","whiteSpace"];function No(t,e){if(e.maxWidth&&(t.style.maxWidth=e.maxWidth),e.padding&&(t.style.padding=e.padding),e.borderRadius&&(t.style.borderRadius=e.borderRadius),e.fontSize&&(t.style.fontSize=e.fontSize),e.whiteSpace&&(t.style.whiteSpace=e.whiteSpace),e.style)for(const[n,i]of Object.entries(e.style))void 0!==i&&(t.style[n]=i)}function $o(t,e){const n={maxWidth:"300px",padding:"6px 12px",borderRadius:"4px",fontSize:"0.8rem",whiteSpace:"nowrap"};for(const i of jo)void 0!==e[i]&&(t.style[i]=n[i]);if(e.style){for(const n of Object.keys(e.style))t.style[n]="";t.style.background="var(--md-sys-color-inverse-surface,#2e3036)",t.style.color="var(--md-sys-color-inverse-on-surface,#f0f0f8)"}}function Uo(n,i){t("string"==typeof i?e`${i}`:i,n)}function Fo(t,e){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.width,r=i.height,o=window.innerWidth,a=window.innerHeight;let l;n.top-8-r>=0?(l=n.top-8-r,e.style.transformOrigin="bottom center"):(l=n.bottom+8,e.style.transformOrigin="top center");let c=n.left+n.width/2-s/2;c=Math.max(4,Math.min(c,o-s-4)),l=Math.max(4,Math.min(l,a-r-4)),e.style.left=`${c}px`,e.style.top=`${l}px`}const Vo=gi((t,e,n)=>{const i=t.el;let s=e,r=n,o=null;const a=()=>{null!==Do&&(cancelAnimationFrame(Do),Do=null),null!==o&&(clearTimeout(o),o=null);const t=r.delay??150;o=setTimeout(()=>{o=null;const t=Lo();Uo(t,s),No(t,r),t.style.visibility="hidden",t.style.opacity="0",t.style.transform="scale(0.94) translateY(3px)",t.style.transition="none",t.style.display="block",Fo(i,t),requestAnimationFrame(()=>{t.style.transition="opacity 0.14s ease, transform 0.14s cubic-bezier(0.22,1,0.36,1)",t.style.visibility="visible",t.style.opacity="1",t.style.transform="scale(1) translateY(0)",Po=i})},t)},l=()=>{if(null!==o&&(clearTimeout(o),o=null),Po!==i)return;const t=Lo();t.style.transition="opacity 0.12s ease, transform 0.12s ease",t.style.opacity="0",t.style.transform="scale(0.94) translateY(3px)",Do=requestAnimationFrame(()=>{Do=requestAnimationFrame(()=>{Do=null,Po===i&&($o(t,r),t.style.display="none",Po=null)})})};return i.addEventListener("mouseenter",a),i.addEventListener("mouseleave",l),i.addEventListener("focusin",a),i.addEventListener("focusout",l),i.setAttribute("aria-describedby","mates-tip"),{onUpdate(t,e){if(s=t,r=e,Po===i){const n=Lo();Uo(n,t),No(n,e),Fo(i,n)}},onCleanup(){if(null!==o&&(clearTimeout(o),o=null),Po===i){null!==Do&&(cancelAnimationFrame(Do),Do=null);const t=Lo();$o(t,r),t.style.display="none",Po=null}i.removeEventListener("mouseenter",a),i.removeEventListener("mouseleave",l),i.removeEventListener("focusin",a),i.removeEventListener("focusout",l)}}});function Wo(t,e={}){return Vo(t,e)}const Yo=Wo,Ho=1e3,Bo=3e4,qo=1/0;function Go(t,e={}){P("ws");const{reconnect:n=!0,reconnectDelay:i=Ho,reconnectMaxDelay:s=Bo,reconnectMaxAttempts:r=qo,protocols:o,auth:a,autoConnect:l=!0}=e,c=ze("connecting",{skipRestrictedContextCheck:!0}),h=new Set;let u=null,d=0,f=i,p=null,m=!1;const _=[];function g(){null!==p&&(clearTimeout(p),p=null)}function y(){let e;m=!1,g(),c.set("connecting");try{e=function(){if(!a)return t;const e=a(),n=Object.entries(e);if(0===n.length)return t;const i=n.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");return t.includes("?")?`${t}&${i}`:`${t}?${i}`}()}catch(t){return D(t),void c.set("error")}try{u=o?new WebSocket(e,o):new WebSocket(e)}catch(t){return D(t),c.set("error"),void w()}u.onopen=()=>{m?u?.close():(d=0,f=i,c.set("connected"),function(){for(;_.length>0;){const t=_.shift();u?.readyState===WebSocket.OPEN&&u.send(t)}}())},u.onmessage=t=>{if(m)return;const e="string"==typeof t.data?t.data:String(t.data);let n;try{n=JSON.parse(e)}catch{n=e}var i;i=n,h.forEach(t=>{try{t(i)}catch(t){D(t)}})},u.onerror=()=>{c.set("error")},u.onclose=()=>{m||(c.set("disconnected"),w())}}function w(){if(!n||m)return;if(d>=r)return;d++;const t=f;f=Math.min(2*f,s),p=setTimeout(()=>{m||y()},t)}function v(){m=!0,g(),u&&(u.onopen=null,u.onmessage=null,u.onerror=null,u.onclose=null,u.readyState!==WebSocket.OPEN&&u.readyState!==WebSocket.CONNECTING||u.close(1e3,"client disconnect"),u=null),c.set("disconnected"),h.clear(),_.length=0}const b={send:function(t){const e="string"==typeof t?t:JSON.stringify(t);u?.readyState===WebSocket.OPEN?u.send(e):_.push(e)},__subscribe:function(t){return h.add(t),()=>h.delete(t)},status:c,connect:y,disconnect:v,__isWs___:!0};return l?y():c.set("disconnected"),ut(b,v),b}class Xo{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}}function Zo(t,e=new WeakMap){if("function"==typeof structuredClone)return structuredClone(t);if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;return e.set(t,n),t.forEach((t,i)=>n.set(Zo(i,e),Zo(t,e))),n}if(t instanceof Set){const n=new Set;return e.set(t,n),t.forEach(t=>n.add(Zo(t,e))),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(let i=0;i<t.length;i++)n[i]=Zo(t[i],e);return n}const n=e.get(t);if(n)return n;const i={};e.set(t,i);for(const n of Object.keys(t))i[n]=Zo(t[n],e);return i}function Jo(t,e){let n=Object.getOwnPropertyDescriptor(t,e),i=Object.getPrototypeOf(t);for(;!n&&i&&i!==Object.prototype;)n=Object.getOwnPropertyDescriptor(i,e),i=Object.getPrototypeOf(i);return n?.get&&"function"==typeof n.get?n.get:null}var Qo,Ko,ta,ea,na,ia;function sa(t){return"number"==typeof t?`${t}px`:t}Ko=new WeakMap,ta=new WeakMap,ea=new WeakMap,na=new WeakMap,Qo=new WeakSet,ia=function(t){L(this,Ko,"f")?.remove(),j(this,Ko,null,"f"),j(this,ta,"","f"),j(this,ea,"","f"),j(this,na,new Set,"f");const e=t.endNode;if(e?.parentNode){const n=t.startNode,i=document.createRange();i.setStartAfter(n),i.setEndBefore(e),i.deleteContents()}};const ra=a(class extends c{constructor(t){if(super(t),Qo.add(this),Ko.set(this,null),ta.set(this,""),ea.set(this,""),na.set(this,new Set),t.type!==l.CHILD)throw new Error("safeSVG() must be used as a child expression, e.g. html`<div>${safeSVG(markup)}</div>`")}update(t,[e,n]){if(console.log("update"),!e.trimStart().startsWith("<svg"))return console.warn("safeSVG: input does not start with <svg — nothing rendered"),L(this,Qo,"m",ia).call(this,t),i;const s=JSON.stringify(n);if(null===L(this,Ko,"f")||e!==L(this,ta,"f")){const n=function(t){const e=document.createElement("template");e.innerHTML=t;const n=e.content.firstElementChild;return n instanceof SVGElement?n:null}(e);if(null===n)return console.warn("safeSVG: failed to parse SVG markup — nothing rendered"),L(this,Qo,"m",ia).call(this,t),i;L(this,Ko,"f")?.remove(),j(this,Ko,n,"f"),j(this,ta,e,"f"),j(this,ea,"","f"),j(this,na,new Set,"f");const s=t.endNode;s.parentNode.insertBefore(L(this,Ko,"f"),s)}if(s!==L(this,ea,"f")){const t=function(t,e){const n=new Set,i=(e,i)=>{t.setAttribute(e,i),n.add(e)},s=e.width??e.size,r=e.height??e.size;void 0!==s&&i("width",sa(s)),void 0!==r&&i("height",sa(r)),void 0!==e.fill&&i("fill",e.fill),void 0!==e.stroke&&i("stroke",e.stroke),void 0!==e.strokeWidth&&i("stroke-width",String(e.strokeWidth)),void 0!==e.strokeLinecap&&i("stroke-linecap",e.strokeLinecap),void 0!==e.strokeLinejoin&&i("stroke-linejoin",e.strokeLinejoin),void 0!==e.opacity&&i("opacity",String(e.opacity)),void 0!==e.viewBox&&i("viewBox",e.viewBox),void 0!==e.transform&&i("transform",e.transform);const o=[],a=e.width??e.size,l=e.height??e.size;void 0!==a&&o.push(`width:${sa(a)}`),void 0!==l&&o.push(`height:${sa(l)}`),void 0!==e.color&&o.push(`color:${e.color}`),o.push("display:inline-block"),o.push("vertical-align:middle"),e.style&&o.push(e.style),i("style",o.join(";")),e.class&&i("class",e.class);const c=e.ariaHidden??!0;return e.ariaLabel?(i("aria-label",e.ariaLabel),i("role","img")):c&&i("aria-hidden","true"),n}(L(this,Ko,"f"),n);for(const e of L(this,na,"f"))t.has(e)||L(this,Ko,"f").removeAttribute(e);j(this,na,t,"f"),j(this,ea,s,"f")}return i}render(t,e){return i}});function oa(t,e={}){return ra(t,e)}function aa(){const t=new Uint8Array(16);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=256*Math.random()|0;t[6]=15&t[6]|64,t[8]=63&t[8]|128;const e=Array.from(t).map(t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}let la=null,ca=null,ha=null;function ua(t){la=t}function da(t){ca=t}function fa(){return ca}function pa(){return la??-(new Date).getTimezoneOffset()}function ma(){return ha??("undefined"!=typeof navigator?navigator.language:null)??"en"}function _a(t,e){const n={};for(const i of new Intl.DateTimeFormat("en",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(e)))"literal"!==i.type&&(n[i.type]=parseInt(i.value,10));const i=24===n.hour?0:n.hour,s=Date.UTC(n.year,n.month-1,n.day,i,n.minute,n.second);return Math.round((s-e)/6e4)||0}function ga(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function ya(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"long"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function wa(t,e){const n=new Date(t+6e4*e);return{Y:n.getUTCFullYear(),M:n.getUTCMonth()+1,D:n.getUTCDate(),h:n.getUTCHours(),m:n.getUTCMinutes(),s:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),wd:n.getUTCDay()}}const va=t=>String(t).padStart(2,"0");function ba(t,e,n){const i={[n]:e};return ca?i.timeZone=ca:(i.timeZone="UTC",t+=6e4*pa()),new Intl.DateTimeFormat(ma(),i).format(new Date(t))}function Sa(t,e){const n=t>=0?"+":"-",i=Math.abs(t);return e?`${n}${va(Math.floor(i/60))}:${va(i%60)}`:`${n}${va(Math.floor(i/60))}${va(i%60)}`}function Ea(t){const e=t.replace(/s$/,"");if("millisecond"===e||"m"===e)return"ms";if("minute"===e)return"min";if(!new Set(["year","month","week","day","hour","min","second","ms"]).has(e))throw new RangeError(`Invalid date unit: "${t}"`);return e}function Ca(){try{const t=new Intl.Locale(ma()),e=t.weekInfo?.firstDay??t.getWeekInfo?.()?.firstDay;if(void 0!==e)return e%7}catch{}return 0}const Ma=/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|H|hh|h|mm|ss|SSS|ZZ|Z|A|a/g,ka=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function xa(t){try{const e=new Date(Date.UTC(2024,0,7+t,12,0,0));return new Intl.DateTimeFormat(ma(),{weekday:"long",timeZone:"UTC"}).format(e)}catch{return ka[t]||""}}function Aa(t){try{const e=new Date(Date.UTC(2024,t-1,15,12,0,0));return new Intl.DateTimeFormat(ma(),{month:"long",timeZone:"UTC"}).format(e)}catch{return""}}function Ra(t){if(t instanceof Number)return t.valueOf();if("number"==typeof t)return t;if("string"==typeof t)return new Date(t).getTime();if(t instanceof Date)return t.getTime();if("object"==typeof t&&null!==t){const{year:e=1970,month:n=1,day:i=1,hour:s=0,minute:r=0,second:o=0,ms:a=0}=t;return Date.UTC(e,n-1,i,s,r,o,a)-6e4*pa()}return NaN}function Oa(t,e,n){const i=Ea(n);if("hour"===i)return t+36e5*e;if("min"===i)return t+6e4*e;if("second"===i)return t+1e3*e;if("ms"===i)return t+e;const s=pa(),r=wa(t,s);let o=r.Y,a=r.M,l=r.D;if("year"===i)o+=e;else if("month"===i){const t=a-1+e;o+=Math.floor(t/12),a=(t%12+12)%12+1,l=Math.min(l,new Date(o,a,0).getDate())}else l+="week"===i?7*e:e;return Date.UTC(o,a-1,l,r.h,r.m,r.s,r.ms)-6e4*s}function za(t,e){const n=pa(),i=wa(t,n),s=wa(e,n);return i.Y===s.Y&&i.M===s.M&&i.D===s.D}function Ta(t){const e=pa(),n=wa(t,e);return Date.UTC(n.Y,n.M-1,n.D,0,0,0,0)-6e4*e}function Ia(t,e){const n=pa(),i=wa(t,n),s=i.h%12||12,r=[],o=e.replace(/\[([^\]]*)\]/g,(t,e)=>(r.push(e),`\0${r.length-1}\0`));Ma.lastIndex=0;return o.replace(Ma,e=>{switch(e){case"YYYY":return String(i.Y);case"YY":return String(i.Y).slice(-2);case"MMMM":return ba(t,"long","month");case"MMM":return ba(t,"short","month");case"MM":return va(i.M);case"M":return String(i.M);case"DD":return va(i.D);case"D":return String(i.D);case"dddd":return ba(t,"long","weekday");case"ddd":return ba(t,"short","weekday");case"HH":return va(i.h);case"H":return String(i.h);case"hh":return va(s);case"h":return String(s);case"mm":return va(i.m);case"ss":return va(i.s);case"SSS":return r=i.ms,String(r).padStart(3,"0");case"A":return i.h>=12?"PM":"AM";case"a":return i.h>=12?"pm":"am";case"Z":return Sa(n,!0);case"ZZ":return Sa(n,!1);default:return e}var r}).replace(/\0(\d+)\0/g,(t,e)=>r[+e])}const Pa=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60],["second",1]];const Da=Symbol("ts"),La=Object.create(Number.prototype);function ja(t){return function(t){const e=Object.create(La);return e[Da]=t,e}(void 0===t?Date.now():Ra(t))}function Na(t){null==t?(ua(null),da(null)):(ua(t.offset),da(t.name))}function $a(t){ua(t),da(null)}function Ua(){return pa()}function Fa(t){ha=t??null}function Va(){return ma()}function Wa(){let t;try{t=Intl.supportedValuesOf("timeZone")}catch{return[]}const e=Date.now();return t.map(t=>({name:t,longName:ya(t,e),shortName:ga(t,e),offset:_a(t,e)}))}function Ya(t){const e=t??ma(),n=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),i=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),s=[];for(let t=1;t<=12;t++){const e=new Date(Date.UTC(2024,t-1,15,12,0,0));s.push({number:t,name:n.format(e),shortName:i.format(e)})}return s}function Ha(t,e){if(!Number.isInteger(t)||!Number.isInteger(e)||e<1||e>12)throw new RangeError("getCalendar(year, month): month must be integer 1–12");const n=ja({year:t,month:e,day:1}),{year:i,month:s,numberOfDaysOfTheMonth:r}=n.values,o=[];for(let t=wa(n.valueOf(),pa()).wd;t>0;t--)o.push(ja({year:i,month:s,day:1-t}));for(let t=1;t<=r;t++)o.push(ja({year:i,month:s,day:t}));const a=o.length%7,l=0===a?0:7-a,c=ja({year:i,month:s,day:r});for(let t=0;t<l;t++)c.add(1,"day"),o.push(ja(c.valueOf()));const h=[];for(let t=0;t<o.length;t+=7)h.push(o.slice(t,t+7));return h}Object.defineProperties(La,{valueOf:{value(){return this[Da]},writable:!1,configurable:!1},values:{get(){const t=this[Da],e=wa(t,pa());return{year:e.Y,month:e.M,monthName:Aa(e.M),dayName:xa(e.wd),date:e.D,weekStartDayName:xa(Ca()),numberOfDaysOfTheMonth:new Date(e.Y,e.M,0).getDate(),hours:e.h,minutes:e.m,seconds:e.s,milliSeconds:e.ms,timestamp:t,iso:new Date(t).toISOString()}},configurable:!1},toJSON:{value(){const t=this[Da];return Number.isFinite(t)?new Date(t).toISOString():"Invalid Date"},writable:!1,configurable:!1},toString:{value(){const t=this[Da];return Number.isFinite(t)?new Intl.DateTimeFormat(ma(),{dateStyle:"medium",...fa()?{timeZone:fa()}:{timeZone:"UTC"}}).format(new Date(fa()?t:t+6e4*pa())):"Invalid Date"},writable:!1,configurable:!1},format:{value(t){return Ia(this[Da],t)},writable:!1,configurable:!1},formatLongAgo:{value(t){return function(t,e={}){const{numeric:n="auto",style:i="long"}=e,s=((void 0!==e.now?Ra(e.now):Date.now())-t)/1e3,r=Math.abs(s),o=s>=0?-1:1,a=new Intl.RelativeTimeFormat(ma(),{numeric:n,style:i});for(const[t,e]of Pa)if(r>=e)return a.format(o*Math.round(r/e),t);return a.format(0,"second")}(this[Da],t)},writable:!1,configurable:!1},add:{value(t,e){return this[Da]=Oa(this[Da],t,e),this},writable:!1,configurable:!1},subtract:{value(t,e){return this[Da]=Oa(this[Da],-t,e),this},writable:!1,configurable:!1},isBefore:{value(t){return this[Da]<Ra(t)},writable:!1,configurable:!1},isAfter:{value(t){return this[Da]>Ra(t)},writable:!1,configurable:!1},isFuture:{value(){return this[Da]>Date.now()},writable:!1,configurable:!1},isPresent:{value(){return za(this[Da],Date.now())},writable:!1,configurable:!1},isToday:{value(){return za(this[Da],Date.now())},writable:!1,configurable:!1},isYesterday:{value(){const t=Oa(Ta(Date.now()),-1,"day");return za(this[Da],t)},writable:!1,configurable:!1},isTomorrow:{value(){const t=Oa(Ta(Date.now()),1,"day");return za(this[Da],t)},writable:!1,configurable:!1},getDifference:{value(t,e){return function(t,e,n){const i=Ea(n),s=t-e;if("ms"===i)return s;if("second"===i)return Math.trunc(s/1e3);if("min"===i)return Math.trunc(s/6e4);if("hour"===i)return Math.trunc(s/36e5);const r=pa(),o=wa(t,r),a=wa(e,r);if("day"===i||"week"===i){const n=Math.floor((t+6e4*r)/864e5)-Math.floor((e+6e4*r)/864e5);return"week"===i?Math.trunc(n/7):n}return"month"===i?12*(o.Y-a.Y)+(o.M-a.M):o.Y-a.Y}(this[Da],Ra(t),e)},writable:!1,configurable:!1},getAge:{value(t){return function(t,e){const n=pa(),i=wa(t,n),s=wa(e,n);let r=s.Y-i.Y,o=i.M,a=i.D;2===o&&29===a&&((l=s.Y)%4==0&&l%100!=0||l%400==0||(o=3,a=1));var l;return(s.M<o||s.M===o&&s.D<a)&&r--,Math.max(0,r)}(this[Da],void 0!==t?Ra(t):Date.now())},writable:!1,configurable:!1}});export{di as $,Xo as Context,Bn as Delete,xn as ErrorTypes,Fn as Fetch,$n as FetchClient,Vn as Get,ne as MA,F as NotificationManager,Hn as Patch,Wn as Post,Yn as Put,vn as Router,V as SyncNotificationManager,ie as ZeroPromise,ot as _,at as _subToView,re as action,C as addStoreBeingRead,pi as animatedIf,an as animatedRouter,mi as animatedX,xr as arrayRange,P as assertComponentOuterContext,I as assertNotInRestrictedContext,Ne as asyncAction,ze as atom,wi as attr,be as blurInPreset,Se as blurOutPreset,me as bouncePreset,ln as buildPath,On as buildRequestUrl,ur as cacheAtom,Le as cacheFn,Ar as chunk,kr as clamp,Si as classes,Z as cleanupScheduler,Nn as clearInterceptors,Ce as collapseWidthPreset,z as componentRunningStatus,Oo as computeAutoPlacement,xt as configureCSS,Le as createCacheManager,se as createManagedTimer,je as createPollingManager,Re as createReactiveRunner,Ks as createTimedAtom,ja as date,Ve as debounce,tr as debouncedAtom,Zo as deepClone,ke as deepFreeze,Qn as deleteAction,ke as df,Co as dialog,Ge as effect,J as effectScheduler,gi as eleHook,ft as event,Ee as expandWidthPreset,oe as fadeInPreset,ae as fadeOutPreset,qn as fetchAction,Un as fetchClient,we as flipInPreset,ve as flipOutPreset,wr as formAtom,br as get,Gn as getAction,Fr as getAllProps,Wa as getAllTimezones,Ha as getCalendar,Ao as getCoords,H as getCurrentHost,Va as getLocale,Ya as getMonths,Wr as getParentScope,Wr as getScope,S as getStoresBeingRead,Ua as getTimezoneOffset,Qt as globalCSS,Q as globalScheduler,ni as globalTheme,Or as groupBy,hn as hashAtom,Mi as htmlHook,Te as iAtom,ee as injectMatesAnimations,_ as installDevToolsHooks,Ln as interceptAfter,Dn as interceptBefore,jn as interceptError,Ys as isAction,An as isApiResponseSuccess,Hs as isAsyncAction,Qs as isAsyncFunction,mt as isAsyncValue,Vs as isAtom,Xs as isChannel,Gs as isConfirmationEvent,Jo as isDefinedAsGetter,g as isDevToolsInstalled,E as isEffectRunning,Pr as isEmail,zr as isEmpty,qs as isEvent,Js as isFunction,Zs as isGetter,T as isInRestrictedContext,$r as isMax,Nr as isMin,rn as isPathMatching,jr as isPattern,b as isReadTrackingEnabled,Ir as isRequired,G as isSSR,Bs as isSetter,Ws as isUnit,Tr as iterateDeeply,Jt as keyframes,Ti as lazyLoad,gn as location,en as lockNavigation,D as logError,ar as lsAtom,er as mapAtom,Ni as masonryGrid,Lr as maxLength,Ur as memo,Vi as memoTemplate,Mr as merge,Dr as minLength,yn as navigateTo,tn as navigationLocked,Er as omit,Ji as on,it as onAllMount,Kr as onBlur,st as onCleanup,po as onClickAway,Di as onConnect,ro as onCopy,oo as onCut,So as onDOMReady,Li as onDisconnect,Br as onError,fo as onFileDrop,to as onFocus,Ri as onHidden,xi as onIntersect,yo as onInterval,ao as onKeyDown,lo as onKeyUp,et as onMount,go as onNavigate,no as onOffline,eo as onOnline,nt as onPaint,ts as onParent,so as onPaste,qr as onReferenceChange,_o as onResize,mo as onScroll,zi as onScrolledIntoView,ho as onSelectionChange,vo as onSocket,uo as onStorageChange,wo as onTimeout,bo as onUpdate,co as onVisibilityChange,Ai as onVisible,Zr as onWindow,Jr as onWindowCapture,io as onWindowResize,Qr as onWindowScroll,We as paginatedAsyncAction,dr as paginationAtom,Jn as patchAction,sn as pathAtom,Sr as pick,Ro as placementTransform,k as popEffect,xo as popup,To as portal,Xn as postAction,ye as pulsePreset,M as pushEffect,Zn as putAction,pn as qsAtom,aa as randomId,Xe as ref,ut as registerCleanup,vi as removeAttr,Ei as removeClasses,Qi as removeOn,ss as removeStyle,es as renderSwitch,Ke as renderX,X as resetComponentState,_t as resolveAsyncValue,A as restoreTracking,ii as rootCSS,wn as route,oa as safeSVG,K as safetyCheck,x as saveAndEnableTracking,de as scaleInPreset,fe as scaleOutPreset,Vr as scope,nr as setAtom,Fa as setLocale,Ze as setRef,En as setSSRApiLookup,q as setSSRMode,Cn as setSSRRequest,Na as setTimezone,$a as setTimezoneOffset,rt as setter,ge as shakePreset,Te as signal,ce as slideInPreset,he as slideOutPreset,pe as spinPreset,_e as springInPreset,lr as ssAtom,R as startTracking,O as stopTracking,is as style,Bt as stylesheet,Ie as superAtom,Ye as taskAction,_r as themeAtom,He as throttle,cr as throttledAtom,os as timer,Yo as tip,hr as titleAtom,Wo as tooltip,xe as trackAndSubscribe,Rr as uniqBy,nn as unlockNavigation,oa as unsafeSVG,gt as unwrapModule,ht as useContext,Vr as useScope,Hr as useState,lt as useStore,aa as uuid,vr as validateAll,Ae as validateReactiveFunction,Qe as view,$s as virtualGrid,Ns as virtualList,Us as virtualMasonry,ct as watch,Y as withHost,Me as withStaggerPreset,Go as ws,Je as x,dt as xTabEvent};
126
+ */function ei(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n}:{keyFn:void 0,template:t,opts:e}}const ni=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,si=t=>"function"==typeof t,ii=t=>"AsyncFunction"===t.constructor.name,ri=(t,e,n,s)=>{if(ni(t)){const i=t,r=We(i(),s),o=n(r.set,e),a=n(r.update,e);return r.set=o,r.update=a,i.__subscribe(()=>{jt.schedule(()=>r.set(i()))}),Bt(r,()=>{o.cancel(),a.cancel()}),r}const i=We(t,s),r=n(i.set,e),o=n(i.update,e);return i.set=r,i.update=o,Bt(i,()=>{r.cancel(),o.cancel()}),i},oi="mates_storage";function ai(t,e){try{null===e?t.removeItem(oi):t.setItem(oi,JSON.stringify(e))}catch{}}function li(t,e){const n=We((()=>{try{return function(t){try{const e=t.getItem(oi);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{ai(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{ai(t(),n.get())}catch{}}},e(t=>{if(t.key===oi)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 ci(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}const hi=li(()=>localStorage,t=>ci(e=>{e.storageArea===localStorage&&t(e)})),ui=li(()=>sessionStorage,t=>ci(e=>{e.storageArea===sessionStorage&&t(e)})),di=We("undefined"!=typeof document?document.title:"");rn(()=>{var t;t=di.get(),"undefined"!=typeof document&&(document.title=t)});const fi="mates-theme";function pi(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}let mi=null;function _i(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 gi(t,e,n){const s=We(t,n),i=We([],n);function r(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const o=s.set;s.set=function(t,e=!1){o(t,e),r()};const a=s.update;s.update=function(t,e=!1){a(t,e),r()};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=r,l.toFloat=()=>_i(s.get()),l.toFloatString=()=>_i(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 yi(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function vi(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 wi(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 bi=t=>{const e=zt();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;wt.viewOuterInProgress=!0;try{n=new t}finally{wt.viewOuterInProgress=!1}const s=wt.setupInProgress;try{if((()=>{wi(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){ii(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),wt.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{wt.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{wt.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}}});if(zt().dispatchEvent(n),e)return e;throw new Error(`No parent scope found for ${t.name}`)};function xi(t,e){let n=t;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=Object.getPrototypeOf(n)}}function Ei(t,e,n,s=!1){document.addEventListener(t,e,{capture:s}),n.addToCleanUps(e,()=>{document.removeEventListener(t,e,{capture:s})})}function Ci(t,e,n,s){let i;if("wheelUp"===t||"wheelDown"===t){const r="wheelUp"===t,o=e,a=t=>{(r?t.deltaY>=0:t.deltaY<=0)||(i&&i(),i=o(t))};return window.addEventListener("wheel",a,{capture:n,passive:!0}),void s.addToCleanUps(e,()=>{window.removeEventListener("wheel",a,{capture:n}),i&&i()})}const r="scroll"===t||"touchstart"===t||"touchmove"===t,o=e,a=t=>{i&&i(),i=o(t)};window.addEventListener(t,a,{capture:n,passive:r}),s.addToCleanUps(e,()=>{window.removeEventListener(t,a,{capture:n}),i&&i()})}function Ai(t,e){$t()||(Ut(),Ci(t,e,!1,zt()))}function Mi(t,e){$t()||(Ut(),Ci(t,e,!0,zt()))}const ki=ns((t,e,n)=>{const s=document.createElement("div");Object.assign(s.style,{position:"fixed",inset:"0",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.5)"}),n?.style&&Object.assign(s.style,n.style),n?.onBackdropClick&&s.addEventListener("click",t=>{t.target===s&&n.onBackdropClick()});const i=document.createElement("div");n?.dialogStyle&&Object.assign(i.style,n.dialogStyle),i.addEventListener("click",t=>t.stopPropagation()),et(e,i),s.appendChild(i),document.body.appendChild(s);const r=document.body.style.overflow;return document.body.style.overflow="hidden",{onUpdate(t){et(t,i)},onCleanup(){s.remove(),document.body.style.overflow=r}}});function Ri(t,e,n,s,i,r,o){return t.startsWith("top")?s>=n:t.startsWith("bottom")?i>=n:t.startsWith("left")?r>=e:!!t.startsWith("right")&&o>=e}const Ti=Qn((t,e,n)=>{const s=t.el;let i=!1,r=e,o=n;const a=document.createElement("div");a.style.cssText="position:fixed;z-index:9999;margin:0;display:none;background:var(--md-color-surface-raised,#fff);box-shadow:var(--md-shadow-dropdown,0 5px 5px -3px rgba(0,0,0,.20),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12));min-width:160px;",o.style&&Object.assign(a.style,o.style),document.body.appendChild(a),et(r,a);const l=()=>{const t=s.getBoundingClientRect();a.style.visibility="hidden",a.style.display="block",o.matchAnchorWidth&&(a.style.width=`${t.width}px`);const e=a.offsetWidth,n=a.offsetHeight,i=function(t,e,n,s,i){const r=window.innerWidth,o=window.innerHeight,a=t.top-s,l=o-t.bottom-s,c=t.left-s,h=r-t.right-s;if("auto"===i){const t=["bottom-start","top-start","right","left"];for(const s of t)if(Ri(s,e,n,a,l,c,h))return s;return"bottom-start"}if(Ri(i,e,n,a,l,c,h))return i;const u=(d=i).startsWith("top")?d.replace("top","bottom"):d.startsWith("bottom")?d.replace("bottom","top"):d.startsWith("left")?d.replace("left","right"):d.startsWith("right")?d.replace("right","left"):d;var d;return Ri(u,e,n,a,l,c,h)?u:i}(t,e,n,o.gap??4,o.position??"bottom-start");!function(t,e,n,s,i,r){const o=window.innerWidth,a=window.innerHeight;let l=0,c=0;n.startsWith("bottom")?l=e.bottom+r:n.startsWith("top")?l=e.top-r-i:"right"===n||"left"===n?l=e.top+e.height/2-i/2:n.endsWith("-start")?l=e.top:n.endsWith("-end")&&(l=e.bottom-i),"bottom"===n||"top"===n?c=e.left+e.width/2-s/2:n.endsWith("-start")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-s:e.left:n.endsWith("-end")?c=n.startsWith("right")?e.right+r:n.startsWith("left")?e.left-r-s:e.right-s:n.startsWith("right")?c=e.right+r:n.startsWith("left")&&(c=e.left-r-s),t.style.left=`${Math.max(4,Math.min(c,o-s-4))}px`,t.style.top=`${Math.max(4,Math.min(l,a-i-4))}px`}(a,t,i,e,n,o.gap??4),a.style.visibility=""},c=()=>{i&&l()},h=t=>{const e=t.target;a.contains(e)||s.contains(e)||d()},u=t=>{"Escape"===t.key&&d()},d=()=>{i=!1,a.style.display="none",o.onClose?.(s),document.removeEventListener("click",h,{capture:!0}),document.removeEventListener("keydown",u),window.removeEventListener("scroll",c,{capture:!0}),window.removeEventListener("resize",c)},f=t=>{t.stopPropagation(),i?d():(i=!0,l(),o.onOpen?.(a),document.addEventListener("click",h,{capture:!0}),document.addEventListener("keydown",u),window.addEventListener("scroll",c,{passive:!0,capture:!0}),window.addEventListener("resize",c,{passive:!0}))};return s.addEventListener("click",f),{onUpdate(t,e){r=t,o=e,et(t,a),e.style&&Object.assign(a.style,e.style),i&&l()},onCleanup(){i&&d(),s.removeEventListener("click",f),a.remove()}}});const Oi=ns((t,e,n)=>{const s=document.createElement("div");if(s.style.position="fixed",s.style.zIndex="9999",n?.style&&Object.assign(s.style,n.style),n?.on)for(const[t,e]of Object.entries(n.on))s.addEventListener(t,e);return function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n?.target).appendChild(s),et(e,s),{onUpdate(t){et(t,s)},onCleanup(){s.remove()}}});let Pi=null,zi=null,Ii=null;function $i(){return Pi||(Pi=document.createElement("div"),Pi.id="mates-tip",Pi.setAttribute("role","tooltip"),Pi.style.cssText="position:fixed;z-index:10000;pointer-events:none;padding:6px 12px;border-radius:4px;font-size:0.8rem;font-family:system-ui,-apple-system,sans-serif;font-weight:500;line-height:1.4;max-width:300px;width:max-content;background:var(--md-sys-color-inverse-surface,#2e3036);color:var(--md-sys-color-inverse-on-surface,#f0f0f8);box-shadow:0 1px 3px rgba(0,0,0,.20),0 2px 6px rgba(0,0,0,.14);letter-spacing:0.01em;white-space:nowrap;display:none;",document.body.appendChild(Pi)),Pi}const Di=["maxWidth","padding","borderRadius","fontSize","whiteSpace"];function Li(t,e){if(e.maxWidth&&(t.style.maxWidth=e.maxWidth),e.padding&&(t.style.padding=e.padding),e.borderRadius&&(t.style.borderRadius=e.borderRadius),e.fontSize&&(t.style.fontSize=e.fontSize),e.whiteSpace&&(t.style.whiteSpace=e.whiteSpace),e.style)for(const[n,s]of Object.entries(e.style))void 0!==s&&(t.style[n]=s)}function ji(t,e){const n={maxWidth:"300px",padding:"6px 12px",borderRadius:"4px",fontSize:"0.8rem",whiteSpace:"nowrap"};for(const s of Di)void 0!==e[s]&&(t.style[s]=n[s]);if(e.style){for(const n of Object.keys(e.style))t.style[n]="";t.style.background="var(--md-sys-color-inverse-surface,#2e3036)",t.style.color="var(--md-sys-color-inverse-on-surface,#f0f0f8)"}}function Ni(t,e){et("string"==typeof e?j`${e}`:e,t)}function Ui(t,e){const n=t.getBoundingClientRect(),s=e.getBoundingClientRect(),i=s.width,r=s.height,o=window.innerWidth,a=window.innerHeight;let l;n.top-8-r>=0?(l=n.top-8-r,e.style.transformOrigin="bottom center"):(l=n.bottom+8,e.style.transformOrigin="top center");let c=n.left+n.width/2-i/2;c=Math.max(4,Math.min(c,o-i-4)),l=Math.max(4,Math.min(l,a-r-4)),e.style.left=`${c}px`,e.style.top=`${l}px`}const Fi=Qn((t,e,n)=>{const s=t.el;let i=e,r=n,o=null;const a=()=>{null!==Ii&&(cancelAnimationFrame(Ii),Ii=null),null!==o&&(clearTimeout(o),o=null);const t=r.delay??150;o=setTimeout(()=>{o=null;const t=$i();Ni(t,i),Li(t,r),t.style.visibility="hidden",t.style.opacity="0",t.style.transform="scale(0.94) translateY(3px)",t.style.transition="none",t.style.display="block",Ui(s,t),requestAnimationFrame(()=>{t.style.transition="opacity 0.14s ease, transform 0.14s cubic-bezier(0.22,1,0.36,1)",t.style.visibility="visible",t.style.opacity="1",t.style.transform="scale(1) translateY(0)",zi=s})},t)},l=()=>{if(null!==o&&(clearTimeout(o),o=null),zi!==s)return;const t=$i();t.style.transition="opacity 0.12s ease, transform 0.12s ease",t.style.opacity="0",t.style.transform="scale(0.94) translateY(3px)",Ii=requestAnimationFrame(()=>{Ii=requestAnimationFrame(()=>{Ii=null,zi===s&&(ji(t,r),t.style.display="none",zi=null)})})};return s.addEventListener("mouseenter",a),s.addEventListener("mouseleave",l),s.addEventListener("focusin",a),s.addEventListener("focusout",l),s.setAttribute("aria-describedby","mates-tip"),{onUpdate(t,e){if(i=t,r=e,zi===s){const n=$i();Ni(n,t),Li(n,e),Ui(s,n)}},onCleanup(){if(null!==o&&(clearTimeout(o),o=null),zi===s){null!==Ii&&(cancelAnimationFrame(Ii),Ii=null);const t=$i();ji(t,r),t.style.display="none",zi=null}s.removeEventListener("mouseenter",a),s.removeEventListener("mouseleave",l),s.removeEventListener("focusin",a),s.removeEventListener("focusout",l)}}});function Vi(t,e={}){return Fi(t,e)}const Wi=Vi,Hi=1e3,Yi=3e4,Bi=1/0;var qi,Gi,Xi,Zi,Ji,Qi;function Ki(t){return"number"==typeof t?`${t}px`:t}class tr extends g.Directive{constructor(t){if(super(t),qi.add(this),Gi.set(this,null),Xi.set(this,""),Zi.set(this,""),Ji.set(this,new Set),t.type!==g.PartType.CHILD)throw new Error("safeSVG() must be used as a child expression, e.g. html`<div>${safeSVG(markup)}</div>`")}update(t,[e,n]){if(console.log("update"),!e.trimStart().startsWith("<svg"))return console.warn("safeSVG: input does not start with <svg — nothing rendered"),Et(this,qi,"m",Qi).call(this,t),U;const s=JSON.stringify(n);if(null===Et(this,Gi,"f")||e!==Et(this,Xi,"f")){const n=function(t){const e=document.createElement("template");e.innerHTML=t;const n=e.content.firstElementChild;return n instanceof SVGElement?n:null}(e);if(null===n)return console.warn("safeSVG: failed to parse SVG markup — nothing rendered"),Et(this,qi,"m",Qi).call(this,t),U;Et(this,Gi,"f")?.remove(),Ct(this,Gi,n,"f"),Ct(this,Xi,e,"f"),Ct(this,Zi,"","f"),Ct(this,Ji,new Set,"f");const s=t.endNode;s.parentNode.insertBefore(Et(this,Gi,"f"),s)}if(s!==Et(this,Zi,"f")){const t=function(t,e){const n=new Set,s=(e,s)=>{t.setAttribute(e,s),n.add(e)},i=e.width??e.size,r=e.height??e.size;void 0!==i&&s("width",Ki(i)),void 0!==r&&s("height",Ki(r)),void 0!==e.fill&&s("fill",e.fill),void 0!==e.stroke&&s("stroke",e.stroke),void 0!==e.strokeWidth&&s("stroke-width",String(e.strokeWidth)),void 0!==e.strokeLinecap&&s("stroke-linecap",e.strokeLinecap),void 0!==e.strokeLinejoin&&s("stroke-linejoin",e.strokeLinejoin),void 0!==e.opacity&&s("opacity",String(e.opacity)),void 0!==e.viewBox&&s("viewBox",e.viewBox),void 0!==e.transform&&s("transform",e.transform);const o=[],a=e.width??e.size,l=e.height??e.size;void 0!==a&&o.push(`width:${Ki(a)}`),void 0!==l&&o.push(`height:${Ki(l)}`),void 0!==e.color&&o.push(`color:${e.color}`),o.push("display:inline-block"),o.push("vertical-align:middle"),e.style&&o.push(e.style),s("style",o.join(";")),e.class&&s("class",e.class);const c=e.ariaHidden??!0;return e.ariaLabel?(s("aria-label",e.ariaLabel),s("role","img")):c&&s("aria-hidden","true"),n}(Et(this,Gi,"f"),n);for(const e of Et(this,Ji,"f"))t.has(e)||Et(this,Gi,"f").removeAttribute(e);Ct(this,Ji,t,"f"),Ct(this,Zi,s,"f")}return U}render(t,e){return U}}Gi=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Ji=new WeakMap,qi=new WeakSet,Qi=function(t){Et(this,Gi,"f")?.remove(),Ct(this,Gi,null,"f"),Ct(this,Xi,"","f"),Ct(this,Zi,"","f"),Ct(this,Ji,new Set,"f");const e=t.endNode;if(e?.parentNode){const n=t.startNode,s=document.createRange();s.setStartAfter(n),s.setEndBefore(e),s.deleteContents()}};const er=g.directive(tr);function nr(t,e={}){return er(t,e)}function sr(){const t=new Uint8Array(16);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=256*Math.random()|0;t[6]=15&t[6]|64,t[8]=63&t[8]|128;const e=Array.from(t).map(t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}let ir=null,rr=null,or=null;function ar(t){ir=t}function lr(t){rr=t}function cr(){return rr}function hr(){return ir??-(new Date).getTimezoneOffset()}function ur(){return or??("undefined"!=typeof navigator?navigator.language:null)??"en"}function dr(t,e){const n={};for(const s of new Intl.DateTimeFormat("en",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(e)))"literal"!==s.type&&(n[s.type]=parseInt(s.value,10));const s=24===n.hour?0:n.hour,i=Date.UTC(n.year,n.month-1,n.day,s,n.minute,n.second);return Math.round((i-e)/6e4)||0}function fr(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function pr(t,e){try{const n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"long"}).formatToParts(new Date(e)).find(t=>"timeZoneName"===t.type);return n?n.value:t}catch{return t}}function mr(t,e){const n=new Date(t+6e4*e);return{Y:n.getUTCFullYear(),M:n.getUTCMonth()+1,D:n.getUTCDate(),h:n.getUTCHours(),m:n.getUTCMinutes(),s:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),wd:n.getUTCDay()}}const _r=t=>String(t).padStart(2,"0");function gr(t,e,n){const s={[n]:e};return rr?s.timeZone=rr:(s.timeZone="UTC",t+=6e4*hr()),new Intl.DateTimeFormat(ur(),s).format(new Date(t))}function yr(t,e){const n=t>=0?"+":"-",s=Math.abs(t);return e?`${n}${_r(Math.floor(s/60))}:${_r(s%60)}`:`${n}${_r(Math.floor(s/60))}${_r(s%60)}`}function vr(t){const e=t.replace(/s$/,"");if("millisecond"===e||"m"===e)return"ms";if("minute"===e)return"min";if(!new Set(["year","month","week","day","hour","min","second","ms"]).has(e))throw new RangeError(`Invalid date unit: "${t}"`);return e}function wr(){try{const t=new Intl.Locale(ur()),e=t.weekInfo?.firstDay??t.getWeekInfo?.()?.firstDay;if(void 0!==e)return e%7}catch{}return 0}const br=/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|H|hh|h|mm|ss|SSS|ZZ|Z|A|a/g,Sr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function xr(t){try{const e=new Date(Date.UTC(2024,0,7+t,12,0,0));return new Intl.DateTimeFormat(ur(),{weekday:"long",timeZone:"UTC"}).format(e)}catch{return Sr[t]||""}}function Er(t){try{const e=new Date(Date.UTC(2024,t-1,15,12,0,0));return new Intl.DateTimeFormat(ur(),{month:"long",timeZone:"UTC"}).format(e)}catch{return""}}function Cr(t){if(t instanceof Number)return t.valueOf();if("number"==typeof t)return t;if("string"==typeof t)return new Date(t).getTime();if(t instanceof Date)return t.getTime();if("object"==typeof t&&null!==t){const{year:e=1970,month:n=1,day:s=1,hour:i=0,minute:r=0,second:o=0,ms:a=0}=t;return Date.UTC(e,n-1,s,i,r,o,a)-6e4*hr()}return NaN}function Ar(t,e,n){const s=vr(n);if("hour"===s)return t+36e5*e;if("min"===s)return t+6e4*e;if("second"===s)return t+1e3*e;if("ms"===s)return t+e;const i=hr(),r=mr(t,i);let o=r.Y,a=r.M,l=r.D;if("year"===s)o+=e;else if("month"===s){const t=a-1+e;o+=Math.floor(t/12),a=(t%12+12)%12+1,l=Math.min(l,new Date(o,a,0).getDate())}else l+="week"===s?7*e:e;return Date.UTC(o,a-1,l,r.h,r.m,r.s,r.ms)-6e4*i}function Mr(t,e){const n=hr(),s=mr(t,n),i=mr(e,n);return s.Y===i.Y&&s.M===i.M&&s.D===i.D}function kr(t){const e=hr(),n=mr(t,e);return Date.UTC(n.Y,n.M-1,n.D,0,0,0,0)-6e4*e}function Rr(t,e){const n=hr(),s=mr(t,n),i=s.h%12||12,r=[],o=e.replace(/\[([^\]]*)\]/g,(t,e)=>(r.push(e),`\0${r.length-1}\0`));br.lastIndex=0;const a=o.replace(br,e=>{switch(e){case"YYYY":return String(s.Y);case"YY":return String(s.Y).slice(-2);case"MMMM":return gr(t,"long","month");case"MMM":return gr(t,"short","month");case"MM":return _r(s.M);case"M":return String(s.M);case"DD":return _r(s.D);case"D":return String(s.D);case"dddd":return gr(t,"long","weekday");case"ddd":return gr(t,"short","weekday");case"HH":return _r(s.h);case"H":return String(s.h);case"hh":return _r(i);case"h":return String(i);case"mm":return _r(s.m);case"ss":return _r(s.s);case"SSS":return(t=>String(t).padStart(3,"0"))(s.ms);case"A":return s.h>=12?"PM":"AM";case"a":return s.h>=12?"pm":"am";case"Z":return yr(n,!0);case"ZZ":return yr(n,!1);default:return e}});return a.replace(/\0(\d+)\0/g,(t,e)=>r[+e])}const Tr=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60],["second",1]];const Or=Symbol("ts"),Pr=Object.create(Number.prototype);function zr(t){return function(t){const e=Object.create(Pr);return e[Or]=t,e}(void 0===t?Date.now():Cr(t))}Object.defineProperties(Pr,{valueOf:{value(){return this[Or]},writable:!1,configurable:!1},values:{get(){const t=this[Or],e=mr(t,hr());return{year:e.Y,month:e.M,monthName:Er(e.M),dayName:xr(e.wd),date:e.D,weekStartDayName:xr(wr()),numberOfDaysOfTheMonth:new Date(e.Y,e.M,0).getDate(),hours:e.h,minutes:e.m,seconds:e.s,milliSeconds:e.ms,timestamp:t,iso:new Date(t).toISOString()}},configurable:!1},toJSON:{value(){const t=this[Or];return Number.isFinite(t)?new Date(t).toISOString():"Invalid Date"},writable:!1,configurable:!1},toString:{value(){const t=this[Or];return Number.isFinite(t)?new Intl.DateTimeFormat(ur(),{dateStyle:"medium",...cr()?{timeZone:cr()}:{timeZone:"UTC"}}).format(new Date(cr()?t:t+6e4*hr())):"Invalid Date"},writable:!1,configurable:!1},format:{value(t){return Rr(this[Or],t)},writable:!1,configurable:!1},formatLongAgo:{value(t){return function(t,e={}){const{numeric:n="auto",style:s="long"}=e,i=((void 0!==e.now?Cr(e.now):Date.now())-t)/1e3,r=Math.abs(i),o=i>=0?-1:1,a=new Intl.RelativeTimeFormat(ur(),{numeric:n,style:s});for(const[t,e]of Tr)if(r>=e)return a.format(o*Math.round(r/e),t);return a.format(0,"second")}(this[Or],t)},writable:!1,configurable:!1},add:{value(t,e){return this[Or]=Ar(this[Or],t,e),this},writable:!1,configurable:!1},subtract:{value(t,e){return this[Or]=Ar(this[Or],-t,e),this},writable:!1,configurable:!1},isBefore:{value(t){return this[Or]<Cr(t)},writable:!1,configurable:!1},isAfter:{value(t){return this[Or]>Cr(t)},writable:!1,configurable:!1},isFuture:{value(){return this[Or]>Date.now()},writable:!1,configurable:!1},isPresent:{value(){return Mr(this[Or],Date.now())},writable:!1,configurable:!1},isToday:{value(){return Mr(this[Or],Date.now())},writable:!1,configurable:!1},isYesterday:{value(){const t=Ar(kr(Date.now()),-1,"day");return Mr(this[Or],t)},writable:!1,configurable:!1},isTomorrow:{value(){const t=Ar(kr(Date.now()),1,"day");return Mr(this[Or],t)},writable:!1,configurable:!1},getDifference:{value(t,e){return function(t,e,n){const s=vr(n),i=t-e;if("ms"===s)return i;if("second"===s)return Math.trunc(i/1e3);if("min"===s)return Math.trunc(i/6e4);if("hour"===s)return Math.trunc(i/36e5);const r=hr(),o=mr(t,r),a=mr(e,r);if("day"===s||"week"===s){const n=Math.floor((t+6e4*r)/864e5)-Math.floor((e+6e4*r)/864e5);return"week"===s?Math.trunc(n/7):n}return"month"===s?12*(o.Y-a.Y)+(o.M-a.M):o.Y-a.Y}(this[Or],Cr(t),e)},writable:!1,configurable:!1},getAge:{value(t){return function(t,e){const n=hr(),s=mr(t,n),i=mr(e,n);let r=i.Y-s.Y,o=s.M,a=s.D;2===o&&29===a&&((l=i.Y)%4==0&&l%100!=0||l%400==0||(o=3,a=1));var l;return(i.M<o||i.M===o&&i.D<a)&&r--,Math.max(0,r)}(this[Or],void 0!==t?Cr(t):Date.now())},writable:!1,configurable:!1}}),Object.defineProperty(exports,"unsafeHTML",{enumerable:!0,get:function(){return t.unsafeHTML}}),Object.defineProperty(exports,"asyncAppend",{enumerable:!0,get:function(){return e.asyncAppend}}),Object.defineProperty(exports,"asyncReplace",{enumerable:!0,get:function(){return n.asyncReplace}}),Object.defineProperty(exports,"litCache",{enumerable:!0,get:function(){return s.cache}}),Object.defineProperty(exports,"classMap",{enumerable:!0,get:function(){return i.classMap}}),Object.defineProperty(exports,"guard",{enumerable:!0,get:function(){return r.guard}}),Object.defineProperty(exports,"ifDefined",{enumerable:!0,get:function(){return o.ifDefined}}),Object.defineProperty(exports,"join",{enumerable:!0,get:function(){return a.join}}),Object.defineProperty(exports,"keyed",{enumerable:!0,get:function(){return l.keyed}}),Object.defineProperty(exports,"live",{enumerable:!0,get:function(){return c.live}}),Object.defineProperty(exports,"range",{enumerable:!0,get:function(){return h.range}}),Object.defineProperty(exports,"repeat",{enumerable:!0,get:function(){return u.repeat}}),Object.defineProperty(exports,"styleMap",{enumerable:!0,get:function(){return d.styleMap}}),Object.defineProperty(exports,"until",{enumerable:!0,get:function(){return f.until}}),Object.defineProperty(exports,"when",{enumerable:!0,get:function(){return p.when}}),exports.$=Gn,exports.Context=class{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}},exports.Delete=t=>Dn.Delete(Rn(t)),exports.ErrorTypes=kn,exports.Fetch=t=>Dn.fetch(Rn(t)),exports.FetchClient=$n,exports.Get=t=>Dn.Get(Rn(t)),exports.MA={fadeIn:"mates-fade-in",fadeOut:"mates-fade-out",slideInUp:"mates-slide-in-up",slideOutUp:"mates-slide-out-up",slideInDown:"mates-slide-in-down",slideOutDown:"mates-slide-out-down",slideInLeft:"mates-slide-in-left",slideOutLeft:"mates-slide-out-left",slideInRight:"mates-slide-in-right",slideOutRight:"mates-slide-out-right",scaleIn:"mates-scale-in",scaleOut:"mates-scale-out",springIn:"mates-spring-in",flipInX:"mates-flip-in-x",flipInY:"mates-flip-in-y",blurIn:"mates-blur-in",blurOut:"mates-blur-out",shake:"mates-shake",pulse:"mates-pulse",bounce:"mates-bounce",spin:"mates-spin"},exports.NotificationManager=Rt,exports.Patch=t=>Dn.Patch(Rn(t)),exports.Post=t=>Dn.Post(Rn(t)),exports.Put=t=>Dn.Put(Rn(t)),exports.Router=(t,e)=>{const n=t.find(t=>dn(t.path));if(void 0===n)return e?()=>ln(e):()=>F;const{component:s}=n;return Gt(s),()=>ln(s)},exports.SyncNotificationManager=Tt,exports.ZeroPromise=Pe,exports._=Ht,exports._subToView=Yt,exports.action=function(t){bt("Action");let e=t;const n=new Set;let s=null,i=null;const r=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})};return Object.assign(function(...t){return((t,n)=>{try{let o;return o=s?s((...n)=>e.call(t,...n),...n):e.call(t,...n),i&&(o=i(o)),r(o),o}catch(t){const e=t instanceof Error?t:new Error(String(t));throw r(void 0),e}})(this,t)},{val:()=>e,set:t=>{e=t},__isAction___:!0,__subscribe:t=>(bt("subscribe"),n.add(t),()=>n.delete(t)),interceptBefore:t=>{s=t},interceptAfter:t=>{i=t}})},exports.addStoreBeingRead=ft,exports.animatedIf=Zn,exports.animatedRouter=function(t,e={}){return ln(fn,{routes:t,options:e})},exports.animatedX=function(t,e,n){const{show:s,...i}=n;return Zn(s,j`<x-view .view=${t} .props=${e}></x-view>`,F,i)},exports.arrayRange=function(t,e,n){if(void 0===e&&(e=t,t=0),void 0===n&&(n=t<=e?1:-1),0===n)return[];const s=[];if(n>0)for(let i=t;i<e;i+=n)s.push(i);else for(let i=t;i>e;i+=n)s.push(i);return s},exports.assertComponentOuterContext=St,exports.assertNotInRestrictedContext=bt,exports.asyncAction=Ze,exports.atom=We,exports.attr=function(t){return Kn(t)},exports.blurInPreset=function(t=10,e=400,n="ease-out"){return{keyframes:[{filter:`blur(${t}px)`,opacity:0},{filter:"blur(0px)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}},exports.blurOutPreset=function(t=10,e=400,n="ease-in"){return{keyframes:[{filter:"blur(0px)",opacity:1},{filter:`blur(${t}px)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}},exports.bouncePreset=function(t=600){return{keyframes:[{transform:"translateY(0)",offset:0},{transform:"translateY(-30%)",offset:.3},{transform:"translateY(0)",offset:.5},{transform:"translateY(-15%)",offset:.7},{transform:"translateY(0)",offset:.85},{transform:"translateY(-5%)",offset:.95},{transform:"translateY(0)",offset:1}],options:{duration:t,easing:"ease",fill:"both"}}},exports.buildPath=pn,exports.buildRequestUrl=Tn,exports.cacheAtom=function(t){const e=new Map,n=new Map,s=We(e,t),i=s.get.bind(s),r=s;return r.add=(t,i,r)=>{if(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),s.update(e=>{e.set(t,i)}),void 0!==r&&-1!==r&&r>0){const i=setTimeout(()=>{e.delete(t),n.delete(t),s.update(()=>{})},r);n.set(t,i)}},r.get=t=>(i(),e.get(t)),r.remove=t=>!!e.has(t)&&(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),e.delete(t),s.update(()=>{}),!0),r.has=t=>(i(),e.has(t)),r.getAll=()=>(i(),Array.from(e.values())),r.clearAll=()=>{n.forEach(t=>clearTimeout(t)),n.clear(),e.clear(),s.update(()=>{})},Object.defineProperty(r,"size",{get:()=>(i(),e.size),enumerable:!0,configurable:!0}),Object.defineProperty(r,"name",{get:()=>"cacheAtom",enumerable:!0,configurable:!0}),Bt(s,r.clearAll),r},exports.cacheFn=Ge,exports.chunk=function(t,e){if(e<1)return[];const n=[];for(let s=0;s<t.length;s+=e)n.push(t.slice(s,s+e));return n},exports.clamp=function(t,e,n){return Math.min(Math.max(t,e),n)},exports.classes=function(t){return ts(t)},exports.cleanupScheduler=Lt,exports.clearInterceptors=()=>{Pn.clear(),zn.clear(),In.clear()},exports.collapseWidthPreset=function(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"auto",overflow:"hidden"},{width:"0",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}},exports.componentRunningStatus=wt,exports.computeAutoPlacement=function(t,e,n,s){const i=window.innerHeight-t.bottom-s,r=t.top-s,o=window.innerWidth-t.right-s,a=t.left-s;return i>=n?"bottom":r>=n?"top":o>=e?"right":a>=e?"left":[["bottom",i],["top",r],["right",o],["left",a]].reduce((t,e)=>e[1]>t[1]?e:t)[0]},exports.configureCSS=function(t){t.breakpoints&&Object.assign(re,t.breakpoints)},exports.createCacheManager=Ge,exports.createManagedTimer=ze,exports.createPollingManager=Xe,exports.createReactiveRunner=Fe,exports.createTimedAtom=ri,exports.date=zr,exports.debounce=tn,exports.debouncedAtom=(t,e,n)=>ri(t,e,tn,n),exports.deepClone=function t(e,n=new WeakMap){if("function"==typeof structuredClone)return structuredClone(e);if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){const s=new Map;return n.set(e,s),e.forEach((e,i)=>s.set(t(i,n),t(e,n))),s}if(e instanceof Set){const s=new Set;return n.set(e,s),e.forEach(e=>s.add(t(e,n))),s}if(Array.isArray(e)){const s=[];n.set(e,s);for(let i=0;i<e.length;i++)s[i]=t(e[i],n);return s}const s=n.get(e);if(s)return s;const i={};n.set(e,i);for(const s of Object.keys(e))i[s]=t(e[s],n);return i},exports.deepFreeze=je,exports.deleteAction=t=>Dn.deleteAction(t),exports.df=je,exports.dialog=function(t,e){return ki(t,e)},exports.effect=rn,exports.effectScheduler=jt,exports.eleHook=Qn,exports.event=t=>{bt("event");const e=t||Math.random().toString(36).substring(2,15),n=new Tt;return{trigger:t=>{ot(e,t),n.trigger(t)},__subscribe:t=>n.subscribe(t),name:e,__isEvent___:!0}},exports.expandWidthPreset=function(t=500,e="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{width:"0",overflow:"hidden"},{width:"auto",overflow:"hidden"}],options:{duration:t,easing:e,fill:"both"}}},exports.fadeInPreset=Ie,exports.fadeOutPreset=$e,exports.fetchAction=t=>Dn.fetchAction(t),exports.fetchClient=Dn,exports.flipInPreset=function(t="y",e=500,n="ease-out"){const s="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${s}(90deg)`,opacity:0},{transform:`${s}(0deg)`,opacity:1}],options:{duration:e,easing:n,fill:"both"}}},exports.flipOutPreset=function(t="y",e=500,n="ease-in"){const s="x"===t?"rotateX":"rotateY";return{keyframes:[{transform:`${s}(0deg)`,opacity:1},{transform:`${s}(90deg)`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}},exports.formAtom=(t,e=[],n)=>gi(t,e,n),exports.get=function(t,e,n){const s=e.replace(/\[(\d+)]/g,".$1").split(".");let i=t;for(const t of s){if(null==i)return n;i=i[t]}return void 0===i?n:i},exports.getAction=t=>Dn.getAction(t),exports.getAllProps=wi,exports.getAllTimezones=function(){let t;try{t=Intl.supportedValuesOf("timeZone")}catch{return[]}const e=Date.now();return t.map(t=>({name:t,longName:pr(t,e),shortName:fr(t,e),offset:dr(t,e)}))},exports.getCalendar=function(t,e){if(!Number.isInteger(t)||!Number.isInteger(e)||e<1||e>12)throw new RangeError("getCalendar(year, month): month must be integer 1–12");const n=zr({year:t,month:e,day:1}),{year:s,month:i,numberOfDaysOfTheMonth:r}=n.values,o=[];for(let t=mr(n.valueOf(),hr()).wd;t>0;t--)o.push(zr({year:s,month:i,day:1-t}));for(let t=1;t<=r;t++)o.push(zr({year:s,month:i,day:t}));const a=o.length%7,l=0===a?0:7-a,c=zr({year:s,month:i,day:r});for(let t=0;t<l;t++)c.add(1,"day"),o.push(zr(c.valueOf()));const h=[];for(let t=0;t<o.length;t+=7)h.push(o.slice(t,t+7));return h},exports.getCoords=function(t,e,n){switch(e){case"top":case"top-start":return{top:t.top-n,left:t.left};case"top-end":return{top:t.top-n,left:t.right};case"bottom":case"bottom-start":default:return{top:t.bottom+n,left:t.left};case"bottom-end":return{top:t.bottom+n,left:t.right};case"right":case"right-start":return{top:t.top,left:t.right+n};case"right-end":return{top:t.bottom,left:t.right+n};case"left":case"left-start":return{top:t.top,left:t.left-n};case"left-end":return{top:t.bottom,left:t.left-n}}},exports.getCurrentHost=zt,exports.getLocale=function(){return ur()},exports.getMonths=function(t){const e=t??ur(),n=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),s=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[];for(let t=1;t<=12;t++){const e=new Date(Date.UTC(2024,t-1,15,12,0,0));i.push({number:t,name:n.format(e),shortName:s.format(e)})}return i},exports.getParentScope=Si,exports.getScope=Si,exports.getStoresBeingRead=function(){return ct},exports.getTimezoneOffset=function(){return hr()},exports.globalCSS=ke,exports.globalScheduler=Nt,exports.globalTheme=function(t){const e=Object.keys(t);if(0===e.length)throw new Error("[globalTheme] themes object must have at least one entry.");const n=e[0],s=e[1],i=t[n],r=[];r.push(Nn(":root",i));for(const n of e)r.push(Nn(`[data-theme="${n}"]`,t[n]));void 0!==s&&r.push(function(t){let e="";for(const n in t)e+=` ${jn(n)}: ${t[n]};\n`;return e?`@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n${e} }\n}`:""}(t[s])),Me();const o=Ae(),a=r.filter(Boolean).join("\n");a&&o.appendRules(a);const l=Object.create(null);for(const t in i)l[t]=jn(t);const c=Object.freeze(l),h=function(){try{return localStorage.getItem(Ln)}catch{return null}}(),u=new Set(["auto",...e]),d=We(null!==h&&u.has(h)?h:"auto",{skipRestrictedContextCheck:!0});return Object.defineProperty(d,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),rn(()=>{const t=d();!function(t){"undefined"!=typeof document&&("auto"===t?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",t))}(t),function(t){try{"auto"===t?localStorage.removeItem(Ln):localStorage.setItem(Ln,t)}catch{}}(t)}),{cssVars:c,themeAtom:d}},exports.groupBy=function(t,e){const n={};for(const s of t){const t=String(e(s));n[t]||(n[t]=[]),n[t].push(s)}return n},exports.hashAtom=_n,exports.html=j,exports.htmlHook=ns,exports.iAtom=He,exports.injectMatesAnimations=Oe,exports.installDevToolsHooks=function(t){t.registerComponent&&(st.registerComponent=t.registerComponent),t.unregisterComponent&&(st.unregisterComponent=t.unregisterComponent),t.notifyRender&&(st.notifyRender=t.notifyRender),t.getComponentName&&(st.getComponentName=t.getComponentName),t.logComponentMount&&(st.logComponentMount=t.logComponentMount),t.logComponentRender&&(st.logComponentRender=t.logComponentRender),t.logComponentUnmount&&(st.logComponentUnmount=t.logComponentUnmount),t.logAtomSet&&(st.logAtomSet=t.logAtomSet),t.logAtomUpdate&&(st.logAtomUpdate=t.logAtomUpdate),t.logEventTrigger&&(st.logEventTrigger=t.logEventTrigger),t.logCleanupEventTrigger&&(st.logCleanupEventTrigger=t.logCleanupEventTrigger),t.logFetchRequest&&(st.logFetchRequest=t.logFetchRequest),t.logFetchResponse&&(st.logFetchResponse=t.logFetchResponse),t.logFetchError&&(st.logFetchError=t.logFetchError),t.recordRender&&(st.recordRender=t.recordRender)},exports.interceptAfter=t=>On(zn,t),exports.interceptBefore=t=>On(Pn,t),exports.interceptError=t=>On(In,t),exports.isAction=t=>"function"==typeof t&&!0===t.__isAction___&&"function"==typeof t.__subscribe,exports.isApiResponseSuccess=function(t){return t>=200&&t<300},exports.isAsyncAction=t=>"function"==typeof t&&!0===t.__isAsyncAction___&&"function"==typeof t.subscribe,exports.isAsyncFunction=ii,exports.isAsyncValue=Gt,exports.isAtom=ni,exports.isChannel=t=>"object"==typeof t&&null!==t&&!0===t.__isChannel___&&"function"==typeof t.join,exports.isConfirmationEvent=t=>"object"==typeof t&&null!==t&&!0===t.__isConfirmationEvent___&&"function"==typeof t.requestConfirmation&&"function"==typeof t.onConfirmRequest,exports.isDefinedAsGetter=function(t,e){let n=Object.getOwnPropertyDescriptor(t,e),s=Object.getPrototypeOf(t);for(;!n&&s&&s!==Object.prototype;)n=Object.getOwnPropertyDescriptor(s,e),s=Object.getPrototypeOf(s);return n?.get&&"function"==typeof n.get?n.get:null},exports.isDevToolsInstalled=function(){return st.registerComponent!==nt},exports.isEffectRunning=dt,exports.isEmail=t=>(t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))(t)?null:"Invalid email",exports.isEmpty=vi,exports.isEvent=t=>"object"==typeof t&&null!==t&&!0===t.__isEvent___&&"function"==typeof t.__subscribe&&"function"==typeof t.trigger,exports.isFunction=si,exports.isGetter=t=>"function"==typeof t&&!0===t.__isSelector___&&"function"==typeof t.areVersionsChanged,exports.isInRestrictedContext=function(){return!wt.isHookRunning&&(wt.templateInProgress||dt())},exports.isMax=t=>e=>((t,e)=>t<=e)(e,t)?null:`Max is ${t}`,exports.isMin=t=>e=>((t,e)=>t>=e)(e,t)?null:`Min is ${t}`,exports.isPathMatching=dn,exports.isPattern=(t,e="Invalid format")=>n=>((t,e)=>e.test(t))(n,t)?null:e,exports.isReadTrackingEnabled=ut,exports.isRequired=t=>(t=>"number"==typeof t||"boolean"==typeof t||!vi(t))(t)?null:"Required",exports.isSSR=$t,exports.isSetter=t=>"function"==typeof t&&!0===t.__isSetter___&&"function"==typeof t.__subscribe,exports.isUnit=t=>"object"==typeof t&&null!==t&&!0===t.__isUnit___&&"function"==typeof t.__subscribe&&"function"==typeof t.__reset,exports.iterateDeeply=function t(e,n){if(null==e||"object"!=typeof e)return;const s=Array.isArray(e)?e.map((t,e)=>e):Object.keys(e);for(const i of s){const s=n(i,e[i],e);void 0!==s&&(e[i]=s);const r=e[i];null!==r&&"object"==typeof r&&t(r,n)}},exports.keyframes=function(t,e){ve("keyframes"),Me();const n=be(t);return Ee.appendRules(Se(n,e)),n},exports.lazyLoad=function(t,e){return is(t,e)},exports.location=xn,exports.lockNavigation=()=>hn.set(!0),exports.logError=xt,exports.lsAtom=hi,exports.mapAtom=(t=[],e)=>{const n=new Map(t),s=We(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return s.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),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=>r(t),clear:()=>{o()},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},exports.masonryGrid=function(t,e,n,s){return as(t,e,n,s)},exports.maxLength=t=>e=>((t,e)=>t.length<=e)(e,t)?null:`Max ${t} characters`,exports.memo=function(t){let e;return Fe({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):(e=We(void 0,{skipRestrictedContextCheck:!0}),e.set(()=>t,!0))}}),e},exports.memoTemplate=function(t,e){return us(t,e)},exports.merge=function t(e,...n){const s={...e};for(const e of n)for(const n of Object.keys(e))yi(s[n])&&yi(e[n])?s[n]=t(s[n],e[n]):s[n]=e[n];return s},exports.minLength=t=>e=>((t,e)=>t.length>=e)(e,t)?null:`Min ${t} characters`,exports.navigateTo=function(t,e,n){hn()||(e?window.history.replaceState(n,"",t):window.history.pushState(n,"",t),un.set(t))},exports.navigationLocked=hn,exports.noChange=U,exports.nothing=F,exports.omit=function(t,e){const n={...t};for(const t of e)delete n[t];return n},exports.on=function(t){return vs(t)},exports.onAllMount=t=>{Ut(),t.__isOnAllMount__=!0;const e=zt();e.addToCleanUps(t,Ft),Nt.onceIdle(()=>{if(!e.isConnected)return;const n=t();n&&e.addToCleanUps(t,n)})},exports.onBlur=t=>{Ai("blur",t)},exports.onCleanup=t=>{Ut(),t.__isOnCleanup__=!0;zt().addToCleanUps(t,t)},exports.onClickAway=t=>{if($t())return;Ut();const e=zt(!0),n=n=>{const s=n.target;s&&!e.contains(s)&&t(n)};document.addEventListener("mousedown",n,!0),e.addToCleanUps(t,()=>{document.removeEventListener("mousedown",n,!0)})},exports.onConnect=function(t){return rs(t)},exports.onCopy=t=>{Ai("copy",t)},exports.onCut=t=>{Ai("cut",t)},exports.onDOMReady=t=>{const e=zt();if(!e)throw new Error("onDOMReady must be called within a component context");return e.DOMReadyEvent.__subscribe(t)},exports.onDisconnect=function(t){return os(t)},exports.onError=t=>{Ut();const e=zt();e._errorHandlers||(e._errorHandlers=[]),e._errorHandlers.push(t)},exports.onFileDrop=t=>{if($t())return;Ut();const e=zt();let n;const s=t=>t.preventDefault(),i=e=>{e.preventDefault(),n&&n(),n=t(e)};window.addEventListener("dragover",s),window.addEventListener("drop",i),e.addToCleanUps(t,()=>{window.removeEventListener("dragover",s),window.removeEventListener("drop",i),n&&n()})},exports.onFocus=t=>{Ai("focus",t)},exports.onHidden=function(t,e){return ss({onHidden:t,...e})},exports.onIntersect=function(t){return ss(t)},exports.onInterval=(t,e)=>{if($t())return;Ut();const n=zt();let s;const i=setInterval(()=>{s&&s(),s=t()},e);n.addToCleanUps(t,()=>{clearInterval(i),s&&s()})},exports.onKeyDown=t=>{Ai("keydown",t)},exports.onKeyUp=t=>{Ai("keyup",t)},exports.onMount=Vt,exports.onNavigate=t=>{if($t())return;Ut();const e=zt();let n;const s=un.__subscribe(()=>{n&&n(),n=t(un.get())||null});e.addToCleanUps(t,()=>{s(),n&&n()})},exports.onOffline=t=>{Ai("offline",t)},exports.onOnline=t=>{Ai("online",t)},exports.onPaint=t=>{Ut(),t.__isOnPaint__=!0;const e=zt();e.addToCleanUps(t,Ft),e.PaintEvent.__subscribe(()=>t())},exports.onParent=function(t,e){return ws(t,e)},exports.onPaste=t=>{Ai("paste",t)},exports.onReferenceChange=(t,e)=>{const n=zt();if(Ut(),!n)throw new Error("onReferenceChange must be called inside a component");let s=[];t(),s=e(),n.onEachUpdate(()=>{const n=e();s.some((t,e)=>t!==n[e])&&(t(),s=n)})},exports.onResize=(t,e)=>{if($t())return;Ut();const n=zt();let s;const i=new ResizeObserver(e=>{for(const n of e)s&&s(),s=t(n)}),r=e||n;i.observe(r),n.addToCleanUps(t,()=>{i.disconnect(),s&&s()})},exports.onScroll=(t,e=window)=>{if($t())return;Ut();const n=zt();let s;const i=e=>{s&&s(),s=t(e)};e.addEventListener("scroll",i,{passive:!0}),n.addToCleanUps(t,()=>{e.removeEventListener("scroll",i),s&&s()})},exports.onScrolledIntoView=function(t,e){return is(t,e)},exports.onSelectionChange=t=>{if($t())return;Ut();let e;Ei("selectionchange",()=>{e&&e(),e=t(window.getSelection())},zt())},exports.onSocket=function(t,e){Ut();const n=zt(),s=e.map(e=>e.__subscribe(t));n.addToCleanUps(t,()=>{s.forEach(t=>t())})},exports.onStorageChange=t=>{Ai("storage",t)},exports.onTimeout=(t,e)=>{if($t())return;Ut();const n=zt();let s;const i=setTimeout(()=>{s=t()},e);n.addToCleanUps(t,()=>{clearTimeout(i),s&&s()})},exports.onUpdate=t=>{Ut();const e=zt();let n;e.onEachUpdate(()=>{n&&n(),n=t()}),e.addToCleanUps(t,()=>{n&&n()})},exports.onVisibilityChange=t=>{if($t())return;Ut();let e;Ei("visibilitychange",()=>{e&&e(),e=t(document.hidden)},zt())},exports.onVisible=function(t,e){return ss({onVisible:t,...e})},exports.onWindow=Ai,exports.onWindowCapture=Mi,exports.onWindowResize=t=>{Ai("resize",t)},exports.onWindowScroll=t=>{Mi("scroll",t)},exports.paginatedAsyncAction=function(t,e){const n=!!e?.allowInRestrictedContext,s=Ze(t,e),i=We(1,{skipRestrictedContextCheck:n}),r=We(-1,{skipRestrictedContextCheck:n});return Object.assign(s,{page:i,totalPages:r,next:(...t)=>{if(!(-1!==r.val&&i.val>=r.val))return i.update(t=>t+1),s(...t)}})},exports.paginationAtom=(t=1,e)=>{const n=We(t,e),s=n;return s.next=()=>{n.set(t=>t+1)},s.prev=()=>{n.set(t=>t>1?t-1:t)},s.reset=()=>{n.set(1)},Object.defineProperty(s,"currentPage",{get:()=>n.get(),enumerable:!1,configurable:!0}),Object.defineProperty(s,"name",{value:"paginationAtom",writable:!0,configurable:!0,enumerable:!1}),s},exports.patchAction=t=>Dn.patchAction(t),exports.pathAtom=un,exports.pick=function(t,e){const n={};for(const s of e)s in t&&(n[s]=t[s]);return n},exports.placementTransform=function(t){return"top"===t||"top-start"===t||"top-end"===t?"translateY(-100%)":"left"===t||"left-start"===t||"left-end"===t?"translateX(-100%)":""},exports.popEffect=mt,exports.popup=function(t,e){return Ti(t,"string"==typeof e?{position:e}:e??{})},exports.portal=function(t,e){return Oi(t,e)},exports.postAction=t=>Dn.postAction(t),exports.pulsePreset=function(t=1.05,e=400){return{keyframes:[{transform:"scale(1)"},{transform:`scale(${t})`},{transform:"scale(1)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}},exports.pushEffect=pt,exports.putAction=t=>Dn.putAction(t),exports.qsAtom=wn,exports.randomId=sr,exports.ref=on,exports.registerCleanup=Bt,exports.removeAttr=function(t){},exports.removeClasses=function(t){},exports.removeOn=function(t){gs.get(t)?.()},exports.removeStyle=function(t){},exports.render=et,exports.renderSwitch=function(t){for(const e of t){if(!Array.isArray(e))return e;{const[t,n]=e;if(t)return n}}return F},exports.renderX=(t,e,n={})=>et(ln(t,n),e),exports.resetComponentState=Dt,exports.resolveAsyncValue=Xt,exports.restoreTracking=gt,exports.rootCSS=function(t){Me();const e=Ae(),n=Nn(":root",t);n&&e.appendRules(n)},exports.route=(t,{view:e})=>dn(t)?e?cn(e,{}):F:null,exports.safeSVG=nr,exports.safetyCheck=Ut,exports.saveAndEnableTracking=_t,exports.scaleInPreset=function(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:`scale(${t})`,opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:e,easing:n,fill:"both"}}},exports.scaleOutPreset=function(t=0,e=300,n="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"scale(1)",opacity:1},{transform:`scale(${t})`,opacity:0}],options:{duration:e,easing:n,fill:"both"}}},exports.scope=bi,exports.setAtom=(t=[],e)=>{const n=new Set(t),s=We(n,e),i=n.add.bind(n);n.add=t=>(i(t),s.update(()=>{}),n);const r=n.delete.bind(n);n.delete=t=>{const e=r(t);return s.update(()=>{}),e};const o=n.clear.bind(n);n.clear=()=>{o(),s.update(()=>{})};const a=n.has.bind(n);n.has=t=>(s.get(),a(t));const l=Object.getOwnPropertyDescriptor(Set.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),l.get.call(n))});const c=n.entries.bind(n);n.entries=()=>(s.get(),c());const h=n.values.bind(n);n.values=()=>(s.get(),h());const u=n.keys.bind(n);n.keys=()=>(s.get(),u());const d=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),d(t,e));const f=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),f()),n.update=t=>{const e={add:t=>(i(t),e),delete:t=>r(t),clear:()=>{o()},has:t=>a(t),entries:()=>c(),values:()=>h(),keys:()=>u(),forEach:(t,e)=>d(t,e),[Symbol.iterator]:()=>f(),get size(){return l.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>(null==t||"object"!=typeof t||(e(t),s.update(()=>{})),n),Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},exports.setLocale=function(t){!function(t){or=t}(t??null)},exports.setRef=an,exports.setSSRApiLookup=function(t){En=t},exports.setSSRMode=function(t){It=t},exports.setSSRRequest=function(t){Cn=t},exports.setTimezone=function(t){null==t?(ar(null),lr(null)):(ar(t.offset),lr(t.name))},exports.setTimezoneOffset=function(t){ar(t),lr(null)},exports.setter=Wt,exports.shakePreset=function(t=10,e=400){return{keyframes:[{transform:"translateX(0)"},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:`translateX(-${t}px)`},{transform:`translateX(${t}px)`},{transform:"translateX(0)"}],options:{duration:e,easing:"ease-in-out",fill:"both"}}},exports.signal=He,exports.slideInPreset=function(t="up",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:e?Le(t,e):De[t],opacity:0},{transform:"translate(0, 0)",opacity:1}],options:{duration:n,easing:s,fill:"both"}}},exports.slideOutPreset=function(t="down",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:"translate(0, 0)",opacity:1},{transform:e?Le(t,e):De[t],opacity:0}],options:{duration:n,easing:s,fill:"both"}}},exports.spinPreset=function(t=1,e=600,n="linear"){return{keyframes:[{transform:"rotate(0deg)"},{transform:`rotate(${360*t}deg)`}],options:{duration:e,easing:n,fill:"both"}}},exports.springInPreset=function(t=500,e="cubic-bezier(0.34, 1.56, 0.64, 1)"){return{keyframes:[{transform:"scale(0)",opacity:0},{transform:"scale(1)",opacity:1}],options:{duration:t,easing:e,fill:"both"}}},exports.ssAtom=ui,exports.startTracking=yt,exports.stopTracking=vt,exports.style=function(t){return bs(t)},exports.stylesheet=function(){ve("stylesheet");const t=new xe;return{css:function(e){ve("css");const n=[],s=ce(e,n);return n.length>0&&t.appendRules(n.join("\n")),he(s)},mount:function(){if(function(t){if(wt.templateInProgress)throw new Error(`[css-in-js] ${t}() must not be called inside a template function. Call it in the component outer function or at module level.`)}("mount"),null===zt(!1))return t.mount(),()=>t.unmount();Vt(()=>(t.mount(),()=>t.unmount()))},keyframes:function(e,n){return ve("keyframes"),t.keyframes(e,n)}}},exports.superAtom=Ye,exports.svg=N,exports.taskAction=function(t){bt("taskAction");const e=[];let n=0,s=1,i=!1;const r={skipRestrictedContextCheck:!0},o=We([],r),a=We("idle",r),l=We(0,r);function c(){if(o.set([...e]),0===e.length)return void l.set(0);let t=0;for(const n of e)"running"===n.status?t+=.5:"pending"!==n.status&&(t+=1);l.set(Math.round(t/e.length*100))}function h(){if(i){return void(e.some(t=>"running"===t.status)||a.set("idle"))}if("running"!==a.get())return;const n=e.filter(t=>"running"===t.status).length,r=e.filter(t=>"pending"===t.status);if(0===r.length&&0===n)return void a.set("idle");const o=-1===s?r.length:Math.max(0,s-n);0!==o&&r.slice(0,o).forEach(e=>function(e){const n=new AbortController;e.status="running",e.abortController=n;const s=t(e.input,n.signal);if(s?.__isZeroPromise__){const t=s;e.abortController={signal:t.signal,abort:()=>{t.cancel()}}}c(),Promise.resolve(s).then(t=>{"cancelled"===e.status||(e.status="success",e.result.data=t),e.abortController=null,c(),h()}).catch(t=>{if("cancelled"===e.status||!0===e.abortController?.signal?.aborted)e.status="cancelled",e.abortController=null;else{const n=t instanceof Error?t:new Error(String(t));e.status="failed",e.result.error=n,e.abortController=null,xt(n,"taskAction")}c(),h()})}(e))}function u(t){return{id:++n,input:t,status:"pending",result:{data:null,error:null},abortController:null}}function d(t){const n=Array.isArray(t)?t:[t];for(const t of n)e.push(u(t));c(),"running"!==a.get()||i||h()}function f(t=1){"running"!==a.get()&&(s=t,i=!1,a.set("running"),h())}function p(){i=!0,function(){for(const t of e)"running"===t.status&&(t.status="cancelled",t.abortController?.abort(),t.abortController=null)}(),a.set("idle"),c()}function m(t){p(),e.length=0,n=0,c(),d(t)}const _={add:d,start:f,pause:function(){i||(i=!0)},stop:p,delete:function(t){const n=Array.isArray(t)?t:[t],s=new Set(n.map(t=>t.id));for(let t=e.length-1;t>=0;t--){const n=e[t];s.has(n.id)&&("running"===n.status&&(n.status="cancelled",n.abortController?.abort(),n.abortController=null),e.splice(t,1))}c(),"running"!==a.get()||i||h()},clearAndAdd:m,addAndStart:function(t,e=1){d(t),f(e)},clearAndStart:function(t,e=1){m(t),f(e)},isRunning:function(){return"running"===a.val},progress:l,tasks:o,pendingTasks:function(){return o.val.filter(t=>"pending"===t.status)},runningTasks:function(){return o.val.filter(t=>"running"===t.status)},successTasks:function(){return o.val.filter(t=>"success"===t.status)},failedTasks:function(){return o.val.filter(t=>"failed"===t.status)},cancelledTasks:function(){return o.val.filter(t=>"cancelled"===t.status)},__isTaskAction__:!0};return Bt(_,p),_},exports.themeAtom=function(){if(mi)return mi;const t=We(function(){try{const t=localStorage.getItem(fi);return"light"===t||"dark"===t||"auto"===t?t:null}catch{return null}}()??"auto",{skipRestrictedContextCheck:!0}),e=t;return e.setToLight=()=>{t.set("light")},e.setToDark=()=>{t.set("dark")},e.setToAuto=()=>{t.set("auto")},e.toggle=()=>{const e=pi(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>pi(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),rn(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",pi(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(fi):localStorage.setItem(fi,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")}),mi=e,e},exports.throttle=en,exports.throttledAtom=(t,e,n)=>ri(t,e,en,n),exports.timer=function(t,e){return Ss(t,e)},exports.tip=Wi,exports.titleAtom=di,exports.tooltip=Vi,exports.trackAndSubscribe=Ne,exports.uniqBy=function(t,e){const n=new Set,s=[];for(const i of t){const t=e(i);n.has(t)||(n.add(t),s.push(i))}return s},exports.unlockNavigation=()=>hn.set(!1),exports.unsafeSVG=nr,exports.unwrapModule=Zt,exports.useContext=function(t){let e=null;const n=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{context:t,resolve(t=null){e=t}}});return zt().dispatchEvent(n),e},exports.useScope=bi,exports.useState=t=>{const e=zt();if("object"!=typeof t||null===t)throw new Error("stateObj must be an object");const n=We(t),s=((t,e,n)=>{const s=wi(t);s.forEach(s=>{const i=xi(t,s);if(i?.get){let n,r=-1;const o=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==r&&(r=s,n=o.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(si(t[s])){if(ii(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=xi(t,n);if(!s)return;const r=!!s.get,o=!r&&si(s.value);r||o||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i})(t,n,"useState");return e?._useStates&&e._useStates.push({state:t,atom:n}),[s,n.update]},exports.useStore=function(t){return Yt(t,!0),t},exports.uuid=sr,exports.validateAll=function(t){const e=[],n={},s=new WeakSet;return function t(i,r){if(null==i)return;const o=typeof i;if("object"!==o&&"function"!==o)return;if(s.has(i))return;if(s.add(i),function(t){if(null==t)return!1;const e=typeof t;return("object"===e||"function"===e)&&!0===t.__isFormAtom__}(i)){const t=i.validate();return void(t.length>0&&(e.push(...t),n[r]=t))}if(Array.isArray(i)){for(let e=0;e<i.length;e++){const n=r?`${r}[${e}]`:`[${e}]`;t(i[e],n)}return}const a=Object.keys(i);for(const e of a){const n=r?`${r}.${e}`:e;t(i[e],n)}}(t,""),{isValid:0===e.length,errors:e,errorsByField:n}},exports.validateReactiveFunction=Ue,exports.view=cn,exports.virtualGrid=function(t,e,n,s){const{keyFn:i,template:r,opts:o}=ei(e,n,s),a={direction:o.direction??"vertical",itemSize:{width:o.itemWidth,height:o.itemHeight},gap:o.gap??"8px",flex:o.flex??!1,...o.pin?{pin:o.pin}:{}};return ti({items:t,renderItem:r,keyFunction:i,scroller:o.scroller,layout:(l=a,Object.assign({type:js},l))});var l},exports.virtualList=function(t,e,n,s){const{keyFn:i,template:r,opts:o}=ei(e,n,s),a={direction:o?.direction??"vertical",...o?.pin?{pin:o.pin}:{}};return ti({items:t,renderItem:r,keyFunction:i,scroller:o?.scroller,layout:Ms(a)})},exports.virtualMasonry=function(t,e,n,s){const{keyFn:i,template:r,opts:o}=ei(e,n,s),a={direction:o.direction??"vertical",getAspectRatio:o.getAspectRatio,gap:o.gap??"8px",flex:!0,...o.itemSize?{itemSize:o.itemSize}:{},...o.pin?{pin:o.pin}:{}};return ti({items:t,renderItem:r,keyFunction:i,scroller:o.scroller,layout:(l=a,Object.assign({type:Us},l))});var l},exports.watch=(t,e)=>{t.__isOn__=!0,bt("on");const n=new Set;let s;const i=()=>{if(s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}const e=t();"function"==typeof e&&(s=e)},r=()=>jt.schedule(i);e.forEach(t=>{n.add(t.__subscribe(r))});const o=()=>{if(n.forEach(t=>t()),s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}};return Bt(t,o),o},exports.withHost=Pt,exports.withStaggerPreset=function(t,e,n=50){return{keyframes:t.keyframes,options:{...t.options,delay:(t.options.delay??0)+e*n}}},exports.ws=function(t,e={}){St("ws");const{reconnect:n=!0,reconnectDelay:s=Hi,reconnectMaxDelay:i=Yi,reconnectMaxAttempts:r=Bi,protocols:o,auth:a,autoConnect:l=!0}=e,c=We("connecting",{skipRestrictedContextCheck:!0}),h=new Set;let u=null,d=0,f=s,p=null,m=!1;const _=[];function g(){null!==p&&(clearTimeout(p),p=null)}function y(){let e;m=!1,g(),c.set("connecting");try{e=function(){if(!a)return t;const e=a(),n=Object.entries(e);if(0===n.length)return t;const s=n.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");return t.includes("?")?`${t}&${s}`:`${t}?${s}`}()}catch(t){return xt(t),void c.set("error")}try{u=o?new WebSocket(e,o):new WebSocket(e)}catch(t){return xt(t),c.set("error"),void v()}u.onopen=()=>{m?u?.close():(d=0,f=s,c.set("connected"),function(){for(;_.length>0;){const t=_.shift();u?.readyState===WebSocket.OPEN&&u.send(t)}}())},u.onmessage=t=>{if(m)return;const e="string"==typeof t.data?t.data:String(t.data);let n;try{n=JSON.parse(e)}catch{n=e}var s;s=n,h.forEach(t=>{try{t(s)}catch(t){xt(t)}})},u.onerror=()=>{c.set("error")},u.onclose=()=>{m||(c.set("disconnected"),v())}}function v(){if(!n||m)return;if(d>=r)return;d++;const t=f;f=Math.min(2*f,i),p=setTimeout(()=>{m||y()},t)}function w(){m=!0,g(),u&&(u.onopen=null,u.onmessage=null,u.onerror=null,u.onclose=null,u.readyState!==WebSocket.OPEN&&u.readyState!==WebSocket.CONNECTING||u.close(1e3,"client disconnect"),u=null),c.set("disconnected"),h.clear(),_.length=0}const b={send:function(t){const e="string"==typeof t?t:JSON.stringify(t);u?.readyState===WebSocket.OPEN?u.send(e):_.push(e)},__subscribe:function(t){return h.add(t),()=>h.delete(t)},status:c,connect:y,disconnect:w,__isWs___:!0};return l?y():c.set("disconnected"),Bt(b,w),b},exports.x=ln,exports.xTabEvent=t=>{bt("xTabEvent");const e=new Set,n=n=>{e.forEach(e=>{try{e(n)}catch(e){xt(e,`xTabEvent(${t}) handler`)}})},s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(t):null;s&&(s.onmessage=t=>{n(t.data)});return{trigger:e=>{if(ot(t,e),s)try{s.postMessage(e)}catch(e){xt(e,`xTabEvent(${t}) postMessage`)}n(e)},__subscribe:t=>{e.add(t);const n=()=>{e.delete(t)};return Bt(t,n),n},close:()=>{s&&s.close()},name:t,__isEvent___:!0,__isXTabEvent___:!0}};
118
127
  //# sourceMappingURL=index.esm.js.map