what-core 0.12.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ENARGHSD.min.js +11 -0
- package/dist/chunk-OKM3GKVP.min.js +1 -0
- package/dist/index.min.js +82 -5
- package/dist/render.min.js +1 -1
- package/dist/testing.min.js +1 -1
- package/index.d.ts +40 -3
- package/package.json +1 -1
- package/render.d.ts +7 -0
- package/src/a11y.js +3 -3
- package/src/agent-context.js +1 -1
- package/src/animation.js +5 -6
- package/src/components.js +1 -1
- package/src/data.js +1 -10
- package/src/dom.js +29 -19
- package/src/errors.js +321 -0
- package/src/form.js +2 -1
- package/src/head.js +2 -1
- package/src/hooks.js +10 -17
- package/src/index.js +1 -0
- package/src/reactive.js +31 -14
- package/src/render.js +11 -14
- package/src/scheduler.js +7 -7
- package/src/skeleton.js +16 -1
- package/src/store.js +0 -1
- package/src/testing.js +101 -50
- package/testing.d.ts +17 -1
- package/dist/chunk-M5GDJRVX.min.js +0 -1
- package/dist/chunk-T2SKNKT5.min.js +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{E as Tt,Q as W,R as St,T as Lt,U as it,V as I,X as G,Y as Bt,Z as Q,a as z,aa as Nt,ba as Mt,ca as ht,d as O,f as j,j as At,n as Y,r as wt,z as Et}from"./chunk-OKM3GKVP.min.js";import{a as J}from"./chunk-O3SKPRTY.min.js";var Ht=O(null);typeof document<"u"&&document.addEventListener("focusin",t=>{Ht.set(t.target)});function Te(){return{current:()=>Ht(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function Se(){let t={current:null};function e(r){typeof document>"u"||(t.current=r||document.activeElement||null)}function n(r){let o=t.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:e,restore:n,previous:()=>t.current}}function Qt(t){let e=null;function n(){if(typeof document>"u")return;e=document.activeElement;let o=t.current||t;if(!o||typeof o.querySelectorAll!="function")return;let i=Dt(o);if(i.length===0)return;i[0].focus();function g(f){if(f.key!=="Tab")return;let a=Dt(o),c=a[0],p=a[a.length-1];f.shiftKey?document.activeElement===c&&(f.preventDefault(),p.focus()):document.activeElement===p&&(f.preventDefault(),c.focus())}return o.addEventListener("keydown",g),()=>{o.removeEventListener("keydown",g)}}function r(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:r}}function Dt(t){let e=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>n.offsetParent!==null)}function Le({children:t,active:e=!0}){let n={current:null},r=O(0),o=Qt(n),i=null,g=c=>{n.current=c,r.set(p=>p+1)},f=j(()=>{if(r(),i&&(i(),i=null,o.deactivate()),e&&n.current)return i=o.activate(),()=>{i?.(),i=null,o.deactivate()}}),a=Bt?.();return a&&(a._cleanupCallbacks=a._cleanupCallbacks||[],a._cleanupCallbacks.push(()=>{f(),i?.(),i=null,o.deactivate()})),J("div",{ref:g},t)}var U=null,pt=0;function vt(){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
|
+
position: absolute;
|
|
3
|
+
width: 1px;
|
|
4
|
+
height: 1px;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: -1px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
clip: rect(0, 0, 0, 0);
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
border: 0;
|
|
11
|
+
`,document.body.appendChild(U)),U)}function Ft(t,e={}){let{priority:n="polite",timeout:r=1e3}=e,o=vt();if(!o)return;o.setAttribute("aria-live",n);let i=++pt;o.textContent="",requestAnimationFrame(()=>{pt===i&&(o.textContent=t)}),setTimeout(()=>{pt===i&&(o.textContent="")},r)}function Be(t){return Ft(t,{priority:"assertive"})}function Ne({href:t="#main",children:e="Skip to content"}){return J("a",{href:t,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(t);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},e)}function gt(t){return t?"true":"false"}function Me(t=!1){let e=O(t);return{expanded:()=>e(),toggle:()=>e.set(!e.peek()),open:()=>e.set(!0),close:()=>e.set(!1),buttonProps:()=>({"aria-expanded":()=>gt(e()),onClick:()=>e.set(!e.peek())}),panelProps:()=>({hidden:()=>!e()})}}function De(t=null){let e=O(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":()=>gt(e()===n),onClick:()=>e.set(n)})}}function He(t=!1){let e=O(t);return{checked:()=>e(),toggle:()=>e.set(!e.peek()),set:n=>e.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":()=>gt(e()),tabIndex:0,onClick:()=>e.set(!e.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.set(!e.peek()))}})}}function Pe(t,e={}){let n=typeof t=="function"?t:()=>t,r=O(0),o=e?.role||null,i=[],g=[],f=[];function a(h){let s=g[h];return s||(s={get current(){return i[h]||null},set current(d){i[h]=d||null;let x=f[h];typeof x=="function"?x(d):x&&typeof x=="object"&&(x.current=d)}},g[h]=s),s}function c(h){let s=i[h];return s?s.isConnected===!1?null:s:null}function p(h){let s=c(h);return!s||typeof s.focus!="function"?null:((typeof document>"u"||document.activeElement!==s)&&s.focus(),s)}function u(){if(typeof document>"u")return!1;let h=document.activeElement;if(!h)return!1;for(let s=0;s<i.length;s++){let d=i[s];if(d&&(d===h||typeof d.contains=="function"&&d.contains(h)))return!0}return!1}function y(h,s){return!(s>0)||h<0?0:h>s-1?s-1:h}function b(){return y(r(),n())}function m(h){return Number.isInteger(h)&&h>=0&&h<n()}function _(h){let s=n();if(s<=0)return;let d=y(r.peek(),s),x=d;switch(h.key){case"ArrowDown":case"ArrowRight":x=(d+1)%s;break;case"ArrowUp":case"ArrowLeft":x=(d-1+s)%s;break;case"Home":x=0;break;case"End":x=s-1;break;default:return}h.preventDefault(),r.set(x),p(x)}return{focusIndex:()=>b(),setFocusIndex:h=>{m(h)&&(r.set(h),u()&&p(h))},focusItem:h=>m(h)?(r.set(h),p(h)):null,getItemProps:(h,s)=>{let{ref:d,...x}=s||{};return f[h]=d||null,{ref:a(h),tabIndex:()=>b()===h?0:-1,onKeyDown:_,onFocus:S=>{let D=S&&(S.currentTarget||S.target);D&&(i[h]=D),r.set(h)},...x}},containerProps:h=>o?{role:o,...h}:{...h}}}function je({children:t,as:e="span"}){return J(e,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},t)}function Ke({children:t,priority:e="polite",atomic:n=!0}){return J("div",{"aria-live":e,"aria-atomic":n},t)}var Pt=0;function jt(){let t=wt();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++Pt}function Kt(){Pt=0}function Rt(t="what"){let e=`${t}-${jt()}`;return()=>e}function Re(t,e="what"){let n=[];for(let r=0;r<t;r++)n.push(`${e}-${jt()}`);return n}function $e(t){let e=Rt("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>J("div",{id:e(),style:{display:"none"}},t)}}function Ie(t){let e=Rt("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Oe={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function Ve(t,e){return n=>{n.key===t&&e(n)}}function ze(t,e){return n=>{t.includes(n.key)&&e(n)}}var et=null;function Ze(t){et=typeof t=="function"?t:null}function Je(t,e,n){if(typeof n=="function"){let r=()=>{let o=n();return o.length===1?o[0]:o};return r._lazyChildren=!0,e||(e={}),Object.defineProperty(e,"_$lazyChildren",{value:r,configurable:!0}),G({tag:t,props:e,children:[],key:null,_vnode:!0})}if(n&&n.length>0){let r=n.length===1?n[0]:n;e?e.children=r:e={children:r}}return G({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var te={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>"}},ee=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 zt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function ne(t){let e=t.trim(),n=zt(e);if(ee.has(n))return re(e);let r=te[n];if(r){let i=document.createElement("template");i.innerHTML=r.wrap+e+r.unwrap;let g=i.content.firstChild;for(let f=0;f<r.depth;f++)g=g.firstChild;return()=>g.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}var $t=!1;function Ye(t){return z&&!$t&&($t=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),ne(t)}function re(t){let e=t.trim();if(zt(e)==="svg"){let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function Gt(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return Gt(t,e(),n);if(typeof e=="function"){let r=n||null,o=null,i=null,g=!1,f=Ct();return j(()=>kt(f,()=>{let a=e(),c=typeof a;if(!g){g=!0,c==="string"||c==="number"?(i=document.createTextNode(String(a)),r?t.insertBefore(i,r):t.appendChild(i),et&&et(t,String(a)),o=i):o=ft(t,a,null,r);return}if(i!==null&&(c==="string"||c==="number")){let p=String(a);i.data!==p&&(i.data=p),et&&et(t,p);return}i=null,o=ft(t,a,o,r)})),o}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n?t.insertBefore(r,n):t.appendChild(r),r}return e!=null&&typeof e=="object"&&e.nodeType>0?(n?t.insertBefore(e,n):t.appendChild(e),e):ft(t,e,null,n||null)}function Ut(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function oe(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var lt=typeof SVGElement<"u";function _t(t){return lt&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function Ct(){let t=Q();return t[t.length-1]||null}function kt(t,e){let n=Q(),r=t!==null&&n[n.length-1]!==t;r&&n.push(t);try{return e()}finally{r&&n.pop()}}function It(t){return t==null?[]:Array.isArray(t)?t:[t]}function qt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let r=0;r<t.length;r++)qt(t[r],e,n);return n}if(typeof t=="function"){let r=G(t,e,_t(e));if(r&&r.nodeType===11){let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}else r&&n.push(r);return n}if(typeof t=="string"||typeof t=="number")return n.push(document.createTextNode(String(t))),n;if(Ut(t)){if(t.nodeType===11&&t.childNodes.length>0){let r=Array.from(t.childNodes);for(let o=0;o<r.length;o++)n.push(r[o])}else n.push(t);return n}if(oe(t)){let r=G(t,e,_t(e));if(r&&r.nodeType===11)if(r.childNodes.length===0)n.push(r);else{let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}else r&&n.push(r);return n}return n.push(document.createTextNode(String(t))),n}function ie(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function ft(t,e,n,r){if(!t||typeof t.insertBefore!="function")return z&&console.warn("[what] reconcileInsert called with invalid parent:",t),n;let o=r||null;if(e==null||typeof e=="boolean"){let c=It(n);for(let p=0;p<c.length;p++){let u=c[p];u.parentNode===t&&(I(u),t.removeChild(u))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let c=String(e);return n.data!==c&&(n.data=c),n}if(typeof e=="object"&&e!==null&&e.nodeType>0&&e.nodeType!==11&&!Array.isArray(e)){if(e===n)return n;if(n&&!Array.isArray(n)&&n.nodeType>0&&n.nodeType!==11)return n.parentNode===t?(I(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let i=qt(e,t,[]),g=It(n);if(ie(g,i))return n;let f=i.length;for(let c=0;c<g.length;c++){let p=g[c];if(p.parentNode!==t)continue;let u=!1;for(let y=0;y<f;y++)if(i[y]===p){u=!0;break}u||(I(p),t.removeChild(p))}let a=o;for(let c=i.length-1;c>=0;c--){let p=i[c];(p.parentNode!==t||p.nextSibling!==a)&&(a&&a.parentNode!==t&&(a=null),a?t.insertBefore(p,a):t.appendChild(p)),a=p}return i.length===0?null:i.length===1?i[0]:i}function Qe(t,e,n){let r=n?.key,o=n?.raw||!1,i=(g,f)=>{let a=[],c=[],p=[],u=r&&!o?new Map:null,y=document.createComment("/list");return g.insertBefore(y,f||null),j(()=>{let b=t()||[],m=y.parentNode||g;r?ue(m,y,a,b,c,p,e,r,u):fe(m,y,a,b,c,p,e),a=b.length>0?b.slice():b}),y};return i._mapArray=!0,i._mapArraySource=t,i._mapArrayFn=e,i._mapArrayKeyed=!!r&&!o,i}function ve(t){let e=t._mapArraySource()||[],n=t._mapArrayFn,r=t._mapArrayKeyed;return e.map((o,i)=>n(r?()=>o:o,i))}function fe(t,e,n,r,o,i,g){let f=r.length,a=n.length;if(f===0){if(a>0){for(let s=0;s<a;s++)i[s]&&i[s]();for(let s=a-1;s>=0;s--){let d=o[s];d&&(I(d),d.parentNode===t&&t.removeChild(d))}o.length=0,i.length=0}return}if(a===0){let s=document.createDocumentFragment();for(let d=0;d<f;d++){let x=r[d],S=Y(D=>(i[d]=D,g(x,d)));o[d]=S,s.appendChild(S)}t.insertBefore(s,e);return}let c=0,p=Math.min(a,f);for(;c<p&&n[c]===r[c];)c++;if(c===a&&c===f)return;let u=a-1,y=f-1;for(;u>=c&&y>=c&&n[u]===r[y];)u--,y--;let b=new Array(f),m=new Array(f);for(let s=0;s<c;s++)b[s]=o[s],m[s]=i[s];for(let s=y+1;s<f;s++){let d=u+1+(s-y-1);b[s]=o[d],m[s]=i[d]}let _=y-c+1,h=u-c+1;if(_===0)for(let s=c;s<=u;s++)i[s]?.(),o[s]&&I(o[s]),o[s]?.parentNode&&o[s].parentNode.removeChild(o[s]);else if(h===0){let s=c<f&&b[y+1]?b[y+1]:e,d=document.createDocumentFragment();for(let x=c;x<=y;x++){let S=r[x],D=x;b[x]=Y(B=>(m[D]=B,g(S,D))),d.appendChild(b[x])}t.insertBefore(d,s)}else ce(t,e,n,r,o,i,g,c,u,y,b,m);o.length=f,i.length=f;for(let s=0;s<f;s++)o[s]=b[s],i[s]=m[s]}function ce(t,e,n,r,o,i,g,f,a,c,p,u){let y=new Map;for(let d=f;d<=a;d++)y.set(n[d],d);let b=c-f+1,m=new Int32Array(b);m.fill(-1);for(let d=f;d<=c;d++){let x=y.get(r[d]);x!==void 0&&(y.delete(r[d]),p[d]=o[x],u[d]=i[x],m[d-f]=x)}for(let[,d]of y)i[d]?.(),o[d]&&I(o[d]),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);let _=b-se(m,b),h=new Uint8Array(b);if(_>1){let d=new Int32Array(_),x=new Int32Array(_),S=0;for(let B=0;B<b;B++)m[B]!==-1&&(d[S]=m[B],x[S]=B,S++);let D=Wt(d,_);for(let B=0;B<D.length;B++)h[x[D[B]]]=1}else if(_===1){for(let d=0;d<b;d++)if(m[d]!==-1){h[d]=1;break}}for(let d=f;d<=c;d++)if(!p[d]){let x=r[d],S=d;p[d]=Y(D=>(u[S]=D,g(x,S)))}let s=c+1<p.length&&p[c+1]?p[c+1]:e;for(let d=c;d>=f;d--){let x=d-f;(m[x]===-1||!h[x])&&(s&&s.parentNode!==t&&(s=e),t.insertBefore(p[d],s)),s=p[d]}}function se(t,e){let n=0;for(let r=0;r<e;r++)t[r]===-1&&n++;return n}function Wt(t,e){if(e===0)return[];if(e===1)return[0];let n=new Int32Array(e),r=new Int32Array(e),o=1;n[0]=0,r[0]=-1;for(let f=1;f<e;f++)if(t[f]>t[n[o-1]])r[f]=n[o-1],n[o++]=f;else{let a=0,c=o-1;for(;a<c;){let p=a+c>>1;t[n[p]]<t[f]?a=p+1:c=p}n[a]=f,r[f]=a>0?n[a-1]:-1}let i=new Array(o),g=n[o-1];for(let f=o-1;f>=0;f--)i[f]=g,g=r[g];return i}function le(){return document.createComment("i")}function v(t,e,n,r){let o=e;for(;o&&o!==n;){let i=o.nextSibling;t.insertBefore(o,r),o=i}}function yt(t,e,n){let r=e;for(;r&&r!==n;){let o=r.nextSibling;I(r),t.removeChild(r),r=o}}function mt(t,e,n,r,o,i,g,f,a){let c;if(o){let y=r(e),b=a(e);c=b,o.set(y,{itemSig:b})}else c=e;let p=le();t.appendChild(p);let u=Y(y=>(f[n]=y,i(c,n)));t.appendChild(u),g[n]=p}function ue(t,e,n,r,o,i,g,f,a){let c=r.length,p=n.length;if(c===0){if(p>0){for(let l=0;l<p;l++)i[l]&&i[l]();o[0]&&yt(t,o[0],e),o.length=0,i.length=0,a&&a.clear()}return}if(p===0){let l=document.createDocumentFragment();for(let E=0;E<c;E++)mt(l,r[E],E,f,a,g,o,i,O);t.insertBefore(l,e);return}let u=0,y=Math.min(p,c);for(;u<y;){if(n[u]===r[u]){u++;continue}let l=f(n[u]),E=f(r[u]);if(l!==E)break;a&&a.get(l).itemSig.set(r[u]),u++}let b=p-1,m=c-1;for(;b>=u&&m>=u;){if(n[b]===r[m]){b--,m--;continue}let l=f(n[b]),E=f(r[m]);if(l!==E)break;a&&a.get(l).itemSig.set(r[m]),b--,m--}if(u>b&&u>m)return;let _=new Array(c),h=new Array(c);for(let l=0;l<u;l++)_[l]=o[l],h[l]=i[l];for(let l=m+1;l<c;l++){let E=b+1+(l-m-1);_[l]=o[E],h[l]=i[E]}let s=m-u+1,d=b-u+1;if(d===0){let l=m+1<c&&_[m+1]?_[m+1]:e,E=document.createDocumentFragment();for(let N=u;N<=m;N++)mt(E,r[N],N,f,a,g,_,h,O);t.insertBefore(E,l),F(o,i,_,h,c);return}if(s===0){for(let l=u;l<=b;l++){i[l]?.();let E=X(t,o[l],o,l,e);yt(t,o[l],E),a&&a.delete(f(n[l]))}F(o,i,_,h,c);return}if(s===d&&s>=2&&s<=Math.max(d,200)){let l=0,E=-1,N=-1;for(let A=0;A<s&&l<=4;A++){let w=f(n[u+A]),$=f(r[u+A]);w!==$&&(l===0?E=A:l===1&&(N=A),l++)}if(l===2){let A=u+E,w=u+N,$=f(n[A]),Z=f(n[w]),dt=f(r[A]),q=f(r[w]);if($===q&&Z===dt){for(let L=0;L<u;L++)_[L]=o[L],h[L]=i[L];for(let L=u;L<=m;L++)_[L]=o[L],h[L]=i[L];for(let L=m+1;L<c;L++){let R=b+1+(L-m-1);_[L]=o[R],h[L]=i[R]}let K=_[A];_[A]=_[w],_[w]=K;let M=h[A];if(h[A]=h[w],h[w]=M,a){if(r[A]!==n[A]){let L=f(r[A]),R=a.get(L);R&&R.itemSig.set(r[A])}if(r[w]!==n[w]){let L=f(r[w]),R=a.get(L);R&&R.itemSig.set(r[w])}}let H=w===A+1||A===w+1,P=Math.min(A,w),T=Math.max(A,w);if(H){let L=X(t,o[T],o,T,e);v(t,o[T],L,o[P])}else{let L=X(t,o[w],o,w,e),R=document.createComment("tmp");t.insertBefore(R,o[w]),v(t,o[w],L,o[A]);let Yt=X(t,o[A],o,A,e);v(t,o[A],Yt,R),t.removeChild(R)}F(o,i,_,h,c);return}}if(l>=2&&l<=s){let A=E,w=-1,$=-1,Z=!1,dt=f(n[u+A]),q=-1;for(let K=A;K<s;K++)if(f(r[u+K])===dt){q=K;break}if(q>A){let K=!0;for(let M=A;M<q;M++)if(f(n[u+M+1])!==f(r[u+M])){K=!1;break}if(K){let M=!0;for(let H=q+1;H<s;H++)if(f(n[u+H])!==f(r[u+H])){M=!1;break}M&&(Z=!0,w=u+A,$=u+q)}}if(!Z){let K=f(r[u+A]),M=-1;for(let H=A;H<d;H++)if(f(n[u+H])===K){M=H;break}if(M>A){let H=!0;for(let P=A;P<M;P++)if(f(n[u+P])!==f(r[u+P+1])){H=!1;break}if(H){let P=!0;for(let T=M+1;T<s;T++)if(f(n[u+T])!==f(r[u+T])){P=!1;break}P&&(Z=!0,w=u+M,$=u+A)}}}if(Z){for(let T=u;T<=b;T++)_[T]=o[T],h[T]=i[T];let K=_[w],M=h[w];if(w<$)for(let T=w;T<$;T++)_[T]=_[T+1],h[T]=h[T+1];else for(let T=w;T>$;T--)_[T]=_[T-1],h[T]=h[T-1];if(_[$]=K,h[$]=M,a)for(let T=u;T<=m;T++){let L=f(r[T]);if(r[T]!==n[T]){let R=a.get(L);R&&R.itemSig.set(r[T])}}let H=X(t,K,o,w,e),P;$+1<c?P=_[$+1]:P=e,($>=m+1||P&&P.parentNode!==t)&&(P=e),v(t,K,H,P),F(o,i,_,h,c);return}}}let x=new Map;for(let l=u;l<=b;l++)x.set(f(n[l]),l);let S=new Int32Array(s);S.fill(-1);for(let l=u;l<=m;l++){let E=f(r[l]),N=x.get(E);N!==void 0&&(x.delete(E),_[l]=o[N],h[l]=i[N],S[l-u]=N,a&&r[l]!==n[N]&&a.get(E).itemSig.set(r[l]))}let D=[...x.values()].sort((l,E)=>E-l);for(let l of D){i[l]?.();let E=X(t,o[l],o,l,e);yt(t,o[l],E),a&&a.delete(f(n[l]))}for(let l=u;l<=m;l++)if(!_[l]){let E=document.createDocumentFragment();mt(E,r[l],l,f,a,g,_,h,O),_[l]._frag=E}let B=0,rt=!0,ot=-1;for(let l=0;l<s;l++)S[l]!==-1&&(B++,S[l]<=ot&&(rt=!1),ot=S[l]);let V=new Uint8Array(s);if(rt)for(let l=0;l<s;l++)S[l]!==-1&&(V[l]=1);else if(B>1){let l=new Int32Array(B),E=new Int32Array(B),N=0;for(let w=0;w<s;w++)S[w]!==-1&&(l[N]=S[w],E[N]=w,N++);let A=Wt(l,B);for(let w=0;w<A.length;w++)V[E[A[w]]]=1}else if(B===1){for(let l=0;l<s;l++)if(S[l]!==-1){V[l]=1;break}}F(o,i,_,h,c);let at=m+1<c&&o[m+1]?o[m+1]:e;for(let l=m;l>=u;l--){let E=l-u,N=o[l];if(S[E]===-1)N._frag&&(t.insertBefore(N._frag,at),delete N._frag);else if(!V[E]){let A=X(t,N,o,l,e);v(t,N,A,at)}at=N}}function X(t,e,n,r,o){let i=e.nextSibling;for(;i&&i!==o;){if(i.nodeType===8&&i.data==="i")return i;i=i.nextSibling}return o}function F(t,e,n,r,o){t.length=o,e.length=o;for(let i=0;i<o;i++)t[i]=n[i],e[i]=r[i]}function Fe(t,e){for(let n in e){let r=e[n];if(n==="ref"){typeof r=="function"?r(t):r&&typeof r=="object"&&(r.current=t);continue}if(W(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(typeof r=="function"&&!W(n)){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}n==="class"||n==="className"?t._propEffects[n]=j(()=>{let o=r()||"";lt&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof r()=="object"?t._propEffects[n]=j(()=>{ut(t,r())}):t._propEffects[n]=j(()=>{ct(t,n,r())})}else ct(t,n,r)}}function ct(t,e,n){if(e==="ref"){typeof n=="function"?n(t):n&&typeof n=="object"&&(n.current=t);return}if(e==="key")return;if(typeof n=="function"&&!W(e)){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>ct(t,e,n()));return}if(W(e))return;if(St(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let r=lt&&t instanceof SVGElement;if(e==="class"||e==="className")r?t.setAttribute("class",n||""):t.className=n||"";else if(e==="dangerouslySetInnerHTML"){let o=n?.__html??"";typeof z<"u"&&z&&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(e==="innerHTML")if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";typeof z<"u"&&z&&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"&&n!=null&&n!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(e==="style")ut(t,n);else if(n==null){if(e in t)try{t[e]=""}catch{}t.removeAttribute(e)}else e.startsWith("data-")||e.startsWith("aria-")?t.setAttribute(e,n):typeof n=="boolean"?n?t.setAttribute(e,""):t.removeAttribute(e):r?t.setAttribute(e,n):e==="value"&&t.tagName==="SELECT"?ht(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function nt(t,e,n,r){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>r(t,n()))}function ae(t,e){if(typeof e=="function")return nt(t,"class",e,ae);lt&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function ut(t,e){if(typeof e=="function")return nt(t,"style",e,ut);if(typeof e=="string")t.style.cssText=e,t._lastStyleObj=null;else if(e&&typeof e=="object"){let n=t.style,r=t._lastStyleObj;if(r)for(let o in r)o in e||(n[o]="");for(let o in e)n[o]=e[o]??"";t._lastStyleObj=e}else e==null&&(t.style.cssText="",t._lastStyleObj=null)}function de(t,e,n){if(typeof n=="function")return nt(t,e,n,(r,o)=>de(r,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function he(t,e){if(typeof e=="function")return nt(t,"value",e,he);if(t.tagName==="SELECT"){ht(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function pe(t,e){if(typeof e=="function")return nt(t,"checked",e,pe);t.checked=!!e}var Ot=new Set;function tn(t){for(let e of t)Ot.has(e)||(Ot.add(e),document.addEventListener(e,n=>{let r=n.target,o="$$"+e;for(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return r||document}});r;){let i=r[o];if(i&&(i(n),n.cancelBubble))return;r=r.parentNode}}))}function en(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function nn(t,e){j(()=>{for(let n in e){let r=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!r)}})}var st=!1,C=null;function rn(){return st}function ge(t,e){st=!0,Kt(),C={parent:e,index:0};try{let n=k(t,e);return e!==document.body&&e!==document.documentElement&&Xt(e),n}finally{st=!1,C=null}}function Xt(t){if(!(!C||C.parent!==t))for(;t.childNodes.length>C.index;){let e=t.lastChild;I(e),t.removeChild(e)}}var ye=new Set(["$","/$","[]","/[]","fn","/fn","eb:start","eb:end","sb:start","sb:end","portal","portal:empty"]);function Zt(t){return t.nodeType===8&&ye.has(t.textContent)}function bt(t){let e=t.childNodes;for(;C.index<e.length;){let n=e[C.index];if(Zt(n)){C.index++;continue}return C.index++,n}return null}function Jt(t){if(!C||C.parent!==t)return null;let e=t.childNodes;for(let n=C.index;n<e.length;n++){let r=e[n];if(!Zt(r))return r}return null}function tt(t,e){return C&&C.parent===t?(t.insertBefore(e,t.childNodes[C.index]||null),C.index++):t.appendChild(e),e}function xt(){return z}function k(t,e){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let n=String(t);if(n===""){let i=Jt(e);return i&&i.nodeType===3?(bt(e),i.textContent="",i):tt(e,document.createTextNode(""))}let r=bt(e);if(r&&r.nodeType===3)return r.textContent!==n&&(xt()&&console.warn(`[what] Hydration mismatch: expected text "${n}", got "${r.textContent}"`),r.textContent=n),r;xt()&&console.warn(`[what] Hydration mismatch: expected text node "${n}", got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createTextNode(n);return r?e.replaceChild(o,r):tt(e,o),o}if(typeof t=="function"&&t._lazyChildren)return k(t(),e);if(typeof t=="function"&&t._mapArray){let n=!!(C&&C.parent===e),r=n&&e.childNodes[C.index]||null,o=t(e,r);if(n){let i=Array.prototype.indexOf.call(e.childNodes,o);i>=0&&(C.index=i+1)}return o}if(typeof t=="function"){let n=!!(C&&C.parent===e),r=document.createComment("fn"),o=document.createComment("/fn");n?(e.insertBefore(r,e.childNodes[C.index]||null),C.index++):e.appendChild(r),k(t(),e),n?(e.insertBefore(o,e.childNodes[C.index]||null),C.index++):e.appendChild(o);let i=[];for(let u=r.nextSibling;u&&u!==o;u=u.nextSibling)i.push(u);let g=i.length===0?null:i.length===1?i[0]:i,f=Ct(),a=j(()=>kt(f,()=>{let u=t();st||(g=ft(o.parentNode||e,u,g,o))})),c=!1,p=()=>{c||(c=!0,a())};return r._dispose=p,o._dispose=p,Lt(r,p),g}if(Array.isArray(t)){let n=[];for(let r of t){let o=k(r,e);o&&n.push(o)}return n.length===1?n[0]:n}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let i=Q(),g=t.tag,f=t.props||{},a=t.children||[],c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:g,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(c);let p,u=null;try{let y={...f};f._$lazyChildren?u=Nt(g,y,f._$lazyChildren):y.children=a.length===0?f.children:a.length===1?a[0]:a,p=g(y),u&&u()}catch(y){return i.pop(),!Mt(y)&&!(y&&typeof y.then=="function"&&me(y,c))&&!Et(y,c)&&console.error("[what] Error in component during hydration:",g.name||"Anonymous",y),null}c.mounted=!0,c._mountCallbacks&&queueMicrotask(()=>{if(!c.disposed)for(let y of c._mountCallbacks)try{y()}catch(b){console.error("[what] onMount error:",b)}});try{let y=k(p,e),b=typeof p=="function"||Array.isArray(p)&&p.some(h=>typeof h=="function"),m=Array.isArray(y)?y[0]:y,_=!b&&m&&m.nodeType?m:e;return it(_,c),y}finally{i.pop()}}if(t.tag==="__errorBoundary"){let{errorState:i,fallback:g,reset:f,handleError:a}=t.props;return Vt(t,e,{startText:"eb:start",endText:"eb:end",ctxExtras:{_errorBoundary:a},state:i,contentFor:c=>c?typeof g=="function"?g({error:c,reset:f}):g:t.children||[]})}if(t.tag==="__suspense"){let{boundary:i,fallback:g,loading:f}=t.props;return Vt(t,e,{startText:"sb:start",endText:"sb:end",ctxExtras:{_suspenseBoundary:i},state:f,contentFor:a=>a?g:t.children||[]})}if(t.tag==="__portal"){let i=G(t,e);return i?tt(e,i):null}let n=bt(e),r=t.tag.toLowerCase();if(n&&n.nodeType===1&&n.nodeName.toLowerCase()===r){_e(n,t.props||{});let i=C;if(C={parent:n,index:0},t.props?.dangerouslySetInnerHTML?.__html==null){for(let f of t.children)k(f,n);t.children.length>0&&Xt(n)}return C=i,n}xt()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${n?n.nodeName:"nothing"}. Falling back to client render.`);let o=G(t,e,_t(e));return n?e.replaceChild(o,n):tt(e,o),o}return Ut(t)?t:tt(e,document.createTextNode(String(t)))}function me(t,e){for(let n=e;n;n=n._parentCtx)if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(t),!0;return!1}function be(t,e){return typeof t=="string"||typeof t=="number"?e.nodeType!==3:t&&t._vnode&&typeof t.tag=="string"?e.nodeType!==1||e.nodeName.toLowerCase()!==t.tag.toLowerCase():!1}function xe(t,e,n){if(e<0||!C||C.parent!==t||C.index!==e)return!1;let r=Jt(t);if(!r)return!1;let o=n(),i=Array.isArray(o)?o:[o],g=i.find(f=>f!=null&&typeof f!="boolean");if(g===void 0)return!0;if(be(g,r))return!1;for(let f of i)k(f,t);return!0}function Vt(t,e,{startText:n,endText:r,ctxExtras:o,state:i,contentFor:g}){let f=t.children||[],a=!!(C&&C.parent===e),c=document.createComment(n),p=document.createComment(r),u={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:Ct(),_startComment:c,_endComment:p,...o};a?(e.insertBefore(c,e.childNodes[C.index]||null),C.index++):e.appendChild(c);let y=a?C.index:-1,b=Q();b.push(u);try{for(let x of f)k(x,e)}finally{b.pop()}let m=At(i),_=!m;if(m){b.push(u);try{_=xe(e,y,()=>g(m))}finally{b.pop()}}a?(e.insertBefore(p,e.childNodes[C.index]||null),C.index++):e.appendChild(p);let h=!0,s=0,d=j(()=>{let x=i();if(h&&(h=!1,_&&x===m))return;let S=c.parentNode;if(!S)return;let D=++s;for(;c.nextSibling&&c.nextSibling!==p;){let B=c.nextSibling;I(B),S.removeChild(B)}b.push(u);try{let B=g(x),rt=Array.isArray(B)?B:[B];for(let ot of rt){let V=G(ot,S);if(D!==s){V&&I(V);break}V&&(p.parentNode?p.parentNode.insertBefore(V,p):I(V))}}finally{b.pop()}});if(a&&C&&C.parent===e){let x=Array.prototype.indexOf.call(e.childNodes,p);x>=0&&(C.index=x+1)}return u.effects.push(d),it(c,u),it(p,u),c}function _e(t,e){for(let n in e){if(n==="children"||n==="key"||n==="dangerouslySetInnerHTML"||n==="innerHTML")continue;if(n==="ref"){let o=e.ref;typeof o=="function"?o(t):o&&typeof o=="object"&&(o.current=t);continue}let r=e[n];if(W(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(n.startsWith("$$")){t[n]=r;continue}if(typeof r=="function"&&!W(n)){n==="class"||n==="className"?j(()=>{t.className=r()||""}):n==="style"&&typeof r()=="object"?j(()=>{ut(t,r())}):j(()=>{ct(t,n,r())});continue}}}Tt({hydrate:ge,insert:Gt});export{Te as a,Se as b,Qt as c,Le as d,Ft as e,Be as f,Ne as g,Me as h,De as i,He as j,Pe as k,je as l,Ke as m,Rt as n,Re as o,$e as p,Ie as q,Oe as r,Ve as s,ze as t,Ze as u,Je as v,ne as w,Ye as x,re as y,Gt as z,Qe as A,ve as B,Fe as C,ct as D,ae as E,ut as F,de as G,he as H,pe as I,tn as J,en as K,nn as L,rn as M,ge as N};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as T}from"./chunk-O3SKPRTY.min.js";var a=typeof globalThis<"u"&&typeof globalThis.__WHAT_DEV__=="boolean"?globalThis.__WHAT_DEV__:import.meta&&import.meta.env?!!import.meta.env.DEV:(typeof process<"u"&&process.env,!1),d=null;function Xe(e){a&&(d=e)}var C=null,S=null,E=null,W=!1,B=0,x=[],U=!1,V=Symbol("needs_upstream"),H=null;function A(e,t){let n=e,r=new Set,o=null,s=0;function c(f){a&&W&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;(n===l?n!==0||1/n===1/l:n!==n&&l!==l)||(n=l,o=null,a&&d&&d.onSignalUpdate?.(i),r.size>0&&ie(r))}function i(f){if(arguments.length===0){let l=C;return l!==null&&(l!==o||l._epoch!==s)&&(o=l,s=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>N(()=>f(i())),i._signal=!0,a&&(i._subs=r,r._signalOwner=i,t&&(i._debugName=t)),a&&d&&d.onSignalCreate?.(i),i}function Qe(e){let t,n=!0,r=new Set,o=null,s=0,c=X(()=>{let f=W;a&&(W=!0);try{t=e(),n=!1}finally{a&&(W=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=C;return f!==null&&(f!==o||f._epoch!==s)&&(o=f,s=f._epoch,r.add(f),f.deps.push(r)),n&&ne(c),t}return c._onNotify=()=>{n=!0,o=null,r.size>0&&ie(r)},i._signal=!0,i.peek=()=>(n&&ne(c),t),i}function ne(e){if(H!==null)throw H.push(e),V;let t=[e];H=t;try{for(;t.length>0;){let n=t[t.length-1];if(!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,o=n.deps;for(let s=0;s<o.length;s++){let c=o[s]._owner;c&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let s=n.deps.length;Q(n),n.deps.length!==s&&F(n),t.pop()}catch(s){if(s===V)n._markDirty();else throw s}}}finally{H=null}}function F(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let o=n[r]._owner;if(o){let s=o._level;s>t&&(t=s)}}e._level=t+1}var ve=()=>{};function N(e,t){let n=X(e);n._level=1;let r=C;C=n;try{let s=n.fn();typeof s=="function"&&(n._cleanup=s)}finally{C=r}if(F(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,a&&d&&d.onEffectDispose?.(n),ve;let o=()=>oe(n);return S&&S.disposals.push(o),o}function Ze(e){B++;try{e()}finally{B--,B===0&&Z()}}function X(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return a&&d&&d.onEffectCreate?.(n),n}function Q(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(o){a&&console.warn("[what] Error in effect cleanup:",o)}e._cleanup=null}let r=C;C=null;try{let o=e.fn();typeof o=="function"&&(e._cleanup=o)}catch(o){d?.onError&&d.onError?.(o,{type:"effect",effect:e}),a&&console.warn("[what] Error in stable effect:",o)}finally{C=r}a&&d?.onEffectRun&&d.onEffectRun?.(e);return}let t=e.deps.length===1?e.deps[0]:null;if(se(e),e._cleanup){try{e._cleanup()}catch(r){a&&d?.onError&&d.onError?.(r,{type:"effect-cleanup",effect:e}),a&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=C;C=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===V||a&&d?.onError&&d.onError?.(r,{type:"effect",effect:e}),r}finally{C=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),a&&d?.onEffectRun&&d.onEffectRun?.(e)}function oe(e){if(e.disposed=!0,a&&d&&d.onEffectDispose?.(e),se(e),e._cleanup){try{e._cleanup()}catch(t){a&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function se(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var J=0,M=null,R=0;function re(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(B===0&&e._stable){let t=C;C=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){a&&d?.onError&&d.onError?.(n,{type:"effect",effect:e}),a&&console.warn("[what] Error in stable effect:",n)}finally{C=t}}else{e._pending=!0;let t=e._level,n=x.length;n>0&&x[n-1]._level>t&&(U=!0),x.push(e)}}}function ie(e){if(J===0){J=1;try{for(let t of e)re(t);if(R>0){let t=0;for(;t<R;){let n=M[t];M[t]=null,t++;for(let r of n)re(r)}R=0}}finally{J=0}B===0&&x.length>0&&ke()}else M===null&&(M=[]),R>=M.length?M.push(e):M[R]=e,R++}var q=!1;function ke(){q||(q=!0,queueMicrotask(()=>{q=!1,Z()}))}var z=!1;function Z(){if(!z){z=!0;try{let e=0;for(;x.length>0&&e<25;){let t=x;x=[],t.length>1&&U&&t.sort((n,r)=>n._level-r._level),U=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;try{Q(r)}catch(s){if(s===V)throw s;a&&d?.onError&&d.onError?.(s,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",s)}catch{}continue}!r._computed&&r.deps.length!==o&&F(r)}}e++}if(e>=25){if(a){let n=x.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<x.length;t++)x[t]._pending=!1;x.length=0}}finally{z=!1}}}function Ye(e){let t,n=new Set,r=X(()=>{let s=e();if(!Object.is(t,s)){t=s;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=x.length;f>0&&x[f-1]._level>i&&(U=!0),x.push(c)}}}});r._level=1,Q(r),F(r),n._owner=r,S&&S.disposals.push(()=>oe(r));function o(){return C&&(n.add(C),C.deps.push(n)),t}return o._signal=!0,o.peek=()=>t,o}function et(){if(z){a&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(C){a&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}q=!1,Z()}function Y(e){let t=C;C=null;try{return e()}finally{C=t}}function tt(){return E}function nt(e,t){let n=E,r=S;E=e,S=e;try{return t()}finally{E=n,S=r}}function rt(e){let t=S,n=E,r={disposals:[],owner:E,children:[],_disposed:!1};E&&E.children.push(r),S=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)ee(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();if(r.disposals.length=0,r.owner){let s=r.owner.children.indexOf(r);s>=0&&r.owner.children.splice(s,1)}}})}finally{S=t,E=n}}function ee(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)ee(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function ot(e){let t=S,n=E,r={disposals:[],owner:null,children:[],_disposed:!1};S=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)ee(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();r.disposals.length=0}})}finally{S=t,E=n}}function st(e){S&&S.disposals.push(e)}if(a&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};d={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function it(){if(!a)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof K<"u"?K:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var K=null;a&&d?.__isPreinstallBuffer&&(K=d.__buffer);var O=null,I=null;function ft(e){I||(I=e)}function Ae(){return I?.getStore()??O}function ce(){return typeof document>"u"||Ae()!=null}function lt(e){let t=O;return O=e,t}function at(e,t){if(I)return I.run(e,t);let n=O;O=e;try{return t()}finally{O=n}}function mt(e,t){let n=function(o){return e(o)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var fe=null;function le(e){fe=e}function yt(e){let t=null,n=null,r=null,o=new Set;function s(c){if(r)throw r;if(t)return T(t,c);throw n||(n=e().then(i=>{t=i.default||i,o.forEach(f=>f()),o.clear()}).catch(i=>{r=i})),n}return s.displayName="Lazy",s._lazy=!0,s._onLoad=c=>{t?c():o.add(c)},s}function Le({fallback:e,children:t}){let n=A(!1),r=new Set,o=!1;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(c){o||(n.set(!0),r.add(c),c.then(()=>{r.delete(c),r.size===0&&n.set(!1)},i=>{o=!0,r.delete(c),console.error("[what] Suspense: a suspended child rejected:",i)}))}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}Le._deferChildren=!0;function Ne({fallback:e,children:t,onError:n}){let r=A(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}Ne._deferChildren=!0;function ae(e,t){let n=t||fe?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function gt({when:e,fallback:t=null,children:n}){return()=>(typeof e=="function"?e():e)?n:t}function Ct({each:e,fallback:t=null,children:n}){let r=Array.isArray(n)?n[0]:n;return typeof r!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):()=>{let o=typeof e=="function"?e():e;return!o||o.length===0?t:o.map((s,c)=>{let i=r(s,c);return i&&typeof i=="object"&&i.key==null&&(s!=null&&typeof s=="object"?s.id!=null?i.key=s.id:s.key!=null&&(i.key=s.key):(typeof s=="string"||typeof s=="number")&&(i.key=s)),i})}}function wt({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];return()=>{for(let r of n)if(r&&r.tag===De){let o=r.props.when;if(typeof o=="function"?o():o)return r.children}return e}}function De(e){return()=>(typeof e.when=="function"?e.when():e.when)?e.children:null}var j=null;function bt(e){j=e}function Me(e){let t={};for(let n in e){let r=e[n];typeof r=="function"||typeof r=="symbol"||r===void 0||(t[n]=r)}try{return JSON.stringify(t)}catch{return"{}"}}function St({component:e,mode:t,mediaQuery:n,name:r,children:o,...s}){let c=r||e?.name||"Island",i=t||"idle",f={"data-island":c,"data-island-mode":i,"data-hydrate":i,"data-island-self":"1"},l=o==null?[]:Array.isArray(o)?o:[o];if(ce())return T("div",{...f,"data-island-props":Me(s)},T(e,s,...l));let _=!1;function y(u){if(_)return;_=!0;let p=T(e,s,...l);u.childNodes.length>0&&j?.hydrate?j.hydrate(p,u):j?.insert&&j.insert(u,p,null),u.removeAttribute("data-hydrate"),u.removeAttribute("data-island-self"),u.setAttribute("data-island-hydrated","");let m=u.ownerDocument?.defaultView??globalThis;typeof m.CustomEvent=="function"&&u.dispatchEvent(new m.CustomEvent("island:hydrated",{bubbles:!0,detail:{name:c,mode:i}}))}function b(u){let p=()=>y(u);switch(i){case"load":queueMicrotask(p);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(p):setTimeout(p,200);break;case"visible":{if(typeof IntersectionObserver>"u"){queueMicrotask(p);break}let m=new IntersectionObserver(w=>{w.some(v=>v.isIntersecting)&&(m.disconnect(),p())},{rootMargin:"200px"});m.observe(u);break}case"interaction":case"action":{let m=["click","focus","mouseenter","touchstart"],w=()=>{for(let v of m)u.removeEventListener(v,w);p()};for(let v of m)u.addEventListener(v,w,{once:!0});break}case"media":{if(!n||typeof window>"u"||!window.matchMedia){p();break}let m=window.matchMedia(n);if(m.matches){queueMicrotask(p);break}let w=()=>{m.matches&&(m.removeEventListener("change",w),p())};m.addEventListener("change",w);break}case"static":break;default:queueMicrotask(p)}}return T("div",{...f,ref:u=>{u&&b(u)}})}var ue=!1;function vt(e,t,n){return ue||(ue=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,o)=>{let s=t(r,o);return n&&s&&typeof s=="object"&&(s.key=n(r,o)),s})}function kt(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,o]of Object.entries(n))o&&t.push(r)}return t.join(" ")}function At(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Te(t)}:${n}`).join(";")}function Te(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Lt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Nt(e,t){let n=0;return(...r)=>{let o=Date.now();o-n>=t&&(n=o,e(...r))}}var $=null;function pe(e){$=e}function Dt(e){if(typeof window>"u")return A(!1);let t=window.matchMedia(e),n=A(t.matches),r=s=>n.set(s.matches);t.addEventListener("change",r);let o=$?.();return o&&(o._cleanupCallbacks=o._cleanupCallbacks||[],o._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function Mt(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=A(n),o=N(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){a&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),s=null;typeof window<"u"&&(s=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){a&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",s));let c=$?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{o(),s&&window.removeEventListener("storage",s)})),r}function Tt({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function Rt(e,t){if(typeof document>"u")return;let n=o=>{let s=e.current||e;!s||s.contains(o.target)||t(o)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=$?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function Ot(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var Re=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),Oe="http://www.w3.org/2000/svg",de=new Set(["href","src","action","formaction","formAction","data","ping","xlink:href","xlinkHref"]),he=new Set(["srcdoc","srcDoc"]);function Pe(e){if(e==null)return!0;let t;try{t=String(e).trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase()}catch{return!1}return!(t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:"))}function _e(e){if(e.length<=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return(t===111||t===79)&&(n===110||n===78)}function Be(e,t){let n=e.toLowerCase();return he.has(e)||he.has(n)?!0:!de.has(e)&&!de.has(n)?!1:!Pe(t)}function Ie(e){return e==="role"||e.startsWith("aria-")}var ye=new Set,G=new WeakMap;function je(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function me(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function te(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}a&&d?.onComponentUnmount&&d.onComponentUnmount?.(e),ye.delete(e)}}function He(e,t){!e||typeof t!="function"||(e._hydrationDisposers?e._hydrationDisposers.push(t):e._hydrationDisposers=[t])}function Ht(e,t){He(e,()=>te(t))}function D(e){if(!e)return;if(e._componentCtx&&te(e._componentCtx),e._hydrationDisposers){let n=e._hydrationDisposers;e._hydrationDisposers=null;for(let r=0;r<n.length;r++)try{n[r]()}catch{}}if(e.nodeType===8){let n=G.get(e);n&&te(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)D(t[n])}function Wt(e,t){typeof t=="string"&&(t=document.querySelector(t)),D(t),t.textContent="";let n=L(e,t);return n&&t.appendChild(n),()=>{D(t),t.textContent=""}}function L(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(je(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),o=document.createComment("/list-frag");return r.appendChild(o),e(r,o),r}if(typeof e=="function"&&e._lazyChildren)return L(e(),t,n);if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),s=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(o);let i=h[h.length-1]||null,f=N(()=>{let l=i!==null&&h[h.length-1]!==i;l&&h.push(i);try{let _=e(),y=_==null||_===!1||_===!0?[]:Array.isArray(_)?_:[_],b=o.parentNode;if(!b)return;for(let u of s)D(u),u.parentNode===b&&b.removeChild(u);s=[];for(let u of y){let p=L(u,b,t?._isSvg);if(p)if(p.nodeType===11){let m=Array.from(p.childNodes);b.insertBefore(p,o);for(let w of m)s.push(w)}else b.insertBefore(p,o),s.push(p)}}finally{l&&h.pop()}});return r._dispose=f,o._dispose=f,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let s=L(o,t,n);s&&r.appendChild(s)}return r}return me(e)&&typeof e.tag=="function"?Ve(e,t,n):me(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?Ce(e,t):e.tag==="__suspense"?we(e,t):e.tag==="__portal"?be(e,t):$e(e,t,n):document.createTextNode(String(e))}var We={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},h=[];function ge(){return h[h.length-1]}le(ge);pe(ge);function qt(){return h}function zt(e){let t={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:e,_parentCtx:h[h.length-1]||null,_errorBoundary:null};return h.push(t),t}function Ut(e){h[h.length-1]===e&&h.pop(),e.disposed=!0}function qe(e,t,n){if(e._deferChildren)return t.children=n,null;let r,o=!1,s=!0;return Object.defineProperty(t,"children",{get(){return s?(o||(o=!0,r=n()),r):n()},enumerable:!0,configurable:!0}),()=>{s=!1,o=!1,r=void 0}}var ze=Symbol.for("what.navigation.signal");function Ue(e){if(e==null)return!1;let t=e[ze];return typeof t!="function"?!1:(t(e),!0)}function Ve(e,t,n){let{tag:r,props:o,children:s}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let g=r;r=function(Ee){return new g(Ee).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Ce(e,t);if(r==="__suspense"||e.tag==="__suspense")return we(e,t);if(r==="__portal"||e.tag==="__portal")return be(e,t);let c=h[h.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let g=c._parentCtx;for(;g;){if(g._errorBoundary){i=g._errorBoundary;break}g=g._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},l=document.createComment("c:start"),_=document.createComment("c:end");G.set(l,f),f._startComment=l,f._endComment=_;let y=document.createDocumentFragment();y._componentCtx=f,f._wrapper=l,ye.add(f),a&&d?.onComponentMount&&d.onComponentMount?.(f);let b=s.length===0?void 0:s.length===1?s[0]:s,u;b!==void 0?u=o?Object.assign({},o,{children:b}):{children:b}:u=o?Object.assign({},o):{};let p=o&&o._$lazyChildren,m=p?qe(r,u,p):null,w=A(u);f._propsSignal=w;let v=new Proxy({_sig:w},We);h.push(f);let k;try{k=Y(()=>r(v))}catch(g){if(h.pop(),!Ue(g)&&!(g&&typeof g.then=="function"&&Fe(g,f))&&!ae(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return y.appendChild(l),y.appendChild(_),y}m&&m(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(P){console.error("[what] onMount error:",P)}}),y.appendChild(l);let xe=Array.isArray(k)?k:[k];try{for(let g of xe){let P=L(g,y,n);P&&y.appendChild(P)}}finally{h.pop()}return y.appendChild(_),y}function Fe(e,t){let n=t;for(;n;){if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(e),!0;n=n._parentCtx}return!1}function Ce(e,t){let{errorState:n,handleError:r,fallback:o,reset:s}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};G.set(i,l);let _=document.createDocumentFragment();_._componentCtx=l,_.appendChild(i),_.appendChild(f);let y=N(()=>{let b=n();h.push(l);let u=i.parentNode;if(u)for(;i.nextSibling&&i.nextSibling!==f;){let m=i.nextSibling;D(m),u.removeChild(m)}let p;b?p=typeof o=="function"?[o({error:b,reset:s})]:[o]:p=c,p=Array.isArray(p)?p:[p];for(let m of p){let w=L(m,t);w&&(f.parentNode?f.parentNode.insertBefore(w,f):_.insertBefore(w,f))}h.pop()});return l.effects.push(y),_}function we(e,t){let{boundary:n,fallback:r,loading:o}=e.props,s=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_suspenseBoundary:n,_startComment:c,_endComment:i};G.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let _=0,y=N(()=>{let u=o()?[r]:s,p=Array.isArray(u)?u:[u],m=++_;h.push(f);let w=c.parentNode;if(w)for(;c.nextSibling&&c.nextSibling!==i;){let v=c.nextSibling;D(v),w.removeChild(v)}try{for(let v of p){let k=L(v,t);if(m!==_){k&&D(k);break}k&&(i.parentNode?i.parentNode.insertBefore(k,i):l.insertBefore(k,i))}}finally{h.pop()}});return f.effects.push(y),l}function be(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let o={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null},s=document.createComment("portal");s._componentCtx=o;let c=[];for(let i of r){let f=L(i,n);f&&(n.appendChild(f),c.push(f))}return o._cleanupCallbacks=[()=>{for(let i of c)D(i),i.parentNode&&i.parentNode.removeChild(i)}],s}function $e(e,t,n){let{tag:r,props:o,children:s}=e,c=n||Re.has(r),i=c?document.createElementNS(Oe,r):document.createElement(r);o&&Ge(i,o,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<s.length;l++){let _=L(s[l],i,f);_&&i.appendChild(_)}return i._vnode=e,i}function Ge(e,t,n,r){if(t){for(let o in t)if(!(o==="key"||o==="children")){if(o==="ref"){let s=t.ref;typeof s=="function"?s(e):s&&(s.current=e);continue}Se(e,o,t[o],r)}}}function Je(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function Se(e,t,n,r){if(typeof n=="function"&&!_e(t)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=N(()=>{let o=n();Se(e,t,o,r)});return}if(_e(t)){if(typeof n!="function"&&n!=null)return;let o=t.slice(2),s=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),s=!0);let c=o.toLowerCase(),i=s?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,s),n==null))return;e._events||(e._events={});let l=y=>(y.nativeEvent||(y.nativeEvent=y),Y(()=>l._handler(y)));l._handler=n,l._original=n,e._events[i]=l;let _=n._eventOpts;e.addEventListener(c,l,_||s||void 0);return}if(Be(t,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${t}" attribute:`,n);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let o=e._prevStyle||{};for(let s in o)s in n||(e.style[s]="");for(let s in n)e.style[s]=n[s]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let o=n?.__html??"";a&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";a&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o}else{a&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(n==null){if(t in e)try{e[t]=""}catch{}e.removeAttribute(t);return}if(Ie(t)){e.setAttribute(t,typeof n=="boolean"?String(n):n);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Je(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{a,d as b,Xe as c,A as d,Qe as e,N as f,Ze as g,Ye as h,et as i,Y as j,tt as k,nt as l,rt as m,ot as n,st as o,it as p,ft as q,Ae as r,ce as s,lt as t,at as u,mt as v,yt as w,Le as x,Ne as y,ae as z,gt as A,Ct as B,wt as C,De as D,bt as E,St as F,vt as G,kt as H,At as I,Lt as J,Nt as K,Dt as L,Mt as M,Tt as N,Rt as O,Ot as P,_e as Q,Be as R,Ie as S,He as T,Ht as U,D as V,Wt as W,L as X,ge as Y,qt as Z,zt as _,Ut as $,qe as aa,Ue as ba,Je as ca};
|
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as Fn,B as On,C as Nn,D as Pn,J as $n,K as Hn,L as Vn,M as jn,N as Gn,a as un,b as ln,c as fn,d as dn,e as pn,f as hn,g as gn,h as mn,i as yn,j as xn,k as vn,l as wn,m as bn,n as kn,o as En,p as Sn,q as Cn,r as _n,s as An,t as Rn,u as Tn,v as In,w as Mn,x as Ue,y as Ln,z as Dn}from"./chunk-T2SKNKT5.min.js";import{A as Bt,B as Yt,C as Wt,E as Xt,F as zt,G as Qt,H as Ut,I as Kt,J as Jt,K as Zt,L as en,M as tn,N as nn,O as rn,P as Le,R as on,V as sn,X as W,Z as an,_ as cn,a as F,b as _t,c as d,d as P,e as V,f as D,g as At,h as Rt,i as ce,j as Tt,k as It,l as Mt,n as Lt,o as Dt,p as Nt,q as he,r as Me,s as Pt,t as $t,u as Ht,v as Vt,w as jt,x as Gt,z as qt}from"./chunk-M5GDJRVX.min.js";import{a as I,b as Ft,c as Ot}from"./chunk-O3SKPRTY.min.js";var re;function De(){if(re!==void 0)return re;if(typeof document>"u")return re=null;let e=document.getElementById("__what_data");if(!e)return re=null;try{re=JSON.parse(e.textContent)}catch{re=null}return re}function qn(){re=void 0}function Fe(){let e=De();return e?e.loaderData:void 0}function Oe(e){let t=De();return t&&t.resources?t.resources[e]:void 0}function Bn(){if(Me()){let e=he();return e?e.loaderData:void 0}return Fe()}function X(e){let t=W();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function oe(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function Yn(e){let t=X("useState"),{index:n,exists:r}=oe(t);if(!r){let s=d(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function Wn(e){let t=X("useSignal"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=d(typeof e=="function"?e():e)),t.hooks[n]}function Xn(e){let t=X("useComputed"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=P(e)),t.hooks[n]}function zn(e,t){let n=X("useEffect"),{index:r,exists:o}=oe(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 c=t[i];c!=null&&typeof c!="function"&&console.warn(`[what] useEffect dep at index ${i} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=V(()=>{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=V(()=>{for(let c=0;c<t.length;c++){let f=t[c];typeof f=="function"&&f._signal&&f()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=ce(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function Qn(e,t){let n=X("useMemo"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={computed:P(e)}),n.hooks[r].computed}function Un(e,t){let n=X("useCallback"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function Kn(e){let t=X("useRef"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ke(e){let t=W();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 Jn(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=X("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=d(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Ke(t);return typeof n=="function"?n(r):n}};return t.Provider._deferChildren=!0,t}function Zn(e,t,n){let r=X("useReducer"),{index:o,exists:s}=oe(r);if(!s){let c=n?n(t):t,f=d(c),h=a=>{f.set(l=>e(l,a))};r.hooks[o]={signal:f,dispatch:h}}let i=r.hooks[o];return[i.signal,i.dispatch]}function er(e){let t=X("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function tr(e){let t=X("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function nr(e,t={}){if(Me()){let a=he();if(a){let l=t.key!=null?t.key:`__r${a.resourceCounter++}`,p=a.resources.get(l);if(p&&p.status==="ready")return[()=>p.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(p&&p.status==="error")return[()=>{},{loading:()=>!1,error:()=>p.error,refetch:()=>{},mutate:()=>{}}];if(!p){let S=Promise.resolve().then(()=>e(t.source??!0,{})).then(v=>{a.resources.set(l,{status:"ready",value:v})}).catch(v=>{a.resources.set(l,{status:"error",error:v})});throw a.resources.set(l,{status:"pending",promise:S}),S}throw p.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 a=Oe(t.key);a!==void 0&&(n=a)}let r=d(n??null),o=d(n==null),s=d(null),i=null,c=async a=>{i&&i.abort(),i=new AbortController;let{signal:l}=i;o.set(!0),s.set(null);try{let p=await e(a,{signal:l});l.aborted||D(()=>{r.set(p),o.set(!1)})}catch(p){l.aborted||D(()=>{s.set(p),o.set(!1)})}},f=a=>{r.set(typeof a=="function"?a(r()):a)},h=W?.();return h&&(h._cleanupCallbacks=h._cleanupCallbacks||[],h._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&c(t.source),[r,{loading:o,error:s,refetch:c,mutate:f}]}function et(e){return e._storeComputed=!0,e}var Je=!1;function rr(e){return Je||(Je=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),et(e)}function or(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]=d(i);for(let[s,i]of Object.entries(n)){let c=new Proxy({},{get(f,h){if(t[h])return t[h]();if(n[h])return n[h]()}});n[s]=P(()=>i(c))}for(let[s,i]of Object.entries(r))r[s]=(...c)=>{let f;return D(()=>{let h=new Proxy({},{get(a,l){if(t[l])return t[l].peek();if(n[l])return n[l].peek();if(r[l])return r[l]},set(a,l,p){return t[l]&&t[l].set(p),!0}});f=i.apply(h,c)}),f};return function(){let i={};for(let[c,f]of Object.entries(t))Object.defineProperty(i,c,{get:()=>f(),enumerable:!0});for(let[c,f]of Object.entries(n))Object.defineProperty(i,c,{get:()=>f(),enumerable:!0});for(let[c,f]of Object.entries(r))i[c]=f;return i}}var Ze=!1;function sr(e){return Ze||(Ze=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),d(e)}var Ne={title:null,metas:new Map,links:new Map};function ir({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=he();return o&&o.head&&cr(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ne.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);nt("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");nt("link",s,o)}return r||null}function ar(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function cr(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(ar(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function ur(){return{title:null,metas:new Map,links:new Map}}function lr(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${rt(String(e.title))}</title>`);for(let n of e.metas.values())t+=tt("meta",n);for(let n of e.links.values())t+=tt("link",n);return t}var fr=/^[a-zA-Z_:][a-zA-Z0-9:._-]*$/;function Pe(e){if(!fr.test(e))return!1;let t=e.toLowerCase();return!(t.startsWith("on")&&t.length>2)}function Ce(e){return e==="httpEquiv"?"http-equiv":e}function tt(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;let s=Ce(r);Pe(s)&&(n+=` ${s}="${rt(String(o))}"`)}return n+">"}function rt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dr(e){let t=String(e);return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n.codePointAt(0).toString(16)} `)}function nt(e,t,n){let r=document.head.querySelector(`[data-what-head="${dr(t)}"]`);if(r){pr(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))Pe(Ce(s))&&o.setAttribute(Ce(s),i);document.head.appendChild(o)}function pr(e,t){for(let[n,r]of Object.entries(t)){let o=Ce(n);Pe(o)&&e.getAttribute(o)!==r&&e.setAttribute(o,r)}}function hr(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ne.metas.clear(),Ne.links.clear()}var ge=[],me=[],He=!1;function ee(e){return ge.push(e),Ve(),()=>{let t=ge.indexOf(e);t!==-1&&ge.splice(t,1)}}function se(e){return me.push(e),Ve(),()=>{let t=me.indexOf(e);t!==-1&&me.splice(t,1)}}function ot(){for(;ge.length>0;){let e=ge.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;me.length>0;){let e=me.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}He=!1,(ge.length>0||me.length>0)&&Ve()}function Ve(){He||(He=!0,requestAnimationFrame(ot))}function gr(e){return new Promise(t=>{ee(()=>{t(e())})})}function mr(e){return new Promise(t=>{se(()=>{e(),t()})})}function yr(e,t){let n=Symbol("scheduledEffect");return V(()=>{st(n,()=>{ee(()=>{let r=e();t&&se(()=>t(r))})})})}function xr(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var ve=new Map;function st(e,t){ve.has(e)?ve.set(e,t):(ve.set(e,t),requestAnimationFrame(()=>{let n=ve.get(e);ve.delete(e),n&&n()}))}var $e=new WeakMap,_e=null;function vr(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(_e||(_e=new ResizeObserver(n=>{ee(()=>{for(let r of n){let o=$e.get(r.target);o&&o(r.contentRect)}})})),$e.set(e,t),_e.observe(e),()=>{$e.delete(e),_e.unobserve(e)})}function wr(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{ee(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function br(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,i,c;ee(()=>{s=window.scrollY;let h=e.getBoundingClientRect();i=s+h.top,c=performance.now(),f()});function f(){ee(()=>{let h=performance.now()-c,a=Math.min(h/n,1),l=r(a),p=s+(i-s)*l;se(()=>{window.scrollTo(0,p),a<1?requestAnimationFrame(f):o()})})}})}function it(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function at(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,i=d(e),c=d(e),f=d(0),h=d(!1),a=null,l=null;function p(E){if(l===null){l=E,a=requestAnimationFrame(p);return}let M=Math.min((E-l)/1e3,.064);l=E;let w=i.peek(),T=c.peek(),C=f.peek(),A=w-T,g=-n*A,_=-r*C,m=(g+_)/o,O=C+m*M,H=w+O*M;if(D(()=>{f.set(O),i.set(H)}),Math.abs(O)<s&&Math.abs(A)<s){D(()=>{i.set(T),f.set(0),h.set(!1)}),a=null,l=null;return}a=requestAnimationFrame(p)}function S(E){c.set(E),a===null&&(h.set(!0),l=null,a=requestAnimationFrame(p))}function v(){a&&(cancelAnimationFrame(a),a=null),h.set(!1),l=null}function R(E){v(),D(()=>{i.set(E),c.set(E),f.set(0)})}let L=W?.();return L&&(L._cleanupCallbacks=L._cleanupCallbacks||[],L._cleanupCallbacks.push(v)),{current:()=>i(),target:()=>c(),velocity:()=>f(),isAnimating:()=>h(),set:S,stop:v,snap:R,subscribe:i.subscribe}}function ct(e,t,n={}){let{duration:r=300,easing:o=S=>S*(2-S),onUpdate:s,onComplete:i}=n,c=d(0),f=d(e),h=d(!0),a=null,l=null;function p(S){a===null&&(a=S);let v=S-a,R=Math.min(v/r,1),L=o(R),E=e+(t-e)*L;D(()=>{c.set(R),f.set(E)}),s&&s(E,R),R<1?l=requestAnimationFrame(p):(h.set(!1),i&&i())}return l=requestAnimationFrame(p),{progress:()=>c(),value:()=>f(),isAnimating:()=>h(),cancel:()=>{l&&cancelAnimationFrame(l),h.set(!1)},subscribe:f.subscribe}}var ut={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 kr(e={}){let{duration:t=300,easing:n=ut.easeOutQuad}=e,r=d(!1),o=d(0);async function s(i){return r.set(!0),o.set(0),new Promise(c=>{let f=performance.now();function h(a){let l=a-f,p=Math.min(l/t,1);o.set(n(p)),p<1?requestAnimationFrame(h):(r.set(!1),i&&i(),c())}requestAnimationFrame(h)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function Er(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:i,onTap:c,onLongPress:f,preventDefault:h=!1}=t,a={isDragging:d(!1),startX:0,startY:0,currentX:d(0),currentY:d(0),deltaX:d(0),deltaY:d(0),velocity:d({x:0,y:0})},l=0,p=0,S=0,v=null;function R(A){let g=A.touches?A.touches[0]:A;a.startX=g.clientX,a.startY=g.clientY,p=g.clientX,S=g.clientY,l=performance.now(),a.isDragging.set(!0),r&&r({x:a.startX,y:a.startY}),f&&(v=setTimeout(()=>{a.isDragging.peek()&&f({x:p,y:S})},500))}function L(A){if(!a.isDragging.peek())return;let g=A.touches?A.touches[0]:A,_=g.clientX,m=g.clientY,O=performance.now(),H=O-l;D(()=>{a.currentX.set(_),a.currentY.set(m),a.deltaX.set(_-a.startX),a.deltaY.set(m-a.startY),H>0&&a.velocity.set({x:(_-p)/H*1e3,y:(m-S)/H*1e3})}),p=_,S=m,l=O,v&&Math.sqrt(a.deltaX.peek()**2+a.deltaY.peek()**2)>10&&(clearTimeout(v),v=null),n&&n({x:_,y:m,deltaX:a.deltaX.peek(),deltaY:a.deltaY.peek(),velocity:a.velocity.peek()})}function E(A){if(!a.isDragging.peek())return;v&&(clearTimeout(v),v=null);let g=a.deltaX.peek(),_=a.deltaY.peek(),m=a.velocity.peek();if(Math.sqrt(g**2+_**2)<10&&c&&c({x:a.startX,y:a.startY}),i&&(Math.abs(m.x)>500||Math.abs(m.y)>500)){let H=Math.abs(m.x)>Math.abs(m.y)?m.x>0?"right":"left":m.y>0?"down":"up";i({direction:H,velocity:m})}o&&o({deltaX:g,deltaY:_,velocity:m}),a.isDragging.set(!1)}let M=null;function w(A){if(!s||A.touches.length!==2)return;let g=A.touches[0],_=A.touches[1],m=Math.sqrt((_.clientX-g.clientX)**2+(_.clientY-g.clientY)**2);M===null&&(M=m);let O=m/M,H=(g.clientX+_.clientX)/2,x=(g.clientY+_.clientY)/2;s({scale:O,centerX:H,centerY:x})}function T(){M=null}typeof e=="function"?it(()=>{let A=ce(e);if(A)return C(A)}):e?.current!==void 0?it(()=>{let A=e.current;if(A)return C(A)}):e&&C(e);function C(A){return A.addEventListener("mousedown",R),A.addEventListener("touchstart",R,{passive:!h}),window.addEventListener("mousemove",L),window.addEventListener("touchmove",w),window.addEventListener("touchmove",L),window.addEventListener("mouseup",E),window.addEventListener("touchend",E),window.addEventListener("touchend",T),()=>{A.removeEventListener("mousedown",R),A.removeEventListener("touchstart",R),window.removeEventListener("mousemove",L),window.removeEventListener("touchmove",w),window.removeEventListener("touchmove",L),window.removeEventListener("mouseup",E),window.removeEventListener("touchend",E),window.removeEventListener("touchend",T)}}return a}function Sr(e){let t=d(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=at(t.peek(),o);s.set(r);let i=V(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=ct(t.peek(),r,{...o,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(r,o){return()=>{let s=t();for(let i=0;i<r.length-1;i++)if(s>=r[i]&&s<=r[i+1]){let c=(s-r[i])/(r[i+1]-r[i]);return o[i]+(o[i+1]-o[i])*c}return s<=r[0]?o[0]:o[o.length-1]}},subscribe:t.subscribe}}function lt(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 Cr(e,t,n="enter",r=300){let o=lt(t);return new Promise(s=>{se(()=>{e.classList.add(o[n]),ee(()=>{e.offsetHeight,se(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{se(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var _r=`
|
|
1
|
+
import{A as Fn,B as Pn,C as Hn,D as $n,J as Vn,K as Gn,L as Un,M as jn,N as qn,a as dn,b as fn,c as pn,d as hn,e as gn,f as mn,g as yn,h as vn,i as wn,j as xn,k as En,l as bn,m as _n,n as Sn,o as kn,p as Rn,q as Cn,r as An,s as In,t as Tn,u as Dn,v as Nn,w as On,x as Je,y as Ln,z as Mn}from"./chunk-ENARGHSD.min.js";import{$ as un,A as Bt,B as Wt,C as Yt,D as Xt,F as zt,G as Qt,H as Kt,I as Jt,J as Zt,K as en,L as tn,M as nn,N as rn,O as on,P as sn,Q as Ne,S as an,W as cn,Y as W,_ as ln,a as L,c as At,d,e as P,f as V,g as O,h as It,i as Tt,j as ce,k as Dt,l as Nt,m as Ot,o as Lt,p as Mt,q as Ht,r as ge,s as De,t as $t,u as Vt,v as Gt,w as Ut,x as jt,y as qt}from"./chunk-OKM3GKVP.min.js";import{a as D,b as Ft,c as Pt}from"./chunk-O3SKPRTY.min.js";var re;function Oe(){if(re!==void 0)return re;if(typeof document>"u")return re=null;let e=document.getElementById("__what_data");if(!e)return re=null;try{re=JSON.parse(e.textContent)}catch{re=null}return re}function Bn(){re=void 0}function Le(){let e=Oe();return e?e.loaderData:void 0}function Me(e){let t=Oe();return t&&t.resources?t.resources[e]:void 0}function Wn(){if(De()){let e=ge();return e?e.loaderData:void 0}return Le()}function Y(e){let t=W();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function oe(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function Yn(e){let t=Y("useState"),{index:n,exists:r}=oe(t);if(!r){let s=d(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function Xn(e){let t=Y("useSignal"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=d(typeof e=="function"?e():e)),t.hooks[n]}function zn(e){let t=Y("useComputed"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=P(e)),t.hooks[n]}function Qn(e,t){let n=Y("useEffect"),{index:r,exists:o}=oe(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),L&&Array.isArray(t)&&t.length>0)for(let a=0;a<t.length;a++){let c=t[a];c!=null&&typeof c!="function"&&console.warn(`[what] useEffect dep at index ${a} 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=V(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let a=e();typeof a=="function"&&(s.cleanup=a)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let a=e();typeof a=="function"&&(s.cleanup=a)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=V(()=>{for(let c=0;c<t.length;c++){let u=t[c];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let a=ce(()=>e());typeof a=="function"&&(s.cleanup=a)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function Kn(e,t){let n=Y("useMemo"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={computed:P(e)}),n.hooks[r].computed}function Jn(e,t){let n=Y("useCallback"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function Zn(e){let t=Y("useRef"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ze(e){let t=W();for(L&&!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 er(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=Y("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=d(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Ze(t);return typeof n=="function"?n(r):n}};return t.Provider._deferChildren=!0,t}function tr(e,t,n){let r=Y("useReducer"),{index:o,exists:s}=oe(r);if(!s){let c=n?n(t):t,u=d(c),p=i=>{u.set(h=>e(h,i))};r.hooks[o]={signal:u,dispatch:p}}let a=r.hooks[o];return[a.signal,a.dispatch]}function nr(e){let t=Y("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function rr(e){let t=Y("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function or(e,t={}){if(De()){let i=ge();if(i){let h=t.key!=null?t.key:`__r${i.resourceCounter++}`,g=i.resources.get(h);if(g&&g.status==="ready")return[()=>g.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(g&&g.status==="error")return[()=>{},{loading:()=>!1,error:()=>g.error,refetch:()=>{},mutate:()=>{}}];if(!g){let _=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{i.resources.set(h,{status:"ready",value:b})}).catch(b=>{i.resources.set(h,{status:"error",error:b})});throw i.resources.set(h,{status:"pending",promise:_}),_}throw g.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 i=Me(t.key);i!==void 0&&(n=i)}let r=d(n??null),o=d(n==null),s=d(null),a=null,c=async i=>{a&&a.abort(),a=new AbortController;let{signal:h}=a;o.set(!0),s.set(null);try{let g=await e(i,{signal:h});h.aborted||O(()=>{r.set(g),o.set(!1)})}catch(g){h.aborted||O(()=>{s.set(g),o.set(!1)})}},u=i=>{r.set(typeof i=="function"?i(r()):i)},p=W?.();return p&&(p._cleanupCallbacks=p._cleanupCallbacks||[],p._cleanupCallbacks.push(()=>{a&&a.abort()})),n==null&&c(t.source),[r,{loading:o,error:s,refetch:c,mutate:u}]}function nt(e){return e._storeComputed=!0,e}var et=!1;function sr(e){return et||(et=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),nt(e)}function ar(e){let t={},n={},r={};for(let[o,s]of Object.entries(e))typeof s=="function"&&s._storeComputed?(L&&s.length===0&&console.warn(`[what] derived() for "${o}" should accept the state parameter, e.g. derived(state => ...).`),n[o]=s):typeof s=="function"?r[o]=s:t[o]=d(s);for(let[o,s]of Object.entries(n)){let a=new Proxy({},{get(c,u){if(t[u])return t[u]();if(n[u])return n[u]()}});n[o]=P(()=>s(a))}for(let[o,s]of Object.entries(r))r[o]=(...a)=>{let c;return O(()=>{let u=new Proxy({},{get(p,i){if(t[i])return t[i].peek();if(n[i])return n[i].peek();if(r[i])return r[i]},set(p,i,h){return t[i]&&t[i].set(h),!0}});c=s.apply(u,a)}),c};return function(){let s={};for(let[a,c]of Object.entries(t))Object.defineProperty(s,a,{get:()=>c(),enumerable:!0});for(let[a,c]of Object.entries(n))Object.defineProperty(s,a,{get:()=>c(),enumerable:!0});for(let[a,c]of Object.entries(r))s[a]=c;return s}}var tt=!1;function ir(e){return tt||(tt=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),d(e)}var Fe={title:null,metas:new Map,links:new Map};function cr({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ge();return o&&o.head&&ur(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Fe.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);ot("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");ot("link",s,o)}return r||null}function lr(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function ur(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(lr(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function dr(){return{title:null,metas:new Map,links:new Map}}function fr(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${st(String(e.title))}</title>`);for(let n of e.metas.values())t+=rt("meta",n);for(let n of e.links.values())t+=rt("link",n);return t}var pr=/^[a-zA-Z_:][a-zA-Z0-9:._-]*$/;function Pe(e){if(!pr.test(e))return!1;let t=e.toLowerCase();return!(t.startsWith("on")&&t.length>2)}function ke(e){return e==="httpEquiv"?"http-equiv":e}function rt(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;let s=ke(r);Pe(s)&&(n+=` ${s}="${st(String(o))}"`)}return n+">"}function st(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function hr(e){let t=String(e);return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n.codePointAt(0).toString(16)} `)}function ot(e,t,n){let r=document.head.querySelector(`[data-what-head="${hr(t)}"]`);if(r){gr(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,a]of Object.entries(n))Pe(ke(s))&&o.setAttribute(ke(s),a);document.head.appendChild(o)}function gr(e,t){for(let[n,r]of Object.entries(t)){let o=ke(n);Pe(o)&&e.getAttribute(o)!==r&&e.setAttribute(o,r)}}function mr(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Fe.metas.clear(),Fe.links.clear()}var me=[],ye=[],$e=!1;function Z(e){return me.push(e),Ve(),()=>{let t=me.indexOf(e);t!==-1&&me.splice(t,1)}}function se(e){return ye.push(e),Ve(),()=>{let t=ye.indexOf(e);t!==-1&&ye.splice(t,1)}}function at(){for(;me.length>0;){let e=me.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;ye.length>0;){let e=ye.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}$e=!1,(me.length>0||ye.length>0)&&Ve()}function Ve(){$e||($e=!0,requestAnimationFrame(at))}function yr(e){return new Promise(t=>{Z(()=>{t(e())})})}function vr(e){return new Promise(t=>{se(()=>{e(),t()})})}function wr(e,t){let n=Symbol("scheduledEffect");return V(()=>{it(n,()=>{Z(()=>{let r=e();t&&se(()=>t(r))})})})}function xr(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var we=new Map;function it(e,t){we.has(e)?we.set(e,t):(we.set(e,t),requestAnimationFrame(()=>{let n=we.get(e);we.delete(e),n&&n()}))}var He=new WeakMap,Re=null;function Er(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(Re||(Re=new ResizeObserver(n=>{Z(()=>{for(let r of n){let o=He.get(r.target);o&&o(r.contentRect)}})})),He.set(e,t),Re.observe(e),()=>{He.delete(e),Re.unobserve(e)})}function br(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{Z(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function _r(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,a,c;Z(()=>{s=window.scrollY;let p=e.getBoundingClientRect();a=s+p.top,c=performance.now(),u()});function u(){Z(()=>{let p=performance.now()-c,i=Math.min(p/n,1),h=r(i),g=s+(a-s)*h;se(()=>{window.scrollTo(0,g),i<1?requestAnimationFrame(u):o()})})}})}function ct(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function lt(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,a=d(e),c=d(e),u=d(0),p=d(!1),i=null,h=null;function g(S){if(h===null){h=S,i=requestAnimationFrame(g);return}let E=Math.min((S-h)/1e3,.064);h=S;let T=a.peek(),N=c.peek(),A=u.peek(),k=T-N,m=-n*k,f=-r*A,I=(m+f)/o,F=A+I*E,$=T+F*E;if(O(()=>{u.set(F),a.set($)}),Math.abs(F)<s&&Math.abs(k)<s){O(()=>{a.set(N),u.set(0),p.set(!1)}),i=null,h=null;return}i=requestAnimationFrame(g)}function _(S){c.set(S),i===null&&(p.set(!0),h=null,i=requestAnimationFrame(g))}function b(){i&&(cancelAnimationFrame(i),i=null),p.set(!1),h=null}function R(S){b(),O(()=>{a.set(S),c.set(S),u.set(0)})}let C=W?.();return C&&(C._cleanupCallbacks=C._cleanupCallbacks||[],C._cleanupCallbacks.push(b)),{current:()=>a(),target:()=>c(),velocity:()=>u(),isAnimating:()=>p(),set:_,stop:b,snap:R,subscribe:a.subscribe}}function ut(e,t,n={}){let{duration:r=300,easing:o=_=>_*(2-_),onUpdate:s,onComplete:a}=n,c=d(0),u=d(e),p=d(!0),i=null,h=null;function g(_){i===null&&(i=_);let b=_-i,R=Math.min(b/r,1),C=o(R),S=e+(t-e)*C;O(()=>{c.set(R),u.set(S)}),s&&s(S,R),R<1?h=requestAnimationFrame(g):(p.set(!1),a&&a())}return h=requestAnimationFrame(g),{progress:()=>c(),value:()=>u(),isAnimating:()=>p(),cancel:()=>{h&&cancelAnimationFrame(h),p.set(!1)},subscribe:u.subscribe}}var dt={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 Sr(e={}){let{duration:t=300,easing:n=dt.easeOutQuad}=e,r=d(!1),o=d(0);async function s(a){return r.set(!0),o.set(0),new Promise(c=>{let u=performance.now();function p(i){let h=i-u,g=Math.min(h/t,1);o.set(n(g)),g<1?requestAnimationFrame(p):(r.set(!1),a&&a(),c())}requestAnimationFrame(p)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function kr(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:a,onTap:c,onLongPress:u,preventDefault:p=!1}=t,i={isDragging:d(!1),startX:0,startY:0,currentX:d(0),currentY:d(0),deltaX:d(0),deltaY:d(0),velocity:d({x:0,y:0})},h=0,g=0,_=0,b=null;function R(k){let m=k.touches?k.touches[0]:k;i.startX=m.clientX,i.startY=m.clientY,g=m.clientX,_=m.clientY,h=performance.now(),i.isDragging.set(!0),r&&r({x:i.startX,y:i.startY}),u&&(b=setTimeout(()=>{i.isDragging.peek()&&u({x:g,y:_})},500))}function C(k){if(!i.isDragging.peek())return;let m=k.touches?k.touches[0]:k,f=m.clientX,I=m.clientY,F=performance.now(),$=F-h;O(()=>{i.currentX.set(f),i.currentY.set(I),i.deltaX.set(f-i.startX),i.deltaY.set(I-i.startY),$>0&&i.velocity.set({x:(f-g)/$*1e3,y:(I-_)/$*1e3})}),g=f,_=I,h=F,b&&Math.sqrt(i.deltaX.peek()**2+i.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:f,y:I,deltaX:i.deltaX.peek(),deltaY:i.deltaY.peek(),velocity:i.velocity.peek()})}function S(k){if(!i.isDragging.peek())return;b&&(clearTimeout(b),b=null);let m=i.deltaX.peek(),f=i.deltaY.peek(),I=i.velocity.peek();if(Math.sqrt(m**2+f**2)<10&&c&&c({x:i.startX,y:i.startY}),a&&(Math.abs(I.x)>500||Math.abs(I.y)>500)){let $=Math.abs(I.x)>Math.abs(I.y)?I.x>0?"right":"left":I.y>0?"down":"up";a({direction:$,velocity:I})}o&&o({deltaX:m,deltaY:f,velocity:I}),i.isDragging.set(!1)}let E=null;function T(k){if(!s||k.touches.length!==2)return;let m=k.touches[0],f=k.touches[1],I=Math.sqrt((f.clientX-m.clientX)**2+(f.clientY-m.clientY)**2);E===null&&(E=I);let F=I/E,$=(m.clientX+f.clientX)/2,v=(m.clientY+f.clientY)/2;s({scale:F,centerX:$,centerY:v})}function N(){E=null}typeof e=="function"?ct(()=>{let k=ce(e);if(k)return A(k)}):e?.current!==void 0?ct(()=>{let k=e.current;if(k)return A(k)}):e&&A(e);function A(k){return k.addEventListener("mousedown",R),k.addEventListener("touchstart",R,{passive:!p}),window.addEventListener("mousemove",C),window.addEventListener("touchmove",T),window.addEventListener("touchmove",C),window.addEventListener("mouseup",S),window.addEventListener("touchend",S),window.addEventListener("touchend",N),()=>{k.removeEventListener("mousedown",R),k.removeEventListener("touchstart",R),window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",T),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",S),window.removeEventListener("touchend",S),window.removeEventListener("touchend",N)}}return i}function Rr(e){let t=d(e);return{value:()=>t(),setValue:n=>t.set(n),spring(n,r={}){let o=lt(t.peek(),r);o.set(n);let s=V(()=>{t.set(o.current())});return{stop:()=>{o.stop(),s()}}},timing(n,r={}){let o=ut(t.peek(),n,{...r,onUpdate:s=>t.set(s)});return{stop:()=>o.cancel()}},interpolate(n,r){return()=>{let o=t();for(let s=0;s<n.length-1;s++)if(o>=n[s]&&o<=n[s+1]){let a=(o-n[s])/(n[s+1]-n[s]);return r[s]+(r[s+1]-r[s])*a}return o<=n[0]?r[0]:r[r.length-1]}},subscribe:t.subscribe}}function ft(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 Cr(e,t,n="enter",r=300){let o=ft(t);return new Promise(s=>{se(()=>{e.classList.add(o[n]),Z(()=>{e.offsetHeight,se(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{se(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Ar=`
|
|
2
2
|
.what-skeleton {
|
|
3
3
|
background: linear-gradient(
|
|
4
4
|
90deg,
|
|
@@ -50,7 +50,7 @@ import{A as Fn,B as On,C as Nn,D as Pn,J as $n,K as Hn,L as Vn,M as jn,N as Gn,a
|
|
|
50
50
|
0% { transform: translateX(-100%); }
|
|
51
51
|
100% { transform: translateX(100%); }
|
|
52
52
|
}
|
|
53
|
-
`,ft=!1;function ue(){if(ft||typeof document>"u")return;ft=!0;let e=document.createElement("style");e.textContent=_r,document.head.appendChild(e)}function je({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:i=1}){ue();let c=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,f=o?`${c} ${o}`:c,h={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return i===1?I("div",{class:f,style:h,"aria-hidden":"true"}):Array.from({length:i},(a,l)=>I("div",{key:l,class:f,style:{...h,marginBottom:l<i-1?"8px":void 0},"aria-hidden":"true"}))}function Ge({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return ue(),I("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,i)=>I("div",{key:i,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:i===e-1?t:"100%",marginBottom:i<e-1?`${r}px`:void 0}})))}function Ar({size:e=40,variant:t="shimmer"}){return je({width:e,height:e,circle:!0,variant:t})}function dt({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return ue(),I("div",{class:"what-skeleton-card","aria-hidden":"true"},I("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),I("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Ge({lines:t,variant:n}))}function Rr({rows:e=5,columns:t=4,variant:n="shimmer"}){return ue(),I("div",{class:"what-skeleton-table","aria-hidden":"true"},I("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>I("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>I("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,i)=>I("div",{key:i,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function Tr({type:e="default",height:t,children:n}){return ue(),e==="card"?dt({}):e==="text"?Ge({}):n||I("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function Ir(e,t=[]){let n=d(!0),r=d(null),o=d(null);return V(()=>{n.set(!0),o.set(null),Promise.resolve(e()).then(s=>{r.set(s),n.set(!1)}).catch(s=>{o.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>o(),Skeleton:s=>n()?je(s):null}}function Mr({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return ue(),I("div",{class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":n,role:"status"},r&&I("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function Lr({size:e=8,color:t="#666"}){ue();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return I("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},I("div",{style:{...n,animationDelay:"0s"}}),I("div",{style:{...n,animationDelay:"0.2s"}}),I("div",{style:{...n,animationDelay:"0.4s"}}))}function Dr({size:e=24,color:t="#666",strokeWidth:n=2}){return I("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},I("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),I("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var G=new Map,te=new Map,ne=new Map,Q=new Map,pt=200;function ie(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?t:JSON.stringify(t)??String(t)).map(t=>t.replace(/([\\:])/g,"\\$1")).join(":"):e}function Ae(e){return Q.set(e,Date.now()),G.has(e)||(G.set(e,d(null)),G.size>pt&&Or()),G.get(e)}function ht(e){return te.has(e)||te.set(e,d(null)),te.get(e)}function Fr(e){return ne.has(e)||ne.set(e,d(!1)),ne.get(e)}function Or(){let e=[...Q.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(pt*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];z.has(r)&&z.get(r).size>0||(G.delete(r),te.delete(r),ne.delete(r),Q.delete(r),be.delete(r))}}var z=new Map;function Ye(e,t){return z.has(e)||z.set(e,new Set),z.get(e).add(t),()=>{let n=z.get(e);n&&(n.delete(t),n.size===0&&z.delete(e))}}var qe=new Set;function We(e){return qe.add(e),()=>qe.delete(e)}var le=new Map,be=new Map,Xe=new Map;function gt(e){return Xe.get(e)||0}function Nr(e){Xe.set(e,gt(e)+1)}function we(e){return e&&typeof e.unref=="function"&&e.unref(),e}function K(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function mt(e){let t=W?.();t&&t.effects.push(e)}function yt(e){let t=typeof e=="function"?e:()=>e,n=d(ce(()=>!!t()));return K(()=>{n.set(!!t())}),n}function Pr(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=p=>p,initialData:i=null}=t,c=d(i),f=d(null),h=d(!0),a=null;async function l(){a&&a.abort(),a=new AbortController;let{signal:p}=a;h.set(!0),f.set(null);try{let S=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:p});if(!S.ok)throw new Error(`HTTP ${S.status}: ${S.statusText}`);let v=await S.json();p.aborted||c.set(s(v))}catch(S){p.aborted||f.set(S)}finally{p.aborted||h.set(!1)}}return K(()=>(l(),()=>{a&&a.abort()})),{data:()=>c(),error:()=>f(),isLoading:()=>h(),refetch:l,mutate:p=>c.set(p)}}function $r(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:i=2e3,fallbackData:c,onSuccess:f,onError:h,suspense:a=!1}=n;if(e==null||e===!1){let w=d(c||null),T=d(null);return{data:()=>w(),error:()=>T(),isLoading:()=>!1,isValidating:()=>!1,mutate:C=>w.set(typeof C=="function"?C(w()):C),revalidate:()=>Promise.resolve()}}let l=ie(e),p=Ae(l),S=ht(l),v=Fr(l),R=P(()=>p()??c??null),L=P(()=>{let w=p()==null,T=v();return w&&T}),E=null;async function M({force:w=!1}={}){let T=Date.now(),C=gt(l);if(le.has(l)){let m=le.get(l);if(w?m.epoch===C:T-m.timestamp<i)return m.refCount++,m.promise}let A=be.get(l);if(!w&&A&&T-A<i&&p.peek()!=null)return p.peek();if(E){let m=le.get(l);(!m||m.refCount<=1)&&E.abort()}E=new AbortController;let{signal:g}=E;v.set(!0);let _=t(e,{signal:g});le.set(l,{promise:_,timestamp:T,refCount:1,epoch:C});try{let m=await _;return g.aborted?void 0:(D(()=>{p.set(m),S.set(null)}),Q.set(l,Date.now()),be.set(l,Date.now()),f&&f(m,e),m)}catch(m){if(g.aborted)return;throw S.set(m),h&&h(m,e),m}finally{g.aborted||v.set(!1);let m=le.get(l);m&&(m.refCount--,m.refCount<=0&&le.delete(l))}}return K(()=>{let w=Ye(l,()=>M({force:!0}).catch(()=>{})),T=We(()=>{E&&(E.abort(),E=null)});return M().catch(()=>{}),()=>{E&&E.abort(),w(),T()}}),r&&typeof window<"u"&&K(()=>{let w=()=>{document.visibilityState==="visible"&&M().catch(()=>{})};return document.addEventListener("visibilitychange",w),()=>document.removeEventListener("visibilitychange",w)}),o&&typeof window<"u"&&K(()=>{let w=()=>M().catch(()=>{});return window.addEventListener("online",w),()=>window.removeEventListener("online",w)}),s>0&&K(()=>{let w=we(setInterval(()=>{M().catch(()=>{})},s));return()=>clearInterval(w)}),{data:()=>R(),error:()=>S(),isLoading:()=>L(),isValidating:()=>v(),mutate:(w,T=!0)=>{let C=typeof w=="function"?w(p.peek()):w;p.set(C),Q.set(l,Date.now()),T&&M().catch(()=>{})},revalidate:M}}function Hr(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:i=!0,refetchInterval:c=!1,retry:f=3,retryDelay:h=x=>Math.min(1e3*2**x,3e4),onSuccess:a,onError:l,onSettled:p,select:S,placeholderData:v}=e,R=ie(t),L=yt(r),E=Ae(R),M=P(()=>{let x=E();return S&&x!=null?S(x):x}),w=ht(R),T=d(E.peek()!=null?"success":L.peek()?"loading":"idle"),C=d("idle"),A=P(()=>{let x=T(),N=E()!=null,ae=w()!=null,J=C()==="fetching";return x==="success"&&!N||x==="error"&&!ae?J?"loading":"idle":x}),g=0,_=null,m=null;async function O({force:x=!1,manual:N=!1}={}){if(!N&&!L.peek())return;let ae=Date.now();if(!x&&E.peek()!=null&&ae-g<o)return E.peek();_&&_.controller.abort();let J=new AbortController;_={controller:J,manual:N};let{signal:q}=J;C.set("fetching"),E.peek()==null&&T.set("loading");let u=0;async function b(){try{let k=await n({queryKey:Array.isArray(t)?t:[t],signal:q});return q.aborted?void 0:(D(()=>{E.set(k),w.set(null),T.set("success"),C.set("idle")}),g=Date.now(),Q.set(R,Date.now()),a&&a(k),p&&p(k,null),m&&clearTimeout(m),m=we(setTimeout(()=>{if(Date.now()-g>=s){let y=z.get(R);(!y||y.size===0)&&(G.delete(R),te.delete(R),ne.delete(R),Q.delete(R),be.delete(R))}},s)),k)}catch(k){if(q.aborted)return;if(u++,u<f)return await new Promise((y,B)=>{let Y=we(setTimeout(y,h(u)));q.addEventListener("abort",()=>{clearTimeout(Y),B(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(y=>{if(y.name!=="AbortError")throw y}),q.aborted?void 0:b();throw D(()=>{w.set(k),T.set("error"),C.set("idle")}),l&&l(k),p&&p(null,k),k}}try{return await b()}finally{_&&_.controller===J&&(_=null)}}function H(){_&&(_.controller.abort(),_=null),D(()=>{T.peek()!=="idle"&&T.set("idle"),C.peek()!=="idle"&&C.set("idle")})}return K(()=>{let x=Ye(R,()=>O({force:!0}).catch(()=>{})),N=We(H);return L()?O().catch(()=>{}):_?.manual||D(()=>{T.peek()==="loading"&&T.set("idle"),C.peek()!=="idle"&&C.set("idle")}),()=>{_&&!_.manual&&(_.controller.abort(),_=null),x(),N()}}),mt(()=>{_&&(_.controller.abort(),_=null)}),i&&typeof window<"u"&&K(()=>{let x=()=>{document.visibilityState==="visible"&&O().catch(()=>{})};return document.addEventListener("visibilitychange",x),()=>document.removeEventListener("visibilitychange",x)}),c&&K(()=>{let x=we(setInterval(()=>{O().catch(()=>{})},c));return()=>clearInterval(x)}),{data:()=>M()??v,error:()=>w(),status:()=>A(),fetchStatus:()=>C(),isLoading:()=>A()==="loading",isError:()=>A()==="error",isSuccess:()=>A()==="success",isIdle:()=>A()==="idle",isFetching:()=>C()==="fetching",isEnabled:()=>L(),refetch:()=>O({force:!0,manual:!0})}}function Vr(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,enabled:i=!0,select:c,retry:f=3,retryDelay:h=x=>Math.min(1e3*2**x,3e4),onSuccess:a,onError:l,onSettled:p}=e,S=yt(i),v=d([]),R=d([]),L=d(!0),E=d(!1),M=d(!1),w=d(!1),T=d(null),C=d(S.peek()?"loading":"idle"),A=ie(t),g=null;function _(){g&&(g.controller.abort(),g=null),D(()=>{v.set([]),R.set([]),L.set(!0),E.set(!1),M.set(!1),w.set(!1),T.set(null),C.set("idle")})}async function m(x,N="next",{replace:ae=!1,manual:J=!1}={}){g&&g.controller.abort();let q=new AbortController;g={controller:q,manual:J,direction:N};let{signal:u}=q,b=N==="next"?M:w;b.set(!0),v.peek().length===0&&C.set("loading");let k=0;try{for(;;)try{let y=await n({queryKey:Array.isArray(t)?t:[t],pageParam:x,signal:u});return u.aborted?void 0:(D(()=>{ae?(v.set([y]),R.set([x])):N==="next"?(v.set([...v.peek(),y]),R.set([...R.peek(),x])):(v.set([y,...v.peek()]),R.set([x,...R.peek()]));let B=r?.(y,v.peek());if(L.set(B!==void 0),o){let Y=o(y,v.peek());E.set(Y!==void 0)}T.set(null),C.set("success")}),a&&a(y),p&&p(y,null),y)}catch(y){if(u.aborted)return;if(k++,k<f){if(await new Promise((B,Y)=>{let Se=we(setTimeout(B,h(k)));u.addEventListener("abort",()=>{clearTimeout(Se),Y(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(B=>{if(B.name!=="AbortError")throw B}),u.aborted)return;continue}throw D(()=>{T.set(y),C.set("error")}),l&&l(y),p&&p(null,y),y}}finally{let y=g&&g.controller!==q?g:null;(!u.aborted||!y||y.direction!==N)&&b.set(!1),g&&g.controller===q&&(g=null)}}function O({manual:x=!1}={}){return m(s,"next",{replace:!0,manual:x})}let H=P(()=>{let x={pages:v(),pageParams:R()};return c?c(x):x});return K(()=>{let x=Ye(A,()=>{S.peek()&&O().catch(()=>{})}),N=We(_);return S()?m(s,"next",{replace:!0}).catch(()=>{}):g?.manual||D(()=>{C.peek()==="loading"&&C.set("idle"),M.peek()&&M.set(!1),w.peek()&&w.set(!1)}),()=>{g&&!g.manual&&(g.controller.abort(),g=null),x(),N()}}),mt(()=>{g&&(g.controller.abort(),g=null)}),{data:()=>H(),error:()=>T(),status:()=>C(),isLoading:()=>C()==="loading",isError:()=>C()==="error",isSuccess:()=>C()==="success",isIdle:()=>C()==="idle",isFetching:()=>M()||w(),isEnabled:()=>S(),hasNextPage:()=>L(),hasPreviousPage:()=>E(),isFetchingNextPage:()=>M(),isFetchingPreviousPage:()=>w(),fetchNextPage:async()=>{let x=v.peek();if(x.length===0)return m(s,"next",{replace:!0,manual:!0});let N=r?.(x[x.length-1],x);if(N!==void 0)return m(N,"next",{manual:!0})},fetchPreviousPage:async()=>{let x=v.peek();if(x.length===0)return m(s,"previous",{replace:!0,manual:!0});let N=o?.(x[0],x);if(N!==void 0)return m(N,"previous",{manual:!0})},refetch:()=>O({manual:!0})}}function Be(){let e=new Set(G.keys());for(let t of z.keys())e.add(t);return e}function jr(e,t={}){let{hard:n=!1,exact:r=!1}=t,o=[];if(typeof e=="function")for(let s of Be())e(s)&&o.push(s);else if(Array.isArray(e)&&!r){let s=ie(e),i=s+":";for(let c of Be())(c===s||typeof c=="string"&&c.startsWith(i))&&o.push(c)}else o.push(ie(e));for(let s of o){Nr(s),n&&G.has(s)&&G.get(s).set(null);let i=z.get(s);if(i)for(let c of i)c()}}function Gr(e,t){e=ie(e);let n=Ae(e);return t(e).then(r=>(n.set(r),Q.set(e,Date.now()),r))}function qr(e,t){e=ie(e);let n=Ae(e),r=n.peek();n.set(typeof t=="function"?t(r):t),Q.set(e,Date.now())}function Br(e){return e=ie(e),G.has(e)?G.get(e).peek():void 0}function Yr(){D(()=>{for(let e of Be()){G.get(e)?.set(void 0),te.get(e)?.set(null),ne.get(e)?.set(!1);let t=z.get(e);t!==void 0&&t.size>0?Q.set(e,Date.now()):(G.delete(e),te.delete(e),ne.delete(e),Q.delete(e))}for(let e of qe)e()}),be.clear(),le.clear(),Xe.clear()}function Wr(){let e=[];for(let[t,n]of G)e.push({key:t,data:n.peek(),error:te.has(t)?te.get(t).peek():null,isValidating:ne.has(t)?ne.get(t).peek():!1});return e}function xt(e,t){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t)}function Xr(e,t){return typeof e!="function"?t:typeof t!="function"?e:function(...r){return e.apply(this,r),t.apply(this,r)}}function zr(e,t){let n={...e},r=new Map;for(let o in n)Le(o)&&r.set(o.slice(2).toLowerCase(),o);for(let o in t){let s=t[o];if(!Le(o)){n[o]=s;continue}let i=r.get(o.slice(2).toLowerCase());if(i===void 0){n[o]=s,r.set(o.slice(2).toLowerCase(),o);continue}n[i]=Xr(s,n[i])}return n}function Qr(e={}){let t=W?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=vt(e)),t.hooks[n]}return vt(e)}function vt(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},i={},c={},f=d({});function h(u){return s[u]||(s[u]=d(t[u]??"")),s[u]}function a(u){return i[u]||(i[u]=d(null)),i[u]}function l(u){return c[u]||(c[u]=d(!1)),c[u]}let p=d(!1),S=d(!1),v=d(!1),R=d(!1),L=d(0);function E(u=!1){let b={...t};for(let[k,y]of Object.entries(s))b[k]=u?y():y.peek();return b}function M(u=!1){return u?f():f.peek()}function w(u,b){let k=b??null;a(u).set(k),f.set(y=>{if(y[u]===k)return y;if(k==null){if(!Object.prototype.hasOwnProperty.call(y,u))return y;let Y={...y};return delete Y[u],Y}return{...y,[u]:k}})}function T(u={}){let b=u||{};D(()=>{for(let[k,y]of Object.entries(i))Object.prototype.hasOwnProperty.call(b,k)||y.set(null);for(let[k,y]of Object.entries(b))a(k).set(y??null);f.set({...b})})}let C=P(()=>Object.keys(M(!0)).length===0),A=P(()=>{let u={};for(let[b,k]of Object.entries(s))k()!==(t[b]??"")&&(u[b]=!0);return u});async function g(u){if(!o)return!0;R.set(!0);try{let k=(await o(E(!1)))?.errors||{};if(u){let y=k[u]??null;return w(u,y),!y}else return T(k),Object.keys(k).length===0}finally{R.set(!1)}}function _(u,b={}){let k=h(u),y=b.type==="radio",B=b.type==="checkbox",Y=y&&b.value!==void 0;function Se(j){if(Y)return b.value;if(j)return typeof j.hasAttribute=="function"?j.hasAttribute("value")?j.value:void 0:j.value}let ze=!1,Qe=!1,Ie=j=>{let $=j&&j.target;if(!$){F&&console.warn(`[what] register("${u}") change handler was called without an event. Pass the DOM event through (or call form.setValue() directly). Ignoring.`);return}let pe=b.type||$.type,Z;if(pe==="radio"){if(Z=Se($),Z===void 0){F&&!ze&&(ze=!0,console.warn(`[what] register("${u}", { type: 'radio' }) cannot tell which value this radio contributes: pass { value } or give the <input> a value attribute. Field left unchanged.`));return}}else pe==="checkbox"?Z=$.checked:Z=$.value;m(u,Z),(n==="onChange"||v.peek()&&r==="onChange")&&g(u)},U={name:u,onBlur:()=>{l(u).set(!0),(n==="onBlur"||v.peek()&&r==="onBlur")&&g(u)},onFocus:()=>{},ref:b.ref};if(y){let j=Y?()=>k()===b.value:()=>!1;Y&&(U.value=b.value),U.checked=j,U.onchange=Ie,U.ref=$=>{if(xt(b.ref,$),!$||typeof $!="object")return;$._propEffects||($._propEffects={});let pe="checked:property";if($._propEffects[pe])try{$._propEffects[pe]()}catch{}$._propEffects[pe]=V(()=>{let Z=Se($);$.checked=Z!==void 0&&k()===Z})}}else B?(Object.defineProperty(U,"checked",{get(){return!!k()},enumerable:!0}),U.onchange=Ie):(Object.defineProperty(U,"value",{get(){return k()},enumerable:!0}),U.oninput=Ie,U.ref=j=>{xt(b.ref,j),F&&!Qe&&j&&j.type==="radio"&&(Qe=!0,console.warn(`[what] register("${u}") was spread onto <input type="radio"> without a type. Radios in a group share one field holding the SELECTED option, so the registration must be told this radio's value: register("${u}", { type: 'radio', value: ... }), or use <Radio name value register />. As written, the registration overwrote the input's own value and the group cannot record a choice.`))});return U}function m(u,b,k={}){let{shouldValidate:y=!1,shouldDirty:B=!0}=k;h(u).set(b),B&&p.set(!0),y&&g(u)}function O(u){return h(u)()}function H(u,b){w(u,b)}function x(u){w(u,null)}function N(){T({})}function ae(u=t){D(()=>{for(let[b,k]of Object.entries(s))k.set(u[b]??"");for(let b of Object.values(i))b.set(null);f.set({});for(let b of Object.values(c))b.set(!1);p.set(!1),v.set(!1)})}function J(u,b){return async k=>{k&&k.preventDefault(),S.set(!0),v.set(!0),L.set(L.peek()+1);try{await g()?await u(E()):b&&b(M(!1))}finally{S.set(!1)}}}function q(u){return u?P(()=>h(u)()):P(()=>E(!0))}return{register:_,handleSubmit:J,setValue:m,getValue:O,setError:H,clearError:x,clearErrors:N,reset:ae,watch:q,validate:g,formState:{get values(){return E(!0)},get errors(){return M(!0)},error:u=>a(u)(),get touched(){let u={};for(let[b,k]of Object.entries(c))k()&&(u[b]=!0);return u},isDirty:()=>p(),isValid:C,isValidating:()=>R(),isSubmitting:()=>S(),isSubmitted:()=>v(),submitCount:()=>L(),dirtyFields:A}}}function Ur(e){return!e||typeof e!="object"?null:Array.isArray(e.issues)?e.issues:Array.isArray(e.errors)?e.errors:null}function Kr(e){let t=e?.path;if(t==null)return"";if(!Array.isArray(t))return String(t);let n="";for(let r=0;r<t.length;r++){let o=t[r];n+=(r?".":"")+(typeof o=="symbol"?o.toString():String(o))}return n}function Jr(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r=Ur(n);if(!r)throw n;let o={};for(let s of r){let i=Kr(s);o[i]||(o[i]={type:s.code??"validation",message:s.message})}return Object.keys(o).length===0&&(o[""]={type:"validation",message:n?.message||"Validation failed"}),{values:{},errors:o}}}}function Zr(e){return!e||typeof e!="object"?!1:e.name==="ValidationError"||Array.isArray(e.inner)}function eo(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){if(!Zr(n))throw n;let r={},o=Array.isArray(n.inner)&&n.inner.length>0?n.inner:[n];for(let s of o){let i=s.path??"";r[i]||(r[i]={type:s.type??"validation",message:s.message})}return{values:{},errors:r}}}}function to(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let i of o){let c=i(s,t);if(c){n[r]={type:"validation",message:c};break}}}return{values:t,errors:n}}}var no={required:(e="This field is required")=>t=>{if(t==null||t==="")return e},minLength:(e,t)=>n=>{if(typeof n=="string"&&n.length<e)return t||`Must be at least ${e} characters`},maxLength:(e,t)=>n=>{if(typeof n=="string"&&n.length>e)return t||`Must be at most ${e} characters`},min:(e,t)=>n=>{if(typeof n=="number"&&n<e)return t||`Must be at least ${e}`},max:(e,t)=>n=>{if(typeof n=="number"&&n>e)return t||`Must be at most ${e}`},pattern:(e,t="Invalid format")=>n=>{if(typeof n=="string"&&!e.test(n))return t},email:(e="Invalid email address")=>t=>{if(typeof t=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return e},url:(e="Invalid URL")=>t=>{try{typeof t=="string"&&t&&new URL(t)}catch{return e}},match:(e,t)=>(n,r)=>{if(n!==r[e])return t||`Must match ${e}`},custom:e=>e};function ro(e,t={}){let{validate:n,defaultValue:r=""}=t,o=d(r),s=d(null),i=d(!1),c=d(!1);async function f(){if(!n)return!0;let h=await n(o.peek());return s.set(h||null),!h}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>i(),isDirty:()=>c(),setValue:h=>{o.set(h),c.set(!0)},setError:h=>s.set(h),validate:f,reset:()=>{o.set(r),s.set(null),i.set(!1),c.set(!1)},inputProps:()=>({name:e,value:o(),onInput:h=>{o.set(h.target.value),c.set(!0)},onBlur:()=>{i.set(!0),f()}})}}function oo(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return I("input",{...r,...o,"aria-invalid":n?"true":void 0})}function so(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return I("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function io(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return I("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function ao(e){let{register:t,...n}=e,r=t?t(e.name):{};return I("input",{type:"checkbox",...n,...r,checked:r.value})}function co(e){let{register:t,value:n,...r}=e;if(n===void 0)return F&&console.warn(`[what] <Radio name="${e.name}"> is missing a \`value\` prop. Radios in a group share one field holding the selected option's value, so a valueless radio has nothing to contribute and cannot be checked. Rendering it unregistered.`),I("input",{type:"radio",...r});let o=t?t(e.name,{type:"radio",value:n,ref:r.ref}):{};return I("input",zr({type:"radio",value:n,...r},o))}function uo({name:e,formState:t,errors:n,render:r}){let o=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return o?r?r({message:o.message,type:o.type}):I("span",{class:"what-error",role:"alert"},o.message):null}var bt={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
|
|
53
|
+
`,pt=!1;function le(){if(pt||typeof document>"u")return;pt=!0;let e=document.createElement("style");e.textContent=Ar,document.head.appendChild(e)}function Ge({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:a=1}){le();let c=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=o?`${c} ${o}`:c,p={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return a===1?D("div",{class:u,style:p,"aria-hidden":"true"}):Array.from({length:a},(i,h)=>D("div",{key:h,class:u,style:{...p,marginBottom:h<a-1?"8px":void 0},"aria-hidden":"true"}))}function Ue({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return le(),D("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,a)=>D("div",{key:a,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:a===e-1?t:"100%",marginBottom:a<e-1?`${r}px`:void 0}})))}function Ir({size:e=40,variant:t="shimmer"}){return Ge({width:e,height:e,circle:!0,variant:t})}function ht({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return le(),D("div",{class:"what-skeleton-card","aria-hidden":"true"},D("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),D("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Ue({lines:t,variant:n}))}function Tr({rows:e=5,columns:t=4,variant:n="shimmer"}){return le(),D("div",{class:"what-skeleton-table","aria-hidden":"true"},D("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>D("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>D("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,a)=>D("div",{key:a,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function Dr({type:e="default",height:t,children:n}){return le(),e==="card"?ht({}):e==="text"?Ue({}):n||D("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function Nr(e,t=[]){let n=d(!0),r=d(null),o=d(null);return V(()=>{n.set(!0),o.set(null),Promise.resolve(e()).then(s=>{r.set(s),n.set(!1)}).catch(s=>{o.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>o(),Skeleton:s=>n()?Ge(s):null}}function Or({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return le(),D("div",{class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":n,role:"status"},r&&D("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function Lr({size:e=8,color:t="#666"}){le();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return D("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},D("div",{style:{...n,animationDelay:"0s"}}),D("div",{style:{...n,animationDelay:"0.2s"}}),D("div",{style:{...n,animationDelay:"0.4s"}}))}function Mr({size:e=24,color:t="#666",strokeWidth:n=2}){return D("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},D("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),D("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var U=new Map,ee=new Map,te=new Map,z=new Map,gt=200;function ae(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?t:JSON.stringify(t)??String(t)).map(t=>t.replace(/([\\:])/g,"\\$1")).join(":"):e}function Ce(e){return z.set(e,Date.now()),U.has(e)||(U.set(e,d(null)),U.size>gt&&Pr()),U.get(e)}function mt(e){return ee.has(e)||ee.set(e,d(null)),ee.get(e)}function Fr(e){return te.has(e)||te.set(e,d(!1)),te.get(e)}function Pr(){let e=[...z.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(gt*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];X.has(r)&&X.get(r).size>0||(U.delete(r),ee.delete(r),te.delete(r),z.delete(r),Ee.delete(r))}}var X=new Map;function Be(e,t){return X.has(e)||X.set(e,new Set),X.get(e).add(t),()=>{let n=X.get(e);n&&(n.delete(t),n.size===0&&X.delete(e))}}var je=new Set;function We(e){return je.add(e),()=>je.delete(e)}var ue=new Map,Ee=new Map,Ye=new Map;function yt(e){return Ye.get(e)||0}function Hr(e){Ye.set(e,yt(e)+1)}function xe(e){return e&&typeof e.unref=="function"&&e.unref(),e}function K(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function vt(e){let t=W?.();t&&t.effects.push(e)}function wt(e){let t=typeof e=="function"?e:()=>e,n=d(ce(()=>!!t()));return K(()=>{n.set(!!t())}),n}function $r(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=g=>g,initialData:a=null}=t,c=d(a),u=d(null),p=d(!0),i=null;async function h(){i&&i.abort(),i=new AbortController;let{signal:g}=i;p.set(!0),u.set(null);try{let _=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:g});if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);let b=await _.json();g.aborted||c.set(s(b))}catch(_){g.aborted||u.set(_)}finally{g.aborted||p.set(!1)}}return K(()=>(h(),()=>{i&&i.abort()})),{data:()=>c(),error:()=>u(),isLoading:()=>p(),refetch:h,mutate:g=>c.set(g)}}function Vr(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:a=2e3,fallbackData:c,onSuccess:u,onError:p}=n;if(e==null||e===!1){let E=d(c||null),T=d(null);return{data:()=>E(),error:()=>T(),isLoading:()=>!1,isValidating:()=>!1,mutate:N=>E.set(typeof N=="function"?N(E()):N),revalidate:()=>Promise.resolve()}}let i=ae(e),h=Ce(i),g=mt(i),_=Fr(i),b=P(()=>h()??c??null),R=P(()=>{let E=h()==null,T=_();return E&&T}),C=null;async function S({force:E=!1}={}){let T=Date.now(),N=yt(i);if(ue.has(i)){let f=ue.get(i);if(E?f.epoch===N:T-f.timestamp<a)return f.refCount++,f.promise}let A=Ee.get(i);if(!E&&A&&T-A<a&&h.peek()!=null)return h.peek();if(C){let f=ue.get(i);(!f||f.refCount<=1)&&C.abort()}C=new AbortController;let{signal:k}=C;_.set(!0);let m=t(e,{signal:k});ue.set(i,{promise:m,timestamp:T,refCount:1,epoch:N});try{let f=await m;return k.aborted?void 0:(O(()=>{h.set(f),g.set(null)}),z.set(i,Date.now()),Ee.set(i,Date.now()),u&&u(f,e),f)}catch(f){if(k.aborted)return;throw g.set(f),p&&p(f,e),f}finally{k.aborted||_.set(!1);let f=ue.get(i);f&&(f.refCount--,f.refCount<=0&&ue.delete(i))}}return K(()=>{let E=Be(i,()=>S({force:!0}).catch(()=>{})),T=We(()=>{C&&(C.abort(),C=null)});return S().catch(()=>{}),()=>{C&&C.abort(),E(),T()}}),r&&typeof window<"u"&&K(()=>{let E=()=>{document.visibilityState==="visible"&&S().catch(()=>{})};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)}),o&&typeof window<"u"&&K(()=>{let E=()=>S().catch(()=>{});return window.addEventListener("online",E),()=>window.removeEventListener("online",E)}),s>0&&K(()=>{let E=xe(setInterval(()=>{S().catch(()=>{})},s));return()=>clearInterval(E)}),{data:()=>b(),error:()=>g(),isLoading:()=>R(),isValidating:()=>_(),mutate:(E,T=!0)=>{let N=typeof E=="function"?E(h.peek()):E;h.set(N),z.set(i,Date.now()),T&&S().catch(()=>{})},revalidate:S}}function Gr(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:a=!0,refetchInterval:c=!1,retry:u=3,retryDelay:p=v=>Math.min(1e3*2**v,3e4),onSuccess:i,onError:h,onSettled:g,select:_,placeholderData:b}=e,R=ae(t),C=wt(r),S=Ce(R),E=P(()=>{let v=S();return _&&v!=null?_(v):v}),T=mt(R),N=d(S.peek()!=null?"success":C.peek()?"loading":"idle"),A=d("idle"),k=P(()=>{let v=N(),M=S()!=null,ie=T()!=null,J=A()==="fetching";return v==="success"&&!M||v==="error"&&!ie?J?"loading":"idle":v}),m=0,f=null,I=null;async function F({force:v=!1,manual:M=!1}={}){if(!M&&!C.peek())return;let ie=Date.now();if(!v&&S.peek()!=null&&ie-m<o)return S.peek();f&&f.controller.abort();let J=new AbortController;f={controller:J,manual:M};let{signal:j}=J;A.set("fetching"),S.peek()==null&&N.set("loading");let l=0;async function w(){try{let x=await n({queryKey:Array.isArray(t)?t:[t],signal:j});return j.aborted?void 0:(O(()=>{S.set(x),T.set(null),N.set("success"),A.set("idle")}),m=Date.now(),z.set(R,Date.now()),i&&i(x),g&&g(x,null),I&&clearTimeout(I),I=xe(setTimeout(()=>{if(Date.now()-m>=s){let y=X.get(R);(!y||y.size===0)&&(U.delete(R),ee.delete(R),te.delete(R),z.delete(R),Ee.delete(R))}},s)),x)}catch(x){if(j.aborted)return;if(l++,l<u)return await new Promise((y,q)=>{let B=xe(setTimeout(y,p(l)));j.addEventListener("abort",()=>{clearTimeout(B),q(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(y=>{if(y.name!=="AbortError")throw y}),j.aborted?void 0:w();throw O(()=>{T.set(x),N.set("error"),A.set("idle")}),h&&h(x),g&&g(null,x),x}}try{return await w()}finally{f&&f.controller===J&&(f=null)}}function $(){f&&(f.controller.abort(),f=null),O(()=>{N.peek()!=="idle"&&N.set("idle"),A.peek()!=="idle"&&A.set("idle")})}return K(()=>{let v=Be(R,()=>F({force:!0}).catch(()=>{})),M=We($);return C()?F().catch(()=>{}):f?.manual||O(()=>{N.peek()==="loading"&&N.set("idle"),A.peek()!=="idle"&&A.set("idle")}),()=>{f&&!f.manual&&(f.controller.abort(),f=null),v(),M()}}),vt(()=>{f&&(f.controller.abort(),f=null)}),a&&typeof window<"u"&&K(()=>{let v=()=>{document.visibilityState==="visible"&&F().catch(()=>{})};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)}),c&&K(()=>{let v=xe(setInterval(()=>{F().catch(()=>{})},c));return()=>clearInterval(v)}),{data:()=>E()??b,error:()=>T(),status:()=>k(),fetchStatus:()=>A(),isLoading:()=>k()==="loading",isError:()=>k()==="error",isSuccess:()=>k()==="success",isIdle:()=>k()==="idle",isFetching:()=>A()==="fetching",isEnabled:()=>C(),refetch:()=>F({force:!0,manual:!0})}}function Ur(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,enabled:a=!0,select:c,retry:u=3,retryDelay:p=v=>Math.min(1e3*2**v,3e4),onSuccess:i,onError:h,onSettled:g}=e,_=wt(a),b=d([]),R=d([]),C=d(!0),S=d(!1),E=d(!1),T=d(!1),N=d(null),A=d(_.peek()?"loading":"idle"),k=ae(t),m=null;function f(){m&&(m.controller.abort(),m=null),O(()=>{b.set([]),R.set([]),C.set(!0),S.set(!1),E.set(!1),T.set(!1),N.set(null),A.set("idle")})}async function I(v,M="next",{replace:ie=!1,manual:J=!1}={}){m&&m.controller.abort();let j=new AbortController;m={controller:j,manual:J,direction:M};let{signal:l}=j,w=M==="next"?E:T;w.set(!0),b.peek().length===0&&A.set("loading");let x=0;try{for(;;)try{let y=await n({queryKey:Array.isArray(t)?t:[t],pageParam:v,signal:l});return l.aborted?void 0:(O(()=>{ie?(b.set([y]),R.set([v])):M==="next"?(b.set([...b.peek(),y]),R.set([...R.peek(),v])):(b.set([y,...b.peek()]),R.set([v,...R.peek()]));let q=r?.(y,b.peek());if(C.set(q!==void 0),o){let B=o(y,b.peek());S.set(B!==void 0)}N.set(null),A.set("success")}),i&&i(y),g&&g(y,null),y)}catch(y){if(l.aborted)return;if(x++,x<u){if(await new Promise((q,B)=>{let Se=xe(setTimeout(q,p(x)));l.addEventListener("abort",()=>{clearTimeout(Se),B(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(q=>{if(q.name!=="AbortError")throw q}),l.aborted)return;continue}throw O(()=>{N.set(y),A.set("error")}),h&&h(y),g&&g(null,y),y}}finally{let y=m&&m.controller!==j?m:null;(!l.aborted||!y||y.direction!==M)&&w.set(!1),m&&m.controller===j&&(m=null)}}function F({manual:v=!1}={}){return I(s,"next",{replace:!0,manual:v})}let $=P(()=>{let v={pages:b(),pageParams:R()};return c?c(v):v});return K(()=>{let v=Be(k,()=>{_.peek()&&F().catch(()=>{})}),M=We(f);return _()?I(s,"next",{replace:!0}).catch(()=>{}):m?.manual||O(()=>{A.peek()==="loading"&&A.set("idle"),E.peek()&&E.set(!1),T.peek()&&T.set(!1)}),()=>{m&&!m.manual&&(m.controller.abort(),m=null),v(),M()}}),vt(()=>{m&&(m.controller.abort(),m=null)}),{data:()=>$(),error:()=>N(),status:()=>A(),isLoading:()=>A()==="loading",isError:()=>A()==="error",isSuccess:()=>A()==="success",isIdle:()=>A()==="idle",isFetching:()=>E()||T(),isEnabled:()=>_(),hasNextPage:()=>C(),hasPreviousPage:()=>S(),isFetchingNextPage:()=>E(),isFetchingPreviousPage:()=>T(),fetchNextPage:async()=>{let v=b.peek();if(v.length===0)return I(s,"next",{replace:!0,manual:!0});let M=r?.(v[v.length-1],v);if(M!==void 0)return I(M,"next",{manual:!0})},fetchPreviousPage:async()=>{let v=b.peek();if(v.length===0)return I(s,"previous",{replace:!0,manual:!0});let M=o?.(v[0],v);if(M!==void 0)return I(M,"previous",{manual:!0})},refetch:()=>F({manual:!0})}}function qe(){let e=new Set(U.keys());for(let t of X.keys())e.add(t);return e}function jr(e,t={}){let{hard:n=!1,exact:r=!1}=t,o=[];if(typeof e=="function")for(let s of qe())e(s)&&o.push(s);else if(Array.isArray(e)&&!r){let s=ae(e),a=s+":";for(let c of qe())(c===s||typeof c=="string"&&c.startsWith(a))&&o.push(c)}else o.push(ae(e));for(let s of o){Hr(s),n&&U.has(s)&&U.get(s).set(null);let a=X.get(s);if(a)for(let c of a)c()}}function qr(e,t){e=ae(e);let n=Ce(e);return t(e).then(r=>(n.set(r),z.set(e,Date.now()),r))}function Br(e,t){e=ae(e);let n=Ce(e),r=n.peek();n.set(typeof t=="function"?t(r):t),z.set(e,Date.now())}function Wr(e){return e=ae(e),U.has(e)?U.get(e).peek():void 0}function Yr(){O(()=>{for(let e of qe()){U.get(e)?.set(void 0),ee.get(e)?.set(null),te.get(e)?.set(!1);let t=X.get(e);t!==void 0&&t.size>0?z.set(e,Date.now()):(U.delete(e),ee.delete(e),te.delete(e),z.delete(e))}for(let e of je)e()}),Ee.clear(),ue.clear(),Ye.clear()}function Xr(){let e=[];for(let[t,n]of U)e.push({key:t,data:n.peek(),error:ee.has(t)?ee.get(t).peek():null,isValidating:te.has(t)?te.get(t).peek():!1});return e}function xt(e,t){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t)}function zr(e,t){return typeof e!="function"?t:typeof t!="function"?e:function(...r){return e.apply(this,r),t.apply(this,r)}}function Qr(e,t){let n={...e},r=new Map;for(let o in n)Ne(o)&&r.set(o.slice(2).toLowerCase(),o);for(let o in t){let s=t[o];if(!Ne(o)){n[o]=s;continue}let a=r.get(o.slice(2).toLowerCase());if(a===void 0){n[o]=s,r.set(o.slice(2).toLowerCase(),o);continue}n[a]=zr(s,n[a])}return n}function Kr(e={}){let t=W?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=Et(e)),t.hooks[n]}return Et(e)}function Et(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},a={},c={},u=d({});function p(l){return s[l]||(s[l]=d(t[l]??"")),s[l]}function i(l){return a[l]||(a[l]=d(null)),a[l]}function h(l){return c[l]||(c[l]=d(!1)),c[l]}let g=d(!1),_=d(!1),b=d(!1),R=d(!1),C=d(0);function S(l=!1){let w={...t};for(let[x,y]of Object.entries(s))w[x]=l?y():y.peek();return w}function E(l=!1){return l?u():u.peek()}function T(l,w){let x=w??null;i(l).set(x),u.set(y=>{if(y[l]===x)return y;if(x==null){if(!Object.prototype.hasOwnProperty.call(y,l))return y;let B={...y};return delete B[l],B}return{...y,[l]:x}})}function N(l={}){let w=l||{};O(()=>{for(let[x,y]of Object.entries(a))Object.prototype.hasOwnProperty.call(w,x)||y.set(null);for(let[x,y]of Object.entries(w))i(x).set(y??null);u.set({...w})})}let A=P(()=>Object.keys(E(!0)).length===0),k=P(()=>{let l={};for(let[w,x]of Object.entries(s))x()!==(t[w]??"")&&(l[w]=!0);return l});async function m(l){if(!o)return!0;R.set(!0);try{let x=(await o(S(!1)))?.errors||{};if(l){let y=x[l]??null;return T(l,y),!y}else return N(x),Object.keys(x).length===0}finally{R.set(!1)}}function f(l,w={}){let x=p(l),y=w.type==="radio",q=w.type==="checkbox",B=y&&w.value!==void 0;function Se(G){if(B)return w.value;if(G)return typeof G.hasAttribute=="function"?G.hasAttribute("value")?G.value:void 0:G.value}let Qe=!1,Ke=!1,Te=G=>{let H=G&&G.target;if(!H){L&&console.warn(`[what] register("${l}") change handler was called without an event. Pass the DOM event through (or call form.setValue() directly). Ignoring.`);return}let he=w.type||H.type,ne;if(he==="radio"){if(ne=Se(H),ne===void 0){L&&!Qe&&(Qe=!0,console.warn(`[what] register("${l}", { type: 'radio' }) cannot tell which value this radio contributes: pass { value } or give the <input> a value attribute. Field left unchanged.`));return}}else he==="checkbox"?ne=H.checked:ne=H.value;I(l,ne),(n==="onChange"||b.peek()&&r==="onChange")&&m(l)},Q={name:l,onBlur:()=>{h(l).set(!0),(n==="onBlur"||b.peek()&&r==="onBlur")&&m(l)},onFocus:()=>{},ref:w.ref};if(y){let G=B?()=>x()===w.value:()=>!1;B&&(Q.value=w.value),Q.checked=G,Q.onchange=Te,Q.ref=H=>{if(xt(w.ref,H),!H||typeof H!="object")return;H._propEffects||(H._propEffects={});let he="checked:property";if(H._propEffects[he])try{H._propEffects[he]()}catch{}H._propEffects[he]=V(()=>{let ne=Se(H);H.checked=ne!==void 0&&x()===ne})}}else q?(Object.defineProperty(Q,"checked",{get(){return!!x()},enumerable:!0}),Q.onchange=Te):(Object.defineProperty(Q,"value",{get(){return x()},enumerable:!0}),Q.oninput=Te,Q.ref=G=>{xt(w.ref,G),L&&!Ke&&G&&G.type==="radio"&&(Ke=!0,console.warn(`[what] register("${l}") was spread onto <input type="radio"> without a type. Radios in a group share one field holding the SELECTED option, so the registration must be told this radio's value: register("${l}", { type: 'radio', value: ... }), or use <Radio name value register />. As written, the registration overwrote the input's own value and the group cannot record a choice.`))});return Q}function I(l,w,x={}){let{shouldValidate:y=!1,shouldDirty:q=!0}=x;p(l).set(w),q&&g.set(!0),y&&m(l)}function F(l){return p(l)()}function $(l,w){T(l,w)}function v(l){T(l,null)}function M(){N({})}function ie(l=t){O(()=>{for(let[w,x]of Object.entries(s))x.set(l[w]??"");for(let w of Object.values(a))w.set(null);u.set({});for(let w of Object.values(c))w.set(!1);g.set(!1),b.set(!1)})}function J(l,w){return async x=>{x&&x.preventDefault(),_.set(!0),b.set(!0),C.set(C.peek()+1);try{await m()?await l(S()):w&&w(E(!1))}finally{_.set(!1)}}}function j(l){return l?P(()=>p(l)()):P(()=>S(!0))}return{register:f,handleSubmit:J,setValue:I,getValue:F,setError:$,clearError:v,clearErrors:M,reset:ie,watch:j,validate:m,formState:{get values(){return S(!0)},get errors(){return E(!0)},error:l=>i(l)(),get touched(){let l={};for(let[w,x]of Object.entries(c))x()&&(l[w]=!0);return l},isDirty:()=>g(),isValid:A,isValidating:()=>R(),isSubmitting:()=>_(),isSubmitted:()=>b(),submitCount:()=>C(),dirtyFields:k}}}function Jr(e){return!e||typeof e!="object"?null:Array.isArray(e.issues)?e.issues:Array.isArray(e.errors)?e.errors:null}function Zr(e){let t=e?.path;if(t==null)return"";if(!Array.isArray(t))return String(t);let n="";for(let r=0;r<t.length;r++){let o=t[r];n+=(r?".":"")+(typeof o=="symbol"?o.toString():String(o))}return n}function eo(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r=Jr(n);if(!r)throw n;let o={};for(let s of r){let a=Zr(s);o[a]||(o[a]={type:s.code??"validation",message:s.message})}return Object.keys(o).length===0&&(o[""]={type:"validation",message:n?.message||"Validation failed"}),{values:{},errors:o}}}}function to(e){return!e||typeof e!="object"?!1:e.name==="ValidationError"||Array.isArray(e.inner)}function no(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){if(!to(n))throw n;let r={},o=Array.isArray(n.inner)&&n.inner.length>0?n.inner:[n];for(let s of o){let a=s.path??"";r[a]||(r[a]={type:s.type??"validation",message:s.message})}return{values:{},errors:r}}}}function ro(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let a of o){let c=a(s,t);if(c){n[r]={type:"validation",message:c};break}}}return{values:t,errors:n}}}var oo={required:(e="This field is required")=>t=>{if(t==null||t==="")return e},minLength:(e,t)=>n=>{if(typeof n=="string"&&n.length<e)return t||`Must be at least ${e} characters`},maxLength:(e,t)=>n=>{if(typeof n=="string"&&n.length>e)return t||`Must be at most ${e} characters`},min:(e,t)=>n=>{if(typeof n=="number"&&n<e)return t||`Must be at least ${e}`},max:(e,t)=>n=>{if(typeof n=="number"&&n>e)return t||`Must be at most ${e}`},pattern:(e,t="Invalid format")=>n=>{if(typeof n=="string"&&!e.test(n))return t},email:(e="Invalid email address")=>t=>{if(typeof t=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return e},url:(e="Invalid URL")=>t=>{try{typeof t=="string"&&t&&new URL(t)}catch{return e}},match:(e,t)=>(n,r)=>{if(n!==r[e])return t||`Must match ${e}`},custom:e=>e};function so(e,t={}){let{validate:n,defaultValue:r=""}=t,o=d(r),s=d(null),a=d(!1),c=d(!1);async function u(){if(!n)return!0;let p=await n(o.peek());return s.set(p||null),!p}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>a(),isDirty:()=>c(),setValue:p=>{o.set(p),c.set(!0)},setError:p=>s.set(p),validate:u,reset:()=>{o.set(r),s.set(null),a.set(!1),c.set(!1)},inputProps:()=>({name:e,value:o(),onInput:p=>{o.set(p.target.value),c.set(!0)},onBlur:()=>{a.set(!0),u()}})}}function ao(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return D("input",{...r,...o,"aria-invalid":n?"true":void 0})}function io(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return D("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function co(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return D("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function lo(e){let{register:t,...n}=e,r=t?t(e.name):{};return D("input",{type:"checkbox",...n,...r,checked:r.value})}function uo(e){let{register:t,value:n,...r}=e;if(n===void 0)return L&&console.warn(`[what] <Radio name="${e.name}"> is missing a \`value\` prop. Radios in a group share one field holding the selected option's value, so a valueless radio has nothing to contribute and cannot be checked. Rendering it unregistered.`),D("input",{type:"radio",...r});let o=t?t(e.name,{type:"radio",value:n,ref:r.ref}):{};return D("input",Qr({type:"radio",value:n,...r},o))}function fo({name:e,formState:t,errors:n,render:r}){let o=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return o?r?r({message:o.message,type:o.type}):D("span",{class:"what-error",role:"alert"},o.message):null}var ze={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
|
|
54
54
|
effect(() => { count(count() + 1); });
|
|
55
55
|
|
|
56
56
|
// Good \u2014 use untrack() so the read doesn't subscribe:
|
|
@@ -120,6 +120,83 @@ redirect(ALLOWED.has(query.next) ? query.next : '/');`},REDIRECT_NOT_CAUGHT:{cod
|
|
|
120
120
|
|
|
121
121
|
// On the server, catch it instead of navigating:
|
|
122
122
|
try { html = renderToString(<App />); }
|
|
123
|
-
catch (e) { if (e.name === 'RouterRedirect') return Response.redirect(e.to, 302); throw e; }`}
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
catch (e) { if (e.name === 'RouterRedirect') return Response.redirect(e.to, 302); throw e; }`},NO_SECURE_RANDOM:{code:"ERR_NO_SECURE_RANDOM",severity:"error",template:"[what] No secure random source available for CSRF token generation.",suggestion:"Neither globalThis.crypto.getRandomValues nor node:crypto was reachable. On Node this means a build older than 18 or a bundler that stripped node:crypto; on an edge runtime it means the Web Crypto global was not provided. A CSRF token from Math.random is not a token, so this refuses rather than degrading.",codeExample:`// Node 18+ exposes Web Crypto globally; nothing to configure.
|
|
124
|
+
// If a bundler dropped it, restore the global before creating the server:
|
|
125
|
+
import { webcrypto } from 'node:crypto';
|
|
126
|
+
globalThis.crypto ??= webcrypto;`},ACTION_FAILED:{code:"ERR_ACTION_FAILED",severity:"error",template:"{{message}}",suggestion:"The server action rejected. The message is the one the action threw, forwarded to the client by the action handler. Throw a typed error from the action and branch on its shape rather than parsing this string.",codeExample:`// In the action, fail with something the client can read:
|
|
127
|
+
export const save = action(async (data) => {
|
|
128
|
+
if (!data.email) throw Object.assign(new Error('Email required'), { field: 'email' });
|
|
129
|
+
});`},STATIC_WRITE_ESCAPE:{code:"ERR_STATIC_WRITE_ESCAPE",severity:"error",template:"[what-server] Refusing to write outside outDir: {{path}}.",suggestion:'A route path resolved to a location outside the export directory, which a "../" segment in a route or a param can do. Sanitize the route path, or drop the route from the static export.',codeExample:`// Bad \u2014 a param that can contain a slash escapes outDir:
|
|
130
|
+
{ path: '/docs/:slug*', mode: 'static' }
|
|
131
|
+
|
|
132
|
+
// Good \u2014 constrain the param, or precompute the exact paths:
|
|
133
|
+
{ path: '/docs/:slug', mode: 'static', paths: () => slugs.map(slug => ({ slug })) }`},INVALID_SSR_TAG:{code:"ERR_INVALID_SSR_TAG",severity:"error",template:"[what-server] Invalid tag name in SSR: {{tag}}.",suggestion:"renderToString reached a vnode whose tag is neither a string nor a component function. This is almost always a component that returned a raw object, or a value interpolated where an element was expected.",codeExample:`// Bad \u2014 returns a plain object, not a vnode:
|
|
134
|
+
function Row() { return { name: 'a' }; }
|
|
135
|
+
|
|
136
|
+
// Good \u2014 return elements, and interpolate values as children:
|
|
137
|
+
function Row({ name }) { return <li>{name}</li>; }`},FORM_ACTION_NOT_REGISTERED:{code:"ERR_FORM_ACTION_NOT_REGISTERED",severity:"error",template:"[what] <Form action={fn}>: that function is not a server action.",suggestion:"Wrap it with action() from what-server, or pass the action id as a string. A plain function has no id, so there is nothing for the form post to address.",codeExample:`// Bad \u2014 a plain function:
|
|
138
|
+
async function save(data) {}
|
|
139
|
+
<Form action={save} />
|
|
140
|
+
|
|
141
|
+
// Good \u2014 a registered action:
|
|
142
|
+
export const save = action(async (data) => {});
|
|
143
|
+
<Form action={save} />`},FORM_ACTION_MISSING:{code:"ERR_FORM_ACTION_MISSING",severity:"error",template:"[what] <Form> requires an `action` prop: a server action or its id.",suggestion:"Pass the action itself, or the string id it was registered under.",codeExample:`// Bad:
|
|
144
|
+
<Form method="post" />
|
|
145
|
+
|
|
146
|
+
// Good:
|
|
147
|
+
<Form action={save} />
|
|
148
|
+
<Form action="save-user" />`},ISLAND_STORE_OUTSIDE_RENDER:{code:"ERR_ISLAND_STORE_OUTSIDE_RENDER",severity:"error",template:'[what-server] Island store "{{name}}" was accessed outside an active server render.',suggestion:"A module-scoped island store resolves against the current request, so it can only be read or written from a component rendered by renderDocument/renderPage. Reading one at module scope, or from a background task, has no request to bind to.",codeExample:`// Bad \u2014 runs at import time, with no request in scope:
|
|
149
|
+
const count = cart.items.length;
|
|
150
|
+
|
|
151
|
+
// Good \u2014 read it inside a component the server is rendering:
|
|
152
|
+
function Cart() { return <span>{cart.items.length}</span>; }`},ISR_MISSING_CLIENT:{code:"ERR_ISR_MISSING_CLIENT",severity:"error",template:"[what-isr] createRedisStore requires { client }.",suggestion:"what-isr ships no Redis driver on purpose, so the client is injected. Pass an ioredis or node-redis instance (get/set/del/sadd/srem/smembers, optionally expire/scan/keys).",codeExample:`import Redis from 'ioredis';
|
|
153
|
+
const store = createRedisStore({ client: new Redis(process.env.REDIS_URL) });`},ISR_VARY_UNRESOLVED:{code:"ERR_ISR_VARY_UNRESOLVED",severity:"error",template:"[what-isr] cannot build a cache key: `vary` is declared but could not be resolved against the request.",suggestion:"A declared vary is a list of names that must be resolved against real request headers before it can be part of a key. Either pass the request headers alongside the declaration, or pass an already-resolved name -> value object. Guessing would cache one visitor page under another visitor key.",codeExample:`// Bad \u2014 a declaration with nothing to resolve it against:
|
|
154
|
+
cacheKey({ path, vary: ['cookie:session'] });
|
|
155
|
+
|
|
156
|
+
// Good \u2014 supply the headers:
|
|
157
|
+
cacheKey({ path, vary: ['cookie:session'], headers: request.headers });
|
|
158
|
+
|
|
159
|
+
// Good \u2014 or resolve it yourself:
|
|
160
|
+
cacheKey({ path, vary: { 'cookie:session': sessionId } });`},ISR_VARY_NO_HEADERS:{code:"ERR_ISR_VARY_NO_HEADERS",severity:"error",template:"[what-isr] route declares `vary` but the adapter supplied no request headers; refusing to cache.",suggestion:"The route varies its output per header, and the adapter called the engine without them. Caching anyway would serve one variant to every request. Forward the request headers from the adapter into the engine call.",codeExample:`// In the adapter:
|
|
161
|
+
await engine.handle(routeMatch, { headers: request.headers });`},DUPLICATE_ACTION_ID:{code:"ERR_DUPLICATE_ACTION_ID",severity:"error",template:'Duplicate server action ID "{{id}}".',suggestion:"Action ids are the wire address of a server action, so two actions cannot share one. Ids derive from the file path and export name, so this usually means the same action is being registered twice, or an explicit id was reused.",codeExample:`// Bad \u2014 two actions pinned to the same id:
|
|
162
|
+
export const save = action(fn, { id: 'save' });
|
|
163
|
+
export const store = action(fn, { id: 'save' });
|
|
164
|
+
|
|
165
|
+
// Good \u2014 let ids derive, or make them distinct:
|
|
166
|
+
export const save = action(fn);
|
|
167
|
+
export const store = action(fn, { id: 'store-user' });`},PAGE_NO_DEFAULT_EXPORT:{code:"ERR_PAGE_NO_DEFAULT_EXPORT",severity:"error",template:"Page module has no default-exported component.",suggestion:"A page file must default-export the component to render. A named export cannot be found by the file-router.",codeExample:`// Bad:
|
|
168
|
+
export function Home() { return <h1>Hi</h1>; }
|
|
169
|
+
|
|
170
|
+
// Good:
|
|
171
|
+
export default function Home() { return <h1>Hi</h1>; }`},HOOK_OUTSIDE_RENDER:{code:"ERR_HOOK_OUTSIDE_RENDER",severity:"error",template:"[what-react] {{hookName}}() called outside of a component render.",suggestion:"Hooks can only be called while a what-react component is rendering. When this happens inside a React library, the usual cause is two module instances: make sure every `react` and `react-dom` import is aliased to what-react by the reactCompat() vite plugin.",codeExample:`// vite.config.js
|
|
172
|
+
import { reactCompat } from 'what-react/vite';
|
|
173
|
+
export default { plugins: [reactCompat()] };`},CHILDREN_ONLY:{code:"ERR_CHILDREN_ONLY",severity:"error",template:"React.Children.only expected to receive a single React element child.",suggestion:"Children.only asserts exactly one element. Pass one child, or use Children.toArray/Children.map when the count can vary.",codeExample:`// Bad:
|
|
174
|
+
<Tooltip><span>a</span><span>b</span></Tooltip>
|
|
175
|
+
|
|
176
|
+
// Good:
|
|
177
|
+
<Tooltip><span>a</span></Tooltip>`},USE_INVALID_ARG:{code:"ERR_USE_INVALID_ARG",severity:"error",template:"[what-react] use() expects a promise or a context.",suggestion:"use() reads either a thenable or a context object. Anything else has nothing to suspend on or subscribe to.",codeExample:`// Good:
|
|
178
|
+
const value = use(ThemeContext);
|
|
179
|
+
const data = use(fetchUser(id));`},PRETEXT_NOT_INSTALLED:{code:"ERR_PRETEXT_NOT_INSTALLED",severity:"error",template:"[what-text] Failed to load @chenglou/pretext: {{message}}.",suggestion:"what-text declares pretext as an optional peer so the package installs without it. Install it to use the text engine: npm install @chenglou/pretext",codeExample:"npm install @chenglou/pretext"},DESTRUCTURED_PROPS:{code:"ERR_DESTRUCTURED_PROPS",severity:"warning",template:"Destructuring '{{binding}}' in the component body snapshots props and loses reactivity.",suggestion:"What components run ONCE, so the body is not re-run when a prop changes. Reading `props.foo` goes through the reactive proxy and tracks; `const { foo } = props` reads the value once and detaches it. Read through the proxy inside JSX and effects, or wrap each field in an accessor.",codeExample:`// Bad - snapshots at first run, never updates:
|
|
180
|
+
function Row(props) {
|
|
181
|
+
const { label } = props;
|
|
182
|
+
return <span>{label}</span>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Good - reads through the proxy each time:
|
|
186
|
+
function Row(props) {
|
|
187
|
+
return <span>{props.label}</span>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Good - an accessor keeps the destructured name:
|
|
191
|
+
function Row(props) {
|
|
192
|
+
const label = () => props.label;
|
|
193
|
+
return <span>{label()}</span>;
|
|
194
|
+
}`},RUNTIME:{code:"ERR_RUNTIME",severity:"error",template:"{{message}}",suggestion:"An error surfaced that the framework could not classify, so the message is the original one verbatim. The stack, file and line on the error narrow it; if the same shape shows up repeatedly it is worth its own code here.",codeExample:`// Inspect the structured form rather than the string:
|
|
195
|
+
try { render(); } catch (e) { console.log(classifyError(e).toJSON()); }`},UNKNOWN:{code:"ERR_UNKNOWN",severity:"error",template:"Unknown error: {{errorCode}}.",suggestion:"createWhatError() was called with a code that is not in this catalogue. Check the spelling against ERROR_CODES, or add the entry.",codeExample:`// Bad - not a catalogue key:
|
|
196
|
+
createWhatError('MISSING_KEYS');
|
|
197
|
+
|
|
198
|
+
// Good:
|
|
199
|
+
createWhatError('MISSING_KEY', { component: 'TodoList' });`},UNKNOWN_TOOL:{code:"ERR_UNKNOWN_TOOL",severity:"error",template:"Unknown tool: {{name}}.",suggestion:"The MCP client called a tool this server does not expose. Call tools/list to enumerate what is available; a stale client cache is the usual cause.",codeExample:`// List what the server actually exposes:
|
|
200
|
+
{ "method": "tools/list" }`}},Xe=null;function _t(e){return Xe===null&&(Xe=new Map(Object.values(ze).map(t=>[t.code,t]))),Xe.get(e)}var pe=class extends Error{constructor({code:t,message:n,suggestion:r,codeExample:o,file:s,line:a,component:c,signal:u,effect:p}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.codeExample=o,this.file=s,this.line=a,this.component=c,this.signal=u,this.effect=p}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,codeExample:this.codeExample,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function fe(e,t={}){let n=typeof e=="string"?ze[e]:e;if(!n)return new pe({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 pe({code:n.code,message:r,suggestion:n.suggestion,codeExample:n.codeExample,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var de=[],bt=200;function Ae(e){L&&(de.push({...e.toJSON(),timestamp:Date.now()}),de.length>bt&&(de=de.slice(-bt)))}function Ie(e){return e?de.filter(t=>t.timestamp>e):de.slice()}function po(){de=[]}function ho(e,t={}){let n=e?.message||String(e);if(e&&typeof e.code=="string"){let r=_t(e.code);if(r)return new pe({code:r.code,message:n,suggestion:r.suggestion,codeExample:r.codeExample,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}return n.includes("infinite effect loop")||n.includes("25 iterations")?fe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?fe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?fe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new pe({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var be={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function go(e){Object.assign(be,e)}function mo(){return{...be}}function yo(e,t){return!L||!be.signalReadDetection||(e.toString=function(){let n=fe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
201
|
+
Suggestion: ${n.suggestion}`),Ae(n),String(e())},e.valueOf=function(){let n=fe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
202
|
+
Suggestion: ${n.suggestion}`),Ae(n),e()}),e}function vo(e){if(!L||!be.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${wo(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 wo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var St=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 xo(e){if(!L||!be.importValidation)return[];let t=[];for(let n of e)St.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Eo(n)}?`});return t}function Eo(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of St){let s=bo(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function bo(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 _o="0.13.0",_e=[];function So(e){L&&_e.push(e)}function ko(e){if(!L)return;let t=_e.indexOf(e);t>=0&&_e.splice(t,1)}function kt(){return _e.slice()}var ve=[];function Ro(e){L&&ve.push(e)}function Co(e){if(!L)return;let t=ve.indexOf(e);t>=0&&ve.splice(t,1)}function Rt(){return ve.slice()}function Ct(){let e=Ie(),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=ve.filter(u=>!!(u._subs&&u._subs.size===0)).length,a=ve.length,c=a>1e4?"high":a>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:c,recentErrorCount:t.length,totalSignals:a,totalComponents:_e.length}}function Ao(){L&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:_o,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>kt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>Rt().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:()=>Ie(),health:()=>Ct(),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{lo as Checkbox,ze as ERROR_CODES,qt as ErrorBoundary,fo as ErrorMessage,hn as FocusTrap,Wt as For,Ft as Fragment,cr as Head,ao as Input,zt as Island,Dr as IslandSkeleton,An as Keys,_n as LiveRegion,Lr as LoadingDots,Xt as Match,Or as Placeholder,rn as Portal,uo as Radio,co as Select,Bt as Show,Ge as Skeleton,Ir as SkeletonAvatar,ht as SkeletonCard,Tr as SkeletonTable,Ue as SkeletonText,yn as SkipLink,Mr as Spinner,jt as Suspense,Yt as Switch,io as Textarea,bn as VisuallyHidden,pe as WhatError,Nn as _$createComponent,On as _$template,Mt as __drainPreinstallBuffer,Xr as __getCacheSnapshot,Ht as __installServerContextStorage,Oe as __readHydrationData,Bn as __resetHydrationData,At as __setDevToolsHooks,ln as _beginComponentSSR,un as _endComponentSSR,an as _isAriaAttr,Pn as _mapArrayToArray,Dn as _setTextInsertHook,Je as _template,gn as announce,mn as announceAssertive,ir as atom,O as batch,dr as beginHeadCollection,vo as checkComponentName,Un as classList,ho as classifyError,Yr as clearCache,po as clearCollectedErrors,mr as clearHead,Kt as cls,Ae as collectError,P as computed,go as configureGuardrails,er as createContext,or as createResource,Ot as createRoot,ar as createStore,ft as createTransitionClasses,fe as createWhatError,Cr as cssTransition,Zt as debounce,Vn as delegateEvents,nt as derived,Qt as each,dt as easings,V as effect,fr as endHeadCollection,at as flushScheduler,Tt as flushSync,Rt as getActiveSignals,Ie as getCollectedErrors,_t as getErrorDefinition,mo as getGuardrailConfig,Ct as getHealth,Le as getLoaderData,kt as getMountedComponents,Dt as getOwner,Wr as getQueryData,Me as getResource,ge as getServerContext,D as h,Pt as html,qn as hydrate,Mn as insert,Ao as installAgentContext,yo as installSignalReadGuardrail,jr as invalidateQueries,jn as isHydrating,Ut as lazy,Fn as mapArray,yr as measure,Gt as memo,cn as mount,vr as mutate,xr as nextFrame,Gn as on,rr as onCleanup,br as onIntersect,In as onKey,Tn as onKeys,nr as onMount,Er as onResize,Lt as onRootCleanup,qr as prefetchQuery,it as raf,So as registerComponent,Ro as registerSignal,oo as rules,Nt as runWithOwner,Vt as runWithServerContext,Z as scheduleRead,se as scheduleWrite,$n as setProp,Br as setQueryData,$t as setServerContext,d as signal,It as signalMemo,ro as simpleResolver,_r as smoothScrollTo,Hn as spread,lt as spring,sr as storeComputed,Jt as style,Ln as svgTemplate,Je as template,en as throttle,sn as transition,ut as tween,ko as unregisterComponent,Co as unregisterSignal,ce as untrack,Rr as useAnimatedValue,xn as useAriaChecked,vn as useAriaExpanded,wn as useAriaSelected,Jn as useCallback,on as useClickOutside,zn as useComputed,Ze as useContext,Rn as useDescribedBy,Qn as useEffect,$r as useFetch,so as useField,dn as useFocus,fn as useFocusRestore,pn as useFocusTrap,Kr as useForm,kr as useGesture,Sn as useId,kn as useIds,Ur as useInfiniteQuery,Cn as useLabelledBy,Wn as useLoaderData,nn as useLocalStorage,tn as useMediaQuery,Kn as useMemo,Gr as useQuery,tr as useReducer,Zn as useRef,En as useRovingTabIndex,Vr as useSWR,wr as useScheduledEffect,Xn as useSignal,Nr as useSkeleton,Yn as useState,Sr as useTransition,xo as validateImports,no as yupResolver,eo as zodResolver};
|
package/dist/render.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as j,B as k,C as l,D as m,E as n,F as o,G as p,H as q,I as r,J as s,K as t,L as u,M as v,N as w,u as d,v as e,w as f,x as g,y as h,z as i}from"./chunk-
|
|
1
|
+
import{A as j,B as k,C as l,D as m,E as n,F as o,G as p,H as q,I as r,J as s,K as t,L as u,M as v,N as w,u as d,v as e,w as f,x as g,y as h,z as i}from"./chunk-ENARGHSD.min.js";import{f as a,h as b,j as c}from"./chunk-OKM3GKVP.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,k as _mapArrayToArray,d as _setTextInsertHook,g as _template,u as classList,s as delegateEvents,a as effect,w as hydrate,i as insert,v as isHydrating,j as mapArray,b as memo,t as on,p as setAttr,r as setChecked,n as setClass,m as setProp,o as setStyle,q as setValue,l as spread,h as svgTemplate,g as template,c as untrack};
|