mates 0.4.0-beta.2 → 0.4.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ class Rt extends X{constructor(t){if(super(t),this.it=E,t.type!==W)throw Error(t
71
71
  * @license
72
72
  * Copyright 2021 Google LLC
73
73
  * SPDX-License-Identifier: BSD-3-Clause
74
- */const zt=()=>{},Dt={registerComponent:zt,unregisterComponent:zt,notifyRender:zt,getComponentName:()=>"Anonymous",logComponentMount:zt,logComponentRender:zt,logComponentUnmount:zt,logAtomSet:zt,logAtomUpdate:zt,logEventTrigger:zt,logCleanupEventTrigger:zt,logFetchRequest:zt,logFetchResponse:zt,logFetchError:zt,recordRender:zt};function Nt(t,e){Dt.registerComponent(t,e)}function Lt(t){return Dt.getComponentName(t)}function jt(t,e){Dt.logEventTrigger(t,e)}function Ut(t,e,n){Dt.recordRender(t,e,n)}function Ft(){return Dt.registerComponent!==zt}const Vt=Symbol.for("mates.readTracking");globalThis[Vt]||(globalThis[Vt]={enableReadTracking:!1,storesBeingRead:new Set,effectRunning:!1});const Wt=globalThis[Vt];function Bt(){return Wt.enableReadTracking}function Ht(){return Wt.effectRunning}function Yt(t){Wt.storesBeingRead.add(t)}function qt(){Wt.effectRunning=!0}function Xt(){Wt.effectRunning=!1}function Gt(){const t={prevEnabled:Wt.enableReadTracking,prevStores:Wt.storesBeingRead};return Wt.enableReadTracking=!0,Wt.storesBeingRead=new Set,t}function Zt(t){const e=Wt.storesBeingRead;return Wt.enableReadTracking=t.prevEnabled,Wt.storesBeingRead=t.prevStores,e}const Kt=Gt,Qt=Zt,Jt=Symbol.for("mates.componentRunningStatus");globalThis[Jt]||(globalThis[Jt]={setupInProgress:!1,templateInProgress:!1,viewOuterInProgress:!1,isHookRunning:!1});const te=globalThis[Jt];function ee(t){if(!te.isHookRunning){if(te.templateInProgress)throw new Error(`${t} cannot be created during template function execution. Only scopes (useScope) are allowed in templates.`);if(Ht())throw new Error(`${t} cannot be created inside a memo() or effect(). They should only read state, not create new reactive primitives.`)}}function ne(t){if(!te.viewOuterInProgress){if(te.templateInProgress)throw new Error(`${t} cannot be called during template function execution. Move it to the component's outer function.`);if(Ht())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).`)}}const se=new Set,ie={name:"matesLogEvent",__isEvent___:!0,trigger(t){se.forEach(e=>{try{e(t)}catch(t){}})},__subscribe:t=>(se.add(t),()=>se.delete(t))};function oe(t){try{return structuredClone(t)}catch(e){return t}}function re(){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")}function ae(t){try{ie.trigger(t)}catch(t){}}function le(t,e){ae({level:"error",message:t,data:void 0!==e?oe(e):void 0,ts:performance.now()}),re()&&(void 0!==e?console.error(`[${e}]`,t):console.error(t))}function ce(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 he(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 ue,de,fe;"function"==typeof SuppressedError&&SuppressedError;class pe{constructor(){ue.set(this,new Set),de.set(this,1)}subscribe(t){return ce(this,ue,"f").add(t),()=>ce(this,ue,"f").delete(t)}notify(){var t;he(this,de,(t=ce(this,de,"f"),++t),"f"),[...ce(this,ue,"f")].forEach(t=>{try{t?.()}catch(t){console.error(t)}})}getVersion(){return ce(this,de,"f")}get subscriberCount(){return ce(this,ue,"f").size}clear(){ce(this,ue,"f").clear()}}ue=new WeakMap,de=new WeakMap;class me{constructor(){fe.set(this,new Set)}subscribe(t){return ee("subscribe"),ce(this,fe,"f").has(t)?()=>{}:(ce(this,fe,"f").add(t),()=>ce(this,fe,"f").delete(t))}trigger(t){ce(this,fe,"f").forEach(e=>{try{e(t)}catch(t){console.error("Error in event handler:",t)}})}get handlerCount(){return ce(this,fe,"f").size}clear(){ce(this,fe,"f").clear()}}fe=new WeakMap;const _e=Symbol.for("mates.hostStack");globalThis[_e]||(globalThis[_e]=[]);const ge=globalThis[_e];function ye(t,e){ge.push(t);let n=null;try{n=e()}finally{ge.pop()}return n}function we(t){const e=ge[ge.length-1];if(!e){if(!1!==t)throw new Error("getCurrentHost(): No active host context");return null}return e}const ve=(t,e)=>{const n=we(!1);n&&n.addToCleanUps(t,e)},be=t=>{ee("event");const e=t||Math.random().toString(36).substring(2,15),n=new me;return{trigger:t=>{jt(e,t),n.trigger(t)},__subscribe:t=>n.subscribe(t),name:e,__isEvent___:!0}},xe=t=>{ee("cleanupEvent");const e=t||Math.random().toString(36).substring(2,15),n=new Map,s=()=>{n.forEach(t=>{if(t)try{t()}catch(t){le(t,"cleanupEvent cleanup")}})},i={trigger:t=>{!function(t,e){Dt.logCleanupEventTrigger(t,e)}(e,t),n.forEach((e,s)=>{if(e)try{e()}catch(t){le(t,"cleanupEvent cleanup")}try{const e=s(t);n.set(s,e)}catch(t){le(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){le(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};let Se=!1;function Ce(){return Se}let Ee=0,Ae=null,ke=null;function Me(){Se&&(Ee++,null!==ke&&(clearTimeout(ke),ke=null))}function $e(){Se&&(Ee=Math.max(0,Ee-1),function(){if(Ee>0)return;if(!Ae)return;if(null!==ke)return;ke=setTimeout(()=>{if(ke=null,0===Ee&&Ae){const t=Ae;Ae=null,t()}},5)}())}function Re(){return"undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("index.js",document.baseURI).href,"undefined"==typeof process||!process.env||"production"!==process.env.NODE_ENV}function Te(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 Oe=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||(Te(e),e._view=null,e._props={},e.oldView=void 0)}reset(){this.pending.clear(),this.isScheduled=!1}},Ie=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){le(t,"Effect")}}this._isFlushing=!1,this.isScheduled=!1,Pe.flush()}},Pe=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(()=>{Ie.isScheduled||Ie.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){le(t,"Component render")}this._currentWave.clear()}this._isFlushing=!1,this.isScheduled=!1,this.nextPendingComponents.size>0?(this.isScheduled=!0,queueMicrotask(()=>{Ie.isScheduled||Ie.isFlushing||this.flush()})):this._drainIdleCallbacks()}},ze=()=>{if(te.templateInProgress&&!te.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.")},De=()=>{},Ne=t=>{ze(),t.__isOnMount__=!0;const e=we();e.addToCleanUps(t,De);if("AsyncFunction"===t.constructor.name&&Ce())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)})},Le=(t,e=!0)=>{if(e&&ee("Setter"),te.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=we();e&&ze();const i=new Set;try{const t=(...t)=>{const e=n(...t);return[...i].forEach(t=>{try{Ie.schedule(()=>t?.())}catch(t){console.error(t)}}),s?.isConnected&&Pe.schedule(s),e};return t.__subscribe=t=>(ee("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")}},je=Le;function Ue(t,e=!0,n){if(Ht())return;const s=we(e);if(s&&t&&!s.cleanups.has(t)){const e=n||t.__subscribe||t.subscribe,i=e?.(()=>{Pe.schedule(s)});s.addToCleanUps(t,i)}}const Fe=(t,e)=>{t.__isOn__=!0,ee("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)},o=()=>Ie.schedule(i);e.forEach(t=>{n.add(t.__subscribe(o))});const r=()=>{if(n.forEach(t=>t()),s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}};return ve(t,r),r};function Ve(){return Re()&&"undefined"!=typeof window&&!!window.__mates_hmr}function We(t){return!!t&&("AsyncFunction"===t.constructor?.name||t instanceof Promise||"object"==typeof t&&null!==t&&"then"in t||"function"==typeof t.then)}function Be(t){return"function"==typeof t?t():t}function He(t){return t.default||t}class Ye 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=te.templateInProgress;te.templateInProgress=!1,ye(this,()=>{this.DOMReadyEvent=xe("DOMReady"),this.PaintEvent=xe("Paint")}),te.templateInProgress=t}set props(t){this._props=t,Pe.schedule(this)}get props(){return this._props}_applyViewChange(t,e){this.oldView!==t&&(this.oldView=t,e(t),(this._hasMounted||this._errorState)&&Te(this))}set view(t){if(null!==t){if(We(t))return this._isViewLoading=!0,void Be(t).then(t=>{this._isViewLoading=!1,this.view=He(t)},t=>{this._isViewLoading=!1,this._handleRenderError(t)});"function"==typeof t&&(this.name=t.name||"Anonymous"),this._applyViewChange(t,()=>{this._view=t}),Pe.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 Ye){e=n,t=n._depth+1;break}n=n.parentElement}this._depth=t,this._parentComponent=e,Oe.cancelDisconnect(this),this._hasMounted&&(Ft()&&!this._view?.skipDevToolsRender&&Nt(this,this._view),Pe.schedule(this))}disconnectedCallback(){var t,e,n;this.removeEventListener("request-parent-scope",this._onRequestParentScope),Ft()&&(this._view?.__devtools__||this._view?.skipDevToolsRender||(n=Lt(this),Dt.logComponentUnmount(n)),this._view?.skipDevToolsRender||(t=this,e=this._view,Dt.unregisterComponent(t,e))),Oe.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._view?.__isErrorView__||this._isViewLoading||this._renderScheduled)&&this._view)if(this._renderVersion=Pe.flushVersion,this._hasMounted){if(this._xviewRender){this.callOnEachUpdate();let s=0;if(Ft()){const i=this._view?.__devtools__,o=this._view?.skipDevToolsRender,r=performance.now();this._xviewRender(),s=performance.now()-r,i||o||(Ut(Lt(this),this.componentId,s),e=Lt(this),n=s,Dt.logComponentRender(e,n)),o||(t=this,Dt.notifyRender(t))}else this._xviewRender()}}else this._mountComponent()}_mountComponent(){const t=this._view,e=function(t){if(!Ve())return t;const e=t?.__mates_hmr_id;if(!e)return t;const n=window.__mates_hmr?.components;return n?.[e]??t}(t);F(x``,this),te.viewOuterInProgress=!0;try{this._templateFn=ye(this,()=>e(this._propsFn))}catch(t){return te.viewOuterInProgress=!1,void this._handleRenderError(t)}if(te.viewOuterInProgress=!1,"function"==typeof this._templateFn){if(this._xviewRender=()=>{te.templateInProgress=!0;try{if(!this._templateFn)return;ye(this,()=>{const t=this._templateFn(this._propsFn);F(t,this)}),this.DOMReadyEvent?.trigger(),this.PaintEvent?.hasSubscribers&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&this.PaintEvent?.trigger()})})}catch(t){this._handleRenderError(t)}finally{te.templateInProgress=!1}},this.callOnEachUpdate(),Ft()){const t=e?.__devtools__,n=e?.skipDevToolsRender,s=performance.now();this._xviewRender();const i=performance.now()-s;t||n||Ut(e?.name||"Anonymous",this.componentId,i)}else this._xviewRender();this._view===t&&(this._hasMounted=!0,Ft()&&(e?.skipDevToolsRender||Nt(this,e),e?.__devtools__||e?.skipDevToolsRender||(n=e?.name||"Anonymous",Dt.logComponentMount(n))))}else this._handleRenderError(new Error("inner function must be a template function that returns html result"));var n}_hotRefresh(){Te(this),Pe.schedule(this)}_handleRenderError(t){this._errorState=t;for(const e of this._errorHandlers)try{e(t)}catch(t){}if(le(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=()=>()=>x`
74
+ */const zt=()=>{},Dt={registerComponent:zt,unregisterComponent:zt,notifyRender:zt,getComponentName:()=>"Anonymous",logComponentMount:zt,logComponentRender:zt,logComponentUnmount:zt,logAtomSet:zt,logAtomUpdate:zt,logEventTrigger:zt,logCleanupEventTrigger:zt,logFetchRequest:zt,logFetchResponse:zt,logFetchError:zt,recordRender:zt};function Nt(t,e){Dt.registerComponent(t,e)}function Lt(t){return Dt.getComponentName(t)}function jt(t,e){Dt.logEventTrigger(t,e)}function Ut(t,e,n){Dt.recordRender(t,e,n)}function Ft(){return Dt.registerComponent!==zt}const Vt=Symbol.for("mates.readTracking");globalThis[Vt]||(globalThis[Vt]={enableReadTracking:!1,storesBeingRead:new Set,effectRunning:!1});const Wt=globalThis[Vt];function Bt(){return Wt.enableReadTracking}function Ht(){return Wt.effectRunning}function Yt(t){Wt.storesBeingRead.add(t)}function qt(){Wt.effectRunning=!0}function Xt(){Wt.effectRunning=!1}function Gt(){const t={prevEnabled:Wt.enableReadTracking,prevStores:Wt.storesBeingRead};return Wt.enableReadTracking=!0,Wt.storesBeingRead=new Set,t}function Zt(t){const e=Wt.storesBeingRead;return Wt.enableReadTracking=t.prevEnabled,Wt.storesBeingRead=t.prevStores,e}const Kt=Gt,Qt=Zt,Jt=Symbol.for("mates.componentRunningStatus");globalThis[Jt]||(globalThis[Jt]={setupInProgress:!1,templateInProgress:!1,viewOuterInProgress:!1,isHookRunning:!1});const te=globalThis[Jt];function ee(t){if(!te.isHookRunning){if(te.templateInProgress)throw new Error(`${t} cannot be created during template function execution. Only scopes (useScope) are allowed in templates.`);if(Ht())throw new Error(`${t} cannot be created inside a memo() or effect(). They should only read state, not create new reactive primitives.`)}}function ne(t){if(!te.viewOuterInProgress){if(te.templateInProgress)throw new Error(`${t} cannot be called during template function execution. Move it to the component's outer function.`);if(Ht())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).`)}}const se=new Set,ie={name:"matesLogEvent",__isEvent___:!0,trigger(t){se.forEach(e=>{try{e(t)}catch(t){}})},__subscribe:t=>(se.add(t),()=>se.delete(t))};function oe(t){try{return structuredClone(t)}catch(e){return t}}function re(){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")}function ae(t){try{ie.trigger(t)}catch(t){}}function le(t,e){ae({level:"error",message:t,data:void 0!==e?oe(e):void 0,ts:performance.now()}),re()&&(void 0!==e?console.error(`[${e}]`,t):console.error(t))}function ce(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 he(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 ue,de,fe;"function"==typeof SuppressedError&&SuppressedError;class pe{constructor(){ue.set(this,new Set),de.set(this,1)}subscribe(t){return ce(this,ue,"f").add(t),()=>ce(this,ue,"f").delete(t)}notify(){var t;he(this,de,(t=ce(this,de,"f"),++t),"f"),[...ce(this,ue,"f")].forEach(t=>{try{t?.()}catch(t){console.error(t)}})}getVersion(){return ce(this,de,"f")}get subscriberCount(){return ce(this,ue,"f").size}clear(){ce(this,ue,"f").clear()}}ue=new WeakMap,de=new WeakMap;class me{constructor(){fe.set(this,new Set)}subscribe(t){return ee("subscribe"),ce(this,fe,"f").has(t)?()=>{}:(ce(this,fe,"f").add(t),()=>ce(this,fe,"f").delete(t))}trigger(t){ce(this,fe,"f").forEach(e=>{try{e(t)}catch(t){console.error("Error in event handler:",t)}})}get handlerCount(){return ce(this,fe,"f").size}clear(){ce(this,fe,"f").clear()}}fe=new WeakMap;const _e=Symbol.for("mates.hostStack");globalThis[_e]||(globalThis[_e]=[]);const ge=globalThis[_e];function ye(t,e){ge.push(t);let n=null;try{n=e()}finally{ge.pop()}return n}function we(t){const e=ge[ge.length-1];if(!e){if(!1!==t)throw new Error("getCurrentHost(): No active host context");return null}return e}const ve=(t,e)=>{const n=we(!1);n&&n.addToCleanUps(t,e)},be=t=>{ee("event");const e=t||Math.random().toString(36).substring(2,15),n=new me;return{trigger:t=>{jt(e,t),n.trigger(t)},__subscribe:t=>n.subscribe(t),name:e,__isEvent___:!0}},xe=t=>{ee("cleanupEvent");const e=t||Math.random().toString(36).substring(2,15),n=new Map,s=()=>{n.forEach(t=>{if(t)try{t()}catch(t){le(t,"cleanupEvent cleanup")}})},i={trigger:t=>{!function(t,e){Dt.logCleanupEventTrigger(t,e)}(e,t),n.forEach((e,s)=>{if(e)try{e()}catch(t){le(t,"cleanupEvent cleanup")}try{const e=s(t);n.set(s,e)}catch(t){le(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){le(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};let Se=!1;function Ce(){return Se}let Ee=0,Ae=null,ke=null;function Me(){Se&&(Ee++,null!==ke&&(clearTimeout(ke),ke=null))}function $e(){Se&&(Ee=Math.max(0,Ee-1),function(){if(Ee>0)return;if(!Ae)return;if(null!==ke)return;ke=setTimeout(()=>{if(ke=null,0===Ee&&Ae){const t=Ae;Ae=null,t()}},5)}())}function Re(){return"undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("index.js",document.baseURI).href,"undefined"==typeof process||!process.env||"production"!==process.env.NODE_ENV}function Te(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 Oe=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||(Te(e),e._view=null,e._props={},e.oldView=void 0)}reset(){this.pending.clear(),this.isScheduled=!1}},Ie=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){le(t,"Effect")}}this._isFlushing=!1,this.isScheduled=!1,Pe.flush()}},Pe=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(()=>{Ie.isScheduled||Ie.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){le(t,"Component render")}this._currentWave.clear()}this._isFlushing=!1,this.isScheduled=!1,this.nextPendingComponents.size>0?(this.isScheduled=!0,queueMicrotask(()=>{Ie.isScheduled||Ie.isFlushing||this.flush()})):this._drainIdleCallbacks()}},ze=()=>{if(te.templateInProgress&&!te.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.")},De=()=>{},Ne=t=>{ze(),t.__isOnMount__=!0;const e=we();e.addToCleanUps(t,De);if("AsyncFunction"===t.constructor.name&&Ce())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)})},Le=(t,e=!0)=>{if(e&&ee("Setter"),te.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=we();e&&ze();const i=new Set;try{const t=(...t)=>{const e=n(...t);return[...i].forEach(t=>{try{Ie.schedule(()=>t?.())}catch(t){console.error(t)}}),s?.isConnected&&Pe.schedule(s),e};return t.__subscribe=t=>(ee("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")}},je=Le;function Ue(t,e=!0,n){if(Ht())return;const s=we(e);if(s&&t&&!s.cleanups.has(t)){const e=n||t.__subscribe||t.subscribe,i=e?.(()=>{Pe.schedule(s)});s.addToCleanUps(t,i)}}const Fe=(t,e)=>{t.__isOn__=!0,ee("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)},o=()=>Ie.schedule(i);e.forEach(t=>{n.add(t.__subscribe(o))});const r=()=>{if(n.forEach(t=>t()),s){try{s()}catch(t){console.error("Error in on() cleanup:",t)}s=void 0}};return ve(t,r),r};function Ve(){return Re()&&"undefined"!=typeof window&&!!window.__mates_hmr}function We(t){return!!t&&("AsyncFunction"===t.constructor?.name||t instanceof Promise||"object"==typeof t&&null!==t&&"then"in t||"function"==typeof t.then)}function Be(t){return"function"==typeof t?t():t}function He(t){return t.default||t}class Ye 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=te.templateInProgress;te.templateInProgress=!1,ye(this,()=>{this.DOMReadyEvent=xe("DOMReady"),this.PaintEvent=xe("Paint")}),te.templateInProgress=t,console.log("[x-x] constructor",this.name,"view:",typeof this._view,"parentElement:",!!this.parentElement,"id:",this.id),this._setup(),console.log("[x-x] constructor after _setup, _hasMounted:",this._hasMounted)}set props(t){this._props=t,Pe.schedule(this)}get props(){return this._props}_applyViewChange(t,e){this.oldView!==t&&(this.oldView=t,e(t),(this._hasMounted||this._errorState)&&Te(this))}set view(t){if(null!==t){if(We(t))return this._isViewLoading=!0,void Be(t).then(t=>{this._isViewLoading=!1,this.view=He(t)},t=>{this._isViewLoading=!1,this._handleRenderError(t)});"function"==typeof t&&(this.name=t.name||"Anonymous"),this._applyViewChange(t,()=>{this._view=t}),Pe.schedule(this)}}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}connectedCallback(){console.log("[x-x] connectedCallback",this.name,"depth:",this._depth,"_hasMounted:",this._hasMounted,"view:",typeof this._view),this.addEventListener("request-parent-scope",this._onRequestParentScope);let t=0,e=null,n=this.parentElement;for(;n;){if(n instanceof Ye){e=n,t=n._depth+1;break}n=n.parentElement}if(this._depth=t,this._parentComponent=e,Oe.cancelDisconnect(this),this._hasMounted)return console.log("[x-x] connectedCallback already mounted, re-render"),Ft()&&!this._view?.skipDevToolsRender&&Nt(this,this._view),void Pe.schedule(this);console.log("[x-x] connectedCallback first time, calling _setup"),Pe.schedule(this)}_setup(){this._hasMounted?console.log("[x-x] _setup already mounted, skip"):"function"==typeof this._view?(console.log("[x-x] _setup mounting component:",this.name),this._mountComponent(),console.log("[x-x] _setup done, _hasMounted:",this._hasMounted)):console.log("[x-x] _setup view not set yet (",typeof this._view,"), skip")}disconnectedCallback(){var t,e,n;this.removeEventListener("request-parent-scope",this._onRequestParentScope),Ft()&&(this._view?.__devtools__||this._view?.skipDevToolsRender||(n=Lt(this),Dt.logComponentUnmount(n)),this._view?.skipDevToolsRender||(t=this,e=this._view,Dt.unregisterComponent(t,e))),Oe.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._view?.__isErrorView__||this._isViewLoading||this._renderScheduled)&&this._view)if(this._renderVersion=Pe.flushVersion,this._hasMounted){if(this._xviewRender){this.callOnEachUpdate();let s=0;if(Ft()){const i=this._view?.__devtools__,o=this._view?.skipDevToolsRender,r=performance.now();this._xviewRender(),s=performance.now()-r,i||o||(Ut(Lt(this),this.componentId,s),e=Lt(this),n=s,Dt.logComponentRender(e,n)),o||(t=this,Dt.notifyRender(t))}else this._xviewRender()}}else this._mountComponent()}_mountComponent(){const t=this._view,e=function(t){if(!Ve())return t;const e=t?.__mates_hmr_id;if(!e)return t;const n=window.__mates_hmr?.components;return n?.[e]??t}(t);F(x``,this),te.viewOuterInProgress=!0;try{this._templateFn=ye(this,()=>e(this._propsFn))}catch(t){return te.viewOuterInProgress=!1,void this._handleRenderError(t)}if(te.viewOuterInProgress=!1,"function"==typeof this._templateFn){if(this._xviewRender=()=>{te.templateInProgress=!0;try{if(!this._templateFn)return;ye(this,()=>{const t=this._templateFn(this._propsFn);F(t,this)}),this.DOMReadyEvent?.trigger(),this.PaintEvent?.hasSubscribers&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&this.PaintEvent?.trigger()})})}catch(t){this._handleRenderError(t)}finally{te.templateInProgress=!1}},this.callOnEachUpdate(),Ft()){const t=e?.__devtools__,n=e?.skipDevToolsRender,s=performance.now();this._xviewRender();const i=performance.now()-s;t||n||Ut(e?.name||"Anonymous",this.componentId,i)}else this._xviewRender();this._view===t&&(this._hasMounted=!0,Ft()&&(e?.skipDevToolsRender||Nt(this,e),e?.__devtools__||e?.skipDevToolsRender||(n=e?.name||"Anonymous",Dt.logComponentMount(n))))}else this._handleRenderError(new Error("inner function must be a template function that returns html result"));var n}_hotRefresh(){Te(this),Pe.schedule(this)}_handleRenderError(t){this._errorState=t;for(const e of this._errorHandlers)try{e(t)}catch(t){}if(le(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=()=>()=>x`
75
75
  <div
76
76
  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"
77
77
  >
@@ -105,79 +105,79 @@ ${s}</pre
105
105
  ${t?is(t.component,t.props??{}):E}
106
106
  </div>
107
107
  </div>
108
- `}};function vs(...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 bs=()=>{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},xs=Nn(bs());let Ss=!1;Jn(()=>{const t=xs();Ss||hs()||(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 Cs=()=>{hs()||(Ss=!0,xs.set(bs()),Ss=!1)};"undefined"!=typeof window&&window.addEventListener("hashchange",Cs);const Es=()=>{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},As=Nn(Es());let ks=!1;Jn(()=>{const t=As();ks||hs()||(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 Ms=()=>{hs()||(ks=!0,As.set(Es()),ks=!1)};"undefined"!=typeof window&&window.addEventListener("popstate",Ms);const $s={get path(){return _s.get()},get hash(){return xs()},get qsObj(){return As()}};let Rs=null,Ts=null;function Os(){return Rs}function Is(){return Ts}class Ps{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 zs={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 Ds(t){return"string"==typeof t?{url:t}:t}function Ns(t){const{url:e="",host:n="",path:s,params:i={}}=t,o=e||s||"",r=/^https?:\/\//i.test(o)?o:`${n}${o}`,{pathParams:a,qsParams:l}=function(t,e){const n=new Set;for(const[,e]of t.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))n.add(e);const s={},i={};for(const[t,o]of Object.entries(e))n.has(t)?s[t]=o:i[t]=o;return{pathParams:s,qsParams:i}}(r,i),c=Object.keys(a).length>0?vs(r,a):r;if(0===Object.keys(l).length)return c;let h,u;if(/^https?:\/\//i.test(c)){const t=new URL(c);h=t.origin+t.pathname,u=t.search}else{const t=c.indexOf("?");h=-1===t?c:c.slice(0,t),u=-1===t?"":c.slice(t)}const d=new URLSearchParams(u);for(const[t,e]of Object.entries(l))null!=e&&(Array.isArray(e)?e.forEach(e=>d.append(t,String(e))):d.set(t,String(e)));const f=d.toString();return f?`${h}?${f}`:h}function Ls(t,e){return t.add(e),()=>t.delete(e)}const js=new Set,Us=new Set,Fs=new Set;class Vs{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 Ps,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:o,params:r,path:a,...l}=n,c=Ns(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=Os(),f=Is();if(Ce()&&d){let t;try{t=c.startsWith("http")?new URL(c).pathname:c.split("?")[0]}catch{t=c.split("?")[0]}if(t.startsWith("/api")){const n=d(u,t);if(n){Me();const t={"content-type":"application/json",...l.headers,...h.headers};if(f){const e=f.headers.get("cookie"),n=f.headers.get("authorization");e&&(t.cookie=e),n&&(t.authorization=n)}const 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=zs[t.status]||"UNKNOWN_ERROR";return e.reject(new Error(`${n}: ${t.statusText}`)),void $e()}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t),$e()}).catch(t=>{e.reject(t),$e()}),e}}}return(async()=>{let t,n=c,s={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(s.headers).length&&delete s.headers;for(const t of this.instanceBeforeFns){const e=await t(n,s);n=e.url,s=e.options}for(const t of js){const e=await t(n,s);n=e.url,s=e.options}try{t=await fetch(n,{...s,signal:e.signal})}catch(t){for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of Fs)try{e(t)}catch(t){}return void e.reject(t)}let i=t;for(const t of this.instanceAfterFns)i=await t(i);for(const t of Us)i=await t(i);if(!i.ok){const t=zs[i.status]||"UNKNOWN_ERROR",n=new Error(`${t}: ${i.statusText}`);for(const t of this.instanceErrorFns)try{t(n)}catch(t){}for(const t of Fs)try{t(n)}catch(t){}return void e.reject(n)}const o=i.headers.get("content-type");if(o?.includes("application/json")){const t=await i.json();if(t&&"object"==typeof t&&"Redirect"===t.__type&&"string"==typeof t.url){const n=t.url;return"undefined"!=typeof window&&(window.location.href=n),void e.resolve(void 0)}e.resolve(t)}else e.resolve(i)})().catch(t=>e.reject(t)),e}Fetch(t){return this.fetch(t)}Get(t){return this.fetch({...t,method:"GET"})}Post(t){return this.fetch({...t,method:"POST"})}Put(t){return this.fetch({...t,method:"PUT"})}Patch(t){return this.fetch({...t,method:"PATCH"})}Delete(t){return this.fetch({...t,method:"DELETE"})}fetchAction(t){const{baseRequest:e,options:n}=function(t){if(!t)return{baseRequest:{},options:{}};const{cacheDuration:e,cacheLimit:n,pollInterval:s,allowInRestrictedContext:i,...o}=t;return{baseRequest:o,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Bn(t=>this.fetch({...e,params:{...e.params,...t}}),n)}getAction(t){return this.fetchAction({...t,method:"GET"})}postAction(t){return this.fetchAction({...t,method:"POST"})}putAction(t){return this.fetchAction({...t,method:"PUT"})}patchAction(t){return this.fetchAction({...t,method:"PATCH"})}deleteAction(t){return this.fetchAction({...t,method:"DELETE"})}}const Ws=new Vs({});const Bs="mates-theme";function Hs(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}const Ys=function(){const t=Nn(function(){try{const t=localStorage.getItem(Bs);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=Hs(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>Hs(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),Jn(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",Hs(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(Bs):localStorage.setItem(Bs,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")}),e}();function qs(t){return t.startsWith("--")?t:`--${t}`}function Xs(t,e){let n="";for(const t in e){n+=` ${qs(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function Gs(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 Zs(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ks(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 Qs=new WeakMap,Js=new WeakMap,ti=new WeakMap,ei=new WeakMap;class ni{constructor(t){this.el=t}attr(t){const e=this.el;Qs.has(e)||Qs.set(e,new Map);const n=Qs.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=Gs(o);"set"===t.action?(n.get(i)!==t.value&&e.setAttribute(i,t.value),s.set(i,t.value)):n.has(i)&&e.removeAttribute(i)}for(const t of n.keys())s.has(t)||e.removeAttribute(t);return Qs.set(e,s),this}updateAttr(t){const e=this.el;Qs.has(e)||Qs.set(e,new Map);const n=Qs.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,o]of Object.entries(s))n.get(t)!==o&&e.setAttribute(t,o),i.set(t,o);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return Qs.set(e,i),this}style(t){const e=this.el;Js.has(e)||Js.set(e,new Map);const n=Js.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=Ks(o),r=Zs(i);null!==t?(n.get(r)!==t&&e.style.setProperty(r,t),s.set(r,t)):n.has(r)&&e.style.removeProperty(r)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return Js.set(e,s),this}classes(t){const e=this.el;ti.has(e)||ti.set(e,new Set);const n=ti.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 ti.set(e,s),this}addClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.add(n);return this}removeClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.remove(n);return this}toggleClass(t,e){const n=this.el;for(const s of t.split(/\s+/))s&&n.classList.toggle(s,e);return this}html(t){if(null==t)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return F(t,this.el),this}text(t){return this.el.textContent=String(t),this}focus(t){return this.el.focus(t),this}blur(){return this.el.blur(),this}scroll(t){const e=this.el;return"string"==typeof t?e.scrollTo({top:0,behavior:t}):t?e.scrollTo(t):e.scrollTo({top:0}),this}scrollIntoView(t){return this.el.scrollIntoView(t),this}measure(t){const e=this.el.getBoundingClientRect();return t({width:e.width,height:e.height,top:e.top,left:e.left,right:e.right,bottom:e.bottom,x:e.x,y:e.y}),this}on(t,e,n){const s=this.el;ei.has(s)||ei.set(s,new Map);const i=ei.get(s),o=i.get(t);o&&s.removeEventListener(t,o.handler,o.options);const r=e;return s.addEventListener(t,r,n),i.set(t,{handler:r,options:n}),this}off(t,e){const n=this.el,s=ei.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),ei.has(this.el)||ei.set(this.el,new Map),ei.get(this.el).set(`${t}:delegate:${e}`,{handler:i,options:s}),this}aria(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,String(s))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,i=n.startsWith("data-")?n:`data-${n}`;null==s?e.removeAttribute(i):e.setAttribute(i,String(s));const o=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[o]:e.dataset[o]=String(s)}return this}}function si(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 ni(e.value)}return new ni(t)}const ii=t=>{const e=ns(),n=t().condition,s=Nn(n),i=Nn(n);return Jn(()=>{const n=i();if(n===s.get())return;const o=e.value;if(!o)return void s.set(n);const r=t().config;Qn({el:o,exit:r?.exit??$n(200),enter:r?.enter??Mn(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Ne(()=>{const n=e.value;if(!n)return;const s=t().config;Kn(n,s?.enter??Mn(250))}),()=>{const n=s(),{condition:o,trueTpl:r,falseTpl:a}=t();return i.get()!==o&&i.set(o),x`
108
+ `}};function vs(...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 bs=()=>{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},xs=Nn(bs());let Ss=!1;Jn(()=>{const t=xs();Ss||hs()||(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 Cs=()=>{hs()||(Ss=!0,xs.set(bs()),Ss=!1)};"undefined"!=typeof window&&window.addEventListener("hashchange",Cs);const Es=()=>{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},As=Nn(Es());let ks=!1;Jn(()=>{const t=As();ks||hs()||(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 Ms=()=>{hs()||(ks=!0,As.set(Es()),ks=!1)};"undefined"!=typeof window&&window.addEventListener("popstate",Ms);const $s={get path(){return _s.get()},get hash(){return xs()},get qsObj(){return As()}};let Rs=null,Ts=null;function Os(){return Rs}function Is(){return Ts}class Ps{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 zs={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"};const Ds=Nn(0);function Ns(){Ds.set(Ds.val+1)}function Ls(){Ds.set(Math.max(0,Ds.val-1))}function js(t){return"string"==typeof t?{url:t}:t}function Us(t){const{url:e="",host:n="",path:s,params:i={}}=t,o=e||s||"",r=/^https?:\/\//i.test(o)?o:`${n}${o}`,{pathParams:a,qsParams:l}=function(t,e){const n=new Set;for(const[,e]of t.matchAll(/:([a-zA-Z_][a-zA-Z0-9_]*)/g))n.add(e);const s={},i={};for(const[t,o]of Object.entries(e))n.has(t)?s[t]=o:i[t]=o;return{pathParams:s,qsParams:i}}(r,i),c=Object.keys(a).length>0?vs(r,a):r;if(0===Object.keys(l).length)return c;let h,u;if(/^https?:\/\//i.test(c)){const t=new URL(c);h=t.origin+t.pathname,u=t.search}else{const t=c.indexOf("?");h=-1===t?c:c.slice(0,t),u=-1===t?"":c.slice(t)}const d=new URLSearchParams(u);for(const[t,e]of Object.entries(l))null!=e&&(Array.isArray(e)?e.forEach(e=>d.append(t,String(e))):d.set(t,String(e)));const f=d.toString();return f?`${h}?${f}`:h}function Fs(t,e){return t.add(e),()=>t.delete(e)}const Vs=new Set,Ws=new Set,Bs=new Set;class Hs{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 Ps,n={...this.baseRequest,...t,headers:{...this.baseRequest.headers,...t.headers},params:{...this.baseRequest.params,...t.params}},{body:s,url:i,host:o,params:r,path:a,...l}=n,c=Us(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=Os(),f=Is();if(Ce()&&d){let t;try{t=c.startsWith("http")?new URL(c).pathname:c.split("?")[0]}catch{t=c.split("?")[0]}if(t.startsWith("/api")){const n=d(u,t);if(n){Me();const t={"content-type":"application/json",...l.headers,...h.headers};if(f){const e=f.headers.get("cookie"),n=f.headers.get("authorization");e&&(t.cookie=e),n&&(t.authorization=n)}const 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=zs[t.status]||"UNKNOWN_ERROR";return e.reject(new Error(`${n}: ${t.statusText}`)),void $e()}const n=t.headers.get("content-type");n?.includes("application/json")?e.resolve(await t.json()):e.resolve(t),$e()}).catch(t=>{e.reject(t),$e()}),e}}}return(async()=>{let t,n=c,s={...l,method:u,...h,headers:{...l.headers,...h.headers}};0===Object.keys(s.headers).length&&delete s.headers,Ns();for(const t of this.instanceBeforeFns){const e=await t(n,s);n=e.url,s=e.options}for(const t of Vs){const e=await t(n,s);n=e.url,s=e.options}try{t=await fetch(n,{...s,signal:e.signal})}catch(t){for(const e of this.instanceErrorFns)try{e(t)}catch(t){}for(const e of Bs)try{e(t)}catch(t){}return Ls(),void e.reject(t)}let i=t;for(const t of this.instanceAfterFns)i=await t(i);for(const t of Ws)i=await t(i);if(Ls(),!i.ok){const t=zs[i.status]||"UNKNOWN_ERROR",n=new Error(`${t}: ${i.statusText}`);for(const t of this.instanceErrorFns)try{t(n)}catch(t){}for(const t of Bs)try{t(n)}catch(t){}return Ls(),void e.reject(n)}const o=i.headers.get("content-type");if(o?.includes("application/json")){const t=await i.json();if(t&&"object"==typeof t&&"Redirect"===t.__type&&"string"==typeof t.url){const n=t.url;return"undefined"!=typeof window&&(window.location.href=n),void e.resolve(void 0)}e.resolve(t)}else e.resolve(i)})().catch(t=>e.reject(t)),e}Fetch(t){return this.fetch(t)}Get(t){return this.fetch({...t,method:"GET"})}Post(t){return this.fetch({...t,method:"POST"})}Put(t){return this.fetch({...t,method:"PUT"})}Patch(t){return this.fetch({...t,method:"PATCH"})}Delete(t){return this.fetch({...t,method:"DELETE"})}fetchAction(t){const{baseRequest:e,options:n}=function(t){if(!t)return{baseRequest:{},options:{}};const{cacheDuration:e,cacheLimit:n,pollInterval:s,allowInRestrictedContext:i,...o}=t;return{baseRequest:o,options:{...void 0!==e&&{cacheDuration:e},...void 0!==n&&{cacheLimit:n},...void 0!==s&&{pollInterval:s},...void 0!==i&&{allowInRestrictedContext:i}}}}(t);return Bn(t=>this.fetch({...e,params:{...e.params,...t}}),n)}getAction(t){return this.fetchAction({...t,method:"GET"})}postAction(t){return this.fetchAction({...t,method:"POST"})}putAction(t){return this.fetchAction({...t,method:"PUT"})}patchAction(t){return this.fetchAction({...t,method:"PATCH"})}deleteAction(t){return this.fetchAction({...t,method:"DELETE"})}}const Ys=new Hs({});const qs="mates-theme";function Xs(t){return"auto"===t?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}():t}const Gs=function(){const t=Nn(function(){try{const t=localStorage.getItem(qs);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=Xs(t.get());t.set("dark"===e?"light":"dark")},Object.defineProperty(e,"resolved",{get:()=>Xs(t.get()),enumerable:!1,configurable:!0}),Object.defineProperty(e,"name",{value:"themeAtom",writable:!0,configurable:!0,enumerable:!1}),Jn(()=>{const e=t.get();!function(t){try{document.documentElement.setAttribute("data-theme",Xs(t))}catch{}}(e),function(t){try{"auto"===t?localStorage.removeItem(qs):localStorage.setItem(qs,t)}catch{}}(e)}),"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{"auto"===t.get()&&t.set("auto")}),e}();function Zs(t){return t.startsWith("--")?t:`--${t}`}function Ks(t,e){let n="";for(const t in e){n+=` ${Zs(t)}: ${e[t]};\n`}return n?`${t} {\n${n}}`:""}function Qs(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 Js(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ti(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 ei=new WeakMap,ni=new WeakMap,si=new WeakMap,ii=new WeakMap;class oi{constructor(t){this.el=t}attr(t){const e=this.el;ei.has(e)||ei.set(e,new Map);const n=ei.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=Qs(o);"set"===t.action?(n.get(i)!==t.value&&e.setAttribute(i,t.value),s.set(i,t.value)):n.has(i)&&e.removeAttribute(i)}for(const t of n.keys())s.has(t)||e.removeAttribute(t);return ei.set(e,s),this}updateAttr(t){const e=this.el;ei.has(e)||ei.set(e,new Map);const n=ei.get(e),s=Object.fromEntries(n);t(s);const i=new Map;for(const[t,o]of Object.entries(s))n.get(t)!==o&&e.setAttribute(t,o),i.set(t,o);for(const t of n.keys())i.has(t)||e.removeAttribute(t);return ei.set(e,i),this}style(t){const e=this.el;ni.has(e)||ni.set(e,new Map);const n=ni.get(e),s=new Map;for(const[i,o]of Object.entries(t)){const t=ti(o),r=Js(i);null!==t?(n.get(r)!==t&&e.style.setProperty(r,t),s.set(r,t)):n.has(r)&&e.style.removeProperty(r)}for(const t of n.keys())s.has(t)||e.style.removeProperty(t);return ni.set(e,s),this}classes(t){const e=this.el;si.has(e)||si.set(e,new Set);const n=si.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 si.set(e,s),this}addClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.add(n);return this}removeClass(t){const e=this.el;for(const n of t.split(/\s+/))n&&e.classList.remove(n);return this}toggleClass(t,e){const n=this.el;for(const s of t.split(/\s+/))s&&n.classList.toggle(s,e);return this}html(t){if(null==t)throw new Error("$(el).html() — the factory function must return a lit-html TemplateResult (e.g. () => html`<span>${value}</span>`).");return F(t,this.el),this}text(t){return this.el.textContent=String(t),this}focus(t){return this.el.focus(t),this}blur(){return this.el.blur(),this}scroll(t){const e=this.el;return"string"==typeof t?e.scrollTo({top:0,behavior:t}):t?e.scrollTo(t):e.scrollTo({top:0}),this}scrollIntoView(t){return this.el.scrollIntoView(t),this}measure(t){const e=this.el.getBoundingClientRect();return t({width:e.width,height:e.height,top:e.top,left:e.left,right:e.right,bottom:e.bottom,x:e.x,y:e.y}),this}on(t,e,n){const s=this.el;ii.has(s)||ii.set(s,new Map);const i=ii.get(s),o=i.get(t);o&&s.removeEventListener(t,o.handler,o.options);const r=e;return s.addEventListener(t,r,n),i.set(t,{handler:r,options:n}),this}off(t,e){const n=this.el,s=ii.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),ii.has(this.el)||ii.set(this.el,new Map),ii.get(this.el).set(`${t}:delegate:${e}`,{handler:i,options:s}),this}aria(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("aria-")?n:`aria-${n}`;null==s||!1===s?e.removeAttribute(t):e.setAttribute(t,String(s))}return this}getAttr(t){return this.el.getAttribute(t)}data(t){const e=this.el;for(const[n,s]of Object.entries(t)){const t=n.startsWith("data-")?n.slice(5):n,i=n.startsWith("data-")?n:`data-${n}`;null==s?e.removeAttribute(i):e.setAttribute(i,String(s));const o=t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());null==s?delete e.dataset[o]:e.dataset[o]=String(s)}return this}}function ri(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 oi(e.value)}return new oi(t)}const ai=t=>{const e=ns(),n=t().condition,s=Nn(n),i=Nn(n);return Jn(()=>{const n=i();if(n===s.get())return;const o=e.value;if(!o)return void s.set(n);const r=t().config;Qn({el:o,exit:r?.exit??$n(200),enter:r?.enter??Mn(250),swap:()=>s.set(n),getEl:()=>e.value,isStale:()=>i.get()!==n})}),Ne(()=>{const n=e.value;if(!n)return;const s=t().config;Kn(n,s?.enter??Mn(250))}),()=>{const n=s(),{condition:o,trueTpl:r,falseTpl:a}=t();return i.get()!==o&&i.set(o),x`
109
109
  <div ${ss(e)} style="position:relative">
110
110
  ${n?r:a}
111
111
  </div>
112
- `}};function oi(t,e,n=E,s){return is(ii,{condition:t,trueTpl:e,falseTpl:n,config:s})}function ri(t){const e=te.isHookRunning;te.isHookRunning=!0;try{return t()}finally{te.isHookRunning=e}}function ai(t){var e,n,s,i,o;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,o=new WeakMap;const r=q(class extends dt{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,null),i.set(this,!1),o.set(this,null),t.type!==Y)throw new Error("eleHook() must be used as an element expression, e.g. html`<div ${myHook()}>`")}update(r,a){const l=r.element;if(!ce(this,i,"f")||l.isConnected){if(!ce(this,n,"f")){he(this,s,l,"f"),he(this,i,!1,"f");const r=si(ce(this,s,"f")),c=ri(()=>t(r,...a));return he(this,e,c??null,"f"),he(this,n,!0,"f"),void he(this,o,a,"f")}ce(this,e,"f")?.onUpdate&&ri(()=>ce(this,e,"f").onUpdate(...a)),he(this,o,a,"f")}else console.log("[eleHook] UPDATE SKIPPED — disconnected & host detached, el:",l)}render(...t){}disconnected(){he(this,i,!0,"f"),console.log("[eleHook] DISCONNECTED — el:",ce(this,s,"f"),"mounted:",ce(this,n,"f"),"hasCleanup:",!!ce(this,e,"f")?.onCleanup),ce(this,e,"f")?.onCleanup&&ce(this,e,"f").onCleanup(),he(this,e,null,"f"),he(this,n,!1,"f")}reconnected(){if(console.log("[eleHook] RECONNECTED — el:",ce(this,s,"f"),"was disconnected:",ce(this,i,"f"),"will re-mount:",!(!ce(this,i,"f")||ce(this,n,"f")||!ce(this,s,"f")||!ce(this,o,"f"))),he(this,i,!1,"f"),!ce(this,n,"f")&&ce(this,s,"f")&&ce(this,o,"f")){const i=si(ce(this,s,"f")),r=ri(()=>t(i,...ce(this,o,"f")));he(this,e,r??null,"f"),he(this,n,!0,"f"),console.log("[eleHook] RE-MOUNTED after reconnect — el:",ce(this,s,"f"))}}});return(...t)=>r(...t)}const li=ai((t,e)=>(t.attr(e),{onUpdate(e){t.attr(e)},onCleanup(){t.attr({})}}));const ci=ai((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,o=t?s:i;o&&e.add(o)}}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}}});const hi=ai((t,e,n)=>{const s=t.el;let i=n;const o=t=>{const e=t;i(e.detail,e)};return s.addEventListener(e,o),{onUpdate(t,e){i=e},onCleanup(){s.removeEventListener(e,o)}}});function ui(t,e){if(e<=0)return{start(){t()},pause(){},resume(){},stop(){},get state(){return"stopped"},get remaining(){return 0}};let n="idle",s=e,i=0,o=null;function r(){null!==o&&(clearTimeout(o),o=null)}function a(){const t=performance.now()-i;return Math.max(0,s-t)}function l(){r(),o=setTimeout(()=>{o=null,n="stopped",s=0,t()},s)}return{start(){"running"!==n&&(s=e,i=performance.now(),n="running",l())},pause(){"running"===n&&(s=a(),r(),n="paused")},resume(){if("paused"===n){if(s<=0)return n="stopped",s=0,void t();i=performance.now(),n="running",l()}},stop(){r(),n="stopped",s=e},get state(){return n},get remaining(){return"running"===n?a():s}}}const di=ai((t,e)=>{const n=t.el;let s=ui(()=>{n.remove()},e);return s.start(),{onUpdate(t){t!==e&&(e=t,s.stop(),s=ui(()=>{n.remove()},e),s.start())},onCleanup(){s.stop()}}});function fi(t){const e=te.isHookRunning;te.isHookRunning=!0;try{return t()}finally{te.isHookRunning=e}}function pi(t){var e,n,s,i,o,r;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap;const a=q(class extends dt{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,!1),i.set(this,!1),o.set(this,null),r.set(this,t=>{ce(this,i,"f")?he(this,o,t,"f"):this.setValue(t)}),t.type!==W)throw new Error("htmlHook() must be used as a child expression, e.g. html`<div>${myHook()}</div>`")}update(a,l){if(!ce(this,s,"f")||this.isConnected){if(he(this,i,!0,"f"),he(this,o,null,"f"),ce(this,n,"f"))ce(this,e,"f")?.onUpdate&&fi(()=>ce(this,e,"f").onUpdate(...l));else{const s=fi(()=>t(ce(this,r,"f"),...l));he(this,e,s??null,"f"),he(this,n,!0,"f")}if(he(this,i,!1,"f"),null!==ce(this,o,"f")){const t=ce(this,o,"f");return he(this,o,null,"f"),t}}else console.log("[htmlHook] UPDATE SKIPPED — disconnected & part detached")}render(...t){}disconnected(){he(this,s,!0,"f"),ce(this,e,"f")?.onCleanup&&ce(this,e,"f").onCleanup(),he(this,n,!1,"f"),he(this,e,null,"f")}reconnected(){ce(this,s,"f")&&(he(this,s,!1,"f"),he(this,n,!1,"f"),he(this,e,null,"f"))}});return(...t)=>a(...t)}const mi=ai((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 _i=ai((t,e,n)=>{let s=e,i=!1,o=!0;const r=new IntersectionObserver(t=>{for(const e of t){const t=e.isIntersecting;if(o)return o=!1,void(i=t);t&&!i&&s(),i=t}},{rootMargin:n?.rootMargin??"0px",threshold:n?.threshold??0});return r.observe(t.el),{onUpdate(t,e){s=t},onCleanup(){r.disconnect(),i=!1,o=!0}}});const gi=ai((t,e)=>{e(t.el)}),yi=ai((t,e)=>{let n=e;return{onUpdate(t){n=t},onCleanup(){n(t.el)}}});ai((t,e)=>({onUpdate(e){e(t.el)}}));const wi=pi((t,e,n,s,i)=>{function o(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n??{}}:{keyFn:null,template:t,opts:e??{}}}function r(t,e,n,s){const i=s.columns??3,o=s.gap??12,r=s.containerClass??"",a=[`column-count:${i}`,`column-gap:${o}px`,s.containerStyle??""].filter(Boolean).join(";"),l=["break-inside:avoid",`margin-bottom:${o}px`,"display:inline-block","width:100%","box-sizing:border-box"].join(";"),c=t,h=At(c,e||((t,e)=>e),(t,e)=>x`
112
+ `}};function li(t,e,n=E,s){return is(ai,{condition:t,trueTpl:e,falseTpl:n,config:s})}function ci(t){const e=te.isHookRunning;te.isHookRunning=!0;try{return t()}finally{te.isHookRunning=e}}function hi(t){var e,n,s,i,o;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,o=new WeakMap;const r=q(class extends dt{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,null),i.set(this,!1),o.set(this,null),t.type!==Y)throw new Error("eleHook() must be used as an element expression, e.g. html`<div ${myHook()}>`")}update(r,a){const l=r.element;if(!ce(this,i,"f")||l.isConnected){if(!ce(this,n,"f")){he(this,s,l,"f"),he(this,i,!1,"f");const r=ri(ce(this,s,"f")),c=ci(()=>t(r,...a));return he(this,e,c??null,"f"),he(this,n,!0,"f"),void he(this,o,a,"f")}ce(this,e,"f")?.onUpdate&&ci(()=>ce(this,e,"f").onUpdate(...a)),he(this,o,a,"f")}else console.log("[eleHook] UPDATE SKIPPED — disconnected & host detached, el:",l)}render(...t){}disconnected(){he(this,i,!0,"f"),console.log("[eleHook] DISCONNECTED — el:",ce(this,s,"f"),"mounted:",ce(this,n,"f"),"hasCleanup:",!!ce(this,e,"f")?.onCleanup),ce(this,e,"f")?.onCleanup&&ce(this,e,"f").onCleanup(),he(this,e,null,"f"),he(this,n,!1,"f")}reconnected(){if(console.log("[eleHook] RECONNECTED — el:",ce(this,s,"f"),"was disconnected:",ce(this,i,"f"),"will re-mount:",!(!ce(this,i,"f")||ce(this,n,"f")||!ce(this,s,"f")||!ce(this,o,"f"))),he(this,i,!1,"f"),!ce(this,n,"f")&&ce(this,s,"f")&&ce(this,o,"f")){const i=ri(ce(this,s,"f")),r=ci(()=>t(i,...ce(this,o,"f")));he(this,e,r??null,"f"),he(this,n,!0,"f"),console.log("[eleHook] RE-MOUNTED after reconnect — el:",ce(this,s,"f"))}}});return(...t)=>r(...t)}const ui=hi((t,e)=>(t.attr(e),{onUpdate(e){t.attr(e)},onCleanup(){t.attr({})}}));const di=hi((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,o=t?s:i;o&&e.add(o)}}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}}});const fi=hi((t,e,n)=>{const s=t.el;let i=n;const o=t=>{const e=t;i(e.detail,e)};return s.addEventListener(e,o),{onUpdate(t,e){i=e},onCleanup(){s.removeEventListener(e,o)}}});function pi(t,e){if(e<=0)return{start(){t()},pause(){},resume(){},stop(){},get state(){return"stopped"},get remaining(){return 0}};let n="idle",s=e,i=0,o=null;function r(){null!==o&&(clearTimeout(o),o=null)}function a(){const t=performance.now()-i;return Math.max(0,s-t)}function l(){r(),o=setTimeout(()=>{o=null,n="stopped",s=0,t()},s)}return{start(){"running"!==n&&(s=e,i=performance.now(),n="running",l())},pause(){"running"===n&&(s=a(),r(),n="paused")},resume(){if("paused"===n){if(s<=0)return n="stopped",s=0,void t();i=performance.now(),n="running",l()}},stop(){r(),n="stopped",s=e},get state(){return n},get remaining(){return"running"===n?a():s}}}const mi=hi((t,e)=>{const n=t.el;let s=pi(()=>{n.remove()},e);return s.start(),{onUpdate(t){t!==e&&(e=t,s.stop(),s=pi(()=>{n.remove()},e),s.start())},onCleanup(){s.stop()}}});function _i(t){const e=te.isHookRunning;te.isHookRunning=!0;try{return t()}finally{te.isHookRunning=e}}function gi(t){var e,n,s,i,o,r;e=new WeakMap,n=new WeakMap,s=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap;const a=q(class extends dt{constructor(t){if(super(t),e.set(this,null),n.set(this,!1),s.set(this,!1),i.set(this,!1),o.set(this,null),r.set(this,t=>{ce(this,i,"f")?he(this,o,t,"f"):this.setValue(t)}),t.type!==W)throw new Error("htmlHook() must be used as a child expression, e.g. html`<div>${myHook()}</div>`")}update(a,l){if(!ce(this,s,"f")||this.isConnected){if(he(this,i,!0,"f"),he(this,o,null,"f"),ce(this,n,"f"))ce(this,e,"f")?.onUpdate&&_i(()=>ce(this,e,"f").onUpdate(...l));else{const s=_i(()=>t(ce(this,r,"f"),...l));he(this,e,s??null,"f"),he(this,n,!0,"f")}if(he(this,i,!1,"f"),null!==ce(this,o,"f")){const t=ce(this,o,"f");return he(this,o,null,"f"),t}}else console.log("[htmlHook] UPDATE SKIPPED — disconnected & part detached")}render(...t){}disconnected(){he(this,s,!0,"f"),ce(this,e,"f")?.onCleanup&&ce(this,e,"f").onCleanup(),he(this,n,!1,"f"),he(this,e,null,"f")}reconnected(){ce(this,s,"f")&&(he(this,s,!1,"f"),he(this,n,!1,"f"),he(this,e,null,"f"))}});return(...t)=>a(...t)}const yi=hi((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 wi=hi((t,e,n)=>{let s=e,i=!1,o=!0;const r=new IntersectionObserver(t=>{for(const e of t){const t=e.isIntersecting;if(o)return o=!1,void(i=t);t&&!i&&s(),i=t}},{rootMargin:n?.rootMargin??"0px",threshold:n?.threshold??0});return r.observe(t.el),{onUpdate(t,e){s=t},onCleanup(){r.disconnect(),i=!1,o=!0}}});const vi=hi((t,e)=>{e(t.el)}),bi=hi((t,e)=>{let n=e;return{onUpdate(t){n=t},onCleanup(){n(t.el)}}});hi((t,e)=>({onUpdate(e){e(t.el)}}));const xi=gi((t,e,n,s,i)=>{function o(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n??{}}:{keyFn:null,template:t,opts:e??{}}}function r(t,e,n,s){const i=s.columns??3,o=s.gap??12,r=s.containerClass??"",a=[`column-count:${i}`,`column-gap:${o}px`,s.containerStyle??""].filter(Boolean).join(";"),l=["break-inside:avoid",`margin-bottom:${o}px`,"display:inline-block","width:100%","box-sizing:border-box"].join(";"),c=t,h=At(c,e||((t,e)=>e),(t,e)=>x`
113
113
  <div style="${l}">${n(t,e)}</div>
114
114
  `);return x`
115
115
  <div class="${r}" style="${a}">
116
116
  ${h}
117
117
  </div>
118
- `}const{keyFn:a,template:l,opts:c}=o(n,s,i);return t(r(e,a,l,c)),{onUpdate(e,n,s,i){const{keyFn:a,template:l,opts:c}=o(n,s,i);t(r(e,a,l,c))}}});var vi,bi;vi=new WeakMap,bi=new WeakMap;const xi=q(class extends dt{constructor(t){if(super(t),vi.set(this,null),bi.set(this,null),t.type!==W)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!==ce(this,vi,"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}(ce(this,vi,"f"),e)||(he(this,bi,n(),"f"),he(this,vi,e.slice(),"f")),ce(this,bi,"f")}render(t,e){return e()}disconnected(){}reconnected(){}});function Si(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 Ci(t){t.cleanup()}function Ei(t){for(const e of t.values())e.cleanup();t.clear()}function Ai(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 ki="__viewport__",Mi=new WeakMap;function $i(t,e,n){const s=new Set;let i,o,r=!1;for(const[a,l]of Object.entries(e)){if(!l)continue;const e="enterViewport"===a||"exitViewport"===a||"clickOutside"===a?a:a.toLowerCase();if("enterViewport"===e){i=l,r=!0;continue}if("exitViewport"===e){o=l,r=!0;continue}s.add(e);const c=n.get(e);c?c.handler!==l&&(c.handlerRef&&(c.handlerRef.current=l),c.handler=l):n.set(e,"clickOutside"===e?Ai(t,l):Si(t,e,l))}if(r){s.add(ki);const e=n.get(ki);if(e){const t=e;t.enterRef&&(t.enterRef.current=i),t.exitRef&&(t.exitRef.current=o)}else n.set(ki,function(t,e,n){const s={current:e},i={current:n},o=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?s.current?.(e):i.current?.(e)},{threshold:0});return o.observe(t),{handler:e??n??(()=>{}),cleanup:()=>o.disconnect(),enterRef:s,exitRef:i}}(t,i,o))}for(const[t,e]of n)s.has(t)||(Ci(e),n.delete(t))}const Ri=ai((t,e)=>{const n=new Map,s=t.el;$i(s,e,n);const i=()=>{Ei(n),Mi.delete(s)};return Mi.set(s,i),{onUpdate(t){$i(s,t,n)},onCleanup(){i()}}});const Ti=ai((t,e,n)=>{const s=new Map;let i=null,o=n;const r=(t,e)=>{t!==i&&(Ei(s),i=t),function(t,e,n){const s=new Set;for(const[i,o]of Object.entries(e)){if(!o)continue;s.add(i);const e=n.get(i);e?e.handler!==o&&(e.handlerRef&&(e.handlerRef.current=o),e.handler=o):n.set(i,Si(t,i,o))}for(const[t,e]of n)s.has(t)||(Ci(e),n.delete(t))}(t,e,s)},a=()=>{Ei(s),i=null},l=e.__subscribe(t=>{t?r(t,o):a()});return e.value&&r(e.value,n),{onUpdate(t,n){o=n,e.value&&r(e.value,n)},onCleanup(){a(),l()}}});const Oi=ai((t,e)=>(t.style(e),{onUpdate(e){t.style(e)}}));const Ii=pi((t,e,n)=>{if(n<16)throw new Error(`timerTemplate() ms must be at least 16ms (one frame at 60fps), got ${n}`);let s=e,i=n,o=null;const r=()=>t(s()),a=()=>{o=setInterval(r,i)};return r(),a(),{onUpdate(t,e){s=t,e!==i&&(i=e,null!==o&&(clearInterval(o),o=null),a())},onCleanup(){null!==o&&(clearInterval(o),o=null)}}});
118
+ `}const{keyFn:a,template:l,opts:c}=o(n,s,i);return t(r(e,a,l,c)),{onUpdate(e,n,s,i){const{keyFn:a,template:l,opts:c}=o(n,s,i);t(r(e,a,l,c))}}});var Si,Ci;Si=new WeakMap,Ci=new WeakMap;const Ei=q(class extends dt{constructor(t){if(super(t),Si.set(this,null),Ci.set(this,null),t.type!==W)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!==ce(this,Si,"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}(ce(this,Si,"f"),e)||(he(this,Ci,n(),"f"),he(this,Si,e.slice(),"f")),ce(this,Ci,"f")}render(t,e){return e()}disconnected(){}reconnected(){}});function Ai(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 ki(t){t.cleanup()}function Mi(t){for(const e of t.values())e.cleanup();t.clear()}function $i(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 Ri="__viewport__",Ti=new WeakMap;function Oi(t,e,n){const s=new Set;let i,o,r=!1;for(const[a,l]of Object.entries(e)){if(!l)continue;const e="enterViewport"===a||"exitViewport"===a||"clickOutside"===a?a:a.toLowerCase();if("enterViewport"===e){i=l,r=!0;continue}if("exitViewport"===e){o=l,r=!0;continue}s.add(e);const c=n.get(e);c?c.handler!==l&&(c.handlerRef&&(c.handlerRef.current=l),c.handler=l):n.set(e,"clickOutside"===e?$i(t,l):Ai(t,e,l))}if(r){s.add(Ri);const e=n.get(Ri);if(e){const t=e;t.enterRef&&(t.enterRef.current=i),t.exitRef&&(t.exitRef.current=o)}else n.set(Ri,function(t,e,n){const s={current:e},i={current:n},o=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?s.current?.(e):i.current?.(e)},{threshold:0});return o.observe(t),{handler:e??n??(()=>{}),cleanup:()=>o.disconnect(),enterRef:s,exitRef:i}}(t,i,o))}for(const[t,e]of n)s.has(t)||(ki(e),n.delete(t))}const Ii=hi((t,e)=>{const n=new Map,s=t.el;Oi(s,e,n);const i=()=>{Mi(n),Ti.delete(s)};return Ti.set(s,i),{onUpdate(t){Oi(s,t,n)},onCleanup(){i()}}});const Pi=hi((t,e,n)=>{const s=new Map;let i=null,o=n;const r=(t,e)=>{t!==i&&(Mi(s),i=t),function(t,e,n){const s=new Set;for(const[i,o]of Object.entries(e)){if(!o)continue;s.add(i);const e=n.get(i);e?e.handler!==o&&(e.handlerRef&&(e.handlerRef.current=o),e.handler=o):n.set(i,Ai(t,i,o))}for(const[t,e]of n)s.has(t)||(ki(e),n.delete(t))}(t,e,s)},a=()=>{Mi(s),i=null},l=e.__subscribe(t=>{t?r(t,o):a()});return e.value&&r(e.value,n),{onUpdate(t,n){o=n,e.value&&r(e.value,n)},onCleanup(){a(),l()}}});const zi=hi((t,e)=>(t.style(e),{onUpdate(e){t.style(e)}}));const Di=gi((t,e,n)=>{if(n<16)throw new Error(`timerTemplate() ms must be at least 16ms (one frame at 60fps), got ${n}`);let s=e,i=n,o=null;const r=()=>t(s()),a=()=>{o=setInterval(r,i)};return r(),a(),{onUpdate(t,e){s=t,e!==i&&(i=e,null!==o&&(clearInterval(o),o=null),a())},onCleanup(){null!==o&&(clearInterval(o),o=null)}}});
119
119
  /**
120
120
  * @license
121
121
  * Copyright 2021 Google LLC
122
122
  * SPDX-License-Identifier: BSD-3-Clause
123
123
  */
124
- function Pi(t){return"horizontal"===t?"width":"height"}class zi{_updateOverhang(){this._overhang=Math.max(200,2*this._viewDim1)}_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(),this._updateOverhang()}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[Pi(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())}}
124
+ function Ni(t){return"horizontal"===t?"width":"height"}class Li{_updateOverhang(){this._overhang=Math.max(200,2*this._viewDim1)}_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(),this._updateOverhang()}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[Ni(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())}}
125
125
  /**
126
126
  * @license
127
127
  * Copyright 2021 Google LLC
128
128
  * SPDX-License-Identifier: BSD-3-Clause
129
- */class Di{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}}
129
+ */class ji{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}}
130
130
  /**
131
131
  * @license
132
132
  * Copyright 2021 Google LLC
133
133
  * SPDX-License-Identifier: BSD-3-Clause
134
- */const Ni=t=>Object.assign({type:Wi},t);function Li(t){return"horizontal"===t?"marginLeft":"marginTop"}function ji(t){return"horizontal"===t?"marginRight":"marginBottom"}function Ui(t){return"horizontal"===t?"xOffset":"yOffset"}function Fi(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 Vi{constructor(){this._childSizeCache=new Di,this._marginSizeCache=new Di,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][Pi(e)]),n.add(i),n.add(i+1)});for(const t of n){const n=this._metricsCache.get(t)?.[Li(e)]||0,s=this._metricsCache.get(t-1)?.[ji(e)]||0;this._marginSizeCache.set(t,Fi(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)?.[Li(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 Wi extends zi{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new Vi,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 o=this._firstVisible-1,r=-1/0;for(;r<t;){r=this._getPhysicalItem(++o).pos+this._metricsCache.getChildSize(o)}return o}_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,o=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-o-s);let r=0;for(this._anchorPos+s+o<e&&(r=e-(this._anchorPos+s+o)),this._anchorPos-i>n&&(r=n-(this._anchorPos-i)),r&&(this._scrollPosition-=r,e-=r,n-=r,this._scrollError+=r),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+o;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,[Ui(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 Bi=Object.freeze({__proto__:null,FlowLayout:Wi,flow:Ni});
134
+ */const Ui=t=>Object.assign({type:Yi},t);function Fi(t){return"horizontal"===t?"marginLeft":"marginTop"}function Vi(t){return"horizontal"===t?"marginRight":"marginBottom"}function Wi(t){return"horizontal"===t?"xOffset":"yOffset"}function Bi(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 Hi{constructor(){this._childSizeCache=new ji,this._marginSizeCache=new ji,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][Ni(e)]),n.add(i),n.add(i+1)});for(const t of n){const n=this._metricsCache.get(t)?.[Fi(e)]||0,s=this._metricsCache.get(t-1)?.[Vi(e)]||0;this._marginSizeCache.set(t,Bi(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)?.[Fi(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 Yi extends Li{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new Hi,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 o=this._firstVisible-1,r=-1/0;for(;r<t;){r=this._getPhysicalItem(++o).pos+this._metricsCache.getChildSize(o)}return o}_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,o=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-o-s);let r=0;for(this._anchorPos+s+o<e&&(r=e-(this._anchorPos+s+o)),this._anchorPos-i>n&&(r=n-(this._anchorPos-i)),r&&(this._scrollPosition-=r,e-=r,n-=r,this._scrollError+=r),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+o;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,[Wi(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 qi=Object.freeze({__proto__:null,FlowLayout:Yi,flow:Ui});
135
135
  /**
136
136
  * @license
137
137
  * Copyright 2021 Google LLC
138
138
  * SPDX-License-Identifier: BSD-3-Clause
139
- */function Hi(t){return"horizontal"===t?"row":"column"}class Yi extends zi{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[Pi(this.direction)]}get _idealSize1(){return this._itemSize[Pi(this.direction)]}get _idealSize2(){return this._itemSize[(t=this.direction,"horizontal"===t?"height":"width")];var t}get _gap1(){return this._gaps[(t=this.direction,"horizontal"===t?"column":"row")];var t}get _gap2(){return this._gaps[Hi(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())}}
139
+ */function Xi(t){return"horizontal"===t?"row":"column"}class Gi extends Li{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[Ni(this.direction)]}get _idealSize1(){return this._itemSize[Ni(this.direction)]}get _idealSize2(){return this._itemSize[(t=this.direction,"horizontal"===t?"height":"width")];var t}get _gap1(){return this._gaps[(t=this.direction,"horizontal"===t?"column":"row")];var t}get _gap2(){return this._gaps[Xi(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())}}
140
140
  /**
141
141
  * @license
142
142
  * Copyright 2021 Google LLC
143
143
  * SPDX-License-Identifier: BSD-3-Clause
144
- */class qi extends Yi{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: ${Hi(this.direction)}-gap cannot be set to 'auto' when direction is set to ${this.direction}`)});const o=this.flex||["start","center","end"].includes(t),r={rolumns:-1,itemSize1:-1,itemSize2:-1,gap1:this._gap1===1/0?-1:this._gap1,gap2:o?this._gap2:0,padding1:{start:e===1/0?this._gap1:e,end:n===1/0?this._gap1:n},padding2:o?{start:s===1/0?this._gap2:s,end:i===1/0?this._gap2:i}:{start:0,end:0},positions:[]},a=this._viewDim2-r.padding2.start-r.padding2.end;if(a<=0)r.rolumns=0;else{const s=o?r.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),r.rolumns=l,r.itemSize2=Math.round((a-s*(l-1))/l);switch(!0===this.flex?"area":this.flex.preserve){case"aspect-ratio":r.itemSize1=Math.round(this._idealSize1/this._idealSize2*r.itemSize2);break;case Pi(this.direction):r.itemSize1=Math.round(this._idealSize1);break;default:r.itemSize1=Math.round(this._idealSize1*this._idealSize2/r.itemSize2)}}else r.itemSize1=this._idealSize1,r.itemSize2=this._idealSize2,r.rolumns=l;if(o){const e=r.rolumns*r.itemSize2+(r.rolumns-1)*r.gap2;i=this.flex||"start"===t?r.padding2.start:"end"===t?this._viewDim2-r.padding2.end-e:Math.round(this._viewDim2/2-e/2)}else{const s=a-r.rolumns*r.itemSize2;"space-between"===t?(r.gap2=Math.round(s/(r.rolumns-1)),i=0):"space-around"===t?(r.gap2=Math.round(s/r.rolumns),i=Math.round(r.gap2/2)):(r.gap2=Math.round(s/(r.rolumns+1)),i=r.gap2),this._gap1===1/0&&(r.gap1=r.gap2,e===1/0&&(r.padding1.start=i),n===1/0&&(r.padding1.end=i))}for(let t=0;t<r.rolumns;t++)r.positions.push(i),i+=r.itemSize2+r.gap2}this._metrics=r}}
144
+ */class Zi extends Gi{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: ${Xi(this.direction)}-gap cannot be set to 'auto' when direction is set to ${this.direction}`)});const o=this.flex||["start","center","end"].includes(t),r={rolumns:-1,itemSize1:-1,itemSize2:-1,gap1:this._gap1===1/0?-1:this._gap1,gap2:o?this._gap2:0,padding1:{start:e===1/0?this._gap1:e,end:n===1/0?this._gap1:n},padding2:o?{start:s===1/0?this._gap2:s,end:i===1/0?this._gap2:i}:{start:0,end:0},positions:[]},a=this._viewDim2-r.padding2.start-r.padding2.end;if(a<=0)r.rolumns=0;else{const s=o?r.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),r.rolumns=l,r.itemSize2=Math.round((a-s*(l-1))/l);switch(!0===this.flex?"area":this.flex.preserve){case"aspect-ratio":r.itemSize1=Math.round(this._idealSize1/this._idealSize2*r.itemSize2);break;case Ni(this.direction):r.itemSize1=Math.round(this._idealSize1);break;default:r.itemSize1=Math.round(this._idealSize1*this._idealSize2/r.itemSize2)}}else r.itemSize1=this._idealSize1,r.itemSize2=this._idealSize2,r.rolumns=l;if(o){const e=r.rolumns*r.itemSize2+(r.rolumns-1)*r.gap2;i=this.flex||"start"===t?r.padding2.start:"end"===t?this._viewDim2-r.padding2.end-e:Math.round(this._viewDim2/2-e/2)}else{const s=a-r.rolumns*r.itemSize2;"space-between"===t?(r.gap2=Math.round(s/(r.rolumns-1)),i=0):"space-around"===t?(r.gap2=Math.round(s/r.rolumns),i=Math.round(r.gap2/2)):(r.gap2=Math.round(s/(r.rolumns+1)),i=r.gap2),this._gap1===1/0&&(r.gap1=r.gap2,e===1/0&&(r.padding1.start=i),n===1/0&&(r.padding1.end=i))}for(let t=0;t<r.rolumns;t++)r.positions.push(i),i+=r.itemSize2+r.gap2}this._metrics=r}}
145
145
  /**
146
146
  * @license
147
147
  * Copyright 2021 Google LLC
148
148
  * SPDX-License-Identifier: BSD-3-Clause
149
- */const Xi="MIN";class Gi extends qi{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===Xi?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:o}=this._metrics;let r=n.start;const a=new Array(e).fill(null).map(t=>r);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],_=o[l];this._positions.set(d,{[this._positionDim]:m,[this._secondaryPositionDim]:_,[this._sizeDim]:p,[this._secondarySizeDim]:s});const g=m+p,y=this._getRangeMapKey(m,Xi);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+i,r=1/0,a.forEach((t,e)=>{t<r&&(r=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,Xi),i=this._getRangeMapKey(e,"MAX");let o=n,r=0;for(let t=s;t<=i;t+=this._RANGE_MAP_GRANULARITY){const[e,s]=this._rangeMap.get(t)??[n,0];o=Math.min(o,e),r=Math.max(r,s)}this._first=o,this._last=r}}_getItemPosition(t){return this._positions.get(t)}_updateScrollSize(){}}
149
+ */const Ki="MIN";class Qi extends Zi{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===Ki?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:o}=this._metrics;let r=n.start;const a=new Array(e).fill(null).map(t=>r);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],_=o[l];this._positions.set(d,{[this._positionDim]:m,[this._secondaryPositionDim]:_,[this._sizeDim]:p,[this._secondarySizeDim]:s});const g=m+p,y=this._getRangeMapKey(m,Ki);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+i,r=1/0,a.forEach((t,e)=>{t<r&&(r=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,Ki),i=this._getRangeMapKey(e,"MAX");let o=n,r=0;for(let t=s;t<=i;t+=this._RANGE_MAP_GRANULARITY){const[e,s]=this._rangeMap.get(t)??[n,0];o=Math.min(o,e),r=Math.max(r,s)}this._first=o,this._last=r}}_getItemPosition(t){return this._positions.get(t)}_updateScrollSize(){}}
150
150
  /**
151
151
  * @license
152
152
  * Copyright 2021 Google LLC
153
153
  * SPDX-License-Identifier: BSD-3-Clause
154
- */class Zi extends Event{constructor(t){super(Zi.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}Zi.eventName="rangeChanged";class Ki extends Event{constructor(t){super(Ki.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}Ki.eventName="visibilityChanged";class Qi extends Event{constructor(){super(Qi.eventName,{bubbles:!1})}}Qi.eventName="unpinned";
154
+ */class Ji extends Event{constructor(t){super(Ji.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}Ji.eventName="rangeChanged";class to extends Event{constructor(t){super(to.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}to.eventName="visibilityChanged";class eo extends Event{constructor(){super(eo.eventName,{bubbles:!1})}}eo.eventName="unpinned";
155
155
  /**
156
156
  * @license
157
157
  * Copyright 2021 Google LLC
158
158
  * SPDX-License-Identifier: BSD-3-Clause
159
159
  */
160
- class Ji{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 to extends Ji{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),o=Math.abs(s-e);i<1&&o<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))}}
160
+ class no{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 so extends no{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),o=Math.abs(s-e);i<1&&o<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))}}
161
161
  /**
162
162
  * @license
163
163
  * Copyright 2021 Google LLC
164
164
  * SPDX-License-Identifier: BSD-3-Clause
165
- */let eo="undefined"!=typeof window?window.ResizeObserver:void 0;const no=Symbol("virtualizerRef"),so="virtualizer-sizer";let io;class oo{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._scrollEndRafId=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 Map,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 eo(()=>this._hostElementSizeChanged()),this._childrenRO=new eo(this._childrenSizeChanged.bind(this))}_initHostElement(t){this._hostElement=t.hostElement;const e=this._hostElement;this._applyVirtualizerStyles(),e[no]=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:ao(t);for(;null!==s;)n.push(s),s=ao(s);return n}(t,e).filter(t=>{if(n)return!1;const e=getComputedStyle(t);return n="fixed"===e.position,"visible"!==e.overflow})}
165
+ */let io="undefined"!=typeof window?window.ResizeObserver:void 0;const oo=Symbol("virtualizerRef"),ro="virtualizer-sizer";let ao;class lo{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._scrollEndRafId=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 Map,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 io(()=>this._hostElementSizeChanged()),this._childrenRO=new io(this._childrenSizeChanged.bind(this))}_initHostElement(t){this._hostElement=t.hostElement;const e=this._hostElement;this._applyVirtualizerStyles(),e[oo]=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:ho(t);for(;null!==s;)n.push(s),s=ho(s);return n}(t,e).filter(t=>{if(n)return!1;const e=getComputedStyle(t);return n="fixed"===e.position,"visible"!==e.overflow})}
166
166
  /**
167
167
  * @license
168
168
  * Copyright 2021 Google LLC
169
169
  * SPDX-License-Identifier: BSD-3-Clause
170
- */(this._hostElement,t),this._scrollerController=new to(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)),null!==this._scrollEndRafId&&(cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=null),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(`[${so}]`);e||(e=document.createElement("div"),e.setAttribute(so,""),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(so,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||io;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&&(io=n=(await Promise.resolve().then(function(){return Bi})).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],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(i))&&(t[o]=n.call(this,i,this._items[o]))}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:ro(e.marginTop),marginRight:ro(e.marginRight),marginBottom:ro(e.marginBottom),marginLeft:ro(e.marginLeft)}}(t))}_schedule(t){const e=this._scheduled.get(t);void 0!==e&&cancelAnimationFrame(e);const n=requestAnimationFrame(()=>{this._scheduled.delete(t),t.call(this)});this._scheduled.set(t,n)}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),null!==this._scrollEndRafId&&cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=requestAnimationFrame(()=>{this._scrollEndRafId=null,this._connected&&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 Qi)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(so)||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,o,r;const a=t.getBoundingClientRect();s=0,i=0,o=window.innerHeight,r=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),o=Math.min(o,t.bottom),r=Math.min(r,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,o-s),m=Math.max(0,r-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:o},r)=>{const a=this._children[r-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===o?null:`${o}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 Zi({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new Ki({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 ro(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function ao(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 lo=q(class extends dt{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,e)=>((t,e)=>x`${e}: ${JSON.stringify(t,null,2)}`)(t,e+this._first),this._keyFunction=(t,e)=>(t=>t)(t,this._first),this._items=[],t.type!==W)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 At(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?C: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 oo({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()}});function co(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n}:{keyFn:void 0,template:t,opts:e}}function ho(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function uo(t,e,n){return new Promise((s,i)=>{const o=[];let r=!1;t.onsuccess=()=>{const i=t.result;if(i){if(e>0&&!r)return r=!0,void i.advance(e);o.push(i.value),null!==n&&o.length>=n?s(o):i.continue()}else s(o)},t.onerror=()=>i(t.error)})}const fo={equals:t=>IDBKeyRange.only(t),greaterThan:t=>IDBKeyRange.lowerBound(t,!0),greaterThanOrEqual:t=>IDBKeyRange.lowerBound(t,!1),lessThan:t=>IDBKeyRange.upperBound(t,!0),lessThanOrEqual:t=>IDBKeyRange.upperBound(t,!1),between:(t,e,n)=>IDBKeyRange.bound(t,e,n?.lowerOpen??!1,n?.upperOpen??!1),startsWith:t=>IDBKeyRange.bound(t,t+"￿",!1,!1)};class po{constructor(t,e,n,s,i,o){this._db=t,this._storeName=e,this._pk=n,this._indexQuery=s,this._indexSort=i,this._page=o}filterByIndex(t,e){return new po(this._db,this._storeName,this._pk,{indexName:t,range:e(fo)},this._indexSort,this._page)}sortByIndex(t,e="asc"){return new po(this._db,this._storeName,this._pk,this._indexQuery,{indexName:t,direction:"desc"===e?"prev":"next"},this._page)}async toArray(){const t=new po(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,null);return mo(await t._run(),t)}async page(t,e){const n=new po(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,{num:t,size:e});return mo(await n._run(),n)}async _run(){const t=this._db.transaction(this._storeName,"readonly").objectStore(this._storeName),e=null!==this._indexQuery,n=null!==this._indexSort,s=this._page?(this._page.num-1)*this._page.size:0,i=this._page?this._page.size:null;if(!e&&!n)return this._page?uo(t.openCursor(),s,i):ho(t.getAll());const o=this._indexQuery.indexName,r=this._indexQuery?.range??null,a=this._indexSort.indexName,l=this._indexSort.direction;if(n&&(!e||o===a)){const n=e?r:null;return uo(t.index(a).openCursor(n,l),s,i)}let c=await ho(t.index(o).getAll(r));if(n){const t=a,e="prev"===l?-1:1;c.sort((n,s)=>{const i=n[t],o=s[t];return(i<o?-1:i>o?1:0)*e})}return this._page&&(c=c.slice(s,s+i)),c}}function mo(t,e){const{_db:n,_storeName:s,_pk:i}=e,o=Nn(t,{skipRestrictedContextCheck:!0}),r=o;return r.updateItem=async(t,e)=>{const r=o.get().find(e=>e[i]===t);null!=r&&"object"==typeof r&&(e(r),await ho(n.transaction(s,"readwrite").objectStore(s).put(r)),o.update(()=>{}))},r.setItem=async(t,e)=>{await ho(n.transaction(s,"readwrite").objectStore(s).put(e)),o.update(n=>{const s=n.findIndex(e=>e[i]===t);-1!==s&&(n[s]=e)})},r.removeItem=async t=>{await ho(n.transaction(s,"readwrite").objectStore(s).delete(t)),o.update(e=>{const n=e.findIndex(e=>e[i]===t);-1!==n&&e.splice(n,1)})},r.refresh=async()=>{o.set(await e._run())},Object.defineProperty(r,"name",{value:"dbTableAtom",writable:!0,configurable:!0,enumerable:!1}),r}function _o(t,e,n,s){const i=new po(t,e,n,null,null,null),o=()=>s?s.objectStore(e):t.transaction(e,"readonly").objectStore(e),r=()=>s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e);return{filterByIndex:(t,e)=>i.filterByIndex(t,e),sortByIndex:(t,e)=>i.sortByIndex(t,e),toArray:()=>i.toArray(),page:(t,e)=>i.page(t,e),add:t=>ho(r().add(t)),set:async(t,e)=>{await ho(r().put(e))},update:async(n,i)=>{const o=s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e),r=await ho(o.get(n));null!=r&&(i(r),await ho(o.put(r)))},delete:async t=>{await ho(r().delete(t))},clear:async()=>{await ho(r().clear())},count:()=>ho(o().count()),get:t=>ho(o().get(t)),has:async t=>void 0!==await ho(o().getKey(t))}}const go=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,yo=t=>"function"==typeof t,wo=t=>"AsyncFunction"===t.constructor.name,vo=(t,e,n,s)=>{if(go(t)){const i=t,o=Nn(i(),s),r=n(o.set,e),a=n(o.update,e);return o.set=r,o.update=a,i.__subscribe(()=>{Ie.schedule(()=>o.set(i()))}),ve(o,()=>{r.cancel(),a.cancel()}),o}const i=Nn(t,s),o=n(i.set,e),r=n(i.update,e);return i.set=o,i.update=r,ve(i,()=>{o.cancel(),r.cancel()}),i};const bo=(t=[],e)=>{const n=new Map(t),s=Nn(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const o=n.delete.bind(n);n.delete=t=>{const e=o(t);return s.update(()=>{}),e};const r=n.clear.bind(n);n.clear=()=>{r(),s.update(()=>{})};const a=n.get.bind(n);n.get=t=>(s.get(),a(t));const l=n.has.bind(n);n.has=t=>(s.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(s.get(),h());const u=n.values.bind(n);n.values=()=>(s.get(),u());const d=n.keys.bind(n);n.keys=()=>(s.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),p()),n.update=t=>{const e={set:(t,n)=>(i(t,n),e),delete:t=>o(t),clear:()=>{r()},get:t=>a(t),has:t=>l(t),entries:()=>h(),values:()=>u(),keys:()=>d(),forEach:(t,e)=>f(t,e),[Symbol.iterator]:()=>p(),get size(){return c.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>{const i=a(t);return null==i||"object"!=typeof i||(e(i),s.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},xo="mates";function So(t,e){try{null===e?t.removeItem(xo):t.setItem(xo,JSON.stringify(e))}catch{}}function Co(t,e){const n=Nn((()=>{try{return function(t){try{const e=t.getItem(xo);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{So(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{So(t(),n.get())}catch{}}},e(t=>{if(t.key===xo)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 Eo(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}const Ao=Co(()=>localStorage,t=>Eo(e=>{e.storageArea===localStorage&&t(e)})),ko=Co(()=>sessionStorage,t=>Eo(e=>{e.storageArea===sessionStorage&&t(e)})),Mo=Nn("undefined"!=typeof document?document.title:"");Jn(()=>{var t;t=Mo.get(),"undefined"!=typeof document&&(document.title=t)});function $o(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 Ro(t,e,n){const s=jn(t,{skipRestrictedContextCheck:!0,...n}),i=jn([],{skipRestrictedContextCheck:!0,...n});function o(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const r=s.set;s.set=function(t,e=!1){r(t,e),o()};const a=s.update;s.update=function(t,e=!1){a(t,e),o()};const l=s;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>i.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===i.get().length,enumerable:!1,configurable:!0}),l.validate=o,l.toFloat=()=>$o(s.get()),l.toFloatString=()=>$o(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 To(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function Oo(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 Io(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 Po=t=>{const e=we();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;te.viewOuterInProgress=!0;try{n=new t}finally{te.viewOuterInProgress=!1}const s=te.setupInProgress;try{if((()=>{Io(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){wo(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),te.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{te.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{te.setupInProgress=s}return n},zo=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}});if(we().dispatchEvent(n),e)return e;throw new Error(`No parent scope found for ${t.name}`)};function Do(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 No=(t,e,n)=>{const s=Io(t);s.forEach(s=>{const i=Do(t,s);if(i?.get){let n,o=-1;const r=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==o&&(o=s,n=r.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(yo(t[s])){if(wo(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=Do(t,n);if(!s)return;const o=!!s.get,r=!o&&yo(s.value);o||r||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i};function Lo(){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)}`}function jo(){return{list:t=>Promise.resolve(function(){function t(){return[]}return t.get=t=>{},t.has=t=>!1,t.add=async t=>"",t.set=async(t,e)=>{},t.update=async(t,e)=>{},t.deleteRow=async t=>{},t.clear=async()=>{},Object.defineProperty(t,"size",{get:()=>0,enumerable:!0,configurable:!0}),t}())}}const Uo="mini-db",Fo="mini-db:v";function Vo(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function Wo(t,e,n){return new Promise((s,i)=>{const o=e?indexedDB.open(t,e):indexedDB.open(t);o.onupgradeneeded=()=>n?.(o.result),o.onsuccess=()=>s(o.result),o.onerror=()=>i(o.error),o.onblocked=()=>console.warn("[miniDB] Open blocked — close other connections first.")})}function Bo(t){t.current.onversionchange=async()=>{t.current.close(),t.current=await Wo(Uo),Bo(t)}}async function Ho(t,e,n){const s=await Vo(t.current.transaction(e,"readonly").objectStore(e).getAll()),i=bo(s.map(t=>[String(t.id),t])),o=n=>Vo(t.current.transaction(e,"readwrite").objectStore(e).put(n));n&&n.addEventListener("message",t=>{const n=t.data;n&&n.store===e&&("set"===n.op?i.set(n.key,n.item):"delete"===n.op?i.delete(n.key):"clear"===n.op&&i.clear())});const r=t=>{try{n?.postMessage(t)}catch{}};function a(){return Array.from(i.values())}return a.get=t=>i.get(t),a.has=t=>i.has(t),a.add=async t=>{const n=String(t.id??Lo()),s={...t,id:n};return await o(s),i.set(n,s),r({store:e,op:"set",key:n,item:s}),n},a.set=async(t,n)=>{const s={...n,id:t};await o(s),i.set(t,s),r({store:e,op:"set",key:t,item:s})},a.update=async(t,n)=>{const s=i.get(t);s&&(i.updateItem(t,n),await o(s),r({store:e,op:"set",key:t,item:s}))},a.deleteRow=async n=>{await(n=>Vo(t.current.transaction(e,"readwrite").objectStore(e).delete(n)))(n),i.delete(n),r({store:e,op:"delete",key:n})},a.clear=async()=>{await Vo(t.current.transaction(e,"readwrite").objectStore(e).clear()),i.clear(),r({store:e,op:"clear"})},Object.defineProperty(a,"size",{get:()=>i.size,enumerable:!0,configurable:!0}),a}function Yo(t,e,n,s=!1){document.addEventListener(t,e,{capture:s}),n.addToCleanUps(e,()=>{document.removeEventListener(t,e,{capture:s})})}function qo(t,e,n,s){let i;if("wheelUp"===t||"wheelDown"===t){const o="wheelUp"===t,r=e,a=t=>{(o?t.deltaY>=0:t.deltaY<=0)||(i&&i(),i=r(t))};return window.addEventListener("wheel",a,{capture:n,passive:!0}),void s.addToCleanUps(e,()=>{window.removeEventListener("wheel",a,{capture:n}),i&&i()})}const o="scroll"===t||"touchstart"===t||"touchmove"===t,r=e,a=t=>{i&&i(),i=r(t)};window.addEventListener(t,a,{capture:n,passive:o}),s.addToCleanUps(e,()=>{window.removeEventListener(t,a,{capture:n}),i&&i()})}function Xo(t,e){Ce()||(ze(),qo(t,e,!1,we()))}function Go(t,e){Ce()||(ze(),qo(t,e,!0,we()))}const Zo=pi((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()),F(e,i),s.appendChild(i),document.body.appendChild(s);const o=document.body.style.overflow;return document.body.style.overflow="hidden",{onUpdate(t){F(t,i)},onCleanup(){s.remove(),document.body.style.overflow=o}}});const Ko={position:"fixed",display:"none",margin:"0"},Qo="9999";function Jo(t={}){const{style:e,target:n,zIndex:s=Qo}=t,i=document.createElement("div");for(const[t,e]of Object.entries(Ko))i.style[t]=e;i.style.zIndex=String(s),e&&Object.assign(i.style,e);return{el:i,attach:()=>{i.isConnected||function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n).appendChild(i)},detach:()=>{i.isConnected&&i.remove()},isAttached:()=>i.isConnected}}function tr(t,e,n,s,i,o,r){return t.startsWith("top")?s>=n:t.startsWith("bottom")?i>=n:t.startsWith("left")?o>=e:!!t.startsWith("right")&&r>=e}function er(t,e,n,s,i,o){const r=window.innerWidth,a=function(t){let e=t.parentElement;for(;e&&e!==document.documentElement;){const{overflowY:t}=window.getComputedStyle(e),n="auto"===t||"scroll"===t,s=e.scrollHeight>e.clientHeight;if(n&&s)return e;e=e.parentElement}return null}(t);let l,c;if(a){const t=a.getBoundingClientRect(),n=a.scrollHeight-a.scrollTop-a.clientHeight;c=t.bottom-e.bottom+n-i;const s=a.scrollTop;l=e.top-t.top+s-i}else{const t=window.scrollY||document.documentElement.scrollTop,n=document.documentElement.scrollHeight;l=e.top+t-i,c=n-(e.bottom+t)-i}const h=e.left-i,u=r-e.right-i;if("auto"===o){const t=["bottom-start","top-start","right","left"];for(const e of t)if(tr(e,n,s,l,c,h,u))return e;return"bottom-start"}if(tr(o,n,s,l,c,h,u))return o;const d=function(t){return t.startsWith("top")?t.replace("top","bottom"):t.startsWith("bottom")?t.replace("bottom","top"):t.startsWith("left")?t.replace("left","right"):t.startsWith("right")?t.replace("right","left"):t}(o);return tr(d,n,s,l,c,h,u)?d:o}const nr=ai((t,e,n)=>{const s=t.el;let i=!1,o=e,r=n;console.log("[popup] MOUNT — anchor:",s,"destroyOnClose:",!!n.destroyOnClose);const a=Jo({...void 0!==r.zIndex?{zIndex:r.zIndex}:{},style:{background:"var(--md-color-surface-raised,#fff)",boxShadow:"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))",minWidth:"160px",...r.style??{}}}),l=a.el;r.destroyOnClose;const c=()=>{const t=s.getBoundingClientRect();l.style.visibility="hidden",l.style.display="block",r.matchAnchorWidth&&(l.style.width=`${t.width}px`);const e=l.offsetWidth,n=l.offsetHeight,i=er(s,t,e,n,r.gap??4,r.position??"bottom-start");!function(t,e,n,s,i,o){const r=window.innerWidth,a=window.innerHeight;let l=0,c=0;n.startsWith("bottom")?l=e.bottom+o:n.startsWith("top")?l=e.top-o-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+o:n.startsWith("left")?e.left-o-s:e.left:n.endsWith("-end")?c=n.startsWith("right")?e.right+o:n.startsWith("left")?e.left-o-s:e.right-s:n.startsWith("right")?c=e.right+o:n.startsWith("left")&&(c=e.left-o-s);const h=Math.max(4,Math.min(c,r-s-4)),u=Math.max(4,Math.min(l,a-i-4)),d=parseInt(String(h),10),f=parseInt(String(u),10);t.style.left=`${d}px`,t.style.top=`${f}px`}(l,t,i,e,n,r.gap??4),l.style.visibility=""},h=()=>{i&&c()};let u=null;const d=()=>{u?.disconnect(),u=null},f=t=>{const e=t.target;l.contains(e)||s.contains(e)||y()},p=t=>{"Escape"===t.key&&y()},m=t=>"boolean"==typeof t?t:t(),_=()=>void 0!==r.open,g=()=>{i||(i=!0,a.isAttached()||(a.attach(),F(o,l),console.log("[popup] LAZY-ATTACHED to body on open — floating:",l)),c(),r.onOpen?.(l),_()||(document.addEventListener("click",f,{capture:!0}),document.addEventListener("keydown",p)),window.addEventListener("scroll",h,{passive:!0,capture:!0}),window.addEventListener("resize",h,{passive:!0}),r.matchAnchorWidth&&(u=new ResizeObserver(t=>{if(!i)return;const e=t[0]?.borderBoxSize?.[0]?.inlineSize??t[0]?.contentRect.width;null!=e&&(l.style.width=`${e}px`,l.style.minWidth=`${e}px`,h())}),u.observe(s)))},y=()=>{i&&(console.log("[popup] CLOSE — destroyOnClose:",r.destroyOnClose,"floating.isConnected:",l.isConnected,"floating:",l),i=!1,r.destroyOnClose||(l.style.display="none"),r.onClose?.(s,l),r.destroyOnClose&&a.isAttached()&&(console.log("[popup] REMOVED from body in close() — floating:",l),a.detach()),_()||(document.removeEventListener("click",f,{capture:!0}),document.removeEventListener("keydown",p)),window.removeEventListener("scroll",h,{capture:!0}),window.removeEventListener("resize",h),d())},w=t=>{t.stopPropagation(),i?y():g()};return _()?m(r.open)&&g():s.addEventListener("click",w),{onUpdate(t,e){console.log("[popup] UPDATE — isOpen:",i,"anchor:",s);const n=_();if(o=t,r=e,l.isConnected&&F(t,l),e.style&&Object.assign(l.style,e.style),_()){n||s.removeEventListener("click",w);const t=m(e.open);t&&!i?g():!t&&i?y():i&&c()}else n&&s.addEventListener("click",w),i&&c()},onCleanup(){console.log("[popup] CLEANUP — isOpen:",i,"floating.parentNode:",l.parentNode??"NO PARENT","floating.isConnected:",l.isConnected,"floating:",l,"anchor.isConnected:",s.isConnected),i&&y(),d(),_()||s.removeEventListener("click",w),a.detach(),console.log("[popup] CLEANUP DONE — floating still in body?",a.isAttached())}}});const sr=pi((t,e,n)=>{const s=document.createElement("div");if(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),F(e,s),{onUpdate(t){F(t,s)},onCleanup(){s.remove()}}});const ir=1e3,or=3e4,rr=1/0;var ar,lr,cr,hr,ur,dr;function fr(t){return"number"==typeof t?`${t}px`:t}lr=new WeakMap,cr=new WeakMap,hr=new WeakMap,ur=new WeakMap,ar=new WeakSet,dr=function(t){ce(this,lr,"f")?.remove(),he(this,lr,null,"f"),he(this,cr,"","f"),he(this,hr,"","f"),he(this,ur,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 pr=q(class extends X{constructor(t){if(super(t),ar.add(this),lr.set(this,null),cr.set(this,""),hr.set(this,""),ur.set(this,new Set),t.type!==W)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"),ce(this,ar,"m",dr).call(this,t),C;const s=JSON.stringify(n);if(null===ce(this,lr,"f")||e!==ce(this,cr,"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"),ce(this,ar,"m",dr).call(this,t),C;ce(this,lr,"f")?.remove(),he(this,lr,n,"f"),he(this,cr,e,"f"),he(this,hr,"","f"),he(this,ur,new Set,"f");const s=t.endNode;s.parentNode.insertBefore(ce(this,lr,"f"),s)}if(s!==ce(this,hr,"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,o=e.height??e.size;void 0!==i&&s("width",fr(i)),void 0!==o&&s("height",fr(o)),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 r=[],a=e.width??e.size,l=e.height??e.size;void 0!==a&&r.push(`width:${fr(a)}`),void 0!==l&&r.push(`height:${fr(l)}`),void 0!==e.color&&r.push(`color:${e.color}`),r.push("display:inline-block"),r.push("vertical-align:middle"),e.style&&r.push(e.style),s("style",r.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}(ce(this,lr,"f"),n);for(const e of ce(this,ur,"f"))t.has(e)||ce(this,lr,"f").removeAttribute(e);he(this,ur,t,"f"),he(this,hr,s,"f")}return C}render(t,e){return C}});function mr(t,e={}){return pr(t,e)}let _r=null,gr=null,yr=null;function wr(t){_r=t}function vr(t){gr=t}function br(){return gr}function xr(){return _r??-(new Date).getTimezoneOffset()}function Sr(){return yr??("undefined"!=typeof navigator?navigator.language:null)??"en"}function Cr(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 Er(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 Ar(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 kr(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 Mr=t=>String(t).padStart(2,"0");function $r(t,e,n){const s={[n]:e};return gr?s.timeZone=gr:(s.timeZone="UTC",t+=6e4*xr()),new Intl.DateTimeFormat(Sr(),s).format(new Date(t))}function Rr(t,e){const n=t>=0?"+":"-",s=Math.abs(t);return e?`${n}${Mr(Math.floor(s/60))}:${Mr(s%60)}`:`${n}${Mr(Math.floor(s/60))}${Mr(s%60)}`}function Tr(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 Or(){try{const t=new Intl.Locale(Sr()),e=t.weekInfo?.firstDay??t.getWeekInfo?.()?.firstDay;if(void 0!==e)return e%7}catch{}return 0}const Ir=/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|H|hh|h|mm|ss|SSS|ZZ|Z|A|a/g,Pr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zr(t){try{const e=new Date(Date.UTC(2024,0,7+t,12,0,0));return new Intl.DateTimeFormat(Sr(),{weekday:"long",timeZone:"UTC"}).format(e)}catch{return Pr[t]||""}}function Dr(t){try{const e=new Date(Date.UTC(2024,t-1,15,12,0,0));return new Intl.DateTimeFormat(Sr(),{month:"long",timeZone:"UTC"}).format(e)}catch{return""}}function Nr(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:o=0,second:r=0,ms:a=0}=t;return Date.UTC(e,n-1,s,i,o,r,a)-6e4*xr()}return NaN}function Lr(t,e,n){const s=Tr(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=xr(),o=kr(t,i);let r=o.Y,a=o.M,l=o.D;if("year"===s)r+=e;else if("month"===s){const t=a-1+e;r+=Math.floor(t/12),a=(t%12+12)%12+1,l=Math.min(l,new Date(r,a,0).getDate())}else l+="week"===s?7*e:e;return Date.UTC(r,a-1,l,o.h,o.m,o.s,o.ms)-6e4*i}function jr(t,e){const n=xr(),s=kr(t,n),i=kr(e,n);return s.Y===i.Y&&s.M===i.M&&s.D===i.D}function Ur(t){const e=xr(),n=kr(t,e);return Date.UTC(n.Y,n.M-1,n.D,0,0,0,0)-6e4*e}function Fr(t,e){const n=xr(),s=kr(t,n),i=s.h%12||12,o=[],r=e.replace(/\[([^\]]*)\]/g,(t,e)=>(o.push(e),`\0${o.length-1}\0`));Ir.lastIndex=0;const a=r.replace(Ir,e=>{switch(e){case"YYYY":return String(s.Y);case"YY":return String(s.Y).slice(-2);case"MMMM":return $r(t,"long","month");case"MMM":return $r(t,"short","month");case"MM":return Mr(s.M);case"M":return String(s.M);case"DD":return Mr(s.D);case"D":return String(s.D);case"dddd":return $r(t,"long","weekday");case"ddd":return $r(t,"short","weekday");case"HH":return Mr(s.h);case"H":return String(s.h);case"hh":return Mr(i);case"h":return String(i);case"mm":return Mr(s.m);case"ss":return Mr(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 Rr(n,!0);case"ZZ":return Rr(n,!1);default:return e}});return a.replace(/\0(\d+)\0/g,(t,e)=>o[+e])}const Vr=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60],["second",1]];const Wr=Symbol("ts"),Br=Object.create(Number.prototype);function Hr(t){return function(t){const e=Object.create(Br);return e[Wr]=t,e}(void 0===t?Date.now():Nr(t))}Object.defineProperties(Br,{valueOf:{value(){return this[Wr]},writable:!1,configurable:!1},values:{get(){const t=this[Wr],e=kr(t,xr());return{year:e.Y,month:e.M,monthName:Dr(e.M),dayName:zr(e.wd),date:e.D,weekStartDayName:zr(Or()),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[Wr];return Number.isFinite(t)?new Date(t).toISOString():"Invalid Date"},writable:!1,configurable:!1},toString:{value(){const t=this[Wr];return Number.isFinite(t)?new Intl.DateTimeFormat(Sr(),{dateStyle:"medium",...br()?{timeZone:br()}:{timeZone:"UTC"}}).format(new Date(br()?t:t+6e4*xr())):"Invalid Date"},writable:!1,configurable:!1},format:{value(t){return Fr(this[Wr],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?Nr(e.now):Date.now())-t)/1e3,o=Math.abs(i),r=i>=0?-1:1,a=new Intl.RelativeTimeFormat(Sr(),{numeric:n,style:s});for(const[t,e]of Vr)if(o>=e)return a.format(r*Math.round(o/e),t);return a.format(0,"second")}(this[Wr],t)},writable:!1,configurable:!1},add:{value(t,e){return this[Wr]=Lr(this[Wr],t,e),this},writable:!1,configurable:!1},subtract:{value(t,e){return this[Wr]=Lr(this[Wr],-t,e),this},writable:!1,configurable:!1},isBefore:{value(t){return this[Wr]<Nr(t)},writable:!1,configurable:!1},isAfter:{value(t){return this[Wr]>Nr(t)},writable:!1,configurable:!1},isFuture:{value(){return this[Wr]>Date.now()},writable:!1,configurable:!1},isPresent:{value(){return jr(this[Wr],Date.now())},writable:!1,configurable:!1},isToday:{value(){return jr(this[Wr],Date.now())},writable:!1,configurable:!1},isYesterday:{value(){const t=Lr(Ur(Date.now()),-1,"day");return jr(this[Wr],t)},writable:!1,configurable:!1},isTomorrow:{value(){const t=Lr(Ur(Date.now()),1,"day");return jr(this[Wr],t)},writable:!1,configurable:!1},getDifference:{value(t,e){return function(t,e,n){const s=Tr(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 o=xr(),r=kr(t,o),a=kr(e,o);if("day"===s||"week"===s){const n=Math.floor((t+6e4*o)/864e5)-Math.floor((e+6e4*o)/864e5);return"week"===s?Math.trunc(n/7):n}return"month"===s?12*(r.Y-a.Y)+(r.M-a.M):r.Y-a.Y}(this[Wr],Nr(t),e)},writable:!1,configurable:!1},getAge:{value(t){return function(t,e){const n=xr(),s=kr(t,n),i=kr(e,n);let o=i.Y-s.Y,r=s.M,a=s.D;if(2===r&&29===a){const t=t=>t%4==0&&t%100!=0||t%400==0;t(i.Y)||(r=3,a=1)}return(i.M<r||i.M===r&&i.D<a)&&o--,Math.max(0,o)}(this[Wr],void 0!==t?Nr(t):Date.now())},writable:!1,configurable:!1}}),exports.$=si,exports.Context=class{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}},exports.Delete=t=>Ws.Delete(Ds(t)),exports.ErrorTypes=zs,exports.Fetch=t=>Ws.fetch(Ds(t)),exports.FetchClient=Vs,exports.Get=t=>Ws.Get(Ds(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=pe,exports.Patch=t=>Ws.Patch(Ds(t)),exports.Post=t=>Ws.Post(Ds(t)),exports.Put=t=>Ws.Put(Ds(t)),exports.Router=(t,e)=>{const n=t.find(t=>ys(t.path));if(void 0===n)return e?()=>is(e):()=>E;const{component:s}=n;return()=>is(s)},exports.SyncNotificationManager=me,exports.ZeroPromise=Ps,exports._=je,exports._subToView=Ue,exports.action=function(t){ee("Action");let e=t;const n=new Set;let s=null,i=null;const o=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})};return Object.assign(function(...t){return((t,n)=>{try{let r;return r=s?s((...n)=>e.call(t,...n),...n):e.call(t,...n),i&&(r=i(r)),o(r),r}catch(t){const e=t instanceof Error?t:new Error(String(t));throw o(void 0),e}})(this,t)},{val:()=>e,set:t=>{e=t},__isAction___:!0,__subscribe:t=>(ee("subscribe"),n.add(t),()=>n.delete(t)),interceptBefore:t=>{s=t},interceptAfter:t=>{i=t}})},exports.addStoreBeingRead=Yt,exports.animatedIf=oi,exports.animatedRouter=function(t,e={}){return is(ws,{routes:t,options:e})},exports.animatedX=function(t,e,n){const{show:s,...i}=n;return oi(s,x`<x-view .view=${t} .props=${e}></x-view>`,E,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=ne,exports.assertNotInRestrictedContext=ee,exports.asyncAction=Bn,exports.asyncAppend=gt,exports.asyncReplace=_t,exports.atom=Nn,exports.attr=function(t){return li(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=vs,exports.buildRequestUrl=Ns,exports.cacheAtom=function(t){const e=new Map,n=new Map,s=Nn(e,t),i=s.get.bind(s),o=s;return o.add=(t,i,o)=>{if(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),s.update(e=>{e.set(t,i)}),void 0!==o&&-1!==o&&o>0){const i=setTimeout(()=>{e.delete(t),n.delete(t),s.update(()=>{})},o);n.set(t,i)}},o.get=t=>(i(),e.get(t)),o.remove=t=>!!e.has(t)&&(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),e.delete(t),s.update(()=>{}),!0),o.has=t=>(i(),e.has(t)),o.getAll=()=>(i(),Array.from(e.values())),o.clearAll=()=>{n.forEach(t=>clearTimeout(t)),n.clear(),e.clear(),s.update(()=>{})},Object.defineProperty(o,"size",{get:()=>(i(),e.size),enumerable:!0,configurable:!0}),Object.defineProperty(o,"name",{get:()=>"cacheAtom",enumerable:!0,configurable:!0}),ve(s,o.clearAll),o},exports.cacheFn=Vn,exports.changeFlagAtom=function(t=0,e){const n=Nn(t,e),s=n;return s.change=t=>{n.set(void 0!==t?t:Math.random())},s.name="changeFlagAtom",s},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.classMap=vt,exports.classes=function(t){return ci(t)},exports.cleanupScheduler=Oe,exports.clearInterceptors=()=>{js.clear(),Us.clear(),Fs.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.collectSSRStyles=function(){return""},exports.componentRunningStatus=te,exports.computeAutoPlacement=function(t,e,n,s){const i=window.innerHeight-t.bottom-s,o=t.top-s,r=window.innerWidth-t.right-s,a=t.left-s;return i>=n?"bottom":o>=n?"top":r>=e?"right":a>=e?"left":[["bottom",i],["top",o],["right",r],["left",a]].reduce((t,e)=>e[1]>t[1]?e:t)[0]},exports.configureCSS=function(t){t.breakpoints&&Object.assign(Je,t.breakpoints)},exports.countdown=ui,exports.createCacheManager=Vn,exports.createFloatingContainer=Jo,exports.createManagedTimer=Hn,exports.createPollingManager=Wn,exports.createReactiveRunner=zn,exports.createTimedAtom=vo,exports.date=Hr,exports.debounce=Gn,exports.debouncedAtom=(t,e,n)=>vo(t,e,Gn,n),exports.decrementSsrAsyncCounter=$e,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=On,exports.delayAtom=function(t,e,n){const s=new Set;function i(t){const n=setTimeout(()=>{s.delete(n),t()},e);s.add(n)}function o(){for(const t of s)clearTimeout(t);s.clear()}if(go(t)){const e=t,s=Nn(e(),n),r=s.set.bind(s),a=s.update.bind(s);return s.set=(t,e)=>{i(()=>r(t,e))},s.update=(t,e)=>{i(()=>a(t,e))},e.__subscribe(()=>{const t=e();i(()=>r(t))}),ve(s,o),s}const r=Nn(t,n),a=r.set.bind(r),l=r.update.bind(r);return r.set=(t,e)=>{i(()=>a(t,e))},r.update=(t,e)=>{i(()=>l(t,e))},ve(r,o),r},exports.deleteAction=t=>Ws.deleteAction(t),exports.df=On,exports.dialog=function(t,e){return Zo(t,e)},exports.disappear=di,exports.done=function(){if(!Se||!Ae)return;null!==ke&&(clearTimeout(ke),ke=null);const t=Ae;Ae=null,t()},exports.effect=Jn,exports.effectScheduler=Ie,exports.eleHook=ai,exports.event=be,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=Mn,exports.fadeOutPreset=$n,exports.fetchAction=t=>Ws.fetchAction(t),exports.fetchClient=Ws,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)=>Ro(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=>Ws.getAction(t),exports.getAllProps=Io,exports.getAllTimezones=function(){let t;try{t=Intl.supportedValuesOf("timeZone")}catch{return[]}const e=Date.now();return t.map(t=>({name:t,longName:Ar(t,e),shortName:Er(t,e),offset:Cr(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=Hr({year:t,month:e,day:1}),{year:s,month:i,numberOfDaysOfTheMonth:o}=n.values,r=[];for(let t=kr(n.valueOf(),xr()).wd;t>0;t--)r.push(Hr({year:s,month:i,day:1-t}));for(let t=1;t<=o;t++)r.push(Hr({year:s,month:i,day:t}));const a=r.length%7,l=0===a?0:7-a,c=Hr({year:s,month:i,day:o});for(let t=0;t<l;t++)c.add(1,"day"),r.push(Hr(c.valueOf()));const h=[];for(let t=0;t<r.length;t+=7)h.push(r.slice(t,t+7));return h},exports.getCookieObj=function(){if("undefined"==typeof document)return{};const t=document.cookie;if(!t)return{};const e={};for(const n of t.split(";")){const t=n.indexOf("=");if(-1===t)continue;const s=n.slice(0,t).trim();if(!s)continue;const i=n.slice(t+1).trim();try{e[s]=decodeURIComponent(i)}catch{e[s]=i}}return e},exports.getCoords=function(t,e,n){const s=t=>parseInt(String(t),10);switch(e){case"top":case"top-start":return{top:s(t.top-n),left:s(t.left)};case"top-end":return{top:s(t.top-n),left:s(t.right)};case"bottom":case"bottom-start":default:return{top:s(t.bottom+n),left:s(t.left)};case"bottom-end":return{top:s(t.bottom+n),left:s(t.right)};case"right":case"right-start":return{top:s(t.top),left:s(t.right+n)};case"right-end":return{top:s(t.bottom),left:s(t.right+n)};case"left":case"left-start":return{top:s(t.top),left:s(t.left-n)};case"left-end":return{top:s(t.bottom),left:s(t.left-n)}}},exports.getCurrentHost=we,exports.getLocale=function(){return Sr()},exports.getMonths=function(t){const e=t??Sr(),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=zo,exports.getScope=zo,exports.getSsrAsyncCounter=function(){return Ee},exports.getStoresBeingRead=function(){return Wt.storesBeingRead},exports.getTimezoneOffset=function(){return xr()},exports.globalCSS=Cn,exports.globalScheduler=Pe,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],o=[];o.push(Xs(":root",i));for(const n of e)o.push(Xs(`[data-theme="${n}"]`,t[n]));void 0!==s&&o.push(function(t){let e="";for(const n in t)e+=` ${qs(n)}: ${t[n]};\n`;return e?`@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n${e} }\n}`:""}(t[s])),Sn();const r=xn(),a=o.filter(Boolean).join("\n");a&&r.appendRules(a);const l=Object.create(null);for(const t in i)l[t]=qs(t);return{cssVars:Object.freeze(l),themeAtom:Ys}},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.guard=xt,exports.hashAtom=xs,exports.historyStateAtom=cs,exports.html=x,exports.htmlHook=pi,exports.iAtom=Ln,exports.ifDefined=t=>t??E,exports.incrementSsrAsyncCounter=Me,exports.indexDB=function(t,e){return Ce()?Promise.reject(new Error("[indexDB] IndexedDB is not available in SSR environments.")):new Promise((n,s)=>{const i=indexedDB.open(t,e.version);i.onupgradeneeded=t=>{const n=i.result,s=i.transaction;e.upgrade&&e.upgrade(function(t,e){return{createTable(e,n,s=[]){if(t.objectStoreNames.contains(e))return;const i=t.createObjectStore(e,{keyPath:n});for(const t of s)i.createIndex(t,t,{unique:!1})},addIndex(n,s,i){if(!t.objectStoreNames.contains(n))return;const o=e.objectStore(n);o.indexNames.contains(s)||o.createIndex(s,s,i??{unique:!1})},removeIndex(n,s){if(!t.objectStoreNames.contains(n))return;const i=e.objectStore(n);i.indexNames.contains(s)&&i.deleteIndex(s)},dropTable(e){t.objectStoreNames.contains(e)&&t.deleteObjectStore(e)}}}(n,s),t.oldVersion)},i.onsuccess=()=>{const e=i.result;e.onversionchange=()=>{e.close(),console.warn(`[indexDB] "${t}" connection closed — version change detected. Reload the page to upgrade.`)};const s={table:(t,n)=>_o(e,t,n),transaction:(t,n)=>new Promise((s,i)=>{const o=e.transaction(t,"readwrite"),r={table:(t,n)=>_o(e,t,n,o)};o.oncomplete=()=>s(),o.onerror=()=>i(o.error),o.onabort=()=>i(new Error(`[indexDB] Transaction on [${t.join(", ")}] aborted`)),n(r).catch(t=>{try{o.abort()}catch{}i(t)})}),close(){e.close()}};n(s)},i.onerror=()=>s(i.error),i.onblocked=()=>{console.warn(`[indexDB] Opening "${t}" is blocked — close other connections first.`)}})},exports.injectMatesAnimations=kn,exports.installDevToolsHooks=function(t){t.registerComponent&&(Dt.registerComponent=t.registerComponent),t.unregisterComponent&&(Dt.unregisterComponent=t.unregisterComponent),t.notifyRender&&(Dt.notifyRender=t.notifyRender),t.getComponentName&&(Dt.getComponentName=t.getComponentName),t.logComponentMount&&(Dt.logComponentMount=t.logComponentMount),t.logComponentRender&&(Dt.logComponentRender=t.logComponentRender),t.logComponentUnmount&&(Dt.logComponentUnmount=t.logComponentUnmount),t.logAtomSet&&(Dt.logAtomSet=t.logAtomSet),t.logAtomUpdate&&(Dt.logAtomUpdate=t.logAtomUpdate),t.logEventTrigger&&(Dt.logEventTrigger=t.logEventTrigger),t.logCleanupEventTrigger&&(Dt.logCleanupEventTrigger=t.logCleanupEventTrigger),t.logFetchRequest&&(Dt.logFetchRequest=t.logFetchRequest),t.logFetchResponse&&(Dt.logFetchResponse=t.logFetchResponse),t.logFetchError&&(Dt.logFetchError=t.logFetchError),t.recordRender&&(Dt.recordRender=t.recordRender)},exports.interceptAfter=t=>Ls(Us,t),exports.interceptBefore=t=>Ls(js,t),exports.interceptError=t=>Ls(Fs,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=wo,exports.isAsyncValue=We,exports.isAtom=go,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.isDev=Re,exports.isDevToolsInstalled=Ft,exports.isEffectRunning=Ht,exports.isEmail=t=>(t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))(t)?null:"Invalid email",exports.isEmpty=Oo,exports.isEvent=t=>"object"==typeof t&&null!==t&&!0===t.__isEvent___&&"function"==typeof t.__subscribe&&"function"==typeof t.trigger,exports.isFunction=yo,exports.isGetter=t=>"function"==typeof t&&!0===t.__isSelector___&&"function"==typeof t.areVersionsChanged,exports.isInRestrictedContext=function(){return!te.isHookRunning&&(te.templateInProgress||Ht())},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=ys,exports.isPattern=(t,e="Invalid format")=>n=>((t,e)=>e.test(t))(n,t)?null:e,exports.isReadTrackingEnabled=Bt,exports.isRequired=t=>(t=>"number"==typeof t||"boolean"==typeof t||!Oo(t))(t)?null:"Required",exports.isSSR=Ce,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 o=e[i];null!==o&&"object"==typeof o&&t(o,n)}},exports.join=
170
+ */(this._hostElement,t),this._scrollerController=new so(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)),null!==this._scrollEndRafId&&(cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=null),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(`[${ro}]`);e||(e=document.createElement("div"),e.setAttribute(ro,""),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(ro,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||ao;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&&(ao=n=(await Promise.resolve().then(function(){return qi})).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],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(i))&&(t[o]=n.call(this,i,this._items[o]))}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:co(e.marginTop),marginRight:co(e.marginRight),marginBottom:co(e.marginBottom),marginLeft:co(e.marginLeft)}}(t))}_schedule(t){const e=this._scheduled.get(t);void 0!==e&&cancelAnimationFrame(e);const n=requestAnimationFrame(()=>{this._scheduled.delete(t),t.call(this)});this._scheduled.set(t,n)}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),null!==this._scrollEndRafId&&cancelAnimationFrame(this._scrollEndRafId),this._scrollEndRafId=requestAnimationFrame(()=>{this._scrollEndRafId=null,this._connected&&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 eo)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(ro)||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,o,r;const a=t.getBoundingClientRect();s=0,i=0,o=window.innerHeight,r=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),o=Math.min(o,t.bottom),r=Math.min(r,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,o-s),m=Math.max(0,r-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:o},r)=>{const a=this._children[r-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===o?null:`${o}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 Ji({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new to({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 co(t){const e=t?parseFloat(t):NaN;return Number.isNaN(e)?0:e}function ho(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 uo=q(class extends dt{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(t,e)=>((t,e)=>x`${e}: ${JSON.stringify(t,null,2)}`)(t,e+this._first),this._keyFunction=(t,e)=>(t=>t)(t,this._first),this._items=[],t.type!==W)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 At(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?C: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 lo({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()}});function fo(t,e,n){return"function"==typeof e?{keyFn:t,template:e,opts:n}:{keyFn:void 0,template:t,opts:e}}function po(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function mo(t,e,n){return new Promise((s,i)=>{const o=[];let r=!1;t.onsuccess=()=>{const i=t.result;if(i){if(e>0&&!r)return r=!0,void i.advance(e);o.push(i.value),null!==n&&o.length>=n?s(o):i.continue()}else s(o)},t.onerror=()=>i(t.error)})}const _o={equals:t=>IDBKeyRange.only(t),greaterThan:t=>IDBKeyRange.lowerBound(t,!0),greaterThanOrEqual:t=>IDBKeyRange.lowerBound(t,!1),lessThan:t=>IDBKeyRange.upperBound(t,!0),lessThanOrEqual:t=>IDBKeyRange.upperBound(t,!1),between:(t,e,n)=>IDBKeyRange.bound(t,e,n?.lowerOpen??!1,n?.upperOpen??!1),startsWith:t=>IDBKeyRange.bound(t,t+"￿",!1,!1)};class go{constructor(t,e,n,s,i,o){this._db=t,this._storeName=e,this._pk=n,this._indexQuery=s,this._indexSort=i,this._page=o}filterByIndex(t,e){return new go(this._db,this._storeName,this._pk,{indexName:t,range:e(_o)},this._indexSort,this._page)}sortByIndex(t,e="asc"){return new go(this._db,this._storeName,this._pk,this._indexQuery,{indexName:t,direction:"desc"===e?"prev":"next"},this._page)}async toArray(){const t=new go(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,null);return yo(await t._run(),t)}async page(t,e){const n=new go(this._db,this._storeName,this._pk,this._indexQuery,this._indexSort,{num:t,size:e});return yo(await n._run(),n)}async _run(){const t=this._db.transaction(this._storeName,"readonly").objectStore(this._storeName),e=null!==this._indexQuery,n=null!==this._indexSort,s=this._page?(this._page.num-1)*this._page.size:0,i=this._page?this._page.size:null;if(!e&&!n)return this._page?mo(t.openCursor(),s,i):po(t.getAll());const o=this._indexQuery.indexName,r=this._indexQuery?.range??null,a=this._indexSort.indexName,l=this._indexSort.direction;if(n&&(!e||o===a)){const n=e?r:null;return mo(t.index(a).openCursor(n,l),s,i)}let c=await po(t.index(o).getAll(r));if(n){const t=a,e="prev"===l?-1:1;c.sort((n,s)=>{const i=n[t],o=s[t];return(i<o?-1:i>o?1:0)*e})}return this._page&&(c=c.slice(s,s+i)),c}}function yo(t,e){const{_db:n,_storeName:s,_pk:i}=e,o=Nn(t,{skipRestrictedContextCheck:!0}),r=o;return r.updateItem=async(t,e)=>{const r=o.get().find(e=>e[i]===t);null!=r&&"object"==typeof r&&(e(r),await po(n.transaction(s,"readwrite").objectStore(s).put(r)),o.update(()=>{}))},r.setItem=async(t,e)=>{await po(n.transaction(s,"readwrite").objectStore(s).put(e)),o.update(n=>{const s=n.findIndex(e=>e[i]===t);-1!==s&&(n[s]=e)})},r.removeItem=async t=>{await po(n.transaction(s,"readwrite").objectStore(s).delete(t)),o.update(e=>{const n=e.findIndex(e=>e[i]===t);-1!==n&&e.splice(n,1)})},r.refresh=async()=>{o.set(await e._run())},Object.defineProperty(r,"name",{value:"dbTableAtom",writable:!0,configurable:!0,enumerable:!1}),r}function wo(t,e,n,s){const i=new go(t,e,n,null,null,null),o=()=>s?s.objectStore(e):t.transaction(e,"readonly").objectStore(e),r=()=>s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e);return{filterByIndex:(t,e)=>i.filterByIndex(t,e),sortByIndex:(t,e)=>i.sortByIndex(t,e),toArray:()=>i.toArray(),page:(t,e)=>i.page(t,e),add:t=>po(r().add(t)),set:async(t,e)=>{await po(r().put(e))},update:async(n,i)=>{const o=s?s.objectStore(e):t.transaction(e,"readwrite").objectStore(e),r=await po(o.get(n));null!=r&&(i(r),await po(o.put(r)))},delete:async t=>{await po(r().delete(t))},clear:async()=>{await po(r().clear())},count:()=>po(o().count()),get:t=>po(o().get(t)),has:async t=>void 0!==await po(o().getKey(t))}}const vo=t=>"function"==typeof t&&!0===t.__isAtom___&&"function"==typeof t.set&&"function"==typeof t.__subscribe,bo=t=>"function"==typeof t,xo=t=>"AsyncFunction"===t.constructor.name,So=(t,e,n,s)=>{if(vo(t)){const i=t,o=Nn(i(),s),r=n(o.set,e),a=n(o.update,e);return o.set=r,o.update=a,i.__subscribe(()=>{Ie.schedule(()=>o.set(i()))}),ve(o,()=>{r.cancel(),a.cancel()}),o}const i=Nn(t,s),o=n(i.set,e),r=n(i.update,e);return i.set=o,i.update=r,ve(i,()=>{o.cancel(),r.cancel()}),i};const Co=(t=[],e)=>{const n=new Map(t),s=Nn(n,e),i=n.set.bind(n);n.set=(t,e)=>(i(t,e),s.update(()=>{}),n);const o=n.delete.bind(n);n.delete=t=>{const e=o(t);return s.update(()=>{}),e};const r=n.clear.bind(n);n.clear=()=>{r(),s.update(()=>{})};const a=n.get.bind(n);n.get=t=>(s.get(),a(t));const l=n.has.bind(n);n.has=t=>(s.get(),l(t));const c=Object.getOwnPropertyDescriptor(Map.prototype,"size");Object.defineProperty(n,"size",{get:()=>(s.get(),c.get.call(n))});const h=n.entries.bind(n);n.entries=()=>(s.get(),h());const u=n.values.bind(n);n.values=()=>(s.get(),u());const d=n.keys.bind(n);n.keys=()=>(s.get(),d());const f=n.forEach.bind(n);n.forEach=(t,e)=>(s.get(),f(t,e));const p=n[Symbol.iterator].bind(n);return n[Symbol.iterator]=()=>(s.get(),p()),n.update=t=>{const e={set:(t,n)=>(i(t,n),e),delete:t=>o(t),clear:()=>{r()},get:t=>a(t),has:t=>l(t),entries:()=>h(),values:()=>u(),keys:()=>d(),forEach:(t,e)=>f(t,e),[Symbol.iterator]:()=>p(),get size(){return c.get.call(n)}};return t(e),s.update(()=>{}),n},n.updateItem=(t,e)=>{const i=a(t);return null==i||"object"!=typeof i||(e(i),s.update(()=>{})),n},Object.defineProperty(n,"__isAtom___",{value:s,writable:!1,enumerable:!1}),Object.defineProperty(n,"__version__",{get:()=>s.__version__,enumerable:!1}),n},Eo="mates";function Ao(t,e){try{null===e?t.removeItem(Eo):t.setItem(Eo,JSON.stringify(e))}catch{}}function ko(t,e){const n=Nn((()=>{try{return function(t){try{const e=t.getItem(Eo);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{Ao(t(),n.get())}catch{}};const i=n.update;return n.update=function(e,s=!1){if(null!==n.get()){i(e,s);try{Ao(t(),n.get())}catch{}}},e(t=>{if(t.key===Eo)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 Mo(t){"undefined"!=typeof window&&window.addEventListener("storage",t)}const $o=ko(()=>localStorage,t=>Mo(e=>{e.storageArea===localStorage&&t(e)})),Ro=ko(()=>sessionStorage,t=>Mo(e=>{e.storageArea===sessionStorage&&t(e)})),To=Nn("undefined"!=typeof document?document.title:"");Jn(()=>{var t;t=To.get(),"undefined"!=typeof document&&(document.title=t)});function Oo(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 Io(t,e,n){const s=jn(t,{skipRestrictedContextCheck:!0,...n}),i=jn([],{skipRestrictedContextCheck:!0,...n});function o(){const t=s.get(),n=e.map(e=>e(t)).filter(t=>null!=t&&""!==t);return i.set(n),n}const r=s.set;s.set=function(t,e=!1){r(t,e),o()};const a=s.update;s.update=function(t,e=!1){a(t,e),o()};const l=s;return Object.defineProperty(l,"__isFormAtom__",{value:!0,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(l,"errors",{get:()=>i.get(),enumerable:!1,configurable:!0}),Object.defineProperty(l,"isValid",{get:()=>0===i.get().length,enumerable:!1,configurable:!0}),l.validate=o,l.toFloat=()=>Oo(s.get()),l.toFloatString=()=>Oo(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 Po(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function zo(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 Do(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 No=t=>{const e=we();if(e&&e.scopes.has(t))throw new Error("Scope already exists for the same class for this component");let n;te.viewOuterInProgress=!0;try{n=new t}finally{te.viewOuterInProgress=!1}const s=te.setupInProgress;try{if((()=>{Do(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){xo(n.setup)&&console.warn("Async setup functions are not supported. Please ensure the setup function is synchronous."),te.setupInProgress=!0;try{n.setup(e?._propsFn||(()=>({})))}catch(t){console.error(t)}finally{te.setupInProgress=s}}e&&e.addScope(t,n),n.__isScope___=!0}catch(t){console.error(t)}finally{te.setupInProgress=s}return n},Lo=t=>{let e=null;const n=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}});if(we().dispatchEvent(n),e)return e;throw new Error(`No parent scope found for ${t.name}`)};function jo(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 Uo=(t,e,n)=>{const s=Do(t);s.forEach(s=>{const i=jo(t,s);if(i?.get){let n,o=-1;const r=i.get;Object.defineProperty(t,s,{get(){const s=e.__version__;return s!==o&&(o=s,n=r.call(t)),n},configurable:!0,enumerable:i.enumerable})}else if(bo(t[s])){if(xo(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=jo(t,n);if(!s)return;const o=!!s.get,r=!o&&bo(s.value);o||r||Object.defineProperty(i,n,{get:()=>e()[n],set(t){e.update(e=>{e[n]=t})},enumerable:!0,configurable:!0})}),i};function Fo(){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)}`}function Vo(){return{list:t=>Promise.resolve(function(){function t(){return[]}return t.get=t=>{},t.has=t=>!1,t.add=async t=>"",t.set=async(t,e)=>{},t.update=async(t,e)=>{},t.deleteRow=async t=>{},t.clear=async()=>{},Object.defineProperty(t,"size",{get:()=>0,enumerable:!0,configurable:!0}),t}())}}const Wo="mini-db",Bo="mini-db:v";function Ho(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}function Yo(t,e,n){return new Promise((s,i)=>{const o=e?indexedDB.open(t,e):indexedDB.open(t);o.onupgradeneeded=()=>n?.(o.result),o.onsuccess=()=>s(o.result),o.onerror=()=>i(o.error),o.onblocked=()=>console.warn("[miniDB] Open blocked — close other connections first.")})}function qo(t){t.current.onversionchange=async()=>{t.current.close(),t.current=await Yo(Wo),qo(t)}}async function Xo(t,e,n){const s=await Ho(t.current.transaction(e,"readonly").objectStore(e).getAll()),i=Co(s.map(t=>[String(t.id),t])),o=n=>Ho(t.current.transaction(e,"readwrite").objectStore(e).put(n));n&&n.addEventListener("message",t=>{const n=t.data;n&&n.store===e&&("set"===n.op?i.set(n.key,n.item):"delete"===n.op?i.delete(n.key):"clear"===n.op&&i.clear())});const r=t=>{try{n?.postMessage(t)}catch{}};function a(){return Array.from(i.values())}return a.get=t=>i.get(t),a.has=t=>i.has(t),a.add=async t=>{const n=String(t.id??Fo()),s={...t,id:n};return await o(s),i.set(n,s),r({store:e,op:"set",key:n,item:s}),n},a.set=async(t,n)=>{const s={...n,id:t};await o(s),i.set(t,s),r({store:e,op:"set",key:t,item:s})},a.update=async(t,n)=>{const s=i.get(t);s&&(i.updateItem(t,n),await o(s),r({store:e,op:"set",key:t,item:s}))},a.deleteRow=async n=>{await(n=>Ho(t.current.transaction(e,"readwrite").objectStore(e).delete(n)))(n),i.delete(n),r({store:e,op:"delete",key:n})},a.clear=async()=>{await Ho(t.current.transaction(e,"readwrite").objectStore(e).clear()),i.clear(),r({store:e,op:"clear"})},Object.defineProperty(a,"size",{get:()=>i.size,enumerable:!0,configurable:!0}),a}function Go(t,e,n,s=!1){document.addEventListener(t,e,{capture:s}),n.addToCleanUps(e,()=>{document.removeEventListener(t,e,{capture:s})})}function Zo(t,e,n,s){let i;if("wheelUp"===t||"wheelDown"===t){const o="wheelUp"===t,r=e,a=t=>{(o?t.deltaY>=0:t.deltaY<=0)||(i&&i(),i=r(t))};return window.addEventListener("wheel",a,{capture:n,passive:!0}),void s.addToCleanUps(e,()=>{window.removeEventListener("wheel",a,{capture:n}),i&&i()})}const o="scroll"===t||"touchstart"===t||"touchmove"===t,r=e,a=t=>{i&&i(),i=r(t)};window.addEventListener(t,a,{capture:n,passive:o}),s.addToCleanUps(e,()=>{window.removeEventListener(t,a,{capture:n}),i&&i()})}function Ko(t,e){Ce()||(ze(),Zo(t,e,!1,we()))}function Qo(t,e){Ce()||(ze(),Zo(t,e,!0,we()))}const Jo=gi((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()),F(e,i),s.appendChild(i),document.body.appendChild(s);const o=document.body.style.overflow;return document.body.style.overflow="hidden",{onUpdate(t){F(t,i)},onCleanup(){s.remove(),document.body.style.overflow=o}}});const tr={position:"fixed",display:"none",margin:"0"},er="9999";function nr(t={}){const{style:e,target:n,zIndex:s=er}=t,i=document.createElement("div");for(const[t,e]of Object.entries(tr))i.style[t]=e;i.style.zIndex=String(s),e&&Object.assign(i.style,e);return{el:i,attach:()=>{i.isConnected||function(t){return t?"string"==typeof t?document.querySelector(t)??document.body:t:document.body}(n).appendChild(i)},detach:()=>{i.isConnected&&i.remove()},isAttached:()=>i.isConnected}}function sr(t,e,n,s,i,o,r){return t.startsWith("top")?s>=n:t.startsWith("bottom")?i>=n:t.startsWith("left")?o>=e:!!t.startsWith("right")&&r>=e}function ir(t,e,n,s,i,o){const r=window.innerWidth,a=function(t){let e=t.parentElement;for(;e&&e!==document.documentElement;){const{overflowY:t}=window.getComputedStyle(e),n="auto"===t||"scroll"===t,s=e.scrollHeight>e.clientHeight;if(n&&s)return e;e=e.parentElement}return null}(t);let l,c;if(a){const t=a.getBoundingClientRect(),n=a.scrollHeight-a.scrollTop-a.clientHeight;c=t.bottom-e.bottom+n-i;const s=a.scrollTop;l=e.top-t.top+s-i}else{const t=window.scrollY||document.documentElement.scrollTop,n=document.documentElement.scrollHeight;l=e.top+t-i,c=n-(e.bottom+t)-i}const h=e.left-i,u=r-e.right-i;if("auto"===o){const t=["bottom-start","top-start","right","left"];for(const e of t)if(sr(e,n,s,l,c,h,u))return e;return"bottom-start"}if(sr(o,n,s,l,c,h,u))return o;const d=function(t){return t.startsWith("top")?t.replace("top","bottom"):t.startsWith("bottom")?t.replace("bottom","top"):t.startsWith("left")?t.replace("left","right"):t.startsWith("right")?t.replace("right","left"):t}(o);return sr(d,n,s,l,c,h,u)?d:o}const or=hi((t,e,n)=>{const s=t.el;let i=!1,o=e,r=n;console.log("[popup] MOUNT — anchor:",s,"destroyOnClose:",!!n.destroyOnClose);const a=nr({...void 0!==r.zIndex?{zIndex:r.zIndex}:{},style:{background:"var(--md-color-surface-raised,#fff)",boxShadow:"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))",minWidth:"160px",...r.style??{}}}),l=a.el;r.destroyOnClose;const c=()=>{const t=s.getBoundingClientRect();l.style.visibility="hidden",l.style.display="block",r.matchAnchorWidth&&(l.style.width=`${t.width}px`);const e=l.offsetWidth,n=l.offsetHeight,i=ir(s,t,e,n,r.gap??4,r.position??"bottom-start");!function(t,e,n,s,i,o){const r=window.innerWidth,a=window.innerHeight;let l=0,c=0;n.startsWith("bottom")?l=e.bottom+o:n.startsWith("top")?l=e.top-o-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+o:n.startsWith("left")?e.left-o-s:e.left:n.endsWith("-end")?c=n.startsWith("right")?e.right+o:n.startsWith("left")?e.left-o-s:e.right-s:n.startsWith("right")?c=e.right+o:n.startsWith("left")&&(c=e.left-o-s);const h=Math.max(4,Math.min(c,r-s-4)),u=Math.max(4,Math.min(l,a-i-4)),d=parseInt(String(h),10),f=parseInt(String(u),10);t.style.left=`${d}px`,t.style.top=`${f}px`}(l,t,i,e,n,r.gap??4),l.style.visibility=""},h=()=>{i&&c()};let u=null;const d=()=>{u?.disconnect(),u=null},f=t=>{const e=t.target;l.contains(e)||s.contains(e)||y()},p=t=>{"Escape"===t.key&&y()},m=t=>"boolean"==typeof t?t:t(),_=()=>void 0!==r.open,g=()=>{i||(i=!0,a.isAttached()||(a.attach(),F(o,l),console.log("[popup] LAZY-ATTACHED to body on open — floating:",l)),c(),r.onOpen?.(l),_()||(document.addEventListener("click",f,{capture:!0}),document.addEventListener("keydown",p)),window.addEventListener("scroll",h,{passive:!0,capture:!0}),window.addEventListener("resize",h,{passive:!0}),r.matchAnchorWidth&&(u=new ResizeObserver(t=>{if(!i)return;const e=t[0]?.borderBoxSize?.[0]?.inlineSize??t[0]?.contentRect.width;null!=e&&(l.style.width=`${e}px`,l.style.minWidth=`${e}px`,h())}),u.observe(s)))},y=()=>{i&&(console.log("[popup] CLOSE — destroyOnClose:",r.destroyOnClose,"floating.isConnected:",l.isConnected,"floating:",l),i=!1,r.destroyOnClose||(l.style.display="none"),r.onClose?.(s,l),r.destroyOnClose&&a.isAttached()&&(console.log("[popup] REMOVED from body in close() — floating:",l),a.detach()),_()||(document.removeEventListener("click",f,{capture:!0}),document.removeEventListener("keydown",p)),window.removeEventListener("scroll",h,{capture:!0}),window.removeEventListener("resize",h),d())},w=t=>{t.stopPropagation(),i?y():g()};return _()?m(r.open)&&g():s.addEventListener("click",w),{onUpdate(t,e){console.log("[popup] UPDATE — isOpen:",i,"anchor:",s);const n=_();if(o=t,r=e,l.isConnected&&F(t,l),e.style&&Object.assign(l.style,e.style),_()){n||s.removeEventListener("click",w);const t=m(e.open);t&&!i?g():!t&&i?y():i&&c()}else n&&s.addEventListener("click",w),i&&c()},onCleanup(){console.log("[popup] CLEANUP — isOpen:",i,"floating.parentNode:",l.parentNode??"NO PARENT","floating.isConnected:",l.isConnected,"floating:",l,"anchor.isConnected:",s.isConnected),i&&y(),d(),_()||s.removeEventListener("click",w),a.detach(),console.log("[popup] CLEANUP DONE — floating still in body?",a.isAttached())}}});const rr=gi((t,e,n)=>{const s=document.createElement("div");if(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),F(e,s),{onUpdate(t){F(t,s)},onCleanup(){s.remove()}}});const ar=1e3,lr=3e4,cr=1/0;var hr,ur,dr,fr,pr,mr;function _r(t){return"number"==typeof t?`${t}px`:t}ur=new WeakMap,dr=new WeakMap,fr=new WeakMap,pr=new WeakMap,hr=new WeakSet,mr=function(t){ce(this,ur,"f")?.remove(),he(this,ur,null,"f"),he(this,dr,"","f"),he(this,fr,"","f"),he(this,pr,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 gr=q(class extends X{constructor(t){if(super(t),hr.add(this),ur.set(this,null),dr.set(this,""),fr.set(this,""),pr.set(this,new Set),t.type!==W)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"),ce(this,hr,"m",mr).call(this,t),C;const s=JSON.stringify(n);if(null===ce(this,ur,"f")||e!==ce(this,dr,"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"),ce(this,hr,"m",mr).call(this,t),C;ce(this,ur,"f")?.remove(),he(this,ur,n,"f"),he(this,dr,e,"f"),he(this,fr,"","f"),he(this,pr,new Set,"f");const s=t.endNode;s.parentNode.insertBefore(ce(this,ur,"f"),s)}if(s!==ce(this,fr,"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,o=e.height??e.size;void 0!==i&&s("width",_r(i)),void 0!==o&&s("height",_r(o)),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 r=[],a=e.width??e.size,l=e.height??e.size;void 0!==a&&r.push(`width:${_r(a)}`),void 0!==l&&r.push(`height:${_r(l)}`),void 0!==e.color&&r.push(`color:${e.color}`),r.push("display:inline-block"),r.push("vertical-align:middle"),e.style&&r.push(e.style),s("style",r.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}(ce(this,ur,"f"),n);for(const e of ce(this,pr,"f"))t.has(e)||ce(this,ur,"f").removeAttribute(e);he(this,pr,t,"f"),he(this,fr,s,"f")}return C}render(t,e){return C}});function yr(t,e={}){return gr(t,e)}let wr=null,vr=null,br=null;function xr(t){wr=t}function Sr(t){vr=t}function Cr(){return vr}function Er(){return wr??-(new Date).getTimezoneOffset()}function Ar(){return br??("undefined"!=typeof navigator?navigator.language:null)??"en"}function kr(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 Mr(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 $r(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 Rr(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 Tr=t=>String(t).padStart(2,"0");function Or(t,e,n){const s={[n]:e};return vr?s.timeZone=vr:(s.timeZone="UTC",t+=6e4*Er()),new Intl.DateTimeFormat(Ar(),s).format(new Date(t))}function Ir(t,e){const n=t>=0?"+":"-",s=Math.abs(t);return e?`${n}${Tr(Math.floor(s/60))}:${Tr(s%60)}`:`${n}${Tr(Math.floor(s/60))}${Tr(s%60)}`}function Pr(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 zr(){try{const t=new Intl.Locale(Ar()),e=t.weekInfo?.firstDay??t.getWeekInfo?.()?.firstDay;if(void 0!==e)return e%7}catch{}return 0}const Dr=/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|H|hh|h|mm|ss|SSS|ZZ|Z|A|a/g,Nr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Lr(t){try{const e=new Date(Date.UTC(2024,0,7+t,12,0,0));return new Intl.DateTimeFormat(Ar(),{weekday:"long",timeZone:"UTC"}).format(e)}catch{return Nr[t]||""}}function jr(t){try{const e=new Date(Date.UTC(2024,t-1,15,12,0,0));return new Intl.DateTimeFormat(Ar(),{month:"long",timeZone:"UTC"}).format(e)}catch{return""}}function Ur(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:o=0,second:r=0,ms:a=0}=t;return Date.UTC(e,n-1,s,i,o,r,a)-6e4*Er()}return NaN}function Fr(t,e,n){const s=Pr(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=Er(),o=Rr(t,i);let r=o.Y,a=o.M,l=o.D;if("year"===s)r+=e;else if("month"===s){const t=a-1+e;r+=Math.floor(t/12),a=(t%12+12)%12+1,l=Math.min(l,new Date(r,a,0).getDate())}else l+="week"===s?7*e:e;return Date.UTC(r,a-1,l,o.h,o.m,o.s,o.ms)-6e4*i}function Vr(t,e){const n=Er(),s=Rr(t,n),i=Rr(e,n);return s.Y===i.Y&&s.M===i.M&&s.D===i.D}function Wr(t){const e=Er(),n=Rr(t,e);return Date.UTC(n.Y,n.M-1,n.D,0,0,0,0)-6e4*e}function Br(t,e){const n=Er(),s=Rr(t,n),i=s.h%12||12,o=[],r=e.replace(/\[([^\]]*)\]/g,(t,e)=>(o.push(e),`\0${o.length-1}\0`));Dr.lastIndex=0;const a=r.replace(Dr,e=>{switch(e){case"YYYY":return String(s.Y);case"YY":return String(s.Y).slice(-2);case"MMMM":return Or(t,"long","month");case"MMM":return Or(t,"short","month");case"MM":return Tr(s.M);case"M":return String(s.M);case"DD":return Tr(s.D);case"D":return String(s.D);case"dddd":return Or(t,"long","weekday");case"ddd":return Or(t,"short","weekday");case"HH":return Tr(s.h);case"H":return String(s.h);case"hh":return Tr(i);case"h":return String(i);case"mm":return Tr(s.m);case"ss":return Tr(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 Ir(n,!0);case"ZZ":return Ir(n,!1);default:return e}});return a.replace(/\0(\d+)\0/g,(t,e)=>o[+e])}const Hr=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60],["second",1]];const Yr=Symbol("ts"),qr=Object.create(Number.prototype);function Xr(t){return function(t){const e=Object.create(qr);return e[Yr]=t,e}(void 0===t?Date.now():Ur(t))}Object.defineProperties(qr,{valueOf:{value(){return this[Yr]},writable:!1,configurable:!1},values:{get(){const t=this[Yr],e=Rr(t,Er());return{year:e.Y,month:e.M,monthName:jr(e.M),dayName:Lr(e.wd),date:e.D,weekStartDayName:Lr(zr()),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[Yr];return Number.isFinite(t)?new Date(t).toISOString():"Invalid Date"},writable:!1,configurable:!1},toString:{value(){const t=this[Yr];return Number.isFinite(t)?new Intl.DateTimeFormat(Ar(),{dateStyle:"medium",...Cr()?{timeZone:Cr()}:{timeZone:"UTC"}}).format(new Date(Cr()?t:t+6e4*Er())):"Invalid Date"},writable:!1,configurable:!1},format:{value(t){return Br(this[Yr],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?Ur(e.now):Date.now())-t)/1e3,o=Math.abs(i),r=i>=0?-1:1,a=new Intl.RelativeTimeFormat(Ar(),{numeric:n,style:s});for(const[t,e]of Hr)if(o>=e)return a.format(r*Math.round(o/e),t);return a.format(0,"second")}(this[Yr],t)},writable:!1,configurable:!1},add:{value(t,e){return this[Yr]=Fr(this[Yr],t,e),this},writable:!1,configurable:!1},subtract:{value(t,e){return this[Yr]=Fr(this[Yr],-t,e),this},writable:!1,configurable:!1},isBefore:{value(t){return this[Yr]<Ur(t)},writable:!1,configurable:!1},isAfter:{value(t){return this[Yr]>Ur(t)},writable:!1,configurable:!1},isFuture:{value(){return this[Yr]>Date.now()},writable:!1,configurable:!1},isPresent:{value(){return Vr(this[Yr],Date.now())},writable:!1,configurable:!1},isToday:{value(){return Vr(this[Yr],Date.now())},writable:!1,configurable:!1},isYesterday:{value(){const t=Fr(Wr(Date.now()),-1,"day");return Vr(this[Yr],t)},writable:!1,configurable:!1},isTomorrow:{value(){const t=Fr(Wr(Date.now()),1,"day");return Vr(this[Yr],t)},writable:!1,configurable:!1},getDifference:{value(t,e){return function(t,e,n){const s=Pr(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 o=Er(),r=Rr(t,o),a=Rr(e,o);if("day"===s||"week"===s){const n=Math.floor((t+6e4*o)/864e5)-Math.floor((e+6e4*o)/864e5);return"week"===s?Math.trunc(n/7):n}return"month"===s?12*(r.Y-a.Y)+(r.M-a.M):r.Y-a.Y}(this[Yr],Ur(t),e)},writable:!1,configurable:!1},getAge:{value(t){return function(t,e){const n=Er(),s=Rr(t,n),i=Rr(e,n);let o=i.Y-s.Y,r=s.M,a=s.D;if(2===r&&29===a){const t=t=>t%4==0&&t%100!=0||t%400==0;t(i.Y)||(r=3,a=1)}return(i.M<r||i.M===r&&i.D<a)&&o--,Math.max(0,o)}(this[Yr],void 0!==t?Ur(t):Date.now())},writable:!1,configurable:!1}}),exports.$=ri,exports.Context=class{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}},exports.Delete=t=>Ys.Delete(js(t)),exports.ErrorTypes=zs,exports.Fetch=t=>Ys.fetch(js(t)),exports.FetchClient=Hs,exports.Get=t=>Ys.Get(js(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=pe,exports.Patch=t=>Ys.Patch(js(t)),exports.Post=t=>Ys.Post(js(t)),exports.Put=t=>Ys.Put(js(t)),exports.Router=(t,e)=>{const n=t.find(t=>ys(t.path));if(void 0===n)return e?()=>is(e):()=>E;const{component:s}=n;return()=>is(s)},exports.SyncNotificationManager=me,exports.ZeroPromise=Ps,exports._=je,exports._hydrationCounter=Ds,exports._subToView=Ue,exports.action=function(t){ee("Action");let e=t;const n=new Set;let s=null,i=null;const o=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})};return Object.assign(function(...t){return((t,n)=>{try{let r;return r=s?s((...n)=>e.call(t,...n),...n):e.call(t,...n),i&&(r=i(r)),o(r),r}catch(t){const e=t instanceof Error?t:new Error(String(t));throw o(void 0),e}})(this,t)},{val:()=>e,set:t=>{e=t},__isAction___:!0,__subscribe:t=>(ee("subscribe"),n.add(t),()=>n.delete(t)),interceptBefore:t=>{s=t},interceptAfter:t=>{i=t}})},exports.addStoreBeingRead=Yt,exports.animatedIf=li,exports.animatedRouter=function(t,e={}){return is(ws,{routes:t,options:e})},exports.animatedX=function(t,e,n){const{show:s,...i}=n;return li(s,x`<x-view .view=${t} .props=${e}></x-view>`,E,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=ne,exports.assertNotInRestrictedContext=ee,exports.asyncAction=Bn,exports.asyncAppend=gt,exports.asyncReplace=_t,exports.atom=Nn,exports.attr=function(t){return ui(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=vs,exports.buildRequestUrl=Us,exports.cacheAtom=function(t){const e=new Map,n=new Map,s=Nn(e,t),i=s.get.bind(s),o=s;return o.add=(t,i,o)=>{if(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),s.update(e=>{e.set(t,i)}),void 0!==o&&-1!==o&&o>0){const i=setTimeout(()=>{e.delete(t),n.delete(t),s.update(()=>{})},o);n.set(t,i)}},o.get=t=>(i(),e.get(t)),o.remove=t=>!!e.has(t)&&(n.has(t)&&(clearTimeout(n.get(t)),n.delete(t)),e.delete(t),s.update(()=>{}),!0),o.has=t=>(i(),e.has(t)),o.getAll=()=>(i(),Array.from(e.values())),o.clearAll=()=>{n.forEach(t=>clearTimeout(t)),n.clear(),e.clear(),s.update(()=>{})},Object.defineProperty(o,"size",{get:()=>(i(),e.size),enumerable:!0,configurable:!0}),Object.defineProperty(o,"name",{get:()=>"cacheAtom",enumerable:!0,configurable:!0}),ve(s,o.clearAll),o},exports.cacheFn=Vn,exports.changeFlagAtom=function(t=0,e){const n=Nn(t,e),s=n;return s.change=t=>{n.set(void 0!==t?t:Math.random())},s.name="changeFlagAtom",s},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.classMap=vt,exports.classes=function(t){return di(t)},exports.cleanupScheduler=Oe,exports.clearInterceptors=()=>{Vs.clear(),Ws.clear(),Bs.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.collectSSRStyles=function(){return""},exports.componentRunningStatus=te,exports.computeAutoPlacement=function(t,e,n,s){const i=window.innerHeight-t.bottom-s,o=t.top-s,r=window.innerWidth-t.right-s,a=t.left-s;return i>=n?"bottom":o>=n?"top":r>=e?"right":a>=e?"left":[["bottom",i],["top",o],["right",r],["left",a]].reduce((t,e)=>e[1]>t[1]?e:t)[0]},exports.configureCSS=function(t){t.breakpoints&&Object.assign(Je,t.breakpoints)},exports.countdown=pi,exports.createCacheManager=Vn,exports.createFloatingContainer=nr,exports.createManagedTimer=Hn,exports.createPollingManager=Wn,exports.createReactiveRunner=zn,exports.createTimedAtom=So,exports.date=Xr,exports.debounce=Gn,exports.debouncedAtom=(t,e,n)=>So(t,e,Gn,n),exports.decrementSsrAsyncCounter=$e,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=On,exports.delayAtom=function(t,e,n){const s=new Set;function i(t){const n=setTimeout(()=>{s.delete(n),t()},e);s.add(n)}function o(){for(const t of s)clearTimeout(t);s.clear()}if(vo(t)){const e=t,s=Nn(e(),n),r=s.set.bind(s),a=s.update.bind(s);return s.set=(t,e)=>{i(()=>r(t,e))},s.update=(t,e)=>{i(()=>a(t,e))},e.__subscribe(()=>{const t=e();i(()=>r(t))}),ve(s,o),s}const r=Nn(t,n),a=r.set.bind(r),l=r.update.bind(r);return r.set=(t,e)=>{i(()=>a(t,e))},r.update=(t,e)=>{i(()=>l(t,e))},ve(r,o),r},exports.deleteAction=t=>Ys.deleteAction(t),exports.df=On,exports.dialog=function(t,e){return Jo(t,e)},exports.disappear=mi,exports.done=function(){if(!Se||!Ae)return;null!==ke&&(clearTimeout(ke),ke=null);const t=Ae;Ae=null,t()},exports.effect=Jn,exports.effectScheduler=Ie,exports.eleHook=hi,exports.event=be,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=Mn,exports.fadeOutPreset=$n,exports.fetchAction=t=>Ys.fetchAction(t),exports.fetchClient=Ys,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)=>Io(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=>Ys.getAction(t),exports.getAllProps=Do,exports.getAllTimezones=function(){let t;try{t=Intl.supportedValuesOf("timeZone")}catch{return[]}const e=Date.now();return t.map(t=>({name:t,longName:$r(t,e),shortName:Mr(t,e),offset:kr(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=Xr({year:t,month:e,day:1}),{year:s,month:i,numberOfDaysOfTheMonth:o}=n.values,r=[];for(let t=Rr(n.valueOf(),Er()).wd;t>0;t--)r.push(Xr({year:s,month:i,day:1-t}));for(let t=1;t<=o;t++)r.push(Xr({year:s,month:i,day:t}));const a=r.length%7,l=0===a?0:7-a,c=Xr({year:s,month:i,day:o});for(let t=0;t<l;t++)c.add(1,"day"),r.push(Xr(c.valueOf()));const h=[];for(let t=0;t<r.length;t+=7)h.push(r.slice(t,t+7));return h},exports.getCookieObj=function(){if("undefined"==typeof document)return{};const t=document.cookie;if(!t)return{};const e={};for(const n of t.split(";")){const t=n.indexOf("=");if(-1===t)continue;const s=n.slice(0,t).trim();if(!s)continue;const i=n.slice(t+1).trim();try{e[s]=decodeURIComponent(i)}catch{e[s]=i}}return e},exports.getCoords=function(t,e,n){const s=t=>parseInt(String(t),10);switch(e){case"top":case"top-start":return{top:s(t.top-n),left:s(t.left)};case"top-end":return{top:s(t.top-n),left:s(t.right)};case"bottom":case"bottom-start":default:return{top:s(t.bottom+n),left:s(t.left)};case"bottom-end":return{top:s(t.bottom+n),left:s(t.right)};case"right":case"right-start":return{top:s(t.top),left:s(t.right+n)};case"right-end":return{top:s(t.bottom),left:s(t.right+n)};case"left":case"left-start":return{top:s(t.top),left:s(t.left-n)};case"left-end":return{top:s(t.bottom),left:s(t.left-n)}}},exports.getCurrentHost=we,exports.getLocale=function(){return Ar()},exports.getMonths=function(t){const e=t??Ar(),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=Lo,exports.getScope=Lo,exports.getSsrAsyncCounter=function(){return Ee},exports.getStoresBeingRead=function(){return Wt.storesBeingRead},exports.getTimezoneOffset=function(){return Er()},exports.globalCSS=Cn,exports.globalScheduler=Pe,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],o=[];o.push(Ks(":root",i));for(const n of e)o.push(Ks(`[data-theme="${n}"]`,t[n]));void 0!==s&&o.push(function(t){let e="";for(const n in t)e+=` ${Zs(n)}: ${t[n]};\n`;return e?`@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n${e} }\n}`:""}(t[s])),Sn();const r=xn(),a=o.filter(Boolean).join("\n");a&&r.appendRules(a);const l=Object.create(null);for(const t in i)l[t]=Zs(t);return{cssVars:Object.freeze(l),themeAtom:Gs}},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.guard=xt,exports.hashAtom=xs,exports.historyStateAtom=cs,exports.html=x,exports.htmlHook=gi,exports.hydrationPending=function(){return Ds()},exports.iAtom=Ln,exports.ifDefined=t=>t??E,exports.incHydration=Ns,exports.incrementSsrAsyncCounter=Me,exports.indexDB=function(t,e){return Ce()?Promise.reject(new Error("[indexDB] IndexedDB is not available in SSR environments.")):new Promise((n,s)=>{const i=indexedDB.open(t,e.version);i.onupgradeneeded=t=>{const n=i.result,s=i.transaction;e.upgrade&&e.upgrade(function(t,e){return{createTable(e,n,s=[]){if(t.objectStoreNames.contains(e))return;const i=t.createObjectStore(e,{keyPath:n});for(const t of s)i.createIndex(t,t,{unique:!1})},addIndex(n,s,i){if(!t.objectStoreNames.contains(n))return;const o=e.objectStore(n);o.indexNames.contains(s)||o.createIndex(s,s,i??{unique:!1})},removeIndex(n,s){if(!t.objectStoreNames.contains(n))return;const i=e.objectStore(n);i.indexNames.contains(s)&&i.deleteIndex(s)},dropTable(e){t.objectStoreNames.contains(e)&&t.deleteObjectStore(e)}}}(n,s),t.oldVersion)},i.onsuccess=()=>{const e=i.result;e.onversionchange=()=>{e.close(),console.warn(`[indexDB] "${t}" connection closed — version change detected. Reload the page to upgrade.`)};const s={table:(t,n)=>wo(e,t,n),transaction:(t,n)=>new Promise((s,i)=>{const o=e.transaction(t,"readwrite"),r={table:(t,n)=>wo(e,t,n,o)};o.oncomplete=()=>s(),o.onerror=()=>i(o.error),o.onabort=()=>i(new Error(`[indexDB] Transaction on [${t.join(", ")}] aborted`)),n(r).catch(t=>{try{o.abort()}catch{}i(t)})}),close(){e.close()}};n(s)},i.onerror=()=>s(i.error),i.onblocked=()=>{console.warn(`[indexDB] Opening "${t}" is blocked — close other connections first.`)}})},exports.injectMatesAnimations=kn,exports.installDevToolsHooks=function(t){t.registerComponent&&(Dt.registerComponent=t.registerComponent),t.unregisterComponent&&(Dt.unregisterComponent=t.unregisterComponent),t.notifyRender&&(Dt.notifyRender=t.notifyRender),t.getComponentName&&(Dt.getComponentName=t.getComponentName),t.logComponentMount&&(Dt.logComponentMount=t.logComponentMount),t.logComponentRender&&(Dt.logComponentRender=t.logComponentRender),t.logComponentUnmount&&(Dt.logComponentUnmount=t.logComponentUnmount),t.logAtomSet&&(Dt.logAtomSet=t.logAtomSet),t.logAtomUpdate&&(Dt.logAtomUpdate=t.logAtomUpdate),t.logEventTrigger&&(Dt.logEventTrigger=t.logEventTrigger),t.logCleanupEventTrigger&&(Dt.logCleanupEventTrigger=t.logCleanupEventTrigger),t.logFetchRequest&&(Dt.logFetchRequest=t.logFetchRequest),t.logFetchResponse&&(Dt.logFetchResponse=t.logFetchResponse),t.logFetchError&&(Dt.logFetchError=t.logFetchError),t.recordRender&&(Dt.recordRender=t.recordRender)},exports.interceptAfter=t=>Fs(Ws,t),exports.interceptBefore=t=>Fs(Vs,t),exports.interceptError=t=>Fs(Bs,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=xo,exports.isAsyncValue=We,exports.isAtom=vo,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.isDev=Re,exports.isDevToolsInstalled=Ft,exports.isEffectRunning=Ht,exports.isEmail=t=>(t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))(t)?null:"Invalid email",exports.isEmpty=zo,exports.isEvent=t=>"object"==typeof t&&null!==t&&!0===t.__isEvent___&&"function"==typeof t.__subscribe&&"function"==typeof t.trigger,exports.isFunction=bo,exports.isGetter=t=>"function"==typeof t&&!0===t.__isSelector___&&"function"==typeof t.areVersionsChanged,exports.isInRestrictedContext=function(){return!te.isHookRunning&&(te.templateInProgress||Ht())},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=ys,exports.isPattern=(t,e="Invalid format")=>n=>((t,e)=>e.test(t))(n,t)?null:e,exports.isReadTrackingEnabled=Bt,exports.isRequired=t=>(t=>"number"==typeof t||"boolean"==typeof t||!zo(t))(t)?null:"Required",exports.isSSR=Ce,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 o=e[i];null!==o&&"object"==typeof o&&t(o,n)}},exports.join=
171
171
  /**
172
172
  * @license
173
173
  * Copyright 2021 Google LLC
174
174
  * SPDX-License-Identifier: BSD-3-Clause
175
175
  */
176
- function*(t,e){const n="function"==typeof e;if(void 0!==t){let s=-1;for(const i of t)s>-1&&(yield n?e(s):e),s++,yield i}},exports.keyed=St,exports.keyframes=function(t,e){if(pn("keyframes"),Ce())return t;Sn();const n=_n(t);return vn.appendRules(gn(n,e)),n},exports.lazyLoad=function(t,e){return _i(t,e)},exports.litCache=wt,exports.live=Ct,exports.location=$s,exports.lockNavigation=us,exports.log=function(t,e){ae({level:"log",message:t,data:void 0!==e?oe(e):void 0,ts:performance.now()}),re()&&(void 0!==e?console.log(t,e):console.log(t))},exports.logError=le,exports.logWarning=function(t,e){ae({level:"warn",message:t,data:void 0!==e?oe(e):void 0,ts:performance.now()}),re()&&(void 0!==e?console.warn(t,e):console.warn(t))},exports.lsAtom=Ao,exports.mapAtom=bo,exports.masonryGrid=function(t,e,n,s){return wi(t,e,n,s)},exports.matesLogEvent=ie,exports.maxLength=t=>e=>((t,e)=>t.length<=e)(e,t)?null:`Max ${t} characters`,exports.memo=function(t){let e;return zn({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):(e=Nn(void 0,{skipRestrictedContextCheck:!0}),e.set(()=>t,!0))}}),e},exports.memoTemplate=function(t,e){return xi(t,e)},exports.merge=function t(e,...n){const s={...e};for(const e of n)for(const n of Object.keys(e))To(s[n])&&To(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.miniDB=async function(t=1,e){if(Ce())return jo();const n={current:await Wo(Uo)};Bo(n);const s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(Uo):null,i=function(){try{return parseInt(localStorage.getItem(Fo)??"0",10)||0}catch{return 0}}();if(i!==t){if(e){const s=[];e(i,t,{clear:t=>s.push(t)});for(const t of s)n.current.objectStoreNames.contains(t)&&await Vo(n.current.transaction(t,"readwrite").objectStore(t).clear())}!function(t){try{localStorage.setItem(Fo,String(t))}catch{}}(t)}const o=new Map;return{async list(t){if(o.has(t))return o.get(t);n.current.objectStoreNames.contains(t)||(n.current=await async function(t,e){const n=t.name,s=t.version+1;return t.close(),Wo(n,s,t=>{t.objectStoreNames.contains(e)||t.createObjectStore(e,{keyPath:"id"})})}(n.current,t),Bo(n));const e=await Ho(n,t,s);return o.set(t,e),e}}},exports.navigateTo=ps,exports.navigationLocked=hs,exports.navigationRequestEvent=ms,exports.noChange=C,exports.nothing=E,exports.omit=function(t,e){const n={...t};for(const t of e)delete n[t];return n},exports.on=Fe,exports.onAllMount=t=>{ze(),t.__isOnAllMount__=!0;const e=we();e.addToCleanUps(t,De),Pe.onceIdle(()=>{if(!e.isConnected)return;const n=t();n&&e.addToCleanUps(t,n)})},exports.onBlur=t=>{Xo("blur",t)},exports.onCleanup=t=>{ze(),t.__isOnCleanup__=!0;we().addToCleanUps(t,t)},exports.onClickAway=t=>{if(Ce())return;ze();const e=we(!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 gi(t)},exports.onCopy=t=>{Xo("copy",t)},exports.onCut=t=>{Xo("cut",t)},exports.onDOMReady=t=>{const e=we();if(!e)throw new Error("onDOMReady must be called within a component context");return e.DOMReadyEvent.__subscribe(t)},exports.onDisconnect=function(t){return yi(t)},exports.onEleEvent=function(t,e){return hi(t,e)},exports.onError=t=>{ze();const e=we();e._errorHandlers||(e._errorHandlers=[]),e._errorHandlers.push(t)},exports.onEvent=function(t){return Ri(t)},exports.onFileDrop=t=>{if(Ce())return;ze();const e=we();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=>{Xo("focus",t)},exports.onHidden=function(t,e){return mi({onHidden:t,...e})},exports.onIntersect=function(t){return mi(t)},exports.onInterval=(t,e)=>{if(Ce())return;ze();const n=we();let s;const i=setInterval(()=>{s&&s(),s=t()},e);n.addToCleanUps(t,()=>{clearInterval(i),s&&s()})},exports.onKeyDown=t=>{Xo("keydown",t)},exports.onKeyUp=t=>{Xo("keyup",t)},exports.onMount=Ne,exports.onNavigate=t=>{if(Ce())return;ze();const e=we();let n;const s=_s.__subscribe(()=>{n&&n(),n=t(_s.get())||null});e.addToCleanUps(t,()=>{s(),n&&n()})},exports.onNavigationRequest=t=>{if(Ce())return;ze();let e=!1;const n=ms.__subscribe(n=>{if(e)return;const{to:s,from:i}=n;us();let o=!1;const r=t({to:s,from:i,next:()=>{o||(o=!0,e=!0,ds(),fs(()=>{ps(s),e=!1}))}});r instanceof Promise?r.then(()=>{o||ds()}).catch(()=>{o||ds()}):o||ds()});ve(t,n)},exports.onOffline=t=>{Xo("offline",t)},exports.onOnline=t=>{Xo("online",t)},exports.onPaint=t=>{ze(),t.__isOnPaint__=!0;const e=we();e.addToCleanUps(t,De),e.PaintEvent.__subscribe(()=>t())},exports.onParent=function(t,e){return Ti(t,e)},exports.onPaste=t=>{Xo("paste",t)},exports.onReferenceChange=(t,e)=>{const n=we();if(ze(),!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(Ce())return;ze();const n=we();let s;const i=new ResizeObserver(e=>{for(const n of e)s&&s(),s=t(n)}),o=e||n;i.observe(o),n.addToCleanUps(t,()=>{i.disconnect(),s&&s()})},exports.onScroll=(t,e=window)=>{if(Ce())return;ze();const n=we();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 _i(t,e)},exports.onSelectionChange=t=>{if(Ce())return;ze();let e;Yo("selectionchange",()=>{e&&e(),e=t(window.getSelection())},we())},exports.onSocket=function(t,e){ze();const n=we(),s=e.map(e=>e.__subscribe(t));n.addToCleanUps(t,()=>{s.forEach(t=>t())})},exports.onStorageChange=t=>{Xo("storage",t)},exports.onTimeout=(t,e)=>{if(Ce())return;ze();const n=we();let s;const i=setTimeout(()=>{s=t()},e);n.addToCleanUps(t,()=>{clearTimeout(i),s&&s()})},exports.onUpdate=t=>{ze();const e=we();let n;e.onEachUpdate(()=>{n&&n(),n=t()}),e.addToCleanUps(t,()=>{n&&n()})},exports.onVisibilityChange=t=>{if(Ce())return;ze();let e;Yo("visibilitychange",()=>{e&&e(),e=t(document.hidden)},we())},exports.onVisible=function(t,e){return mi({onVisible:t,...e})},exports.onWindow=Xo,exports.onWindowCapture=Go,exports.onWindowResize=t=>{Xo("resize",t)},exports.onWindowScroll=t=>{Go("scroll",t)},exports.onceIdle=fs,exports.paginatedAsyncAction=function(t,e){const n=!!e?.allowInRestrictedContext,s=Bn(t,e),i=Nn(1,{skipRestrictedContextCheck:n}),o=Nn(-1,{skipRestrictedContextCheck:n});return Object.assign(s,{page:i,totalPages:o,next:(...t)=>{if(!(-1!==o.val&&i.val>=o.val))return i.update(t=>t+1),s(...t)}})},exports.paginationAtom=(t=1,e)=>{const n=Nn(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=>Ws.patchAction(t),exports.pathAtom=_s,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=Xt,exports.popup=function(t,e){return nr(t,"string"==typeof e?{position:e}:e??{})},exports.portal=function(t,e){return sr(t,e)},exports.postAction=t=>Ws.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=qt,exports.putAction=t=>Ws.putAction(t),exports.qsAtom=As,exports.randomId=Lo,exports.range=
176
+ function*(t,e){const n="function"==typeof e;if(void 0!==t){let s=-1;for(const i of t)s>-1&&(yield n?e(s):e),s++,yield i}},exports.keyed=St,exports.keyframes=function(t,e){if(pn("keyframes"),Ce())return t;Sn();const n=_n(t);return vn.appendRules(gn(n,e)),n},exports.lazyLoad=function(t,e){return wi(t,e)},exports.litCache=wt,exports.live=Ct,exports.location=$s,exports.lockNavigation=us,exports.log=function(t,e){ae({level:"log",message:t,data:void 0!==e?oe(e):void 0,ts:performance.now()}),re()&&(void 0!==e?console.log(t,e):console.log(t))},exports.logError=le,exports.logWarning=function(t,e){ae({level:"warn",message:t,data:void 0!==e?oe(e):void 0,ts:performance.now()}),re()&&(void 0!==e?console.warn(t,e):console.warn(t))},exports.lsAtom=$o,exports.mapAtom=Co,exports.masonryGrid=function(t,e,n,s){return xi(t,e,n,s)},exports.matesLogEvent=ie,exports.maxLength=t=>e=>((t,e)=>t.length<=e)(e,t)?null:`Max ${t} characters`,exports.memo=function(t){let e;return zn({name:"Memo",fn:t,onRun:t=>{e?e.set(()=>t):(e=Nn(void 0,{skipRestrictedContextCheck:!0}),e.set(()=>t,!0))}}),e},exports.memoTemplate=function(t,e){return Ei(t,e)},exports.merge=function t(e,...n){const s={...e};for(const e of n)for(const n of Object.keys(e))Po(s[n])&&Po(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.miniDB=async function(t=1,e){if(Ce())return Vo();const n={current:await Yo(Wo)};qo(n);const s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(Wo):null,i=function(){try{return parseInt(localStorage.getItem(Bo)??"0",10)||0}catch{return 0}}();if(i!==t){if(e){const s=[];e(i,t,{clear:t=>s.push(t)});for(const t of s)n.current.objectStoreNames.contains(t)&&await Ho(n.current.transaction(t,"readwrite").objectStore(t).clear())}!function(t){try{localStorage.setItem(Bo,String(t))}catch{}}(t)}const o=new Map;return{async list(t){if(o.has(t))return o.get(t);n.current.objectStoreNames.contains(t)||(n.current=await async function(t,e){const n=t.name,s=t.version+1;return t.close(),Yo(n,s,t=>{t.objectStoreNames.contains(e)||t.createObjectStore(e,{keyPath:"id"})})}(n.current,t),qo(n));const e=await Xo(n,t,s);return o.set(t,e),e}}},exports.navigateTo=ps,exports.navigationLocked=hs,exports.navigationRequestEvent=ms,exports.noChange=C,exports.nothing=E,exports.omit=function(t,e){const n={...t};for(const t of e)delete n[t];return n},exports.on=Fe,exports.onAllMount=t=>{ze(),t.__isOnAllMount__=!0;const e=we();e.addToCleanUps(t,De),Pe.onceIdle(()=>{if(!e.isConnected)return;const n=t();n&&e.addToCleanUps(t,n)})},exports.onBlur=t=>{Ko("blur",t)},exports.onCleanup=t=>{ze(),t.__isOnCleanup__=!0;we().addToCleanUps(t,t)},exports.onClickAway=t=>{if(Ce())return;ze();const e=we(!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 vi(t)},exports.onCopy=t=>{Ko("copy",t)},exports.onCut=t=>{Ko("cut",t)},exports.onDOMReady=t=>{const e=we();if(!e)throw new Error("onDOMReady must be called within a component context");return e.DOMReadyEvent.__subscribe(t)},exports.onDisconnect=function(t){return bi(t)},exports.onEleEvent=function(t,e){return fi(t,e)},exports.onError=t=>{ze();const e=we();e._errorHandlers||(e._errorHandlers=[]),e._errorHandlers.push(t)},exports.onEvent=function(t){return Ii(t)},exports.onFileDrop=t=>{if(Ce())return;ze();const e=we();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=>{Ko("focus",t)},exports.onHidden=function(t,e){return yi({onHidden:t,...e})},exports.onIntersect=function(t){return yi(t)},exports.onInterval=(t,e)=>{if(Ce())return;ze();const n=we();let s;const i=setInterval(()=>{s&&s(),s=t()},e);n.addToCleanUps(t,()=>{clearInterval(i),s&&s()})},exports.onKeyDown=t=>{Ko("keydown",t)},exports.onKeyUp=t=>{Ko("keyup",t)},exports.onMount=Ne,exports.onNavigate=t=>{if(Ce())return;ze();const e=we();let n;const s=_s.__subscribe(()=>{n&&n(),n=t(_s.get())||null});e.addToCleanUps(t,()=>{s(),n&&n()})},exports.onNavigationRequest=t=>{if(Ce())return;ze();let e=!1;const n=ms.__subscribe(n=>{if(e)return;const{to:s,from:i}=n;us();let o=!1;const r=t({to:s,from:i,next:()=>{o||(o=!0,e=!0,ds(),fs(()=>{ps(s),e=!1}))}});r instanceof Promise?r.then(()=>{o||ds()}).catch(()=>{o||ds()}):o||ds()});ve(t,n)},exports.onOffline=t=>{Ko("offline",t)},exports.onOnline=t=>{Ko("online",t)},exports.onPaint=t=>{ze(),t.__isOnPaint__=!0;const e=we();e.addToCleanUps(t,De),e.PaintEvent.__subscribe(()=>t())},exports.onParent=function(t,e){return Pi(t,e)},exports.onPaste=t=>{Ko("paste",t)},exports.onReferenceChange=(t,e)=>{const n=we();if(ze(),!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(Ce())return;ze();const n=we();let s;const i=new ResizeObserver(e=>{for(const n of e)s&&s(),s=t(n)}),o=e||n;i.observe(o),n.addToCleanUps(t,()=>{i.disconnect(),s&&s()})},exports.onScroll=(t,e=window)=>{if(Ce())return;ze();const n=we();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 wi(t,e)},exports.onSelectionChange=t=>{if(Ce())return;ze();let e;Go("selectionchange",()=>{e&&e(),e=t(window.getSelection())},we())},exports.onSocket=function(t,e){ze();const n=we(),s=e.map(e=>e.__subscribe(t));n.addToCleanUps(t,()=>{s.forEach(t=>t())})},exports.onStorageChange=t=>{Ko("storage",t)},exports.onTimeout=(t,e)=>{if(Ce())return;ze();const n=we();let s;const i=setTimeout(()=>{s=t()},e);n.addToCleanUps(t,()=>{clearTimeout(i),s&&s()})},exports.onUpdate=t=>{ze();const e=we();let n;e.onEachUpdate(()=>{n&&n(),n=t()}),e.addToCleanUps(t,()=>{n&&n()})},exports.onVisibilityChange=t=>{if(Ce())return;ze();let e;Go("visibilitychange",()=>{e&&e(),e=t(document.hidden)},we())},exports.onVisible=function(t,e){return yi({onVisible:t,...e})},exports.onWindow=Ko,exports.onWindowCapture=Qo,exports.onWindowResize=t=>{Ko("resize",t)},exports.onWindowScroll=t=>{Qo("scroll",t)},exports.onceIdle=fs,exports.paginatedAsyncAction=function(t,e){const n=!!e?.allowInRestrictedContext,s=Bn(t,e),i=Nn(1,{skipRestrictedContextCheck:n}),o=Nn(-1,{skipRestrictedContextCheck:n});return Object.assign(s,{page:i,totalPages:o,next:(...t)=>{if(!(-1!==o.val&&i.val>=o.val))return i.update(t=>t+1),s(...t)}})},exports.paginationAtom=(t=1,e)=>{const n=Nn(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=>Ys.patchAction(t),exports.pathAtom=_s,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=Xt,exports.popup=function(t,e){return or(t,"string"==typeof e?{position:e}:e??{})},exports.portal=function(t,e){return rr(t,e)},exports.postAction=t=>Ys.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=qt,exports.putAction=t=>Ys.putAction(t),exports.qsAtom=As,exports.randomId=Fo,exports.range=
177
177
  /**
178
178
  * @license
179
179
  * Copyright 2021 Google LLC
180
180
  * SPDX-License-Identifier: BSD-3-Clause
181
181
  */
182
- function*(t,e,n=1){const s=void 0===e?0:t;e??=t;for(let t=s;n>0?t<e:e<t;t+=n)yield t},exports.ref=ns,exports.registerCleanup=ve,exports.removeAttr=function(t){},exports.removeClasses=function(t){},exports.removeOn=function(t){Mi.get(t)?.()},exports.removeStyle=function(t){},exports.render=F,exports.renderSwitch=function(t){for(const e of t){if(!Array.isArray(e))return e;{const[t,n]=e;if(t)return n}}return E},exports.renderTemplate=ls,exports.renderX=as,exports.repeat=At,exports.replaceParams=function(t,e){if("undefined"==typeof window)return;const n=_s.get(),s=t.split("/"),i=n.split("/");if(s.length!==i.length)return void console.warn(`replaceParams: pattern "${t}" has ${s.length} segments but current path "${n}" has ${i.length}. No-op.`);const o=new Set(s.filter(t=>t.startsWith(":")).map(t=>t.slice(1)));for(const n of Object.keys(e))o.has(n)||console.warn(`replaceParams: param "${n}" not found in pattern "${t}".`);const r=i.map((t,n)=>{const i=s[n];if(!i.startsWith(":"))return t;const o=i.slice(1);return o in e?String(e[o]):t}),a=r.join("/");a!==n&&ps(a,!0)},exports.resetComponentState=Te,exports.resolveAsyncValue=Be,exports.restoreTracking=Zt,exports.rootCSS=function(t){Sn();const e=xn(),n=Xs(":root",t);return n&&e.appendRules(n),t},exports.route=(t,{view:e})=>ys(t)?e?os(e,{}):E:null,exports.runWithGlobalInterceptors=async function(t,e){let n,s=t,i=e;for(const t of js){const e=await t(s,i);s=e.url,i=e.options}try{n=await fetch(s,i)}catch(t){for(const e of Fs)try{e(t)}catch{}throw t}for(const t of Us)n=await t(n);if(!n.ok){const t=new Error(`${n.status} ${n.statusText}`);for(const e of Fs)try{e(t)}catch{}}return n},exports.safeClone=oe,exports.safeSVG=mr,exports.safetyCheck=ze,exports.saveAndEnableTracking=Gt,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=Po,exports.setAtom=(t=[],e)=>{const n=new Set(t),s=Nn(n,e),i=n.add.bind(n);n.add=t=>(i(t),s.update(()=>{}),n);const o=n.delete.bind(n);n.delete=t=>{const e=o(t);return s.update(()=>{}),e};const r=n.clear.bind(n);n.clear=()=>{r(),s.update(()=>{})};const a=n.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=>o(t),clear:()=>{r()},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){yr=t}(t??null)},exports.setRef=ss,exports.setSSRApiLookup=function(t){Rs=t},exports.setSSRMode=function(t){Se=t,t||(Ee=0,Ae=null,ke=null)},exports.setSSRRequest=function(t){Ts=t},exports.setSsrDoneCallback=function(t){Ae=t,Ee=0,null!==ke&&(clearTimeout(ke),ke=null)},exports.setTimezone=function(t){null==t?(wr(null),vr(null)):(wr(t.offset),vr(t.name))},exports.setTimezoneOffset=function(t){wr(t),vr(null)},exports.setter=Le,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=Ln,exports.slideInPreset=function(t="up",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:e?Tn(t,e):Rn[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?Tn(t,e):Rn[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=ko,exports.startTracking=Kt,exports.stopTracking=Qt,exports.store=t=>{if("object"!=typeof t||null===t)throw new Error("initial state must be an object");const e=Nn(t),n=No(t,e,"store");return()=>[n,e.update]},exports.style=function(t){return Oi(t)},exports.styleMap=$t,exports.stylesheet=function(){if(pn("stylesheet"),Ce())return{css:()=>({}),mount:()=>{},keyframes:()=>""};const t=new wn;return{css:function(e){pn("css");const n=[],s=sn(e,n);return n.length>0&&t.appendRules(n.join("\n")),on(s)},mount:function(){if(function(t){if(te.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===we(!1))return t.mount(),()=>t.unmount();Ne(()=>(t.mount(),()=>t.unmount()))},keyframes:function(e,n){return pn("keyframes"),t.keyframes(e,n)}}},exports.superAtom=jn,exports.svg=S,exports.taskAction=function(t){ee("taskAction");const e=[];let n=0,s=1,i=!1;const o={skipRestrictedContextCheck:!0},r=Nn([],o),a=Nn("idle",o),l=Nn(0,o);function c(){if(r.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){const t=e.some(t=>"running"===t.status);return void(t||a.set("idle"))}if("running"!==a.get())return;const n=e.filter(t=>"running"===t.status).length,o=e.filter(t=>"pending"===t.status);if(0===o.length&&0===n)return void a.set("idle");const r=-1===s?o.length:Math.max(0,s-n);0!==r&&o.slice(0,r).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,le(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:r,pendingTasks:function(){return r.val.filter(t=>"pending"===t.status)},runningTasks:function(){return r.val.filter(t=>"running"===t.status)},successTasks:function(){return r.val.filter(t=>"success"===t.status)},failedTasks:function(){return r.val.filter(t=>"failed"===t.status)},cancelledTasks:function(){return r.val.filter(t=>"cancelled"===t.status)},__isTaskAction__:!0};return ve(_,p),_},exports.template=rs,exports.themeAtom=Ys,exports.throttle=Zn,exports.throttledAtom=(t,e,n)=>vo(t,e,Zn,n),exports.timerTemplate=function(t,e){return Ii(t,e)},exports.titleAtom=Mo,exports.trackAndSubscribe=In,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=ds,exports.unsafeHTML=Tt,exports.unsafeSVG=mr,exports.until=Pt,exports.unwrapModule=He,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 we().dispatchEvent(n),e},exports.useEleEvent=function(){const t=we(!1);return{dispatch(e,n){t&&t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}}},exports.useScope=Po,exports.useState=t=>{const e=we();if("object"!=typeof t||null===t)throw new Error("stateObj must be an object");const n=Nn(t),s=No(t,n,"useState");return e?._useStates&&e._useStates.push({state:t,atom:n}),[s,n.update]},exports.useStore=function(t){return Ue(t,!0),t},exports.uuid=Lo,exports.validateAll=function(t){const e=[],n={},s=new WeakSet;return function t(i,o){if(null==i)return;const r=typeof i;if("object"!==r&&"function"!==r)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[o]=t))}if(Array.isArray(i)){for(let e=0;e<i.length;e++){const n=o?`${o}[${e}]`:`[${e}]`;t(i[e],n)}return}const a=Object.keys(i);for(const e of a){const n=o?`${o}.${e}`:e;t(i[e],n)}}(t,""),{isValid:0===e.length,errors:e,errorsByField:n}},exports.validateReactiveFunction=Pn,exports.view=os,exports.virtualList=function(t,e,n,s){const{keyFn:i,template:o,opts:r}=co(e,n,s),a={direction:r?.direction??"vertical",...r?.pin?{pin:r.pin}:{}};return lo({items:t,renderItem:o,keyFunction:i,scroller:r?.scroller,layout:Ni(a)})},exports.virtualMasonry=function(t,e,n,s){const{keyFn:i,template:o,opts:r}=co(e,n,s),a={direction:r.direction??"vertical",getAspectRatio:r.getAspectRatio,gap:r.gap??"8px",flex:!0,...r.itemSize?{itemSize:r.itemSize}:{},...r.pin?{pin:r.pin}:{}};return lo({items:t,renderItem:o,keyFunction:i,scroller:r.scroller,layout:(l=a,Object.assign({type:Gi},l))});var l},exports.watch=Fe,exports.when=function(t,e,n){return t?e(t):n?.(t)},exports.withAuth=function(t){return async(e,n)=>({url:e,options:{...n,headers:{...n.headers,Authorization:"string"==typeof t?t:await t()}}})},exports.withBaseUrl=function(t){return(e,n)=>({url:e.startsWith("http")?e:`${t}${e}`,options:n})},exports.withHost=ye,exports.withLogging=function(t=console.log){return e=>(t(`[fetch] ${e.status} ${e.url}`),e)},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={}){ne("ws");const{reconnect:n=!0,reconnectDelay:s=ir,reconnectMaxDelay:i=or,reconnectMaxAttempts:o=rr,protocols:r,auth:a,autoConnect:l=!0}=e,c=Nn("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 le(t),void c.set("error")}try{u=r?new WebSocket(e,r):new WebSocket(e)}catch(t){return le(t),c.set("error"),void w()}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){le(t)}})},u.onerror=()=>{c.set("error")},u.onclose=()=>{m||(c.set("disconnected"),w())}}function w(){if(!n||m)return;if(d>=o)return;d++;const t=f;f=Math.min(2*f,i),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"),ve(b,v),b},exports.x=is,exports.xTabEvent=t=>{ee("xTabEvent");const e=new Set,n=n=>{e.forEach(e=>{try{e(n)}catch(e){le(e,`xTabEvent(${t}) handler`)}})},s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(t):null;s&&(s.onmessage=t=>{n(t.data)});return{trigger:e=>{if(jt(t,e),s)try{s.postMessage(e)}catch(e){le(e,`xTabEvent(${t}) postMessage`)}n(e)},__subscribe:t=>{e.add(t);const n=()=>{e.delete(t)};return ve(t,n),n},close:()=>{s&&s.close()},name:t,__isEvent___:!0,__isXTabEvent___:!0}};
182
+ function*(t,e,n=1){const s=void 0===e?0:t;e??=t;for(let t=s;n>0?t<e:e<t;t+=n)yield t},exports.ref=ns,exports.registerCleanup=ve,exports.removeAttr=function(t){},exports.removeClasses=function(t){},exports.removeOn=function(t){Ti.get(t)?.()},exports.removeStyle=function(t){},exports.render=F,exports.renderSwitch=function(t){for(const e of t){if(!Array.isArray(e))return e;{const[t,n]=e;if(t)return n}}return E},exports.renderTemplate=ls,exports.renderX=as,exports.repeat=At,exports.replaceParams=function(t,e){if("undefined"==typeof window)return;const n=_s.get(),s=t.split("/"),i=n.split("/");if(s.length!==i.length)return void console.warn(`replaceParams: pattern "${t}" has ${s.length} segments but current path "${n}" has ${i.length}. No-op.`);const o=new Set(s.filter(t=>t.startsWith(":")).map(t=>t.slice(1)));for(const n of Object.keys(e))o.has(n)||console.warn(`replaceParams: param "${n}" not found in pattern "${t}".`);const r=i.map((t,n)=>{const i=s[n];if(!i.startsWith(":"))return t;const o=i.slice(1);return o in e?String(e[o]):t}),a=r.join("/");a!==n&&ps(a,!0)},exports.resetComponentState=Te,exports.resolveAsyncValue=Be,exports.restoreTracking=Zt,exports.rootCSS=function(t){Sn();const e=xn(),n=Ks(":root",t);return n&&e.appendRules(n),t},exports.route=(t,{view:e})=>ys(t)?e?os(e,{}):E:null,exports.runWithGlobalInterceptors=async function(t,e){let n,s=t,i=e;for(const t of Vs){const e=await t(s,i);s=e.url,i=e.options}try{n=await fetch(s,i)}catch(t){for(const e of Bs)try{e(t)}catch{}throw t}for(const t of Ws)n=await t(n);if(!n.ok){const t=new Error(`${n.status} ${n.statusText}`);for(const e of Bs)try{e(t)}catch{}}return n},exports.safeClone=oe,exports.safeSVG=yr,exports.safetyCheck=ze,exports.saveAndEnableTracking=Gt,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=No,exports.setAtom=(t=[],e)=>{const n=new Set(t),s=Nn(n,e),i=n.add.bind(n);n.add=t=>(i(t),s.update(()=>{}),n);const o=n.delete.bind(n);n.delete=t=>{const e=o(t);return s.update(()=>{}),e};const r=n.clear.bind(n);n.clear=()=>{r(),s.update(()=>{})};const a=n.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=>o(t),clear:()=>{r()},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){br=t}(t??null)},exports.setRef=ss,exports.setSSRApiLookup=function(t){Rs=t},exports.setSSRMode=function(t){Se=t,t||(Ee=0,Ae=null,ke=null)},exports.setSSRRequest=function(t){Ts=t},exports.setSsrDoneCallback=function(t){Ae=t,Ee=0,null!==ke&&(clearTimeout(ke),ke=null)},exports.setTimezone=function(t){null==t?(xr(null),Sr(null)):(xr(t.offset),Sr(t.name))},exports.setTimezoneOffset=function(t){xr(t),Sr(null)},exports.setter=Le,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=Ln,exports.slideInPreset=function(t="up",e,n=400,s="cubic-bezier(0.4, 0, 0.2, 1)"){return{keyframes:[{transform:e?Tn(t,e):Rn[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?Tn(t,e):Rn[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=Ro,exports.startTracking=Kt,exports.stopTracking=Qt,exports.store=t=>{if("object"!=typeof t||null===t)throw new Error("initial state must be an object");const e=Nn(t),n=Uo(t,e,"store");return()=>[n,e.update]},exports.style=function(t){return zi(t)},exports.styleMap=$t,exports.stylesheet=function(){if(pn("stylesheet"),Ce())return{css:()=>({}),mount:()=>{},keyframes:()=>""};const t=new wn;return{css:function(e){pn("css");const n=[],s=sn(e,n);return n.length>0&&t.appendRules(n.join("\n")),on(s)},mount:function(){if(function(t){if(te.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===we(!1))return t.mount(),()=>t.unmount();Ne(()=>(t.mount(),()=>t.unmount()))},keyframes:function(e,n){return pn("keyframes"),t.keyframes(e,n)}}},exports.superAtom=jn,exports.svg=S,exports.taskAction=function(t){ee("taskAction");const e=[];let n=0,s=1,i=!1;const o={skipRestrictedContextCheck:!0},r=Nn([],o),a=Nn("idle",o),l=Nn(0,o);function c(){if(r.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){const t=e.some(t=>"running"===t.status);return void(t||a.set("idle"))}if("running"!==a.get())return;const n=e.filter(t=>"running"===t.status).length,o=e.filter(t=>"pending"===t.status);if(0===o.length&&0===n)return void a.set("idle");const r=-1===s?o.length:Math.max(0,s-n);0!==r&&o.slice(0,r).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,le(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:r,pendingTasks:function(){return r.val.filter(t=>"pending"===t.status)},runningTasks:function(){return r.val.filter(t=>"running"===t.status)},successTasks:function(){return r.val.filter(t=>"success"===t.status)},failedTasks:function(){return r.val.filter(t=>"failed"===t.status)},cancelledTasks:function(){return r.val.filter(t=>"cancelled"===t.status)},__isTaskAction__:!0};return ve(_,p),_},exports.template=rs,exports.themeAtom=Gs,exports.throttle=Zn,exports.throttledAtom=(t,e,n)=>So(t,e,Zn,n),exports.timerTemplate=function(t,e){return Di(t,e)},exports.titleAtom=To,exports.trackAndSubscribe=In,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=ds,exports.unsafeHTML=Tt,exports.unsafeSVG=yr,exports.until=Pt,exports.unwrapModule=He,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 we().dispatchEvent(n),e},exports.useEleEvent=function(){const t=we(!1);return{dispatch(e,n){t&&t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}}},exports.useScope=No,exports.useState=t=>{const e=we();if("object"!=typeof t||null===t)throw new Error("stateObj must be an object");const n=Nn(t),s=Uo(t,n,"useState");return e?._useStates&&e._useStates.push({state:t,atom:n}),[s,n.update]},exports.useStore=function(t){return Ue(t,!0),t},exports.uuid=Fo,exports.validateAll=function(t){const e=[],n={},s=new WeakSet;return function t(i,o){if(null==i)return;const r=typeof i;if("object"!==r&&"function"!==r)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[o]=t))}if(Array.isArray(i)){for(let e=0;e<i.length;e++){const n=o?`${o}[${e}]`:`[${e}]`;t(i[e],n)}return}const a=Object.keys(i);for(const e of a){const n=o?`${o}.${e}`:e;t(i[e],n)}}(t,""),{isValid:0===e.length,errors:e,errorsByField:n}},exports.validateReactiveFunction=Pn,exports.view=os,exports.virtualList=function(t,e,n,s){const{keyFn:i,template:o,opts:r}=fo(e,n,s),a={direction:r?.direction??"vertical",...r?.pin?{pin:r.pin}:{}};return uo({items:t,renderItem:o,keyFunction:i,scroller:r?.scroller,layout:Ui(a)})},exports.virtualMasonry=function(t,e,n,s){const{keyFn:i,template:o,opts:r}=fo(e,n,s),a={direction:r.direction??"vertical",getAspectRatio:r.getAspectRatio,gap:r.gap??"8px",flex:!0,...r.itemSize?{itemSize:r.itemSize}:{},...r.pin?{pin:r.pin}:{}};return uo({items:t,renderItem:o,keyFunction:i,scroller:r.scroller,layout:(l=a,Object.assign({type:Qi},l))});var l},exports.watch=Fe,exports.when=function(t,e,n){return t?e(t):n?.(t)},exports.withAuth=function(t){return async(e,n)=>({url:e,options:{...n,headers:{...n.headers,Authorization:"string"==typeof t?t:await t()}}})},exports.withBaseUrl=function(t){return(e,n)=>({url:e.startsWith("http")?e:`${t}${e}`,options:n})},exports.withHost=ye,exports.withLogging=function(t=console.log){return e=>(t(`[fetch] ${e.status} ${e.url}`),e)},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={}){ne("ws");const{reconnect:n=!0,reconnectDelay:s=ar,reconnectMaxDelay:i=lr,reconnectMaxAttempts:o=cr,protocols:r,auth:a,autoConnect:l=!0}=e,c=Nn("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 le(t),void c.set("error")}try{u=r?new WebSocket(e,r):new WebSocket(e)}catch(t){return le(t),c.set("error"),void w()}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){le(t)}})},u.onerror=()=>{c.set("error")},u.onclose=()=>{m||(c.set("disconnected"),w())}}function w(){if(!n||m)return;if(d>=o)return;d++;const t=f;f=Math.min(2*f,i),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"),ve(b,v),b},exports.x=is,exports.xTabEvent=t=>{ee("xTabEvent");const e=new Set,n=n=>{e.forEach(e=>{try{e(n)}catch(e){le(e,`xTabEvent(${t}) handler`)}})},s="undefined"!=typeof BroadcastChannel?new BroadcastChannel(t):null;s&&(s.onmessage=t=>{n(t.data)});return{trigger:e=>{if(jt(t,e),s)try{s.postMessage(e)}catch(e){le(e,`xTabEvent(${t}) postMessage`)}n(e)},__subscribe:t=>{e.add(t);const n=()=>{e.delete(t)};return ve(t,n),n},close:()=>{s&&s.close()},name:t,__isEvent___:!0,__isXTabEvent___:!0}};
183
183
  //# sourceMappingURL=index.js.map