what-core 0.6.5 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var b=!(typeof process<"u"),w=null;var L=null,K=null,U=null,de=!1,oe=0,I=[],Y=!1,je=new WeakMap,We=Symbol("needs_upstream");function P(e,n){let t=e,r=new Set;function o(...i){if(i.length===0)return L&&(r.add(L),L.deps.push(r)),t;b&&de&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let l=typeof i[0]=="function"?i[0](t):i[0];Object.is(t,l)||(t=l,b&&w&&w.onSignalUpdate(o),r.size>0&&pe(r))}return o.set=i=>{b&&de&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let l=typeof i=="function"?i(t):i;Object.is(t,l)||(t=l,b&&w&&w.onSignalUpdate(o),r.size>0&&pe(r))},o.peek=()=>t,o.subscribe=i=>A(()=>i(o())),o._signal=!0,b&&(o._subs=r,n&&(o._debugName=n)),b&&w&&w.onSignalCreate(o),o}function he(e){let n=0,t=e.deps;for(let r=0;r<t.length;r++){let o=je.get(t[r]);if(o){let i=o._level;i>n&&(n=i)}}e._level=n+1}function A(e,n){let t=Ge(e);t._level=1;let r=L;L=t;try{let i=t.fn();typeof i=="function"&&(t._cleanup=i)}finally{L=r}he(t),n?.stable&&(t._stable=!0);let o=()=>qe(t);return K&&K.disposals.push(o),o}function Ge(e,n){let t={fn:e,deps:[],lazy:n||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null};return b&&w&&w.onEffectCreate(t),t}function Ue(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){b&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let t=L;L=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:e}),b&&console.warn("[what] Error in stable effect:",r)}finally{L=t}b&&w?.onEffectRun&&w.onEffectRun(e);return}if(me(e),e._cleanup){try{e._cleanup()}catch(t){w?.onError&&w.onError(t,{type:"effect-cleanup",effect:e}),b&&console.warn("[what] Error in effect cleanup:",t)}e._cleanup=null}let n=L;L=e;try{let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){throw t===We||w?.onError&&w.onError(t,{type:"effect",effect:e}),t}finally{L=n}b&&w?.onEffectRun&&w.onEffectRun(e)}function qe(e){if(e.disposed=!0,b&&w&&w.onEffectDispose(e),me(e),e._cleanup){try{e._cleanup()}catch(n){b&&console.warn("[what] Error in effect cleanup on dispose:",n)}e._cleanup=null}}function me(e){let n=e.deps;for(let t=0;t<n.length;t++)n[t].delete(e);n.length=0}var ie=0,j=null,q=0;function pe(e){if(ie===0){ie=1;try{for(let n of e)if(!n.disposed){if(n._onNotify)n._onNotify();else if(oe===0&&n._stable){let t=L;L=null;try{let r=n.fn();if(typeof r=="function"){if(n._cleanup)try{n._cleanup()}catch{}n._cleanup=r}}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:n}),b&&console.warn("[what] Error in stable effect:",r)}finally{L=t}}else if(!n._pending){n._pending=!0;let t=n._level,r=I.length;r>0&&I[r-1]._level>t&&(Y=!0),I.push(n)}}if(q>0){let n=0;for(;n<q;){let t=j[n];j[n]=null,n++;for(let r of t)if(!r.disposed){if(r._onNotify)r._onNotify();else if(oe===0&&r._stable){let o=L;L=null;try{let i=r.fn();if(typeof i=="function"){if(r._cleanup)try{r._cleanup()}catch{}r._cleanup=i}}catch(i){w?.onError&&w.onError(i,{type:"effect",effect:r}),b&&console.warn("[what] Error in stable effect:",i)}finally{L=o}}else if(!r._pending){r._pending=!0;let o=r._level,i=I.length;i>0&&I[i-1]._level>o&&(Y=!0),I.push(r)}}}q=0}}finally{ie=0}oe===0&&I.length>0&&Pe()}else j===null&&(j=[]),q>=j.length?j.push(e):j[q]=e,q++}var se=!1;function Pe(){se||(se=!0,queueMicrotask(()=>{se=!1,Ve()}))}var ce=!1;function Ve(){if(!ce){ce=!0;try{let e=0;for(;I.length>0&&e<25;){let n=I;I=[],n.length>1&&Y&&n.sort((t,r)=>t._level-r._level),Y=!1;for(let t=0;t<n.length;t++){let r=n[t];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;Ue(r),!r._computed&&r.deps.length!==o&&he(r)}}e++}if(e>=25){for(let n=0;n<I.length;n++)I[n]._pending=!1;if(I.length=0,b){let t=I.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: ${t.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected")}}finally{ce=!1}}}function le(e){let n=L;L=null;try{return e()}finally{L=n}}function W(e){let n=K,t=U,r={disposals:[],owner:U,children:[],_disposed:!1};U&&U.children.push(r),K=r,U=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let i=r.children.length-1;i>=0;i--)ge(r.children[i]);r.children.length=0;for(let i=r.disposals.length-1;i>=0;i--)r.disposals[i]();if(r.disposals.length=0,r.owner){let i=r.owner.children.indexOf(r);i>=0&&r.owner.children.splice(i,1)}}})}finally{K=n,U=t}}function ge(e){if(!e._disposed){e._disposed=!0;for(let n=e.children.length-1;n>=0;n--)ge(e.children[n]);e.children.length=0;for(let n=e.disposals.length-1;n>=0;n--)e.disposals[n]();e.disposals.length=0}}var ye=null;function _e(e){ye=e}function we(e,n){let t=n||ye?.();for(;t;){if(t._errorBoundary)return t._errorBoundary(e),!0;t=t._parentCtx}return!1}var ze=null;function Ce(e){ze=e}var Ke=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"]),Fe="http://www.w3.org/2000/svg",xe=new Set,Z=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 fe(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function be(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let n of e.cleanups)try{n()}catch(t){console.error("[what] cleanup error:",t)}if(e.effects)for(let n of e.effects)try{n()}catch{}if(e.hooks){for(let n of e.hooks)if(n&&typeof n.cleanup=="function")try{n.cleanup()}catch(t){console.error("[what] hook cleanup error:",t)}}if(e._cleanupCallbacks)for(let n of e._cleanupCallbacks)try{n()}catch(t){console.error("[what] onCleanup error:",t)}b&&w?.onComponentUnmount&&w.onComponentUnmount(e),xe.delete(e)}}function H(e){if(!e)return;e._componentCtx&&be(e._componentCtx);let n=Z.get(e);if(n&&be(n),e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let t in e._propEffects)try{e._propEffects[t]()}catch{}if(e.childNodes)for(let t of e.childNodes)H(t)}function D(e,n,t){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"){let r=document.createComment("fn"),o=document.createComment("/fn"),i=[],l=document.createDocumentFragment();l.appendChild(r),l.appendChild(o);let s=A(()=>{let f=e(),c=f==null||f===!1||f===!0?[]:Array.isArray(f)?f:[f],p=o.parentNode;if(p){for(let u of i)H(u),u.parentNode===p&&p.removeChild(u);i=[];for(let u of c){let _=D(u,p,n?._isSvg);if(_)if(_.nodeType===11){let y=Array.from(_.childNodes);p.insertBefore(_,o);for(let m of y)i.push(m)}else p.insertBefore(_,o),i.push(_)}}});return r._dispose=s,o._dispose=s,l}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let i=D(o,n,t);i&&r.appendChild(i)}return r}return fe(e)&&typeof e.tag=="function"||fe(e)&&(e.tag==="__errorBoundary"||e.tag==="__suspense"||e.tag==="__portal")?Ee(e,n,t):fe(e)?Qe(e,n,t):document.createTextNode(String(e))}var T=[];function Se(){return T[T.length-1]}_e(Se);Ce(Se);function Ne(){return T}function Ee(e,n,t){let{tag:r,props:o,children:i}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let h=r;r=function(d){return new h(d).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Xe(e,n);if(r==="__suspense"||e.tag==="__suspense")return Ye(e,n);if(r==="__portal"||e.tag==="__portal")return Ze(e,n);let l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:T[T.length-1]||null,_errorBoundary:(()=>{let h=T[T.length-1];for(;h;){if(h._errorBoundary)return h._errorBoundary;h=h._parentCtx}return null})()},s=document.createComment("c:start"),f=document.createComment("c:end");Z.set(s,l),l._startComment=s,l._endComment=f;let c=document.createDocumentFragment();c._componentCtx=l,l._wrapper=s,xe.add(l),b&&w?.onComponentMount&&w.onComponentMount(l);let p=i.length===0?void 0:i.length===1?i[0]:i,u=P({...o,children:p});l._propsSignal=u;let _=new Proxy({},{get(h,E){return u()[E]},has(h,E){let d=u();return E in d},ownKeys(){let h=u();return Reflect.ownKeys(h)},getOwnPropertyDescriptor(h,E){let d=u();if(E in d)return{value:d[E],writable:!1,enumerable:!0,configurable:!0}}});T.push(l);let y;try{y=r(_)}catch(h){if(T.pop(),!we(h,l))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return c.appendChild(s),c.appendChild(f),c}T.pop(),l.mounted=!0,l._mountCallbacks&&queueMicrotask(()=>{if(!l.disposed)for(let h of l._mountCallbacks)try{h()}catch(E){console.error("[what] onMount error:",E)}}),c.appendChild(s);let m=Array.isArray(y)?y:[y];for(let h of m){let E=D(h,c,t);E&&c.appendChild(E)}return c.appendChild(f),c}function Xe(e,n){let{errorState:t,handleError:r,fallback:o,reset:i}=e.props,l=e.children,s=document.createComment("eb:start"),f=document.createComment("eb:end"),c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:T[T.length-1]||null,_errorBoundary:r,_startComment:s,_endComment:f};Z.set(s,c);let p=document.createDocumentFragment();p._componentCtx=c,p.appendChild(s),p.appendChild(f);let u=A(()=>{let _=t();if(T.push(c),s.parentNode)for(;s.nextSibling&&s.nextSibling!==f;){let m=s.nextSibling;H(m),m.parentNode.removeChild(m)}let y;_?y=typeof o=="function"?[o({error:_,reset:i})]:[o]:y=l,y=Array.isArray(y)?y:[y];for(let m of y){let h=D(m,n);h&&(f.parentNode?f.parentNode.insertBefore(h,f):p.insertBefore(h,f))}T.pop()});return c.effects.push(u),p}function Ye(e,n){let{boundary:t,fallback:r,loading:o}=e.props,i=e.children,l=document.createComment("sb:start"),s=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:T[T.length-1]||null,_startComment:l,_endComment:s};Z.set(l,f);let c=document.createDocumentFragment();c._componentCtx=f,c.appendChild(l),c.appendChild(s);let p=A(()=>{let _=o()?[r]:i,y=Array.isArray(_)?_:[_];if(T.push(f),l.parentNode)for(;l.nextSibling&&l.nextSibling!==s;){let m=l.nextSibling;H(m),m.parentNode.removeChild(m)}for(let m of y){let h=D(m,n);h&&(s.parentNode?s.parentNode.insertBefore(h,s):c.insertBefore(h,s))}T.pop()});return f.effects.push(p),c}function Ze(e,n){let{container:t}=e.props,r=e.children;if(!t)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:T[T.length-1]||null},i=document.createComment("portal");i._componentCtx=o;let l=[];for(let s of r){let f=D(s,t);f&&(t.appendChild(f),l.push(f))}return o._cleanupCallbacks=[()=>{for(let s of l)H(s),s.parentNode&&s.parentNode.removeChild(s)}],i}function Qe(e,n,t){let{tag:r,props:o,children:i}=e,l=t||Ke.has(r),s=l?document.createElementNS(Fe,r):document.createElement(r);o&&et(s,o,{},l);for(let f of i){let c=D(f,s,l&&r!=="foreignObject");c&&s.appendChild(c)}return s._vnode=e,s}function et(e,n,t,r){n=n||{},t=t||{};for(let o in n)if(!(o==="key"||o==="children")){if(o==="ref"){typeof n.ref=="function"?n.ref(e):n.ref&&(n.ref.current=e);continue}Le(e,o,n[o],r)}}function Le(e,n,t,r){if(typeof t=="function"&&!(n.startsWith("on")&&n.length>2)&&n!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[n])try{e._propEffects[n]()}catch{}e._propEffects[n]=A(()=>{let o=t();Le(e,n,o,r)});return}if(n.startsWith("on")&&n.length>2){let o=n.slice(2),i=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),i=!0);let l=o.toLowerCase(),s=i?l+"_capture":l,f=e._events?.[s];if(f&&f._original===t||(f&&e.removeEventListener(l,f,i),t==null))return;e._events||(e._events={});let c=u=>(u.nativeEvent||(u.nativeEvent=u),le(()=>t(u)));c._original=t,e._events[s]=c;let p=t._eventOpts;e.addEventListener(l,c,p||i||void 0);return}if(n==="className"||n==="class"){r?e.setAttribute("class",t||""):e.className=t||"";return}if(n==="style"){if(typeof t=="string")e.style.cssText=t,e._prevStyle=null;else if(typeof t=="object"){let o=e._prevStyle||{};for(let i in o)i in t||(e.style[i]="");for(let i in t)e.style[i]=t[i]??"";e._prevStyle={...t}}return}if(n==="dangerouslySetInnerHTML"){e.innerHTML=t?.__html??"";return}if(n==="innerHTML"){if(t==null)return;if(t&&typeof t=="object"&&"__html"in t)e.innerHTML=t.__html??"";else{b&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(typeof t=="boolean"){t?e.setAttribute(n,""):e.removeAttribute(n);return}if(n.startsWith("data-")||n.startsWith("aria-")){e.setAttribute(n,t);return}if(r){t===!1||t==null?e.removeAttribute(n):e.setAttribute(n,t===!0?"":String(t));return}n in e?e[n]=t:e.setAttribute(n,t)}var tt={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
1
+ var b=!(typeof process<"u"),w=null;var L=null,F=null,G=null,me=!1,se=0,I=[],Y=!1,Ge=new WeakMap,Ve=Symbol("needs_upstream");function q(e,n){let t=e,r=new Set;function o(...i){if(i.length===0)return L&&(r.add(L),L.deps.push(r)),t;b&&me&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let l=typeof i[0]=="function"?i[0](t):i[0];Object.is(t,l)||(t=l,b&&w&&w.onSignalUpdate(o),r.size>0&&ge(r))}return o.set=i=>{b&&me&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let l=typeof i=="function"?i(t):i;Object.is(t,l)||(t=l,b&&w&&w.onSignalUpdate(o),r.size>0&&ge(r))},o.peek=()=>t,o.subscribe=i=>T(()=>i(o())),o._signal=!0,b&&(o._subs=r,n&&(o._debugName=n)),b&&w&&w.onSignalCreate(o),o}function ye(e){let n=0,t=e.deps;for(let r=0;r<t.length;r++){let o=Ge.get(t[r]);if(o){let i=o._level;i>n&&(n=i)}}e._level=n+1}function T(e,n){let t=qe(e);t._level=1;let r=L;L=t;try{let i=t.fn();typeof i=="function"&&(t._cleanup=i)}finally{L=r}ye(t),n?.stable&&(t._stable=!0);let o=()=>ze(t);return F&&F.disposals.push(o),o}function qe(e,n){let t={fn:e,deps:[],lazy:n||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null};return b&&w&&w.onEffectCreate(t),t}function Pe(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){b&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let t=L;L=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:e}),b&&console.warn("[what] Error in stable effect:",r)}finally{L=t}b&&w?.onEffectRun&&w.onEffectRun(e);return}if(_e(e),e._cleanup){try{e._cleanup()}catch(t){w?.onError&&w.onError(t,{type:"effect-cleanup",effect:e}),b&&console.warn("[what] Error in effect cleanup:",t)}e._cleanup=null}let n=L;L=e;try{let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){throw t===Ve||w?.onError&&w.onError(t,{type:"effect",effect:e}),t}finally{L=n}b&&w?.onEffectRun&&w.onEffectRun(e)}function ze(e){if(e.disposed=!0,b&&w&&w.onEffectDispose(e),_e(e),e._cleanup){try{e._cleanup()}catch(n){b&&console.warn("[what] Error in effect cleanup on dispose:",n)}e._cleanup=null}}function _e(e){let n=e.deps;for(let t=0;t<n.length;t++)n[t].delete(e);n.length=0}var ce=0,U=null,V=0;function ge(e){if(ce===0){ce=1;try{for(let n of e)if(!n.disposed){if(n._onNotify)n._onNotify();else if(se===0&&n._stable){let t=L;L=null;try{let r=n.fn();if(typeof r=="function"){if(n._cleanup)try{n._cleanup()}catch{}n._cleanup=r}}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:n}),b&&console.warn("[what] Error in stable effect:",r)}finally{L=t}}else if(!n._pending){n._pending=!0;let t=n._level,r=I.length;r>0&&I[r-1]._level>t&&(Y=!0),I.push(n)}}if(V>0){let n=0;for(;n<V;){let t=U[n];U[n]=null,n++;for(let r of t)if(!r.disposed){if(r._onNotify)r._onNotify();else if(se===0&&r._stable){let o=L;L=null;try{let i=r.fn();if(typeof i=="function"){if(r._cleanup)try{r._cleanup()}catch{}r._cleanup=i}}catch(i){w?.onError&&w.onError(i,{type:"effect",effect:r}),b&&console.warn("[what] Error in stable effect:",i)}finally{L=o}}else if(!r._pending){r._pending=!0;let o=r._level,i=I.length;i>0&&I[i-1]._level>o&&(Y=!0),I.push(r)}}}V=0}}finally{ce=0}se===0&&I.length>0&&Fe()}else U===null&&(U=[]),V>=U.length?U.push(e):U[V]=e,V++}var le=!1;function Fe(){le||(le=!0,queueMicrotask(()=>{le=!1,Ke()}))}var fe=!1;function Ke(){if(!fe){fe=!0;try{let e=0;for(;I.length>0&&e<25;){let n=I;I=[],n.length>1&&Y&&n.sort((t,r)=>t._level-r._level),Y=!1;for(let t=0;t<n.length;t++){let r=n[t];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;Pe(r),!r._computed&&r.deps.length!==o&&ye(r)}}e++}if(e>=25){for(let n=0;n<I.length;n++)I[n]._pending=!1;if(I.length=0,b){let t=I.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: ${t.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected")}}finally{fe=!1}}}function ae(e){let n=L;L=null;try{return e()}finally{L=n}}function j(e){let n=F,t=G,r={disposals:[],owner:G,children:[],_disposed:!1};G&&G.children.push(r),F=r,G=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let i=r.children.length-1;i>=0;i--)we(r.children[i]);r.children.length=0;for(let i=r.disposals.length-1;i>=0;i--)r.disposals[i]();if(r.disposals.length=0,r.owner){let i=r.owner.children.indexOf(r);i>=0&&r.owner.children.splice(i,1)}}})}finally{F=n,G=t}}function we(e){if(!e._disposed){e._disposed=!0;for(let n=e.children.length-1;n>=0;n--)we(e.children[n]);e.children.length=0;for(let n=e.disposals.length-1;n>=0;n--)e.disposals[n]();e.disposals.length=0}}var Ce=null;function be(e){Ce=e}function Ee(e,n){let t=n||Ce?.();for(;t;){if(t._errorBoundary)return t._errorBoundary(e),!0;t=t._parentCtx}return!1}var Je=null;function xe(e){Je=e}var Xe=new Set(["href","src","action","formaction","poster","cite","background","xlink:href"]),Ye=new Set(["srcset"]);function ue(e){return String(e).toLowerCase()}function Ze(e){return String(e).trim().replace(/[\s\x00-\x1f\x7f]/g,"").toLowerCase()}function Se(e){if(typeof e!="string")return!0;let n=Ze(e);return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}function Qe(e){return typeof e!="string"?!0:e.split(",").every(n=>{let t=n.trim().split(/\s+/,1)[0]||"";return t===""||Se(t)})}function et(e){return Xe.has(ue(e))}function tt(e){return Ye.has(ue(e))}function Z(e,n){return tt(e)?Qe(n):et(e)?Se(n):!0}function Q(e){return e==="className"?"class":e==="htmlFor"?"for":ue(e)==="formaction"?"formaction":e}var nt=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"]),rt="http://www.w3.org/2000/svg",Ae=new Set,ee=new WeakMap;function ot(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function de(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function Ne(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let n of e.cleanups)try{n()}catch(t){console.error("[what] cleanup error:",t)}if(e.effects)for(let n of e.effects)try{n()}catch{}if(e.hooks){for(let n of e.hooks)if(n&&typeof n.cleanup=="function")try{n.cleanup()}catch(t){console.error("[what] hook cleanup error:",t)}}if(e._cleanupCallbacks)for(let n of e._cleanupCallbacks)try{n()}catch(t){console.error("[what] onCleanup error:",t)}b&&w?.onComponentUnmount&&w.onComponentUnmount(e),Ae.delete(e)}}function H(e){if(!e)return;e._componentCtx&&Ne(e._componentCtx);let n=ee.get(e);if(n&&Ne(n),e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let t in e._propEffects)try{e._propEffects[t]()}catch{}if(e.childNodes)for(let t of e.childNodes)H(t)}function v(e,n,t){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(ot(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),i=[],l=document.createDocumentFragment();l.appendChild(r),l.appendChild(o);let s=T(()=>{let f=e(),c=f==null||f===!1||f===!0?[]:Array.isArray(f)?f:[f],p=o.parentNode;if(p){for(let u of i)H(u),u.parentNode===p&&p.removeChild(u);i=[];for(let u of c){let _=v(u,p,n?._isSvg);if(_)if(_.nodeType===11){let y=Array.from(_.childNodes);p.insertBefore(_,o);for(let m of y)i.push(m)}else p.insertBefore(_,o),i.push(_)}}});return r._dispose=s,o._dispose=s,l}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let i=v(o,n,t);i&&r.appendChild(i)}return r}return de(e)&&typeof e.tag=="function"||de(e)&&(e.tag==="__errorBoundary"||e.tag==="__suspense"||e.tag==="__portal")?Le(e,n,t):de(e)?lt(e,n,t):document.createTextNode(String(e))}var M=[];function Me(){return M[M.length-1]}be(Me);xe(Me);function Te(){return M}function Le(e,n,t){let{tag:r,props:o,children:i}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let h=r;r=function(d){return new h(d).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return it(e,n);if(r==="__suspense"||e.tag==="__suspense")return st(e,n);if(r==="__portal"||e.tag==="__portal")return ct(e,n);let l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:M[M.length-1]||null,_errorBoundary:(()=>{let h=M[M.length-1];for(;h;){if(h._errorBoundary)return h._errorBoundary;h=h._parentCtx}return null})()},s=document.createComment("c:start"),f=document.createComment("c:end");ee.set(s,l),l._startComment=s,l._endComment=f;let c=document.createDocumentFragment();c._componentCtx=l,l._wrapper=s,Ae.add(l),b&&w?.onComponentMount&&w.onComponentMount(l);let p=i.length===0?void 0:i.length===1?i[0]:i,u=q({...o,children:p});l._propsSignal=u;let _=new Proxy({},{get(h,E){return u()[E]},has(h,E){let d=u();return E in d},ownKeys(){let h=u();return Reflect.ownKeys(h)},getOwnPropertyDescriptor(h,E){let d=u();if(E in d)return{value:d[E],writable:!1,enumerable:!0,configurable:!0}}});M.push(l);let y;try{y=r(_)}catch(h){if(M.pop(),!Ee(h,l))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return c.appendChild(s),c.appendChild(f),c}M.pop(),l.mounted=!0,l._mountCallbacks&&queueMicrotask(()=>{if(!l.disposed)for(let h of l._mountCallbacks)try{h()}catch(E){console.error("[what] onMount error:",E)}}),c.appendChild(s);let m=Array.isArray(y)?y:[y];for(let h of m){let E=v(h,c,t);E&&c.appendChild(E)}return c.appendChild(f),c}function it(e,n){let{errorState:t,handleError:r,fallback:o,reset:i}=e.props,l=e.children,s=document.createComment("eb:start"),f=document.createComment("eb:end"),c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:M[M.length-1]||null,_errorBoundary:r,_startComment:s,_endComment:f};ee.set(s,c);let p=document.createDocumentFragment();p._componentCtx=c,p.appendChild(s),p.appendChild(f);let u=T(()=>{let _=t();if(M.push(c),s.parentNode)for(;s.nextSibling&&s.nextSibling!==f;){let m=s.nextSibling;H(m),m.parentNode.removeChild(m)}let y;_?y=typeof o=="function"?[o({error:_,reset:i})]:[o]:y=l,y=Array.isArray(y)?y:[y];for(let m of y){let h=v(m,n);h&&(f.parentNode?f.parentNode.insertBefore(h,f):p.insertBefore(h,f))}M.pop()});return c.effects.push(u),p}function st(e,n){let{boundary:t,fallback:r,loading:o}=e.props,i=e.children,l=document.createComment("sb:start"),s=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:M[M.length-1]||null,_startComment:l,_endComment:s};ee.set(l,f);let c=document.createDocumentFragment();c._componentCtx=f,c.appendChild(l),c.appendChild(s);let p=T(()=>{let _=o()?[r]:i,y=Array.isArray(_)?_:[_];if(M.push(f),l.parentNode)for(;l.nextSibling&&l.nextSibling!==s;){let m=l.nextSibling;H(m),m.parentNode.removeChild(m)}for(let m of y){let h=v(m,n);h&&(s.parentNode?s.parentNode.insertBefore(h,s):c.insertBefore(h,s))}M.pop()});return f.effects.push(p),c}function ct(e,n){let{container:t}=e.props,r=e.children;if(!t)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:M[M.length-1]||null},i=document.createComment("portal");i._componentCtx=o;let l=[];for(let s of r){let f=v(s,t);f&&(t.appendChild(f),l.push(f))}return o._cleanupCallbacks=[()=>{for(let s of l)H(s),s.parentNode&&s.parentNode.removeChild(s)}],i}function lt(e,n,t){let{tag:r,props:o,children:i}=e,l=t||nt.has(r),s=l?document.createElementNS(rt,r):document.createElement(r);o&&ft(s,o,{},l);for(let f of i){let c=v(f,s,l&&r!=="foreignObject");c&&s.appendChild(c)}return s._vnode=e,s}function ft(e,n,t,r){n=n||{},t=t||{};for(let o in n)if(!(o==="key"||o==="children")){if(o==="ref"){typeof n.ref=="function"?n.ref(e):n.ref&&(n.ref.current=e);continue}ke(e,o,n[o],r)}}function ke(e,n,t,r){if(!Z(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Q(n));return}if(typeof t=="function"&&!(n.startsWith("on")&&n.length>2)&&n!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[n])try{e._propEffects[n]()}catch{}e._propEffects[n]=T(()=>{let o=t();ke(e,n,o,r)});return}if(n.startsWith("on")&&n.length>2){let o=n.slice(2),i=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),i=!0);let l=o.toLowerCase(),s=i?l+"_capture":l,f=e._events?.[s];if(f&&f._original===t||(f&&e.removeEventListener(l,f,i),t==null))return;e._events||(e._events={});let c=u=>(u.nativeEvent||(u.nativeEvent=u),ae(()=>t(u)));c._original=t,e._events[s]=c;let p=t._eventOpts;e.addEventListener(l,c,p||i||void 0);return}if(n==="className"||n==="class"){r?e.setAttribute("class",t||""):e.className=t||"";return}if(n==="style"){if(typeof t=="string")e.style.cssText=t,e._prevStyle=null;else if(typeof t=="object"){let o=e._prevStyle||{};for(let i in o)i in t||(e.style[i]="");for(let i in t)e.style[i]=t[i]??"";e._prevStyle={...t}}return}if(n==="dangerouslySetInnerHTML"){e.innerHTML=t?.__html??"";return}if(n==="innerHTML"){if(t==null)return;if(t&&typeof t=="object"&&"__html"in t)e.innerHTML=t.__html??"";else{b&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(typeof t=="boolean"){t?e.setAttribute(n,""):e.removeAttribute(n);return}if(n.startsWith("data-")||n.startsWith("aria-")){e.setAttribute(n,t);return}if(r){t===!1||t==null?e.removeAttribute(n):e.setAttribute(n,t===!0?"":String(t));return}n in e?e[n]=t:e.setAttribute(n,t)}var at={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
2
2
  effect(() => { count(count() + 1); });
3
3
 
4
4
  // Good \u2014 use untrack() so the read doesn't subscribe:
@@ -55,5 +55,5 @@ html\`<div>\${sanitizedContent}</div>\``},MISSING_KEY:{code:"ERR_MISSING_KEY",se
55
55
  <For each={items()}>{item => <li>{item.name}</li>}</For>
56
56
 
57
57
  // Good \u2014 stable key:
58
- <For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},ee=class extends Error{constructor({code:n,message:t,suggestion:r,file:o,line:i,component:l,signal:s,effect:f}){super(t),this.name="WhatError",this.code=n,this.suggestion=r,this.file=o,this.line=i,this.component=l,this.signal=s,this.effect=f}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function Te(e,n={}){let t=typeof e=="string"?tt[e]:e;if(!t)return new ee({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=t.template;for(let[o,i]of Object.entries(n))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(i));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ee({code:t.code,message:r,suggestion:t.suggestion,file:n.file,line:n.line,component:n.component,signal:n.signal||n.signalName,effect:n.effect||n.effectName})}var Q=[],Me=200;function Ae(e){b&&(Q.push({...e.toJSON(),timestamp:Date.now()}),Q.length>Me&&(Q=Q.slice(-Me)))}function kt(e,n,t){if(t&&t.length>0){let r=t.length===1?t[0]:t;n=n?{...n,children:r}:{children:r}}return D({tag:e,props:n||{},children:t||[],key:null,_vnode:!0})}var ke=new Set(["href","src","action","formaction","formAction"]);function nt(e){if(typeof e!="string")return!0;let n=e.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}var rt={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>"}},ot=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 He(e){let n=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function it(e){let n=e.trim(),t=He(n);if(ot.has(t))return st(n);let r=rt[t];if(r){let i=document.createElement("template");return i.innerHTML=r.wrap+n+r.unwrap,()=>{let l=i.content.firstChild;for(let s=0;s<r.depth;s++)l=l.firstChild;return l.cloneNode(!0)}}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var Re=!1;function Rt(e){return b&&!Re&&(Re=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),it(e)}function st(e){let n=e.trim();if(He(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function It(e,n,t){if(typeof n=="function"){let r=null;return A(()=>{r=ne(e,n(),r,t||null)}),r}return ne(e,n,null,t||null)}function Be(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ct(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function lt(e){return typeof SVGElement<"u"&&e instanceof SVGElement&&e.tagName.toLowerCase()!=="foreignobject"}function Ie(e){return e==null?[]:Array.isArray(e)?e:[e]}function Oe(e,n,t){if(e==null||typeof e=="boolean")return t;if(Array.isArray(e)){for(let r=0;r<e.length;r++)Oe(e[r],n,t);return t}return typeof e=="string"||typeof e=="number"?(t.push(document.createTextNode(String(e))),t):Be(e)?(t.push(e),t):ct(e)?(t.push(D(e,n,lt(n))),t):(t.push(document.createTextNode(String(e))),t)}function ft(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function ne(e,n,t,r){if(!e||typeof e.insertBefore!="function")return b&&console.warn("[what] reconcileInsert called with invalid parent:",e),t;let o=r||null;if(n==null||typeof n=="boolean"){let c=Ie(t);for(let p=0;p<c.length;p++){let u=c[p];u.parentNode===e&&(H(u),e.removeChild(u))}return null}if((typeof n=="string"||typeof n=="number")&&t&&!Array.isArray(t)&&t.nodeType===3){let c=String(n);return t.textContent!==c&&(t.textContent=c),t}let i=Oe(n,e,[]),l=Ie(t);if(ft(l,i))return t;let s=new Set(i);for(let c=0;c<l.length;c++){let p=l[c];!s.has(p)&&p.parentNode===e&&(H(p),e.removeChild(p))}let f=o;for(let c=i.length-1;c>=0;c--){let p=i[c];(p.parentNode!==e||p.nextSibling!==f)&&(f&&f.parentNode!==e&&(f=null),f?e.insertBefore(p,f):e.appendChild(p)),f=p}return i.length===0?null:i.length===1?i[0]:i}function vt(e,n,t){let r=t?.key,o=t?.raw||!1;return(i,l)=>{let s=[],f=[],c=[],p=r&&!o?new Map:null,u=document.createComment("/list");return i.insertBefore(u,l||null),A(()=>{let _=e()||[];r?pt(i,u,s,_,f,c,n,r,p):at(i,u,s,_,f,c,n),s=_.slice()}),u}}function at(e,n,t,r,o,i,l){let s=r.length,f=t.length;if(s===0){if(f>0){for(let d=0;d<f;d++)i[d]?.(),o[d]?.parentNode===e&&(H(o[d]),e.removeChild(o[d]));o.length=0,i.length=0}return}if(f===0){let d=document.createDocumentFragment();for(let g=0;g<s;g++){let x=r[g],N=W(k=>(i[g]=k,l(x,g)));o[g]=N,d.appendChild(N)}e.insertBefore(d,n);return}let c=0,p=Math.min(f,s);for(;c<p&&t[c]===r[c];)c++;if(c===f&&c===s)return;let u=f-1,_=s-1;for(;u>=c&&_>=c&&t[u]===r[_];)u--,_--;let y=new Array(s),m=new Array(s);for(let d=0;d<c;d++)y[d]=o[d],m[d]=i[d];for(let d=_+1;d<s;d++){let g=u+1+(d-_-1);y[d]=o[g],m[d]=i[g]}let h=_-c+1,E=u-c+1;if(h===0)for(let d=c;d<=u;d++)i[d]?.(),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);else if(E===0){let d=c<s&&y[_+1]?y[_+1]:n,g=document.createDocumentFragment();for(let x=c;x<=_;x++){let N=r[x],k=x;y[x]=W(R=>(m[k]=R,l(N,k))),g.appendChild(y[x])}e.insertBefore(g,d)}else ut(e,n,t,r,o,i,l,c,u,_,y,m);o.length=s,i.length=s;for(let d=0;d<s;d++)o[d]=y[d],i[d]=m[d]}function ut(e,n,t,r,o,i,l,s,f,c,p,u){let _=new Map;for(let g=s;g<=f;g++)_.set(t[g],g);let y=c-s+1,m=new Int32Array(y);m.fill(-1);for(let g=s;g<=c;g++){let x=_.get(r[g]);x!==void 0&&(_.delete(r[g]),p[g]=o[x],u[g]=i[x],m[g-s]=x)}for(let[,g]of _)i[g]?.(),o[g]?.parentNode&&o[g].parentNode.removeChild(o[g]);let h=y-dt(m,y),E=new Uint8Array(y);if(h>1){let g=new Int32Array(h),x=new Int32Array(h),N=0;for(let R=0;R<y;R++)m[R]!==-1&&(g[N]=m[R],x[N]=R,N++);let k=$e(g,h);for(let R=0;R<k.length;R++)E[x[k[R]]]=1}else if(h===1){for(let g=0;g<y;g++)if(m[g]!==-1){E[g]=1;break}}for(let g=s;g<=c;g++)if(!p[g]){let x=r[g],N=g;p[g]=W(k=>(u[N]=k,l(x,N)))}let d=c+1<p.length&&p[c+1]?p[c+1]:n;for(let g=c;g>=s;g--){let x=g-s;(m[x]===-1||!E[x])&&(d&&d.parentNode!==e&&(d=n),e.insertBefore(p[g],d)),d=p[g]}}function dt(e,n){let t=0;for(let r=0;r<n;r++)e[r]===-1&&t++;return t}function $e(e,n){if(n===0)return[];if(n===1)return[0];let t=new Int32Array(n),r=new Int32Array(n),o=1;t[0]=0,r[0]=-1;for(let s=1;s<n;s++)if(e[s]>e[t[o-1]])r[s]=t[o-1],t[o++]=s;else{let f=0,c=o-1;for(;f<c;){let p=f+c>>1;e[t[p]]<e[s]?f=p+1:c=p}t[f]=s,r[s]=f>0?t[f-1]:-1}let i=new Array(o),l=t[o-1];for(let s=o-1;s>=0;s--)i[s]=l,l=r[l];return i}function pt(e,n,t,r,o,i,l,s,f){let c=r.length,p=t.length;if(c===0){if(p>0){for(let a=0;a<p;a++)i[a]?.(),o[a]?.parentNode===e&&(H(o[a]),e.removeChild(o[a]));o.length=0,i.length=0,f&&f.clear()}return}if(p===0){let a=document.createDocumentFragment();for(let C=0;C<c;C++){let S=r[C],v=C,M;if(f){let $=s(S),z=P(S);M=z,f.set($,{itemSig:z})}else M=S;let B=W($=>(i[v]=$,l(M,v)));o[C]=B,a.appendChild(B)}e.insertBefore(a,n);return}let u=0,_=Math.min(p,c);for(;u<_;){if(t[u]===r[u]){u++;continue}let a=s(t[u]),C=s(r[u]);if(a!==C)break;f&&f.get(a).itemSig.set(r[u]),u++}let y=p-1,m=c-1;for(;y>=u&&m>=u;){if(t[y]===r[m]){y--,m--;continue}let a=s(t[y]),C=s(r[m]);if(a!==C)break;f&&f.get(a).itemSig.set(r[m]),y--,m--}if(u>y&&u>m)return;let h=new Array(c),E=new Array(c);for(let a=0;a<u;a++)h[a]=o[a],E[a]=i[a];for(let a=m+1;a<c;a++){let C=y+1+(a-m-1);h[a]=o[C],E[a]=i[C]}let d=m-u+1;if(y-u+1===0){let a=m+1<c&&h[m+1]?h[m+1]:n,C=document.createDocumentFragment();for(let S=u;S<=m;S++){let v=r[S],M=S,B;if(f){let $=s(v),z=P(v);B=z,f.set($,{itemSig:z})}else B=v;h[S]=W($=>(E[M]=$,l(B,M))),C.appendChild(h[S])}e.insertBefore(C,a),ae(o,i,h,E,c);return}if(d===0){for(let a=u;a<=y;a++)i[a]?.(),o[a]?.parentNode&&e.removeChild(o[a]),f&&f.delete(s(t[a]));ae(o,i,h,E,c);return}let x=new Map;for(let a=u;a<=y;a++)x.set(s(t[a]),a);let N=new Int32Array(d);N.fill(-1);for(let a=u;a<=m;a++){let C=s(r[a]),S=x.get(C);S!==void 0&&(x.delete(C),h[a]=o[S],E[a]=i[S],N[a-u]=S,f&&r[a]!==t[S]&&f.get(C).itemSig.set(r[a]))}for(let[a,C]of x)i[C]?.(),o[C]?.parentNode&&e.removeChild(o[C]),f&&f.delete(a);for(let a=u;a<=m;a++)if(!h[a]){let C=r[a],S=a,v;if(f){let M=s(C),B=P(C);v=B,f.set(M,{itemSig:B})}else v=C;h[a]=W(M=>(E[S]=M,l(v,S)))}let k=0,R=!0,ue=-1;for(let a=0;a<d;a++)N[a]!==-1&&(k++,N[a]<=ue&&(R=!1),ue=N[a]);let X=new Uint8Array(d);if(R)for(let a=0;a<d;a++)N[a]!==-1&&(X[a]=1);else if(k>1){let a=new Int32Array(k),C=new Int32Array(k),S=0;for(let M=0;M<d;M++)N[M]!==-1&&(a[S]=N[M],C[S]=M,S++);let v=$e(a,k);for(let M=0;M<v.length;M++)X[C[v[M]]]=1}else if(k===1){for(let a=0;a<d;a++)if(N[a]!==-1){X[a]=1;break}}let V=m+1<h.length&&h[m+1]?h[m+1]:n;for(let a=m;a>=u;a--){let C=a-u;(N[C]===-1||!X[C])&&(V&&V.parentNode!==e&&(V=n),e.insertBefore(h[a],V)),V=h[a]}ae(o,i,h,E,c)}function ae(e,n,t,r,o){e.length=o,n.length=o;for(let i=0;i<o;i++)e[i]=t[i],n[i]=r[i]}function Dt(e,n){for(let t in n){let r=n[t];if(t.startsWith("on")&&t.length>2){let o=t.slice(2).toLowerCase();e.addEventListener(o,r);continue}typeof r=="function"&&!t.startsWith("on")?t==="class"||t==="className"?A(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?A(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):A(()=>{J(e,t,r())}):J(e,t,r)}}function J(e,n,t){if(n==="ref"){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e);return}if(n!=="key"){if((ke.has(n)||ke.has(n.toLowerCase()))&&!nt(t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`);return}if(n==="class"||n==="className")e.className=t||"";else if(n==="dangerouslySetInnerHTML")e.innerHTML=t?.__html??"";else if(n==="innerHTML")t&&typeof t=="object"&&"__html"in t?e.innerHTML=t.__html??"":typeof console<"u"&&t!=null&&t!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(n==="style"){if(typeof t=="string")e.style.cssText=t;else if(typeof t=="object")for(let r in t)e.style[r]=t[r]??""}else n.startsWith("data-")||n.startsWith("aria-")?e.setAttribute(n,t):typeof t=="boolean"?t?e.setAttribute(n,""):e.removeAttribute(n):n in e?e[n]=t:e.setAttribute(n,t)}}var ve=new Set;function Ht(e){for(let n of e)ve.has(n)||(ve.add(n),document.addEventListener(n,t=>{let r=t.target,o="$$"+n;for(;r;){let i=r[o];if(i&&(i(t),t.cancelBubble))return;r=r.parentNode}}))}function Bt(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function Ot(e,n){A(()=>{for(let t in n){let r=typeof n[t]=="function"?n[t]():n[t];e.classList.toggle(t,!!r)}})}var re=!1,O=null;function $t(){return re}function jt(e,n){re=!0,O={parent:n,index:0},G=0;try{let t=F(e,n);return b&&G>0&&console.warn(`[what] Hydration completed with ${G} mismatch${G===1?"":"es"}. See previous warnings for details. This usually means server and client render different initial HTML.`),t}finally{re=!1,O=null}}function De(e){let n=e.childNodes;for(;O.index<n.length;){let t=n[O.index];if(t.nodeType===8){let r=t.textContent;if(r==="$"||r==="/$"||r==="[]"||r==="/[]"){O.index++;continue}}return O.index++,t}return null}var G=0;function Wt(){return G}function te(e,n,t){if(G++,b){let o=Te("HYDRATION_MISMATCH",{component:t||"unknown",serverHTML:n,clientHTML:e});Ae(o),w?.onHydrationMismatch&&w.onHydrationMismatch({component:t||"unknown",expected:e,actual:n,mismatchCount:G}),w?.onError&&w.onError(o,{type:"hydration",component:t}),console.warn(`[what] Hydration mismatch: expected ${e}, got ${n}`+(t?` (in ${t})`:"")+". Falling back to client render.")}}function F(e,n,t){if(e==null||typeof e=="boolean")return null;if(typeof e=="string"||typeof e=="number"){let o=De(n),i=String(e);if(o&&o.nodeType===3)return b&&o.textContent!==i&&(te(`text "${i}"`,`text "${o.textContent}"`,t),o.textContent=i),o;te(`text node "${i}"`,o?o.nodeName:"nothing",t);let l=document.createTextNode(i);return o?n.replaceChild(l,o):n.appendChild(l),l}if(typeof e=="function"){let o=e(),i=F(o,n,t);return A(()=>{let l=e();re||(i=ne(n,l,i,null))}),i}if(Array.isArray(e)){let o=[];for(let i of e){let l=F(i,n,t);l&&o.push(l)}return o.length===1?o[0]:o}if(typeof e=="object"&&e._vnode){if(typeof e.tag=="function"){let s=Ne(),f=e.tag,c=f.displayName||f.name||"Anonymous",p=e.props||{},u=e.children||[],_={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:f,_parentCtx:s[s.length-1]||null,_errorBoundary:null};s.push(_);let y;try{let m=u.length===0?void 0:u.length===1?u[0]:u;y=f({...p,children:m})}catch(m){return s.pop(),b&&console.error("[what] Error in component during hydration:",c,m),null}return s.pop(),_.mounted=!0,_._mountCallbacks&&queueMicrotask(()=>{if(!_.disposed)for(let m of _._mountCallbacks)try{m()}catch(h){console.error("[what] onMount error:",h)}}),F(y,n,c)}let o=De(n),i=e.tag.toUpperCase();if(o&&o.nodeType===1&&o.nodeName===i){if(ht(o,e.props||{}),e.props?.ref){let c=e.props.ref;typeof c=="function"?c(o):typeof c=="object"&&c!==null&&(c.current=o)}let s=O;if(O={parent:o,index:0},e.props?.dangerouslySetInnerHTML?.__html==null)for(let c of e.children)F(c,o,t);return O=s,o}te(`<${e.tag}>`,o?o.nodeName:"nothing",t);let l=document.createElement(e.tag);for(let s in e.props||{})s==="children"||s==="key"||J(l,s,e.props[s]);for(let s of e.children)ne(l,s,null,null);return o?n.replaceChild(l,o):n.appendChild(l),l}if(Be(e))return e;let r=document.createTextNode(String(e));return n.appendChild(r),r}function ht(e,n){for(let t in n){if(t==="children"||t==="key"||t==="ref"||t==="dangerouslySetInnerHTML"||t==="innerHTML")continue;let r=n[t];if(t.startsWith("on")&&t.length>2){let o=t.slice(2).toLowerCase();e.addEventListener(o,r);continue}if(t.startsWith("$$")){e[t]=r;continue}if(typeof r=="function"&&!t.startsWith("on")){t==="class"||t==="className"?A(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?A(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):A(()=>{J(e,t,r())});continue}if(t!=="data-hk"&&b&&typeof r=="string"){let o=t==="className"?"class":t==="htmlFor"?"for":t,i=e.getAttribute(o);i!==null&&i!==r&&(te(`${o}="${r}"`,`${o}="${i}"`,e.tagName.toLowerCase()),J(e,t,r))}}}export{kt as _$createComponent,it as _$template,Rt as _template,Ot as classList,Ht as delegateEvents,A as effect,Wt as getHydrationMismatchCount,jt as hydrate,It as insert,$t as isHydrating,vt as mapArray,Bt as on,J as setProp,Dt as spread,st as svgTemplate,Rt as template,le as untrack};
58
+ <For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},ne=class extends Error{constructor({code:n,message:t,suggestion:r,file:o,line:i,component:l,signal:s,effect:f}){super(t),this.name="WhatError",this.code=n,this.suggestion=r,this.file=o,this.line=i,this.component=l,this.signal=s,this.effect=f}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function Ie(e,n={}){let t=typeof e=="string"?at[e]:e;if(!t)return new ne({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=t.template;for(let[o,i]of Object.entries(n))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(i));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ne({code:t.code,message:r,suggestion:t.suggestion,file:n.file,line:n.line,component:n.component,signal:n.signal||n.signalName,effect:n.effect||n.effectName})}var te=[],Re=200;function De(e){b&&(te.push({...e.toJSON(),timestamp:Date.now()}),te.length>Re&&(te=te.slice(-Re)))}function Wt(e,n,t){if(t&&t.length>0){let r=t.length===1?t[0]:t;n=n?{...n,children:r}:{children:r}}return v({tag:e,props:n||{},children:t||[],key:null,_vnode:!0})}var ut={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>"}},dt=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 $e(e){let n=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function pt(e){let n=e.trim(),t=$e(n);if(dt.has(t))return ht(n);let r=ut[t];if(r){let i=document.createElement("template");return i.innerHTML=r.wrap+n+r.unwrap,()=>{let l=i.content.firstChild;for(let s=0;s<r.depth;s++)l=l.firstChild;return l.cloneNode(!0)}}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var ve=!1;function Gt(e){return b&&!ve&&(ve=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),pt(e)}function ht(e){let n=e.trim();if($e(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function Vt(e,n,t){if(typeof n=="function"){let r=null;return T(()=>{r=oe(e,n(),r,t||null)}),r}return oe(e,n,null,t||null)}function Ue(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function mt(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function gt(e){return typeof SVGElement<"u"&&e instanceof SVGElement&&e.tagName.toLowerCase()!=="foreignobject"}function He(e){return e==null?[]:Array.isArray(e)?e:[e]}function je(e,n,t){if(e==null||typeof e=="boolean")return t;if(Array.isArray(e)){for(let r=0;r<e.length;r++)je(e[r],n,t);return t}return typeof e=="string"||typeof e=="number"?(t.push(document.createTextNode(String(e))),t):Ue(e)?(t.push(e),t):mt(e)?(t.push(v(e,n,gt(n))),t):(t.push(document.createTextNode(String(e))),t)}function yt(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function oe(e,n,t,r){if(!e||typeof e.insertBefore!="function")return b&&console.warn("[what] reconcileInsert called with invalid parent:",e),t;let o=r||null;if(n==null||typeof n=="boolean"){let c=He(t);for(let p=0;p<c.length;p++){let u=c[p];u.parentNode===e&&(H(u),e.removeChild(u))}return null}if((typeof n=="string"||typeof n=="number")&&t&&!Array.isArray(t)&&t.nodeType===3){let c=String(n);return t.textContent!==c&&(t.textContent=c),t}let i=je(n,e,[]),l=He(t);if(yt(l,i))return t;let s=new Set(i);for(let c=0;c<l.length;c++){let p=l[c];!s.has(p)&&p.parentNode===e&&(H(p),e.removeChild(p))}let f=o;for(let c=i.length-1;c>=0;c--){let p=i[c];(p.parentNode!==e||p.nextSibling!==f)&&(f&&f.parentNode!==e&&(f=null),f?e.insertBefore(p,f):e.appendChild(p)),f=p}return i.length===0?null:i.length===1?i[0]:i}function qt(e,n,t){let r=t?.key,o=t?.raw||!1;return(i,l)=>{let s=[],f=[],c=[],p=r&&!o?new Map:null,u=document.createComment("/list");return i.insertBefore(u,l||null),T(()=>{let _=e()||[];r?bt(i,u,s,_,f,c,n,r,p):_t(i,u,s,_,f,c,n),s=_.slice()}),u}}function _t(e,n,t,r,o,i,l){let s=r.length,f=t.length;if(s===0){if(f>0){for(let d=0;d<f;d++)i[d]?.(),o[d]?.parentNode===e&&(H(o[d]),e.removeChild(o[d]));o.length=0,i.length=0}return}if(f===0){let d=document.createDocumentFragment();for(let g=0;g<s;g++){let x=r[g],N=j(k=>(i[g]=k,l(x,g)));o[g]=N,d.appendChild(N)}e.insertBefore(d,n);return}let c=0,p=Math.min(f,s);for(;c<p&&t[c]===r[c];)c++;if(c===f&&c===s)return;let u=f-1,_=s-1;for(;u>=c&&_>=c&&t[u]===r[_];)u--,_--;let y=new Array(s),m=new Array(s);for(let d=0;d<c;d++)y[d]=o[d],m[d]=i[d];for(let d=_+1;d<s;d++){let g=u+1+(d-_-1);y[d]=o[g],m[d]=i[g]}let h=_-c+1,E=u-c+1;if(h===0)for(let d=c;d<=u;d++)i[d]?.(),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);else if(E===0){let d=c<s&&y[_+1]?y[_+1]:n,g=document.createDocumentFragment();for(let x=c;x<=_;x++){let N=r[x],k=x;y[x]=j(R=>(m[k]=R,l(N,k))),g.appendChild(y[x])}e.insertBefore(g,d)}else wt(e,n,t,r,o,i,l,c,u,_,y,m);o.length=s,i.length=s;for(let d=0;d<s;d++)o[d]=y[d],i[d]=m[d]}function wt(e,n,t,r,o,i,l,s,f,c,p,u){let _=new Map;for(let g=s;g<=f;g++)_.set(t[g],g);let y=c-s+1,m=new Int32Array(y);m.fill(-1);for(let g=s;g<=c;g++){let x=_.get(r[g]);x!==void 0&&(_.delete(r[g]),p[g]=o[x],u[g]=i[x],m[g-s]=x)}for(let[,g]of _)i[g]?.(),o[g]?.parentNode&&o[g].parentNode.removeChild(o[g]);let h=y-Ct(m,y),E=new Uint8Array(y);if(h>1){let g=new Int32Array(h),x=new Int32Array(h),N=0;for(let R=0;R<y;R++)m[R]!==-1&&(g[N]=m[R],x[N]=R,N++);let k=We(g,h);for(let R=0;R<k.length;R++)E[x[k[R]]]=1}else if(h===1){for(let g=0;g<y;g++)if(m[g]!==-1){E[g]=1;break}}for(let g=s;g<=c;g++)if(!p[g]){let x=r[g],N=g;p[g]=j(k=>(u[N]=k,l(x,N)))}let d=c+1<p.length&&p[c+1]?p[c+1]:n;for(let g=c;g>=s;g--){let x=g-s;(m[x]===-1||!E[x])&&(d&&d.parentNode!==e&&(d=n),e.insertBefore(p[g],d)),d=p[g]}}function Ct(e,n){let t=0;for(let r=0;r<n;r++)e[r]===-1&&t++;return t}function We(e,n){if(n===0)return[];if(n===1)return[0];let t=new Int32Array(n),r=new Int32Array(n),o=1;t[0]=0,r[0]=-1;for(let s=1;s<n;s++)if(e[s]>e[t[o-1]])r[s]=t[o-1],t[o++]=s;else{let f=0,c=o-1;for(;f<c;){let p=f+c>>1;e[t[p]]<e[s]?f=p+1:c=p}t[f]=s,r[s]=f>0?t[f-1]:-1}let i=new Array(o),l=t[o-1];for(let s=o-1;s>=0;s--)i[s]=l,l=r[l];return i}function bt(e,n,t,r,o,i,l,s,f){let c=r.length,p=t.length;if(c===0){if(p>0){for(let a=0;a<p;a++)i[a]?.(),o[a]?.parentNode===e&&(H(o[a]),e.removeChild(o[a]));o.length=0,i.length=0,f&&f.clear()}return}if(p===0){let a=document.createDocumentFragment();for(let C=0;C<c;C++){let S=r[C],D=C,A;if(f){let $=s(S),z=q(S);A=z,f.set($,{itemSig:z})}else A=S;let B=j($=>(i[D]=$,l(A,D)));o[C]=B,a.appendChild(B)}e.insertBefore(a,n);return}let u=0,_=Math.min(p,c);for(;u<_;){if(t[u]===r[u]){u++;continue}let a=s(t[u]),C=s(r[u]);if(a!==C)break;f&&f.get(a).itemSig.set(r[u]),u++}let y=p-1,m=c-1;for(;y>=u&&m>=u;){if(t[y]===r[m]){y--,m--;continue}let a=s(t[y]),C=s(r[m]);if(a!==C)break;f&&f.get(a).itemSig.set(r[m]),y--,m--}if(u>y&&u>m)return;let h=new Array(c),E=new Array(c);for(let a=0;a<u;a++)h[a]=o[a],E[a]=i[a];for(let a=m+1;a<c;a++){let C=y+1+(a-m-1);h[a]=o[C],E[a]=i[C]}let d=m-u+1;if(y-u+1===0){let a=m+1<c&&h[m+1]?h[m+1]:n,C=document.createDocumentFragment();for(let S=u;S<=m;S++){let D=r[S],A=S,B;if(f){let $=s(D),z=q(D);B=z,f.set($,{itemSig:z})}else B=D;h[S]=j($=>(E[A]=$,l(B,A))),C.appendChild(h[S])}e.insertBefore(C,a),pe(o,i,h,E,c);return}if(d===0){for(let a=u;a<=y;a++)i[a]?.(),o[a]?.parentNode&&e.removeChild(o[a]),f&&f.delete(s(t[a]));pe(o,i,h,E,c);return}let x=new Map;for(let a=u;a<=y;a++)x.set(s(t[a]),a);let N=new Int32Array(d);N.fill(-1);for(let a=u;a<=m;a++){let C=s(r[a]),S=x.get(C);S!==void 0&&(x.delete(C),h[a]=o[S],E[a]=i[S],N[a-u]=S,f&&r[a]!==t[S]&&f.get(C).itemSig.set(r[a]))}for(let[a,C]of x)i[C]?.(),o[C]?.parentNode&&e.removeChild(o[C]),f&&f.delete(a);for(let a=u;a<=m;a++)if(!h[a]){let C=r[a],S=a,D;if(f){let A=s(C),B=q(C);D=B,f.set(A,{itemSig:B})}else D=C;h[a]=j(A=>(E[S]=A,l(D,S)))}let k=0,R=!0,he=-1;for(let a=0;a<d;a++)N[a]!==-1&&(k++,N[a]<=he&&(R=!1),he=N[a]);let X=new Uint8Array(d);if(R)for(let a=0;a<d;a++)N[a]!==-1&&(X[a]=1);else if(k>1){let a=new Int32Array(k),C=new Int32Array(k),S=0;for(let A=0;A<d;A++)N[A]!==-1&&(a[S]=N[A],C[S]=A,S++);let D=We(a,k);for(let A=0;A<D.length;A++)X[C[D[A]]]=1}else if(k===1){for(let a=0;a<d;a++)if(N[a]!==-1){X[a]=1;break}}let P=m+1<h.length&&h[m+1]?h[m+1]:n;for(let a=m;a>=u;a--){let C=a-u;(N[C]===-1||!X[C])&&(P&&P.parentNode!==e&&(P=n),e.insertBefore(h[a],P)),P=h[a]}pe(o,i,h,E,c)}function pe(e,n,t,r,o){e.length=o,n.length=o;for(let i=0;i<o;i++)e[i]=t[i],n[i]=r[i]}function Pt(e,n){for(let t in n){let r=n[t];if(t.startsWith("on")&&t.length>2){let o=t.slice(2).toLowerCase();e.addEventListener(o,r);continue}typeof r=="function"&&!t.startsWith("on")?t==="class"||t==="className"?T(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?T(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):T(()=>{J(e,t,r())}):J(e,t,r)}}function J(e,n,t){if(n==="ref"){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e);return}if(n!=="key"){if(!Z(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Q(n));return}if(n==="class"||n==="className")e.className=t||"";else if(n==="dangerouslySetInnerHTML")e.innerHTML=t?.__html??"";else if(n==="innerHTML")t&&typeof t=="object"&&"__html"in t?e.innerHTML=t.__html??"":typeof console<"u"&&t!=null&&t!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(n==="style"){if(typeof t=="string")e.style.cssText=t;else if(typeof t=="object")for(let r in t)e.style[r]=t[r]??""}else n.startsWith("data-")||n.startsWith("aria-")?e.setAttribute(n,t):typeof t=="boolean"?t?e.setAttribute(n,""):e.removeAttribute(n):n in e?e[n]=t:e.setAttribute(n,t)}}var Be=new Set;function zt(e){for(let n of e)Be.has(n)||(Be.add(n),document.addEventListener(n,t=>{let r=t.target,o="$$"+n;for(;r;){let i=r[o];if(i&&(i(t),t.cancelBubble))return;r=r.parentNode}}))}function Ft(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function Kt(e,n){T(()=>{for(let t in n){let r=typeof n[t]=="function"?n[t]():n[t];e.classList.toggle(t,!!r)}})}var ie=!1,O=null;function Jt(){return ie}function Xt(e,n){ie=!0,O={parent:n,index:0},W=0;try{let t=K(e,n);return b&&W>0&&console.warn(`[what] Hydration completed with ${W} mismatch${W===1?"":"es"}. See previous warnings for details. This usually means server and client render different initial HTML.`),t}finally{ie=!1,O=null}}function Oe(e){let n=e.childNodes;for(;O.index<n.length;){let t=n[O.index];if(t.nodeType===8){let r=t.textContent;if(r==="$"||r==="/$"||r==="[]"||r==="/[]"){O.index++;continue}}return O.index++,t}return null}var W=0;function Yt(){return W}function re(e,n,t){if(W++,b){let o=Ie("HYDRATION_MISMATCH",{component:t||"unknown",serverHTML:n,clientHTML:e});De(o),w?.onHydrationMismatch&&w.onHydrationMismatch({component:t||"unknown",expected:e,actual:n,mismatchCount:W}),w?.onError&&w.onError(o,{type:"hydration",component:t}),console.warn(`[what] Hydration mismatch: expected ${e}, got ${n}`+(t?` (in ${t})`:"")+". Falling back to client render.")}}function K(e,n,t){if(e==null||typeof e=="boolean")return null;if(typeof e=="string"||typeof e=="number"){let o=Oe(n),i=String(e);if(o&&o.nodeType===3)return b&&o.textContent!==i&&(re(`text "${i}"`,`text "${o.textContent}"`,t),o.textContent=i),o;re(`text node "${i}"`,o?o.nodeName:"nothing",t);let l=document.createTextNode(i);return o?n.replaceChild(l,o):n.appendChild(l),l}if(typeof e=="function"){let o=e(),i=K(o,n,t);return T(()=>{let l=e();ie||(i=oe(n,l,i,null))}),i}if(Array.isArray(e)){let o=[];for(let i of e){let l=K(i,n,t);l&&o.push(l)}return o.length===1?o[0]:o}if(typeof e=="object"&&e._vnode){if(typeof e.tag=="function"){let s=Te(),f=e.tag,c=f.displayName||f.name||"Anonymous",p=e.props||{},u=e.children||[],_={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:f,_parentCtx:s[s.length-1]||null,_errorBoundary:null};s.push(_);let y;try{let m=u.length===0?void 0:u.length===1?u[0]:u;y=f({...p,children:m})}catch(m){return s.pop(),b&&console.error("[what] Error in component during hydration:",c,m),null}return s.pop(),_.mounted=!0,_._mountCallbacks&&queueMicrotask(()=>{if(!_.disposed)for(let m of _._mountCallbacks)try{m()}catch(h){console.error("[what] onMount error:",h)}}),K(y,n,c)}let o=Oe(n),i=e.tag.toUpperCase();if(o&&o.nodeType===1&&o.nodeName===i){if(Et(o,e.props||{}),e.props?.ref){let c=e.props.ref;typeof c=="function"?c(o):typeof c=="object"&&c!==null&&(c.current=o)}let s=O;if(O={parent:o,index:0},e.props?.dangerouslySetInnerHTML?.__html==null)for(let c of e.children)K(c,o,t);return O=s,o}re(`<${e.tag}>`,o?o.nodeName:"nothing",t);let l=document.createElement(e.tag);for(let s in e.props||{})s==="children"||s==="key"||J(l,s,e.props[s]);for(let s of e.children)oe(l,s,null,null);return o?n.replaceChild(l,o):n.appendChild(l),l}if(Ue(e))return e;let r=document.createTextNode(String(e));return n.appendChild(r),r}function Et(e,n){for(let t in n){if(t==="children"||t==="key"||t==="ref"||t==="dangerouslySetInnerHTML"||t==="innerHTML")continue;let r=n[t];if(t.startsWith("on")&&t.length>2){let o=t.slice(2).toLowerCase();e.addEventListener(o,r);continue}if(t.startsWith("$$")){e[t]=r;continue}if(typeof r=="function"&&!t.startsWith("on")){t==="class"||t==="className"?T(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?T(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):T(()=>{J(e,t,r())});continue}if(t!=="data-hk"&&b&&typeof r=="string"){let o=t==="className"?"class":t==="htmlFor"?"for":t,i=e.getAttribute(o);i!==null&&i!==r&&(re(`${o}="${r}"`,`${o}="${i}"`,e.tagName.toLowerCase()),J(e,t,r))}}}export{Wt as _$createComponent,pt as _$template,Gt as _template,Kt as classList,zt as delegateEvents,T as effect,Yt as getHydrationMismatchCount,Xt as hydrate,Vt as insert,Jt as isHydrating,qt as mapArray,Ft as on,J as setProp,Pt as spread,ht as svgTemplate,Gt as template,ae as untrack};
59
59
  //# sourceMappingURL=render.min.js.map