@stacksjs/stx 0.2.606 → 0.2.607

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 (63) hide show
  1. package/dist/{chunk-y6gj9jq8.js → chunk-0cb00ys2.js} +1 -1
  2. package/dist/{chunk-605c6zks.js → chunk-0mgth7cm.js} +1 -1
  3. package/dist/{chunk-3cnwstra.js → chunk-1dd4qefr.js} +1 -1
  4. package/dist/{chunk-915s0may.js → chunk-2n59ahd9.js} +1 -1
  5. package/dist/{chunk-3gm6013p.js → chunk-2pwjnydp.js} +1 -1
  6. package/dist/chunk-32hr3qq7.js +2 -0
  7. package/dist/{chunk-ajd5w5c4.js → chunk-39pgf5z3.js} +1 -1
  8. package/dist/{chunk-r4wqh5fd.js → chunk-3xwzd9wp.js} +18 -18
  9. package/dist/{chunk-c0h9cxew.js → chunk-4szajb1z.js} +1 -1
  10. package/dist/{chunk-rg7wvcqw.js → chunk-5j29466h.js} +1 -1
  11. package/dist/{chunk-zs3tmd12.js → chunk-60wedefh.js} +1 -1
  12. package/dist/{chunk-bkjre6xk.js → chunk-61ztfana.js} +2 -2
  13. package/dist/{chunk-4dfqgmgs.js → chunk-77kpsnf6.js} +5 -5
  14. package/dist/{chunk-fwp1en28.js → chunk-79edpvb2.js} +1 -1
  15. package/dist/{chunk-61d0gr5b.js → chunk-7f63z4xx.js} +1 -1
  16. package/dist/{chunk-fese2cf6.js → chunk-8bzx0r0x.js} +1 -1
  17. package/dist/{chunk-y9a9cvke.js → chunk-8fq6bvnw.js} +1 -1
  18. package/dist/{chunk-1veeefpn.js → chunk-974dxazw.js} +1 -1
  19. package/dist/chunk-9sgt7v77.js +2 -0
  20. package/dist/{chunk-pndhb1nk.js → chunk-9zzhpp2a.js} +1 -1
  21. package/dist/{chunk-d0kes50w.js → chunk-aan7601v.js} +1 -1
  22. package/dist/{chunk-mtxs4fya.js → chunk-aestp72s.js} +1 -1
  23. package/dist/{chunk-n882b1fy.js → chunk-bakxqwnz.js} +1 -1
  24. package/dist/{chunk-vvfpb3k3.js → chunk-bspryr4a.js} +2 -2
  25. package/dist/{chunk-9zwdpa7p.js → chunk-c48mh4d6.js} +2 -2
  26. package/dist/{chunk-vhajhs44.js → chunk-c65q0svd.js} +1 -1
  27. package/dist/{chunk-tyb481p0.js → chunk-cp901m61.js} +1 -1
  28. package/dist/{chunk-vm2d4hap.js → chunk-dxqwm8tr.js} +1 -1
  29. package/dist/{chunk-5taenpfg.js → chunk-ev6w9c69.js} +1 -1
  30. package/dist/{chunk-k7spjpr0.js → chunk-exd1h9sd.js} +1 -1
  31. package/dist/{chunk-9734nkc8.js → chunk-g04y5wyn.js} +1 -1
  32. package/dist/{chunk-mn7a5b55.js → chunk-g63ye3fe.js} +1 -1
  33. package/dist/{chunk-y8jjmwa9.js → chunk-k4wkfhvz.js} +1 -1
  34. package/dist/{chunk-327bt8zb.js → chunk-mgj0ngyq.js} +1 -1
  35. package/dist/{chunk-gk7mmc2e.js → chunk-n39ezmxz.js} +1 -1
  36. package/dist/{chunk-qygr4pv8.js → chunk-n8eavnxf.js} +1 -1
  37. package/dist/{chunk-dzekcand.js → chunk-pghtgep5.js} +1 -1
  38. package/dist/{chunk-8t3c2myr.js → chunk-rxja040z.js} +1 -1
  39. package/dist/chunk-sx0qbekt.js +2 -0
  40. package/dist/{chunk-en388k3h.js → chunk-t83acmv2.js} +1 -1
  41. package/dist/{chunk-y2wr7c9e.js → chunk-tc176d93.js} +1 -1
  42. package/dist/{chunk-htf3z9et.js → chunk-tfjcs55e.js} +1 -1
  43. package/dist/{chunk-s45envb5.js → chunk-wqmm1qsz.js} +2 -2
  44. package/dist/{chunk-cw76y2p5.js → chunk-wtax276j.js} +1 -1
  45. package/dist/{chunk-93na8hh0.js → chunk-x49qdt4c.js} +1 -1
  46. package/dist/{chunk-8x2ejkcc.js → chunk-y0zyzbjf.js} +1 -1
  47. package/dist/{chunk-w67rrd1f.js → chunk-z2xrwmjr.js} +1 -1
  48. package/dist/{chunk-3ttnn4t3.js → chunk-zq345s76.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/craft-entry.js +1 -1
  51. package/dist/craft.js +1 -1
  52. package/dist/native/compiler/html-to-ir.js +1 -0
  53. package/dist/native/compiler/ir.d.ts +1 -1
  54. package/dist/native/components/primitives.d.ts +33 -11
  55. package/dist/native/event-names.js +1 -0
  56. package/dist/native/prop-names.js +3 -1
  57. package/dist/pwa.js +1 -1
  58. package/dist/server-bindings.js +5 -2
  59. package/dist/ssg.js +2 -2
  60. package/package.json +5 -5
  61. package/dist/chunk-1e28n9q2.js +0 -2
  62. package/dist/chunk-kgvm5ytn.js +0 -2
  63. package/dist/chunk-mfery7a4.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ln,y,Ji,Vt,eo,Yi,Zi,Qi,ea}from"./chunk-sswjv8p9.js";import{O}from"./chunk-bsy8v1xj.js";import{t,Y,Sr,i,oe,Ys,I,zt,Dn,Zs,l,p,Xi,D,Ae,at,c,Cr}from"./chunk-06wv8qwy.js";import{Bn,Fn,Rr,Ie}from"./chunk-azpkje69.js";import{S,Gs,ot,Ks,Vi,Tn,$n,Ui,Re,Wi,Rn,qi,Ft,Xs,Gi,An,In,wr,be,Js,ve,xr}from"./chunk-x8q5przn.js";import{Vs,Us,Ws,qs,hr,yr}from"./chunk-td5100fz.js";import{Fi,Fs,fr,gr}from"./chunk-6xsm53pz.js";import{he,Bt,mr,Hs,C,rt}from"./chunk-bhf9yt2w.js";import{En}from"./chunk-3cnwstra.js";import{oo}from"./chunk-rmv35cx0.js";import{Oi,Di,Mi,Li}from"./chunk-dnqq1ze0.js";import{nt}from"./chunk-vp3fzjsc.js";import{s,Te}from"./chunk-20k77e2a.js";import{jt,Hi,Cn,a,_n}from"./chunk-n35yc890.js";import{d}from"./chunk-yn2d8x8m.js";import{E,N,Nn,Qs}from"./chunk-k3f4044e.js";import{Ar}from"./chunk-5s47qfp6.js";import Yr from"path";import Po from"fs";var zh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ec(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return zh.has(v.toLowerCase())}var Lu=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"]),Bu={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"},Wh=new Set(["ctrl","alt","shift","meta"]),Fu={left:0,middle:1,right:2};function zu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Wh.has(R))_.systemKeys.push(R);else if(R in Fu)_.mouse=R;else if(R in Bu||/^[a-z]$/.test(R))_.keys.push(Bu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Vu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,U=B.index,H=U+z.length,q=`__stx_evt_${_}${R++}`,Q=[],ie=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Z;while((Z=ie.exec(F))!==null){let[,le,ce]=Z,de=le.split("."),ue=de[0];if(!Lu.has(ue))continue;Q.push({attribute:`@${le}`,event:ue,handler:ce,modifiers:zu(de.slice(1)),elementId:q})}let ae=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Z=ae.exec(F))!==null){let[,le,ce]=Z,de=le.split("."),ue=de[0];if(!Lu.has(ue))continue;Q.push({attribute:`@${le}`,event:ue,handler:ce,modifiers:zu(de.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:U,endIndex:H})}return k}function Fh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Fu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Vh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function tc(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Uh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Fh(v),T=Vh(tc(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(ec(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
2
+ import{Ln,y,Ji,Vt,eo,Yi,Zi,Qi,ea}from"./chunk-sswjv8p9.js";import{O}from"./chunk-bsy8v1xj.js";import{t,Y,Sr,i,oe,Ys,I,zt,Dn,Zs,l,p,Xi,D,Ae,at,c,Cr}from"./chunk-06wv8qwy.js";import{Bn,Fn,Rr,Ie}from"./chunk-azpkje69.js";import{S,Gs,ot,Ks,Vi,Tn,$n,Ui,Re,Wi,Rn,qi,Ft,Xs,Gi,An,In,wr,be,Js,ve,xr}from"./chunk-x8q5przn.js";import{Vs,Us,Ws,qs,hr,yr}from"./chunk-td5100fz.js";import{Fi,Fs,fr,gr}from"./chunk-6xsm53pz.js";import{he,Bt,mr,Hs,C,rt}from"./chunk-bhf9yt2w.js";import{En}from"./chunk-1dd4qefr.js";import{oo}from"./chunk-rmv35cx0.js";import{Oi,Di,Mi,Li}from"./chunk-dnqq1ze0.js";import{nt}from"./chunk-vp3fzjsc.js";import{s,Te}from"./chunk-20k77e2a.js";import{jt,Hi,Cn,a,_n}from"./chunk-n35yc890.js";import{d}from"./chunk-yn2d8x8m.js";import{E,N,Nn,Qs}from"./chunk-k3f4044e.js";import{Ar}from"./chunk-5s47qfp6.js";import Yr from"path";import Po from"fs";var zh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ec(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return zh.has(v.toLowerCase())}var Lu=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"]),Bu={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"},Wh=new Set(["ctrl","alt","shift","meta"]),Fu={left:0,middle:1,right:2};function zu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Wh.has(R))_.systemKeys.push(R);else if(R in Fu)_.mouse=R;else if(R in Bu||/^[a-z]$/.test(R))_.keys.push(Bu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Vu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,U=B.index,H=U+z.length,q=`__stx_evt_${_}${R++}`,Q=[],ie=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Z;while((Z=ie.exec(F))!==null){let[,le,ce]=Z,de=le.split("."),ue=de[0];if(!Lu.has(ue))continue;Q.push({attribute:`@${le}`,event:ue,handler:ce,modifiers:zu(de.slice(1)),elementId:q})}let ae=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Z=ae.exec(F))!==null){let[,le,ce]=Z,de=le.split("."),ue=de[0];if(!Lu.has(ue))continue;Q.push({attribute:`@${le}`,event:ue,handler:ce,modifiers:zu(de.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:U,endIndex:H})}return k}function Fh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Fu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Vh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function tc(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Uh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Fh(v),T=Vh(tc(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(ec(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${k}');
5
5
  if (!$el) return;
@@ -142,7 +142,7 @@ catch (e) {
142
142
  `)})}else _.push({selector:`@${H} ${q.trim()}`,declarations:Q.trim()})}z="",B=!1}else if(T.trim()){T+=F;let U=T.match(/([^{]+)\{([^}]*)\}/);if(U)_.push({selector:U[1].trim(),declarations:U[2].trim()});T=""}continue}}if(B)z+=F;else T+=F}return _}function wf(v,_,k,R,T,B){let{selector:z,declarations:W}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let H=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${W} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let q=il(`x { ${W} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((Q)=>wf(Q,_,k,R,T,B)).join(`
143
143
  `);return`${z} {
144
144
  ${q}
145
- }`}return`${z} { ${W} }`}let F=Cy(z,_,k,R),U=W;for(let[H,q]of T)U=U.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)U=U.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${U} }`}function Cy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let U=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(U)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=Ry(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function Ry(v,_){let k=0,R=v.length;for(let F=0;F<v.length;F++){let U=v[F];if(U==="["||U==="(")k++;else if(U==="]"||U===")")k--;else if(k===0&&(U===" "||U===">"||U==="+"||U==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let U=T[F];if(U==="["||U==="(")W++;else if(U==="]"||U===")")W--;else if(k===0&&W===0&&U===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var _f=String.raw`(?<![\w-])scoped(?![\w-])`,ol=/<style\s+([^>]*)>/gi,Sf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,kf=new RegExp(_f,"i"),Ay=new RegExp(_f,"gi"),al=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ty(v){ol.lastIndex=0;let _=ol.exec(v);while(_!==null){if(kf.test(_[1]))return!0;_=ol.exec(v)}return!1}function cl(v){let _=new Set,k=[];al.lastIndex=0;let R=al.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=al.exec(v)}return k}function so(v){let _=cl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function ca(v,_){if(!Ty(v))return{html:v,hasScoped:!1};let k=bf(_),R=`data-v-${k}`,T=v,B=!1;if(Sf.lastIndex=0,T=T.replace(Sf,(z,W,F)=>{if(!kf.test(W))return z;B=!0;let U=Iy(F,R),H=W.replace(Ay,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${U}</style>`}),!B)return{html:v,hasScoped:!1};return T=Dy(T,R),{html:T,hasScoped:!0}}function Iy(v,_){return vf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Py=(v)=>`\x00stx-scope-mask-${v}\x00`,$f=/\u0000stx-scope-mask-(\d+)\u0000/g;function Dy(v,_){let k=Vn(v,(T,B)=>{let z=V(T,B);return z>B?z:is(T,B)},(T,B)=>Py(B)),R=Oy(k.output,_);return $f.lastIndex=0,R.replace($f,(T,B)=>k.tokens[Number(B)])}function Oy(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Hn=null,la="";function Cf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;la=`${_}@${Math.trunc(ao.statSync(_).mtimeMs)}`}catch{la=v}}var ul=!1,Hr=null,io="",cs=!1,If=256,Er=new Map,qn=new Map,ua=null,Pf=null,da=new Map,Rf=new Set;function fa(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function ll(v,_){if(Er.has(v))Er.delete(v);else if(Er.size>=If)Er.delete(Er.keys().next().value);Er.set(v,_)}function My(v){let _=fa(v);if(qn.has(_))qn.delete(_);else if(qn.size>=If)qn.delete(qn.keys().next().value);return qn.set(_,v),_}function ad(v){let _=qn.get(v);if(_===void 0)return;return qn.delete(v),qn.set(v,_),_}async function Ny(v,_=ua){if(!_)return null;try{let k=Bun.file(Ht.join(_,`cw-${fa(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function jy(v,_,k=ua){if(!k)return;try{if(!ao.existsSync(k))ao.mkdirSync(k,{recursive:!0});await Bun.write(Ht.join(k,`cw-${fa(v)}.css`),_)}catch{}}async function Af(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ly=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],By=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zy(){let v=[],_=process.cwd();while(_!==Ht.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ly)v.push(Ht.join(_,k,...R));_=Ht.dirname(_)}return v}function Wy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ht.join(_,"Code","Tools","ts-css"),_&&Ht.join(_,"Code","Tools","crosswind"),_&&Ht.join(_,"repos","stacks-org","ts-css"),_&&Ht.join(_,"repos","stacks-org","crosswind"),Ht.join(process.cwd(),"..","ts-css"),Ht.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Ht.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Ht.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ht.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function pi(){if(ul)return Hn;ul=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await Af(B);if(z){if(Cf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ht.dirname(Ht.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Ht.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Hn=B,Hn}let _=await v(zy());if(_)return Hn=_,Hn;let k=By;for(let T of k){let B=await Af(T);if(B){Hn=B;try{Cf(import.meta.resolve(T))}catch{la=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Hn}}let R=await v(Wy());if(R)return Hn=R,Hn;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function cd(){dl.clear(),Hn=null,ul=!1,Hr=null,io="",Er.clear(),qn.clear(),Pf=null,da.clear()}var Tf=!1;async function fi(v){try{let _=Ef({name:"css",cwd:v})?"css":Ef({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Tf)Tf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Ht.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Tc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-3ttnn4t3.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Ht.isAbsolute(R.css)?R.css:Ht.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Ht.isAbsolute(R.css.config)?R.css.config:Ht.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await fi(v)}function $c(v){try{let _=new WeakSet;return fa(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Nt(v){if(cs)return io;cs=!0;try{let _=await pi();if(!_||!_.build)return cs=!1,"";if(!Hr)Hr=await fi(v);if(!Hr)return cs=!1,"";let k=_.defaultConfig?.theme||{},R=Hr.theme||{},T={..._.defaultConfig,...Hr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(io=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=Ht.isAbsolute(T.output)?T.output:Ht.join(v,T.output),U=Ht.dirname(F);if(!ao.existsSync(U))ao.mkdirSync(U,{recursive:!0});await Bun.write(F,z.css)}return cs=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),cs=!1,io}}async function xn(v){Hr=null,await Nt(v)}function ld(){return io}function Rc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var dl=m(64);async function Ac(v,_){let k=()=>da.get(_?Ht.resolve(_):process.cwd())?.fingerprint??null,R=dl.get(h(v,_,k()));if(R!==void 0)return R;let T=await Fy(v,_);if(T)dl.set(h(v,_,k()),T);return T}function*Df(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=di(R);if(T)yield T}}function ud(v){return[...Df(v)].join(`
145
+ }`}return`${z} { ${W} }`}let F=Cy(z,_,k,R),U=W;for(let[H,q]of T)U=U.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)U=U.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${U} }`}function Cy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let U=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(U)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=Ry(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function Ry(v,_){let k=0,R=v.length;for(let F=0;F<v.length;F++){let U=v[F];if(U==="["||U==="(")k++;else if(U==="]"||U===")")k--;else if(k===0&&(U===" "||U===">"||U==="+"||U==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let U=T[F];if(U==="["||U==="(")W++;else if(U==="]"||U===")")W--;else if(k===0&&W===0&&U===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var _f=String.raw`(?<![\w-])scoped(?![\w-])`,ol=/<style\s+([^>]*)>/gi,Sf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,kf=new RegExp(_f,"i"),Ay=new RegExp(_f,"gi"),al=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ty(v){ol.lastIndex=0;let _=ol.exec(v);while(_!==null){if(kf.test(_[1]))return!0;_=ol.exec(v)}return!1}function cl(v){let _=new Set,k=[];al.lastIndex=0;let R=al.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=al.exec(v)}return k}function so(v){let _=cl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function ca(v,_){if(!Ty(v))return{html:v,hasScoped:!1};let k=bf(_),R=`data-v-${k}`,T=v,B=!1;if(Sf.lastIndex=0,T=T.replace(Sf,(z,W,F)=>{if(!kf.test(W))return z;B=!0;let U=Iy(F,R),H=W.replace(Ay,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${U}</style>`}),!B)return{html:v,hasScoped:!1};return T=Dy(T,R),{html:T,hasScoped:!0}}function Iy(v,_){return vf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Py=(v)=>`\x00stx-scope-mask-${v}\x00`,$f=/\u0000stx-scope-mask-(\d+)\u0000/g;function Dy(v,_){let k=Vn(v,(T,B)=>{let z=V(T,B);return z>B?z:is(T,B)},(T,B)=>Py(B)),R=Oy(k.output,_);return $f.lastIndex=0,R.replace($f,(T,B)=>k.tokens[Number(B)])}function Oy(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Hn=null,la="";function Cf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;la=`${_}@${Math.trunc(ao.statSync(_).mtimeMs)}`}catch{la=v}}var ul=!1,Hr=null,io="",cs=!1,If=256,Er=new Map,qn=new Map,ua=null,Pf=null,da=new Map,Rf=new Set;function fa(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function ll(v,_){if(Er.has(v))Er.delete(v);else if(Er.size>=If)Er.delete(Er.keys().next().value);Er.set(v,_)}function My(v){let _=fa(v);if(qn.has(_))qn.delete(_);else if(qn.size>=If)qn.delete(qn.keys().next().value);return qn.set(_,v),_}function ad(v){let _=qn.get(v);if(_===void 0)return;return qn.delete(v),qn.set(v,_),_}async function Ny(v,_=ua){if(!_)return null;try{let k=Bun.file(Ht.join(_,`cw-${fa(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function jy(v,_,k=ua){if(!k)return;try{if(!ao.existsSync(k))ao.mkdirSync(k,{recursive:!0});await Bun.write(Ht.join(k,`cw-${fa(v)}.css`),_)}catch{}}async function Af(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ly=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],By=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zy(){let v=[],_=process.cwd();while(_!==Ht.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ly)v.push(Ht.join(_,k,...R));_=Ht.dirname(_)}return v}function Wy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ht.join(_,"Code","Tools","ts-css"),_&&Ht.join(_,"Code","Tools","crosswind"),_&&Ht.join(_,"repos","stacks-org","ts-css"),_&&Ht.join(_,"repos","stacks-org","crosswind"),Ht.join(process.cwd(),"..","ts-css"),Ht.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Ht.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Ht.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ht.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function pi(){if(ul)return Hn;ul=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await Af(B);if(z){if(Cf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ht.dirname(Ht.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Ht.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Hn=B,Hn}let _=await v(zy());if(_)return Hn=_,Hn;let k=By;for(let T of k){let B=await Af(T);if(B){Hn=B;try{Cf(import.meta.resolve(T))}catch{la=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Hn}}let R=await v(Wy());if(R)return Hn=R,Hn;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function cd(){dl.clear(),Hn=null,ul=!1,Hr=null,io="",Er.clear(),qn.clear(),Pf=null,da.clear()}var Tf=!1;async function fi(v){try{let _=Ef({name:"css",cwd:v})?"css":Ef({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Tf)Tf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Ht.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Tc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-zq345s76.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Ht.isAbsolute(R.css)?R.css:Ht.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Ht.isAbsolute(R.css.config)?R.css.config:Ht.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await fi(v)}function $c(v){try{let _=new WeakSet;return fa(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Nt(v){if(cs)return io;cs=!0;try{let _=await pi();if(!_||!_.build)return cs=!1,"";if(!Hr)Hr=await fi(v);if(!Hr)return cs=!1,"";let k=_.defaultConfig?.theme||{},R=Hr.theme||{},T={..._.defaultConfig,...Hr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(io=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=Ht.isAbsolute(T.output)?T.output:Ht.join(v,T.output),U=Ht.dirname(F);if(!ao.existsSync(U))ao.mkdirSync(U,{recursive:!0});await Bun.write(F,z.css)}return cs=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),cs=!1,io}}async function xn(v){Hr=null,await Nt(v)}function ld(){return io}function Rc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var dl=m(64);async function Ac(v,_){let k=()=>da.get(_?Ht.resolve(_):process.cwd())?.fingerprint??null,R=dl.get(h(v,_,k()));if(R!==void 0)return R;let T=await Fy(v,_);if(T)dl.set(h(v,_,k()),T);return T}function*Df(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=di(R);if(T)yield T}}function ud(v){return[...Df(v)].join(`
146
146
  `)}async function Fy(v,_){try{let k=await pi();if(!k)return"";let R=new Set;for(let Oe of Df(v)){let Me=typeof k.extractClasses==="function"?k.extractClasses(Oe):Rc(Oe);for(let Ne of Me)R.add(Ne)}if(R.size===0)return"";let T=_?Ht.resolve(_):process.cwd(),B=a(T,"cache");if(!ua)ua=B;let z=da.get(T);if(!z){let Oe=await Tc(T);z={config:Oe,fingerprint:$c(Oe)},da.set(T,z),Pf=z.fingerprint}let W=[...R].sort().join(" "),F=`${la}::${z.fingerprint||"default"}::${W}`,U=Er.get(F);if(U!==void 0)return ll(F,U),U;let H=await Ny(F,B);if(H!==null)return ll(F,H),H;let q=k.defaultConfig||k.config,Q=z.config||{},ie=xf(q,Q),{safelist:Z,includePreflight:ae,minify:le,tokenCSS:ce}=ie;if(ie.unknownRoles.length>0&&!Rf.has(T))Rf.add(T),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${ie.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let de=ie.config,ue=new k.CSSGenerator(de),$e=de.shortcuts||Q.shortcuts||{},we=Object.keys($e).filter((Oe)=>R.has(Oe)||Z.includes(Oe));for(let Oe of Z)if(!$e[Oe])ue.generate(Oe);for(let Oe of R)if(!$e[Oe])ue.generate(Oe);let ye="";if(we.length>0){let Oe=new k.CSSGenerator(de);for(let Me of we)Oe.generate(Me);if(ye=Oe.toCSS(!1,le),ye&&!ye.endsWith(`
147
147
  `))ye+=`
148
148
  `}let Pe=ye+ue.toCSS(ae,le);return Pe=yf(k.CSSGenerator,ie)+ce+Pe,ll(F,Pe),jy(F,Pe,B),Pe}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await Ac(v,_);if(!T)return R?so(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${My(T)}.css">`:`<style data-css="generated">
@@ -2289,7 +2289,7 @@ ${H}
2289
2289
  customElements.define('${_}', ${z});
2290
2290
  `}async function kp(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",W=Pn.isAbsolute(z)?[Pn.join(z,`${T}.stx`),Pn.join(Pn.dirname(R),`${T}.stx`)]:[Pn.join(Pn.dirname(R),z,`${T}.stx`),Pn.join(process.cwd(),z,`${T}.stx`),Pn.join(Pn.dirname(R),`${T}.stx`)],F=null;for(let q of W)if(await r(q)){F=await Bun.file(q).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let U=Yx(F,T);return`<script type="module">
2291
2291
  ${Qx(U)}
2292
- </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:jt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:ap,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:kp,hasEndTag:!1,description:"Include a web component in the template"},Mi,Li,hr,yr,Xf,Gf,Jf,Zf,sp,Kf,hp,El,...Ar],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function tb(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=on.join(T,"resources","views"),z=on.join(T,"resources","layouts");if(ds.existsSync(B)&&ds.existsSync(z))return{root:"resources",pagesDir:"views"};let W=on.join(T,"resources","views","pages");if(ds.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var Ep=new Set,ba=["partialsDir","componentsDir","layoutsDir"],Cl=new WeakMap;function nb(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function el(v,_){let k=!v.root,R=tb(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!Ep.has(T))Ep.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Cl.has(v)){let T={};for(let B of ba){let z=v[B];if(typeof z==="string"&&z)T[B]=z}Cl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ba){let z=v[B];if(typeof z!=="string"||!z)continue;if(on.isAbsolute(z)||nb(z,T))continue;v[B]=on.join(T,z)}}for(let T of ba){let B=v[T];if(typeof B!=="string"||!B||on.isAbsolute(B))continue;v[T]=on.resolve(_,B)}return v}function rb(v,_){let k=Cl.get(v);for(let R of ba){let T=v[R];if(typeof T!=="string"||!T)continue;let B=on.isAbsolute(T)?T:on.join(_,T);if(ds.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function sb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function ib(v){if(Hi(v.stateDir),v.stateDir=Cn(),v.cachePath=_n(v.cachePath),v.build)v.build.cacheDir=_n(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=_n(v.media.cache.directory);if(v.story)v.story.outDir=_n(v.story.outDir)}var Ir=null,qr=new Map,xa=new Map,po=null;async function js(v,_=eb){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?on.resolve(v):process.cwd(),k=xa.get(_);if(k&&k.signature!==fr(k.graph)){let B=qr.get(_);if(qr.delete(_),xa.delete(_),!v)Ir=null,po=null;let{clearComponentCache:z}=await import("./chunk-pndhb1nk.js"),{partialsCache:W}=await import("./chunk-ajd5w5c4.js");if(z(),W.clear(),B&&k.configSignature===gr(k.graph)){let F=B.then(async(U)=>{let H={...k.graph};await Fs(H,_),xa.set(_,{graph:H,signature:fr(H),configSignature:gr(H)});let q={...U,_layerGraph:H};if(!v)Ir=q;return q});return qr.set(_,F),F}}if(!v){if(Ir)return Ir;if(po)return po}let R=qr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>ds.existsSync(on.join(_,`stx.config${Q}`))),W=B.some((Q)=>ds.existsSync(on.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await js({name:"ui",cwd:on.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await js({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,errorPolicy:"throw",verbose:!1})).config}else F=(await js({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Fi(_,A);F=Q.config,xa.set(_,{graph:Q.graph,signature:fr(Q.graph),configSignature:gr(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-fcgf8d5k.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:ie}=await import("./chunk-cw76y2p5.js");await ie(_,F.runtimeConfig)}sb(F),ib(F),el(F,_),rb(F,_);let U=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let ie=`${Q}/stx-plugin`;if(H.has(ie)||H.has(Q))continue;try{d.resolve(ie,{paths:[_]}),U.push(ie)}catch{}}let q=[...F.plugins??[],...U];if(q.length>0){let{pluginManager:Q}=await import("./chunk-zg87pybq.js"),ie=[],Z=[];for(let ae of q){let le=typeof ae==="string"?ae:ae[0],ce=typeof ae==="string"?{}:ae[1]||{};try{let de,ue;try{let we=d.resolve(le,{paths:[_]});de=await import(we),ue=on.dirname(we)}catch{let we=on.resolve(_,le);de=await import(we),ue=on.dirname(we)}let $e=de.default||de;if(!Q.has($e.name))await Q.register($e,F);if($e.components){let we=Array.isArray($e.components)?$e.components:[$e.components];for(let ye of we)ie.push(on.resolve(ue,ye))}if($e.pages){let we=on.resolve(ue,$e.pages),ye=ce.path||"/";Z.push({dir:we,prefix:ye})}if($e.setup){let we={addDirective:(ye)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(ye)},addRoute:(ye,Pe)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[ye]=Pe},addMiddleware:(ye)=>{F.middleware=F.middleware||[],F.middleware.push(ye)},pluginDir:ue,config:F};await $e.setup(ce,we)}process.stderr.write(`[stx] Plugin loaded: ${$e.name||le}
2292
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:jt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:ap,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:kp,hasEndTag:!1,description:"Include a web component in the template"},Mi,Li,hr,yr,Xf,Gf,Jf,Zf,sp,Kf,hp,El,...Ar],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function tb(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=on.join(T,"resources","views"),z=on.join(T,"resources","layouts");if(ds.existsSync(B)&&ds.existsSync(z))return{root:"resources",pagesDir:"views"};let W=on.join(T,"resources","views","pages");if(ds.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var Ep=new Set,ba=["partialsDir","componentsDir","layoutsDir"],Cl=new WeakMap;function nb(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function el(v,_){let k=!v.root,R=tb(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!Ep.has(T))Ep.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Cl.has(v)){let T={};for(let B of ba){let z=v[B];if(typeof z==="string"&&z)T[B]=z}Cl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ba){let z=v[B];if(typeof z!=="string"||!z)continue;if(on.isAbsolute(z)||nb(z,T))continue;v[B]=on.join(T,z)}}for(let T of ba){let B=v[T];if(typeof B!=="string"||!B||on.isAbsolute(B))continue;v[T]=on.resolve(_,B)}return v}function rb(v,_){let k=Cl.get(v);for(let R of ba){let T=v[R];if(typeof T!=="string"||!T)continue;let B=on.isAbsolute(T)?T:on.join(_,T);if(ds.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function sb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function ib(v){if(Hi(v.stateDir),v.stateDir=Cn(),v.cachePath=_n(v.cachePath),v.build)v.build.cacheDir=_n(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=_n(v.media.cache.directory);if(v.story)v.story.outDir=_n(v.story.outDir)}var Ir=null,qr=new Map,xa=new Map,po=null;async function js(v,_=eb){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?on.resolve(v):process.cwd(),k=xa.get(_);if(k&&k.signature!==fr(k.graph)){let B=qr.get(_);if(qr.delete(_),xa.delete(_),!v)Ir=null,po=null;let{clearComponentCache:z}=await import("./chunk-9zzhpp2a.js"),{partialsCache:W}=await import("./chunk-39pgf5z3.js");if(z(),W.clear(),B&&k.configSignature===gr(k.graph)){let F=B.then(async(U)=>{let H={...k.graph};await Fs(H,_),xa.set(_,{graph:H,signature:fr(H),configSignature:gr(H)});let q={...U,_layerGraph:H};if(!v)Ir=q;return q});return qr.set(_,F),F}}if(!v){if(Ir)return Ir;if(po)return po}let R=qr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>ds.existsSync(on.join(_,`stx.config${Q}`))),W=B.some((Q)=>ds.existsSync(on.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await js({name:"ui",cwd:on.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await js({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,errorPolicy:"throw",verbose:!1})).config}else F=(await js({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Fi(_,A);F=Q.config,xa.set(_,{graph:Q.graph,signature:fr(Q.graph),configSignature:gr(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-fcgf8d5k.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:ie}=await import("./chunk-wtax276j.js");await ie(_,F.runtimeConfig)}sb(F),ib(F),el(F,_),rb(F,_);let U=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let ie=`${Q}/stx-plugin`;if(H.has(ie)||H.has(Q))continue;try{d.resolve(ie,{paths:[_]}),U.push(ie)}catch{}}let q=[...F.plugins??[],...U];if(q.length>0){let{pluginManager:Q}=await import("./chunk-zg87pybq.js"),ie=[],Z=[];for(let ae of q){let le=typeof ae==="string"?ae:ae[0],ce=typeof ae==="string"?{}:ae[1]||{};try{let de,ue;try{let we=d.resolve(le,{paths:[_]});de=await import(we),ue=on.dirname(we)}catch{let we=on.resolve(_,le);de=await import(we),ue=on.dirname(we)}let $e=de.default||de;if(!Q.has($e.name))await Q.register($e,F);if($e.components){let we=Array.isArray($e.components)?$e.components:[$e.components];for(let ye of we)ie.push(on.resolve(ue,ye))}if($e.pages){let we=on.resolve(ue,$e.pages),ye=ce.path||"/";Z.push({dir:we,prefix:ye})}if($e.setup){let we={addDirective:(ye)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(ye)},addRoute:(ye,Pe)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[ye]=Pe},addMiddleware:(ye)=>{F.middleware=F.middleware||[],F.middleware.push(ye)},pluginDir:ue,config:F};await $e.setup(ce,we)}process.stderr.write(`[stx] Plugin loaded: ${$e.name||le}
2293
2293
  `)}catch(de){console.warn(`[stx] Failed to load plugin ${le}:`,de.message)}}F._pluginComponentDirs=ie,F._pluginPageDirs=Z}return F})();if(qr.set(_,T),T.catch(()=>{if(qr.get(_)===T)qr.delete(_)}),!v)po=T,T.then((B)=>{Ir=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Ir&&_ in Ir)return Ir[_];if(!po)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function yd(v){return v}function bd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${B}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var Al=new Map;async function me(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await ob.promises.stat(v)).mtime.getTime();if(_.cache&&Al.has(v)){let q=Al.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=tr(T),W=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=Ue(z,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)U=await cb(U,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:U,data:B||{}};if(_.cache)Al.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var va=null;async function cb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!va)try{va=await ab({theme:_||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),v}let T=async(W,F,U,H)=>{let q=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Q=U||(k?"text":"");if(!Q)return W;try{if(!va.getSupportedLanguages().includes(Q))return W;return(await va.highlight(q,Q,{theme:_})).html}catch(ie){console.error(`Error highlighting code block with language ${U}:`,ie)}return W},B=v,z=v.matchAll(R);for(let W of z){let[F,U,H,q]=W,Q=await T(F,U,H,q);B=B.replace(F,Q)}return B}async function Cp(v,_,k="",R={}){return await lb(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,W,F,U)=>{try{let H=W;if(!Rl.isAbsolute(W))H=Rl.resolve(Rl.dirname(k),W);let q={};if(F)try{try{q=JSON.parse(F)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let de=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ue of de){let $e=ue.indexOf(":");if($e>0){let we=ue.substring(0,$e).trim(),ye=ue.substring($e+1).trim(),Pe=ye.startsWith('"')&&ye.endsWith('"'),Oe=ye.startsWith("'")&&ye.endsWith("'");if(Pe||Oe)ye=ye.substring(1,ye.length-1);q[we]=ye}}}}catch(ce){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ce)}let{content:Q,data:ie}=await me(H,R),Z={..._,...ie,...q},ae=Q,le=/\{\{([^}]+)\}\}/g;return ae=ae.replace(le,(ce,de)=>{let ue=de.trim();return Z[ue]!==void 0?String(Z[ue]):ce}),ae}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,U,z)}})}async function lb(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let W=T[0],F=T.index,U=T;R.push(k(...U).then((H)=>({match:W,replacement:H,index:F})))}let B=await Promise.all(R);B.sort((W,F)=>F.index-W.index);let z=v;for(let{match:W,replacement:F}of B)z=z.replace(W,()=>F);return z}function Pr(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Dr(v,_){let k=ub(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function ub(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function db(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Kr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),W=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,W.lastIndex=B;let F=z.exec(v),U=W.exec(v),H=F?F.index:1/0,q=U?U.index:1/0;if(H<q)T++,B=H+F[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+U[0].length}else break}return-1}function Rp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Dr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"if","endif",B);if(z===-1)return null;let W=v.slice(B,z),F=[],U=0,H="if",q=T.expression,Q=0,ie=0;while(U<W.length){let Z=W.indexOf("@",U);if(Z===-1)break;U=Z;let ae=W.substring(Z);if(db(W,Z)){U++;continue}if(/^@if\s*\(/.test(ae)){ie++,U++;continue}if(/^@endif(?![a-z])/.test(ae)){ie--,U+=6;continue}if(ie===0){let le=ae.match(/^@elseif\s*/);if(le){F.push({type:H,condition:q,content:W.substring(Q,U),start:B+Q,end:B+U});let ce=U+le[0].length,de=Dr(W,ce);if(!de){U++;continue}H="elseif",q=de.expression,U=de.endPos,Q=U;continue}else if(/^@else(?![a-z])/.test(ae)){F.push({type:H,condition:q,content:W.substring(Q,U),start:B+Q,end:B+U}),H="else",q=void 0,U+=5,Q=U;continue}}U++}return F.push({type:H,condition:q,content:W.slice(Q),start:B+Q,end:B+W.length}),{fullMatch:v.slice(_,z+6),branches:F,start:_,end:z+6}}function go(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=Rp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function wa(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((ae)=>B.index>ae.start&&B.index<ae.end)){B=T.exec(v);continue}let W=B.index,F=W+B[0].length-1,U=S(v,"(",")",F);if(U===-1){B=T.exec(v);continue}let H=v.slice(F+1,U),q=U+1,Q=Kr(v,_,k,q);if(Q===-1){B=T.exec(v);continue}let ie=v.slice(q,Q),Z=Q+`@${k}`.length;R.push({fullMatch:v.slice(W,Z),name:_,params:H,content:ie,start:W,end:Z}),T.lastIndex=Z,B=T.exec(v)}return R}function Tl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=Dr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"switch","endswitch",B);if(z===-1)return null;let W=v.slice(B,z),F=[],U=0,H=null,q=0;while(U<W.length){let Q=W.slice(U),ie=Q.match(/^@switch\s*\(/),Z=Q.match(/^@endswitch(?![a-z])/);if(ie){if(q++,H)H.content+=ie[0];U+=ie[0].length;continue}if(Z){if(q--,H)H.content+=Z[0];U+=Z[0].length;continue}if(q>0){if(H)H.content+=W[U];U++;continue}let ae=Q.match(/^@case\s*/),le=Q.match(/^@default(?![a-z])/),ce=Q.match(/^@break(?![a-z])/);if(ae&&Q.startsWith("@case")){if(H)F.push(H);let de=U+ae[0].length,ue=Dr(W,de);if(!ue){U++;continue}H={type:"case",value:ue.expression,content:""},U=ue.endPos}else if(le&&Q.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},U+=le[0].length}else if(ce&&Q.startsWith("@break"))U+=ce[0].length;else{if(H)H.content+=W[U];U++}}if(H)F.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:F,start:_,end:z+10}}function mb(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=Tl(R,z);if(!W)break;try{let F;if(p(W.expression))F=c(W.expression,Object.keys(_))(...Object.values(_));else F=l(W.expression,_);let U="",H=!1;for(let q of W.cases)if(q.type==="default"){if(!H)U=q.content.trim()}else try{let Q;if(q.value&&p(q.value))Q=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)Q=l(q.value,_);if(F===Q){U=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+U+R.substring(W.end),T=!0}catch(F){let U=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${U}`,t.EVALUATION_ERROR);R=R.substring(0,z)+H+R.substring(W.end);break}}return R}function hb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function yb(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function br(v,_,k){let{masked:R,scripts:T}=hb(v);return yb(xb(R,_,k),T)}function xb(v,_,k){let R=v;R=mb(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=Dr(R,W+7);if(!F)break;let U=F.endPos,H=Kr(R,"unless","endunless",U);if(H===-1){console.warn(`[stx] @unless directive at position ${W} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(U,H),Q=F.expression,ie=-1;{let ae=0,le=/@(?:if|unless)\s*\(/g,ce=/@(?:endif|endunless)(?![a-z])/g,de=/@else(?![a-z])/g,ue=[],$e;while(($e=le.exec(q))!==null)ue.push({pos:$e.index,type:"open"});while(($e=ce.exec(q))!==null)ue.push({pos:$e.index,type:"close"});while(($e=de.exec(q))!==null)ue.push({pos:$e.index,type:"else"});ue.sort((we,ye)=>we.pos-ye.pos);for(let we of ue)if(we.type==="open")ae++;else if(we.type==="close")ae--;else if(we.type==="else"&&ae===0){ie=we.pos;break}}let Z;if(ie!==-1){let ae=q.slice(0,ie),le=q.slice(ie+5);Z=`@if (${Q})${le}@else ${ae}@endif`}else Z=`@if (!(${Q}))${q}@endif`;R=R.substring(0,W)+Z+R.substring(H+10),B=!0}}R=Pl(R,_,k),R=Dl(R,_,k),R=Il(R,_);let T=()=>{let B=go(R);if(B.length===0)return!1;let z=Array(B.length);for(let U=B.length-1;U>=0;U--){let H=B[U];try{let q="",Q=!1;for(let ie of H.branches){if(Q)break;if(ie.type==="else")q=ie.content,Q=!0;else try{if(ie.condition?Xi(ie.condition,_):!1)q=ie.content,Q=!0}catch(Z){q=i(ie.type==="if"?"If":"Elseif",`Error in @${ie.type}(${ie.condition}): ${Z instanceof Error?Z.message:String(Z)}`,t.EVALUATION_ERROR),Q=!0}}z[U]=q}catch(q){let Q=q instanceof Error?q.message:String(q);z[U]=i("If",`Error processing @if block: ${Q}`,t.EVALUATION_ERROR)}}let W=Array(B.length*2+1),F=0;for(let U=0;U<B.length;U++){let H=B[U];W[U*2]=R.slice(F,H.start),W[U*2+1]=z[U],F=H.end}return W[B.length*2]=R.slice(F),R=W.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function Ap(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function Il(v,_){let k=v;function R(W,F,U,H){let q=1,Q=H,ie=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Z=new RegExp(`@${U}(?![a-z])`,"g");while(Q<W.length&&q>0){ie.lastIndex=Q,Z.lastIndex=Q;let ae=ie.exec(W),le=Z.exec(W),ce=ae?ae.index:1/0,de=le?le.index:1/0;if(ce<de)q++,Q=ce+ae[0].length;else if(de<1/0){if(q--,q===0)return de;Q=de+le[0].length}else break}return-1}function T(W,F,U){let H=0,q=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${U}(?![a-z])`,"g"),ie=/@else(?![a-z])/g,Z=[],ae;while((ae=q.exec(W))!==null)Z.push({pos:ae.index,type:"open"});while((ae=Q.exec(W))!==null)Z.push({pos:ae.index,type:"close"});while((ae=ie.exec(W))!==null)Z.push({pos:ae.index,type:"else"});Z.sort((le,ce)=>le.pos-ce.pos);for(let le of Z)if(le.type==="open")H++;else if(le.type==="close")H--;else if(le.type==="else"&&H===0)return le.pos;return-1}{let W=!0;while(W){W=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let U=F.index,H,q,Q=k.slice(U+5),ie=Ap(Q);if(ie)H=ie.value,q=U+5+ie.consumed;else q=U+5;let Z=R(k,"auth","endauth",q);if(Z===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let ae=k.slice(q,Z),le=T(ae,"auth","endauth"),ce;if(!_.auth)ce=!1;else ce=H?Pr(`auth?.check && auth?.user?.[${H}]`,_):Pr("auth?.check",_);let de;if(le!==-1){let ue=ae.slice(0,le),$e=ae.slice(le+5);de=ce?ue:$e}else de=ce?ae:"";k=k.substring(0,U)+de+k.substring(Z+8),W=!0}}{let W=!0;while(W){W=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let U=F.index,H,q,Q=k.slice(U+6),ie=Ap(Q);if(ie)H=ie.value,q=U+6+ie.consumed;else q=U+6;let Z=R(k,"guest","endguest",q);if(Z===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let ae=k.slice(q,Z),le=T(ae,"guest","endguest"),ce;if(!_.auth)ce=!0;else ce=H?Pr(`!auth?.check || !auth?.user?.[${H}]`,_):Pr("!auth?.check",_);let de;if(le!==-1){let ue=ae.slice(0,le),$e=ae.slice(le+5);de=ce?ue:$e}else de=ce?ae:"";k=k.substring(0,U)+de+k.substring(Z+9),W=!0}}function B(W,F,U){if(_.userCan&&typeof _.userCan[W]==="boolean")return _.userCan[W];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[W];if(F)H.push(F);if(U){let q=Pr(U,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(W){let F=W.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let W of["can","cannot"]){let F=`end${W}`,U=W==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${W}\\s*\\(`));if(!q||q.index===void 0)break;let Q=q.index,ie=k.slice(Q+`@${W}`.length),Z=z(ie);if(!Z)break;let ae=Q+`@${W}`.length+Z.paramsEnd,le=R(k,W,F,ae);if(le===-1){console.warn(`[stx] @${W} directive at position ${Q} has no matching @${F} \u2014 the block was skipped.`);break}let ce=k.slice(ae,le),de=[],ue=0,$e=new RegExp(`@${W}\\s*\\(`,"g"),we=new RegExp(`@${F}(?![a-z])`,"g"),ye=new RegExp(`@${U}\\s*\\(`,"g"),Pe=/@else(?![a-z])/g,Oe=[],Me;while((Me=$e.exec(ce))!==null)Oe.push({pos:Me.index,type:"open"});while((Me=we.exec(ce))!==null)Oe.push({pos:Me.index,type:"close"});while((Me=ye.exec(ce))!==null)Oe.push({pos:Me.index,type:"elseDirective"});while((Me=Pe.exec(ce))!==null)Oe.push({pos:Me.index,type:"else"});Oe.sort((Be,je)=>Be.pos-je.pos);for(let Be of Oe){if(Be.type==="open"){ue++;continue}if(Be.type==="close"){ue--;continue}if(ue===0)de.push(Be)}let Ne=[],Le=0;for(let Be=0;Be<de.length;Be++){let je=de[Be];if(Ne.push({content:ce.slice(Le,je.pos),ability:void 0}),je.type==="elseDirective"){let st=ce.slice(je.pos+`@${U}`.length),ht=z(st);if(ht){Ne[Ne.length-1]={content:ce.slice(Le,je.pos)},Le=je.pos+`@${U}`.length+ht.paramsEnd,Ne.push({content:"",ability:ht.ability,type:ht.type,id:ht.id}),Ne.pop();let yt=de[Be+1],vt=yt?yt.pos:ce.length;Ne.push({content:ce.slice(Le,vt),ability:ht.ability,type:ht.type,id:ht.id}),Le=vt}}else Le=je.pos+5}if(Le<ce.length){let Be=Ne[Ne.length-1];if(de.length>0&&de[de.length-1].type==="else")Ne.push({content:ce.slice(Le),isFinalElse:!0});else if(Ne.length===0)Ne.push({content:ce.slice(Le)})}let De=B(Z.ability,Z.type,Z.id),ze=W==="can"?De:!De,Ve="";if(ze)Ve=Ne[0]?.content||"";else{let Be=!1;for(let je=1;je<Ne.length;je++){let st=Ne[je];if(st.isFinalElse){Ve=st.content,Be=!0;break}if(st.ability){let ht=B(st.ability,st.type,st.id);if(W==="can"?ht:!ht){Ve=st.content,Be=!0;break}}}if(!Be&&Ne.length>0){let je=Ne[Ne.length-1];if(je.isFinalElse)Ve=je.content}}k=k.substring(0,Q)+Ve+k.substring(le+`@${F}`.length),H=!0}}return k}function Pl(v,_,k){let R=v;function T(B,z,W,F,U){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),Q=B.match(q);if(!Q||Q.index===void 0)break;let ie=Q.index,Z=Dr(B,ie+`@${z}`.length);if(!Z)break;let ae=Z.endPos,le=Kr(B,z,W,ae);if(le===-1){console.warn(`[stx] @${z} directive at position ${ie} has no matching @${W} \u2014 the block was skipped.`);break}let ce=B.slice(ae,le),de=Z.expression,ue=-1,$e=0,we=0;while(we<ce.length){let ye=ce.indexOf("@",we);if(ye===-1)break;let Pe=ce.substring(ye);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Pe)){$e++,we=ye+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Pe)){$e--,we=ye+1;continue}if($e===0&&/^@else(?![a-z])/.test(Pe)){ue=ye;break}we=ye+1}try{let ye=F(de.trim()),Pe;if(ue!==-1){let Oe=ce.slice(0,ue),Me=ce.slice(ue+5);Pe=ye?Oe:Me}else Pe=ye?ce:"";B=B.substring(0,ie)+Pe+B.substring(le+`@${W}`.length),H=!0}catch(ye){let Pe=ye instanceof Error?ye.message:String(ye),Oe=i(U,`Error processing @${z} directive: ${Pe}`,t.EVALUATION_ERROR);B=B.substring(0,ie)+Oe+B.substring(le+`@${W}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=Pr(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=Pr(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function Dl(v,_,k){let R=v,T="development";function B(z,W,F,U){let H=new RegExp(`@${W}(?![a-z])`,"g"),q=new RegExp(`@${F}(?![a-z])`,"g"),Q=new RegExp(`^@${W}(?![a-z])`),ie=new RegExp(`^@${F}(?![a-z])`),Z=z,ae=!0;while(ae){ae=!1,H.lastIndex=0;let le=H.exec(Z);if(!le)break;let ce=le.index,de=ce+le[0].length;if(W==="env"){let De=Z.substring(de).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!De)break;de+=De[0].length,U=T===De[2]}let ue=1,$e=de,we=-1;while(ue>0&&$e<Z.length){H.lastIndex=$e,q.lastIndex=$e;let De=H.exec(Z),ze=q.exec(Z),Ve=De?De.index:1/0,Be=ze?ze.index:1/0;if(Ve<Be)ue++,$e=Ve+De[0].length;else if(Be<1/0){if(ue--,ue===0){we=Be;break}$e=Be+ze[0].length}else break}if(we===-1){console.warn(`[stx] @${W} directive at position ${ce} has no matching @${F} \u2014 the block was skipped.`);break}let ye=Z.substring(de,we),Pe=-1,Oe=0,Me=0;while(Me<ye.length){let De=ye.indexOf("@",Me);if(De===-1)break;let ze=ye.substring(De);if(Q.test(ze)){Oe++,Me=De+1;continue}if(ie.test(ze)){Oe--,Me=De+1;continue}if(Oe===0&&/^@else(?![a-z])/.test(ze)){Pe=De;break}Me=De+1}let Ne;if(Pe!==-1){let De=ye.slice(0,Pe),ze=ye.slice(Pe+5);Ne=U?De:ze}else Ne=U?ye:"";let Le=`@${F}`.length;Z=Z.substring(0,ce)+Ne+Z.substring(we+Le),ae=!0}return Z}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var Tp=new WeakMap;function Ip(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Sa(v,_){if(!v)return _?.nonceGenerator?.()??Ip();let k=Tp.get(v);if(!k)k=_?.nonceGenerator?.()??Ip(),Tp.set(v,k);return k}function bb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function Pp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${bb(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Dp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let R=_.useNonce?Sa(k,_):void 0,T=Pp(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2294
2294
  ${T}`)}function Op(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function Mp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?Sa(_,B):void 0;return Pp(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return Sa(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=Sa(_,B);return T}import vb from"crypto";var wb=40,Np="_token",Ol=null;function Sb(v=wb){let _=vb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Ol=_,_}function $b(){if(!Ol)Sb();return Ol}function _b(v=Np){let _=$b();return`<input type="hidden" name="${v}" value="${_}">`}function jp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>_b(R||Np))}async function Lp(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await kb(T,B,_,k,R);else T=await Eb(T,B,_,k,R)}return T}async function kb(v,_,k,R,T){let{name:B,handler:z}=_,W=`@${B}`,F=`@end${B}`,U=v,H=Fr(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),q=[],Q=H.exec(U);while(Q!==null){let[ie,Z="",ae=""]=Q,le=Q.index||0;try{let ce=Z?Bp(_,Z):[],de=ae.trim(),ue=await z(de,ce,k,R);q.push({original:ie,processed:ue,startIndex:le})}catch(ce){let de=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);q.push({original:ie,processed:i("CustomDirective",`Error in @${B}${Z?`(${Z})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:le})}Q=H.exec(U)}for(let ie=q.length-1;ie>=0;ie--){let{original:Z,processed:ae}=q[ie];U=U.replace(Z,ae)}return U}async function Eb(v,_,k,R,T){let{name:B,handler:z}=_,W=v,F=[],U=[];if(_.rawParams){for(let Q of Gs(W,Fr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(Q.end!==-1)U.push({fullMatch:Q.call,paramString:Q.args,startIndex:Q.start})}else{let Q=Fr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Q.lastIndex=0;let ie=Q.exec(W);while(ie!==null)U.push({fullMatch:ie[0],paramString:ie[1]??"",startIndex:ie.index||0}),ie=Q.exec(W)}for(let{fullMatch:Q,paramString:ie,startIndex:Z}of U)try{let ae=Bp(_,ie),le=await z("",ae,k,R);F.push({original:Q,processed:le,startIndex:Z})}catch(ae){let le=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${B}:`,ae);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}(${ie}): ${le}`,t.EVALUATION_ERROR),startIndex:Z})}let H=Fr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(W);while(q!==null){let[Q]=q,ie=q.index||0;try{let Z=await z("",[],k,R);F.push({original:Q,processed:Z,startIndex:ie})}catch(Z){let ae=Z instanceof Error?Z.message:String(Z);if(T.debug)console.error(`Error processing custom directive @${B}:`,Z);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}: ${ae}`,t.EVALUATION_ERROR),startIndex:ie})}q=H.exec(W)}for(let Q=F.length-1;Q>=0;Q--){let{original:ie,processed:Z}=F[Q];W=W.replace(ie,Z)}return W}function Bp(v,_){return v.rawParams?ot(_):Cb(_)}function Cb(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var zp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Wp=/^[A-Za-z_$][\w$]*$/,Rb=new Set(["light","dark","system"]);function Xr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Ab(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Xr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Xr(R.key,"colorMode.key"),Xr(R.attribute,"colorMode.attribute"),Xr(R.default,"colorMode.default"),!Wp.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!zp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Rb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Xr(k.key,"appearance.key"),Xr(k.attribute,"appearance.attribute"),Xr(k.default,"appearance.default"),!Wp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!zp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function Tb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Ib(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Tb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Pb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Fp(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Pb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=k.slice(B+1,z).trim(),F=l(`(${W})`,_),U=Ib(Ab(F));k=k.slice(0,T.index)+U+k.slice(z+1),R.lastIndex=T.index+U.length}return k}import Db from"crypto";function nn(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Up={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function $a(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function On(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function fs(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${nn(_)}"`}function Ml(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${nn(`${On(v)}-error`)}"`;return R}function Ob(){return Db.randomUUID()}function _a(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=Ob();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${nn(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${nn(B)}">`;return R}),k}function Hp(v,_,k=Up){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,W,F,U="")=>{let H=B||z||"POST",q=W||F||"",Q=Or(U),ie=H.toUpperCase(),Z=["GET","POST"].includes(ie)?ie:"POST",ae=`<form method="${nn(Z)}" action="${nn(q)}"${Q?` ${Q}`:""}>`;if(ae+=`
2295
2295
  ${_a("@csrf",_)}`,!["GET","POST"].includes(ie))ae+=`
@@ -2435,7 +2435,7 @@ document.addEventListener("focusout",function(e){
2435
2435
  });
2436
2436
  })();
2437
2437
  `}function mg(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}function hg(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),R=v.match(k);if(!R)return{region:null,rest:v};return{region:R[2],rest:v.replace(R[0],"")}}var su={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=hg(_,"fallback"),T=R.rest,B=hg(T,"error"),z=B.rest,W=R.region??mg(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=B.region??mg(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${W}</div><div data-stx-suspense-error hidden>${F}</div><div data-stx-suspense-content hidden>${z}</div></div>`}};function Oa(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}var iu={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let R=(Oa(v,"name")||"v").replace(/["'<>]/g,""),T=(Oa(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",B=Oa(v,"class"),z=Oa(v,"id"),W=[`data-stx-transition-group="${R}"`,B?`class="${B}"`:"",z?`id="${z}"`:""].filter(Boolean).join(" ");return`<${T} ${W}>${_}</${T}>`}};function yg(v=Bs){v.registerBuiltin(Ll),v.registerBuiltin(Zl),v.registerBuiltin(Gl),v.registerBuiltin(Yl),v.registerBuiltin(Ql),v.registerBuiltin(eu),v.registerBuiltin(tu),v.registerBuiltin(nu),v.registerBuiltin(su),v.registerBuiltin(iu)}var xg=new Map;function Sv(v){let _=xg.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),xg.set(v.source,_);return _}var bg=new WeakMap;function vg(v){let _=bg.get(v);if(!_)_=new Set([...v].map((R)=>R.toLowerCase())),bg.set(v,_);let k=_;return(R)=>!/[a-z]/.test(R)&&k.has(R.toLowerCase())}function $v(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function wg(v,_,k){let R=[],T=0,B=typeof k==="function"?k:k?(z)=>k.has(z.toLowerCase()):void 0;while(T<v.length){let z=v.indexOf("<",T);if(z===-1)break;let W=Sv(_);W.lastIndex=z+1;let F=W.exec(v);if(!F){T=z+1;continue}let U=F[1];if(B&&B(U)){let le=z+1+U.length;while(le<v.length&&v[le]!==">")le++;T=le+1;continue}let H=z+1+U.length,q=null,Q=H,ie=-1,Z=!1;while(H<v.length){let le=v[H];if(q){if(le==="\\"&&H+1<v.length){H+=2;continue}if(le===q)q=null;H++;continue}if(le==='"'||le==="'"){q=le,H++;continue}if(le==="/"&&H+1<v.length&&v[H+1]===">"){ie=H+2,Z=!0;break}if(le===">"){ie=H+1;break}H++}if(ie===-1){T=z+1;continue}let ae=v.slice(Q,Z?ie-2:ie-1).trim();if(Z)R.push({fullMatch:v.slice(z,ie),tagName:U,attributes:ae,content:"",startIndex:z,endIndex:ie,isSelfClosing:!0}),T=ie;else{let le=`<${U}`,ce=`</${U}>`,de=1,ue=ie,$e=-1;while(de>0&&ue<v.length){let Pe=v.indexOf(le,ue),Oe=v.indexOf(ce,ue);if(Oe===-1)break;if(Pe!==-1&&Pe<Oe){let Me=v[Pe+le.length];if(Me===" "||Me===">"||Me==="/"||Me===`
2438
- `||Me==="\t"){let Ne=$v(v,Pe+le.length);if(v[Ne-1]!=="/")de++;ue=Ne+1}else ue=Pe+le.length}else{if(de--,de===0){$e=Oe;break}ue=Oe+ce.length}}if($e===-1){T=ie;continue}let we=v.slice(ie,$e),ye=$e+ce.length;R.push({fullMatch:v.slice(z,ye),tagName:U,attributes:ae,content:we,startIndex:z,endIndex:ye,isSelfClosing:!1}),T=ye}}return R}function ou(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Sg(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function au(v,_){let k=0,R="",T=_;while(T<v.length){let B=v[T];if(R){if(B==="\\")T++;else if(B===R)R=""}else if(B==='"'||B==="'"||B==="`")R=B;else if(B==="{")k++;else if(B==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function $g(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(au(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var _v=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),kv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ev(v){return cu(v).map((_)=>[_.start,_.end])}function cu(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",B=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!B)continue;let z=Wr(B[1]??B[2]??B[3]??""),W=R.index,F=W+R[0].length,U=R[1].toLowerCase();if(R[0].endsWith("/>")||kv.has(U)){_.push({start:W,end:F,names:z});continue}let H=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=F;let Q=1,ie=F,Z;while((Z=q.exec(v))!==null)if(Z[0].startsWith("</")){if(Q--,Q===0){ie=Z.index+Z[0].length;break}}else if(!Z[0].endsWith("/>"))Q++;_.push({start:W,end:ie,names:z})}return _}function _g(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>_g(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function kg(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,R=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],B;while((B=R.exec(v))!==null)T.push([B.index,B.index+B[0].length]);T.push(...Ev(v));let z=new Set(kr(_));function W(Q){return T.some(([ie,Z])=>Q>=ie&&Q<Z)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,U=[],H=new Map,q=256;while((B=F.exec(k))!==null){if(W(B.index))continue;let Q=B[0],ie=B[2];if(!ie||!ie.includes(":"))continue;let Z=/(?:^|\s)data-native(?:\s|=|$)/i.test(ie.replace(/"[^"]*"|'[^']*'/g,"")),ae=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,le,ce=ie,de=!1;while((le=ae.exec(ie))!==null){let ue=le[1],$e=le[2];if(Qi(ue))continue;if(te($e,z))continue;if($e.includes("()")&&!$e.includes(".get(")||$e.includes("$store")||$e.includes("$ref"))continue;try{let we=Object.keys(_),ye=Object.values(_),Pe=$e.match(/^([a-zA-Z_$][\w$]*)/);if(Pe&&!we.includes(Pe[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Pe[1]))continue;let Oe=JSON.stringify([we,$e]),Me=H.get(Oe);if(!Me){if(Me=Function(...we,`return (${$e})`),H.size>=q)H.clear();H.set(Oe,Me)}let Ne=Me(...ye);if(ue==="class"){let Le=_g(Ne);if(Le){let De=ce.match(/\sclass="([^"]*)"/);if(De)ce=ce.replace(De[0],` class="${De[1]} ${Le}"`);else ce=ce.replace(le[0],` class="${Le}"`)}else ce=ce.replace(le[0],"");de=!0;continue}if(_v.has(ue)){if(Ne)ce=ce.replace(le[0],` ${ue}`);else ce=ce.replace(le[0],"");de=!0;continue}if(Ne===null||Ne===void 0||Ne===!1)ce=ce.replace(le[0],"");else{let De=(Z&&typeof Ne==="object"?JSON.stringify(Ne):String(Ne)).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ce=ce.replace(le[0],` ${ue}="${De}"`)}de=!0}catch{continue}}if(de){let ue=B[3]?" /":"",we=`<${B[1]}${ce}${ue}>`;U.push({start:B.index,end:B.index+Q.length,replacement:we})}}if(U.length>0){let Q=Array(U.length*2+1),ie=0;for(let Z=0;Z<U.length;Z++){let{start:ae,end:le,replacement:ce}=U[Z];Q[Z*2]=k.slice(ie,ae),Q[Z*2+1]=ce,ie=le}Q[U.length*2]=k.slice(ie),k=Q.join("")}return k}var K=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];import Lg from"path";import uu from"fs";import ko from"path";function Eg(v,_,k,R){let T=0;for(let B=_;B<v.length;B++)if(v[B]===k)T++;else if(v[B]===R&&!(R===">"&&v[B-1]==="=")){if(--T===0)return B}return-1}function Cv(v){let _=s(v),k=0,R=0,T=[];for(let B=0;B<_.length;B++)if("([{".includes(_[B]))k++;else if(")]}".includes(_[B]))k--;else if(_[B]===","&&k===0)T.push(v.slice(R,B).trim()),R=B+1;return T.push(v.slice(R).trim()),T}function lu(v,_){let k=s(v),R=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(R)){let B=T.index+T[0].length,z="";if(k[B]==="<"){let F=Eg(k,B,"<",">");if(F<0)continue;z=v.slice(B+1,F),B=F+1;while(/\s/.test(k[B]||"")&&B<k.length)B++}if(k[B]!=="(")continue;let W=Eg(k,B,"(",")");if(W>=0)return{type:z,args:Cv(v.slice(B+1,W))}}return null}var Cg=`
2438
+ `||Me==="\t"){let Ne=$v(v,Pe+le.length);if(v[Ne-1]!=="/")de++;ue=Ne+1}else ue=Pe+le.length}else{if(de--,de===0){$e=Oe;break}ue=Oe+ce.length}}if($e===-1){T=ie;continue}let we=v.slice(ie,$e),ye=$e+ce.length;R.push({fullMatch:v.slice(z,ye),tagName:U,attributes:ae,content:we,startIndex:z,endIndex:ye,isSelfClosing:!1}),T=ye}}return R}function ou(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Sg(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function au(v,_){let k=0,R="",T=_;while(T<v.length){let B=v[T];if(R){if(B==="\\")T++;else if(B===R)R=""}else if(B==='"'||B==="'"||B==="`")R=B;else if(B==="{")k++;else if(B==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function $g(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(au(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var _v=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),kv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ev(v){return cu(v).map((_)=>[_.start,_.end])}function cu(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",B=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!B)continue;let z=Wr(B[1]??B[2]??B[3]??""),W=R.index,F=W+R[0].length,U=R[1].toLowerCase();if(R[0].endsWith("/>")||kv.has(U)){_.push({start:W,end:F,names:z});continue}let H=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=F;let Q=1,ie=F,Z;while((Z=q.exec(v))!==null)if(Z[0].startsWith("</")){if(Q--,Q===0){ie=Z.index+Z[0].length;break}}else if(!Z[0].endsWith("/>"))Q++;_.push({start:W,end:ie,names:z})}return _}function _g(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>_g(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function kg(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,R=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],B;while((B=R.exec(v))!==null)T.push([B.index,B.index+B[0].length]);T.push(...Ev(v));let z=new Set([...kr(_),...Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]]);function W(Q){return T.some(([ie,Z])=>Q>=ie&&Q<Z)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,U=[],H=new Map,q=256;while((B=F.exec(k))!==null){if(W(B.index))continue;let Q=B[0],ie=B[2];if(!ie||!ie.includes(":"))continue;let Z=/(?:^|\s)data-native(?:\s|=|$)/i.test(ie.replace(/"[^"]*"|'[^']*'/g,"")),ae=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,le,ce=ie,de=!1;while((le=ae.exec(ie))!==null){let ue=le[1],$e=le[2];if(Qi(ue))continue;if(te($e,z))continue;if($e.includes("()")&&!$e.includes(".get(")||$e.includes("$store")||$e.includes("$ref"))continue;try{let we=Object.keys(_),ye=Object.values(_),Pe=$e.match(/^([a-zA-Z_$][\w$]*)/);if(Pe&&!we.includes(Pe[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Pe[1]))continue;let Oe=JSON.stringify([we,$e]),Me=H.get(Oe);if(!Me){if(Me=Function(...we,`return (${$e})`),H.size>=q)H.clear();H.set(Oe,Me)}let Ne=Me(...ye);if(ue==="class"){let Le=_g(Ne);if(Le){let De=ce.match(/\sclass="([^"]*)"/);if(De)ce=ce.replace(De[0],` class="${De[1]} ${Le}"`);else ce=ce.replace(le[0],` class="${Le}"`)}else ce=ce.replace(le[0],"");de=!0;continue}if(_v.has(ue)){if(Ne)ce=ce.replace(le[0],` ${ue}`);else ce=ce.replace(le[0],"");de=!0;continue}if(Ne===null||Ne===void 0||Ne===!1)ce=ce.replace(le[0],"");else{let De=(Z&&typeof Ne==="object"?JSON.stringify(Ne):String(Ne)).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ce=ce.replace(le[0],` ${ue}="${De}"`)}de=!0}catch{continue}}if(de){let ue=B[3]?" /":"",we=`<${B[1]}${ce}${ue}>`;U.push({start:B.index,end:B.index+Q.length,replacement:we})}}if(U.length>0){let Q=Array(U.length*2+1),ie=0;for(let Z=0;Z<U.length;Z++){let{start:ae,end:le,replacement:ce}=U[Z];Q[Z*2]=k.slice(ie,ae),Q[Z*2+1]=ce,ie=le}Q[U.length*2]=k.slice(ie),k=Q.join("")}return k}var K=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];import Lg from"path";import uu from"fs";import ko from"path";function Eg(v,_,k,R){let T=0;for(let B=_;B<v.length;B++)if(v[B]===k)T++;else if(v[B]===R&&!(R===">"&&v[B-1]==="=")){if(--T===0)return B}return-1}function Cv(v){let _=s(v),k=0,R=0,T=[];for(let B=0;B<_.length;B++)if("([{".includes(_[B]))k++;else if(")]}".includes(_[B]))k--;else if(_[B]===","&&k===0)T.push(v.slice(R,B).trim()),R=B+1;return T.push(v.slice(R).trim()),T}function lu(v,_){let k=s(v),R=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(R)){let B=T.index+T[0].length,z="";if(k[B]==="<"){let F=Eg(k,B,"<",">");if(F<0)continue;z=v.slice(B+1,F),B=F+1;while(/\s/.test(k[B]||"")&&B<k.length)B++}if(k[B]!=="(")continue;let W=Eg(k,B,"(",")");if(W>=0)return{type:z,args:Cv(v.slice(B+1,W))}}return null}var Cg=`
2439
2439
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
2440
2440
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
2441
2441
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
@@ -2511,10 +2511,10 @@ ${T}
2511
2511
  } finally {
2512
2512
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2513
2513
  }
2514
- })();`}function pw(v,_){if(Kn(v)){let T=Kn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:ls(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var gw=0;function Jg(v,_){let k=Zt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++gw}`}var yu=new Set,xu=new Set;function gd(){yu.clear(),xu.clear()}var mw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Uc(v){let _=(W)=>W.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],U=z[3]==="/"||mw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!U)T++}return R}function Yg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var Ee=new M(500),Ri=new Set;function md(){Ri.clear()}function hw(v){if(v.__onceStore instanceof Set)return v.__onceStore;return Ri}async function Ps(v,_,k,R,T,B=new Set){let z=R.partialsDir||Zt.join(Zt.dirname(k),"partials");if(z&&!Zt.isAbsolute(z))z=Zt.resolve(process.cwd(),z);let W=aw(v,"@partial","@include"),F=hw(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(ae,le,ce)=>{let de=le.trim(),ue=`${k}:${de}`;if(F.has(ue))return"";return F.add(ue),le});{let ae=/@includeIf\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")")ue--;$e++}if(ue!==0)break;let we=W.substring(de+1,$e-1),ye=we.match(/^\s*['"]([^'"]+)['"]/);if(!ye){ae.lastIndex=$e;continue}let Pe=ye[1],Oe=U(Pe,z,k),Me="";if(Oe&&await Bun.file(Oe).exists())T.add(Oe),Me=`@include(${we})`;W=W.substring(0,ce)+Me+W.substring($e),ae.lastIndex=0}}for(let[ae,le]of[["@includeWhen",!1],["@includeUnless",!0]]){let ce=new RegExp(`${ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=ce.exec(W))!==null){let ue=de.index,$e=ue+de[0].length-1,we=1,ye=$e+1;while(ye<W.length&&we>0){if(W[ye]==="(")we++;else if(W[ye]===")")we--;ye++}if(we!==0)break;let Pe=W.substring($e+1,ye-1),Oe=hu(Pe,0);if(Oe===-1){ce.lastIndex=ye;continue}let Me=Pe.substring(0,Oe).trim(),Ne=Pe.substring(Oe+1).trim(),Le=Ne.match(/^\s*['"]([^'"]+)['"]/);if(!Le){ce.lastIndex=ye;continue}let De=Le[1],ze=Ne.substring(Le[0].length),Ve,Be=hu(ze,0);if(Be!==-1)Ve=ze.substring(Be+1).trim();try{let je=`Boolean(${Me})`,st;if(p(je)){let vt=c(je,Object.keys(_));st=Boolean(vt(...Object.values(_)))}else st=Boolean(l(je,_));let ht=le?!st:st,yt="";if(ht){let vt=U(De,z,k);if(vt&&await Bun.file(vt).exists())T.add(vt);yt=`@include('${De}'${Ve?`, ${Ve}`:""})`}W=W.substring(0,ue)+yt+W.substring(ye),ce.lastIndex=0}catch(je){let st=je instanceof Error?je.message:String(je),ht=g("Include",`Error evaluating ${ae} condition: ${st}`,k,v,ue);W=W.substring(0,ue)+ht+W.substring(ye),ce.lastIndex=0}}}{let ae=/@each\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")"){if(ue--,ue===0)break}$e++}if(ue!==0)break;let we=W.substring(de+1,$e),ye=W.substring(ce,$e+1),Pe=we.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Pe){ae.lastIndex=0,W=W.replace(ye,"");continue}let[,Oe,Me,Ne,Le]=Pe;try{let De,ze=Me.trim();if(p(ze))De=c(ze,Object.keys(_))(...Object.values(_));else De=l(ze,_);let Ve="";if(Array.isArray(De)&&De.length>0)for(let Be of De){let je={..._,[Ne]:Be},st=await Q(Oe,je,v,ce);Ve+=st}else if(Le)Ve=await Q(Le,{},v,ce);W=W.substring(0,ce)+Ve+W.substring($e+1),ae.lastIndex=0}catch(De){let ze=De instanceof Error?De.message:String(De);W=W.substring(0,ce)+g("Each",`Error in @each: ${ze}`,k,v,ce)+W.substring($e+1),ae.lastIndex=0}}}{let ae=/@includeFirst\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")"){if(ue--,ue===0)break}$e++}if(ue!==0)break;let we=W.substring(de+1,$e),ye=W.substring(ce,$e+1),Pe=we.match(/^\s*(\[[^\]]+\])/);if(!Pe){ae.lastIndex=0,W=W.replace(ye,"");continue}let Oe=Pe[1],Me=we.slice(Pe[0].length),Ne,Le=Me.match(/^\s*,\s*\{/);if(Le){Me=Me.slice(Le[0].length-1);let Ve=1,Be=1;while(Be<Me.length&&Ve>0){if(Me[Be]==="{")Ve++;else if(Me[Be]==="}"){if(Ve--,Ve===0)break}Be++}Ne=Me.substring(0,Be+1),Me=Me.slice(Be+1)}let De,ze=Me.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(ze)De=ze[1];try{let Ve=JSON.parse(Oe.replace(/'/g,'"')),Be={};if(Ne)try{Be=D(Ne,_)}catch(st){let ht=st instanceof Error?st.message:String(st);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ht}`,k,v,ce,ye);W=W.replace(ye,()=>yt)}else W=W.replace(ye,()=>De||"");continue}let je=!1;for(let st of Ve){let ht=U(st,z,k);if(!ht)continue;if(await r(ht)){let yt=await Q(st,Be,v,ce);W=W.replace(ye,()=>yt),je=!0;break}}if(!je)if(De!==void 0)W=W.replace(ye,()=>De);else if(R.debug){let st=g("Include",`None of the includeFirst paths exist: ${Oe}`,k,v,ce,ye);W=W.replace(ye,()=>st)}else W=W.replace(ye,"")}catch(Ve){let Be=Ve instanceof Error?Ve.message:String(Ve),je=g("Include",`Error processing @includeFirst: ${Be}`,k,v,ce,ye);W=W.replace(ye,()=>je)}ae.lastIndex=0}}function U(ae,le,ce){try{let de=ae;if(!ae.endsWith(".stx"))de=`${ae}.stx`;let ue=Zt.resolve(le),$e=Zt.resolve(Zt.dirname(ce)),we;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Le of R._layerPartialDirs??[]){let De=Zt.resolve(Le,de);if(De.startsWith(`${Zt.resolve(Le)}${Zt.sep}`)&&ow(De))return De}we=Zt.resolve(le,de)}else we=Zt.resolve($e,de);let ye=Zt.normalize(we),Pe=ye.startsWith(ue+Zt.sep)||ye===ue,Oe=ye.startsWith($e+Zt.sep)||ye===$e,Me=!1,Ne=Zt.dirname($e);if(ye.startsWith(Ne+Zt.sep)){if(!Zt.relative(Ne,ye).split(Zt.sep).some((Ve)=>Ve.startsWith(".")&&Ve!=="."&&Ve!==".."))Me=!0}if(!Pe&&!Oe&&!Me)return console.error(`Security: Path traversal attempt blocked for include path: ${ae}`),console.error(` Resolved to: ${ye}`),console.error(` Allowed dirs: ${ue}, ${$e}`),null;return ye}catch(de){return console.error(`Error resolving path ${ae}: ${de}`),null}}let H=Zt.resolve(k);B.add(H);function q(ae,le,ce,de){return R.onIncludeError?.({includePath:ae,templatePath:k,message:le,partialsDir:z}),g("Include",le,k,ce,de)}async function Q(ae,le={},ce,de){let ue=U(ae,z,k);if(!ue)return q(ae,`Could not resolve path for include: ${ae}`,ce,de);let $e=Zt.resolve(ue);if(B.has($e)){let we=[...B,$e].map((ye)=>Zt.basename(ye)).join(" -> ");return q(ae,`Circular include detected: ${we}`,ce,de)}try{T.add(ue);let we;if(!we)try{we=await Bun.file(ue).text()}catch(ct){let St=ct instanceof Error?ct.message:String(ct);return q(ae,`Error loading include file ${ae}: ${St}`,ce,de)}if(we)we=we.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(we&&we.includes("@stream")){let{processStreamDirectives:ct}=await import("./chunk-d0kes50w.js");we=ct(we,_)}if(we&&(R.debug||!E()&&!Nn()))try{let{warnUnbalancedTags:ct}=await import("./chunk-ewkza45r.js");ct(we,ue)}catch{}try{let{processESImports:ct}=await import("./chunk-k7spjpr0.js");we=await ct(we,_,ue,R,T)}catch(ct){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${ue}:`,ct instanceof Error?ct.message:ct)}let ye=we,Pe=re(ye);if(Pe)ye=Pe.content.trim();let Me=we.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ne="";if(Me)Ne=`<style${Me[1]}>${Me[2]}</style>`;let Le=[];ye=ye.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ct,St,mt)=>{if(!Yg(St))return"";return Le.push({attrs:St,body:mt}),`__STX_DATA_BLOCK_${Le.length-1}__`}),ye=ye.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let De={..._};De.__stx_signals_gate=ke(we,ue);for(let[ct,St]of Object.entries(le))De[ct]=St;let ze=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ve=[...we.matchAll(ze)].sort((ct,St)=>{let mt=(ct[1]||"").includes("server"),Kt=(St[1]||"").includes("server");return Number(Kt)-Number(mt)}),Be="",je=null,st=!1,ht=!1;for(let ct of Ve){let St=ct[1]||"",mt=ct[2]||"";if(Yg(St))continue;let Kt=St.includes("server"),Wn=Qe(St);if(!Kt&&mt.trim()){let{interpolateScriptExpressions:ft}=await import("./chunk-3gm6013p.js");mt=ft(mt,De,ae)}let Mn="";try{let{extractAndStripCssImports:ft,renderVendorStyleTags:$t}=await import("./chunk-fese2cf6.js"),Wt=ft(mt,{filePath:ue,projectRoot:process.cwd()});mt=Wt.code,Mn=$t(Wt.styles)}catch(ft){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${ue}:`,ft instanceof Error?ft.message:ft)}if(Wn&&mt.trim())mt=et(mt);if(!Kt){try{let{injectBrowserCoreAutoImports:$t}=await import("./chunk-fese2cf6.js");mt=$t(mt).code;let{hasUserImports:Wt,bundleClientScript:Gt}=await import("./chunk-8x2ejkcc.js");if(Wt(mt))mt=await Gt(mt,ue,{projectRoot:process.cwd()})}catch($t){if(R.debug)console.warn(`[stx] bundler skipped for ${ue}:`,$t instanceof Error?$t.message:$t)}let{stripStxRuntimeImports:ft}=await import("./chunk-en388k3h.js");mt=ft(mt)}let bt=cw(mt);if(!Kt){let{extractBridgeData:ft,generateServerDataBridge:$t}=await import("./chunk-fese2cf6.js"),Wt=$t(mt,ft(De));if(Wt)mt=`${Wt}
2514
+ })();`}function pw(v,_){if(Kn(v)){let T=Kn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:ls(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var gw=0;function Jg(v,_){let k=Zt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++gw}`}var yu=new Set,xu=new Set;function gd(){yu.clear(),xu.clear()}var mw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Uc(v){let _=(W)=>W.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],U=z[3]==="/"||mw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!U)T++}return R}function Yg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var Ee=new M(500),Ri=new Set;function md(){Ri.clear()}function hw(v){if(v.__onceStore instanceof Set)return v.__onceStore;return Ri}async function Ps(v,_,k,R,T,B=new Set){let z=R.partialsDir||Zt.join(Zt.dirname(k),"partials");if(z&&!Zt.isAbsolute(z))z=Zt.resolve(process.cwd(),z);let W=aw(v,"@partial","@include"),F=hw(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(ae,le,ce)=>{let de=le.trim(),ue=`${k}:${de}`;if(F.has(ue))return"";return F.add(ue),le});{let ae=/@includeIf\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")")ue--;$e++}if(ue!==0)break;let we=W.substring(de+1,$e-1),ye=we.match(/^\s*['"]([^'"]+)['"]/);if(!ye){ae.lastIndex=$e;continue}let Pe=ye[1],Oe=U(Pe,z,k),Me="";if(Oe&&await Bun.file(Oe).exists())T.add(Oe),Me=`@include(${we})`;W=W.substring(0,ce)+Me+W.substring($e),ae.lastIndex=0}}for(let[ae,le]of[["@includeWhen",!1],["@includeUnless",!0]]){let ce=new RegExp(`${ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=ce.exec(W))!==null){let ue=de.index,$e=ue+de[0].length-1,we=1,ye=$e+1;while(ye<W.length&&we>0){if(W[ye]==="(")we++;else if(W[ye]===")")we--;ye++}if(we!==0)break;let Pe=W.substring($e+1,ye-1),Oe=hu(Pe,0);if(Oe===-1){ce.lastIndex=ye;continue}let Me=Pe.substring(0,Oe).trim(),Ne=Pe.substring(Oe+1).trim(),Le=Ne.match(/^\s*['"]([^'"]+)['"]/);if(!Le){ce.lastIndex=ye;continue}let De=Le[1],ze=Ne.substring(Le[0].length),Ve,Be=hu(ze,0);if(Be!==-1)Ve=ze.substring(Be+1).trim();try{let je=`Boolean(${Me})`,st;if(p(je)){let vt=c(je,Object.keys(_));st=Boolean(vt(...Object.values(_)))}else st=Boolean(l(je,_));let ht=le?!st:st,yt="";if(ht){let vt=U(De,z,k);if(vt&&await Bun.file(vt).exists())T.add(vt);yt=`@include('${De}'${Ve?`, ${Ve}`:""})`}W=W.substring(0,ue)+yt+W.substring(ye),ce.lastIndex=0}catch(je){let st=je instanceof Error?je.message:String(je),ht=g("Include",`Error evaluating ${ae} condition: ${st}`,k,v,ue);W=W.substring(0,ue)+ht+W.substring(ye),ce.lastIndex=0}}}{let ae=/@each\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")"){if(ue--,ue===0)break}$e++}if(ue!==0)break;let we=W.substring(de+1,$e),ye=W.substring(ce,$e+1),Pe=we.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Pe){ae.lastIndex=0,W=W.replace(ye,"");continue}let[,Oe,Me,Ne,Le]=Pe;try{let De,ze=Me.trim();if(p(ze))De=c(ze,Object.keys(_))(...Object.values(_));else De=l(ze,_);let Ve="";if(Array.isArray(De)&&De.length>0)for(let Be of De){let je={..._,[Ne]:Be},st=await Q(Oe,je,v,ce);Ve+=st}else if(Le)Ve=await Q(Le,{},v,ce);W=W.substring(0,ce)+Ve+W.substring($e+1),ae.lastIndex=0}catch(De){let ze=De instanceof Error?De.message:String(De);W=W.substring(0,ce)+g("Each",`Error in @each: ${ze}`,k,v,ce)+W.substring($e+1),ae.lastIndex=0}}}{let ae=/@includeFirst\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")"){if(ue--,ue===0)break}$e++}if(ue!==0)break;let we=W.substring(de+1,$e),ye=W.substring(ce,$e+1),Pe=we.match(/^\s*(\[[^\]]+\])/);if(!Pe){ae.lastIndex=0,W=W.replace(ye,"");continue}let Oe=Pe[1],Me=we.slice(Pe[0].length),Ne,Le=Me.match(/^\s*,\s*\{/);if(Le){Me=Me.slice(Le[0].length-1);let Ve=1,Be=1;while(Be<Me.length&&Ve>0){if(Me[Be]==="{")Ve++;else if(Me[Be]==="}"){if(Ve--,Ve===0)break}Be++}Ne=Me.substring(0,Be+1),Me=Me.slice(Be+1)}let De,ze=Me.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(ze)De=ze[1];try{let Ve=JSON.parse(Oe.replace(/'/g,'"')),Be={};if(Ne)try{Be=D(Ne,_)}catch(st){let ht=st instanceof Error?st.message:String(st);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ht}`,k,v,ce,ye);W=W.replace(ye,()=>yt)}else W=W.replace(ye,()=>De||"");continue}let je=!1;for(let st of Ve){let ht=U(st,z,k);if(!ht)continue;if(await r(ht)){let yt=await Q(st,Be,v,ce);W=W.replace(ye,()=>yt),je=!0;break}}if(!je)if(De!==void 0)W=W.replace(ye,()=>De);else if(R.debug){let st=g("Include",`None of the includeFirst paths exist: ${Oe}`,k,v,ce,ye);W=W.replace(ye,()=>st)}else W=W.replace(ye,"")}catch(Ve){let Be=Ve instanceof Error?Ve.message:String(Ve),je=g("Include",`Error processing @includeFirst: ${Be}`,k,v,ce,ye);W=W.replace(ye,()=>je)}ae.lastIndex=0}}function U(ae,le,ce){try{let de=ae;if(!ae.endsWith(".stx"))de=`${ae}.stx`;let ue=Zt.resolve(le),$e=Zt.resolve(Zt.dirname(ce)),we;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Le of R._layerPartialDirs??[]){let De=Zt.resolve(Le,de);if(De.startsWith(`${Zt.resolve(Le)}${Zt.sep}`)&&ow(De))return De}we=Zt.resolve(le,de)}else we=Zt.resolve($e,de);let ye=Zt.normalize(we),Pe=ye.startsWith(ue+Zt.sep)||ye===ue,Oe=ye.startsWith($e+Zt.sep)||ye===$e,Me=!1,Ne=Zt.dirname($e);if(ye.startsWith(Ne+Zt.sep)){if(!Zt.relative(Ne,ye).split(Zt.sep).some((Ve)=>Ve.startsWith(".")&&Ve!=="."&&Ve!==".."))Me=!0}if(!Pe&&!Oe&&!Me)return console.error(`Security: Path traversal attempt blocked for include path: ${ae}`),console.error(` Resolved to: ${ye}`),console.error(` Allowed dirs: ${ue}, ${$e}`),null;return ye}catch(de){return console.error(`Error resolving path ${ae}: ${de}`),null}}let H=Zt.resolve(k);B.add(H);function q(ae,le,ce,de){return R.onIncludeError?.({includePath:ae,templatePath:k,message:le,partialsDir:z}),g("Include",le,k,ce,de)}async function Q(ae,le={},ce,de){let ue=U(ae,z,k);if(!ue)return q(ae,`Could not resolve path for include: ${ae}`,ce,de);let $e=Zt.resolve(ue);if(B.has($e)){let we=[...B,$e].map((ye)=>Zt.basename(ye)).join(" -> ");return q(ae,`Circular include detected: ${we}`,ce,de)}try{T.add(ue);let we;if(!we)try{we=await Bun.file(ue).text()}catch(ct){let St=ct instanceof Error?ct.message:String(ct);return q(ae,`Error loading include file ${ae}: ${St}`,ce,de)}if(we)we=we.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(we&&we.includes("@stream")){let{processStreamDirectives:ct}=await import("./chunk-aan7601v.js");we=ct(we,_)}if(we&&(R.debug||!E()&&!Nn()))try{let{warnUnbalancedTags:ct}=await import("./chunk-ewkza45r.js");ct(we,ue)}catch{}try{let{processESImports:ct}=await import("./chunk-exd1h9sd.js");we=await ct(we,_,ue,R,T)}catch(ct){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${ue}:`,ct instanceof Error?ct.message:ct)}let ye=we,Pe=re(ye);if(Pe)ye=Pe.content.trim();let Me=we.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ne="";if(Me)Ne=`<style${Me[1]}>${Me[2]}</style>`;let Le=[];ye=ye.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ct,St,mt)=>{if(!Yg(St))return"";return Le.push({attrs:St,body:mt}),`__STX_DATA_BLOCK_${Le.length-1}__`}),ye=ye.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let De={..._};De.__stx_signals_gate=ke(we,ue);for(let[ct,St]of Object.entries(le))De[ct]=St;let ze=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ve=[...we.matchAll(ze)].sort((ct,St)=>{let mt=(ct[1]||"").includes("server"),Kt=(St[1]||"").includes("server");return Number(Kt)-Number(mt)}),Be="",je=null,st=!1,ht=!1;for(let ct of Ve){let St=ct[1]||"",mt=ct[2]||"";if(Yg(St))continue;let Kt=St.includes("server"),Wn=Qe(St);if(!Kt&&mt.trim()){let{interpolateScriptExpressions:ft}=await import("./chunk-2pwjnydp.js");mt=ft(mt,De,ae)}let Mn="";try{let{extractAndStripCssImports:ft,renderVendorStyleTags:$t}=await import("./chunk-8bzx0r0x.js"),Wt=ft(mt,{filePath:ue,projectRoot:process.cwd()});mt=Wt.code,Mn=$t(Wt.styles)}catch(ft){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${ue}:`,ft instanceof Error?ft.message:ft)}if(Wn&&mt.trim())mt=et(mt);if(!Kt){try{let{injectBrowserCoreAutoImports:$t}=await import("./chunk-8bzx0r0x.js");mt=$t(mt).code;let{hasUserImports:Wt,bundleClientScript:Gt}=await import("./chunk-y0zyzbjf.js");if(Wt(mt))mt=await Gt(mt,ue,{projectRoot:process.cwd()})}catch($t){if(R.debug)console.warn(`[stx] bundler skipped for ${ue}:`,$t instanceof Error?$t.message:$t)}let{stripStxRuntimeImports:ft}=await import("./chunk-t83acmv2.js");mt=ft(mt)}let bt=cw(mt);if(!Kt){let{extractBridgeData:ft,generateServerDataBridge:$t}=await import("./chunk-8bzx0r0x.js"),Wt=$t(mt,ft(De));if(Wt)mt=`${Wt}
2515
2515
  ${mt}`}if(bt&&!Kt){st=!0,je=Jg(ue,_);let ft=O(mt),$t=Gg(ft,je);Be+=`${Mn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}">${$t}</script>
2516
- `;continue}if(Kt)try{let{extractVariables:ft}=await import("./chunk-915s0may.js");await ft(mt,De,ue)}catch(ft){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${ue}:`,ft)}if(!Kt&&!bt){let ft=St.replace(/\bclient\b/i,"").trim();je=Jg(ue,_);let $t=O(mt),Wt=Gg($t,je);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Wt))ht=!0;Be+=`${Mn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}"${ft?` ${ft}`:""}>${Wt}</script>
2517
- `}}if(Le.length>0){let{interpolateScriptExpressions:ct}=await import("./chunk-3gm6013p.js");ye=ye.replace(/__STX_DATA_BLOCK_(\d+)__/g,(St,mt)=>{let Kt=Le[Number(mt)];return`<script${Kt.attrs}>${ct(Kt.body,De,ae)}</script>`})}if(je){let ct=pw(ye,je);if(ye=ct.html,ct.mergedIntoExisting){let mt=je,Kt=ct.mergedIntoExisting;Be=Be.split(`'${mt}'`).join(`'${Kt}'`).split(`"${mt}"`).join(`"${Kt}"`),je=Kt}else if(!ct.stamped&&st&&!yu.has(ue))yu.add(ue),console.warn(`[stx] ${Zt.relative(process.cwd(),ue)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(ct.stamped&&ct.root!=="body"&&(st||ht)&&!xu.has(ue)){let mt=Uc(ye);if(mt.length>1)xu.add(ue),console.warn(`[stx] ${Zt.relative(process.cwd(),ue)} declares ${st?"signals":"bindings"} and has ${mt.length} top-level elements (${mt.map((Kt)=>`<${Kt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let St=ct.stamped&&ct.root!==null&&Sn(ct.root);Be=dw(Be,St?je:null)}if(ye.includes("@include")||ye.includes("@partial"))ye=await Ps(ye,De,ue,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:vt}=await import("./chunk-y2wr7c9e.js"),dt=yt(ye,De,ue,void 0,!0);dt=br(dt,De,ue),dt=vt(dt);let{processMetaDirectives:wt,processSeoDirective:kt,processStructuredData:xt}=await import("./chunk-jshj69dy.js");if(dt=wt(dt,De,ue,R),dt=xt(dt,De,ue),dt=kt(dt,De,ue,R),dt=X(dt,De,ue),Ne)dt+=`
2516
+ `;continue}if(Kt)try{let{extractVariables:ft}=await import("./chunk-2n59ahd9.js");await ft(mt,De,ue)}catch(ft){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${ue}:`,ft)}if(!Kt&&!bt){let ft=St.replace(/\bclient\b/i,"").trim();je=Jg(ue,_);let $t=O(mt),Wt=Gg($t,je);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Wt))ht=!0;Be+=`${Mn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}"${ft?` ${ft}`:""}>${Wt}</script>
2517
+ `}}if(Le.length>0){let{interpolateScriptExpressions:ct}=await import("./chunk-2pwjnydp.js");ye=ye.replace(/__STX_DATA_BLOCK_(\d+)__/g,(St,mt)=>{let Kt=Le[Number(mt)];return`<script${Kt.attrs}>${ct(Kt.body,De,ae)}</script>`})}if(je){let ct=pw(ye,je);if(ye=ct.html,ct.mergedIntoExisting){let mt=je,Kt=ct.mergedIntoExisting;Be=Be.split(`'${mt}'`).join(`'${Kt}'`).split(`"${mt}"`).join(`"${Kt}"`),je=Kt}else if(!ct.stamped&&st&&!yu.has(ue))yu.add(ue),console.warn(`[stx] ${Zt.relative(process.cwd(),ue)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(ct.stamped&&ct.root!=="body"&&(st||ht)&&!xu.has(ue)){let mt=Uc(ye);if(mt.length>1)xu.add(ue),console.warn(`[stx] ${Zt.relative(process.cwd(),ue)} declares ${st?"signals":"bindings"} and has ${mt.length} top-level elements (${mt.map((Kt)=>`<${Kt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let St=ct.stamped&&ct.root!==null&&Sn(ct.root);Be=dw(Be,St?je:null)}if(ye.includes("@include")||ye.includes("@partial"))ye=await Ps(ye,De,ue,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:vt}=await import("./chunk-tc176d93.js"),dt=yt(ye,De,ue,void 0,!0);dt=br(dt,De,ue),dt=vt(dt);let{processMetaDirectives:wt,processSeoDirective:kt,processStructuredData:xt}=await import("./chunk-jshj69dy.js");if(dt=wt(dt,De,ue,R),dt=xt(dt,De,ue),dt=kt(dt,De,ue,R),dt=X(dt,De,ue),Ne)dt+=`
2518
2518
  `+Ne;if(Be)dt+=`
2519
2519
  `+Be;return dt}catch(we){let ye=we instanceof Error?we.message:String(we);return q(ae,`Error processing include ${ae}: ${ye}`,ce,de)}}let ie=/@include\s*\(/g,Z;while((Z=ie.exec(W))!==null){let ae=Z.index,le=ae+Z[0].length-1,ce=1,de=le+1;while(de<W.length&&ce>0){if(W[de]==="(")ce++;else if(W[de]===")")ce--;de++}if(ce!==0)break;let ue=W.substring(ae,de),$e=W.substring(le+1,de-1),we=$e.match(/^\s*['"]([^'"]+)['"]/);if(!we){ie.lastIndex=de;continue}let ye=we[1],Pe,Oe=$e.substring(we[0].length),Me=hu(Oe,0);if(Me!==-1)Pe=Oe.substring(Me+1).trim();let Ne={};if(Pe)try{Ne=D(Pe,_)}catch(De){let ze=De instanceof Error?De.message:String(De);W=W.replace(ue,g("Include",`Error parsing include variables for ${ye}: ${ze}`,k,v,ae)),ie.lastIndex=0;continue}let Le=await Q(ye,Ne,v,ae);W=W.substring(0,ae)+Le+W.substring(de),ie.lastIndex=0}return W}function Is(v,_){let k=v;function R(T,B,z,W){let F=T,U=!0;while(U){U=!1;let H=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),q=F.match(H);if(!q||q.index===void 0)break;let Q=q.index,ie=q[1],Z=Q+q[0].length,ae=new RegExp(`@${B}\\(`),le=new RegExp(`@${z}(?![a-z])`),ce=1,de=Z,ue=-1;while(ce>0&&de<F.length){let we=F.slice(de),ye=we.match(ae),Pe=we.match(le),Oe=ye?de+ye.index:1/0,Me=Pe?de+Pe.index:1/0;if(Oe<Me)ce++,de=Oe+(ye[0].length||1);else if(Me<1/0){if(ce--,ce===0){ue=Me;break}de=Me+z.length+1}else break}if(ue===-1)break;let $e=F.slice(Z,ue);if(!_[ie])_[ie]=[];if(W)_[ie].unshift($e);else _[ie].push($e);F=F.substring(0,Q)+F.substring(ue+`@${z}`.length),U=!0}return F}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function Os(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2520
2520
  `)})}import*as bu from"path";async function em(v,_,k=""){if(bu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return nm(v,_,k,"@js","@endjs")}async function tm(v,_,k=""){if(bu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return nm(v,_,k,"@ts","@endts")}async function nm(v,_,k,R,T){let B=v,z=Fr(`${R}([\\s\\S]*?)${T}`,"g"),W=[],F;while((F=z.exec(v))!==null)W.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:U,content:H,index:q}of W)try{let Q={..._,global:_},ie=Object.keys(Q),Z=Object.values(Q),ae=H.trim();if(R==="@ts")ae=ae.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 ce=(ae.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((ye)=>ye.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),de=ce.length>0?`return { ${ce.join(", ")} };`:"return {};",ue=`
@@ -2558,14 +2558,14 @@ ${si(z,{...R,start:0,end:R.end-R.start},T)}
2558
2558
  ${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
2559
2559
  `+v.slice(z)}if(Kn(v))return ls(v,(z)=>`${z}
2560
2560
  ${_}`);return`${_}
2561
- ${v}`}async function Wa(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-93na8hh0.js"),{url:B}=await T("runtime",_.debug===!0);return Su(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return Su(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-93na8hh0.js"),R=await k(_.debug);return Su(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function nS(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Pm(v){if(v.includes("data-stx-tooltip-runtime")||!nS(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${ru()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2561
+ ${v}`}async function Wa(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-x49qdt4c.js"),{url:B}=await T("runtime",_.debug===!0);return Su(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return Su(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-x49qdt4c.js"),R=await k(_.debug);return Su(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function nS(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Pm(v){if(v.includes("data-stx-tooltip-runtime")||!nS(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${ru()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2562
2562
  ${_}`;return`${v.slice(0,k)}${_}
2563
2563
  ${v.slice(k)}`}var rS=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function sS(v){return rS.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function J(v,_){if(!v.includes("</body>"))return v;if(sS(v))return v;let k=_?.router,R="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)F.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)F.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)F.keepOpening=k.keepOpening}try{let U=await Am(_?.pagesDir,_?.root);if(U.length>0)F.ownedRoutes=U}catch{}if(Object.keys(F).length>0)R=`<script>window.__stxRouterConfig=${Tm(F)};</script>
2564
- `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-93na8hh0.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2564
+ `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-x49qdt4c.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2565
2565
  </body>`+v.slice(W+7)}var Dm=Symbol.for("stx.lazy-module-promises");function iS(){let v=globalThis;return v[Dm]??=new Map,v[Dm]}function _t(v,_){let k=iS(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var $u=`(?:"[^"]*"|'[^']*'|[^>"'])*`,zm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,oS=65536,aS=4,Va=new Map;function fd(){Va.clear()}function cS(v){let _=[];for(let k of ee(v,V)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function Oc(v,_={}){let k=v.length>=oS,R=k?Va.get(v):void 0;if(R===void 0){if(R=cS(v),k)Ld(Va,aS),Va.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function _s(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:W}=Om(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:W}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:W}=Om(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Om(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function Es(v,_){return Zi(v,_)}function lS(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Wm(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function uS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${$u})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ee(v,(B,z)=>{_.lastIndex=z;let W=_.exec(B);if(!W||W.index!==z||!k.test(W[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let W=z[2].match(k),F=_s(W?.[1]??W?.[2]??""),U=[F.itemVar,F.indexVar].filter(Boolean);if(U.length===0)continue;let H=z[1],Q=/\/\s*>$/.test(B.token)||Ua.has(H.toLowerCase())?B.end:ku(v,B.start,H,B.end);if(Q!==-1)T.push({start:B.start,end:Q,vars:new Set(U)})}return T}var Mm=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 dS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Nm(v,_,k,R){if(!v)return!1;let T=dS(v),B=!1,z=!1,W=!1,F=/([a-zA-Z_$][\w$]*)/g,U;while((U=F.exec(T))!==null){let ie=U[1];if(T.slice(0,U.index).trimEnd().endsWith("."))continue;if(Mm.has(ie))continue;if(_.has(ie)||R?.has(ie))B=!0;else if(k&&ie in k)z=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=H.exec(T))!==null){let ie=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if(Mm.has(ie)||k&&ie in k)continue;W=!0}return(B||W)&&!z}function Fa(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),B=T.match(zm);if(B&&fS(B[3],B[1])){let[,z,W,F]=B;return`<${z}${W}${R}>${F}</${z}>`}return`<template${R}>${T}</template>`}function fS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function Si(v,_){let k=Wm(v);function R(T){let B=T,z=uS(T),W=(q)=>{let Q=new Set;for(let ie of z)if(q>ie.start&&q<ie.end)for(let Z of ie.vars)Q.add(Z);return Q},F=/@if\s*\(/g,U,H=[];while((U=F.exec(B))!==null){let q=U.index,Q=q+U[0].length,ie=1,Z=Q;while(Z<B.length&&ie>0){if(B[Z]==="(")ie++;else if(B[Z]===")")ie--;Z++}if(ie!==0)continue;let ae=B.substring(Q,Z-1).trim(),le=Z,ce=1,de=le,ue=/@(if\s*\(|endif)/g;ue.lastIndex=le;let $e;while(($e=ue.exec(B))!==null)if($e[1].startsWith("if"))ce++;else if($e[1]==="endif"){if(ce--,ce===0){de=$e.index+$e[0].length;break}}if(ce!==0)continue;let we=B.substring(le,de-6).trim(),ye;if(lS(we)){let Pe=go(B.substring(q,de));if(Pe.length===0)continue;let Oe=Pe[0].branches.filter((De)=>De.type!=="else"),Me=W(q);if(!(Oe.length>0&&Oe.every((De)=>Nm(De.condition,k,_,Me))))continue;ye=Pe[0].branches.map((De)=>{let ze=R(De.content);if(De.type==="elseif")return Fa(ze,"@else-if",De.condition??"");if(De.type==="else")return Fa(ze,"@else");return Fa(ze,"@if",De.condition??"")}).join(`
2566
2566
  `)}else{if(!Nm(ae,k,_,W(q)))continue;ye=Fa(R(we),"@if",ae)}H.push({start:q,end:de,replacement:ye}),F.lastIndex=de}for(let q=H.length-1;q>=0;q--){let{start:Q,end:ie,replacement:Z}=H[q];B=B.substring(0,Q)+Z+B.substring(ie)}return B}return R(v)}function pS(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var Ua=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jm=/<(script|style)\b/iy,gS=/<\/script/gi,mS=/<\/style/gi;function ku(v,_,k,R){if(Ua.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,W=R;while(W<B){let F=v.indexOf("<",W);if(F===-1)return-1;if(W=F,v.startsWith("<!--",W)){let Q=v.indexOf("-->",W+4);if(Q===-1)return-1;W=Q+3;continue}jm.lastIndex=W;let U=jm.exec(v);if(U){let Q=v.indexOf(">",W);if(Q===-1)return-1;if(v[Q-1]==="/"){W=Q+1;continue}let ie=U[1].toLowerCase()==="script"?gS:mS;ie.lastIndex=W;let Z=ie.exec(v);if(Z===null)return-1;let ae=v.indexOf(">",Z.index);if(ae===-1)return-1;W=ae+1;continue}if(v[W+1]==="/"){let Q=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(W,W+64));if(!Q){W++;continue}if(Q[1].toLowerCase()===T){if(z--,W+=Q[0].length,z===0)return W;continue}W+=Q[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(W,W+64));if(!H){W++;continue}let q=v.indexOf(">",W);if(q===-1)return-1;if(H[1].toLowerCase()===T){let Q=v.slice(W,q+1);if(!(/\/\s*>$/.test(Q)||Ua.has(T)))z++}W=q+1}return-1}var hS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function yS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return hS.test(B)}function ki(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(q)=>_.some(([Q,ie])=>q>=Q&&q<ie),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],W;while((W=B.exec(v))!==null){if(T(W.index))continue;let[q,Q,ie,Z,ae,le,ce]=W,de=pS(ae);if(de===void 0)continue;let ue=W.index,$e=ue+q.length,Pe=!!ce||/\/\s*>$/.test(q)||Ua.has(Q.toLowerCase())?$e:ku(v,ue,Q,$e);if(Pe===-1)continue;if((Z===":if"||Z==="x-if"||Z==="@if")&&yS(v,Pe)){B.lastIndex=$e;continue}if(de===!0){let Me=`<${Q}${ie}${le}${ce}>`;z.push({start:ue,end:$e,replacement:Me});continue}z.push({start:ue,end:Pe,replacement:""}),B.lastIndex=Pe}if(z.length===0)return v;z.sort((q,Q)=>q.start-Q.start);let F=[],U=-1;for(let q of z){if(q.start<U)continue;F.push(q),U=q.end}let H=v;for(let q=F.length-1;q>=0;q--){let{start:Q,end:ie,replacement:Z}=F[q];H=H.substring(0,Q)+Z+H.substring(ie)}return H}var Lm=[":for","@for","x-for"];function Ts(v,_){if(!_||Object.keys(_).length===0)return v;if(!Lm.some((W)=>v.includes(`${W}=`)))return v;let k=Wm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let W of _.__stx_client_signal_names)if(typeof W==="string")k.add(W)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[W,F,U]=z,H=z.index,q=H+W.length,Q=Lm.map((ye)=>({attr:ye,m:new RegExp(`\\s${ye}="([^"]*)"`).exec(U)})).find((ye)=>ye.m!==null);if(!Q||!Q.m)continue;let ie=_s(Q.m[1]);if(!ie.iterable||!ie.itemVar)continue;let Z=ie.iterable.trim().split(/[.[(]/)[0].trim();if(!Z||k.has(Z)||!(Z in _))continue;let ae=ku(R,H,F,q);if(ae===-1)continue;let le=U.replace(new RegExp(`\\s${Q.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ce=R.slice(q,ae-`</${F}>`.length),de={..._,[ie.itemVar]:void 0};if(ie.indexVar)de[ie.indexVar]=void 0;let ue=Ts(ce,de),$e=ie.indexVar?`${ie.iterable} as ${ie.indexVar} => ${ie.itemVar}`:`${ie.iterable} as ${ie.itemVar}`,we=F.toLowerCase()==="template"?ue:`<${F}${le}>${ue}</${F}>`;T.push({start:H,end:ae,replacement:`@foreach(${$e})${we}@endforeach`}),B.lastIndex=ae}for(let W=T.length-1;W>=0;W--){let{start:F,end:U,replacement:H}=T[W];R=R.slice(0,F)+H+R.slice(U)}return R}function $s(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let W=T[1],F=T.index,U=F+T[0].length,H=1,q=U;while(q<k.length&&H>0){if(k[q]==="(")H++;else if(k[q]===")")H--;q++}if(H!==0)continue;let Q=k.substring(U,q-1).trim(),ie=q,Z=_s(Q),ae=W==="for"?"@endfor":"@endforeach",le=1,ce=ie,de=W==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${W}\\s*\\(|end${W})`,"g");de.lastIndex=ie;let ue;while((ue=de.exec(k))!==null)if(ue[1].startsWith(W))le++;else if(le--,le===0){ce=ue.index+ue[0].length;break}if(le!==0)continue;let $e=()=>{let Ne=[Z.itemVar,Z.indexVar].filter(Boolean);if(Ne.length)z.push({start:F,end:ce,vars:Ne})};if(Z.iterable){let Ne=Z.iterable.trim();if(Ne.startsWith("[")||Ne.startsWith("{")||Ne.startsWith("'")||Ne.startsWith('"')||Ne.startsWith("`")||/^-?\d/.test(Ne)){$e();continue}let Le=Ne.split(/[.[(]/)[0].trim(),De=_?Le in _:!1,ze=z.some((Ve)=>F>Ve.start&&F<Ve.end&&Ve.vars.includes(Le));if(Le&&(De||ze)){$e();continue}}if(Z.style==="as")Q=Z.indexVar?`(${Z.itemVar}, ${Z.indexVar}) in ${Z.iterable}`:`${Z.itemVar} in ${Z.iterable}`;let we=k.substring(ie,ce-ae.length).trim(),ye=_?{..._}:{};if(Z.itemVar)delete ye[Z.itemVar];if(Z.indexVar)delete ye[Z.indexVar];let Pe=$s(we,ye),Oe=Pe.match(zm),Me;if(Oe){let[,Ne,Le,De]=Oe;Me=`<${Ne}${Le} @for="${Q}">${De}</${Ne}>`}else Me=`<template @for="${Q}">${Pe}</template>`;B.push({start:F,end:ce,replacement:Me}),R.lastIndex=ce}for(let W=B.length-1;W>=0;W--){let{start:F,end:U,replacement:H}=B[W];k=k.substring(0,F)+H+k.substring(U)}return k}function xS(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(H)=>{let q=R+1;while(q<B){let Q=v[q];if(Q==="\\"){q+=2;continue}if(Q===H)return q+1;q++}return B},W=()=>{let H=R+2;while(H<B&&v[H]!==`
2567
2567
  `)H++;return H},F=()=>{let H=R+2;while(H<B-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return B},U=(H)=>{let q=H,Q=0;while(q<B){let ie=v[q];if(ie==="/"&&v[q+1]==="/"){let Z=q+2;while(Z<B&&v[Z]!==`
2568
- `)Z++;q=Z;continue}if(ie==="/"&&v[q+1]==="*"){let Z=q+2;while(Z<B-1&&!(v[Z]==="*"&&v[Z+1]==="/"))Z++;q=Z+2;continue}if(ie==='"'||ie==="'"||ie==="`"){let Z=q+1;while(Z<B){if(v[Z]==="\\"){Z+=2;continue}if(v[Z]===ie){Z++;break}Z++}q=Z;continue}if(ie==="("||ie==="["||ie==="{"){Q++,q++;continue}if(ie===")"||ie==="]"||ie==="}"){Q--,q++;continue}if(ie===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let ie=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ie){let Z=ie[2],ae=U(R+ie[0].length);if(_.has(Z)){k.push(`/* stx: deduped const ${Z} */`),R=ae;continue}_.add(Z),k.push(v.slice(R,ae)),R=ae;continue}}}k.push(H),R++}return k.join("")}var bS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function _u(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function vS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!_u(T,T+_.length,k))return!0;R=T+_.length}return!1}function wS(v,_){if(vS(v,"<body",_)){let T=new RegExp(`<body(${$u})>`,"g"),B;while((B=T.exec(v))!==null)if(!_u(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${$u})>`,"gi"),R;while((R=k.exec(v))!==null){if(_u(R.index,R.index+R[0].length,_))continue;if(bS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function SS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(U)=>{if(k!==null&&!W&&k>=z&&k<=U)T.push(v.slice(z,k),B,v.slice(k,U)),W=!0;else T.push(v.slice(z,U))};for(let U of _){if(U.start<z)continue;F(U.start),z=U.end}return F(v.length),T.join("")}async function cr(v,_,k,R={}){let T=Oc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|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*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await _t("stx/client-script-bundler",()=>import("./chunk-8x2ejkcc.js"));for(let ue of T){let $e=ue.body;if(Qe(ue.attrs))$e=et($e);if(R.forceClientSetup||B.test($e)){z.push({content:$e,start:ue.start,end:ue.end});continue}if(!W($e))continue;try{let we=await F(Pt($e).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(we))z.push({content:$e,start:ue.start,end:ue.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let U=`${_??""}\x00${z.map((ue)=>ue.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,q=[];for(let ue=0;ue<z.length;ue++){let $e=z[ue].bundled??Pt(z[ue].content).code;if(!z[ue].bundled&&W($e))$e=await F($e,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});$e=Ze($e);let we=O($e);q.push(`// \u2500\u2500 merged signal script #${ue+1} \u2500\u2500
2568
+ `)Z++;q=Z;continue}if(ie==="/"&&v[q+1]==="*"){let Z=q+2;while(Z<B-1&&!(v[Z]==="*"&&v[Z+1]==="/"))Z++;q=Z+2;continue}if(ie==='"'||ie==="'"||ie==="`"){let Z=q+1;while(Z<B){if(v[Z]==="\\"){Z+=2;continue}if(v[Z]===ie){Z++;break}Z++}q=Z;continue}if(ie==="("||ie==="["||ie==="{"){Q++,q++;continue}if(ie===")"||ie==="]"||ie==="}"){Q--,q++;continue}if(ie===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let ie=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ie){let Z=ie[2],ae=U(R+ie[0].length);if(_.has(Z)){k.push(`/* stx: deduped const ${Z} */`),R=ae;continue}_.add(Z),k.push(v.slice(R,ae)),R=ae;continue}}}k.push(H),R++}return k.join("")}var bS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function _u(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function vS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!_u(T,T+_.length,k))return!0;R=T+_.length}return!1}function wS(v,_){if(vS(v,"<body",_)){let T=new RegExp(`<body(${$u})>`,"g"),B;while((B=T.exec(v))!==null)if(!_u(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${$u})>`,"gi"),R;while((R=k.exec(v))!==null){if(_u(R.index,R.index+R[0].length,_))continue;if(bS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function SS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(U)=>{if(k!==null&&!W&&k>=z&&k<=U)T.push(v.slice(z,k),B,v.slice(k,U)),W=!0;else T.push(v.slice(z,U))};for(let U of _){if(U.start<z)continue;F(U.start),z=U.end}return F(v.length),T.join("")}async function cr(v,_,k,R={}){let T=Oc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|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*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await _t("stx/client-script-bundler",()=>import("./chunk-y0zyzbjf.js"));for(let ue of T){let $e=ue.body;if(Qe(ue.attrs))$e=et($e);if(R.forceClientSetup||B.test($e)){z.push({content:$e,start:ue.start,end:ue.end});continue}if(!W($e))continue;try{let we=await F(Pt($e).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(we))z.push({content:$e,start:ue.start,end:ue.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let U=`${_??""}\x00${z.map((ue)=>ue.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,q=[];for(let ue=0;ue<z.length;ue++){let $e=z[ue].bundled??Pt(z[ue].content).code;if(!z[ue].bundled&&W($e))$e=await F($e,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});$e=Ze($e);let we=O($e);q.push(`// \u2500\u2500 merged signal script #${ue+1} \u2500\u2500
2569
2569
  ${we}`)}let Q=q.join(`
2570
2570
 
2571
2571
  `);Q=xS(Q);let ie=Dc(Q),Z=ie.split(",").map((ue)=>ue.trim()).filter(Boolean),ae=hn(Q,k),le=`
@@ -2603,13 +2603,13 @@ ${U.join(`
2603
2603
  Tip: prefer useRef(), navigate(), and composables for component code`;if(Cu.set(B,ie),T.failOnViolation)throw Error(ie);else console.warn(ie)}import Ru from"path";var jS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,LS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function BS(v,_){if(!_||!v.includes("/"))return v;let k=Ru.dirname(_);return v.replace(jS,(R,T,B,z)=>{let W=Ru.resolve(k,z);return`${T}${B}${W.split(Ru.sep).join("/")}${B}`})}function nh(v,_){if(!_||!v.includes("<script"))return v;return v.replace(LS,(k,R,T,B)=>`${R}${BS(T,_)}${B}`)}var Jr="<!--PARENT_CONTENT_PLACEHOLDER-->";function rh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uh(v,_){let k=v.length,R=_,T=!0,B=[],z=(W)=>W+9<=k&&v[W]==="<"&&v[W+1]==="/"&&(v[W+2]==="s"||v[W+2]==="S")&&(v[W+3]==="c"||v[W+3]==="C")&&(v[W+4]==="r"||v[W+4]==="R")&&(v[W+5]==="i"||v[W+5]==="I")&&(v[W+6]==="p"||v[W+6]==="P")&&(v[W+7]==="t"||v[W+7]==="T")&&(v[W+8]===">"||/\s/.test(v[W+8]));while(R<k){let W=v[R];if(z(R))return R;if(W==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2604
2604
  `,R+2),R===-1)return-1;R+=1,T=!0;continue}if(W==="/"&&v[R+1]==="*"){let F=v.indexOf("*/",R+2);if(F===-1)return-1;R=F+2,T=!0;continue}if(W==="/"&&T){let F=R+1,U=!1;while(F<k){let H=v[F];if(H==="\\"){F+=2;continue}if(H==="[")U=!0;else if(H==="]")U=!1;else if(H==="/"&&!U){F++;break}else if(H===`
2605
2605
  `){F=-1;break}F++}if(F===-1){R++,T=!1;continue}while(F<k&&/[a-z]/.test(v[F]))F++;R=F,T=!1;continue}if(W==="'"||W==='"'){let F=W;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===F){R++;break}if(v[R]===`
2606
- `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function dh(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var WS=4096;async function sh(v,_,k){if(k.buildMode!=="serve"||_.length<WS)return null;let{registerServeModuleBundle:R}=await import("./chunk-93na8hh0.js");return`<script ${v} src="${R(_)}"></script>`}async function ih(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await _t("stx/client-module-registry",()=>import("./chunk-5taenpfg.js")),B=[],z=await T(R(...v),{minify:Qs(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-93na8hh0.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function FS(v,_=""){let k=dh(v,"data-stx-runtime");if(!k)return v;let R=co(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2606
+ `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function dh(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var WS=4096;async function sh(v,_,k){if(k.buildMode!=="serve"||_.length<WS)return null;let{registerServeModuleBundle:R}=await import("./chunk-x49qdt4c.js");return`<script ${v} src="${R(_)}"></script>`}async function ih(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await _t("stx/client-module-registry",()=>import("./chunk-ev6w9c69.js")),B=[],z=await T(R(...v),{minify:Qs(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-x49qdt4c.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function FS(v,_=""){let k=dh(v,"data-stx-runtime");if(!k)return v;let R=co(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2607
2607
  `+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),B=v.slice(0,k.start)+v.slice(k.end),z=co(B);if(z===-1)return T+_+`
2608
2608
  `+B;return B.slice(0,z)+T+_+`
2609
2609
  `+B.slice(z)}function VS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ke(v,k);let B=!_.__stxProcessingDepth;kn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await En(_,k,R.runtimeConfig);if(B)_d(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ks(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Nn())&&k&&k.endsWith(".stx"))oo(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await US(v,_,k,R,T);if(B)z=Eu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let W=be(R.app?.head,{known:In,source:"app.head"}),U=(_.__stx_runtime_head||null)??Js(),H=(_.__stx_head_raw||"").trim(),q,Q=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Q)q=Q[1].trim(),H=H.replace(Q[0],"").trim();let ie=_.__sections?.title,Z=U.title||q||ie,ae=!U.title&&(!!q||!!ie),le=U.meta||[],ce=new Set(le.map((Pe)=>Re(Pe)).filter(Boolean)),de={...W,...Z&&{title:Z},meta:[...(W.meta||[]).filter((Pe)=>!ce.has(Re(Pe))),...le],link:[...W.link||[],...U.link||[]],script:[...W.script||[],...U.script||[]],headRaw:[W.headRaw,H].filter(Boolean).join(`
2610
2610
  `),...U.htmlAttrs&&{htmlAttrs:Wi(W.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...W.bodyAttrs||{},...U.bodyAttrs}}},ue=Xs(z);if(z=An(z,de,{...ae&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},ue),ue)z=Gi(z,W),z=Rn(z,de.htmlAttrs);let $e=z.match(/<!-- stx-layout: ([^ ]+) -->/);if($e&&z.includes("<head")){let Pe=$e[1],Oe=Rr(Pe);z=z.replace(/<head\b[^>]*>/i,(Me)=>`${Me}
2611
2611
  <meta name="stx-layout" content="${rh(Pe)}">
2612
- <meta name="stx-layout-group" content="${rh(Oe)}">`)}let we=z.match(/function (__stx_setup_\w+)\(/),ye=we?Kn(z):null;if(we&&ye&&!/\bdata-stx=/.test(ye.tag)){z=ls(z,(Oe,Me)=>`<body${Me} data-stx="${we[1]}">`);let Pe=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${we[1]}"`,"i");z=z.replace(Pe,"$1")}}if(B){let W=_.__stx_head_injections??Ks(),F=qi(z);if(F!==null)W.beforeClose.push(F);let U=Sm(z);if(U!==null)W.afterOpen.push(U);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push($m);z=Vi(z,W);let H=R.app?.colorMode;if(H)z=$n(z,H)}if(B)if(dh(z,"data-stx-runtime")){let F=null,U=null,H=null,q=null,Q=null;try{let{getStoreScript:Z}=await _t("stx/store-loader",()=>import("./chunk-1e28n9q2.js")),ae=R.storesDir,le=await Z(ae);if(le)H=`<script data-stx-stores>${le}</script>`,U=await sh("data-stx-stores",le,R)??H}catch{}F=await ih([z,H],R,T);try{let{getFrameworkComposableScript:Z}=await _t("stx/framework-composables",()=>import("./chunk-tyb481p0.js"));Q=await Z(z)}catch{}try{let{getComposableScript:Z}=await _t("stx/composable-loader",()=>import("./chunk-kgvm5ytn.js")),ae=R.composablesDir,le=[F,H,Q].filter((de)=>de!==null),ce=await Z(R._layerComposableDirs??ae,z,le);if(ce)q=await sh('data-stx-scoped data-stx-run="always" data-stx-composables',ce,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ce}</script>`}catch{}let ie=[F,U,q,Q].filter((Z)=>Z!==null).map((Z)=>`
2612
+ <meta name="stx-layout-group" content="${rh(Oe)}">`)}let we=z.match(/function (__stx_setup_\w+)\(/),ye=we?Kn(z):null;if(we&&ye&&!/\bdata-stx=/.test(ye.tag)){z=ls(z,(Oe,Me)=>`<body${Me} data-stx="${we[1]}">`);let Pe=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${we[1]}"`,"i");z=z.replace(Pe,"$1")}}if(B){let W=_.__stx_head_injections??Ks(),F=qi(z);if(F!==null)W.beforeClose.push(F);let U=Sm(z);if(U!==null)W.afterOpen.push(U);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push($m);z=Vi(z,W);let H=R.app?.colorMode;if(H)z=$n(z,H)}if(B)if(dh(z,"data-stx-runtime")){let F=null,U=null,H=null,q=null,Q=null;try{let{getStoreScript:Z}=await _t("stx/store-loader",()=>import("./chunk-9sgt7v77.js")),ae=R.storesDir,le=await Z(ae);if(le)H=`<script data-stx-stores>${le}</script>`,U=await sh("data-stx-stores",le,R)??H}catch{}F=await ih([z,H],R,T);try{let{getFrameworkComposableScript:Z}=await _t("stx/framework-composables",()=>import("./chunk-cp901m61.js"));Q=await Z(z)}catch{}try{let{getComposableScript:Z}=await _t("stx/composable-loader",()=>import("./chunk-sx0qbekt.js")),ae=R.composablesDir,le=[F,H,Q].filter((de)=>de!==null),ce=await Z(R._layerComposableDirs??ae,z,le);if(ce)q=await sh('data-stx-scoped data-stx-run="always" data-stx-composables',ce,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ce}</script>`}catch{}let ie=[F,U,q,Q].filter((Z)=>Z!==null).map((Z)=>`
2613
2613
  ${Z}`).join("");z=FS(z,ie)}else{let F=await ih([z],R,T);if(F){let U=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(U!==-1)z=z.slice(0,U)+F+`
2614
2614
  `+z.slice(U)}}if(B)z=Ui(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=so(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=VS(z),B&&_.__stx_runtime_config)z=rt(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let W=lr(_);if(W){let F=/<head\b[^>]*>/i.exec(z),U=F?F.index+F[0].length:0;z=z.slice(0,U)+W+z.slice(U)}}return z})}catch(z){if(z instanceof Sr)throw z;let W=z instanceof Error?z.message:String(z),F=new Y(`Template processing failed: ${W}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(I.log(F,{filePath:k,context:_}),zt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),R.debug)throw F;return Ys.createFallbackContent("Template Processing",F)}}async function US(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!ln.isAbsolute(R.partialsDir)?ln.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!ln.isAbsolute(R.componentsDir)?ln.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!ln.isAbsolute(R.layoutsDir)?ln.resolve(B,R.layoutsDir):R.layoutsDir},W=z,F=v;await KS(k,_),qS(_,W),F=await oe(()=>fm(F,_,k,W),F,(we)=>{I.log(we,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${we.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Vn(F,qe,(we,ye)=>`\x00STX_HTML_COMMENT_${ye}\x00`);F=U.output;let H=U.tokens,q=(we)=>H.length===0?we:we.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(ye,Pe)=>H[Number(Pe)]??""),Q="\x00STX_ESCAPED_AT\x00",ie="\x00STX_ESC_MUSTACHE_OPEN\x00",Z="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Q),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(we,ye)=>`${ie}${ye}${Z}`),F=ym(F),F=await Hm(F,k,T);let ae={};F=Is(F,ae);let le={..._.__sections||{}},ce="",de=Qf(Ke(v)),ue=/@nolayout\b/.test(F)||de===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let $e=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e)ce=$e[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof de==="string"){if(ce=de,!/@section\s*\(/.test(F))F=`@section('content')
2615
2615
  ${F.trim()}
@@ -2618,7 +2618,7 @@ ${F.trim()}
2618
2618
  @endsection`}}if(ce&&F.includes("<script")){let we=gn(F),ye=we.scripts.map((Pe)=>oh(Pe,k)??Pe);F=os(we.output,ye)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(we,ye,Pe)=>(le[ye]=Pe,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(we,ye,Pe)=>{if(/^(['"]).*\1$/.test(Pe.trim()))return we;try{let Oe=l(Pe.trim(),_);if(Oe===void 0)return we;return le[ye]=String(Oe??""),""}catch{return we}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(we,ye,Pe)=>{if(Pe.includes("@parent"))le[ye]=Pe.replace("@parent",Jr);else le[ye]=Pe.trim();return""}),_.__sections=le,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(we,ye,Pe)=>le[ye]||Pe||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>le.content||"");if(F=Os(F,ae),ce){let we=[],ye=gn(F),Pe=Vn(ye.output,is,(Oe,Me)=>`\x00STX_ORPHAN_STYLE_${Me}\x00`);if(F=Pe.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Oe,Me,Ne)=>{let Le=Me==="SCRIPT"?oh(ye.scripts[Number(Ne)],k):Pe.tokens[Number(Ne)];if(Le)we.push(Le);return""}),we.length>0){let Oe=we.join(`
2619
2619
  `);le.content=le.content?`${le.content}
2620
2620
  ${Oe}`:Oe,_.__sections=le}}if(ce)try{let we;if(ln.isAbsolute(ce))we=ce,T.add(ce);else we=await oe(()=>dr(ce,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ce}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!we){let Le=(Ve)=>{if(!Ve)return[];try{let Be=ln.isAbsolute(Ve)?Ve:ln.resolve(process.cwd(),Ve);return zS.readdirSync(Be).filter((je)=>je.endsWith(".stx")).map((je)=>je.replace(/\.stx$/,""))}catch{return[]}},De=[...Le(z.layoutsDir),...Le(z.fallbackLayoutsDir)].filter((Ve,Be,je)=>je.indexOf(Ve)===Be).sort(),ze=`Layout not found: ${ce} (referenced from ${k})`+(De.length>0?`. Available layouts: ${De.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(I.log(Error(ze),{layoutPath:ce,filePath:k,available:De},"error"),console.error(`[stx] ${ze}`),z.debug)throw new Y(ze,k);return F}let ye=await oe(()=>Bun.file(we).text(),"",()=>{throw new Y(`Failed to read layout file: ${we}`,k,void 0,void 0,"Layout content could not be loaded")});ye=nh(ye,we);let Pe=ye.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Pe){if(z.debug)console.log(`Found nested layout: ${Pe[1]} in ${we}`);let Le={},De=ye.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Be,je,st)=>(Le[je]=st.trim(),""));for(let[Be,je]of Object.entries(Le))if(le[Be]&&le[Be].includes(Jr)){let st=le[Be].indexOf(Jr);le[Be]=le[Be].slice(0,st)+je+le[Be].slice(st+Jr.length)}else if(!le[Be])le[Be]=je;let ze={..._,__sections:le},Ve=`@layout('${Pe[1]}')${De}`;return await n(Ve,ze,we,z,T)}let Oe=ye.replace(/\{\{--[\s\S]*?--\}\}/g,""),Me=Is(Oe,ae),Ne={};return Me=Me.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Le,De,ze)=>(Ne[De]=ze.trim(),`@slot('${De}')`)),Me=Me.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Le,De,ze)=>{if(le[De]){let Ve=le[De];if(Ve.includes(Jr)){let Be=Ne[De]||"",je=Ve.indexOf(Jr);Ve=Ve.slice(0,je)+Be+Ve.slice(je+Jr.length)}return Ve}return ze||""}),Me=HS(Me,le),Me=Me.replace(/\{\{\s*slot\s*\}\}/g,()=>le.content||""),Me=Os(Me,ae),_.__originalFilePath=k,F=await lh(Me,_,we,z,T),F=`<!-- stx-layout: ${ce} -->
2621
- ${F}`,q(F)}catch(we){return I.log(we instanceof Error?we:Error(String(we)),{layoutPath:ce,filePath:k},"error"),`[Error processing layout: ${we instanceof Error?we.message:String(we)}]`}return q(await lh(F,_,k,z,T))}function HS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function qS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function KS(v,_){await oe(()=>mm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Au="data-stx-source";function oh(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Au))return v;return`<script ${Au}="${encodeURIComponent(_)}"${v.slice(7)}`}function XS(v){let _=new RegExp(`${Au}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function ah(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ch(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${ah(v)}</span><span style="display:block;margin-top:4px">${ah(k)}</span></div>`}async function ZS(v,_,k,R){let{scanScriptTags:T}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js")),B=[],z=!E()&&!Nn();for(let F of T(v)){let U=F.attrs;if(!/\bserver\b/.test(U))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=uh(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let ie=XS(U)??k,Z={index:F.start,length:q+9-F.start};try{let{extractVariables:ae}=await _t("stx/variable-extractor",()=>import("./chunk-915s0may.js"));await ae(Q,_,ie,{preserveExisting:!0,onFailure:(le)=>{if(le.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:ie,kind:le.kind,message:le.message}),!z)return;B.push({...Z,markup:ch(ie,le.kind,le.message)})}})}catch(ae){let le=ae instanceof Error?ae:Error(String(ae));if(I.log(le,{filePath:ie,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ie}: ${le.message}`),z)B.push({...Z,markup:ch(ie,"unknown",le.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((U,H)=>H.index-U.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function GS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await _t("stx/expressions",()=>import("./chunk-3gm6013p.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function lh(v,_,k,R,T){let B=v,z=R;if(B=await ZS(B,_,k,R),B=await GS(B,_,k),B=await em(B,_,k),B=await tm(B,_,k),B=await Lp(B,_,k,z),ke(B))B=Si(B,_),B=$s(B,_),B=Ts(B,_);B=ki(B);let{processStreamDirectives:W}=await _t("stx/streaming",()=>import("./chunk-d0kes50w.js"));B=W(B,_),B=$i(B,_,k,z,!0),B=await wm(B,_,k,z,T),B=await Cs(B,_,k,z,T),B=Yf(B,_,k,z);let{processDeferDirectives:F}=await _t("stx/defer",()=>import("./chunk-rrw2jg26.js"));B=F(B,_,k);let{processTeleportDirectives:U}=await _t("stx/teleport",()=>import("./chunk-2r4an7bh.js"));B=U(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await _t("stx/transitions",()=>import("./chunk-gw2dvp35.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:ie}=await _t("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=ie(B);let{processSuspenseDirectives:Z}=await _t("stx/suspense",()=>import("./chunk-q40ahbjs.js"));B=Z(B,_,k);let{processAsyncDirectives:ae}=await _t("stx/async-components",()=>import("./chunk-3yttgk0s.js"));B=ae(B,_,k);let{processKeepAliveDirectives:le}=await _t("stx/keep-alive",()=>import("./chunk-myqhdz1w.js"));B=le(B,_,k);let{processVirtualListDirectives:ce,processVirtualGridDirectives:de,processInfiniteListDirectives:ue}=await _t("stx/virtual-scrolling",()=>import("./chunk-wm8w2721.js"));B=ce(B,_,k),B=de(B,_,k),B=ue(B,_,k);let{processPartialHydrationDirectives:$e,processStaticDirectives:we}=await _t("stx/partial-hydration",()=>import("./chunk-wjhhb6dn.js"));B=$e(B,_,k),B=we(B);let{processComputedDirectives:ye,processWatchDirectives:Pe}=await _t("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=ye(B,_,k),B=Pe(B,_,k);let{processFormValidationDirectives:Oe}=await _t("stx/forms-validation",()=>import("./chunk-qjxxhdv7.js"));B=Oe(B,_,k);let{processHeadDirective:Me,processTitleDirective:Ne,processMetaDirective:Le,resetHead:De}=await _t("stx/head",()=>import("./chunk-z8mdsjzw.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)De();let ze=Me(B);if(B=ze.content,ze.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${ze.headContent}
2621
+ ${F}`,q(F)}catch(we){return I.log(we instanceof Error?we:Error(String(we)),{layoutPath:ce,filePath:k},"error"),`[Error processing layout: ${we instanceof Error?we.message:String(we)}]`}return q(await lh(F,_,k,z,T))}function HS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function qS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function KS(v,_){await oe(()=>mm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Au="data-stx-source";function oh(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Au))return v;return`<script ${Au}="${encodeURIComponent(_)}"${v.slice(7)}`}function XS(v){let _=new RegExp(`${Au}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function ah(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ch(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${ah(v)}</span><span style="display:block;margin-top:4px">${ah(k)}</span></div>`}async function ZS(v,_,k,R){let{scanScriptTags:T}=await _t("stx/signal-processing",()=>import("./chunk-t83acmv2.js")),B=[],z=!E()&&!Nn();for(let F of T(v)){let U=F.attrs;if(!/\bserver\b/.test(U))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=uh(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let ie=XS(U)??k,Z={index:F.start,length:q+9-F.start};try{let{extractVariables:ae}=await _t("stx/variable-extractor",()=>import("./chunk-2n59ahd9.js"));await ae(Q,_,ie,{preserveExisting:!0,onFailure:(le)=>{if(le.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:ie,kind:le.kind,message:le.message}),!z)return;B.push({...Z,markup:ch(ie,le.kind,le.message)})}})}catch(ae){let le=ae instanceof Error?ae:Error(String(ae));if(I.log(le,{filePath:ie,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ie}: ${le.message}`),z)B.push({...Z,markup:ch(ie,"unknown",le.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((U,H)=>H.index-U.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function GS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await _t("stx/expressions",()=>import("./chunk-2pwjnydp.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function lh(v,_,k,R,T){let B=v,z=R;if(B=await ZS(B,_,k,R),B=await GS(B,_,k),B=await em(B,_,k),B=await tm(B,_,k),B=await Lp(B,_,k,z),ke(B))B=Si(B,_),B=$s(B,_),B=Ts(B,_);B=ki(B);let{processStreamDirectives:W}=await _t("stx/streaming",()=>import("./chunk-aan7601v.js"));B=W(B,_),B=$i(B,_,k,z,!0),B=await wm(B,_,k,z,T),B=await Cs(B,_,k,z,T),B=Yf(B,_,k,z);let{processDeferDirectives:F}=await _t("stx/defer",()=>import("./chunk-rrw2jg26.js"));B=F(B,_,k);let{processTeleportDirectives:U}=await _t("stx/teleport",()=>import("./chunk-2r4an7bh.js"));B=U(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await _t("stx/transitions",()=>import("./chunk-gw2dvp35.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:ie}=await _t("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=ie(B);let{processSuspenseDirectives:Z}=await _t("stx/suspense",()=>import("./chunk-q40ahbjs.js"));B=Z(B,_,k);let{processAsyncDirectives:ae}=await _t("stx/async-components",()=>import("./chunk-3yttgk0s.js"));B=ae(B,_,k);let{processKeepAliveDirectives:le}=await _t("stx/keep-alive",()=>import("./chunk-myqhdz1w.js"));B=le(B,_,k);let{processVirtualListDirectives:ce,processVirtualGridDirectives:de,processInfiniteListDirectives:ue}=await _t("stx/virtual-scrolling",()=>import("./chunk-wm8w2721.js"));B=ce(B,_,k),B=de(B,_,k),B=ue(B,_,k);let{processPartialHydrationDirectives:$e,processStaticDirectives:we}=await _t("stx/partial-hydration",()=>import("./chunk-wjhhb6dn.js"));B=$e(B,_,k),B=we(B);let{processComputedDirectives:ye,processWatchDirectives:Pe}=await _t("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=ye(B,_,k),B=Pe(B,_,k);let{processFormValidationDirectives:Oe}=await _t("stx/forms-validation",()=>import("./chunk-qjxxhdv7.js"));B=Oe(B,_,k);let{processHeadDirective:Me,processTitleDirective:Ne,processMetaDirective:Le,resetHead:De}=await _t("stx/head",()=>import("./chunk-z8mdsjzw.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)De();let ze=Me(B);if(B=ze.content,ze.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${ze.headContent}
2622
2622
  `;if(B=Ne(B,_),B=Le(B,_,k),B=gm(B),B=Il(B,_),B=jp(B),B=um(B),B=await Ps(B,_,k,z,T),B=await Cs(B,_,k,z,T),_.__stxProcessingDepth===1)B=kd(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=Eu(B),B=br(B,_,k),B=As(B),B=ep(B,_,{filePath:k,buildMode:z.buildMode}),B=Pl(B,_),B=Dl(B,_),B=_a(B,_),B=Hp(B,_),B=qp(B,_),B=await Cp(B,_,k,z),B=await op(B,_,k),B=await Oi(B,_,k,z),B=Di(B,_,k,z),B=Vs(B,_,k,z),B=Us(B,_,k),B=Ws(B,_,k,z),B=Mp(B,_,k,z),B=Ns(B,_),B=Ms(B),B=Zm(B),!z.skipEventDirectives)B=Uu(B,_,k);if(B=rp(B,_,k),z.debug){let bt=/\bx-data\s*=/.test(B),ft=Es(v);if(bt&&ft)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2623
2623
  Both work on the same page, but they manage separate scopes.
2624
2624
  Prefer signals (state/derived/effect) for new components.`)}B=kg(B,_),B=await X(B,_,k),B=Qm(B),B=eh(B),B=Vf(B);let{processXElementDirectives:Ve}=await _t("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Ve(B);let Be=_.__originalFilePath||k,je=xe(_);if(B=await Ci(B,z,Be,je),B=Fp(B,_),B=await pm(B,_,k,z),z.media?.image?.autoSiblings){let bt=z.publicDir||"public",{rewriteImagesWithSiblings:ft}=await _t("stx/image-optimization/auto-sibling",()=>import("./chunk-36n8yz6t.js"));B=await ft(B,{publicDir:bt})}if(z.seo?.enabled)B=qs(B,_,z);let st=(bt,ft,$t=!0)=>{if(!ft)return bt;let Wt=ft.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Gt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(bt),Yt=Gt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Gt[0]):null;if(Wt&&Gt&&Yt){if($t){let un=Gt.index+Yt.index;bt=bt.slice(0,un)+Wt[0]+bt.slice(un+Yt[0].length)}if(ft=ft.replace(Wt[0],"").trim(),!ft)return bt}if(/<\/head>/i.test(bt))return bt.replace(/<\/head>/i,`${ft}
@@ -2632,7 +2632,7 @@ ${zf()}
2632
2632
  `+un}else B=B.replace("</head>",`${ft}
2633
2633
  </head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
2634
2634
  ${ft}`);else B=ft+`
2635
- `+B}{let{scanScriptTags:bt}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js")),ft=[];for(let $t of bt(B)){if(!/\bserver\b/i.test($t.attrs))continue;let Wt=$t.start+$t.fullMatch.indexOf(">")+1,Gt=uh(B,Wt);if(Gt===-1)continue;let Yt=Gt+9;while(Yt<B.length&&/\s/.test(B[Yt]))Yt++;ft.push({start:$t.start,end:Yt})}if(ft.length>0){let $t=Array(ft.length+1),Wt=0;for(let Gt=0;Gt<ft.length;Gt++){let{start:Yt,end:un}=ft[Gt];$t[Gt]=B.slice(Wt,Yt),Wt=un}$t[ft.length]=B.slice(Wt),B=$t.join("")}}let ct=ca(B,k);if(ct.hasScoped)B=ct.html;let St=_.__stx_event_bindings||[],mt=!1,Kt=[],Wn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Mn}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js"));for(let bt of Mn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Kt.push({match:bt.fullMatch,attrs:bt.attrs,content:bt.body});for(let{match:bt,attrs:ft,content:$t}of Kt){mt=!0;let Wt=$t;Ls($t,k,R.strict,_.__originalFilePath);let Gt=await Se($t,{eventBindings:St,attrs:ft,hasColonDirectives:Wn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Qs(R.buildMode),serverData:je});B=B.replace(bt,()=>Gt)}if(mt)_.__stx_event_bindings=[];if(!mt&&_.__stxProcessingDepth===1){let bt=_.__stx_event_bindings||[];if(bt.length>0){let ft=nc(bt);if(ft){let $t=B.lastIndexOf("</body>");B=$t===-1?B+ft:B.slice(0,$t)+ft+`
2635
+ `+B}{let{scanScriptTags:bt}=await _t("stx/signal-processing",()=>import("./chunk-t83acmv2.js")),ft=[];for(let $t of bt(B)){if(!/\bserver\b/i.test($t.attrs))continue;let Wt=$t.start+$t.fullMatch.indexOf(">")+1,Gt=uh(B,Wt);if(Gt===-1)continue;let Yt=Gt+9;while(Yt<B.length&&/\s/.test(B[Yt]))Yt++;ft.push({start:$t.start,end:Yt})}if(ft.length>0){let $t=Array(ft.length+1),Wt=0;for(let Gt=0;Gt<ft.length;Gt++){let{start:Yt,end:un}=ft[Gt];$t[Gt]=B.slice(Wt,Yt),Wt=un}$t[ft.length]=B.slice(Wt),B=$t.join("")}}let ct=ca(B,k);if(ct.hasScoped)B=ct.html;let St=_.__stx_event_bindings||[],mt=!1,Kt=[],Wn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Mn}=await _t("stx/signal-processing",()=>import("./chunk-t83acmv2.js"));for(let bt of Mn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Kt.push({match:bt.fullMatch,attrs:bt.attrs,content:bt.body});for(let{match:bt,attrs:ft,content:$t}of Kt){mt=!0;let Wt=$t;Ls($t,k,R.strict,_.__originalFilePath);let Gt=await Se($t,{eventBindings:St,attrs:ft,hasColonDirectives:Wn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Qs(R.buildMode),serverData:je});B=B.replace(bt,()=>Gt)}if(mt)_.__stx_event_bindings=[];if(!mt&&_.__stxProcessingDepth===1){let bt=_.__stx_event_bindings||[];if(bt.length>0){let ft=nc(bt);if(ft){let $t=B.lastIndexOf("</body>");B=$t===-1?B+ft:B.slice(0,$t)+ft+`
2636
2636
  `+B.slice($t)}_.__stx_event_bindings=[]}}if(!ge(B)&&Im(B))B=await Wa(B,z);if(B=Pm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=Op(B,_.cspNonce);return B}var JS=[{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"}],YS=[{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')"}],QS=[{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 Wc(v){let _=[],k=[];return e0(v,_),t0(v,_,k),n0(v,k),r0(v,_),{valid:_.length===0,errors:_,warnings:k}}function e0(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function t0(v,_,k){for(let R of JS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,W=(v.match(B)||[]).length;if(R.altClose){let F=new RegExp(R.altClose,"g");W+=(v.match(F)||[]).length}if(z>W)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${W} closing`,suggestion:`Add ${z-W} missing ${R.close} tag(s)`});else if(W>z)k.push({type:"directive",message:`Extra ${R.close} found: ${W-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function n0(v,_){for(let k of YS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function r0(v,_){for(let k of QS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function qc(v,_){let k=v.slice(0,_).split(`
2637
2637
  `);return{line:k.length,column:k[k.length-1].length+1}}function Gc(v,_,k){let R=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))R.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(k.length===0)R.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)R.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)R.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return R}function Kc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Xc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let R of _){let T=R[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Xn from"path";import ji from"process";var Lt=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","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"];var fh=new Set(Lt),s0=new Set(["props","$props","defineProps"]),i0=new Set(["stx","@stacksjs/stx"]),ph=m(128),gh=m(64);function o0(v){let _=[],k=0,R=v.split(`
2638
2638
  `);for(let T of R){let B=k,z=null,W=!1;for(let F=0;F<T.length;F++){let U=T[F];if(W){W=!1;continue}if(U==="\\"){W=!0;continue}if(z){if(U===z)z=null;continue}if(U==="'"||U==='"'||U==="`"){z=U;continue}if(U==="/"&&F+1<T.length&&T[F+1]==="/")break;if(U==="{")k++;else if(U==="}")k--}if(B===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let U=T.match(/(?:const|let|var)\s+(\w+)/);if(U)_.push(U[1])}else{let U=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let q=U[1].slice(1,-1).split(",").map((Q)=>{let ie=Q.split(":");return(ie.length>1?ie[1]:ie[0]).trim()}).filter((Q)=>/^\w+$/.test(Q));_.push(...q)}}}}return[...new Set(_)]}function Mc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(R){if(!R.includes(":"))return R;let T=[],B="",z=0,W=0,F=null;for(let U=0;U<R.length;U++){let H=R[U];if(F){if(B+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,B+=H;continue}if(H==="<")z++;else if(H===">"&&z>0)z--;else if(H==="(")W++;else if(H===")")W--;if(H===","&&z===0&&W===0){T.push(B),B="";continue}B+=H}if(B)T.push(B);return T.map((U)=>{let H=U.trim(),q=H.startsWith("..."),Q=q?H.slice(3):H,ie=-1,Z=0;for(let we=0;we<Q.length;we++)if(Q[we]==="<")Z++;else if(Q[we]===">")Z--;else if(Q[we]===":"&&Z===0){ie=we;break}if(ie===-1)return U;let le=Q.substring(0,ie).trim().replace(/\?$/,""),ce=Q.substring(ie+1),de=-1,ue=0;for(let we=0;we<ce.length;we++)if(ce[we]==="<")ue++;else if(ce[we]===">")ue--;else if(ce[we]==="="&&ue===0){de=we;break}let $e=q?"...":"";if(de!==-1)return`${$e}${le} = ${ce.substring(de+1).trim()}`;return`${$e}${le}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,B)=>{if(!B.includes(":"))return R;return`${T}(${k(B)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,B=[];while((T=R.exec(_))!==null){let z=T.index+T[0].length-1,W=1,F=z+1,U=0,H=null;while(F<_.length&&W>0){let ie=_[F];if(H){if(ie===H)H=null;F++;continue}if(ie==='"'||ie==="'"||ie==="`"){H=ie,F++;continue}if(ie==="<")U++;else if(ie===">"&&U>0)U--;else if(U===0){if(ie==="(")W++;else if(ie===")")W--}if(W>0)F++}if(W!==0)continue;let q=_.substring(z+1,F);if(!q.includes(":"))continue;let Q=k(q);B.push({start:z+1,end:F,replacement:Q})}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:U}=B[z];_=_.substring(0,W)+U+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(R,T)=>{if(!T.includes(":"))return R;if(T.includes("{")||T.includes("}"))return R;return`(${T.split(",").map((z)=>{let[W,...F]=z.split("="),U=W.split(":")[0].trim();if(F.length>0)return`${U} = ${F.join("=").trim()}`;return U}).join(", ")}) =>`}),_=_.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"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
@@ -2657,8 +2657,8 @@ ${z}`,T++}return{functionCode:R,nextIndex:T}}function vh(v,_){let k=l(v,_)??l(`(
2657
2657
  `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},U=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let Z=H[2].split(",").map((ae)=>{let le=ae.trim().split(":");return le[le.length-1].trim()});for(let ae of Z)if(ae&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ae)&&!k.has(ae))_.push(ae),k.add(ae);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Z=q[2];if(!k.has(Z))_.push(Z),k.add(Z);return}let Q=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let Z=Q[1];if(!k.has(Z))_.push(Z),k.add(Z);return}let ie=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Z=ie[1];if(!k.has(Z))_.push(Z),k.add(Z)}};while(T<B){if(F())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){W();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))U();T++}return _}function x0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function b0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function v0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let F=v[R];if(F==="}")B++;else if(F==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let W=v.slice(z+1,T);for(let F of x0(W)){let U=F.trim();if(!U||U.startsWith("..."))continue;let H=b0(U);if(H===-1)continue;let q=U.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let Q=U.slice(H+1).trim();if(!Q)continue;try{let ie=Object.keys(_).filter(at),Z=Function(...ie,`"use strict"; return (${Q});`);_[q]=Z(...ie.map((ae)=>_[ae]))}catch{}}}catch{}}var w0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Yc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let R=k[2].toLowerCase();if(!w0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(U,H)=>(T.lastIndex=H,T.exec(U)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,W=!1;for(let U of B){if(z+=U.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(U.end).trim())return null;W=!0;break}}if(!W)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function ur(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(we)=>we.split("-").map((ye)=>ye.charAt(0).toUpperCase()+ye.slice(1)).join(""),W=k.__importedComponents;if(W){for(let we of[B,B.toLowerCase(),z(B),dn(B)])if(W.has(we))return!0}let F=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${dn(B)}.stx`])],U=typeof T.root==="string"?ut.resolve(T.root):void 0,H=U??ut.dirname(R),q=[],Q=(we)=>{if(we&&!q.includes(we))q.push(we)},ie=k.__originalFilePath;if(ie)Q(ut.join(ut.dirname(ie),"components"));Q(_),Q(T._rootComponentsDir),Q(ut.join(ut.dirname(R),"components")),Q(T.componentsDir);let Z=T._targetComponentFallbackNames?.some((we)=>we.toLowerCase()===B.toLowerCase());if(!Z)for(let we of T._targetComponentDirs??[])Q(we);if(U)Q(ut.resolve(U,"resources/views/components")),Q(ut.resolve(U,"resources/components")),Q(ut.resolve(U,"src/components")),Q(ut.resolve(U,"components"));for(let we of T._layerComponentDirs??[])Q(we);let ae=T._pluginComponentDirs;if(Array.isArray(ae))for(let we of ae)Q(typeof we==="string"?we:null);if(Q(T.fallbackComponentsDir),Z)for(let we of T._targetComponentDirs??[])Q(we);if(B.startsWith("./")||B.startsWith("../"))return r(ut.resolve(ut.dirname(R),`${B}.stx`));let le=Ch(ut.resolve(import.meta.dir,"components")),ce=q.map((we)=>ut.isAbsolute(we)?we:ut.resolve(H,we)),de=`${F.join("\x00")}\x00\x00${ce.join("\x00")}`,ue=Pu.get(de);if(ue!==void 0)return ue;let $e=!1;e:for(let we of ce){if(Ch(we)===le)continue;for(let ye of F)if(await r(ut.join(we,ye))){$e=!0;break e}}return Pu.set(de,$e),$e}function Ch(v){let _=Du.get(v);if(_!==void 0)return _;let k=v;try{k=Ih.realpathSync(v)}catch{}return Du.set(v,k),k}function Zc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function Pi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function S0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let W=String(z);if(/<\/style/i.test(W))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return W};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var Rh=new Set;function Ah(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&Rh.has(T))return;Rh.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",W=k.length>0?`
2658
2658
  searched:
2659
2659
  ${k.map((F)=>` - ${F}`).join(`
2660
- `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function Th(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Qc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function tt(v,_,k,R,T,B,z,W=new Set,F,U=kr(T),H,q=v){let{extractVariables:Q}=await _t("stx/variable-extractor",()=>import("./chunk-915s0may.js")),ie=W??new Set;if(ie.has(v))return`[Circular component reference: ${v}]`;let Z=new Set(ie);Z.add(v);let ae=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let le=ae&&ae!=="load"&&Zc(ae)?ae:"";try{let ce=(lt)=>lt.split("-").map((gt)=>gt.charAt(0).toUpperCase()+gt.slice(1)).join(""),de=q.endsWith(".stx")?q.slice(0,-4):q,ue=null,$e=T.__importedComponents;if($e){let lt=[de,de.toLowerCase(),ce(de),dn(de)];for(let gt of lt)if($e.has(gt)){ue=$e.get(gt);break}}let we=[];if(!ue){let lt=[`${de}.stx`,`${ce(de)}.stx`,`${dn(de)}.stx`],gt=[...new Set(lt)],Et=T.__originalFilePath,it=[];if(it.push(...z._layerComponentDirs??[]),Et){let Tt=ut.join(ut.dirname(Et),"components");it.push(Tt)}if(R)it.push(R);let Xt=z._rootComponentsDir;if(typeof Xt==="string"&&!it.includes(Xt))it.push(Xt);let Qt=ut.join(ut.dirname(B),"components");if(!it.includes(Qt))it.push(Qt);if(z.componentsDir&&z.componentsDir!==R&&!it.includes(z.componentsDir))it.push(z.componentsDir);let $r=z._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(de),Br=(H?.events??[]).map((Tt)=>Tt.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ts=!Br.includes("valuechange")&&(Object.hasOwn(_,"checked")||H?.reactiveProps?.includes("checked")||Br.includes("change")),No=z._targetComponentFallbackNames?.some((Tt)=>Tt.toLowerCase()===de.toLowerCase())&&(!$r||ts);for(let Tt of No?[]:z._targetComponentDirs??[])if(Tt&&!it.includes(Tt))it.push(Tt);let jn=typeof z.root==="string"?ut.resolve(z.root):void 0,jo=jn??ut.dirname(B),Jn=[];if(jn)Jn.push(ut.resolve(jn,"resources/views/components")),Jn.push(ut.resolve(jn,"resources/components")),Jn.push(ut.resolve(jn,"src/components")),Jn.push(ut.resolve(jn,"components"));Jn.push(ut.resolve(import.meta.dir,"components"));for(let Tt of Jn)if(!it.includes(Tt))it.push(Tt);let Bi=z._pluginComponentDirs;if(Array.isArray(Bi)){for(let Tt of Bi)if(typeof Tt==="string"&&!it.includes(Tt))it.push(Tt)}if(z.fallbackComponentsDir&&!it.includes(z.fallbackComponentsDir))it.push(z.fallbackComponentsDir);if(No){for(let Tt of z._targetComponentDirs??[])if(Tt&&!it.includes(Tt))it.push(Tt)}let zi=[...new Set(it.map((Tt)=>{if(!Tt)return Tt;return ut.isAbsolute(Tt)?Tt:ut.resolve(jo,Tt)}))];it.length=0,it.push(...zi);let ns=`${de}\x00${B}\x00${zi.join("\x00")}`,Ja=qa.get(ns);if(Ja)if(await r(Ja))ue=Ja;else qa.delete(ns);if(!ue&&(de.startsWith("./")||de.startsWith("../")))ue=ut.resolve(ut.dirname(B),`${de}.stx`),we.push(ue);else if(!ue)for(let Tt of it){if(!Tt)continue;for(let Lo of gt){let Bo=ut.join(Tt,Lo);if(we.push(Bo),await r(Bo)){ue=Bo;break}}if(ue)break;if(!ue)try{let Lo=await import("fs");if(!Lo.statSync(Tt,{throwIfNoEntry:!1})?.isDirectory())continue;let Lh=8,Ya=[{path:Tt,depth:0}];while(Ya.length>0&&!ue){let zo=Ya.pop();if(zo.depth>=Lh)continue;let Nu;try{Nu=Lo.readdirSync(zo.path,{withFileTypes:!0})}catch{continue}for(let Wo of Nu){if(!Wo.isDirectory())continue;if(Wo.name==="node_modules"||Wo.name.startsWith("."))continue;let ju=ut.join(zo.path,Wo.name);for(let Bh of gt){let Qa=ut.join(ju,Bh);if(we.push(Qa),await r(Qa)){ue=Qa;break}}if(ue)break;Ya.push({path:ju,depth:zo.depth+1})}}}catch{}if(ue)break}if(ue)qa.set(ns,ue)}if(!ue||!await r(ue))return Ah(v,B,we),Th(v);F.add(ue);let ye;if(Io.has(ue))ye=Io.get(ue);else try{ye=await Bun.file(ue).text(),Io.set(ue,ye)}catch(lt){let gt=lt instanceof Error?lt.message:String(lt);return Ah(v,B,[ue],gt),Th(v)}if(H)for(let lt of new Set([...Object.keys(_),...H.reactiveProps??[]])){let gt=lt.toLowerCase();if(gt.startsWith("aria-")||gt.startsWith("data-"))continue;let Et=lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Et}\\b`).test(ye))H.declaredProps.add(lt);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Et}\\b|\\[\\s*['"]${Et}['"]\\s*\\])`).test(ye)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Et}['"]`).test(ye))H.consumedProps?.add(lt)}let Pe=new Set(["__originalFilePath","__importedComponents",Xo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Oe={};for(let[lt,gt]of Object.entries(T))if(!lt.startsWith("__")||Pe.has(lt))Oe[lt]=gt;let Me=U.length>0?{[na]:[...U]}:{},Ne=k;if(k.includes("@include")){let{processIncludes:lt}=await _t("stx/includes",()=>import("./chunk-ajd5w5c4.js"));Ne=await lt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ne)){let{processComponents:lt}=await _t("stx/component-renderer",()=>import("./chunk-k7spjpr0.js"));Ne=await lt(Ne,{...T,__processedComponents:ie,...Me},B,z,F)}let Le=[];if(Pi(Ne)){let{processExpressions:lt}=await _t("stx/expressions",()=>import("./chunk-3gm6013p.js")),gt=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Me}:U.length>0?{...T,...Me}:T;Ne=lt(Ne,gt,B);for(let Et of Ne.matchAll(/\{\{([\s\S]*?)\}\}/g))Le.push(Et[1].trim())}let De=gn(Ne),ze=[],Ve=De.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(lt,gt)=>{let Et=De.scripts[Number(gt)]||"",it=Et.match(/^<script\b([^>]*)>/i)?.[1]||"",Xt=it.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qt=!Xt||["module","text/javascript","application/javascript"].includes(Xt),$r=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${it}`);if(!/\bserver\b/i.test(it)&&Qt&&!$r)return ze.push(Et),"";return Et}),{extractSlotContent:Be}=await _t("stx/slots",()=>import("./chunk-1veeefpn.js")),je=Be(Ve),st={};if(je.defaultSlot?.trim())st.default=je.defaultSlot;for(let[lt,gt]of je.namedSlots)st[lt]=gt.content;let ht=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},vt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ht.n}_${ht.key}`,dt={...Oe,$uid:vt,..._,props:_,slot:Ve,$slots:st,__processedComponents:Z,__sections:{},__stx_signals_gate:ke(ye)||Pi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Le]};v0(ye,dt);let wt=ye,kt=re(wt);if(kt)wt=kt.content.trim();let xt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ct=[...ye.matchAll(xt)],St=[],mt=null,Kt=ct.some((lt)=>/\bserver\b/.test(lt[1]||"")&&/\bcache\b/.test(lt[1]||"")),Wn=null,Mn=null,bt=null,ft=0,$t=null;if(p0(z),Kt&&Ou>0){let lt=g0({props:_,slot:Ne,slotContext:k.trim()?m0(Oe):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...U].sort(),layers:z._layerGraph?.layers.map((gt)=>gt.configFile),uid:vt});if(lt!==null){Wn=`${ue}\x00${h(ye)}\x00${lt}`;let gt=Ka.get(Wn);if(gt){for(let Et of gt.dependencies)F.add(Et);if(Rd(T,gt.clientFactories),ht.n+=gt.uidsConsumed,gt.preservedClientExpressions.length>0){let Et=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let it of gt.preservedClientExpressions)Et.add(it);T.__stx_preserved_client_expressions=[...Et]}return gt.output}Mn=new Set(F),bt=Ed(T),ft=ht.n,$t=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let lt of ct){let gt=lt[1]||"",Et=lt[2]||"",it=gt.includes("server");if(Qe(gt)&&Et.trim())Et=et(Et);if(it&&Et){for(let Qt of fe(Et))Wt.add(Qt);try{await Q(Et,dt,ue,{onFailure:(Qt)=>{if(Qt.kind!=="unknown")mt=Qt.kind}})}catch(Qt){}}if(!it){let Qt=Et.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$r=Qt.includes("{{")&&Qt.includes("}}"),Br=Qt.includes("{!!")&&Qt.includes("!!}");if($r||Br)Qt=ys(Qt,dt,ue);let ts=gt.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");St.push(`<script${ts}>${Qt}</script>`)}}let Yt=gn(ye).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),un=Yt?Yt[1]:"",Xa=Yt?Yt[2]:"",Zn="",Za=un&&/\bscoped\b/i.test(un);if(Yt)Zn=`<style${un}>${S0(Xa,dt,ue)}</style>`;let Fe=wt;if(Fe=Fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Yt)Fe=Fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let lt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,gt=[];if(Fe=Fe.replace(lt,(Et,it)=>{let Xt=it.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xt)gt.push(`<style${Xt[1]}>${Xt[2]}</style>`);return""}),Fe=Fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),gt.length>0)Zn=`${Zn}${gt.join(`
2661
- `)}`}if(k&&Fe.includes("{{ text || slot }}"))Fe=Fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:He}=await _t("stx/slots",()=>import("./chunk-1veeefpn.js")),{defaultSlot:pt,namedSlots:Ct}=je,Ut=St.some((lt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(lt)),rn=(lt)=>Ut?Gm(lt,vt):lt,Qr=new Map([...Ct].map(([lt,gt])=>[lt,{...gt,content:rn(gt.content)}]));Fe=await He(Fe,rn(pt),Qr,dt);let Ga=Qc(St),Do=(Array.isArray(dt.__stx_client_signal_names)?dt.__stx_client_signal_names:[]).filter((lt)=>!Wt.has(lt));if(Ga.length>0||Do.length>0)dt.__stx_client_signal_names=[...new Set([...Do,...Ga])];else delete dt.__stx_client_signal_names;let Oo=U.filter((lt)=>!Wt.has(lt)&&!(lt in _));if(Oo.length>0)dt[na]=Oo;let Mo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:ut.dirname(ue),skipSignalsRuntime:!0,skipEventDirectives:z._nativeHostAttrs===!0||Ut||St.length===0,defaultLayout:void 0};dt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let vr=await n(Fe,dt,ue,Mo,F),es=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let lt of vr.matchAll(/\{\{([\s\S]*?)\}\}/g))es.add(lt[1].trim());if(es.size>0)T.__stx_preserved_client_expressions=[...es];let Gn=vt,cn=vr;if(Ut){let lt="";if(Object.keys(_).length>0)try{lt=` data-stx-props="${kh(JSON.stringify(_))}"`}catch{}let gt=le?` stx-hydrate="${kh(le)}"`:"",Et=` data-stx-scope="${Gn}"${lt}${gt}`,it=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(vr),Xt=it?"span":"div";cn=Yc(vr,Et)??`<${Xt}${Et} data-stx-component-wrapper${it?' style="display:contents"':""}>${vr}</${Xt}>`;let Qt=await Promise.all(St.map(async($r)=>{let Br=$r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Br)return $r;let[,ts,No]=Br,jn=await k0(No,ue,z.buildMode==="compile"),jo=hn(jn.clientCode,xe(dt)),{vendorStyleTags:Jn}=jn,Bi=jo?`function(__scopeId) {
2660
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function Th(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Qc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function tt(v,_,k,R,T,B,z,W=new Set,F,U=kr(T),H,q=v){let{extractVariables:Q}=await _t("stx/variable-extractor",()=>import("./chunk-2n59ahd9.js")),ie=W??new Set;if(ie.has(v))return`[Circular component reference: ${v}]`;let Z=new Set(ie);Z.add(v);let ae=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let le=ae&&ae!=="load"&&Zc(ae)?ae:"";try{let ce=(lt)=>lt.split("-").map((gt)=>gt.charAt(0).toUpperCase()+gt.slice(1)).join(""),de=q.endsWith(".stx")?q.slice(0,-4):q,ue=null,$e=T.__importedComponents;if($e){let lt=[de,de.toLowerCase(),ce(de),dn(de)];for(let gt of lt)if($e.has(gt)){ue=$e.get(gt);break}}let we=[];if(!ue){let lt=[`${de}.stx`,`${ce(de)}.stx`,`${dn(de)}.stx`],gt=[...new Set(lt)],Et=T.__originalFilePath,it=[];if(it.push(...z._layerComponentDirs??[]),Et){let Tt=ut.join(ut.dirname(Et),"components");it.push(Tt)}if(R)it.push(R);let Xt=z._rootComponentsDir;if(typeof Xt==="string"&&!it.includes(Xt))it.push(Xt);let Qt=ut.join(ut.dirname(B),"components");if(!it.includes(Qt))it.push(Qt);if(z.componentsDir&&z.componentsDir!==R&&!it.includes(z.componentsDir))it.push(z.componentsDir);let $r=z._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(de),Br=(H?.events??[]).map((Tt)=>Tt.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ts=!Br.includes("valuechange")&&(Object.hasOwn(_,"checked")||H?.reactiveProps?.includes("checked")||Br.includes("change")),No=z._targetComponentFallbackNames?.some((Tt)=>Tt.toLowerCase()===de.toLowerCase())&&(!$r||ts);for(let Tt of No?[]:z._targetComponentDirs??[])if(Tt&&!it.includes(Tt))it.push(Tt);let jn=typeof z.root==="string"?ut.resolve(z.root):void 0,jo=jn??ut.dirname(B),Jn=[];if(jn)Jn.push(ut.resolve(jn,"resources/views/components")),Jn.push(ut.resolve(jn,"resources/components")),Jn.push(ut.resolve(jn,"src/components")),Jn.push(ut.resolve(jn,"components"));Jn.push(ut.resolve(import.meta.dir,"components"));for(let Tt of Jn)if(!it.includes(Tt))it.push(Tt);let Bi=z._pluginComponentDirs;if(Array.isArray(Bi)){for(let Tt of Bi)if(typeof Tt==="string"&&!it.includes(Tt))it.push(Tt)}if(z.fallbackComponentsDir&&!it.includes(z.fallbackComponentsDir))it.push(z.fallbackComponentsDir);if(No){for(let Tt of z._targetComponentDirs??[])if(Tt&&!it.includes(Tt))it.push(Tt)}let zi=[...new Set(it.map((Tt)=>{if(!Tt)return Tt;return ut.isAbsolute(Tt)?Tt:ut.resolve(jo,Tt)}))];it.length=0,it.push(...zi);let ns=`${de}\x00${B}\x00${zi.join("\x00")}`,Ja=qa.get(ns);if(Ja)if(await r(Ja))ue=Ja;else qa.delete(ns);if(!ue&&(de.startsWith("./")||de.startsWith("../")))ue=ut.resolve(ut.dirname(B),`${de}.stx`),we.push(ue);else if(!ue)for(let Tt of it){if(!Tt)continue;for(let Lo of gt){let Bo=ut.join(Tt,Lo);if(we.push(Bo),await r(Bo)){ue=Bo;break}}if(ue)break;if(!ue)try{let Lo=await import("fs");if(!Lo.statSync(Tt,{throwIfNoEntry:!1})?.isDirectory())continue;let Lh=8,Ya=[{path:Tt,depth:0}];while(Ya.length>0&&!ue){let zo=Ya.pop();if(zo.depth>=Lh)continue;let Nu;try{Nu=Lo.readdirSync(zo.path,{withFileTypes:!0})}catch{continue}for(let Wo of Nu){if(!Wo.isDirectory())continue;if(Wo.name==="node_modules"||Wo.name.startsWith("."))continue;let ju=ut.join(zo.path,Wo.name);for(let Bh of gt){let Qa=ut.join(ju,Bh);if(we.push(Qa),await r(Qa)){ue=Qa;break}}if(ue)break;Ya.push({path:ju,depth:zo.depth+1})}}}catch{}if(ue)break}if(ue)qa.set(ns,ue)}if(!ue||!await r(ue))return Ah(v,B,we),Th(v);F.add(ue);let ye;if(Io.has(ue))ye=Io.get(ue);else try{ye=await Bun.file(ue).text(),Io.set(ue,ye)}catch(lt){let gt=lt instanceof Error?lt.message:String(lt);return Ah(v,B,[ue],gt),Th(v)}if(H)for(let lt of new Set([...Object.keys(_),...H.reactiveProps??[]])){let gt=lt.toLowerCase();if(gt.startsWith("aria-")||gt.startsWith("data-"))continue;let Et=lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Et}\\b`).test(ye))H.declaredProps.add(lt);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Et}\\b|\\[\\s*['"]${Et}['"]\\s*\\])`).test(ye)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Et}['"]`).test(ye))H.consumedProps?.add(lt)}let Pe=new Set(["__originalFilePath","__importedComponents",Xo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Oe={};for(let[lt,gt]of Object.entries(T))if(!lt.startsWith("__")||Pe.has(lt))Oe[lt]=gt;let Me=U.length>0?{[na]:[...U]}:{},Ne=k;if(k.includes("@include")){let{processIncludes:lt}=await _t("stx/includes",()=>import("./chunk-39pgf5z3.js"));Ne=await lt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ne)){let{processComponents:lt}=await _t("stx/component-renderer",()=>import("./chunk-exd1h9sd.js"));Ne=await lt(Ne,{...T,__processedComponents:ie,...Me},B,z,F)}let Le=[];if(Pi(Ne)){let{processExpressions:lt}=await _t("stx/expressions",()=>import("./chunk-2pwjnydp.js")),gt=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Me}:U.length>0?{...T,...Me}:T;Ne=lt(Ne,gt,B);for(let Et of Ne.matchAll(/\{\{([\s\S]*?)\}\}/g))Le.push(Et[1].trim())}let De=gn(Ne),ze=[],Ve=De.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(lt,gt)=>{let Et=De.scripts[Number(gt)]||"",it=Et.match(/^<script\b([^>]*)>/i)?.[1]||"",Xt=it.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qt=!Xt||["module","text/javascript","application/javascript"].includes(Xt),$r=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${it}`);if(!/\bserver\b/i.test(it)&&Qt&&!$r)return ze.push(Et),"";return Et}),{extractSlotContent:Be}=await _t("stx/slots",()=>import("./chunk-974dxazw.js")),je=Be(Ve),st={};if(je.defaultSlot?.trim())st.default=je.defaultSlot;for(let[lt,gt]of je.namedSlots)st[lt]=gt.content;let ht=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},vt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ht.n}_${ht.key}`,dt={...Oe,$uid:vt,..._,props:_,slot:Ve,$slots:st,__processedComponents:Z,__sections:{},__stx_signals_gate:ke(ye)||Pi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Le]};v0(ye,dt);let wt=ye,kt=re(wt);if(kt)wt=kt.content.trim();let xt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ct=[...ye.matchAll(xt)],St=[],mt=null,Kt=ct.some((lt)=>/\bserver\b/.test(lt[1]||"")&&/\bcache\b/.test(lt[1]||"")),Wn=null,Mn=null,bt=null,ft=0,$t=null;if(p0(z),Kt&&Ou>0){let lt=g0({props:_,slot:Ne,slotContext:k.trim()?m0(Oe):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...U].sort(),layers:z._layerGraph?.layers.map((gt)=>gt.configFile),uid:vt});if(lt!==null){Wn=`${ue}\x00${h(ye)}\x00${lt}`;let gt=Ka.get(Wn);if(gt){for(let Et of gt.dependencies)F.add(Et);if(Rd(T,gt.clientFactories),ht.n+=gt.uidsConsumed,gt.preservedClientExpressions.length>0){let Et=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let it of gt.preservedClientExpressions)Et.add(it);T.__stx_preserved_client_expressions=[...Et]}return gt.output}Mn=new Set(F),bt=Ed(T),ft=ht.n,$t=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let lt of ct){let gt=lt[1]||"",Et=lt[2]||"",it=gt.includes("server");if(Qe(gt)&&Et.trim())Et=et(Et);if(it&&Et){for(let Qt of fe(Et))Wt.add(Qt);try{await Q(Et,dt,ue,{onFailure:(Qt)=>{if(Qt.kind!=="unknown")mt=Qt.kind}})}catch(Qt){}}if(!it){let Qt=Et.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$r=Qt.includes("{{")&&Qt.includes("}}"),Br=Qt.includes("{!!")&&Qt.includes("!!}");if($r||Br)Qt=ys(Qt,dt,ue);let ts=gt.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");St.push(`<script${ts}>${Qt}</script>`)}}let Yt=gn(ye).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),un=Yt?Yt[1]:"",Xa=Yt?Yt[2]:"",Zn="",Za=un&&/\bscoped\b/i.test(un);if(Yt)Zn=`<style${un}>${S0(Xa,dt,ue)}</style>`;let Fe=wt;if(Fe=Fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Yt)Fe=Fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let lt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,gt=[];if(Fe=Fe.replace(lt,(Et,it)=>{let Xt=it.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xt)gt.push(`<style${Xt[1]}>${Xt[2]}</style>`);return""}),Fe=Fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),gt.length>0)Zn=`${Zn}${gt.join(`
2661
+ `)}`}if(k&&Fe.includes("{{ text || slot }}"))Fe=Fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:He}=await _t("stx/slots",()=>import("./chunk-974dxazw.js")),{defaultSlot:pt,namedSlots:Ct}=je,Ut=St.some((lt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(lt)),rn=(lt)=>Ut?Gm(lt,vt):lt,Qr=new Map([...Ct].map(([lt,gt])=>[lt,{...gt,content:rn(gt.content)}]));Fe=await He(Fe,rn(pt),Qr,dt);let Ga=Qc(St),Do=(Array.isArray(dt.__stx_client_signal_names)?dt.__stx_client_signal_names:[]).filter((lt)=>!Wt.has(lt));if(Ga.length>0||Do.length>0)dt.__stx_client_signal_names=[...new Set([...Do,...Ga])];else delete dt.__stx_client_signal_names;let Oo=U.filter((lt)=>!Wt.has(lt)&&!(lt in _));if(Oo.length>0)dt[na]=Oo;let Mo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:ut.dirname(ue),skipSignalsRuntime:!0,skipEventDirectives:z._nativeHostAttrs===!0||Ut||St.length===0,defaultLayout:void 0};dt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let vr=await n(Fe,dt,ue,Mo,F),es=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let lt of vr.matchAll(/\{\{([\s\S]*?)\}\}/g))es.add(lt[1].trim());if(es.size>0)T.__stx_preserved_client_expressions=[...es];let Gn=vt,cn=vr;if(Ut){let lt="";if(Object.keys(_).length>0)try{lt=` data-stx-props="${kh(JSON.stringify(_))}"`}catch{}let gt=le?` stx-hydrate="${kh(le)}"`:"",Et=` data-stx-scope="${Gn}"${lt}${gt}`,it=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(vr),Xt=it?"span":"div";cn=Yc(vr,Et)??`<${Xt}${Et} data-stx-component-wrapper${it?' style="display:contents"':""}>${vr}</${Xt}>`;let Qt=await Promise.all(St.map(async($r)=>{let Br=$r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Br)return $r;let[,ts,No]=Br,jn=await k0(No,ue,z.buildMode==="compile"),jo=hn(jn.clientCode,xe(dt)),{vendorStyleTags:Jn}=jn,Bi=jo?`function(__scopeId) {
2662
2662
  ${jo}
2663
2663
  return (${jn.factoryBody})(__scopeId);
2664
2664
  }`:jn.factoryBody,zi=le?null:ac(T,Bi),ns=zi?`window.__stxComponentFactories[${JSON.stringify(zi)}](${JSON.stringify(Gn)});`:`(${Bi})(${JSON.stringify(Gn)});`;if(le)return`${Jn}<script type="stx/island" data-stx-island="${Gn}" data-stx-scoped data-stx-owner="${Gn}"${ts}>${ns}</script>`;return`${Jn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Gn}"${ts}>${ns}</script>`}));if(cn=cn+`
@@ -2684,7 +2684,7 @@ ${Rt.yellow}${Rt.bold}Message:${Rt.reset} ${_}
2684
2684
  `,W)H+=`
2685
2685
  ${Rt.blue}${Rt.bold}Context:${Rt.reset}
2686
2686
  ${Rt.dim}${W}${Rt.reset}
2687
- `;return H}function se(){Io.clear(),qa.clear(),Pu.clear(),Du.clear(),Ka.clear()}function hd(){return{size:Io.size,maxSize:500}}var Iu=m(128);async function k0(v,_,k){let R=h(v,_,k),T=Iu.get(R);if(T){if(mn(T.deps))return T;Iu.delete(R)}let B=ps(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=gs(B.styles);z=Pt(z).code;let{hasUserImports:F,bundleClientScript:U}=await _t("stx/client-script-bundler",()=>import("./chunk-8x2ejkcc.js")),H=[],q=!1;if(F(z)){let ce=z;z=await U(ce,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ce}let{stripStxRuntimeImports:Q}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js"));z=Q(z);let ie=O(z),Z=y0(ie),ae=`function(__scopeId) {
2687
+ `;return H}function se(){Io.clear(),qa.clear(),Pu.clear(),Du.clear(),Ka.clear()}function hd(){return{size:Io.size,maxSize:500}}var Iu=m(128);async function k0(v,_,k){let R=h(v,_,k),T=Iu.get(R);if(T){if(mn(T.deps))return T;Iu.delete(R)}let B=ps(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=gs(B.styles);z=Pt(z).code;let{hasUserImports:F,bundleClientScript:U}=await _t("stx/client-script-bundler",()=>import("./chunk-y0zyzbjf.js")),H=[],q=!1;if(F(z)){let ce=z;z=await U(ce,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ce}let{stripStxRuntimeImports:Q}=await _t("stx/signal-processing",()=>import("./chunk-t83acmv2.js"));z=Q(z);let ie=O(z),Z=y0(ie),ae=`function(__scopeId) {
2688
2688
  ${Vt("const",[...Ji,...Z],ie)}
2689
2689
  const __scope = window.stx._scopes = window.stx._scopes || {};
2690
2690
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -2818,7 +2818,7 @@ else {
2818
2818
  // STX: auto-generated event bindings
2819
2819
  ${v.map((k,R)=>F0(k,R)).join(`
2820
2820
  `)}`}function Nh(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let W=R[z];if(W==="'"||W==='"'||W==="`"){let F=W;if(z++,F==="`"){let U=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&U===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){U++,z+=2;continue}if(R[z]==="}"&&U>0){U--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===F){z++;break}z++}continue}if(W==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
2821
- `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),U=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let Q=U[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=U[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let ie=Q.trim(),Z=ie.indexOf(":"),ae=Z>=0?ie.slice(Z+1).trim().split(/[\s=]/)[0]:ie.split(/[\s=]/)[0];if(ae&&!ae.startsWith("_")&&!k.has(ae))_.push(ae),k.add(ae)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var U0=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 H0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let ie;while((ie=k.exec(Q))!==null){let Z=ie[0];if(!U0.has(Z))_.add(Z)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=U.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function Se(v,_={}){let k=v,R="",T=!1,B=[],z=ps(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=gs(z.styles),F=Pt(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:U,bundleClientScript:H}=await _t("stx/client-script-bundler",()=>import("./chunk-8x2ejkcc.js"));if(U(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ue=ii(k);k=ue.code,R=ai(ue.stxImports,ue.browserImports.filter(($e)=>!B.includes($e)))}if(R=`${hn(k,_.serverData)}${R}`,k=O(k),!T&&Qe(_.attrs||""))k=et(k);let q=V0(_.eventBindings||[]),Q=(_.attrs||"").trim(),ie=/\btype\s*=\s*["']module["']/i.test(Q),Z=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ie){let ue=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),$e=`type="module" data-stx-scoped${Z}${ue?` ${ue}`:""}`;return`${W}<script ${$e}>
2821
+ `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),U=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let Q=U[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=U[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let ie=Q.trim(),Z=ie.indexOf(":"),ae=Z>=0?ie.slice(Z+1).trim().split(/[\s=]/)[0]:ie.split(/[\s=]/)[0];if(ae&&!ae.startsWith("_")&&!k.has(ae))_.push(ae),k.add(ae)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var U0=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 H0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let ie;while((ie=k.exec(Q))!==null){let Z=ie[0];if(!U0.has(Z))_.add(Z)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=U.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function Se(v,_={}){let k=v,R="",T=!1,B=[],z=ps(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=gs(z.styles),F=Pt(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:U,bundleClientScript:H}=await _t("stx/client-script-bundler",()=>import("./chunk-y0zyzbjf.js"));if(U(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ue=ii(k);k=ue.code,R=ai(ue.stxImports,ue.browserImports.filter(($e)=>!B.includes($e)))}if(R=`${hn(k,_.serverData)}${R}`,k=O(k),!T&&Qe(_.attrs||""))k=et(k);let q=V0(_.eventBindings||[]),Q=(_.attrs||"").trim(),ie=/\btype\s*=\s*["']module["']/i.test(Q),Z=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ie){let ue=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),$e=`type="module" data-stx-scoped${Z}${ue?` ${ue}`:""}`;return`${W}<script ${$e}>
2822
2822
  ${oi(`${R}${k}
2823
2823
  ${q}`)}
2824
2824
  </script>`}let ae=eo(v),le=/function __stx_setup_/.test(k),ce=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function de(ue){let $e=ue.length>0?`