what-core 0.5.6 → 0.6.1

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,123 @@
1
+ var S=!(typeof process<"u"),O=null;function gn(e){S&&(O=e)}var $=null,X=null,Z=null,ke=!1,we=0,q=[],Ee=!1,$e=new WeakMap,Xe=Symbol("needs_upstream"),De=null;function y(e,t){let n=e,r=new Set;function s(...o){if(o.length===0)return $&&(r.add($),$.deps.push(r)),n;S&&ke&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let i=typeof o[0]=="function"?o[0](n):o[0];Object.is(n,i)||(n=i,S&&O&&O.onSignalUpdate(s),r.size>0&&Ye(r))}return s.set=o=>{S&&ke&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let i=typeof o=="function"?o(n):o;Object.is(n,i)||(n=i,S&&O&&O.onSignalUpdate(s),r.size>0&&Ye(r))},s.peek=()=>n,s.subscribe=o=>N(()=>o(s())),s._signal=!0,S&&(s._subs=r,t&&(s._debugName=t)),S&&O&&O.onSignalCreate(s),s}function W(e){let t,n=!0,r=new Set,s=Ke(()=>{let i=ke;S&&(ke=!0);try{t=e(),n=!1}finally{S&&(ke=i)}},!0);s._level=1,s._computed=!0,s._computedSubs=r,$e.set(r,s),s._markDirty=()=>{n=!0},s._isDirty=()=>n;function o(){return $&&(r.add($),$.deps.push(r)),n&&lt(s),t}return s._onNotify=()=>{n=!0,r.size>0&&Ye(r)},o._signal=!0,o.peek=()=>(n&&lt(s),t),o}function lt(e){if(De!==null)throw De.push(e),Xe;let t=[e];De=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 i=$e.get(s[o]);i&&i._computed&&i._isDirty&&i._isDirty()&&(t.push(i),r=!0)}if(!r)try{let o=n.deps.length;Qe(n),n.deps.length!==o&&Fe(n),t.pop()}catch(o){if(o===Xe)n._markDirty();else throw o}}}finally{De=null}}function Fe(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let s=$e.get(n[r]);if(s){let o=s._level;o>t&&(t=o)}}e._level=t+1}function N(e,t){let n=Ke(e);n._level=1;let r=$;$=n;try{let o=n.fn();typeof o=="function"&&(n._cleanup=o)}finally{$=r}Fe(n),t?.stable&&(n._stable=!0);let s=()=>ut(n);return X&&X.disposals.push(s),s}function B(e){we++;try{e()}finally{we--,we===0&&Je()}}function Ke(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};return S&&O&&O.onEffectCreate(n),n}function Qe(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){S&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=$;$=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){O?.onError&&O.onError(r,{type:"effect",effect:e}),S&&console.warn("[what] Error in stable effect:",r)}finally{$=n}S&&O?.onEffectRun&&O.onEffectRun(e);return}if(ft(e),e._cleanup){try{e._cleanup()}catch(n){O?.onError&&O.onError(n,{type:"effect-cleanup",effect:e}),S&&console.warn("[what] Error in effect cleanup:",n)}e._cleanup=null}let t=$;$=e;try{let n=e.fn();typeof n=="function"&&(e._cleanup=n)}catch(n){throw n===Xe||O?.onError&&O.onError(n,{type:"effect",effect:e}),n}finally{$=t}S&&O?.onEffectRun&&O.onEffectRun(e)}function ut(e){if(e.disposed=!0,S&&O&&O.onEffectDispose(e),ft(e),e._cleanup){try{e._cleanup()}catch(t){S&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function ft(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}var Ue=0,pe=null,xe=0;function Ye(e){if(Ue===0){Ue=1;try{for(let t of e)if(!t.disposed){if(t._onNotify)t._onNotify();else if(we===0&&t._stable){let n=$;$=null;try{let r=t.fn();if(typeof r=="function"){if(t._cleanup)try{t._cleanup()}catch{}t._cleanup=r}}catch(r){O?.onError&&O.onError(r,{type:"effect",effect:t}),S&&console.warn("[what] Error in stable effect:",r)}finally{$=n}}else if(!t._pending){t._pending=!0;let n=t._level,r=q.length;r>0&&q[r-1]._level>n&&(Ee=!0),q.push(t)}}if(xe>0){let t=0;for(;t<xe;){let n=pe[t];pe[t]=null,t++;for(let r of n)if(!r.disposed){if(r._onNotify)r._onNotify();else if(we===0&&r._stable){let s=$;$=null;try{let o=r.fn();if(typeof o=="function"){if(r._cleanup)try{r._cleanup()}catch{}r._cleanup=o}}catch(o){O?.onError&&O.onError(o,{type:"effect",effect:r}),S&&console.warn("[what] Error in stable effect:",o)}finally{$=s}}else if(!r._pending){r._pending=!0;let s=r._level,o=q.length;o>0&&q[o-1]._level>s&&(Ee=!0),q.push(r)}}}xe=0}}finally{Ue=0}we===0&&q.length>0&&yn()}else pe===null&&(pe=[]),xe>=pe.length?pe.push(e):pe[xe]=e,xe++}var Oe=!1;function yn(){Oe||(Oe=!0,queueMicrotask(()=>{Oe=!1,Je()}))}var Pe=!1;function Je(){if(!Pe){Pe=!0;try{let e=0;for(;q.length>0&&e<25;){let t=q;q=[],t.length>1&&Ee&&t.sort((n,r)=>n._level-r._level),Ee=!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;Qe(r),!r._computed&&r.deps.length!==s&&Fe(r)}}e++}if(e>=25){for(let t=0;t<q.length;t++)q[t]._pending=!1;if(q.length=0,S){let n=q.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")}}finally{Pe=!1}}}function xn(e){let t,n=new Set,r=Ke(()=>{let o=e();if(!Object.is(t,o)){t=o;for(let i of n)if(!i.disposed){if(i._onNotify)i._onNotify();else if(!i._pending){i._pending=!0;let c=i._level,a=q.length;a>0&&q[a-1]._level>c&&(Ee=!0),q.push(i)}}}});r._level=1,Qe(r),Fe(r),$e.set(n,r),X&&X.disposals.push(()=>ut(r));function s(){return $&&(n.add($),$.deps.push(n)),t}return s._signal=!0,s.peek=()=>t,s}function wn(){if(Pe){S&&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($){S&&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}Oe=!1,Je()}function ie(e){let t=$;$=null;try{return e()}finally{$=t}}function bn(){return Z}function _n(e,t){let n=Z,r=X;Z=e,X=e;try{return t()}finally{Z=n,X=r}}function ce(e){let t=X,n=Z,r={disposals:[],owner:Z,children:[],_disposed:!1};Z&&Z.children.push(r),X=r,Z=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)dt(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{X=t,Z=n}}function dt(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)dt(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 Cn(e){X&&X.disposals.push(e)}var kn=Object.create(null);function L(e,t,...n){t=t||kn;let r=pt(n),s=t.key??null;return t.key!==void 0&&(t={...t},delete t.key),{tag:e,props:t,children:r,key:s,_vnode:!0}}function En({children:e}){return e}function pt(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];r==null||r===!1||r===!0||(Array.isArray(r)?t.push(...pt(r)):typeof r=="object"&&r._vnode||typeof r=="function"?t.push(r):t.push(String(r)))}return t}function vn(e,...t){let n=e.reduce((r,s,o)=>r+s+(o<t.length?`\0${o}\0`:""),"");return Sn(n,t)}function Sn(e,t){e=e.trim();let n=[],r=0;for(;r<e.length;){if(e[r]==="<"){let o=ht(e,r,t);if(o){n.push(o.node),r=o.end;continue}}let s=mt(e,r,t);s.text&&n.push(s.text),r=s.end}return n.length===1?n[0]:n}function ht(e,t,n){let r=e.slice(t).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\w*)/);if(!r)return null;let s=r[1],o=t+r[0].length,i={};for(;o<e.length;){for(;o<e.length&&/\s/.test(e[o]);)o++;if(e.slice(o,o+2)==="/>")return{node:L(s,Object.keys(i).length?i:null),end:o+2};if(e[o]===">"){o++;break}if(e.slice(o,o+3)==="..."){let f=e.slice(o+3).match(/^\x00(\d+)\x00/);if(f){Object.assign(i,n[Number(f[1])]),o+=3+f[0].length;continue}}let l=e.slice(o).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);if(!l)break;let u=l[1];for(o+=l[0].length;o<e.length&&/\s/.test(e[o]);)o++;if(e[o]==="="){for(o++;o<e.length&&/\s/.test(e[o]);)o++;let f=e.slice(o).match(/^\x00(\d+)\x00/);if(f)i[u]=n[Number(f[1])],o+=f[0].length;else if(e[o]==='"'||e[o]==="'"){let h=e[o];o++;let x="";for(;o<e.length&&e[o]!==h;){let g=e.slice(o).match(/^\x00(\d+)\x00/);g?(x+=String(n[Number(g[1])]),o+=g[0].length):(x+=e[o],o++)}o++,i[u]=x}}else i[u]=!0}let c=[],a=`</${s}>`;for(;o<e.length;){if(e.slice(o,o+a.length)===a){o+=a.length;break}if(e[o]==="<"){let u=ht(e,o,n);if(u){c.push(u.node),o=u.end;continue}}let l=mt(e,o,n);l.text!=null&&c.push(l.text),o=l.end}return{node:L(s,Object.keys(i).length?i:null,...c),end:o}}function mt(e,t,n){let r=t,s="";for(;r<e.length&&e[r]!=="<";){let o=e.slice(r).match(/^\x00(\d+)\x00/);if(o)return s.trim()?{text:s.trim(),end:r}:{text:n[Number(o[1])],end:r+o[0].length};s+=e[r],r++}return{text:s.trim()||null,end:r}}function An(e,t){let n=function(s){return e(s)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var gt=null;function yt(e){gt=e}function Tn(e){let t=null,n=null,r=null,s=new Set;function o(i){if(r)throw r;if(t)return L(t,i);throw n||(n=e().then(c=>{t=c.default||c,s.forEach(a=>a()),s.clear()}).catch(c=>{r=c})),n}return o.displayName="Lazy",o._lazy=!0,o._onLoad=i=>{t?i():s.add(i)},o}function Ln({fallback:e,children:t}){let n=y(!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 Mn({fallback:e,children:t,onError:n}){let r=y(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:i=>{if(r.set(i),n)try{n(i)}catch(c){console.error("Error in onError handler:",c)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}function xt(e,t){let n=t||gt?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function Nn({when:e,fallback:t=null,children:n}){return(typeof e=="function"?e():e)?n:t}function In({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,i)=>{let c=s(o,i);return c&&typeof c=="object"&&c.key==null&&(o!=null&&typeof o=="object"?o.id!=null?c.key=o.id:o.key!=null&&(c.key=o.key):(typeof o=="string"||typeof o=="number")&&(c.key=o)),c})}function Rn({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];for(let r of n)if(r&&r.tag===Ze&&(typeof r.props.when=="function"?r.props.when():r.props.when))return r.children;return e}function Ze({when:e,children:t}){return{tag:Ze,props:{when:e},children:t,_vnode:!0}}function Dn({component:e,mode:t,mediaQuery:n,...r}){let s=L("div",{"data-island":e.name||"Island","data-hydrate":t}),o=y(null),i=y(!1);function c(){i()||(i.set(!0),o.set(L(e,r)))}function a(u){switch(t){case"load":queueMicrotask(c);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(c):setTimeout(c,200);break;case"visible":{let f=new IntersectionObserver(h=>{h[0].isIntersecting&&(f.disconnect(),c())});f.observe(u);break}case"interaction":{let f=()=>{u.removeEventListener("click",f),u.removeEventListener("focus",f),u.removeEventListener("mouseenter",f),c()};u.addEventListener("click",f,{once:!0}),u.addEventListener("focus",f,{once:!0}),u.addEventListener("mouseenter",f,{once:!0});break}case"media":{if(!n){c();break}let f=window.matchMedia(n);if(f.matches)queueMicrotask(c);else{let h=()=>{f.matches&&(f.removeEventListener("change",h),c())};f.addEventListener("change",h)}break}default:queueMicrotask(c)}}let l=u=>{u&&a(u)};return L("div",{"data-island":e.name||"Island","data-hydrate":t,ref:l},i()?o():null)}var wt=!1;function On(e,t,n){return wt||(wt=!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 Pn(...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 $n(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Fn(t)}:${n}`).join(";")}function Fn(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function jn(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Hn(e,t){let n=0;return(...r)=>{let s=Date.now();s-n>=t&&(n=s,e(...r))}}var je=null;function bt(e){je=e}function Bn(e){if(typeof window>"u")return y(!1);let t=window.matchMedia(e),n=y(t.matches),r=o=>n.set(o.matches);t.addEventListener("change",r);let s=je?.();return s&&(s._cleanupCallbacks=s._cleanupCallbacks||[],s._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function Vn(e,t){let n;try{let c=localStorage.getItem(e);n=c!==null?JSON.parse(c):t}catch{n=t}let r=y(n),s=N(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(c){S&&console.warn("[what] localStorage write failed (quota exceeded?):",c)}}),o=null;typeof window<"u"&&(o=c=>{if(c.key===e&&c.newValue!==null)try{r.set(JSON.parse(c.newValue))}catch(a){S&&console.warn("[what] localStorage parse failed:",a)}},window.addEventListener("storage",o));let i=je?.();return i&&(i._cleanupCallbacks=i._cleanupCallbacks||[],i._cleanupCallbacks.push(()=>{s(),o&&window.removeEventListener("storage",o)})),r}function qn({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 Wn(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=je?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function Gn(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var zn=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"]),Un="http://www.w3.org/2000/svg",kt=new Set,He=new WeakMap;function Xn(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function _t(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function Ct(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)}S&&O?.onComponentUnmount&&O.onComponentUnmount(e),kt.delete(e)}}function Y(e){if(!e)return;e._componentCtx&&Ct(e._componentCtx);let t=He.get(e);if(t&&Ct(t),e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}if(e.childNodes)for(let n of e.childNodes)Y(n)}function Yn(e,t){typeof t=="string"&&(t=document.querySelector(t)),Y(t),t.textContent="";let n=Q(e,t);return n&&t.appendChild(n),()=>{Y(t),t.textContent=""}}function Q(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(Xn(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),s=document.createComment("/fn"),o=[],i=document.createDocumentFragment();i.appendChild(r),i.appendChild(s);let c=N(()=>{let a=e(),l=a==null||a===!1||a===!0?[]:Array.isArray(a)?a:[a],u=s.parentNode;if(u){for(let f of o)Y(f),f.parentNode===u&&u.removeChild(f);o=[];for(let f of l){let h=Q(f,u,t?._isSvg);if(h)if(h.nodeType===11){let x=Array.from(h.childNodes);u.insertBefore(h,s);for(let g of x)o.push(g)}else u.insertBefore(h,s),o.push(h)}}});return r._dispose=c,s._dispose=c,i}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let s of e){let o=Q(s,t,n);o&&r.appendChild(o)}return r}return _t(e)&&typeof e.tag=="function"?Kn(e,t,n):_t(e)?er(e,t,n):document.createTextNode(String(e))}var V=[];function G(){return V[V.length-1]}yt(G);bt(G);function Et(){return V}function Kn(e,t,n){let{tag:r,props:s,children:o}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let m=r;r=function(p){return new m(p).render()},r.displayName=m.displayName||m.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Qn(e,t);if(r==="__suspense"||e.tag==="__suspense")return Jn(e,t);if(r==="__portal"||e.tag==="__portal")return Zn(e,t);let i={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:V[V.length-1]||null,_errorBoundary:(()=>{let m=V[V.length-1];for(;m;){if(m._errorBoundary)return m._errorBoundary;m=m._parentCtx}return null})()},c=document.createComment("c:start"),a=document.createComment("c:end");He.set(c,i),i._startComment=c,i._endComment=a;let l=document.createDocumentFragment();l._componentCtx=i,i._wrapper=c,kt.add(i),S&&O?.onComponentMount&&O.onComponentMount(i);let u=o.length===0?void 0:o.length===1?o[0]:o,f=y({...s,children:u});i._propsSignal=f;let h=new Proxy({},{get(m,C){return f()[C]},has(m,C){let p=f();return C in p},ownKeys(){let m=f();return Reflect.ownKeys(m)},getOwnPropertyDescriptor(m,C){let p=f();if(C in p)return{value:p[C],writable:!1,enumerable:!0,configurable:!0}}});V.push(i);let x;try{x=r(h)}catch(m){if(V.pop(),!xt(m,i))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",m),m;return l.appendChild(c),l.appendChild(a),l}V.pop(),i.mounted=!0,i._mountCallbacks&&queueMicrotask(()=>{if(!i.disposed)for(let m of i._mountCallbacks)try{m()}catch(C){console.error("[what] onMount error:",C)}}),l.appendChild(c);let g=Array.isArray(x)?x:[x];for(let m of g){let C=Q(m,l,n);C&&l.appendChild(C)}return l.appendChild(a),l}function Qn(e,t){let{errorState:n,handleError:r,fallback:s,reset:o}=e.props,i=e.children,c=document.createComment("eb:start"),a=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:V[V.length-1]||null,_errorBoundary:r,_startComment:c,_endComment:a};He.set(c,l);let u=document.createDocumentFragment();u._componentCtx=l,u.appendChild(c),u.appendChild(a);let f=N(()=>{let h=n();if(V.push(l),c.parentNode)for(;c.nextSibling&&c.nextSibling!==a;){let g=c.nextSibling;Y(g),g.parentNode.removeChild(g)}let x;h?x=typeof s=="function"?[s({error:h,reset:o})]:[s]:x=i,x=Array.isArray(x)?x:[x];for(let g of x){let m=Q(g,t);m&&(a.parentNode?a.parentNode.insertBefore(m,a):u.insertBefore(m,a))}V.pop()});return l.effects.push(f),u}function Jn(e,t){let{boundary:n,fallback:r,loading:s}=e.props,o=e.children,i=document.createComment("sb:start"),c=document.createComment("sb:end"),a={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:V[V.length-1]||null,_startComment:i,_endComment:c};He.set(i,a);let l=document.createDocumentFragment();l._componentCtx=a,l.appendChild(i),l.appendChild(c);let u=N(()=>{let h=s()?[r]:o,x=Array.isArray(h)?h:[h];if(V.push(a),i.parentNode)for(;i.nextSibling&&i.nextSibling!==c;){let g=i.nextSibling;Y(g),g.parentNode.removeChild(g)}for(let g of x){let m=Q(g,t);m&&(c.parentNode?c.parentNode.insertBefore(m,c):l.insertBefore(m,c))}V.pop()});return a.effects.push(u),l}function Zn(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:V[V.length-1]||null},o=document.createComment("portal");o._componentCtx=s;let i=[];for(let c of r){let a=Q(c,n);a&&(n.appendChild(a),i.push(a))}return s._cleanupCallbacks=[()=>{for(let c of i)Y(c),c.parentNode&&c.parentNode.removeChild(c)}],o}function er(e,t,n){let{tag:r,props:s,children:o}=e,i=n||zn.has(r),c=i?document.createElementNS(Un,r):document.createElement(r);s&&tr(c,s,{},i);for(let a of o){let l=Q(a,c,i&&r!=="foreignObject");l&&c.appendChild(l)}return c._vnode=e,c}function tr(e,t,n,r){t=t||{},n=n||{};for(let s in t)if(!(s==="key"||s==="children")){if(s==="ref"){typeof t.ref=="function"?t.ref(e):t.ref&&(t.ref.current=e);continue}vt(e,s,t[s],r)}}function vt(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]=N(()=>{let s=n();vt(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 i=s.toLowerCase(),c=o?i+"_capture":i,a=e._events?.[c];if(a&&a._original===n||(a&&e.removeEventListener(i,a,o),n==null))return;e._events||(e._events={});let l=f=>(f.nativeEvent||(f.nativeEvent=f),ie(()=>n(f)));l._original=n,e._events[c]=l;let u=n._eventOpts;e.addEventListener(i,l,u||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"){e.innerHTML=n?.__html??"";return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n)e.innerHTML=n.__html??"";else{S&&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(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}t in e?e[t]=n:e.setAttribute(t,n)}function nr(e,t,n){if(n&&n.length>0){let r=n.length===1?n[0]:n;t=t?{...t,children:r}:{children:r}}return Q({tag:e,props:t||{},children:n||[],key:null,_vnode:!0})}var St=new Set(["href","src","action","formaction","formAction"]);function rr(e){if(typeof e!="string")return!0;let t=e.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:"))}var or={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>"}},sr=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 Nt(e){let t=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return t?t[1]:""}function It(e){let t=e.trim(),n=Nt(t);if(sr.has(n))return Dt(t);let r=or[n];if(r){let o=document.createElement("template");return o.innerHTML=r.wrap+t+r.unwrap,()=>{let i=o.content.firstChild;for(let c=0;c<r.depth;c++)i=i.firstChild;return i.cloneNode(!0)}}let s=document.createElement("template");return s.innerHTML=t,()=>s.content.firstChild.cloneNode(!0)}var At=!1;function Rt(e){return S&&!At&&(At=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),It(e)}function Dt(e){let t=e.trim();if(Nt(t)==="svg"){let s=document.createElement("template");return s.innerHTML=t,()=>s.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function ir(e,t,n){if(typeof t=="function"){let r=null;return N(()=>{r=Be(e,t(),r,n||null)}),r}return Be(e,t,null,n||null)}function Ot(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function cr(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function ar(e){return typeof SVGElement<"u"&&e instanceof SVGElement&&e.tagName.toLowerCase()!=="foreignobject"}function Tt(e){return e==null?[]:Array.isArray(e)?e:[e]}function Pt(e,t,n){if(e==null||typeof e=="boolean")return n;if(Array.isArray(e)){for(let r=0;r<e.length;r++)Pt(e[r],t,n);return n}return typeof e=="string"||typeof e=="number"?(n.push(document.createTextNode(String(e))),n):Ot(e)?(n.push(e),n):cr(e)?(n.push(Q(e,t,ar(t))),n):(n.push(document.createTextNode(String(e))),n)}function lr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Be(e,t,n,r){if(!e||typeof e.insertBefore!="function")return S&&console.warn("[what] reconcileInsert called with invalid parent:",e),n;let s=r||null;if(t==null||typeof t=="boolean"){let l=Tt(n);for(let u=0;u<l.length;u++){let f=l[u];f.parentNode===e&&(Y(f),e.removeChild(f))}return null}if((typeof t=="string"||typeof t=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let l=String(t);return n.textContent!==l&&(n.textContent=l),n}let o=Pt(t,e,[]),i=Tt(n);if(lr(i,o))return n;let c=new Set(o);for(let l=0;l<i.length;l++){let u=i[l];!c.has(u)&&u.parentNode===e&&(Y(u),e.removeChild(u))}let a=s;for(let l=o.length-1;l>=0;l--){let u=o[l];(u.parentNode!==e||u.nextSibling!==a)&&(a&&a.parentNode!==e&&(a=null),a?e.insertBefore(u,a):e.appendChild(u)),a=u}return o.length===0?null:o.length===1?o[0]:o}function ur(e,t,n){let r=n?.key,s=n?.raw||!1;return(o,i)=>{let c=[],a=[],l=[],u=r&&!s?new Map:null,f=document.createComment("/list");return o.insertBefore(f,i||null),N(()=>{let h=e()||[];r?hr(o,f,c,h,a,l,t,r,u):fr(o,f,c,h,a,l,t),c=h.slice()}),f}}function fr(e,t,n,r,s,o,i){let c=r.length,a=n.length;if(c===0){if(a>0){for(let p=0;p<a;p++)o[p]?.(),s[p]?.parentNode===e&&(Y(s[p]),e.removeChild(s[p]));s.length=0,o.length=0}return}if(a===0){let p=document.createDocumentFragment();for(let w=0;w<c;w++){let b=r[w],A=ce(T=>(o[w]=T,i(b,w)));s[w]=A,p.appendChild(A)}e.insertBefore(p,t);return}let l=0,u=Math.min(a,c);for(;l<u&&n[l]===r[l];)l++;if(l===a&&l===c)return;let f=a-1,h=c-1;for(;f>=l&&h>=l&&n[f]===r[h];)f--,h--;let x=new Array(c),g=new Array(c);for(let p=0;p<l;p++)x[p]=s[p],g[p]=o[p];for(let p=h+1;p<c;p++){let w=f+1+(p-h-1);x[p]=s[w],g[p]=o[w]}let m=h-l+1,C=f-l+1;if(m===0)for(let p=l;p<=f;p++)o[p]?.(),s[p]?.parentNode&&s[p].parentNode.removeChild(s[p]);else if(C===0){let p=l<c&&x[h+1]?x[h+1]:t,w=document.createDocumentFragment();for(let b=l;b<=h;b++){let A=r[b],T=b;x[b]=ce(k=>(g[T]=k,i(A,T))),w.appendChild(x[b])}e.insertBefore(w,p)}else dr(e,t,n,r,s,o,i,l,f,h,x,g);s.length=c,o.length=c;for(let p=0;p<c;p++)s[p]=x[p],o[p]=g[p]}function dr(e,t,n,r,s,o,i,c,a,l,u,f){let h=new Map;for(let w=c;w<=a;w++)h.set(n[w],w);let x=l-c+1,g=new Int32Array(x);g.fill(-1);for(let w=c;w<=l;w++){let b=h.get(r[w]);b!==void 0&&(h.delete(r[w]),u[w]=s[b],f[w]=o[b],g[w-c]=b)}for(let[,w]of h)o[w]?.(),s[w]?.parentNode&&s[w].parentNode.removeChild(s[w]);let m=x-pr(g,x),C=new Uint8Array(x);if(m>1){let w=new Int32Array(m),b=new Int32Array(m),A=0;for(let k=0;k<x;k++)g[k]!==-1&&(w[A]=g[k],b[A]=k,A++);let T=$t(w,m);for(let k=0;k<T.length;k++)C[b[T[k]]]=1}else if(m===1){for(let w=0;w<x;w++)if(g[w]!==-1){C[w]=1;break}}for(let w=c;w<=l;w++)if(!u[w]){let b=r[w],A=w;u[w]=ce(T=>(f[A]=T,i(b,A)))}let p=l+1<u.length&&u[l+1]?u[l+1]:t;for(let w=l;w>=c;w--){let b=w-c;(g[b]===-1||!C[b])&&(p&&p.parentNode!==e&&(p=t),e.insertBefore(u[w],p)),p=u[w]}}function pr(e,t){let n=0;for(let r=0;r<t;r++)e[r]===-1&&n++;return n}function $t(e,t){if(t===0)return[];if(t===1)return[0];let n=new Int32Array(t),r=new Int32Array(t),s=1;n[0]=0,r[0]=-1;for(let c=1;c<t;c++)if(e[c]>e[n[s-1]])r[c]=n[s-1],n[s++]=c;else{let a=0,l=s-1;for(;a<l;){let u=a+l>>1;e[n[u]]<e[c]?a=u+1:l=u}n[a]=c,r[c]=a>0?n[a-1]:-1}let o=new Array(s),i=n[s-1];for(let c=s-1;c>=0;c--)o[c]=i,i=r[i];return o}function hr(e,t,n,r,s,o,i,c,a){let l=r.length,u=n.length;if(l===0){if(u>0){for(let d=0;d<u;d++)o[d]?.(),s[d]?.parentNode===e&&(Y(s[d]),e.removeChild(s[d]));s.length=0,o.length=0,a&&a.clear()}return}if(u===0){let d=document.createDocumentFragment();for(let v=0;v<l;v++){let I=r[v],F=v,D;if(a){let K=c(I),_=y(I);D=_,a.set(K,{itemSig:_})}else D=I;let z=ce(K=>(o[F]=K,i(D,F)));s[v]=z,d.appendChild(z)}e.insertBefore(d,t);return}let f=0,h=Math.min(u,l);for(;f<h;){if(n[f]===r[f]){f++;continue}let d=c(n[f]),v=c(r[f]);if(d!==v)break;a&&a.get(d).itemSig.set(r[f]),f++}let x=u-1,g=l-1;for(;x>=f&&g>=f;){if(n[x]===r[g]){x--,g--;continue}let d=c(n[x]),v=c(r[g]);if(d!==v)break;a&&a.get(d).itemSig.set(r[g]),x--,g--}if(f>x&&f>g)return;let m=new Array(l),C=new Array(l);for(let d=0;d<f;d++)m[d]=s[d],C[d]=o[d];for(let d=g+1;d<l;d++){let v=x+1+(d-g-1);m[d]=s[v],C[d]=o[v]}let p=g-f+1;if(x-f+1===0){let d=g+1<l&&m[g+1]?m[g+1]:t,v=document.createDocumentFragment();for(let I=f;I<=g;I++){let F=r[I],D=I,z;if(a){let K=c(F),_=y(F);z=_,a.set(K,{itemSig:_})}else z=F;m[I]=ce(K=>(C[D]=K,i(z,D))),v.appendChild(m[I])}e.insertBefore(v,d),et(s,o,m,C,l);return}if(p===0){for(let d=f;d<=x;d++)o[d]?.(),s[d]?.parentNode&&e.removeChild(s[d]),a&&a.delete(c(n[d]));et(s,o,m,C,l);return}let b=new Map;for(let d=f;d<=x;d++)b.set(c(n[d]),d);let A=new Int32Array(p);A.fill(-1);for(let d=f;d<=g;d++){let v=c(r[d]),I=b.get(v);I!==void 0&&(b.delete(v),m[d]=s[I],C[d]=o[I],A[d-f]=I,a&&r[d]!==n[I]&&a.get(v).itemSig.set(r[d]))}for(let[d,v]of b)o[v]?.(),s[v]?.parentNode&&e.removeChild(s[v]),a&&a.delete(d);for(let d=f;d<=g;d++)if(!m[d]){let v=r[d],I=d,F;if(a){let D=c(v),z=y(v);F=z,a.set(D,{itemSig:z})}else F=v;m[d]=ce(D=>(C[I]=D,i(F,I)))}let T=0,k=!0,E=-1;for(let d=0;d<p;d++)A[d]!==-1&&(T++,A[d]<=E&&(k=!1),E=A[d]);let j=new Uint8Array(p);if(k)for(let d=0;d<p;d++)A[d]!==-1&&(j[d]=1);else if(T>1){let d=new Int32Array(T),v=new Int32Array(T),I=0;for(let D=0;D<p;D++)A[D]!==-1&&(d[I]=A[D],v[I]=D,I++);let F=$t(d,T);for(let D=0;D<F.length;D++)j[v[F[D]]]=1}else if(T===1){for(let d=0;d<p;d++)if(A[d]!==-1){j[d]=1;break}}let M=g+1<m.length&&m[g+1]?m[g+1]:t;for(let d=g;d>=f;d--){let v=d-f;(A[v]===-1||!j[v])&&(M&&M.parentNode!==e&&(M=t),e.insertBefore(m[d],M)),M=m[d]}et(s,o,m,C,l)}function et(e,t,n,r,s){e.length=s,t.length=s;for(let o=0;o<s;o++)e[o]=n[o],t[o]=r[o]}function mr(e,t){for(let n in t){let r=t[n];if(n.startsWith("on")&&n.length>2){let s=n.slice(2).toLowerCase();e.addEventListener(s,r);continue}typeof r=="function"&&!n.startsWith("on")?n==="class"||n==="className"?N(()=>{e.className=r()||""}):n==="style"&&typeof r()=="object"?N(()=>{let s=r();for(let o in s)e.style[o]=s[o]??""}):N(()=>{Se(e,n,r())}):Se(e,n,r)}}function Se(e,t,n){if(t==="ref"){typeof n=="function"?n(e):n&&typeof n=="object"&&(n.current=e);return}if((St.has(t)||St.has(t.toLowerCase()))&&!rr(n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${t}" attribute: ${n}`);return}if(t==="class"||t==="className")e.className=n||"";else if(t==="dangerouslySetInnerHTML")e.innerHTML=n?.__html??"";else if(t==="innerHTML")n&&typeof n=="object"&&"__html"in n?e.innerHTML=n.__html??"":typeof console<"u"&&n!=null&&n!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(t==="style"){if(typeof n=="string")e.style.cssText=n;else if(typeof n=="object")for(let r in n)e.style[r]=n[r]??""}else t.startsWith("data-")||t.startsWith("aria-")?e.setAttribute(t,n):typeof n=="boolean"?n?e.setAttribute(t,""):e.removeAttribute(t):t in e?e[t]=n:e.setAttribute(t,n)}var Lt=new Set;function gr(e){for(let t of e)Lt.has(t)||(Lt.add(t),document.addEventListener(t,n=>{let r=n.target,s="$$"+t;for(;r;){let o=r[s];if(o&&(o(n),n.cancelBubble))return;r=r.parentNode}}))}function yr(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function xr(e,t){N(()=>{for(let n in t){let r=typeof t[n]=="function"?t[n]():t[n];e.classList.toggle(n,!!r)}})}var Ve=!1,te=null;function wr(){return Ve}function br(e,t){Ve=!0,te={parent:t,index:0};try{return ve(e,t)}finally{Ve=!1,te=null}}function Mt(e){let t=e.childNodes;for(;te.index<t.length;){let n=t[te.index];if(n.nodeType===8){let r=n.textContent;if(r==="$"||r==="/$"||r==="[]"||r==="/[]"){te.index++;continue}}return te.index++,n}return null}function tt(){return typeof process<"u"&&!1}function ve(e,t){if(e==null||typeof e=="boolean")return null;if(typeof e=="string"||typeof e=="number"){let r=Mt(t),s=String(e);if(r&&r.nodeType===3)return tt()&&r.textContent!==s&&(console.warn(`[what] Hydration mismatch: expected text "${s}", got "${r.textContent}"`),r.textContent=s),r;tt()&&console.warn(`[what] Hydration mismatch: expected text node "${s}", got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createTextNode(s);return r?t.replaceChild(o,r):t.appendChild(o),o}if(typeof e=="function"){let r=e(),s=ve(r,t);return N(()=>{let o=e();Ve||(s=Be(t,o,s,null))}),s}if(Array.isArray(e)){let r=[];for(let s of e){let o=ve(s,t);o&&r.push(o)}return r.length===1?r[0]:r}if(typeof e=="object"&&e._vnode){if(typeof e.tag=="function"){let i=Et(),c=e.tag,a=e.props||{},l=e.children||[],u={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(u);let f;try{let h=l.length===0?void 0:l.length===1?l[0]:l;f=c({...a,children:h})}catch(h){return i.pop(),console.error("[what] Error in component during hydration:",c.name||"Anonymous",h),null}return i.pop(),u.mounted=!0,u._mountCallbacks&&queueMicrotask(()=>{if(!u.disposed)for(let h of u._mountCallbacks)try{h()}catch(x){console.error("[what] onMount error:",x)}}),ve(f,t)}let r=Mt(t),s=e.tag.toUpperCase();if(r&&r.nodeType===1&&r.nodeName===s){_r(r,e.props||{});let i=te;if(te={parent:r,index:0},e.props?.dangerouslySetInnerHTML?.__html==null)for(let a of e.children)ve(a,r);return te=i,r}tt()&&console.warn(`[what] Hydration mismatch: expected <${e.tag}>, got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createElement(e.tag);for(let i in e.props||{})i==="children"||i==="key"||Se(o,i,e.props[i]);for(let i of e.children)Be(o,i,null,null);return r?t.replaceChild(o,r):t.appendChild(o),o}if(Ot(e))return e;let n=document.createTextNode(String(e));return t.appendChild(n),n}function _r(e,t){for(let n in t){if(n==="children"||n==="key"||n==="ref"||n==="dangerouslySetInnerHTML"||n==="innerHTML")continue;let r=t[n];if(n.startsWith("on")&&n.length>2){let s=n.slice(2).toLowerCase();e.addEventListener(s,r);continue}if(n.startsWith("$$")){e[n]=r;continue}if(typeof r=="function"&&!n.startsWith("on")){n==="class"||n==="className"?N(()=>{e.className=r()||""}):n==="style"&&typeof r()=="object"?N(()=>{let s=r();for(let o in s)e.style[o]=s[o]??""}):N(()=>{Se(e,n,r())});continue}}}function J(e){let t=G();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 ae(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function Cr(e){let t=J("useState"),{index:n,exists:r}=ae(t);if(!r){let o=y(typeof e=="function"?e():e);t.hooks[n]=o}let s=t.hooks[n];return[s,s.set]}function kr(e){let t=J("useSignal"),{index:n,exists:r}=ae(t);return r||(t.hooks[n]=y(typeof e=="function"?e():e)),t.hooks[n]}function Er(e){let t=J("useComputed"),{index:n,exists:r}=ae(t);return r||(t.hooks[n]=W(e)),t.hooks[n]}function vr(e,t){let n=J("useEffect"),{index:r,exists:s}=ae(n);if(s||(n.hooks[r]={cleanup:null,dispose:null}),S&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let c=t[i];c!=null&&typeof c!="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 o=n.hooks[r];o.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(o.dispose=N(()=>{if(o.cleanup){try{o.cleanup()}catch{}o.cleanup=null}let i=e();typeof i=="function"&&(o.cleanup=i)}),n.effects=n.effects||[],n.effects.push(o.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(o.cleanup=i)}),o.dispose=!0):queueMicrotask(()=>{n.disposed||(o.dispose=N(()=>{for(let c=0;c<t.length;c++){let a=t[c];typeof a=="function"&&a._signal&&a()}if(o.cleanup){try{o.cleanup()}catch{}o.cleanup=null}let i=ie(()=>e());typeof i=="function"&&(o.cleanup=i)}),n.effects=n.effects||[],n.effects.push(o.dispose))}))}function Sr(e,t){let n=J("useMemo"),{index:r,exists:s}=ae(n);return s||(n.hooks[r]={computed:W(e)}),n.hooks[r].computed}function Ar(e,t){let n=J("useCallback"),{index:r,exists:s}=ae(n);return s||(n.hooks[r]={callback:e}),n.hooks[r].callback}function Tr(e){let t=J("useRef"),{index:n,exists:r}=ae(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ft(e){let t=G();for(S&&!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 Lr(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let s=J("Context.Provider");if(s._contextValues||(s._contextValues=new Map),s._contextSignals||(s._contextSignals=new Map),s._contextSignals.has(t))s._contextSignals.get(t).set(n);else{let o=y(n);s._contextSignals.set(t,o),s._contextValues.set(t,o)}return r},Consumer:({children:n})=>{let r=Ft(t);return typeof n=="function"?n(r):n}};return t}function Mr(e,t,n){let r=J("useReducer"),{index:s,exists:o}=ae(r);if(!o){let c=n?n(t):t,a=y(c),l=u=>{a.set(f=>e(f,u))};r.hooks[s]={signal:a,dispatch:l}}let i=r.hooks[s];return[i.signal,i.dispatch]}function Nr(e){let t=J("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function Ir(e){let t=J("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function Rr(e,t={}){let n=y(t.initialValue??null),r=y(!t.initialValue),s=y(null),o=null,i=async l=>{o&&o.abort(),o=new AbortController;let{signal:u}=o;r.set(!0),s.set(null);try{let f=await e(l,{signal:u});u.aborted||B(()=>{n.set(f),r.set(!1)})}catch(f){u.aborted||B(()=>{s.set(f),r.set(!1)})}},c=l=>{n.set(typeof l=="function"?l(n()):l)},a=G?.();return a&&(a._cleanupCallbacks=a._cleanupCallbacks||[],a._cleanupCallbacks.push(()=>{o&&o.abort()})),t.initialValue||i(t.source),[n,{loading:r,error:s,refetch:i,mutate:c}]}function Bt(e){return e._storeComputed=!0,e}var jt=!1;function Dr(e){return jt||(jt=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),Bt(e)}function Or(e){let t={},n={},r={},s={};for(let[o,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(S&&i.length===0&&console.warn(`[what] derived() for "${o}" should accept the state parameter, e.g. derived(state => ...).`),n[o]=i):typeof i=="function"?r[o]=i:t[o]=y(i);for(let[o,i]of Object.entries(n)){let c=new Proxy({},{get(a,l){if(t[l])return t[l]();if(n[l])return n[l]()}});n[o]=W(()=>i(c))}for(let[o,i]of Object.entries(r))r[o]=(...c)=>{B(()=>{let a=new Proxy({},{get(l,u){if(t[u])return t[u].peek();if(n[u])return n[u].peek();if(r[u])return r[u]},set(l,u,f){return t[u]&&t[u].set(f),!0}});i.apply(a,c)})};return function(){let i={};for(let[c,a]of Object.entries(t))Object.defineProperty(i,c,{get:()=>a(),enumerable:!0});for(let[c,a]of Object.entries(n))Object.defineProperty(i,c,{get:()=>a(),enumerable:!0});for(let[c,a]of Object.entries(r))i[c]=a;return i}}var Ht=!1;function Pr(e){return Ht||(Ht=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),y(e)}var nt={title:null,metas:new Map,links:new Map};function $r({title:e,meta:t,link:n,children:r}){if(typeof document>"u")return null;if(e&&(document.title=e,nt.title=e),t)for(let s of Array.isArray(t)?t:[t]){let o=s.name||s.property||s.httpEquiv||JSON.stringify(s);Vt("meta",o,s)}if(n)for(let s of Array.isArray(n)?n:[n]){let o=s.rel+(s.href||"");Vt("link",o,s)}return r||null}function Vt(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){Fr(r,n);return}let s=document.createElement(e);s.setAttribute("data-what-head",t);for(let[o,i]of Object.entries(n))s.setAttribute(o,i);document.head.appendChild(s)}function Fr(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function jr(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();nt.metas.clear(),nt.links.clear()}var Te=[],Le=[],ot=!1;function ne(e){return Te.push(e),Wt(),()=>{let t=Te.indexOf(e);t!==-1&&Te.splice(t,1)}}function le(e){return Le.push(e),Wt(),()=>{let t=Le.indexOf(e);t!==-1&&Le.splice(t,1)}}function qt(){for(;Te.length>0;){let e=Te.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;Le.length>0;){let e=Le.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}ot=!1}function Wt(){ot||(ot=!0,requestAnimationFrame(qt))}function Hr(e){return new Promise(t=>{ne(()=>{t(e())})})}function Br(e){return new Promise(t=>{le(()=>{e(),t()})})}function Vr(e,t){let n=Symbol("scheduledEffect");return N(()=>{Gt(n,()=>{ne(()=>{let r=e();t&&le(()=>t(r))})})})}function qr(){let e,t=new Promise((n,r)=>{let s=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(s),r(new Error("Cancelled"))}});return t.cancel=e,t}var Ae=new Map;function Gt(e,t){Ae.has(e)?Ae.set(e,t):(Ae.set(e,t),requestAnimationFrame(()=>{let n=Ae.get(e);Ae.delete(e),n&&n()}))}var rt=new WeakMap,qe=null;function Wr(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(qe||(qe=new ResizeObserver(n=>{ne(()=>{for(let r of n){let s=rt.get(r.target);s&&s(r.contentRect)}})})),rt.set(e,t),qe.observe(e),()=>{rt.delete(e),qe.unobserve(e)})}function Gr(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(s=>{ne(()=>{for(let o of s)t(o)})},n);return r.observe(e),()=>r.disconnect()}function zr(e,t={}){let{duration:n=300,easing:r=s=>s*(2-s)}=t;return new Promise(s=>{let o,i,c;ne(()=>{o=window.scrollY;let l=e.getBoundingClientRect();i=o+l.top,c=performance.now(),a()});function a(){ne(()=>{let l=performance.now()-c,u=Math.min(l/n,1),f=r(u),h=o+(i-o)*f;le(()=>{window.scrollTo(0,h),u<1?requestAnimationFrame(a):s()})})}})}function zt(e){let t=G?.(),n=N(e);return t&&t.effects.push(n),n}function Ut(e,t={}){let{stiffness:n=100,damping:r=10,mass:s=1,precision:o=.01}=t,i=y(e),c=y(e),a=y(0),l=y(!1),u=null,f=null;function h(p){if(f===null){f=p,u=requestAnimationFrame(h);return}let w=Math.min((p-f)/1e3,.064);f=p;let b=i.peek(),A=c.peek(),T=a.peek(),k=b-A,E=-n*k,j=-r*T,M=(E+j)/s,d=T+M*w,v=b+d*w;if(B(()=>{a.set(d),i.set(v)}),Math.abs(d)<o&&Math.abs(k)<o){B(()=>{i.set(A),a.set(0),l.set(!1)}),u=null,f=null;return}u=requestAnimationFrame(h)}function x(p){c.set(p),u===null&&(l.set(!0),f=null,u=requestAnimationFrame(h))}function g(){u&&(cancelAnimationFrame(u),u=null),l.set(!1),f=null}function m(p){g(),B(()=>{i.set(p),c.set(p),a.set(0)})}let C=G?.();return C&&(C._cleanupCallbacks=C._cleanupCallbacks||[],C._cleanupCallbacks.push(g)),{current:()=>i(),target:()=>c(),velocity:()=>a(),isAnimating:()=>l(),set:x,stop:g,snap:m,subscribe:i.subscribe}}function Xt(e,t,n={}){let{duration:r=300,easing:s=x=>x*(2-x),onUpdate:o,onComplete:i}=n,c=y(0),a=y(e),l=y(!0),u=null,f=null;function h(x){u===null&&(u=x);let g=x-u,m=Math.min(g/r,1),C=s(m),p=e+(t-e)*C;B(()=>{c.set(m),a.set(p)}),o&&o(p,m),m<1?f=requestAnimationFrame(h):(l.set(!1),i&&i())}return f=requestAnimationFrame(h),{progress:()=>c(),value:()=>a(),isAnimating:()=>l(),cancel:()=>{f&&cancelAnimationFrame(f),l.set(!1)},subscribe:a.subscribe}}var Yt={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 Ur(e={}){let{duration:t=300,easing:n=Yt.easeOutQuad}=e,r=y(!1),s=y(0);async function o(i){return r.set(!0),s.set(0),new Promise(c=>{let a=performance.now();function l(u){let f=u-a,h=Math.min(f/t,1);s.set(n(h)),h<1?requestAnimationFrame(l):(r.set(!1),i&&i(),c())}requestAnimationFrame(l)})}return{isTransitioning:()=>r(),progress:()=>s(),start:o}}function Xr(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:s,onPinch:o,onSwipe:i,onTap:c,onLongPress:a,preventDefault:l=!1}=t,u={isDragging:y(!1),startX:0,startY:0,currentX:y(0),currentY:y(0),deltaX:y(0),deltaY:y(0),velocity:y({x:0,y:0})},f=0,h=0,x=0,g=null;function m(k){let E=k.touches?k.touches[0]:k;u.startX=E.clientX,u.startY=E.clientY,h=E.clientX,x=E.clientY,f=performance.now(),u.isDragging.set(!0),r&&r({x:u.startX,y:u.startY}),a&&(g=setTimeout(()=>{u.isDragging.peek()&&a({x:h,y:x})},500))}function C(k){if(!u.isDragging.peek())return;let E=k.touches?k.touches[0]:k,j=E.clientX,M=E.clientY,d=performance.now(),v=d-f;B(()=>{u.currentX.set(j),u.currentY.set(M),u.deltaX.set(j-u.startX),u.deltaY.set(M-u.startY),v>0&&u.velocity.set({x:(j-h)/v*1e3,y:(M-x)/v*1e3})}),h=j,x=M,f=d,g&&Math.sqrt(u.deltaX.peek()**2+u.deltaY.peek()**2)>10&&(clearTimeout(g),g=null),n&&n({x:j,y:M,deltaX:u.deltaX.peek(),deltaY:u.deltaY.peek(),velocity:u.velocity.peek()})}function p(k){if(!u.isDragging.peek())return;g&&(clearTimeout(g),g=null);let E=u.deltaX.peek(),j=u.deltaY.peek(),M=u.velocity.peek();if(Math.sqrt(E**2+j**2)<10&&c&&c({x:u.startX,y:u.startY}),i&&(Math.abs(M.x)>500||Math.abs(M.y)>500)){let v=Math.abs(M.x)>Math.abs(M.y)?M.x>0?"right":"left":M.y>0?"down":"up";i({direction:v,velocity:M})}s&&s({deltaX:E,deltaY:j,velocity:M}),u.isDragging.set(!1)}let w=null;function b(k){if(!o||k.touches.length!==2)return;let E=k.touches[0],j=k.touches[1],M=Math.sqrt((j.clientX-E.clientX)**2+(j.clientY-E.clientY)**2);w===null&&(w=M);let d=M/w,v=(E.clientX+j.clientX)/2,I=(E.clientY+j.clientY)/2;o({scale:d,centerX:v,centerY:I})}function A(){w=null}typeof e=="function"?zt(()=>{let k=ie(e);if(k)return T(k)}):e?.current!==void 0?zt(()=>{let k=e.current;if(k)return T(k)}):e&&T(e);function T(k){return k.addEventListener("mousedown",m),k.addEventListener("touchstart",m,{passive:!l}),window.addEventListener("mousemove",C),window.addEventListener("touchmove",b),window.addEventListener("touchmove",C),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),window.addEventListener("touchend",A),()=>{k.removeEventListener("mousedown",m),k.removeEventListener("touchstart",m),window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",b),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),window.removeEventListener("touchend",A)}}return u}function Yr(e){let t=y(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,s={}){let o=Ut(t.peek(),s);o.set(r);let i=N(()=>{t.set(o.current())});return{stop:()=>{o.stop(),i()}}},timing(r,s={}){let o=Xt(t.peek(),r,{...s,onUpdate:i=>t.set(i)});return{stop:()=>o.cancel()}},interpolate(r,s){return()=>{let o=t();for(let i=0;i<r.length-1;i++)if(o>=r[i]&&o<=r[i+1]){let c=(o-r[i])/(r[i+1]-r[i]);return s[i]+(s[i+1]-s[i])*c}return o<=r[0]?s[0]:s[s.length-1]}},subscribe:t.subscribe}}function Kt(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 Kr(e,t,n="enter",r=300){let s=Kt(t);return new Promise(o=>{le(()=>{e.classList.add(s[n]),ne(()=>{e.offsetHeight,le(()=>{e.classList.add(s[`${n}Active`]),setTimeout(()=>{le(()=>{e.classList.remove(s[n],s[`${n}Active`]),e.classList.add(s[`${n}Done`]),o()})},r)})})})})}var Jt=y(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Jt.set(e.target)});function Qr(){return{current:()=>Jt(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function Jr(){let e={current:null};function t(r){typeof document>"u"||(e.current=r||document.activeElement||null)}function n(r){let s=e.current||r;s&&typeof s.focus=="function"&&s.focus()}return{capture:t,restore:n,previous:()=>e.current}}function Zt(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let s=e.current||e;if(!s||typeof s.querySelectorAll!="function")return;let o=Qt(s);if(o.length===0)return;o[0].focus();function i(c){if(c.key!=="Tab")return;let a=Qt(s),l=a[0],u=a[a.length-1];c.shiftKey?document.activeElement===l&&(c.preventDefault(),u.focus()):document.activeElement===u&&(c.preventDefault(),l.focus())}return s.addEventListener("keydown",i),()=>{s.removeEventListener("keydown",i)}}function r(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:r}}function Qt(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 Zr({children:e,active:t=!0}){let n={current:null},r=y(0),s=Zt(n),o=null,i=l=>{n.current=l,r.set(u=>u+1)},c=N(()=>{if(r(),o&&(o(),o=null,s.deactivate()),t&&n.current)return o=s.activate(),()=>{o?.(),o=null,s.deactivate()}}),a=G?.();return a&&(a._cleanupCallbacks=a._cleanupCallbacks||[],a._cleanupCallbacks.push(()=>{c(),o?.(),o=null,s.deactivate()})),L("div",{ref:i},e)}var ue=null,st=0;function eo(){return typeof document>"u"?null:(ue||(ue=document.createElement("div"),ue.id="what-announcer",ue.setAttribute("aria-live","polite"),ue.setAttribute("aria-atomic","true"),ue.style.cssText=`
2
+ position: absolute;
3
+ width: 1px;
4
+ height: 1px;
5
+ padding: 0;
6
+ margin: -1px;
7
+ overflow: hidden;
8
+ clip: rect(0, 0, 0, 0);
9
+ white-space: nowrap;
10
+ border: 0;
11
+ `,document.body.appendChild(ue)),ue)}function en(e,t={}){let{priority:n="polite",timeout:r=1e3}=t,s=eo();if(!s)return;s.setAttribute("aria-live",n);let o=++st;s.textContent="",requestAnimationFrame(()=>{st===o&&(s.textContent=e)}),setTimeout(()=>{st===o&&(s.textContent="")},r)}function to(e){return en(e,{priority:"assertive"})}function no({href:e="#main",children:t="Skip to content"}){return L("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 ro(e=!1){let t=y(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 oo(e=null){let t=y(e);return{selected:()=>t(),select:n=>t.set(n),isSelected:n=>t()===n,itemProps:n=>({"aria-selected":t()===n,onClick:()=>t.set(n)})}}function so(e=!1){let t=y(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 io(e){let t=typeof e=="function"?e:()=>e,n=y(0);function r(s){let o=t();if(!(o<=0))switch(s.key){case"ArrowDown":case"ArrowRight":s.preventDefault(),n.set((n.peek()+1)%o);break;case"ArrowUp":case"ArrowLeft":s.preventDefault(),n.set((n.peek()-1+o)%o);break;case"Home":s.preventDefault(),n.set(0);break;case"End":s.preventDefault(),n.set(o-1);break}}return{focusIndex:()=>n(),setFocusIndex:s=>n.set(s),getItemProps:s=>({tabIndex:n()===s?0:-1,onKeyDown:r,onFocus:()=>n.set(s)}),containerProps:()=>({role:"listbox"})}}function co({children:e,as:t="span"}){return L(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 ao({children:e,priority:t="polite",atomic:n=!0}){return L("div",{"aria-live":t,"aria-atomic":n},e)}var tn=0;function it(e="what"){let t=`${e}-${++tn}`;return()=>t}function lo(e,t="what"){let n=[];for(let r=0;r<e;r++)n.push(`${t}-${++tn}`);return n}function uo(e){let t=it("desc");return{descriptionId:t,descriptionProps:()=>({id:t(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":t()}),Description:()=>L("div",{id:t(),style:{display:"none"}},e)}}function fo(e){let t=it("label");return{labelId:t,labelProps:()=>({id:t()}),labelledByProps:()=>({"aria-labelledby":t()})}}var po={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function ho(e,t){return n=>{n.key===e&&t(n)}}function mo(e,t){return n=>{e.includes(n.key)&&t(n)}}var go=`
12
+ .what-skeleton {
13
+ background: linear-gradient(
14
+ 90deg,
15
+ var(--skeleton-base, #e0e0e0) 0%,
16
+ var(--skeleton-highlight, #f0f0f0) 50%,
17
+ var(--skeleton-base, #e0e0e0) 100%
18
+ );
19
+ background-size: 200% 100%;
20
+ animation: what-skeleton-shimmer 1.5s infinite ease-in-out;
21
+ border-radius: var(--skeleton-radius, 4px);
22
+ }
23
+
24
+ @keyframes what-skeleton-shimmer {
25
+ 0% { background-position: 200% 0; }
26
+ 100% { background-position: -200% 0; }
27
+ }
28
+
29
+ .what-skeleton-pulse {
30
+ animation: what-skeleton-pulse 1.5s infinite ease-in-out;
31
+ }
32
+
33
+ @keyframes what-skeleton-pulse {
34
+ 0%, 100% { opacity: 1; }
35
+ 50% { opacity: 0.5; }
36
+ }
37
+
38
+ .what-skeleton-wave {
39
+ position: relative;
40
+ overflow: hidden;
41
+ }
42
+
43
+ .what-skeleton-wave::after {
44
+ content: '';
45
+ position: absolute;
46
+ top: 0;
47
+ right: 0;
48
+ bottom: 0;
49
+ left: 0;
50
+ background: linear-gradient(
51
+ 90deg,
52
+ transparent 0%,
53
+ rgba(255, 255, 255, 0.4) 50%,
54
+ transparent 100%
55
+ );
56
+ animation: what-skeleton-wave 1.5s infinite;
57
+ }
58
+
59
+ @keyframes what-skeleton-wave {
60
+ 0% { transform: translateX(-100%); }
61
+ 100% { transform: translateX(100%); }
62
+ }
63
+ `,nn=!1;function he(){if(nn||typeof document>"u")return;nn=!0;let e=document.createElement("style");e.textContent=go,document.head.appendChild(e)}function ct({width:e,height:t,variant:n="shimmer",circle:r=!1,class:s,style:o,count:i=1}){he();let c=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,a=s?`${c} ${s}`:c,l={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...o};return i===1?L("div",{class:a,style:l,"aria-hidden":"true"}):Array.from({length:i},(u,f)=>L("div",{key:f,class:a,style:{...l,marginBottom:f<i-1?"8px":void 0},"aria-hidden":"true"}))}function at({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:s="shimmer"}){return he(),L("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(o,i)=>L("div",{key:i,class:`what-skeleton ${s==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:i===e-1?t:"100%",marginBottom:i<e-1?`${r}px`:void 0}})))}function yo({size:e=40,variant:t="shimmer"}){return ct({width:e,height:e,circle:!0,variant:t})}function rn({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return he(),L("div",{class:"what-skeleton-card","aria-hidden":"true"},L("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),L("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),at({lines:t,variant:n}))}function xo({rows:e=5,columns:t=4,variant:n="shimmer"}){return he(),L("div",{class:"what-skeleton-table","aria-hidden":"true"},L("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,s)=>L("div",{key:s,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,s)=>L("div",{key:s,style:{display:"flex",gap:"16px",marginBottom:s<e-1?"12px":void 0}},Array.from({length:t},(o,i)=>L("div",{key:i,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function wo({type:e="default",height:t,children:n}){return he(),e==="card"?rn({}):e==="text"?at({}):n||L("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function bo(e,t=[]){let n=y(!0),r=y(null),s=y(null);return N(()=>{n.set(!0),s.set(null),Promise.resolve(e()).then(o=>{r.set(o),n.set(!1)}).catch(o=>{s.set(o),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>s(),Skeleton:o=>n()?ct(o):null}}function _o({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:s="shimmer"}){return he(),L("div",{class:`what-skeleton ${s==="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&&L("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function Co({size:e=8,color:t="#666"}){he();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return L("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},L("div",{style:{...n,animationDelay:"0s"}}),L("div",{style:{...n,animationDelay:"0.2s"}}),L("div",{style:{...n,animationDelay:"0.4s"}}))}function ko({size:e=24,color:t="#666",strokeWidth:n=2}){return L("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},L("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),L("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var U=new Map,fe=new Map,de=new Map,ee=new Map,on=200;function We(e){return ee.set(e,Date.now()),U.has(e)||(U.set(e,y(null)),U.size>on&&vo()),U.get(e)}function sn(e){return fe.has(e)||fe.set(e,y(null)),fe.get(e)}function Eo(e){return de.has(e)||de.set(e,y(!1)),de.get(e)}function vo(){let e=[...ee.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(on*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];re.has(r)&&re.get(r).size>0||(U.delete(r),fe.delete(r),de.delete(r),ee.delete(r),Me.delete(r))}}var re=new Map;function cn(e,t){return re.has(e)||re.set(e,new Set),re.get(e).add(t),()=>{let n=re.get(e);n&&(n.delete(t),n.size===0&&re.delete(e))}}var me=new Map,Me=new Map;function oe(e){let t=G?.(),n=N(e);return t&&t.effects.push(n),n}function So(e,t={}){let{method:n="GET",body:r,headers:s={},transform:o=h=>h,initialData:i=null}=t,c=y(i),a=y(null),l=y(!0),u=null;async function f(){u&&u.abort(),u=new AbortController;let{signal:h}=u;l.set(!0),a.set(null);try{let x=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...s},body:r?JSON.stringify(r):void 0,signal:h});if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);let g=await x.json();h.aborted||c.set(o(g))}catch(x){h.aborted||a.set(x)}finally{h.aborted||l.set(!1)}}return oe(()=>(f(),()=>{u&&u.abort()})),{data:()=>c(),error:()=>a(),isLoading:()=>l(),refetch:f,mutate:h=>c.set(h)}}function Ao(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:s=!0,refreshInterval:o=0,dedupingInterval:i=2e3,fallbackData:c,onSuccess:a,onError:l,suspense:u=!1}=n;if(e==null||e===!1){let b=y(c||null),A=y(null);return{data:()=>b(),error:()=>A(),isLoading:()=>!1,isValidating:()=>!1,mutate:T=>b.set(typeof T=="function"?T(b()):T),revalidate:()=>Promise.resolve()}}let f=We(e),h=sn(e),x=Eo(e),g=W(()=>f()??c??null),m=W(()=>f()==null&&x()),C=null;async function p(){let b=Date.now();if(me.has(e)){let E=me.get(e);if(b-E.timestamp<i)return E.refCount++,E.promise}let A=Me.get(e);if(A&&b-A<i&&f.peek()!=null)return f.peek();if(C){let E=me.get(e);(!E||E.refCount<=1)&&C.abort()}C=new AbortController;let{signal:T}=C;x.set(!0);let k=t(e,{signal:T});me.set(e,{promise:k,timestamp:b,refCount:1});try{let E=await k;return T.aborted?void 0:(B(()=>{f.set(E),h.set(null)}),ee.set(e,Date.now()),Me.set(e,Date.now()),a&&a(E,e),E)}catch(E){if(T.aborted)return;throw h.set(E),l&&l(E,e),E}finally{T.aborted||x.set(!1);let E=me.get(e);E&&(E.refCount--,E.refCount<=0&&me.delete(e))}}let w=cn(e,()=>p().catch(()=>{}));return oe(()=>(p().catch(()=>{}),()=>{C&&C.abort(),w()})),r&&typeof window<"u"&&oe(()=>{let b=()=>{document.visibilityState==="visible"&&p().catch(()=>{})};return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)}),s&&typeof window<"u"&&oe(()=>{let b=()=>p().catch(()=>{});return window.addEventListener("online",b),()=>window.removeEventListener("online",b)}),o>0&&oe(()=>{let b=setInterval(()=>{p().catch(()=>{})},o);return()=>clearInterval(b)}),{data:()=>g(),error:()=>h(),isLoading:()=>m(),isValidating:()=>x(),mutate:(b,A=!0)=>{let T=typeof b=="function"?b(f.peek()):b;f.set(T),ee.set(e,Date.now()),A&&p().catch(()=>{})},revalidate:p}}function To(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:s=0,cacheTime:o=300*1e3,refetchOnWindowFocus:i=!0,refetchInterval:c=!1,retry:a=3,retryDelay:l=M=>Math.min(1e3*2**M,3e4),onSuccess:u,onError:f,onSettled:h,select:x,placeholderData:g}=e,m=Array.isArray(t)?t.join(":"):t,C=We(m),p=W(()=>{let M=C();return x&&M!==null?x(M):M}),w=sn(m),b=y(C.peek()!=null?"success":"loading"),A=y("idle"),T=0,k=null;async function E(){if(!r)return;let M=Date.now();if(C.peek()!=null&&M-T<s)return C.peek();k&&k.abort(),k=new AbortController;let{signal:d}=k;A.set("fetching"),C.peek()==null&&b.set("loading");let v=0;async function I(){try{let F=await n({queryKey:Array.isArray(t)?t:[t],signal:d});return d.aborted?void 0:(B(()=>{C.set(F),w.set(null),b.set("success"),A.set("idle")}),T=Date.now(),ee.set(m,Date.now()),u&&u(F),h&&h(F,null),setTimeout(()=>{if(Date.now()-T>=o){let D=re.get(m);(!D||D.size===0)&&(U.delete(m),fe.delete(m),de.delete(m),ee.delete(m),Me.delete(m))}},o),F)}catch(F){if(d.aborted)return;if(v++,v<a)return await new Promise((D,z)=>{let K=setTimeout(D,l(v));d.addEventListener("abort",()=>{clearTimeout(K),z(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(D=>{if(D.name!=="AbortError")throw D}),d.aborted?void 0:I();throw B(()=>{w.set(F),b.set("error"),A.set("idle")}),f&&f(F),h&&h(null,F),F}}return I()}let j=cn(m,()=>E().catch(()=>{}));return oe(()=>(r&&E().catch(()=>{}),()=>{k&&k.abort(),j()})),i&&typeof window<"u"&&oe(()=>{let M=()=>{document.visibilityState==="visible"&&E().catch(()=>{})};return document.addEventListener("visibilitychange",M),()=>document.removeEventListener("visibilitychange",M)}),c&&oe(()=>{let M=setInterval(()=>{E().catch(()=>{})},c);return()=>clearInterval(M)}),{data:()=>p()??g,error:()=>w(),status:()=>b(),fetchStatus:()=>A(),isLoading:()=>b()==="loading",isError:()=>b()==="error",isSuccess:()=>b()==="success",isFetching:()=>A()==="fetching",refetch:E}}function Lo(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:s,initialPageParam:o,...i}=e,c=y([]),a=y([o]),l=y(!0),u=y(!1),f=y(!1),h=y(!1),x=Array.isArray(t)?t.join(":"):t,g=null,m=!1;async function C(p,w="next"){g&&g.abort(),g=new AbortController;let{signal:b}=g,A=w==="next"?f:h;A.set(!0);try{let T=await n({queryKey:Array.isArray(t)?t:[t],pageParam:p,signal:b});return b.aborted?void 0:(B(()=>{m?(c.set([T]),a.set([p]),m=!1):w==="next"?(c.set([...c.peek(),T]),a.set([...a.peek(),p])):(c.set([T,...c.peek()]),a.set([p,...a.peek()]));let k=r?.(T,c.peek());if(l.set(k!==void 0),s){let E=s(T,c.peek());u.set(E!==void 0)}}),T)}finally{b.aborted||A.set(!1)}}return oe(()=>(C(o).catch(()=>{}),()=>{g&&g.abort()})),{data:()=>({pages:c(),pageParams:a()}),hasNextPage:()=>l(),hasPreviousPage:()=>u(),isFetchingNextPage:()=>f(),isFetchingPreviousPage:()=>h(),fetchNextPage:async()=>{let p=c.peek()[c.peek().length-1],w=r?.(p,c.peek());if(w!==void 0)return C(w,"next")},fetchPreviousPage:async()=>{let p=c.peek()[0],w=s?.(p,c.peek());if(w!==void 0)return C(w,"previous")},refetch:async()=>(m=!0,C(o))}}function Mo(e,t={}){let{hard:n=!1}=t,r=[];if(typeof e=="function")for(let[s]of U)e(s)&&r.push(s);else r.push(e);for(let s of r){n&&U.has(s)&&U.get(s).set(null);let o=re.get(s);if(o)for(let i of o)i()}}function No(e,t){let n=We(e);return t(e).then(r=>(n.set(r),ee.set(e,Date.now()),r))}function Io(e,t){let n=We(e),r=n.peek();n.set(typeof t=="function"?t(r):t),ee.set(e,Date.now())}function Ro(e){return U.has(e)?U.get(e).peek():void 0}function Do(){U.clear(),fe.clear(),de.clear(),ee.clear(),Me.clear(),me.clear()}function Oo(){let e=[];for(let[t,n]of U)e.push({key:t,data:n.peek(),error:fe.has(t)?fe.get(t).peek():null,isValidating:de.has(t)?de.get(t).peek():!1});return e}function Po(e={}){let t=G?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=an(e)),t.hooks[n]}return an(e)}function an(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:s}=e,o={},i={},c={},a=y({});function l(_){return o[_]||(o[_]=y(t[_]??"")),o[_]}function u(_){return i[_]||(i[_]=y(null)),i[_]}function f(_){return c[_]||(c[_]=y(!1)),c[_]}let h=y(!1),x=y(!1),g=y(!1),m=y(!1),C=y(0);function p(_=!1){let R={...t};for(let[P,H]of Object.entries(o))R[P]=_?H():H.peek();return R}function w(_=!1){return _?a():a.peek()}function b(_,R){let P=R??null;u(_).set(P),a.set(H=>{if(H[_]===P)return H;if(P==null){if(!Object.prototype.hasOwnProperty.call(H,_))return H;let se={...H};return delete se[_],se}return{...H,[_]:P}})}function A(_={}){let R=_||{};B(()=>{for(let[P,H]of Object.entries(i))Object.prototype.hasOwnProperty.call(R,P)||H.set(null);for(let[P,H]of Object.entries(R))u(P).set(H??null);a.set({...R})})}let T=W(()=>Object.keys(w(!0)).length===0),k=W(()=>{let _={};for(let[R,P]of Object.entries(o))P()!==(t[R]??"")&&(_[R]=!0);return _});async function E(_){if(!s)return!0;m.set(!0);try{let P=(await s(p(!1)))?.errors||{};if(_){let H=P[_]??null;return b(_,H),!H}else return A(P),Object.keys(P).length===0}finally{m.set(!1)}}function j(_,R={}){let P=l(_),H=R.type==="checkbox"||R.type==="radio",Ce=Re=>{let mn=Re.target.type==="checkbox"||Re.target.type==="radio"?Re.target.checked:Re.target.value;M(_,mn),(n==="onChange"||g.peek()&&r==="onChange")&&E(_)},se={name:_,onBlur:()=>{f(_).set(!0),(n==="onBlur"||g.peek()&&r==="onBlur")&&E(_)},onFocus:()=>{},ref:R.ref};return H?(Object.defineProperty(se,"checked",{get(){return!!P()},enumerable:!0}),se.onchange=Ce):(Object.defineProperty(se,"value",{get(){return P()},enumerable:!0}),se.oninput=Ce),se}function M(_,R,P={}){let{shouldValidate:H=!1,shouldDirty:Ce=!0}=P;l(_).set(R),Ce&&h.set(!0),H&&E(_)}function d(_){return l(_)()}function v(_,R){b(_,R)}function I(_){b(_,null)}function F(){A({})}function D(_=t){B(()=>{for(let[R,P]of Object.entries(o))P.set(_[R]??"");for(let R of Object.values(i))R.set(null);a.set({});for(let R of Object.values(c))R.set(!1);h.set(!1),g.set(!1)})}function z(_,R){return async P=>{P&&P.preventDefault(),x.set(!0),g.set(!0),C.set(C.peek()+1),await E()?await _(p()):R&&R(w(!1)),x.set(!1)}}function K(_){return _?W(()=>l(_)()):W(()=>p(!0))}return{register:j,handleSubmit:z,setValue:M,getValue:d,setError:v,clearError:I,clearErrors:F,reset:D,watch:K,validate:E,formState:{get values(){return p(!0)},get errors(){return w(!0)},error:_=>u(_)(),get touched(){let _={};for(let[R,P]of Object.entries(c))P()&&(_[R]=!0);return _},isDirty:()=>h(),isValid:T,isValidating:()=>m(),isSubmitting:()=>x(),isSubmitted:()=>g(),submitCount:()=>C(),dirtyFields:k}}}function $o(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r={};for(let s of n.errors||[]){let o=s.path.join(".");r[o]||(r[o]={type:s.code,message:s.message})}return{values:{},errors:r}}}}function Fo(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){let r={};for(let s of n.inner||[])r[s.path]||(r[s.path]={type:s.type,message:s.message});return{values:{},errors:r}}}}function jo(e){return async t=>{let n={};for(let[r,s]of Object.entries(e)){let o=t[r];for(let i of s){let c=i(o,t);if(c){n[r]={type:"validation",message:c};break}}}return{values:t,errors:n}}}var Ho={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 Bo(e,t={}){let{validate:n,defaultValue:r=""}=t,s=y(r),o=y(null),i=y(!1),c=y(!1);async function a(){if(!n)return!0;let l=await n(s.peek());return o.set(l||null),!l}return{name:e,value:()=>s(),error:()=>o(),isTouched:()=>i(),isDirty:()=>c(),setValue:l=>{s.set(l),c.set(!0)},setError:l=>o.set(l),validate:a,reset:()=>{s.set(r),o.set(null),i.set(!1),c.set(!1)},inputProps:()=>({name:e,value:s(),onInput:l=>{s.set(l.target.value),c.set(!0)},onBlur:()=>{i.set(!0),a()}})}}function Vo(e){let{register:t,error:n,...r}=e,s=t?t(e.name):{};return L("input",{...r,...s,"aria-invalid":n?"true":void 0})}function qo(e){let{register:t,error:n,...r}=e,s=t?t(e.name):{};return L("textarea",{...r,...s,"aria-invalid":n?"true":void 0})}function Wo(e){let{register:t,error:n,children:r,...s}=e,o=t?t(e.name):{};return L("select",{...s,...o,"aria-invalid":n?"true":void 0},r)}function Go(e){let{register:t,...n}=e,r=t?t(e.name):{};return L("input",{type:"checkbox",...n,...r,checked:r.value})}function zo(e){let{register:t,value:n,...r}=e,s=t?t(e.name):{};return L("input",{type:"radio",value:n,...r,checked:s.value===n,onChange:o=>{o.target.checked&&s.onInput&&s.onInput({target:{value:n}})}})}function Uo({name:e,formState:t,errors:n,render:r}){let s=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return s?r?r({message:s.message,type:s.type}):L("span",{class:"what-error",role:"alert"},s.message):null}var un={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
+ effect(() => { count(count() + 1); });
65
+
66
+ // Good \u2014 use untrack() so the read doesn't subscribe:
67
+ effect(() => { count(untrack(count) + 1); });
68
+
69
+ // Better \u2014 split into separate logic:
70
+ const doubled = computed(() => count() * 2);`},MISSING_SIGNAL_READ:{code:"ERR_MISSING_SIGNAL_READ",severity:"warning",template:'Signal "{{signalName}}" used without calling () \u2014 renders as "[Function]" instead of its value.',suggestion:"Signals are functions. Call them to read: count() not count. In JSX: {count()} not {count}.",codeExample:`// Bad \u2014 signal reference, not value:
71
+ <span>{count}</span> // renders "[Function]"
72
+
73
+ // Good \u2014 call the signal:
74
+ <span>{count()}</span> // renders the actual value`},HYDRATION_MISMATCH:{code:"ERR_HYDRATION_MISMATCH",severity:"error",template:'Hydration mismatch in component "{{component}}": server rendered "{{serverHTML}}" but client expects "{{clientHTML}}".',suggestion:"Ensure server and client render identical initial HTML. Avoid reading browser-only APIs (window, localStorage) during the initial render. Use onMount() for client-only logic.",codeExample:`// Bad \u2014 different on server vs client:
75
+ function App() {
76
+ return <p>{window.innerWidth}</p>;
77
+ }
78
+
79
+ // Good \u2014 use onMount for client-only values:
80
+ function App() {
81
+ const width = signal(0);
82
+ onMount(() => width(window.innerWidth));
83
+ return <p>{width()}</p>;
84
+ }`},ORPHAN_EFFECT:{code:"ERR_ORPHAN_EFFECT",severity:"warning",template:'Effect "{{effectName}}" was created outside a reactive root \u2014 it will never be cleaned up.',suggestion:"Wrap effect creation in createRoot() or create effects inside component functions where they are automatically tracked.",codeExample:`// Bad \u2014 orphaned, leaks memory:
85
+ effect(() => console.log(count()));
86
+
87
+ // Good \u2014 inside a root with cleanup:
88
+ createRoot(dispose => {
89
+ effect(() => console.log(count()));
90
+ // later: dispose() cleans up
91
+ });`},SIGNAL_WRITE_IN_RENDER:{code:"ERR_SIGNAL_WRITE_IN_RENDER",severity:"error",template:'Signal "{{signalName}}" written during render of component "{{component}}". This triggers re-execution.',suggestion:"Move signal writes into event handlers, effects, or onMount(). The component body should only read signals, not write them.",codeExample:`// Bad \u2014 write during render:
92
+ function Counter() {
93
+ count(count() + 1); // triggers infinite loop
94
+ return <span>{count()}</span>;
95
+ }
96
+
97
+ // Good \u2014 write in event handler:
98
+ function Counter() {
99
+ return <button onclick={() => count(c => c + 1)}>{count()}</button>;
100
+ }`},MISSING_CLEANUP:{code:"ERR_MISSING_CLEANUP",severity:"warning",template:'Effect sets up "{{resource}}" but does not return a cleanup function.',suggestion:"Effects that add event listeners, set timers, or open connections should return a cleanup function to prevent memory leaks.",codeExample:`// Bad \u2014 no cleanup:
101
+ effect(() => {
102
+ window.addEventListener('resize', handler);
103
+ });
104
+
105
+ // Good \u2014 return cleanup:
106
+ effect(() => {
107
+ window.addEventListener('resize', handler);
108
+ return () => window.removeEventListener('resize', handler);
109
+ });`},UNSAFE_INNERHTML:{code:"ERR_UNSAFE_INNERHTML",severity:"warning",template:"innerHTML set on element without using the __html safety marker.",suggestion:"Use the html tagged template literal or pass { __html: content } to mark innerHTML as intentional and reviewed.",codeExample:`// Bad \u2014 raw innerHTML (XSS risk):
110
+ <div innerHTML={userInput} />
111
+
112
+ // Good \u2014 explicit opt-in:
113
+ <div innerHTML={{ __html: sanitizedContent }} />
114
+
115
+ // Better \u2014 use the html template literal:
116
+ html\`<div>\${sanitizedContent}</div>\``},MISSING_KEY:{code:"ERR_MISSING_KEY",severity:"warning",template:'List rendered without key prop in component "{{component}}". Items may re-order incorrectly.',suggestion:"Add a unique key prop to each item in a list. Use a stable identifier (like an ID), not the array index.",codeExample:`// Bad \u2014 no key:
117
+ <For each={items()}>{item => <li>{item.name}</li>}</For>
118
+
119
+ // Good \u2014 stable key:
120
+ <For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},be=class extends Error{constructor({code:t,message:n,suggestion:r,file:s,line:o,component:i,signal:c,effect:a}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=s,this.line=o,this.component=i,this.signal=c,this.effect=a}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 ye(e,t={}){let n=typeof e=="string"?un[e]:e;if(!n)return new be({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[s,o]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${s}\\}\\}`,"g"),String(o));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new be({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 ge=[],ln=200;function Ge(e){S&&(ge.push({...e.toJSON(),timestamp:Date.now()}),ge.length>ln&&(ge=ge.slice(-ln)))}function ze(e){return e?ge.filter(t=>t.timestamp>e):ge.slice()}function Xo(){ge=[]}function Yo(e,t={}){let n=e?.message||String(e);return n.includes("infinite effect loop")||n.includes("25 iterations")?ye("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?ye("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?ye("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new be({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var Ne={signalReadDetection:!0,effectCycleDetection:!0,componentNaming:!0,importValidation:!0};function Ko(e){Object.assign(Ne,e)}function Qo(){return{...Ne}}function Jo(e,t){if(!S||!Ne.signalReadDetection)return e;let n=e.toString;return e.toString=function(){let r=ye("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${r.message}
121
+ Suggestion: ${r.suggestion}`),Ge(r),String(e())},e.valueOf=function(){let r=ye("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${r.message}
122
+ Suggestion: ${r.suggestion}`),Ge(r),e()},e}function Zo(e){if(!S||!Ne.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${es(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 es(e){return e.charAt(0).toUpperCase()+e.slice(1)}var fn=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","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 ts(e){if(!S||!Ne.importValidation)return[];let t=[];for(let n of e)fn.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${ns(n)}?`});return t}function ns(e){let t=e.toLowerCase(),n=null,r=1/0;for(let s of fn){let o=rs(t,s.toLowerCase());o<r&&(r=o,n=s)}return r<=3?n:"(no close match found)"}function rs(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 s=1;s<=e.length;s++){let o=t[r-1]===e[s-1]?0:1;n[r][s]=Math.min(n[r-1][s]+1,n[r][s-1]+1,n[r-1][s-1]+o)}return n[t.length][e.length]}var os="0.6.0",Ie=[];function ss(e){S&&Ie.push(e)}function is(e){if(!S)return;let t=Ie.indexOf(e);t>=0&&Ie.splice(t,1)}function dn(){return Ie.slice()}var _e=[];function cs(e){S&&_e.push(e)}function as(e){if(!S)return;let t=_e.indexOf(e);t>=0&&_e.splice(t,1)}function pn(){return _e.slice()}function hn(){let e=ze(),t=e.filter(a=>Date.now()-a.timestamp<6e4),r=e.filter(a=>a.code==="ERR_INFINITE_EFFECT").length>0,s=e.filter(a=>a.code==="ERR_ORPHAN_EFFECT"),o=_e.filter(a=>!!(a._subs&&a._subs.size===0)).length,i=_e.length,c=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:s.length,signalLeaks:o,memoryPressure:c,recentErrorCount:t.length,totalSignals:i,totalComponents:Ie.length}}function ls(){S&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:os,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>dn().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>pn().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:()=>ze(),health:()=>hn(),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{Go as Checkbox,un as ERROR_CODES,Mn as ErrorBoundary,Uo as ErrorMessage,Zr as FocusTrap,In as For,En as Fragment,$r as Head,Vo as Input,Dn as Island,wo as IslandSkeleton,po as Keys,ao as LiveRegion,Co as LoadingDots,Ze as Match,_o as Placeholder,qn as Portal,zo as Radio,Wo as Select,Nn as Show,ct as Skeleton,yo as SkeletonAvatar,rn as SkeletonCard,xo as SkeletonTable,at as SkeletonText,no as SkipLink,ko as Spinner,Ln as Suspense,Rn as Switch,qo as Textarea,co as VisuallyHidden,be as WhatError,nr as _$createComponent,It as _$template,Oo as __getCacheSnapshot,gn as __setDevToolsHooks,Rt as _template,en as announce,to as announceAssertive,Pr as atom,B as batch,Zo as checkComponentName,xr as classList,Yo as classifyError,Do as clearCache,Xo as clearCollectedErrors,jr as clearHead,Pn as cls,Ge as collectError,W as computed,Ko as configureGuardrails,Lr as createContext,Rr as createResource,ce as createRoot,Or as createStore,Kt as createTransitionClasses,ye as createWhatError,Kr as cssTransition,jn as debounce,gr as delegateEvents,Bt as derived,On as each,Yt as easings,N as effect,qt as flushScheduler,wn as flushSync,pn as getActiveSignals,ze as getCollectedErrors,Qo as getGuardrailConfig,hn as getHealth,dn as getMountedComponents,bn as getOwner,Ro as getQueryData,L as h,vn as html,br as hydrate,ir as insert,ls as installAgentContext,Jo as installSignalReadGuardrail,Mo as invalidateQueries,wr as isHydrating,Tn as lazy,ur as mapArray,Hr as measure,An as memo,Yn as mount,Br as mutate,qr as nextFrame,yr as on,Ir as onCleanup,Gr as onIntersect,ho as onKey,mo as onKeys,Nr as onMount,Wr as onResize,Cn as onRootCleanup,No as prefetchQuery,Gt as raf,ss as registerComponent,cs as registerSignal,Ho as rules,_n as runWithOwner,ne as scheduleRead,le as scheduleWrite,Se as setProp,Io as setQueryData,y as signal,xn as signalMemo,jo as simpleResolver,zr as smoothScrollTo,mr as spread,Ut as spring,Dr as storeComputed,$n as style,Dt as svgTemplate,Rt as template,Hn as throttle,Gn as transition,Xt as tween,is as unregisterComponent,as as unregisterSignal,ie as untrack,Yr as useAnimatedValue,so as useAriaChecked,ro as useAriaExpanded,oo as useAriaSelected,Ar as useCallback,Wn as useClickOutside,Er as useComputed,Ft as useContext,uo as useDescribedBy,vr as useEffect,So as useFetch,Bo as useField,Qr as useFocus,Jr as useFocusRestore,Zt as useFocusTrap,Po as useForm,Xr as useGesture,it as useId,lo as useIds,Lo as useInfiniteQuery,fo as useLabelledBy,Vn as useLocalStorage,Bn as useMediaQuery,Sr as useMemo,To as useQuery,Mr as useReducer,Tr as useRef,io as useRovingTabIndex,Ao as useSWR,Vr as useScheduledEffect,kr as useSignal,bo as useSkeleton,Cr as useState,Ur as useTransition,ts as validateImports,Fo as yupResolver,$o as zodResolver};
123
+ //# sourceMappingURL=index.min.js.map