@stacksjs/stx 0.2.243 → 0.2.244

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 (54) hide show
  1. package/dist/browser-core-imports.js +1 -0
  2. package/dist/{chunk-ysq64g2a.js → chunk-02btxy6j.js} +1 -1
  3. package/dist/{chunk-kd3hbecq.js → chunk-0hatcb1t.js} +1 -1
  4. package/dist/{chunk-rnr9ffy1.js → chunk-0zdy4dpp.js} +8 -8
  5. package/dist/{chunk-bjb61amk.js → chunk-15w5gfwe.js} +1 -1
  6. package/dist/{chunk-kvqkkwnd.js → chunk-1gaetkpx.js} +1 -1
  7. package/dist/{chunk-z5ecweqg.js → chunk-1md5q98r.js} +1 -1
  8. package/dist/{chunk-jvs7azc8.js → chunk-2d13x7hs.js} +1 -1
  9. package/dist/{chunk-4heeeaef.js → chunk-2nqtzhgw.js} +1 -1
  10. package/dist/{chunk-t2sbh2xx.js → chunk-47be2t3d.js} +1 -1
  11. package/dist/{chunk-6mtkpbz8.js → chunk-4j8crbk6.js} +1 -1
  12. package/dist/{chunk-vgmc978e.js → chunk-4mnmm48x.js} +1 -1
  13. package/dist/{chunk-5dh58a34.js → chunk-56rabpsq.js} +1 -1
  14. package/dist/{chunk-380tnd2y.js → chunk-595kj4n2.js} +1 -1
  15. package/dist/{chunk-k8y3m0kn.js → chunk-5a6dzmj8.js} +1 -1
  16. package/dist/{chunk-fm6z2zr9.js → chunk-6rfc8exk.js} +1 -1
  17. package/dist/{chunk-b7tw429a.js → chunk-6z1re4a4.js} +1 -1
  18. package/dist/{chunk-we0kk7cq.js → chunk-7qyz242h.js} +2 -2
  19. package/dist/{chunk-eb7875fm.js → chunk-8vgcye5c.js} +1 -1
  20. package/dist/{chunk-wzyfsdr7.js → chunk-8yn96bkr.js} +1 -1
  21. package/dist/{chunk-19erfat4.js → chunk-9k5symz8.js} +1 -1
  22. package/dist/{chunk-eavhvfzr.js → chunk-b6zt4aqb.js} +1 -1
  23. package/dist/{chunk-3k3vrnk0.js → chunk-d35mdkw8.js} +1 -1
  24. package/dist/{chunk-fpvksjwh.js → chunk-djct09qx.js} +1 -1
  25. package/dist/{chunk-bc250je5.js → chunk-e03bh9ze.js} +1 -1
  26. package/dist/{chunk-y8p9jhb6.js → chunk-f13qa3kb.js} +1 -1
  27. package/dist/{chunk-58x4e8m5.js → chunk-fad3d1g7.js} +1 -1
  28. package/dist/{chunk-at4yzmym.js → chunk-fbhhzy5j.js} +1 -1
  29. package/dist/{chunk-5e7zmgjk.js → chunk-gcf0z2j8.js} +1 -1
  30. package/dist/{chunk-9pkxerqa.js → chunk-hess6q86.js} +1 -1
  31. package/dist/{chunk-dq48z0r7.js → chunk-jqkg6w3p.js} +1 -1
  32. package/dist/{chunk-a0sagjwy.js → chunk-jwchwn52.js} +20 -17
  33. package/dist/{chunk-1aekxpev.js → chunk-kf8edvxc.js} +1 -1
  34. package/dist/{chunk-gept2ha2.js → chunk-m2w91jne.js} +1 -1
  35. package/dist/{chunk-qqt7b18y.js → chunk-przv5z6z.js} +1 -1
  36. package/dist/{chunk-azrhea8j.js → chunk-pxzj5tzb.js} +1 -1
  37. package/dist/{chunk-v5fmahvj.js → chunk-qaj72jrj.js} +1 -1
  38. package/dist/{chunk-ggghr7tk.js → chunk-qbc0adqw.js} +2 -2
  39. package/dist/{chunk-7q6abr68.js → chunk-qtmearwp.js} +1 -1
  40. package/dist/{chunk-h3k1gzwg.js → chunk-rg1g3xjx.js} +1 -1
  41. package/dist/{chunk-atbpj3dh.js → chunk-s0b1p8tc.js} +1 -1
  42. package/dist/{chunk-q9bbt522.js → chunk-vcreetnm.js} +1 -1
  43. package/dist/{chunk-p5mr2984.js → chunk-wjahpknc.js} +1 -1
  44. package/dist/{chunk-c2xhf8re.js → chunk-z4f3gahw.js} +1 -1
  45. package/dist/cli.js +7 -7
  46. package/dist/composables.d.ts +11 -1
  47. package/dist/composables.js +10 -0
  48. package/dist/craft-entry.js +1 -1
  49. package/dist/craft.js +1 -1
  50. package/dist/pwa.js +1 -1
  51. package/dist/ssg.js +2 -2
  52. package/dist/stx.d.ts +39 -7
  53. package/package.json +5 -5
  54. package/stx.d.ts +39 -7
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ks as o8,us as w6,vs as R6}from"./chunk-092sm06a.js";import{Bs as p5}from"./chunk-19m7hed6.js";import{Js as s0}from"./chunk-mv2v3g62.js";import{Zs as a8}from"./chunk-7q6abr68.js";import{_s as O8}from"./chunk-2qkasmq1.js";import{ft as D6,ht as N6,it as A6,kt as O5}from"./chunk-1px4xey5.js";import{lt as t8,pt as e5,rt as G2}from"./chunk-a8fx6wcb.js";import{Ct as e8}from"./chunk-x41v697c.js";import{Dt as L2,Et as j2,Ft as i1,Jt as w2,Kt as h4,Lt as Q8,Nt as D9,Qt as f8}from"./chunk-ax56kn66.js";import{Bu as KG,Cu as n$,Eu as K5,_t as e3,bu as i9,iu as p3,zu as r8}from"./chunk-z2gmz9ew.js";import{Ju as M6}from"./chunk-k26kt6fp.js";import{Ou as f}from"./chunk-qs0fp63n.js";import S1 from"path";import b5 from"fs";var f4=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"]),x4={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"},M2=new Set(["ctrl","alt","shift","meta"]),u4={left:0,middle:1,right:2};function g4($){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(M2.has(J))Z.systemKeys.push(J);else if(J in u4)Z.mouse=J;else if(J in x4||/^[a-z]$/.test(J))Z.keys.push(x4[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 d4($){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[,_,F]=B,V=_.split("."),O=V[0];if(!f4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:g4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,F]=B,V=_.split("."),O=V[0];if(!f4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:g4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function T2($){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=u4[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 I2($,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 C$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function k2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=T2($),Y=I2(C$($.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{ks as o8,us as w6,vs as R6}from"./chunk-092sm06a.js";import{Bs as p5}from"./chunk-19m7hed6.js";import{Js as s0}from"./chunk-mv2v3g62.js";import{Zs as a8}from"./chunk-qtmearwp.js";import{_s as O8}from"./chunk-2qkasmq1.js";import{ft as D6,ht as N6,it as A6,kt as O5}from"./chunk-1px4xey5.js";import{lt as t8,pt as e5,rt as G2}from"./chunk-a8fx6wcb.js";import{Ct as e8}from"./chunk-x41v697c.js";import{Dt as L2,Et as j2,Ft as i1,Jt as w2,Kt as h4,Lt as Q8,Nt as D9,Qt as f8}from"./chunk-ax56kn66.js";import{Bu as KG,Cu as n$,Eu as K5,_t as e3,bu as i9,iu as p3,zu as r8}from"./chunk-z2gmz9ew.js";import{Ju as M6}from"./chunk-k26kt6fp.js";import{Ou as f}from"./chunk-qs0fp63n.js";import S1 from"path";import b5 from"fs";var f4=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"]),x4={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"},M2=new Set(["ctrl","alt","shift","meta"]),u4={left:0,middle:1,right:2};function g4($){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(M2.has(J))Z.systemKeys.push(J);else if(J in u4)Z.mouse=J;else if(J in x4||/^[a-z]$/.test(J))Z.keys.push(x4[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 d4($){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[,_,F]=B,V=_.split("."),O=V[0];if(!f4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:g4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,F]=B,V=_.split("."),O=V[0];if(!f4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:g4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function T2($){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=u4[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 I2($,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 C$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function k2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=T2($),Y=I2(C$($.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;
@@ -283,6 +283,9 @@ finally {
283
283
  if (typeof cleanup === 'function') {
284
284
  instance.destroyHooks.push(cleanup);
285
285
  }
286
+ else if (cleanup && typeof cleanup.then === 'function') {
287
+ cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
288
+ }
286
289
  }
287
290
  catch (e) {
288
291
  console.error('[stx] onMount error:', e);
@@ -3360,9 +3363,9 @@ ${Z9($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3360
3363
  } finally {
3361
3364
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3362
3365
  }
3363
- })();`}function BY($,Z){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]};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}}return{html:$,mergedIntoExisting:null}}var $9=0,uK=new F1(500),Y9=new Set;function dK(){Y9.clear()}function jY($){if($.__onceStore instanceof Set)return $.__onceStore;return Y9}async function d3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||W0.join(W0.dirname(X),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let q=zY($,"@partial","@include"),U=jY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,F,V)=>{let O=F.trim(),L=`${X}:${O}`;if(U.has(L))return"";return U.add(L),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let L=O.index,w=L+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),T=u3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),E=M.match(/^\s*['"]([^'"]+)['"]/);if(!E){V.lastIndex=D;continue}let I=E[1],y=M.substring(E[0].length),k,b=u3(y,0);if(b!==-1)k=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Q0(C)){let l=G0(C,Object.keys(Z));g=Boolean(l(...Object.values(Z)))}else g=Boolean(t(C,Z));let h=F?!g:g,m="";if(h){let l=W(I,G,X);if(l&&await Bun.file(l).exists())Y.add(l);m=`@include('${I}'${k?`, ${k}`:""})`}q=q.substring(0,L)+m+q.substring(D),V.lastIndex=0}catch(C){let g=C instanceof Error?C.message:String(C),h=z0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+h+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==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[,T,A,M,E]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=t(y,Z);let k="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},g=await H(T,C,$,V);k+=g}else if(E)k=await H(E,{},$,V);q=q.substring(0,V)+k+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+z0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==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 T=N[1],A=R.slice(N[0].length),M,E=A.match(/^\s*,\s*\{/);if(E){A=A.slice(E[0].length-1);let k=1,b=1;while(b<A.length&&k>0){if(A[b]==="{")k++;else if(A[b]==="}"){if(k--,k===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let k=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=w0(M,Z)}catch(g){let h=g instanceof Error?g.message:String(g);if(J.debug){let m=z0("Include",`Error parsing includeFirst variables: ${h}`,X,$,V,D);q=q.replace(D,()=>m)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let g of k){let h=W(g,G,X);if(!h)continue;if(await a(h)){let m=await H(g,b,$,V);q=q.replace(D,()=>m),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let g=z0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>g)}else q=q.replace(D,"")}catch(k){let b=k instanceof Error?k.message:String(k),C=z0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,F,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=W0.resolve(F),w=W0.resolve(W0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=W0.resolve(F,O);else R=W0.resolve(w,O);let D=W0.normalize(R),N=D.startsWith(L+W0.sep)||D===L,T=D.startsWith(w+W0.sep)||D===w,A=!1,M=W0.dirname(w);if(D.startsWith(M+W0.sep)){if(!W0.relative(M,D).split(W0.sep).some((k)=>k.startsWith(".")&&k!=="."&&k!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=W0.resolve(X);Q.add(z);function K(_,F,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:F,partialsDir:G}),z0("Include",F,X,V,O)}async function H(_,F={},V,O){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=W0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(h){let m=h instanceof Error?h.message:String(h);return K(_,`Error loading include file ${_}: ${m}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:h}=await import("./chunk-k8y3m0kn.js");R=h(R,Z)}if(R&&(J.debug||!_5()&&!s5()))try{let{warnUnbalancedTags:h}=await import("./chunk-p6gb0bak.js");h(R,L)}catch{}let D=R;try{let{processESImports:h}=await import("./chunk-eb7875fm.js");await h(R,Z,L,J,Y)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,h instanceof Error?h.message:h)}let N=W$(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 E={...Z};E.__stx_signals_gate=Q1(R);for(let[h,m]of Object.entries(F))E[h]=m;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],k="",b=null;for(let h of y){let m=h[1]||"",l=h[2]||"",V0=m.includes("server"),h0=M1(m),D0="";try{let{extractAndStripCssImports:q0,renderVendorStyleTags:X0}=await import("./chunk-qqt7b18y.js"),N0=q0(l,{filePath:L,projectRoot:process.cwd()});l=N0.code,D0=X0(N0.styles)}catch(q0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,q0 instanceof Error?q0.message:q0)}if(h0&&l.trim())l=T1(l);if(!V0){try{let{hasUserImports:X0,bundleClientScript:N0}=await import("./chunk-58x4e8m5.js");if(X0(l))l=await N0(l,L,{projectRoot:process.cwd()})}catch(X0){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,X0 instanceof Error?X0.message:X0)}let{stripStxRuntimeImports:q0}=await import("./chunk-wzyfsdr7.js");l=q0(l)}let y0=KY(l);if(y0&&!V0){b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$9}`;let q0=t0(l),X0=HY(q0,b);k+=`${D0}<script data-stx-scoped data-stx-run="always">${X0}</script>
3364
- `;continue}if(V0)try{let{extractVariables:q0}=await import("./chunk-t2sbh2xx.js");await q0(l,E,L)}catch(q0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,q0)}if(!V0&&!y0){let q0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$9}`;let X0=t0(l),N0=J9(X0,b),K0=X9(X0,N0);k+=`${D0}<script data-stx-scoped data-stx-run="always"${q0?` ${q0}`:""}>${K0}</script>
3365
- `}}if(b){let h=BY(D,b);if(D=h.html,h.mergedIntoExisting)k=k.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await d3(D,E,L,J,Y,Q);let{processLoops:C}=await import("./chunk-y8p9jhb6.js"),g=C(D,E,L);if(g=$1(g,E,L),g=O1(g,E,L),M)g+=`
3366
+ })();`}function BY($,Z){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]};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}}return{html:$,mergedIntoExisting:null}}var $9=0,uK=new F1(500),Y9=new Set;function dK(){Y9.clear()}function jY($){if($.__onceStore instanceof Set)return $.__onceStore;return Y9}async function d3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||W0.join(W0.dirname(X),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let q=zY($,"@partial","@include"),U=jY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,F,V)=>{let O=F.trim(),L=`${X}:${O}`;if(U.has(L))return"";return U.add(L),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let L=O.index,w=L+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),T=u3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),E=M.match(/^\s*['"]([^'"]+)['"]/);if(!E){V.lastIndex=D;continue}let I=E[1],y=M.substring(E[0].length),k,b=u3(y,0);if(b!==-1)k=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Q0(C)){let l=G0(C,Object.keys(Z));g=Boolean(l(...Object.values(Z)))}else g=Boolean(t(C,Z));let h=F?!g:g,m="";if(h){let l=W(I,G,X);if(l&&await Bun.file(l).exists())Y.add(l);m=`@include('${I}'${k?`, ${k}`:""})`}q=q.substring(0,L)+m+q.substring(D),V.lastIndex=0}catch(C){let g=C instanceof Error?C.message:String(C),h=z0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+h+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==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[,T,A,M,E]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=t(y,Z);let k="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},g=await H(T,C,$,V);k+=g}else if(E)k=await H(E,{},$,V);q=q.substring(0,V)+k+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+z0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==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 T=N[1],A=R.slice(N[0].length),M,E=A.match(/^\s*,\s*\{/);if(E){A=A.slice(E[0].length-1);let k=1,b=1;while(b<A.length&&k>0){if(A[b]==="{")k++;else if(A[b]==="}"){if(k--,k===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let k=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=w0(M,Z)}catch(g){let h=g instanceof Error?g.message:String(g);if(J.debug){let m=z0("Include",`Error parsing includeFirst variables: ${h}`,X,$,V,D);q=q.replace(D,()=>m)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let g of k){let h=W(g,G,X);if(!h)continue;if(await a(h)){let m=await H(g,b,$,V);q=q.replace(D,()=>m),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let g=z0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>g)}else q=q.replace(D,"")}catch(k){let b=k instanceof Error?k.message:String(k),C=z0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,F,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=W0.resolve(F),w=W0.resolve(W0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=W0.resolve(F,O);else R=W0.resolve(w,O);let D=W0.normalize(R),N=D.startsWith(L+W0.sep)||D===L,T=D.startsWith(w+W0.sep)||D===w,A=!1,M=W0.dirname(w);if(D.startsWith(M+W0.sep)){if(!W0.relative(M,D).split(W0.sep).some((k)=>k.startsWith(".")&&k!=="."&&k!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=W0.resolve(X);Q.add(z);function K(_,F,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:F,partialsDir:G}),z0("Include",F,X,V,O)}async function H(_,F={},V,O){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=W0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(h){let m=h instanceof Error?h.message:String(h);return K(_,`Error loading include file ${_}: ${m}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:h}=await import("./chunk-5a6dzmj8.js");R=h(R,Z)}if(R&&(J.debug||!_5()&&!s5()))try{let{warnUnbalancedTags:h}=await import("./chunk-p6gb0bak.js");h(R,L)}catch{}let D=R;try{let{processESImports:h}=await import("./chunk-8vgcye5c.js");await h(R,Z,L,J,Y)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,h instanceof Error?h.message:h)}let N=W$(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 E={...Z};E.__stx_signals_gate=Q1(R);for(let[h,m]of Object.entries(F))E[h]=m;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],k="",b=null;for(let h of y){let m=h[1]||"",l=h[2]||"",V0=m.includes("server"),h0=M1(m),D0="";try{let{extractAndStripCssImports:q0,renderVendorStyleTags:X0}=await import("./chunk-przv5z6z.js"),N0=q0(l,{filePath:L,projectRoot:process.cwd()});l=N0.code,D0=X0(N0.styles)}catch(q0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,q0 instanceof Error?q0.message:q0)}if(h0&&l.trim())l=T1(l);if(!V0){try{let{hasUserImports:X0,bundleClientScript:N0}=await import("./chunk-fad3d1g7.js");if(X0(l))l=await N0(l,L,{projectRoot:process.cwd()})}catch(X0){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,X0 instanceof Error?X0.message:X0)}let{stripStxRuntimeImports:q0}=await import("./chunk-8yn96bkr.js");l=q0(l)}let y0=KY(l);if(y0&&!V0){b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$9}`;let q0=t0(l),X0=HY(q0,b);k+=`${D0}<script data-stx-scoped data-stx-run="always">${X0}</script>
3367
+ `;continue}if(V0)try{let{extractVariables:q0}=await import("./chunk-47be2t3d.js");await q0(l,E,L)}catch(q0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,q0)}if(!V0&&!y0){let q0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$9}`;let X0=t0(l),N0=J9(X0,b),K0=X9(X0,N0);k+=`${D0}<script data-stx-scoped data-stx-run="always"${q0?` ${q0}`:""}>${K0}</script>
3368
+ `}}if(b){let h=BY(D,b);if(D=h.html,h.mergedIntoExisting)k=k.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await d3(D,E,L,J,Y,Q);let{processLoops:C}=await import("./chunk-f13qa3kb.js"),g=C(D,E,L);if(g=$1(g,E,L),g=O1(g,E,L),M)g+=`
3366
3369
  `+M;if(k)g+=`
3367
3370
  `+k;return g}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,F=_+j[0].length-1,V=1,O=F+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let L=q.substring(_,O),w=q.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=O;continue}let D=R[1],N,T=w.substring(R[0].length),A=u3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=w0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,z0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let E=await H(D,M,$,_);q=q.substring(0,_)+E+q.substring(O),B.lastIndex=0}return q}function m3($,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}\\(`),F=new RegExp(`@${G}(?![a-z])`),V=1,O=j,L=-1;while(V>0&&O<U.length){let R=U.slice(O),D=R.match(_),N=R.match(F),T=D?O+D.index:1/0,A=N?O+N.index:1/0;if(T<A)V++,O=T+(D[0].length||1);else if(A<1/0){if(V--,V===0){L=A;break}O=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function l3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3368
3371
  `)})}import*as c3 from"path";async function Q9($,Z,X=""){if(c3.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 q9($,Z,X,"@js","@endjs")}async function G9($,Z,X=""){if(c3.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 q9($,Z,X,"@ts","@endts")}async function q9($,Z,X,J,Y){let Q=$,G=g1(`${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 {};",L=`
@@ -3534,14 +3537,14 @@ document.addEventListener("focusout",function(e){
3534
3537
  ${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3535
3538
  `+$.slice(G)}if(W5($))return d5($,(G)=>`${G}
3536
3539
  ${Z}`);return`${Z}
3537
- ${$}`}async function F$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return Z4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return Z4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-atbpj3dh.js"),J=await X(Z.debug);return Z4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function FQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function e9($){if($.includes("data-stx-tooltip-runtime")||!FQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${$4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3540
+ ${$}`}async function F$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return Z4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return Z4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-s0b1p8tc.js"),J=await X(Z.debug);return Z4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function FQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function e9($){if($.includes("data-stx-tooltip-runtime")||!FQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${$4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3538
3541
  ${Z}`;return`${$.slice(0,X)}${Z}
3539
3542
  ${$.slice(X)}`}async function LQ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))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 o9(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${r9(q)};</script>
3540
- `}let{getCachedRouterScript:Y}=await import("./chunk-atbpj3dh.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+`
3543
+ `}let{getCachedRouterScript:Y}=await import("./chunk-s0b1p8tc.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+`
3541
3544
  </body>`+$.slice(G+7)}var $8=Symbol.for("stx.lazy-module-promises");function wQ(){let $=globalThis;return $[$8]??=new Map,$[$8]}function o($,Z){let X=wQ(),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 J4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,G8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function RQ($,Z={}){let X=[];for(let J of h5($,Y1)){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 q8($){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}=Z8(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}=Z8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Z8($){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 Q4($){return Q8($)}function DQ($){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 NQ($){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 AQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${J4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=h5($,(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=q8(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)||w$.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 X8=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(X8.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(X8.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function L$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(G8);if(Q&&TQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function TQ($,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 U8($,Z){let X=NQ($);function J(Y){let Q=Y,G=AQ(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(),F=j,V=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.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(F,O-6).trim(),D;if(DQ(R)){let N=F5(Q.substring(K,O));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(K);if(!(T.length>0&&T.every((I)=>J8(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return L$(y,"@else-if",I.condition??"");if(I.type==="else")return L$(y,"@else");return L$(y,"@if",I.condition??"")}).join(`
3542
3545
  `)}else{if(!J8(_,X,Z,q(K)))continue;D=L$(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 IQ($){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 w$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function W8($,Z,X,J){if(w$.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)||w$.has(Y)))q++}U=H+1}return-1}var kQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function EQ($,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 kQ.test(Q)}function z8($){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,_,F,V]=q,O=IQ(_);if(O===void 0)continue;let L=q.index,w=L+K.length,N=!!V||/\/\s*>$/.test(K)||w$.has(H.toLowerCase())?w:W8($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&EQ($,N)){Q.lastIndex=w;continue}if(O===!0){let A=`<${H}${B}${F}${V}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,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 K8($,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=q8(H),_=q==="for"?"@endfor":"@endforeach",F=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 L;while((L=O.exec(X))!==null)if(L[1].startsWith(q))F++;else if(F--,F===0){V=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:V,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,E=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||E)){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(G8),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}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 bQ($){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]!==`
3543
3546
  `)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]!==`
3544
- `)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 yQ($,Z,X){let J=RQ($,{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=[];for(let V of J){let O=V.body;if(M1(V.attrs))O=T1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(G).toString(36).slice(0,10)}`,{hasUserImports:U,bundleClientScript:W}=await o("stx/client-script-bundler",()=>import("./chunk-58x4e8m5.js")),z=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=A5(O).code,U(O))O=await W(O,Z||"",{projectRoot:process.cwd()});O=vQ(O);let L=t0(O);z.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3547
+ `)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 yQ($,Z,X){let J=RQ($,{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=[];for(let V of J){let O=V.body;if(M1(V.attrs))O=T1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(G).toString(36).slice(0,10)}`,{hasUserImports:U,bundleClientScript:W}=await o("stx/client-script-bundler",()=>import("./chunk-fad3d1g7.js")),z=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=A5(O).code,U(O))O=await W(O,Z||"",{projectRoot:process.cwd()});O=vQ(O);let L=t0(O);z.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3545
3548
  ${L}`)}let K=z.join(`
3546
3549
 
3547
3550
  `);K=bQ(K);let H=SQ(K),B=H.split(",").map((V)=>V.trim()).filter(Boolean),j=Y4(K,X),_=`
@@ -3619,9 +3622,9 @@ ${G.join(`
3619
3622
  `+Y.slice(Q)}async function I4($,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=Q1($);let Q=!Z.__stxProcessingDepth;if(Q)c4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!_5()&&!s5())&&X&&X.endsWith(".stx"))e8($,X);try{return await z7.timeAsync("template-processing",async()=>{let G=await _G($,Z,X,J,Y);if(Q)G=M4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??t8(),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),F=W.meta||[],V=new Set(F.map((N)=>o1(N)).filter(Boolean)),O={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!V.has(o1(N))),...F],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
3620
3623
  `),...W.htmlAttrs&&{htmlAttrs:d9(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=t3(G);if(G=p9(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=c9(G,q),G=m9(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=r8(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
3621
3624
  <meta name="stx-layout" content="${i8(N)}">
3622
- <meta name="stx-layout-group" content="${i8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?W5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=d5(G,(T,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=l9(G);let q=J.app?.colorMode;if(q)G=f9(G,q);G=g9(G),G=jG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-at4yzmym.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)+`
3623
- `+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-q9bbt522.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)+`
3624
- `+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-1aekxpev.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)+`
3625
+ <meta name="stx-layout-group" content="${i8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?W5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=d5(G,(T,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=l9(G);let q=J.app?.colorMode;if(q)G=f9(G,q);G=g9(G),G=jG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-fbhhzy5j.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)+`
3626
+ `+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-vcreetnm.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)+`
3627
+ `+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-kf8edvxc.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)+`
3625
3628
  `+z+G.slice(K.end)}}catch{}if(Q)G=x9(G);if(Q&&Z.__stx_inject_css!==!1)G=await a8(G,void 0,J.buildMode==="serve");if(Q)G=v9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof a5)throw G;let q=G instanceof Error?G.message:String(G),U=new R1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(m0.log(U,{filePath:X,context:Z}),W3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return q3.createFallbackContent("Template Processing",U)}}async function _G($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!T0.isAbsolute(J.partialsDir)?T0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!T0.isAbsolute(J.componentsDir)?T0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!T0.isAbsolute(J.layoutsDir)?T0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await FG(X,Z),OG(Z,q),U=await m1(()=>F9(U,Z,X,q),U,(L)=>{m0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=i0(U,q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let z=W.tokens,K=(L)=>z.length===0?L:L.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,(L,w)=>{return`{{ ${w} }}`}),U=T9(U),U=await d8(U,X,Y);let B={};U=m3(U,B);let j={...Z.__sections||{}},_="",F=T7(M7($)),V=/@nolayout\b/.test(U)||F===!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 F==="string"){if(_=F,!/@section\s*\(/.test(U))U=`@section('content')
3626
3629
  ${U.trim()}
3627
3630
  @endsection`}if(!_&&!V&&q.defaultLayout){let L=a3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=T0.dirname(X),N=q.layoutsDir?T0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=T0.join(D,"_layout.stx");if(await a(A)){R=A;break}let M=T0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=T0.isAbsolute(q.layoutsDir)?q.layoutsDir:T0.resolve(process.cwd(),q.layoutsDir),A=T0.join(T,`${q.defaultLayout}.stx`);if(await a(A))_=A}if(_&&!w)U=`@section('content')
@@ -3629,7 +3632,7 @@ ${U.trim()}
3629
3632
  @endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=t(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",y1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,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=l3(U,B),_){let L=[],w=n0(U),R=i0(w.output,v1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
3630
3633
  `);j.content=j.content?`${j.content}
3631
3634
  ${D}`:D,Z.__sections=j}}if(_)try{let L;if(T0.isAbsolute(_))L=_,Y.add(_);else L=await m1(()=>$$(_,X,G,Y),null,()=>{throw new R1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=T0.isAbsolute(I)?I:T0.resolve(process.cwd(),I);return HG.readdirSync(y).filter((k)=>k.endsWith(".stx")).map((k)=>k.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,k)=>k.indexOf(I)===y).sort(),E=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(m0.log(Error(E),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${E}`),G.debug)throw new R1(E,X);return U}let w=await m1(()=>Bun.file(L).text(),"",()=>{throw new R1(`Failed to read layout file: ${L}`,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 ${L}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,k,b)=>{return A[k]=b.trim(),""});for(let[y,k]of Object.entries(A))if(j[y]&&j[y].includes(y1)){let b=j[y].indexOf(y1);j[y]=j[y].slice(0,b)+k+j[y].slice(b+y1.length)}else if(!j[y])j[y]=k;let E={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await I4(I,E,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=m3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,E)=>{return T[M]=E.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,E)=>{if(j[M]){let I=j[M];if(I.includes(y1)){let y=T[M]||"",k=I.indexOf(y1);I=I.slice(0,k)+y+I.slice(k+y1.length)}return I}return E||""}),N=VG(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=l3(N,B),Z.__originalFilePath=X,U=await s8(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
3632
- ${U}`,K(U)}catch(L){return m0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await s8(U,Z,X,G,Y))}function VG($,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 OG($,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 FG($,Z){await m1(()=>R9($,Z),void 0,(X)=>{m0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function LG($,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 o("stx/variable-extractor",()=>import("./chunk-t2sbh2xx.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));m0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function wG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-bc250je5.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return m0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function s8($,Z,X,J,Y){let Q=$,G=J;if(await LG(Q,Z,X),Q=await wG(Q,Z,X),Q=await Q9(Q,Z,X),Q=await G9(Q,Z,X),Q=await m6(Q,Z,X,G),Q1(Q))Q=U8(Q,Z),Q=K8(Q,Z);Q=z8(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-k8y3m0kn.js"));Q=q(Q,Z),Q=B9(Q,Z,X,G),Q=await b9(Q,Z,X,G,Y),Q=await D4(Q,Z,X,G,Y),Q=A7(Q,Z,X,G);let{processDeferDirectives:U}=await o("stx/defer",()=>import("./chunk-r2zcdk2f.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await o("stx/teleport",()=>import("./chunk-6qtx7w2r.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await o("stx/transitions",()=>import("./chunk-w3pzxz3m.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-98pkw4t1.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await o("stx/suspense",()=>import("./chunk-myqyr2dp.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await o("stx/async-components",()=>import("./chunk-xddvx94h.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-ajjwrrmz.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:F,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-cda7v05f.js"));Q=F(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-6mk7fd7v.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-n07dds2d.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await o("stx/forms-validation",()=>import("./chunk-8g7xy48w.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:E}=await o("stx/head",()=>import("./chunk-v0tmvq31.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3635
+ ${U}`,K(U)}catch(L){return m0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await s8(U,Z,X,G,Y))}function VG($,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 OG($,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 FG($,Z){await m1(()=>R9($,Z),void 0,(X)=>{m0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function LG($,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 o("stx/variable-extractor",()=>import("./chunk-47be2t3d.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));m0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function wG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-e03bh9ze.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return m0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function s8($,Z,X,J,Y){let Q=$,G=J;if(await LG(Q,Z,X),Q=await wG(Q,Z,X),Q=await Q9(Q,Z,X),Q=await G9(Q,Z,X),Q=await m6(Q,Z,X,G),Q1(Q))Q=U8(Q,Z),Q=K8(Q,Z);Q=z8(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-5a6dzmj8.js"));Q=q(Q,Z),Q=B9(Q,Z,X,G),Q=await b9(Q,Z,X,G,Y),Q=await D4(Q,Z,X,G,Y),Q=A7(Q,Z,X,G);let{processDeferDirectives:U}=await o("stx/defer",()=>import("./chunk-r2zcdk2f.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await o("stx/teleport",()=>import("./chunk-6qtx7w2r.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await o("stx/transitions",()=>import("./chunk-w3pzxz3m.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-98pkw4t1.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await o("stx/suspense",()=>import("./chunk-myqyr2dp.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await o("stx/async-components",()=>import("./chunk-xddvx94h.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-ajjwrrmz.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:F,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-cda7v05f.js"));Q=F(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-6mk7fd7v.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-n07dds2d.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await o("stx/forms-validation",()=>import("./chunk-8g7xy48w.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:E}=await o("stx/head",()=>import("./chunk-v0tmvq31.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3633
3636
  `;if(Q=A(Q,Z),Q=M(Q,Z),Q=w9(Q),Q=D3(Q,Z),Q=d6(Q),Q=V9(Q),Q=await d3(Q,Z,X,G,Y),Q=await D4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=i4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=M4(Q),Q=$1(Q,Z,X),Q=k7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=N3(Q,Z),Q=A3(Q,Z),Q=R5(Q,Z),Q=y3(Q,Z),Q=S3(Q,Z),Q=await k6(Q,Z,X,G),Q=await v7(Q,Z,X),Q=await e6(Q,Z,X,G),Q=o8(Q,Z,X,G),Q=B6(Q,Z,X,G),Q=j6(Q,Z,X),Q=_6(Q,Z,X,G),Q=h6(Q,Z,X,G),Q=N4(Q,Z),Q=A4(Q),Q=m8(Q),!G.skipEventDirectives)Q=m4(Q,Z,X);if(Q=y7(Q,Z,X),G.debug){let i=/\bx-data\s*=/.test(Q),Z0=Q4($);if(i&&Z0)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3634
3637
  Both work on the same page, but they manage separate scopes.
3635
3638
  Prefer signals (state/derived/effect) for new components.`)}Q=A9(Q,Z),Q=await O1(Q,Z,X),Q=c8(Q),Q=p8(Q),Q=V7(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-bn0td54v.js"));Q=y(Q);let k=Z.__originalFilePath||X,b=I$(Z);if(Q=await H8(Q,G,k,b),Q=i6(Q,Z),Q=await L9(Q,Z,X,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:Z0}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-eyfmvy7z.js"));Q=await Z0(Q,{publicDir:i})}if(G.seo?.enabled)Q=V6(Q,Z,G);let C=(i,Z0,J0=!0)=>{if(!Z0)return i;let A0=Z0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),O0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&O0){if(J0)i=i.replace(O0[0],A0[0]);if(Z0=Z0.replace(A0[0],"").trim(),!Z0)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${Z0}
@@ -3643,7 +3646,7 @@ ${B7()}
3643
3646
  `+B1}else Q=Q.replace("</head>",`${Z0}
3644
3647
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3645
3648
  ${Z0}`);else Q=Z0+`
3646
- `+Q}{let{scanScriptTags:i}=await o("stx/signal-processing",()=>import("./chunk-wzyfsdr7.js")),Z0=[];for(let J0 of i(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let A0=J0.start+J0.fullMatch.indexOf(">")+1,O0=BG(Q,A0);if(O0===-1)continue;let p0=O0+9;while(p0<Q.length&&/\s/.test(Q[p0]))p0++;Z0.push({start:J0.start,end:p0})}for(let J0=Z0.length-1;J0>=0;J0--){let{start:A0,end:O0}=Z0[J0];Q=Q.substring(0,A0)+Q.substring(O0)}}let y0=j$(Q,X);if(y0.hasScoped)Q=y0.html;let q0=Z.__stx_event_bindings||[],X0=!1,N0=[],K0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:G5}=await o("stx/signal-processing",()=>import("./chunk-wzyfsdr7.js"));for(let i of G5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:Z0,content:J0}of N0){X0=!0;let A0=J0;T4(J0,X,J.strict,Z.__originalFilePath);let O0=await k$(J0,{eventBindings:q0,attrs:Z0,hasColonDirectives:K0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(i,()=>O0)}if(X0)Z.__stx_event_bindings=[];if(!X0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let Z0=P$(i);if(Z0){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+Z0:Q.slice(0,J0)+Z0+`
3649
+ `+Q}{let{scanScriptTags:i}=await o("stx/signal-processing",()=>import("./chunk-8yn96bkr.js")),Z0=[];for(let J0 of i(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let A0=J0.start+J0.fullMatch.indexOf(">")+1,O0=BG(Q,A0);if(O0===-1)continue;let p0=O0+9;while(p0<Q.length&&/\s/.test(Q[p0]))p0++;Z0.push({start:J0.start,end:p0})}for(let J0=Z0.length-1;J0>=0;J0--){let{start:A0,end:O0}=Z0[J0];Q=Q.substring(0,A0)+Q.substring(O0)}}let y0=j$(Q,X);if(y0.hasScoped)Q=y0.html;let q0=Z.__stx_event_bindings||[],X0=!1,N0=[],K0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:G5}=await o("stx/signal-processing",()=>import("./chunk-8yn96bkr.js"));for(let i of G5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:Z0,content:J0}of N0){X0=!0;let A0=J0;T4(J0,X,J.strict,Z.__originalFilePath);let O0=await k$(J0,{eventBindings:q0,attrs:Z0,hasColonDirectives:K0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(i,()=>O0)}if(X0)Z.__stx_event_bindings=[];if(!X0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let Z0=P$(i);if(Z0){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+Z0:Q.slice(0,J0)+Z0+`
3647
3650
  `+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!a9(Q)&&t9(Q))Q=await F$(Q,G);if(Q=e9(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=g6(Q,Z.cspNonce);return Q}var RG=[{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"}],DG=[{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')"}],NG=[{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 AG($){let Z=[],X=[];return MG($,Z),TG($,Z,X),IG($,X),kG($,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 TG($,Z,X){for(let J of RG){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 IG($,Z){for(let X of DG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function kG($,Z){for(let X of NG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function EG($,Z){let X=$.slice(0,Z).split(`
3648
3651
  `);return{line:X.length,column:X[X.length-1].length+1}}function bG($,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 yG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function SG($){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 r0 from"path";import Q5 from"process";var q2=["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"],$2=new Set(q2),CG=new Set(["props","$props","defineProps"]),PG=new Set(["stx","@stacksjs/stx"]);function vG($){let Z=[],X=0,J=$.split(`
3649
3652
  `);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 fG($){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 F=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),O=-1,L=0;for(let R=0;R<V.length;R++)if(V[R]==="<")L++;else if(V[R]===">")L--;else if(V[R]==="="&&L===0){O=R;break}let w=K?"...":"";if(O!==-1)return`${w}${F} = ${V.substring(O+1).trim()}`;return`${w}${F}`}).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,`
@@ -3665,11 +3668,11 @@ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:
3665
3668
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
3666
3669
  ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function iG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=H2(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3667
3670
  ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function Q2($,Z){let X=t($,Z)??t(`(${$})`,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 nG($,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=Q2(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=Q2(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function sG($){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 oG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var E5=new F1(500),b$=new F1(1000),b4=new F1(2000);function aG($){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 B2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function tG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function M1($){return!tG($)}var E$=new Map;function E4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=E$.get(Z);if(X)return X;if(E$.size>=16)E$.clear();let J=new Bun.Transpiler($);return E$.set(Z,J),J}function T1($){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=E4({loader:"ts",target:"browser",define:X5()}).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 eG($){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]!==`
3668
- `)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 F=_.trim().split(":");return F[F.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 $q($){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 Zq($){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 Xq($,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 $q(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=Zq(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 M$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let F of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(F))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=(F)=>{if(F&&!H.includes(F))H.push(F)},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 F of _)B(typeof F==="string"?F:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(x.resolve(x.dirname(J),`${Q}.stx`));for(let F of H){let V=x.isAbsolute(F)?F:x.resolve(K,F);for(let O of W)if(await a(x.join(V,O)))return!0}return!1}function Jq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Yq($){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 Qq($){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 k1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-t2sbh2xx.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"&&Jq(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let P=[F,F.toLowerCase(),j(F),_(F)];for(let u of P)if(O.has(u)){V=O.get(u);break}}let L=[];if(!V){let P=[`${F}.stx`,`${j(F)}.stx`,`${_(F)}.stx`],u=[...new Set(P)],Y0=Y.__originalFilePath,r=[];if(Y0){let U0=x.join(x.dirname(Y0),"components");r.push(U0)}if(J)r.push(J);let F0=G._rootComponentsDir;if(typeof F0==="string"&&!r.includes(F0))r.push(F0);let L0=x.join(x.dirname(Q),"components");if(!r.includes(L0))r.push(L0);if(G.componentsDir&&G.componentsDir!==J&&!r.includes(G.componentsDir))r.push(G.componentsDir);let v0=typeof G.root==="string"?x.resolve(G.root):void 0,a0=v0??x.dirname(Q),H0=[];if(v0)H0.push(x.resolve(v0,"resources/views/components")),H0.push(x.resolve(v0,"resources/components")),H0.push(x.resolve(v0,"src/components")),H0.push(x.resolve(v0,"components"));H0.push(x.resolve(import.meta.dir,"components"));for(let U0 of H0)if(!r.includes(U0))r.push(U0);let C1=G._pluginComponentDirs;if(Array.isArray(C1)){for(let U0 of C1)if(typeof U0==="string"&&!r.includes(U0))r.push(U0)}if(G.fallbackComponentsDir&&!r.includes(G.fallbackComponentsDir))r.push(G.fallbackComponentsDir);let j1=[...new Set(r.map((U0)=>{if(!U0)return U0;return x.isAbsolute(U0)?U0:x.resolve(a0,U0)}))];r.length=0,r.push(...j1);let s=`${F}\x00${Q}\x00${j1.join("\x00")}`,u0=b$.get(s);if(u0)if(await a(u0))V=u0;else b$.delete(s);if(!V&&(F.startsWith("./")||F.startsWith("../")))V=x.resolve(x.dirname(Q),`${F}.stx`),L.push(V);else if(!V)for(let U0 of r){if(!U0)continue;for(let _1 of u){let V1=x.join(U0,_1);if(L.push(V1),await a(V1)){V=V1;break}}if(V)break;if(!V)try{let _1=await import("fs");if(!_1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let y5=8,P1=[{path:U0,depth:0}];while(P1.length>0&&!V){let J1=P1.pop();if(J1.depth>=y5)continue;let P4;try{P4=_1.readdirSync(J1.path,{withFileTypes:!0})}catch{continue}for(let S5 of P4){if(!S5.isDirectory())continue;if(S5.name==="node_modules"||S5.name.startsWith("."))continue;let v4=x.join(J1.path,S5.name);for(let A2 of u){let S$=x.join(v4,A2);if(L.push(S$),await a(S$)){V=S$;break}}if(V)break;P1.push({path:v4,depth:J1.depth+1})}}}catch{}if(V)break}if(V)b$.set(s,V)}if(!V||!await a(V)){let P=L.length>0?`
3671
+ `)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 F=_.trim().split(":");return F[F.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 $q($){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 Zq($){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 Xq($,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 $q(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=Zq(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 M$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let F of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(F))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=(F)=>{if(F&&!H.includes(F))H.push(F)},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 F of _)B(typeof F==="string"?F:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(x.resolve(x.dirname(J),`${Q}.stx`));for(let F of H){let V=x.isAbsolute(F)?F:x.resolve(K,F);for(let O of W)if(await a(x.join(V,O)))return!0}return!1}function Jq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Yq($){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 Qq($){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 k1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-47be2t3d.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"&&Jq(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let P=[F,F.toLowerCase(),j(F),_(F)];for(let u of P)if(O.has(u)){V=O.get(u);break}}let L=[];if(!V){let P=[`${F}.stx`,`${j(F)}.stx`,`${_(F)}.stx`],u=[...new Set(P)],Y0=Y.__originalFilePath,r=[];if(Y0){let U0=x.join(x.dirname(Y0),"components");r.push(U0)}if(J)r.push(J);let F0=G._rootComponentsDir;if(typeof F0==="string"&&!r.includes(F0))r.push(F0);let L0=x.join(x.dirname(Q),"components");if(!r.includes(L0))r.push(L0);if(G.componentsDir&&G.componentsDir!==J&&!r.includes(G.componentsDir))r.push(G.componentsDir);let v0=typeof G.root==="string"?x.resolve(G.root):void 0,a0=v0??x.dirname(Q),H0=[];if(v0)H0.push(x.resolve(v0,"resources/views/components")),H0.push(x.resolve(v0,"resources/components")),H0.push(x.resolve(v0,"src/components")),H0.push(x.resolve(v0,"components"));H0.push(x.resolve(import.meta.dir,"components"));for(let U0 of H0)if(!r.includes(U0))r.push(U0);let C1=G._pluginComponentDirs;if(Array.isArray(C1)){for(let U0 of C1)if(typeof U0==="string"&&!r.includes(U0))r.push(U0)}if(G.fallbackComponentsDir&&!r.includes(G.fallbackComponentsDir))r.push(G.fallbackComponentsDir);let j1=[...new Set(r.map((U0)=>{if(!U0)return U0;return x.isAbsolute(U0)?U0:x.resolve(a0,U0)}))];r.length=0,r.push(...j1);let s=`${F}\x00${Q}\x00${j1.join("\x00")}`,u0=b$.get(s);if(u0)if(await a(u0))V=u0;else b$.delete(s);if(!V&&(F.startsWith("./")||F.startsWith("../")))V=x.resolve(x.dirname(Q),`${F}.stx`),L.push(V);else if(!V)for(let U0 of r){if(!U0)continue;for(let _1 of u){let V1=x.join(U0,_1);if(L.push(V1),await a(V1)){V=V1;break}}if(V)break;if(!V)try{let _1=await import("fs");if(!_1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let y5=8,P1=[{path:U0,depth:0}];while(P1.length>0&&!V){let J1=P1.pop();if(J1.depth>=y5)continue;let P4;try{P4=_1.readdirSync(J1.path,{withFileTypes:!0})}catch{continue}for(let S5 of P4){if(!S5.isDirectory())continue;if(S5.name==="node_modules"||S5.name.startsWith("."))continue;let v4=x.join(J1.path,S5.name);for(let A2 of u){let S$=x.join(v4,A2);if(L.push(S$),await a(S$)){V=S$;break}}if(V)break;P1.push({path:v4,depth:J1.depth+1})}}}catch{}if(V)break}if(V)b$.set(s,V)}if(!V||!await a(V)){let P=L.length>0?`
3669
3672
  Searched paths:
3670
3673
  ${L.map((u)=>` - ${u}`).join(`
3671
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(E5.has(V))w=E5.get(V);else try{w=await Bun.file(V).text(),E5.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",C5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=X;if(X.includes("@include")){let{processIncludes:P}=await o("stx/includes",()=>import("./chunk-v5fmahvj.js"));N=await P(X,Y,Q,G,U)}let T=n0(N),A=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let Y0=T.scripts[Number(u)]||"",r=Y0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=r.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test(r)&&L0)return A.push(Y0),"";return Y0}),{extractSlotContent:E}=await o("stx/slots",()=>import("./chunk-bjb61amk.js")),I=E(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[P,u]of I.namedSlots)y[P]=u.content;let k={...D,...Z,props:Z,slot:M,$slots:y,__processedComponents:K,__sections:{},__stx_signals_gate:Q1(w)||Yq(X)};Xq(w,k);let b=w,C=W$(b);if(C)b=C.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,h=[...w.matchAll(g)],m=[],l=h.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&h.every((P)=>/\bserver\b/.test(P[1]||"")),V0=null,h0=null;if(l){let P=aG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){V0=`${V}\x00${P}`;let u=b4.get(V0);if(u){for(let Y0 of u.dependencies)U.add(Y0);return u.output}h0=new Set(U)}}for(let P of h){let u=P[1]||"",Y0=P[2]||"",r=u.includes("server");if(M1(u)&&Y0.trim())Y0=T1(Y0);if(r&&Y0)try{await W(Y0,k,V)}catch(L0){}if(!r){let L0=Y0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=L0.includes("{{")&&L0.includes("}}"),a0=L0.includes("{!!")&&L0.includes("!!}");if(v0||a0)L0=x$(L0,k);let H0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${H0}>${L0}</script>`)}}let D0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),y0=D0?D0[1]:"",q0=D0?D0[2]:"",X0="",N0=y0&&/\bscoped\b/i.test(y0);if(D0)X0=`<style${y0}>${q0}</style>`;let K0=b;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D0)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(K0=K0.replace(P,(Y0,r)=>{let F0=r.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)u.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)X0=`${X0}${u.join(`
3672
- `)}`}if(X&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:G5}=await o("stx/slots",()=>import("./chunk-bjb61amk.js")),{defaultSlot:i,namedSlots:Z0}=I;K0=await G5(K0,i,Z0,k);let J0=m.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),A0=Qq(m),O0=Array.isArray(k.__stx_client_signal_names)?k.__stx_client_signal_names:[];if(A0.length>0||O0.length>0)k.__stx_client_signal_names=[...new Set([...O0,...A0])];let p0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:J0||m.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let B1=await I4(K0,k,V,p0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of B1.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},n=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++v.n}_${v.key}`,d=B1;if(J0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${B2(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${B2(B)}"`:"";d=`<div data-stx-scope="${n}"${P}${u}>${B1}</div>`;let Y0=await Promise.all(m.map(async(r)=>{let F0=r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return r;let[,L0,v0]=F0,a0=S4(v0,{filePath:V,projectRoot:process.cwd()}),H0=a0.code,C1=C4(a0.styles);H0=A5(H0).code;let{hasUserImports:j1,bundleClientScript:s}=await o("stx/client-script-bundler",()=>import("./chunk-58x4e8m5.js"));if(j1(H0))H0=await s(H0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{stripStxRuntimeImports:u0}=await o("stx/signal-processing",()=>import("./chunk-wzyfsdr7.js"));H0=u0(H0);let U0=t0(H0),_1=eG(U0),V1=`function(__scopeId) {
3674
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(E5.has(V))w=E5.get(V);else try{w=await Bun.file(V).text(),E5.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",C5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=X;if(X.includes("@include")){let{processIncludes:P}=await o("stx/includes",()=>import("./chunk-qaj72jrj.js"));N=await P(X,Y,Q,G,U)}let T=n0(N),A=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let Y0=T.scripts[Number(u)]||"",r=Y0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=r.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test(r)&&L0)return A.push(Y0),"";return Y0}),{extractSlotContent:E}=await o("stx/slots",()=>import("./chunk-15w5gfwe.js")),I=E(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[P,u]of I.namedSlots)y[P]=u.content;let k={...D,...Z,props:Z,slot:M,$slots:y,__processedComponents:K,__sections:{},__stx_signals_gate:Q1(w)||Yq(X)};Xq(w,k);let b=w,C=W$(b);if(C)b=C.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,h=[...w.matchAll(g)],m=[],l=h.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&h.every((P)=>/\bserver\b/.test(P[1]||"")),V0=null,h0=null;if(l){let P=aG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){V0=`${V}\x00${P}`;let u=b4.get(V0);if(u){for(let Y0 of u.dependencies)U.add(Y0);return u.output}h0=new Set(U)}}for(let P of h){let u=P[1]||"",Y0=P[2]||"",r=u.includes("server");if(M1(u)&&Y0.trim())Y0=T1(Y0);if(r&&Y0)try{await W(Y0,k,V)}catch(L0){}if(!r){let L0=Y0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=L0.includes("{{")&&L0.includes("}}"),a0=L0.includes("{!!")&&L0.includes("!!}");if(v0||a0)L0=x$(L0,k);let H0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${H0}>${L0}</script>`)}}let D0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),y0=D0?D0[1]:"",q0=D0?D0[2]:"",X0="",N0=y0&&/\bscoped\b/i.test(y0);if(D0)X0=`<style${y0}>${q0}</style>`;let K0=b;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D0)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(K0=K0.replace(P,(Y0,r)=>{let F0=r.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)u.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)X0=`${X0}${u.join(`
3675
+ `)}`}if(X&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:G5}=await o("stx/slots",()=>import("./chunk-15w5gfwe.js")),{defaultSlot:i,namedSlots:Z0}=I;K0=await G5(K0,i,Z0,k);let J0=m.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),A0=Qq(m),O0=Array.isArray(k.__stx_client_signal_names)?k.__stx_client_signal_names:[];if(A0.length>0||O0.length>0)k.__stx_client_signal_names=[...new Set([...O0,...A0])];let p0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:J0||m.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let B1=await I4(K0,k,V,p0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of B1.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},n=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++v.n}_${v.key}`,d=B1;if(J0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${B2(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${B2(B)}"`:"";d=`<div data-stx-scope="${n}"${P}${u}>${B1}</div>`;let Y0=await Promise.all(m.map(async(r)=>{let F0=r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return r;let[,L0,v0]=F0,a0=S4(v0,{filePath:V,projectRoot:process.cwd()}),H0=a0.code,C1=C4(a0.styles);H0=A5(H0).code;let{hasUserImports:j1,bundleClientScript:s}=await o("stx/client-script-bundler",()=>import("./chunk-fad3d1g7.js"));if(j1(H0))H0=await s(H0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{stripStxRuntimeImports:u0}=await o("stx/signal-processing",()=>import("./chunk-8yn96bkr.js"));H0=u0(H0);let U0=t0(H0),_1=eG(U0),V1=`function(__scopeId) {
3673
3676
  ${i1("const",[...j2,..._1],U0)}
3674
3677
  const __scope = window.stx._scopes = window.stx._scopes || {};
3675
3678
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -3721,7 +3724,7 @@ ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
3721
3724
  `,q)z+=`
3722
3725
  ${$0.blue}${$0.bold}Context:${$0.reset}
3723
3726
  ${$0.dim}${q}${$0.reset}
3724
- `;return z}function OV(){E5.clear(),b$.clear(),b4.clear()}function FV(){return{size:E5.size,maxSize:500}}var y$=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];var Uq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Wq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function zq($,Z){let X=Z;while(!0){let J=S1.join(X,"node_modules",$,"package.json");if(b5.existsSync(J))return S1.dirname(J);let Y=S1.dirname(X);if(Y===X)return null;X=Y}}function Kq($,Z){if(!$||typeof $!=="object")return null;let X=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),q=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:q}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function Hq($,Z){let X=Wq($);if(!X||!X.subpath)return null;let J=zq(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(b5.readFileSync(S1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=Kq(Y.exports,Q);if(!G)return null;let q=S1.resolve(J,G);return b5.existsSync(q)?q:null}function S4($,Z){let X=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[];return{code:$.replace(Uq,(q,U)=>{let W;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(W=U.startsWith("/")?U:S1.resolve(X,U),!b5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(U,J)}catch{z=Hq(U,J)}if(!z)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(Y.has(W))return"";Y.add(W);try{let z=b5.readFileSync(W,"utf8");Q.push({source:U,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function Bq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Bq(Z.source)}" data-stx-layer="vendor">
3727
+ `;return z}function OV(){E5.clear(),b$.clear(),b4.clear()}function FV(){return{size:E5.size,maxSize:500}}var y$=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useObjectUrl","useTimeoutFn"];var Uq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Wq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function zq($,Z){let X=Z;while(!0){let J=S1.join(X,"node_modules",$,"package.json");if(b5.existsSync(J))return S1.dirname(J);let Y=S1.dirname(X);if(Y===X)return null;X=Y}}function Kq($,Z){if(!$||typeof $!=="object")return null;let X=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),q=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:q}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function Hq($,Z){let X=Wq($);if(!X||!X.subpath)return null;let J=zq(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(b5.readFileSync(S1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=Kq(Y.exports,Q);if(!G)return null;let q=S1.resolve(J,G);return b5.existsSync(q)?q:null}function S4($,Z){let X=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[];return{code:$.replace(Uq,(q,U)=>{let W;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(W=U.startsWith("/")?U:S1.resolve(X,U),!b5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(U,J)}catch{z=Hq(U,J)}if(!z)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(Y.has(W))return"";Y.add(W);try{let z=b5.readFileSync(W,"utf8");Q.push({source:U,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function Bq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Bq(Z.source)}" data-stx-layer="vendor">
3725
3728
  @layer vendor {
3726
3729
  ${Z.contents}
3727
3730
  }
@@ -3791,7 +3794,7 @@ else {
3791
3794
  // STX: auto-generated event bindings
3792
3795
  ${$.map((X,J)=>Aq(X,J)).join(`
3793
3796
  `)}`}function F2($){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]!==`
3794
- `)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 Tq=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(!Tq.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 k$($,Z={}){let X=$,J="",Y=!1,Q=[],G=S4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=C4(G.styles),U=A5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-58x4e8m5.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=D2(X);X=O.code,J=N2(O.stxImports,O.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${Y4(X,Z.serverData)}${J}`,X=t0(X),!Y&&M1(Z.attrs||""))X=T1(X);let K=Mq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${L}>
3797
+ `)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 Tq=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(!Tq.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 k$($,Z={}){let X=$,J="",Y=!1,Q=[],G=S4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=C4(G.styles),U=A5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-fad3d1g7.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=D2(X);X=O.code,J=N2(O.stxImports,O.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${Y4(X,Z.serverData)}${J}`,X=t0(X),!Y&&M1(Z.attrs||""))X=T1(X);let K=Mq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${L}>
3795
3798
  ${r1(`${J}${X}
3796
3799
  ${K}`)}
3797
3800
  </script>`}let j=w2($),_=/function __stx_setup_/.test(X),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let L=O.length>0?`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Wi as a,Xi as b,Yi as c}from"./chunk-z5ecweqg.js";import"./chunk-ht51fz7w.js";import"./chunk-a0sagjwy.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import"./chunk-mv2v3g62.js";import"./chunk-7q6abr68.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
2
+ import{Wi as a,Xi as b,Yi as c}from"./chunk-1md5q98r.js";import"./chunk-ht51fz7w.js";import"./chunk-jwchwn52.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import"./chunk-mv2v3g62.js";import"./chunk-qtmearwp.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{gl as _,hl as h}from"./chunk-r84h7wxw.js";import{Ql as m,cs as p}from"./chunk-a0sagjwy.js";import{jt as N}from"./chunk-1px4xey5.js";import K from"path";import q from"fs";var l=5,u=1;function i(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function L(...J){if(i())console.log("[stx:bundler]",...J)}var D=[];function v(J,z,Y){D.push({filePath:J||"<inline>",message:z,details:Y})}function Yw(){return D.slice()}function Zw(){D.length=0}var F;function $w(J){F=J}function b(){if(F)return F;try{let J=p.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var f=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qw(J){let z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=z.exec(J))!==null){let M=Y[1];if(!f.some((w)=>w.test(M)))return L("detected user import:",M),!0}let Z=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=Z.exec(J))!==null){let M=Y[1];if(/\.css(?:\?.*)?$/.test(M))continue;if(!f.some((w)=>w.test(M)))return L("detected side-effect import:",M),!0}return!1}function t(J,z,Y,Z){let M=($,w)=>{let G=$===Y?z:K.dirname($),W=K.resolve(G,w),H=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,K.join(W,"index.ts"),K.join(W,"index.tsx"),K.join(W,"index.js"),K.join(W,"index.mjs")];for(let j of H)try{if(q.existsSync(j)&&q.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return W};return{name:"stx-client-bundle",setup($){$.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(w)=>({path:w.path,external:!0})),$.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(w)=>({path:w.path,external:!0})),$.onResolve({filter:/^\//},(w)=>{if(q.existsSync(w.path))return{path:w.path};return{path:w.path,external:!0}}),$.onResolve({filter:/^\.\.?\//},(w)=>{let G=M(w.importer,w.path);return Z.add(G),{path:G}}),$.onResolve({filter:/^[@~]\//},(w)=>{let G=K.resolve(J,w.path.slice(2)),W=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,K.join(G,"index.ts"),K.join(G,"index.tsx"),K.join(G,"index.js"),K.join(G,"index.mjs")];for(let H of W)if(q.existsSync(H)&&q.statSync(H,{throwIfNoEntry:!1})?.isFile())return L(`resolved ${w.path[0]}/ import:`,w.path,"\u2192",H),Z.add(H),{path:H};return console.warn(`[stx:bundler] could not resolve ${w.path[0]}/ import:`,w.path),{path:G}}),$.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(w)=>{let G=K.extname(w.path).toLowerCase(),W=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(w.path!==Y)Z.add(w.path);return{contents:q.readFileSync(w.path,"utf8"),loader:W}})}}}var R=new Map,g=Symbol.for("stx.client-bundle-build-queue");function s(J){let z=globalThis,Z=(z[g]??Promise.resolve()).then(J,J);return z[g]=Z.then(()=>{return},()=>{return}),Z}async function Xw(J,z,Y={}){let Z=Y.projectRoot||process.cwd(),M=Y.minify??!1,$=Y.cacheDir||N(Z,"bundle-cache"),w=new Bun.CryptoHasher("md5");w.update(`${l}\x00${J}\x00${z}`);let G=w.digest("hex").slice(0,12),W=K.join($,`${G}.js`),H=K.join($,`${G}.deps.json`),j=Bun.file(W);if(await j.exists()){let V=Bun.file(H),O=!0;if(await V.exists())try{let y=JSON.parse(await V.text());if(y.metadataVersion!==u||!Array.isArray(y.files))O=!1;for(let S of Array.isArray(y.files)?y.files:[])try{if(q.statSync(S.path).mtimeMs!==S.mtimeMs){O=!1;break}}catch{O=!1;break}}catch{O=!1}if(O)return L("cache hit:",G),await j.text();L("cache invalidated by dep change:",G)}let T=R.get(G);if(T)return await T;let x=s(()=>a(J,z,{projectRoot:Z,minify:M,cacheDir:$,hash:G,cachePath:W,depsPath:H}));R.set(G,x);try{return await x}finally{R.delete(G)}}async function a(J,z,Y){let{projectRoot:Z,minify:M,cacheDir:$,hash:w,cachePath:G,depsPath:W}=Y,H=N(Z,"bundle-tmp"),j=K.join(H,`${w}.ts`),T=K.join(H,"out",w);q.mkdirSync(H,{recursive:!0}),q.mkdirSync(T,{recursive:!0});let x=K.dirname(z),V=[],O=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,y=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,S;while((S=O.exec(J))!==null){if(S[1])continue;if(S[2])S[2].split(",").forEach((I)=>{let X=e(I);if(X)V.push(X)});else if(S[3])V.push(S[3])}while((S=y.exec(J))!==null){if(S[1])continue;V.push(S[2])}let B=V.length>0?`
2
+ import{gl as _,hl as h}from"./chunk-r84h7wxw.js";import{Ql as m,cs as p}from"./chunk-jwchwn52.js";import{jt as N}from"./chunk-1px4xey5.js";import K from"path";import q from"fs";var l=5,u=1;function i(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function L(...J){if(i())console.log("[stx:bundler]",...J)}var D=[];function v(J,z,Y){D.push({filePath:J||"<inline>",message:z,details:Y})}function Yw(){return D.slice()}function Zw(){D.length=0}var F;function $w(J){F=J}function b(){if(F)return F;try{let J=p.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var f=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qw(J){let z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=z.exec(J))!==null){let M=Y[1];if(!f.some((w)=>w.test(M)))return L("detected user import:",M),!0}let Z=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=Z.exec(J))!==null){let M=Y[1];if(/\.css(?:\?.*)?$/.test(M))continue;if(!f.some((w)=>w.test(M)))return L("detected side-effect import:",M),!0}return!1}function t(J,z,Y,Z){let M=($,w)=>{let G=$===Y?z:K.dirname($),W=K.resolve(G,w),H=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,K.join(W,"index.ts"),K.join(W,"index.tsx"),K.join(W,"index.js"),K.join(W,"index.mjs")];for(let j of H)try{if(q.existsSync(j)&&q.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return W};return{name:"stx-client-bundle",setup($){$.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(w)=>({path:w.path,external:!0})),$.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(w)=>({path:w.path,external:!0})),$.onResolve({filter:/^\//},(w)=>{if(q.existsSync(w.path))return{path:w.path};return{path:w.path,external:!0}}),$.onResolve({filter:/^\.\.?\//},(w)=>{let G=M(w.importer,w.path);return Z.add(G),{path:G}}),$.onResolve({filter:/^[@~]\//},(w)=>{let G=K.resolve(J,w.path.slice(2)),W=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,K.join(G,"index.ts"),K.join(G,"index.tsx"),K.join(G,"index.js"),K.join(G,"index.mjs")];for(let H of W)if(q.existsSync(H)&&q.statSync(H,{throwIfNoEntry:!1})?.isFile())return L(`resolved ${w.path[0]}/ import:`,w.path,"\u2192",H),Z.add(H),{path:H};return console.warn(`[stx:bundler] could not resolve ${w.path[0]}/ import:`,w.path),{path:G}}),$.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(w)=>{let G=K.extname(w.path).toLowerCase(),W=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(w.path!==Y)Z.add(w.path);return{contents:q.readFileSync(w.path,"utf8"),loader:W}})}}}var R=new Map,g=Symbol.for("stx.client-bundle-build-queue");function s(J){let z=globalThis,Z=(z[g]??Promise.resolve()).then(J,J);return z[g]=Z.then(()=>{return},()=>{return}),Z}async function Xw(J,z,Y={}){let Z=Y.projectRoot||process.cwd(),M=Y.minify??!1,$=Y.cacheDir||N(Z,"bundle-cache"),w=new Bun.CryptoHasher("md5");w.update(`${l}\x00${J}\x00${z}`);let G=w.digest("hex").slice(0,12),W=K.join($,`${G}.js`),H=K.join($,`${G}.deps.json`),j=Bun.file(W);if(await j.exists()){let V=Bun.file(H),O=!0;if(await V.exists())try{let y=JSON.parse(await V.text());if(y.metadataVersion!==u||!Array.isArray(y.files))O=!1;for(let S of Array.isArray(y.files)?y.files:[])try{if(q.statSync(S.path).mtimeMs!==S.mtimeMs){O=!1;break}}catch{O=!1;break}}catch{O=!1}if(O)return L("cache hit:",G),await j.text();L("cache invalidated by dep change:",G)}let T=R.get(G);if(T)return await T;let x=s(()=>a(J,z,{projectRoot:Z,minify:M,cacheDir:$,hash:G,cachePath:W,depsPath:H}));R.set(G,x);try{return await x}finally{R.delete(G)}}async function a(J,z,Y){let{projectRoot:Z,minify:M,cacheDir:$,hash:w,cachePath:G,depsPath:W}=Y,H=N(Z,"bundle-tmp"),j=K.join(H,`${w}.ts`),T=K.join(H,"out",w);q.mkdirSync(H,{recursive:!0}),q.mkdirSync(T,{recursive:!0});let x=K.dirname(z),V=[],O=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,y=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,S;while((S=O.exec(J))!==null){if(S[1])continue;if(S[2])S[2].split(",").forEach((I)=>{let X=e(I);if(X)V.push(X)});else if(S[3])V.push(S[3])}while((S=y.exec(J))!==null){if(S[1])continue;V.push(S[2])}let B=V.length>0?`
3
3
  export { ${V.join(", ")} }`:"";await Bun.write(j,J+B),L("bundling:",w,"from:",K.basename(z));let P=new Set;try{let I=await Bun.build({entrypoints:[j],outdir:T,target:"browser",format:"esm",minify:M,plugins:[t(Z,x,j,P)],define:{"process.env.NODE_ENV":M?'"production"':'"development"',...m()},root:Z});if(!I.success){let C=I.logs.filter((U)=>U.level==="error").map((U)=>U.message).join(", ")||`Unable to bundle ${K.basename(z)}`,A=_(I.logs,z||void 0);if(console.warn("[stx:bundler] build failed:",C),v(z||"",C,A),b()==="error")throw Error(C);return J}let X="";for(let Q of I.outputs){X=await Q.text();break}let k=[];for(let Q of X.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of Q[1].split(",")){let A=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(A){k.push([A[2],A[1]]);continue}let U=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(U))k.push([U,U])}let c=X.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];X=X.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let E=`__stxBundle_${w}`,o=k.map(([Q,C])=>`${JSON.stringify(Q)}: ${C}`).join(", "),n=k.map(([Q])=>`var ${Q} = undefined;`).join(`
4
4
  `),r=k.map(([Q])=>`${Q} = ${E}[${JSON.stringify(Q)}];`).join(`
5
5
  `);if(X=`${c.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pl as c,Sl as d,Tl as e,Ul as f,Vl as g,Wl as h,Xl as i,Yl as j,Zl as k,_l as l}from"./chunk-a0sagjwy.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import{Is as a,Js as b}from"./chunk-mv2v3g62.js";import"./chunk-7q6abr68.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{b as stripCommentsAndLiterals,e as renderVendorStyleTags,l as processClientScript,g as injectBrowserCoreAutoImports,k as generateServerDataBridge,i as generateBrowserAutoImportDestructuring,h as generateAutoImportDestructuring,a as findInterpolationEnd,j as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
2
+ import{Pl as c,Sl as d,Tl as e,Ul as f,Vl as g,Wl as h,Xl as i,Yl as j,Zl as k,_l as l}from"./chunk-jwchwn52.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import{Is as a,Js as b}from"./chunk-mv2v3g62.js";import"./chunk-qtmearwp.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{b as stripCommentsAndLiterals,e as renderVendorStyleTags,l as processClientScript,g as injectBrowserCoreAutoImports,k as generateServerDataBridge,i as generateBrowserAutoImportDestructuring,h as generateAutoImportDestructuring,a as findInterpolationEnd,j as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ns as a,Os as b,Ps as c,Qs as d,Rs as e,Ss as f,Ts as g,Us as h,Vs as i,Ws as j,Xs as k,Ys as l,Zs as m}from"./chunk-7q6abr68.js";import"./chunk-1px4xey5.js";import"./chunk-qs0fp63n.js";export{f as resolveUserCrosswindConfig,c as resetCssCache,d as resetCrosswindCache,i as rebuildCrosswindCSS,e as loadCrosswindConfig,b as loadCrosswind,m as injectCrosswindCSS,a as getCrosswindServeAsset,j as getCachedCSS,l as generateCrosswindCSS,g as fingerprintConfig,k as extractClassNames,h as buildCrosswindCSS};
2
+ import{Ns as a,Os as b,Ps as c,Qs as d,Rs as e,Ss as f,Ts as g,Us as h,Vs as i,Ws as j,Xs as k,Ys as l,Zs as m}from"./chunk-qtmearwp.js";import"./chunk-1px4xey5.js";import"./chunk-qs0fp63n.js";export{f as resolveUserCrosswindConfig,c as resetCssCache,d as resetCrosswindCache,i as rebuildCrosswindCSS,e as loadCrosswindConfig,b as loadCrosswind,m as injectCrosswindCSS,a as getCrosswindServeAsset,j as getCachedCSS,l as generateCrosswindCSS,g as fingerprintConfig,k as extractClassNames,h as buildCrosswindCSS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ap as a,Bp as b,Cp as c,Dp as d,Ep as e,Fp as f}from"./chunk-a0sagjwy.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import"./chunk-mv2v3g62.js";import"./chunk-7q6abr68.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
2
+ import{Ap as a,Bp as b,Cp as c,Dp as d,Ep as e,Fp as f}from"./chunk-jwchwn52.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import"./chunk-mv2v3g62.js";import"./chunk-qtmearwp.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$r as w,Eq as k,Gl as A,Hl as D,Rm as T,Sm as y,Wo as x,Yl as B,_l as F,bp as M,sp as R}from"./chunk-a0sagjwy.js";import{Ou as P}from"./chunk-qs0fp63n.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
2
+ import{$r as w,Eq as k,Gl as A,Hl as D,Rm as T,Sm as y,Wo as x,Yl as B,_l as F,bp as M,sp as R}from"./chunk-jwchwn52.js";import{Ou as P}from"./chunk-qs0fp63n.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${Q.join(`
14
14
  `)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=X.__stx_event_bindings||[],Y=B(X),Z=(await Promise.all(Q.map(async(V)=>{let W=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return V;return await F(W[1],{eventBindings:N,templateContent:q,serverData:Y,filePath:z})}))).join(`
15
15
  `);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
16
16
  $1`);else q+=`
17
- ${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-azrhea8j.js");q=await N(q)}catch{}return q}
17
+ ${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-pxzj5tzb.js");q=await N(q)}catch{}return q}
18
18
  export{b as pk,C as qk,j as rk,s as sk,i as tk,I as uk};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{jt as Jq}from"./chunk-1px4xey5.js";import{Ou as Gq}from"./chunk-qs0fp63n.js";import $ from"path";import{hasLocalConfig as Uq}from"bunfig";var a={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}};function m(G){return`--stx-${G}`}function p(G,q){let Q=q.lastIndexOf("-");if(Q===-1)return typeof G[q]==="string"?G[q]:void 0;let J=G[q.slice(0,Q)];if(!J||typeof J!=="object")return;let Y=J[q.slice(Q+1)];return typeof Y==="string"?Y:void 0}function o(G){let q={};for(let[Q,J]of Object.entries(a)){let Y=p(G,J.light);if(Y===void 0)continue;q[Q]=`var(${m(Q)}, ${Y})`}return q}function t(G){let q=[],Q=[];for(let[J,Y]of Object.entries(a)){let Z=p(G,Y.light),U=p(G,Y.dark);if(Z===void 0)continue;if(q.push(` ${m(J)}: ${Z};`),U!==void 0)Q.push(` ${m(J)}: ${U};`)}if(q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...q,"}",".dark {",...Q,"}",""].join(`
3
- `)}function s(G){return typeof G==="object"&&G!==null&&!Array.isArray(G)}function g(G,q){let Q={...G};for(let[J,Y]of Object.entries(q))Q[J]=s(Y)&&s(Q[J])?g(Q[J],Y):Y;return Q}function e(G={},q={}){let Q=G.theme||{},J=q.theme||{},{extend:Y,...Z}=J,{extend:U,...z}=Q,X=z.colors||{};z.colors={...X,...o(X)};let A=g(z,Z),L=g(U||{},Y||{});if(Object.keys(L).length>0)A.extend=L;let H=[...G.safelist||[],...q.safelist||[]],E={...G.shortcuts||{},...q.shortcuts||{}},P=[...G.preflights||[],...q.preflights||[]];return{config:{...G,...q,theme:A,safelist:H,shortcuts:E,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:H,shortcuts:E,includePreflight:q.preflight!==!1,minify:q.minify===!0,tokenCSS:t(X)}}var W={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var F=null,C=!1,_=null,b="",K=!1,Qq=256,V=new Map,O=new Map,j=null,d=null;function S(G){return Bun.hash(G).toString(16).padStart(16,"0").slice(0,16)}function u(G,q){if(V.has(G))V.delete(G);else if(V.size>=Qq)V.delete(V.keys().next().value);V.set(G,q)}function Wq(G){let q=S(G);if(O.has(q))O.delete(q);else if(O.size>=Qq)O.delete(O.keys().next().value);return O.set(q,G),q}function Dq(G){let q=O.get(G);if(q===void 0)return;return O.delete(G),O.set(G,q),q}async function Xq(G){if(!j)return null;try{let q=Bun.file($.join(j,`cw-${S(G)}.css`));if(!await q.exists())return null;return await q.text()}catch{return null}}async function zq(G,q){if(!j)return;try{if(!fs.existsSync(j))fs.mkdirSync(j,{recursive:!0});await Bun.write($.join(j,`cw-${S(G)}.css`),q)}catch{}}async function qq(G){try{let q=await import(G);if(q&&q.CSSGenerator)return{CSSGenerator:q.CSSGenerator,config:q.config,build:q.build,defaultConfig:q.defaultConfig,extractClasses:q.extractClasses}}catch{}return null}function Iq(){let G=[],q=process.cwd();while(q!==$.dirname(q))G.push($.join(q,"node_modules","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"node_modules","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"pantry","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"pantry","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"node_modules","@stacksjs","crosswind","dist","index.js")),G.push($.join(q,"pantry","@stacksjs","crosswind","dist","index.js")),q=$.dirname(q);return G}function Oq(){let G=[],q=process.env.HOME||process.env.USERPROFILE||"";if(q){let Q=[$.join(q,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),$.join(q,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];G.push(...Q)}return G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),G}async function Yq(){if(C)return F;C=!0;try{let G=async(Y)=>{for(let Z of Y){if(!await Bun.file(Z).exists())continue;let U=await qq(Z);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded from ${$.dirname($.dirname(Z))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Y=$.resolve(process.env.CROSSWIND_SRC),Z=await G([Y]);if(!Z)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return F=Z,F}let q=await G(Iq());if(q)return F=q,F;let Q=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Q){let Z=await qq(Y);if(Z){if(F=Z,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded`);return F}}let J=await G(Oq());if(J)return F=J,F;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${W.reset}`),null}}function Sq(){V.clear(),O.clear()}function xq(){F=null,C=!1,_=null,b="",V.clear(),O.clear(),d=null}async function Zq(G){try{if(!Uq({name:"crosswind",cwd:G}))return null;let{loadConfigWithResult:q}=await import("bunfig"),Q=await q({name:"crosswind",cwd:G,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Q?.path||!Q.config||Object.keys(Q.config).length===0)return null;let J=$.relative(G,Q.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} Loaded config from ${J||Q.path}`);return Q.config}catch(q){if(q instanceof Error&&q.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[Crosswind]${W.reset} Failed to load crosswind config:`,q instanceof Error?q.message:q),null}}async function _q(G){let q=null;try{let{loadStxConfig:Q}=await import("./chunk-kd3hbecq.js"),J=await Q(G);if(J.css)if(typeof J.css==="string"){let Y=$.isAbsolute(J.css)?J.css:$.resolve(G,J.css);if(await Bun.file(Y).exists()){let Z=await import(Y);q=Z.default||Z,console.log(`${W.green}[Crosswind]${W.reset} Loaded config from stx.config.ts \u2192 ${J.css}`)}}else{if(q={...J.css,content:J.css.content||[],preflight:J.css.preflight??!0,minify:J.css.minify??!1},J.css.config){let Y=$.isAbsolute(J.css.config)?J.css.config:$.resolve(G,J.css.config);if(await Bun.file(Y).exists()){let Z=await import(Y);q={...Z.default||Z,...q}}}console.log(`${W.green}[Crosswind]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return q||await Zq(G)}function Fq(G){try{let q=new WeakSet;return S(JSON.stringify(G??{},(Q,J)=>{if(typeof J==="function")return`[fn]${String(J)}`;if(typeof J==="object"&&J!==null){if(q.has(J))return"[circular]";q.add(J)}return J})??"")}catch{return"unhashable"}}async function Nq(G){if(K)return b;K=!0;try{let q=await Yq();if(!q||!q.build)return K=!1,"";if(!_)_=await Zq(G);if(!_)return K=!1,"";let Q=q.defaultConfig?.theme||{},J=_.theme||{},Y={...q.defaultConfig,..._,theme:{...Q,...J,extend:{...Q.extend||{},...J.extend||{}}}},Z=performance.now(),U=await q.build(Y),z=performance.now()-Z;if(b=U.css,console.log(`${W.cyan}[Crosswind]${W.reset} Built ${U.classes.size} classes in ${z.toFixed(1)}ms`),Y.output){let X=$.isAbsolute(Y.output)?Y.output:$.join(G,Y.output),A=$.dirname(X);if(!fs.existsSync(A))fs.mkdirSync(A,{recursive:!0});await Bun.write(X,U.css)}return K=!1,U.css}catch(q){return console.error(`${W.red}[Crosswind]${W.reset} Build error:`,q),K=!1,b}}async function kq(G){_=null,await Nq(G)}function wq(){return b}function Vq(G){let q=new Set,Q=/class\s*=\s*["']([^"']+)["']/gi,J=Q.exec(G);while(J!==null){for(let U of J[1].split(/\s+/))if(U.trim())q.add(U.trim());J=Q.exec(G)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Z=Y.exec(G);while(Z!==null){let U=Z[1].match(/'([^']+)'/g);if(U){for(let z of U)for(let X of z.slice(1,-1).split(/\s+/))if(X.trim())q.add(X.trim())}Z=Y.exec(G)}return q}async function jq(G,q){try{let Q=await Yq();if(!Q)return"";let J=typeof Q.extractClasses==="function"?Q.extractClasses(G):Vq(G);if(J.size===0)return"";let Y=q?$.resolve(q):process.cwd();if(!j)j=Jq(Y,"cache");let Z=[...J].sort().join(" "),U=`${d||"default"}::${Z}`,z=V.get(U);if(z!==void 0)return u(U,z),z;let X=await Xq(U);if(X!==null)return u(U,X),X;if(!_)_=await _q(Y),d=Fq(_);let A=Q.defaultConfig||Q.config,L=_||{},H=e(A,L),{safelist:E,includePreflight:P,minify:x,tokenCSS:$q}=H,h=H.config,R=new Q.CSSGenerator(h);for(let I of E)R.generate(I);for(let I of J)R.generate(I);let N=R.toCSS(P,x),i=h.shortcuts||L.shortcuts||{};for(let[I,k]of Object.entries(i)){if(!J.has(I)&&!E.includes(I))continue;let w=k.split(/\s+/).filter(Boolean);for(let T of w)R.generate(T)}N=R.toCSS(P,x);let B=N.split(`
3
+ `)}function s(G){return typeof G==="object"&&G!==null&&!Array.isArray(G)}function g(G,q){let Q={...G};for(let[J,Y]of Object.entries(q))Q[J]=s(Y)&&s(Q[J])?g(Q[J],Y):Y;return Q}function e(G={},q={}){let Q=G.theme||{},J=q.theme||{},{extend:Y,...Z}=J,{extend:U,...z}=Q,X=z.colors||{};z.colors={...X,...o(X)};let A=g(z,Z),L=g(U||{},Y||{});if(Object.keys(L).length>0)A.extend=L;let H=[...G.safelist||[],...q.safelist||[]],E={...G.shortcuts||{},...q.shortcuts||{}},P=[...G.preflights||[],...q.preflights||[]];return{config:{...G,...q,theme:A,safelist:H,shortcuts:E,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:H,shortcuts:E,includePreflight:q.preflight!==!1,minify:q.minify===!0,tokenCSS:t(X)}}var W={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var F=null,C=!1,_=null,b="",K=!1,Qq=256,V=new Map,O=new Map,j=null,d=null;function S(G){return Bun.hash(G).toString(16).padStart(16,"0").slice(0,16)}function u(G,q){if(V.has(G))V.delete(G);else if(V.size>=Qq)V.delete(V.keys().next().value);V.set(G,q)}function Wq(G){let q=S(G);if(O.has(q))O.delete(q);else if(O.size>=Qq)O.delete(O.keys().next().value);return O.set(q,G),q}function Dq(G){let q=O.get(G);if(q===void 0)return;return O.delete(G),O.set(G,q),q}async function Xq(G){if(!j)return null;try{let q=Bun.file($.join(j,`cw-${S(G)}.css`));if(!await q.exists())return null;return await q.text()}catch{return null}}async function zq(G,q){if(!j)return;try{if(!fs.existsSync(j))fs.mkdirSync(j,{recursive:!0});await Bun.write($.join(j,`cw-${S(G)}.css`),q)}catch{}}async function qq(G){try{let q=await import(G);if(q&&q.CSSGenerator)return{CSSGenerator:q.CSSGenerator,config:q.config,build:q.build,defaultConfig:q.defaultConfig,extractClasses:q.extractClasses}}catch{}return null}function Iq(){let G=[],q=process.cwd();while(q!==$.dirname(q))G.push($.join(q,"node_modules","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"node_modules","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"pantry","@cwcss","crosswind","dist","index.js")),G.push($.join(q,"pantry","@cwcss","crosswind","src","index.ts")),G.push($.join(q,"node_modules","@stacksjs","crosswind","dist","index.js")),G.push($.join(q,"pantry","@stacksjs","crosswind","dist","index.js")),q=$.dirname(q);return G}function Oq(){let G=[],q=process.env.HOME||process.env.USERPROFILE||"";if(q){let Q=[$.join(q,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),$.join(q,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),$.join(q,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),$.join(q,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];G.push(...Q)}return G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),G.push($.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),G}async function Yq(){if(C)return F;C=!0;try{let G=async(Y)=>{for(let Z of Y){if(!await Bun.file(Z).exists())continue;let U=await qq(Z);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded from ${$.dirname($.dirname(Z))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Y=$.resolve(process.env.CROSSWIND_SRC),Z=await G([Y]);if(!Z)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return F=Z,F}let q=await G(Iq());if(q)return F=q,F;let Q=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Q){let Z=await qq(Y);if(Z){if(F=Z,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} CSS engine loaded`);return F}}let J=await G(Oq());if(J)return F=J,F;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${W.reset}`),null}}function Sq(){V.clear(),O.clear()}function xq(){F=null,C=!1,_=null,b="",V.clear(),O.clear(),d=null}async function Zq(G){try{if(!Uq({name:"crosswind",cwd:G}))return null;let{loadConfigWithResult:q}=await import("bunfig"),Q=await q({name:"crosswind",cwd:G,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Q?.path||!Q.config||Object.keys(Q.config).length===0)return null;let J=$.relative(G,Q.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[Crosswind]${W.reset} Loaded config from ${J||Q.path}`);return Q.config}catch(q){if(q instanceof Error&&q.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[Crosswind]${W.reset} Failed to load crosswind config:`,q instanceof Error?q.message:q),null}}async function _q(G){let q=null;try{let{loadStxConfig:Q}=await import("./chunk-0hatcb1t.js"),J=await Q(G);if(J.css)if(typeof J.css==="string"){let Y=$.isAbsolute(J.css)?J.css:$.resolve(G,J.css);if(await Bun.file(Y).exists()){let Z=await import(Y);q=Z.default||Z,console.log(`${W.green}[Crosswind]${W.reset} Loaded config from stx.config.ts \u2192 ${J.css}`)}}else{if(q={...J.css,content:J.css.content||[],preflight:J.css.preflight??!0,minify:J.css.minify??!1},J.css.config){let Y=$.isAbsolute(J.css.config)?J.css.config:$.resolve(G,J.css.config);if(await Bun.file(Y).exists()){let Z=await import(Y);q={...Z.default||Z,...q}}}console.log(`${W.green}[Crosswind]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return q||await Zq(G)}function Fq(G){try{let q=new WeakSet;return S(JSON.stringify(G??{},(Q,J)=>{if(typeof J==="function")return`[fn]${String(J)}`;if(typeof J==="object"&&J!==null){if(q.has(J))return"[circular]";q.add(J)}return J})??"")}catch{return"unhashable"}}async function Nq(G){if(K)return b;K=!0;try{let q=await Yq();if(!q||!q.build)return K=!1,"";if(!_)_=await Zq(G);if(!_)return K=!1,"";let Q=q.defaultConfig?.theme||{},J=_.theme||{},Y={...q.defaultConfig,..._,theme:{...Q,...J,extend:{...Q.extend||{},...J.extend||{}}}},Z=performance.now(),U=await q.build(Y),z=performance.now()-Z;if(b=U.css,console.log(`${W.cyan}[Crosswind]${W.reset} Built ${U.classes.size} classes in ${z.toFixed(1)}ms`),Y.output){let X=$.isAbsolute(Y.output)?Y.output:$.join(G,Y.output),A=$.dirname(X);if(!fs.existsSync(A))fs.mkdirSync(A,{recursive:!0});await Bun.write(X,U.css)}return K=!1,U.css}catch(q){return console.error(`${W.red}[Crosswind]${W.reset} Build error:`,q),K=!1,b}}async function kq(G){_=null,await Nq(G)}function wq(){return b}function Vq(G){let q=new Set,Q=/class\s*=\s*["']([^"']+)["']/gi,J=Q.exec(G);while(J!==null){for(let U of J[1].split(/\s+/))if(U.trim())q.add(U.trim());J=Q.exec(G)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Z=Y.exec(G);while(Z!==null){let U=Z[1].match(/'([^']+)'/g);if(U){for(let z of U)for(let X of z.slice(1,-1).split(/\s+/))if(X.trim())q.add(X.trim())}Z=Y.exec(G)}return q}async function jq(G,q){try{let Q=await Yq();if(!Q)return"";let J=typeof Q.extractClasses==="function"?Q.extractClasses(G):Vq(G);if(J.size===0)return"";let Y=q?$.resolve(q):process.cwd();if(!j)j=Jq(Y,"cache");let Z=[...J].sort().join(" "),U=`${d||"default"}::${Z}`,z=V.get(U);if(z!==void 0)return u(U,z),z;let X=await Xq(U);if(X!==null)return u(U,X),X;if(!_)_=await _q(Y),d=Fq(_);let A=Q.defaultConfig||Q.config,L=_||{},H=e(A,L),{safelist:E,includePreflight:P,minify:x,tokenCSS:$q}=H,h=H.config,R=new Q.CSSGenerator(h);for(let I of E)R.generate(I);for(let I of J)R.generate(I);let N=R.toCSS(P,x),i=h.shortcuts||L.shortcuts||{};for(let[I,k]of Object.entries(i)){if(!J.has(I)&&!E.includes(I))continue;let w=k.split(/\s+/).filter(Boolean);for(let T of w)R.generate(T)}N=R.toCSS(P,x);let B=N.split(`
4
4
  `);for(let[I,k]of Object.entries(i)){if(!J.has(I)&&!E.includes(I))continue;let w=k.split(/\s+/).filter(Boolean),T=[],y=[];for(let v of w){let c=v.startsWith("dark:"),n=`.${(c?v.slice(5):v).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let M=0;M<B.length;M++){let l=B[M].trim();if(l===`${n} {`||l.startsWith(`${n} {`)){let D=M,r="";while(D<B.length){if(r+=B[D],B[D].includes("}"))break;D++}let f=r.match(/\{([^}]+)\}/);if(f)if(c)y.push(f[1].trim());else T.push(f[1].trim());break}}}if(T.length)N+=`
5
5
  .${I} { ${T.join(" ")} }`;if(y.length)N+=`
6
6
  @media (prefers-color-scheme: dark) { .dark .${I} { ${y.join(" ")} } }`}return N=$q+N,u(U,N),zq(U,N),N}catch(Q){return console.warn("Failed to generate Crosswind CSS:",Q),""}}async function yq(G,q,Q=!1){let J=await jq(G,q);if(!J)return G;let Y=Q?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Wq(J)}.css">`:`<style data-crosswind="generated">
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{jg as a}from"./chunk-c2xhf8re.js";import"./chunk-a0sagjwy.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import"./chunk-mv2v3g62.js";import"./chunk-7q6abr68.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{a as buildApp};
2
+ import{jg as a}from"./chunk-z4f3gahw.js";import"./chunk-jwchwn52.js";import"./chunk-092sm06a.js";import"./chunk-19m7hed6.js";import"./chunk-nhn7qftp.js";import"./chunk-mv2v3g62.js";import"./chunk-qtmearwp.js";import"./chunk-2qkasmq1.js";import"./chunk-1px4xey5.js";import"./chunk-a8fx6wcb.js";import"./chunk-x41v697c.js";import"./chunk-ax56kn66.js";import"./chunk-z2gmz9ew.js";import"./chunk-k26kt6fp.js";import"./chunk-qs0fp63n.js";export{a as buildApp};