what-core 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{I as W,K as et,M as ht,N as ft,a as R,c as tt,e as $,m as q}from"./chunk-W33M3HL5.min.js";var Z=null;function Zt(t){Z=typeof t=="function"?t:null}function Jt(t,n,e){if(e&&e.length>0){let i=e.length===1?e[0]:e;n?n.children=i:n={children:i}}return et({tag:t,props:n||{},children:e||[],key:null,_vnode:!0})}var gt=new Set(["href","src","action","formaction","formAction"]);function Tt(t){if(typeof t!="string")return!0;let n=t.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}var wt={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},Et=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function xt(t){let n=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Lt(t){let n=t.trim(),e=xt(n);if(Et.has(e))return St(n);let i=wt[e];if(i){let r=document.createElement("template");r.innerHTML=i.wrap+n+i.unwrap;let y=r.content.firstChild;for(let c=0;c<i.depth;c++)y=y.firstChild;return()=>y.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var dt=!1;function Qt(t){return R&&!dt&&(dt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Lt(t)}function St(t){let n=t.trim();if(xt(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let i=document.createElement("template");return i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>i.content.firstChild.firstChild.cloneNode(!0)}function Yt(t,n,e){if(typeof n=="function"&&n._mapArray)return n(t,e||null);if(typeof n=="function"){let i=e||null,o=null,r=null,y=!1;return $(()=>{let c=n(),h=typeof c;if(!y){y=!0,h==="string"||h==="number"?(r=document.createTextNode(String(c)),i?t.insertBefore(r,i):t.appendChild(r),Z&&Z(t,String(c)),o=r):o=Q(t,c,null,i);return}if(r!==null&&(h==="string"||h==="number")){let l=String(c);r.data!==l&&(r.data=l),Z&&Z(t,l);return}r=null,o=Q(t,c,o,i)}),o}if(typeof n=="string"||typeof n=="number"){let i=document.createTextNode(String(n));return e?t.insertBefore(i,e):t.appendChild(i),i}return n!=null&&typeof n=="object"&&n.nodeType>0?(e?t.insertBefore(n,e):t.appendChild(n),n):Q(t,n,null,e||null)}function _t(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function Mt(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var it=typeof SVGElement<"u";function yt(t){return it&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function bt(t){return t==null?[]:Array.isArray(t)?t:[t]}function Ct(t,n,e){if(t==null||typeof t=="boolean")return e;if(Array.isArray(t)){for(let i=0;i<t.length;i++)Ct(t[i],n,e);return e}if(typeof t=="function"){let i=et(t,n,yt(n));if(i&&i.nodeType===11){let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)e.push(o[r])}else i&&e.push(i);return e}if(typeof t=="string"||typeof t=="number")return e.push(document.createTextNode(String(t))),e;if(_t(t)){if(t.nodeType===11&&t.childNodes.length>0){let i=Array.from(t.childNodes);for(let o=0;o<i.length;o++)e.push(i[o])}else e.push(t);return e}if(Mt(t)){let i=et(t,n,yt(n));if(i&&i.nodeType===11)if(i.childNodes.length===0)e.push(i);else{let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)e.push(o[r])}else i&&e.push(i);return e}return e.push(document.createTextNode(String(t))),e}function jt(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function Q(t,n,e,i){if(!t||typeof t.insertBefore!="function")return R&&console.warn("[what] reconcileInsert called with invalid parent:",t),e;let o=i||null;if(n==null||typeof n=="boolean"){let l=bt(e);for(let d=0;d<l.length;d++){let s=l[d];s.parentNode===t&&(W(s),t.removeChild(s))}return null}if((typeof n=="string"||typeof n=="number")&&e&&!Array.isArray(e)&&e.nodeType===3){let l=String(n);return e.data!==l&&(e.data=l),e}if(typeof n=="object"&&n!==null&&n.nodeType>0&&n.nodeType!==11&&!Array.isArray(n)){if(n===e)return e;if(e&&!Array.isArray(e)&&e.nodeType>0&&e.nodeType!==11)return e.parentNode===t?(W(e),t.replaceChild(n,e)):o?t.insertBefore(n,o):t.appendChild(n),n}let r=Ct(n,t,[]),y=bt(e);if(jt(y,r))return e;let c=r.length;for(let l=0;l<y.length;l++){let d=y[l];if(d.parentNode!==t)continue;let s=!1;for(let x=0;x<c;x++)if(r[x]===d){s=!0;break}s||(W(d),t.removeChild(d))}let h=o;for(let l=r.length-1;l>=0;l--){let d=r[l];(d.parentNode!==t||d.nextSibling!==h)&&(h&&h.parentNode!==t&&(h=null),h?t.insertBefore(d,h):t.appendChild(d)),h=d}return r.length===0?null:r.length===1?r[0]:r}function It(t,n,e){let i=e?.key,o=e?.raw||!1,r=(y,c)=>{let h=[],l=[],d=[],s=i&&!o?new Map:null,x=document.createComment("/list");return y.insertBefore(x,c||null),$(()=>{let m=t()||[],b=x.parentNode||y;i?Dt(b,x,h,m,l,d,n,i,s):Bt(b,x,h,m,l,d,n),h=m.length>0?m.slice():m}),x};return r._mapArray=!0,r}function Bt(t,n,e,i,o,r,y){let c=i.length,h=e.length;if(c===0){if(h>0){for(let u=0;u<h;u++)r[u]&&r[u]();for(let u=h-1;u>=0;u--){let a=o[u];a&&(W(a),a.parentNode===t&&t.removeChild(a))}o.length=0,r.length=0}return}if(h===0){let u=document.createDocumentFragment();for(let a=0;a<c;a++){let w=i[a],L=q(O=>(r[a]=O,y(w,a)));o[a]=L,u.appendChild(L)}t.insertBefore(u,n);return}let l=0,d=Math.min(h,c);for(;l<d&&e[l]===i[l];)l++;if(l===h&&l===c)return;let s=h-1,x=c-1;for(;s>=l&&x>=l&&e[s]===i[x];)s--,x--;let m=new Array(c),b=new Array(c);for(let u=0;u<l;u++)m[u]=o[u],b[u]=r[u];for(let u=x+1;u<c;u++){let a=s+1+(u-x-1);m[u]=o[a],b[u]=r[a]}let _=x-l+1,T=s-l+1;if(_===0)for(let u=l;u<=s;u++)r[u]?.(),o[u]&&W(o[u]),o[u]?.parentNode&&o[u].parentNode.removeChild(o[u]);else if(T===0){let u=l<c&&m[x+1]?m[x+1]:n,a=document.createDocumentFragment();for(let w=l;w<=x;w++){let L=i[w],O=w;m[w]=q(S=>(b[O]=S,y(L,O))),a.appendChild(m[w])}t.insertBefore(a,u)}else Ht(t,n,e,i,o,r,y,l,s,x,m,b);o.length=c,r.length=c;for(let u=0;u<c;u++)o[u]=m[u],r[u]=b[u]}function Ht(t,n,e,i,o,r,y,c,h,l,d,s){let x=new Map;for(let a=c;a<=h;a++)x.set(e[a],a);let m=l-c+1,b=new Int32Array(m);b.fill(-1);for(let a=c;a<=l;a++){let w=x.get(i[a]);w!==void 0&&(x.delete(i[a]),d[a]=o[w],s[a]=r[w],b[a-c]=w)}for(let[,a]of x)r[a]?.(),o[a]&&W(o[a]),o[a]?.parentNode&&o[a].parentNode.removeChild(o[a]);let _=m-Nt(b,m),T=new Uint8Array(m);if(_>1){let a=new Int32Array(_),w=new Int32Array(_),L=0;for(let S=0;S<m;S++)b[S]!==-1&&(a[L]=b[S],w[L]=S,L++);let O=At(a,_);for(let S=0;S<O.length;S++)T[w[O[S]]]=1}else if(_===1){for(let a=0;a<m;a++)if(b[a]!==-1){T[a]=1;break}}for(let a=c;a<=l;a++)if(!d[a]){let w=i[a],L=a;d[a]=q(O=>(s[L]=O,y(w,L)))}let u=l+1<d.length&&d[l+1]?d[l+1]:n;for(let a=l;a>=c;a--){let w=a-c;(b[w]===-1||!T[w])&&(u&&u.parentNode!==t&&(u=n),t.insertBefore(d[a],u)),u=d[a]}}function Nt(t,n){let e=0;for(let i=0;i<n;i++)t[i]===-1&&e++;return e}function At(t,n){if(n===0)return[];if(n===1)return[0];let e=new Int32Array(n),i=new Int32Array(n),o=1;e[0]=0,i[0]=-1;for(let c=1;c<n;c++)if(t[c]>t[e[o-1]])i[c]=e[o-1],e[o++]=c;else{let h=0,l=o-1;for(;h<l;){let d=h+l>>1;t[e[d]]<t[c]?h=d+1:l=d}e[h]=c,i[c]=h>0?e[h-1]:-1}let r=new Array(o),y=e[o-1];for(let c=o-1;c>=0;c--)r[c]=y,y=i[y];return r}function $t(){return document.createComment("i")}function z(t,n,e,i){let o=n;for(;o&&o!==e;){let r=o.nextSibling;t.insertBefore(o,i),o=r}}function ct(t,n,e){let i=n;for(;i&&i!==e;){let o=i.nextSibling;W(i),t.removeChild(i),i=o}}function lt(t,n,e,i,o,r,y,c,h){let l;if(o){let x=i(n),m=h(n);l=m,o.set(x,{itemSig:m})}else l=n;let d=$t();t.appendChild(d);let s=q(x=>(c[e]=x,r(l,e)));t.appendChild(s),y[e]=d}function Dt(t,n,e,i,o,r,y,c,h){let l=i.length,d=e.length;if(l===0){if(d>0){for(let f=0;f<d;f++)r[f]&&r[f]();o[0]&&ct(t,o[0],n),o.length=0,r.length=0,h&&h.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<l;C++)lt(f,i[C],C,c,h,y,o,r,tt);t.insertBefore(f,n);return}let s=0,x=Math.min(d,l);for(;s<x;){if(e[s]===i[s]){s++;continue}let f=c(e[s]),C=c(i[s]);if(f!==C)break;h&&h.get(f).itemSig.set(i[s]),s++}let m=d-1,b=l-1;for(;m>=s&&b>=s;){if(e[m]===i[b]){m--,b--;continue}let f=c(e[m]),C=c(i[b]);if(f!==C)break;h&&h.get(f).itemSig.set(i[b]),m--,b--}if(s>m&&s>b)return;let _=new Array(l),T=new Array(l);for(let f=0;f<s;f++)_[f]=o[f],T[f]=r[f];for(let f=b+1;f<l;f++){let C=m+1+(f-b-1);_[f]=o[C],T[f]=r[C]}let u=b-s+1,a=m-s+1;if(a===0){let f=b+1<l&&_[b+1]?_[b+1]:n,C=document.createDocumentFragment();for(let E=s;E<=b;E++)lt(C,i[E],E,c,h,y,_,T,tt);t.insertBefore(C,f),X(o,r,_,T,l);return}if(u===0){for(let f=s;f<=m;f++){r[f]?.();let C=G(t,o[f],o,f,n);ct(t,o[f],C),h&&h.delete(c(e[f]))}X(o,r,_,T,l);return}if(u===a&&u>=2&&u<=Math.max(a,200)){let f=0,C=-1,E=-1;for(let p=0;p<u&&f<=4;p++){let A=c(e[s+p]),D=c(i[s+p]);A!==D&&(f===0?C=p:f===1&&(E=p),f++)}if(f===2){let p=s+C,A=s+E,D=c(e[p]),K=c(e[A]),U=c(i[p]),v=c(i[A]);if(D===v&&K===U){for(let g=0;g<s;g++)_[g]=o[g],T[g]=r[g];for(let g=s;g<=b;g++)_[g]=o[g],T[g]=r[g];for(let g=b+1;g<l;g++){let N=m+1+(g-b-1);_[g]=o[N],T[g]=r[N]}let P=_[p];_[p]=_[A],_[A]=P;let B=T[p];if(T[p]=T[A],T[A]=B,h){if(i[p]!==e[p]){let g=c(i[p]),N=h.get(g);N&&N.itemSig.set(i[p])}if(i[A]!==e[A]){let g=c(i[A]),N=h.get(g);N&&N.itemSig.set(i[A])}}let j=A===p+1||p===A+1,H=Math.min(p,A),M=Math.max(p,A);if(j){let g=G(t,o[M],o,M,n);z(t,o[M],g,o[H])}else{let g=G(t,o[A],o,A,n),N=document.createComment("tmp");t.insertBefore(N,o[A]),z(t,o[A],g,o[p]);let F=G(t,o[p],o,p,n);z(t,o[p],F,N),t.removeChild(N)}X(o,r,_,T,l);return}}if(f>=2&&f<=u){let p=C,A=null,D=-1,K=-1,U=!1,v=c(e[s+p]),P=-1;for(let B=p;B<u;B++)if(c(i[s+B])===v){P=B;break}if(P>p){let B=!0;for(let j=p;j<P;j++)if(c(e[s+j+1])!==c(i[s+j])){B=!1;break}if(B){let j=!0;for(let H=P+1;H<u;H++)if(c(e[s+H])!==c(i[s+H])){j=!1;break}j&&(U=!0,D=s+p,K=s+P,A=v)}}if(!U){let B=c(i[s+p]),j=-1;for(let H=p;H<a;H++)if(c(e[s+H])===B){j=H;break}if(j>p){let H=!0;for(let M=p;M<j;M++)if(c(e[s+M])!==c(i[s+M+1])){H=!1;break}if(H){let M=!0;for(let g=j+1;g<u;g++)if(c(e[s+g])!==c(i[s+g])){M=!1;break}M&&(U=!0,D=s+j,K=s+p,A=B)}}}if(U){for(let g=s;g<=m;g++)_[g]=o[g],T[g]=r[g];let B=_[D],j=T[D];if(D<K)for(let g=D;g<K;g++)_[g]=_[g+1],T[g]=T[g+1];else for(let g=D;g>K;g--)_[g]=_[g-1],T[g]=T[g-1];if(_[K]=B,T[K]=j,h)for(let g=s;g<=b;g++){let N=c(i[g]);if(i[g]!==e[g]){let F=h.get(N);F&&F.itemSig.set(i[g])}}let H=G(t,B,o,D,n),M;K+1<l?M=_[K+1]:M=n,(K>=b+1||M&&M.parentNode!==t)&&(M=n),z(t,B,H,M),X(o,r,_,T,l);return}}}let w=new Map;for(let f=s;f<=m;f++)w.set(c(e[f]),f);let L=new Int32Array(u);L.fill(-1);for(let f=s;f<=b;f++){let C=c(i[f]),E=w.get(C);E!==void 0&&(w.delete(C),_[f]=o[E],T[f]=r[E],L[f-s]=E,h&&i[f]!==e[E]&&h.get(C).itemSig.set(i[f]))}let O=[...w.values()].sort((f,C)=>C-f);for(let f of O){r[f]?.();let C=G(t,o[f],o,f,n);ct(t,o[f],C),h&&h.delete(c(e[f]))}for(let f=s;f<=b;f++)if(!_[f]){let C=document.createDocumentFragment();lt(C,i[f],f,c,h,y,_,T,tt),_[f]._frag=C}let S=0,ut=!0,at=-1;for(let f=0;f<u;f++)L[f]!==-1&&(S++,L[f]<=at&&(ut=!1),at=L[f]);let k=new Uint8Array(u);if(ut)for(let f=0;f<u;f++)L[f]!==-1&&(k[f]=1);else if(S>1){let f=new Int32Array(S),C=new Int32Array(S),E=0;for(let A=0;A<u;A++)L[A]!==-1&&(f[E]=L[A],C[E]=A,E++);let p=At(f,S);for(let A=0;A<p.length;A++)k[C[p[A]]]=1}else if(S===1){for(let f=0;f<u;f++)if(L[f]!==-1){k[f]=1;break}}X(o,r,_,T,l);let rt=b+1<l&&o[b+1]?o[b+1]:n;for(let f=b;f>=s;f--){let C=f-s,E=o[f];if(L[C]===-1)E._frag&&(t.insertBefore(E._frag,rt),delete E._frag);else if(!k[C]){let p=G(t,E,o,f,n);z(t,E,p,rt)}rt=E}}function G(t,n,e,i,o){let r=n.nextSibling;for(;r&&r!==o;){if(r.nodeType===8&&r.data==="i")return r;r=r.nextSibling}return o}function X(t,n,e,i,o){t.length=o,n.length=o;for(let r=0;r<o;r++)t[r]=e[r],n[r]=i[r]}function kt(t,n){for(let e in n){let i=n[e];if(e.startsWith("on")&&e.length>2){let o=e.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(typeof i=="function"&&!e.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}e==="class"||e==="className"?t._propEffects[e]=$(()=>{let o=i()||"";it&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):e==="style"&&typeof i()=="object"?t._propEffects[e]=$(()=>{ot(t,i())}):t._propEffects[e]=$(()=>{Y(t,e,i())})}else Y(t,e,i)}}function Y(t,n,e){if(n==="ref"){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t);return}if(n==="key")return;if(typeof e=="function"&&!n.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=$(()=>Y(t,n,e()));return}if((gt.has(n)||gt.has(n.toLowerCase()))&&!Tt(e)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${e}`);return}let i=it&&t instanceof SVGElement;if(n==="class"||n==="className")i?t.setAttribute("class",e||""):t.className=e||"";else if(n==="dangerouslySetInnerHTML"){let o=e?.__html??"";typeof R<"u"&&R&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else if(n==="innerHTML")if(e&&typeof e=="object"&&"__html"in e){let o=e.__html??"";typeof R<"u"&&R&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else typeof console<"u"&&e!=null&&e!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else n==="style"?ot(t,e):n.startsWith("data-")||n.startsWith("aria-")?t.setAttribute(n,e):typeof e=="boolean"?e?t.setAttribute(n,""):t.removeAttribute(n):i?t.setAttribute(n,e):n==="value"&&t.tagName==="SELECT"?ft(t,e):n in t?t[n]=e:t.setAttribute(n,e)}function I(t,n,e,i){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=$(()=>i(t,e()))}function Kt(t,n){if(typeof n=="function")return I(t,"class",n,Kt);it&&t instanceof SVGElement?t.setAttribute("class",n||""):t.className=n||""}function ot(t,n){if(typeof n=="function")return I(t,"style",n,ot);if(typeof n=="string")t.style.cssText=n,t._lastStyleObj=null;else if(n&&typeof n=="object"){let e=t.style,i=t._lastStyleObj;if(i)for(let o in i)o in n||(e[o]="");for(let o in n)e[o]=n[o]??"";t._lastStyleObj=n}else n==null&&(t.style.cssText="",t._lastStyleObj=null)}function Ot(t,n,e){if(typeof e=="function")return I(t,n,e,(i,o)=>Ot(i,n,o));e==null?t.removeAttribute(n):t.setAttribute(n,e)}function Vt(t,n){if(typeof n=="function")return I(t,"value",n,Vt);if(t.tagName==="SELECT"){ft(t,n);return}let e=n==null?"":String(n);t.value!==e&&(t.value=e)}function Wt(t,n){if(typeof n=="function")return I(t,"checked",n,Wt);t.checked=!!n}var pt=new Set;function vt(t){for(let n of t)pt.has(n)||(pt.add(n),document.addEventListener(n,e=>{let i=e.target,o="$$"+n;for(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return i||document}});i;){let r=i[o];if(r&&(r(e),e.cancelBubble))return;i=i.parentNode}}))}function Ft(t,n,e){return t.addEventListener(n,e),()=>t.removeEventListener(n,e)}function te(t,n){$(()=>{for(let e in n){let i=typeof n[e]=="function"?n[e]():n[e];t.classList.toggle(e,!!i)}})}var nt=!1,V=null;function ee(){return nt}function ne(t,n){nt=!0,V={parent:n,index:0};try{return J(t,n)}finally{nt=!1,V=null}}function mt(t){let n=t.childNodes;for(;V.index<n.length;){let e=n[V.index];if(e.nodeType===8){let i=e.textContent;if(i==="$"||i==="/$"||i==="[]"||i==="/[]"){V.index++;continue}}return V.index++,e}return null}function st(){return typeof process<"u"&&!1}function J(t,n){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let i=mt(n),o=String(t);if(i&&i.nodeType===3)return st()&&i.textContent!==o&&(console.warn(`[what] Hydration mismatch: expected text "${o}", got "${i.textContent}"`),i.textContent=o),i;st()&&console.warn(`[what] Hydration mismatch: expected text node "${o}", got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createTextNode(o);return i?n.replaceChild(r,i):n.appendChild(r),r}if(typeof t=="function"){let i=t(),o=J(i,n);return $(()=>{let r=t();nt||(o=Q(n,r,o,null))}),o}if(Array.isArray(t)){let i=[];for(let o of t){let r=J(o,n);r&&i.push(r)}return i.length===1?i[0]:i}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let y=ht(),c=t.tag,h=t.props||{},l=t.children||[],d={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:y[y.length-1]||null,_errorBoundary:null};y.push(d);let s;try{let x=l.length===0?void 0:l.length===1?l[0]:l;s=c({...h,children:x})}catch(x){return y.pop(),console.error("[what] Error in component during hydration:",c.name||"Anonymous",x),null}return y.pop(),d.mounted=!0,d._mountCallbacks&&queueMicrotask(()=>{if(!d.disposed)for(let x of d._mountCallbacks)try{x()}catch(m){console.error("[what] onMount error:",m)}}),J(s,n)}let i=mt(n),o=t.tag.toUpperCase();if(i&&i.nodeType===1&&i.nodeName===o){Pt(i,t.props||{});let y=V;if(V={parent:i,index:0},t.props?.dangerouslySetInnerHTML?.__html==null)for(let h of t.children)J(h,i);return V=y,i}st()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createElement(t.tag);for(let y in t.props||{})y==="children"||y==="key"||Y(r,y,t.props[y]);for(let y of t.children)Q(r,y,null,null);return i?n.replaceChild(r,i):n.appendChild(r),r}if(_t(t))return t;let e=document.createTextNode(String(t));return n.appendChild(e),e}function Pt(t,n){for(let e in n){if(e==="children"||e==="key"||e==="ref"||e==="dangerouslySetInnerHTML"||e==="innerHTML")continue;let i=n[e];if(e.startsWith("on")&&e.length>2){let o=e.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(e.startsWith("$$")){t[e]=i;continue}if(typeof i=="function"&&!e.startsWith("on")){e==="class"||e==="className"?$(()=>{t.className=i()||""}):e==="style"&&typeof i()=="object"?$(()=>{ot(t,i())}):$(()=>{Y(t,e,i())});continue}}}export{Zt as a,Jt as b,Lt as c,Qt as d,St as e,Yt as f,It as g,kt as h,Y as i,Kt as j,ot as k,Ot as l,Vt as m,Wt as n,vt as o,Ft as p,te as q,ee as r,ne as s};
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as Gt,b as Yt,c as Xt,d as Fe,e as Wt,f as Qt,g as zt,h as Kt,i as Ut,o as Jt,p as Zt,q as en,r as tn,s as nn}from"./chunk-DF3XC3WN.min.js";import{A as Pt,B as Nt,C as Ot,D as $t,E as Ht,F as Vt,G as jt,H as qt,J as Bt,L as $,a as F,b as ht,c as l,d as N,e as O,f as M,g as gt,h as mt,i as le,j as yt,k as xt,l as vt,n as wt,o as bt,p as Et,q as Ct,r as _t,s as At,t as It,u as Rt,v as Tt,w as Mt,x as Lt,y as Dt,z as Ft}from"./chunk-W33M3HL5.min.js";import{a as w,b as kt,c as St}from"./chunk-O3SKPRTY.min.js";var se=null;function ie(){return se}function rn(e){let t=se;return se=e,t}function on(e,t){let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ee(){if(Q!==void 0)return Q;if(typeof document>"u")return Q=null;let e=document.getElementById("__what_data");if(!e)return Q=null;try{Q=JSON.parse(e.textContent)}catch{Q=null}return Q}function sn(){Q=void 0}function Ce(){let e=Ee();return e?e.loaderData:void 0}function _e(e){let t=Ee();return t&&t.resources?t.resources[e]:void 0}function an(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return Ce()}function j(e){let t=$();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function z(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function cn(e){let t=j("useState"),{index:n,exists:r}=z(t);if(!r){let s=l(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function un(e){let t=j("useSignal"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=l(typeof e=="function"?e():e)),t.hooks[n]}function ln(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function fn(e,t){let n=j("useEffect"),{index:r,exists:o}=z(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),F&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let a=t[i];a!=null&&typeof a!="function"&&console.warn(`[what] useEffect dep at index ${i} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=e();typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(s.cleanup=i)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{for(let a=0;a<t.length;a++){let u=t[a];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=le(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function dn(e,t){let n=j("useMemo"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={computed:N(e)}),n.hooks[r].computed}function pn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function hn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Pe(e){let t=$();for(F&&!t&&console.warn(`[what] useContext(${e?.displayName||"Context"}) called outside of component render. useContext must be called during component rendering, not inside effects or event handlers. Store the context value in a variable during render and use that variable in your callback.`);t;){if(t._contextValues&&t._contextValues.has(e)){let n=t._contextValues.get(e);return n&&n._signal?n():n}t=t._parentCtx}return e._defaultValue}function gn(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=j("Context.Provider");if(o._contextValues||(o._contextValues=new Map),o._contextSignals||(o._contextSignals=new Map),o._contextSignals.has(t))o._contextSignals.get(t).set(n);else{let s=l(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Pe(t);return typeof n=="function"?n(r):n}};return t}function mn(e,t,n){let r=j("useReducer"),{index:o,exists:s}=z(r);if(!s){let a=n?n(t):t,u=l(a),f=c=>{u.set(d=>e(d,c))};r.hooks[o]={signal:u,dispatch:f}}let i=r.hooks[o];return[i.signal,i.dispatch]}function yn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function xn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function vn(e,t={}){if(typeof document>"u"){let c=ie();if(c){let d=t.key!=null?t.key:`__r${c.resourceCounter++}`,h=c.resources.get(d);if(h&&h.status==="ready")return[()=>h.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(h&&h.status==="error")return[()=>{},{loading:()=>!1,error:()=>h.error,refetch:()=>{},mutate:()=>{}}];if(!h){let v=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{c.resources.set(d,{status:"ready",value:b})}).catch(b=>{c.resources.set(d,{status:"error",error:b})});throw c.resources.set(d,{status:"pending",promise:v}),v}throw h.promise}if(t.initialValue!=null)return[()=>t.initialValue,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];throw Promise.resolve().then(()=>e(t.source??!0,{}))}let n=t.initialValue;if(n==null&&t.key!=null){let c=_e(t.key);c!==void 0&&(n=c)}let r=l(n??null),o=l(n==null),s=l(null),i=null,a=async c=>{i&&i.abort(),i=new AbortController;let{signal:d}=i;o.set(!0),s.set(null);try{let h=await e(c,{signal:d});d.aborted||M(()=>{r.set(h),o.set(!1)})}catch(h){d.aborted||M(()=>{s.set(h),o.set(!1)})}},u=c=>{r.set(typeof c=="function"?c(r()):c)},f=$?.();return f&&(f._cleanupCallbacks=f._cleanupCallbacks||[],f._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&a(t.source),[r,{loading:o,error:s,refetch:a,mutate:u}]}function $e(e){return e._storeComputed=!0,e}var Ne=!1;function wn(e){return Ne||(Ne=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),$e(e)}function bn(e){let t={},n={},r={},o={};for(let[s,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(F&&i.length===0&&console.warn(`[what] derived() for "${s}" should accept the state parameter, e.g. derived(state => ...).`),n[s]=i):typeof i=="function"?r[s]=i:t[s]=l(i);for(let[s,i]of Object.entries(n)){let a=new Proxy({},{get(u,f){if(t[f])return t[f]();if(n[f])return n[f]()}});n[s]=N(()=>i(a))}for(let[s,i]of Object.entries(r))r[s]=(...a)=>{let u;return M(()=>{let f=new Proxy({},{get(c,d){if(t[d])return t[d].peek();if(n[d])return n[d].peek();if(r[d])return r[d]},set(c,d,h){return t[d]&&t[d].set(h),!0}});u=i.apply(f,a)}),u};return function(){let i={};for(let[a,u]of Object.entries(t))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(n))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(r))i[a]=u;return i}}var Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ae={title:null,metas:new Map,links:new Map};function Sn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&Cn(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ae.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);Ve("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");Ve("link",s,o)}return r||null}function En(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function Cn(e,{title:t,meta:n,link:r}){if(t!=null&&(e.title=t),n)for(let o of Array.isArray(n)?n:[n])e.metas.set(En(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function _n(){return{title:null,metas:new Map,links:new Map}}function An(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${je(String(e.title))}</title>`);for(let n of e.metas.values())t+=He("meta",n);for(let n of e.links.values())t+=He("link",n);return t}function He(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;n+=` ${r==="httpEquiv"?"http-equiv":r}="${je(String(o))}"`}return n+">"}function je(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ve(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){In(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))o.setAttribute(s,i);document.head.appendChild(o)}function In(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Rn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ae.metas.clear(),Ae.links.clear()}var de=[],pe=[],Re=!1;function G(e){return de.push(e),Be(),()=>{let t=de.indexOf(e);t!==-1&&de.splice(t,1)}}function K(e){return pe.push(e),Be(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function qe(){for(;de.length>0;){let e=de.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Re=!1}function Be(){Re||(Re=!0,requestAnimationFrame(qe))}function Tn(e){return new Promise(t=>{G(()=>{t(e())})})}function Mn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Ln(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ge(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Dn(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var fe=new Map;function Ge(e,t){fe.has(e)?fe.set(e,t):(fe.set(e,t),requestAnimationFrame(()=>{let n=fe.get(e);fe.delete(e),n&&n()}))}var Ie=new WeakMap,xe=null;function Fn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(xe||(xe=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Ie.get(r.target);o&&o(r.contentRect)}})})),Ie.set(e,t),xe.observe(e),()=>{Ie.delete(e),xe.unobserve(e)})}function Pn(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{G(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function Nn(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,i,a;G(()=>{s=window.scrollY;let f=e.getBoundingClientRect();i=s+f.top,a=performance.now(),u()});function u(){G(()=>{let f=performance.now()-a,c=Math.min(f/n,1),d=r(c),h=s+(i-s)*d;K(()=>{window.scrollTo(0,h),c<1?requestAnimationFrame(u):o()})})}})}function Ye(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function Xe(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,i=l(e),a=l(e),u=l(0),f=l(!1),c=null,d=null;function h(y){if(d===null){d=y,c=requestAnimationFrame(h);return}let I=Math.min((y-d)/1e3,.064);d=y;let m=i.peek(),R=a.peek(),_=u.peek(),x=m-R,g=-n*x,L=-r*_,k=(g+L)/o,D=_+k*I,P=m+D*I;if(M(()=>{u.set(D),i.set(P)}),Math.abs(D)<s&&Math.abs(x)<s){M(()=>{i.set(R),u.set(0),f.set(!1)}),c=null,d=null;return}c=requestAnimationFrame(h)}function v(y){a.set(y),c===null&&(f.set(!0),d=null,c=requestAnimationFrame(h))}function b(){c&&(cancelAnimationFrame(c),c=null),f.set(!1),d=null}function E(y){b(),M(()=>{i.set(y),a.set(y),u.set(0)})}let S=$?.();return S&&(S._cleanupCallbacks=S._cleanupCallbacks||[],S._cleanupCallbacks.push(b)),{current:()=>i(),target:()=>a(),velocity:()=>u(),isAnimating:()=>f(),set:v,stop:b,snap:E,subscribe:i.subscribe}}function We(e,t,n={}){let{duration:r=300,easing:o=v=>v*(2-v),onUpdate:s,onComplete:i}=n,a=l(0),u=l(e),f=l(!0),c=null,d=null;function h(v){c===null&&(c=v);let b=v-c,E=Math.min(b/r,1),S=o(E),y=e+(t-e)*S;M(()=>{a.set(E),u.set(y)}),s&&s(y,E),E<1?d=requestAnimationFrame(h):(f.set(!1),i&&i())}return d=requestAnimationFrame(h),{progress:()=>a(),value:()=>u(),isAnimating:()=>f(),cancel:()=>{d&&cancelAnimationFrame(d),f.set(!1)},subscribe:u.subscribe}}var Qe={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*(2*Math.PI/3)),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function On(e={}){let{duration:t=300,easing:n=Qe.easeOutQuad}=e,r=l(!1),o=l(0);async function s(i){return r.set(!0),o.set(0),new Promise(a=>{let u=performance.now();function f(c){let d=c-u,h=Math.min(d/t,1);o.set(n(h)),h<1?requestAnimationFrame(f):(r.set(!1),i&&i(),a())}requestAnimationFrame(f)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function $n(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:i,onTap:a,onLongPress:u,preventDefault:f=!1}=t,c={isDragging:l(!1),startX:0,startY:0,currentX:l(0),currentY:l(0),deltaX:l(0),deltaY:l(0),velocity:l({x:0,y:0})},d=0,h=0,v=0,b=null;function E(x){let g=x.touches?x.touches[0]:x;c.startX=g.clientX,c.startY=g.clientY,h=g.clientX,v=g.clientY,d=performance.now(),c.isDragging.set(!0),r&&r({x:c.startX,y:c.startY}),u&&(b=setTimeout(()=>{c.isDragging.peek()&&u({x:h,y:v})},500))}function S(x){if(!c.isDragging.peek())return;let g=x.touches?x.touches[0]:x,L=g.clientX,k=g.clientY,D=performance.now(),P=D-d;M(()=>{c.currentX.set(L),c.currentY.set(k),c.deltaX.set(L-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(L-h)/P*1e3,y:(k-v)/P*1e3})}),h=L,v=k,d=D,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:L,y:k,deltaX:c.deltaX.peek(),deltaY:c.deltaY.peek(),velocity:c.velocity.peek()})}function y(x){if(!c.isDragging.peek())return;b&&(clearTimeout(b),b=null);let g=c.deltaX.peek(),L=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+L**2)<10&&a&&a({x:c.startX,y:c.startY}),i&&(Math.abs(k.x)>500||Math.abs(k.y)>500)){let P=Math.abs(k.x)>Math.abs(k.y)?k.x>0?"right":"left":k.y>0?"down":"up";i({direction:P,velocity:k})}o&&o({deltaX:g,deltaY:L,velocity:k}),c.isDragging.set(!1)}let I=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],L=x.touches[1],k=Math.sqrt((L.clientX-g.clientX)**2+(L.clientY-g.clientY)**2);I===null&&(I=k);let D=k/I,P=(g.clientX+L.clientX)/2,ee=(g.clientY+L.clientY)/2;s({scale:D,centerX:P,centerY:ee})}function R(){I=null}typeof e=="function"?Ye(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Ye(()=>{let x=e.current;if(x)return _(x)}):e&&_(e);function _(x){return x.addEventListener("mousedown",E),x.addEventListener("touchstart",E,{passive:!f}),window.addEventListener("mousemove",S),window.addEventListener("touchmove",m),window.addEventListener("touchmove",S),window.addEventListener("mouseup",y),window.addEventListener("touchend",y),window.addEventListener("touchend",R),()=>{x.removeEventListener("mousedown",E),x.removeEventListener("touchstart",E),window.removeEventListener("mousemove",S),window.removeEventListener("touchmove",m),window.removeEventListener("touchmove",S),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y),window.removeEventListener("touchend",R)}}return c}function Hn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=Xe(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=We(t.peek(),r,{...o,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(r,o){return()=>{let s=t();for(let i=0;i<r.length-1;i++)if(s>=r[i]&&s<=r[i+1]){let a=(s-r[i])/(r[i+1]-r[i]);return o[i]+(o[i+1]-o[i])*a}return s<=r[0]?o[0]:o[o.length-1]}},subscribe:t.subscribe}}function ze(e){return{enter:`${e}-enter`,enterActive:`${e}-enter-active`,enterDone:`${e}-enter-done`,exit:`${e}-exit`,exitActive:`${e}-exit-active`,exitDone:`${e}-exit-done`}}async function Vn(e,t,n="enter",r=300){let o=ze(t);return new Promise(s=>{K(()=>{e.classList.add(o[n]),G(()=>{e.offsetHeight,K(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{K(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Ue=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Ue.set(e.target)});function jn(){return{current:()=>Ue(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function qn(){let e={current:null};function t(r){typeof document>"u"||(e.current=r||document.activeElement||null)}function n(r){let o=e.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:t,restore:n,previous:()=>e.current}}function Je(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let o=e.current||e;if(!o||typeof o.querySelectorAll!="function")return;let s=Ke(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ke(o),f=u[0],c=u[u.length-1];a.shiftKey?document.activeElement===f&&(a.preventDefault(),c.focus()):document.activeElement===c&&(a.preventDefault(),f.focus())}return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}}function r(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:r}}function Ke(e){let t=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter(n=>n.offsetParent!==null)}function Bn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Je(n),s=null,i=f=>{n.current=f,r.set(c=>c+1)},a=O(()=>{if(r(),s&&(s(),s=null,o.deactivate()),t&&n.current)return s=o.activate(),()=>{s?.(),s=null,o.deactivate()}}),u=$?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{a(),s?.(),s=null,o.deactivate()})),w("div",{ref:i},e)}var U=null,Te=0;function Gn(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.style.cssText=`
1
+ import{a as Gt,b as Yt,c as Xt,d as Fe,e as Wt,f as Qt,g as zt,h as Kt,i as Ut,o as Jt,p as Zt,q as en,r as tn,s as nn}from"./chunk-7FW6K5RG.min.js";import{A as Pt,B as Nt,C as Ot,D as $t,E as Ht,F as Vt,G as jt,H as qt,J as Bt,L as $,a as F,b as ht,c as l,d as N,e as O,f as M,g as gt,h as mt,i as le,j as yt,k as xt,l as vt,n as wt,o as bt,p as Et,q as Ct,r as _t,s as At,t as It,u as Rt,v as Tt,w as Mt,x as Lt,y as Dt,z as Ft}from"./chunk-W33M3HL5.min.js";import{a as w,b as kt,c as St}from"./chunk-O3SKPRTY.min.js";var se=null;function ie(){return se}function rn(e){let t=se;return se=e,t}function on(e,t){let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ee(){if(Q!==void 0)return Q;if(typeof document>"u")return Q=null;let e=document.getElementById("__what_data");if(!e)return Q=null;try{Q=JSON.parse(e.textContent)}catch{Q=null}return Q}function sn(){Q=void 0}function Ce(){let e=Ee();return e?e.loaderData:void 0}function _e(e){let t=Ee();return t&&t.resources?t.resources[e]:void 0}function an(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return Ce()}function j(e){let t=$();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function z(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function cn(e){let t=j("useState"),{index:n,exists:r}=z(t);if(!r){let s=l(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function un(e){let t=j("useSignal"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=l(typeof e=="function"?e():e)),t.hooks[n]}function ln(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function fn(e,t){let n=j("useEffect"),{index:r,exists:o}=z(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),F&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let a=t[i];a!=null&&typeof a!="function"&&console.warn(`[what] useEffect dep at index ${i} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=e();typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(s.cleanup=i)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{for(let a=0;a<t.length;a++){let u=t[a];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=le(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function dn(e,t){let n=j("useMemo"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={computed:N(e)}),n.hooks[r].computed}function pn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function hn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Pe(e){let t=$();for(F&&!t&&console.warn(`[what] useContext(${e?.displayName||"Context"}) called outside of component render. useContext must be called during component rendering, not inside effects or event handlers. Store the context value in a variable during render and use that variable in your callback.`);t;){if(t._contextValues&&t._contextValues.has(e)){let n=t._contextValues.get(e);return n&&n._signal?n():n}t=t._parentCtx}return e._defaultValue}function gn(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=j("Context.Provider");if(o._contextValues||(o._contextValues=new Map),o._contextSignals||(o._contextSignals=new Map),o._contextSignals.has(t))o._contextSignals.get(t).set(n);else{let s=l(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Pe(t);return typeof n=="function"?n(r):n}};return t}function mn(e,t,n){let r=j("useReducer"),{index:o,exists:s}=z(r);if(!s){let a=n?n(t):t,u=l(a),f=c=>{u.set(d=>e(d,c))};r.hooks[o]={signal:u,dispatch:f}}let i=r.hooks[o];return[i.signal,i.dispatch]}function yn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function xn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function vn(e,t={}){if(typeof document>"u"){let c=ie();if(c){let d=t.key!=null?t.key:`__r${c.resourceCounter++}`,h=c.resources.get(d);if(h&&h.status==="ready")return[()=>h.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(h&&h.status==="error")return[()=>{},{loading:()=>!1,error:()=>h.error,refetch:()=>{},mutate:()=>{}}];if(!h){let v=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{c.resources.set(d,{status:"ready",value:b})}).catch(b=>{c.resources.set(d,{status:"error",error:b})});throw c.resources.set(d,{status:"pending",promise:v}),v}throw h.promise}if(t.initialValue!=null)return[()=>t.initialValue,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];throw Promise.resolve().then(()=>e(t.source??!0,{}))}let n=t.initialValue;if(n==null&&t.key!=null){let c=_e(t.key);c!==void 0&&(n=c)}let r=l(n??null),o=l(n==null),s=l(null),i=null,a=async c=>{i&&i.abort(),i=new AbortController;let{signal:d}=i;o.set(!0),s.set(null);try{let h=await e(c,{signal:d});d.aborted||M(()=>{r.set(h),o.set(!1)})}catch(h){d.aborted||M(()=>{s.set(h),o.set(!1)})}},u=c=>{r.set(typeof c=="function"?c(r()):c)},f=$?.();return f&&(f._cleanupCallbacks=f._cleanupCallbacks||[],f._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&a(t.source),[r,{loading:o,error:s,refetch:a,mutate:u}]}function $e(e){return e._storeComputed=!0,e}var Ne=!1;function wn(e){return Ne||(Ne=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),$e(e)}function bn(e){let t={},n={},r={},o={};for(let[s,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(F&&i.length===0&&console.warn(`[what] derived() for "${s}" should accept the state parameter, e.g. derived(state => ...).`),n[s]=i):typeof i=="function"?r[s]=i:t[s]=l(i);for(let[s,i]of Object.entries(n)){let a=new Proxy({},{get(u,f){if(t[f])return t[f]();if(n[f])return n[f]()}});n[s]=N(()=>i(a))}for(let[s,i]of Object.entries(r))r[s]=(...a)=>{let u;return M(()=>{let f=new Proxy({},{get(c,d){if(t[d])return t[d].peek();if(n[d])return n[d].peek();if(r[d])return r[d]},set(c,d,h){return t[d]&&t[d].set(h),!0}});u=i.apply(f,a)}),u};return function(){let i={};for(let[a,u]of Object.entries(t))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(n))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(r))i[a]=u;return i}}var Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ae={title:null,metas:new Map,links:new Map};function Sn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&Cn(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ae.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);Ve("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");Ve("link",s,o)}return r||null}function En(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function Cn(e,{title:t,meta:n,link:r}){if(t!=null&&(e.title=t),n)for(let o of Array.isArray(n)?n:[n])e.metas.set(En(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function _n(){return{title:null,metas:new Map,links:new Map}}function An(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${je(String(e.title))}</title>`);for(let n of e.metas.values())t+=He("meta",n);for(let n of e.links.values())t+=He("link",n);return t}function He(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;n+=` ${r==="httpEquiv"?"http-equiv":r}="${je(String(o))}"`}return n+">"}function je(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ve(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){In(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))o.setAttribute(s,i);document.head.appendChild(o)}function In(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Rn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ae.metas.clear(),Ae.links.clear()}var de=[],pe=[],Re=!1;function G(e){return de.push(e),Be(),()=>{let t=de.indexOf(e);t!==-1&&de.splice(t,1)}}function K(e){return pe.push(e),Be(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function qe(){for(;de.length>0;){let e=de.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Re=!1}function Be(){Re||(Re=!0,requestAnimationFrame(qe))}function Tn(e){return new Promise(t=>{G(()=>{t(e())})})}function Mn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Ln(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ge(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Dn(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var fe=new Map;function Ge(e,t){fe.has(e)?fe.set(e,t):(fe.set(e,t),requestAnimationFrame(()=>{let n=fe.get(e);fe.delete(e),n&&n()}))}var Ie=new WeakMap,xe=null;function Fn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(xe||(xe=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Ie.get(r.target);o&&o(r.contentRect)}})})),Ie.set(e,t),xe.observe(e),()=>{Ie.delete(e),xe.unobserve(e)})}function Pn(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{G(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function Nn(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,i,a;G(()=>{s=window.scrollY;let f=e.getBoundingClientRect();i=s+f.top,a=performance.now(),u()});function u(){G(()=>{let f=performance.now()-a,c=Math.min(f/n,1),d=r(c),h=s+(i-s)*d;K(()=>{window.scrollTo(0,h),c<1?requestAnimationFrame(u):o()})})}})}function Ye(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function Xe(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,i=l(e),a=l(e),u=l(0),f=l(!1),c=null,d=null;function h(y){if(d===null){d=y,c=requestAnimationFrame(h);return}let I=Math.min((y-d)/1e3,.064);d=y;let m=i.peek(),R=a.peek(),_=u.peek(),x=m-R,g=-n*x,L=-r*_,k=(g+L)/o,D=_+k*I,P=m+D*I;if(M(()=>{u.set(D),i.set(P)}),Math.abs(D)<s&&Math.abs(x)<s){M(()=>{i.set(R),u.set(0),f.set(!1)}),c=null,d=null;return}c=requestAnimationFrame(h)}function v(y){a.set(y),c===null&&(f.set(!0),d=null,c=requestAnimationFrame(h))}function b(){c&&(cancelAnimationFrame(c),c=null),f.set(!1),d=null}function E(y){b(),M(()=>{i.set(y),a.set(y),u.set(0)})}let S=$?.();return S&&(S._cleanupCallbacks=S._cleanupCallbacks||[],S._cleanupCallbacks.push(b)),{current:()=>i(),target:()=>a(),velocity:()=>u(),isAnimating:()=>f(),set:v,stop:b,snap:E,subscribe:i.subscribe}}function We(e,t,n={}){let{duration:r=300,easing:o=v=>v*(2-v),onUpdate:s,onComplete:i}=n,a=l(0),u=l(e),f=l(!0),c=null,d=null;function h(v){c===null&&(c=v);let b=v-c,E=Math.min(b/r,1),S=o(E),y=e+(t-e)*S;M(()=>{a.set(E),u.set(y)}),s&&s(y,E),E<1?d=requestAnimationFrame(h):(f.set(!1),i&&i())}return d=requestAnimationFrame(h),{progress:()=>a(),value:()=>u(),isAnimating:()=>f(),cancel:()=>{d&&cancelAnimationFrame(d),f.set(!1)},subscribe:u.subscribe}}var Qe={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*(2*Math.PI/3)),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function On(e={}){let{duration:t=300,easing:n=Qe.easeOutQuad}=e,r=l(!1),o=l(0);async function s(i){return r.set(!0),o.set(0),new Promise(a=>{let u=performance.now();function f(c){let d=c-u,h=Math.min(d/t,1);o.set(n(h)),h<1?requestAnimationFrame(f):(r.set(!1),i&&i(),a())}requestAnimationFrame(f)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function $n(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:i,onTap:a,onLongPress:u,preventDefault:f=!1}=t,c={isDragging:l(!1),startX:0,startY:0,currentX:l(0),currentY:l(0),deltaX:l(0),deltaY:l(0),velocity:l({x:0,y:0})},d=0,h=0,v=0,b=null;function E(x){let g=x.touches?x.touches[0]:x;c.startX=g.clientX,c.startY=g.clientY,h=g.clientX,v=g.clientY,d=performance.now(),c.isDragging.set(!0),r&&r({x:c.startX,y:c.startY}),u&&(b=setTimeout(()=>{c.isDragging.peek()&&u({x:h,y:v})},500))}function S(x){if(!c.isDragging.peek())return;let g=x.touches?x.touches[0]:x,L=g.clientX,k=g.clientY,D=performance.now(),P=D-d;M(()=>{c.currentX.set(L),c.currentY.set(k),c.deltaX.set(L-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(L-h)/P*1e3,y:(k-v)/P*1e3})}),h=L,v=k,d=D,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:L,y:k,deltaX:c.deltaX.peek(),deltaY:c.deltaY.peek(),velocity:c.velocity.peek()})}function y(x){if(!c.isDragging.peek())return;b&&(clearTimeout(b),b=null);let g=c.deltaX.peek(),L=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+L**2)<10&&a&&a({x:c.startX,y:c.startY}),i&&(Math.abs(k.x)>500||Math.abs(k.y)>500)){let P=Math.abs(k.x)>Math.abs(k.y)?k.x>0?"right":"left":k.y>0?"down":"up";i({direction:P,velocity:k})}o&&o({deltaX:g,deltaY:L,velocity:k}),c.isDragging.set(!1)}let I=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],L=x.touches[1],k=Math.sqrt((L.clientX-g.clientX)**2+(L.clientY-g.clientY)**2);I===null&&(I=k);let D=k/I,P=(g.clientX+L.clientX)/2,ee=(g.clientY+L.clientY)/2;s({scale:D,centerX:P,centerY:ee})}function R(){I=null}typeof e=="function"?Ye(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Ye(()=>{let x=e.current;if(x)return _(x)}):e&&_(e);function _(x){return x.addEventListener("mousedown",E),x.addEventListener("touchstart",E,{passive:!f}),window.addEventListener("mousemove",S),window.addEventListener("touchmove",m),window.addEventListener("touchmove",S),window.addEventListener("mouseup",y),window.addEventListener("touchend",y),window.addEventListener("touchend",R),()=>{x.removeEventListener("mousedown",E),x.removeEventListener("touchstart",E),window.removeEventListener("mousemove",S),window.removeEventListener("touchmove",m),window.removeEventListener("touchmove",S),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y),window.removeEventListener("touchend",R)}}return c}function Hn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=Xe(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=We(t.peek(),r,{...o,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(r,o){return()=>{let s=t();for(let i=0;i<r.length-1;i++)if(s>=r[i]&&s<=r[i+1]){let a=(s-r[i])/(r[i+1]-r[i]);return o[i]+(o[i+1]-o[i])*a}return s<=r[0]?o[0]:o[o.length-1]}},subscribe:t.subscribe}}function ze(e){return{enter:`${e}-enter`,enterActive:`${e}-enter-active`,enterDone:`${e}-enter-done`,exit:`${e}-exit`,exitActive:`${e}-exit-active`,exitDone:`${e}-exit-done`}}async function Vn(e,t,n="enter",r=300){let o=ze(t);return new Promise(s=>{K(()=>{e.classList.add(o[n]),G(()=>{e.offsetHeight,K(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{K(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Ue=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Ue.set(e.target)});function jn(){return{current:()=>Ue(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function qn(){let e={current:null};function t(r){typeof document>"u"||(e.current=r||document.activeElement||null)}function n(r){let o=e.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:t,restore:n,previous:()=>e.current}}function Je(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let o=e.current||e;if(!o||typeof o.querySelectorAll!="function")return;let s=Ke(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ke(o),f=u[0],c=u[u.length-1];a.shiftKey?document.activeElement===f&&(a.preventDefault(),c.focus()):document.activeElement===c&&(a.preventDefault(),f.focus())}return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}}function r(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:r}}function Ke(e){let t=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter(n=>n.offsetParent!==null)}function Bn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Je(n),s=null,i=f=>{n.current=f,r.set(c=>c+1)},a=O(()=>{if(r(),s&&(s(),s=null,o.deactivate()),t&&n.current)return s=o.activate(),()=>{s?.(),s=null,o.deactivate()}}),u=$?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{a(),s?.(),s=null,o.deactivate()})),w("div",{ref:i},e)}var U=null,Te=0;function Gn(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.style.cssText=`
2
2
  position: absolute;
3
3
  width: 1px;
4
4
  height: 1px;
@@ -119,4 +119,4 @@ html\`<div>\${sanitizedContent}</div>\``},MISSING_KEY:{code:"ERR_MISSING_KEY",se
119
119
  // Good \u2014 stable key:
120
120
  <For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},ae=class extends Error{constructor({code:t,message:n,suggestion:r,file:o,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=o,this.line=s,this.component=i,this.signal=a,this.effect=u}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function oe(e,t={}){let n=typeof e=="string"?ct[e]:e;if(!n)return new ae({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ae({code:n.code,message:r,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],at=200;function we(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>at&&(re=re.slice(-at)))}function be(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function Or(){re=[]}function $r(e,t={}){let n=e?.message||String(e);return n.includes("infinite effect loop")||n.includes("25 iterations")?oe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?oe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?oe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new ae({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var ge={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function Hr(e){Object.assign(ge,e)}function Vr(){return{...ge}}function jr(e,t){return!F||!ge.signalReadDetection||(e.toString=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
121
121
  Suggestion: ${n.suggestion}`),we(n),String(e())},e.valueOf=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
122
- Suggestion: ${n.suggestion}`),we(n),e()}),e}function qr(e){if(!F||!ge.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Br(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ut=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function Gr(e){if(!F||!ge.importValidation)return[];let t=[];for(let n of e)ut.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Yr(n)}?`});return t}function Yr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of ut){let s=Xr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Xr(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var Wr="0.11.2",me=[];function Qr(e){F&&me.push(e)}function zr(e){if(!F)return;let t=me.indexOf(e);t>=0&&me.splice(t,1)}function lt(){return me.slice()}var ce=[];function Kr(e){F&&ce.push(e)}function Ur(e){if(!F)return;let t=ce.indexOf(e);t>=0&&ce.splice(t,1)}function ft(){return ce.slice()}function dt(){let e=be(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ce.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ce.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:me.length}}function Jr(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:Wr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>lt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>ft().map((e,t)=>({id:t,name:e._debugName||`signal_${t}`,value:typeof e=="function"?e.peek?.():void 0,subscriberCount:e._subs?e._subs.size:0})),errors:()=>be(),health:()=>dt(),api:{reactive:["signal","computed","effect","batch","untrack","flushSync","createRoot","memo"],hooks:["useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","onMount","onCleanup"],components:["Show","For","Switch","Match","Suspense","ErrorBoundary","lazy","Island"],data:["useSWR","useQuery","useFetch","useInfiniteQuery"],store:["createStore","derived","atom"]}}))}export{Fr as Checkbox,ct as ERROR_CODES,At as ErrorBoundary,Nr as ErrorMessage,Bn as FocusTrap,Rt as For,kt as Fragment,Sn as Head,Mr as Input,Lt as Island,cr as IslandSkeleton,nr as Keys,Jn as LiveRegion,fr as LoadingDots,Mt as Match,lr as Placeholder,Vt as Portal,Pr as Radio,Dr as Select,It as Show,Le as Skeleton,ir as SkeletonAvatar,nt as SkeletonCard,ar as SkeletonTable,De as SkeletonText,Xn as SkipLink,dr as Spinner,_t as Suspense,Tt as Switch,Lr as Textarea,Un as VisuallyHidden,ae as WhatError,Yt as _$createComponent,Xt as _$template,bt as __drainPreinstallBuffer,Er as __getCacheSnapshot,Ee as __readHydrationData,sn as __resetHydrationData,ht as __setDevToolsHooks,Gt as _setTextInsertHook,Fe as _template,Ze as announce,Yn as announceAssertive,kn as atom,M as batch,_n as beginHeadCollection,qr as checkComponentName,en as classList,$r as classifyError,Sr as clearCache,Or as clearCollectedErrors,Rn as clearHead,Ft as cls,we as collectError,N as computed,Hr as configureGuardrails,gn as createContext,vn as createResource,vt as createRoot,bn as createStore,ze as createTransitionClasses,oe as createWhatError,Vn as cssTransition,Nt as debounce,Jt as delegateEvents,$e as derived,Dt as each,Qe as easings,O as effect,An as endHeadCollection,qe as flushScheduler,mt as flushSync,ft as getActiveSignals,be as getCollectedErrors,Vr as getGuardrailConfig,dt as getHealth,Ce as getLoaderData,lt as getMountedComponents,yt as getOwner,kr as getQueryData,_e as getResource,ie as getServerContext,w as h,St as html,nn as hydrate,Qt as insert,Jr as installAgentContext,jr as installSignalReadGuardrail,vr as invalidateQueries,tn as isHydrating,Ct as lazy,zt as mapArray,Tn as measure,Et as memo,Bt as mount,Mn as mutate,Dn as nextFrame,Zt as on,xn as onCleanup,Pn as onIntersect,rr as onKey,or as onKeys,yn as onMount,Fn as onResize,wt as onRootCleanup,wr as prefetchQuery,Ge as raf,Qr as registerComponent,Kr as registerSignal,Rr as rules,xt as runWithOwner,on as runWithServerContext,G as scheduleRead,K as scheduleWrite,Ut as setProp,br as setQueryData,rn as setServerContext,l as signal,gt as signalMemo,Ir as simpleResolver,Nn as smoothScrollTo,Kt as spread,Xe as spring,wn as storeComputed,Pt as style,Wt as svgTemplate,Fe as template,Ot as throttle,qt as transition,We as tween,zr as unregisterComponent,Ur as unregisterSignal,le as untrack,Hn as useAnimatedValue,zn as useAriaChecked,Wn as useAriaExpanded,Qn as useAriaSelected,pn as useCallback,jt as useClickOutside,ln as useComputed,Pe as useContext,er as useDescribedBy,fn as useEffect,gr as useFetch,Tr as useField,jn as useFocus,qn as useFocusRestore,Je as useFocusTrap,Cr as useForm,$n as useGesture,Me as useId,Zn as useIds,xr as useInfiniteQuery,tr as useLabelledBy,an as useLoaderData,Ht as useLocalStorage,$t as useMediaQuery,dn as useMemo,yr as useQuery,mn as useReducer,hn as useRef,Kn as useRovingTabIndex,mr as useSWR,Ln as useScheduledEffect,un as useSignal,ur as useSkeleton,cn as useState,On as useTransition,Gr as validateImports,Ar as yupResolver,_r as zodResolver};
122
+ Suggestion: ${n.suggestion}`),we(n),e()}),e}function qr(e){if(!F||!ge.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Br(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ut=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function Gr(e){if(!F||!ge.importValidation)return[];let t=[];for(let n of e)ut.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Yr(n)}?`});return t}function Yr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of ut){let s=Xr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Xr(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var Wr="0.11.4",me=[];function Qr(e){F&&me.push(e)}function zr(e){if(!F)return;let t=me.indexOf(e);t>=0&&me.splice(t,1)}function lt(){return me.slice()}var ce=[];function Kr(e){F&&ce.push(e)}function Ur(e){if(!F)return;let t=ce.indexOf(e);t>=0&&ce.splice(t,1)}function ft(){return ce.slice()}function dt(){let e=be(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ce.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ce.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:me.length}}function Jr(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:Wr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>lt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>ft().map((e,t)=>({id:t,name:e._debugName||`signal_${t}`,value:typeof e=="function"?e.peek?.():void 0,subscriberCount:e._subs?e._subs.size:0})),errors:()=>be(),health:()=>dt(),api:{reactive:["signal","computed","effect","batch","untrack","flushSync","createRoot","memo"],hooks:["useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","onMount","onCleanup"],components:["Show","For","Switch","Match","Suspense","ErrorBoundary","lazy","Island"],data:["useSWR","useQuery","useFetch","useInfiniteQuery"],store:["createStore","derived","atom"]}}))}export{Fr as Checkbox,ct as ERROR_CODES,At as ErrorBoundary,Nr as ErrorMessage,Bn as FocusTrap,Rt as For,kt as Fragment,Sn as Head,Mr as Input,Lt as Island,cr as IslandSkeleton,nr as Keys,Jn as LiveRegion,fr as LoadingDots,Mt as Match,lr as Placeholder,Vt as Portal,Pr as Radio,Dr as Select,It as Show,Le as Skeleton,ir as SkeletonAvatar,nt as SkeletonCard,ar as SkeletonTable,De as SkeletonText,Xn as SkipLink,dr as Spinner,_t as Suspense,Tt as Switch,Lr as Textarea,Un as VisuallyHidden,ae as WhatError,Yt as _$createComponent,Xt as _$template,bt as __drainPreinstallBuffer,Er as __getCacheSnapshot,Ee as __readHydrationData,sn as __resetHydrationData,ht as __setDevToolsHooks,Gt as _setTextInsertHook,Fe as _template,Ze as announce,Yn as announceAssertive,kn as atom,M as batch,_n as beginHeadCollection,qr as checkComponentName,en as classList,$r as classifyError,Sr as clearCache,Or as clearCollectedErrors,Rn as clearHead,Ft as cls,we as collectError,N as computed,Hr as configureGuardrails,gn as createContext,vn as createResource,vt as createRoot,bn as createStore,ze as createTransitionClasses,oe as createWhatError,Vn as cssTransition,Nt as debounce,Jt as delegateEvents,$e as derived,Dt as each,Qe as easings,O as effect,An as endHeadCollection,qe as flushScheduler,mt as flushSync,ft as getActiveSignals,be as getCollectedErrors,Vr as getGuardrailConfig,dt as getHealth,Ce as getLoaderData,lt as getMountedComponents,yt as getOwner,kr as getQueryData,_e as getResource,ie as getServerContext,w as h,St as html,nn as hydrate,Qt as insert,Jr as installAgentContext,jr as installSignalReadGuardrail,vr as invalidateQueries,tn as isHydrating,Ct as lazy,zt as mapArray,Tn as measure,Et as memo,Bt as mount,Mn as mutate,Dn as nextFrame,Zt as on,xn as onCleanup,Pn as onIntersect,rr as onKey,or as onKeys,yn as onMount,Fn as onResize,wt as onRootCleanup,wr as prefetchQuery,Ge as raf,Qr as registerComponent,Kr as registerSignal,Rr as rules,xt as runWithOwner,on as runWithServerContext,G as scheduleRead,K as scheduleWrite,Ut as setProp,br as setQueryData,rn as setServerContext,l as signal,gt as signalMemo,Ir as simpleResolver,Nn as smoothScrollTo,Kt as spread,Xe as spring,wn as storeComputed,Pt as style,Wt as svgTemplate,Fe as template,Ot as throttle,qt as transition,We as tween,zr as unregisterComponent,Ur as unregisterSignal,le as untrack,Hn as useAnimatedValue,zn as useAriaChecked,Wn as useAriaExpanded,Qn as useAriaSelected,pn as useCallback,jt as useClickOutside,ln as useComputed,Pe as useContext,er as useDescribedBy,fn as useEffect,gr as useFetch,Tr as useField,jn as useFocus,qn as useFocusRestore,Je as useFocusTrap,Cr as useForm,$n as useGesture,Me as useId,Zn as useIds,xr as useInfiniteQuery,tr as useLabelledBy,an as useLoaderData,Ht as useLocalStorage,$t as useMediaQuery,dn as useMemo,yr as useQuery,mn as useReducer,hn as useRef,Kn as useRovingTabIndex,mr as useSWR,Ln as useScheduledEffect,un as useSignal,ur as useSkeleton,cn as useState,On as useTransition,Gr as validateImports,Ar as yupResolver,_r as zodResolver};
@@ -1 +1 @@
1
- import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v}from"./chunk-DF3XC3WN.min.js";import{e as a,g as b,i as c}from"./chunk-W33M3HL5.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,d as _setTextInsertHook,g as _template,t as classList,r as delegateEvents,a as effect,v as hydrate,i as insert,u as isHydrating,j as mapArray,b as memo,s as on,o as setAttr,q as setChecked,m as setClass,l as setProp,n as setStyle,p as setValue,k as spread,h as svgTemplate,g as template,c as untrack};
1
+ import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v}from"./chunk-7FW6K5RG.min.js";import{e as a,g as b,i as c}from"./chunk-W33M3HL5.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,d as _setTextInsertHook,g as _template,t as classList,r as delegateEvents,a as effect,v as hydrate,i as insert,u as isHydrating,j as mapArray,b as memo,s as on,o as setAttr,q as setChecked,m as setClass,l as setProp,n as setStyle,p as setValue,k as spread,h as svgTemplate,g as template,c as untrack};
@@ -0,0 +1,15 @@
1
+ // What Framework — JSX dev-runtime type definitions.
2
+ // Re-exports the runtime types (including the JSX namespace) and adds jsxDEV,
3
+ // which the "react-jsxdev" transform emits in development builds.
4
+ import type { VNode } from './index';
5
+
6
+ export * from './jsx-runtime';
7
+
8
+ export function jsxDEV(
9
+ type: any,
10
+ props: any,
11
+ key?: any,
12
+ isStaticChildren?: boolean,
13
+ source?: any,
14
+ self?: any,
15
+ ): VNode;
@@ -0,0 +1,311 @@
1
+ // What Framework — JSX runtime type definitions.
2
+ //
3
+ // Enables type-checked JSX authoring with:
4
+ // "jsx": "react-jsx", "jsxImportSource": "what-framework" (or "what-core")
5
+ //
6
+ // What is DOM-native and lenient at runtime: attributes pass through as-is,
7
+ // both `class`/`className` and camelCase/lowercase event handlers are accepted
8
+ // (events are bound via `key.slice(2).toLowerCase()`), and any attribute value
9
+ // may be reactive — a plain value OR a `() => value` thunk. These types mirror
10
+ // that behavior: common attributes are explicitly typed for autocomplete and
11
+ // documentation, while an index signature keeps arbitrary/custom attributes and
12
+ // web-component tags valid (never false-flagging code the runtime accepts).
13
+
14
+ import type { VNode, VNodeChild } from './index';
15
+
16
+ export { Fragment } from './index';
17
+
18
+ /** A JSX attribute value in What may be static or a reactive `() => value` thunk. */
19
+ export type Reactive<T> = T | (() => T);
20
+
21
+ export function jsx(type: any, props: any, key?: any): VNode;
22
+ export function jsxs(type: any, props: any, key?: any): VNode;
23
+
24
+ type EventHandler<E extends Event = Event> = (event: E & { currentTarget: EventTarget & Element; target: Element }) => void;
25
+
26
+ interface WhatEventHandlers {
27
+ // What lowercases the event name, so both spellings resolve to the same DOM event.
28
+ onClick?: EventHandler<MouseEvent>;
29
+ onclick?: EventHandler<MouseEvent>;
30
+ onDblClick?: EventHandler<MouseEvent>;
31
+ ondblclick?: EventHandler<MouseEvent>;
32
+ onMouseDown?: EventHandler<MouseEvent>;
33
+ onmousedown?: EventHandler<MouseEvent>;
34
+ onMouseUp?: EventHandler<MouseEvent>;
35
+ onmouseup?: EventHandler<MouseEvent>;
36
+ onMouseEnter?: EventHandler<MouseEvent>;
37
+ onmouseenter?: EventHandler<MouseEvent>;
38
+ onMouseLeave?: EventHandler<MouseEvent>;
39
+ onmouseleave?: EventHandler<MouseEvent>;
40
+ onMouseMove?: EventHandler<MouseEvent>;
41
+ onmousemove?: EventHandler<MouseEvent>;
42
+ onInput?: EventHandler<InputEvent>;
43
+ oninput?: EventHandler<InputEvent>;
44
+ onChange?: EventHandler<Event>;
45
+ onchange?: EventHandler<Event>;
46
+ onSubmit?: EventHandler<SubmitEvent>;
47
+ onsubmit?: EventHandler<SubmitEvent>;
48
+ onReset?: EventHandler<Event>;
49
+ onreset?: EventHandler<Event>;
50
+ onKeyDown?: EventHandler<KeyboardEvent>;
51
+ onkeydown?: EventHandler<KeyboardEvent>;
52
+ onKeyUp?: EventHandler<KeyboardEvent>;
53
+ onkeyup?: EventHandler<KeyboardEvent>;
54
+ onKeyPress?: EventHandler<KeyboardEvent>;
55
+ onkeypress?: EventHandler<KeyboardEvent>;
56
+ onFocus?: EventHandler<FocusEvent>;
57
+ onfocus?: EventHandler<FocusEvent>;
58
+ onBlur?: EventHandler<FocusEvent>;
59
+ onblur?: EventHandler<FocusEvent>;
60
+ onScroll?: EventHandler<Event>;
61
+ onscroll?: EventHandler<Event>;
62
+ }
63
+
64
+ interface WhatHTMLAttributes extends WhatEventHandlers {
65
+ children?: VNodeChild;
66
+ /** Component-list reconciliation key. */
67
+ key?: string | number;
68
+ ref?: ((el: any) => void) | { current: any };
69
+
70
+ class?: Reactive<string>;
71
+ className?: Reactive<string>;
72
+ id?: Reactive<string>;
73
+ style?: Reactive<string | Record<string, string | number>>;
74
+ title?: Reactive<string>;
75
+ role?: Reactive<string>;
76
+ slot?: Reactive<string>;
77
+ lang?: Reactive<string>;
78
+ dir?: Reactive<string>;
79
+ hidden?: Reactive<boolean>;
80
+ draggable?: Reactive<boolean>;
81
+ contentEditable?: Reactive<boolean | string>;
82
+ tabindex?: Reactive<number | string>;
83
+ tabIndex?: Reactive<number | string>;
84
+
85
+ // Common data-/aria- attributes remain typed; arbitrary ones fall through below.
86
+ [dataAttr: `data-${string}`]: any;
87
+ [ariaAttr: `aria-${string}`]: any;
88
+ /** What passes unknown attributes straight to the DOM; keep them valid. */
89
+ [attr: string]: any;
90
+ }
91
+
92
+ interface WhatInputAttributes extends WhatHTMLAttributes {
93
+ type?: Reactive<string>;
94
+ value?: Reactive<string | number>;
95
+ checked?: Reactive<boolean>;
96
+ placeholder?: Reactive<string>;
97
+ disabled?: Reactive<boolean>;
98
+ readonly?: Reactive<boolean>;
99
+ readOnly?: Reactive<boolean>;
100
+ required?: Reactive<boolean>;
101
+ name?: Reactive<string>;
102
+ min?: Reactive<string | number>;
103
+ max?: Reactive<string | number>;
104
+ step?: Reactive<string | number>;
105
+ pattern?: Reactive<string>;
106
+ autocomplete?: Reactive<string>;
107
+ autofocus?: Reactive<boolean>;
108
+ }
109
+
110
+ interface WhatAnchorAttributes extends WhatHTMLAttributes {
111
+ href?: Reactive<string>;
112
+ target?: Reactive<string>;
113
+ rel?: Reactive<string>;
114
+ download?: Reactive<string | boolean>;
115
+ }
116
+
117
+ interface WhatImgAttributes extends WhatHTMLAttributes {
118
+ src?: Reactive<string>;
119
+ srcset?: Reactive<string>;
120
+ alt?: Reactive<string>;
121
+ width?: Reactive<string | number>;
122
+ height?: Reactive<string | number>;
123
+ loading?: Reactive<'eager' | 'lazy'>;
124
+ decoding?: Reactive<'async' | 'auto' | 'sync'>;
125
+ }
126
+
127
+ interface WhatButtonAttributes extends WhatHTMLAttributes {
128
+ type?: Reactive<'button' | 'submit' | 'reset'>;
129
+ disabled?: Reactive<boolean>;
130
+ name?: Reactive<string>;
131
+ value?: Reactive<string | number>;
132
+ form?: Reactive<string>;
133
+ }
134
+
135
+ interface WhatFormAttributes extends WhatHTMLAttributes {
136
+ action?: Reactive<string>;
137
+ method?: Reactive<string>;
138
+ enctype?: Reactive<string>;
139
+ novalidate?: Reactive<boolean>;
140
+ target?: Reactive<string>;
141
+ }
142
+
143
+ interface WhatLabelAttributes extends WhatHTMLAttributes {
144
+ for?: Reactive<string>;
145
+ htmlFor?: Reactive<string>;
146
+ }
147
+
148
+ interface WhatOptionAttributes extends WhatHTMLAttributes {
149
+ value?: Reactive<string | number>;
150
+ selected?: Reactive<boolean>;
151
+ disabled?: Reactive<boolean>;
152
+ }
153
+
154
+ interface WhatSelectAttributes extends WhatHTMLAttributes {
155
+ value?: Reactive<string | number>;
156
+ name?: Reactive<string>;
157
+ disabled?: Reactive<boolean>;
158
+ required?: Reactive<boolean>;
159
+ multiple?: Reactive<boolean>;
160
+ }
161
+
162
+ interface WhatTextareaAttributes extends WhatHTMLAttributes {
163
+ value?: Reactive<string>;
164
+ placeholder?: Reactive<string>;
165
+ rows?: Reactive<string | number>;
166
+ cols?: Reactive<string | number>;
167
+ disabled?: Reactive<boolean>;
168
+ readonly?: Reactive<boolean>;
169
+ required?: Reactive<boolean>;
170
+ name?: Reactive<string>;
171
+ }
172
+
173
+ interface WhatMediaAttributes extends WhatHTMLAttributes {
174
+ src?: Reactive<string>;
175
+ controls?: Reactive<boolean>;
176
+ autoplay?: Reactive<boolean>;
177
+ loop?: Reactive<boolean>;
178
+ muted?: Reactive<boolean>;
179
+ poster?: Reactive<string>;
180
+ preload?: Reactive<string>;
181
+ }
182
+
183
+ // SVG (recharts and other chart libraries render through this).
184
+ interface WhatSVGAttributes extends WhatHTMLAttributes {
185
+ width?: Reactive<string | number>;
186
+ height?: Reactive<string | number>;
187
+ viewBox?: Reactive<string>;
188
+ fill?: Reactive<string>;
189
+ stroke?: Reactive<string>;
190
+ x?: Reactive<string | number>;
191
+ y?: Reactive<string | number>;
192
+ cx?: Reactive<string | number>;
193
+ cy?: Reactive<string | number>;
194
+ r?: Reactive<string | number>;
195
+ d?: Reactive<string>;
196
+ points?: Reactive<string>;
197
+ transform?: Reactive<string>;
198
+ }
199
+
200
+ export namespace JSX {
201
+ type Element = VNode;
202
+ interface ElementChildrenAttribute {
203
+ children: {};
204
+ }
205
+ interface IntrinsicAttributes {
206
+ key?: string | number;
207
+ }
208
+
209
+ interface IntrinsicElements {
210
+ // Element-specific typing (autocomplete for the props that matter most).
211
+ a: WhatAnchorAttributes;
212
+ img: WhatImgAttributes;
213
+ input: WhatInputAttributes;
214
+ button: WhatButtonAttributes;
215
+ form: WhatFormAttributes;
216
+ label: WhatLabelAttributes;
217
+ option: WhatOptionAttributes;
218
+ select: WhatSelectAttributes;
219
+ textarea: WhatTextareaAttributes;
220
+ video: WhatMediaAttributes;
221
+ audio: WhatMediaAttributes;
222
+ source: WhatMediaAttributes;
223
+
224
+ // Structural / text / sectioning elements.
225
+ div: WhatHTMLAttributes;
226
+ span: WhatHTMLAttributes;
227
+ p: WhatHTMLAttributes;
228
+ section: WhatHTMLAttributes;
229
+ article: WhatHTMLAttributes;
230
+ header: WhatHTMLAttributes;
231
+ footer: WhatHTMLAttributes;
232
+ main: WhatHTMLAttributes;
233
+ aside: WhatHTMLAttributes;
234
+ nav: WhatHTMLAttributes;
235
+ h1: WhatHTMLAttributes;
236
+ h2: WhatHTMLAttributes;
237
+ h3: WhatHTMLAttributes;
238
+ h4: WhatHTMLAttributes;
239
+ h5: WhatHTMLAttributes;
240
+ h6: WhatHTMLAttributes;
241
+ ul: WhatHTMLAttributes;
242
+ ol: WhatHTMLAttributes;
243
+ li: WhatHTMLAttributes;
244
+ dl: WhatHTMLAttributes;
245
+ dt: WhatHTMLAttributes;
246
+ dd: WhatHTMLAttributes;
247
+ table: WhatHTMLAttributes;
248
+ thead: WhatHTMLAttributes;
249
+ tbody: WhatHTMLAttributes;
250
+ tfoot: WhatHTMLAttributes;
251
+ tr: WhatHTMLAttributes;
252
+ th: WhatHTMLAttributes;
253
+ td: WhatHTMLAttributes;
254
+ caption: WhatHTMLAttributes;
255
+ colgroup: WhatHTMLAttributes;
256
+ col: WhatHTMLAttributes;
257
+ fieldset: WhatHTMLAttributes;
258
+ legend: WhatHTMLAttributes;
259
+ strong: WhatHTMLAttributes;
260
+ em: WhatHTMLAttributes;
261
+ b: WhatHTMLAttributes;
262
+ i: WhatHTMLAttributes;
263
+ u: WhatHTMLAttributes;
264
+ small: WhatHTMLAttributes;
265
+ mark: WhatHTMLAttributes;
266
+ code: WhatHTMLAttributes;
267
+ pre: WhatHTMLAttributes;
268
+ kbd: WhatHTMLAttributes;
269
+ blockquote: WhatHTMLAttributes;
270
+ hr: WhatHTMLAttributes;
271
+ br: WhatHTMLAttributes;
272
+ figure: WhatHTMLAttributes;
273
+ figcaption: WhatHTMLAttributes;
274
+ details: WhatHTMLAttributes;
275
+ summary: WhatHTMLAttributes;
276
+ dialog: WhatHTMLAttributes;
277
+ picture: WhatHTMLAttributes;
278
+ iframe: WhatHTMLAttributes;
279
+ canvas: WhatHTMLAttributes;
280
+ template: WhatHTMLAttributes;
281
+ slot: WhatHTMLAttributes;
282
+ time: WhatHTMLAttributes;
283
+ progress: WhatHTMLAttributes;
284
+ meter: WhatHTMLAttributes;
285
+ output: WhatHTMLAttributes;
286
+ datalist: WhatHTMLAttributes;
287
+ optgroup: WhatHTMLAttributes;
288
+
289
+ // SVG.
290
+ svg: WhatSVGAttributes;
291
+ g: WhatSVGAttributes;
292
+ path: WhatSVGAttributes;
293
+ circle: WhatSVGAttributes;
294
+ ellipse: WhatSVGAttributes;
295
+ rect: WhatSVGAttributes;
296
+ line: WhatSVGAttributes;
297
+ polyline: WhatSVGAttributes;
298
+ polygon: WhatSVGAttributes;
299
+ text: WhatSVGAttributes;
300
+ tspan: WhatSVGAttributes;
301
+ defs: WhatSVGAttributes;
302
+ linearGradient: WhatSVGAttributes;
303
+ radialGradient: WhatSVGAttributes;
304
+ stop: WhatSVGAttributes;
305
+ clipPath: WhatSVGAttributes;
306
+ use: WhatSVGAttributes;
307
+
308
+ // Custom elements / web components remain valid.
309
+ [tagName: string]: WhatHTMLAttributes;
310
+ }
311
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "what-core",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "What Framework - Signal-based UI framework built for AI agents",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -10,31 +10,40 @@
10
10
  ".": {
11
11
  "types": "./index.d.ts",
12
12
  "production": "./dist/index.min.js",
13
- "import": "./src/index.js"
13
+ "import": "./src/index.js",
14
+ "default": "./src/index.js"
14
15
  },
15
16
  "./jsx-runtime": {
17
+ "types": "./jsx-runtime.d.ts",
16
18
  "production": "./dist/jsx-runtime.min.js",
17
- "import": "./src/jsx-runtime.js"
19
+ "import": "./src/jsx-runtime.js",
20
+ "default": "./src/jsx-runtime.js"
18
21
  },
19
22
  "./jsx-dev-runtime": {
23
+ "types": "./jsx-dev-runtime.d.ts",
20
24
  "production": "./dist/jsx-dev-runtime.min.js",
21
- "import": "./src/jsx-dev-runtime.js"
25
+ "import": "./src/jsx-dev-runtime.js",
26
+ "default": "./src/jsx-dev-runtime.js"
22
27
  },
23
28
  "./render": {
24
29
  "types": "./render.d.ts",
25
30
  "production": "./dist/render.min.js",
26
- "import": "./src/render.js"
31
+ "import": "./src/render.js",
32
+ "default": "./src/render.js"
27
33
  },
28
34
  "./testing": {
29
35
  "types": "./testing.d.ts",
30
36
  "production": "./dist/testing.min.js",
31
- "import": "./src/testing.js"
37
+ "import": "./src/testing.js",
38
+ "default": "./src/testing.js"
32
39
  }
33
40
  },
34
41
  "files": [
35
42
  "src",
36
43
  "dist/**/*.min.js",
37
44
  "index.d.ts",
45
+ "jsx-runtime.d.ts",
46
+ "jsx-dev-runtime.d.ts",
38
47
  "render.d.ts",
39
48
  "testing.d.ts"
40
49
  ],
@@ -8,7 +8,7 @@ import { getCollectedErrors } from './errors.js';
8
8
  // --- Version ---
9
9
  // Keep in sync with packages/core/package.json (checked by
10
10
  // core/test/guardrails.test.js so it can't silently go stale again).
11
- const VERSION = '0.11.2';
11
+ const VERSION = '0.11.4';
12
12
 
13
13
  // --- Component Registry ---
14
14
  // Tracks mounted components for agent inspection.
package/src/render.js CHANGED
@@ -270,9 +270,35 @@ function valuesToNodes(value, parent, out) {
270
270
  return out;
271
271
  }
272
272
 
273
- // Resolve function values (reactive accessors passed through props)
273
+ // Reactive thunks passed through as component children / props.
274
+ //
275
+ // The compiler lowers a multi-child component to an ARRAY of children, e.g.
276
+ // `<Card><Sib/>{() => x()}</Card>` -> `_$createComponent(Card, null, [<Sib/>, () => x()])`.
277
+ // Rendering `{props.children}` then emits `_$insert(el, props.children)`; a
278
+ // plain array child skips insert()'s function/effect branch and lands here.
279
+ // Resolving the thunk eagerly (`value()`) captured a one-time snapshot with no
280
+ // reactive subscription, so the child rendered once and never updated.
281
+ //
282
+ // Route it through createDOM instead — its reactive fn-child path installs a
283
+ // dedicated effect between stable comment markers, exactly like a thunk that
284
+ // is the direct child of an intrinsic element. createDOM returns a
285
+ // DocumentFragment (start marker, initial content, end marker); we flatten it
286
+ // to its child nodes here — same reasoning as the isVNode/isDomNode fragment
287
+ // handling below — so a later reconcile can still track and remove them. This
288
+ // keeps event handlers and manually-called render props untouched: only
289
+ // functions that actually flow into a render (child) position reach
290
+ // valuesToNodes.
291
+ //
292
+ // mapArray inserters (`value._mapArray`) are also functions — createDOM
293
+ // special-cases them, so they are handled correctly here too.
274
294
  if (typeof value === 'function') {
275
- valuesToNodes(value(), parent, out);
295
+ const node = createDOM(value, parent, isSvgParent(parent));
296
+ if (node && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
297
+ const kids = Array.from(node.childNodes);
298
+ for (let i = 0; i < kids.length; i++) out.push(kids[i]);
299
+ } else if (node) {
300
+ out.push(node);
301
+ }
276
302
  return out;
277
303
  }
278
304
 
@@ -360,10 +386,20 @@ function reconcileInsert(parent, value, current, marker) {
360
386
  return current;
361
387
  }
362
388
 
363
- // Fast path: single DOM node value with single current node — skip array allocations
364
- if (typeof value === 'object' && value !== null && value.nodeType > 0 && !Array.isArray(value)) {
389
+ // Fast path: single DOM node value with single current node — skip array allocations.
390
+ //
391
+ // DocumentFragments (nodeType 11) are deliberately EXCLUDED on both sides. A
392
+ // component realizes to a fragment `[<!--c:start-->, ...content, <!--c:end-->]`;
393
+ // inserting a fragment absorbs its children into the DOM and leaves the fragment
394
+ // empty. If the fast path stored that emptied fragment as `current`, it would
395
+ // lose the reference to the real inserted nodes, so the next switch away could
396
+ // not remove them and copies would stack (the "doubled empty-state" bug). Route
397
+ // fragments through valuesToNodes below, which flattens them to their child
398
+ // nodes and tracks each one for correct removal on the next reconcile.
399
+ if (typeof value === 'object' && value !== null && value.nodeType > 0
400
+ && value.nodeType !== 11 && !Array.isArray(value)) {
365
401
  if (value === current) return current;
366
- if (current && !Array.isArray(current) && current.nodeType > 0) {
402
+ if (current && !Array.isArray(current) && current.nodeType > 0 && current.nodeType !== 11) {
367
403
  // Replace single node with single node
368
404
  if (current.parentNode === parent) {
369
405
  disposeTree(current);
@@ -1 +0,0 @@
1
- import{I as W,K as ot,M as gt,N as ft,a as R,c as tt,e as D,m as q}from"./chunk-W33M3HL5.min.js";var Z=null;function Zt(t){Z=typeof t=="function"?t:null}function Jt(t,n,e){if(e&&e.length>0){let r=e.length===1?e[0]:e;n?n.children=r:n={children:r}}return ot({tag:t,props:n||{},children:e||[],key:null,_vnode:!0})}var dt=new Set(["href","src","action","formaction","formAction"]);function At(t){if(typeof t!="string")return!0;let n=t.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}var wt={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},Tt=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function xt(t){let n=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Et(t){let n=t.trim(),e=xt(n);if(Tt.has(e))return Lt(n);let r=wt[e];if(r){let o=document.createElement("template");o.innerHTML=r.wrap+n+r.unwrap;let y=o.content.firstChild;for(let c=0;c<r.depth;c++)y=y.firstChild;return()=>y.cloneNode(!0)}let i=document.createElement("template");return i.innerHTML=n,()=>i.content.firstChild.cloneNode(!0)}var yt=!1;function Qt(t){return R&&!yt&&(yt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Et(t)}function Lt(t){let n=t.trim();if(xt(n)==="svg"){let i=document.createElement("template");return i.innerHTML=n,()=>i.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function Yt(t,n,e){if(typeof n=="function"&&n._mapArray)return n(t,e||null);if(typeof n=="function"){let r=e||null,i=null,o=null,y=!1;return D(()=>{let c=n(),h=typeof c;if(!y){y=!0,h==="string"||h==="number"?(o=document.createTextNode(String(c)),r?t.insertBefore(o,r):t.appendChild(o),Z&&Z(t,String(c)),i=o):i=Q(t,c,null,r);return}if(o!==null&&(h==="string"||h==="number")){let l=String(c);o.data!==l&&(o.data=l),Z&&Z(t,l);return}o=null,i=Q(t,c,i,r)}),i}if(typeof n=="string"||typeof n=="number"){let r=document.createTextNode(String(n));return e?t.insertBefore(r,e):t.appendChild(r),r}return n!=null&&typeof n=="object"&&n.nodeType>0?(e?t.insertBefore(n,e):t.appendChild(n),n):Q(t,n,null,e||null)}function _t(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function St(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var nt=typeof SVGElement<"u";function Mt(t){return nt&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function bt(t){return t==null?[]:Array.isArray(t)?t:[t]}function ut(t,n,e){if(t==null||typeof t=="boolean")return e;if(Array.isArray(t)){for(let r=0;r<t.length;r++)ut(t[r],n,e);return e}if(typeof t=="function")return ut(t(),n,e),e;if(typeof t=="string"||typeof t=="number")return e.push(document.createTextNode(String(t))),e;if(_t(t)){if(t.nodeType===11&&t.childNodes.length>0){let r=Array.from(t.childNodes);for(let i=0;i<r.length;i++)e.push(r[i])}else e.push(t);return e}if(St(t)){let r=ot(t,n,Mt(n));if(r&&r.nodeType===11)if(r.childNodes.length===0)e.push(r);else{let i=Array.from(r.childNodes);for(let o=0;o<i.length;o++)e.push(i[o])}else r&&e.push(r);return e}return e.push(document.createTextNode(String(t))),e}function jt(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function Q(t,n,e,r){if(!t||typeof t.insertBefore!="function")return R&&console.warn("[what] reconcileInsert called with invalid parent:",t),e;let i=r||null;if(n==null||typeof n=="boolean"){let l=bt(e);for(let d=0;d<l.length;d++){let s=l[d];s.parentNode===t&&(W(s),t.removeChild(s))}return null}if((typeof n=="string"||typeof n=="number")&&e&&!Array.isArray(e)&&e.nodeType===3){let l=String(n);return e.data!==l&&(e.data=l),e}if(typeof n=="object"&&n!==null&&n.nodeType>0&&!Array.isArray(n)){if(n===e)return e;if(e&&!Array.isArray(e)&&e.nodeType>0)return e.parentNode===t?(W(e),t.replaceChild(n,e)):i?t.insertBefore(n,i):t.appendChild(n),n}let o=ut(n,t,[]),y=bt(e);if(jt(y,o))return e;let c=o.length;for(let l=0;l<y.length;l++){let d=y[l];if(d.parentNode!==t)continue;let s=!1;for(let x=0;x<c;x++)if(o[x]===d){s=!0;break}s||(W(d),t.removeChild(d))}let h=i;for(let l=o.length-1;l>=0;l--){let d=o[l];(d.parentNode!==t||d.nextSibling!==h)&&(h&&h.parentNode!==t&&(h=null),h?t.insertBefore(d,h):t.appendChild(d)),h=d}return o.length===0?null:o.length===1?o[0]:o}function It(t,n,e){let r=e?.key,i=e?.raw||!1,o=(y,c)=>{let h=[],l=[],d=[],s=r&&!i?new Map:null,x=document.createComment("/list");return y.insertBefore(x,c||null),D(()=>{let p=t()||[],b=x.parentNode||y;r?Nt(b,x,h,p,l,d,n,r,s):Bt(b,x,h,p,l,d,n),h=p.length>0?p.slice():p}),x};return o._mapArray=!0,o}function Bt(t,n,e,r,i,o,y){let c=r.length,h=e.length;if(c===0){if(h>0){for(let u=0;u<h;u++)o[u]&&o[u]();for(let u=h-1;u>=0;u--){let a=i[u];a&&(W(a),a.parentNode===t&&t.removeChild(a))}i.length=0,o.length=0}return}if(h===0){let u=document.createDocumentFragment();for(let a=0;a<c;a++){let T=r[a],L=q(O=>(o[a]=O,y(T,a)));i[a]=L,u.appendChild(L)}t.insertBefore(u,n);return}let l=0,d=Math.min(h,c);for(;l<d&&e[l]===r[l];)l++;if(l===h&&l===c)return;let s=h-1,x=c-1;for(;s>=l&&x>=l&&e[s]===r[x];)s--,x--;let p=new Array(c),b=new Array(c);for(let u=0;u<l;u++)p[u]=i[u],b[u]=o[u];for(let u=x+1;u<c;u++){let a=s+1+(u-x-1);p[u]=i[a],b[u]=o[a]}let _=x-l+1,w=s-l+1;if(_===0)for(let u=l;u<=s;u++)o[u]?.(),i[u]&&W(i[u]),i[u]?.parentNode&&i[u].parentNode.removeChild(i[u]);else if(w===0){let u=l<c&&p[x+1]?p[x+1]:n,a=document.createDocumentFragment();for(let T=l;T<=x;T++){let L=r[T],O=T;p[T]=q(S=>(b[O]=S,y(L,O))),a.appendChild(p[T])}t.insertBefore(a,u)}else Ht(t,n,e,r,i,o,y,l,s,x,p,b);i.length=c,o.length=c;for(let u=0;u<c;u++)i[u]=p[u],o[u]=b[u]}function Ht(t,n,e,r,i,o,y,c,h,l,d,s){let x=new Map;for(let a=c;a<=h;a++)x.set(e[a],a);let p=l-c+1,b=new Int32Array(p);b.fill(-1);for(let a=c;a<=l;a++){let T=x.get(r[a]);T!==void 0&&(x.delete(r[a]),d[a]=i[T],s[a]=o[T],b[a-c]=T)}for(let[,a]of x)o[a]?.(),i[a]&&W(i[a]),i[a]?.parentNode&&i[a].parentNode.removeChild(i[a]);let _=p-$t(b,p),w=new Uint8Array(p);if(_>1){let a=new Int32Array(_),T=new Int32Array(_),L=0;for(let S=0;S<p;S++)b[S]!==-1&&(a[L]=b[S],T[L]=S,L++);let O=Ct(a,_);for(let S=0;S<O.length;S++)w[T[O[S]]]=1}else if(_===1){for(let a=0;a<p;a++)if(b[a]!==-1){w[a]=1;break}}for(let a=c;a<=l;a++)if(!d[a]){let T=r[a],L=a;d[a]=q(O=>(s[L]=O,y(T,L)))}let u=l+1<d.length&&d[l+1]?d[l+1]:n;for(let a=l;a>=c;a--){let T=a-c;(b[T]===-1||!w[T])&&(u&&u.parentNode!==t&&(u=n),t.insertBefore(d[a],u)),u=d[a]}}function $t(t,n){let e=0;for(let r=0;r<n;r++)t[r]===-1&&e++;return e}function Ct(t,n){if(n===0)return[];if(n===1)return[0];let e=new Int32Array(n),r=new Int32Array(n),i=1;e[0]=0,r[0]=-1;for(let c=1;c<n;c++)if(t[c]>t[e[i-1]])r[c]=e[i-1],e[i++]=c;else{let h=0,l=i-1;for(;h<l;){let d=h+l>>1;t[e[d]]<t[c]?h=d+1:l=d}e[h]=c,r[c]=h>0?e[h-1]:-1}let o=new Array(i),y=e[i-1];for(let c=i-1;c>=0;c--)o[c]=y,y=r[y];return o}function Dt(){return document.createComment("i")}function z(t,n,e,r){let i=n;for(;i&&i!==e;){let o=i.nextSibling;t.insertBefore(i,r),i=o}}function ct(t,n,e){let r=n;for(;r&&r!==e;){let i=r.nextSibling;W(r),t.removeChild(r),r=i}}function lt(t,n,e,r,i,o,y,c,h){let l;if(i){let x=r(n),p=h(n);l=p,i.set(x,{itemSig:p})}else l=n;let d=Dt();t.appendChild(d);let s=q(x=>(c[e]=x,o(l,e)));t.appendChild(s),y[e]=d}function Nt(t,n,e,r,i,o,y,c,h){let l=r.length,d=e.length;if(l===0){if(d>0){for(let f=0;f<d;f++)o[f]&&o[f]();i[0]&&ct(t,i[0],n),i.length=0,o.length=0,h&&h.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<l;C++)lt(f,r[C],C,c,h,y,i,o,tt);t.insertBefore(f,n);return}let s=0,x=Math.min(d,l);for(;s<x;){if(e[s]===r[s]){s++;continue}let f=c(e[s]),C=c(r[s]);if(f!==C)break;h&&h.get(f).itemSig.set(r[s]),s++}let p=d-1,b=l-1;for(;p>=s&&b>=s;){if(e[p]===r[b]){p--,b--;continue}let f=c(e[p]),C=c(r[b]);if(f!==C)break;h&&h.get(f).itemSig.set(r[b]),p--,b--}if(s>p&&s>b)return;let _=new Array(l),w=new Array(l);for(let f=0;f<s;f++)_[f]=i[f],w[f]=o[f];for(let f=b+1;f<l;f++){let C=p+1+(f-b-1);_[f]=i[C],w[f]=o[C]}let u=b-s+1,a=p-s+1;if(a===0){let f=b+1<l&&_[b+1]?_[b+1]:n,C=document.createDocumentFragment();for(let E=s;E<=b;E++)lt(C,r[E],E,c,h,y,_,w,tt);t.insertBefore(C,f),X(i,o,_,w,l);return}if(u===0){for(let f=s;f<=p;f++){o[f]?.();let C=G(t,i[f],i,f,n);ct(t,i[f],C),h&&h.delete(c(e[f]))}X(i,o,_,w,l);return}if(u===a&&u>=2&&u<=Math.max(a,200)){let f=0,C=-1,E=-1;for(let m=0;m<u&&f<=4;m++){let A=c(e[s+m]),N=c(r[s+m]);A!==N&&(f===0?C=m:f===1&&(E=m),f++)}if(f===2){let m=s+C,A=s+E,N=c(e[m]),K=c(e[A]),U=c(r[m]),v=c(r[A]);if(N===v&&K===U){for(let g=0;g<s;g++)_[g]=i[g],w[g]=o[g];for(let g=s;g<=b;g++)_[g]=i[g],w[g]=o[g];for(let g=b+1;g<l;g++){let $=p+1+(g-b-1);_[g]=i[$],w[g]=o[$]}let P=_[m];_[m]=_[A],_[A]=P;let B=w[m];if(w[m]=w[A],w[A]=B,h){if(r[m]!==e[m]){let g=c(r[m]),$=h.get(g);$&&$.itemSig.set(r[m])}if(r[A]!==e[A]){let g=c(r[A]),$=h.get(g);$&&$.itemSig.set(r[A])}}let j=A===m+1||m===A+1,H=Math.min(m,A),M=Math.max(m,A);if(j){let g=G(t,i[M],i,M,n);z(t,i[M],g,i[H])}else{let g=G(t,i[A],i,A,n),$=document.createComment("tmp");t.insertBefore($,i[A]),z(t,i[A],g,i[m]);let F=G(t,i[m],i,m,n);z(t,i[m],F,$),t.removeChild($)}X(i,o,_,w,l);return}}if(f>=2&&f<=u){let m=C,A=null,N=-1,K=-1,U=!1,v=c(e[s+m]),P=-1;for(let B=m;B<u;B++)if(c(r[s+B])===v){P=B;break}if(P>m){let B=!0;for(let j=m;j<P;j++)if(c(e[s+j+1])!==c(r[s+j])){B=!1;break}if(B){let j=!0;for(let H=P+1;H<u;H++)if(c(e[s+H])!==c(r[s+H])){j=!1;break}j&&(U=!0,N=s+m,K=s+P,A=v)}}if(!U){let B=c(r[s+m]),j=-1;for(let H=m;H<a;H++)if(c(e[s+H])===B){j=H;break}if(j>m){let H=!0;for(let M=m;M<j;M++)if(c(e[s+M])!==c(r[s+M+1])){H=!1;break}if(H){let M=!0;for(let g=j+1;g<u;g++)if(c(e[s+g])!==c(r[s+g])){M=!1;break}M&&(U=!0,N=s+j,K=s+m,A=B)}}}if(U){for(let g=s;g<=p;g++)_[g]=i[g],w[g]=o[g];let B=_[N],j=w[N];if(N<K)for(let g=N;g<K;g++)_[g]=_[g+1],w[g]=w[g+1];else for(let g=N;g>K;g--)_[g]=_[g-1],w[g]=w[g-1];if(_[K]=B,w[K]=j,h)for(let g=s;g<=b;g++){let $=c(r[g]);if(r[g]!==e[g]){let F=h.get($);F&&F.itemSig.set(r[g])}}let H=G(t,B,i,N,n),M;K+1<l?M=_[K+1]:M=n,(K>=b+1||M&&M.parentNode!==t)&&(M=n),z(t,B,H,M),X(i,o,_,w,l);return}}}let T=new Map;for(let f=s;f<=p;f++)T.set(c(e[f]),f);let L=new Int32Array(u);L.fill(-1);for(let f=s;f<=b;f++){let C=c(r[f]),E=T.get(C);E!==void 0&&(T.delete(C),_[f]=i[E],w[f]=o[E],L[f-s]=E,h&&r[f]!==e[E]&&h.get(C).itemSig.set(r[f]))}let O=[...T.values()].sort((f,C)=>C-f);for(let f of O){o[f]?.();let C=G(t,i[f],i,f,n);ct(t,i[f],C),h&&h.delete(c(e[f]))}for(let f=s;f<=b;f++)if(!_[f]){let C=document.createDocumentFragment();lt(C,r[f],f,c,h,y,_,w,tt),_[f]._frag=C}let S=0,at=!0,ht=-1;for(let f=0;f<u;f++)L[f]!==-1&&(S++,L[f]<=ht&&(at=!1),ht=L[f]);let k=new Uint8Array(u);if(at)for(let f=0;f<u;f++)L[f]!==-1&&(k[f]=1);else if(S>1){let f=new Int32Array(S),C=new Int32Array(S),E=0;for(let A=0;A<u;A++)L[A]!==-1&&(f[E]=L[A],C[E]=A,E++);let m=Ct(f,S);for(let A=0;A<m.length;A++)k[C[m[A]]]=1}else if(S===1){for(let f=0;f<u;f++)if(L[f]!==-1){k[f]=1;break}}X(i,o,_,w,l);let it=b+1<l&&i[b+1]?i[b+1]:n;for(let f=b;f>=s;f--){let C=f-s,E=i[f];if(L[C]===-1)E._frag&&(t.insertBefore(E._frag,it),delete E._frag);else if(!k[C]){let m=G(t,E,i,f,n);z(t,E,m,it)}it=E}}function G(t,n,e,r,i){let o=n.nextSibling;for(;o&&o!==i;){if(o.nodeType===8&&o.data==="i")return o;o=o.nextSibling}return i}function X(t,n,e,r,i){t.length=i,n.length=i;for(let o=0;o<i;o++)t[o]=e[o],n[o]=r[o]}function kt(t,n){for(let e in n){let r=n[e];if(e.startsWith("on")&&e.length>2){let i=e.slice(2).toLowerCase();t.addEventListener(i,r);continue}if(typeof r=="function"&&!e.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}e==="class"||e==="className"?t._propEffects[e]=D(()=>{let i=r()||"";nt&&t instanceof SVGElement?t.setAttribute("class",i):t.className=i}):e==="style"&&typeof r()=="object"?t._propEffects[e]=D(()=>{rt(t,r())}):t._propEffects[e]=D(()=>{Y(t,e,r())})}else Y(t,e,r)}}function Y(t,n,e){if(n==="ref"){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t);return}if(n==="key")return;if(typeof e=="function"&&!n.startsWith("on")){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=D(()=>Y(t,n,e()));return}if((dt.has(n)||dt.has(n.toLowerCase()))&&!At(e)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${e}`);return}let r=nt&&t instanceof SVGElement;if(n==="class"||n==="className")r?t.setAttribute("class",e||""):t.className=e||"";else if(n==="dangerouslySetInnerHTML"){let i=e?.__html??"";typeof R<"u"&&R&&typeof i=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(i)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=i}else if(n==="innerHTML")if(e&&typeof e=="object"&&"__html"in e){let i=e.__html??"";typeof R<"u"&&R&&typeof i=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(i)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=i}else typeof console<"u"&&e!=null&&e!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else n==="style"?rt(t,e):n.startsWith("data-")||n.startsWith("aria-")?t.setAttribute(n,e):typeof e=="boolean"?e?t.setAttribute(n,""):t.removeAttribute(n):r?t.setAttribute(n,e):n==="value"&&t.tagName==="SELECT"?ft(t,e):n in t?t[n]=e:t.setAttribute(n,e)}function I(t,n,e,r){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}t._propEffects[n]=D(()=>r(t,e()))}function Kt(t,n){if(typeof n=="function")return I(t,"class",n,Kt);nt&&t instanceof SVGElement?t.setAttribute("class",n||""):t.className=n||""}function rt(t,n){if(typeof n=="function")return I(t,"style",n,rt);if(typeof n=="string")t.style.cssText=n,t._lastStyleObj=null;else if(n&&typeof n=="object"){let e=t.style,r=t._lastStyleObj;if(r)for(let i in r)i in n||(e[i]="");for(let i in n)e[i]=n[i]??"";t._lastStyleObj=n}else n==null&&(t.style.cssText="",t._lastStyleObj=null)}function Ot(t,n,e){if(typeof e=="function")return I(t,n,e,(r,i)=>Ot(r,n,i));e==null?t.removeAttribute(n):t.setAttribute(n,e)}function Vt(t,n){if(typeof n=="function")return I(t,"value",n,Vt);if(t.tagName==="SELECT"){ft(t,n);return}let e=n==null?"":String(n);t.value!==e&&(t.value=e)}function Wt(t,n){if(typeof n=="function")return I(t,"checked",n,Wt);t.checked=!!n}var mt=new Set;function vt(t){for(let n of t)mt.has(n)||(mt.add(n),document.addEventListener(n,e=>{let r=e.target,i="$$"+n;for(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return r||document}});r;){let o=r[i];if(o&&(o(e),e.cancelBubble))return;r=r.parentNode}}))}function Ft(t,n,e){return t.addEventListener(n,e),()=>t.removeEventListener(n,e)}function te(t,n){D(()=>{for(let e in n){let r=typeof n[e]=="function"?n[e]():n[e];t.classList.toggle(e,!!r)}})}var et=!1,V=null;function ee(){return et}function ne(t,n){et=!0,V={parent:n,index:0};try{return J(t,n)}finally{et=!1,V=null}}function pt(t){let n=t.childNodes;for(;V.index<n.length;){let e=n[V.index];if(e.nodeType===8){let r=e.textContent;if(r==="$"||r==="/$"||r==="[]"||r==="/[]"){V.index++;continue}}return V.index++,e}return null}function st(){return typeof process<"u"&&!1}function J(t,n){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let r=pt(n),i=String(t);if(r&&r.nodeType===3)return st()&&r.textContent!==i&&(console.warn(`[what] Hydration mismatch: expected text "${i}", got "${r.textContent}"`),r.textContent=i),r;st()&&console.warn(`[what] Hydration mismatch: expected text node "${i}", got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createTextNode(i);return r?n.replaceChild(o,r):n.appendChild(o),o}if(typeof t=="function"){let r=t(),i=J(r,n);return D(()=>{let o=t();et||(i=Q(n,o,i,null))}),i}if(Array.isArray(t)){let r=[];for(let i of t){let o=J(i,n);o&&r.push(o)}return r.length===1?r[0]:r}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let y=gt(),c=t.tag,h=t.props||{},l=t.children||[],d={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:y[y.length-1]||null,_errorBoundary:null};y.push(d);let s;try{let x=l.length===0?void 0:l.length===1?l[0]:l;s=c({...h,children:x})}catch(x){return y.pop(),console.error("[what] Error in component during hydration:",c.name||"Anonymous",x),null}return y.pop(),d.mounted=!0,d._mountCallbacks&&queueMicrotask(()=>{if(!d.disposed)for(let x of d._mountCallbacks)try{x()}catch(p){console.error("[what] onMount error:",p)}}),J(s,n)}let r=pt(n),i=t.tag.toUpperCase();if(r&&r.nodeType===1&&r.nodeName===i){Pt(r,t.props||{});let y=V;if(V={parent:r,index:0},t.props?.dangerouslySetInnerHTML?.__html==null)for(let h of t.children)J(h,r);return V=y,r}st()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createElement(t.tag);for(let y in t.props||{})y==="children"||y==="key"||Y(o,y,t.props[y]);for(let y of t.children)Q(o,y,null,null);return r?n.replaceChild(o,r):n.appendChild(o),o}if(_t(t))return t;let e=document.createTextNode(String(t));return n.appendChild(e),e}function Pt(t,n){for(let e in n){if(e==="children"||e==="key"||e==="ref"||e==="dangerouslySetInnerHTML"||e==="innerHTML")continue;let r=n[e];if(e.startsWith("on")&&e.length>2){let i=e.slice(2).toLowerCase();t.addEventListener(i,r);continue}if(e.startsWith("$$")){t[e]=r;continue}if(typeof r=="function"&&!e.startsWith("on")){e==="class"||e==="className"?D(()=>{t.className=r()||""}):e==="style"&&typeof r()=="object"?D(()=>{rt(t,r())}):D(()=>{Y(t,e,r())});continue}}}export{Zt as a,Jt as b,Et as c,Qt as d,Lt as e,Yt as f,It as g,kt as h,Y as i,Kt as j,rt as k,Ot as l,Vt as m,Wt as n,vt as o,Ft as p,te as q,ee as r,ne as s};