what-core 0.11.5 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{a as T}from"./chunk-O3SKPRTY.min.js";var u=typeof globalThis<"u"&&typeof globalThis.__WHAT_DEV__=="boolean"?globalThis.__WHAT_DEV__:import.meta&&import.meta.env?!!import.meta.env.DEV:(typeof process<"u"&&process.env,!1),d=null;function Me(e){u&&(d=e)}var _=null,w=null,E=null,P=!1,D=0,b=[],j=!1,q=Symbol("needs_upstream"),B=null;function S(e,t){let n=e,r=new Set,s=null,o=0;function c(f){u&&P&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;n===l||n!==n&&l!==l||(n=l,s=null,u&&d&&d.onSignalUpdate(i),r.size>0&&ee(r))}function i(f){if(arguments.length===0){let l=_;return l!==null&&(l!==s||l._epoch!==o)&&(s=l,o=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>v(()=>f(i())),i._signal=!0,u&&(i._subs=r,t&&(i._debugName=t)),u&&d&&d.onSignalCreate(i),i}function Ae(e){let t,n=!0,r=new Set,s=null,o=0,c=U(()=>{let f=P;u&&(P=!0);try{t=e(),n=!1}finally{u&&(P=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=_;return f!==null&&(f!==s||f._epoch!==o)&&(s=f,o=f._epoch,r.add(f),f.deps.push(r)),n&&X(c),t}return c._onNotify=()=>{n=!0,s=null,r.size>0&&ee(r)},i._signal=!0,i.peek=()=>(n&&X(c),t),i}function X(e){if(B!==null)throw B.push(e),q;let t=[e];B=t;try{for(;t.length>0;){let n=t[t.length-1];if(!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,s=n.deps;for(let o=0;o<s.length;o++){let c=s[o]._owner;c&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let o=n.deps.length;$(n),n.deps.length!==o&&H(n),t.pop()}catch(o){if(o===q)n._markDirty();else throw o}}}finally{B=null}}function H(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let s=n[r]._owner;if(s){let o=s._level;o>t&&(t=o)}}e._level=t+1}var ge=()=>{};function v(e,t){let n=U(e);n._level=1;let r=_;_=n;try{let o=n.fn();typeof o=="function"&&(n._cleanup=o)}finally{_=r}if(H(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,u&&d&&d.onEffectDispose(n),ge;let s=()=>Z(n);return w&&w.disposals.push(s),s}function Te(e){D++;try{e()}finally{D--,D===0&&G()}}function U(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return u&&d&&d.onEffectCreate(n),n}function $(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(s){u&&console.warn("[what] Error in effect cleanup:",s)}e._cleanup=null}let r=_;_=null;try{let s=e.fn();typeof s=="function"&&(e._cleanup=s)}catch(s){d?.onError&&d.onError(s,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",s)}finally{_=r}u&&d?.onEffectRun&&d.onEffectRun(e);return}let t=e.deps.length===1?e.deps[0]:null;if(Y(e),e._cleanup){try{e._cleanup()}catch(r){u&&d?.onError&&d.onError(r,{type:"effect-cleanup",effect:e}),u&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=_;_=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===q||u&&d?.onError&&d.onError(r,{type:"effect",effect:e}),r}finally{_=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),u&&d?.onEffectRun&&d.onEffectRun(e)}function Z(e){if(e.disposed=!0,u&&d&&d.onEffectDispose(e),Y(e),e._cleanup){try{e._cleanup()}catch(t){u&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function Y(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var F=0,L=null,M=0;function Q(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(D===0&&e._stable){let t=_;_=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){u&&d?.onError&&d.onError(n,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",n)}finally{_=t}}else{e._pending=!0;let t=e._level,n=b.length;n>0&&b[n-1]._level>t&&(j=!0),b.push(e)}}}function ee(e){if(F===0){F=1;try{for(let t of e)Q(t);if(M>0){let t=0;for(;t<M;){let n=L[t];L[t]=null,t++;for(let r of n)Q(r)}M=0}}finally{F=0}D===0&&b.length>0&&ye()}else L===null&&(L=[]),M>=L.length?L.push(e):L[M]=e,M++}var I=!1;function ye(){I||(I=!0,queueMicrotask(()=>{I=!1,G()}))}var R=!1;function G(){if(!R){R=!0;try{let e=0;for(;b.length>0&&e<25;){let t=b;b=[],t.length>1&&j&&t.sort((n,r)=>n._level-r._level),j=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let s=r.deps.length;try{$(r)}catch(o){if(o===q)throw o;u&&d?.onError&&d.onError(o,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",o)}catch{}continue}!r._computed&&r.deps.length!==s&&H(r)}}e++}if(e>=25){if(u){let n=b.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<b.length;t++)b[t]._pending=!1;b.length=0}}finally{R=!1}}}function De(e){let t,n=new Set,r=U(()=>{let o=e();if(!Object.is(t,o)){t=o;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=b.length;f>0&&b[f-1]._level>i&&(j=!0),b.push(c)}}}});r._level=1,$(r),H(r),n._owner=r,w&&w.disposals.push(()=>Z(r));function s(){return _&&(n.add(_),_.deps.push(n)),t}return s._signal=!0,s.peek=()=>t,s}function Oe(){if(R){u&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(_){u&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}I=!1,G()}function K(e){let t=_;_=null;try{return e()}finally{_=t}}function Be(){return E}function Pe(e,t){let n=E,r=w;E=e,w=e;try{return t()}finally{E=n,w=r}}function Ie(e){let t=w,n=E,r={disposals:[],owner:E,children:[],_disposed:!1};E&&E.children.push(r),w=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)J(r.children[o]);r.children.length=0;for(let o=r.disposals.length-1;o>=0;o--)r.disposals[o]();if(r.disposals.length=0,r.owner){let o=r.owner.children.indexOf(r);o>=0&&r.owner.children.splice(o,1)}}})}finally{w=t,E=n}}function J(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)J(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function Re(e){let t=w,n=E,r={disposals:[],owner:null,children:[],_disposed:!1};w=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)J(r.children[o]);r.children.length=0;for(let o=r.disposals.length-1;o>=0;o--)r.disposals[o]();r.disposals.length=0}})}finally{w=t,E=n}}function je(e){w&&w.disposals.push(e)}if(u&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};d={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function qe(){if(!u)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof z<"u"?z:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var z=null;u&&d?.__isPreinstallBuffer&&(z=d.__buffer);function $e(e,t){let n=function(s){return e(s)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var te=null;function ne(e){te=e}function Ge(e){let t=null,n=null,r=null,s=new Set;function o(c){if(r)throw r;if(t)return T(t,c);throw n||(n=e().then(i=>{t=i.default||i,s.forEach(f=>f()),s.clear()}).catch(i=>{r=i})),n}return o.displayName="Lazy",o._lazy=!0,o._onLoad=c=>{t?c():s.add(c)},o}function Ke({fallback:e,children:t}){let n=S(!1),r=new Set;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(o){n.set(!0),r.add(o),o.finally(()=>{r.delete(o),r.size===0&&n.set(!1)})}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}function Je({fallback:e,children:t,onError:n}){let r=S(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}function re(e,t){let n=t||te?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function Xe({when:e,fallback:t=null,children:n}){return()=>(typeof e=="function"?e():e)?n:t}function Qe({each:e,fallback:t=null,children:n}){let r=Array.isArray(n)?n[0]:n;return typeof r!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):()=>{let s=typeof e=="function"?e():e;return!s||s.length===0?t:s.map((o,c)=>{let i=r(o,c);return i&&typeof i=="object"&&i.key==null&&(o!=null&&typeof o=="object"?o.id!=null?i.key=o.id:o.key!=null&&(i.key=o.key):(typeof o=="string"||typeof o=="number")&&(i.key=o)),i})}}function Ze({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];return()=>{for(let r of n)if(r&&r.tag===oe&&(typeof r.props.when=="function"?r.props.when():r.props.when))return r.children;return e}}function oe({when:e,children:t}){return{tag:oe,props:{when:e},children:t,_vnode:!0}}function Ye({component:e,mode:t,mediaQuery:n,...r}){let s=T("div",{"data-island":e.name||"Island","data-hydrate":t}),o=S(null),c=S(!1);function i(){c()||(c.set(!0),o.set(T(e,r)))}function f(p){switch(t){case"load":queueMicrotask(i);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(i):setTimeout(i,200);break;case"visible":{let a=new IntersectionObserver(h=>{h[0].isIntersecting&&(a.disconnect(),i())});a.observe(p);break}case"interaction":{let a=()=>{p.removeEventListener("click",a),p.removeEventListener("focus",a),p.removeEventListener("mouseenter",a),i()};p.addEventListener("click",a,{once:!0}),p.addEventListener("focus",a,{once:!0}),p.addEventListener("mouseenter",a,{once:!0});break}case"media":{if(!n){i();break}let a=window.matchMedia(n);if(a.matches)queueMicrotask(i);else{let h=()=>{a.matches&&(a.removeEventListener("change",h),i())};a.addEventListener("change",h)}break}default:queueMicrotask(i)}}let l=p=>{p&&f(p)};return T("div",{"data-island":e.name||"Island","data-hydrate":t,ref:l},c()?o():null)}var se=!1;function nt(e,t,n){return se||(se=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,s)=>{let o=t(r,s);return n&&o&&typeof o=="object"&&(o.key=n(r,s)),o})}function rt(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,s]of Object.entries(n))s&&t.push(r)}return t.join(" ")}function ot(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Ce(t)}:${n}`).join(";")}function Ce(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function st(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function it(e,t){let n=0;return(...r)=>{let s=Date.now();s-n>=t&&(n=s,e(...r))}}var W=null;function ie(e){W=e}function ct(e){if(typeof window>"u")return S(!1);let t=window.matchMedia(e),n=S(t.matches),r=o=>n.set(o.matches);t.addEventListener("change",r);let s=W?.();return s&&(s._cleanupCallbacks=s._cleanupCallbacks||[],s._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function ft(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=S(n),s=v(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){u&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),o=null;typeof window<"u"&&(o=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){u&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",o));let c=W?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{s(),o&&window.removeEventListener("storage",o)})),r}function lt({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function at(e,t){if(typeof document>"u")return;let n=s=>{let o=e.current||e;!o||o.contains(s.target)||t(s)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=W?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function ut(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var we=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),be="http://www.w3.org/2000/svg",le=new Set,V=new WeakMap;function Ee(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ce(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function fe(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}u&&d?.onComponentUnmount&&d.onComponentUnmount(e),le.delete(e)}}function N(e){if(!e)return;if(e._componentCtx&&fe(e._componentCtx),e.nodeType===8){let n=V.get(e);n&&fe(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)N(t[n])}function yt(e,t){typeof t=="string"&&(t=document.querySelector(t)),N(t),t.textContent="";let n=k(e,t);return n&&t.appendChild(n),()=>{N(t),t.textContent=""}}function k(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(Ee(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),s=document.createComment("/list-frag");return r.appendChild(s),e(r,s),r}if(typeof e=="function"){let r=document.createComment("fn"),s=document.createComment("/fn"),o=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(s);let i=v(()=>{let f=e(),l=f==null||f===!1||f===!0?[]:Array.isArray(f)?f:[f],p=s.parentNode;if(p){for(let a of o)N(a),a.parentNode===p&&p.removeChild(a);o=[];for(let a of l){let h=k(a,p,t?._isSvg);if(h)if(h.nodeType===11){let C=Array.from(h.childNodes);p.insertBefore(h,s);for(let y of C)o.push(y)}else p.insertBefore(h,s),o.push(h)}}});return r._dispose=i,s._dispose=i,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let s of e){let o=k(s,t,n);o&&r.appendChild(o)}return r}return ce(e)&&typeof e.tag=="function"?xe(e,t,n):ce(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?ue(e,t):e.tag==="__suspense"?pe(e,t):e.tag==="__portal"?de(e,t):ve(e,t,n):document.createTextNode(String(e))}var Se={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},m=[];function ae(){return m[m.length-1]}ne(ae);ie(ae);function Ct(){return m}function xe(e,t,n){let{tag:r,props:s,children:o}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let g=r;r=function(me){return new g(me).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return ue(e,t);if(r==="__suspense"||e.tag==="__suspense")return pe(e,t);if(r==="__portal"||e.tag==="__portal")return de(e,t);let c=m[m.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let g=c._parentCtx;for(;g;){if(g._errorBoundary){i=g._errorBoundary;break}g=g._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},l=document.createComment("c:start"),p=document.createComment("c:end");V.set(l,f),f._startComment=l,f._endComment=p;let a=document.createDocumentFragment();a._componentCtx=f,f._wrapper=l,le.add(f),u&&d?.onComponentMount&&d.onComponentMount(f);let h=o.length===0?void 0:o.length===1?o[0]:o,C;h!==void 0?C=s?Object.assign({},s,{children:h}):{children:h}:C=s?Object.assign({},s):{};let y=S(C);f._propsSignal=y;let x=new Proxy({_sig:y},Se);m.push(f);let O;try{O=K(()=>r(x))}catch(g){if(m.pop(),!re(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return a.appendChild(l),a.appendChild(p),a}m.pop(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(A){console.error("[what] onMount error:",A)}}),a.appendChild(l);let _e=Array.isArray(O)?O:[O];for(let g of _e){let A=k(g,a,n);A&&a.appendChild(A)}return a.appendChild(p),a}function ue(e,t){let{errorState:n,handleError:r,fallback:s,reset:o}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};V.set(i,l);let p=document.createDocumentFragment();p._componentCtx=l,p.appendChild(i),p.appendChild(f);let a=v(()=>{let h=n();if(m.push(l),i.parentNode)for(;i.nextSibling&&i.nextSibling!==f;){let y=i.nextSibling;N(y),y.parentNode.removeChild(y)}let C;h?C=typeof s=="function"?[s({error:h,reset:o})]:[s]:C=c,C=Array.isArray(C)?C:[C];for(let y of C){let x=k(y,t);x&&(f.parentNode?f.parentNode.insertBefore(x,f):p.insertBefore(x,f))}m.pop()});return l.effects.push(a),p}function pe(e,t){let{boundary:n,fallback:r,loading:s}=e.props,o=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null,_startComment:c,_endComment:i};V.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let p=v(()=>{let h=s()?[r]:o,C=Array.isArray(h)?h:[h];if(m.push(f),c.parentNode)for(;c.nextSibling&&c.nextSibling!==i;){let y=c.nextSibling;N(y),y.parentNode.removeChild(y)}for(let y of C){let x=k(y,t);x&&(i.parentNode?i.parentNode.insertBefore(x,i):l.insertBefore(x,i))}m.pop()});return f.effects.push(p),l}function de(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let s={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null},o=document.createComment("portal");o._componentCtx=s;let c=[];for(let i of r){let f=k(i,n);f&&(n.appendChild(f),c.push(f))}return s._cleanupCallbacks=[()=>{for(let i of c)N(i),i.parentNode&&i.parentNode.removeChild(i)}],o}function ve(e,t,n){let{tag:r,props:s,children:o}=e,c=n||we.has(r),i=c?document.createElementNS(be,r):document.createElement(r);s&&ke(i,s,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<o.length;l++){let p=k(o[l],i,f);p&&i.appendChild(p)}return i._vnode=e,i}function ke(e,t,n,r){if(t){for(let s in t)if(!(s==="key"||s==="children")){if(s==="ref"){let o=t.ref;typeof o=="function"?o(e):o&&(o.current=e);continue}he(e,s,t[s],r)}}}function Le(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function he(e,t,n,r){if(typeof n=="function"&&!(t.startsWith("on")&&t.length>2)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=v(()=>{let s=n();he(e,t,s,r)});return}if(t.startsWith("on")&&t.length>2){let s=t.slice(2),o=!1;s.endsWith("Capture")&&(s=s.slice(0,-7),o=!0);let c=s.toLowerCase(),i=o?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,o),n==null))return;e._events||(e._events={});let l=a=>(a.nativeEvent||(a.nativeEvent=a),K(()=>l._handler(a)));l._handler=n,l._original=n,e._events[i]=l;let p=n._eventOpts;e.addEventListener(c,l,p||o||void 0);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let s=e._prevStyle||{};for(let o in s)o in n||(e.style[o]="");for(let o in n)e.style[o]=n[o]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let s=n?.__html??"";u&&typeof s=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(s)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=s;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let s=n.__html??"";u&&typeof s=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(s)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=s}else{u&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(n==null){if(t in e)try{e[t]=""}catch{}e.removeAttribute(t);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")||t.startsWith("aria-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Le(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{u as a,Me as b,S as c,Ae as d,v as e,Te as f,De as g,Oe as h,K as i,Be as j,Pe as k,Ie as l,Re as m,je as n,qe as o,$e as p,Ge as q,Ke as r,Je as s,Xe as t,Qe as u,Ze as v,oe as w,Ye as x,nt as y,rt as z,ot as A,st as B,it as C,ct as D,ft as E,lt as F,at as G,ut as H,N as I,yt as J,k as K,ae as L,Ct as M,Le as N};
@@ -1 +1 @@
1
- import{I as W,K as et,M as ht,N as ft,a as R,c as tt,e as $,m as q}from"./chunk-MIAYVSK2.min.js";var Z=null;function Zt(t){Z=typeof t=="function"?t:null}function Jt(t,n,e){if(e&&e.length>0){let i=e.length===1?e[0]:e;n?n.children=i:n={children:i}}return et({tag:t,props:n||{},children:e||[],key:null,_vnode:!0})}var gt=new Set(["href","src","action","formaction","formAction"]);function Tt(t){if(typeof t!="string")return!0;let n=t.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}var wt={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},Et=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function xt(t){let n=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Lt(t){let n=t.trim(),e=xt(n);if(Et.has(e))return St(n);let i=wt[e];if(i){let r=document.createElement("template");r.innerHTML=i.wrap+n+i.unwrap;let y=r.content.firstChild;for(let c=0;c<i.depth;c++)y=y.firstChild;return()=>y.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var dt=!1;function Qt(t){return R&&!dt&&(dt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Lt(t)}function St(t){let n=t.trim();if(xt(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let i=document.createElement("template");return i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>i.content.firstChild.firstChild.cloneNode(!0)}function Yt(t,n,e){if(typeof n=="function"&&n._mapArray)return n(t,e||null);if(typeof n=="function"){let i=e||null,o=null,r=null,y=!1;return $(()=>{let c=n(),h=typeof c;if(!y){y=!0,h==="string"||h==="number"?(r=document.createTextNode(String(c)),i?t.insertBefore(r,i):t.appendChild(r),Z&&Z(t,String(c)),o=r):o=Q(t,c,null,i);return}if(r!==null&&(h==="string"||h==="number")){let l=String(c);r.data!==l&&(r.data=l),Z&&Z(t,l);return}r=null,o=Q(t,c,o,i)}),o}if(typeof n=="string"||typeof n=="number"){let i=document.createTextNode(String(n));return e?t.insertBefore(i,e):t.appendChild(i),i}return n!=null&&typeof n=="object"&&n.nodeType>0?(e?t.insertBefore(n,e):t.appendChild(n),n):Q(t,n,null,e||null)}function _t(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function Mt(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var it=typeof SVGElement<"u";function yt(t){return it&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function bt(t){return t==null?[]:Array.isArray(t)?t:[t]}function Ct(t,n,e){if(t==null||typeof t=="boolean")return e;if(Array.isArray(t)){for(let i=0;i<t.length;i++)Ct(t[i],n,e);return e}if(typeof t=="function"){let i=et(t,n,yt(n));if(i&&i.nodeType===11){let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)e.push(o[r])}else i&&e.push(i);return e}if(typeof t=="string"||typeof t=="number")return e.push(document.createTextNode(String(t))),e;if(_t(t)){if(t.nodeType===11&&t.childNodes.length>0){let i=Array.from(t.childNodes);for(let o=0;o<i.length;o++)e.push(i[o])}else e.push(t);return e}if(Mt(t)){let i=et(t,n,yt(n));if(i&&i.nodeType===11)if(i.childNodes.length===0)e.push(i);else{let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)e.push(o[r])}else i&&e.push(i);return e}return e.push(document.createTextNode(String(t))),e}function jt(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function Q(t,n,e,i){if(!t||typeof t.insertBefore!="function")return R&&console.warn("[what] reconcileInsert called with invalid parent:",t),e;let o=i||null;if(n==null||typeof n=="boolean"){let l=bt(e);for(let d=0;d<l.length;d++){let s=l[d];s.parentNode===t&&(W(s),t.removeChild(s))}return null}if((typeof n=="string"||typeof n=="number")&&e&&!Array.isArray(e)&&e.nodeType===3){let l=String(n);return e.data!==l&&(e.data=l),e}if(typeof n=="object"&&n!==null&&n.nodeType>0&&n.nodeType!==11&&!Array.isArray(n)){if(n===e)return e;if(e&&!Array.isArray(e)&&e.nodeType>0&&e.nodeType!==11)return e.parentNode===t?(W(e),t.replaceChild(n,e)):o?t.insertBefore(n,o):t.appendChild(n),n}let r=Ct(n,t,[]),y=bt(e);if(jt(y,r))return e;let c=r.length;for(let l=0;l<y.length;l++){let d=y[l];if(d.parentNode!==t)continue;let s=!1;for(let x=0;x<c;x++)if(r[x]===d){s=!0;break}s||(W(d),t.removeChild(d))}let h=o;for(let l=r.length-1;l>=0;l--){let d=r[l];(d.parentNode!==t||d.nextSibling!==h)&&(h&&h.parentNode!==t&&(h=null),h?t.insertBefore(d,h):t.appendChild(d)),h=d}return r.length===0?null:r.length===1?r[0]:r}function It(t,n,e){let i=e?.key,o=e?.raw||!1,r=(y,c)=>{let h=[],l=[],d=[],s=i&&!o?new Map:null,x=document.createComment("/list");return y.insertBefore(x,c||null),$(()=>{let m=t()||[],b=x.parentNode||y;i?Dt(b,x,h,m,l,d,n,i,s):Bt(b,x,h,m,l,d,n),h=m.length>0?m.slice():m}),x};return r._mapArray=!0,r}function Bt(t,n,e,i,o,r,y){let c=i.length,h=e.length;if(c===0){if(h>0){for(let u=0;u<h;u++)r[u]&&r[u]();for(let u=h-1;u>=0;u--){let a=o[u];a&&(W(a),a.parentNode===t&&t.removeChild(a))}o.length=0,r.length=0}return}if(h===0){let u=document.createDocumentFragment();for(let a=0;a<c;a++){let w=i[a],L=q(O=>(r[a]=O,y(w,a)));o[a]=L,u.appendChild(L)}t.insertBefore(u,n);return}let l=0,d=Math.min(h,c);for(;l<d&&e[l]===i[l];)l++;if(l===h&&l===c)return;let s=h-1,x=c-1;for(;s>=l&&x>=l&&e[s]===i[x];)s--,x--;let m=new Array(c),b=new Array(c);for(let u=0;u<l;u++)m[u]=o[u],b[u]=r[u];for(let u=x+1;u<c;u++){let a=s+1+(u-x-1);m[u]=o[a],b[u]=r[a]}let _=x-l+1,T=s-l+1;if(_===0)for(let u=l;u<=s;u++)r[u]?.(),o[u]&&W(o[u]),o[u]?.parentNode&&o[u].parentNode.removeChild(o[u]);else if(T===0){let u=l<c&&m[x+1]?m[x+1]:n,a=document.createDocumentFragment();for(let w=l;w<=x;w++){let L=i[w],O=w;m[w]=q(S=>(b[O]=S,y(L,O))),a.appendChild(m[w])}t.insertBefore(a,u)}else Ht(t,n,e,i,o,r,y,l,s,x,m,b);o.length=c,r.length=c;for(let u=0;u<c;u++)o[u]=m[u],r[u]=b[u]}function Ht(t,n,e,i,o,r,y,c,h,l,d,s){let x=new Map;for(let a=c;a<=h;a++)x.set(e[a],a);let m=l-c+1,b=new Int32Array(m);b.fill(-1);for(let a=c;a<=l;a++){let w=x.get(i[a]);w!==void 0&&(x.delete(i[a]),d[a]=o[w],s[a]=r[w],b[a-c]=w)}for(let[,a]of x)r[a]?.(),o[a]&&W(o[a]),o[a]?.parentNode&&o[a].parentNode.removeChild(o[a]);let _=m-Nt(b,m),T=new Uint8Array(m);if(_>1){let a=new Int32Array(_),w=new Int32Array(_),L=0;for(let S=0;S<m;S++)b[S]!==-1&&(a[L]=b[S],w[L]=S,L++);let O=At(a,_);for(let S=0;S<O.length;S++)T[w[O[S]]]=1}else if(_===1){for(let a=0;a<m;a++)if(b[a]!==-1){T[a]=1;break}}for(let a=c;a<=l;a++)if(!d[a]){let w=i[a],L=a;d[a]=q(O=>(s[L]=O,y(w,L)))}let u=l+1<d.length&&d[l+1]?d[l+1]:n;for(let a=l;a>=c;a--){let w=a-c;(b[w]===-1||!T[w])&&(u&&u.parentNode!==t&&(u=n),t.insertBefore(d[a],u)),u=d[a]}}function Nt(t,n){let e=0;for(let i=0;i<n;i++)t[i]===-1&&e++;return e}function At(t,n){if(n===0)return[];if(n===1)return[0];let e=new Int32Array(n),i=new Int32Array(n),o=1;e[0]=0,i[0]=-1;for(let c=1;c<n;c++)if(t[c]>t[e[o-1]])i[c]=e[o-1],e[o++]=c;else{let h=0,l=o-1;for(;h<l;){let d=h+l>>1;t[e[d]]<t[c]?h=d+1:l=d}e[h]=c,i[c]=h>0?e[h-1]:-1}let r=new Array(o),y=e[o-1];for(let c=o-1;c>=0;c--)r[c]=y,y=i[y];return r}function $t(){return document.createComment("i")}function z(t,n,e,i){let o=n;for(;o&&o!==e;){let r=o.nextSibling;t.insertBefore(o,i),o=r}}function ct(t,n,e){let i=n;for(;i&&i!==e;){let o=i.nextSibling;W(i),t.removeChild(i),i=o}}function lt(t,n,e,i,o,r,y,c,h){let l;if(o){let x=i(n),m=h(n);l=m,o.set(x,{itemSig:m})}else l=n;let d=$t();t.appendChild(d);let s=q(x=>(c[e]=x,r(l,e)));t.appendChild(s),y[e]=d}function Dt(t,n,e,i,o,r,y,c,h){let l=i.length,d=e.length;if(l===0){if(d>0){for(let f=0;f<d;f++)r[f]&&r[f]();o[0]&&ct(t,o[0],n),o.length=0,r.length=0,h&&h.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<l;C++)lt(f,i[C],C,c,h,y,o,r,tt);t.insertBefore(f,n);return}let s=0,x=Math.min(d,l);for(;s<x;){if(e[s]===i[s]){s++;continue}let f=c(e[s]),C=c(i[s]);if(f!==C)break;h&&h.get(f).itemSig.set(i[s]),s++}let m=d-1,b=l-1;for(;m>=s&&b>=s;){if(e[m]===i[b]){m--,b--;continue}let f=c(e[m]),C=c(i[b]);if(f!==C)break;h&&h.get(f).itemSig.set(i[b]),m--,b--}if(s>m&&s>b)return;let _=new Array(l),T=new Array(l);for(let f=0;f<s;f++)_[f]=o[f],T[f]=r[f];for(let f=b+1;f<l;f++){let C=m+1+(f-b-1);_[f]=o[C],T[f]=r[C]}let u=b-s+1,a=m-s+1;if(a===0){let f=b+1<l&&_[b+1]?_[b+1]:n,C=document.createDocumentFragment();for(let E=s;E<=b;E++)lt(C,i[E],E,c,h,y,_,T,tt);t.insertBefore(C,f),X(o,r,_,T,l);return}if(u===0){for(let f=s;f<=m;f++){r[f]?.();let C=G(t,o[f],o,f,n);ct(t,o[f],C),h&&h.delete(c(e[f]))}X(o,r,_,T,l);return}if(u===a&&u>=2&&u<=Math.max(a,200)){let f=0,C=-1,E=-1;for(let p=0;p<u&&f<=4;p++){let A=c(e[s+p]),D=c(i[s+p]);A!==D&&(f===0?C=p:f===1&&(E=p),f++)}if(f===2){let p=s+C,A=s+E,D=c(e[p]),K=c(e[A]),U=c(i[p]),v=c(i[A]);if(D===v&&K===U){for(let g=0;g<s;g++)_[g]=o[g],T[g]=r[g];for(let g=s;g<=b;g++)_[g]=o[g],T[g]=r[g];for(let g=b+1;g<l;g++){let N=m+1+(g-b-1);_[g]=o[N],T[g]=r[N]}let P=_[p];_[p]=_[A],_[A]=P;let B=T[p];if(T[p]=T[A],T[A]=B,h){if(i[p]!==e[p]){let g=c(i[p]),N=h.get(g);N&&N.itemSig.set(i[p])}if(i[A]!==e[A]){let g=c(i[A]),N=h.get(g);N&&N.itemSig.set(i[A])}}let j=A===p+1||p===A+1,H=Math.min(p,A),M=Math.max(p,A);if(j){let g=G(t,o[M],o,M,n);z(t,o[M],g,o[H])}else{let g=G(t,o[A],o,A,n),N=document.createComment("tmp");t.insertBefore(N,o[A]),z(t,o[A],g,o[p]);let F=G(t,o[p],o,p,n);z(t,o[p],F,N),t.removeChild(N)}X(o,r,_,T,l);return}}if(f>=2&&f<=u){let p=C,A=null,D=-1,K=-1,U=!1,v=c(e[s+p]),P=-1;for(let B=p;B<u;B++)if(c(i[s+B])===v){P=B;break}if(P>p){let B=!0;for(let j=p;j<P;j++)if(c(e[s+j+1])!==c(i[s+j])){B=!1;break}if(B){let j=!0;for(let H=P+1;H<u;H++)if(c(e[s+H])!==c(i[s+H])){j=!1;break}j&&(U=!0,D=s+p,K=s+P,A=v)}}if(!U){let B=c(i[s+p]),j=-1;for(let H=p;H<a;H++)if(c(e[s+H])===B){j=H;break}if(j>p){let H=!0;for(let M=p;M<j;M++)if(c(e[s+M])!==c(i[s+M+1])){H=!1;break}if(H){let M=!0;for(let g=j+1;g<u;g++)if(c(e[s+g])!==c(i[s+g])){M=!1;break}M&&(U=!0,D=s+j,K=s+p,A=B)}}}if(U){for(let g=s;g<=m;g++)_[g]=o[g],T[g]=r[g];let B=_[D],j=T[D];if(D<K)for(let g=D;g<K;g++)_[g]=_[g+1],T[g]=T[g+1];else for(let g=D;g>K;g--)_[g]=_[g-1],T[g]=T[g-1];if(_[K]=B,T[K]=j,h)for(let g=s;g<=b;g++){let N=c(i[g]);if(i[g]!==e[g]){let F=h.get(N);F&&F.itemSig.set(i[g])}}let H=G(t,B,o,D,n),M;K+1<l?M=_[K+1]:M=n,(K>=b+1||M&&M.parentNode!==t)&&(M=n),z(t,B,H,M),X(o,r,_,T,l);return}}}let w=new Map;for(let f=s;f<=m;f++)w.set(c(e[f]),f);let L=new Int32Array(u);L.fill(-1);for(let f=s;f<=b;f++){let C=c(i[f]),E=w.get(C);E!==void 0&&(w.delete(C),_[f]=o[E],T[f]=r[E],L[f-s]=E,h&&i[f]!==e[E]&&h.get(C).itemSig.set(i[f]))}let O=[...w.values()].sort((f,C)=>C-f);for(let f of O){r[f]?.();let C=G(t,o[f],o,f,n);ct(t,o[f],C),h&&h.delete(c(e[f]))}for(let f=s;f<=b;f++)if(!_[f]){let C=document.createDocumentFragment();lt(C,i[f],f,c,h,y,_,T,tt),_[f]._frag=C}let S=0,ut=!0,at=-1;for(let f=0;f<u;f++)L[f]!==-1&&(S++,L[f]<=at&&(ut=!1),at=L[f]);let k=new Uint8Array(u);if(ut)for(let f=0;f<u;f++)L[f]!==-1&&(k[f]=1);else if(S>1){let f=new Int32Array(S),C=new Int32Array(S),E=0;for(let A=0;A<u;A++)L[A]!==-1&&(f[E]=L[A],C[E]=A,E++);let p=At(f,S);for(let A=0;A<p.length;A++)k[C[p[A]]]=1}else if(S===1){for(let f=0;f<u;f++)if(L[f]!==-1){k[f]=1;break}}X(o,r,_,T,l);let rt=b+1<l&&o[b+1]?o[b+1]:n;for(let f=b;f>=s;f--){let C=f-s,E=o[f];if(L[C]===-1)E._frag&&(t.insertBefore(E._frag,rt),delete E._frag);else if(!k[C]){let p=G(t,E,o,f,n);z(t,E,p,rt)}rt=E}}function G(t,n,e,i,o){let r=n.nextSibling;for(;r&&r!==o;){if(r.nodeType===8&&r.data==="i")return r;r=r.nextSibling}return o}function X(t,n,e,i,o){t.length=o,n.length=o;for(let r=0;r<o;r++)t[r]=e[r],n[r]=i[r]}function kt(t,n){for(let e in n){let i=n[e];if(e.startsWith("on")&&e.length>2){let o=e.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(typeof i=="function"&&!e.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}e==="class"||e==="className"?t._propEffects[e]=$(()=>{let o=i()||"";it&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):e==="style"&&typeof i()=="object"?t._propEffects[e]=$(()=>{ot(t,i())}):t._propEffects[e]=$(()=>{Y(t,e,i())})}else Y(t,e,i)}}function Y(t,n,e){if(n==="ref"){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t);return}if(n==="key")return;if(typeof e=="function"&&!n.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=$(()=>Y(t,n,e()));return}if((gt.has(n)||gt.has(n.toLowerCase()))&&!Tt(e)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${e}`);return}let i=it&&t instanceof SVGElement;if(n==="class"||n==="className")i?t.setAttribute("class",e||""):t.className=e||"";else if(n==="dangerouslySetInnerHTML"){let o=e?.__html??"";typeof R<"u"&&R&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else if(n==="innerHTML")if(e&&typeof e=="object"&&"__html"in e){let o=e.__html??"";typeof R<"u"&&R&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else typeof console<"u"&&e!=null&&e!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(n==="style")ot(t,e);else if(e==null){if(n in t)try{t[n]=""}catch{}t.removeAttribute(n)}else n.startsWith("data-")||n.startsWith("aria-")?t.setAttribute(n,e):typeof e=="boolean"?e?t.setAttribute(n,""):t.removeAttribute(n):i?t.setAttribute(n,e):n==="value"&&t.tagName==="SELECT"?ft(t,e):n in t?t[n]=e:t.setAttribute(n,e)}function I(t,n,e,i){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=$(()=>i(t,e()))}function Kt(t,n){if(typeof n=="function")return I(t,"class",n,Kt);it&&t instanceof SVGElement?t.setAttribute("class",n||""):t.className=n||""}function ot(t,n){if(typeof n=="function")return I(t,"style",n,ot);if(typeof n=="string")t.style.cssText=n,t._lastStyleObj=null;else if(n&&typeof n=="object"){let e=t.style,i=t._lastStyleObj;if(i)for(let o in i)o in n||(e[o]="");for(let o in n)e[o]=n[o]??"";t._lastStyleObj=n}else n==null&&(t.style.cssText="",t._lastStyleObj=null)}function Ot(t,n,e){if(typeof e=="function")return I(t,n,e,(i,o)=>Ot(i,n,o));e==null?t.removeAttribute(n):t.setAttribute(n,e)}function Vt(t,n){if(typeof n=="function")return I(t,"value",n,Vt);if(t.tagName==="SELECT"){ft(t,n);return}let e=n==null?"":String(n);t.value!==e&&(t.value=e)}function Wt(t,n){if(typeof n=="function")return I(t,"checked",n,Wt);t.checked=!!n}var pt=new Set;function vt(t){for(let n of t)pt.has(n)||(pt.add(n),document.addEventListener(n,e=>{let i=e.target,o="$$"+n;for(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return i||document}});i;){let r=i[o];if(r&&(r(e),e.cancelBubble))return;i=i.parentNode}}))}function Ft(t,n,e){return t.addEventListener(n,e),()=>t.removeEventListener(n,e)}function te(t,n){$(()=>{for(let e in n){let i=typeof n[e]=="function"?n[e]():n[e];t.classList.toggle(e,!!i)}})}var nt=!1,V=null;function ee(){return nt}function ne(t,n){nt=!0,V={parent:n,index:0};try{return J(t,n)}finally{nt=!1,V=null}}function mt(t){let n=t.childNodes;for(;V.index<n.length;){let e=n[V.index];if(e.nodeType===8){let i=e.textContent;if(i==="$"||i==="/$"||i==="[]"||i==="/[]"){V.index++;continue}}return V.index++,e}return null}function st(){return typeof process<"u"&&!1}function J(t,n){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let i=mt(n),o=String(t);if(i&&i.nodeType===3)return st()&&i.textContent!==o&&(console.warn(`[what] Hydration mismatch: expected text "${o}", got "${i.textContent}"`),i.textContent=o),i;st()&&console.warn(`[what] Hydration mismatch: expected text node "${o}", got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createTextNode(o);return i?n.replaceChild(r,i):n.appendChild(r),r}if(typeof t=="function"){let i=t(),o=J(i,n);return $(()=>{let r=t();nt||(o=Q(n,r,o,null))}),o}if(Array.isArray(t)){let i=[];for(let o of t){let r=J(o,n);r&&i.push(r)}return i.length===1?i[0]:i}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let y=ht(),c=t.tag,h=t.props||{},l=t.children||[],d={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:y[y.length-1]||null,_errorBoundary:null};y.push(d);let s;try{let x=l.length===0?void 0:l.length===1?l[0]:l;s=c({...h,children:x})}catch(x){return y.pop(),console.error("[what] Error in component during hydration:",c.name||"Anonymous",x),null}return y.pop(),d.mounted=!0,d._mountCallbacks&&queueMicrotask(()=>{if(!d.disposed)for(let x of d._mountCallbacks)try{x()}catch(m){console.error("[what] onMount error:",m)}}),J(s,n)}let i=mt(n),o=t.tag.toUpperCase();if(i&&i.nodeType===1&&i.nodeName===o){Pt(i,t.props||{});let y=V;if(V={parent:i,index:0},t.props?.dangerouslySetInnerHTML?.__html==null)for(let h of t.children)J(h,i);return V=y,i}st()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createElement(t.tag);for(let y in t.props||{})y==="children"||y==="key"||Y(r,y,t.props[y]);for(let y of t.children)Q(r,y,null,null);return i?n.replaceChild(r,i):n.appendChild(r),r}if(_t(t))return t;let e=document.createTextNode(String(t));return n.appendChild(e),e}function Pt(t,n){for(let e in n){if(e==="children"||e==="key"||e==="ref"||e==="dangerouslySetInnerHTML"||e==="innerHTML")continue;let i=n[e];if(e.startsWith("on")&&e.length>2){let o=e.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(e.startsWith("$$")){t[e]=i;continue}if(typeof i=="function"&&!e.startsWith("on")){e==="class"||e==="className"?$(()=>{t.className=i()||""}):e==="style"&&typeof i()=="object"?$(()=>{ot(t,i())}):$(()=>{Y(t,e,i())});continue}}}export{Zt as a,Jt as b,Lt as c,Qt as d,St as e,Yt as f,It as g,kt as h,Y as i,Kt as j,ot as k,Ot as l,Vt as m,Wt as n,vt as o,Ft as p,te as q,ee as r,ne as s};
1
+ import{I as W,K as et,M as ht,N as ft,a as R,c as tt,e as $,m as q}from"./chunk-5QCEMXNL.min.js";var Z=null;function Zt(t){Z=typeof t=="function"?t:null}function Jt(t,n,e){if(e&&e.length>0){let i=e.length===1?e[0]:e;n?n.children=i:n={children:i}}return et({tag:t,props:n||{},children:e||[],key:null,_vnode:!0})}var gt=new Set(["href","src","action","formaction","formAction"]);function Tt(t){if(typeof t!="string")return!0;let n=t.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}var wt={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},Et=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function xt(t){let n=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Lt(t){let n=t.trim(),e=xt(n);if(Et.has(e))return St(n);let i=wt[e];if(i){let r=document.createElement("template");r.innerHTML=i.wrap+n+i.unwrap;let y=r.content.firstChild;for(let c=0;c<i.depth;c++)y=y.firstChild;return()=>y.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var dt=!1;function Qt(t){return R&&!dt&&(dt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Lt(t)}function St(t){let n=t.trim();if(xt(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let i=document.createElement("template");return i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>i.content.firstChild.firstChild.cloneNode(!0)}function Yt(t,n,e){if(typeof n=="function"&&n._mapArray)return n(t,e||null);if(typeof n=="function"){let i=e||null,o=null,r=null,y=!1;return $(()=>{let c=n(),h=typeof c;if(!y){y=!0,h==="string"||h==="number"?(r=document.createTextNode(String(c)),i?t.insertBefore(r,i):t.appendChild(r),Z&&Z(t,String(c)),o=r):o=Q(t,c,null,i);return}if(r!==null&&(h==="string"||h==="number")){let l=String(c);r.data!==l&&(r.data=l),Z&&Z(t,l);return}r=null,o=Q(t,c,o,i)}),o}if(typeof n=="string"||typeof n=="number"){let i=document.createTextNode(String(n));return e?t.insertBefore(i,e):t.appendChild(i),i}return n!=null&&typeof n=="object"&&n.nodeType>0?(e?t.insertBefore(n,e):t.appendChild(n),n):Q(t,n,null,e||null)}function _t(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function Mt(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var it=typeof SVGElement<"u";function yt(t){return it&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function bt(t){return t==null?[]:Array.isArray(t)?t:[t]}function Ct(t,n,e){if(t==null||typeof t=="boolean")return e;if(Array.isArray(t)){for(let i=0;i<t.length;i++)Ct(t[i],n,e);return e}if(typeof t=="function"){let i=et(t,n,yt(n));if(i&&i.nodeType===11){let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)e.push(o[r])}else i&&e.push(i);return e}if(typeof t=="string"||typeof t=="number")return e.push(document.createTextNode(String(t))),e;if(_t(t)){if(t.nodeType===11&&t.childNodes.length>0){let i=Array.from(t.childNodes);for(let o=0;o<i.length;o++)e.push(i[o])}else e.push(t);return e}if(Mt(t)){let i=et(t,n,yt(n));if(i&&i.nodeType===11)if(i.childNodes.length===0)e.push(i);else{let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)e.push(o[r])}else i&&e.push(i);return e}return e.push(document.createTextNode(String(t))),e}function jt(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function Q(t,n,e,i){if(!t||typeof t.insertBefore!="function")return R&&console.warn("[what] reconcileInsert called with invalid parent:",t),e;let o=i||null;if(n==null||typeof n=="boolean"){let l=bt(e);for(let d=0;d<l.length;d++){let s=l[d];s.parentNode===t&&(W(s),t.removeChild(s))}return null}if((typeof n=="string"||typeof n=="number")&&e&&!Array.isArray(e)&&e.nodeType===3){let l=String(n);return e.data!==l&&(e.data=l),e}if(typeof n=="object"&&n!==null&&n.nodeType>0&&n.nodeType!==11&&!Array.isArray(n)){if(n===e)return e;if(e&&!Array.isArray(e)&&e.nodeType>0&&e.nodeType!==11)return e.parentNode===t?(W(e),t.replaceChild(n,e)):o?t.insertBefore(n,o):t.appendChild(n),n}let r=Ct(n,t,[]),y=bt(e);if(jt(y,r))return e;let c=r.length;for(let l=0;l<y.length;l++){let d=y[l];if(d.parentNode!==t)continue;let s=!1;for(let x=0;x<c;x++)if(r[x]===d){s=!0;break}s||(W(d),t.removeChild(d))}let h=o;for(let l=r.length-1;l>=0;l--){let d=r[l];(d.parentNode!==t||d.nextSibling!==h)&&(h&&h.parentNode!==t&&(h=null),h?t.insertBefore(d,h):t.appendChild(d)),h=d}return r.length===0?null:r.length===1?r[0]:r}function It(t,n,e){let i=e?.key,o=e?.raw||!1,r=(y,c)=>{let h=[],l=[],d=[],s=i&&!o?new Map:null,x=document.createComment("/list");return y.insertBefore(x,c||null),$(()=>{let m=t()||[],b=x.parentNode||y;i?Dt(b,x,h,m,l,d,n,i,s):Bt(b,x,h,m,l,d,n),h=m.length>0?m.slice():m}),x};return r._mapArray=!0,r}function Bt(t,n,e,i,o,r,y){let c=i.length,h=e.length;if(c===0){if(h>0){for(let u=0;u<h;u++)r[u]&&r[u]();for(let u=h-1;u>=0;u--){let a=o[u];a&&(W(a),a.parentNode===t&&t.removeChild(a))}o.length=0,r.length=0}return}if(h===0){let u=document.createDocumentFragment();for(let a=0;a<c;a++){let w=i[a],L=q(O=>(r[a]=O,y(w,a)));o[a]=L,u.appendChild(L)}t.insertBefore(u,n);return}let l=0,d=Math.min(h,c);for(;l<d&&e[l]===i[l];)l++;if(l===h&&l===c)return;let s=h-1,x=c-1;for(;s>=l&&x>=l&&e[s]===i[x];)s--,x--;let m=new Array(c),b=new Array(c);for(let u=0;u<l;u++)m[u]=o[u],b[u]=r[u];for(let u=x+1;u<c;u++){let a=s+1+(u-x-1);m[u]=o[a],b[u]=r[a]}let _=x-l+1,T=s-l+1;if(_===0)for(let u=l;u<=s;u++)r[u]?.(),o[u]&&W(o[u]),o[u]?.parentNode&&o[u].parentNode.removeChild(o[u]);else if(T===0){let u=l<c&&m[x+1]?m[x+1]:n,a=document.createDocumentFragment();for(let w=l;w<=x;w++){let L=i[w],O=w;m[w]=q(S=>(b[O]=S,y(L,O))),a.appendChild(m[w])}t.insertBefore(a,u)}else Ht(t,n,e,i,o,r,y,l,s,x,m,b);o.length=c,r.length=c;for(let u=0;u<c;u++)o[u]=m[u],r[u]=b[u]}function Ht(t,n,e,i,o,r,y,c,h,l,d,s){let x=new Map;for(let a=c;a<=h;a++)x.set(e[a],a);let m=l-c+1,b=new Int32Array(m);b.fill(-1);for(let a=c;a<=l;a++){let w=x.get(i[a]);w!==void 0&&(x.delete(i[a]),d[a]=o[w],s[a]=r[w],b[a-c]=w)}for(let[,a]of x)r[a]?.(),o[a]&&W(o[a]),o[a]?.parentNode&&o[a].parentNode.removeChild(o[a]);let _=m-Nt(b,m),T=new Uint8Array(m);if(_>1){let a=new Int32Array(_),w=new Int32Array(_),L=0;for(let S=0;S<m;S++)b[S]!==-1&&(a[L]=b[S],w[L]=S,L++);let O=At(a,_);for(let S=0;S<O.length;S++)T[w[O[S]]]=1}else if(_===1){for(let a=0;a<m;a++)if(b[a]!==-1){T[a]=1;break}}for(let a=c;a<=l;a++)if(!d[a]){let w=i[a],L=a;d[a]=q(O=>(s[L]=O,y(w,L)))}let u=l+1<d.length&&d[l+1]?d[l+1]:n;for(let a=l;a>=c;a--){let w=a-c;(b[w]===-1||!T[w])&&(u&&u.parentNode!==t&&(u=n),t.insertBefore(d[a],u)),u=d[a]}}function Nt(t,n){let e=0;for(let i=0;i<n;i++)t[i]===-1&&e++;return e}function At(t,n){if(n===0)return[];if(n===1)return[0];let e=new Int32Array(n),i=new Int32Array(n),o=1;e[0]=0,i[0]=-1;for(let c=1;c<n;c++)if(t[c]>t[e[o-1]])i[c]=e[o-1],e[o++]=c;else{let h=0,l=o-1;for(;h<l;){let d=h+l>>1;t[e[d]]<t[c]?h=d+1:l=d}e[h]=c,i[c]=h>0?e[h-1]:-1}let r=new Array(o),y=e[o-1];for(let c=o-1;c>=0;c--)r[c]=y,y=i[y];return r}function $t(){return document.createComment("i")}function z(t,n,e,i){let o=n;for(;o&&o!==e;){let r=o.nextSibling;t.insertBefore(o,i),o=r}}function ct(t,n,e){let i=n;for(;i&&i!==e;){let o=i.nextSibling;W(i),t.removeChild(i),i=o}}function lt(t,n,e,i,o,r,y,c,h){let l;if(o){let x=i(n),m=h(n);l=m,o.set(x,{itemSig:m})}else l=n;let d=$t();t.appendChild(d);let s=q(x=>(c[e]=x,r(l,e)));t.appendChild(s),y[e]=d}function Dt(t,n,e,i,o,r,y,c,h){let l=i.length,d=e.length;if(l===0){if(d>0){for(let f=0;f<d;f++)r[f]&&r[f]();o[0]&&ct(t,o[0],n),o.length=0,r.length=0,h&&h.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<l;C++)lt(f,i[C],C,c,h,y,o,r,tt);t.insertBefore(f,n);return}let s=0,x=Math.min(d,l);for(;s<x;){if(e[s]===i[s]){s++;continue}let f=c(e[s]),C=c(i[s]);if(f!==C)break;h&&h.get(f).itemSig.set(i[s]),s++}let m=d-1,b=l-1;for(;m>=s&&b>=s;){if(e[m]===i[b]){m--,b--;continue}let f=c(e[m]),C=c(i[b]);if(f!==C)break;h&&h.get(f).itemSig.set(i[b]),m--,b--}if(s>m&&s>b)return;let _=new Array(l),T=new Array(l);for(let f=0;f<s;f++)_[f]=o[f],T[f]=r[f];for(let f=b+1;f<l;f++){let C=m+1+(f-b-1);_[f]=o[C],T[f]=r[C]}let u=b-s+1,a=m-s+1;if(a===0){let f=b+1<l&&_[b+1]?_[b+1]:n,C=document.createDocumentFragment();for(let E=s;E<=b;E++)lt(C,i[E],E,c,h,y,_,T,tt);t.insertBefore(C,f),X(o,r,_,T,l);return}if(u===0){for(let f=s;f<=m;f++){r[f]?.();let C=G(t,o[f],o,f,n);ct(t,o[f],C),h&&h.delete(c(e[f]))}X(o,r,_,T,l);return}if(u===a&&u>=2&&u<=Math.max(a,200)){let f=0,C=-1,E=-1;for(let p=0;p<u&&f<=4;p++){let A=c(e[s+p]),D=c(i[s+p]);A!==D&&(f===0?C=p:f===1&&(E=p),f++)}if(f===2){let p=s+C,A=s+E,D=c(e[p]),K=c(e[A]),U=c(i[p]),v=c(i[A]);if(D===v&&K===U){for(let g=0;g<s;g++)_[g]=o[g],T[g]=r[g];for(let g=s;g<=b;g++)_[g]=o[g],T[g]=r[g];for(let g=b+1;g<l;g++){let N=m+1+(g-b-1);_[g]=o[N],T[g]=r[N]}let P=_[p];_[p]=_[A],_[A]=P;let B=T[p];if(T[p]=T[A],T[A]=B,h){if(i[p]!==e[p]){let g=c(i[p]),N=h.get(g);N&&N.itemSig.set(i[p])}if(i[A]!==e[A]){let g=c(i[A]),N=h.get(g);N&&N.itemSig.set(i[A])}}let j=A===p+1||p===A+1,H=Math.min(p,A),M=Math.max(p,A);if(j){let g=G(t,o[M],o,M,n);z(t,o[M],g,o[H])}else{let g=G(t,o[A],o,A,n),N=document.createComment("tmp");t.insertBefore(N,o[A]),z(t,o[A],g,o[p]);let F=G(t,o[p],o,p,n);z(t,o[p],F,N),t.removeChild(N)}X(o,r,_,T,l);return}}if(f>=2&&f<=u){let p=C,A=null,D=-1,K=-1,U=!1,v=c(e[s+p]),P=-1;for(let B=p;B<u;B++)if(c(i[s+B])===v){P=B;break}if(P>p){let B=!0;for(let j=p;j<P;j++)if(c(e[s+j+1])!==c(i[s+j])){B=!1;break}if(B){let j=!0;for(let H=P+1;H<u;H++)if(c(e[s+H])!==c(i[s+H])){j=!1;break}j&&(U=!0,D=s+p,K=s+P,A=v)}}if(!U){let B=c(i[s+p]),j=-1;for(let H=p;H<a;H++)if(c(e[s+H])===B){j=H;break}if(j>p){let H=!0;for(let M=p;M<j;M++)if(c(e[s+M])!==c(i[s+M+1])){H=!1;break}if(H){let M=!0;for(let g=j+1;g<u;g++)if(c(e[s+g])!==c(i[s+g])){M=!1;break}M&&(U=!0,D=s+j,K=s+p,A=B)}}}if(U){for(let g=s;g<=m;g++)_[g]=o[g],T[g]=r[g];let B=_[D],j=T[D];if(D<K)for(let g=D;g<K;g++)_[g]=_[g+1],T[g]=T[g+1];else for(let g=D;g>K;g--)_[g]=_[g-1],T[g]=T[g-1];if(_[K]=B,T[K]=j,h)for(let g=s;g<=b;g++){let N=c(i[g]);if(i[g]!==e[g]){let F=h.get(N);F&&F.itemSig.set(i[g])}}let H=G(t,B,o,D,n),M;K+1<l?M=_[K+1]:M=n,(K>=b+1||M&&M.parentNode!==t)&&(M=n),z(t,B,H,M),X(o,r,_,T,l);return}}}let w=new Map;for(let f=s;f<=m;f++)w.set(c(e[f]),f);let L=new Int32Array(u);L.fill(-1);for(let f=s;f<=b;f++){let C=c(i[f]),E=w.get(C);E!==void 0&&(w.delete(C),_[f]=o[E],T[f]=r[E],L[f-s]=E,h&&i[f]!==e[E]&&h.get(C).itemSig.set(i[f]))}let O=[...w.values()].sort((f,C)=>C-f);for(let f of O){r[f]?.();let C=G(t,o[f],o,f,n);ct(t,o[f],C),h&&h.delete(c(e[f]))}for(let f=s;f<=b;f++)if(!_[f]){let C=document.createDocumentFragment();lt(C,i[f],f,c,h,y,_,T,tt),_[f]._frag=C}let S=0,ut=!0,at=-1;for(let f=0;f<u;f++)L[f]!==-1&&(S++,L[f]<=at&&(ut=!1),at=L[f]);let k=new Uint8Array(u);if(ut)for(let f=0;f<u;f++)L[f]!==-1&&(k[f]=1);else if(S>1){let f=new Int32Array(S),C=new Int32Array(S),E=0;for(let A=0;A<u;A++)L[A]!==-1&&(f[E]=L[A],C[E]=A,E++);let p=At(f,S);for(let A=0;A<p.length;A++)k[C[p[A]]]=1}else if(S===1){for(let f=0;f<u;f++)if(L[f]!==-1){k[f]=1;break}}X(o,r,_,T,l);let rt=b+1<l&&o[b+1]?o[b+1]:n;for(let f=b;f>=s;f--){let C=f-s,E=o[f];if(L[C]===-1)E._frag&&(t.insertBefore(E._frag,rt),delete E._frag);else if(!k[C]){let p=G(t,E,o,f,n);z(t,E,p,rt)}rt=E}}function G(t,n,e,i,o){let r=n.nextSibling;for(;r&&r!==o;){if(r.nodeType===8&&r.data==="i")return r;r=r.nextSibling}return o}function X(t,n,e,i,o){t.length=o,n.length=o;for(let r=0;r<o;r++)t[r]=e[r],n[r]=i[r]}function kt(t,n){for(let e in n){let i=n[e];if(e.startsWith("on")&&e.length>2){let o=e.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(typeof i=="function"&&!e.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}e==="class"||e==="className"?t._propEffects[e]=$(()=>{let o=i()||"";it&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):e==="style"&&typeof i()=="object"?t._propEffects[e]=$(()=>{ot(t,i())}):t._propEffects[e]=$(()=>{Y(t,e,i())})}else Y(t,e,i)}}function Y(t,n,e){if(n==="ref"){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t);return}if(n==="key")return;if(typeof e=="function"&&!n.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=$(()=>Y(t,n,e()));return}if((gt.has(n)||gt.has(n.toLowerCase()))&&!Tt(e)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${e}`);return}let i=it&&t instanceof SVGElement;if(n==="class"||n==="className")i?t.setAttribute("class",e||""):t.className=e||"";else if(n==="dangerouslySetInnerHTML"){let o=e?.__html??"";typeof R<"u"&&R&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else if(n==="innerHTML")if(e&&typeof e=="object"&&"__html"in e){let o=e.__html??"";typeof R<"u"&&R&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else typeof console<"u"&&e!=null&&e!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(n==="style")ot(t,e);else if(e==null){if(n in t)try{t[n]=""}catch{}t.removeAttribute(n)}else n.startsWith("data-")||n.startsWith("aria-")?t.setAttribute(n,e):typeof e=="boolean"?e?t.setAttribute(n,""):t.removeAttribute(n):i?t.setAttribute(n,e):n==="value"&&t.tagName==="SELECT"?ft(t,e):n in t?t[n]=e:t.setAttribute(n,e)}function I(t,n,e,i){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=$(()=>i(t,e()))}function Kt(t,n){if(typeof n=="function")return I(t,"class",n,Kt);it&&t instanceof SVGElement?t.setAttribute("class",n||""):t.className=n||""}function ot(t,n){if(typeof n=="function")return I(t,"style",n,ot);if(typeof n=="string")t.style.cssText=n,t._lastStyleObj=null;else if(n&&typeof n=="object"){let e=t.style,i=t._lastStyleObj;if(i)for(let o in i)o in n||(e[o]="");for(let o in n)e[o]=n[o]??"";t._lastStyleObj=n}else n==null&&(t.style.cssText="",t._lastStyleObj=null)}function Ot(t,n,e){if(typeof e=="function")return I(t,n,e,(i,o)=>Ot(i,n,o));e==null?t.removeAttribute(n):t.setAttribute(n,e)}function Vt(t,n){if(typeof n=="function")return I(t,"value",n,Vt);if(t.tagName==="SELECT"){ft(t,n);return}let e=n==null?"":String(n);t.value!==e&&(t.value=e)}function Wt(t,n){if(typeof n=="function")return I(t,"checked",n,Wt);t.checked=!!n}var pt=new Set;function vt(t){for(let n of t)pt.has(n)||(pt.add(n),document.addEventListener(n,e=>{let i=e.target,o="$$"+n;for(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return i||document}});i;){let r=i[o];if(r&&(r(e),e.cancelBubble))return;i=i.parentNode}}))}function Ft(t,n,e){return t.addEventListener(n,e),()=>t.removeEventListener(n,e)}function te(t,n){$(()=>{for(let e in n){let i=typeof n[e]=="function"?n[e]():n[e];t.classList.toggle(e,!!i)}})}var nt=!1,V=null;function ee(){return nt}function ne(t,n){nt=!0,V={parent:n,index:0};try{return J(t,n)}finally{nt=!1,V=null}}function mt(t){let n=t.childNodes;for(;V.index<n.length;){let e=n[V.index];if(e.nodeType===8){let i=e.textContent;if(i==="$"||i==="/$"||i==="[]"||i==="/[]"){V.index++;continue}}return V.index++,e}return null}function st(){return typeof process<"u"&&!1}function J(t,n){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let i=mt(n),o=String(t);if(i&&i.nodeType===3)return st()&&i.textContent!==o&&(console.warn(`[what] Hydration mismatch: expected text "${o}", got "${i.textContent}"`),i.textContent=o),i;st()&&console.warn(`[what] Hydration mismatch: expected text node "${o}", got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createTextNode(o);return i?n.replaceChild(r,i):n.appendChild(r),r}if(typeof t=="function"){let i=t(),o=J(i,n);return $(()=>{let r=t();nt||(o=Q(n,r,o,null))}),o}if(Array.isArray(t)){let i=[];for(let o of t){let r=J(o,n);r&&i.push(r)}return i.length===1?i[0]:i}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let y=ht(),c=t.tag,h=t.props||{},l=t.children||[],d={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:y[y.length-1]||null,_errorBoundary:null};y.push(d);let s;try{let x=l.length===0?void 0:l.length===1?l[0]:l;s=c({...h,children:x})}catch(x){return y.pop(),console.error("[what] Error in component during hydration:",c.name||"Anonymous",x),null}return y.pop(),d.mounted=!0,d._mountCallbacks&&queueMicrotask(()=>{if(!d.disposed)for(let x of d._mountCallbacks)try{x()}catch(m){console.error("[what] onMount error:",m)}}),J(s,n)}let i=mt(n),o=t.tag.toUpperCase();if(i&&i.nodeType===1&&i.nodeName===o){Pt(i,t.props||{});let y=V;if(V={parent:i,index:0},t.props?.dangerouslySetInnerHTML?.__html==null)for(let h of t.children)J(h,i);return V=y,i}st()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createElement(t.tag);for(let y in t.props||{})y==="children"||y==="key"||Y(r,y,t.props[y]);for(let y of t.children)Q(r,y,null,null);return i?n.replaceChild(r,i):n.appendChild(r),r}if(_t(t))return t;let e=document.createTextNode(String(t));return n.appendChild(e),e}function Pt(t,n){for(let e in n){if(e==="children"||e==="key"||e==="ref"||e==="dangerouslySetInnerHTML"||e==="innerHTML")continue;let i=n[e];if(e.startsWith("on")&&e.length>2){let o=e.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(e.startsWith("$$")){t[e]=i;continue}if(typeof i=="function"&&!e.startsWith("on")){e==="class"||e==="className"?$(()=>{t.className=i()||""}):e==="style"&&typeof i()=="object"?$(()=>{ot(t,i())}):$(()=>{Y(t,e,i())});continue}}}export{Zt as a,Jt as b,Lt as c,Qt as d,St as e,Yt as f,It as g,kt as h,Y as i,Kt as j,ot as k,Ot as l,Vt as m,Wt as n,vt as o,Ft as p,te as q,ee as r,ne as s};
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as Gt,b as Yt,c as Xt,d as Fe,e as Wt,f as Qt,g as zt,h as Kt,i as Ut,o as Jt,p as Zt,q as en,r as tn,s as nn}from"./chunk-NWRGIVGK.min.js";import{A as Pt,B as Nt,C as Ot,D as $t,E as Ht,F as Vt,G as jt,H as qt,J as Bt,L as $,a as F,b as ht,c as l,d as N,e as O,f as M,g as gt,h as mt,i as le,j as yt,k as xt,l as vt,n as wt,o as bt,p as Et,q as Ct,r as _t,s as At,t as It,u as Rt,v as Tt,w as Mt,x as Lt,y as Dt,z as Ft}from"./chunk-MIAYVSK2.min.js";import{a as w,b as kt,c as St}from"./chunk-O3SKPRTY.min.js";var se=null;function ie(){return se}function rn(e){let t=se;return se=e,t}function on(e,t){let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ee(){if(Q!==void 0)return Q;if(typeof document>"u")return Q=null;let e=document.getElementById("__what_data");if(!e)return Q=null;try{Q=JSON.parse(e.textContent)}catch{Q=null}return Q}function sn(){Q=void 0}function Ce(){let e=Ee();return e?e.loaderData:void 0}function _e(e){let t=Ee();return t&&t.resources?t.resources[e]:void 0}function an(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return Ce()}function j(e){let t=$();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function z(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function cn(e){let t=j("useState"),{index:n,exists:r}=z(t);if(!r){let s=l(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function un(e){let t=j("useSignal"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=l(typeof e=="function"?e():e)),t.hooks[n]}function ln(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function fn(e,t){let n=j("useEffect"),{index:r,exists:o}=z(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),F&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let a=t[i];a!=null&&typeof a!="function"&&console.warn(`[what] useEffect dep at index ${i} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=e();typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(s.cleanup=i)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{for(let a=0;a<t.length;a++){let u=t[a];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=le(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function dn(e,t){let n=j("useMemo"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={computed:N(e)}),n.hooks[r].computed}function pn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function hn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Pe(e){let t=$();for(F&&!t&&console.warn(`[what] useContext(${e?.displayName||"Context"}) called outside of component render. useContext must be called during component rendering, not inside effects or event handlers. Store the context value in a variable during render and use that variable in your callback.`);t;){if(t._contextValues&&t._contextValues.has(e)){let n=t._contextValues.get(e);return n&&n._signal?n():n}t=t._parentCtx}return e._defaultValue}function gn(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=j("Context.Provider");if(o._contextValues||(o._contextValues=new Map),o._contextSignals||(o._contextSignals=new Map),o._contextSignals.has(t))o._contextSignals.get(t).set(n);else{let s=l(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Pe(t);return typeof n=="function"?n(r):n}};return t}function mn(e,t,n){let r=j("useReducer"),{index:o,exists:s}=z(r);if(!s){let a=n?n(t):t,u=l(a),f=c=>{u.set(d=>e(d,c))};r.hooks[o]={signal:u,dispatch:f}}let i=r.hooks[o];return[i.signal,i.dispatch]}function yn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function xn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function vn(e,t={}){if(typeof document>"u"){let c=ie();if(c){let d=t.key!=null?t.key:`__r${c.resourceCounter++}`,h=c.resources.get(d);if(h&&h.status==="ready")return[()=>h.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(h&&h.status==="error")return[()=>{},{loading:()=>!1,error:()=>h.error,refetch:()=>{},mutate:()=>{}}];if(!h){let v=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{c.resources.set(d,{status:"ready",value:b})}).catch(b=>{c.resources.set(d,{status:"error",error:b})});throw c.resources.set(d,{status:"pending",promise:v}),v}throw h.promise}if(t.initialValue!=null)return[()=>t.initialValue,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];throw Promise.resolve().then(()=>e(t.source??!0,{}))}let n=t.initialValue;if(n==null&&t.key!=null){let c=_e(t.key);c!==void 0&&(n=c)}let r=l(n??null),o=l(n==null),s=l(null),i=null,a=async c=>{i&&i.abort(),i=new AbortController;let{signal:d}=i;o.set(!0),s.set(null);try{let h=await e(c,{signal:d});d.aborted||M(()=>{r.set(h),o.set(!1)})}catch(h){d.aborted||M(()=>{s.set(h),o.set(!1)})}},u=c=>{r.set(typeof c=="function"?c(r()):c)},f=$?.();return f&&(f._cleanupCallbacks=f._cleanupCallbacks||[],f._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&a(t.source),[r,{loading:o,error:s,refetch:a,mutate:u}]}function $e(e){return e._storeComputed=!0,e}var Ne=!1;function wn(e){return Ne||(Ne=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),$e(e)}function bn(e){let t={},n={},r={},o={};for(let[s,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(F&&i.length===0&&console.warn(`[what] derived() for "${s}" should accept the state parameter, e.g. derived(state => ...).`),n[s]=i):typeof i=="function"?r[s]=i:t[s]=l(i);for(let[s,i]of Object.entries(n)){let a=new Proxy({},{get(u,f){if(t[f])return t[f]();if(n[f])return n[f]()}});n[s]=N(()=>i(a))}for(let[s,i]of Object.entries(r))r[s]=(...a)=>{let u;return M(()=>{let f=new Proxy({},{get(c,d){if(t[d])return t[d].peek();if(n[d])return n[d].peek();if(r[d])return r[d]},set(c,d,h){return t[d]&&t[d].set(h),!0}});u=i.apply(f,a)}),u};return function(){let i={};for(let[a,u]of Object.entries(t))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(n))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(r))i[a]=u;return i}}var Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ae={title:null,metas:new Map,links:new Map};function Sn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&Cn(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ae.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);Ve("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");Ve("link",s,o)}return r||null}function En(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function Cn(e,{title:t,meta:n,link:r}){if(t!=null&&(e.title=t),n)for(let o of Array.isArray(n)?n:[n])e.metas.set(En(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function _n(){return{title:null,metas:new Map,links:new Map}}function An(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${je(String(e.title))}</title>`);for(let n of e.metas.values())t+=He("meta",n);for(let n of e.links.values())t+=He("link",n);return t}function He(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;n+=` ${r==="httpEquiv"?"http-equiv":r}="${je(String(o))}"`}return n+">"}function je(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ve(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){In(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))o.setAttribute(s,i);document.head.appendChild(o)}function In(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Rn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ae.metas.clear(),Ae.links.clear()}var de=[],pe=[],Re=!1;function G(e){return de.push(e),Be(),()=>{let t=de.indexOf(e);t!==-1&&de.splice(t,1)}}function K(e){return pe.push(e),Be(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function qe(){for(;de.length>0;){let e=de.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Re=!1}function Be(){Re||(Re=!0,requestAnimationFrame(qe))}function Tn(e){return new Promise(t=>{G(()=>{t(e())})})}function Mn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Ln(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ge(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Dn(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var fe=new Map;function Ge(e,t){fe.has(e)?fe.set(e,t):(fe.set(e,t),requestAnimationFrame(()=>{let n=fe.get(e);fe.delete(e),n&&n()}))}var Ie=new WeakMap,xe=null;function Fn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(xe||(xe=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Ie.get(r.target);o&&o(r.contentRect)}})})),Ie.set(e,t),xe.observe(e),()=>{Ie.delete(e),xe.unobserve(e)})}function Pn(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{G(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function Nn(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,i,a;G(()=>{s=window.scrollY;let f=e.getBoundingClientRect();i=s+f.top,a=performance.now(),u()});function u(){G(()=>{let f=performance.now()-a,c=Math.min(f/n,1),d=r(c),h=s+(i-s)*d;K(()=>{window.scrollTo(0,h),c<1?requestAnimationFrame(u):o()})})}})}function Ye(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function Xe(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,i=l(e),a=l(e),u=l(0),f=l(!1),c=null,d=null;function h(y){if(d===null){d=y,c=requestAnimationFrame(h);return}let I=Math.min((y-d)/1e3,.064);d=y;let m=i.peek(),R=a.peek(),_=u.peek(),x=m-R,g=-n*x,L=-r*_,k=(g+L)/o,D=_+k*I,P=m+D*I;if(M(()=>{u.set(D),i.set(P)}),Math.abs(D)<s&&Math.abs(x)<s){M(()=>{i.set(R),u.set(0),f.set(!1)}),c=null,d=null;return}c=requestAnimationFrame(h)}function v(y){a.set(y),c===null&&(f.set(!0),d=null,c=requestAnimationFrame(h))}function b(){c&&(cancelAnimationFrame(c),c=null),f.set(!1),d=null}function E(y){b(),M(()=>{i.set(y),a.set(y),u.set(0)})}let S=$?.();return S&&(S._cleanupCallbacks=S._cleanupCallbacks||[],S._cleanupCallbacks.push(b)),{current:()=>i(),target:()=>a(),velocity:()=>u(),isAnimating:()=>f(),set:v,stop:b,snap:E,subscribe:i.subscribe}}function We(e,t,n={}){let{duration:r=300,easing:o=v=>v*(2-v),onUpdate:s,onComplete:i}=n,a=l(0),u=l(e),f=l(!0),c=null,d=null;function h(v){c===null&&(c=v);let b=v-c,E=Math.min(b/r,1),S=o(E),y=e+(t-e)*S;M(()=>{a.set(E),u.set(y)}),s&&s(y,E),E<1?d=requestAnimationFrame(h):(f.set(!1),i&&i())}return d=requestAnimationFrame(h),{progress:()=>a(),value:()=>u(),isAnimating:()=>f(),cancel:()=>{d&&cancelAnimationFrame(d),f.set(!1)},subscribe:u.subscribe}}var Qe={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*(2*Math.PI/3)),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function On(e={}){let{duration:t=300,easing:n=Qe.easeOutQuad}=e,r=l(!1),o=l(0);async function s(i){return r.set(!0),o.set(0),new Promise(a=>{let u=performance.now();function f(c){let d=c-u,h=Math.min(d/t,1);o.set(n(h)),h<1?requestAnimationFrame(f):(r.set(!1),i&&i(),a())}requestAnimationFrame(f)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function $n(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:i,onTap:a,onLongPress:u,preventDefault:f=!1}=t,c={isDragging:l(!1),startX:0,startY:0,currentX:l(0),currentY:l(0),deltaX:l(0),deltaY:l(0),velocity:l({x:0,y:0})},d=0,h=0,v=0,b=null;function E(x){let g=x.touches?x.touches[0]:x;c.startX=g.clientX,c.startY=g.clientY,h=g.clientX,v=g.clientY,d=performance.now(),c.isDragging.set(!0),r&&r({x:c.startX,y:c.startY}),u&&(b=setTimeout(()=>{c.isDragging.peek()&&u({x:h,y:v})},500))}function S(x){if(!c.isDragging.peek())return;let g=x.touches?x.touches[0]:x,L=g.clientX,k=g.clientY,D=performance.now(),P=D-d;M(()=>{c.currentX.set(L),c.currentY.set(k),c.deltaX.set(L-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(L-h)/P*1e3,y:(k-v)/P*1e3})}),h=L,v=k,d=D,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:L,y:k,deltaX:c.deltaX.peek(),deltaY:c.deltaY.peek(),velocity:c.velocity.peek()})}function y(x){if(!c.isDragging.peek())return;b&&(clearTimeout(b),b=null);let g=c.deltaX.peek(),L=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+L**2)<10&&a&&a({x:c.startX,y:c.startY}),i&&(Math.abs(k.x)>500||Math.abs(k.y)>500)){let P=Math.abs(k.x)>Math.abs(k.y)?k.x>0?"right":"left":k.y>0?"down":"up";i({direction:P,velocity:k})}o&&o({deltaX:g,deltaY:L,velocity:k}),c.isDragging.set(!1)}let I=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],L=x.touches[1],k=Math.sqrt((L.clientX-g.clientX)**2+(L.clientY-g.clientY)**2);I===null&&(I=k);let D=k/I,P=(g.clientX+L.clientX)/2,ee=(g.clientY+L.clientY)/2;s({scale:D,centerX:P,centerY:ee})}function R(){I=null}typeof e=="function"?Ye(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Ye(()=>{let x=e.current;if(x)return _(x)}):e&&_(e);function _(x){return x.addEventListener("mousedown",E),x.addEventListener("touchstart",E,{passive:!f}),window.addEventListener("mousemove",S),window.addEventListener("touchmove",m),window.addEventListener("touchmove",S),window.addEventListener("mouseup",y),window.addEventListener("touchend",y),window.addEventListener("touchend",R),()=>{x.removeEventListener("mousedown",E),x.removeEventListener("touchstart",E),window.removeEventListener("mousemove",S),window.removeEventListener("touchmove",m),window.removeEventListener("touchmove",S),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y),window.removeEventListener("touchend",R)}}return c}function Hn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=Xe(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=We(t.peek(),r,{...o,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(r,o){return()=>{let s=t();for(let i=0;i<r.length-1;i++)if(s>=r[i]&&s<=r[i+1]){let a=(s-r[i])/(r[i+1]-r[i]);return o[i]+(o[i+1]-o[i])*a}return s<=r[0]?o[0]:o[o.length-1]}},subscribe:t.subscribe}}function ze(e){return{enter:`${e}-enter`,enterActive:`${e}-enter-active`,enterDone:`${e}-enter-done`,exit:`${e}-exit`,exitActive:`${e}-exit-active`,exitDone:`${e}-exit-done`}}async function Vn(e,t,n="enter",r=300){let o=ze(t);return new Promise(s=>{K(()=>{e.classList.add(o[n]),G(()=>{e.offsetHeight,K(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{K(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Ue=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Ue.set(e.target)});function jn(){return{current:()=>Ue(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function qn(){let e={current:null};function t(r){typeof document>"u"||(e.current=r||document.activeElement||null)}function n(r){let o=e.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:t,restore:n,previous:()=>e.current}}function Je(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let o=e.current||e;if(!o||typeof o.querySelectorAll!="function")return;let s=Ke(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ke(o),f=u[0],c=u[u.length-1];a.shiftKey?document.activeElement===f&&(a.preventDefault(),c.focus()):document.activeElement===c&&(a.preventDefault(),f.focus())}return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}}function r(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:r}}function Ke(e){let t=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter(n=>n.offsetParent!==null)}function Bn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Je(n),s=null,i=f=>{n.current=f,r.set(c=>c+1)},a=O(()=>{if(r(),s&&(s(),s=null,o.deactivate()),t&&n.current)return s=o.activate(),()=>{s?.(),s=null,o.deactivate()}}),u=$?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{a(),s?.(),s=null,o.deactivate()})),w("div",{ref:i},e)}var U=null,Te=0;function Gn(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.style.cssText=`
1
+ import{a as Yt,b as Xt,c as Wt,d as Pe,e as Qt,f as zt,g as Kt,h as Ut,i as Jt,o as Zt,p as en,q as tn,r as nn,s as rn}from"./chunk-H67HFVDV.min.js";import{A as Nt,B as Ot,C as $t,D as Ht,E as Vt,F as jt,G as qt,H as Bt,J as Gt,L as $,a as F,b as gt,c as l,d as N,e as O,f as M,g as mt,h as yt,i as le,j as xt,k as vt,l as wt,n as bt,o as kt,p as Ct,q as _t,r as At,s as It,t as Rt,u as Tt,v as Mt,w as Lt,x as Dt,y as Ft,z as Pt}from"./chunk-5QCEMXNL.min.js";import{a as w,b as St,c as Et}from"./chunk-O3SKPRTY.min.js";var se=null,fe=null;function on(e){fe||(fe=e)}function ie(){return fe?.getStore()??se}function sn(e){let t=se;return se=e,t}function an(e,t){if(fe)return fe.run(e,t);let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ce(){if(Q!==void 0)return Q;if(typeof document>"u")return Q=null;let e=document.getElementById("__what_data");if(!e)return Q=null;try{Q=JSON.parse(e.textContent)}catch{Q=null}return Q}function cn(){Q=void 0}function _e(){let e=Ce();return e?e.loaderData:void 0}function Ae(e){let t=Ce();return t&&t.resources?t.resources[e]:void 0}function un(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return _e()}function j(e){let t=$();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function z(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function ln(e){let t=j("useState"),{index:n,exists:r}=z(t);if(!r){let s=l(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function fn(e){let t=j("useSignal"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=l(typeof e=="function"?e():e)),t.hooks[n]}function dn(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function pn(e,t){let n=j("useEffect"),{index:r,exists:o}=z(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),F&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let a=t[i];a!=null&&typeof a!="function"&&console.warn(`[what] useEffect dep at index ${i} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=e();typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(s.cleanup=i)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{for(let a=0;a<t.length;a++){let u=t[a];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=le(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function hn(e,t){let n=j("useMemo"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={computed:N(e)}),n.hooks[r].computed}function gn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function mn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ne(e){let t=$();for(F&&!t&&console.warn(`[what] useContext(${e?.displayName||"Context"}) called outside of component render. useContext must be called during component rendering, not inside effects or event handlers. Store the context value in a variable during render and use that variable in your callback.`);t;){if(t._contextValues&&t._contextValues.has(e)){let n=t._contextValues.get(e);return n&&n._signal?n():n}t=t._parentCtx}return e._defaultValue}function yn(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=j("Context.Provider");if(o._contextValues||(o._contextValues=new Map),o._contextSignals||(o._contextSignals=new Map),o._contextSignals.has(t))o._contextSignals.get(t).set(n);else{let s=l(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Ne(t);return typeof n=="function"?n(r):n}};return t}function xn(e,t,n){let r=j("useReducer"),{index:o,exists:s}=z(r);if(!s){let a=n?n(t):t,u=l(a),f=c=>{u.set(d=>e(d,c))};r.hooks[o]={signal:u,dispatch:f}}let i=r.hooks[o];return[i.signal,i.dispatch]}function vn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function wn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function bn(e,t={}){if(typeof document>"u"){let c=ie();if(c){let d=t.key!=null?t.key:`__r${c.resourceCounter++}`,h=c.resources.get(d);if(h&&h.status==="ready")return[()=>h.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(h&&h.status==="error")return[()=>{},{loading:()=>!1,error:()=>h.error,refetch:()=>{},mutate:()=>{}}];if(!h){let v=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{c.resources.set(d,{status:"ready",value:b})}).catch(b=>{c.resources.set(d,{status:"error",error:b})});throw c.resources.set(d,{status:"pending",promise:v}),v}throw h.promise}if(t.initialValue!=null)return[()=>t.initialValue,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];throw Promise.resolve().then(()=>e(t.source??!0,{}))}let n=t.initialValue;if(n==null&&t.key!=null){let c=Ae(t.key);c!==void 0&&(n=c)}let r=l(n??null),o=l(n==null),s=l(null),i=null,a=async c=>{i&&i.abort(),i=new AbortController;let{signal:d}=i;o.set(!0),s.set(null);try{let h=await e(c,{signal:d});d.aborted||M(()=>{r.set(h),o.set(!1)})}catch(h){d.aborted||M(()=>{s.set(h),o.set(!1)})}},u=c=>{r.set(typeof c=="function"?c(r()):c)},f=$?.();return f&&(f._cleanupCallbacks=f._cleanupCallbacks||[],f._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&a(t.source),[r,{loading:o,error:s,refetch:a,mutate:u}]}function He(e){return e._storeComputed=!0,e}var Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),He(e)}function Sn(e){let t={},n={},r={},o={};for(let[s,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(F&&i.length===0&&console.warn(`[what] derived() for "${s}" should accept the state parameter, e.g. derived(state => ...).`),n[s]=i):typeof i=="function"?r[s]=i:t[s]=l(i);for(let[s,i]of Object.entries(n)){let a=new Proxy({},{get(u,f){if(t[f])return t[f]();if(n[f])return n[f]()}});n[s]=N(()=>i(a))}for(let[s,i]of Object.entries(r))r[s]=(...a)=>{let u;return M(()=>{let f=new Proxy({},{get(c,d){if(t[d])return t[d].peek();if(n[d])return n[d].peek();if(r[d])return r[d]},set(c,d,h){return t[d]&&t[d].set(h),!0}});u=i.apply(f,a)}),u};return function(){let i={};for(let[a,u]of Object.entries(t))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(n))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(r))i[a]=u;return i}}var $e=!1;function En(e){return $e||($e=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ie={title:null,metas:new Map,links:new Map};function Cn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&An(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ie.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);je("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");je("link",s,o)}return r||null}function _n(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function An(e,{title:t,meta:n,link:r}){if(t!=null&&(e.title=t),n)for(let o of Array.isArray(n)?n:[n])e.metas.set(_n(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function In(){return{title:null,metas:new Map,links:new Map}}function Rn(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${qe(String(e.title))}</title>`);for(let n of e.metas.values())t+=Ve("meta",n);for(let n of e.links.values())t+=Ve("link",n);return t}function Ve(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;n+=` ${r==="httpEquiv"?"http-equiv":r}="${qe(String(o))}"`}return n+">"}function qe(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function je(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){Tn(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))o.setAttribute(s,i);document.head.appendChild(o)}function Tn(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Mn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ie.metas.clear(),Ie.links.clear()}var pe=[],he=[],Te=!1;function G(e){return pe.push(e),Ge(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function K(e){return he.push(e),Ge(),()=>{let t=he.indexOf(e);t!==-1&&he.splice(t,1)}}function Be(){for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;he.length>0;){let e=he.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Te=!1}function Ge(){Te||(Te=!0,requestAnimationFrame(Be))}function Ln(e){return new Promise(t=>{G(()=>{t(e())})})}function Dn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Fn(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ye(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Pn(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var de=new Map;function Ye(e,t){de.has(e)?de.set(e,t):(de.set(e,t),requestAnimationFrame(()=>{let n=de.get(e);de.delete(e),n&&n()}))}var Re=new WeakMap,ve=null;function Nn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(ve||(ve=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Re.get(r.target);o&&o(r.contentRect)}})})),Re.set(e,t),ve.observe(e),()=>{Re.delete(e),ve.unobserve(e)})}function On(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{G(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function $n(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,i,a;G(()=>{s=window.scrollY;let f=e.getBoundingClientRect();i=s+f.top,a=performance.now(),u()});function u(){G(()=>{let f=performance.now()-a,c=Math.min(f/n,1),d=r(c),h=s+(i-s)*d;K(()=>{window.scrollTo(0,h),c<1?requestAnimationFrame(u):o()})})}})}function Xe(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function We(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,i=l(e),a=l(e),u=l(0),f=l(!1),c=null,d=null;function h(y){if(d===null){d=y,c=requestAnimationFrame(h);return}let I=Math.min((y-d)/1e3,.064);d=y;let m=i.peek(),R=a.peek(),_=u.peek(),x=m-R,g=-n*x,L=-r*_,k=(g+L)/o,D=_+k*I,P=m+D*I;if(M(()=>{u.set(D),i.set(P)}),Math.abs(D)<s&&Math.abs(x)<s){M(()=>{i.set(R),u.set(0),f.set(!1)}),c=null,d=null;return}c=requestAnimationFrame(h)}function v(y){a.set(y),c===null&&(f.set(!0),d=null,c=requestAnimationFrame(h))}function b(){c&&(cancelAnimationFrame(c),c=null),f.set(!1),d=null}function E(y){b(),M(()=>{i.set(y),a.set(y),u.set(0)})}let S=$?.();return S&&(S._cleanupCallbacks=S._cleanupCallbacks||[],S._cleanupCallbacks.push(b)),{current:()=>i(),target:()=>a(),velocity:()=>u(),isAnimating:()=>f(),set:v,stop:b,snap:E,subscribe:i.subscribe}}function Qe(e,t,n={}){let{duration:r=300,easing:o=v=>v*(2-v),onUpdate:s,onComplete:i}=n,a=l(0),u=l(e),f=l(!0),c=null,d=null;function h(v){c===null&&(c=v);let b=v-c,E=Math.min(b/r,1),S=o(E),y=e+(t-e)*S;M(()=>{a.set(E),u.set(y)}),s&&s(y,E),E<1?d=requestAnimationFrame(h):(f.set(!1),i&&i())}return d=requestAnimationFrame(h),{progress:()=>a(),value:()=>u(),isAnimating:()=>f(),cancel:()=>{d&&cancelAnimationFrame(d),f.set(!1)},subscribe:u.subscribe}}var ze={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*(2*Math.PI/3)),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function Hn(e={}){let{duration:t=300,easing:n=ze.easeOutQuad}=e,r=l(!1),o=l(0);async function s(i){return r.set(!0),o.set(0),new Promise(a=>{let u=performance.now();function f(c){let d=c-u,h=Math.min(d/t,1);o.set(n(h)),h<1?requestAnimationFrame(f):(r.set(!1),i&&i(),a())}requestAnimationFrame(f)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function Vn(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:i,onTap:a,onLongPress:u,preventDefault:f=!1}=t,c={isDragging:l(!1),startX:0,startY:0,currentX:l(0),currentY:l(0),deltaX:l(0),deltaY:l(0),velocity:l({x:0,y:0})},d=0,h=0,v=0,b=null;function E(x){let g=x.touches?x.touches[0]:x;c.startX=g.clientX,c.startY=g.clientY,h=g.clientX,v=g.clientY,d=performance.now(),c.isDragging.set(!0),r&&r({x:c.startX,y:c.startY}),u&&(b=setTimeout(()=>{c.isDragging.peek()&&u({x:h,y:v})},500))}function S(x){if(!c.isDragging.peek())return;let g=x.touches?x.touches[0]:x,L=g.clientX,k=g.clientY,D=performance.now(),P=D-d;M(()=>{c.currentX.set(L),c.currentY.set(k),c.deltaX.set(L-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(L-h)/P*1e3,y:(k-v)/P*1e3})}),h=L,v=k,d=D,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:L,y:k,deltaX:c.deltaX.peek(),deltaY:c.deltaY.peek(),velocity:c.velocity.peek()})}function y(x){if(!c.isDragging.peek())return;b&&(clearTimeout(b),b=null);let g=c.deltaX.peek(),L=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+L**2)<10&&a&&a({x:c.startX,y:c.startY}),i&&(Math.abs(k.x)>500||Math.abs(k.y)>500)){let P=Math.abs(k.x)>Math.abs(k.y)?k.x>0?"right":"left":k.y>0?"down":"up";i({direction:P,velocity:k})}o&&o({deltaX:g,deltaY:L,velocity:k}),c.isDragging.set(!1)}let I=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],L=x.touches[1],k=Math.sqrt((L.clientX-g.clientX)**2+(L.clientY-g.clientY)**2);I===null&&(I=k);let D=k/I,P=(g.clientX+L.clientX)/2,ee=(g.clientY+L.clientY)/2;s({scale:D,centerX:P,centerY:ee})}function R(){I=null}typeof e=="function"?Xe(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Xe(()=>{let x=e.current;if(x)return _(x)}):e&&_(e);function _(x){return x.addEventListener("mousedown",E),x.addEventListener("touchstart",E,{passive:!f}),window.addEventListener("mousemove",S),window.addEventListener("touchmove",m),window.addEventListener("touchmove",S),window.addEventListener("mouseup",y),window.addEventListener("touchend",y),window.addEventListener("touchend",R),()=>{x.removeEventListener("mousedown",E),x.removeEventListener("touchstart",E),window.removeEventListener("mousemove",S),window.removeEventListener("touchmove",m),window.removeEventListener("touchmove",S),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y),window.removeEventListener("touchend",R)}}return c}function jn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=We(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=Qe(t.peek(),r,{...o,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(r,o){return()=>{let s=t();for(let i=0;i<r.length-1;i++)if(s>=r[i]&&s<=r[i+1]){let a=(s-r[i])/(r[i+1]-r[i]);return o[i]+(o[i+1]-o[i])*a}return s<=r[0]?o[0]:o[o.length-1]}},subscribe:t.subscribe}}function Ke(e){return{enter:`${e}-enter`,enterActive:`${e}-enter-active`,enterDone:`${e}-enter-done`,exit:`${e}-exit`,exitActive:`${e}-exit-active`,exitDone:`${e}-exit-done`}}async function qn(e,t,n="enter",r=300){let o=Ke(t);return new Promise(s=>{K(()=>{e.classList.add(o[n]),G(()=>{e.offsetHeight,K(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{K(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Je=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Je.set(e.target)});function Bn(){return{current:()=>Je(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function Gn(){let e={current:null};function t(r){typeof document>"u"||(e.current=r||document.activeElement||null)}function n(r){let o=e.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:t,restore:n,previous:()=>e.current}}function Ze(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let o=e.current||e;if(!o||typeof o.querySelectorAll!="function")return;let s=Ue(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ue(o),f=u[0],c=u[u.length-1];a.shiftKey?document.activeElement===f&&(a.preventDefault(),c.focus()):document.activeElement===c&&(a.preventDefault(),f.focus())}return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}}function r(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:r}}function Ue(e){let t=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter(n=>n.offsetParent!==null)}function Yn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Ze(n),s=null,i=f=>{n.current=f,r.set(c=>c+1)},a=O(()=>{if(r(),s&&(s(),s=null,o.deactivate()),t&&n.current)return s=o.activate(),()=>{s?.(),s=null,o.deactivate()}}),u=$?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{a(),s?.(),s=null,o.deactivate()})),w("div",{ref:i},e)}var U=null,Me=0;function Xn(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.style.cssText=`
2
2
  position: absolute;
3
3
  width: 1px;
4
4
  height: 1px;
@@ -8,7 +8,7 @@ import{a as Gt,b as Yt,c as Xt,d as Fe,e as Wt,f as Qt,g as zt,h as Kt,i as Ut,o
8
8
  clip: rect(0, 0, 0, 0);
9
9
  white-space: nowrap;
10
10
  border: 0;
11
- `,document.body.appendChild(U)),U)}function Ze(e,t={}){let{priority:n="polite",timeout:r=1e3}=t,o=Gn();if(!o)return;o.setAttribute("aria-live",n);let s=++Te;o.textContent="",requestAnimationFrame(()=>{Te===s&&(o.textContent=e)}),setTimeout(()=>{Te===s&&(o.textContent="")},r)}function Yn(e){return Ze(e,{priority:"assertive"})}function Xn({href:e="#main",children:t="Skip to content"}){return w("a",{href:e,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(e);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},t)}function Wn(e=!1){let t=l(e);return{expanded:()=>t(),toggle:()=>t.set(!t.peek()),open:()=>t.set(!0),close:()=>t.set(!1),buttonProps:()=>({"aria-expanded":t(),onClick:()=>t.set(!t.peek())}),panelProps:()=>({hidden:!t()})}}function Qn(e=null){let t=l(e);return{selected:()=>t(),select:n=>t.set(n),isSelected:n=>t()===n,itemProps:n=>({"aria-selected":t()===n,onClick:()=>t.set(n)})}}function zn(e=!1){let t=l(e);return{checked:()=>t(),toggle:()=>t.set(!t.peek()),set:n=>t.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":t(),tabIndex:0,onClick:()=>t.set(!t.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),t.set(!t.peek()))}})}}function Kn(e){let t=typeof e=="function"?e:()=>e,n=l(0);function r(o){let s=t();if(!(s<=0))switch(o.key){case"ArrowDown":case"ArrowRight":o.preventDefault(),n.set((n.peek()+1)%s);break;case"ArrowUp":case"ArrowLeft":o.preventDefault(),n.set((n.peek()-1+s)%s);break;case"Home":o.preventDefault(),n.set(0);break;case"End":o.preventDefault(),n.set(s-1);break}}return{focusIndex:()=>n(),setFocusIndex:o=>n.set(o),getItemProps:o=>({tabIndex:n()===o?0:-1,onKeyDown:r,onFocus:()=>n.set(o)}),containerProps:()=>({role:"listbox"})}}function Un({children:e,as:t="span"}){return w(t,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},e)}function Jn({children:e,priority:t="polite",atomic:n=!0}){return w("div",{"aria-live":t,"aria-atomic":n},e)}var et=0;function Me(e="what"){let t=`${e}-${++et}`;return()=>t}function Zn(e,t="what"){let n=[];for(let r=0;r<e;r++)n.push(`${t}-${++et}`);return n}function er(e){let t=Me("desc");return{descriptionId:t,descriptionProps:()=>({id:t(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":t()}),Description:()=>w("div",{id:t(),style:{display:"none"}},e)}}function tr(e){let t=Me("label");return{labelId:t,labelProps:()=>({id:t()}),labelledByProps:()=>({"aria-labelledby":t()})}}var nr={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function rr(e,t){return n=>{n.key===e&&t(n)}}function or(e,t){return n=>{e.includes(n.key)&&t(n)}}var sr=`
11
+ `,document.body.appendChild(U)),U)}function et(e,t={}){let{priority:n="polite",timeout:r=1e3}=t,o=Xn();if(!o)return;o.setAttribute("aria-live",n);let s=++Me;o.textContent="",requestAnimationFrame(()=>{Me===s&&(o.textContent=e)}),setTimeout(()=>{Me===s&&(o.textContent="")},r)}function Wn(e){return et(e,{priority:"assertive"})}function Qn({href:e="#main",children:t="Skip to content"}){return w("a",{href:e,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(e);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},t)}function zn(e=!1){let t=l(e);return{expanded:()=>t(),toggle:()=>t.set(!t.peek()),open:()=>t.set(!0),close:()=>t.set(!1),buttonProps:()=>({"aria-expanded":t(),onClick:()=>t.set(!t.peek())}),panelProps:()=>({hidden:!t()})}}function Kn(e=null){let t=l(e);return{selected:()=>t(),select:n=>t.set(n),isSelected:n=>t()===n,itemProps:n=>({"aria-selected":t()===n,onClick:()=>t.set(n)})}}function Un(e=!1){let t=l(e);return{checked:()=>t(),toggle:()=>t.set(!t.peek()),set:n=>t.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":t(),tabIndex:0,onClick:()=>t.set(!t.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),t.set(!t.peek()))}})}}function Jn(e){let t=typeof e=="function"?e:()=>e,n=l(0);function r(o){let s=t();if(!(s<=0))switch(o.key){case"ArrowDown":case"ArrowRight":o.preventDefault(),n.set((n.peek()+1)%s);break;case"ArrowUp":case"ArrowLeft":o.preventDefault(),n.set((n.peek()-1+s)%s);break;case"Home":o.preventDefault(),n.set(0);break;case"End":o.preventDefault(),n.set(s-1);break}}return{focusIndex:()=>n(),setFocusIndex:o=>n.set(o),getItemProps:o=>({tabIndex:n()===o?0:-1,onKeyDown:r,onFocus:()=>n.set(o)}),containerProps:()=>({role:"listbox"})}}function Zn({children:e,as:t="span"}){return w(t,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},e)}function er({children:e,priority:t="polite",atomic:n=!0}){return w("div",{"aria-live":t,"aria-atomic":n},e)}var tt=0;function Le(e="what"){let t=`${e}-${++tt}`;return()=>t}function tr(e,t="what"){let n=[];for(let r=0;r<e;r++)n.push(`${t}-${++tt}`);return n}function nr(e){let t=Le("desc");return{descriptionId:t,descriptionProps:()=>({id:t(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":t()}),Description:()=>w("div",{id:t(),style:{display:"none"}},e)}}function rr(e){let t=Le("label");return{labelId:t,labelProps:()=>({id:t()}),labelledByProps:()=>({"aria-labelledby":t()})}}var or={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function sr(e,t){return n=>{n.key===e&&t(n)}}function ir(e,t){return n=>{e.includes(n.key)&&t(n)}}var ar=`
12
12
  .what-skeleton {
13
13
  background: linear-gradient(
14
14
  90deg,
@@ -60,7 +60,7 @@ import{a as Gt,b as Yt,c as Xt,d as Fe,e as Wt,f as Qt,g as zt,h as Kt,i as Ut,o
60
60
  0% { transform: translateX(-100%); }
61
61
  100% { transform: translateX(100%); }
62
62
  }
63
- `,tt=!1;function te(){if(tt||typeof document>"u")return;tt=!0;let e=document.createElement("style");e.textContent=sr,document.head.appendChild(e)}function Le({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:i=1}){te();let a=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=o?`${a} ${o}`:a,f={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return i===1?w("div",{class:u,style:f,"aria-hidden":"true"}):Array.from({length:i},(c,d)=>w("div",{key:d,class:u,style:{...f,marginBottom:d<i-1?"8px":void 0},"aria-hidden":"true"}))}function De({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return te(),w("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,i)=>w("div",{key:i,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:i===e-1?t:"100%",marginBottom:i<e-1?`${r}px`:void 0}})))}function ir({size:e=40,variant:t="shimmer"}){return Le({width:e,height:e,circle:!0,variant:t})}function nt({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-card","aria-hidden":"true"},w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),De({lines:t,variant:n}))}function ar({rows:e=5,columns:t=4,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-table","aria-hidden":"true"},w("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>w("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>w("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,i)=>w("div",{key:i,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function cr({type:e="default",height:t,children:n}){return te(),e==="card"?nt({}):e==="text"?De({}):n||w("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function ur(e,t=[]){let n=l(!0),r=l(null),o=l(null);return O(()=>{n.set(!0),o.set(null),Promise.resolve(e()).then(s=>{r.set(s),n.set(!1)}).catch(s=>{o.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>o(),Skeleton:s=>n()?Le(s):null}}function lr({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return te(),w("div",{class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":n,role:"status"},r&&w("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function fr({size:e=8,color:t="#666"}){te();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return w("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},w("div",{style:{...n,animationDelay:"0s"}}),w("div",{style:{...n,animationDelay:"0.2s"}}),w("div",{style:{...n,animationDelay:"0.4s"}}))}function dr({size:e=24,color:t="#666",strokeWidth:n=2}){return w("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},w("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),w("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var H=new Map,J=new Map,Z=new Map,q=new Map,rt=200;function ve(e){return q.set(e,Date.now()),H.has(e)||(H.set(e,l(null)),H.size>rt&&hr()),H.get(e)}function ot(e){return J.has(e)||J.set(e,l(null)),J.get(e)}function pr(e){return Z.has(e)||Z.set(e,l(!1)),Z.get(e)}function hr(){let e=[...q.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(rt*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];Y.has(r)&&Y.get(r).size>0||(H.delete(r),J.delete(r),Z.delete(r),q.delete(r),he.delete(r))}}var Y=new Map;function st(e,t){return Y.has(e)||Y.set(e,new Set),Y.get(e).add(t),()=>{let n=Y.get(e);n&&(n.delete(t),n.size===0&&Y.delete(e))}}var ne=new Map,he=new Map;function X(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function gr(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=h=>h,initialData:i=null}=t,a=l(i),u=l(null),f=l(!0),c=null;async function d(){c&&c.abort(),c=new AbortController;let{signal:h}=c;f.set(!0),u.set(null);try{let v=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:h});if(!v.ok)throw new Error(`HTTP ${v.status}: ${v.statusText}`);let b=await v.json();h.aborted||a.set(s(b))}catch(v){h.aborted||u.set(v)}finally{h.aborted||f.set(!1)}}return X(()=>(d(),()=>{c&&c.abort()})),{data:()=>a(),error:()=>u(),isLoading:()=>f(),refetch:d,mutate:h=>a.set(h)}}function mr(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:i=2e3,fallbackData:a,onSuccess:u,onError:f,suspense:c=!1}=n;if(e==null||e===!1){let m=l(a||null),R=l(null);return{data:()=>m(),error:()=>R(),isLoading:()=>!1,isValidating:()=>!1,mutate:_=>m.set(typeof _=="function"?_(m()):_),revalidate:()=>Promise.resolve()}}let d=ve(e),h=ot(e),v=pr(e),b=N(()=>d()??a??null),E=N(()=>d()==null&&v()),S=null;async function y(){let m=Date.now();if(ne.has(e)){let g=ne.get(e);if(m-g.timestamp<i)return g.refCount++,g.promise}let R=he.get(e);if(R&&m-R<i&&d.peek()!=null)return d.peek();if(S){let g=ne.get(e);(!g||g.refCount<=1)&&S.abort()}S=new AbortController;let{signal:_}=S;v.set(!0);let x=t(e,{signal:_});ne.set(e,{promise:x,timestamp:m,refCount:1});try{let g=await x;return _.aborted?void 0:(M(()=>{d.set(g),h.set(null)}),q.set(e,Date.now()),he.set(e,Date.now()),u&&u(g,e),g)}catch(g){if(_.aborted)return;throw h.set(g),f&&f(g,e),g}finally{_.aborted||v.set(!1);let g=ne.get(e);g&&(g.refCount--,g.refCount<=0&&ne.delete(e))}}let I=st(e,()=>y().catch(()=>{}));return X(()=>(y().catch(()=>{}),()=>{S&&S.abort(),I()})),r&&typeof window<"u"&&X(()=>{let m=()=>{document.visibilityState==="visible"&&y().catch(()=>{})};return document.addEventListener("visibilitychange",m),()=>document.removeEventListener("visibilitychange",m)}),o&&typeof window<"u"&&X(()=>{let m=()=>y().catch(()=>{});return window.addEventListener("online",m),()=>window.removeEventListener("online",m)}),s>0&&X(()=>{let m=setInterval(()=>{y().catch(()=>{})},s);return()=>clearInterval(m)}),{data:()=>b(),error:()=>h(),isLoading:()=>E(),isValidating:()=>v(),mutate:(m,R=!0)=>{let _=typeof m=="function"?m(d.peek()):m;d.set(_),q.set(e,Date.now()),R&&y().catch(()=>{})},revalidate:y}}function yr(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:i=!0,refetchInterval:a=!1,retry:u=3,retryDelay:f=k=>Math.min(1e3*2**k,3e4),onSuccess:c,onError:d,onSettled:h,select:v,placeholderData:b}=e,E=Array.isArray(t)?t.join(":"):t,S=ve(E),y=N(()=>{let k=S();return v&&k!==null?v(k):k}),I=ot(E),m=l(S.peek()!=null?"success":"loading"),R=l("idle"),_=0,x=null;async function g(){if(!r)return;let k=Date.now();if(S.peek()!=null&&k-_<o)return S.peek();x&&x.abort(),x=new AbortController;let{signal:D}=x;R.set("fetching"),S.peek()==null&&m.set("loading");let P=0;async function ee(){try{let V=await n({queryKey:Array.isArray(t)?t:[t],signal:D});return D.aborted?void 0:(M(()=>{S.set(V),I.set(null),m.set("success"),R.set("idle")}),_=Date.now(),q.set(E,Date.now()),c&&c(V),h&&h(V,null),setTimeout(()=>{if(Date.now()-_>=s){let B=Y.get(E);(!B||B.size===0)&&(H.delete(E),J.delete(E),Z.delete(E),q.delete(E),he.delete(E))}},s),V)}catch(V){if(D.aborted)return;if(P++,P<u)return await new Promise((B,ke)=>{let Se=setTimeout(B,f(P));D.addEventListener("abort",()=>{clearTimeout(Se),ke(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(B=>{if(B.name!=="AbortError")throw B}),D.aborted?void 0:ee();throw M(()=>{I.set(V),m.set("error"),R.set("idle")}),d&&d(V),h&&h(null,V),V}}return ee()}let L=st(E,()=>g().catch(()=>{}));return X(()=>(r&&g().catch(()=>{}),()=>{x&&x.abort(),L()})),i&&typeof window<"u"&&X(()=>{let k=()=>{document.visibilityState==="visible"&&g().catch(()=>{})};return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)}),a&&X(()=>{let k=setInterval(()=>{g().catch(()=>{})},a);return()=>clearInterval(k)}),{data:()=>y()??b,error:()=>I(),status:()=>m(),fetchStatus:()=>R(),isLoading:()=>m()==="loading",isError:()=>m()==="error",isSuccess:()=>m()==="success",isFetching:()=>R()==="fetching",refetch:g}}function xr(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,...i}=e,a=l([]),u=l([s]),f=l(!0),c=l(!1),d=l(!1),h=l(!1),v=Array.isArray(t)?t.join(":"):t,b=null,E=!1;async function S(y,I="next"){b&&b.abort(),b=new AbortController;let{signal:m}=b,R=I==="next"?d:h;R.set(!0);try{let _=await n({queryKey:Array.isArray(t)?t:[t],pageParam:y,signal:m});return m.aborted?void 0:(M(()=>{E?(a.set([_]),u.set([y]),E=!1):I==="next"?(a.set([...a.peek(),_]),u.set([...u.peek(),y])):(a.set([_,...a.peek()]),u.set([y,...u.peek()]));let x=r?.(_,a.peek());if(f.set(x!==void 0),o){let g=o(_,a.peek());c.set(g!==void 0)}}),_)}finally{m.aborted||R.set(!1)}}return X(()=>(S(s).catch(()=>{}),()=>{b&&b.abort()})),{data:()=>({pages:a(),pageParams:u()}),hasNextPage:()=>f(),hasPreviousPage:()=>c(),isFetchingNextPage:()=>d(),isFetchingPreviousPage:()=>h(),fetchNextPage:async()=>{let y=a.peek()[a.peek().length-1],I=r?.(y,a.peek());if(I!==void 0)return S(I,"next")},fetchPreviousPage:async()=>{let y=a.peek()[0],I=o?.(y,a.peek());if(I!==void 0)return S(I,"previous")},refetch:async()=>(E=!0,S(s))}}function vr(e,t={}){let{hard:n=!1}=t,r=[];if(typeof e=="function")for(let[o]of H)e(o)&&r.push(o);else r.push(e);for(let o of r){n&&H.has(o)&&H.get(o).set(null);let s=Y.get(o);if(s)for(let i of s)i()}}function wr(e,t){let n=ve(e);return t(e).then(r=>(n.set(r),q.set(e,Date.now()),r))}function br(e,t){let n=ve(e),r=n.peek();n.set(typeof t=="function"?t(r):t),q.set(e,Date.now())}function kr(e){return H.has(e)?H.get(e).peek():void 0}function Sr(){H.clear(),J.clear(),Z.clear(),q.clear(),he.clear(),ne.clear()}function Er(){let e=[];for(let[t,n]of H)e.push({key:t,data:n.peek(),error:J.has(t)?J.get(t).peek():null,isValidating:Z.has(t)?Z.get(t).peek():!1});return e}function Cr(e={}){let t=$?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=it(e)),t.hooks[n]}return it(e)}function it(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},i={},a={},u=l({});function f(p){return s[p]||(s[p]=l(t[p]??"")),s[p]}function c(p){return i[p]||(i[p]=l(null)),i[p]}function d(p){return a[p]||(a[p]=l(!1)),a[p]}let h=l(!1),v=l(!1),b=l(!1),E=l(!1),S=l(0);function y(p=!1){let C={...t};for(let[A,T]of Object.entries(s))C[A]=p?T():T.peek();return C}function I(p=!1){return p?u():u.peek()}function m(p,C){let A=C??null;c(p).set(A),u.set(T=>{if(T[p]===A)return T;if(A==null){if(!Object.prototype.hasOwnProperty.call(T,p))return T;let W={...T};return delete W[p],W}return{...T,[p]:A}})}function R(p={}){let C=p||{};M(()=>{for(let[A,T]of Object.entries(i))Object.prototype.hasOwnProperty.call(C,A)||T.set(null);for(let[A,T]of Object.entries(C))c(A).set(T??null);u.set({...C})})}let _=N(()=>Object.keys(I(!0)).length===0),x=N(()=>{let p={};for(let[C,A]of Object.entries(s))A()!==(t[C]??"")&&(p[C]=!0);return p});async function g(p){if(!o)return!0;E.set(!0);try{let A=(await o(y(!1)))?.errors||{};if(p){let T=A[p]??null;return m(p,T),!T}else return R(A),Object.keys(A).length===0}finally{E.set(!1)}}function L(p,C={}){let A=f(p),T=C.type==="checkbox"||C.type==="radio",ue=ye=>{let pt=ye.target.type==="checkbox"||ye.target.type==="radio"?ye.target.checked:ye.target.value;k(p,pt),(n==="onChange"||b.peek()&&r==="onChange")&&g(p)},W={name:p,onBlur:()=>{d(p).set(!0),(n==="onBlur"||b.peek()&&r==="onBlur")&&g(p)},onFocus:()=>{},ref:C.ref};return T?(Object.defineProperty(W,"checked",{get(){return!!A()},enumerable:!0}),W.onchange=ue):(Object.defineProperty(W,"value",{get(){return A()},enumerable:!0}),W.oninput=ue),W}function k(p,C,A={}){let{shouldValidate:T=!1,shouldDirty:ue=!0}=A;f(p).set(C),ue&&h.set(!0),T&&g(p)}function D(p){return f(p)()}function P(p,C){m(p,C)}function ee(p){m(p,null)}function V(){R({})}function B(p=t){M(()=>{for(let[C,A]of Object.entries(s))A.set(p[C]??"");for(let C of Object.values(i))C.set(null);u.set({});for(let C of Object.values(a))C.set(!1);h.set(!1),b.set(!1)})}function ke(p,C){return async A=>{A&&A.preventDefault(),v.set(!0),b.set(!0),S.set(S.peek()+1),await g()?await p(y()):C&&C(I(!1)),v.set(!1)}}function Se(p){return p?N(()=>f(p)()):N(()=>y(!0))}return{register:L,handleSubmit:ke,setValue:k,getValue:D,setError:P,clearError:ee,clearErrors:V,reset:B,watch:Se,validate:g,formState:{get values(){return y(!0)},get errors(){return I(!0)},error:p=>c(p)(),get touched(){let p={};for(let[C,A]of Object.entries(a))A()&&(p[C]=!0);return p},isDirty:()=>h(),isValid:_,isValidating:()=>E(),isSubmitting:()=>v(),isSubmitted:()=>b(),submitCount:()=>S(),dirtyFields:x}}}function _r(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r={};for(let o of n.errors||[]){let s=o.path.join(".");r[s]||(r[s]={type:o.code,message:o.message})}return{values:{},errors:r}}}}function Ar(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){let r={};for(let o of n.inner||[])r[o.path]||(r[o.path]={type:o.type,message:o.message});return{values:{},errors:r}}}}function Ir(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let i of o){let a=i(s,t);if(a){n[r]={type:"validation",message:a};break}}}return{values:t,errors:n}}}var Rr={required:(e="This field is required")=>t=>{if(t==null||t==="")return e},minLength:(e,t)=>n=>{if(typeof n=="string"&&n.length<e)return t||`Must be at least ${e} characters`},maxLength:(e,t)=>n=>{if(typeof n=="string"&&n.length>e)return t||`Must be at most ${e} characters`},min:(e,t)=>n=>{if(typeof n=="number"&&n<e)return t||`Must be at least ${e}`},max:(e,t)=>n=>{if(typeof n=="number"&&n>e)return t||`Must be at most ${e}`},pattern:(e,t="Invalid format")=>n=>{if(typeof n=="string"&&!e.test(n))return t},email:(e="Invalid email address")=>t=>{if(typeof t=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return e},url:(e="Invalid URL")=>t=>{try{typeof t=="string"&&t&&new URL(t)}catch{return e}},match:(e,t)=>(n,r)=>{if(n!==r[e])return t||`Must match ${e}`},custom:e=>e};function Tr(e,t={}){let{validate:n,defaultValue:r=""}=t,o=l(r),s=l(null),i=l(!1),a=l(!1);async function u(){if(!n)return!0;let f=await n(o.peek());return s.set(f||null),!f}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>i(),isDirty:()=>a(),setValue:f=>{o.set(f),a.set(!0)},setError:f=>s.set(f),validate:u,reset:()=>{o.set(r),s.set(null),i.set(!1),a.set(!1)},inputProps:()=>({name:e,value:o(),onInput:f=>{o.set(f.target.value),a.set(!0)},onBlur:()=>{i.set(!0),u()}})}}function Mr(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return w("input",{...r,...o,"aria-invalid":n?"true":void 0})}function Lr(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return w("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function Dr(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return w("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function Fr(e){let{register:t,...n}=e,r=t?t(e.name):{};return w("input",{type:"checkbox",...n,...r,checked:r.value})}function Pr(e){let{register:t,value:n,...r}=e,o=t?t(e.name):{};return w("input",{type:"radio",value:n,...r,checked:o.value===n,onChange:s=>{s.target.checked&&o.onInput&&o.onInput({target:{value:n}})}})}function Nr({name:e,formState:t,errors:n,render:r}){let o=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return o?r?r({message:o.message,type:o.type}):w("span",{class:"what-error",role:"alert"},o.message):null}var ct={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
63
+ `,nt=!1;function te(){if(nt||typeof document>"u")return;nt=!0;let e=document.createElement("style");e.textContent=ar,document.head.appendChild(e)}function De({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:i=1}){te();let a=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=o?`${a} ${o}`:a,f={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return i===1?w("div",{class:u,style:f,"aria-hidden":"true"}):Array.from({length:i},(c,d)=>w("div",{key:d,class:u,style:{...f,marginBottom:d<i-1?"8px":void 0},"aria-hidden":"true"}))}function Fe({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return te(),w("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,i)=>w("div",{key:i,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:i===e-1?t:"100%",marginBottom:i<e-1?`${r}px`:void 0}})))}function cr({size:e=40,variant:t="shimmer"}){return De({width:e,height:e,circle:!0,variant:t})}function rt({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-card","aria-hidden":"true"},w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Fe({lines:t,variant:n}))}function ur({rows:e=5,columns:t=4,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-table","aria-hidden":"true"},w("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>w("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>w("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,i)=>w("div",{key:i,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function lr({type:e="default",height:t,children:n}){return te(),e==="card"?rt({}):e==="text"?Fe({}):n||w("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function fr(e,t=[]){let n=l(!0),r=l(null),o=l(null);return O(()=>{n.set(!0),o.set(null),Promise.resolve(e()).then(s=>{r.set(s),n.set(!1)}).catch(s=>{o.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>o(),Skeleton:s=>n()?De(s):null}}function dr({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return te(),w("div",{class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":n,role:"status"},r&&w("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function pr({size:e=8,color:t="#666"}){te();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return w("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},w("div",{style:{...n,animationDelay:"0s"}}),w("div",{style:{...n,animationDelay:"0.2s"}}),w("div",{style:{...n,animationDelay:"0.4s"}}))}function hr({size:e=24,color:t="#666",strokeWidth:n=2}){return w("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},w("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),w("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var H=new Map,J=new Map,Z=new Map,q=new Map,ot=200;function we(e){return q.set(e,Date.now()),H.has(e)||(H.set(e,l(null)),H.size>ot&&mr()),H.get(e)}function st(e){return J.has(e)||J.set(e,l(null)),J.get(e)}function gr(e){return Z.has(e)||Z.set(e,l(!1)),Z.get(e)}function mr(){let e=[...q.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(ot*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];Y.has(r)&&Y.get(r).size>0||(H.delete(r),J.delete(r),Z.delete(r),q.delete(r),ge.delete(r))}}var Y=new Map;function it(e,t){return Y.has(e)||Y.set(e,new Set),Y.get(e).add(t),()=>{let n=Y.get(e);n&&(n.delete(t),n.size===0&&Y.delete(e))}}var ne=new Map,ge=new Map;function X(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function yr(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=h=>h,initialData:i=null}=t,a=l(i),u=l(null),f=l(!0),c=null;async function d(){c&&c.abort(),c=new AbortController;let{signal:h}=c;f.set(!0),u.set(null);try{let v=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:h});if(!v.ok)throw new Error(`HTTP ${v.status}: ${v.statusText}`);let b=await v.json();h.aborted||a.set(s(b))}catch(v){h.aborted||u.set(v)}finally{h.aborted||f.set(!1)}}return X(()=>(d(),()=>{c&&c.abort()})),{data:()=>a(),error:()=>u(),isLoading:()=>f(),refetch:d,mutate:h=>a.set(h)}}function xr(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:i=2e3,fallbackData:a,onSuccess:u,onError:f,suspense:c=!1}=n;if(e==null||e===!1){let m=l(a||null),R=l(null);return{data:()=>m(),error:()=>R(),isLoading:()=>!1,isValidating:()=>!1,mutate:_=>m.set(typeof _=="function"?_(m()):_),revalidate:()=>Promise.resolve()}}let d=we(e),h=st(e),v=gr(e),b=N(()=>d()??a??null),E=N(()=>d()==null&&v()),S=null;async function y(){let m=Date.now();if(ne.has(e)){let g=ne.get(e);if(m-g.timestamp<i)return g.refCount++,g.promise}let R=ge.get(e);if(R&&m-R<i&&d.peek()!=null)return d.peek();if(S){let g=ne.get(e);(!g||g.refCount<=1)&&S.abort()}S=new AbortController;let{signal:_}=S;v.set(!0);let x=t(e,{signal:_});ne.set(e,{promise:x,timestamp:m,refCount:1});try{let g=await x;return _.aborted?void 0:(M(()=>{d.set(g),h.set(null)}),q.set(e,Date.now()),ge.set(e,Date.now()),u&&u(g,e),g)}catch(g){if(_.aborted)return;throw h.set(g),f&&f(g,e),g}finally{_.aborted||v.set(!1);let g=ne.get(e);g&&(g.refCount--,g.refCount<=0&&ne.delete(e))}}let I=it(e,()=>y().catch(()=>{}));return X(()=>(y().catch(()=>{}),()=>{S&&S.abort(),I()})),r&&typeof window<"u"&&X(()=>{let m=()=>{document.visibilityState==="visible"&&y().catch(()=>{})};return document.addEventListener("visibilitychange",m),()=>document.removeEventListener("visibilitychange",m)}),o&&typeof window<"u"&&X(()=>{let m=()=>y().catch(()=>{});return window.addEventListener("online",m),()=>window.removeEventListener("online",m)}),s>0&&X(()=>{let m=setInterval(()=>{y().catch(()=>{})},s);return()=>clearInterval(m)}),{data:()=>b(),error:()=>h(),isLoading:()=>E(),isValidating:()=>v(),mutate:(m,R=!0)=>{let _=typeof m=="function"?m(d.peek()):m;d.set(_),q.set(e,Date.now()),R&&y().catch(()=>{})},revalidate:y}}function vr(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:i=!0,refetchInterval:a=!1,retry:u=3,retryDelay:f=k=>Math.min(1e3*2**k,3e4),onSuccess:c,onError:d,onSettled:h,select:v,placeholderData:b}=e,E=Array.isArray(t)?t.join(":"):t,S=we(E),y=N(()=>{let k=S();return v&&k!==null?v(k):k}),I=st(E),m=l(S.peek()!=null?"success":"loading"),R=l("idle"),_=0,x=null;async function g(){if(!r)return;let k=Date.now();if(S.peek()!=null&&k-_<o)return S.peek();x&&x.abort(),x=new AbortController;let{signal:D}=x;R.set("fetching"),S.peek()==null&&m.set("loading");let P=0;async function ee(){try{let V=await n({queryKey:Array.isArray(t)?t:[t],signal:D});return D.aborted?void 0:(M(()=>{S.set(V),I.set(null),m.set("success"),R.set("idle")}),_=Date.now(),q.set(E,Date.now()),c&&c(V),h&&h(V,null),setTimeout(()=>{if(Date.now()-_>=s){let B=Y.get(E);(!B||B.size===0)&&(H.delete(E),J.delete(E),Z.delete(E),q.delete(E),ge.delete(E))}},s),V)}catch(V){if(D.aborted)return;if(P++,P<u)return await new Promise((B,Se)=>{let Ee=setTimeout(B,f(P));D.addEventListener("abort",()=>{clearTimeout(Ee),Se(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(B=>{if(B.name!=="AbortError")throw B}),D.aborted?void 0:ee();throw M(()=>{I.set(V),m.set("error"),R.set("idle")}),d&&d(V),h&&h(null,V),V}}return ee()}let L=it(E,()=>g().catch(()=>{}));return X(()=>(r&&g().catch(()=>{}),()=>{x&&x.abort(),L()})),i&&typeof window<"u"&&X(()=>{let k=()=>{document.visibilityState==="visible"&&g().catch(()=>{})};return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)}),a&&X(()=>{let k=setInterval(()=>{g().catch(()=>{})},a);return()=>clearInterval(k)}),{data:()=>y()??b,error:()=>I(),status:()=>m(),fetchStatus:()=>R(),isLoading:()=>m()==="loading",isError:()=>m()==="error",isSuccess:()=>m()==="success",isFetching:()=>R()==="fetching",refetch:g}}function wr(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,...i}=e,a=l([]),u=l([s]),f=l(!0),c=l(!1),d=l(!1),h=l(!1),v=Array.isArray(t)?t.join(":"):t,b=null,E=!1;async function S(y,I="next"){b&&b.abort(),b=new AbortController;let{signal:m}=b,R=I==="next"?d:h;R.set(!0);try{let _=await n({queryKey:Array.isArray(t)?t:[t],pageParam:y,signal:m});return m.aborted?void 0:(M(()=>{E?(a.set([_]),u.set([y]),E=!1):I==="next"?(a.set([...a.peek(),_]),u.set([...u.peek(),y])):(a.set([_,...a.peek()]),u.set([y,...u.peek()]));let x=r?.(_,a.peek());if(f.set(x!==void 0),o){let g=o(_,a.peek());c.set(g!==void 0)}}),_)}finally{m.aborted||R.set(!1)}}return X(()=>(S(s).catch(()=>{}),()=>{b&&b.abort()})),{data:()=>({pages:a(),pageParams:u()}),hasNextPage:()=>f(),hasPreviousPage:()=>c(),isFetchingNextPage:()=>d(),isFetchingPreviousPage:()=>h(),fetchNextPage:async()=>{let y=a.peek()[a.peek().length-1],I=r?.(y,a.peek());if(I!==void 0)return S(I,"next")},fetchPreviousPage:async()=>{let y=a.peek()[0],I=o?.(y,a.peek());if(I!==void 0)return S(I,"previous")},refetch:async()=>(E=!0,S(s))}}function br(e,t={}){let{hard:n=!1}=t,r=[];if(typeof e=="function")for(let[o]of H)e(o)&&r.push(o);else r.push(e);for(let o of r){n&&H.has(o)&&H.get(o).set(null);let s=Y.get(o);if(s)for(let i of s)i()}}function kr(e,t){let n=we(e);return t(e).then(r=>(n.set(r),q.set(e,Date.now()),r))}function Sr(e,t){let n=we(e),r=n.peek();n.set(typeof t=="function"?t(r):t),q.set(e,Date.now())}function Er(e){return H.has(e)?H.get(e).peek():void 0}function Cr(){H.clear(),J.clear(),Z.clear(),q.clear(),ge.clear(),ne.clear()}function _r(){let e=[];for(let[t,n]of H)e.push({key:t,data:n.peek(),error:J.has(t)?J.get(t).peek():null,isValidating:Z.has(t)?Z.get(t).peek():!1});return e}function Ar(e={}){let t=$?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=at(e)),t.hooks[n]}return at(e)}function at(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},i={},a={},u=l({});function f(p){return s[p]||(s[p]=l(t[p]??"")),s[p]}function c(p){return i[p]||(i[p]=l(null)),i[p]}function d(p){return a[p]||(a[p]=l(!1)),a[p]}let h=l(!1),v=l(!1),b=l(!1),E=l(!1),S=l(0);function y(p=!1){let C={...t};for(let[A,T]of Object.entries(s))C[A]=p?T():T.peek();return C}function I(p=!1){return p?u():u.peek()}function m(p,C){let A=C??null;c(p).set(A),u.set(T=>{if(T[p]===A)return T;if(A==null){if(!Object.prototype.hasOwnProperty.call(T,p))return T;let W={...T};return delete W[p],W}return{...T,[p]:A}})}function R(p={}){let C=p||{};M(()=>{for(let[A,T]of Object.entries(i))Object.prototype.hasOwnProperty.call(C,A)||T.set(null);for(let[A,T]of Object.entries(C))c(A).set(T??null);u.set({...C})})}let _=N(()=>Object.keys(I(!0)).length===0),x=N(()=>{let p={};for(let[C,A]of Object.entries(s))A()!==(t[C]??"")&&(p[C]=!0);return p});async function g(p){if(!o)return!0;E.set(!0);try{let A=(await o(y(!1)))?.errors||{};if(p){let T=A[p]??null;return m(p,T),!T}else return R(A),Object.keys(A).length===0}finally{E.set(!1)}}function L(p,C={}){let A=f(p),T=C.type==="checkbox"||C.type==="radio",ue=xe=>{let ht=xe.target.type==="checkbox"||xe.target.type==="radio"?xe.target.checked:xe.target.value;k(p,ht),(n==="onChange"||b.peek()&&r==="onChange")&&g(p)},W={name:p,onBlur:()=>{d(p).set(!0),(n==="onBlur"||b.peek()&&r==="onBlur")&&g(p)},onFocus:()=>{},ref:C.ref};return T?(Object.defineProperty(W,"checked",{get(){return!!A()},enumerable:!0}),W.onchange=ue):(Object.defineProperty(W,"value",{get(){return A()},enumerable:!0}),W.oninput=ue),W}function k(p,C,A={}){let{shouldValidate:T=!1,shouldDirty:ue=!0}=A;f(p).set(C),ue&&h.set(!0),T&&g(p)}function D(p){return f(p)()}function P(p,C){m(p,C)}function ee(p){m(p,null)}function V(){R({})}function B(p=t){M(()=>{for(let[C,A]of Object.entries(s))A.set(p[C]??"");for(let C of Object.values(i))C.set(null);u.set({});for(let C of Object.values(a))C.set(!1);h.set(!1),b.set(!1)})}function Se(p,C){return async A=>{A&&A.preventDefault(),v.set(!0),b.set(!0),S.set(S.peek()+1),await g()?await p(y()):C&&C(I(!1)),v.set(!1)}}function Ee(p){return p?N(()=>f(p)()):N(()=>y(!0))}return{register:L,handleSubmit:Se,setValue:k,getValue:D,setError:P,clearError:ee,clearErrors:V,reset:B,watch:Ee,validate:g,formState:{get values(){return y(!0)},get errors(){return I(!0)},error:p=>c(p)(),get touched(){let p={};for(let[C,A]of Object.entries(a))A()&&(p[C]=!0);return p},isDirty:()=>h(),isValid:_,isValidating:()=>E(),isSubmitting:()=>v(),isSubmitted:()=>b(),submitCount:()=>S(),dirtyFields:x}}}function Ir(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r={};for(let o of n.errors||[]){let s=o.path.join(".");r[s]||(r[s]={type:o.code,message:o.message})}return{values:{},errors:r}}}}function Rr(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){let r={};for(let o of n.inner||[])r[o.path]||(r[o.path]={type:o.type,message:o.message});return{values:{},errors:r}}}}function Tr(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let i of o){let a=i(s,t);if(a){n[r]={type:"validation",message:a};break}}}return{values:t,errors:n}}}var Mr={required:(e="This field is required")=>t=>{if(t==null||t==="")return e},minLength:(e,t)=>n=>{if(typeof n=="string"&&n.length<e)return t||`Must be at least ${e} characters`},maxLength:(e,t)=>n=>{if(typeof n=="string"&&n.length>e)return t||`Must be at most ${e} characters`},min:(e,t)=>n=>{if(typeof n=="number"&&n<e)return t||`Must be at least ${e}`},max:(e,t)=>n=>{if(typeof n=="number"&&n>e)return t||`Must be at most ${e}`},pattern:(e,t="Invalid format")=>n=>{if(typeof n=="string"&&!e.test(n))return t},email:(e="Invalid email address")=>t=>{if(typeof t=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return e},url:(e="Invalid URL")=>t=>{try{typeof t=="string"&&t&&new URL(t)}catch{return e}},match:(e,t)=>(n,r)=>{if(n!==r[e])return t||`Must match ${e}`},custom:e=>e};function Lr(e,t={}){let{validate:n,defaultValue:r=""}=t,o=l(r),s=l(null),i=l(!1),a=l(!1);async function u(){if(!n)return!0;let f=await n(o.peek());return s.set(f||null),!f}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>i(),isDirty:()=>a(),setValue:f=>{o.set(f),a.set(!0)},setError:f=>s.set(f),validate:u,reset:()=>{o.set(r),s.set(null),i.set(!1),a.set(!1)},inputProps:()=>({name:e,value:o(),onInput:f=>{o.set(f.target.value),a.set(!0)},onBlur:()=>{i.set(!0),u()}})}}function Dr(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return w("input",{...r,...o,"aria-invalid":n?"true":void 0})}function Fr(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return w("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function Pr(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return w("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function Nr(e){let{register:t,...n}=e,r=t?t(e.name):{};return w("input",{type:"checkbox",...n,...r,checked:r.value})}function Or(e){let{register:t,value:n,...r}=e,o=t?t(e.name):{};return w("input",{type:"radio",value:n,...r,checked:o.value===n,onChange:s=>{s.target.checked&&o.onInput&&o.onInput({target:{value:n}})}})}function $r({name:e,formState:t,errors:n,render:r}){let o=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return o?r?r({message:o.message,type:o.type}):w("span",{class:"what-error",role:"alert"},o.message):null}var ut={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
64
64
  effect(() => { count(count() + 1); });
65
65
 
66
66
  // Good \u2014 use untrack() so the read doesn't subscribe:
@@ -117,6 +117,6 @@ html\`<div>\${sanitizedContent}</div>\``},MISSING_KEY:{code:"ERR_MISSING_KEY",se
117
117
  <For each={items()}>{item => <li>{item.name}</li>}</For>
118
118
 
119
119
  // Good \u2014 stable key:
120
- <For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},ae=class extends Error{constructor({code:t,message:n,suggestion:r,file:o,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=o,this.line=s,this.component=i,this.signal=a,this.effect=u}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function oe(e,t={}){let n=typeof e=="string"?ct[e]:e;if(!n)return new ae({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ae({code:n.code,message:r,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],at=200;function we(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>at&&(re=re.slice(-at)))}function be(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function Or(){re=[]}function $r(e,t={}){let n=e?.message||String(e);return n.includes("infinite effect loop")||n.includes("25 iterations")?oe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?oe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?oe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new ae({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var ge={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function Hr(e){Object.assign(ge,e)}function Vr(){return{...ge}}function jr(e,t){return!F||!ge.signalReadDetection||(e.toString=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
121
- Suggestion: ${n.suggestion}`),we(n),String(e())},e.valueOf=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
122
- Suggestion: ${n.suggestion}`),we(n),e()}),e}function qr(e){if(!F||!ge.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Br(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ut=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function Gr(e){if(!F||!ge.importValidation)return[];let t=[];for(let n of e)ut.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Yr(n)}?`});return t}function Yr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of ut){let s=Xr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Xr(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var Wr="0.11.5",me=[];function Qr(e){F&&me.push(e)}function zr(e){if(!F)return;let t=me.indexOf(e);t>=0&&me.splice(t,1)}function lt(){return me.slice()}var ce=[];function Kr(e){F&&ce.push(e)}function Ur(e){if(!F)return;let t=ce.indexOf(e);t>=0&&ce.splice(t,1)}function ft(){return ce.slice()}function dt(){let e=be(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ce.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ce.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:me.length}}function Jr(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:Wr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>lt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>ft().map((e,t)=>({id:t,name:e._debugName||`signal_${t}`,value:typeof e=="function"?e.peek?.():void 0,subscriberCount:e._subs?e._subs.size:0})),errors:()=>be(),health:()=>dt(),api:{reactive:["signal","computed","effect","batch","untrack","flushSync","createRoot","memo"],hooks:["useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","onMount","onCleanup"],components:["Show","For","Switch","Match","Suspense","ErrorBoundary","lazy","Island"],data:["useSWR","useQuery","useFetch","useInfiniteQuery"],store:["createStore","derived","atom"]}}))}export{Fr as Checkbox,ct as ERROR_CODES,At as ErrorBoundary,Nr as ErrorMessage,Bn as FocusTrap,Rt as For,kt as Fragment,Sn as Head,Mr as Input,Lt as Island,cr as IslandSkeleton,nr as Keys,Jn as LiveRegion,fr as LoadingDots,Mt as Match,lr as Placeholder,Vt as Portal,Pr as Radio,Dr as Select,It as Show,Le as Skeleton,ir as SkeletonAvatar,nt as SkeletonCard,ar as SkeletonTable,De as SkeletonText,Xn as SkipLink,dr as Spinner,_t as Suspense,Tt as Switch,Lr as Textarea,Un as VisuallyHidden,ae as WhatError,Yt as _$createComponent,Xt as _$template,bt as __drainPreinstallBuffer,Er as __getCacheSnapshot,Ee as __readHydrationData,sn as __resetHydrationData,ht as __setDevToolsHooks,Gt as _setTextInsertHook,Fe as _template,Ze as announce,Yn as announceAssertive,kn as atom,M as batch,_n as beginHeadCollection,qr as checkComponentName,en as classList,$r as classifyError,Sr as clearCache,Or as clearCollectedErrors,Rn as clearHead,Ft as cls,we as collectError,N as computed,Hr as configureGuardrails,gn as createContext,vn as createResource,vt as createRoot,bn as createStore,ze as createTransitionClasses,oe as createWhatError,Vn as cssTransition,Nt as debounce,Jt as delegateEvents,$e as derived,Dt as each,Qe as easings,O as effect,An as endHeadCollection,qe as flushScheduler,mt as flushSync,ft as getActiveSignals,be as getCollectedErrors,Vr as getGuardrailConfig,dt as getHealth,Ce as getLoaderData,lt as getMountedComponents,yt as getOwner,kr as getQueryData,_e as getResource,ie as getServerContext,w as h,St as html,nn as hydrate,Qt as insert,Jr as installAgentContext,jr as installSignalReadGuardrail,vr as invalidateQueries,tn as isHydrating,Ct as lazy,zt as mapArray,Tn as measure,Et as memo,Bt as mount,Mn as mutate,Dn as nextFrame,Zt as on,xn as onCleanup,Pn as onIntersect,rr as onKey,or as onKeys,yn as onMount,Fn as onResize,wt as onRootCleanup,wr as prefetchQuery,Ge as raf,Qr as registerComponent,Kr as registerSignal,Rr as rules,xt as runWithOwner,on as runWithServerContext,G as scheduleRead,K as scheduleWrite,Ut as setProp,br as setQueryData,rn as setServerContext,l as signal,gt as signalMemo,Ir as simpleResolver,Nn as smoothScrollTo,Kt as spread,Xe as spring,wn as storeComputed,Pt as style,Wt as svgTemplate,Fe as template,Ot as throttle,qt as transition,We as tween,zr as unregisterComponent,Ur as unregisterSignal,le as untrack,Hn as useAnimatedValue,zn as useAriaChecked,Wn as useAriaExpanded,Qn as useAriaSelected,pn as useCallback,jt as useClickOutside,ln as useComputed,Pe as useContext,er as useDescribedBy,fn as useEffect,gr as useFetch,Tr as useField,jn as useFocus,qn as useFocusRestore,Je as useFocusTrap,Cr as useForm,$n as useGesture,Me as useId,Zn as useIds,xr as useInfiniteQuery,tr as useLabelledBy,an as useLoaderData,Ht as useLocalStorage,$t as useMediaQuery,dn as useMemo,yr as useQuery,mn as useReducer,hn as useRef,Kn as useRovingTabIndex,mr as useSWR,Ln as useScheduledEffect,un as useSignal,ur as useSkeleton,cn as useState,On as useTransition,Gr as validateImports,Ar as yupResolver,_r as zodResolver};
120
+ <For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},ae=class extends Error{constructor({code:t,message:n,suggestion:r,file:o,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=o,this.line=s,this.component=i,this.signal=a,this.effect=u}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function oe(e,t={}){let n=typeof e=="string"?ut[e]:e;if(!n)return new ae({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ae({code:n.code,message:r,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],ct=200;function be(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>ct&&(re=re.slice(-ct)))}function ke(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function Hr(){re=[]}function Vr(e,t={}){let n=e?.message||String(e);return n.includes("infinite effect loop")||n.includes("25 iterations")?oe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?oe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?oe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new ae({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var me={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function jr(e){Object.assign(me,e)}function qr(){return{...me}}function Br(e,t){return!F||!me.signalReadDetection||(e.toString=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
121
+ Suggestion: ${n.suggestion}`),be(n),String(e())},e.valueOf=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
122
+ Suggestion: ${n.suggestion}`),be(n),e()}),e}function Gr(e){if(!F||!me.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Yr(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function Yr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var lt=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function Xr(e){if(!F||!me.importValidation)return[];let t=[];for(let n of e)lt.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Wr(n)}?`});return t}function Wr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of lt){let s=Qr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Qr(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var zr="0.11.7",ye=[];function Kr(e){F&&ye.push(e)}function Ur(e){if(!F)return;let t=ye.indexOf(e);t>=0&&ye.splice(t,1)}function ft(){return ye.slice()}var ce=[];function Jr(e){F&&ce.push(e)}function Zr(e){if(!F)return;let t=ce.indexOf(e);t>=0&&ce.splice(t,1)}function dt(){return ce.slice()}function pt(){let e=ke(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ce.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ce.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:ye.length}}function eo(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:zr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>ft().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>dt().map((e,t)=>({id:t,name:e._debugName||`signal_${t}`,value:typeof e=="function"?e.peek?.():void 0,subscriberCount:e._subs?e._subs.size:0})),errors:()=>ke(),health:()=>pt(),api:{reactive:["signal","computed","effect","batch","untrack","flushSync","createRoot","memo"],hooks:["useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","onMount","onCleanup"],components:["Show","For","Switch","Match","Suspense","ErrorBoundary","lazy","Island"],data:["useSWR","useQuery","useFetch","useInfiniteQuery"],store:["createStore","derived","atom"]}}))}export{Nr as Checkbox,ut as ERROR_CODES,It as ErrorBoundary,$r as ErrorMessage,Yn as FocusTrap,Tt as For,St as Fragment,Cn as Head,Dr as Input,Dt as Island,lr as IslandSkeleton,or as Keys,er as LiveRegion,pr as LoadingDots,Lt as Match,dr as Placeholder,jt as Portal,Or as Radio,Pr as Select,Rt as Show,De as Skeleton,cr as SkeletonAvatar,rt as SkeletonCard,ur as SkeletonTable,Fe as SkeletonText,Qn as SkipLink,hr as Spinner,At as Suspense,Mt as Switch,Fr as Textarea,Zn as VisuallyHidden,ae as WhatError,Xt as _$createComponent,Wt as _$template,kt as __drainPreinstallBuffer,_r as __getCacheSnapshot,on as __installServerContextStorage,Ce as __readHydrationData,cn as __resetHydrationData,gt as __setDevToolsHooks,Yt as _setTextInsertHook,Pe as _template,et as announce,Wn as announceAssertive,En as atom,M as batch,In as beginHeadCollection,Gr as checkComponentName,tn as classList,Vr as classifyError,Cr as clearCache,Hr as clearCollectedErrors,Mn as clearHead,Pt as cls,be as collectError,N as computed,jr as configureGuardrails,yn as createContext,bn as createResource,wt as createRoot,Sn as createStore,Ke as createTransitionClasses,oe as createWhatError,qn as cssTransition,Ot as debounce,Zt as delegateEvents,He as derived,Ft as each,ze as easings,O as effect,Rn as endHeadCollection,Be as flushScheduler,yt as flushSync,dt as getActiveSignals,ke as getCollectedErrors,qr as getGuardrailConfig,pt as getHealth,_e as getLoaderData,ft as getMountedComponents,xt as getOwner,Er as getQueryData,Ae as getResource,ie as getServerContext,w as h,Et as html,rn as hydrate,zt as insert,eo as installAgentContext,Br as installSignalReadGuardrail,br as invalidateQueries,nn as isHydrating,_t as lazy,Kt as mapArray,Ln as measure,Ct as memo,Gt as mount,Dn as mutate,Pn as nextFrame,en as on,wn as onCleanup,On as onIntersect,sr as onKey,ir as onKeys,vn as onMount,Nn as onResize,bt as onRootCleanup,kr as prefetchQuery,Ye as raf,Kr as registerComponent,Jr as registerSignal,Mr as rules,vt as runWithOwner,an as runWithServerContext,G as scheduleRead,K as scheduleWrite,Jt as setProp,Sr as setQueryData,sn as setServerContext,l as signal,mt as signalMemo,Tr as simpleResolver,$n as smoothScrollTo,Ut as spread,We as spring,kn as storeComputed,Nt as style,Qt as svgTemplate,Pe as template,$t as throttle,Bt as transition,Qe as tween,Ur as unregisterComponent,Zr as unregisterSignal,le as untrack,jn as useAnimatedValue,Un as useAriaChecked,zn as useAriaExpanded,Kn as useAriaSelected,gn as useCallback,qt as useClickOutside,dn as useComputed,Ne as useContext,nr as useDescribedBy,pn as useEffect,yr as useFetch,Lr as useField,Bn as useFocus,Gn as useFocusRestore,Ze as useFocusTrap,Ar as useForm,Vn as useGesture,Le as useId,tr as useIds,wr as useInfiniteQuery,rr as useLabelledBy,un as useLoaderData,Vt as useLocalStorage,Ht as useMediaQuery,hn as useMemo,vr as useQuery,xn as useReducer,mn as useRef,Jn as useRovingTabIndex,xr as useSWR,Fn as useScheduledEffect,fn as useSignal,fr as useSkeleton,ln as useState,Hn as useTransition,Xr as validateImports,Rr as yupResolver,Ir as zodResolver};
@@ -1 +1 @@
1
- import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v}from"./chunk-NWRGIVGK.min.js";import{e as a,g as b,i as c}from"./chunk-MIAYVSK2.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,d as _setTextInsertHook,g as _template,t as classList,r as delegateEvents,a as effect,v as hydrate,i as insert,u as isHydrating,j as mapArray,b as memo,s as on,o as setAttr,q as setChecked,m as setClass,l as setProp,n as setStyle,p as setValue,k as spread,h as svgTemplate,g as template,c as untrack};
1
+ import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v}from"./chunk-H67HFVDV.min.js";import{e as a,g as b,i as c}from"./chunk-5QCEMXNL.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,d as _setTextInsertHook,g as _template,t as classList,r as delegateEvents,a as effect,v as hydrate,i as insert,u as isHydrating,j as mapArray,b as memo,s as on,o as setAttr,q as setChecked,m as setClass,l as setProp,n as setStyle,p as setValue,k as spread,h as svgTemplate,g as template,c as untrack};
@@ -1 +1 @@
1
- import{J as m,c as f,e as p,h as w,l as b}from"./chunk-MIAYVSK2.min.js";import{a as h}from"./chunk-O3SKPRTY.min.js";var l=null;function E(){return typeof document<"u"&&(l=document.createElement("div"),l.id="test-root",document.body.appendChild(l)),l}function v(){l&&(l.innerHTML="",l.parentNode&&l.parentNode.removeChild(l),l=null)}function N(e,t={}){let{container:n}=t,o=n||E();if(!o)throw new Error("No DOM container available. Are you running in Node.js without jsdom?");let s=m(e,o);return{container:o,unmount:s,getByText:r=>d(o,r),getByTestId:r=>o.querySelector(`[data-testid="${r}"]`),getByRole:r=>o.querySelector(`[role="${r}"]`),getAllByText:r=>g(o,r),queryByText:r=>d(o,r),queryByTestId:r=>o.querySelector(`[data-testid="${r}"]`),debug:()=>console.log(o.innerHTML),findByText:(r,u)=>y(()=>d(o,r),{timeout:u}),findByTestId:(r,u)=>y(()=>o.querySelector(`[data-testid="${r}"]`),{timeout:u})}}function q(e,t){let n=E();if(!n)throw new Error("No DOM container available. Are you running in Node.js without jsdom?");let o={},s=null,r;return b(u=>{s=u;let c=h(e,t||{});r=m(c,n)}),{container:n,signals:new Proxy(o,{get(u,c){if(c in u)return u[c]},set(u,c,i){return u[c]=i,!0}}),update(){w()},unmount(){r&&r(),s&&s(),v()},getByText:u=>d(n,u),getByTestId:u=>n.querySelector(`[data-testid="${u}"]`),queryByText:u=>d(n,u),debug:()=>console.log(n.innerHTML)}}function C(){w()}function M(e){let t=[],n=[],o=f,s=new Map,r=i=>{t.includes(i)||t.push(i)},u=i=>{n.includes(i)||n.push(i)},c;return b(i=>{c=i;let a=p(()=>{e()})}),c&&c(),{accessed:t,written:n}}function D(e,t){let n=[t],o=0,s=f(t,e),r=s.set;s.set=function(i){let a=typeof i=="function"?i(s.peek()):i;return Object.is(s.peek(),a)||(o++,n.push(a)),r(a)};let u=s,c=function(...i){if(i.length===0)return u();let a=typeof i[0]=="function"?i[0](u.peek()):i[0];return Object.is(u.peek(),a)||(o++,n.push(a)),u(a)};return c._signal=!0,c.peek=s.peek,c.set=s.set,c.subscribe=s.subscribe,s._debugName&&(c._debugName=s._debugName),s._subs&&(c._subs=s._subs),Object.defineProperty(c,"history",{get(){return n}}),Object.defineProperty(c,"setCount",{get(){return o}}),c.reset=function(i){let a=i!==void 0?i:t;n.length=0,n.push(a),o=0,u(a)},c}function d(e,t){let n=t instanceof RegExp?t:null,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);for(;o.nextNode();){let s=o.currentNode;if(n?n.test(s.textContent):s.textContent.includes(t))return s.parentElement}return null}function g(e,t){let n=[],o=t instanceof RegExp?t:null,s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);for(;s.nextNode();){let r=s.currentNode;(o?o.test(r.textContent):r.textContent.includes(t))&&n.push(r.parentElement)}return n}var H={click(e){let t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:typeof window<"u"?window:void 0});return e.dispatchEvent(t),t},change(e,t){e.value=t;let n=new Event("input",{bubbles:!0});e.dispatchEvent(n);let o=new Event("change",{bubbles:!0});return e.dispatchEvent(o),o},input(e,t){e.value=t;let n=new Event("input",{bubbles:!0});return e.dispatchEvent(n),n},submit(e){let t=new Event("submit",{bubbles:!0,cancelable:!0});return e.dispatchEvent(t),t},focus(e){e.focus();let t=new FocusEvent("focus",{bubbles:!0});return e.dispatchEvent(t),t},blur(e){e.blur();let t=new FocusEvent("blur",{bubbles:!0});return e.dispatchEvent(t),t},keyDown(e,t,n={}){let o=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:t,...n});return e.dispatchEvent(o),o},keyUp(e,t,n={}){let o=new KeyboardEvent("keyup",{bubbles:!0,cancelable:!0,key:t,...n});return e.dispatchEvent(o),o},mouseEnter(e){let t=new MouseEvent("mouseenter",{bubbles:!0});return e.dispatchEvent(t),t},mouseLeave(e){let t=new MouseEvent("mouseleave",{bubbles:!0});return e.dispatchEvent(t),t}};async function y(e,t={}){let{timeout:n=1e3,interval:o=50}=t,s=Date.now();for(;Date.now()-s<n;){try{let r=e();if(r)return r}catch{}await new Promise(r=>setTimeout(r,o))}throw new Error(`waitFor timed out after ${n}ms`)}async function O(e,t={}){let{timeout:n=1e3,interval:o=50}=t,s=Date.now(),r=e();if(!r)throw new Error("Element not found");for(;Date.now()-s<n;){if(r=e(),!r)return;await new Promise(u=>setTimeout(u,o))}throw new Error(`Element still present after ${n}ms`)}async function _(e){let t=await e();return w(),await new Promise(n=>queueMicrotask(n)),await new Promise(n=>setTimeout(n,0)),t}function F(e){let t=f(e),n=[e];return p(()=>{n.push(t())}),{signal:t,get value(){return t()},set value(o){t.set(o)},history:n,reset(){n.length=0,n.push(t())}}}function R(e="MockComponent"){let t=[];function n(o){return t.push({props:o,timestamp:Date.now()}),h("div",{"data-testid":`mock-${e}`},JSON.stringify(o,null,2))}return n.displayName=e,n.calls=t,n.lastCall=()=>t[t.length-1],n.reset=()=>{t.length=0},n}var j={toBeInTheDocument(e){if(!e||!e.parentNode)throw new Error("Expected element to be in the document")},toHaveTextContent(e,t){if(!e)throw new Error("Element not found");let n=e.textContent;if(!(t instanceof RegExp?t.test(n):n.includes(t)))throw new Error(`Expected "${n}" to contain "${t}"`)},toHaveAttribute(e,t,n){if(!e)throw new Error("Element not found");let o=e.getAttribute(t);if(n!==void 0&&o!==n)throw new Error(`Expected attribute "${t}" to be "${n}", got "${o}"`);if(n===void 0&&o===null)throw new Error(`Expected element to have attribute "${t}"`)},toHaveClass(e,t){if(!e)throw new Error("Element not found");if(!e.classList.contains(t))throw new Error(`Expected element to have class "${t}"`)},toBeVisible(e){if(!e)throw new Error("Element not found");let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden"||t.opacity==="0")throw new Error("Expected element to be visible")},toBeDisabled(e){if(!e)throw new Error("Element not found");if(!e.disabled)throw new Error("Expected element to be disabled")},toHaveValue(e,t){if(!e)throw new Error("Element not found");if(e.value!==t)throw new Error(`Expected value to be "${t}", got "${e.value}"`)}},A={getByText:e=>d(document.body,e),getByTestId:e=>document.querySelector(`[data-testid="${e}"]`),getByRole:e=>document.querySelector(`[role="${e}"]`),getAllByText:e=>g(document.body,e),queryByText:e=>d(document.body,e),queryByTestId:e=>document.querySelector(`[data-testid="${e}"]`),debug:()=>console.log(document.body.innerHTML)};export{_ as act,v as cleanup,F as createTestSignal,j as expect,H as fireEvent,C as flushEffects,R as mockComponent,D as mockSignal,N as render,q as renderTest,A as screen,E as setupDOM,M as trackSignals,y as waitFor,O as waitForElementToBeRemoved};
1
+ import{J as m,c as f,e as p,h as w,l as b}from"./chunk-5QCEMXNL.min.js";import{a as h}from"./chunk-O3SKPRTY.min.js";var l=null;function E(){return typeof document<"u"&&(l=document.createElement("div"),l.id="test-root",document.body.appendChild(l)),l}function v(){l&&(l.innerHTML="",l.parentNode&&l.parentNode.removeChild(l),l=null)}function N(e,t={}){let{container:n}=t,o=n||E();if(!o)throw new Error("No DOM container available. Are you running in Node.js without jsdom?");let s=m(e,o);return{container:o,unmount:s,getByText:r=>d(o,r),getByTestId:r=>o.querySelector(`[data-testid="${r}"]`),getByRole:r=>o.querySelector(`[role="${r}"]`),getAllByText:r=>g(o,r),queryByText:r=>d(o,r),queryByTestId:r=>o.querySelector(`[data-testid="${r}"]`),debug:()=>console.log(o.innerHTML),findByText:(r,u)=>y(()=>d(o,r),{timeout:u}),findByTestId:(r,u)=>y(()=>o.querySelector(`[data-testid="${r}"]`),{timeout:u})}}function q(e,t){let n=E();if(!n)throw new Error("No DOM container available. Are you running in Node.js without jsdom?");let o={},s=null,r;return b(u=>{s=u;let c=h(e,t||{});r=m(c,n)}),{container:n,signals:new Proxy(o,{get(u,c){if(c in u)return u[c]},set(u,c,i){return u[c]=i,!0}}),update(){w()},unmount(){r&&r(),s&&s(),v()},getByText:u=>d(n,u),getByTestId:u=>n.querySelector(`[data-testid="${u}"]`),queryByText:u=>d(n,u),debug:()=>console.log(n.innerHTML)}}function C(){w()}function M(e){let t=[],n=[],o=f,s=new Map,r=i=>{t.includes(i)||t.push(i)},u=i=>{n.includes(i)||n.push(i)},c;return b(i=>{c=i;let a=p(()=>{e()})}),c&&c(),{accessed:t,written:n}}function D(e,t){let n=[t],o=0,s=f(t,e),r=s.set;s.set=function(i){let a=typeof i=="function"?i(s.peek()):i;return Object.is(s.peek(),a)||(o++,n.push(a)),r(a)};let u=s,c=function(...i){if(i.length===0)return u();let a=typeof i[0]=="function"?i[0](u.peek()):i[0];return Object.is(u.peek(),a)||(o++,n.push(a)),u(a)};return c._signal=!0,c.peek=s.peek,c.set=s.set,c.subscribe=s.subscribe,s._debugName&&(c._debugName=s._debugName),s._subs&&(c._subs=s._subs),Object.defineProperty(c,"history",{get(){return n}}),Object.defineProperty(c,"setCount",{get(){return o}}),c.reset=function(i){let a=i!==void 0?i:t;n.length=0,n.push(a),o=0,u(a)},c}function d(e,t){let n=t instanceof RegExp?t:null,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);for(;o.nextNode();){let s=o.currentNode;if(n?n.test(s.textContent):s.textContent.includes(t))return s.parentElement}return null}function g(e,t){let n=[],o=t instanceof RegExp?t:null,s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);for(;s.nextNode();){let r=s.currentNode;(o?o.test(r.textContent):r.textContent.includes(t))&&n.push(r.parentElement)}return n}var H={click(e){let t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:typeof window<"u"?window:void 0});return e.dispatchEvent(t),t},change(e,t){e.value=t;let n=new Event("input",{bubbles:!0});e.dispatchEvent(n);let o=new Event("change",{bubbles:!0});return e.dispatchEvent(o),o},input(e,t){e.value=t;let n=new Event("input",{bubbles:!0});return e.dispatchEvent(n),n},submit(e){let t=new Event("submit",{bubbles:!0,cancelable:!0});return e.dispatchEvent(t),t},focus(e){e.focus();let t=new FocusEvent("focus",{bubbles:!0});return e.dispatchEvent(t),t},blur(e){e.blur();let t=new FocusEvent("blur",{bubbles:!0});return e.dispatchEvent(t),t},keyDown(e,t,n={}){let o=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:t,...n});return e.dispatchEvent(o),o},keyUp(e,t,n={}){let o=new KeyboardEvent("keyup",{bubbles:!0,cancelable:!0,key:t,...n});return e.dispatchEvent(o),o},mouseEnter(e){let t=new MouseEvent("mouseenter",{bubbles:!0});return e.dispatchEvent(t),t},mouseLeave(e){let t=new MouseEvent("mouseleave",{bubbles:!0});return e.dispatchEvent(t),t}};async function y(e,t={}){let{timeout:n=1e3,interval:o=50}=t,s=Date.now();for(;Date.now()-s<n;){try{let r=e();if(r)return r}catch{}await new Promise(r=>setTimeout(r,o))}throw new Error(`waitFor timed out after ${n}ms`)}async function O(e,t={}){let{timeout:n=1e3,interval:o=50}=t,s=Date.now(),r=e();if(!r)throw new Error("Element not found");for(;Date.now()-s<n;){if(r=e(),!r)return;await new Promise(u=>setTimeout(u,o))}throw new Error(`Element still present after ${n}ms`)}async function _(e){let t=await e();return w(),await new Promise(n=>queueMicrotask(n)),await new Promise(n=>setTimeout(n,0)),t}function F(e){let t=f(e),n=[e];return p(()=>{n.push(t())}),{signal:t,get value(){return t()},set value(o){t.set(o)},history:n,reset(){n.length=0,n.push(t())}}}function R(e="MockComponent"){let t=[];function n(o){return t.push({props:o,timestamp:Date.now()}),h("div",{"data-testid":`mock-${e}`},JSON.stringify(o,null,2))}return n.displayName=e,n.calls=t,n.lastCall=()=>t[t.length-1],n.reset=()=>{t.length=0},n}var j={toBeInTheDocument(e){if(!e||!e.parentNode)throw new Error("Expected element to be in the document")},toHaveTextContent(e,t){if(!e)throw new Error("Element not found");let n=e.textContent;if(!(t instanceof RegExp?t.test(n):n.includes(t)))throw new Error(`Expected "${n}" to contain "${t}"`)},toHaveAttribute(e,t,n){if(!e)throw new Error("Element not found");let o=e.getAttribute(t);if(n!==void 0&&o!==n)throw new Error(`Expected attribute "${t}" to be "${n}", got "${o}"`);if(n===void 0&&o===null)throw new Error(`Expected element to have attribute "${t}"`)},toHaveClass(e,t){if(!e)throw new Error("Element not found");if(!e.classList.contains(t))throw new Error(`Expected element to have class "${t}"`)},toBeVisible(e){if(!e)throw new Error("Element not found");let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden"||t.opacity==="0")throw new Error("Expected element to be visible")},toBeDisabled(e){if(!e)throw new Error("Element not found");if(!e.disabled)throw new Error("Expected element to be disabled")},toHaveValue(e,t){if(!e)throw new Error("Element not found");if(e.value!==t)throw new Error(`Expected value to be "${t}", got "${e.value}"`)}},A={getByText:e=>d(document.body,e),getByTestId:e=>document.querySelector(`[data-testid="${e}"]`),getByRole:e=>document.querySelector(`[role="${e}"]`),getAllByText:e=>g(document.body,e),queryByText:e=>d(document.body,e),queryByTestId:e=>document.querySelector(`[data-testid="${e}"]`),debug:()=>console.log(document.body.innerHTML)};export{_ as act,v as cleanup,F as createTestSignal,j as expect,H as fireEvent,C as flushEffects,R as mockComponent,D as mockSignal,N as render,q as renderTest,A as screen,E as setupDOM,M as trackSignals,y as waitFor,O as waitForElementToBeRemoved};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "what-core",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
4
  "description": "What Framework - Signal-based UI framework built for AI agents",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -8,7 +8,7 @@ import { getCollectedErrors } from './errors.js';
8
8
  // --- Version ---
9
9
  // Keep in sync with packages/core/package.json (checked by
10
10
  // core/test/guardrails.test.js so it can't silently go stale again).
11
- const VERSION = '0.11.5';
11
+ const VERSION = '0.11.7';
12
12
 
13
13
  // --- Component Registry ---
14
14
  // Tracks mounted components for agent inspection.
package/src/components.js CHANGED
@@ -154,62 +154,90 @@ export function reportError(error, startCtx) {
154
154
 
155
155
  // --- Show ---
156
156
  // Conditional rendering component. Cleaner than ternaries.
157
+ //
158
+ // Components run ONCE and never re-execute, so reading `when()` in the body
159
+ // would snapshot the condition a single time — the content would render once
160
+ // and never advance when the signal flips (the classic `<Show when={() =>
161
+ // authed()}>` identity-gate trap). Instead we return a reactive THUNK: when a
162
+ // component returns a function, createDOM installs a fine-grained fn-child
163
+ // effect (packages/core/src/dom.js) that re-evaluates it — the same reactive
164
+ // form the fine-grained compiler lowers `<Show>` to. Works on both JSX
165
+ // pipelines (the babel plugin lowers inline; the automatic `jsxImportSource`
166
+ // runtime / h() route here via _$createComponent).
157
167
 
158
168
  export function Show({ when, fallback = null, children }) {
159
- // when can be a signal or a value
160
- const condition = typeof when === 'function' ? when() : when;
161
- return condition ? children : fallback;
169
+ return () => {
170
+ // `when` can be a signal getter, a plain thunk, or a static value.
171
+ const condition = typeof when === 'function' ? when() : when;
172
+ return condition ? children : fallback;
173
+ };
162
174
  }
163
175
 
164
176
  // --- For ---
165
- // Efficient list rendering with keyed reconciliation.
177
+ // List rendering. Returns a reactive thunk (see Show above) so the list
178
+ // re-renders when `each` changes. The thunk re-reads `each()` inside the
179
+ // framework's fn-child effect, tracking it. The preferred, keyed-efficient
180
+ // pattern is `.map()` with a `key` prop (auto-lowered to _$mapArray by the
181
+ // compiler) or `<For>` compiled by the fine-grained plugin; this runtime form
182
+ // is the fallback for the automatic JSX runtime / h() path.
166
183
 
167
184
  export function For({ each, fallback = null, children }) {
168
- const list = typeof each === 'function' ? each() : each;
169
- if (!list || list.length === 0) return fallback;
170
-
171
- // children should be a function (item, index) => vnode
185
+ // children should be a function (item, index) => vnode. Resolve/validate it
186
+ // once at creation it does not change across list updates.
172
187
  const renderFn = Array.isArray(children) ? children[0] : children;
173
188
  if (typeof renderFn !== 'function') {
174
189
  console.warn('[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>');
175
190
  return fallback;
176
191
  }
177
192
 
178
- return list.map((item, index) => {
179
- const vnode = renderFn(item, index);
180
- // Auto-detect keys for efficient keyed reconciliation
181
- if (vnode && typeof vnode === 'object' && vnode.key == null) {
182
- if (item != null && typeof item === 'object') {
183
- // Use item.id or item.key if available
184
- if (item.id != null) vnode.key = item.id;
185
- else if (item.key != null) vnode.key = item.key;
186
- } else if (typeof item === 'string' || typeof item === 'number') {
187
- // Primitive items can be their own key
188
- vnode.key = item;
193
+ return () => {
194
+ const list = typeof each === 'function' ? each() : each;
195
+ if (!list || list.length === 0) return fallback;
196
+
197
+ return list.map((item, index) => {
198
+ const vnode = renderFn(item, index);
199
+ // Auto-detect keys for efficient keyed reconciliation
200
+ if (vnode && typeof vnode === 'object' && vnode.key == null) {
201
+ if (item != null && typeof item === 'object') {
202
+ // Use item.id or item.key if available
203
+ if (item.id != null) vnode.key = item.id;
204
+ else if (item.key != null) vnode.key = item.key;
205
+ } else if (typeof item === 'string' || typeof item === 'number') {
206
+ // Primitive items can be their own key
207
+ vnode.key = item;
208
+ }
189
209
  }
190
- }
191
- return vnode;
192
- });
210
+ return vnode;
211
+ });
212
+ };
193
213
  }
194
214
 
195
215
  // --- Switch / Match ---
196
216
  // Multi-condition rendering (like switch statement).
197
217
 
198
218
  export function Switch({ fallback = null, children }) {
219
+ // The Match children (marker vnodes) are static — resolve them once. The
220
+ // match loop, which reads each Match's reactive `when`, must run inside a
221
+ // reactive thunk (see Show/For above): components run once, so evaluating
222
+ // `when()` in the body here would snapshot the active arm a single time and
223
+ // `<Switch>`/`<Match when={() => sig()}>` would render once and never update.
224
+ // Switch/Match are NOT lowered by the fine-grained compiler, so this runtime
225
+ // path is the ONLY path — the thunk is what makes them reactive at all.
199
226
  const kids = Array.isArray(children) ? children : [children];
200
227
 
201
- for (const child of kids) {
202
- if (child && child.tag === Match) {
203
- const condition = typeof child.props.when === 'function'
204
- ? child.props.when()
205
- : child.props.when;
206
- if (condition) {
207
- return child.children;
228
+ return () => {
229
+ for (const child of kids) {
230
+ if (child && child.tag === Match) {
231
+ const condition = typeof child.props.when === 'function'
232
+ ? child.props.when()
233
+ : child.props.when;
234
+ if (condition) {
235
+ return child.children;
236
+ }
208
237
  }
209
238
  }
210
- }
211
-
212
- return fallback;
239
+ return fallback;
240
+ };
213
241
  }
214
242
 
215
243
  export function Match({ when, children }) {
package/src/index.js CHANGED
@@ -43,7 +43,12 @@ export { createStore, derived, storeComputed, atom } from './store.js';
43
43
  export { Head, clearHead, beginHeadCollection, endHeadCollection } from './head.js';
44
44
 
45
45
  // SSR render-scoped context (keystone for head collection, loaders, resources)
46
- export { getServerContext, setServerContext, runWithServerContext } from './server-context.js';
46
+ export {
47
+ getServerContext,
48
+ setServerContext,
49
+ runWithServerContext,
50
+ __installServerContextStorage,
51
+ } from './server-context.js';
47
52
 
48
53
  // Client hydration payload reader (loader data + resources)
49
54
  export { __readHydrationData, __resetHydrationData, getLoaderData, getResource } from './hydration-data.js';
@@ -4,22 +4,33 @@
4
4
  // the head sink, the current page's loader data, and the resource cache.
5
5
  //
6
6
  // Concurrency model:
7
- // - renderToString() is SYNCHRONOUS. A module-global set at the start of the
8
- // render and cleared in a `finally` lives within one uninterrupted tick, so
9
- // no other request's render can observe it (same reasoning React's
10
- // server dispatcher uses). Use runWithServerContext() for that path.
11
- // - ASYNC paths (renderToStream, async loaders, async createResource) must
12
- // thread the ctx object explicitly through the call stack and NEVER read
13
- // this module global across an `await` — two requests can interleave there.
7
+ // - Browser and synchronous-only consumers use the module-global fallback.
8
+ // - what-server installs an AsyncLocalStorage-compatible provider in Node so
9
+ // async components retain their request context across `await` without
10
+ // exposing it to concurrent renders.
14
11
  //
15
12
  // getServerContext() returns null on the client and outside of any render, so
16
13
  // `typeof document === 'undefined'` guards keep behaving correctly.
17
14
 
18
15
  let _current = null;
16
+ let _asyncContextStorage = null;
17
+
18
+ /**
19
+ * Install the async context provider used by the server renderer.
20
+ *
21
+ * This intentionally accepts the small AsyncLocalStorage surface instead of
22
+ * importing `node:async_hooks` from what-core: the core bundle remains browser
23
+ * compatible, while what-server owns its Node runtime dependency.
24
+ *
25
+ * @internal
26
+ */
27
+ export function __installServerContextStorage(storage) {
28
+ if (!_asyncContextStorage) _asyncContextStorage = storage;
29
+ }
19
30
 
20
31
  /** @returns the active render context, or null on the client / outside a render. */
21
32
  export function getServerContext() {
22
- return _current;
33
+ return _asyncContextStorage?.getStore() ?? _current;
23
34
  }
24
35
 
25
36
  /**
@@ -38,6 +49,10 @@ export function setServerContext(ctx) {
38
49
  * synchronous render path; do not rely on it across `await` boundaries.
39
50
  */
40
51
  export function runWithServerContext(ctx, fn) {
52
+ if (_asyncContextStorage) {
53
+ return _asyncContextStorage.run(ctx, fn);
54
+ }
55
+
41
56
  const prev = _current;
42
57
  _current = ctx;
43
58
  try {
@@ -1 +0,0 @@
1
- import{a as T}from"./chunk-O3SKPRTY.min.js";var u=typeof globalThis<"u"&&typeof globalThis.__WHAT_DEV__=="boolean"?globalThis.__WHAT_DEV__:import.meta&&import.meta.env?!!import.meta.env.DEV:(typeof process<"u"&&process.env,!1),d=null;function Me(e){u&&(d=e)}var _=null,w=null,E=null,P=!1,D=0,b=[],j=!1,q=Symbol("needs_upstream"),B=null;function S(e,t){let n=e,r=new Set,s=null,o=0;function c(f){u&&P&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;n===l||n!==n&&l!==l||(n=l,s=null,u&&d&&d.onSignalUpdate(i),r.size>0&&ee(r))}function i(f){if(arguments.length===0){let l=_;return l!==null&&(l!==s||l._epoch!==o)&&(s=l,o=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>v(()=>f(i())),i._signal=!0,u&&(i._subs=r,t&&(i._debugName=t)),u&&d&&d.onSignalCreate(i),i}function Ae(e){let t,n=!0,r=new Set,s=null,o=0,c=U(()=>{let f=P;u&&(P=!0);try{t=e(),n=!1}finally{u&&(P=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=_;return f!==null&&(f!==s||f._epoch!==o)&&(s=f,o=f._epoch,r.add(f),f.deps.push(r)),n&&X(c),t}return c._onNotify=()=>{n=!0,s=null,r.size>0&&ee(r)},i._signal=!0,i.peek=()=>(n&&X(c),t),i}function X(e){if(B!==null)throw B.push(e),q;let t=[e];B=t;try{for(;t.length>0;){let n=t[t.length-1];if(!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,s=n.deps;for(let o=0;o<s.length;o++){let c=s[o]._owner;c&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let o=n.deps.length;$(n),n.deps.length!==o&&H(n),t.pop()}catch(o){if(o===q)n._markDirty();else throw o}}}finally{B=null}}function H(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let s=n[r]._owner;if(s){let o=s._level;o>t&&(t=o)}}e._level=t+1}var ge=()=>{};function v(e,t){let n=U(e);n._level=1;let r=_;_=n;try{let o=n.fn();typeof o=="function"&&(n._cleanup=o)}finally{_=r}if(H(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,u&&d&&d.onEffectDispose(n),ge;let s=()=>Z(n);return w&&w.disposals.push(s),s}function Te(e){D++;try{e()}finally{D--,D===0&&G()}}function U(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return u&&d&&d.onEffectCreate(n),n}function $(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(s){u&&console.warn("[what] Error in effect cleanup:",s)}e._cleanup=null}let r=_;_=null;try{let s=e.fn();typeof s=="function"&&(e._cleanup=s)}catch(s){d?.onError&&d.onError(s,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",s)}finally{_=r}u&&d?.onEffectRun&&d.onEffectRun(e);return}let t=e.deps.length===1?e.deps[0]:null;if(Y(e),e._cleanup){try{e._cleanup()}catch(r){u&&d?.onError&&d.onError(r,{type:"effect-cleanup",effect:e}),u&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=_;_=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===q||u&&d?.onError&&d.onError(r,{type:"effect",effect:e}),r}finally{_=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),u&&d?.onEffectRun&&d.onEffectRun(e)}function Z(e){if(e.disposed=!0,u&&d&&d.onEffectDispose(e),Y(e),e._cleanup){try{e._cleanup()}catch(t){u&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function Y(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var F=0,L=null,M=0;function Q(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(D===0&&e._stable){let t=_;_=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){u&&d?.onError&&d.onError(n,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",n)}finally{_=t}}else{e._pending=!0;let t=e._level,n=b.length;n>0&&b[n-1]._level>t&&(j=!0),b.push(e)}}}function ee(e){if(F===0){F=1;try{for(let t of e)Q(t);if(M>0){let t=0;for(;t<M;){let n=L[t];L[t]=null,t++;for(let r of n)Q(r)}M=0}}finally{F=0}D===0&&b.length>0&&ye()}else L===null&&(L=[]),M>=L.length?L.push(e):L[M]=e,M++}var I=!1;function ye(){I||(I=!0,queueMicrotask(()=>{I=!1,G()}))}var R=!1;function G(){if(!R){R=!0;try{let e=0;for(;b.length>0&&e<25;){let t=b;b=[],t.length>1&&j&&t.sort((n,r)=>n._level-r._level),j=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let s=r.deps.length;try{$(r)}catch(o){if(o===q)throw o;u&&d?.onError&&d.onError(o,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",o)}catch{}continue}!r._computed&&r.deps.length!==s&&H(r)}}e++}if(e>=25){if(u){let n=b.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<b.length;t++)b[t]._pending=!1;b.length=0}}finally{R=!1}}}function De(e){let t,n=new Set,r=U(()=>{let o=e();if(!Object.is(t,o)){t=o;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=b.length;f>0&&b[f-1]._level>i&&(j=!0),b.push(c)}}}});r._level=1,$(r),H(r),n._owner=r,w&&w.disposals.push(()=>Z(r));function s(){return _&&(n.add(_),_.deps.push(n)),t}return s._signal=!0,s.peek=()=>t,s}function Oe(){if(R){u&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(_){u&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}I=!1,G()}function K(e){let t=_;_=null;try{return e()}finally{_=t}}function Be(){return E}function Pe(e,t){let n=E,r=w;E=e,w=e;try{return t()}finally{E=n,w=r}}function Ie(e){let t=w,n=E,r={disposals:[],owner:E,children:[],_disposed:!1};E&&E.children.push(r),w=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)J(r.children[o]);r.children.length=0;for(let o=r.disposals.length-1;o>=0;o--)r.disposals[o]();if(r.disposals.length=0,r.owner){let o=r.owner.children.indexOf(r);o>=0&&r.owner.children.splice(o,1)}}})}finally{w=t,E=n}}function J(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)J(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function Re(e){let t=w,n=E,r={disposals:[],owner:null,children:[],_disposed:!1};w=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)J(r.children[o]);r.children.length=0;for(let o=r.disposals.length-1;o>=0;o--)r.disposals[o]();r.disposals.length=0}})}finally{w=t,E=n}}function je(e){w&&w.disposals.push(e)}if(u&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};d={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function qe(){if(!u)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof z<"u"?z:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var z=null;u&&d?.__isPreinstallBuffer&&(z=d.__buffer);function $e(e,t){let n=function(s){return e(s)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var te=null;function ne(e){te=e}function Ge(e){let t=null,n=null,r=null,s=new Set;function o(c){if(r)throw r;if(t)return T(t,c);throw n||(n=e().then(i=>{t=i.default||i,s.forEach(f=>f()),s.clear()}).catch(i=>{r=i})),n}return o.displayName="Lazy",o._lazy=!0,o._onLoad=c=>{t?c():s.add(c)},o}function Ke({fallback:e,children:t}){let n=S(!1),r=new Set;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(o){n.set(!0),r.add(o),o.finally(()=>{r.delete(o),r.size===0&&n.set(!1)})}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}function Je({fallback:e,children:t,onError:n}){let r=S(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}function re(e,t){let n=t||te?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function Xe({when:e,fallback:t=null,children:n}){return(typeof e=="function"?e():e)?n:t}function Qe({each:e,fallback:t=null,children:n}){let r=typeof e=="function"?e():e;if(!r||r.length===0)return t;let s=Array.isArray(n)?n[0]:n;return typeof s!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):r.map((o,c)=>{let i=s(o,c);return i&&typeof i=="object"&&i.key==null&&(o!=null&&typeof o=="object"?o.id!=null?i.key=o.id:o.key!=null&&(i.key=o.key):(typeof o=="string"||typeof o=="number")&&(i.key=o)),i})}function Ze({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];for(let r of n)if(r&&r.tag===oe&&(typeof r.props.when=="function"?r.props.when():r.props.when))return r.children;return e}function oe({when:e,children:t}){return{tag:oe,props:{when:e},children:t,_vnode:!0}}function Ye({component:e,mode:t,mediaQuery:n,...r}){let s=T("div",{"data-island":e.name||"Island","data-hydrate":t}),o=S(null),c=S(!1);function i(){c()||(c.set(!0),o.set(T(e,r)))}function f(p){switch(t){case"load":queueMicrotask(i);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(i):setTimeout(i,200);break;case"visible":{let a=new IntersectionObserver(h=>{h[0].isIntersecting&&(a.disconnect(),i())});a.observe(p);break}case"interaction":{let a=()=>{p.removeEventListener("click",a),p.removeEventListener("focus",a),p.removeEventListener("mouseenter",a),i()};p.addEventListener("click",a,{once:!0}),p.addEventListener("focus",a,{once:!0}),p.addEventListener("mouseenter",a,{once:!0});break}case"media":{if(!n){i();break}let a=window.matchMedia(n);if(a.matches)queueMicrotask(i);else{let h=()=>{a.matches&&(a.removeEventListener("change",h),i())};a.addEventListener("change",h)}break}default:queueMicrotask(i)}}let l=p=>{p&&f(p)};return T("div",{"data-island":e.name||"Island","data-hydrate":t,ref:l},c()?o():null)}var se=!1;function nt(e,t,n){return se||(se=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,s)=>{let o=t(r,s);return n&&o&&typeof o=="object"&&(o.key=n(r,s)),o})}function rt(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,s]of Object.entries(n))s&&t.push(r)}return t.join(" ")}function ot(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Ce(t)}:${n}`).join(";")}function Ce(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function st(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function it(e,t){let n=0;return(...r)=>{let s=Date.now();s-n>=t&&(n=s,e(...r))}}var W=null;function ie(e){W=e}function ct(e){if(typeof window>"u")return S(!1);let t=window.matchMedia(e),n=S(t.matches),r=o=>n.set(o.matches);t.addEventListener("change",r);let s=W?.();return s&&(s._cleanupCallbacks=s._cleanupCallbacks||[],s._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function ft(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=S(n),s=v(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){u&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),o=null;typeof window<"u"&&(o=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){u&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",o));let c=W?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{s(),o&&window.removeEventListener("storage",o)})),r}function lt({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function at(e,t){if(typeof document>"u")return;let n=s=>{let o=e.current||e;!o||o.contains(s.target)||t(s)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=W?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function ut(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var we=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),be="http://www.w3.org/2000/svg",le=new Set,V=new WeakMap;function Ee(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ce(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function fe(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}u&&d?.onComponentUnmount&&d.onComponentUnmount(e),le.delete(e)}}function N(e){if(!e)return;if(e._componentCtx&&fe(e._componentCtx),e.nodeType===8){let n=V.get(e);n&&fe(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)N(t[n])}function yt(e,t){typeof t=="string"&&(t=document.querySelector(t)),N(t),t.textContent="";let n=k(e,t);return n&&t.appendChild(n),()=>{N(t),t.textContent=""}}function k(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(Ee(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),s=document.createComment("/list-frag");return r.appendChild(s),e(r,s),r}if(typeof e=="function"){let r=document.createComment("fn"),s=document.createComment("/fn"),o=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(s);let i=v(()=>{let f=e(),l=f==null||f===!1||f===!0?[]:Array.isArray(f)?f:[f],p=s.parentNode;if(p){for(let a of o)N(a),a.parentNode===p&&p.removeChild(a);o=[];for(let a of l){let h=k(a,p,t?._isSvg);if(h)if(h.nodeType===11){let C=Array.from(h.childNodes);p.insertBefore(h,s);for(let y of C)o.push(y)}else p.insertBefore(h,s),o.push(h)}}});return r._dispose=i,s._dispose=i,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let s of e){let o=k(s,t,n);o&&r.appendChild(o)}return r}return ce(e)&&typeof e.tag=="function"?xe(e,t,n):ce(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?ue(e,t):e.tag==="__suspense"?pe(e,t):e.tag==="__portal"?de(e,t):ve(e,t,n):document.createTextNode(String(e))}var Se={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},m=[];function ae(){return m[m.length-1]}ne(ae);ie(ae);function Ct(){return m}function xe(e,t,n){let{tag:r,props:s,children:o}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let g=r;r=function(me){return new g(me).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return ue(e,t);if(r==="__suspense"||e.tag==="__suspense")return pe(e,t);if(r==="__portal"||e.tag==="__portal")return de(e,t);let c=m[m.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let g=c._parentCtx;for(;g;){if(g._errorBoundary){i=g._errorBoundary;break}g=g._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},l=document.createComment("c:start"),p=document.createComment("c:end");V.set(l,f),f._startComment=l,f._endComment=p;let a=document.createDocumentFragment();a._componentCtx=f,f._wrapper=l,le.add(f),u&&d?.onComponentMount&&d.onComponentMount(f);let h=o.length===0?void 0:o.length===1?o[0]:o,C;h!==void 0?C=s?Object.assign({},s,{children:h}):{children:h}:C=s?Object.assign({},s):{};let y=S(C);f._propsSignal=y;let x=new Proxy({_sig:y},Se);m.push(f);let O;try{O=K(()=>r(x))}catch(g){if(m.pop(),!re(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return a.appendChild(l),a.appendChild(p),a}m.pop(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(A){console.error("[what] onMount error:",A)}}),a.appendChild(l);let _e=Array.isArray(O)?O:[O];for(let g of _e){let A=k(g,a,n);A&&a.appendChild(A)}return a.appendChild(p),a}function ue(e,t){let{errorState:n,handleError:r,fallback:s,reset:o}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};V.set(i,l);let p=document.createDocumentFragment();p._componentCtx=l,p.appendChild(i),p.appendChild(f);let a=v(()=>{let h=n();if(m.push(l),i.parentNode)for(;i.nextSibling&&i.nextSibling!==f;){let y=i.nextSibling;N(y),y.parentNode.removeChild(y)}let C;h?C=typeof s=="function"?[s({error:h,reset:o})]:[s]:C=c,C=Array.isArray(C)?C:[C];for(let y of C){let x=k(y,t);x&&(f.parentNode?f.parentNode.insertBefore(x,f):p.insertBefore(x,f))}m.pop()});return l.effects.push(a),p}function pe(e,t){let{boundary:n,fallback:r,loading:s}=e.props,o=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null,_startComment:c,_endComment:i};V.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let p=v(()=>{let h=s()?[r]:o,C=Array.isArray(h)?h:[h];if(m.push(f),c.parentNode)for(;c.nextSibling&&c.nextSibling!==i;){let y=c.nextSibling;N(y),y.parentNode.removeChild(y)}for(let y of C){let x=k(y,t);x&&(i.parentNode?i.parentNode.insertBefore(x,i):l.insertBefore(x,i))}m.pop()});return f.effects.push(p),l}function de(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let s={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null},o=document.createComment("portal");o._componentCtx=s;let c=[];for(let i of r){let f=k(i,n);f&&(n.appendChild(f),c.push(f))}return s._cleanupCallbacks=[()=>{for(let i of c)N(i),i.parentNode&&i.parentNode.removeChild(i)}],o}function ve(e,t,n){let{tag:r,props:s,children:o}=e,c=n||we.has(r),i=c?document.createElementNS(be,r):document.createElement(r);s&&ke(i,s,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<o.length;l++){let p=k(o[l],i,f);p&&i.appendChild(p)}return i._vnode=e,i}function ke(e,t,n,r){if(t){for(let s in t)if(!(s==="key"||s==="children")){if(s==="ref"){let o=t.ref;typeof o=="function"?o(e):o&&(o.current=e);continue}he(e,s,t[s],r)}}}function Le(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function he(e,t,n,r){if(typeof n=="function"&&!(t.startsWith("on")&&t.length>2)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=v(()=>{let s=n();he(e,t,s,r)});return}if(t.startsWith("on")&&t.length>2){let s=t.slice(2),o=!1;s.endsWith("Capture")&&(s=s.slice(0,-7),o=!0);let c=s.toLowerCase(),i=o?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,o),n==null))return;e._events||(e._events={});let l=a=>(a.nativeEvent||(a.nativeEvent=a),K(()=>l._handler(a)));l._handler=n,l._original=n,e._events[i]=l;let p=n._eventOpts;e.addEventListener(c,l,p||o||void 0);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let s=e._prevStyle||{};for(let o in s)o in n||(e.style[o]="");for(let o in n)e.style[o]=n[o]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let s=n?.__html??"";u&&typeof s=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(s)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=s;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let s=n.__html??"";u&&typeof s=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(s)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=s}else{u&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(n==null){if(t in e)try{e[t]=""}catch{}e.removeAttribute(t);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")||t.startsWith("aria-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Le(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{u as a,Me as b,S as c,Ae as d,v as e,Te as f,De as g,Oe as h,K as i,Be as j,Pe as k,Ie as l,Re as m,je as n,qe as o,$e as p,Ge as q,Ke as r,Je as s,Xe as t,Qe as u,Ze as v,oe as w,Ye as x,nt as y,rt as z,ot as A,st as B,it as C,ct as D,ft as E,lt as F,at as G,ut as H,N as I,yt as J,k as K,ae as L,Ct as M,Le as N};