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