what-core 0.6.8 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var E=!(typeof process<"u"),w=null;var A=null,z=null,V=null,ce=!1,Y=0,D=[],K=!1,De=new WeakMap,Be=Symbol("needs_upstream");function I(e,n){let t=e,r=new Set;function o(...i){if(i.length===0)return A&&(r.add(A),A.deps.push(r)),t;E&&ce&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i[0]=="function"?i[0](t):i[0];Object.is(t,a)||(t=a,E&&w&&w.onSignalUpdate(o),r.size>0&&fe(r))}return o.set=i=>{E&&ce&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i=="function"?i(t):i;Object.is(t,a)||(t=a,E&&w&&w.onSignalUpdate(o),r.size>0&&fe(r))},o.peek=()=>t,o.subscribe=i=>B(()=>i(o())),o._signal=!0,E&&(o._subs=r,n&&(o._debugName=n)),E&&w&&w.onSignalCreate(o),o}function le(e){let n=0,t=e.deps;for(let r=0;r<t.length;r++){let o=De.get(t[r]);if(o){let i=o._level;i>n&&(n=i)}}e._level=n+1}function B(e,n){let t=$e(e);t._level=1;let r=A;A=t;try{let i=t.fn();typeof i=="function"&&(t._cleanup=i)}finally{A=r}le(t),n?.stable&&(t._stable=!0);let o=()=>Oe(t);return z&&z.disposals.push(o),o}function $e(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 E&&w&&w.onEffectCreate(t),t}function He(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){E&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let t=A;A=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:e}),E&&console.warn("[what] Error in stable effect:",r)}finally{A=t}E&&w?.onEffectRun&&w.onEffectRun(e);return}if(ae(e),e._cleanup){try{e._cleanup()}catch(t){w?.onError&&w.onError(t,{type:"effect-cleanup",effect:e}),E&&console.warn("[what] Error in effect cleanup:",t)}e._cleanup=null}let n=A;A=e;try{let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){throw t===Be||w?.onError&&w.onError(t,{type:"effect",effect:e}),t}finally{A=n}E&&w?.onEffectRun&&w.onEffectRun(e)}function Oe(e){if(e.disposed=!0,E&&w&&w.onEffectDispose(e),ae(e),e._cleanup){try{e._cleanup()}catch(n){E&&console.warn("[what] Error in effect cleanup on dispose:",n)}e._cleanup=null}}function ae(e){let n=e.deps;for(let t=0;t<n.length;t++)n[t].delete(e);n.length=0}var F=0,U=null,W=0;function fe(e){if(F===0){F=1;try{for(let n of e)if(!n.disposed){if(n._onNotify)n._onNotify();else if(Y===0&&n._stable){let t=A;A=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}),E&&console.warn("[what] Error in stable effect:",r)}finally{A=t}}else if(!n._pending){n._pending=!0;let t=n._level,r=D.length;r>0&&D[r-1]._level>t&&(K=!0),D.push(n)}}if(W>0){let n=0;for(;n<W;){let t=U[n];U[n]=null,n++;for(let r of t)if(!r.disposed){if(r._onNotify)r._onNotify();else if(Y===0&&r._stable){let o=A;A=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}),E&&console.warn("[what] Error in stable effect:",i)}finally{A=o}}else if(!r._pending){r._pending=!0;let o=r._level,i=D.length;i>0&&D[i-1]._level>o&&(K=!0),D.push(r)}}}W=0}}finally{F=0}Y===0&&D.length>0&&je()}else U===null&&(U=[]),W>=U.length?U.push(e):U[W]=e,W++}var ee=!1;function je(){ee||(ee=!0,queueMicrotask(()=>{ee=!1,Re()}))}var te=!1;function Re(){if(!te){te=!0;try{let e=0;for(;D.length>0&&e<25;){let n=D;D=[],n.length>1&&K&&n.sort((t,r)=>t._level-r._level),K=!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;He(r),!r._computed&&r.deps.length!==o&&le(r)}}e++}if(e>=25){for(let n=0;n<D.length;n++)D[n]._pending=!1;if(D.length=0,E){let t=D.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{te=!1}}}function J(e){let n=A;A=null;try{return e()}finally{A=n}}function v(e){let n=z,t=V,r={disposals:[],owner:V,children:[],_disposed:!1};V&&V.children.push(r),z=r,V=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let i=r.children.length-1;i>=0;i--)ue(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{z=n,V=t}}function ue(e){if(!e._disposed){e._disposed=!0;for(let n=e.children.length-1;n>=0;n--)ue(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 pe=null;function de(e){pe=e}function he(e,n){let t=n||pe?.();for(;t;){if(t._errorBoundary)return t._errorBoundary(e),!0;t=t._parentCtx}return!1}var Ue=null;function me(e){Ue=e}var ve=new Set(["href","src","action","formaction","poster","cite","background","xlink:href"]),Ve=new Set(["srcset"]);function ne(e){return String(e).toLowerCase()}function We(e){return String(e).trim().replace(/[\s\x00-\x1f\x7f]/g,"").toLowerCase()}function ge(e){if(typeof e!="string")return!0;let n=We(e);return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}function Ie(e){return typeof e!="string"?!0:e.split(",").every(n=>{let t=n.trim().split(/\s+/,1)[0]||"";return t===""||ge(t)})}function qe(e){return ve.has(ne(e))}function Pe(e){return Ve.has(ne(e))}function X(e,n){return Pe(e)?Ie(n):qe(e)?ge(n):!0}function Z(e){return e==="className"?"class":e==="htmlFor"?"for":ne(e)==="formaction"?"formaction":e}var ze=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"]),Ge="http://www.w3.org/2000/svg",Ce=new Set,Q=new WeakMap;function Ke(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function re(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function ye(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)}E&&w?.onComponentUnmount&&w.onComponentUnmount(e),Ce.delete(e)}}function O(e){if(!e)return;e._componentCtx&&ye(e._componentCtx);let n=Q.get(e);if(n&&ye(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)O(t)}function H(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(Ke(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),i=[],a=document.createDocumentFragment();a.appendChild(r),a.appendChild(o);let s=B(()=>{let l=e(),c=l==null||l===!1||l===!0?[]:Array.isArray(l)?l:[l],d=o.parentNode;if(d){for(let u of i)O(u),u.parentNode===d&&d.removeChild(u);i=[];for(let u of c){let _=H(u,d,n?._isSvg);if(_)if(_.nodeType===11){let y=Array.from(_.childNodes);d.insertBefore(_,o);for(let g of y)i.push(g)}else d.insertBefore(_,o),i.push(_)}}});return r._dispose=s,o._dispose=s,a}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let i=H(o,n,t);i&&r.appendChild(i)}return r}return re(e)&&typeof e.tag=="function"||re(e)&&(e.tag==="__errorBoundary"||e.tag==="__suspense"||e.tag==="__portal")?_e(e,n,t):re(e)?Qe(e,n,t):document.createTextNode(String(e))}var N=[];function we(){return N[N.length-1]}de(we);me(we);function _e(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(p){return new h(p).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Je(e,n);if(r==="__suspense"||e.tag==="__suspense")return Xe(e,n);if(r==="__portal"||e.tag==="__portal")return Ze(e,n);let a={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:N[N.length-1]||null,_errorBoundary:(()=>{let h=N[N.length-1];for(;h;){if(h._errorBoundary)return h._errorBoundary;h=h._parentCtx}return null})()},s=document.createComment("c:start"),l=document.createComment("c:end");Q.set(s,a),a._startComment=s,a._endComment=l;let c=document.createDocumentFragment();c._componentCtx=a,a._wrapper=s,Ce.add(a),E&&w?.onComponentMount&&w.onComponentMount(a);let d=i.length===0?void 0:i.length===1?i[0]:i,u=I({...o,children:d});a._propsSignal=u;let _=new Proxy({},{get(h,b){return u()[b]},has(h,b){let p=u();return b in p},ownKeys(){let h=u();return Reflect.ownKeys(h)},getOwnPropertyDescriptor(h,b){let p=u();if(b in p)return{value:p[b],writable:!1,enumerable:!0,configurable:!0}}});N.push(a);let y;try{y=r(_)}catch(h){if(N.pop(),!he(h,a))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return c.appendChild(s),c.appendChild(l),c}N.pop(),a.mounted=!0,a._mountCallbacks&&queueMicrotask(()=>{if(!a.disposed)for(let h of a._mountCallbacks)try{h()}catch(b){console.error("[what] onMount error:",b)}}),c.appendChild(s);let g=Array.isArray(y)?y:[y];for(let h of g){let b=H(h,c,t);b&&c.appendChild(b)}return c.appendChild(l),c}function Je(e,n){let{errorState:t,handleError:r,fallback:o,reset:i}=e.props,a=e.children,s=document.createComment("eb:start"),l=document.createComment("eb:end"),c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null,_errorBoundary:r,_startComment:s,_endComment:l};Q.set(s,c);let d=document.createDocumentFragment();d._componentCtx=c,d.appendChild(s),d.appendChild(l);let u=B(()=>{let _=t();if(N.push(c),s.parentNode)for(;s.nextSibling&&s.nextSibling!==l;){let g=s.nextSibling;O(g),g.parentNode.removeChild(g)}let y;_?y=typeof o=="function"?[o({error:_,reset:i})]:[o]:y=a,y=Array.isArray(y)?y:[y];for(let g of y){let h=H(g,n);h&&(l.parentNode?l.parentNode.insertBefore(h,l):d.insertBefore(h,l))}N.pop()});return c.effects.push(u),d}function Xe(e,n){let{boundary:t,fallback:r,loading:o}=e.props,i=e.children,a=document.createComment("sb:start"),s=document.createComment("sb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null,_startComment:a,_endComment:s};Q.set(a,l);let c=document.createDocumentFragment();c._componentCtx=l,c.appendChild(a),c.appendChild(s);let d=B(()=>{let _=o()?[r]:i,y=Array.isArray(_)?_:[_];if(N.push(l),a.parentNode)for(;a.nextSibling&&a.nextSibling!==s;){let g=a.nextSibling;O(g),g.parentNode.removeChild(g)}for(let g of y){let h=H(g,n);h&&(s.parentNode?s.parentNode.insertBefore(h,s):c.insertBefore(h,s))}N.pop()});return l.effects.push(d),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:N[N.length-1]||null},i=document.createComment("portal");i._componentCtx=o;let a=[];for(let s of r){let l=H(s,t);l&&(t.appendChild(l),a.push(l))}return o._cleanupCallbacks=[()=>{for(let s of a)O(s),s.parentNode&&s.parentNode.removeChild(s)}],i}function Qe(e,n,t){let{tag:r,props:o,children:i}=e,a=t||ze.has(r),s=a?document.createElementNS(Ge,r):document.createElement(r);o&&Ye(s,o,{},a);for(let l of i){let c=H(l,s,a&&r!=="foreignObject");c&&s.appendChild(c)}return s._vnode=e,s}function Ye(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}be(e,o,n[o],r)}}function be(e,n,t,r){if(!X(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Z(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]=B(()=>{let o=t();be(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 a=o.toLowerCase(),s=i?a+"_capture":a,l=e._events?.[s];if(l&&l._original===t||(l&&e.removeEventListener(a,l,i),t==null))return;e._events||(e._events={});let c=u=>(u.nativeEvent||(u.nativeEvent=u),J(()=>t(u)));c._original=t,e._events[s]=c;let d=t._eventOpts;e.addEventListener(a,c,d||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{E&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(typeof 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)}function Fe(e,n,t){if(t&&t.length>0){let r=t.length===1?t[0]:t;n=n?{...n,children:r}:{children:r}}return H({tag:e,props:n||{},children:t||[],key:null,_vnode:!0})}var et={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},tt=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function Ae(e){let n=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Me(e){let n=e.trim(),t=Ae(n);if(tt.has(t))return nt(n);let r=et[t];if(r){let i=document.createElement("template");return i.innerHTML=r.wrap+n+r.unwrap,()=>{let a=i.content.firstChild;for(let s=0;s<r.depth;s++)a=a.firstChild;return a.cloneNode(!0)}}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var xe=!1;function Ne(e){return E&&!xe&&(xe=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Me(e)}function nt(e){let n=e.trim();if(Ae(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 rt(e,n,t){if(typeof n=="function"){let r=null;return B(()=>{r=Se(e,n(),r,t||null)}),r}return Se(e,n,null,t||null)}function ot(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function it(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function st(e){return typeof SVGElement<"u"&&e instanceof SVGElement&&e.tagName.toLowerCase()!=="foreignobject"}function Ee(e){return e==null?[]:Array.isArray(e)?e:[e]}function Te(e,n,t){if(e==null||typeof e=="boolean")return t;if(Array.isArray(e)){for(let r=0;r<e.length;r++)Te(e[r],n,t);return t}return typeof e=="string"||typeof e=="number"?(t.push(document.createTextNode(String(e))),t):ot(e)?(t.push(e),t):it(e)?(t.push(H(e,n,st(n))),t):(t.push(document.createTextNode(String(e))),t)}function ct(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 Se(e,n,t,r){if(!e||typeof e.insertBefore!="function")return E&&console.warn("[what] reconcileInsert called with invalid parent:",e),t;let o=r||null;if(n==null||typeof n=="boolean"){let c=Ee(t);for(let d=0;d<c.length;d++){let u=c[d];u.parentNode===e&&(O(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=Te(n,e,[]),a=Ee(t);if(ct(a,i))return t;let s=new Set(i);for(let c=0;c<a.length;c++){let d=a[c];!s.has(d)&&d.parentNode===e&&(O(d),e.removeChild(d))}let l=o;for(let c=i.length-1;c>=0;c--){let d=i[c];(d.parentNode!==e||d.nextSibling!==l)&&(l&&l.parentNode!==e&&(l=null),l?e.insertBefore(d,l):e.appendChild(d)),l=d}return i.length===0?null:i.length===1?i[0]:i}function ft(e,n,t){let r=t?.key,o=t?.raw||!1;return(i,a)=>{let s=[],l=[],c=[],d=r&&!o?new Map:null,u=document.createComment("/list");return i.insertBefore(u,a||null),B(()=>{let _=e()||[];r?pt(i,u,s,_,l,c,n,r,d):lt(i,u,s,_,l,c,n),s=_.slice()}),u}}function lt(e,n,t,r,o,i,a){let s=r.length,l=t.length;if(s===0){if(l>0){for(let p=0;p<l;p++)i[p]?.(),o[p]?.parentNode===e&&(O(o[p]),e.removeChild(o[p]));o.length=0,i.length=0}return}if(l===0){let p=document.createDocumentFragment();for(let m=0;m<s;m++){let x=r[m],L=v(T=>(i[m]=T,a(x,m)));o[m]=L,p.appendChild(L)}e.insertBefore(p,n);return}let c=0,d=Math.min(l,s);for(;c<d&&t[c]===r[c];)c++;if(c===l&&c===s)return;let u=l-1,_=s-1;for(;u>=c&&_>=c&&t[u]===r[_];)u--,_--;let y=new Array(s),g=new Array(s);for(let p=0;p<c;p++)y[p]=o[p],g[p]=i[p];for(let p=_+1;p<s;p++){let m=u+1+(p-_-1);y[p]=o[m],g[p]=i[m]}let h=_-c+1,b=u-c+1;if(h===0)for(let p=c;p<=u;p++)i[p]?.(),o[p]?.parentNode&&o[p].parentNode.removeChild(o[p]);else if(b===0){let p=c<s&&y[_+1]?y[_+1]:n,m=document.createDocumentFragment();for(let x=c;x<=_;x++){let L=r[x],T=x;y[x]=v(k=>(g[T]=k,a(L,T))),m.appendChild(y[x])}e.insertBefore(m,p)}else at(e,n,t,r,o,i,a,c,u,_,y,g);o.length=s,i.length=s;for(let p=0;p<s;p++)o[p]=y[p],i[p]=g[p]}function at(e,n,t,r,o,i,a,s,l,c,d,u){let _=new Map;for(let m=s;m<=l;m++)_.set(t[m],m);let y=c-s+1,g=new Int32Array(y);g.fill(-1);for(let m=s;m<=c;m++){let x=_.get(r[m]);x!==void 0&&(_.delete(r[m]),d[m]=o[x],u[m]=i[x],g[m-s]=x)}for(let[,m]of _)i[m]?.(),o[m]?.parentNode&&o[m].parentNode.removeChild(o[m]);let h=y-ut(g,y),b=new Uint8Array(y);if(h>1){let m=new Int32Array(h),x=new Int32Array(h),L=0;for(let k=0;k<y;k++)g[k]!==-1&&(m[L]=g[k],x[L]=k,L++);let T=ke(m,h);for(let k=0;k<T.length;k++)b[x[T[k]]]=1}else if(h===1){for(let m=0;m<y;m++)if(g[m]!==-1){b[m]=1;break}}for(let m=s;m<=c;m++)if(!d[m]){let x=r[m],L=m;d[m]=v(T=>(u[L]=T,a(x,L)))}let p=c+1<d.length&&d[c+1]?d[c+1]:n;for(let m=c;m>=s;m--){let x=m-s;(g[x]===-1||!b[x])&&(p&&p.parentNode!==e&&(p=n),e.insertBefore(d[m],p)),p=d[m]}}function ut(e,n){let t=0;for(let r=0;r<n;r++)e[r]===-1&&t++;return t}function ke(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 l=0,c=o-1;for(;l<c;){let d=l+c>>1;e[t[d]]<e[s]?l=d+1:c=d}t[l]=s,r[s]=l>0?t[l-1]:-1}let i=new Array(o),a=t[o-1];for(let s=o-1;s>=0;s--)i[s]=a,a=r[a];return i}function pt(e,n,t,r,o,i,a,s,l){let c=r.length,d=t.length;if(c===0){if(d>0){for(let f=0;f<d;f++)i[f]?.(),o[f]?.parentNode===e&&(O(o[f]),e.removeChild(o[f]));o.length=0,i.length=0,l&&l.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<c;C++){let S=r[C],$=C,M;if(l){let R=s(S),P=I(S);M=P,l.set(R,{itemSig:P})}else M=S;let j=v(R=>(i[$]=R,a(M,$)));o[C]=j,f.appendChild(j)}e.insertBefore(f,n);return}let u=0,_=Math.min(d,c);for(;u<_;){if(t[u]===r[u]){u++;continue}let f=s(t[u]),C=s(r[u]);if(f!==C)break;l&&l.get(f).itemSig.set(r[u]),u++}let y=d-1,g=c-1;for(;y>=u&&g>=u;){if(t[y]===r[g]){y--,g--;continue}let f=s(t[y]),C=s(r[g]);if(f!==C)break;l&&l.get(f).itemSig.set(r[g]),y--,g--}if(u>y&&u>g)return;let h=new Array(c),b=new Array(c);for(let f=0;f<u;f++)h[f]=o[f],b[f]=i[f];for(let f=g+1;f<c;f++){let C=y+1+(f-g-1);h[f]=o[C],b[f]=i[C]}let p=g-u+1;if(y-u+1===0){let f=g+1<c&&h[g+1]?h[g+1]:n,C=document.createDocumentFragment();for(let S=u;S<=g;S++){let $=r[S],M=S,j;if(l){let R=s($),P=I($);j=P,l.set(R,{itemSig:P})}else j=$;h[S]=v(R=>(b[M]=R,a(j,M))),C.appendChild(h[S])}e.insertBefore(C,f),oe(o,i,h,b,c);return}if(p===0){for(let f=u;f<=y;f++)i[f]?.(),o[f]?.parentNode&&e.removeChild(o[f]),l&&l.delete(s(t[f]));oe(o,i,h,b,c);return}let x=new Map;for(let f=u;f<=y;f++)x.set(s(t[f]),f);let L=new Int32Array(p);L.fill(-1);for(let f=u;f<=g;f++){let C=s(r[f]),S=x.get(C);S!==void 0&&(x.delete(C),h[f]=o[S],b[f]=i[S],L[f-u]=S,l&&r[f]!==t[S]&&l.get(C).itemSig.set(r[f]))}for(let[f,C]of x)i[C]?.(),o[C]?.parentNode&&e.removeChild(o[C]),l&&l.delete(f);for(let f=u;f<=g;f++)if(!h[f]){let C=r[f],S=f,$;if(l){let M=s(C),j=I(C);$=j,l.set(M,{itemSig:j})}else $=C;h[f]=v(M=>(b[S]=M,a($,S)))}let T=0,k=!0,se=-1;for(let f=0;f<p;f++)L[f]!==-1&&(T++,L[f]<=se&&(k=!1),se=L[f]);let G=new Uint8Array(p);if(k)for(let f=0;f<p;f++)L[f]!==-1&&(G[f]=1);else if(T>1){let f=new Int32Array(T),C=new Int32Array(T),S=0;for(let M=0;M<p;M++)L[M]!==-1&&(f[S]=L[M],C[S]=M,S++);let $=ke(f,T);for(let M=0;M<$.length;M++)G[C[$[M]]]=1}else if(T===1){for(let f=0;f<p;f++)if(L[f]!==-1){G[f]=1;break}}let q=g+1<h.length&&h[g+1]?h[g+1]:n;for(let f=g;f>=u;f--){let C=f-u;(L[C]===-1||!G[C])&&(q&&q.parentNode!==e&&(q=n),e.insertBefore(h[f],q)),q=h[f]}oe(o,i,h,b,c)}function oe(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"?B(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?B(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):B(()=>{ie(e,t,r())}):ie(e,t,r)}}function ie(e,n,t){if(n==="ref"){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e);return}if(n!=="key"){if(!X(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Z(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 Le=new Set;function ht(e){for(let n of e)Le.has(n)||(Le.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 mt(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function gt(e,n){B(()=>{for(let t in n){let r=typeof n[t]=="function"?n[t]():n[t];e.classList.toggle(t,!!r)}})}export{Fe as _$createComponent,Me as _$template,Ne as _template,gt as classList,ht as delegateEvents,B as effect,rt as insert,ft as mapArray,mt as on,ie as setProp,dt as spread,Ne as template,J as untrack};
1
+ var A=!(typeof process<"u"),x=null;var T=null,z=null,I=null,le=!1,Y=0,D=[],K=!1,Be=new WeakMap,He=Symbol("needs_upstream");function q(e,n){let t=e,r=new Set;function o(...i){if(i.length===0)return T&&(r.add(T),T.deps.push(r)),t;A&&le&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i[0]=="function"?i[0](t):i[0];Object.is(t,a)||(t=a,A&&x&&x.onSignalUpdate(o),r.size>0&&ae(r))}return o.set=i=>{A&&le&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i=="function"?i(t):i;Object.is(t,a)||(t=a,A&&x&&x.onSignalUpdate(o),r.size>0&&ae(r))},o.peek=()=>t,o.subscribe=i=>$(()=>i(o())),o._signal=!0,A&&(o._subs=r,n&&(o._debugName=n)),A&&x&&x.onSignalCreate(o),o}function ue(e){let n=0,t=e.deps;for(let r=0;r<t.length;r++){let o=Be.get(t[r]);if(o){let i=o._level;i>n&&(n=i)}}e._level=n+1}function $(e,n){let t=Oe(e);t._level=1;let r=T;T=t;try{let i=t.fn();typeof i=="function"&&(t._cleanup=i)}finally{T=r}ue(t),n?.stable&&(t._stable=!0);let o=()=>Re(t);return z&&z.disposals.push(o),o}function Oe(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 A&&x&&x.onEffectCreate(t),t}function je(e){if(e.disposed)return;if(e._stable){ne(e);return}pe(e),re(e,"effect cleanup");let n=T;T=e;try{let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){throw t===He||x?.onError&&x.onError(t,{type:"effect",effect:e}),t}finally{T=n}A&&x?.onEffectRun&&x.onEffectRun(e)}function Re(e){e.disposed=!0,A&&x&&x.onEffectDispose(e),pe(e),re(e,"effect cleanup on dispose")}function Ue(e,n,t){x?.onError&&x.onError(e,{type:"effect-cleanup",effect:n,phase:t}),A&&console.warn(`[what] Error in ${t}:`,e)}function re(e,n){if(!e._cleanup)return;let t=e._cleanup;e._cleanup=null;try{t()}catch(r){Ue(r,e,n)}}function ne(e){let n=T;T=null;try{re(e,"stable effect cleanup");let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){x?.onError&&x.onError(t,{type:"effect",effect:e}),A&&console.warn("[what] Error in stable effect:",t)}finally{T=n}A&&x?.onEffectRun&&x.onEffectRun(e)}function pe(e){let n=e.deps;for(let t=0;t<n.length;t++)n[t].delete(e);n.length=0}var F=0,U=null,W=0;function ae(e){if(F===0){F=1;try{for(let n of e)if(!n.disposed){if(n._onNotify)n._onNotify();else if(Y===0&&n._stable)ne(n);else if(!n._pending){n._pending=!0;let t=n._level,r=D.length;r>0&&D[r-1]._level>t&&(K=!0),D.push(n)}}if(W>0){let n=0;for(;n<W;){let t=U[n];U[n]=null,n++;for(let r of t)if(!r.disposed){if(r._onNotify)r._onNotify();else if(Y===0&&r._stable)ne(r);else if(!r._pending){r._pending=!0;let o=r._level,i=D.length;i>0&&D[i-1]._level>o&&(K=!0),D.push(r)}}}W=0}}finally{F=0}Y===0&&D.length>0&&Ve()}else U===null&&(U=[]),W>=U.length?U.push(e):U[W]=e,W++}var ee=!1;function Ve(){ee||(ee=!0,queueMicrotask(()=>{ee=!1,Ie()}))}var te=!1;function Ie(){if(!te){te=!0;try{let e=0;for(;D.length>0&&e<25;){let n=D;D=[],n.length>1&&K&&n.sort((t,r)=>t._level-r._level),K=!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;je(r),!r._computed&&r.deps.length!==o&&ue(r)}}e++}if(e>=25){for(let n=0;n<D.length;n++)D[n]._pending=!1;if(D.length=0,A){let t=D.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{te=!1}}}function J(e){let n=T;T=null;try{return e()}finally{T=n}}function V(e){let n=z,t=I,r={disposals:[],owner:I,children:[],_disposed:!1};I&&I.children.push(r),z=r,I=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let i=r.children.length-1;i>=0;i--)de(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{z=n,I=t}}function de(e){if(!e._disposed){e._disposed=!0;for(let n=e.children.length-1;n>=0;n--)de(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 he=null;function me(e){he=e}function ge(e,n){let t=n||he?.();for(;t;){if(t._errorBoundary)return t._errorBoundary(e),!0;t=t._parentCtx}return!1}var We=null;function ye(e){We=e}var qe=new Set(["href","src","action","formaction","poster","cite","background","xlink:href"]),ve=new Set(["srcset"]);function oe(e){return String(e).toLowerCase()}function Pe(e){return String(e).trim().replace(/[\s\x00-\x1f\x7f]/g,"").toLowerCase()}function _e(e){if(typeof e!="string")return!0;let n=Pe(e);return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}function ze(e){return typeof e!="string"?!0:e.split(",").every(n=>{let t=n.trim().split(/\s+/,1)[0]||"";return t===""||_e(t)})}function Ge(e){return qe.has(oe(e))}function Ke(e){return ve.has(oe(e))}function X(e,n){return Ke(e)?ze(n):Ge(e)?_e(n):!0}function Z(e){return e==="className"?"class":e==="htmlFor"?"for":oe(e)==="formaction"?"formaction":e}var Je=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"]),Xe="http://www.w3.org/2000/svg",we=new Set,Q=new WeakMap;function Ze(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ie(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function Ce(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)}A&&x?.onComponentUnmount&&x.onComponentUnmount(e),we.delete(e)}}function O(e){if(!e)return;e._componentCtx&&Ce(e._componentCtx);let n=Q.get(e);if(n&&Ce(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)O(t)}function H(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(Ze(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),i=[],a=document.createDocumentFragment();a.appendChild(r),a.appendChild(o);let s=$(()=>{let l=e(),c=l==null||l===!1||l===!0?[]:Array.isArray(l)?l:[l],d=o.parentNode;if(d){for(let u of i)O(u),u.parentNode===d&&d.removeChild(u);i=[];for(let u of c){let _=H(u,d,n?._isSvg);if(_)if(_.nodeType===11){let y=Array.from(_.childNodes);d.insertBefore(_,o);for(let g of y)i.push(g)}else d.insertBefore(_,o),i.push(_)}}});return r._dispose=s,o._dispose=s,a}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let i=H(o,n,t);i&&r.appendChild(i)}return r}return ie(e)&&typeof e.tag=="function"||ie(e)&&(e.tag==="__errorBoundary"||e.tag==="__suspense"||e.tag==="__portal")?be(e,n,t):ie(e)?et(e,n,t):document.createTextNode(String(e))}var M=[];function xe(){return M[M.length-1]}me(xe);ye(xe);function be(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(p){return new h(p).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Qe(e,n);if(r==="__suspense"||e.tag==="__suspense")return Ye(e,n);if(r==="__portal"||e.tag==="__portal")return Fe(e,n);let a={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"),l=document.createComment("c:end");Q.set(s,a),a._startComment=s,a._endComment=l;let c=document.createDocumentFragment();c._componentCtx=a,a._wrapper=s,we.add(a),A&&x?.onComponentMount&&x.onComponentMount(a);let d=i.length===0?void 0:i.length===1?i[0]:i,u=q({...o,children:d});a._propsSignal=u;let _=new Proxy({},{get(h,b){return u()[b]},has(h,b){let p=u();return b in p},ownKeys(){let h=u();return Reflect.ownKeys(h)},getOwnPropertyDescriptor(h,b){let p=u();if(b in p)return{value:p[b],writable:!1,enumerable:!0,configurable:!0}}});M.push(a);let y;try{y=r(_)}catch(h){if(M.pop(),!ge(h,a))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return c.appendChild(s),c.appendChild(l),c}M.pop(),a.mounted=!0,a._mountCallbacks&&queueMicrotask(()=>{if(!a.disposed)for(let h of a._mountCallbacks)try{h()}catch(b){console.error("[what] onMount error:",b)}}),c.appendChild(s);let g=Array.isArray(y)?y:[y];for(let h of g){let b=H(h,c,t);b&&c.appendChild(b)}return c.appendChild(l),c}function Qe(e,n){let{errorState:t,handleError:r,fallback:o,reset:i}=e.props,a=e.children,s=document.createComment("eb:start"),l=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:l};Q.set(s,c);let d=document.createDocumentFragment();d._componentCtx=c,d.appendChild(s),d.appendChild(l);let u=$(()=>{let _=t();if(M.push(c),s.parentNode)for(;s.nextSibling&&s.nextSibling!==l;){let g=s.nextSibling;O(g),g.parentNode.removeChild(g)}let y;_?y=typeof o=="function"?[o({error:_,reset:i})]:[o]:y=a,y=Array.isArray(y)?y:[y];for(let g of y){let h=H(g,n);h&&(l.parentNode?l.parentNode.insertBefore(h,l):d.insertBefore(h,l))}M.pop()});return c.effects.push(u),d}function Ye(e,n){let{boundary:t,fallback:r,loading:o}=e.props,i=e.children,a=document.createComment("sb:start"),s=document.createComment("sb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:M[M.length-1]||null,_startComment:a,_endComment:s};Q.set(a,l);let c=document.createDocumentFragment();c._componentCtx=l,c.appendChild(a),c.appendChild(s);let d=$(()=>{let _=o()?[r]:i,y=Array.isArray(_)?_:[_];if(M.push(l),a.parentNode)for(;a.nextSibling&&a.nextSibling!==s;){let g=a.nextSibling;O(g),g.parentNode.removeChild(g)}for(let g of y){let h=H(g,n);h&&(s.parentNode?s.parentNode.insertBefore(h,s):c.insertBefore(h,s))}M.pop()});return l.effects.push(d),c}function Fe(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 a=[];for(let s of r){let l=H(s,t);l&&(t.appendChild(l),a.push(l))}return o._cleanupCallbacks=[()=>{for(let s of a)O(s),s.parentNode&&s.parentNode.removeChild(s)}],i}function et(e,n,t){let{tag:r,props:o,children:i}=e,a=t||Je.has(r),s=a?document.createElementNS(Xe,r):document.createElement(r);o&&tt(s,o,{},a);for(let l of i){let c=H(l,s,a&&r!=="foreignObject");c&&s.appendChild(c)}return s._vnode=e,s}function tt(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}Se(e,o,n[o],r)}}function Se(e,n,t,r){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 a=o.toLowerCase(),s=i?a+"_capture":a,l=e._events?.[s];if(l&&l._original===t||(l&&e.removeEventListener(a,l,i),t==null))return;e._events||(e._events={});let c=u=>(u.nativeEvent||(u.nativeEvent=u),J(()=>t(u)));c._original=t,e._events[s]=c;let d=t._eventOpts;e.addEventListener(a,c,d||i||void 0);return}if(n==="ref"){typeof t=="function"?t(e):t&&(t.current=e);return}if(!X(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Z(n));return}if(typeof t=="function"){if(e._propEffects||(e._propEffects={}),e._propEffects[n])try{e._propEffects[n]()}catch{}e._propEffects[n]=$(()=>{let o=t();Se(e,n,o,r)});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{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(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)}function nt(e,n,t){if(t&&t.length>0){let r=t.length===1?t[0]:t;n=n?{...n,children:r}:{children:r}}return H({tag:e,props:n||{},children:t||[],key:null,_vnode:!0})}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 Ne(e){let n=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Te(e){let n=e.trim(),t=Ne(n);if(ot.has(t))return it(n);let r=rt[t];if(r){let i=document.createElement("template");return i.innerHTML=r.wrap+n+r.unwrap,()=>{let a=i.content.firstChild;for(let s=0;s<r.depth;s++)a=a.firstChild;return a.cloneNode(!0)}}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var Ee=!1;function ke(e){return A&&!Ee&&(Ee=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Te(e)}function it(e){let n=e.trim();if(Ne(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 st(e,n,t){if(typeof n=="function"){let r=null;return $(()=>{r=Ae(e,n(),r,t||null)}),r}return Ae(e,n,null,t||null)}function ct(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ft(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 Le(e){return e==null?[]:Array.isArray(e)?e:[e]}function De(e,n,t){if(e==null||typeof e=="boolean")return t;if(Array.isArray(e)){for(let r=0;r<e.length;r++)De(e[r],n,t);return t}return typeof e=="string"||typeof e=="number"?(t.push(document.createTextNode(String(e))),t):ct(e)?(t.push(e),t):ft(e)?(t.push(H(e,n,lt(n))),t):(t.push(document.createTextNode(String(e))),t)}function at(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 Ae(e,n,t,r){if(!e||typeof e.insertBefore!="function")return A&&console.warn("[what] reconcileInsert called with invalid parent:",e),t;let o=r||null;if(n==null||typeof n=="boolean"){let c=Le(t);for(let d=0;d<c.length;d++){let u=c[d];u.parentNode===e&&(O(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=De(n,e,[]),a=Le(t);if(at(a,i))return t;let s=new Set(i);for(let c=0;c<a.length;c++){let d=a[c];!s.has(d)&&d.parentNode===e&&(O(d),e.removeChild(d))}let l=o;for(let c=i.length-1;c>=0;c--){let d=i[c];(d.parentNode!==e||d.nextSibling!==l)&&(l&&l.parentNode!==e&&(l=null),l?e.insertBefore(d,l):e.appendChild(d)),l=d}return i.length===0?null:i.length===1?i[0]:i}function ut(e,n,t){let r=t?.key,o=t?.raw||!1;return(i,a)=>{let s=[],l=[],c=[],d=r&&!o?new Map:null,u=document.createComment("/list");return i.insertBefore(u,a||null),$(()=>{let _=e()||[];r?mt(i,u,s,_,l,c,n,r,d):pt(i,u,s,_,l,c,n),s=_.slice()}),u}}function pt(e,n,t,r,o,i,a){let s=r.length,l=t.length;if(s===0){if(l>0){for(let p=0;p<l;p++)i[p]?.(),o[p]?.parentNode===e&&(O(o[p]),e.removeChild(o[p]));o.length=0,i.length=0}return}if(l===0){let p=document.createDocumentFragment();for(let m=0;m<s;m++){let w=r[m],E=V(N=>(i[m]=N,a(w,m)));o[m]=E,p.appendChild(E)}e.insertBefore(p,n);return}let c=0,d=Math.min(l,s);for(;c<d&&t[c]===r[c];)c++;if(c===l&&c===s)return;let u=l-1,_=s-1;for(;u>=c&&_>=c&&t[u]===r[_];)u--,_--;let y=new Array(s),g=new Array(s);for(let p=0;p<c;p++)y[p]=o[p],g[p]=i[p];for(let p=_+1;p<s;p++){let m=u+1+(p-_-1);y[p]=o[m],g[p]=i[m]}let h=_-c+1,b=u-c+1;if(h===0)for(let p=c;p<=u;p++)i[p]?.(),o[p]?.parentNode&&o[p].parentNode.removeChild(o[p]);else if(b===0){let p=c<s&&y[_+1]?y[_+1]:n,m=document.createDocumentFragment();for(let w=c;w<=_;w++){let E=r[w],N=w;y[w]=V(k=>(g[N]=k,a(E,N))),m.appendChild(y[w])}e.insertBefore(m,p)}else dt(e,n,t,r,o,i,a,c,u,_,y,g);o.length=s,i.length=s;for(let p=0;p<s;p++)o[p]=y[p],i[p]=g[p]}function dt(e,n,t,r,o,i,a,s,l,c,d,u){let _=new Map;for(let m=s;m<=l;m++)_.set(t[m],m);let y=c-s+1,g=new Int32Array(y);g.fill(-1);for(let m=s;m<=c;m++){let w=_.get(r[m]);w!==void 0&&(_.delete(r[m]),d[m]=o[w],u[m]=i[w],g[m-s]=w)}for(let[,m]of _)i[m]?.(),o[m]?.parentNode&&o[m].parentNode.removeChild(o[m]);let h=y-ht(g,y),b=new Uint8Array(y);if(h>1){let m=new Int32Array(h),w=new Int32Array(h),E=0;for(let k=0;k<y;k++)g[k]!==-1&&(m[E]=g[k],w[E]=k,E++);let N=$e(m,h);for(let k=0;k<N.length;k++)b[w[N[k]]]=1}else if(h===1){for(let m=0;m<y;m++)if(g[m]!==-1){b[m]=1;break}}for(let m=s;m<=c;m++)if(!d[m]){let w=r[m],E=m;d[m]=V(N=>(u[E]=N,a(w,E)))}let p=c+1<d.length&&d[c+1]?d[c+1]:n;for(let m=c;m>=s;m--){let w=m-s;(g[w]===-1||!b[w])&&(p&&p.parentNode!==e&&(p=n),e.insertBefore(d[m],p)),p=d[m]}}function ht(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 l=0,c=o-1;for(;l<c;){let d=l+c>>1;e[t[d]]<e[s]?l=d+1:c=d}t[l]=s,r[s]=l>0?t[l-1]:-1}let i=new Array(o),a=t[o-1];for(let s=o-1;s>=0;s--)i[s]=a,a=r[a];return i}function mt(e,n,t,r,o,i,a,s,l){let c=r.length,d=t.length;if(c===0){if(d>0){for(let f=0;f<d;f++)i[f]?.(),o[f]?.parentNode===e&&(O(o[f]),e.removeChild(o[f]));o.length=0,i.length=0,l&&l.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<c;C++){let S=r[C],B=C,L;if(l){let R=s(S),P=q(S);L=P,l.set(R,{itemSig:P})}else L=S;let j=V(R=>(i[B]=R,a(L,B)));o[C]=j,f.appendChild(j)}e.insertBefore(f,n);return}let u=0,_=Math.min(d,c);for(;u<_;){if(t[u]===r[u]){u++;continue}let f=s(t[u]),C=s(r[u]);if(f!==C)break;l&&l.get(f).itemSig.set(r[u]),u++}let y=d-1,g=c-1;for(;y>=u&&g>=u;){if(t[y]===r[g]){y--,g--;continue}let f=s(t[y]),C=s(r[g]);if(f!==C)break;l&&l.get(f).itemSig.set(r[g]),y--,g--}if(u>y&&u>g)return;let h=new Array(c),b=new Array(c);for(let f=0;f<u;f++)h[f]=o[f],b[f]=i[f];for(let f=g+1;f<c;f++){let C=y+1+(f-g-1);h[f]=o[C],b[f]=i[C]}let p=g-u+1;if(y-u+1===0){let f=g+1<c&&h[g+1]?h[g+1]:n,C=document.createDocumentFragment();for(let S=u;S<=g;S++){let B=r[S],L=S,j;if(l){let R=s(B),P=q(B);j=P,l.set(R,{itemSig:P})}else j=B;h[S]=V(R=>(b[L]=R,a(j,L))),C.appendChild(h[S])}e.insertBefore(C,f),se(o,i,h,b,c);return}if(p===0){for(let f=u;f<=y;f++)i[f]?.(),o[f]?.parentNode&&e.removeChild(o[f]),l&&l.delete(s(t[f]));se(o,i,h,b,c);return}let w=new Map;for(let f=u;f<=y;f++)w.set(s(t[f]),f);let E=new Int32Array(p);E.fill(-1);for(let f=u;f<=g;f++){let C=s(r[f]),S=w.get(C);S!==void 0&&(w.delete(C),h[f]=o[S],b[f]=i[S],E[f-u]=S,l&&r[f]!==t[S]&&l.get(C).itemSig.set(r[f]))}for(let[f,C]of w)i[C]?.(),o[C]?.parentNode&&e.removeChild(o[C]),l&&l.delete(f);for(let f=u;f<=g;f++)if(!h[f]){let C=r[f],S=f,B;if(l){let L=s(C),j=q(C);B=j,l.set(L,{itemSig:j})}else B=C;h[f]=V(L=>(b[S]=L,a(B,S)))}let N=0,k=!0,fe=-1;for(let f=0;f<p;f++)E[f]!==-1&&(N++,E[f]<=fe&&(k=!1),fe=E[f]);let G=new Uint8Array(p);if(k)for(let f=0;f<p;f++)E[f]!==-1&&(G[f]=1);else if(N>1){let f=new Int32Array(N),C=new Int32Array(N),S=0;for(let L=0;L<p;L++)E[L]!==-1&&(f[S]=E[L],C[S]=L,S++);let B=$e(f,N);for(let L=0;L<B.length;L++)G[C[B[L]]]=1}else if(N===1){for(let f=0;f<p;f++)if(E[f]!==-1){G[f]=1;break}}let v=g+1<h.length&&h[g+1]?h[g+1]:n;for(let f=g;f>=u;f--){let C=f-u;(E[C]===-1||!G[C])&&(v&&v.parentNode!==e&&(v=n),e.insertBefore(h[f],v)),v=h[f]}se(o,i,h,b,c)}function se(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 gt(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"?$(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?$(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):$(()=>{ce(e,t,r())}):ce(e,t,r)}}function ce(e,n,t){if(n==="ref"){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e);return}if(n!=="key"){if(!X(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Z(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 Me=new Set;function yt(e){for(let n of e)Me.has(n)||(Me.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 _t(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function Ct(e,n){$(()=>{for(let t in n){let r=typeof n[t]=="function"?n[t]():n[t];e.classList.toggle(t,!!r)}})}export{nt as _$createComponent,Te as _$template,ke as _template,Ct as classList,yt as delegateEvents,$ as effect,st as insert,ut as mapArray,_t as on,ce as setProp,gt as spread,ke as template,J as untrack};
2
2
  //# sourceMappingURL=compiler.min.js.map