@stacksjs/stx 0.2.229 → 0.2.230

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{chunk-evnm04mk.js → chunk-0939bnyw.js} +2 -2
  2. package/dist/{chunk-v6015c7x.js → chunk-1tmhht43.js} +1 -1
  3. package/dist/{chunk-yj90q1bk.js → chunk-40rqwfqt.js} +1 -1
  4. package/dist/{chunk-c6y91qmt.js → chunk-4bbyk43z.js} +1 -1
  5. package/dist/{chunk-bxb8v1ev.js → chunk-4j8vpk72.js} +8 -8
  6. package/dist/{chunk-0aj80aj9.js → chunk-5fy1k8m0.js} +1 -1
  7. package/dist/{chunk-3nnja4z6.js → chunk-764km47e.js} +1 -1
  8. package/dist/{chunk-9vnc4a3b.js → chunk-7918r5qc.js} +1 -1
  9. package/dist/{chunk-d4tnecbv.js → chunk-8309r1ea.js} +1 -1
  10. package/dist/{chunk-8mt7gk35.js → chunk-8m0p3v0e.js} +1 -1
  11. package/dist/{chunk-k9gdaetd.js → chunk-9ny96ccv.js} +1 -1
  12. package/dist/{chunk-ctdrjf3m.js → chunk-a0a7vmgm.js} +1 -1
  13. package/dist/{chunk-4tqmx6dd.js → chunk-akh7aqh0.js} +1 -1
  14. package/dist/{chunk-yfj7tc37.js → chunk-apk45qqk.js} +1 -1
  15. package/dist/{chunk-ywpcqmrz.js → chunk-c4a2kfj0.js} +1 -1
  16. package/dist/{chunk-k8kx4npc.js → chunk-cddj2p27.js} +1 -1
  17. package/dist/{chunk-5qhjeyp4.js → chunk-cges9wnq.js} +1 -1
  18. package/dist/{chunk-mkfeqges.js → chunk-dedefnzd.js} +1 -1
  19. package/dist/{chunk-vy253t51.js → chunk-dk06jv4n.js} +1 -1
  20. package/dist/{chunk-tswv4p1r.js → chunk-en8ajb6b.js} +1 -1
  21. package/dist/{chunk-ypq3brzq.js → chunk-erwwmzym.js} +1 -1
  22. package/dist/{chunk-s3sa0z97.js → chunk-g3qcyeb1.js} +1 -1
  23. package/dist/{chunk-z61y1yv1.js → chunk-h1jzzy6t.js} +25 -25
  24. package/dist/{chunk-qanmpzke.js → chunk-hkn78n7a.js} +1 -1
  25. package/dist/{chunk-pnarrxms.js → chunk-jrcm4vzs.js} +1 -1
  26. package/dist/{chunk-07n6dv48.js → chunk-n2fhxh9a.js} +1 -1
  27. package/dist/{chunk-0wcpp78j.js → chunk-n4ecxe8x.js} +2 -2
  28. package/dist/{chunk-87m6cyay.js → chunk-nwxd1jee.js} +1 -1
  29. package/dist/{chunk-rhdr9jp2.js → chunk-p13ggd30.js} +1 -1
  30. package/dist/{chunk-nxf2s46y.js → chunk-p58b19t0.js} +1 -1
  31. package/dist/{chunk-b318zf0z.js → chunk-paz6f4m5.js} +1 -1
  32. package/dist/{chunk-8qhyzqk6.js → chunk-rfky5t3a.js} +1 -1
  33. package/dist/{chunk-edydd6c9.js → chunk-rfpg019d.js} +1 -1
  34. package/dist/{chunk-6ge7t20t.js → chunk-s3x1p8ff.js} +1 -1
  35. package/dist/{chunk-17zts4jt.js → chunk-t7zk4x6s.js} +1 -1
  36. package/dist/{chunk-53wyachb.js → chunk-v7fsv3wn.js} +1 -1
  37. package/dist/{chunk-yjzznatw.js → chunk-vy3brhf3.js} +1 -1
  38. package/dist/{chunk-2n82qm71.js → chunk-wbegam4r.js} +1 -1
  39. package/dist/{chunk-z8v3qtzk.js → chunk-x7rf15d3.js} +1 -1
  40. package/dist/{chunk-g29rxrje.js → chunk-y8g3d192.js} +1 -1
  41. package/dist/{chunk-rgxtc72z.js → chunk-zbsnkmne.js} +1 -1
  42. package/dist/{chunk-n3ba1kf9.js → chunk-zd7bn188.js} +1 -1
  43. package/dist/cli.js +7 -7
  44. package/dist/craft-entry.js +1 -1
  45. package/dist/craft.js +1 -1
  46. package/dist/pwa.js +1 -1
  47. package/dist/ssg.js +2 -2
  48. package/dist/types/config-types.d.ts +17 -0
  49. package/dist/utils.js +3 -0
  50. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{hs as i2,rs as F6,ss as L6}from"./chunk-by2p4by1.js";import{ys as p5}from"./chunk-a2ppgamd.js";import{Gs as i0}from"./chunk-nstqd54d.js";import{Ws as s2}from"./chunk-yjzznatw.js";import{Xs as _2}from"./chunk-kqjxwz6c.js";import{ct as w6,et as R6,ft as D6,ht as V5}from"./chunk-t0jzk81v.js";import{it as o2,mt as e5,ot as J8}from"./chunk-njc6sven.js";import{zt as r2}from"./chunk-70v7vvry.js";import{At as V8,Bt as K8,Ct as c1,Dt as O8,Et as x4,Ft as J2,Gt as w9,Ht as P2}from"./chunk-myh6j9ab.js";import{Qt as t3,Tt as c9,_t as c3,pu as n2,ru as QG,su as i$,uu as z5}from"./chunk-bqdbf8k2.js";import{zu as N6}from"./chunk-ge69r310.js";import{Eu as f}from"./chunk-q891e1vj.js";import y1 from"path";import E5 from"fs";var P4=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"]),v4={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"},N8=new Set(["ctrl","alt","shift","meta"]),g4={left:0,middle:1,right:2};function f4($){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(N8.has(J))Z.systemKeys.push(J);else if(J in g4)Z.mouse=J;else if(J in v4||/^[a-z]$/.test(J))Z.keys.push(v4[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 h4($){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[,_,O]=B,V=_.split("."),F=V[0];if(!P4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:f4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,O]=B,V=_.split("."),F=V[0];if(!P4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:f4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function A8($){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=g4[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 M8($,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 S$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function T8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=A8($),Y=M8(S$($.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{hs as i2,rs as F6,ss as L6}from"./chunk-by2p4by1.js";import{ys as p5}from"./chunk-a2ppgamd.js";import{Gs as i0}from"./chunk-nstqd54d.js";import{Ws as s2}from"./chunk-vy3brhf3.js";import{Xs as _2}from"./chunk-kqjxwz6c.js";import{ct as w6,et as R6,ft as D6,ht as V5}from"./chunk-t0jzk81v.js";import{it as o2,mt as e5,ot as J8}from"./chunk-njc6sven.js";import{zt as r2}from"./chunk-70v7vvry.js";import{At as V8,Bt as K8,Ct as c1,Dt as O8,Et as x4,Ft as J2,Gt as w9,Ht as P2}from"./chunk-myh6j9ab.js";import{Qt as t3,Tt as c9,_t as c3,pu as n2,ru as QG,su as i$,uu as z5}from"./chunk-bqdbf8k2.js";import{zu as N6}from"./chunk-ge69r310.js";import{Eu as f}from"./chunk-q891e1vj.js";import y1 from"path";import E5 from"fs";var P4=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"]),v4={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"},N8=new Set(["ctrl","alt","shift","meta"]),g4={left:0,middle:1,right:2};function f4($){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(N8.has(J))Z.systemKeys.push(J);else if(J in g4)Z.mouse=J;else if(J in v4||/^[a-z]$/.test(J))Z.keys.push(v4[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 h4($){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[,_,O]=B,V=_.split("."),F=V[0];if(!P4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:f4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,O]=B,V=_.split("."),F=V[0];if(!P4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:f4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function A8($){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=g4[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 M8($,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 S$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function T8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=A8($),Y=M8(S$($.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;
@@ -3360,9 +3360,9 @@ ${e6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3360
3360
  } finally {
3361
3361
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3362
3362
  }
3363
- })();`}function KY($,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 t6=0,vK=new O1(500),X9=new Set;function fK(){X9.clear()}function HY($){if($.__onceStore instanceof Set)return $.__onceStore;return X9}async function u3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||q0.join(q0.dirname(X),"partials");if(G&&!q0.isAbsolute(G))G=q0.resolve(process.cwd(),G);let q=UY($,"@partial","@include"),U=HY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let F=O.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+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(F+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[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=V.exec(q))!==null){let L=F.index,w=L+F[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=h3(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=h3(y,0);if(b!==-1)k=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Q0(C)){let c=G0(C,Object.keys(Z));g=Boolean(c(...Object.values(Z)))}else g=Boolean(t(C,Z));let h=O?!g:g,m="";if(h){let c=W(I,G,X);if(c&&await Bun.file(c).exists())Y.add(c);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=W0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+h+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+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(F+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)+W0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+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(F+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=F0(M,Z)}catch(g){let h=g instanceof Error?g.message:String(g);if(J.debug){let m=W0("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=W0("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=W0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,O,V){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=q0.resolve(O),w=q0.resolve(q0.dirname(V)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=q0.resolve(O,F);else R=q0.resolve(w,F);let D=q0.normalize(R),N=D.startsWith(L+q0.sep)||D===L,T=D.startsWith(w+q0.sep)||D===w,A=!1,M=q0.dirname(w);if(D.startsWith(M+q0.sep)){if(!q0.relative(M,D).split(q0.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(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let z=q0.resolve(X);Q.add(z);function K(_,O,V,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),W0("Include",O,X,V,F)}async function H(_,O={},V,F){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,F);let w=q0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>q0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,F)}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,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:h}=await import("./chunk-qanmpzke.js");R=h(R,Z)}if(R&&(J.debug||!j5()&&!s5()))try{let{warnUnbalancedTags:h}=await import("./chunk-wkmd8pfh.js");h(R,L)}catch{}let D=R;try{let{processESImports:h}=await import("./chunk-vy253t51.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=G1(R);for(let[h,m]of Object.entries(O))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]||"",c=h[2]||"",V0=m.includes("server"),g0=A1(m),w0="";try{let{extractAndStripCssImports:J0,renderVendorStyleTags:U0}=await import("./chunk-n3ba1kf9.js"),M0=J0(c,{filePath:L,projectRoot:process.cwd()});c=M0.code,w0=U0(M0.styles)}catch(J0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,J0 instanceof Error?J0.message:J0)}if(g0&&c.trim())c=M1(c);if(!V0)try{let{hasUserImports:J0,bundleClientScript:U0}=await import("./chunk-yj90q1bk.js");if(J0(c))c=await U0(c,L,{projectRoot:process.cwd()})}catch(J0){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,J0 instanceof Error?J0.message:J0)}let b0=WY(c);if(b0&&!V0){b=`stx_scope_${q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++t6}`;let J0=r0(c),U0=zY(J0,b);k+=`${w0}<script data-stx-scoped data-stx-run="always">${U0}</script>
3364
- `;continue}if(V0)try{let{extractVariables:J0}=await import("./chunk-pnarrxms.js");await J0(c,E,L)}catch(J0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,J0)}if(!V0&&!b0){let J0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++t6}`;let U0=r0(c),M0=Z9(U0,b),z0=$9(U0,M0);k+=`${w0}<script data-stx-scoped data-stx-run="always"${J0?` ${J0}`:""}>${z0}</script>
3365
- `}}if(b){let h=KY(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 u3(D,E,L,J,Y,Q);let{processLoops:C}=await import("./chunk-2n82qm71.js"),g=C(D,E,L);if(g=t0(g,E,L),g=V1(g,E,L),M)g+=`
3363
+ })();`}function KY($,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 t6=0,vK=new O1(500),X9=new Set;function fK(){X9.clear()}function HY($){if($.__onceStore instanceof Set)return $.__onceStore;return X9}async function u3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||q0.join(q0.dirname(X),"partials");if(G&&!q0.isAbsolute(G))G=q0.resolve(process.cwd(),G);let q=UY($,"@partial","@include"),U=HY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let F=O.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+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(F+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[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=V.exec(q))!==null){let L=F.index,w=L+F[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=h3(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=h3(y,0);if(b!==-1)k=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Q0(C)){let c=G0(C,Object.keys(Z));g=Boolean(c(...Object.values(Z)))}else g=Boolean(t(C,Z));let h=O?!g:g,m="";if(h){let c=W(I,G,X);if(c&&await Bun.file(c).exists())Y.add(c);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=W0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+h+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+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(F+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)+W0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+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(F+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=F0(M,Z)}catch(g){let h=g instanceof Error?g.message:String(g);if(J.debug){let m=W0("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=W0("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=W0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,O,V){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=q0.resolve(O),w=q0.resolve(q0.dirname(V)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=q0.resolve(O,F);else R=q0.resolve(w,F);let D=q0.normalize(R),N=D.startsWith(L+q0.sep)||D===L,T=D.startsWith(w+q0.sep)||D===w,A=!1,M=q0.dirname(w);if(D.startsWith(M+q0.sep)){if(!q0.relative(M,D).split(q0.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(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let z=q0.resolve(X);Q.add(z);function K(_,O,V,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),W0("Include",O,X,V,F)}async function H(_,O={},V,F){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,F);let w=q0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>q0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,F)}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,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:h}=await import("./chunk-hkn78n7a.js");R=h(R,Z)}if(R&&(J.debug||!j5()&&!s5()))try{let{warnUnbalancedTags:h}=await import("./chunk-wkmd8pfh.js");h(R,L)}catch{}let D=R;try{let{processESImports:h}=await import("./chunk-dk06jv4n.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=G1(R);for(let[h,m]of Object.entries(O))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]||"",c=h[2]||"",V0=m.includes("server"),g0=A1(m),w0="";try{let{extractAndStripCssImports:J0,renderVendorStyleTags:U0}=await import("./chunk-zd7bn188.js"),M0=J0(c,{filePath:L,projectRoot:process.cwd()});c=M0.code,w0=U0(M0.styles)}catch(J0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,J0 instanceof Error?J0.message:J0)}if(g0&&c.trim())c=M1(c);if(!V0)try{let{hasUserImports:J0,bundleClientScript:U0}=await import("./chunk-40rqwfqt.js");if(J0(c))c=await U0(c,L,{projectRoot:process.cwd()})}catch(J0){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,J0 instanceof Error?J0.message:J0)}let b0=WY(c);if(b0&&!V0){b=`stx_scope_${q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++t6}`;let J0=r0(c),U0=zY(J0,b);k+=`${w0}<script data-stx-scoped data-stx-run="always">${U0}</script>
3364
+ `;continue}if(V0)try{let{extractVariables:J0}=await import("./chunk-jrcm4vzs.js");await J0(c,E,L)}catch(J0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,J0)}if(!V0&&!b0){let J0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++t6}`;let U0=r0(c),M0=Z9(U0,b),z0=$9(U0,M0);k+=`${w0}<script data-stx-scoped data-stx-run="always"${J0?` ${J0}`:""}>${z0}</script>
3365
+ `}}if(b){let h=KY(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 u3(D,E,L,J,Y,Q);let{processLoops:C}=await import("./chunk-wbegam4r.js"),g=C(D,E,L);if(g=t0(g,E,L),g=V1(g,E,L),M)g+=`
3366
3366
  `+M;if(k)g+=`
3367
3367
  `+k;return g}catch(R){let D=R instanceof Error?R.message:String(R);return K(_,`Error processing include ${_}: ${D}`,V,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,O=_+j[0].length-1,V=1,F=O+1;while(F<q.length&&V>0){if(q[F]==="(")V++;else if(q[F]===")")V--;F++}if(V!==0)break;let L=q.substring(_,F),w=q.substring(O+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=h3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=F0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,W0("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(F),B.lastIndex=0}return q}function d3($,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}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,F=j,L=-1;while(V>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(O),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)V++,F=T+(D[0].length||1);else if(A<1/0){if(V--,V===0){L=A;break}F=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 m3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3368
3368
  `)})}import*as l3 from"path";async function J9($,Z,X=""){if(l3.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 Y9($,Z,X=""){if(l3.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=f1(`${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),F=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
@@ -3534,14 +3534,14 @@ document.addEventListener("focusout",function(e){
3534
3534
  ${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3535
3535
  `+$.slice(G)}if(U5($))return d5($,(G)=>`${G}
3536
3536
  ${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 $4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return $4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-17zts4jt.js"),J=await X(Z.debug);return $4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function VQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function a9($){if($.includes("data-stx-tooltip-runtime")||!VQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${e3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3537
+ ${$}`}async function F$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return $4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return $4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-t7zk4x6s.js"),J=await X(Z.debug);return $4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function VQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function a9($){if($.includes("data-stx-tooltip-runtime")||!VQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${e3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3538
3538
  ${Z}`;return`${$.slice(0,X)}${Z}
3539
3539
  ${$.slice(X)}`}async function OQ($,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 n9(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${s9(q)};</script>
3540
- `}let{getCachedRouterScript:Y}=await import("./chunk-17zts4jt.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
- </body>`+$.slice(G+7)}var t9=Symbol.for("stx.lazy-module-promises");function FQ(){let $=globalThis;return $[t9]??=new Map,$[t9]}function s($,Z){let X=FQ(),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 LQ=0,X4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Y2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function wQ($,Z={}){let X=[];for(let J of h5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function Q2($){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}=e9(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}=e9(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function e9($){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 Y4($){return J2($)}function RQ($){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 DQ($){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 NQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${X4})>`,"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=Q2(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:q2($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var $2=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 AQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Z2($,Z,X,J){if(!$)return!1;let Y=AQ($),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($2.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($2.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(Y2);if(Q&&MQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function MQ($,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 G2($,Z){let X=DQ($);function J(Y){let Q=Y,G=NQ(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(),O=j,V=1,F=O,L=/@(if\s*\(|endif)/g;L.lastIndex=O;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){F=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(O,F-6).trim(),D;if(RQ(R)){let N=O5(Q.substring(K,F));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)=>Z2(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(`
3540
+ `}let{getCachedRouterScript:Y}=await import("./chunk-t7zk4x6s.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
+ </body>`+$.slice(G+7)}var t9=Symbol.for("stx.lazy-module-promises");function FQ(){let $=globalThis;return $[t9]??=new Map,$[t9]}function o($,Z){let X=FQ(),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 LQ=0,X4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Y2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function wQ($,Z={}){let X=[];for(let J of h5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function Q2($){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}=e9(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}=e9(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function e9($){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 Y4($){return J2($)}function RQ($){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 DQ($){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 NQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${X4})>`,"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=Q2(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:q2($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var $2=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 AQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Z2($,Z,X,J){if(!$)return!1;let Y=AQ($),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($2.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($2.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(Y2);if(Q&&MQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function MQ($,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 G2($,Z){let X=DQ($);function J(Y){let Q=Y,G=NQ(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(),O=j,V=1,F=O,L=/@(if\s*\(|endif)/g;L.lastIndex=O;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){F=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(O,F-6).trim(),D;if(RQ(R)){let N=O5(Q.substring(K,F));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)=>Z2(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
3542
  `)}else{if(!Z2(_,X,Z,q(K)))continue;D=L$(J(R),"@if",_)}z.push({start:K,end:F,replacement:D}),U.lastIndex=F}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 TQ($){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 q2($,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 IQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function kQ($,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 IQ.test(Q)}function U2($){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,_,O,V]=q,F=TQ(_);if(F===void 0)continue;let L=q.index,w=L+K.length,N=!!V||/\/\s*>$/.test(K)||w$.has(H.toLowerCase())?w:q2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&kQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${O}${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 W2($,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=Q2(H),_=q==="for"?"@endfor":"@endforeach",O=1,V=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))O++;else if(O--,O===0){V=L.index+L[0].length;break}if(O!==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(Y2),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 EQ($){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
3543
  `)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 bQ($,Z,X){let J=wQ($,{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 O of J){let V=O.body;if(A1(O.attrs))V=M1(V);if(Y.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${LQ++}`,{hasUserImports:q,bundleClientScript:U}=await s("stx/client-script-bundler",()=>import("./chunk-yj90q1bk.js")),W=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=N5(V).code,q(V))V=await U(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>SQ(w));let F=r0(V);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
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 bQ($,Z,X){let J=wQ($,{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 O of J){let V=O.body;if(A1(O.attrs))V=M1(V);if(Y.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${LQ++}`,{hasUserImports:q,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-40rqwfqt.js")),W=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=N5(V).code,q(V))V=await U(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>SQ(w));let F=r0(V);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
3545
3545
  ${F}`)}let z=W.join(`
3546
3546
 
3547
3547
  `);z=EQ(z);let K=yQ(z),H=K.split(",").map((O)=>O.trim()).filter(Boolean),B=J4(z,X),j=`
@@ -3619,9 +3619,9 @@ ${G.join(`
3619
3619
  `+Y.slice(Q)}async function T4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=G1($);let Q=!Z.__stxProcessingDepth;if(Q)m4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!j5()&&!s5())&&X&&X.endsWith(".stx"))r2($,X);try{return await U7.timeAsync("template-processing",async()=>{let G=await WG($,Z,X,J,Y);if(Q)G=A4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??o2(),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),O=W.meta||[],V=new Set(O.map((N)=>n1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!V.has(n1(N))),...O],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
3620
3620
  `),...W.htmlAttrs&&{htmlAttrs:h9(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=a3(G);if(G=l9(G,F,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=m9(G,q),G=u9(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=n2(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
3621
3621
  <meta name="stx-layout" content="${l2(N)}">
3622
- <meta name="stx-layout-group" content="${l2(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?U5(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=d9(G);let q=J.app?.colorMode;if(q)G=P9(G,q);G=f9(G),G=UG(G)}if(Q)try{let{getStoreScript:q}=await s("stx/store-loader",()=>import("./chunk-nxf2s46y.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=X5(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 s("stx/framework-composables",()=>import("./chunk-yfj7tc37.js")),U=await q(G);if(U){let W=X5(G,"data-stx-stores")||X5(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 s("stx/composable-loader",()=>import("./chunk-tswv4p1r.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=X5(G,"data-stx-stores")||X5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3622
+ <meta name="stx-layout-group" content="${l2(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?U5(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=d9(G);let q=J.app?.colorMode;if(q)G=P9(G,q);G=f9(G),G=UG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-p58b19t0.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=X5(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-apk45qqk.js")),U=await q(G);if(U){let W=X5(G,"data-stx-stores")||X5(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-en8ajb6b.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=X5(G,"data-stx-stores")||X5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3625
3625
  `+z+G.slice(K.end)}}catch{}if(Q)G=v9(G);if(Q&&Z.__stx_inject_css!==!1)G=await s2(G,void 0,J.buildMode==="serve");if(Q)G=C9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof a5)throw G;let q=G instanceof Error?G.message:String(G),U=new w1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(u0.log(U,{filePath:X,context:Z}),U3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return G3.createFallbackContent("Template Processing",U)}}async function WG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!A0.isAbsolute(J.partialsDir)?A0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!A0.isAbsolute(J.componentsDir)?A0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!A0.isAbsolute(J.layoutsDir)?A0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await HG(X,Z),KG(Z,q),U=await u1(()=>V9(U,Z,X,q),U,(L)=>{u0.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=c0(U,G5,(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=A9(U),U=await h2(U,X,Y);let B={};U=d3(U,B);let j={...Z.__sections||{}},_="",O=A7(N7($)),V=/@nolayout\b/.test(U)||O===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(U))U=`@section('content')
3626
3626
  ${U.trim()}
3627
3627
  @endsection`}if(!_&&!V&&q.defaultLayout){let L=r3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=A0.dirname(X),N=q.layoutsDir?A0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=A0.join(D,"_layout.stx");if(await a(A)){R=A;break}let M=A0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=A0.isAbsolute(q.layoutsDir)?q.layoutsDir:A0.resolve(process.cwd(),q.layoutsDir),A=A0.join(T,`${q.defaultLayout}.stx`);if(await a(A))_=A}if(_&&!w)U=`@section('content')
@@ -3629,31 +3629,31 @@ ${U.trim()}
3629
3629
  @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",b1);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=m3(U,B),_){let L=[],w=p0(U),R=c0(w.output,C1,(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
3630
  `);j.content=j.content?`${j.content}
3631
3631
  ${D}`:D,Z.__sections=j}}if(_)try{let L;if(A0.isAbsolute(_))L=_,Y.add(_);else L=await u1(()=>$$(_,X,G,Y),null,()=>{throw new w1(`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=A0.isAbsolute(I)?I:A0.resolve(process.cwd(),I);return GG.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(u0.log(Error(E),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${E}`),G.debug)throw new w1(E,X);return U}let w=await u1(()=>Bun.file(L).text(),"",()=>{throw new w1(`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(b1)){let b=j[y].indexOf(b1);j[y]=j[y].slice(0,b)+k+j[y].slice(b+b1.length)}else if(!j[y])j[y]=k;let E={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await T4(I,E,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=d3(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(b1)){let y=T[M]||"",k=I.indexOf(b1);I=I.slice(0,k)+y+I.slice(k+b1.length)}return I}return E||""}),N=zG(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=m3(N,B),Z.__originalFilePath=X,U=await p2(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
3632
- ${U}`,K(U)}catch(L){return u0.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 p2(U,Z,X,G,Y))}function zG($,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 KG($,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 HG($,Z){await u1(()=>L9($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function BG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await s("stx/variable-extractor",()=>import("./chunk-pnarrxms.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));u0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function jG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await s("stx/expressions",()=>import("./chunk-g29rxrje.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return u0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function p2($,Z,X,J,Y){let Q=$,G=J;if(await BG(Q,Z,X),Q=await jG(Q,Z,X),Q=await J9(Q,Z,X),Q=await Y9(Q,Z,X),Q=await u6(Q,Z,X,G),G1(Q))Q=G2(Q,Z),Q=W2(Q,Z);Q=U2(Q);let{processStreamDirectives:q}=await s("stx/streaming",()=>import("./chunk-qanmpzke.js"));Q=q(Q,Z),Q=K9(Q,Z,X,G),Q=await k9(Q,Z,X,G,Y),Q=await R4(Q,Z,X,G,Y),Q=D7(Q,Z,X,G);let{processDeferDirectives:U}=await s("stx/defer",()=>import("./chunk-d8efym0s.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await s("stx/teleport",()=>import("./chunk-47v621t0.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await s("stx/transitions",()=>import("./chunk-6t89bck2.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await s("stx/error-boundaries",()=>import("./chunk-ep2agtrk.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-qn2hsdy5.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await s("stx/async-components",()=>import("./chunk-rhkwswq0.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await s("stx/keep-alive",()=>import("./chunk-vs7843yp.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-6345zcg6.js"));Q=O(Q,Z,X),Q=V(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-tdt7b8kg.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await s("stx/computed",()=>import("./chunk-8hnyynhv.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await s("stx/forms-validation",()=>import("./chunk-72ywcwe8.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:E}=await s("stx/head",()=>import("./chunk-z44ra321.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}
3632
+ ${U}`,K(U)}catch(L){return u0.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 p2(U,Z,X,G,Y))}function zG($,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 KG($,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 HG($,Z){await u1(()=>L9($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function BG($,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-jrcm4vzs.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));u0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function jG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-y8g3d192.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return u0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function p2($,Z,X,J,Y){let Q=$,G=J;if(await BG(Q,Z,X),Q=await jG(Q,Z,X),Q=await J9(Q,Z,X),Q=await Y9(Q,Z,X),Q=await u6(Q,Z,X,G),G1(Q))Q=G2(Q,Z),Q=W2(Q,Z);Q=U2(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-hkn78n7a.js"));Q=q(Q,Z),Q=K9(Q,Z,X,G),Q=await k9(Q,Z,X,G,Y),Q=await R4(Q,Z,X,G,Y),Q=D7(Q,Z,X,G);let{processDeferDirectives:U}=await o("stx/defer",()=>import("./chunk-d8efym0s.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await o("stx/teleport",()=>import("./chunk-47v621t0.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await o("stx/transitions",()=>import("./chunk-6t89bck2.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-ep2agtrk.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await o("stx/suspense",()=>import("./chunk-qn2hsdy5.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await o("stx/async-components",()=>import("./chunk-rhkwswq0.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-vs7843yp.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-6345zcg6.js"));Q=O(Q,Z,X),Q=V(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-tdt7b8kg.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-8hnyynhv.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await o("stx/forms-validation",()=>import("./chunk-72ywcwe8.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:E}=await o("stx/head",()=>import("./chunk-z44ra321.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
3633
  `;if(Q=A(Q,Z),Q=M(Q,Z),Q=F9(Q),Q=R3(Q,Z),Q=h6(Q),Q=j9(Q),Q=await u3(Q,Z,X,G,Y),Q=await R4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=c4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=A4(Q),Q=t0(Q,Z,X),Q=T7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=D3(Q,Z),Q=N3(Q,Z),Q=w5(Q,Z),Q=b3(Q,Z),Q=y3(Q,Z),Q=await T6(Q,Z,X,G),Q=await C7(Q,Z,X),Q=await a6(Q,Z,X,G),Q=i2(Q,Z,X,G),Q=K6(Q,Z,X,G),Q=H6(Q,Z,X),Q=B6(Q,Z,X,G),Q=x6(Q,Z,X,G),Q=D4(Q,Z),Q=N4(Q),Q=u2(Q),!G.skipEventDirectives)Q=u4(Q,Z,X);if(Q=E7(Q,Z,X),G.debug){let i=/\bx-data\s*=/.test(Q),Z0=Y4($);if(i&&Z0)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3634
3634
  Both work on the same page, but they manage separate scopes.
3635
- Prefer signals (state/derived/effect) for new components.`)}Q=D9(Q,Z),Q=await V1(Q,Z,X),Q=d2(Q),Q=m2(Q),Q=j7(Q);let{processXElementDirectives:y}=await s("stx/x-element",()=>import("./chunk-0h08j951.js"));Q=y(Q);let k=Z.__originalFilePath||X,b=I$(Z);if(Q=await z2(Q,G,k,b),Q=c6(Q,Z),Q=await O9(Q,Z,X,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:Z0}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-ccam7wfn.js"));Q=await Z0(Q,{publicDir:i})}if(G.seo?.enabled)Q=j6(Q,Z,G);let C=(i,Z0,Y0=!0)=>{if(!Z0)return i;let R0=Z0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),O0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(R0&&O0){if(Y0)i=i.replace(O0[0],R0[0]);if(Z0=Z0.replace(R0[0],"").trim(),!Z0)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${Z0}
3635
+ Prefer signals (state/derived/effect) for new components.`)}Q=D9(Q,Z),Q=await V1(Q,Z,X),Q=d2(Q),Q=m2(Q),Q=j7(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-0h08j951.js"));Q=y(Q);let k=Z.__originalFilePath||X,b=I$(Z);if(Q=await z2(Q,G,k,b),Q=c6(Q,Z),Q=await O9(Q,Z,X,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:Z0}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-ccam7wfn.js"));Q=await Z0(Q,{publicDir:i})}if(G.seo?.enabled)Q=j6(Q,Z,G);let C=(i,Z0,Y0=!0)=>{if(!Z0)return i;let R0=Z0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),O0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(R0&&O0){if(Y0)i=i.replace(O0[0],R0[0]);if(Z0=Z0.replace(R0[0],"").trim(),!Z0)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${Z0}
3636
3636
  </head>`);if(/<head\b[^>]*>/i.test(i))return i.replace(/(<head\b[^>]*>)/i,`$1
3637
3637
  ${Z0}`);if(/<html\b[^>]*>/i.test(i))return i.replace(/(<html\b[^>]*>)/i,`$1
3638
3638
  <head>
3639
3639
  ${Z0}
3640
- </head>`);return i},{renderHead:g,getHead:h}=await s("stx/head",()=>import("./chunk-z44ra321.js")),c=Z.__stx_runtime_head??h();if(c.title||c.meta?.length||c.link?.length){let i=g(c);if(i)Q=C(Q,i)}if(I.headContent)Q=C(Q,I.headContent,!c.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=v6(Q,G.csp,Z);if(G.analytics?.enabled)Q=V7(Q,G);if(G.heatmap?.enabled)Q=F7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:i}=await s("stx/pwa/inject",()=>import("./chunk-38dwv9n5.js"));Q=i(Q,G)}let V0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),g0=/\bSTX\.\w+/.test(Q),w0=/window\.STX\s*=/.test(Q);if(V0&&g0&&!w0){let Z0=`<script data-stx-scoped data-stx-run="once">
3640
+ </head>`);return i},{renderHead:g,getHead:h}=await o("stx/head",()=>import("./chunk-z44ra321.js")),c=Z.__stx_runtime_head??h();if(c.title||c.meta?.length||c.link?.length){let i=g(c);if(i)Q=C(Q,i)}if(I.headContent)Q=C(Q,I.headContent,!c.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=v6(Q,G.csp,Z);if(G.analytics?.enabled)Q=V7(Q,G);if(G.heatmap?.enabled)Q=F7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:i}=await o("stx/pwa/inject",()=>import("./chunk-38dwv9n5.js"));Q=i(Q,G)}let V0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),g0=/\bSTX\.\w+/.test(Q),w0=/window\.STX\s*=/.test(Q);if(V0&&g0&&!w0){let Z0=`<script data-stx-scoped data-stx-run="once">
3641
3641
  ${K7()}
3642
3642
  </script>`;if(Q.includes("</head>")){let Y0=Q.indexOf("</head>"),O0=Q.slice(0,Y0).indexOf("<script");if(O0!==-1){let l0=Q.slice(0,O0),j1=Q.slice(O0);Q=l0+Z0+`
3643
3643
  `+j1}else Q=Q.replace("</head>",`${Z0}
3644
3644
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3645
3645
  ${Z0}`);else Q=Z0+`
3646
- `+Q}{let{scanScriptTags:i}=await s("stx/signal-processing",()=>import("./chunk-4tqmx6dd.js")),Z0=[];for(let Y0 of i(Q)){if(!/\bserver\b/i.test(Y0.attrs))continue;let R0=Y0.start+Y0.fullMatch.indexOf(">")+1,O0=qG(Q,R0);if(O0===-1)continue;let l0=O0+9;while(l0<Q.length&&/\s/.test(Q[l0]))l0++;Z0.push({start:Y0.start,end:l0})}for(let Y0=Z0.length-1;Y0>=0;Y0--){let{start:R0,end:O0}=Z0[Y0];Q=Q.substring(0,R0)+Q.substring(O0)}}let b0=j$(Q,X);if(b0.hasScoped)Q=b0.html;let J0=Z.__stx_event_bindings||[],U0=!1,M0=[],z0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await s("stx/signal-processing",()=>import("./chunk-4tqmx6dd.js"));for(let i of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))M0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:Z0,content:Y0}of M0){U0=!0;let R0=Y0;M4(Y0,X,J.strict,Z.__originalFilePath);let O0=await k$(Y0,{eventBindings:J0,attrs:Z0,hasColonDirectives:z0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(i,()=>O0)}if(U0)Z.__stx_event_bindings=[];if(!U0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let Z0=C$(i);if(Z0){let Y0=Q.lastIndexOf("</body>");Q=Y0===-1?Q+Z0:Q.slice(0,Y0)+Z0+`
3646
+ `+Q}{let{scanScriptTags:i}=await o("stx/signal-processing",()=>import("./chunk-akh7aqh0.js")),Z0=[];for(let Y0 of i(Q)){if(!/\bserver\b/i.test(Y0.attrs))continue;let R0=Y0.start+Y0.fullMatch.indexOf(">")+1,O0=qG(Q,R0);if(O0===-1)continue;let l0=O0+9;while(l0<Q.length&&/\s/.test(Q[l0]))l0++;Z0.push({start:Y0.start,end:l0})}for(let Y0=Z0.length-1;Y0>=0;Y0--){let{start:R0,end:O0}=Z0[Y0];Q=Q.substring(0,R0)+Q.substring(O0)}}let b0=j$(Q,X);if(b0.hasScoped)Q=b0.html;let J0=Z.__stx_event_bindings||[],U0=!1,M0=[],z0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await o("stx/signal-processing",()=>import("./chunk-akh7aqh0.js"));for(let i of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))M0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:Z0,content:Y0}of M0){U0=!0;let R0=Y0;M4(Y0,X,J.strict,Z.__originalFilePath);let O0=await k$(Y0,{eventBindings:J0,attrs:Z0,hasColonDirectives:z0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(i,()=>O0)}if(U0)Z.__stx_event_bindings=[];if(!U0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let Z0=C$(i);if(Z0){let Y0=Q.lastIndexOf("</body>");Q=Y0===-1?Q+Z0:Q.slice(0,Y0)+Z0+`
3647
3647
  `+Q.slice(Y0)}Z.__stx_event_bindings=[]}}if(!o9(Q)&&r9(Q))Q=await F$(Q,G);if(Q=a9(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=f6(Q,Z.cspNonce);return Q}var _G=[{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"}],VG=[{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')"}],OG=[{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 FG($){let Z=[],X=[];return LG($,Z),wG($,Z,X),RG($,X),DG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function LG($,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 wG($,Z,X){for(let J of _G){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 RG($,Z){for(let X of VG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function DG($,Z){for(let X of OG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function NG($,Z){let X=$.slice(0,Z).split(`
3648
3648
  `);return{line:X.length,column:X[X.length-1].length+1}}function AG($,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 MG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function TG($){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 s0 from"path";import J5 from"process";var Y8=["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"],a2=new Set(Y8),IG=new Set(["props","$props","defineProps"]),kG=new Set(["stx","@stacksjs/stx"]);function EG($){let Z=[],X=0,J=$.split(`
3649
3649
  `);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 bG($){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 O=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),F=-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){F=R;break}let w=K?"...":"";if(F!==-1)return`${w}${O} = ${V.substring(F+1).trim()}`;return`${w}${O}`}).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,`
3650
3650
 
3651
- `),Z}function yG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function SG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function CG($,Z,X,J={}){if(!$.trim())return;let Y;try{let S=k4({loader:"ts",target:"browser",define:$5()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=S.transformSync(v)}catch{Y=bG($)}let Q={exports:{}},G=Q.exports,q=J5.cwd(),U={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),z=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(s0.resolve(s0.dirname(X),S));continue}let v=s0.resolve(q,"node_modules",S),d=s0.join(v,"package.json"),P=JSON.parse(f("fs").readFileSync(d,"utf8")),u=P.main||"index.js";if(P.exports){let o=typeof P.exports==="string"?P.exports:P.exports["."];if(typeof o==="string")u=o;else if(o?.bun)u=o.bun;else if(o?.import)u=o.import;else if(o?.default)u=o.default}U[S]=await import(s0.resolve(v,u))}catch(v){if(S.startsWith("."))z.set(S,v instanceof Error?v.message:String(v))}let K=(S)=>{if(U[S])return U[S];let v=z.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${v}`);return f(S)},H=Z.props||{},B=(S)=>{if(!S)return H;let v={};for(let[d,P]of Object.entries(S)){let u=H[d];if(u!==void 0)v[d]=u;else if(typeof P==="function")v[d]=P();else v[d]=P}return v};for(let[S,v]of Object.entries(H))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(H,S))continue;try{Object.defineProperty(B,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(S)=>{if(!S)return H;let v={...H};for(let[d,P]of Object.entries(S)){let u=P&&typeof P==="object"&&!Array.isArray(P)?P:{type:P};if(v[d]===void 0&&u.default!==void 0)v[d]=typeof u.default==="function"?u.default():u.default}return v},_=()=>Z.slots||{},O=(S,v)=>{let d={...S};for(let[P,u]of Object.entries(v))if(d[P]===void 0)if(typeof u==="function")d[P]=u();else d[P]=u;return d},V=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},F=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},L=(S)=>{},w=(S)=>S(),R=(S)=>{},D=(S)=>{},N=M7(Z);function T(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function A(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let M=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",P=Object.fromEntries(new URLSearchParams(v)),u=Z.query,o=Object.keys(P).length>0?P:u??{},r=v||(Object.keys(o).length>0?`?${new URLSearchParams(o).toString()}`:"");return{params:Z.params??{},query:o,path:d,name:"",fullPath:d+r,hash:"",matched:[]}},E=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),I=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=e5(v,S||{})},y=(S)=>{I(J8(S||{}))},k=(S)=>({value:S}),b=(S)=>S,C=(S)=>({value:typeof S==="function"?S():S}),g=(S,v)=>{},h=(S)=>{},m=(S)=>{},c=(S)=>S?S():Promise.resolve(),V0=(S)=>(v,...d)=>{},g0=(S)=>{},w0=(S,v)=>{},b0=(S,v)=>v,J0=()=>({value:"light"}),U0=()=>V(!1),M0=(S)=>V(!1),z0=()=>V(!1),Y5=()=>M0("(prefers-color-scheme: dark)"),i=()=>M0("(prefers-color-scheme: light)"),Z0=()=>M0("(prefers-reduced-motion: reduce)"),Y0=()=>M0("(prefers-contrast: more)"),R0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},O0=new Proxy(R0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),l0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},j1=console;try{let S=Q8(Y,X),v=new Set(Object.keys(H)),d=(n)=>/^[a-z_$][\w$]*$/i.test(n),P=Object.keys(Z).filter((n)=>!v.has(n)&&!IG.has(n)&&d(n)),u=P.map((n)=>Z[n]);if(!P.includes("__stxServeContext"))P.push("__stxServeContext"),u.push(void 0);let o=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),r=[],K0=[];for(let[n,X0]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(o.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(S))continue;r.push(n),K0.push(X0)}let P0=EG(S).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3652
- `),Z1=Z.params??{},H0=[],X1=[];for(let n=0;n<P.length;n++){if(P[n]==="params")continue;H0.push(P[n]),X1.push(u[n])}let J1=await Function(...Y8,...r,...H0,`return (async () => {
3651
+ `),Z}function yG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function SG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function CG($,Z,X,J={}){if(!$.trim())return;let Y;try{let S=k4({loader:"ts",target:"browser",define:$5()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=S.transformSync(v)}catch{Y=bG($)}let Q={exports:{}},G=Q.exports,q=J5.cwd(),U={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),z=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(s0.resolve(s0.dirname(X),S));continue}let v=s0.resolve(q,"node_modules",S),d=s0.join(v,"package.json"),P=JSON.parse(f("fs").readFileSync(d,"utf8")),u=P.main||"index.js";if(P.exports){let r=typeof P.exports==="string"?P.exports:P.exports["."];if(typeof r==="string")u=r;else if(r?.bun)u=r.bun;else if(r?.import)u=r.import;else if(r?.default)u=r.default}U[S]=await import(s0.resolve(v,u))}catch(v){if(S.startsWith("."))z.set(S,v instanceof Error?v.message:String(v))}let K=(S)=>{if(U[S])return U[S];let v=z.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${v}`);return f(S)},H=Z.props||{},B=(S)=>{if(!S)return H;let v={};for(let[d,P]of Object.entries(S)){let u=H[d];if(u!==void 0)v[d]=u;else if(typeof P==="function")v[d]=P();else v[d]=P}return v};for(let[S,v]of Object.entries(H))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(H,S))continue;try{Object.defineProperty(B,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(S)=>{if(!S)return H;let v={...H};for(let[d,P]of Object.entries(S)){let u=P&&typeof P==="object"&&!Array.isArray(P)?P:{type:P};if(v[d]===void 0&&u.default!==void 0)v[d]=typeof u.default==="function"?u.default():u.default}return v},_=()=>Z.slots||{},O=(S,v)=>{let d={...S};for(let[P,u]of Object.entries(v))if(d[P]===void 0)if(typeof u==="function")d[P]=u();else d[P]=u;return d},V=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},F=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},L=(S)=>{},w=(S)=>S(),R=(S)=>{},D=(S)=>{},N=M7(Z);function T(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function A(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let M=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",P=Object.fromEntries(new URLSearchParams(v)),u=Z.query,r=Object.keys(P).length>0?P:u??{},n=v||(Object.keys(r).length>0?`?${new URLSearchParams(r).toString()}`:"");return{params:Z.params??{},query:r,path:d,name:"",fullPath:d+n,hash:"",matched:[]}},E=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),I=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=e5(v,S||{})},y=(S)=>{I(J8(S||{}))},k=(S)=>({value:S}),b=(S)=>S,C=(S)=>({value:typeof S==="function"?S():S}),g=(S,v)=>{},h=(S)=>{},m=(S)=>{},c=(S)=>S?S():Promise.resolve(),V0=(S)=>(v,...d)=>{},g0=(S)=>{},w0=(S,v)=>{},b0=(S,v)=>v,J0=()=>({value:"light"}),U0=()=>V(!1),M0=(S)=>V(!1),z0=()=>V(!1),Y5=()=>M0("(prefers-color-scheme: dark)"),i=()=>M0("(prefers-color-scheme: light)"),Z0=()=>M0("(prefers-reduced-motion: reduce)"),Y0=()=>M0("(prefers-contrast: more)"),R0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},O0=new Proxy(R0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),l0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},j1=console;try{let S=Q8(Y,X),v=new Set(Object.keys(H)),d=(s)=>/^[a-z_$][\w$]*$/i.test(s),P=Object.keys(Z).filter((s)=>!v.has(s)&&!IG.has(s)&&d(s)),u=P.map((s)=>Z[s]);if(!P.includes("__stxServeContext"))P.push("__stxServeContext"),u.push(void 0);let r=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),n=[],K0=[];for(let[s,X0]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s))continue;if(r.has(s))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${s}\\b`).test(S))continue;n.push(s),K0.push(X0)}let P0=EG(S).map((s)=>`module.exports.${s} = typeof ${s} !== 'undefined' ? ${s} : module.exports.${s};`).join(`
3652
+ `),Z1=Z.params??{},H0=[],X1=[];for(let s=0;s<P.length;s++){if(P[s]==="params")continue;H0.push(P[s]),X1.push(u[s])}let J1=await Function(...Y8,...n,...H0,`return (async () => {
3653
3653
  ${S}
3654
3654
  ${P0}
3655
3655
  return module.exports
3656
- })()`)(Q,G,K,H,B,j,O,A,V,F,L,w,R,D,T,M,E,I,y,N.setResponseStatus,N.setResponseHeader,N.notFound,k,b,C,g,h,m,c,V0,g0,_,w0,b0,J0,U0,M0,z0,Y5,i,Z0,Y0,O0,l0,j1,R0.confirm,R0.alert,R0.fetch,Z1,...K0,...X1);if(J.preserveExisting){for(let[n,X0]of Object.entries(J1))if(!(n in Z)||Z[n]===void 0)Z[n]=X0}else Object.assign(Z,J1);for(let[n,X0]of Object.entries(H))if(!(n in Z))Z[n]=X0}catch(S){let v=S instanceof Error?S.message:String(S);if(yG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(SG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(J5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await dG(Y,Z,X)}catch(d){if(J5.env.STX_DEBUG){let P=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${P}`)}}}}function PG($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var vG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Q8($,Z){let X=Z?s0.dirname(Z):J5.cwd(),J=J5.cwd(),Y=$.split(`
3656
+ })()`)(Q,G,K,H,B,j,O,A,V,F,L,w,R,D,T,M,E,I,y,N.setResponseStatus,N.setResponseHeader,N.notFound,k,b,C,g,h,m,c,V0,g0,_,w0,b0,J0,U0,M0,z0,Y5,i,Z0,Y0,O0,l0,j1,R0.confirm,R0.alert,R0.fetch,Z1,...K0,...X1);if(J.preserveExisting){for(let[s,X0]of Object.entries(J1))if(!(s in Z)||Z[s]===void 0)Z[s]=X0}else Object.assign(Z,J1);for(let[s,X0]of Object.entries(H))if(!(s in Z))Z[s]=X0}catch(S){let v=S instanceof Error?S.message:String(S);if(yG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(SG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(J5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await dG(Y,Z,X)}catch(d){if(J5.env.STX_DEBUG){let P=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${P}`)}}}}function PG($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var vG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Q8($,Z){let X=Z?s0.dirname(Z):J5.cwd(),J=J5.cwd(),Y=$.split(`
3657
3657
  `),Q=[],G=0;while(G<Y.length){let q=Y[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let U=0;for(;G<Y.length;G++){for(let W of Y[G])if(W==="{")U++;else if(W==="}")U--;if(U<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let U=0,W=!1,z=G;for(let B=G;B<Y.length&&!W;B++){let j=null,_=!1,O=Y[B];for(let V=0;V<O.length;V++){let F=O[V];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(j){if(F===j)j=null;continue}if(F==='"'||F==="'"||F==="`"){j=F;continue}if(F==="(")U++;else if(F===")"){if(U--,U===0){G=B+1,W=!0;break}}}}if(!W)G=Y.length;let K=Y.slice(z,G).join(`
3658
3658
  `),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(j)H.push(`${B}: ${JSON.stringify(j[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let U=q,W=0;while(!PG(U)&&G+W+1<Y.length)W++,U=`${U} ${Y[G+W].trim()}`;G+=W;let z=U.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=U.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=U.match(/^import\s+['"](.+?)['"]/),B=U,j=(_)=>{if(_.startsWith("."))return s0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return s0.resolve(J,_.slice(2));return _};if(z){let[,_,O]=z,V=j(O);Q.push(`const ${_} = (await import('${V}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(K){let[,_,O]=K,V=j(O),F=[],L=[],w=kG.has(O);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let N=D.split(/\s+as\s+/);if(N.length===2){let[T,A]=[N[0].trim(),N[1].trim()];if(w&&a2.has(T)){Q.push(`const ${A} = ${T};`);continue}F.push(`${T}: ${A}`),L.push(A)}else{if(w&&a2.has(D))continue;F.push(D),L.push(D)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${V}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=j(H[1]);Q.push(`await import('${_}')`)}else Q.push(B);G++;continue}if(vG.test(q))Q.push(Y[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let U=e2(Y,G),{type:W,name:z,value:K}=U;Q.push(`${W} ${z} = ${K};`),Q.push(`module.exports.${z} = ${z};`),G=U.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let U=I4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let U=e2(Y,G),{type:W,name:z,value:K}=U;Q.push(`${W} ${z} = ${K};`),Q.push(`module.exports.${z} = ${z};`),G=U.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let U=I4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let U=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[G]=U;let z=I4(W,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(q.startsWith("export default ")){let U=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${U};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let U=q.match(/(?:export\s+)?class\s+(\w+)/);if(U){let W=U[1],z=Y[G].replace(/^export\s+/,""),K=0,H=G;for(;H<Y.length;H++){let B=Y[H];for(let j of B)if(j==="{")K++;else if(j==="}")K--;if(H>G)z+=`
3659
3659
  `+B;if(K<=0&&H>=G)break}Q.push(z),Q.push(`module.exports.${W} = ${W};`),G=H+1}else Q.push(q),G++}else if(q.includes("module.exports"))Q.push(q),G++;else if(q.trim()&&!q.startsWith("//"))Q.push(q),G++;else G++}return fG(Q.join(`
@@ -3665,11 +3665,11 @@ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:
3665
3665
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
3666
3666
  ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function uG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=W8(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3667
3667
  ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function X8($,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:{...J5.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 dG($,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=X8(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=X8(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function mG($){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 lG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var k5=new O1(500),b$=new O1(1000),E4=new O1(2000),pG=0;function iG($){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 z8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!nG($)}var E$=new Map;function k4($){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 M1($){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=k4({loader:"ts",target:"browser",define:$5()}).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 sG($){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 O=_.trim().split(":");return O[O.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 oG($){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 rG($){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 aG($,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 oG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=rG(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=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let O of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(O))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=(O)=>{if(O&&!H.includes(O))H.push(O)},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 O of _)B(typeof O==="string"?O:null);if(Q.startsWith("./")||Q.startsWith("../"))return a(x.resolve(x.dirname(J),`${Q}.stx`));for(let O of H){let V=x.isAbsolute(O)?O:x.resolve(K,O);for(let F of W)if(await a(x.join(V,F)))return!0}return!1}function tG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function eG($){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 $q($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await s("stx/variable-extractor",()=>import("./chunk-pnarrxms.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"&&tG(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(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,F=Y.__importedComponents;if(F){let P=[O,O.toLowerCase(),j(O),_(O)];for(let u of P)if(F.has(u)){V=F.get(u);break}}let L=[];if(!V){let P=[`${O}.stx`,`${j(O)}.stx`,`${_(O)}.stx`],u=[...new Set(P)],o=Y.__originalFilePath,r=[];if(o){let X0=x.join(x.dirname(o),"components");r.push(X0)}if(J)r.push(J);let K0=G._rootComponentsDir;if(typeof K0==="string"&&!r.includes(K0))r.push(K0);let D0=x.join(x.dirname(Q),"components");if(!r.includes(D0))r.push(D0);if(G.componentsDir&&G.componentsDir!==J&&!r.includes(G.componentsDir))r.push(G.componentsDir);let P0=typeof G.root==="string"?x.resolve(G.root):void 0,Z1=P0??x.dirname(Q),H0=[];if(P0)H0.push(x.resolve(P0,"resources/views/components")),H0.push(x.resolve(P0,"resources/components")),H0.push(x.resolve(P0,"src/components")),H0.push(x.resolve(P0,"components"));H0.push(x.resolve(import.meta.dir,"components"));for(let X0 of H0)if(!r.includes(X0))r.push(X0);let X1=G._pluginComponentDirs;if(Array.isArray(X1)){for(let X0 of X1)if(typeof X0==="string"&&!r.includes(X0))r.push(X0)}let Q5=[...new Set(r.map((X0)=>{if(!X0)return X0;return x.isAbsolute(X0)?X0:x.resolve(Z1,X0)}))];r.length=0,r.push(...Q5);let J1=`${O}\x00${Q}\x00${Q5.join("\x00")}`,n=b$.get(J1);if(n)if(await a(n))V=n;else b$.delete(J1);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=x.resolve(x.dirname(Q),`${O}.stx`),L.push(V);else if(!V)for(let X0 of r){if(!X0)continue;for(let Y1 of u){let _1=x.join(X0,Y1);if(L.push(_1),await a(_1)){V=_1;break}}if(V)break;if(!V)try{let Y1=await import("fs");if(!Y1.statSync(X0,{throwIfNoEntry:!1})?.isDirectory())continue;let b5=8,S1=[{path:X0,depth:0}];while(S1.length>0&&!V){let o0=S1.pop();if(o0.depth>=b5)continue;let y5;try{y5=Y1.readdirSync(o0.path,{withFileTypes:!0})}catch{continue}for(let S5 of y5){if(!S5.isDirectory())continue;if(S5.name==="node_modules"||S5.name.startsWith("."))continue;let C4=x.join(o0.path,S5.name);for(let D8 of u){let y$=x.join(C4,D8);if(L.push(y$),await a(y$)){V=y$;break}}if(V)break;S1.push({path:C4,depth:o0.depth+1})}}}catch{}if(V)break}if(V)b$.set(J1,V)}if(!V||!await a(V)){let P=L.length>0?`
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 O=_.trim().split(":");return O[O.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 oG($){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 rG($){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 aG($,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 oG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=rG(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=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let O of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(O))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=(O)=>{if(O&&!H.includes(O))H.push(O)},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 O of _)B(typeof O==="string"?O:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(x.resolve(x.dirname(J),`${Q}.stx`));for(let O of H){let V=x.isAbsolute(O)?O:x.resolve(K,O);for(let F of W)if(await a(x.join(V,F)))return!0}return!1}function tG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function eG($){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 $q($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-jrcm4vzs.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"&&tG(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(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,F=Y.__importedComponents;if(F){let P=[O,O.toLowerCase(),j(O),_(O)];for(let u of P)if(F.has(u)){V=F.get(u);break}}let L=[];if(!V){let P=[`${O}.stx`,`${j(O)}.stx`,`${_(O)}.stx`],u=[...new Set(P)],r=Y.__originalFilePath,n=[];if(r){let X0=x.join(x.dirname(r),"components");n.push(X0)}if(J)n.push(J);let K0=G._rootComponentsDir;if(typeof K0==="string"&&!n.includes(K0))n.push(K0);let D0=x.join(x.dirname(Q),"components");if(!n.includes(D0))n.push(D0);if(G.componentsDir&&G.componentsDir!==J&&!n.includes(G.componentsDir))n.push(G.componentsDir);let P0=typeof G.root==="string"?x.resolve(G.root):void 0,Z1=P0??x.dirname(Q),H0=[];if(P0)H0.push(x.resolve(P0,"resources/views/components")),H0.push(x.resolve(P0,"resources/components")),H0.push(x.resolve(P0,"src/components")),H0.push(x.resolve(P0,"components"));H0.push(x.resolve(import.meta.dir,"components"));for(let X0 of H0)if(!n.includes(X0))n.push(X0);let X1=G._pluginComponentDirs;if(Array.isArray(X1)){for(let X0 of X1)if(typeof X0==="string"&&!n.includes(X0))n.push(X0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let Q5=[...new Set(n.map((X0)=>{if(!X0)return X0;return x.isAbsolute(X0)?X0:x.resolve(Z1,X0)}))];n.length=0,n.push(...Q5);let J1=`${O}\x00${Q}\x00${Q5.join("\x00")}`,s=b$.get(J1);if(s)if(await a(s))V=s;else b$.delete(J1);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=x.resolve(x.dirname(Q),`${O}.stx`),L.push(V);else if(!V)for(let X0 of n){if(!X0)continue;for(let Y1 of u){let _1=x.join(X0,Y1);if(L.push(_1),await a(_1)){V=_1;break}}if(V)break;if(!V)try{let Y1=await import("fs");if(!Y1.statSync(X0,{throwIfNoEntry:!1})?.isDirectory())continue;let b5=8,S1=[{path:X0,depth:0}];while(S1.length>0&&!V){let o0=S1.pop();if(o0.depth>=b5)continue;let y5;try{y5=Y1.readdirSync(o0.path,{withFileTypes:!0})}catch{continue}for(let S5 of y5){if(!S5.isDirectory())continue;if(S5.name==="node_modules"||S5.name.startsWith("."))continue;let C4=x.join(o0.path,S5.name);for(let D8 of u){let y$=x.join(C4,D8);if(L.push(y$),await a(y$)){V=y$;break}}if(V)break;S1.push({path:C4,depth:o0.depth+1})}}}catch{}if(V)break}if(V)b$.set(J1,V)}if(!V||!await a(V)){let P=L.length>0?`
3669
3669
  Searched paths:
3670
3670
  ${L.map((u)=>` - ${u}`).join(`
3671
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(k5.has(V))w=k5.get(V);else try{w=await Bun.file(V).text(),k5.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"]),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 s("stx/includes",()=>import("./chunk-b318zf0z.js"));N=await P(X,Y,Q,G,U)}let T=p0(N),A=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let o=T.scripts[Number(u)]||"",r=o.match(/^<script\b([^>]*)>/i)?.[1]||"",K0=r.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),D0=!K0||["module","text/javascript","application/javascript"].includes(K0);if(!/\bserver\b/i.test(r)&&D0)return A.push(o),"";return o}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-07n6dv48.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:G1(w)||eG(X)};aG(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=[],c=h.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&h.every((P)=>/\bserver\b/.test(P[1]||"")),V0=null,g0=null;if(c){let P=iG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){V0=`${V}\x00${P}`;let u=E4.get(V0);if(u){for(let o of u.dependencies)U.add(o);return u.output}g0=new Set(U)}}for(let P of h){let u=P[1]||"",o=P[2]||"",r=u.includes("server");if(A1(u)&&o.trim())o=M1(o);if(r&&o)try{await W(o,k,V)}catch(D0){}if(!r){let D0=o.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=D0.includes("{{")&&D0.includes("}}"),Z1=D0.includes("{!!")&&D0.includes("!!}");if(P0||Z1)D0=f$(D0,k);let H0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${H0}>${D0}</script>`)}}let w0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),b0=w0?w0[1]:"",J0=w0?w0[2]:"",U0="",M0=b0&&/\bscoped\b/i.test(b0);if(w0)U0=`<style${b0}>${J0}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(z0=z0.replace(P,(o,r)=>{let K0=r.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(K0)u.push(`<style${K0[1]}>${K0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)U0=`${U0}${u.join(`
3672
- `)}`}if(X&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:Y5}=await s("stx/slots",()=>import("./chunk-07n6dv48.js")),{defaultSlot:i,namedSlots:Z0}=I;z0=await Y5(z0,i,Z0,k);let Y0=m.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),R0=$q(m),O0=Array.isArray(k.__stx_client_signal_names)?k.__stx_client_signal_names:[];if(R0.length>0||O0.length>0)k.__stx_client_signal_names=[...new Set([...O0,...R0])];let l0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:Y0||m.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let j1=await T4(z0,k,V,l0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of j1.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++pG}_${Math.random().toString(36).slice(2,8)}`,d=j1;if(Y0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${z8(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${z8(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${j1}</div>`;let o=await Promise.all(m.map(async(r)=>{let K0=r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!K0)return r;let[,D0,P0]=K0,Z1=y4(P0,{filePath:V,projectRoot:process.cwd()}),H0=Z1.code,X1=S4(Z1.styles);H0=N5(H0).code;let{hasUserImports:Q5,bundleClientScript:J1}=await s("stx/client-script-bundler",()=>import("./chunk-yj90q1bk.js"));if(Q5(H0))H0=await J1(H0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:n}=await s("stx/signal-processing",()=>import("./chunk-4tqmx6dd.js"));H0=H0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(o0,y5)=>n(y5));let X0=r0(H0),Y1=sG(X0),_1=`function(__scopeId) {
3671
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(k5.has(V))w=k5.get(V);else try{w=await Bun.file(V).text(),k5.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"]),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-paz6f4m5.js"));N=await P(X,Y,Q,G,U)}let T=p0(N),A=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let r=T.scripts[Number(u)]||"",n=r.match(/^<script\b([^>]*)>/i)?.[1]||"",K0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),D0=!K0||["module","text/javascript","application/javascript"].includes(K0);if(!/\bserver\b/i.test(n)&&D0)return A.push(r),"";return r}),{extractSlotContent:E}=await o("stx/slots",()=>import("./chunk-n2fhxh9a.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:G1(w)||eG(X)};aG(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=[],c=h.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&h.every((P)=>/\bserver\b/.test(P[1]||"")),V0=null,g0=null;if(c){let P=iG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){V0=`${V}\x00${P}`;let u=E4.get(V0);if(u){for(let r of u.dependencies)U.add(r);return u.output}g0=new Set(U)}}for(let P of h){let u=P[1]||"",r=P[2]||"",n=u.includes("server");if(A1(u)&&r.trim())r=M1(r);if(n&&r)try{await W(r,k,V)}catch(D0){}if(!n){let D0=r.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=D0.includes("{{")&&D0.includes("}}"),Z1=D0.includes("{!!")&&D0.includes("!!}");if(P0||Z1)D0=f$(D0,k);let H0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${H0}>${D0}</script>`)}}let w0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),b0=w0?w0[1]:"",J0=w0?w0[2]:"",U0="",M0=b0&&/\bscoped\b/i.test(b0);if(w0)U0=`<style${b0}>${J0}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(z0=z0.replace(P,(r,n)=>{let K0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(K0)u.push(`<style${K0[1]}>${K0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)U0=`${U0}${u.join(`
3672
+ `)}`}if(X&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:Y5}=await o("stx/slots",()=>import("./chunk-n2fhxh9a.js")),{defaultSlot:i,namedSlots:Z0}=I;z0=await Y5(z0,i,Z0,k);let Y0=m.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),R0=$q(m),O0=Array.isArray(k.__stx_client_signal_names)?k.__stx_client_signal_names:[];if(R0.length>0||O0.length>0)k.__stx_client_signal_names=[...new Set([...O0,...R0])];let l0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:Y0||m.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let j1=await T4(z0,k,V,l0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of j1.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++pG}_${Math.random().toString(36).slice(2,8)}`,d=j1;if(Y0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${z8(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${z8(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${j1}</div>`;let r=await Promise.all(m.map(async(n)=>{let K0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!K0)return n;let[,D0,P0]=K0,Z1=y4(P0,{filePath:V,projectRoot:process.cwd()}),H0=Z1.code,X1=S4(Z1.styles);H0=N5(H0).code;let{hasUserImports:Q5,bundleClientScript:J1}=await o("stx/client-script-bundler",()=>import("./chunk-40rqwfqt.js"));if(Q5(H0))H0=await J1(H0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:s}=await o("stx/signal-processing",()=>import("./chunk-akh7aqh0.js"));H0=H0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(o0,y5)=>s(y5));let X0=r0(H0),Y1=sG(X0),_1=`function(__scopeId) {
3673
3673
  ${c1("const",[...K8,...Y1],X0)}
3674
3674
  const __scope = window.stx._scopes = window.stx._scopes || {};
3675
3675
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -3699,11 +3699,11 @@ finally {
3699
3699
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3700
3700
  }
3701
3701
  }`,b5=B?null:l4(Y,_1),S1=b5?`window.__stxComponentFactories[${JSON.stringify(b5)}](${JSON.stringify(v)});`:`(${_1})(${JSON.stringify(v)});`;if(B)return`${X1}<script type="stx/island" data-stx-island="${v}" data-stx-scoped${D0}>${S1}</script>`;return`${X1}<script data-stx-scoped data-stx-run="always"${D0}>${S1}</script>`}));if(d=d+`
3702
- `+o.join(`
3702
+ `+r.join(`
3703
3703
  `),U0)d+=`
3704
3704
  `+U0}else{if(U0)d+=`
3705
- `+U0;if(m.length>0){let P=k.__stx_event_bindings||[],u=I$(k),o=await Promise.all(m.map(async(r)=>{let K0=r.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!K0)return r;return await k$(K0[1],{eventBindings:P,templateContent:d,filePath:V,projectRoot:process.cwd(),serverData:u})}));d+=`
3706
- `+o.join(`
3705
+ `+U0;if(m.length>0){let P=k.__stx_event_bindings||[],u=I$(k),r=await Promise.all(m.map(async(n)=>{let K0=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!K0)return n;return await k$(K0[1],{eventBindings:P,templateContent:d,filePath:V,projectRoot:process.cwd(),serverData:u})}));d+=`
3706
+ `+r.join(`
3707
3707
  `),k.__stx_event_bindings=[]}}if(M0){let P=j$(d,V);if(P.hasScoped)d=P.html}if(V0&&g0)E4.set(V0,{output:d,dependencies:[...U].filter((P)=>!g0.has(P))});return A.length>0?`${d}
3708
3708
  ${A.join(`
3709
3709
  `)}`:d}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function a($){return Bun.file($).exists()}function b4($,Z){let X=x.resolve(Z),J=x.resolve($),Y=X.endsWith(x.sep)?X:X+x.sep;if(J===X||J.startsWith(Y))return J;return null}async function Zq($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=x.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await a(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function $$($,Z,X,J){let Y=await Xq($,Z,X,J);if(Y===null)return null;let Q=b4(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of G){let U=x.isAbsolute(q)?q:x.resolve(process.cwd(),q);if(b4(Y,U))return x.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function Xq($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=x.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=x.join(Q,$),B=b4(H,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${B}`);if(await a(B)&&J)J.add(B);return B}let G=x.join(Y,$);if(await a(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let B=`${G}${H}`;if(await a(B)){if(X.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let q=[];if(X.layoutsDir)q.push(x.isAbsolute(X.layoutsDir)?X.layoutsDir:x.resolve(process.cwd(),X.layoutsDir));let U=x.resolve(Y),W=process.cwd();for(let H=0;H<10;H++){let B=x.join(U,"layouts"),j=!1;try{j=cG.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=x.dirname(U);if(_===U||_.length<W.length)break;U=_}for(let H of q){let B=await Zq(H,$,J,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=x.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:x.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[x.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await a(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=x.join(X.partialsDir||Y,"layouts",H[1]);if(await a(B)){if(X.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await a(j)){if(X.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(X.partialsDir){let H=x.join(X.partialsDir,"layouts");if(await a(H)){let B=x.join(H,$);if(await a(B)){if(X.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await a(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let z=X.partialsDir||x.join(process.cwd(),"views"),K=x.join(z,$);if(await a(K)){if(X.debug)console.log(`Found in views path: ${K}`);if(J)J.add(K);return K}if(!$.endsWith(".stx")){let H=`${K}.stx`;if(await a(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(J)J.add(H);return H}}if(Y.includes("temp")){let H=x.join(x.dirname(Y),"layouts",$);if(await a(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let B=`${H}.stx`;if(await a(B)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(X.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function H8($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
@@ -3791,7 +3791,7 @@ else {
3791
3791
  // STX: auto-generated event bindings
3792
3792
  ${$.map((X,J)=>Lq(X,J)).join(`
3793
3793
  `)}`}function _8($){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 Rq=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 Dq($){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(!Rq.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=y4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=S4(G.styles),U=N5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-yj90q1bk.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=w8(X);X=F.code,J=R8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${J4(X,Z.serverData)}${J}`,X=r0(X),!Y&&A1(Z.attrs||""))X=M1(X);let K=wq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
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 Rq=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 Dq($){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(!Rq.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=y4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=S4(G.styles),U=N5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-40rqwfqt.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=w8(X);X=F.code,J=R8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${J4(X,Z.serverData)}${J}`,X=r0(X),!Y&&A1(Z.attrs||""))X=M1(X);let K=wq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
3795
3795
  ${s1(`${J}${X}
3796
3796
  ${K}`)}
3797
3797
  </script>`}let j=O8($),_=/function __stx_setup_/.test(X),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(F){let L=F.length>0?`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Aj as n,nj as a,oj as b,pj as c,qj as d,rj as e,sj as f,tj as g,uj as h,vj as i,wj as j,xj as k,yj as l,zj as m}from"./chunk-0aj80aj9.js";import"./chunk-z61y1yv1.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-yjzznatw.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
2
+ import{Aj as n,nj as a,oj as b,pj as c,qj as d,rj as e,sj as f,tj as g,uj as h,vj as i,wj as j,xj as k,yj as l,zj as m}from"./chunk-5fy1k8m0.js";import"./chunk-h1jzzy6t.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-vy3brhf3.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$o as d,Yo as a,Zo as b,_o as c,ap as e,bp as f,cp as g,dp as h,ep as i,fp as j}from"./chunk-z61y1yv1.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-yjzznatw.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
2
+ import{$o as d,Yo as a,Zo as b,_o as c,ap as e,bp as f,cp as g,dp as h,ep as i,fp as j}from"./chunk-h1jzzy6t.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-vy3brhf3.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{uh as a,vh as b,wh as c,xh as d,yh as e,zh as f}from"./chunk-c6y91qmt.js";import"./chunk-z61y1yv1.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-yjzznatw.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
2
+ import{uh as a,vh as b,wh as c,xh as d,yh as e,zh as f}from"./chunk-4bbyk43z.js";import"./chunk-h1jzzy6t.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-vy3brhf3.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Bq as k,Fl as A,Gl as D,Pm as T,Qm as y,Uo as x,Wl as B,Yl as F,Yr as w,ap as M,mq as R}from"./chunk-z61y1yv1.js";import{Eu as P}from"./chunk-q891e1vj.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{Bq as k,Fl as A,Gl as D,Pm as T,Qm as y,Uo as x,Wl as B,Yl as F,Yr as w,ap as M,mq as R}from"./chunk-h1jzzy6t.js";import{Eu as P}from"./chunk-q891e1vj.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 R(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-53wyachb.js");q=await N(q)}catch{}return q}
17
+ ${Z}`}q=await R(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-v7fsv3wn.js");q=await N(q)}catch{}return q}
18
18
  export{b as ok,C as pk,j as qk,s as rk,i as sk,I as tk};