@stacksjs/stx 0.2.267 → 0.2.268

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.
Files changed (50) hide show
  1. package/dist/{chunk-scdxk8nn.js → chunk-0a2dq7g9.js} +1 -1
  2. package/dist/{chunk-jq4104he.js → chunk-15x3b9tp.js} +1 -1
  3. package/dist/{chunk-dpgp6rzq.js → chunk-1c0yy9rs.js} +1 -1
  4. package/dist/{chunk-7cts329z.js → chunk-2b4g32yv.js} +1 -1
  5. package/dist/{chunk-8vewrjzp.js → chunk-477zvh3f.js} +1 -1
  6. package/dist/{chunk-z86pq9pd.js → chunk-50gk2vsn.js} +1 -1
  7. package/dist/{chunk-18nxwzv3.js → chunk-5k1bec90.js} +8 -8
  8. package/dist/{chunk-9rkcrzj4.js → chunk-7jpq01y1.js} +1 -1
  9. package/dist/{chunk-y9tv04zh.js → chunk-868ep3pm.js} +1 -1
  10. package/dist/{chunk-cksz4k5v.js → chunk-8n89zhmq.js} +1 -1
  11. package/dist/{chunk-2ed60g20.js → chunk-95bfzrx2.js} +2 -2
  12. package/dist/{chunk-xkb16kmv.js → chunk-9asehtpb.js} +1 -1
  13. package/dist/{chunk-q5et8k2d.js → chunk-9th0hyk5.js} +1 -1
  14. package/dist/{chunk-m0aetx9j.js → chunk-a3drgebc.js} +1 -1
  15. package/dist/{chunk-b41qf397.js → chunk-bn1e010c.js} +1 -1
  16. package/dist/{chunk-d3v3p15c.js → chunk-bwf0xaqc.js} +1 -1
  17. package/dist/{chunk-mzpb11dp.js → chunk-c17r76es.js} +1 -1
  18. package/dist/{chunk-k5c19t7e.js → chunk-cg8dd896.js} +1 -1
  19. package/dist/{chunk-78bm61kd.js → chunk-chte720d.js} +1 -1
  20. package/dist/{chunk-13ftt3qc.js → chunk-d867gwtk.js} +1 -1
  21. package/dist/{chunk-xv2mr8vq.js → chunk-e1a1c5b9.js} +1 -1
  22. package/dist/{chunk-e6vdk4v0.js → chunk-ea5ab7zt.js} +1 -1
  23. package/dist/{chunk-mcn9mwzv.js → chunk-erjf0z2d.js} +1 -1
  24. package/dist/{chunk-mb0kqnwf.js → chunk-eszybcp6.js} +1 -1
  25. package/dist/{chunk-mbvkvac6.js → chunk-fpkgcpey.js} +18 -18
  26. package/dist/{chunk-xpsxwbw0.js → chunk-fwgqz5vv.js} +1 -1
  27. package/dist/{chunk-8evws5cc.js → chunk-gaqvk74x.js} +1 -1
  28. package/dist/{chunk-4wnnet1k.js → chunk-h6xxqg0h.js} +1 -1
  29. package/dist/{chunk-r9z71gj0.js → chunk-hzwvszyg.js} +1 -1
  30. package/dist/{chunk-sz51py35.js → chunk-jhfmkke9.js} +1 -1
  31. package/dist/{chunk-fcv00xs9.js → chunk-kcwa9cxw.js} +1 -1
  32. package/dist/{chunk-2qsa4h1t.js → chunk-m87wfz2b.js} +2 -2
  33. package/dist/{chunk-fn9yw31x.js → chunk-mync09v4.js} +1 -1
  34. package/dist/{chunk-c1r9q5pk.js → chunk-p557qcrk.js} +1 -1
  35. package/dist/{chunk-qf5grrg1.js → chunk-qmpsyysd.js} +1 -1
  36. package/dist/{chunk-g4z7gah7.js → chunk-ref9c9hn.js} +1 -1
  37. package/dist/{chunk-jb7h4qgh.js → chunk-rzdar1x9.js} +1 -1
  38. package/dist/{chunk-cd4v7xyr.js → chunk-sfha6xsd.js} +1 -1
  39. package/dist/{chunk-r8qvm7a3.js → chunk-t35x61f5.js} +1 -1
  40. package/dist/{chunk-ykxs16y7.js → chunk-v5qv7q0y.js} +1 -1
  41. package/dist/{chunk-6g7m08rv.js → chunk-wnt3yvxv.js} +1 -1
  42. package/dist/{chunk-4mw2kfqd.js → chunk-yax48zgv.js} +1 -1
  43. package/dist/{chunk-yxp7wv61.js → chunk-z8btarwy.js} +1 -1
  44. package/dist/cli.js +7 -7
  45. package/dist/component-renderer.js +4 -4
  46. package/dist/craft-entry.js +1 -1
  47. package/dist/craft.js +1 -1
  48. package/dist/pwa.js +1 -1
  49. package/dist/ssg.js +2 -2
  50. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ls as G2,vs as I6,ws as k6}from"./chunk-0athjw48.js";import{Cs as o5}from"./chunk-135mme4g.js";import{Ks as c0}from"./chunk-f1jd5qjb.js";import{Ls as c1,Ms as d1,Ns as U2,Os as J5,Qs as E1,Rs as T2,Ss as E2,gt as W2}from"./chunk-jb7h4qgh.js";import{ht as T8}from"./chunk-jnbhyzkv.js";import{ot as T6,qt as E6,rt as b6,tt as V5}from"./chunk-bby4emay.js";import{At as L2,ut as z2,yt as J$}from"./chunk-52wr95ps.js";import{Lt as K2}from"./chunk-j24k071e.js";import{Mt as j7,Nt as P2,Ot as k2,Pt as l1,Tt as v2,Ut as i4,Vt as V8,Xt as T9,_t as n8}from"./chunk-sde45gh3.js";import{Ju as q2,Lu as TG,Mu as t$,Ou as z5,iu as Y4,lu as J8,su as r3}from"./chunk-5wkwhjjn.js";import{Tu as y6}from"./chunk-krgth3gf.js";import{Yu as v}from"./chunk-f8wjdg40.js";import y1 from"path";import E5 from"fs";var l4=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),c4={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},d2=new Set(["ctrl","alt","shift","meta"]),n4={left:0,middle:1,right:2};function p4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(d2.has(J))Z.systemKeys.push(J);else if(J in n4)Z.mouse=J;else if(J in c4||/^[a-z]$/.test(J))Z.keys.push(c4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function s4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,z=`__stx_evt_${X++}`,K=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,L]=B,V=_.split("."),O=V[0];if(!l4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:L,modifiers:p4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,L]=B,V=_.split("."),O=V[0];if(!l4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:L,modifiers:p4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function m2($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=n4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function l2($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function g$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function c2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=m2($),Y=l2(g$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{ls as G2,vs as I6,ws as k6}from"./chunk-0athjw48.js";import{Cs as o5}from"./chunk-135mme4g.js";import{Ks as c0}from"./chunk-f1jd5qjb.js";import{Ls as c1,Ms as d1,Ns as U2,Os as J5,Qs as E1,Rs as T2,Ss as E2,gt as W2}from"./chunk-rzdar1x9.js";import{ht as T8}from"./chunk-jnbhyzkv.js";import{ot as T6,qt as E6,rt as b6,tt as V5}from"./chunk-bby4emay.js";import{At as L2,ut as z2,yt as J$}from"./chunk-52wr95ps.js";import{Lt as K2}from"./chunk-j24k071e.js";import{Mt as j7,Nt as P2,Ot as k2,Pt as l1,Tt as v2,Ut as i4,Vt as V8,Xt as T9,_t as n8}from"./chunk-sde45gh3.js";import{Ju as q2,Lu as TG,Mu as t$,Ou as z5,iu as Y4,lu as J8,su as r3}from"./chunk-5wkwhjjn.js";import{Tu as y6}from"./chunk-krgth3gf.js";import{Yu as v}from"./chunk-f8wjdg40.js";import y1 from"path";import E5 from"fs";var l4=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),c4={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},d2=new Set(["ctrl","alt","shift","meta"]),n4={left:0,middle:1,right:2};function p4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(d2.has(J))Z.systemKeys.push(J);else if(J in n4)Z.mouse=J;else if(J in c4||/^[a-z]$/.test(J))Z.keys.push(c4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function s4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,z=`__stx_evt_${X++}`,K=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,L]=B,V=_.split("."),O=V[0];if(!l4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:L,modifiers:p4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,L]=B,V=_.split("."),O=V[0];if(!l4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:L,modifiers:p4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function m2($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=n4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function l2($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function g$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function c2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=m2($),Y=l2(g$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${X}');
5
5
  if (!$el) return;
@@ -3352,9 +3352,9 @@ ${q9($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3352
3352
  } finally {
3353
3353
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3354
3354
  }
3355
- })();`}function kY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:P1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var G9=0,QH=new c1(500),z9=new Set;function GH(){z9.clear()}function TY($){if($.__onceStore instanceof Set)return $.__onceStore;return z9}async function i3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=AY($,"@partial","@include"),U=TY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(U.has(F))return"";return U.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],I=W(N,G,X),A="";if(I&&await Bun.file(I).exists())Y.add(I),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),I=p3(N,0);if(I===-1){V.lastIndex=D;continue}let A=N.substring(0,I).trim(),M=N.substring(I+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let k=T[1],y=M.substring(T[0].length),E,b=p3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let S=`Boolean(${A})`,f;if(G0(S)){let u=q0(S,Object.keys(Z));f=Boolean(u(...Object.values(Z)))}else f=Boolean(e(S,Z));let g=L?!f:f,o="";if(g){let u=W(k,G,X);if(u&&await Bun.file(u).exists())Y.add(u);o=`@include('${k}'${E?`, ${E}`:""})`}q=q.substring(0,F)+o+q.substring(D),V.lastIndex=0}catch(S){let f=S instanceof Error?S.message:String(S),g=B0("Include",`Error evaluating ${_} condition: ${f}`,X,$,F);q=q.substring(0,F)+g+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,I,A,M,T]=N;try{let k,y=A.trim();if(G0(y))k=q0(y,Object.keys(Z))(...Object.values(Z));else k=e(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let S={...Z,[M]:b},f=await H(I,S,$,V);E+=f}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);q=q.substring(0,V)+B0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let I=N[1],A=R.slice(N[0].length),M,T=A.match(/^\s*,\s*\{/);if(T){A=A.slice(T[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let k,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(M)try{b=w0(M,Z)}catch(f){let g=f instanceof Error?f.message:String(f);if(J.debug){let o=B0("Include",`Error parsing includeFirst variables: ${g}`,X,$,V,D);q=q.replace(D,()=>o)}else q=q.replace(D,()=>k||"");continue}let S=!1;for(let f of E){let g=W(f,G,X);if(!g)continue;if(await t(g)){let o=await H(f,b,$,V);q=q.replace(D,()=>o),S=!0;break}}if(!S)if(k!==void 0)q=q.replace(D,()=>k);else if(J.debug){let f=B0("Include",`None of the includeFirst paths exist: ${I}`,X,$,V,D);q=q.replace(D,()=>f)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),S=B0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>S)}_.lastIndex=0}}function W(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),N=D.startsWith(F+z0.sep)||D===F,I=D.startsWith(w+z0.sep)||D===w,A=!1,M=z0.dirname(w);if(D.startsWith(M+z0.sep)){if(!z0.relative(M,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!I&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=z0.resolve(X);Q.add(z);function K(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),B0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=W(_,G,X);if(!F)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(g){let o=g instanceof Error?g.message:String(g);return K(_,`Error loading include file ${_}: ${o}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:g}=await import("./chunk-78bm61kd.js");R=g(R,Z)}if(R&&(J.debug||!j5()&&!t5()))try{let{warnUnbalancedTags:g}=await import("./chunk-tc01rmwh.js");g(R,F)}catch{}let D=R;try{let{processESImports:g}=await import("./chunk-mb0kqnwf.js");await g(R,Z,F,J,Y)}catch(g){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,g instanceof Error?g.message:g)}let N=B$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=G1(R,F);for(let[g,o]of Object.entries(L))T[g]=o;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(k)],E="",b=null;for(let g of y){let o=g[1]||"",u=g[2]||"",K0=o.includes("server"),e0=N1(o);if(!K0&&u.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-cd4v7xyr.js");u=X0(u,T)}let M0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:H0}=await import("./chunk-qf5grrg1.js"),I0=X0(u,{filePath:F,projectRoot:process.cwd()});u=I0.code,M0=H0(I0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,X0 instanceof Error?X0.message:X0)}if(e0&&u.trim())u=A1(u);if(!K0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-qf5grrg1.js");u=H0(u).code;let{hasUserImports:I0,bundleClientScript:E0}=await import("./chunk-9rkcrzj4.js");if(I0(u))u=await E0(u,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:X0}=await import("./chunk-q5et8k2d.js");u=X0(u)}let C0=MY(u);if(C0&&!K0){b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++G9}`;let X0=$1(u),H0=IY(X0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always">${H0}</script>
3356
- `;continue}if(K0)try{let{extractVariables:X0}=await import("./chunk-7cts329z.js");await X0(u,T,F)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,X0)}if(!K0&&!C0){let X0=o.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++G9}`;let H0=$1(u),I0=W9(H0,b),E0=U9(H0,I0);E+=`${M0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${E0}</script>
3357
- `}}if(b){let g=kY(D,b);if(D=g.html,g.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),b=g.mergedIntoExisting;else if(!g.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await i3(D,T,F,J,Y,Q);let{processLoops:S}=await import("./chunk-xpsxwbw0.js"),f=S(D,T,F);if(f=X1(f,T,F),f=V1(f,T,F),M)f+=`
3355
+ })();`}function kY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:P1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var G9=0,QH=new c1(500),z9=new Set;function GH(){z9.clear()}function TY($){if($.__onceStore instanceof Set)return $.__onceStore;return z9}async function i3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=AY($,"@partial","@include"),U=TY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(U.has(F))return"";return U.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],I=W(N,G,X),A="";if(I&&await Bun.file(I).exists())Y.add(I),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),I=p3(N,0);if(I===-1){V.lastIndex=D;continue}let A=N.substring(0,I).trim(),M=N.substring(I+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let k=T[1],y=M.substring(T[0].length),E,b=p3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let S=`Boolean(${A})`,f;if(G0(S)){let u=q0(S,Object.keys(Z));f=Boolean(u(...Object.values(Z)))}else f=Boolean(e(S,Z));let g=L?!f:f,o="";if(g){let u=W(k,G,X);if(u&&await Bun.file(u).exists())Y.add(u);o=`@include('${k}'${E?`, ${E}`:""})`}q=q.substring(0,F)+o+q.substring(D),V.lastIndex=0}catch(S){let f=S instanceof Error?S.message:String(S),g=B0("Include",`Error evaluating ${_} condition: ${f}`,X,$,F);q=q.substring(0,F)+g+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,I,A,M,T]=N;try{let k,y=A.trim();if(G0(y))k=q0(y,Object.keys(Z))(...Object.values(Z));else k=e(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let S={...Z,[M]:b},f=await H(I,S,$,V);E+=f}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);q=q.substring(0,V)+B0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let I=N[1],A=R.slice(N[0].length),M,T=A.match(/^\s*,\s*\{/);if(T){A=A.slice(T[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let k,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(M)try{b=w0(M,Z)}catch(f){let g=f instanceof Error?f.message:String(f);if(J.debug){let o=B0("Include",`Error parsing includeFirst variables: ${g}`,X,$,V,D);q=q.replace(D,()=>o)}else q=q.replace(D,()=>k||"");continue}let S=!1;for(let f of E){let g=W(f,G,X);if(!g)continue;if(await t(g)){let o=await H(f,b,$,V);q=q.replace(D,()=>o),S=!0;break}}if(!S)if(k!==void 0)q=q.replace(D,()=>k);else if(J.debug){let f=B0("Include",`None of the includeFirst paths exist: ${I}`,X,$,V,D);q=q.replace(D,()=>f)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),S=B0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>S)}_.lastIndex=0}}function W(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),N=D.startsWith(F+z0.sep)||D===F,I=D.startsWith(w+z0.sep)||D===w,A=!1,M=z0.dirname(w);if(D.startsWith(M+z0.sep)){if(!z0.relative(M,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!I&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=z0.resolve(X);Q.add(z);function K(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),B0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=W(_,G,X);if(!F)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(g){let o=g instanceof Error?g.message:String(g);return K(_,`Error loading include file ${_}: ${o}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:g}=await import("./chunk-chte720d.js");R=g(R,Z)}if(R&&(J.debug||!j5()&&!t5()))try{let{warnUnbalancedTags:g}=await import("./chunk-tc01rmwh.js");g(R,F)}catch{}let D=R;try{let{processESImports:g}=await import("./chunk-eszybcp6.js");await g(R,Z,F,J,Y)}catch(g){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,g instanceof Error?g.message:g)}let N=B$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=G1(R,F);for(let[g,o]of Object.entries(L))T[g]=o;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(k)],E="",b=null;for(let g of y){let o=g[1]||"",u=g[2]||"",K0=o.includes("server"),e0=N1(o);if(!K0&&u.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-sfha6xsd.js");u=X0(u,T)}let M0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:H0}=await import("./chunk-qmpsyysd.js"),I0=X0(u,{filePath:F,projectRoot:process.cwd()});u=I0.code,M0=H0(I0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,X0 instanceof Error?X0.message:X0)}if(e0&&u.trim())u=A1(u);if(!K0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-qmpsyysd.js");u=H0(u).code;let{hasUserImports:I0,bundleClientScript:E0}=await import("./chunk-7jpq01y1.js");if(I0(u))u=await E0(u,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:X0}=await import("./chunk-9th0hyk5.js");u=X0(u)}let C0=MY(u);if(C0&&!K0){b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++G9}`;let X0=$1(u),H0=IY(X0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always">${H0}</script>
3356
+ `;continue}if(K0)try{let{extractVariables:X0}=await import("./chunk-2b4g32yv.js");await X0(u,T,F)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,X0)}if(!K0&&!C0){let X0=o.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++G9}`;let H0=$1(u),I0=W9(H0,b),E0=U9(H0,I0);E+=`${M0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${E0}</script>
3357
+ `}}if(b){let g=kY(D,b);if(D=g.html,g.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),b=g.mergedIntoExisting;else if(!g.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await i3(D,T,F,J,Y,Q);let{processLoops:S}=await import("./chunk-fwgqz5vv.js"),f=S(D,T,F);if(f=X1(f,T,F),f=V1(f,T,F),M)f+=`
3358
3358
  `+M;if(E)f+=`
3359
3359
  `+E;return f}catch(R){let D=R instanceof Error?R.message:String(R);return K(_,`Error processing include ${_}: ${D}`,V,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,L=_+j[0].length-1,V=1,O=L+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let F=q.substring(_,O),w=q.substring(L+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=O;continue}let D=R[1],N,I=w.substring(R[0].length),A=p3(I,0);if(A!==-1)N=I.substring(A+1).trim();let M={};if(N)try{M=w0(N,Z)}catch(k){let y=k instanceof Error?k.message:String(k);q=q.replace(F,B0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let T=await H(D,M,$,_);q=q.substring(0,_)+T+q.substring(O),B.lastIndex=0}return q}function n3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),K=U.match(z);if(!K||K.index===void 0)break;let H=K.index,B=K[1],j=H+K[0].length,_=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=j,F=-1;while(V>0&&O<U.length){let R=U.slice(O),D=R.match(_),N=R.match(L),I=D?O+D.index:1/0,A=N?O+N.index:1/0;if(I<A)V++,O=I+(D[0].length||1);else if(A<1/0){if(V--,V===0){F=A;break}O=A+G.length+1}else break}if(F===-1)break;let w=U.slice(j,F);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(F+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function s3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3360
3360
  `)})}import*as o3 from"path";async function K9($,Z,X=""){if(o3.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return B9($,Z,X,"@js","@endjs")}async function H9($,Z,X=""){if(o3.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return B9($,Z,X,"@ts","@endts")}async function B9($,Z,X,J,Y){let Q=$,G=d1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:z,index:K}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=z.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
@@ -3526,14 +3526,14 @@ document.addEventListener("focusout",function(e){
3526
3526
  ${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3527
3527
  `+$.slice(G)}if(q1($))return P1($,(G)=>`${G}
3528
3528
  ${Z}`);return`${Z}
3529
- ${$}`}async function D$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return G4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return G4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-scdxk8nn.js"),J=await X(Z.debug);return G4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function CQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function z8($){if($.includes("data-stx-tooltip-runtime")||!CQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${Q4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3529
+ ${$}`}async function D$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return G4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return G4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-0a2dq7g9.js"),J=await X(Z.debug);return G4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function CQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function z8($){if($.includes("data-stx-tooltip-runtime")||!CQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${Q4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3530
3530
  ${Z}`;return`${$.slice(0,X)}${Z}
3531
3531
  ${$.slice(X)}`}var PQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function vQ($){return PQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function fQ($,Z){if(!$.includes("</body>"))return $;if(vQ($))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let U=await G8(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${q8(q)};</script>
3532
- `}let{getCachedRouterScript:Y}=await import("./chunk-scdxk8nn.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
3532
+ `}let{getCachedRouterScript:Y}=await import("./chunk-0a2dq7g9.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
3533
3533
  </body>`+$.slice(G+7)}var K8=Symbol.for("stx.lazy-module-promises");function xQ(){let $=globalThis;return $[K8]??=new Map,$[K8]}function s($,Z){let X=xQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var U4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,O8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function gQ($,Z={}){let X=[];for(let J of c5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function F8($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=H8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=H8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function H8($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function z4($,Z){return V8($,Z)}function hQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function uQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function dQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${U4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=c5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=F8(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let z=G[1],H=/\/\s*>$/.test(Q.token)||A$.has(z.toLowerCase())?Q.end:w8($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var B8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function mQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function j8($,Z,X,J){if(!$)return!1;let Y=mQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(B8.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=z.exec(Y))!==null){let B=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(B8.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function N$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(O8);if(Q&&lQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function lQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function L8($,Z){let X=uQ($);function J(Y){let Q=Y,G=dQ(Y),q=(K)=>{let H=new Set;for(let B of G)if(K>B.start&&K<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,z=[];while((W=U.exec(Q))!==null){let K=W.index,H=K+W[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),L=j,V=1,O=L,F=/@(if\s*\(|endif)/g;F.lastIndex=L;let w;while((w=F.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){O=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(L,O-6).trim(),D;if(hQ(R)){let N=O5(Q.substring(K,O));if(N.length===0)continue;let I=N[0].branches.filter((k)=>k.type!=="else"),A=q(K);if(!(I.length>0&&I.every((k)=>j8(k.condition,X,Z,A))))continue;D=N[0].branches.map((k)=>{let y=J(k.content);if(k.type==="elseif")return N$(y,"@else-if",k.condition??"");if(k.type==="else")return N$(y,"@else");return N$(y,"@if",k.condition??"")}).join(`
3534
3534
  `)}else{if(!j8(_,X,Z,q(K)))continue;D=N$(J(R),"@if",_)}z.push({start:K,end:O,replacement:D}),U.lastIndex=O}for(let K=z.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=z[K];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function cQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var A$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function w8($,Z,X,J){if(A$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(U,U+8));if(z){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!K){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(K[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||A$.has(Y)))q++}U=H+1}return-1}var pQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function iQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return pQ.test(Q)}function R8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(K)=>Z.some(([H,B])=>K>=H&&K<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[K,H,B,j,_,L,V]=q,O=cQ(_);if(O===void 0)continue;let F=q.index,w=F+K.length,N=!!V||/\/\s*>$/.test(K)||A$.has(H.toLowerCase())?w:w8($,F,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&iQ($,N)){Q.lastIndex=w;continue}if(O===!0){let A=`<${H}${B}${L}${V}>`;G.push({start:F,end:w,replacement:A});continue}G.push({start:F,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((K,H)=>K.start-H.start);let U=[],W=-1;for(let K of G){if(K.start<W)continue;U.push(K),W=K.end}let z=$;for(let K=U.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=U[K];z=z.substring(0,H)+j+z.substring(B)}return z}function D8($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,z=1,K=W;while(K<X.length&&z>0){if(X[K]==="(")z++;else if(X[K]===")")z--;K++}if(z!==0)continue;let H=X.substring(W,K-1).trim(),B=K,j=F8(H),_=q==="for"?"@endfor":"@endforeach",L=1,V=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let F;while((F=O.exec(X))!==null)if(F[1].startsWith(q))L++;else if(L--,L===0){V=F.index+F[0].length;break}if(L!==0)continue;let w=()=>{let I=[j.itemVar,j.indexVar].filter(Boolean);if(I.length)G.push({start:U,end:V,vars:I})};if(j.iterable){let I=j.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let A=I.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,T=G.some((k)=>U>k.start&&U<k.end&&k.vars.includes(A));if(A&&(M||T)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,V-_.length).trim(),D=R.match(O8),N;if(D){let[,I,A,M]=D;N=`<${I}${A} @for="${H}">${M}</${I}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:V,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:z}=Q[q];X=X.substring(0,U)+z+X.substring(W)}return X}function nQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(z)=>{let K=J+1;while(K<Q){let H=$[K];if(H==="\\"){K+=2;continue}if(H===z)return K+1;K++}return Q},q=()=>{let z=J+2;while(z<Q&&$[z]!==`
3535
3535
  `)z++;return z},U=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let K=z,H=0;while(K<Q){let B=$[K];if(B==="/"&&$[K+1]==="/"){let j=K+2;while(j<Q&&$[j]!==`
3536
- `)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function sQ($,Z,X){let J=gQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-9rkcrzj4.js"));for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let F=await q(o1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let U=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,W=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,z=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??o1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=tQ(O);let F=$1(O);z.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3536
+ `)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function sQ($,Z,X){let J=gQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-7jpq01y1.js"));for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let F=await q(o1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let U=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,W=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,z=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??o1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=tQ(O);let F=$1(O);z.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3537
3537
  ${F}`)}let K=z.join(`
3538
3538
 
3539
3539
  `);K=nQ(K);let H=oQ(K),B=H.split(",").map((V)=>V.trim()).filter(Boolean),j=W4(K,X),_=`
@@ -3589,7 +3589,7 @@ ${k}
3589
3589
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3590
3590
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3591
3591
  </style>`}};import{existsSync as QG,readFileSync as GG}from"fs";var T1=new Map,P8=new Set;function v8($){if(P8.has($))return;P8.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function f8($){let Z=process.cwd();for(let X of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(QG(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return v.resolve(X)}catch{}return null}function qG($){if(T1.has($))return T1.get($);let Z=f8($);if(!Z)return v8($),null;try{let X=JSON.parse(GG(Z,"utf8"));return T1.set($,X.icons),X.icons}catch{return null}}async function UG($,Z=!1){if(T1.has($))return T1.get($);let X=f8($);if(!X){if(!Z)v8($);return null}try{let J=await Bun.file(X).json();return T1.set($,J.icons),J.icons}catch{return null}}function $5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var A4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=$5($,"name")??$5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let O=J.split(":");Y=O[0],Q=O[1]}let G=L0($5($,"size")||"24"),q=L0($5($,"color")||"currentColor"),U=L0($5($,"class")||""),W=L0($5($,"style")||""),z=T1.get(Y)??qG(Y);if(!z)return`<!-- Icon: collection "${Y}" not loaded -->`;let K=z[Q];if(!K)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=K.width||24,B=K.height||24,j=`0 0 ${H} ${B}`,_=K.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let L=U?` class="${U}"`:"",V=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${V}>${_}</svg>`}};async function WG($="lucide",Z={}){await UG($,Z.speculative??!0)}function x8($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}function g8($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(X);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var M4={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=g8(Z,"fallback"),Y=J.rest,Q=g8(Y,"error"),G=Q.rest,q=J.region??x8($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',U=Q.region??x8($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${U}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function k$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}var I4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(k$($,"name")||"v").replace(/["'<>]/g,""),Y=(k$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=k$($,"class"),G=k$($,"id"),q=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${q}>${Z}</${Y}>`}};function h8(){S0.registerBuiltin(B4),S0.registerBuiltin(O4),S0.registerBuiltin(F4),S0.registerBuiltin(w4),S0.registerBuiltin(R4),S0.registerBuiltin(D4),S0.registerBuiltin(N4),S0.registerBuiltin(A4),S0.registerBuiltin(M4),S0.registerBuiltin(I4)}function T$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function u8($,Z,X){let J=[],Y=0;while(Y<$.length){let Q=$.indexOf("<",Y);if(Q===-1)break;let q=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!q){Y=Q+1;continue}let U=q[1];if(X&&X.has(U.toLowerCase())){let _=Q+1+U.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=Q+1+U.length,z=null,K=W,H=-1,B=!1;while(W<$.length){let _=$[W];if(z){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===z)z=null;W++;continue}if(_==='"'||_==="'"){z=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){H=W+2,B=!0;break}if(_===">"){H=W+1;break}W++}if(H===-1){Y=Q+1;continue}let j=$.slice(K,B?H-2:H-1).trim();if(B)J.push({fullMatch:$.slice(Q,H),tagName:U,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),Y=H;else{let _=`<${U}`,L=`</${U}>`,V=1,O=H,F=-1;while(V>0&&O<$.length){let D=$.indexOf(_,O),N=$.indexOf(L,O);if(N===-1)break;if(D!==-1&&D<N){let I=$[D+_.length];if(I===" "||I===">"||I==="/"||I===`
3592
- `||I==="\t")V++;O=D+_.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){Y=H;continue}let w=$.slice(H,F),R=F+L.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function d8($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function m8($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import b$ from"fs";import g0 from"path";var l8=!1,zG=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function KG($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let z=c0(W),K=z.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&Y.has(K))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(z))return!0}return!1},G=new Set(n8),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(z,K)=>K.toUpperCase())},U=(W,z)=>{let K=q(W);if(J.static[K]=z,K!==W)J.staticNames[K]=W};for(let[W,z]of Object.entries($)){let K=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(K.startsWith("@")){J.events[K]=z;continue}if(K.startsWith("__stx_")){let H=q(K.slice(6));J.serverDynamic[H]=m8(z,X);continue}if(K.startsWith(":")){let H=q(K.slice(1)),B=z===k1?H:z;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!G0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),L=q0(B,j)(...Object.values(Z));if(L===void 0){let V=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(u5(B).some((F)=>!V.has(F)&&!j.includes(F))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=L,H!==K.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=K.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof z==="string"&&z.includes("{{")&&z.includes("}}")){let H=z.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(G0(B)){let _=q0(B,Object.keys(Z))(...Object.values(Z));U(K,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${K}: ${B}`);U(K,z)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${K}:`,B);U(K,z)}else{let B=z,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(z))!==null)try{let L=_[1];if(!G0(L)){if(X.debug)console.error(`Unsafe expression in ${K}: ${L}`);continue}let O=q0(L,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(O??""))}catch(L){if(X.debug)console.error(`Error evaluating expression in ${K}:`,L)}U(K,B)}continue}U(K,z===k1?"true":d8(z))}return J}var HG=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function BG($,Z,X){if(!$.includes("@"))return $;if(!HG.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return X1($,Z,X)}catch{return $}}function jG($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=k1}return Z}function c8($){return Object.entries($).map(([Z,X])=>X===k1?Z:`${Z}="${_G(X)}"`).join(" ")}function _G($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VG($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(S0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var p8=new Map;function OG($){let Z=p8.get($);if(Z)return Z;let X=new Map,J=[g0.join($,"src"),g0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=b$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=g0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let z=U.name.slice(0,-4);if(!X.has(z))X.set(z,W);let K=z.toLowerCase();if(!X.has(K))X.set(K,W);let H=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return p8.set($,X),X}function FG($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=g0.join(X,"node_modules",$);try{if(b$.statSync(J).isDirectory())return J}catch{}let Y=g0.dirname(X);if(Y===X)return null;X=Y}}async function LG($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=g0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,z,K)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,j,_=[];while((j=H.exec(K))!==null){let[L,V,O,F]=j,w=null,R=null;if(F.startsWith(".")||F.startsWith("/")){let I=g0.resolve(G,F);if(I.endsWith(".stx"))R=I;else{let A=`${I}.stx`;try{if(b$.statSync(A).isFile())R=A}catch{try{if(b$.statSync(I).isDirectory())w=I}catch{}}}}else w=FG(F,G);if(!w&&!R)continue;let D=!1,N=(I,A)=>{Q.set(I,A),Q.set(I.toLowerCase(),A);let M=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(O&&R)N(O,R),D=!0;else if(V){let I=V.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let T=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:M,local:M}}),A=w?OG(w):null;for(let{source:M,local:T}of I){let k=null;if(R)k=R;else if(A)k=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(k)N(T,k),D=!0}}if(D)_.push({start:j.index,end:j.index+L.length})}if(_.length===0)return W;for(let L=_.length-1;L>=0;L--)B=B.slice(0,_[L].start)+B.slice(_[L].end);return`<script${z}>${B}</script>`}),q}async function wG($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,z]=U,K=z.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of K){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),L=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,O=[g0.resolve(g0.dirname(X),`${H}.stx`),g0.resolve(g0.dirname(X),H),g0.resolve(J.componentsDir||"components",`${H}.stx`),g0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(_,V),G.set(_.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),Y.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function RG($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let z=W.index,K=z+W[0].length-1,H=1,B=K+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(K+1,B),_=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){U.lastIndex=0;continue}let V=L[1],O,F=j.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let R={};if(O)try{R=w0(O,Z)}catch(T){let k=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${k}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await I1(V,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,z)+M+Q.substring(N),U.lastIndex=0}return Q}async function DG($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=r0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,zG),Q=C1(Q,U.scripts),Q;async function H(B,j,_,L){if(!B)return B;let V=B,O=u8(V,j,L);for(let F=O.length-1;F>=0;F--){let w=O[F],R=_?T$(w.tagName):w.tagName,D=jG(BG(w.attributes,Z,X)),N=KG(D,Z,J),I=S0.getBuiltin(w.tagName),A=I?await E$(R,G,Z,X,J):!1;if(I&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=I.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=i8(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=c8(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}V=V.substring(0,w.startIndex)+E+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await E$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let k=await I1(R,M,C1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.clientReactive).length>0)k=i8(k,N.clientReactive);if(Object.keys(N.events).length>0){let y=s8(k);if(y){let E=c8(N.events),b=Object.keys(N.events).map((S)=>S.replace(/^@/,"").split(".")[0]).join(" ");k=k.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+k.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+k+V.substring(w.endIndex)}return V}}function i8($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([z])=>!X.has(z)),Q=Y.filter(([z])=>!J.has(z)).map(([z])=>T$(z)).join(" "),G=$,q=Y.length>0?s8(G):null;if(q){let z=Y.map(([H,B])=>`:${T$(H)}="${B.replace(/"/g,"&quot;")}"`).join(" "),K=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${K} ${z}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function s8($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function k4($,Z,X,J,Y){if(!l8)h8(),l8=!0;let Q=await LG($,Z,X,J,Y);Q=await wG(Q,Z,X,J,Y),Q=await RG(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=o0(Q,q5,(z,K)=>`\x00STX_COMPONENT_COMMENT_${G.length+K}\x00`);G.push(...U.tokens);let W=Q;if(Q=await DG(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=VG(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import X5 from"path";import o8 from"process";function Z5($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(o8.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function oj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(o8.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function r8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function a8($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=X5.join(Y,$);if(await Bun.file(G).exists())return G;Y=X5.dirname(Y)}J=X5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=X5.resolve(Z,$);else J=X5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function t8($,Z,X){let J=$,Y=X5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,z,K,H]=G;if(r8(K))continue;let B=await a8(K,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:Z5()});if(L.outputs.length>0)j=await L.outputs[0].text()}let _=`<script>
3592
+ `||I==="\t")V++;O=D+_.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){Y=H;continue}let w=$.slice(H,F),R=F+L.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function d8($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function m8($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import b$ from"fs";import g0 from"path";var l8=!1,zG=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function KG($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let z=c0(W),K=z.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&Y.has(K))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(z))return!0}return!1},G=new Set(n8),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(z,K)=>K.toUpperCase())},U=(W,z)=>{let K=q(W);if(J.static[K]=z,K!==W)J.staticNames[K]=W};for(let[W,z]of Object.entries($)){let K=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(K.startsWith("@")){J.events[K]=z;continue}if(K.startsWith("__stx_")){let H=q(K.slice(6));J.serverDynamic[H]=m8(z,X);continue}if(K.startsWith(":")){let H=q(K.slice(1)),B=z===k1?H:z;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!G0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),L=q0(B,j)(...Object.values(Z));if(L===void 0){let V=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(u5(B).some((F)=>!V.has(F)&&!j.includes(F))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=L,H!==K.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=K.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof z==="string"&&z.includes("{{")&&z.includes("}}")){let H=z.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(G0(B)){let _=q0(B,Object.keys(Z))(...Object.values(Z));U(K,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${K}: ${B}`);U(K,z)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${K}:`,B);U(K,z)}else{let B=z,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(z))!==null)try{let L=_[1];if(!G0(L)){if(X.debug)console.error(`Unsafe expression in ${K}: ${L}`);continue}let O=q0(L,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(O??""))}catch(L){if(X.debug)console.error(`Error evaluating expression in ${K}:`,L)}U(K,B)}continue}U(K,z===k1?"true":d8(z))}return J}var HG=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function BG($,Z,X){if(!$.includes("@"))return $;if(!HG.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return X1($,Z,X)}catch{return $}}function jG($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=k1}return Z}function c8($){return Object.entries($).map(([Z,X])=>X===k1?Z:`${Z}="${_G(X)}"`).join(" ")}function _G($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VG($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(S0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var p8=new Map;function OG($){let Z=p8.get($);if(Z)return Z;let X=new Map,J=[g0.join($,"src"),g0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=b$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=g0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let z=U.name.slice(0,-4);if(!X.has(z))X.set(z,W);let K=z.toLowerCase();if(!X.has(K))X.set(K,W);let H=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return p8.set($,X),X}function FG($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=g0.join(X,"node_modules",$);try{if(b$.statSync(J).isDirectory())return J}catch{}let Y=g0.dirname(X);if(Y===X)return null;X=Y}}async function LG($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=g0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,z,K)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,j,_=[];while((j=H.exec(K))!==null){let[L,V,O,F]=j,w=null,R=null;if(F.startsWith(".")||F.startsWith("/")){let I=g0.resolve(G,F);if(I.endsWith(".stx"))R=I;else{let A=`${I}.stx`;try{if(b$.statSync(A).isFile())R=A}catch{try{if(b$.statSync(I).isDirectory())w=I}catch{}}}}else w=FG(F,G);if(!w&&!R)continue;let D=!1,N=(I,A)=>{Q.set(I,A),Q.set(I.toLowerCase(),A);let M=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(O&&R)N(O,R),D=!0;else if(V){let I=V.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let T=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:M,local:M}}),A=w?OG(w):null;for(let{source:M,local:T}of I){let k=null;if(R)k=R;else if(A)k=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(k)N(T,k),D=!0}}if(D)_.push({start:j.index,end:j.index+L.length})}if(_.length===0)return W;for(let L=_.length-1;L>=0;L--)B=B.slice(0,_[L].start)+B.slice(_[L].end);return`<script${z}>${B}</script>`}),q}async function wG($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,z]=U,K=z.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of K){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),L=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,O=[g0.resolve(g0.dirname(X),`${H}.stx`),g0.resolve(g0.dirname(X),H),g0.resolve(J.componentsDir||"components",`${H}.stx`),g0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(_,V),G.set(_.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),Y.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function RG($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let z=W.index,K=z+W[0].length-1,H=1,B=K+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(K+1,B),_=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){U.lastIndex=0;continue}let V=L[1],O,F=j.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let R={};if(O)try{R=w0(O,Z)}catch(T){let k=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${k}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await I1(V,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,z)+M+Q.substring(N),U.lastIndex=0}return Q}async function DG($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=r0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,zG),Q=C1(Q,U.scripts),Q;async function H(B,j,_,L){if(!B)return B;let V=B,O=u8(V,j,L);for(let F=O.length-1;F>=0;F--){let w=O[F],R=_?T$(w.tagName):w.tagName,D=jG(BG(w.attributes,Z,X)),N=KG(D,Z,J),I=S0.getBuiltin(w.tagName),A=I?await E$(R,G,Z,X,J):!1;if(I&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=I.render(N,w.content,y);if(Object.keys(N.events).length>0){let b=c8(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}if(Object.keys(N.clientReactive).length>0)E=i8(E,N.clientReactive);V=V.substring(0,w.startIndex)+E+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await E$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let k=await I1(R,M,C1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.events).length>0){let y=s8(k);if(y){let E=c8(N.events),b=Object.keys(N.events).map((S)=>S.replace(/^@/,"").split(".")[0]).join(" ");k=k.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+k.substring(y.insertPos)}}if(Object.keys(N.clientReactive).length>0)k=i8(k,N.clientReactive);V=V.substring(0,w.startIndex)+k+V.substring(w.endIndex)}return V}}function i8($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([z])=>!X.has(z)),Q=Y.filter(([z])=>!J.has(z)).map(([z])=>T$(z)).join(" "),G=$,q=Y.length>0?s8(G):null;if(q){let z=Y.map(([H,B])=>`:${T$(H)}="${B.replace(/"/g,"&quot;")}"`).join(" "),K=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${K} ${z}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function s8($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function k4($,Z,X,J,Y){if(!l8)h8(),l8=!0;let Q=await LG($,Z,X,J,Y);Q=await wG(Q,Z,X,J,Y),Q=await RG(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=o0(Q,q5,(z,K)=>`\x00STX_COMPONENT_COMMENT_${G.length+K}\x00`);G.push(...U.tokens);let W=Q;if(Q=await DG(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=VG(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import X5 from"path";import o8 from"process";function Z5($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(o8.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function oj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(o8.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function r8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function a8($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=X5.join(Y,$);if(await Bun.file(G).exists())return G;Y=X5.dirname(Y)}J=X5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=X5.resolve(Z,$);else J=X5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function t8($,Z,X){let J=$,Y=X5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,z,K,H]=G;if(r8(K))continue;let B=await a8(K,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:Z5()});if(L.outputs.length>0)j=await L.outputs[0].text()}let _=`<script>
3593
3593
  // Source: ${K}
3594
3594
  ${j}
3595
3595
  </script>`;J=J.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(J))!==null){let[W,z,K,H]=U,B=z+H;if(r8(K))continue;if(/rel=["']stylesheet["']/.test(B)||K.endsWith(".css")){let _=await a8(K,Y,Z);if(_)try{let L=await Bun.file(_).text();X.add(_);let V=`<style>
@@ -3611,9 +3611,9 @@ ${U.join(`
3611
3611
  `+Y.slice(Q)}async function C4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=G1($,X);let Q=!Z.__stxProcessingDepth;if(Q)r4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!j5()&&!t5())&&X&&X.endsWith(".stx"))K2($,X);try{return await U2.timeAsync("template-processing",async()=>{let G=await SG($,Z,X,J,Y);if(Q)G=b4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??z2(),z=(Z.__stx_head_raw||"").trim(),K,H=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)K=H[1].trim(),z=z.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||K||B,_=!W.title&&(!!K||!!B),L=W.meta||[],V=new Set(L.map((N)=>n1(N)).filter(Boolean)),O={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!V.has(n1(N))),...L],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
3612
3612
  `),...W.htmlAttrs&&{htmlAttrs:t9(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},F=J4(G);if(G=X8(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=Z8(G,q),G=e9(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],I=q2(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
3613
3613
  <meta name="stx-layout" content="${J2(N)}">
3614
- <meta name="stx-layout-group" content="${J2(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=P1(G,(I,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=$8(G);let q=J.app?.colorMode;if(q)G=n9(G,q);G=o9(G),G=yG(G)}if(Q)try{let{getStoreScript:q}=await s("stx/store-loader",()=>import("./chunk-ykxs16y7.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=Y5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3615
- `+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await s("stx/framework-composables",()=>import("./chunk-4wnnet1k.js")),U=await q(G);if(U){let W=Y5(G,"data-stx-stores")||Y5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
3616
- `+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await s("stx/composable-loader",()=>import("./chunk-d3v3p15c.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=Y5(G,"data-stx-stores")||Y5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3614
+ <meta name="stx-layout-group" content="${J2(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=P1(G,(I,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=$8(G);let q=J.app?.colorMode;if(q)G=n9(G,q);G=o9(G),G=yG(G)}if(Q)try{let{getStoreScript:q}=await s("stx/store-loader",()=>import("./chunk-v5qv7q0y.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=Y5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3615
+ `+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await s("stx/framework-composables",()=>import("./chunk-h6xxqg0h.js")),U=await q(G);if(U){let W=Y5(G,"data-stx-stores")||Y5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
3616
+ `+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await s("stx/composable-loader",()=>import("./chunk-bwf0xaqc.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=Y5(G,"data-stx-stores")||Y5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3617
3617
  `+z+G.slice(K.end)}}catch{}if(Q)G=s9(G);if(Q&&Z.__stx_inject_css!==!1)G=await W2(G,void 0,J.buildMode==="serve");if(Q)G=c9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Z$)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(i0.log(U,{filePath:X,context:Z}),j3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return H3.createFallbackContent("Template Processing",U)}}async function SG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!A0.isAbsolute(J.partialsDir)?A0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!A0.isAbsolute(J.componentsDir)?A0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!A0.isAbsolute(J.layoutsDir)?A0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await vG(X,Z),PG(Z,q),U=await g1(()=>A9(U,Z,X,q),U,(F)=>{i0.log(F,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${F.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=o0(U,q5,(F,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let z=W.tokens,K=(F)=>z.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(F,w)=>{return`{{ ${w} }}`}),U=S9(U),U=await t8(U,X,Y);let B={};U=n3(U,B);let j={...Z.__sections||{}},_="",L=S7(y7($)),V=/@nolayout\b/.test(U)||L===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let O=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof L==="string"){if(_=L,!/@section\s*\(/.test(U))U=`@section('content')
3618
3618
  ${U.trim()}
3619
3619
  @endsection`}if(!_&&!V&&q.defaultLayout){let F=X4(U),w=/@section\s*\(/.test(U);if(!F||w){let R="",D=A0.dirname(X),N=q.layoutsDir?A0.dirname(q.layoutsDir):process.cwd();for(let I=0;I<20;I++){let A=A0.join(D,"_layout.stx");if(await t(A)){R=A;break}let M=A0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let I=A0.isAbsolute(q.layoutsDir)?q.layoutsDir:A0.resolve(process.cwd(),q.layoutsDir),A=A0.join(I,`${q.defaultLayout}.stx`);if(await t(A))_=A}if(_&&!w)U=`@section('content')
@@ -3621,7 +3621,7 @@ ${U.trim()}
3621
3621
  @endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return F;try{let D=e(R.trim(),Z);if(D===void 0)return F;return j[w]=String(D??""),""}catch{return F}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",b1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=s3(U,B),_){let F=[],w=r0(U),R=o0(w.output,S1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,I)=>{let A=N==="SCRIPT"?w.scripts[Number(I)]:R.tokens[Number(I)];if(A)F.push(A);return""}),F.length>0){let D=F.join(`
3622
3622
  `);j.content=j.content?`${j.content}
3623
3623
  ${D}`:D,Z.__sections=j}}if(_)try{let F;if(A0.isAbsolute(_))F=_,Y.add(_);else F=await g1(()=>Y$(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let A=(k)=>{if(!k)return[];try{let y=A0.isAbsolute(k)?k:A0.resolve(process.cwd(),k);return EG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((k,y,E)=>E.indexOf(k)===y).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(i0.log(Error(T),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new L1(T,X);return U}let w=await g1(()=>Bun.file(F).text(),"",()=>{throw new L1(`Failed to read layout file: ${F}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${F}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(b1)){let b=j[y].indexOf(b1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+b1.length)}else if(!j[y])j[y]=E;let T={...Z,__sections:j},k=`@layout('${R[1]}')${M}`;return await C4(k,T,F,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=n3(D,B),I={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,T)=>{return I[M]=T.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,T)=>{if(j[M]){let k=j[M];if(k.includes(b1)){let y=I[M]||"",E=k.indexOf(b1);k=k.slice(0,E)+y+k.slice(E+b1.length)}return k}return T||""}),N=CG(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=s3(N,B),Z.__originalFilePath=X,U=await Q2(N,Z,F,G,Y),U=`<!-- stx-layout: ${_} -->
3624
- ${U}`,K(U)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await Q2(U,Z,X,G,Y))}function CG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function PG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function vG($,Z){await g1(()=>k9($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function fG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await s("stx/variable-extractor",()=>import("./chunk-7cts329z.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));i0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function xG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await s("stx/expressions",()=>import("./chunk-cd4v7xyr.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return i0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function Q2($,Z,X,J,Y){let Q=$,G=J;if(await fG(Q,Z,X),Q=await xG(Q,Z,X),Q=await K9(Q,Z,X),Q=await H9(Q,Z,X),Q=await s6(Q,Z,X,G),G1(Q))Q=L8(Q,Z),Q=D8(Q,Z);Q=R8(Q);let{processStreamDirectives:q}=await s("stx/streaming",()=>import("./chunk-78bm61kd.js"));Q=q(Q,Z),Q=L9(Q,Z,X,G),Q=await f9(Q,Z,X,G,Y),Q=await k4(Q,Z,X,G,Y),Q=b7(Q,Z,X,G);let{processDeferDirectives:U}=await s("stx/defer",()=>import("./chunk-ng1wyd2v.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await s("stx/teleport",()=>import("./chunk-wacr03x4.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await s("stx/transitions",()=>import("./chunk-k7n88ess.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await s("stx/error-boundaries",()=>import("./chunk-rc4zrsw3.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-shtemwbq.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await s("stx/async-components",()=>import("./chunk-6746wmsf.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await s("stx/keep-alive",()=>import("./chunk-9rdg7x9h.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await s("stx/virtual-scrolling",()=>import("./chunk-1hhxj2r5.js"));Q=L(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-dhe8sp1a.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await s("stx/computed",()=>import("./chunk-qkbrbys7.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await s("stx/forms-validation",()=>import("./chunk-vrskjx64.js"));Q=N(Q,Z,X);let{processHeadDirective:I,processTitleDirective:A,processMetaDirective:M,resetHead:T}=await s("stx/head",()=>import("./chunk-278yw67q.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let k=I(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
3624
+ ${U}`,K(U)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await Q2(U,Z,X,G,Y))}function CG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function PG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function vG($,Z){await g1(()=>k9($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function fG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await s("stx/variable-extractor",()=>import("./chunk-2b4g32yv.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));i0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function xG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await s("stx/expressions",()=>import("./chunk-sfha6xsd.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return i0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function Q2($,Z,X,J,Y){let Q=$,G=J;if(await fG(Q,Z,X),Q=await xG(Q,Z,X),Q=await K9(Q,Z,X),Q=await H9(Q,Z,X),Q=await s6(Q,Z,X,G),G1(Q))Q=L8(Q,Z),Q=D8(Q,Z);Q=R8(Q);let{processStreamDirectives:q}=await s("stx/streaming",()=>import("./chunk-chte720d.js"));Q=q(Q,Z),Q=L9(Q,Z,X,G),Q=await f9(Q,Z,X,G,Y),Q=await k4(Q,Z,X,G,Y),Q=b7(Q,Z,X,G);let{processDeferDirectives:U}=await s("stx/defer",()=>import("./chunk-ng1wyd2v.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await s("stx/teleport",()=>import("./chunk-wacr03x4.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await s("stx/transitions",()=>import("./chunk-k7n88ess.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await s("stx/error-boundaries",()=>import("./chunk-rc4zrsw3.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-shtemwbq.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await s("stx/async-components",()=>import("./chunk-6746wmsf.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await s("stx/keep-alive",()=>import("./chunk-9rdg7x9h.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await s("stx/virtual-scrolling",()=>import("./chunk-1hhxj2r5.js"));Q=L(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-dhe8sp1a.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await s("stx/computed",()=>import("./chunk-qkbrbys7.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await s("stx/forms-validation",()=>import("./chunk-vrskjx64.js"));Q=N(Q,Z,X);let{processHeadDirective:I,processTitleDirective:A,processMetaDirective:M,resetHead:T}=await s("stx/head",()=>import("./chunk-278yw67q.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let k=I(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
3625
3625
  `;if(Q=A(Q,Z),Q=M(Q,Z),Q=I9(Q),Q=k3(Q,Z),Q=n6(Q),Q=D9(Q),Q=await i3(Q,Z,X,G,Y),Q=await k4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=a4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=b4(Q),Q=X1(Q,Z,X),Q=P7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=T3(Q,Z),Q=E3(Q,Z),Q=w5(Q,Z),Q=f3(Q,Z),Q=x3(Q,Z),Q=await P6(Q,Z,X,G),Q=await d7(Q,Z,X),Q=await Q9(Q,Z,X,G),Q=G2(Q,Z,X,G),Q=L6(Q,Z,X,G),Q=w6(Q,Z,X),Q=R6(Q,Z,X,G),Q=p6(Q,Z,X,G),Q=T4(Q,Z),Q=E4(Q),Q=e8(Q),!G.skipEventDirectives)Q=o4(Q,Z,X);if(Q=x7(Q,Z,X),G.debug){let c=/\bx-data\s*=/.test(Q),p=z4($);if(c&&p)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3626
3626
  Both work on the same page, but they manage separate scopes.
3627
3627
  Prefer signals (state/derived/effect) for new components.`)}Q=b9(Q,Z),Q=await V1(Q,Z,X),Q=Z2(Q),Q=X2(Q),Q=D7(Q);let{processXElementDirectives:y}=await s("stx/x-element",()=>import("./chunk-9gzmcxzg.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=y$(Z);if(Q=await N8(Q,G,E,b),Q=t6(Q,Z),Q=await M9(Q,Z,X,G),G.media?.image?.autoSiblings){let c=G.publicDir||"public",{rewriteImagesWithSiblings:p}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-7kkc13rc.js"));Q=await p(Q,{publicDir:c})}if(G.seo?.enabled)Q=D6(Q,Z,G);let S=(c,p,U0=!0)=>{if(!p)return c;let Q0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),D0=c.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Q0&&D0){if(U0)c=c.replace(D0[0],Q0[0]);if(p=p.replace(Q0[0],"").trim(),!p)return c}if(/<\/head>/i.test(c))return c.replace(/<\/head>/i,`${p}
@@ -3635,7 +3635,7 @@ ${L7()}
3635
3635
  `+G5}else Q=Q.replace("</head>",`${p}
3636
3636
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3637
3637
  ${p}`);else Q=p+`
3638
- `+Q}{let{scanScriptTags:c}=await s("stx/signal-processing",()=>import("./chunk-q5et8k2d.js")),p=[];for(let U0 of c(Q)){if(!/\bserver\b/i.test(U0.attrs))continue;let Q0=U0.start+U0.fullMatch.indexOf(">")+1,D0=bG(Q,Q0);if(D0===-1)continue;let P0=D0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;p.push({start:U0.start,end:P0})}for(let U0=p.length-1;U0>=0;U0--){let{start:Q0,end:D0}=p[U0];Q=Q.substring(0,Q0)+Q.substring(D0)}}let C0=F$(Q,X);if(C0.hasScoped)Q=C0.html;let X0=Z.__stx_event_bindings||[],H0=!1,I0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:m0}=await s("stx/signal-processing",()=>import("./chunk-q5et8k2d.js"));for(let c of m0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))I0.push({match:c.fullMatch,attrs:c.attrs,content:c.body});for(let{match:c,attrs:p,content:U0}of I0){H0=!0;let Q0=U0;S4(U0,X,J.strict,Z.__originalFilePath);let D0=await S$(U0,{eventBindings:X0,attrs:p,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(c,()=>D0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let c=Z.__stx_event_bindings||[];if(c.length>0){let p=h$(c);if(p){let U0=Q.lastIndexOf("</body>");Q=U0===-1?Q+p:Q.slice(0,U0)+p+`
3638
+ `+Q}{let{scanScriptTags:c}=await s("stx/signal-processing",()=>import("./chunk-9th0hyk5.js")),p=[];for(let U0 of c(Q)){if(!/\bserver\b/i.test(U0.attrs))continue;let Q0=U0.start+U0.fullMatch.indexOf(">")+1,D0=bG(Q,Q0);if(D0===-1)continue;let P0=D0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;p.push({start:U0.start,end:P0})}for(let U0=p.length-1;U0>=0;U0--){let{start:Q0,end:D0}=p[U0];Q=Q.substring(0,Q0)+Q.substring(D0)}}let C0=F$(Q,X);if(C0.hasScoped)Q=C0.html;let X0=Z.__stx_event_bindings||[],H0=!1,I0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:m0}=await s("stx/signal-processing",()=>import("./chunk-9th0hyk5.js"));for(let c of m0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))I0.push({match:c.fullMatch,attrs:c.attrs,content:c.body});for(let{match:c,attrs:p,content:U0}of I0){H0=!0;let Q0=U0;S4(U0,X,J.strict,Z.__originalFilePath);let D0=await S$(U0,{eventBindings:X0,attrs:p,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(c,()=>D0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let c=Z.__stx_event_bindings||[];if(c.length>0){let p=h$(c);if(p){let U0=Q.lastIndexOf("</body>");Q=U0===-1?Q+p:Q.slice(0,U0)+p+`
3639
3639
  `+Q.slice(U0)}Z.__stx_event_bindings=[]}}if(!U8(Q)&&W8(Q))Q=await D$(Q,G);if(Q=z8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=c6(Q,Z.cspNonce);return Q}var gG=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],hG=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],uG=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function dG($){let Z=[],X=[];return mG($,Z),lG($,Z,X),cG($,X),pG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function mG($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function lG($,Z,X){for(let J of gG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function cG($,Z){for(let X of hG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function pG($,Z){for(let X of uG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function iG($,Z){let X=$.slice(0,Z).split(`
3640
3640
  `);return{line:X.length,column:X[X.length-1].length+1}}function nG($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function sG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function oG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import t0 from"path";import Q5 from"process";var w2=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],H2=new Set(w2),rG=new Set(["props","$props","defineProps"]),aG=new Set(["stx","@stacksjs/stx"]),B2=J5(128);function tG($){let Z=[],X=0,J=$.split(`
3641
3641
  `);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...K)}}}}return[...new Set(Z)]}function eG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,U=null;for(let W=0;W<J.length;W++){let z=J[W];if(U){if(Q+=z,z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")q++;else if(z===")")q--;if(z===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=z}if(Q)Y.push(Q);return Y.map((W)=>{let z=W.trim(),K=z.startsWith("..."),H=K?z.slice(3):z,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return W;let L=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),O=-1,F=0;for(let R=0;R<V.length;R++)if(V[R]==="<")F++;else if(V[R]===">")F--;else if(V[R]==="="&&F===0){O=R;break}let w=K?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,U=G+1,W=0,z=null;while(U<Z.length&&q>0){let B=Z[U];if(z){if(B===z)z=null;U++;continue}if(B==='"'||B==="'"||B==="`"){z=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let K=Z.substring(G+1,U);if(!K.includes(":"))continue;let H=X(K);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
@@ -3657,11 +3657,11 @@ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:
3657
3657
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
3658
3658
  ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Wq($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=M2(J);if(Q!==-1){if(j0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3659
3659
  ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function F2($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...Q5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function zq($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=F2(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=F2(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function Kq($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function Hq($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=new c1(500),P$=new c1(1000),jq=33554432,x4=new c1(2000,{maxBytes:jq,sizeOf:($)=>$.output.length});function _q($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function I2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!Vq($)}var C$=new Map;function v4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=C$.get(Z);if(X)return X;if(C$.size>=16)C$.clear();let J=new Bun.Transpiler($);return C$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=v4({loader:"ts",target:"browser",define:Z5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Oq($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(z)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===z){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let z=1;while(Y<Q&&z>0)if($[Y]==="{")z++,Y++;else if($[Y]==="}")z--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3660
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function Fq($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function Lq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function wq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of Fq(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=Lq(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function E$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(L))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?x.resolve(Y.root):void 0,K=z??x.dirname(J),H=[],B=(L)=>{if(L&&!H.includes(L))H.push(L)},j=X.__originalFilePath;if(j)B(x.join(x.dirname(j),"components"));if(B(Z),B(Y._rootComponentsDir),B(x.join(x.dirname(J),"components")),B(Y.componentsDir),z)B(x.resolve(z,"resources/views/components")),B(x.resolve(z,"resources/components")),B(x.resolve(z,"src/components")),B(x.resolve(z,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)B(typeof L==="string"?L:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(x.resolve(x.dirname(J),`${Q}.stx`));for(let L of H){let V=x.isAbsolute(L)?L:x.resolve(K,L);for(let O of W)if(await t(x.join(V,O)))return!0}return!1}function Rq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Dq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Nq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await s("stx/variable-extractor",()=>import("./chunk-7cts329z.js")),z=q??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let K=new Set(z);K.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&Rq(H)?H:"";try{let j=(h)=>h.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),_=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let h=[L,L.toLowerCase(),j(L),_(L)];for(let d of h)if(O.has(d)){V=O.get(d);break}}let F=[];if(!V){let h=[`${L}.stx`,`${j(L)}.stx`,`${_(L)}.stx`],d=[...new Set(h)],W0=Y.__originalFilePath,i=[];if(W0){let F0=x.join(x.dirname(W0),"components");i.push(F0)}if(J)i.push(J);let V0=G._rootComponentsDir;if(typeof V0==="string"&&!i.includes(V0))i.push(V0);let O0=x.join(x.dirname(Q),"components");if(!i.includes(O0))i.push(O0);if(G.componentsDir&&G.componentsDir!==J&&!i.includes(G.componentsDir))i.push(G.componentsDir);let v0=typeof G.root==="string"?x.resolve(G.root):void 0,_1=v0??x.dirname(Q),b0=[];if(v0)b0.push(x.resolve(v0,"resources/views/components")),b0.push(x.resolve(v0,"resources/components")),b0.push(x.resolve(v0,"src/components")),b0.push(x.resolve(v0,"components"));b0.push(x.resolve(import.meta.dir,"components"));for(let F0 of b0)if(!i.includes(F0))i.push(F0);let n=G._pluginComponentDirs;if(Array.isArray(n)){for(let F0 of n)if(typeof F0==="string"&&!i.includes(F0))i.push(F0)}if(G.fallbackComponentsDir&&!i.includes(G.fallbackComponentsDir))i.push(G.fallbackComponentsDir);let l0=[...new Set(i.map((F0)=>{if(!F0)return F0;return x.isAbsolute(F0)?F0:x.resolve(_1,F0)}))];i.length=0,i.push(...l0);let S5=`${L}\x00${Q}\x00${l0.join("\x00")}`,v$=P$.get(S5);if(v$)if(await t(v$))V=v$;else P$.delete(S5);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=x.resolve(x.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let F0 of i){if(!F0)continue;for(let C5 of d){let P5=x.join(F0,C5);if(F.push(P5),await t(P5)){V=P5;break}}if(V)break;if(!V)try{let C5=await import("fs");if(!C5.statSync(F0,{throwIfNoEntry:!1})?.isDirectory())continue;let h2=8,f$=[{path:F0,depth:0}];while(f$.length>0&&!V){let v5=f$.pop();if(v5.depth>=h2)continue;let d4;try{d4=C5.readdirSync(v5.path,{withFileTypes:!0})}catch{continue}for(let f5 of d4){if(!f5.isDirectory())continue;if(f5.name==="node_modules"||f5.name.startsWith("."))continue;let m4=x.join(v5.path,f5.name);for(let u2 of d){let x$=x.join(m4,u2);if(F.push(x$),await t(x$)){V=x$;break}}if(V)break;f$.push({path:m4,depth:v5.depth+1})}}}catch{}if(V)break}if(V)P$.set(S5,V)}if(!V||!await t(V)){let h=F.length>0?`
3660
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function Fq($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function Lq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function wq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of Fq(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=Lq(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function E$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(L))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?x.resolve(Y.root):void 0,K=z??x.dirname(J),H=[],B=(L)=>{if(L&&!H.includes(L))H.push(L)},j=X.__originalFilePath;if(j)B(x.join(x.dirname(j),"components"));if(B(Z),B(Y._rootComponentsDir),B(x.join(x.dirname(J),"components")),B(Y.componentsDir),z)B(x.resolve(z,"resources/views/components")),B(x.resolve(z,"resources/components")),B(x.resolve(z,"src/components")),B(x.resolve(z,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)B(typeof L==="string"?L:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(x.resolve(x.dirname(J),`${Q}.stx`));for(let L of H){let V=x.isAbsolute(L)?L:x.resolve(K,L);for(let O of W)if(await t(x.join(V,O)))return!0}return!1}function Rq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Dq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Nq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await s("stx/variable-extractor",()=>import("./chunk-2b4g32yv.js")),z=q??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let K=new Set(z);K.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&Rq(H)?H:"";try{let j=(h)=>h.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),_=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let h=[L,L.toLowerCase(),j(L),_(L)];for(let d of h)if(O.has(d)){V=O.get(d);break}}let F=[];if(!V){let h=[`${L}.stx`,`${j(L)}.stx`,`${_(L)}.stx`],d=[...new Set(h)],W0=Y.__originalFilePath,i=[];if(W0){let F0=x.join(x.dirname(W0),"components");i.push(F0)}if(J)i.push(J);let V0=G._rootComponentsDir;if(typeof V0==="string"&&!i.includes(V0))i.push(V0);let O0=x.join(x.dirname(Q),"components");if(!i.includes(O0))i.push(O0);if(G.componentsDir&&G.componentsDir!==J&&!i.includes(G.componentsDir))i.push(G.componentsDir);let v0=typeof G.root==="string"?x.resolve(G.root):void 0,_1=v0??x.dirname(Q),b0=[];if(v0)b0.push(x.resolve(v0,"resources/views/components")),b0.push(x.resolve(v0,"resources/components")),b0.push(x.resolve(v0,"src/components")),b0.push(x.resolve(v0,"components"));b0.push(x.resolve(import.meta.dir,"components"));for(let F0 of b0)if(!i.includes(F0))i.push(F0);let n=G._pluginComponentDirs;if(Array.isArray(n)){for(let F0 of n)if(typeof F0==="string"&&!i.includes(F0))i.push(F0)}if(G.fallbackComponentsDir&&!i.includes(G.fallbackComponentsDir))i.push(G.fallbackComponentsDir);let l0=[...new Set(i.map((F0)=>{if(!F0)return F0;return x.isAbsolute(F0)?F0:x.resolve(_1,F0)}))];i.length=0,i.push(...l0);let S5=`${L}\x00${Q}\x00${l0.join("\x00")}`,v$=P$.get(S5);if(v$)if(await t(v$))V=v$;else P$.delete(S5);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=x.resolve(x.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let F0 of i){if(!F0)continue;for(let C5 of d){let P5=x.join(F0,C5);if(F.push(P5),await t(P5)){V=P5;break}}if(V)break;if(!V)try{let C5=await import("fs");if(!C5.statSync(F0,{throwIfNoEntry:!1})?.isDirectory())continue;let h2=8,f$=[{path:F0,depth:0}];while(f$.length>0&&!V){let v5=f$.pop();if(v5.depth>=h2)continue;let d4;try{d4=C5.readdirSync(v5.path,{withFileTypes:!0})}catch{continue}for(let f5 of d4){if(!f5.isDirectory())continue;if(f5.name==="node_modules"||f5.name.startsWith("."))continue;let m4=x.join(v5.path,f5.name);for(let u2 of d){let x$=x.join(m4,u2);if(F.push(x$),await t(x$)){V=x$;break}}if(V)break;f$.push({path:m4,depth:v5.depth+1})}}}catch{}if(V)break}if(V)P$.set(S5,V)}if(!V||!await t(V)){let h=F.length>0?`
3661
3661
  Searched paths:
3662
3662
  ${F.map((d)=>` - ${d}`).join(`
3663
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}U.add(V);let w;if(T5.has(V))w=T5.get(V);else try{w=await Bun.file(V).text(),T5.set(V,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let R=new Set(["__originalFilePath","__importedComponents",x5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[h,d]of Object.entries(Y))if(!h.startsWith("__")||R.has(h))D[h]=d;let N=X;if(X.includes("@include")){let{processIncludes:h}=await s("stx/includes",()=>import("./chunk-xkb16kmv.js"));N=await h(X,Y,Q,G,U)}let I=r0(N),A=[],M=I.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(h,d)=>{let W0=I.scripts[Number(d)]||"",i=W0.match(/^<script\b([^>]*)>/i)?.[1]||"",V0=i.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!V0||["module","text/javascript","application/javascript"].includes(V0);if(!/\bserver\b/i.test(i)&&O0)return A.push(W0),"";return W0}),{extractSlotContent:T}=await s("stx/slots",()=>import("./chunk-fcv00xs9.js")),k=T(M),y={};if(k.defaultSlot?.trim())y.default=k.defaultSlot;for(let[h,d]of k.namedSlots)y[h]=d.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,S={...D,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:K,__sections:{},__stx_signals_gate:G1(w)||Dq(X)};wq(w,S);let f=w,g=B$(f);if(g)f=g.content.trim();let o=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(o)],K0=[],e0=u.some((h)=>/\bserver\b/.test(h[1]||"")&&/\bcache\b/.test(h[1]||"")),M0=null,C0=null,X0=null,H0=0,I0=null;if(e0){let h=_q({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(h!==null){M0=`${V}\x00${E1(w)}\x00${h}`;let d=x4.get(M0);if(d){for(let W0 of d.dependencies)U.add(W0);if($7(Y,d.clientFactories),E.n+=d.uidsConsumed,d.preservedClientExpressions.length>0){let W0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let i of d.preservedClientExpressions)W0.add(i);Y.__stx_preserved_client_expressions=[...W0]}return d.output}C0=new Set(U),X0=t4(Y),H0=E.n,I0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let h of u){let d=h[1]||"",W0=h[2]||"",i=d.includes("server");if(N1(d)&&W0.trim())W0=A1(W0);if(i&&W0)try{await W(W0,S,V)}catch(O0){}if(!i){let O0=W0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=O0.includes("{{")&&O0.includes("}}"),_1=O0.includes("{!!")&&O0.includes("!!}");if(v0||_1)O0=l$(O0,S);let b0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");K0.push(`<script${b0}>${O0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),m0=E0?E0[1]:"",c=E0?E0[2]:"",p="",U0=m0&&/\bscoped\b/i.test(m0);if(E0)p=`<style${m0}>${c}</style>`;let Q0=f;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let h=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(Q0=Q0.replace(h,(W0,i)=>{let V0=i.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(V0)d.push(`<style${V0[1]}>${V0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)p=`${p}${d.join(`
3664
- `)}`}if(X&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:D0}=await s("stx/slots",()=>import("./chunk-fcv00xs9.js")),{defaultSlot:P0,namedSlots:G5}=k;Q0=await D0(Q0,P0,G5,S);let b5=K0.some((h)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(h)),y5=Nq(K0),C=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(y5.length>0||C.length>0)S.__stx_client_signal_names=[...new Set([...C,...y5])];let P={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:b5||K0.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r=await C4(Q0,S,V,P,U),a=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let h of r.matchAll(/\{\{([\s\S]*?)\}\}/g))a.add(h[1].trim());if(a.size>0)Y.__stx_preserved_client_expressions=[...a];let J0=b,Y0=r;if(b5){let h="";if(Object.keys(Z).length>0)try{h=` data-stx-props="${I2(JSON.stringify(Z))}"`}catch{}let d=B?` stx-hydrate="${I2(B)}"`:"";Y0=`<div data-stx-scope="${J0}"${h}${d}>${r}</div>`;let W0=await Promise.all(K0.map(async(i)=>{let V0=i.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!V0)return i;let[,O0,v0]=V0,{vendorStyleTags:_1,factoryBody:b0}=await Iq(v0,V,G.buildMode==="compile"),n=B?null:u$(Y,b0),l0=n?`window.__stxComponentFactories[${JSON.stringify(n)}](${JSON.stringify(J0)});`:`(${b0})(${JSON.stringify(J0)});`;if(B)return`${_1}<script type="stx/island" data-stx-island="${J0}" data-stx-scoped${O0}>${l0}</script>`;return`${_1}<script data-stx-scoped data-stx-run="always"${O0}>${l0}</script>`}));if(Y0=Y0+`
3663
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}U.add(V);let w;if(T5.has(V))w=T5.get(V);else try{w=await Bun.file(V).text(),T5.set(V,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let R=new Set(["__originalFilePath","__importedComponents",x5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[h,d]of Object.entries(Y))if(!h.startsWith("__")||R.has(h))D[h]=d;let N=X;if(X.includes("@include")){let{processIncludes:h}=await s("stx/includes",()=>import("./chunk-9asehtpb.js"));N=await h(X,Y,Q,G,U)}let I=r0(N),A=[],M=I.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(h,d)=>{let W0=I.scripts[Number(d)]||"",i=W0.match(/^<script\b([^>]*)>/i)?.[1]||"",V0=i.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!V0||["module","text/javascript","application/javascript"].includes(V0);if(!/\bserver\b/i.test(i)&&O0)return A.push(W0),"";return W0}),{extractSlotContent:T}=await s("stx/slots",()=>import("./chunk-kcwa9cxw.js")),k=T(M),y={};if(k.defaultSlot?.trim())y.default=k.defaultSlot;for(let[h,d]of k.namedSlots)y[h]=d.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,S={...D,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:K,__sections:{},__stx_signals_gate:G1(w)||Dq(X)};wq(w,S);let f=w,g=B$(f);if(g)f=g.content.trim();let o=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(o)],K0=[],e0=u.some((h)=>/\bserver\b/.test(h[1]||"")&&/\bcache\b/.test(h[1]||"")),M0=null,C0=null,X0=null,H0=0,I0=null;if(e0){let h=_q({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(h!==null){M0=`${V}\x00${E1(w)}\x00${h}`;let d=x4.get(M0);if(d){for(let W0 of d.dependencies)U.add(W0);if($7(Y,d.clientFactories),E.n+=d.uidsConsumed,d.preservedClientExpressions.length>0){let W0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let i of d.preservedClientExpressions)W0.add(i);Y.__stx_preserved_client_expressions=[...W0]}return d.output}C0=new Set(U),X0=t4(Y),H0=E.n,I0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let h of u){let d=h[1]||"",W0=h[2]||"",i=d.includes("server");if(N1(d)&&W0.trim())W0=A1(W0);if(i&&W0)try{await W(W0,S,V)}catch(O0){}if(!i){let O0=W0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=O0.includes("{{")&&O0.includes("}}"),_1=O0.includes("{!!")&&O0.includes("!!}");if(v0||_1)O0=l$(O0,S);let b0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");K0.push(`<script${b0}>${O0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),m0=E0?E0[1]:"",c=E0?E0[2]:"",p="",U0=m0&&/\bscoped\b/i.test(m0);if(E0)p=`<style${m0}>${c}</style>`;let Q0=f;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let h=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(Q0=Q0.replace(h,(W0,i)=>{let V0=i.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(V0)d.push(`<style${V0[1]}>${V0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)p=`${p}${d.join(`
3664
+ `)}`}if(X&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:D0}=await s("stx/slots",()=>import("./chunk-kcwa9cxw.js")),{defaultSlot:P0,namedSlots:G5}=k;Q0=await D0(Q0,P0,G5,S);let b5=K0.some((h)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(h)),y5=Nq(K0),C=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(y5.length>0||C.length>0)S.__stx_client_signal_names=[...new Set([...C,...y5])];let P={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:b5||K0.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r=await C4(Q0,S,V,P,U),a=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let h of r.matchAll(/\{\{([\s\S]*?)\}\}/g))a.add(h[1].trim());if(a.size>0)Y.__stx_preserved_client_expressions=[...a];let J0=b,Y0=r;if(b5){let h="";if(Object.keys(Z).length>0)try{h=` data-stx-props="${I2(JSON.stringify(Z))}"`}catch{}let d=B?` stx-hydrate="${I2(B)}"`:"";Y0=`<div data-stx-scope="${J0}"${h}${d}>${r}</div>`;let W0=await Promise.all(K0.map(async(i)=>{let V0=i.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!V0)return i;let[,O0,v0]=V0,{vendorStyleTags:_1,factoryBody:b0}=await Iq(v0,V,G.buildMode==="compile"),n=B?null:u$(Y,b0),l0=n?`window.__stxComponentFactories[${JSON.stringify(n)}](${JSON.stringify(J0)});`:`(${b0})(${JSON.stringify(J0)});`;if(B)return`${_1}<script type="stx/island" data-stx-island="${J0}" data-stx-scoped${O0}>${l0}</script>`;return`${_1}<script data-stx-scoped data-stx-run="always"${O0}>${l0}</script>`}));if(Y0=Y0+`
3665
3665
  `+W0.join(`
3666
3666
  `),p)Y0+=`
3667
3667
  `+p}else{if(p)Y0+=`
@@ -3684,7 +3684,7 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
3684
3684
  `,q)z+=`
3685
3685
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
3686
3686
  ${Z0.dim}${q}${Z0.reset}
3687
- `;return z}function dV(){T5.clear(),P$.clear(),x4.clear()}function mV(){return{size:T5.size,maxSize:500}}var f4=J5(128);async function Iq($,Z,X){let J=E1($,Z,X),Y=f4.get(J);if(Y){if(E2(Y.deps))return Y;f4.delete(J)}let Q=h4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=u4(Q.styles);G=o1(G).code;let{hasUserImports:U,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-9rkcrzj4.js")),z=[],K=!1;if(U(G)){let V=G;G=await W(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:z}),K=G===V}let{stripStxRuntimeImports:H}=await s("stx/signal-processing",()=>import("./chunk-q5et8k2d.js"));G=H(G);let B=$1(G),j=Oq(B),_=`function(__scopeId) {
3687
+ `;return z}function dV(){T5.clear(),P$.clear(),x4.clear()}function mV(){return{size:T5.size,maxSize:500}}var f4=J5(128);async function Iq($,Z,X){let J=E1($,Z,X),Y=f4.get(J);if(Y){if(E2(Y.deps))return Y;f4.delete(J)}let Q=h4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=u4(Q.styles);G=o1(G).code;let{hasUserImports:U,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-7jpq01y1.js")),z=[],K=!1;if(U(G)){let V=G;G=await W(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:z}),K=G===V}let{stripStxRuntimeImports:H}=await s("stx/signal-processing",()=>import("./chunk-9th0hyk5.js"));G=H(G);let B=$1(G),j=Oq(B),_=`function(__scopeId) {
3688
3688
  ${l1("const",[...k2,...j],B)}
3689
3689
  const __scope = window.stx._scopes = window.stx._scopes || {};
3690
3690
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -3783,7 +3783,7 @@ else {
3783
3783
  // STX: auto-generated event bindings
3784
3784
  ${$.map((X,J)=>lq(X,J)).join(`
3785
3785
  `)}`}function C2($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
3786
- `)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var pq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function iq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!pq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function S$($,Z={}){let X=$,J="",Y=!1,Q=[],G=h4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=u4(G.styles),U=o1(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-9rkcrzj4.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=x2(X);X=O.code,J=g2(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${W4(X,Z.serverData)}${J}`,X=$1(X),!Y&&N1(Z.attrs||""))X=A1(X);let K=cq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
3786
+ `)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var pq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function iq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!pq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function S$($,Z={}){let X=$,J="",Y=!1,Q=[],G=h4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=u4(G.styles),U=o1(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-7jpq01y1.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=x2(X);X=O.code,J=g2(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${W4(X,Z.serverData)}${J}`,X=$1(X),!Y&&N1(Z.attrs||""))X=A1(X);let K=cq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
3787
3787
  ${s1(`${J}${X}
3788
3788
  ${K}`)}
3789
3789
  </script>`}let j=v2($),_=/function __stx_setup_/.test(X),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ap as b,zp as a}from"./chunk-mbvkvac6.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import"./chunk-jb7h4qgh.js";import"./chunk-jnbhyzkv.js";import"./chunk-bby4emay.js";import"./chunk-52wr95ps.js";import"./chunk-j24k071e.js";import"./chunk-sde45gh3.js";import"./chunk-5wkwhjjn.js";import"./chunk-krgth3gf.js";import"./chunk-f8wjdg40.js";export{b as processLoops,a as parseLoopBinding};
2
+ import{Ap as b,zp as a}from"./chunk-fpkgcpey.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import"./chunk-rzdar1x9.js";import"./chunk-jnbhyzkv.js";import"./chunk-bby4emay.js";import"./chunk-52wr95ps.js";import"./chunk-j24k071e.js";import"./chunk-sde45gh3.js";import"./chunk-5wkwhjjn.js";import"./chunk-krgth3gf.js";import"./chunk-f8wjdg40.js";export{b as processLoops,a as parseLoopBinding};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$i as W,_i as G,aj as Z}from"./chunk-9n0gvfrg.js";import{$k as M,gl as U,il as T}from"./chunk-c1r9q5pk.js";import{Nq as w,Ol as B,Pl as E,Rl as L,cs as k}from"./chunk-mbvkvac6.js";import{Nt as j}from"./chunk-sde45gh3.js";import $ from"path";var Y=new Map;function I(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function h(Q){let z;if(Q)z=$.resolve(Q);else{let q=await k();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>M(q))])],K=G(V()),O=W(Y,z,K);if(O!==void 0)return O||null;if(H.length===0)return Z(Y,z,K,""),null;let x=[];for(let q of H){let y=await Bun.file(q).text();x.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}x.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let C=x.map((q)=>q.file),A=[],P=new Set,N=w({loader:"ts",target:"browser",define:L()});for(let q of C)try{let y=await Bun.file(q).text(),F=$.basename(q,".ts");if(I(y,P),U(y))y=await T(y,q,{projectRoot:process.cwd()});y=B(y),y=E(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=N.transformSync(y),A.push(`// Store: ${F}
2
+ import{$i as W,_i as G,aj as Z}from"./chunk-9n0gvfrg.js";import{$k as M,gl as U,il as T}from"./chunk-p557qcrk.js";import{Nq as w,Ol as B,Pl as E,Rl as L,cs as k}from"./chunk-fpkgcpey.js";import{Nt as j}from"./chunk-sde45gh3.js";import $ from"path";var Y=new Map;function I(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function h(Q){let z;if(Q)z=$.resolve(Q);else{let q=await k();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>M(q))])],K=G(V()),O=W(Y,z,K);if(O!==void 0)return O||null;if(H.length===0)return Z(Y,z,K,""),null;let x=[];for(let q of H){let y=await Bun.file(q).text();x.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}x.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let C=x.map((q)=>q.file),A=[],P=new Set,N=w({loader:"ts",target:"browser",define:L()});for(let q of C)try{let y=await Bun.file(q).text(),F=$.basename(q,".ts");if(I(y,P),U(y))y=await T(y,q,{projectRoot:process.cwd()});y=B(y),y=E(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=N.transformSync(y),A.push(`// Store: ${F}
3
3
  ${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(A.length===0)return Z(Y,z,K,""),null;let R=A.join(`
4
4
 
5
5
  `),X=`;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Nq as M,Rl as x}from"./chunk-mbvkvac6.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import{Os as B,Qs as P}from"./chunk-jb7h4qgh.js";import"./chunk-jnbhyzkv.js";import"./chunk-bby4emay.js";import"./chunk-52wr95ps.js";import"./chunk-j24k071e.js";import"./chunk-sde45gh3.js";import"./chunk-5wkwhjjn.js";import"./chunk-krgth3gf.js";import"./chunk-f8wjdg40.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
2
+ import{Nq as M,Rl as x}from"./chunk-fpkgcpey.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import{Os as B,Qs as P}from"./chunk-rzdar1x9.js";import"./chunk-jnbhyzkv.js";import"./chunk-bby4emay.js";import"./chunk-52wr95ps.js";import"./chunk-j24k071e.js";import"./chunk-sde45gh3.js";import"./chunk-5wkwhjjn.js";import"./chunk-krgth3gf.js";import"./chunk-f8wjdg40.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
3
3
  ${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
4
4
  `),w=`<script data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{tk as m}from"./chunk-2qsa4h1t.js";import{Yu as z}from"./chunk-f8wjdg40.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
2
+ import{tk as m}from"./chunk-m87wfz2b.js";import{Yu as z}from"./chunk-f8wjdg40.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';