@stacksjs/stx 0.2.368 → 0.2.370

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 (57) hide show
  1. package/dist/{chunk-1q5vxmm2.js → chunk-0t2kjykc.js} +1 -1
  2. package/dist/{chunk-y7m8sp4g.js → chunk-100261ad.js} +1 -1
  3. package/dist/{chunk-b04c020d.js → chunk-2nqj7hnt.js} +1 -1
  4. package/dist/{chunk-88qse1rb.js → chunk-3nfccw8g.js} +1 -1
  5. package/dist/{chunk-xgzrx7ya.js → chunk-5853mbhm.js} +1 -1
  6. package/dist/{chunk-hgxc6601.js → chunk-5cjc1w05.js} +1 -1
  7. package/dist/{chunk-k0wkxgb7.js → chunk-5p0bm54m.js} +1 -1
  8. package/dist/{chunk-38q84mff.js → chunk-76jc2bp2.js} +1 -1
  9. package/dist/{chunk-rt76x1hv.js → chunk-8rm4znzz.js} +1 -1
  10. package/dist/{chunk-04qfhvwh.js → chunk-8rt0vg06.js} +1 -1
  11. package/dist/{chunk-vzt7pas7.js → chunk-9z2mksp0.js} +8 -8
  12. package/dist/{chunk-nyw7c3e3.js → chunk-abffw83w.js} +1 -1
  13. package/dist/{chunk-dmzzbw55.js → chunk-bsvars9r.js} +2 -2
  14. package/dist/{chunk-qj8jfkst.js → chunk-cpjqmg8e.js} +1 -1
  15. package/dist/{chunk-v794te0v.js → chunk-dhafhyw2.js} +1 -1
  16. package/dist/{chunk-6ec0dk8n.js → chunk-dhj6zfzc.js} +1 -1
  17. package/dist/{chunk-bkhksb74.js → chunk-dmtvgwmm.js} +1 -1
  18. package/dist/{chunk-rfqw1q2h.js → chunk-e26spfv8.js} +1 -1
  19. package/dist/{chunk-n7sq6rpd.js → chunk-e6hjrrb9.js} +1 -1
  20. package/dist/{chunk-63z1kw0k.js → chunk-e772yfk8.js} +1 -1
  21. package/dist/{chunk-yrb6gyny.js → chunk-ej4a59pv.js} +1 -1
  22. package/dist/{chunk-k11m8bez.js → chunk-eja82tav.js} +1 -1
  23. package/dist/{chunk-t376jx7f.js → chunk-ew2f2gt0.js} +1 -1
  24. package/dist/{chunk-c1jewr67.js → chunk-f47tm3jw.js} +1 -1
  25. package/dist/{chunk-301caz1g.js → chunk-fscn8dg3.js} +1 -1
  26. package/dist/{chunk-wnr635ma.js → chunk-fwbsr4kx.js} +2 -2
  27. package/dist/{chunk-htd9bf38.js → chunk-gjxdxfaz.js} +1 -1
  28. package/dist/{chunk-6d7z4e7v.js → chunk-gsjkk7re.js} +1 -1
  29. package/dist/{chunk-pdhkzprw.js → chunk-h13564da.js} +182 -182
  30. package/dist/{chunk-rn0j7n49.js → chunk-h40194h3.js} +1 -1
  31. package/dist/{chunk-rzwwtqxm.js → chunk-hk88xttw.js} +1 -1
  32. package/dist/{chunk-w4ft9mhg.js → chunk-jq0p5dyc.js} +1 -1
  33. package/dist/{chunk-w08mr6wd.js → chunk-mfh0zj95.js} +1 -1
  34. package/dist/{chunk-x3dxrzgq.js → chunk-mfxesx41.js} +1 -1
  35. package/dist/{chunk-vtyys0r4.js → chunk-mv8q9xyt.js} +1 -1
  36. package/dist/{chunk-3mw9269k.js → chunk-n44dxh1c.js} +1 -1
  37. package/dist/{chunk-hxgmf1a8.js → chunk-p2bbfek9.js} +1 -1
  38. package/dist/{chunk-2g3xnk2j.js → chunk-pdrtf7ga.js} +1 -1
  39. package/dist/{chunk-zzf0k3my.js → chunk-q5hyhe0r.js} +1 -1
  40. package/dist/{chunk-sazv95fq.js → chunk-r7ym6zf1.js} +1 -1
  41. package/dist/{chunk-dxw41d46.js → chunk-t5d1q2ps.js} +1 -1
  42. package/dist/{chunk-wwwh8bxe.js → chunk-tas7ervy.js} +1 -1
  43. package/dist/{chunk-jnv4283w.js → chunk-v3mmcyvx.js} +1 -1
  44. package/dist/{chunk-bs64kcb6.js → chunk-wpzcgwqj.js} +1 -1
  45. package/dist/{chunk-vrbjwgva.js → chunk-xgxf107n.js} +1 -1
  46. package/dist/{chunk-4bx30vz5.js → chunk-xman4hcx.js} +1 -1
  47. package/dist/{chunk-rbhndq6q.js → chunk-y336fe2t.js} +2 -2
  48. package/dist/{chunk-q0wwegph.js → chunk-zm98xr8t.js} +2 -2
  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/events.d.ts +1 -16
  53. package/dist/events.js +10 -6
  54. package/dist/pwa.js +1 -1
  55. package/dist/ssg.js +2 -2
  56. package/dist/theme-tokens.js +1 -0
  57. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Yr as n8,as as s8,ks as l4,ls as c4}from"./chunk-jc6wrxrh.js";import{qs as z0,rs as K2}from"./chunk-v90kxg77.js";import{ts as s4,us as o4,vs as W9,ws as H9}from"./chunk-4arms0am.js";import{Cs as G9}from"./chunk-135mme4g.js";import{$s as t8,Hs as r1,Is as R1,Js as a8,Ks as y1,Ms as U1,Ns as JJ,Os as XJ,Ps as H2,Qs as Z9,Rs as E9,Ss as x2,Ts as y8,Us as F8,Vs as V1,Ws as u0,Xs as K5,at as l9,nt as e8}from"./chunk-dmzzbw55.js";import{ot as p4,qt as i4,rt as n4,tt as _2}from"./chunk-w1asc0zd.js";import{At as y7,Bt as C7,vt as T7,wt as k7,xt as E7}from"./chunk-kd95t585.js";import{Gt as c9}from"./chunk-htd9bf38.js";import{It as fZ,Jt as gZ,Kt as hZ,Lt as uZ,Mt as mZ,Ot as r8}from"./chunk-xk402w4a.js";import{Pt as JZ,Qt as XZ,Rt as YZ,St as QZ,Tt as r4,Ut as a4}from"./chunk-dnard9gp.js";import{$t as u5,au as N0,cu as m5,du as j7,fu as B7,mu as $Z,qu as dZ,su as lZ}from"./chunk-vgx5077x.js";import{Iu as R0,Ku as y2,Lu as m3,Mu as C2,Tu as f2,Wu as c8,Yu as D0,av as g2,bv as p8,dv as s0,ev as i8,lv as d3,mv as F6,ov as X0,pv as B0,qv as d0,rv as k9,sv as z2,tv as U0,uv as b9}from"./chunk-met6wtbk.js";import{vv as e0}from"./chunk-ta6z7k4p.js";import{yv as ZZ}from"./chunk-zxptxz2b.js";import{Av as Q2,Bv as ZJ,Cv as o1,Gv as qJ,Hv as R3,Iv as O8,Kv as a7,Nv as Q6,zv as l3}from"./chunk-7racewc5.js";import{Cw as o8,Ew as hz,Fw as w5,Iw as V2,bw as l$,ew as Z8,lw as b$}from"./chunk-e03m4har.js";import{Nw as t4}from"./chunk-vsqx756d.js";import{Sw as x}from"./chunk-m8kem5ca.js";import S1 from"path";import l2 from"fs";var LJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Z5($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return LJ.has($.toLowerCase())}var F3=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"]),_3={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"},OJ=new Set(["ctrl","alt","shift","meta"]),D3={left:0,middle:1,right:2};function w3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(X==="nonpassive")Z.nonpassive=!0;else if(OJ.has(X))Z.systemKeys.push(X);else if(X in D3)Z.mouse=X;else if(X in _3||/^[a-z]$/.test(X))Z.keys.push(_3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function N3($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,K=Y.index,q=K+Q.length,H=`__stx_evt_${J++}`,W=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,F]=j,O=V.split("."),_=O[0];if(!F3.has(_))continue;W.push({attribute:`@${V}`,event:_,handler:F,modifiers:w3(O.slice(1)),elementId:H})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,O=V.split("."),_=O[0];if(!F3.has(_))continue;W.push({attribute:`@${V}`,event:_,handler:F,modifiers:w3(O.slice(1)),elementId:H})}if(W.length>0)Z.push({originalTag:Q,elementId:H,events:W,startIndex:K,endIndex:q})}return Z}function FJ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=D3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function _J($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function J5($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function wJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=FJ($),Y=_J(J5($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z5($.event,Z))Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{Yr as s8,as as o8,ks as c4,ls as p4}from"./chunk-jc6wrxrh.js";import{qs as z0,rs as K2}from"./chunk-v90kxg77.js";import{ts as o4,us as r4,vs as W9,ws as H9}from"./chunk-4arms0am.js";import{Cs as G9}from"./chunk-135mme4g.js";import{$s as e8,Hs as r1,Is as R1,Js as t8,Ks as y1,Ms as U1,Ns as XJ,Os as YJ,Ps as H2,Qs as Z9,Rs as E9,Ss as x2,Ts as C8,Us as _8,Vs as V1,Ws as u0,Xs as K5,at as l9,nt as $Z}from"./chunk-bsvars9r.js";import{ot as i4,qt as n4,rt as s4,tt as _2}from"./chunk-w1asc0zd.js";import{At as C7,Bt as S7,vt as k7,wt as E7,xt as b7}from"./chunk-kd95t585.js";import{Gt as c9}from"./chunk-gjxdxfaz.js";import{It as gZ,Jt as hZ,Kt as uZ,Lt as mZ,Mt as dZ,Ot as a8}from"./chunk-xk402w4a.js";import{Pt as XZ,Qt as YZ,Rt as QZ,St as GZ,Tt as a4,Ut as t4}from"./chunk-dnard9gp.js";import{$t as u5,au as N0,cu as m5,du as B7,fu as V7,mu as ZZ,qu as lZ,su as cZ}from"./chunk-vgx5077x.js";import{Iu as R0,Ku as y2,Lu as d3,Mu as C2,Tu as f2,Wu as p8,Yu as D0,av as g2,bv as i8,dv as s0,ev as n8,lv as l3,mv as _6,ov as X0,pv as B0,qv as d0,rv as k9,sv as z2,tv as U0,uv as b9}from"./chunk-met6wtbk.js";import{vv as e0}from"./chunk-ta6z7k4p.js";import{yv as JZ}from"./chunk-zxptxz2b.js";import{Av as Q2,Bv as JJ,Cv as o1,Gv as WJ,Hv as D3,Iv as F8,Kv as t7,Nv as G6,zv as c3}from"./chunk-7racewc5.js";import{Cw as r8,Ew as uz,Fw as w5,Iw as V2,bw as l$,ew as J8,lw as b$}from"./chunk-e03m4har.js";import{Nw as e4}from"./chunk-vsqx756d.js";import{Sw as x}from"./chunk-m8kem5ca.js";import S1 from"path";import l2 from"fs";var OJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Z5($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return OJ.has($.toLowerCase())}var F3=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"]),_3={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"},FJ=new Set(["ctrl","alt","shift","meta"]),N3={left:0,middle:1,right:2};function w3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(X==="nonpassive")Z.nonpassive=!0;else if(FJ.has(X))Z.systemKeys.push(X);else if(X in N3)Z.mouse=X;else if(X in _3||/^[a-z]$/.test(X))Z.keys.push(_3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function M3($,Z=""){let J=[],X=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[G,z,K]=Q,q=Q.index,H=q+G.length,W=`__stx_evt_${Z}${X++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=j.exec(K))!==null){let[,F,O]=B,_=F.split("."),L=_[0];if(!F3.has(L))continue;U.push({attribute:`@${F}`,event:L,handler:O,modifiers:w3(_.slice(1)),elementId:W})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=V.exec(K))!==null){let[,F,O]=B,_=F.split("."),L=_[0];if(!F3.has(L))continue;U.push({attribute:`@${F}`,event:L,handler:O,modifiers:w3(_.slice(1)),elementId:W})}if(U.length>0)J.push({originalTag:G,elementId:W,events:U,startIndex:q,endIndex:H})}return J}function _J($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=N3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function wJ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function J5($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function RJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=_J($),Y=wJ(J5($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z5($.event,Z))Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${J}');
5
5
  if (!$el) return;
@@ -108,11 +108,11 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${$.map(wJ).join(`
111
+ ${$.map(RJ).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function RJ($){let Z=N3($);if(Z.length===0)return{template:$,bindings:[]};let J=$,X=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let K of Q.events)K.elementId=z[1]}for(let z of Q.events){let K=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(H,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),X.push(...Q.events)}return{template:J,bindings:X}}function M3($,Z,J){if(R3($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:K}=RJ($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...K],z}let X=N3($);if(X.length===0)return $;let Y=$;for(let z=X.length-1;z>=0;z--){let K=X[z],q=K.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let H=q.match(/id=["']([^"']+)["']/);if(H)for(let W of K.events)W.elementId=H[1]}for(let H of K.events){let W=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");q=q.replace(U,""),q=q.replace(j,"")}Y=Y.slice(0,K.startIndex)+q+Y.slice(K.endIndex)}let Q=X5(X.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
- `+Y.slice(G);else Y+=Q;return Y}function vq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function A3($,Z){let J=new Set;for(let X of $.split(",")){let Y=X.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))J.add(Y)}return J}function o2($,Z){let J=z0($),{depths:X,balanced:Y}=K2(J),Q=(z)=>!Y||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let K=(z.index??0)+z[0].length-z[1].length;if(Q(K))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Q(z.index??0)&&A3(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&A3(z[1],!1).has(Z))return!0;return!1}import YJ from"fs";import g from"path";import{createHash as DJ}from"crypto";var r2="__stx_component_client_factories";function a2($){let Z=$[r2];return Z instanceof Map?Z:null}function T3($){$[r2]=new Map}function Y5($,Z){let J=a2($);if(!J)return null;let X=DJ("sha256").update(Z).digest("hex").slice(0,16),Y=J.get(X);if(Y)Y.instances++;else J.set(X,{body:Z,instances:1});return X}function k3($,Z){let J=a2(Z);if(!J?.size)return $;let X=new Map;for(let[H,W]of J)if(W.instances===1)X.set(H,W.body);let Y=[];if(X.size>0){let H=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),W=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),U=W.exec($);while(U!==null){let j=X.get(JSON.parse(U[1]));if(j!==void 0)Y.push({start:U.index,end:U.index+U[0].length,replacement:`(${j})(${U[2]});`});U=W.exec($)}}let Q=[...J].filter(([,H])=>H.instances>1);if(Q.length===0)return I3($,Y);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
114
+ </script>`}function DJ($,Z=""){let J=M3($,Z);if(J.length===0)return{template:$,bindings:[]};let X=$,Y=[];for(let Q=J.length-1;Q>=0;Q--){let G=J[Q],z=G.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let K=z.match(/id=["']([^"']+)["']/);if(K)for(let q of G.events)q.elementId=K[1]}for(let K of G.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");z=z.replace(H,""),z=z.replace(W,"")}X=X.slice(0,G.startIndex)+z+X.slice(G.endIndex),Y.push(...G.events)}return{template:X,bindings:Y}}function R3($){let Z=$.$uid;return typeof Z==="string"&&Z?`${Z}_`:""}function A3($,Z,J){if(D3($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:K}=DJ($,R3(Z)),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...K],z}let X=M3($,R3(Z));if(X.length===0)return $;let Y=$;for(let z=X.length-1;z>=0;z--){let K=X[z],q=K.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let H=q.match(/id=["']([^"']+)["']/);if(H)for(let W of K.events)W.elementId=H[1]}for(let H of K.events){let W=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");q=q.replace(U,""),q=q.replace(j,"")}Y=Y.slice(0,K.startIndex)+q+Y.slice(K.endIndex)}let Q=X5(X.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
+ `+Y.slice(G);else Y+=Q;return Y}function xq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function I3($,Z){let J=new Set;for(let X of $.split(",")){let Y=X.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))J.add(Y)}return J}function o2($,Z){let J=z0($),{depths:X,balanced:Y}=K2(J),Q=(z)=>!Y||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let K=(z.index??0)+z[0].length-z[1].length;if(Q(K))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Q(z.index??0)&&I3(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&I3(z[1],!1).has(Z))return!0;return!1}import QJ from"fs";import g from"path";import{createHash as NJ}from"crypto";var r2="__stx_component_client_factories";function a2($){let Z=$[r2];return Z instanceof Map?Z:null}function k3($){$[r2]=new Map}function Y5($,Z){let J=a2($);if(!J)return null;let X=NJ("sha256").update(Z).digest("hex").slice(0,16),Y=J.get(X);if(Y)Y.instances++;else J.set(X,{body:Z,instances:1});return X}function E3($,Z){let J=a2(Z);if(!J?.size)return $;let X=new Map;for(let[H,W]of J)if(W.instances===1)X.set(H,W.body);let Y=[];if(X.size>0){let H=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),W=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),U=W.exec($);while(U!==null){let j=X.get(JSON.parse(U[1]));if(j!==void 0)Y.push({start:U.index,end:U.index+U[0].length,replacement:`(${j})(${U[2]});`});U=W.exec($)}}let Q=[...J].filter(([,H])=>H.instances>1);if(Q.length===0)return T3($,Y);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
116
  (function() {
117
117
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
118
  ${Q.map(([H,W])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${W.body}; }
@@ -120,8 +120,8 @@ ${Q.map(([H,W])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.str
120
120
  `)}
121
121
  })();
122
122
  </script>`,K=$.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),q=K<0?0:K;return Y.push({start:q,end:q,replacement:`${z}
123
- `}),I3($,Y)}function I3($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function E3($){let Z=a2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function b3($,Z){let J=a2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function y3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)Y5($,J)}import v3 from"fs";var C3=0,t2=new Map;function mq(){C3=0,t2.clear()}function e2($,Z){let J=C3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return t2.set(X,{type:$,expression:Z}),X}function dq(){let $={};for(let[Z,J]of t2)$[Z]={type:J.type,expression:J.expression};return $}function lq($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=t2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function cq($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function pq($){return $.includes("<!--__STX_")}var NJ=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function MJ($){return Array.from({length:$},()=>"&#123;").join("&#8288;")}function S3($){return $.replace(/\{{2,}/g,(Z)=>MJ(Z.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(NJ,"&#64;")}var AJ=/^(?:javascript|vbscript|livescript|mocha|view-source):/,IJ=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,TJ=/^data:(?:text\/html|application\/xhtml\+xml)/,kJ=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function EJ($){return $.replace(kJ,"").toLowerCase()}function bJ($){let Z=$.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(Z))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(Z))return"fetched";return null}function P3($,Z="navigable"){let J=EJ($);if(AJ.test(J))return!0;return Z==="navigable"?IJ.test(J):TJ.test(J)}function q2($,Z="navigable"){return P3($,Z)?"unsafe:"+$:$}function yJ($){let Z=$.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!Z)return null;if(Z[3].trim()!=="")return null;return bJ(Z[1])}function Q5($,Z,J=256){if(Z<=J)return $.slice(0,Z);let X=$.slice(Z-J,Z),Y=X.search(/[\s"'`/]/);return Y===-1?"":X.slice(Y)}function G5($,Z,J=Z){let X=yJ($);return X&&P3(Z,X)?"unsafe:"+J:J}var U2={},x3=new Map;function CJ($){let Z=x3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),x3.set($,Z)}return Z.lastIndex=0,Z}var J9={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return W5(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let K of Q){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([K,q])=>{z=z.replace(CJ(K),String(q))}),z},t:($,Z,J={})=>{return J9.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function SJ($,Z){if($ in J9)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);U2[$]=Z}function QW($){for(let[Z,J]of Object.entries($))SJ(Z,J)}function PJ(){return{...J9,...U2}}function GW(){for(let $ of Object.keys(U2))delete U2[$]}function vJ($,Z,J=2){let X=0,Y=null;for(let Q=Z+J;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="{"){X++;continue}if(G==="}"){if(X>0){X--;continue}let z=0;while($[Q+z]==="}")z++;if(z>=J)return Q}}return-1}function $9($,Z,J=2){let X="{".repeat(J);if(!$.includes(X))return $;let Y="",Q=0;for(;;){let G=$.indexOf(X,Q);if(G===-1)break;let z=vJ($,G,J);if(z===-1)break;Y+=$.slice(Q,G)+Z($.slice(G,z+J),$.slice(G+J,z),G),Q=z+J}return Q===0?$:Y+$.slice(Q)}function q5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W5($){return S3(q5($))}function X1($,Z){let{scripts:J}=u0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(l3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function f3($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let q=0;q<X.length;q++){let H=X[q];if(!Q&&H==="`"){Q=!0,G=0;continue}if(Q){if(H==="`"&&G===0){Q=!1;continue}if(H==="$"&&X[q+1]==="{"){G++,q++,Y+=" ";continue}if(H==="}"&&G>0){G--;continue}if(G>0){Y+=H;continue}continue}Y+=H}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=z.exec(X))!==null){let q=K[1];if(!X.substring(0,K.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function xJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=z0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}var g3=new Set;function h3($){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test($.trim())}function u3($,Z){let J=`${Z??"<unknown>"}\x00${$}`;if(process.env.STX_DEBUG||!g3.has(J))g3.add(J),console.warn(`[stx] {{ ${$} }} in a <script> in ${Z??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function H5($,Z,J){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let G=C0(Q,Z);if(G===void 0)return h3(Q)?u3(Q.trim(),J):Y;return G===null?"":String(G)}catch{return Y}}),X=$9(X,(Y,Q,G)=>{let z=Q.trim();if(/^__[A-Z_]+__$/.test(z))return Y;try{let K=C0(Q,Z);if(K===void 0)return h3(z)?u3(z,J):Y;return JSON.stringify(K).replace(/</g,"\\u003c")}catch{return Y}}),X}function fJ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=C0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=$9(J,(X,Y,Q)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return X;try{let z=C0(Y,Z);if(z===void 0)return X;if(z===null)return"";let K=String(z);return G5(Q5(J,Q),K,W5(K))}catch{return X}}),J}function zW($,Z,J={}){let{output:X,scripts:Y}=u0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!z||!K||q===-1)return G;let H=z[1],W=z[2];if(/\bdata-raw\b/.test(H))return G;if(J.skipServer&&/\bserver\b/.test(H))return G;let j=`<script${fJ(H,Z)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return j+W+G.slice(q);return j+H5(W,Z)+G.slice(q)});return K5(X,Q)}function L1($,Z,J){let X=$,Y=(W,U)=>{let j=Z9(W,U);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(U,j))?-1:j},Q=(W,U,j,B)=>{let V=j.length,{output:F,tokens:O}=V1(W,U,(_,L)=>B(V+L));return j.push(...O),F},G=[];X=Q(X,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=[];X=Q(X,H2,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let K=Z?.__stx_signals_gate===!0||X1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),H=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(X=$9(X,(W,U,j)=>{try{let B=C0(U,Z,!1,(V)=>z5(V,W,J,$));return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return O0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${V}`,J,$,j,W)}},3),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(W,U,j)=>{try{let B=C0(U,Z,!1,(V)=>z5(V,W,J,$));if(B===void 0&&Z.__stx_buildMode==="compile")return e2("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return e2("raw",U.trim());let V=B instanceof Error?B.message:String(B);return O0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${V}`,J,$,j,W)}}),X=Q(X,H2,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),X=Q(X,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`),X=$9(X,(W,U,j)=>{let B=U.trim();if(H.has(B))return W;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,_=B.match(F)?.[1],L=_&&((_ in Z)||V.includes(_)),w=Boolean(_&&q.has(_)),D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(D),M=R&&!V.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";let T;try{let N=C0(U,Z,!1,(E)=>{T=E});if(w)return W;if(K&&!f3(B,Z))return W;if(T)z5(T,W,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(N===void 0||xJ(B,Z)))return e2("expr",B);if(N===void 0||N===null)return"";let I=String(N);return G5(Q5(X,j),I,W5(I))}catch(N){if(w)return W;if(K&&!f3(B,Z))return W;if(M)return W;let I=N instanceof Error?N.message:String(N);return O0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,J,$,j,W)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,U)=>z[Number(U)]??W);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,U)=>G[Number(U)]??W);return X}function gJ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=U2[G]||J9[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(PJ()).join(", ")}`);let K=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let H=q[1].trim();try{let W=Number(H);K=[Number.isNaN(W)?H:W]}catch{K=[H]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,H=1;while(q>0&&H<Y.length){if(Y[H]==="(")q++;if(Y[H]===")")q--;H++}if(q===0){let W=Y.substring(1,H-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))K=[C0(`(${W})`,J,!0)];else{let U=[],j="",B=null,V=0,F=0,O=0,_=!1;for(let L=0;L<W.length;L++){let w=W[L];if(_){j+=w,_=!1;continue}if(w==="\\"){j+=w,_=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&V===0&&F===0&&O===0){U.push(j),j="";continue}j+=w}if(j)U.push(j);K=U.map((L)=>{let w=L.trim();return C0(w,J,!0)})}}catch{K=[W]}Y=Y.substring(H).trim()}}try{X=z(X,J,...K)}catch(q){let H=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${H}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function hJ($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let K=$[z],q=$[z+1];if(Z&&G){G=!1;continue}if(Z&&K==="\\"){G=!0;continue}if(G=!1,(K==='"'||K==="'"||K==="`")&&!G){if(!Z)Z=!0,J=K;else if(K===J)Z=!1,J="";continue}if(Z&&J==="`"&&K==="$"&&q==="{"){let H=1;z+=2;while(z<$.length&&H>0){if($[z]==="{")H++;else if($[z]==="}")H--;if(H>0)z++}continue}if(Z)continue;if(K==="(")X++;else if(K===")")X--;else if(K==="[")Y++;else if(K==="]")Y--;else if(K==="{")Q++;else if(K==="}")Q--;if(K==="|"&&X===0&&Y===0&&Q===0){if(q==="|"){z++;continue}if(q==="="){z++;continue}return z}}return-1}var W2=new Set,uJ=1000;function KW(){W2.clear()}function z5($,Z,J,X){if(!m3())return;let Y=`${J}\x00${$.expression}`;if(W2.has(Y))return;if(W2.size>=uJ)W2.clear();W2.add(Y);let Q=J,G=X;try{if(J&&v3.existsSync(J))G=v3.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Q=`${J}:${G.slice(0,z).split(`
124
- `).length}`;console.warn(`${Q}: stx warning: ${Z} rendered as an empty string. The safe evaluator rejected \`${$.expression}\` (${$.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function C0($,Z,J=!1,X){try{let Y=$.trim(),Q=hJ(Y);if(Q>0){let z=Y.substring(0,Q).trim(),K=Y.substring(Q+1).trim(),q=C0(z,Z,!0,X);return gJ(q,K,Z)}let G=d3(Y);if(G!==null){X?.({expression:Y,rule:G});return}try{let z=Object.keys(Z),K=Object.values(Z);return U0(Y,z)(...K)}catch{return X0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let G=Q[1],z=mJ(G,Object.keys(Z));if(z&&z!==G)Y.message=`${Y.message} \u2014 did you mean '${z}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function mJ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=dJ($,Y);if(J===null||Q<J.dist)J={key:Y,dist:Q}}if(!J)return null;let X=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/X<=0.35)return J.key;return null}function dJ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,X]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)Y[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let z=1;z<=J.length;z++){let K=J[z-1]===X[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+K)}for(let z=0;z<=J.length;z++)Y[z]=Q[z]}return Y[J.length]}function qW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import uz from"fs";import y0 from"path";var U5=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],c3=/<body\b([^>]*)>/gi;function i0($){let Z=0,J,X=U5.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)c3.lastIndex=Z,J=c3.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let K=0;K<U5.length;K++){let q=U5[K],H=X[K];if(H===void 0||H!==null&&H.index<Z)q.open.lastIndex=Z,H=q.open.exec($),X[K]=H;if(!H)continue;if(H.index<Y&&(Q===-1||H.index<Q))Q=H.index,G=q.close}if(Q===-1||!G)return{index:Y,tag:J[0],attrs:J[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function x1($,Z){let J=i0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var p3=/<style\b[^>]*>/iy,i3=/<\/style>/gi,n3=/<script\b[^>]*>/iy,s3=/<template(?=[\s>/])[^>]*>/iy,o3=/<\/template\s*>/iy;function j2($){let Z=0,J=0,X=-1;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y+4);Z=K===-1?$.length:K+3;continue}p3.lastIndex=Y;let Q=p3.exec($);if(Q){i3.lastIndex=Y+Q[0].length;let K=i3.exec($);Z=K===null?$.length:K.index+8;continue}s3.lastIndex=Y;let G=s3.exec($);if(G){if(J===0)X=Y;J++,Z=Y+G[0].length;continue}o3.lastIndex=Y;let z=o3.exec($);if(z){if(J>0)J--;Z=Y+z[0].length;continue}if(n3.lastIndex=Y,n3.test($))return J>0?X:Y;Z=Y+1}return-1}var r3=null;function lJ($){if(!r3)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return r3}function jW($){let Z=lJ("onUpdate");if(Z)Z.updateHooks.push($)}function a3(){return`
123
+ `}),T3($,Y)}function T3($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function b3($){let Z=a2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function y3($,Z){let J=a2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function C3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)Y5($,J)}import x3 from"fs";var S3=0,t2=new Map;function dq(){S3=0,t2.clear()}function e2($,Z){let J=S3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return t2.set(X,{type:$,expression:Z}),X}function lq(){let $={};for(let[Z,J]of t2)$[Z]={type:J.type,expression:J.expression};return $}function cq($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=t2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function pq($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function iq($){return $.includes("<!--__STX_")}var MJ=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function AJ($){return Array.from({length:$},()=>"&#123;").join("&#8288;")}function P3($){return $.replace(/\{{2,}/g,(Z)=>AJ(Z.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(MJ,"&#64;")}var IJ=/^(?:javascript|vbscript|livescript|mocha|view-source):/,TJ=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,kJ=/^data:(?:text\/html|application\/xhtml\+xml)/,EJ=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function bJ($){return $.replace(EJ,"").toLowerCase()}function yJ($){let Z=$.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(Z))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(Z))return"fetched";return null}function v3($,Z="navigable"){let J=bJ($);if(IJ.test(J))return!0;return Z==="navigable"?TJ.test(J):kJ.test(J)}function q2($,Z="navigable"){return v3($,Z)?"unsafe:"+$:$}function CJ($){let Z=$.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!Z)return null;if(Z[3].trim()!=="")return null;return yJ(Z[1])}function Q5($,Z,J=256){if(Z<=J)return $.slice(0,Z);let X=$.slice(Z-J,Z),Y=X.search(/[\s"'`/]/);return Y===-1?"":X.slice(Y)}function G5($,Z,J=Z){let X=CJ($);return X&&v3(Z,X)?"unsafe:"+J:J}var U2={},f3=new Map;function SJ($){let Z=f3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),f3.set($,Z)}return Z.lastIndex=0,Z}var J9={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return W5(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let K of Q){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([K,q])=>{z=z.replace(SJ(K),String(q))}),z},t:($,Z,J={})=>{return J9.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function PJ($,Z){if($ in J9)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);U2[$]=Z}function GW($){for(let[Z,J]of Object.entries($))PJ(Z,J)}function vJ(){return{...J9,...U2}}function zW(){for(let $ of Object.keys(U2))delete U2[$]}function xJ($,Z,J=2){let X=0,Y=null;for(let Q=Z+J;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="{"){X++;continue}if(G==="}"){if(X>0){X--;continue}let z=0;while($[Q+z]==="}")z++;if(z>=J)return Q}}return-1}function $9($,Z,J=2){let X="{".repeat(J);if(!$.includes(X))return $;let Y="",Q=0;for(;;){let G=$.indexOf(X,Q);if(G===-1)break;let z=xJ($,G,J);if(z===-1)break;Y+=$.slice(Q,G)+Z($.slice(G,z+J),$.slice(G+J,z),G),Q=z+J}return Q===0?$:Y+$.slice(Q)}function q5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W5($){return P3(q5($))}function X1($,Z){let{scripts:J}=u0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(c3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function g3($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let q=0;q<X.length;q++){let H=X[q];if(!Q&&H==="`"){Q=!0,G=0;continue}if(Q){if(H==="`"&&G===0){Q=!1;continue}if(H==="$"&&X[q+1]==="{"){G++,q++,Y+=" ";continue}if(H==="}"&&G>0){G--;continue}if(G>0){Y+=H;continue}continue}Y+=H}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=z.exec(X))!==null){let q=K[1];if(!X.substring(0,K.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function fJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=z0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}var h3=new Set;function u3($){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test($.trim())}function m3($,Z){let J=`${Z??"<unknown>"}\x00${$}`;if(process.env.STX_DEBUG||!h3.has(J))h3.add(J),console.warn(`[stx] {{ ${$} }} in a <script> in ${Z??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function H5($,Z,J){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let G=C0(Q,Z);if(G===void 0)return u3(Q)?m3(Q.trim(),J):Y;return G===null?"":String(G)}catch{return Y}}),X=$9(X,(Y,Q,G)=>{let z=Q.trim();if(/^__[A-Z_]+__$/.test(z))return Y;try{let K=C0(Q,Z);if(K===void 0)return u3(z)?m3(z,J):Y;return JSON.stringify(K).replace(/</g,"\\u003c")}catch{return Y}}),X}function gJ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=C0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=$9(J,(X,Y,Q)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return X;try{let z=C0(Y,Z);if(z===void 0)return X;if(z===null)return"";let K=String(z);return G5(Q5(J,Q),K,W5(K))}catch{return X}}),J}function KW($,Z,J={}){let{output:X,scripts:Y}=u0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!z||!K||q===-1)return G;let H=z[1],W=z[2];if(/\bdata-raw\b/.test(H))return G;if(J.skipServer&&/\bserver\b/.test(H))return G;let j=`<script${gJ(H,Z)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return j+W+G.slice(q);return j+H5(W,Z)+G.slice(q)});return K5(X,Q)}function L1($,Z,J){let X=$,Y=(W,U)=>{let j=Z9(W,U);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(U,j))?-1:j},Q=(W,U,j,B)=>{let V=j.length,{output:F,tokens:O}=V1(W,U,(_,L)=>B(V+L));return j.push(...O),F},G=[];X=Q(X,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=[];X=Q(X,H2,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let K=Z?.__stx_signals_gate===!0||X1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),H=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(X=$9(X,(W,U,j)=>{try{let B=C0(U,Z,!1,(V)=>z5(V,W,J,$));return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return O0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${V}`,J,$,j,W)}},3),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(W,U,j)=>{try{let B=C0(U,Z,!1,(V)=>z5(V,W,J,$));if(B===void 0&&Z.__stx_buildMode==="compile")return e2("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return e2("raw",U.trim());let V=B instanceof Error?B.message:String(B);return O0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${V}`,J,$,j,W)}}),X=Q(X,H2,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),X=Q(X,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`),X=$9(X,(W,U,j)=>{let B=U.trim();if(H.has(B))return W;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,_=B.match(F)?.[1],L=_&&((_ in Z)||V.includes(_)),w=Boolean(_&&q.has(_)),D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(D),M=R&&!V.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";let T;try{let N=C0(U,Z,!1,(E)=>{T=E});if(w)return W;if(K&&!g3(B,Z))return W;if(T)z5(T,W,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(N===void 0||fJ(B,Z)))return e2("expr",B);if(N===void 0||N===null)return"";let I=String(N);return G5(Q5(X,j),I,W5(I))}catch(N){if(w)return W;if(K&&!g3(B,Z))return W;if(M)return W;let I=N instanceof Error?N.message:String(N);return O0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,J,$,j,W)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,U)=>z[Number(U)]??W);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,U)=>G[Number(U)]??W);return X}function hJ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=U2[G]||J9[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(vJ()).join(", ")}`);let K=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let H=q[1].trim();try{let W=Number(H);K=[Number.isNaN(W)?H:W]}catch{K=[H]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,H=1;while(q>0&&H<Y.length){if(Y[H]==="(")q++;if(Y[H]===")")q--;H++}if(q===0){let W=Y.substring(1,H-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))K=[C0(`(${W})`,J,!0)];else{let U=[],j="",B=null,V=0,F=0,O=0,_=!1;for(let L=0;L<W.length;L++){let w=W[L];if(_){j+=w,_=!1;continue}if(w==="\\"){j+=w,_=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&V===0&&F===0&&O===0){U.push(j),j="";continue}j+=w}if(j)U.push(j);K=U.map((L)=>{let w=L.trim();return C0(w,J,!0)})}}catch{K=[W]}Y=Y.substring(H).trim()}}try{X=z(X,J,...K)}catch(q){let H=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${H}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function uJ($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let K=$[z],q=$[z+1];if(Z&&G){G=!1;continue}if(Z&&K==="\\"){G=!0;continue}if(G=!1,(K==='"'||K==="'"||K==="`")&&!G){if(!Z)Z=!0,J=K;else if(K===J)Z=!1,J="";continue}if(Z&&J==="`"&&K==="$"&&q==="{"){let H=1;z+=2;while(z<$.length&&H>0){if($[z]==="{")H++;else if($[z]==="}")H--;if(H>0)z++}continue}if(Z)continue;if(K==="(")X++;else if(K===")")X--;else if(K==="[")Y++;else if(K==="]")Y--;else if(K==="{")Q++;else if(K==="}")Q--;if(K==="|"&&X===0&&Y===0&&Q===0){if(q==="|"){z++;continue}if(q==="="){z++;continue}return z}}return-1}var W2=new Set,mJ=1000;function qW(){W2.clear()}function z5($,Z,J,X){if(!d3())return;let Y=`${J}\x00${$.expression}`;if(W2.has(Y))return;if(W2.size>=mJ)W2.clear();W2.add(Y);let Q=J,G=X;try{if(J&&x3.existsSync(J))G=x3.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Q=`${J}:${G.slice(0,z).split(`
124
+ `).length}`;console.warn(`${Q}: stx warning: ${Z} rendered as an empty string. The safe evaluator rejected \`${$.expression}\` (${$.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function C0($,Z,J=!1,X){try{let Y=$.trim(),Q=uJ(Y);if(Q>0){let z=Y.substring(0,Q).trim(),K=Y.substring(Q+1).trim(),q=C0(z,Z,!0,X);return hJ(q,K,Z)}let G=l3(Y);if(G!==null){X?.({expression:Y,rule:G});return}try{let z=Object.keys(Z),K=Object.values(Z);return U0(Y,z)(...K)}catch{return X0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let G=Q[1],z=dJ(G,Object.keys(Z));if(z&&z!==G)Y.message=`${Y.message} \u2014 did you mean '${z}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function dJ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=lJ($,Y);if(J===null||Q<J.dist)J={key:Y,dist:Q}}if(!J)return null;let X=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/X<=0.35)return J.key;return null}function lJ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,X]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)Y[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let z=1;z<=J.length;z++){let K=J[z-1]===X[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+K)}for(let z=0;z<=J.length;z++)Y[z]=Q[z]}return Y[J.length]}function WW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import mz from"fs";import y0 from"path";var U5=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],p3=/<body\b([^>]*)>/gi;function i0($){let Z=0,J,X=U5.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)p3.lastIndex=Z,J=p3.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let K=0;K<U5.length;K++){let q=U5[K],H=X[K];if(H===void 0||H!==null&&H.index<Z)q.open.lastIndex=Z,H=q.open.exec($),X[K]=H;if(!H)continue;if(H.index<Y&&(Q===-1||H.index<Q))Q=H.index,G=q.close}if(Q===-1||!G)return{index:Y,tag:J[0],attrs:J[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function x1($,Z){let J=i0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var i3=/<style\b[^>]*>/iy,n3=/<\/style>/gi,s3=/<script\b[^>]*>/iy,o3=/<template(?=[\s>/])[^>]*>/iy,r3=/<\/template\s*>/iy;function j2($){let Z=0,J=0,X=-1;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y+4);Z=K===-1?$.length:K+3;continue}i3.lastIndex=Y;let Q=i3.exec($);if(Q){n3.lastIndex=Y+Q[0].length;let K=n3.exec($);Z=K===null?$.length:K.index+8;continue}o3.lastIndex=Y;let G=o3.exec($);if(G){if(J===0)X=Y;J++,Z=Y+G[0].length;continue}r3.lastIndex=Y;let z=r3.exec($);if(z){if(J>0)J--;Z=Y+z[0].length;continue}if(s3.lastIndex=Y,s3.test($))return J>0?X:Y;Z=Y+1}return-1}var a3=null;function cJ($){if(!a3)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return a3}function BW($){let Z=cJ("onUpdate");if(Z)Z.updateHooks.push($)}function t3(){return`
125
125
  // STX Lifecycle Runtime
126
126
  (function() {
127
127
  if (typeof window === 'undefined') return;
@@ -469,7 +469,7 @@ else {
469
469
 
470
470
  console.log('[stx] Lifecycle runtime initialized');
471
471
  })();
472
- `}function j5($){return Symbol($)}var BW=j5("theme"),VW=j5("router"),LW=j5("i18n");import*as e3 from"crypto";function t3($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function cJ(){return`stx-${e3.randomBytes(4).toString("hex")}`}function pJ($){return/\$\w+\./.test($)}function iJ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(X,(Q,G,z,K)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],H=!1,W=z,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(U)];for(let F of j){let O=F[0],_=F[1],L=F[2];if(pJ(L)){H=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let D=w[1];if(q.push({attr:_,expr:D,fullMatch:O,originalAttr:_}),t3(D).forEach((M)=>J.add(M)),_==="text")W=W.replace(O,"");else if(_==="class")W=W.replace(O,'class=""');else if(_==="disabled"||_==="hidden")W=W.replace(O,"");else W=W.replace(O,`${_}=""`)}}}if(!H)return Q;let B=W.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=cJ(),W=` id="${V}"${W}`;for(let F of q)Z.push({elementId:V,attribute:F.attr,expression:F.expr,stores:t3(F.expr)});return`<${G}${W}${K}`}),{html:Y,bindings:Z,stores:J}}function nJ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
472
+ `}function j5($){return Symbol($)}var VW=j5("theme"),LW=j5("router"),OW=j5("i18n");import*as $4 from"crypto";function e3($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function pJ(){return`stx-${$4.randomBytes(4).toString("hex")}`}function iJ($){return/\$\w+\./.test($)}function nJ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(X,(Q,G,z,K)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],H=!1,W=z,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(U)];for(let F of j){let O=F[0],_=F[1],L=F[2];if(iJ(L)){H=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let D=w[1];if(q.push({attr:_,expr:D,fullMatch:O,originalAttr:_}),e3(D).forEach((M)=>J.add(M)),_==="text")W=W.replace(O,"");else if(_==="class")W=W.replace(O,'class=""');else if(_==="disabled"||_==="hidden")W=W.replace(O,"");else W=W.replace(O,`${_}=""`)}}}if(!H)return Q;let B=W.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=pJ(),W=` id="${V}"${W}`;for(let F of q)Z.push({elementId:V,attribute:F.attr,expression:F.expr,stores:e3(F.expr)});return`<${G}${W}${K}`}),{html:Y,bindings:Z,stores:J}}function sJ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
473
473
  <script>
474
474
  (function() {
475
475
  'use strict';
@@ -627,10 +627,10 @@ else {
627
627
  }
628
628
  })();
629
629
  </script>
630
- `,X}function $4($){let{html:Z,bindings:J,stores:X}=iJ($);if(J.length===0)return $;let Y=nJ(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function Z4($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return sJ(Z);case"google-analytics":return oJ(Z);case"plausible":return rJ(Z);case"self-hosted":return aJ(Z);case"custom":return tJ(Z);default:return""}}function sJ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Y=[`data-site="${v0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${v0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
630
+ `,X}function Z4($){let{html:Z,bindings:J,stores:X}=nJ($);if(J.length===0)return $;let Y=sJ(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function J4($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return oJ(Z);case"google-analytics":return rJ(Z);case"plausible":return aJ(Z);case"self-hosted":return tJ(Z);case"custom":return eJ(Z);default:return""}}function oJ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Y=[`data-site="${v0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${v0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
631
631
  <!-- Fathom Analytics -->
632
632
  <script src="${v0(J)}" ${Y.join(" ")}${X}></script>
633
- `}function oJ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=v0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
633
+ `}function rJ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=v0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
634
634
  <!-- Google Analytics -->
635
635
  <script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
636
636
  <script>
@@ -640,10 +640,10 @@ else {
640
640
  gtag('config', '${J}');
641
641
  ${X}
642
642
  </script>
643
- `}function rJ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${v0(Z.domain)}"`],Y=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
643
+ `}function aJ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${v0(Z.domain)}"`],Y=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
644
644
  <!-- Plausible Analytics -->
645
645
  <script defer data-domain="${v0(Z.domain)}" src="${v0(Y)}"></script>
646
- `}function aJ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=v0(Z.siteId),X=v0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
646
+ `}function tJ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=v0(Z.siteId),X=v0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
647
647
  d.addEventListener('click',function(e){
648
648
  var a=e.target.closest('a');
649
649
  if(a&&a.hostname!==location.hostname){
@@ -676,7 +676,7 @@ else {
676
676
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
677
677
  })();
678
678
  </script>
679
- `}function tJ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
679
+ `}function eJ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
680
680
  <!-- Custom Analytics -->
681
681
  <script>
682
682
  ${Z.inlineScript}
@@ -684,7 +684,7 @@ ${Z.inlineScript}
684
684
  `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${v0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))J.push(`${v0(Y)}="${v0(Q)}"`);return`
685
685
  <!-- Custom Analytics -->
686
686
  <script${J.length>0?` ${J.join(" ")}`:""} src="${v0(Z.scriptUrl)}" defer></script>
687
- `}function J4($,Z){let J=Z4(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function v0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var _W={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return Z4(Y)}};var eJ={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function X4($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...eJ,...Z};return`
687
+ `}function X4($,Z){let J=J4(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function v0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var wW={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return J4(Y)}};var $X={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Y4($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...$X,...Z};return`
688
688
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
689
689
  <script>
690
690
  (function() {
@@ -1067,7 +1067,7 @@ else {
1067
1067
  };
1068
1068
  })();
1069
1069
  </script>
1070
- `}function Y4($,Z){let J=X4(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var Q4={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=$X(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return X4(Y)}};function $X($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Y,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class G4{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let J of this.sessions.values())if(J.page===$)Z.push(...J.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),J=new Map;for(let X of Z)if(X.depth!==void 0)J.set(X.depth,(J.get(X.depth)||0)+1);return Array.from(J.entries()).map(([X,Y])=>({depth:X,count:Y})).sort((X,Y)=>X.depth-Y.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Y=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Y.clicks++;else if(X.type==="move")Y.hovers++;Z.set(X.zone,Y)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of J){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);X[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of X)for(let G of Q)Y=Math.max(Y,G);return X.map((Q,G)=>Q.map((z,K)=>({x:K,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function RW(){return new G4}var ZX;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(ZX||={});var JX;((X)=>{X.In="in";X.Out="out";X.Both="both"})(JX||={});var XX;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(XX||={});var a0={duration:300,delay:0,ease:"ease",direction:"both"};function YX($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...a0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1070
+ `}function Q4($,Z){let J=Y4(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var G4={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=ZX(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return Y4(Y)}};function ZX($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Y,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class z4{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let J of this.sessions.values())if(J.page===$)Z.push(...J.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),J=new Map;for(let X of Z)if(X.depth!==void 0)J.set(X.depth,(J.get(X.depth)||0)+1);return Array.from(J.entries()).map(([X,Y])=>({depth:X,count:Y})).sort((X,Y)=>X.depth-Y.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Y=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Y.clicks++;else if(X.type==="move")Y.hovers++;Z.set(X.zone,Y)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of J){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);X[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of X)for(let G of Q)Y=Math.max(Y,G);return X.map((Q,G)=>Q.map((z,K)=>({x:K,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function DW(){return new z4}var JX;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(JX||={});var XX;((X)=>{X.In="in";X.Out="out";X.Both="both"})(XX||={});var YX;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(YX||={});var a0={duration:300,delay:0,ease:"ease",direction:"both"};function QX($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...a0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1071
1071
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1072
1072
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1073
1073
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1077,7 +1077,7 @@ else {
1077
1077
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1078
1078
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1079
1079
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1080
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function QX(){return`
1080
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function GX(){return`
1081
1081
  <script data-stx-scoped data-stx-run="once">
1082
1082
  // Motion preferences handling
1083
1083
  (function() {
@@ -1105,7 +1105,7 @@ else {
1105
1105
  });
1106
1106
  })();
1107
1107
  </script>
1108
- `}function GX($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function zX($=0.1,Z="0px"){return`
1108
+ `}function zX($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function KX($=0.1,Z="0px"){return`
1109
1109
  <script data-stx-scoped data-stx-run="always">
1110
1110
  // Intersection Observer for scroll animations
1111
1111
  (function() {
@@ -1148,7 +1148,7 @@ else {
1148
1148
  }
1149
1149
  })();
1150
1150
  </script>
1151
- `}function KX(){return`
1151
+ `}function qX(){return`
1152
1152
  <style id="stx-animation-base">
1153
1153
  :root {
1154
1154
  --stx-transition-duration: 300ms;
@@ -1263,7 +1263,7 @@ else {
1263
1263
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1264
1264
  }
1265
1265
  </style>
1266
- `}function qX($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
1266
+ `}function WX($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
1267
1267
  <script data-stx-scoped data-stx-run="always">
1268
1268
  // Animation Group: ${$}
1269
1269
  (function() {
@@ -1300,21 +1300,21 @@ else {
1300
1300
  }
1301
1301
  })();
1302
1302
  </script>
1303
- `}var B5={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||a0.duration:a0.duration,G=Z.length>2?Z[2]||a0.ease:a0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||a0.delay:a0.delay,K=Z.length>4?Z[4]||a0.direction:a0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=YX(Y,{duration:Q,delay:z,ease:G,direction:K}),W="stx-transition",U="";if(Y==="fade")U="stx-fade";else if(Y==="slide")U="stx-slide";else if(Y==="scale")U="stx-scale";else if(Y==="flip")U="stx-flip";else if(Y==="rotate")U="stx-rotate";return`<div id="${q}" class="${W} ${U} ${K==="out"?"stx-out":""}"
1304
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},V5={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,K=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,H=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Y==="fade")W+=" stx-fade";else if(Y==="slide-up"||Y==="slide")W+=" stx-from-bottom";else if(Y==="slide-down")W+=" stx-from-top";else if(Y==="slide-left")W+=" stx-from-right";else if(Y==="slide-right")W+=" stx-from-left";else if(Y==="scale")W+=" stx-scale";else if(Y.includes("-"))W+=` stx-${Y}`;else W+=` stx-${Y}`;return`<div id="${q}" class="${W}" style="${H}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},L5={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,z=J.sequence||!0,K=qX(Y,Q,{staggerDelay:G,sequence:z});return`${$}
1305
- ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},O5={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=QX();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function K4($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!GX(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=KX();Y=Y.replace("</head>",`${z}
1306
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let K=zX(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+K+`
1307
- `+Y.slice(q)}}return Y}var z4={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function WX($,Z){let J=Z.map((X)=>{let Y=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
1303
+ `}var B5={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||a0.duration:a0.duration,G=Z.length>2?Z[2]||a0.ease:a0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||a0.delay:a0.delay,K=Z.length>4?Z[4]||a0.direction:a0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=QX(Y,{duration:Q,delay:z,ease:G,direction:K}),W="stx-transition",U="";if(Y==="fade")U="stx-fade";else if(Y==="slide")U="stx-slide";else if(Y==="scale")U="stx-scale";else if(Y==="flip")U="stx-flip";else if(Y==="rotate")U="stx-rotate";return`<div id="${q}" class="${W} ${U} ${K==="out"?"stx-out":""}"
1304
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},V5={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,K=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,H=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Y==="fade")W+=" stx-fade";else if(Y==="slide-up"||Y==="slide")W+=" stx-from-bottom";else if(Y==="slide-down")W+=" stx-from-top";else if(Y==="slide-left")W+=" stx-from-right";else if(Y==="slide-right")W+=" stx-from-left";else if(Y==="scale")W+=" stx-scale";else if(Y.includes("-"))W+=` stx-${Y}`;else W+=` stx-${Y}`;return`<div id="${q}" class="${W}" style="${H}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},L5={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,z=J.sequence||!0,K=WX(Y,Q,{staggerDelay:G,sequence:z});return`${$}
1305
+ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},O5={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=GX();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function q4($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!zX(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=qX();Y=Y.replace("</head>",`${z}
1306
+ </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let K=KX(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+K+`
1307
+ `+Y.slice(q)}}return Y}var K4={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function HX($,Z){let J=Z.map((X)=>{let Y=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
1308
1308
  `);return`@keyframes ${$} {
1309
1309
  ${J}
1310
- }`}var HX={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",K=Z[4]?.replace(/['"`]/g,"")||"normal",q=Z[5]?.replace(/['"`]/g,"")||"forwards",H=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,W=`
1310
+ }`}var UX={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",K=Z[4]?.replace(/['"`]/g,"")||"normal",q=Z[5]?.replace(/['"`]/g,"")||"forwards",H=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,W=`
1311
1311
  animation-name: ${Y};
1312
1312
  animation-duration: ${Q}ms;
1313
1313
  animation-timing-function: ${G};
1314
1314
  animation-iteration-count: ${z};
1315
1315
  animation-direction: ${K};
1316
1316
  animation-fill-mode: ${q};
1317
- `.trim().replace(/\s+/g," ");return`<div id="${H}" style="${W}">${$}</div>`},description:"Applies a keyframe animation to an element"};function UX($,Z,J,X,Y){return`
1317
+ `.trim().replace(/\s+/g," ");return`<div id="${H}" style="${W}">${$}</div>`},description:"Applies a keyframe animation to an element"};function jX($,Z,J,X,Y){return`
1318
1318
  <script data-stx-scoped data-stx-run="always">
1319
1319
  (function() {
1320
1320
  const container = document.getElementById('${$}');
@@ -1328,7 +1328,7 @@ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1328
1328
  child.classList.add('${Y}');
1329
1329
  });
1330
1330
  })();
1331
- </script>`}var jX={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",K=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,q="stx-stagger-item";if(z==="fade")q+=" stx-fade";else if(z==="slide")q+=" stx-from-bottom";else if(z==="scale")q+=" stx-scale";let H=UX(K,Y,G,Q,q);return`${`
1331
+ </script>`}var BX={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",K=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,q="stx-stagger-item";if(z==="fade")q+=" stx-fade";else if(z==="slide")q+=" stx-from-bottom";else if(z==="scale")q+=" stx-scale";let H=jX(K,Y,G,Q,q);return`${`
1332
1332
  <style>
1333
1333
  #${K} .stx-stagger-item {
1334
1334
  opacity: 0;
@@ -1338,12 +1338,12 @@ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1338
1338
  from { opacity: 0; transform: translateY(10px); }
1339
1339
  to { opacity: 1; transform: translateY(0); }
1340
1340
  }
1341
- </style>`}<div id="${K}" class="stx-stagger-container">${$}</div>${H}`},description:"Applies staggered animations to child elements"};function BX($){let{stiffness:Z,damping:J}=$,X=J/(2*Math.sqrt(Z));if(X<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(X<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var VX={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(z4[Y])Q=z4[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,K=BX(Q),q=`
1341
+ </style>`}<div id="${K}" class="stx-stagger-container">${$}</div>${H}`},description:"Applies staggered animations to child elements"};function VX($){let{stiffness:Z,damping:J}=$,X=J/(2*Math.sqrt(Z));if(X<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(X<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var LX={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(K4[Y])Q=K4[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,K=VX(Q),q=`
1342
1342
  transition: all ${G}ms ${K};
1343
1343
  --stx-spring-stiffness: ${Q.stiffness};
1344
1344
  --stx-spring-damping: ${Q.damping};
1345
1345
  --stx-spring-mass: ${Q.mass};
1346
- `.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${q}">${$}</div>`},description:"Applies spring physics animations to an element"};function NW($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1346
+ `.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${q}">${$}</div>`},description:"Applies spring physics animations to an element"};function MW($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1347
1347
  <script data-stx-scoped data-stx-run="always">
1348
1348
  (function() {
1349
1349
  const timeline = ${JSON.stringify($)};
@@ -1380,7 +1380,7 @@ else {
1380
1380
  runTimeline();
1381
1381
  }
1382
1382
  })();
1383
- </script>`}function MW($,Z,J){let X=WX($,Z),Y=`
1383
+ </script>`}function AW($,Z,J){let X=HX($,Z),Y=`
1384
1384
  .${$}-animation {
1385
1385
  animation-name: ${$};
1386
1386
  animation-duration: ${J.duration}ms;
@@ -1390,7 +1390,7 @@ else {
1390
1390
  animation-direction: ${J.direction||"normal"};
1391
1391
  animation-fill-mode: ${J.fill||"forwards"};
1392
1392
  }`;return`${X}
1393
- ${Y}`}function AW($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Y=Z[X];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(X===0)J.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else J.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))J.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))J.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))J.fill=Y;else J.easing=Y}return J}function IW(){return`
1393
+ ${Y}`}function IW($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Y=Z[X];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(X===0)J.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else J.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))J.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))J.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))J.fill=Y;else J.easing=Y}return J}function TW(){return`
1394
1394
  <script data-stx-scoped data-stx-run="once">
1395
1395
  window.__stxAnimation = {
1396
1396
  // Registry of animations
@@ -1462,7 +1462,7 @@ else {
1462
1462
  );
1463
1463
  }
1464
1464
  };
1465
- </script>`}function TW($){let Z=$.customDirectives||[];return Z.push(B5),Z.push(L5),Z.push(O5),Z.push(V5),Z.push(HX),Z.push(jX),Z.push(VX),{...$,customDirectives:Z}}function q4($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function W4($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var LX=100,OX=599,_5="__stxResponseStatus",B2="__stxResponseHeaders";function X9($){return typeof $==="number"&&Number.isInteger($)&&$>=LX&&$<=OX}function yW($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let J=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!J)continue;let X=Number(J[1]);if(X9(X))return X}return}function F5($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!X9(J))return!1;return $[_5]=J,!0}function FX($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[B2]={...$[B2],[X]:String(J)}}function _X($){let Z=$?.[_5];return X9(Z)?Z:void 0}function wX($){let Z=$?.[B2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Y])=>[X,String(Y)]);return J.length>0?Object.fromEntries(J):void 0}function CW($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=_X($);if(J!==void 0)Z[_5]=J;let X=wX($);if(X)Z[B2]={...Z[B2],...X}}function H4($){return{setResponseStatus:(Z)=>{F5($,Z)},notFound:(Z=404)=>{let J=X9(Z)&&Z>=400?Z:404;F5($,J)},setResponseHeader:(Z,J)=>{FX($,Z,J)}}}function U4($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Y}=J,Q=Y==="compile",G="",z=0,K=/@status\s*\(/g,q;while((q=K.exec($))!==null){let H=RX($,q.index+q[0].length-1);if(H<0)break;let W=$.slice(q.index+q[0].length,H).trim(),U=/^\d+$/.test(W)?Number(W):X0(W,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${W})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${W}) from <script server> instead \u2014 that runs per request.`);else if(!F5(Z,U))console.warn(`[stx] @status(${W})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,q.index),z=H+1+($.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),K.lastIndex=z}return z===0?$:G+$.slice(z)}function RX($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}var DX=0,NX=0;function j4($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function MX($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Y,Q,G]=X,z=X.index,K=j4(G,"x-data");if(!K)continue;let q=`__stx_scope_${DX++}`,H=j4(G,"x-init"),W=AX($,Q,z+Y.length),U=$.slice(z,W.endIndex),j=IX(U);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:K,initExpr:H,bindings:[],refs:j})}return Z}function AX($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let K=Q.exec($),q=G.exec($),H=z.exec($);if(H&&H.index<(K?.index??1/0)){Y=H.index+H[0].length;continue}if(!q)return{endIndex:$.length};if(K&&K.index<q.index)X++,Y=K.index+K[0].length;else{if(X--,X===0)return{endIndex:q.index+q[0].length};Y=q.index+q[0].length}}return{endIndex:$.length}}function IX($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=X.exec(J))!==null){let[,Q,G]=Y,z=TX(Q);Z.set(G,z)}return Z}function TX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${NX++}`}function kX(){return`
1465
+ </script>`}function kW($){let Z=$.customDirectives||[];return Z.push(B5),Z.push(L5),Z.push(O5),Z.push(V5),Z.push(UX),Z.push(BX),Z.push(LX),{...$,customDirectives:Z}}function W4($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function H4($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var OX=100,FX=599,_5="__stxResponseStatus",B2="__stxResponseHeaders";function X9($){return typeof $==="number"&&Number.isInteger($)&&$>=OX&&$<=FX}function CW($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let J=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!J)continue;let X=Number(J[1]);if(X9(X))return X}return}function F5($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!X9(J))return!1;return $[_5]=J,!0}function _X($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[B2]={...$[B2],[X]:String(J)}}function wX($){let Z=$?.[_5];return X9(Z)?Z:void 0}function RX($){let Z=$?.[B2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Y])=>[X,String(Y)]);return J.length>0?Object.fromEntries(J):void 0}function SW($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=wX($);if(J!==void 0)Z[_5]=J;let X=RX($);if(X)Z[B2]={...Z[B2],...X}}function U4($){return{setResponseStatus:(Z)=>{F5($,Z)},notFound:(Z=404)=>{let J=X9(Z)&&Z>=400?Z:404;F5($,J)},setResponseHeader:(Z,J)=>{_X($,Z,J)}}}function j4($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Y}=J,Q=Y==="compile",G="",z=0,K=/@status\s*\(/g,q;while((q=K.exec($))!==null){let H=DX($,q.index+q[0].length-1);if(H<0)break;let W=$.slice(q.index+q[0].length,H).trim(),U=/^\d+$/.test(W)?Number(W):X0(W,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${W})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${W}) from <script server> instead \u2014 that runs per request.`);else if(!F5(Z,U))console.warn(`[stx] @status(${W})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,q.index),z=H+1+($.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),K.lastIndex=z}return z===0?$:G+$.slice(z)}function DX($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}var NX=0,MX=0;function B4($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function AX($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Y,Q,G]=X,z=X.index,K=B4(G,"x-data");if(!K)continue;let q=`__stx_scope_${NX++}`,H=B4(G,"x-init"),W=IX($,Q,z+Y.length),U=$.slice(z,W.endIndex),j=TX(U);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:K,initExpr:H,bindings:[],refs:j})}return Z}function IX($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let K=Q.exec($),q=G.exec($),H=z.exec($);if(H&&H.index<(K?.index??1/0)){Y=H.index+H[0].length;continue}if(!q)return{endIndex:$.length};if(K&&K.index<q.index)X++,Y=K.index+K[0].length;else{if(X--,X===0)return{endIndex:q.index+q[0].length};Y=q.index+q[0].length}}return{endIndex:$.length}}function TX($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=X.exec(J))!==null){let[,Q,G]=Y,z=kX(Q);Z.set(G,z)}return Z}function kX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${MX++}`}function EX(){return`
1466
1466
  // STX Reactive Runtime - x-cloak and transition CSS
1467
1467
  (function() {
1468
1468
  var style = document.createElement('style');
@@ -1669,7 +1669,7 @@ window.__stx_reactive = (function() {
1669
1669
 
1670
1670
  return { initScope: initScope, reactive: reactive };
1671
1671
  })();
1672
- `}function B4($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,K)=>{try{let q=C0(K,Z,!0);if(q===void 0)return z;return String(q)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let K=J.indexOf("}}",Y+2);if(K!==-1){let q=J.slice(Y,K+2);X+=G(J.slice(Y+2,K),q,Q),Y=K+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,K,q){let H;try{H=C0(z,Z,!0)}catch{return K}if(H===void 0)return K;if(q){let W=String(H).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?W.replace(/\$\{/g,"\\${"):W}if(typeof H==="string"){let W=H.trim();if(W.startsWith("{")&&W.endsWith("}")||W.startsWith("[")&&W.endsWith("]"))try{return JSON.parse(W),W}catch{}}return JSON.stringify(H)}}function EX($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=B4(X.stateExpr,Z),G=X.initExpr?B4(X.initExpr,Z):null,z=JSON.stringify(Q),K=G?JSON.stringify(G):"null";return`
1672
+ `}function V4($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,K)=>{try{let q=C0(K,Z,!0);if(q===void 0)return z;return String(q)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let K=J.indexOf("}}",Y+2);if(K!==-1){let q=J.slice(Y,K+2);X+=G(J.slice(Y+2,K),q,Q),Y=K+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,K,q){let H;try{H=C0(z,Z,!0)}catch{return K}if(H===void 0)return K;if(q){let W=String(H).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?W.replace(/\$\{/g,"\\${"):W}if(typeof H==="string"){let W=H.trim();if(W.startsWith("{")&&W.endsWith("}")||W.startsWith("[")&&W.endsWith("]"))try{return JSON.parse(W),W}catch{}}return JSON.stringify(H)}}function bX($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=V4(X.stateExpr,Z),G=X.initExpr?V4(X.initExpr,Z):null,z=JSON.stringify(Q),K=G?JSON.stringify(G):"null";return`
1673
1673
  (function() {
1674
1674
  var scopeEl = document.querySelector('${X.selector}');
1675
1675
  if (!scopeEl) return;
@@ -1678,11 +1678,11 @@ window.__stx_reactive = (function() {
1678
1678
  })();`}).join(`
1679
1679
  `);return`
1680
1680
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1681
- ${kX()}
1681
+ ${EX()}
1682
1682
  ${J}
1683
- </script>`}function V4($,Z,J){if(!yX($))return $;let X=MX($);if(X.length===0)return $;let Y=bX($,X),Q=EX(X,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1684
- `+Y.slice(G);else Y+=Q;return Y}function bX($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[J++];if(!z)return Y;let K=/data-stx-scope="([^"]*)"/.exec(G);if(K)return z.id=K[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),X=X.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),X}function yX($){return/x-data\s*=\s*["']/.test($)}import _Y from"fs";import f5 from"path";import{createHighlighter as wY}from"ts-syntax-highlighter";import U9 from"fs";import S0 from"path";import{loadConfigWithResult as UY}from"bunfig";V2();async function CX($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=w5();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var L4={name:"stxRouter",handler:CX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function O4($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function F4($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Y=$.slice(J[0].length),Q={};for(let G of X.split(`
1685
- `)){let z=G.trim();if(!z||z.startsWith("#"))continue;let K=z.indexOf(":");if(K===-1)continue;let q=z.slice(0,K).trim(),H=z.slice(K+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}Q[q]=H}return{data:Q,content:Y.trim()}}function L2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(H,W,U)=>{let j=Q.length,B=W?` class="language-${Y1(W)}"`:"";return Q.push(`<pre><code${B}>${Y1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(H,W)=>`<code>${Y1(W)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,W,U)=>{return`<img src="${O4(U)?Y1(U):""}" alt="${Y1(W)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,W,U)=>{return`<a href="${O4(U)?Y1(U):""}">${W}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1683
+ </script>`}function L4($,Z,J){if(!CX($))return $;let X=AX($);if(X.length===0)return $;let Y=yX($,X),Q=bX(X,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1684
+ `+Y.slice(G);else Y+=Q;return Y}function yX($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[J++];if(!z)return Y;let K=/data-stx-scope="([^"]*)"/.exec(G);if(K)return z.id=K[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),X=X.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),X}function CX($){return/x-data\s*=\s*["']/.test($)}import wY from"fs";import f5 from"path";import{createHighlighter as RY}from"ts-syntax-highlighter";import U9 from"fs";import S0 from"path";import{loadConfigWithResult as jY}from"bunfig";V2();async function SX($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=w5();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var O4={name:"stxRouter",handler:SX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function F4($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function _4($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Y=$.slice(J[0].length),Q={};for(let G of X.split(`
1685
+ `)){let z=G.trim();if(!z||z.startsWith("#"))continue;let K=z.indexOf(":");if(K===-1)continue;let q=z.slice(0,K).trim(),H=z.slice(K+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}Q[q]=H}return{data:Q,content:Y.trim()}}function L2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(H,W,U)=>{let j=Q.length,B=W?` class="language-${Y1(W)}"`:"";return Q.push(`<pre><code${B}>${Y1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(H,W)=>`<code>${Y1(W)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,W,U)=>{return`<img src="${F4(U)?Y1(U):""}" alt="${Y1(W)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,W,U)=>{return`<a href="${F4(U)?Y1(U):""}">${W}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1686
1686
  `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),J)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(H,W,U)=>{let B=`<tr>${W.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${Y1(F)}</th>`).join("")}</tr>`,V=U.trim().split(`
1687
1687
  `).map((F)=>{return`<tr>${F.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<td>${Y1(_)}</td>`).join("")}</tr>`}).join(`
1688
1688
  `);return`<table>
@@ -1699,9 +1699,9 @@ ${V}
1699
1699
  `:`
1700
1700
  `)}</p>`);if(Y=z.join(`
1701
1701
  `),X)Y=Y.replace(/\n/g,`<br />
1702
- `);for(let H=0;H<Q.length;H++)Y=Y.replace(`\x00CODEBLOCK${H}\x00`,Q[H]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function _4($,Z,J=""){let X=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,K=G[0].match(/@markdown\(([^)]*)\)/),q=K?K[1]:"",H=z+G[0].length,W=1,U=H,j=-1;while(W>0&&U<$.length){let F=$.indexOf("@markdown",U),O=$.indexOf("@endmarkdown",U);if(O===-1)break;if(F!==-1&&F<O&&F!==z){let _=$[F+9];if(_==="("||_===`
1703
- `||_==="\r"||_===" "||_===void 0)W++;U=F+9}else{if(W--,W===0){j=O;break}U=O+12}}if(j===-1)continue;let B=$.slice(H,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:q,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:K,content:q,index:H}of Y)try{let W={};if(K)K.split(",").forEach((B)=>{let V=B.trim();if(V)W[V]=!0});let U={gfm:W.gfm??!0,breaks:W.breaks??!1},j=L2(q.trim(),U);X=X.split(z).join(j)}catch(W){let U=W instanceof Error?W.message:String(W),j=O0("Markdown Directive",`Error processing markdown: ${U}`,J,$,H,z);X=X.split(z).join(j)}return X}async function w4($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),L2($.trim(),Y)}var O1=[320,480,640,768,1024,1280,1536,1920,2560],R4=[1,1.5,2,3],f1=["avif","webp","jpeg"],D4={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},SX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function O2($,Z=O1,J={},X){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Q1($,{...J,w:Y,fm:X})} ${Y}w`}).join(", ")}function pW($,Z=320,J=2560,X=0.08,Y={},Q){let G=PX(Z,J,X);return O2($,G,Y,Q)}function PX($,Z,J=0.08){let X=[],Y=$;while(Y<Z)X.push(Math.round(Y)),Y*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function R5($,Z,J=R4,X={},Y){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q1($,{...X,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function iW($,Z,J=R4,X=80,Y={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return J.sort((z,K)=>z-K).map((z)=>{let K=Math.round(Z*z),q=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${Q1($,{...Y,w:K,q,dpr:z,fm:Q})} ${z}x`}).join(", ")}function D5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return X.push(Z),X.join(", ")}function nW($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return X.push(Z),X.join(", ")}var sW={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Q1($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let X=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${X}`}function oW($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function rW($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:z={}}=$,K=[];for(let q of Q){let H,W;if(Y!==void 0&&X)H=R5(Z,Y,X,z,q),W=X.map((U)=>({path:"",url:Q1(Z,{...z,w:Math.round(Y*U),fm:q}),width:Math.round(Y*U),height:0,format:q,size:0,dpr:U}));else{let U=J||O1;H=O2(Z,U,z,q),W=U.map((j)=>({path:"",url:Q1(Z,{...z,w:j,fm:q}),width:j,height:0,format:q,size:0}))}K.push({srcset:H,format:q,mimeType:D4[q],variants:W})}return K}function aW($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
1704
- `)}function tW($,Z){if($.length===0)return;let J=[...$].sort((Y,Q)=>Y.width-Q.width),X=J.find((Y)=>Y.width>=Z);if(X)return X;return J[J.length-1]}function N5($){return D4[$]||"application/octet-stream"}function eW($){return SX[$]||$}function $H($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var vX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},M5=`
1702
+ `);for(let H=0;H<Q.length;H++)Y=Y.replace(`\x00CODEBLOCK${H}\x00`,Q[H]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function w4($,Z,J=""){let X=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,K=G[0].match(/@markdown\(([^)]*)\)/),q=K?K[1]:"",H=z+G[0].length,W=1,U=H,j=-1;while(W>0&&U<$.length){let F=$.indexOf("@markdown",U),O=$.indexOf("@endmarkdown",U);if(O===-1)break;if(F!==-1&&F<O&&F!==z){let _=$[F+9];if(_==="("||_===`
1703
+ `||_==="\r"||_===" "||_===void 0)W++;U=F+9}else{if(W--,W===0){j=O;break}U=O+12}}if(j===-1)continue;let B=$.slice(H,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:q,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:K,content:q,index:H}of Y)try{let W={};if(K)K.split(",").forEach((B)=>{let V=B.trim();if(V)W[V]=!0});let U={gfm:W.gfm??!0,breaks:W.breaks??!1},j=L2(q.trim(),U);X=X.split(z).join(j)}catch(W){let U=W instanceof Error?W.message:String(W),j=O0("Markdown Directive",`Error processing markdown: ${U}`,J,$,H,z);X=X.split(z).join(j)}return X}async function R4($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),L2($.trim(),Y)}var O1=[320,480,640,768,1024,1280,1536,1920,2560],D4=[1,1.5,2,3],f1=["avif","webp","jpeg"],N4={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},PX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function O2($,Z=O1,J={},X){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Q1($,{...J,w:Y,fm:X})} ${Y}w`}).join(", ")}function iW($,Z=320,J=2560,X=0.08,Y={},Q){let G=vX(Z,J,X);return O2($,G,Y,Q)}function vX($,Z,J=0.08){let X=[],Y=$;while(Y<Z)X.push(Math.round(Y)),Y*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function R5($,Z,J=D4,X={},Y){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q1($,{...X,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function nW($,Z,J=D4,X=80,Y={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return J.sort((z,K)=>z-K).map((z)=>{let K=Math.round(Z*z),q=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${Q1($,{...Y,w:K,q,dpr:z,fm:Q})} ${z}x`}).join(", ")}function D5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return X.push(Z),X.join(", ")}function sW($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return X.push(Z),X.join(", ")}var oW={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Q1($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let X=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${X}`}function rW($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function aW($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:z={}}=$,K=[];for(let q of Q){let H,W;if(Y!==void 0&&X)H=R5(Z,Y,X,z,q),W=X.map((U)=>({path:"",url:Q1(Z,{...z,w:Math.round(Y*U),fm:q}),width:Math.round(Y*U),height:0,format:q,size:0,dpr:U}));else{let U=J||O1;H=O2(Z,U,z,q),W=U.map((j)=>({path:"",url:Q1(Z,{...z,w:j,fm:q}),width:j,height:0,format:q,size:0}))}K.push({srcset:H,format:q,mimeType:N4[q],variants:W})}return K}function tW($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
1704
+ `)}function eW($,Z){if($.length===0)return;let J=[...$].sort((Y,Q)=>Y.width-Q.width),X=J.find((Y)=>Y.width>=Z);if(X)return X;return J[J.length-1]}function N5($){return N4[$]||"application/octet-stream"}function $H($){return PX[$]||$}function ZH($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var xX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},M5=`
1705
1705
  .stx-img-placeholder {
1706
1706
  position: relative;
1707
1707
  overflow: hidden;
@@ -1730,9 +1730,9 @@ ${V}
1730
1730
  filter: blur(0);
1731
1731
  transform: scale(1);
1732
1732
  }
1733
- `.trim();async function A5(){try{return await import("ts-images")}catch{return null}}async function N4($,Z={}){let J={...vX,...Z},X=await A5();if(X)try{return await xX($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return M4($,J)}async function xX($,Z,J){let{generatePlaceholder:X,generateThumbHash:Y}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function M4($,Z){let J=Z.width||20,X=Z.height||J,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${X}" viewBox="0 0 ${J} ${X}"><rect fill="#e5e7eb" width="${J}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function JH($){let Z=await A5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await M4($,{strategy:"thumbhash",width:32,height:32})).dataURL}function XH($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,K=(z>>3&63)/63,q=(z>>9&63)/63,H=z>>15!==0,W=Math.max(3,H?G?5:7:G?5:7),U=Math.max(3,H?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),F=Math.max(0,Math.min(255,Math.round(J*255))),O=Math.max(0,Math.min(255,Math.round((J-X)*255))),_=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1733
+ `.trim();async function A5(){try{return await import("ts-images")}catch{return null}}async function M4($,Z={}){let J={...xX,...Z},X=await A5();if(X)try{return await fX($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return A4($,J)}async function fX($,Z,J){let{generatePlaceholder:X,generateThumbHash:Y}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function A4($,Z){let J=Z.width||20,X=Z.height||J,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${X}" viewBox="0 0 ${J} ${X}"><rect fill="#e5e7eb" width="${J}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function XH($){let Z=await A5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await A4($,{strategy:"thumbhash",width:32,height:32})).dataURL}function YH($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,K=(z>>3&63)/63,q=(z>>9&63)/63,H=z>>15!==0,W=Math.max(3,H?G?5:7:G?5:7),U=Math.max(3,H?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),F=Math.max(0,Math.min(255,Math.round(J*255))),O=Math.max(0,Math.min(255,Math.round((J-X)*255))),_=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1734
1734
  <rect fill="rgb(${V},${F},${O})" width="32" height="32"/>
1735
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(_)}`}async function YH($,Z=20,J=50){return N4($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function QH($){let Z=await A5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function GH($,Z=1,J=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}"><rect fill="${$}" width="${Z}" height="${J}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function A4($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
1735
+ </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(_)}`}async function QH($,Z=20,J=50){return M4($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function GH($){let Z=await A5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function zH($,Z=1,J=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}"><rect fill="${$}" width="${Z}" height="${J}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function I4($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
1736
1736
  #${$} {
1737
1737
  --stx-img-transition-duration: ${X}ms;
1738
1738
  --stx-img-transition-easing: ${Y};
@@ -1749,8 +1749,8 @@ ${V}
1749
1749
  #${$}.stx-img-loaded img {
1750
1750
  opacity: 1;
1751
1751
  }
1752
- `.trim()}function zH($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var g1=new Map;async function I4($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(g1.has(J))return g1.get(J);let X=await N4($,Z);return g1.set(J,X),X}function KH(){g1.clear()}function qH(){return{size:g1.size,keys:Array.from(g1.keys())}}async function fX(){try{return await import("./chunk-xb2fcf36.js")}catch($){if(!T4)console.warn("[stx-media] Image processor not available, some features disabled:",$),T4=!0;return null}}var T4=!1,I5=80,Y9="async",Q9="lazy",k4=!1;async function F2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return dX(X,J)}if(J.processedResult?.processed)return E5($,J.processedResult,Z);if(J.responsiveVariants)return y4($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=O1,dpr:H,formats:W=f1,quality:U=I5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:F=!0,priority:O=!1,loading:_=O?"eager":Q9,decoding:L=Y9,fetchpriority:w,objectFit:D,objectPosition:R,crossorigin:M,referrerpolicy:T}=$,N=$.class,I=$.style,E=$.id,A=$.data||{},{isDev:k=!1,baseUrl:C=""}=Z;if(k&&!Z.optimize)return uX($);let y,b,P=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await I4(Y,{strategy:B,...V}),b=A4(P,y,V)}catch{}let h=H!==void 0&&G!==void 0,p;if(h)p=hX($,P,y,Z);else p=await gX($,P,y,Z);let u;if(O){let Y0=W.includes("webp")?"webp":W[0],i=O2(Y,q,{...j,q:U},Y0),W0=typeof K==="object"?D5(K):K||"100vw";u=`<link rel="preload" as="image" imagesrcset="${i}" imagesizes="${W0}" />`}let r=[];if(!k4&&B!=="none")r.push(M5),k4=!0;if(b)r.push(b);let e=F?b4(P):void 0;return{html:p,preloadLink:u,css:r.length>0?r.join(`
1753
- `):void 0,script:e}}async function gX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=O1,formats:H=f1,quality:W=I5,params:U={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":Q9,decoding:F=Y9,fetchpriority:O,objectFit:_,objectPosition:L,crossorigin:w,referrerpolicy:D}=$,R=$.class,M=$.style,T=$.data||{},N=typeof K==="object"?D5(K):K||"100vw",I=[];for(let k of H){let C=O2(Y,q,{...U,q:W},k),y=N5(k);if(j&&!B)I.push(` <source type="${y}" data-srcset="${C}" data-sizes="${N}" />`);else I.push(` <source type="${y}" srcset="${C}" sizes="${N}" />`)}let E=T5({src:Q1(Y,{...U,q:W}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:F,fetchpriority:B?"high":O,objectFit:_,objectPosition:L,crossorigin:w,referrerpolicy:D,className:E4(R,J),style:k5(M,_,L,J),lazy:j&&!B,data:T}),A;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;A=`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1752
+ `.trim()}function KH($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var g1=new Map;async function T4($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(g1.has(J))return g1.get(J);let X=await M4($,Z);return g1.set(J,X),X}function qH(){g1.clear()}function WH(){return{size:g1.size,keys:Array.from(g1.keys())}}async function gX(){try{return await import("./chunk-xb2fcf36.js")}catch($){if(!k4)console.warn("[stx-media] Image processor not available, some features disabled:",$),k4=!0;return null}}var k4=!1,I5=80,Y9="async",Q9="lazy",E4=!1;async function F2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return lX(X,J)}if(J.processedResult?.processed)return E5($,J.processedResult,Z);if(J.responsiveVariants)return C4($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=O1,dpr:H,formats:W=f1,quality:U=I5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:F=!0,priority:O=!1,loading:_=O?"eager":Q9,decoding:L=Y9,fetchpriority:w,objectFit:D,objectPosition:R,crossorigin:M,referrerpolicy:T}=$,N=$.class,I=$.style,E=$.id,A=$.data||{},{isDev:k=!1,baseUrl:C=""}=Z;if(k&&!Z.optimize)return mX($);let y,b,P=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await T4(Y,{strategy:B,...V}),b=I4(P,y,V)}catch{}let h=H!==void 0&&G!==void 0,p;if(h)p=uX($,P,y,Z);else p=await hX($,P,y,Z);let u;if(O){let Y0=W.includes("webp")?"webp":W[0],i=O2(Y,q,{...j,q:U},Y0),W0=typeof K==="object"?D5(K):K||"100vw";u=`<link rel="preload" as="image" imagesrcset="${i}" imagesizes="${W0}" />`}let r=[];if(!E4&&B!=="none")r.push(M5),E4=!0;if(b)r.push(b);let e=F?y4(P):void 0;return{html:p,preloadLink:u,css:r.length>0?r.join(`
1753
+ `):void 0,script:e}}async function hX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=O1,formats:H=f1,quality:W=I5,params:U={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":Q9,decoding:F=Y9,fetchpriority:O,objectFit:_,objectPosition:L,crossorigin:w,referrerpolicy:D}=$,R=$.class,M=$.style,T=$.data||{},N=typeof K==="object"?D5(K):K||"100vw",I=[];for(let k of H){let C=O2(Y,q,{...U,q:W},k),y=N5(k);if(j&&!B)I.push(` <source type="${y}" data-srcset="${C}" data-sizes="${N}" />`);else I.push(` <source type="${y}" srcset="${C}" sizes="${N}" />`)}let E=T5({src:Q1(Y,{...U,q:W}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:F,fetchpriority:B?"high":O,objectFit:_,objectPosition:L,crossorigin:w,referrerpolicy:D,className:b4(R,J),style:k5(M,_,L,J),lazy:j&&!B,data:T}),A;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;A=`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1754
1754
  <picture>
1755
1755
  ${I.join(`
1756
1756
  `)}
@@ -1760,9 +1760,9 @@ ${I.join(`
1760
1760
  ${I.join(`
1761
1761
  `)}
1762
1762
  <img ${E} />
1763
- </picture>`;return A}function hX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:K=[1,2,3],quality:q=I5,params:H={},lazy:W=!0,priority:U=!1,loading:j=U?"eager":Q9,decoding:B=Y9,fetchpriority:V,objectFit:F,objectPosition:O,crossorigin:_,referrerpolicy:L}=$,w=$.class,D=$.style,R=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=R5(Y,M,K,{...H,q}),N=T5({src:Q1(Y,{...H,w:M,q}),alt:Q,width:G,height:z,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":V,objectFit:F,objectPosition:O,crossorigin:_,referrerpolicy:L,className:E4(w,J),style:k5(D,F,O,J),lazy:W&&!U,data:R}),I=W&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
1763
+ </picture>`;return A}function uX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:K=[1,2,3],quality:q=I5,params:H={},lazy:W=!0,priority:U=!1,loading:j=U?"eager":Q9,decoding:B=Y9,fetchpriority:V,objectFit:F,objectPosition:O,crossorigin:_,referrerpolicy:L}=$,w=$.class,D=$.style,R=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=R5(Y,M,K,{...H,q}),N=T5({src:Q1(Y,{...H,w:M,q}),alt:Q,width:G,height:z,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":V,objectFit:F,objectPosition:O,crossorigin:_,referrerpolicy:L,className:b4(w,J),style:k5(D,F,O,J),lazy:W&&!U,data:R}),I=W&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
1764
1764
  <img ${N} ${I} />
1765
- </div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${I} />`}function uX($){let{src:Z,alt:J,width:X,height:Y,loading:Q=Q9,decoding:G=Y9,fetchpriority:z,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W,priority:U=!1}=$,j=$.class,B=$.style,V=$.id,F=$.data||{};return{html:`<img ${T5({src:Z,alt:J,width:X,height:Y,loading:U?"eager":Q,decoding:G,fetchpriority:U?"high":z,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W,className:j,style:k5(B,K,q),id:V,data:F})} />`}}function T5($){let Z=[];if($.lazy)Z.push(`data-src="${m0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${m0($.src)}"`);if(Z.push(`alt="${m0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${m0($.className)}"`);if($.style)Z.push(`style="${m0($.style)}"`);if($.id)Z.push(`id="${m0($.id)}"`);if($.data)for(let[J,X]of Object.entries($.data))Z.push(`data-${J}="${m0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function E4($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function k5($,Z,J,X){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(J)Y.push(`object-position: ${J}`);if(X)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b4($){return`
1765
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${I} />`}function mX($){let{src:Z,alt:J,width:X,height:Y,loading:Q=Q9,decoding:G=Y9,fetchpriority:z,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W,priority:U=!1}=$,j=$.class,B=$.style,V=$.id,F=$.data||{};return{html:`<img ${T5({src:Z,alt:J,width:X,height:Y,loading:U?"eager":Q,decoding:G,fetchpriority:U?"high":z,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W,className:j,style:k5(B,K,q),id:V,data:F})} />`}}function T5($){let Z=[];if($.lazy)Z.push(`data-src="${m0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${m0($.src)}"`);if(Z.push(`alt="${m0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${m0($.className)}"`);if($.style)Z.push(`style="${m0($.style)}"`);if($.id)Z.push(`id="${m0($.id)}"`);if($.data)for(let[J,X]of Object.entries($.data))Z.push(`data-${J}="${m0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function b4($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function k5($,Z,J,X){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(J)Y.push(`object-position: ${J}`);if(X)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y4($){return`
1766
1766
  (function() {
1767
1767
  const container = document.getElementById('${$}');
1768
1768
  if (!container) return;
@@ -1799,7 +1799,7 @@ ${I.join(`
1799
1799
 
1800
1800
  observer.observe(container);
1801
1801
  })();
1802
- `.trim()}function mX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(J))!==null){let[,G,z,K,q,H]=Q,W=K??q??H??!0;if(G===":"&&typeof W==="string")try{X[z]=JSON.parse(W)}catch{X[z]=W}else switch(z){case"src":X.src=String(W);break;case"alt":X.alt=String(W);break;case"width":X.width=Number(W)||W;break;case"height":X.height=Number(W)||W;break;case"sizes":X.sizes=String(W);break;case"quality":X.quality=Number(W);break;case"placeholder":X.placeholder=W;break;case"lazy":X.lazy=W===!0||W==="true";break;case"priority":X.priority=W===!0||W==="true";break;case"class":X.class=String(W);break;case"style":X.style=String(W);break;case"id":X.id=String(W);break;case"loading":X.loading=W;break;case"decoding":X.decoding=W;break;case"fetchpriority":X.fetchpriority=W;break;case"objectFit":X.objectFit=W;break;case"objectPosition":X.objectPosition=String(W);break;case"crossorigin":X.crossorigin=W;break}}if(!X.src||!X.alt)return null;return X}async function jH($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Y=[],Q=[],G=$,z=[],K;while((K=J.exec($))!==null)z.push({match:K[0],index:K.index});for(let q=z.length-1;q>=0;q--){let{match:H}=z[q],W=mX(H);if(W){let U=await F2(W,Z);if(G=G.replace(H,U.html),U.preloadLink)X.push(U.preloadLink);if(U.css)Y.push(U.css);if(U.script)Q.push(U.script)}}return{html:G,preloadLinks:X,styles:Y,scripts:Q}}async function dX($,Z){let J=await fX();if(!J)return F2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,X);if(Q)return y4($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return E5($,Q,Z)}return F2({...$,process:!1},Z)}async function E5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},F=Z.variants||[],O=F.find((b)=>b.format==="jpeg")||F.find((b)=>b.format==="webp")||F[0],_=O?.url||$.src,L=F.filter((b)=>b.format===(O?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),w=new Map;for(let b of F){if(!w.has(b.format))w.set(b.format,[]);w.get(b.format).push(b)}let D=[],R=["avif","webp","jpeg","png"];for(let b of R){let P=w.get(b);if(P&&P.length>0){let h=P.map((u)=>`${u.url} ${u.width}w`).join(", "),p=N5(b);if(G&&!z)D.push(` <source type="${p}" data-srcset="${h}" />`);else D.push(` <source type="${p}" srcset="${h}" />`)}}let M=[];if(G&&!z){if(M.push(`data-src="${m0(_)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)M.push(`data-srcset="${L}"`)}else if(M.push(`src="${m0(_)}"`),L)M.push(`srcset="${L}"`);M.push(`alt="${m0(X)}"`);let T=Y||Z.originalWidth,N=Q||Z.originalHeight;if(T)M.push(`width="${T}"`);if(N)M.push(`height="${N}"`);if(!z)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),z)M.push('fetchpriority="high"');if(H)M.push(`crossorigin="${H}"`);if(W)M.push(`referrerpolicy="${W}"`);let I=[];if(K)I.push(`object-fit: ${K}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)M.push(`style="${I.join("; ")}"`);let E=[];if(U)E.push(U);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)M.push(`class="${E.join(" ")}"`);if(G&&!z)M.push("data-stx-lazy");for(let[b,P]of Object.entries(V))M.push(`data-${b}="${m0(P)}"`);let A;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let b=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;A=`<div id="${B}" class="stx-img-placeholder" style="${b}">
1802
+ `.trim()}function dX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(J))!==null){let[,G,z,K,q,H]=Q,W=K??q??H??!0;if(G===":"&&typeof W==="string")try{X[z]=JSON.parse(W)}catch{X[z]=W}else switch(z){case"src":X.src=String(W);break;case"alt":X.alt=String(W);break;case"width":X.width=Number(W)||W;break;case"height":X.height=Number(W)||W;break;case"sizes":X.sizes=String(W);break;case"quality":X.quality=Number(W);break;case"placeholder":X.placeholder=W;break;case"lazy":X.lazy=W===!0||W==="true";break;case"priority":X.priority=W===!0||W==="true";break;case"class":X.class=String(W);break;case"style":X.style=String(W);break;case"id":X.id=String(W);break;case"loading":X.loading=W;break;case"decoding":X.decoding=W;break;case"fetchpriority":X.fetchpriority=W;break;case"objectFit":X.objectFit=W;break;case"objectPosition":X.objectPosition=String(W);break;case"crossorigin":X.crossorigin=W;break}}if(!X.src||!X.alt)return null;return X}async function BH($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Y=[],Q=[],G=$,z=[],K;while((K=J.exec($))!==null)z.push({match:K[0],index:K.index});for(let q=z.length-1;q>=0;q--){let{match:H}=z[q],W=dX(H);if(W){let U=await F2(W,Z);if(G=G.replace(H,U.html),U.preloadLink)X.push(U.preloadLink);if(U.css)Y.push(U.css);if(U.script)Q.push(U.script)}}return{html:G,preloadLinks:X,styles:Y,scripts:Q}}async function lX($,Z){let J=await gX();if(!J)return F2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,X);if(Q)return C4($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return E5($,Q,Z)}return F2({...$,process:!1},Z)}async function E5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},F=Z.variants||[],O=F.find((b)=>b.format==="jpeg")||F.find((b)=>b.format==="webp")||F[0],_=O?.url||$.src,L=F.filter((b)=>b.format===(O?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),w=new Map;for(let b of F){if(!w.has(b.format))w.set(b.format,[]);w.get(b.format).push(b)}let D=[],R=["avif","webp","jpeg","png"];for(let b of R){let P=w.get(b);if(P&&P.length>0){let h=P.map((u)=>`${u.url} ${u.width}w`).join(", "),p=N5(b);if(G&&!z)D.push(` <source type="${p}" data-srcset="${h}" />`);else D.push(` <source type="${p}" srcset="${h}" />`)}}let M=[];if(G&&!z){if(M.push(`data-src="${m0(_)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)M.push(`data-srcset="${L}"`)}else if(M.push(`src="${m0(_)}"`),L)M.push(`srcset="${L}"`);M.push(`alt="${m0(X)}"`);let T=Y||Z.originalWidth,N=Q||Z.originalHeight;if(T)M.push(`width="${T}"`);if(N)M.push(`height="${N}"`);if(!z)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),z)M.push('fetchpriority="high"');if(H)M.push(`crossorigin="${H}"`);if(W)M.push(`referrerpolicy="${W}"`);let I=[];if(K)I.push(`object-fit: ${K}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)M.push(`style="${I.join("; ")}"`);let E=[];if(U)E.push(U);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)M.push(`class="${E.join(" ")}"`);if(G&&!z)M.push("data-stx-lazy");for(let[b,P]of Object.entries(V))M.push(`data-${b}="${m0(P)}"`);let A;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let b=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;A=`<div id="${B}" class="stx-img-placeholder" style="${b}">
1803
1803
  <picture>
1804
1804
  ${D.join(`
1805
1805
  `)}
@@ -1809,11 +1809,11 @@ ${D.join(`
1809
1809
  ${D.join(`
1810
1810
  `)}
1811
1811
  <img ${M.join(" ")} />
1812
- </picture>`;let k=[];if(Z.placeholder)k.push(M5);let C=G?b4(B):void 0,y;if(z&&L)y=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:A,preloadLink:y,css:k.length>0?k.join(`
1813
- `):void 0,script:C}}async function y4($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return E5($,X,J)}function lX(){return G9({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Y,alt:Q,options:G}=cX($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||O1,formats:G.formats||f1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},K=J.__isDev||!1,q=await F2(z,{isDev:K}),H=q.html;if(q.preloadLink)H=q.preloadLink+`
1812
+ </picture>`;let k=[];if(Z.placeholder)k.push(M5);let C=G?y4(B):void 0,y;if(z&&L)y=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:A,preloadLink:y,css:k.length>0?k.join(`
1813
+ `):void 0,script:C}}async function C4($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return E5($,X,J)}function cX(){return G9({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Y,alt:Q,options:G}=pX($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||O1,formats:G.formats||f1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},K=J.__isDev||!1,q=await F2(z,{isDev:K}),H=q.html;if(q.preloadLink)H=q.preloadLink+`
1814
1814
  `+H;if(q.css)H+=`
1815
1815
  <style>${q.css}</style>`;if(q.script)H+=`
1816
- <script>${q.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function cX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=pX(X),Q=b5(Y[0],J)||"",G=b5(Y[1],J)||"",z={};if(Y[2]){let K=b5(Y[2],J);if(typeof K==="object"&&K!==null)z=K;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function pX($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function b5($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var C4=lX();async function P4(){try{return await import("./chunk-xnbbnbtm.js")}catch($){if(!S4)console.warn("[stx-media] Video processor not available, some features disabled:",$),S4=!0;return null}}var S4=!1,v4=!0,x4="metadata",iX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function z9($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return aX(X,J)}if(J.processedResult?.processed)return g4($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await tX(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:K,controls:q=v4,autoplay:H=!1,muted:W=!1,loop:U=!1,preload:j=x4,playsinline:B=!0,lazy:V=!0,player:F="native",type:O,width:_,height:L,crossorigin:w,disablePictureInPicture:D=!1,disableRemotePlayback:R=!1}=$,M=Y||z,T=$.class,N=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return sX($,Z);if(O&&O!=="video")return nX(Q||"",O,$);let E=G.length>0?G:Q?[{src:Q,type:f4(Q)}]:[],A=[`id="${I}"`];if(q)A.push("controls");if(H)A.push("autoplay");if(W)A.push("muted");if(U)A.push("loop");if(B)A.push("playsinline");if(D)A.push("disablepictureinpicture");if(R)A.push("disableremoteplayback");if(w)A.push(`crossorigin="${w}"`);if(V){if(A.push(`data-preload="${j}"`),A.push('preload="none"'),M)A.push(`data-poster="${T0(M)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${j}"`),M)A.push(`poster="${T0(M)}"`);if(_)A.push(`width="${_}"`);if(L)A.push(`height="${L}"`);if(T)A.push(`class="${T0(T)}"`);if(N)A.push(`style="${T0(N)}"`);let k=E.map((b)=>{return` <source ${V?`data-src="${T0(b.src)}"`:`src="${T0(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
1816
+ <script>${q.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function pX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=iX(X),Q=b5(Y[0],J)||"",G=b5(Y[1],J)||"",z={};if(Y[2]){let K=b5(Y[2],J);if(typeof K==="object"&&K!==null)z=K;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function iX($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function b5($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var S4=cX();async function v4(){try{return await import("./chunk-xnbbnbtm.js")}catch($){if(!P4)console.warn("[stx-media] Video processor not available, some features disabled:",$),P4=!0;return null}}var P4=!1,x4=!0,f4="metadata",nX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function z9($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return tX(X,J)}if(J.processedResult?.processed)return h4($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await eX(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:K,controls:q=x4,autoplay:H=!1,muted:W=!1,loop:U=!1,preload:j=f4,playsinline:B=!0,lazy:V=!0,player:F="native",type:O,width:_,height:L,crossorigin:w,disablePictureInPicture:D=!1,disableRemotePlayback:R=!1}=$,M=Y||z,T=$.class,N=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return oX($,Z);if(O&&O!=="video")return sX(Q||"",O,$);let E=G.length>0?G:Q?[{src:Q,type:g4(Q)}]:[],A=[`id="${I}"`];if(q)A.push("controls");if(H)A.push("autoplay");if(W)A.push("muted");if(U)A.push("loop");if(B)A.push("playsinline");if(D)A.push("disablepictureinpicture");if(R)A.push("disableremoteplayback");if(w)A.push(`crossorigin="${w}"`);if(V){if(A.push(`data-preload="${j}"`),A.push('preload="none"'),M)A.push(`data-poster="${T0(M)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${j}"`),M)A.push(`poster="${T0(M)}"`);if(_)A.push(`width="${_}"`);if(L)A.push(`height="${L}"`);if(T)A.push(`class="${T0(T)}"`);if(N)A.push(`style="${T0(N)}"`);let k=E.map((b)=>{return` <source ${V?`data-src="${T0(b.src)}"`:`src="${T0(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
1817
1817
  `),C=`<video ${A.join(" ")}>
1818
1818
  ${k}
1819
1819
  Your browser does not support the video tag.
@@ -1852,9 +1852,9 @@ ${k}
1852
1852
 
1853
1853
  observer.observe(video);
1854
1854
  })();
1855
- `.trim();return{html:C,script:y}}function nX($,Z,J){let{width:X=640,height:Y=360}=J,Q=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,q=null;switch(Z){case"youtube":q=oX($),K=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=rX($),K=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",K=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=$}let H=[`id="${z}"`,`src="${T0(K)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)H.push(`class="${T0(Q)}"`);if(G)H.push(`style="${T0(G)}"`);if(J.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1855
+ `.trim();return{html:C,script:y}}function sX($,Z,J){let{width:X=640,height:Y=360}=J,Q=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,q=null;switch(Z){case"youtube":q=rX($),K=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=aX($),K=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",K=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=$}let H=[`id="${z}"`,`src="${T0(K)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)H.push(`class="${T0(Q)}"`);if(G)H.push(`style="${T0(G)}"`);if(J.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1856
1856
  <iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1857
- </div>`}}function sX($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:K=!1,preload:q="metadata",playsinline:H=!0,lazy:W=!0,width:U,height:j}=$,B=$.class,V=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:X.length>0?X:J,autoplay:G,loop:K,muted:z,playsinline:H,preload:q,poster:Y,controls:Q,title:$.title},_=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",V||""].filter(Boolean).join("; "),L=`
1857
+ </div>`}}function oX($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:K=!1,preload:q="metadata",playsinline:H=!0,lazy:W=!0,width:U,height:j}=$,B=$.class,V=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:X.length>0?X:J,autoplay:G,loop:K,muted:z,playsinline:H,preload:q,poster:Y,controls:Q,title:$.title},_=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",V||""].filter(Boolean).join("; "),L=`
1858
1858
  <div
1859
1859
  id="${F}"
1860
1860
  class="ts-video-player${B?" "+T0(B):""}"
@@ -1891,7 +1891,7 @@ ${k}
1891
1891
 
1892
1892
  // Load ts-video-player from CDN
1893
1893
  var script = document.createElement('script');
1894
- script.src = '${iX}';
1894
+ script.src = '${nX}';
1895
1895
  script.onload = initPlayer;
1896
1896
  script.onerror = function() {
1897
1897
  console.error('[stx] Failed to load ts-video-player');
@@ -2021,7 +2021,7 @@ else {
2021
2021
  .ts-video-player__play-button svg {
2022
2022
  margin-left: 4px;
2023
2023
  }
2024
- `.trim();return{html:L,script:w,css:D}}function f4($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function oX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let X=$.match(J);if(X)return X[1]}return null}function rX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function _H($,Z,J){if(Z.src)return{src:String(Z.src),...Z};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=X.indexOf(",");if(Y===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Q=X.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function aX($,Z){let J=await P4();if(!J)return z9({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return g4($,Y,Z);return z9({...$,process:!1},Z)}async function tX($,Z){let J=await P4();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Y.outputDir,Y.baseUrl||"/videos"))?.url}function g4($,Z,J){let{controls:X=v4,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=x4,playsinline:K=!0,lazy:q=!0,width:H,height:W,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,F=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,_=$.src,L=f4(_);if(Z.transcoded)_=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)_=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)_=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let D=Z.poster?.url||$.poster,R=[`id="${O}"`];if(X)R.push("controls");if(Y)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(K)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(q){if(R.push(`data-preload="${z}"`),R.push('preload="none"'),D)R.push(`data-poster="${T0(D)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${z}"`),D)R.push(`poster="${T0(D)}"`);let M=H||Z.metadata?.width,T=W||Z.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(V)R.push(`class="${T0(V)}"`);if(F)R.push(`style="${T0(F)}"`);let I=` <source ${q?`data-src="${T0(_)}"`:`src="${T0(_)}"`} type="${L}" />`,E=`<video ${R.join(" ")}>
2024
+ `.trim();return{html:L,script:w,css:D}}function g4($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function rX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let X=$.match(J);if(X)return X[1]}return null}function aX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function wH($,Z,J){if(Z.src)return{src:String(Z.src),...Z};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=X.indexOf(",");if(Y===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Q=X.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function tX($,Z){let J=await v4();if(!J)return z9({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return h4($,Y,Z);return z9({...$,process:!1},Z)}async function eX($,Z){let J=await v4();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Y.outputDir,Y.baseUrl||"/videos"))?.url}function h4($,Z,J){let{controls:X=x4,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=f4,playsinline:K=!0,lazy:q=!0,width:H,height:W,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,F=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,_=$.src,L=g4(_);if(Z.transcoded)_=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)_=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)_=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let D=Z.poster?.url||$.poster,R=[`id="${O}"`];if(X)R.push("controls");if(Y)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(K)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(q){if(R.push(`data-preload="${z}"`),R.push('preload="none"'),D)R.push(`data-poster="${T0(D)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${z}"`),D)R.push(`poster="${T0(D)}"`);let M=H||Z.metadata?.width,T=W||Z.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(V)R.push(`class="${T0(V)}"`);if(F)R.push(`style="${T0(F)}"`);let I=` <source ${q?`data-src="${T0(_)}"`:`src="${T0(_)}"`} type="${L}" />`,E=`<video ${R.join(" ")}>
2025
2025
  ${I}
2026
2026
  Your browser does not support the video tag.
2027
2027
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${T0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -2070,9 +2070,9 @@ ${E}
2070
2070
  width: 100%;
2071
2071
  height: auto;
2072
2072
  }
2073
- `.trim();return{html:E,script:A,css:k}}function h4(){return G9({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=eX($,Z,J);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},K={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},q=await z9(G,K),H=q.html;if(q.css)H+=`
2073
+ `.trim();return{html:E,script:A,css:k}}function u4(){return G9({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=$Y($,Z,J);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},K={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},q=await z9(G,K),H=q.html;if(q.css)H+=`
2074
2074
  <style>${q.css}</style>`;if(q.script)H+=`
2075
- <script>${q.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function eX($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=$Y(X),Q=u4(Y[0],J)||"",G={};if(Y[1]){let z=u4(Y[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function $Y($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function u4($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var y5=h4();import ZY from"fs";import x0 from"path";async function EH($,Z){if(!$.webComponents?.enabled)return[];let J=$.webComponents.components||[],X=[];if(J.length>0){if($.debug)console.log(`Building ${J.length} web components...`);for(let Y of J)try{let Q=await JY(Y,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return X}async function JY($,Z,J){let{name:X,file:Y,tag:Q,extends:G}=$;if(!X||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(x0.isAbsolute(Y)&&await t(Y))z=Y;else if(Z.componentsDir){let V=x0.join(Z.componentsDir,Y);if(await t(V))z=V}if(!z)z=await K9(Y,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let K=await Bun.file(z).text();J.add(z);let H=($.outputFormat||"js")==="ts",W=H?YY({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):XY({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),U=Z.webComponents?.outputDir||"dist/web-components";await ZY.promises.mkdir(U,{recursive:!0});let j=H?"ts":"js",B=x0.join(U,`${Q}.${j}`);if(await Bun.write(B,W),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function XY($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[]}=$,q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)q=q.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),q=q.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),q=q.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),q=q.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let H="";if(z)H=`<link rel="stylesheet" href="${z}">`;return`/**
2075
+ <script>${q.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function $Y($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=ZY(X),Q=m4(Y[0],J)||"",G={};if(Y[1]){let z=m4(Y[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function ZY($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function m4($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var y5=u4();import JY from"fs";import x0 from"path";async function bH($,Z){if(!$.webComponents?.enabled)return[];let J=$.webComponents.components||[],X=[];if(J.length>0){if($.debug)console.log(`Building ${J.length} web components...`);for(let Y of J)try{let Q=await XY(Y,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return X}async function XY($,Z,J){let{name:X,file:Y,tag:Q,extends:G}=$;if(!X||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(x0.isAbsolute(Y)&&await t(Y))z=Y;else if(Z.componentsDir){let V=x0.join(Z.componentsDir,Y);if(await t(V))z=V}if(!z)z=await K9(Y,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let K=await Bun.file(z).text();J.add(z);let H=($.outputFormat||"js")==="ts",W=H?QY({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):YY({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),U=Z.webComponents?.outputDir||"dist/web-components";await JY.promises.mkdir(U,{recursive:!0});let j=H?"ts":"js",B=x0.join(U,`${Q}.${j}`);if(await Bun.write(B,W),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function YY($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[]}=$,q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)q=q.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),q=q.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),q=q.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),q=q.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let H="";if(z)H=`<link rel="stylesheet" href="${z}">`;return`/**
2076
2076
  * ${Z} Web Component
2077
2077
  * Auto-generated from stx component
2078
2078
  */
@@ -2164,7 +2164,7 @@ class ${Z.replace(/\W/g,"")} extends ${X} {
2164
2164
 
2165
2165
  // Register the web component
2166
2166
  customElements.define('${J}', ${Z.replace(/\W/g,"")})
2167
- `}function YY($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[],attributeTypes:q={}}=$,H=Z.replace(/\W/g,""),W=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");W=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let U=z?`<link rel="stylesheet" href="${z}">`:"",j=(D)=>{switch(q[D]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(D)=>D.replace(/-([a-z])/g,(R,M)=>M.toUpperCase()),V=K.map((D)=>` private _${B(D)}: ${j(D)} | null = null;`).join(`
2167
+ `}function QY($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[],attributeTypes:q={}}=$,H=Z.replace(/\W/g,""),W=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");W=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let U=z?`<link rel="stylesheet" href="${z}">`:"",j=(D)=>{switch(q[D]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(D)=>D.replace(/-([a-z])/g,(R,M)=>M.toUpperCase()),V=K.map((D)=>` private _${B(D)}: ${j(D)} | null = null;`).join(`
2168
2168
  `),F=K.map((D)=>{let R=j(D),M=B(D);return`
2169
2169
  get ${M}(): ${R} | null {
2170
2170
  return this._${M};
@@ -2319,9 +2319,9 @@ declare global {
2319
2319
 
2320
2320
  // Register the web component
2321
2321
  customElements.define('${J}', ${H});
2322
- `}var C5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function S5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function QY($,Z,J={}){let X={...C5,...J},Y=S5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return zY($,X.prefix||Z,X.preserveOriginal);case"attribute":return GY($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return KY($,Z,X.preserveOriginal);default:return $}}function GY($,Z,J,X){let Y=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${Y}`:`${G}${Y}`}${z}`})}function zY($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Y)=>{if(Y.startsWith(Z))return X;let Q=`${Z}__${Y}`;return J?`.${Q}`:`.${Q}`})}function KY($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return Y}let G=`${X}__${Q}`;return J?`.${G}`:`.${G}`})}function qY($,Z,J={}){let X={...C5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=S5(Z),G=`${X.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,K,q)=>{if(/^(?:script|style|!--)$/i.test(K))return z;let H=q.trimEnd().endsWith("/"),W=H?q.slice(0,-1):q;return`<${K}${W} ${G}${H?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Y=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((K)=>{if(!K)return K;if(K.startsWith(Y))return K;return`${Y}__${K}`}).join(" ")}"`})}return $}function bH($,Z={}){let J={...C5,...Z},X=S5($);return`${J.attributeName||"data-v"}-${X}`}function yH($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,K)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${QY(K,Z,J)}
2322
+ `}var C5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function S5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function GY($,Z,J={}){let X={...C5,...J},Y=S5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return KY($,X.prefix||Z,X.preserveOriginal);case"attribute":return zY($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return qY($,Z,X.preserveOriginal);default:return $}}function zY($,Z,J,X){let Y=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${Y}`:`${G}${Y}`}${z}`})}function KY($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Y)=>{if(Y.startsWith(Z))return X;let Q=`${Z}__${Y}`;return J?`.${Q}`:`.${Q}`})}function qY($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return Y}let G=`${X}__${Q}`;return J?`.${G}`:`.${G}`})}function WY($,Z,J={}){let X={...C5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=S5(Z),G=`${X.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,K,q)=>{if(/^(?:script|style|!--)$/i.test(K))return z;let H=q.trimEnd().endsWith("/"),W=H?q.slice(0,-1):q;return`<${K}${W} ${G}${H?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Y=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((K)=>{if(!K)return K;if(K.startsWith(Y))return K;return`${Y}__${K}`}).join(" ")}"`})}return $}function yH($,Z={}){let J={...C5,...Z},X=S5($);return`${J.attributeName||"data-v"}-${X}`}function CH($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,K)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${GY(K,Z,J)}
2323
2323
  `;else X+=`${K}
2324
- `;return""});return{html:qY(Y,Z,J),css:X.trim()}}function h1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function CH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:H={},state:W={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||h1(T)),V=j.map((T)=>{let N=z[T],I=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
2324
+ `;return""});return{html:WY(Y,Z,J),css:X.trim()}}function h1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function SH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:H={},state:W={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||h1(T)),V=j.map((T)=>{let N=z[T],I=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
2325
2325
  `),F=j.map((T)=>{let N=z[T],I=N.attribute!==!1?N.attribute||h1(T):null,E=N.reflect&&I?`
2326
2326
  if (value !== null && value !== undefined) {
2327
2327
  ${N.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
@@ -2523,7 +2523,7 @@ customElements.define('${J}', ${U});
2523
2523
  // Export for module usage
2524
2524
  export { ${U} };
2525
2525
  export default ${U};
2526
- `}function SH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:H={},state:W={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((N)=>z[N].attribute!==!1).map((N)=>z[N].attribute||h1(N)),V=(N)=>{switch(N){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},F=j.length>0?`
2526
+ `}function PH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:H={},state:W={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((N)=>z[N].attribute!==!1).map((N)=>z[N].attribute||h1(N)),V=(N)=>{switch(N){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},F=j.length>0?`
2527
2527
  /**
2528
2528
  * Props interface for ${Z}
2529
2529
  */
@@ -2775,7 +2775,7 @@ declare global {
2775
2775
  customElements.define('${J}', ${U});
2776
2776
 
2777
2777
  export default ${U};
2778
- `}function PH(){return`/**
2778
+ `}function vH(){return`/**
2779
2779
  * ReactiveElement Mixin
2780
2780
  * Adds reactive properties and lifecycle management to web components
2781
2781
  */
@@ -2897,7 +2897,7 @@ else {
2897
2897
 
2898
2898
  export { ReactiveElement };
2899
2899
  export default ReactiveElement;
2900
- `}function vH(){return`/**
2900
+ `}function xH(){return`/**
2901
2901
  * stx Reactive Web Components Runtime
2902
2902
  * Provides base classes and utilities for reactive web components
2903
2903
  */
@@ -3114,7 +3114,7 @@ else {
3114
3114
  };
3115
3115
 
3116
3116
  })(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
3117
- `}function WY($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let W=X.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let U=W[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let V=U.match(/shadowDOM\s*:\s*(true|false)/);if(V)G=V[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=z?z[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),H=q?q[1].trim():"";return{tag:Y,props:Q,template:K,styles:H,script:X,shadowDOM:G}}function HY($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((W)=>`'${W}'`).join(", "),H=J.map((W)=>`
3117
+ `}function HY($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let W=X.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let U=W[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let V=U.match(/shadowDOM\s*:\s*(true|false)/);if(V)G=V[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=z?z[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),H=q?q[1].trim():"";return{tag:Y,props:Q,template:K,styles:H,script:X,shadowDOM:G}}function UY($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((W)=>`'${W}'`).join(", "),H=J.map((W)=>`
3118
3118
  get ${W}() {
3119
3119
  return this.getAttribute('${W}') || '';
3120
3120
  }
@@ -3165,12 +3165,12 @@ ${H}
3165
3165
  }
3166
3166
 
3167
3167
  customElements.define('${Z}', ${G});
3168
- `}async function m4($,Z,J,X){if(Z.length<1)return D0("WebComponent","@webcomponent directive requires at least the tag name parameter",R0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=x0.isAbsolute(G)?[x0.join(G,`${Y}.stx`),x0.join(x0.dirname(X),`${Y}.stx`)]:[x0.join(x0.dirname(X),G,`${Y}.stx`),x0.join(process.cwd(),G,`${Y}.stx`),x0.join(x0.dirname(X),`${Y}.stx`)],K=null;for(let W of z)if(await t(W)){K=await Bun.file(W).text();break}if(!K)return D0("WebComponent",`Component file not found: ${Y}.stx`,R0.FILE_NOT_FOUND);let q=WY(K,Y);return`<script type="module">
3169
- ${HY(q)}
3170
- </script>`}var P5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:p4,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:w4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:m4,hasEndTag:!1,description:"Include a web component in the template"},l4,c4,r4,a4,B5,L5,O5,V5,L4,Q4,C4,y5,...t4],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 jY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(U9.existsSync(Q)&&U9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(U9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var d4=new Set,j9=["partialsDir","componentsDir","layoutsDir"],v5=new WeakMap;function BY($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function VY($,Z){let J=!$.root,X=jY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!d4.has(Y))d4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!v5.has($)){let Y={};for(let Q of j9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}v5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of j9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||BY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of j9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function LY($,Z){let J=v5.get($);for(let X of j9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(U9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function OY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function FY($){if(i4($.stateDir),$.stateDir=n4(),$.cachePath=_2($.cachePath),$.build)$.build.cacheDir=_2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=_2($.media.cache.directory);if($.story)$.story.outDir=_2($.story.outDir)}var G1=null,F1=new Map,q9=new Map,w2=null;async function x5($){let Z=$?S0.resolve($):process.cwd(),J=q9.get(Z);if(J&&J.signature!==W9(J.graph)){let Q=F1.get(Z);if(F1.delete(Z),q9.delete(Z),!$)G1=null,w2=null;let{clearComponentCache:G}=await import("./chunk-k11m8bez.js"),{partialsCache:z}=await import("./chunk-qj8jfkst.js");if(G(),z.clear(),Q&&J.configSignature===H9(J.graph)){let K=Q.then(async(q)=>{let H={...J.graph};await o4(H,Z),q9.set(Z,{graph:H,signature:W9(H),configSignature:H9(H)});let W={...q,_layerGraph:H};if(!$)G1=W;return W});return F1.set(Z,K),K}}if(!$){if(G1)return G1;if(w2)return w2}let X=F1.get(Z);if(X)return X;let Y=(async()=>{let G=(await UY({name:"stx",alias:"ui",cwd:Z,defaultConfig:P5,verbose:!1})).config;if(G.extends!==void 0||J){let H=await s4(Z,P5);G=H.config,q9.set(Z,{graph:H.graph,signature:W9(H.graph),configSignature:H9(H.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zd172hvg.js");H(G.runtimeConfig,{});let{generateRuntimeConfigTypes:W}=await import("./chunk-6ec0dk8n.js");await W(Z,G.runtimeConfig)}OY(G),FY(G),VY(G,Z),LY(G,Z);let z=[],K=new Set((G.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of G.componentPackages??["@stacksjs/components"]){let W=`${H}/stx-plugin`;if(K.has(W)||K.has(H))continue;try{x.resolve(W,{paths:[Z]}),z.push(W)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:H}=await import("./chunk-ct8tvahc.js"),W=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=S0.dirname(L)}catch{let L=S0.resolve(Z,B);F=await import(L),O=S0.dirname(L)}let _=F.default||F;if(!H.has(_.name))await H.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)W.push(S0.resolve(O,w))}if(_.pages){let L=S0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,D)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=D},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=W,G._pluginPageDirs=U}return G})();if(F1.set(Z,Y),Y.catch(()=>{if(F1.get(Z)===Y)F1.delete(Z)}),!$)w2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var e4=new Proxy(P5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!w2)x5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function tH($){return $}function eH($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var g5=new Map;async function RY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await _Y.promises.stat($)).mtime.getTime();if(Z.cache&&g5.has($)){let W=g5.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=F4(Y),z=Z.markdown||e4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=L2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await DY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:q,data:Q||{}};if(Z.cache)g5.set($,{...H,updatedAt:X});return H}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var B9=null;async function DY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!B9)try{B9=await wY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,H)=>{let W=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!B9.getSupportedLanguages().includes(U))return z;return(await B9.highlight(W,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,H,W]=z,U=await Y(K,q,H,W);Q=Q.replace(K,U)}return Q}async function $7($,Z,J="",X={}){return await NY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let H=z;if(!f5.isAbsolute(z))H=f5.resolve(f5.dirname(J),z);let W={};if(K)try{try{W=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let D=L.substring(0,w).trim(),R=L.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);W[D]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await RY(H,X),B={...Z,...j,...W},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(H){let W=H instanceof Error?H.message:String(H);return O0("Markdown File",`Error including markdown file: ${W}`,J,$,q,G)}})}async function NY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((H)=>({match:z,replacement:H,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=MY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function MY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=N0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function AY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),H=K?K.index:1/0,W=q?q.index:1/0;if(H<W)Y++,Q=H+K[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+q[0].length}else break}return-1}function Z7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H="if",W=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(AY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}H="elseif",W=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q}),H="else",W=void 0,q+=5,U=q;continue}}q++}return K.push({type:H,condition:W,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function R2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=Z7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function V9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=N0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let H=$.slice(K+1,q),W=q+1,U=_1($,Z,J,W);if(U===-1){Q=Y.exec($);continue}let j=$.slice(W,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:H,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function h5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H=null,W=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(W++,H)H.content+=j[0];q+=j[0].length;continue}if(B){if(W--,H)H.content+=B[0];q+=B[0].length;continue}if(W>0){if(H)H.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(H)K.push(H);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}H={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(H)K.push(H);H={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(H)H.content+=z[q];q++}}if(H)K.push(H);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function TY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,H=kY($,q,K);if(H===-1){J=G+1;continue}let W=$.slice(q,H).trim(),U=H+K.length;Z.push({fullMatch:$.slice(G,U),expression:W,start:G,end:U,isRaw:Q}),J=U}return Z}function kY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function EY($){let Z=m5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=bY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function bY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=N0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=Y7(G);return{name:X,args:z}}function Y7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function yY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=N0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function CY($){let Z=[],X=new u5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let W=Y<X.length?X[Y].start:$.length,U=J7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:H,value:$.slice(W,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let H=q.start,W=q.value==="{"?"}":"]",U=N0($,q.value,W,H);if(U!==-1){let j=$.slice(H,U+1);if(Y=X7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=J7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;Y++;let W=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){W=X[Y].start;break}Y++}if(W!==-1){let U=N0($,"{","}",W);if(U!==-1)Z.push({type:"function",name:H,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=X7(X,U+1)}}}else Y++}return Z}function J7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function X7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function SY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=h5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",H=!1;for(let W of z.cases)if(W.type==="default"){if(!H)q=W.content.trim()}else try{let U;if(W.value&&B0(W.value))U=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)U=X0(W.value,Z);if(K===U){q=W.content.trim(),H=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),H=D0("Switch",`Error evaluating @switch expression: ${q}`,R0.EVALUATION_ERROR);X=X.substring(0,G)+H+X.substring(z.end);break}}return X}function PY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function vY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=PY($);return vY(xY(X,Z,J),Y)}function xY($,Z,J){let X=$;X=SY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,H=_1(X,"unless","endunless",q);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=X.slice(q,H),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(W))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(W))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(W))!==null)L.push({pos:w.index,type:"else"});L.sort((D,R)=>D.pos-R.pos);for(let D of L)if(D.type==="open")V++;else if(D.type==="close")V--;else if(D.type==="else"&&V===0){j=D.pos;break}}let B;if(j!==-1){let V=W.slice(0,j),F=W.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${W}@endif`;X=X.substring(0,z)+B+X.substring(H+10),Q=!0}}X=l5(X,Z,J),X=c5(X,Z,J),X=d5(X,Z);let Y=()=>{let Q=R2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let H=Q[q];try{let W="",U=!1;for(let j of H.branches){if(U)break;if(j.type==="else")W=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)W=j.content,U=!0}catch(B){W=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,R0.EVALUATION_ERROR),U=!0}}G[q]=W}catch(W){let U=W instanceof Error?W.message:String(W);G[q]=D0("If",`Error processing @if block: ${U}`,R0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let H=Q[q];z[q*2]=X.slice(K,H.start),z[q*2+1]=G[q],K=H.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function Q7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function d5($,Z){let J=$;function X(z,K,q,H){let W=1,U=H,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&W>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)W++,U=O+V[0].length;else if(_<1/0){if(W--,W===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let H=0,W=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=W.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")H++;else if(F.type==="close")H--;else if(F.type==="else"&&H===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+5),j=Q7(U);if(j)H=j.value,W=q+5+j.consumed;else W=q+5;let B=X(J,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=H?z1(`auth?.check && auth?.user?.[${H}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+6),j=Q7(U);if(j)H=j.value,W=q+6+j.consumed;else W=q+6;let B=X(J,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=H?z1(`!auth?.check || !auth?.user?.[${H}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[z];if(K)H.push(K);if(q){let W=z1(q,Z);H.push(W)}return Z.permissions.check(...H)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let W=J.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let U=W.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),D=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],N;while((N=w.exec(O))!==null)T.push({pos:N.index,type:"open"});while((N=D.exec(O))!==null)T.push({pos:N.index,type:"close"});while((N=R.exec(O))!==null)T.push({pos:N.index,type:"elseDirective"});while((N=M.exec(O))!==null)T.push({pos:N.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){L++;continue}if(y.type==="close"){L--;continue}if(L===0)_.push(y)}let I=[],E=0;for(let y=0;y<_.length;y++){let b=_[y];if(I.push({content:O.slice(E,b.pos),ability:void 0}),b.type==="elseDirective"){let P=O.slice(b.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(E,b.pos)},E=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[y+1],u=p?p.pos:O.length;I.push({content:O.slice(E,u),ability:h.ability,type:h.type,id:h.id}),E=u}}else E=b.pos+5}if(E<O.length){let y=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(E)})}let A=Q(B.ability,B.type,B.id),k=z==="can"?A:!A,C="";if(k)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,U)+C+J.substring(F+`@${K}`.length),H=!0}}return J}function l5($,Z,J){let X=$;function Y(Q,G,z,K,q){let H=!0;while(H){H=!1;let W=new RegExp(`@${G}\\s*\\(`),U=Q.match(W);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=_1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,D=0;while(D<O.length){let R=O.indexOf("@",D);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,D=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,D=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}D=R+1}try{let R=K(_.trim()),M;if(L!==-1){let T=O.slice(0,L),N=O.slice(L+5);M=R?T:N}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(F+`@${z}`.length),H=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,R0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function c5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let H=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,H.lastIndex=0;let F=H.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,D=-1;while(L>0&&w<B.length){H.lastIndex=w,W.lastIndex=w;let A=H.exec(B),k=W.exec(B),C=A?A.index:1/0,y=k?k.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){D=y;break}w=y+k[0].length}else break}if(D===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(_,D),M=-1,T=0,N=0;while(N<R.length){let A=R.indexOf("@",N);if(A===-1)break;let k=R.substring(A);if(U.test(k)){T++,N=A+1;continue}if(j.test(k)){T--,N=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(k)){M=A;break}N=A+1}let I;if(M!==-1){let A=R.slice(0,M),k=R.slice(M+5);I=q?A:k}else I=q?R:"";let E=`@${K}`.length;B=B.substring(0,O)+I+B.substring(D+E),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var p5=new WeakMap;function G7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function w1($,Z){if(!$)return Z?.nonceGenerator?.()??G7();let J=p5.get($);if(!J)J=Z?.nonceGenerator?.()??G7(),p5.set($,J);return J}function AU($){p5.delete($)}function z7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function n5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${z7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var fY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},i5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},gY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},hY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function IU($){return{enabled:!0,directives:{strict:fY,moderate:i5,relaxed:gY,api:hY}[$]||i5,useNonce:$==="strict",addMetaTag:!0}}function TU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function K7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?w1(J,Z):void 0,Y=n5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3171
- ${Y}`)}function q7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function W7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?w1(Z,Q):void 0;return n5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return w1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=w1(Z,Q);return Y}var uY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?w1(J,Q):void 0;return n5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},mY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return w1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function kU(){return[uY,mY]}function EU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function dY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function bU($,Z){if(!$.enabled)return{};let J=$.useNonce?w1(Z,$):void 0,X=z7($.directives,J);return{[dY($.reportOnly)]:X}}var yU={enabled:!1,reportOnly:!1,directives:i5,useNonce:!1,addMetaTag:!0};import lY from"crypto";var cY=40,H7="_token",s5=null;function pY($=cY){let Z=lY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return s5=Z,Z}function iY(){if(!s5)pY();return s5}function nY($=H7){let Z=iY();return`<input type="hidden" name="${$}" value="${Z}">`}function U7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return nY(X||H7)})}async function V7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await sY(Y,Q,Z,J,X);else Y=await oY(Y,Q,Z,J,X)}return Y}async function sY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,H=R1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),W=[],U=H.exec(q);while(U!==null){let[j,B="",V=""]=U,F=U.index||0;try{let O=B?L7(Z,B):[],_=V.trim(),L=await G(_,O,J,X);W.push({original:j,processed:L,startIndex:F})}catch(O){let _=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:j,processed:D0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${_}`,R0.EVALUATION_ERROR),startIndex:F})}U=H.exec(q)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:V}=W[j];q=q.replace(B,V)}return q}async function oY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of j7(z,R1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=R1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=L7(Z,j),F=await G("",V,J,X);K.push({original:U,processed:F,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}(${j}): ${F}`,R0.EVALUATION_ERROR),startIndex:B})}let H=R1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),W=H.exec(z);while(W!==null){let[U]=W,j=W.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}: ${V}`,R0.EVALUATION_ERROR),startIndex:j})}W=H.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function L7($,Z){return $.rawParams?B7(Z):rY(Z)}function rY($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var O7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,F7=/^[A-Za-z_$][\w$]*$/,aY=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function tY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(J.key,"appearance.key"),D1(J.attribute,"appearance.attribute"),D1(J.default,"appearance.default"),D1(X.key,"colorMode.key"),D1(X.attribute,"colorMode.attribute"),D1(X.default,"colorMode.default"),!F7.test(J.key)||!F7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!O7.test(J.attribute)||!O7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!aY.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function eY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $Q($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${eY($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function ZQ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function _7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=ZQ(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=X0(`(${z})`,Z),q=$Q(tY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import JQ from"crypto";function M0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var r5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function XQ($){return{...r5,...$.forms?.classes}}function L9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function f0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function u1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${M0(Z)}"`}function o5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${M0(`${f0($)}-error`)}"`;return X}function YQ(){return JQ.randomUUID()}function lU($,Z,J,X){let Y=XQ(X),Q=$;return Q=GQ(Q,Z),Q=M2(Q,Z),Q=a5(Q,Z,Y),Q=t5(Q,Z,Y),Q}function M2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=YQ();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${M0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${M0(Q)}">`;return X}),J}function a5($,Z,J=r5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let H=Q||G||"POST",W=z||K||"",U=q1(q),j=H.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${M0(B)}" action="${M0(W)}"${U?` ${U}`:""}>`;if(V+=`
3168
+ `}async function d4($,Z,J,X){if(Z.length<1)return D0("WebComponent","@webcomponent directive requires at least the tag name parameter",R0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=x0.isAbsolute(G)?[x0.join(G,`${Y}.stx`),x0.join(x0.dirname(X),`${Y}.stx`)]:[x0.join(x0.dirname(X),G,`${Y}.stx`),x0.join(process.cwd(),G,`${Y}.stx`),x0.join(x0.dirname(X),`${Y}.stx`)],K=null;for(let W of z)if(await t(W)){K=await Bun.file(W).text();break}if(!K)return D0("WebComponent",`Component file not found: ${Y}.stx`,R0.FILE_NOT_FOUND);let q=HY(K,Y);return`<script type="module">
3169
+ ${UY(q)}
3170
+ </script>`}var P5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:i4,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:R4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:d4,hasEndTag:!1,description:"Include a web component in the template"},c4,p4,a4,t4,B5,L5,O5,V5,O4,G4,S4,y5,...e4],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 BY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(U9.existsSync(Q)&&U9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(U9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var l4=new Set,j9=["partialsDir","componentsDir","layoutsDir"],v5=new WeakMap;function VY($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function LY($,Z){let J=!$.root,X=BY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!l4.has(Y))l4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!v5.has($)){let Y={};for(let Q of j9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}v5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of j9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||VY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of j9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function OY($,Z){let J=v5.get($);for(let X of j9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(U9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function FY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function _Y($){if(n4($.stateDir),$.stateDir=s4(),$.cachePath=_2($.cachePath),$.build)$.build.cacheDir=_2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=_2($.media.cache.directory);if($.story)$.story.outDir=_2($.story.outDir)}var G1=null,F1=new Map,q9=new Map,w2=null;async function x5($){let Z=$?S0.resolve($):process.cwd(),J=q9.get(Z);if(J&&J.signature!==W9(J.graph)){let Q=F1.get(Z);if(F1.delete(Z),q9.delete(Z),!$)G1=null,w2=null;let{clearComponentCache:G}=await import("./chunk-eja82tav.js"),{partialsCache:z}=await import("./chunk-cpjqmg8e.js");if(G(),z.clear(),Q&&J.configSignature===H9(J.graph)){let K=Q.then(async(q)=>{let H={...J.graph};await r4(H,Z),q9.set(Z,{graph:H,signature:W9(H),configSignature:H9(H)});let W={...q,_layerGraph:H};if(!$)G1=W;return W});return F1.set(Z,K),K}}if(!$){if(G1)return G1;if(w2)return w2}let X=F1.get(Z);if(X)return X;let Y=(async()=>{let G=(await jY({name:"stx",alias:"ui",cwd:Z,defaultConfig:P5,verbose:!1})).config;if(G.extends!==void 0||J){let H=await o4(Z,P5);G=H.config,q9.set(Z,{graph:H.graph,signature:W9(H.graph),configSignature:H9(H.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zd172hvg.js");H(G.runtimeConfig,{});let{generateRuntimeConfigTypes:W}=await import("./chunk-dhj6zfzc.js");await W(Z,G.runtimeConfig)}FY(G),_Y(G),LY(G,Z),OY(G,Z);let z=[],K=new Set((G.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of G.componentPackages??["@stacksjs/components"]){let W=`${H}/stx-plugin`;if(K.has(W)||K.has(H))continue;try{x.resolve(W,{paths:[Z]}),z.push(W)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:H}=await import("./chunk-ct8tvahc.js"),W=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=S0.dirname(L)}catch{let L=S0.resolve(Z,B);F=await import(L),O=S0.dirname(L)}let _=F.default||F;if(!H.has(_.name))await H.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)W.push(S0.resolve(O,w))}if(_.pages){let L=S0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,D)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=D},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=W,G._pluginPageDirs=U}return G})();if(F1.set(Z,Y),Y.catch(()=>{if(F1.get(Z)===Y)F1.delete(Z)}),!$)w2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var $7=new Proxy(P5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!w2)x5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function eH($){return $}function $U($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var g5=new Map;async function DY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await wY.promises.stat($)).mtime.getTime();if(Z.cache&&g5.has($)){let W=g5.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=_4(Y),z=Z.markdown||$7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=L2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await NY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:q,data:Q||{}};if(Z.cache)g5.set($,{...H,updatedAt:X});return H}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var B9=null;async function NY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!B9)try{B9=await RY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,H)=>{let W=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!B9.getSupportedLanguages().includes(U))return z;return(await B9.highlight(W,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,H,W]=z,U=await Y(K,q,H,W);Q=Q.replace(K,U)}return Q}async function Z7($,Z,J="",X={}){return await MY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let H=z;if(!f5.isAbsolute(z))H=f5.resolve(f5.dirname(J),z);let W={};if(K)try{try{W=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let D=L.substring(0,w).trim(),R=L.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);W[D]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await DY(H,X),B={...Z,...j,...W},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(H){let W=H instanceof Error?H.message:String(H);return O0("Markdown File",`Error including markdown file: ${W}`,J,$,q,G)}})}async function MY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((H)=>({match:z,replacement:H,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=AY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function AY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=N0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function IY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),H=K?K.index:1/0,W=q?q.index:1/0;if(H<W)Y++,Q=H+K[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+q[0].length}else break}return-1}function J7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H="if",W=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(IY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}H="elseif",W=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q}),H="else",W=void 0,q+=5,U=q;continue}}q++}return K.push({type:H,condition:W,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function R2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=J7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function V9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=N0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let H=$.slice(K+1,q),W=q+1,U=_1($,Z,J,W);if(U===-1){Q=Y.exec($);continue}let j=$.slice(W,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:H,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function h5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H=null,W=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(W++,H)H.content+=j[0];q+=j[0].length;continue}if(B){if(W--,H)H.content+=B[0];q+=B[0].length;continue}if(W>0){if(H)H.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(H)K.push(H);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}H={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(H)K.push(H);H={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(H)H.content+=z[q];q++}}if(H)K.push(H);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function kY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,H=EY($,q,K);if(H===-1){J=G+1;continue}let W=$.slice(q,H).trim(),U=H+K.length;Z.push({fullMatch:$.slice(G,U),expression:W,start:G,end:U,isRaw:Q}),J=U}return Z}function EY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function bY($){let Z=m5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=yY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function yY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=N0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=Q7(G);return{name:X,args:z}}function Q7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function CY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=N0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function SY($){let Z=[],X=new u5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let W=Y<X.length?X[Y].start:$.length,U=X7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:H,value:$.slice(W,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let H=q.start,W=q.value==="{"?"}":"]",U=N0($,q.value,W,H);if(U!==-1){let j=$.slice(H,U+1);if(Y=Y7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=X7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;Y++;let W=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){W=X[Y].start;break}Y++}if(W!==-1){let U=N0($,"{","}",W);if(U!==-1)Z.push({type:"function",name:H,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=Y7(X,U+1)}}}else Y++}return Z}function X7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function Y7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function PY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=h5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",H=!1;for(let W of z.cases)if(W.type==="default"){if(!H)q=W.content.trim()}else try{let U;if(W.value&&B0(W.value))U=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)U=X0(W.value,Z);if(K===U){q=W.content.trim(),H=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),H=D0("Switch",`Error evaluating @switch expression: ${q}`,R0.EVALUATION_ERROR);X=X.substring(0,G)+H+X.substring(z.end);break}}return X}function vY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function xY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=vY($);return xY(fY(X,Z,J),Y)}function fY($,Z,J){let X=$;X=PY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,H=_1(X,"unless","endunless",q);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=X.slice(q,H),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(W))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(W))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(W))!==null)L.push({pos:w.index,type:"else"});L.sort((D,R)=>D.pos-R.pos);for(let D of L)if(D.type==="open")V++;else if(D.type==="close")V--;else if(D.type==="else"&&V===0){j=D.pos;break}}let B;if(j!==-1){let V=W.slice(0,j),F=W.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${W}@endif`;X=X.substring(0,z)+B+X.substring(H+10),Q=!0}}X=l5(X,Z,J),X=c5(X,Z,J),X=d5(X,Z);let Y=()=>{let Q=R2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let H=Q[q];try{let W="",U=!1;for(let j of H.branches){if(U)break;if(j.type==="else")W=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)W=j.content,U=!0}catch(B){W=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,R0.EVALUATION_ERROR),U=!0}}G[q]=W}catch(W){let U=W instanceof Error?W.message:String(W);G[q]=D0("If",`Error processing @if block: ${U}`,R0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let H=Q[q];z[q*2]=X.slice(K,H.start),z[q*2+1]=G[q],K=H.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function G7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function d5($,Z){let J=$;function X(z,K,q,H){let W=1,U=H,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&W>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)W++,U=O+V[0].length;else if(_<1/0){if(W--,W===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let H=0,W=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=W.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")H++;else if(F.type==="close")H--;else if(F.type==="else"&&H===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+5),j=G7(U);if(j)H=j.value,W=q+5+j.consumed;else W=q+5;let B=X(J,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=H?z1(`auth?.check && auth?.user?.[${H}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+6),j=G7(U);if(j)H=j.value,W=q+6+j.consumed;else W=q+6;let B=X(J,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=H?z1(`!auth?.check || !auth?.user?.[${H}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[z];if(K)H.push(K);if(q){let W=z1(q,Z);H.push(W)}return Z.permissions.check(...H)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let W=J.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let U=W.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),D=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],N;while((N=w.exec(O))!==null)T.push({pos:N.index,type:"open"});while((N=D.exec(O))!==null)T.push({pos:N.index,type:"close"});while((N=R.exec(O))!==null)T.push({pos:N.index,type:"elseDirective"});while((N=M.exec(O))!==null)T.push({pos:N.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){L++;continue}if(y.type==="close"){L--;continue}if(L===0)_.push(y)}let I=[],E=0;for(let y=0;y<_.length;y++){let b=_[y];if(I.push({content:O.slice(E,b.pos),ability:void 0}),b.type==="elseDirective"){let P=O.slice(b.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(E,b.pos)},E=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[y+1],u=p?p.pos:O.length;I.push({content:O.slice(E,u),ability:h.ability,type:h.type,id:h.id}),E=u}}else E=b.pos+5}if(E<O.length){let y=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(E)})}let A=Q(B.ability,B.type,B.id),k=z==="can"?A:!A,C="";if(k)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,U)+C+J.substring(F+`@${K}`.length),H=!0}}return J}function l5($,Z,J){let X=$;function Y(Q,G,z,K,q){let H=!0;while(H){H=!1;let W=new RegExp(`@${G}\\s*\\(`),U=Q.match(W);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=_1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,D=0;while(D<O.length){let R=O.indexOf("@",D);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,D=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,D=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}D=R+1}try{let R=K(_.trim()),M;if(L!==-1){let T=O.slice(0,L),N=O.slice(L+5);M=R?T:N}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(F+`@${z}`.length),H=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,R0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function c5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let H=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,H.lastIndex=0;let F=H.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,D=-1;while(L>0&&w<B.length){H.lastIndex=w,W.lastIndex=w;let A=H.exec(B),k=W.exec(B),C=A?A.index:1/0,y=k?k.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){D=y;break}w=y+k[0].length}else break}if(D===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(_,D),M=-1,T=0,N=0;while(N<R.length){let A=R.indexOf("@",N);if(A===-1)break;let k=R.substring(A);if(U.test(k)){T++,N=A+1;continue}if(j.test(k)){T--,N=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(k)){M=A;break}N=A+1}let I;if(M!==-1){let A=R.slice(0,M),k=R.slice(M+5);I=q?A:k}else I=q?R:"";let E=`@${K}`.length;B=B.substring(0,O)+I+B.substring(D+E),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var p5=new WeakMap;function z7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function w1($,Z){if(!$)return Z?.nonceGenerator?.()??z7();let J=p5.get($);if(!J)J=Z?.nonceGenerator?.()??z7(),p5.set($,J);return J}function IU($){p5.delete($)}function K7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function n5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${K7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var gY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},i5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},hY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},uY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function TU($){return{enabled:!0,directives:{strict:gY,moderate:i5,relaxed:hY,api:uY}[$]||i5,useNonce:$==="strict",addMetaTag:!0}}function kU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function q7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?w1(J,Z):void 0,Y=n5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3171
+ ${Y}`)}function W7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function H7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?w1(Z,Q):void 0;return n5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return w1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=w1(Z,Q);return Y}var mY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?w1(J,Q):void 0;return n5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},dY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return w1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function EU(){return[mY,dY]}function bU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function lY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function yU($,Z){if(!$.enabled)return{};let J=$.useNonce?w1(Z,$):void 0,X=K7($.directives,J);return{[lY($.reportOnly)]:X}}var CU={enabled:!1,reportOnly:!1,directives:i5,useNonce:!1,addMetaTag:!0};import cY from"crypto";var pY=40,U7="_token",s5=null;function iY($=pY){let Z=cY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return s5=Z,Z}function nY(){if(!s5)iY();return s5}function sY($=U7){let Z=nY();return`<input type="hidden" name="${$}" value="${Z}">`}function j7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return sY(X||U7)})}async function L7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await oY(Y,Q,Z,J,X);else Y=await rY(Y,Q,Z,J,X)}return Y}async function oY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,H=R1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),W=[],U=H.exec(q);while(U!==null){let[j,B="",V=""]=U,F=U.index||0;try{let O=B?O7(Z,B):[],_=V.trim(),L=await G(_,O,J,X);W.push({original:j,processed:L,startIndex:F})}catch(O){let _=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:j,processed:D0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${_}`,R0.EVALUATION_ERROR),startIndex:F})}U=H.exec(q)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:V}=W[j];q=q.replace(B,V)}return q}async function rY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of B7(z,R1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=R1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=O7(Z,j),F=await G("",V,J,X);K.push({original:U,processed:F,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}(${j}): ${F}`,R0.EVALUATION_ERROR),startIndex:B})}let H=R1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),W=H.exec(z);while(W!==null){let[U]=W,j=W.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}: ${V}`,R0.EVALUATION_ERROR),startIndex:j})}W=H.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function O7($,Z){return $.rawParams?V7(Z):aY(Z)}function aY($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var F7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,_7=/^[A-Za-z_$][\w$]*$/,tY=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function eY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(J.key,"appearance.key"),D1(J.attribute,"appearance.attribute"),D1(J.default,"appearance.default"),D1(X.key,"colorMode.key"),D1(X.attribute,"colorMode.attribute"),D1(X.default,"colorMode.default"),!_7.test(J.key)||!_7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!F7.test(J.attribute)||!F7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!tY.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function $Q($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ZQ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${$Q($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function JQ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function w7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=JQ(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=X0(`(${z})`,Z),q=ZQ(eY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import XQ from"crypto";function M0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var r5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function YQ($){return{...r5,...$.forms?.classes}}function L9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function f0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function u1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${M0(Z)}"`}function o5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${M0(`${f0($)}-error`)}"`;return X}function QQ(){return XQ.randomUUID()}function cU($,Z,J,X){let Y=YQ(X),Q=$;return Q=zQ(Q,Z),Q=M2(Q,Z),Q=a5(Q,Z,Y),Q=t5(Q,Z,Y),Q}function M2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=QQ();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${M0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${M0(Q)}">`;return X}),J}function a5($,Z,J=r5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let H=Q||G||"POST",W=z||K||"",U=q1(q),j=H.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${M0(B)}" action="${M0(W)}"${U?` ${U}`:""}>`;if(V+=`
3172
3172
  ${M2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
3173
- ${M2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let H=Q||G||"",W=z||K||"",U=q1(q),j=D2(H,Z),B=j!==void 0&&j!==null?j:W||"",V=U.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",O=N2(H,Z),_=U.match(/class=['"]([^'"]+)['"]/i),L=L9(_?_[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${M0(F)}" name="${M0(H)}"${u1(U,f0(H))} value="${M0(B)}" class="${L}"${o5(H,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=D2(Q,Z)||z.trim(),H=N2(Q,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=L9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${M0(Q)}"${u1(K,f0(Q))} class="${U}"${o5(Q,H,K)}${j?` ${j}`:""}>${M0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=D2(Q,Z),H=N2(Q,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=L9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${M0(Q)}"${u1(K,f0(Q))} class="${U}"${o5(Q,H,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?f0(Q):`${f0(Q)}-${f0(K)}`,H=q1(z),W=D2(Q,Z),U=W!==void 0&&(Array.isArray(W)?W.some((F)=>String(F)===K):W===!0||String(W)===K),j=H.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${M0(Q)}"${u1(H,q)} value="${M0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=D2(Q,Z),H=q!==void 0&&q===G,W=K.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${M0(Q)}"${u1(K,`${f0(Q)}-${f0(G)}`)} value="${M0(G)}" class="${U}"${H?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",H=z.includes("multiple"),W=N2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=L9(U?U[1]:"",J.input,W,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${M0(Q)}"${u1(z,f0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${M0(q)}"`);if(H)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),H=q?q[1]:J.label,W=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${M0(f0(Q))}" class="${H}"${W?` ${W}`:""}>${z}</label>`}),X}function t5($,Z,J=r5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(N2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return w7(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return w7(Y,Z)}let q=K.trim();if(B0(q)){let H=X0(q,Z);return H!==void 0?String(H):q}return q}catch{return K}});return`<div id="${M0(`${f0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function N2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function w7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function D2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var R7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function cU($,Z){R7[$]=Z}function e5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function QQ($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=e5(G),K=R7[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let H=`${$}_confirmation`;z.params=[X[H]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function pU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=QQ(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function GQ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=e5(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var D7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function iU($){D7[$.name]=$}function zQ($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=e5(Q),z=D7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function nU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=zQ($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function sU($,Z){let J=JSON.stringify(Z);return`
3173
+ ${M2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let H=Q||G||"",W=z||K||"",U=q1(q),j=D2(H,Z),B=j!==void 0&&j!==null?j:W||"",V=U.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",O=N2(H,Z),_=U.match(/class=['"]([^'"]+)['"]/i),L=L9(_?_[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${M0(F)}" name="${M0(H)}"${u1(U,f0(H))} value="${M0(B)}" class="${L}"${o5(H,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=D2(Q,Z)||z.trim(),H=N2(Q,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=L9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${M0(Q)}"${u1(K,f0(Q))} class="${U}"${o5(Q,H,K)}${j?` ${j}`:""}>${M0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=D2(Q,Z),H=N2(Q,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=L9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${M0(Q)}"${u1(K,f0(Q))} class="${U}"${o5(Q,H,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?f0(Q):`${f0(Q)}-${f0(K)}`,H=q1(z),W=D2(Q,Z),U=W!==void 0&&(Array.isArray(W)?W.some((F)=>String(F)===K):W===!0||String(W)===K),j=H.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${M0(Q)}"${u1(H,q)} value="${M0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=D2(Q,Z),H=q!==void 0&&q===G,W=K.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${M0(Q)}"${u1(K,`${f0(Q)}-${f0(G)}`)} value="${M0(G)}" class="${U}"${H?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",H=z.includes("multiple"),W=N2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=L9(U?U[1]:"",J.input,W,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${M0(Q)}"${u1(z,f0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${M0(q)}"`);if(H)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),H=q?q[1]:J.label,W=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${M0(f0(Q))}" class="${H}"${W?` ${W}`:""}>${z}</label>`}),X}function t5($,Z,J=r5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(N2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return R7(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return R7(Y,Z)}let q=K.trim();if(B0(q)){let H=X0(q,Z);return H!==void 0?String(H):q}return q}catch{return K}});return`<div id="${M0(`${f0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function N2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function R7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function D2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var D7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function pU($,Z){D7[$]=Z}function e5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function GQ($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=e5(G),K=D7[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let H=`${$}_confirmation`;z.params=[X[H]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function iU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=GQ(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function zQ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=e5(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var N7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function nU($){N7[$.name]=$}function KQ($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=e5(Q),z=N7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function sU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=KQ($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function oU($,Z){let J=JSON.stringify(Z);return`
3174
3174
  <script>
3175
3175
  (function() {
3176
3176
  const form = document.getElementById('${$}');
@@ -3222,19 +3222,19 @@ catch { return 'Please enter a valid URL'; } },
3222
3222
  }
3223
3223
  });
3224
3224
  })();
3225
- </script>`.trim()}var A2=/<\/?template\b[^>]*>/gi,KQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function qQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return KQ.test(Z)}function O9($){A2.lastIndex=0;let Z;while((Z=A2.exec($))!==null){if(Z[0].startsWith("</")||qQ(Z[0]))continue;let J=Z.index,X=A2.lastIndex,Y=1,Q;while((Q=A2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:A2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import K0 from"path";import{existsSync as lQ}from"fs";import F9 from"fs";import V0 from"path";var N7=new Map;function _9($,Z=!0){let J=N7.get($);if(Z&&J)return J;let X=new Map,Y=[V0.join($,"src"),V0.join($,"dist"),$];function Q(G,z){if(z>6)return;let K;try{K=F9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of K){let H=V0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(H,z+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!X.has(W))X.set(W,H);let U=W.toLowerCase();if(!X.has(U))X.set(U,H);let j=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,H)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)N7.set($,X);return X}function w9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=V0.join(J,"node_modules",$);try{if(F9.statSync(X).isDirectory())return X}catch{}let Y=V0.dirname(J);if(Y===J)return null;J=Y}}function R9($,Z,J={}){return[V0.resolve(V0.dirname(Z),`${$}.stx`),V0.resolve(V0.dirname(Z),$),V0.resolve(J.componentsDir||"components",`${$}.stx`),V0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function M7($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function $$($,Z){let[J,X,Y]=M7($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*Z$($,Z,J={},X){let Y=M7($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield V0.resolve(V0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((K)=>`${K}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[V0.join(V0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],V0.join(V0.dirname(Z),"components"),V0.resolve(G,"src/components"),V0.resolve(G,"components"),...import.meta.dir?[V0.resolve(import.meta.dir,"components")]:[]];for(let K of new Set(z)){for(let q of Q)yield V0.join(K,q);try{for(let q of F9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let H of Q)yield V0.join(K,q.name,H)}catch{}}}function A7($,Z,J={},X){let Y=$$($,X);if(Y!==void 0)return Y;for(let Q of Z$($,Z,J,X))try{if(F9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class I7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=$$($,X);if(Y!==void 0)return Y;for(let Q of Z$($,Z,J,X))if(await t(Q))return Q;return null}}var m1=new I7;function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var N1="\x00stx-boolean-attribute";function J$($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function d1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(I0(Q));continue}if(Y===N1){J.push(I0(Q));continue}J.push(`${I0(Q)}="${I0(J$(String(Y)))}"`)}return J}function l1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(I0(Q));continue}if(typeof Y==="object")continue;J.push(`${I0(Q)}="${I0(J$(String(Y)))}"`)}return J}function c1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WQ($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var X$={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=WQ($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,K=[];if(X.reactive)K.push(`:href="${c1(X.value)}"`);else K.push(`href="${c1(q2(X.value,"navigable"))}"`);if(Y)K.push(`class="${c1(Y)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${c1(Q)}"`),K.push(`data-stx-exact-active-class="${c1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${c1(q)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...d1($,H)),K.push(...l1($,H)),`<a ${K.join(" ")}>${Z}</a>`}};import p1 from"fs";import Y$ from"path";var HQ=new Set([".jpg",".jpeg",".png",".webp",".avif"]),n0=new Map,M1=!1;function Q$($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return n0.get(Z)}function Vj(){return M1}function Lj(){n0.clear(),M1=!1}function Oj($,Z){n0.set($,Z),M1=!0}function UQ($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function jQ($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function BQ($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let K=Math.floor(z*Z/X),q=Math.max(K+1,Math.floor((z+1)*Z/X)),H=Math.floor(G*J/Y),W=Math.max(H+1,Math.floor((G+1)*J/Y)),U=0,j=0,B=0,V=0;for(let O=H;O<W;O++)for(let _=K;_<q;_++){let L=(O*Z+_)*4;U+=$[L],j+=$[L+1],B+=$[L+2],V++}let F=(O)=>Math.round(O/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(U)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function VQ($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function LQ($){try{return JSON.parse(p1.readFileSync($,"utf8"))}catch{return{}}}function OQ($,Z){try{p1.mkdirSync(Y$.dirname($),{recursive:!0}),p1.writeFileSync($,JSON.stringify(Z))}catch{}}function b7($,Z,J=[]){let X;try{X=p1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=Y$.join($,Y.name);if(Y.isDirectory()){b7(Q,`${Z}/${Y.name}`,J);continue}if(!HQ.has(Y$.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function Fj($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000,offThread:Q}=Z;if(!$||!p1.existsSync($))return M1=!0,n0.size;if(Q){let U=await E7("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Y}});if(U!==k7){for(let[j,B]of U.placeholders)n0.set(j,B);return M1=!0,n0.size}}let G;try{G=await import("ts-images")}catch{return M1=!0,n0.size}let z=J?LQ(J):{},K=!1,q=b7($,"").slice(0,Y),H=8,W=async([U,j])=>{let B;try{B=p1.statSync(j)}catch{return}if(B.size>X)return;let V=z[U];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let F=V.transparent;if(typeof F!=="boolean"&&T7(j)==="none")F=!1,z[U]={...V,transparent:F},K=!0;if(typeof F==="boolean"){n0.set(U,{dataUrl:V.dataUrl,color:V.color,transparent:F});return}}try{let{hash:F}=await G.generateThumbHash(j);if(!F)return;let{rgba:O,w:_,h:L}=G.thumbHashToRGBA(F),w={dataUrl:VQ(BQ(O,_,L)),color:jQ(O),transparent:UQ(O)};n0.set(U,w),z[U]={mtimeMs:B.mtimeMs,size:B.size,...w},K=!0}catch{}};for(let U=0;U<q.length;U+=H)await Promise.all(q.slice(U,U+H).map(W));if(J&&K)OQ(J,z);return M1=!0,n0.size}var FQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},G$=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function D9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function _Q($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function z$($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=FQ[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function K$($,Z,J,X){return Z.map((Y)=>`${I2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function wQ($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${I2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function I2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function RQ($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function DQ($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var q$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Y=y7(X),Q=E0($,"alt")||"",G=E0($,"width")||(Y?String(Y.source.width):void 0),z=E0($,"height")||(Y?String(Y.source.height):void 0),K=E0($,"sizes"),q=E0($,"srcset"),H=E0($,"densities"),W=E0($,"format"),U=C7(X)||Q$(X)?.transparent===!0,j=E0($,"placeholder")||(Y&&!U?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),F=E0($,"class")||E0($,"className")||"",O=E0($,"style")||"",_=E0($,"quality"),L=D9($,"lazy",!0),w=D9($,"preload",!1),D=D9($,"priority",!1),R=E0($,"loading"),M=E0($,"decoding")||"async",T=!!Y||D9($,"picture",!1)||!!W,N=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,E=q||"",A="";if(Y)E=Y.sources[Y.fallback.format]||"",A=K?z$(K):"100vw";else if(!E&&K&&V&&V!=="local"&&V!=="static")E=K$(X,G$,V,W),A=z$(K);else if(!E&&H){let e=H.split(/\s+/).map((Y0)=>Number.parseFloat(Y0.replace("x","")));E=wQ(X,e,N,V,W)}else if(K)A=z$(K);let k=[];if(O)k.push(O);if(N&&I)k.push(`aspect-ratio:${N}/${I}`);let C=[],y=j==="blur"||j==="color"||j==="thumbhash";if(y&&!U){let e=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:Q$(X);if(e&&j==="color")k.push(`background-color:${e.color}`),C.push("backgroundColor");else if(e)k.push(`background-color:${e.color}`),k.push(`background-image:url(${e.dataUrl})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundColor","backgroundImage");else{let Y0=DQ(N||16,I||9,B);k.push(`background-image:url(${Y0})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundImage")}}else if(!y&&j&&j!=="empty"&&j!=="none")k.push(`background-image:url(${F0(j)})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundImage");let b=Y?.fallback.url||I2(X,N,I,V,W),P=[];if(P.push(`src="${F0(q2(b,"fetched"))}"`),P.push(`alt="${F0(Q)}"`),G)P.push(`width="${F0(G)}"`);if(z)P.push(`height="${F0(z)}"`);let h=R||(D||w?"eager":L?"lazy":"");if(h)P.push(`loading="${F0(h)}"`);if(D)P.push('fetchpriority="high"');if(P.push(`decoding="${F0(M)}"`),F)P.push(`class="${F0(F)}"`);if(k.length>0)P.push(`style="${F0(k.join(";"))}"`);if(E)P.push(`srcset="${F0(q2(E,"fetched"))}"`);if(A)P.push(`sizes="${F0(A)}"`);let p=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(C.length>0){let e=typeof $.static.onload==="string"?$.static.onload:"",Y0=RQ(C)+(e?`;${e}`:"");P.push(`onload="${F0(Y0)}"`),p.add("onload")}P.push(...d1($,p)),P.push(...l1($,p));let u=`<img ${P.join(" ")} />`,r="";if(w){let Y0=W==="webp"?"image/webp":W==="avif"?"image/avif":"";r=`<link rel="preload" as="image" href="${F0(b)}"${Y0?` type="${Y0}"`:""}${E?` imagesrcset="${F0(E)}"`:""}${A?` imagesizes="${F0(A)}"`:""} />
3226
- `}if(T){let e=[];if(Y)for(let Y0 of _Q(Y))e.push(`<source type="image/${Y0.format}" srcset="${F0(Y0.srcset)}"${A?` sizes="${F0(A)}"`:""} />`);if(!Y&&(W==="avif"||W==="auto")){let Y0=I2(X,N,I,V,"avif"),i=E?K$(X,G$,V,"avif"):`${Y0}`;e.push(`<source type="image/avif" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}if(!Y&&(W==="webp"||W==="auto")){let Y0=I2(X,N,I,V,"webp"),i=E?K$(X,G$,V,"webp"):`${Y0}`;e.push(`<source type="image/webp" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}return`${r}<picture>
3225
+ </script>`.trim()}var A2=/<\/?template\b[^>]*>/gi,qQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function WQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return qQ.test(Z)}function O9($){A2.lastIndex=0;let Z;while((Z=A2.exec($))!==null){if(Z[0].startsWith("</")||WQ(Z[0]))continue;let J=Z.index,X=A2.lastIndex,Y=1,Q;while((Q=A2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:A2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import K0 from"path";import{existsSync as cQ}from"fs";import F9 from"fs";import V0 from"path";var M7=new Map;function _9($,Z=!0){let J=M7.get($);if(Z&&J)return J;let X=new Map,Y=[V0.join($,"src"),V0.join($,"dist"),$];function Q(G,z){if(z>6)return;let K;try{K=F9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of K){let H=V0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(H,z+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!X.has(W))X.set(W,H);let U=W.toLowerCase();if(!X.has(U))X.set(U,H);let j=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,H)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)M7.set($,X);return X}function w9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=V0.join(J,"node_modules",$);try{if(F9.statSync(X).isDirectory())return X}catch{}let Y=V0.dirname(J);if(Y===J)return null;J=Y}}function R9($,Z,J={}){return[V0.resolve(V0.dirname(Z),`${$}.stx`),V0.resolve(V0.dirname(Z),$),V0.resolve(J.componentsDir||"components",`${$}.stx`),V0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function A7($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function $$($,Z){let[J,X,Y]=A7($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*Z$($,Z,J={},X){let Y=A7($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield V0.resolve(V0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((K)=>`${K}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[V0.join(V0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],V0.join(V0.dirname(Z),"components"),V0.resolve(G,"src/components"),V0.resolve(G,"components"),...import.meta.dir?[V0.resolve(import.meta.dir,"components")]:[]];for(let K of new Set(z)){for(let q of Q)yield V0.join(K,q);try{for(let q of F9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let H of Q)yield V0.join(K,q.name,H)}catch{}}}function I7($,Z,J={},X){let Y=$$($,X);if(Y!==void 0)return Y;for(let Q of Z$($,Z,J,X))try{if(F9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class T7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=$$($,X);if(Y!==void 0)return Y;for(let Q of Z$($,Z,J,X))if(await t(Q))return Q;return null}}var m1=new T7;function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var N1="\x00stx-boolean-attribute";function J$($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function d1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(I0(Q));continue}if(Y===N1){J.push(I0(Q));continue}J.push(`${I0(Q)}="${I0(J$(String(Y)))}"`)}return J}function l1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(I0(Q));continue}if(typeof Y==="object")continue;J.push(`${I0(Q)}="${I0(J$(String(Y)))}"`)}return J}function c1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HQ($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var X$={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=HQ($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,K=[];if(X.reactive)K.push(`:href="${c1(X.value)}"`);else K.push(`href="${c1(q2(X.value,"navigable"))}"`);if(Y)K.push(`class="${c1(Y)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${c1(Q)}"`),K.push(`data-stx-exact-active-class="${c1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${c1(q)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...d1($,H)),K.push(...l1($,H)),`<a ${K.join(" ")}>${Z}</a>`}};import p1 from"fs";import Y$ from"path";var UQ=new Set([".jpg",".jpeg",".png",".webp",".avif"]),n0=new Map,M1=!1;function Q$($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return n0.get(Z)}function Lj(){return M1}function Oj(){n0.clear(),M1=!1}function Fj($,Z){n0.set($,Z),M1=!0}function jQ($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function BQ($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function VQ($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let K=Math.floor(z*Z/X),q=Math.max(K+1,Math.floor((z+1)*Z/X)),H=Math.floor(G*J/Y),W=Math.max(H+1,Math.floor((G+1)*J/Y)),U=0,j=0,B=0,V=0;for(let O=H;O<W;O++)for(let _=K;_<q;_++){let L=(O*Z+_)*4;U+=$[L],j+=$[L+1],B+=$[L+2],V++}let F=(O)=>Math.round(O/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(U)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function LQ($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function OQ($){try{return JSON.parse(p1.readFileSync($,"utf8"))}catch{return{}}}function FQ($,Z){try{p1.mkdirSync(Y$.dirname($),{recursive:!0}),p1.writeFileSync($,JSON.stringify(Z))}catch{}}function y7($,Z,J=[]){let X;try{X=p1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=Y$.join($,Y.name);if(Y.isDirectory()){y7(Q,`${Z}/${Y.name}`,J);continue}if(!UQ.has(Y$.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function _j($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000,offThread:Q}=Z;if(!$||!p1.existsSync($))return M1=!0,n0.size;if(Q){let U=await b7("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Y}});if(U!==E7){for(let[j,B]of U.placeholders)n0.set(j,B);return M1=!0,n0.size}}let G;try{G=await import("ts-images")}catch{return M1=!0,n0.size}let z=J?OQ(J):{},K=!1,q=y7($,"").slice(0,Y),H=8,W=async([U,j])=>{let B;try{B=p1.statSync(j)}catch{return}if(B.size>X)return;let V=z[U];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let F=V.transparent;if(typeof F!=="boolean"&&k7(j)==="none")F=!1,z[U]={...V,transparent:F},K=!0;if(typeof F==="boolean"){n0.set(U,{dataUrl:V.dataUrl,color:V.color,transparent:F});return}}try{let{hash:F}=await G.generateThumbHash(j);if(!F)return;let{rgba:O,w:_,h:L}=G.thumbHashToRGBA(F),w={dataUrl:LQ(VQ(O,_,L)),color:BQ(O),transparent:jQ(O)};n0.set(U,w),z[U]={mtimeMs:B.mtimeMs,size:B.size,...w},K=!0}catch{}};for(let U=0;U<q.length;U+=H)await Promise.all(q.slice(U,U+H).map(W));if(J&&K)FQ(J,z);return M1=!0,n0.size}var _Q={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},G$=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function D9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function wQ($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function z$($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=_Q[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function K$($,Z,J,X){return Z.map((Y)=>`${I2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function RQ($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${I2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function I2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function DQ($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function NQ($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var q$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Y=C7(X),Q=E0($,"alt")||"",G=E0($,"width")||(Y?String(Y.source.width):void 0),z=E0($,"height")||(Y?String(Y.source.height):void 0),K=E0($,"sizes"),q=E0($,"srcset"),H=E0($,"densities"),W=E0($,"format"),U=S7(X)||Q$(X)?.transparent===!0,j=E0($,"placeholder")||(Y&&!U?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),F=E0($,"class")||E0($,"className")||"",O=E0($,"style")||"",_=E0($,"quality"),L=D9($,"lazy",!0),w=D9($,"preload",!1),D=D9($,"priority",!1),R=E0($,"loading"),M=E0($,"decoding")||"async",T=!!Y||D9($,"picture",!1)||!!W,N=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,E=q||"",A="";if(Y)E=Y.sources[Y.fallback.format]||"",A=K?z$(K):"100vw";else if(!E&&K&&V&&V!=="local"&&V!=="static")E=K$(X,G$,V,W),A=z$(K);else if(!E&&H){let e=H.split(/\s+/).map((Y0)=>Number.parseFloat(Y0.replace("x","")));E=RQ(X,e,N,V,W)}else if(K)A=z$(K);let k=[];if(O)k.push(O);if(N&&I)k.push(`aspect-ratio:${N}/${I}`);let C=[],y=j==="blur"||j==="color"||j==="thumbhash";if(y&&!U){let e=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:Q$(X);if(e&&j==="color")k.push(`background-color:${e.color}`),C.push("backgroundColor");else if(e)k.push(`background-color:${e.color}`),k.push(`background-image:url(${e.dataUrl})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundColor","backgroundImage");else{let Y0=NQ(N||16,I||9,B);k.push(`background-image:url(${Y0})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundImage")}}else if(!y&&j&&j!=="empty"&&j!=="none")k.push(`background-image:url(${F0(j)})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat"),C.push("backgroundImage");let b=Y?.fallback.url||I2(X,N,I,V,W),P=[];if(P.push(`src="${F0(q2(b,"fetched"))}"`),P.push(`alt="${F0(Q)}"`),G)P.push(`width="${F0(G)}"`);if(z)P.push(`height="${F0(z)}"`);let h=R||(D||w?"eager":L?"lazy":"");if(h)P.push(`loading="${F0(h)}"`);if(D)P.push('fetchpriority="high"');if(P.push(`decoding="${F0(M)}"`),F)P.push(`class="${F0(F)}"`);if(k.length>0)P.push(`style="${F0(k.join(";"))}"`);if(E)P.push(`srcset="${F0(q2(E,"fetched"))}"`);if(A)P.push(`sizes="${F0(A)}"`);let p=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(C.length>0){let e=typeof $.static.onload==="string"?$.static.onload:"",Y0=DQ(C)+(e?`;${e}`:"");P.push(`onload="${F0(Y0)}"`),p.add("onload")}P.push(...d1($,p)),P.push(...l1($,p));let u=`<img ${P.join(" ")} />`,r="";if(w){let Y0=W==="webp"?"image/webp":W==="avif"?"image/avif":"";r=`<link rel="preload" as="image" href="${F0(b)}"${Y0?` type="${Y0}"`:""}${E?` imagesrcset="${F0(E)}"`:""}${A?` imagesizes="${F0(A)}"`:""} />
3226
+ `}if(T){let e=[];if(Y)for(let Y0 of wQ(Y))e.push(`<source type="image/${Y0.format}" srcset="${F0(Y0.srcset)}"${A?` sizes="${F0(A)}"`:""} />`);if(!Y&&(W==="avif"||W==="auto")){let Y0=I2(X,N,I,V,"avif"),i=E?K$(X,G$,V,"avif"):`${Y0}`;e.push(`<source type="image/avif" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}if(!Y&&(W==="webp"||W==="auto")){let Y0=I2(X,N,I,V,"webp"),i=E?K$(X,G$,V,"webp"):`${Y0}`;e.push(`<source type="image/webp" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}return`${r}<picture>
3227
3227
  ${e.join(`
3228
3228
  `)}
3229
3229
  ${u}
3230
- </picture>`}return`${r}${u}`}};var S7="/images/safe-image-default.svg";function T2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var NQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${S7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,W$={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=i1($,"src")||"",Y=i1($,"alt")||"",Q=i1($,"fallback")||S7,G=i1($,"class")||i1($,"className")||"",z=i1($,"fallbackClassName")||"",K=[];if(K.push(`src="${T2(X)}"`),K.push(`alt="${T2(Y)}"`),G)K.push(`class="${T2(G)}"`);if(K.push(`data-fallback="${T2(Q)}"`),z)K.push(`data-fallback-class="${T2(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...d1($,q)),K.push(...l1($,q));let H=`<img ${K.join(" ")} />`,W=J.context;if(!W.__safeImageHandlerEmitted)return W.__safeImageHandlerEmitted=!0,`${NQ}${H}`;return H}};function H$($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function k2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function N9($,Z,J){let X=k2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var U$={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=H$(k2($,"color")||"#6366f1"),Y=H$(k2($,"initialColor")||k2($,"initial-color")||""),Q=H$(k2($,"height")||"3px"),G=N9($,"duration",2000),z=N9($,"throttle",200),K=N9($,"zIndex",999999)||N9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
3230
+ </picture>`}return`${r}${u}`}};var P7="/images/safe-image-default.svg";function T2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var MQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${P7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,W$={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=i1($,"src")||"",Y=i1($,"alt")||"",Q=i1($,"fallback")||P7,G=i1($,"class")||i1($,"className")||"",z=i1($,"fallbackClassName")||"",K=[];if(K.push(`src="${T2(X)}"`),K.push(`alt="${T2(Y)}"`),G)K.push(`class="${T2(G)}"`);if(K.push(`data-fallback="${T2(Q)}"`),z)K.push(`data-fallback-class="${T2(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...d1($,q)),K.push(...l1($,q));let H=`<img ${K.join(" ")} />`,W=J.context;if(!W.__safeImageHandlerEmitted)return W.__safeImageHandlerEmitted=!0,`${MQ}${H}`;return H}};function H$($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function k2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function N9($,Z,J){let X=k2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var U$={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=H$(k2($,"color")||"#6366f1"),Y=H$(k2($,"initialColor")||k2($,"initial-color")||""),Q=H$(k2($,"height")||"3px"),G=N9($,"duration",2000),z=N9($,"throttle",200),K=N9($,"zIndex",999999)||N9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
3231
3231
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${q};z-index:${K};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3232
3232
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
3233
3233
  </div>
3234
3234
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3235
3235
  <script>
3236
3236
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
3237
- </script>`}};function v7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function MQ($,Z,J){let X=v7($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var P7={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},j$={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=I0(v7($,"position")||"top-right"),Y=MQ($,"max",5),Q=P7[X]||P7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3237
+ </script>`}};function x7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function AQ($,Z,J){let X=x7($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var v7={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},j$={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=I0(x7($,"position")||"top-right"),Y=AQ($,"max",5),Q=v7[X]||v7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3238
3238
  <style>
3239
3239
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3240
3240
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3242,7 +3242,7 @@ ${u}
3242
3242
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3243
3243
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3244
3244
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3245
- </style>`}};function M9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var x7={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},B$={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=M9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=I0(X),Q=M9($,"size")||"md",G=M9($,"closeOnBackdrop")!=="false",z=M9($,"closeOnEscape")!=="false",K=x7[Q]||x7.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
3245
+ </style>`}};function M9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var f7={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},B$={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=M9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=I0(X),Q=M9($,"size")||"md",G=M9($,"closeOnBackdrop")!=="false",z=M9($,"closeOnEscape")!=="false",K=f7[Q]||f7.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
3246
3246
  <div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
3247
3247
  <div style="padding:1.5rem">${Z}</div>
3248
3248
  </div>
@@ -3251,7 +3251,7 @@ ${u}
3251
3251
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3252
3252
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3253
3253
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3254
- </style>`}};function n1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var f7={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},V$={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=n1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=I0(X),Q=n1($,"side")||"right",G=n1($,"size")||"md",z=n1($,"closeOnBackdrop")!=="false",K=n1($,"closeOnEscape")!=="false",q=n1($,"overlay")!=="false",H=f7[G]||f7.md,W=Q==="left",U=W?"left:0":"right:0",j=W?"translateX(-100%)":"translateX(100%)",B=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3254
+ </style>`}};function n1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var g7={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},V$={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=n1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=I0(X),Q=n1($,"side")||"right",G=n1($,"size")||"md",z=n1($,"closeOnBackdrop")!=="false",K=n1($,"closeOnEscape")!=="false",q=n1($,"overlay")!=="false",H=g7[G]||g7.md,W=Q==="left",U=W?"left:0":"right:0",j=W?"translateX(-100%)":"translateX(100%)",B=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3255
3255
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${U};width:${H};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
3256
3256
  <div style="padding:1.5rem">${Z}</div>
3257
3257
  </div>
@@ -3260,7 +3260,7 @@ ${u}
3260
3260
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3261
3261
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3262
3262
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3263
- </style>`}};import{existsSync as AQ,readFileSync as IQ}from"fs";var A1=new Map,g7=new Set;function h7($){if(g7.has($))return;g7.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function u7($){let Z=process.cwd();for(let J of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(AQ(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function TQ($){if(A1.has($))return A1.get($);let Z=u7($);if(!Z)return h7($),null;try{let J=JSON.parse(IQ(Z,"utf8"));return A1.set($,J.icons),J.icons}catch{return null}}async function kQ($,Z=!1){if(A1.has($))return A1.get($);let J=u7($);if(!J){if(!Z)h7($);return null}try{let X=await Bun.file(J).json();return A1.set($,X.icons),X.icons}catch{return null}}function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var L$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=s1($,"name")??s1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let _=X.split(":");Y=_[0],Q=_[1]}let G=I0(s1($,"size")||"24"),z=I0(s1($,"color")||"currentColor"),K=I0(s1($,"class")||""),q=I0(s1($,"style")||""),H=A1.get(Y)??TQ(Y);if(!H)return`<!-- Icon: collection "${Y}" not loaded -->`;let W=H[Q];if(!W)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let U=W.width||24,j=W.height||24,B=`0 0 ${U} ${j}`,V=W.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let F=K?` class="${K}"`:"",O=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${O}>${V}</svg>`}};async function EQ($="lucide",Z={}){await kQ($,Z.speculative??!0)}function O$(){return`
3263
+ </style>`}};import{existsSync as IQ,readFileSync as TQ}from"fs";var A1=new Map,h7=new Set;function u7($){if(h7.has($))return;h7.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function m7($){let Z=process.cwd();for(let J of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(IQ(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function kQ($){if(A1.has($))return A1.get($);let Z=m7($);if(!Z)return u7($),null;try{let J=JSON.parse(TQ(Z,"utf8"));return A1.set($,J.icons),J.icons}catch{return null}}async function EQ($,Z=!1){if(A1.has($))return A1.get($);let J=m7($);if(!J){if(!Z)u7($);return null}try{let X=await Bun.file(J).json();return A1.set($,X.icons),X.icons}catch{return null}}function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var L$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=s1($,"name")??s1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let _=X.split(":");Y=_[0],Q=_[1]}let G=I0(s1($,"size")||"24"),z=I0(s1($,"color")||"currentColor"),K=I0(s1($,"class")||""),q=I0(s1($,"style")||""),H=A1.get(Y)??kQ(Y);if(!H)return`<!-- Icon: collection "${Y}" not loaded -->`;let W=H[Q];if(!W)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let U=W.width||24,j=W.height||24,B=`0 0 ${U} ${j}`,V=W.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let F=K?` class="${K}"`:"",O=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${O}>${V}</svg>`}};async function bQ($="lucide",Z={}){await EQ($,Z.speculative??!0)}function O$(){return`
3264
3264
  (function(){
3265
3265
  var tip=null,hideTimer=null,currentEl=null;
3266
3266
 
@@ -3363,9 +3363,9 @@ document.addEventListener("focusout",function(e){
3363
3363
  if(el) hideTip();
3364
3364
  });
3365
3365
  })();
3366
- `}function m7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function d7($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var F$={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=d7(Z,"fallback"),Y=X.rest,Q=d7(Y,"error"),G=Q.rest,z=X.region??m7($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??m7($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function A9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var _$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(A9($,"name")||"v").replace(/["'<>]/g,""),Y=(A9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=A9($,"class"),G=A9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function l7($=m1){$.registerBuiltin(X$),$.registerBuiltin(q$),$.registerBuiltin(W$),$.registerBuiltin(U$),$.registerBuiltin(j$),$.registerBuiltin(B$),$.registerBuiltin(V$),$.registerBuiltin(L$),$.registerBuiltin(F$),$.registerBuiltin(_$)}function I9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var c7=new Map;function bQ($){let Z=c7.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),c7.set($.source,Z);return Z}var p7=new WeakMap;function i7($){let Z=p7.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),p7.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function n7($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=bQ(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Y=G+1;continue}let q=K[1];if(Q&&Q(q)){let F=G+1+q.length;while(F<$.length&&$[F]!==">")F++;Y=F+1;continue}let H=G+1+q.length,W=null,U=H,j=-1,B=!1;while(H<$.length){let F=$[H];if(W){if(F==="\\"&&H+1<$.length){H+=2;continue}if(F===W)W=null;H++;continue}if(F==='"'||F==="'"){W=F,H++;continue}if(F==="/"&&H+1<$.length&&$[H+1]===">"){j=H+2,B=!0;break}if(F===">"){j=H+1;break}H++}if(j===-1){Y=G+1;continue}let V=$.slice(U,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:q,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let F=`<${q}`,O=`</${q}>`,_=1,L=j,w=-1;while(_>0&&L<$.length){let M=$.indexOf(F,L),T=$.indexOf(O,L);if(T===-1)break;if(M!==-1&&M<T){let N=$[M+F.length];if(N===" "||N===">"||N==="/"||N===`
3367
- `||N==="\t")_++;L=M+F.length}else{if(_--,_===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let D=$.slice(j,w),R=w+O.length;X.push({fullMatch:$.slice(G,R),tagName:q,attributes:V,content:D,startIndex:G,endIndex:R,isSelfClosing:!1}),Y=R}}return X}function s7($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function o7($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function w$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function r7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(w$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var yQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),CQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function R$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||CQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let H=1,W=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(H--,H===0){W=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))H++;Z.push([Q,W])}return Z}function t7($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>t7(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function e7($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...R$($));function G(W){return Y.some(([U,j])=>W>=U&&W<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,K=[],q=new Map,H=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let W=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,F=!1;while((B=j.exec(U))!==null){let O=B[1],_=B[2];if(a7(O))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),D=_.match(/^([a-zA-Z_$][\w$]*)/);if(D&&!L.includes(D[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(D[1]))continue;let R=JSON.stringify([L,_]),M=q.get(R);if(!M){if(M=Function(...L,`return (${_})`),q.size>=H)q.clear();q.set(R,M)}let T=M(...w);if(O==="class"){let N=t7(T);if(N){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${N}"`);else V=V.replace(B[0],` class="${N}"`)}else V=V.replace(B[0],"");F=!0;continue}if(yQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let N=String(T).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");V=V.replace(B[0],` ${O}="${N}"`)}F=!0}catch{continue}}if(F){let O=W.endsWith("/>")?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+W.length,replacement:L})}}if(K.length>0){let W=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:F}=K[j];W[j*2]=J.slice(U,B),W[j*2+1]=F,U=V}W[K.length*2]=J.slice(U),J=W.join("")}return J}import $6 from"fs";import Z6 from"path";var E2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function b2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...E2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return E2.has($)||/[A-Z]/.test($)}var J6=!1;function SQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(H)=>{if(Q.size===0)return!1;let W=z0(H),U=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Q.has(U))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},z=new Set(Q6),K=(H)=>{if(!H.includes("-")||H.startsWith("@")||H.startsWith(":")||H.startsWith("x-")||H.startsWith("__"))return H;if(H.startsWith("aria-")||H.startsWith("data-"))return H;return H.replace(/-([a-z0-9])/g,(W,U)=>U.toUpperCase())},q=(H,W)=>{let U=K(H);if(Y.static[U]=W,U!==H)Y.staticNames[U]=H};for(let[H,W]of Object.entries($)){let U=H.startsWith("x-")&&!z.has(H)&&!H.startsWith("x-bind:")&&!H.startsWith("x-on:")?`:${H.slice(2)}`:H;if(U.startsWith("@")){Y.events[U]=W;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=o7(W,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=W===N1?j:W;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!B0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=U0(B,V)(...Object.values(Z));if(O===void 0){let _=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(k9(B).some((w)=>!_.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=O,j!==U.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=U.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let j=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(B0(B)){let F=U0(B,Object.keys(Z))(...Object.values(Z));q(U,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,W)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,W)}else{let B=W,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(W))!==null)try{let O=F[1];if(!B0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=U0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,W===N1?"true":s7(W))}return Y}var PQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function vQ($,Z,J){if(!$.includes("@"))return $;if(!PQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,J)}catch{return $}}function xQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=w$($,J),J+=Q.length;let G=r7(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=N1}return Z}function X6($){return Object.entries($).map(([Z,J])=>J===N1?Z:`${Z}="${fQ(J)}"`).join(" ")}function fQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(m1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function hQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=Z6.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let W of $.matchAll(K)){let[U,j,B]=W,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,O,_=[];while((O=V.exec(B))!==null){let[L,w,D,R]=O,M=null,T=null;if(R.startsWith(".")||R.startsWith("/")){let E=Z6.resolve(G,R);if(E.endsWith(".stx"))T=E;else{let A=`${E}.stx`;try{if($6.statSync(A).isFile())T=A}catch{try{if($6.statSync(E).isDirectory())M=E}catch{}}}}else M=w9(R,G);if(!M&&!T)continue;let N=!1,I=(E,A)=>{Q.set(E,A),Q.set(E.toLowerCase(),A);let k=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(k,A),Y.add(A)};if(D&&T)I(D,T),N=!0;else if(w){let E=w.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let C=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C)return{source:C[1],local:C[2]};return{source:k,local:k}}),A=M?_9(M):null;for(let{source:k,local:C}of E){let y=null;if(T)y=T;else if(A)y=A.get(k)??A.get(k.toLowerCase())??A.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(y)I(C,y),N=!0}}if(N)_.push({start:O.index,end:O.index+L.length})}if(_.length===0)continue;for(let L=_.length-1;L>=0;L--)F=F.slice(0,_[L].start)+F.slice(_[L].end);z.push({start:W.index,end:W.index+U.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let q=[],H=0;for(let W of z)q.push($.slice(H,W.start),W.value),H=W.end;return q.push($.slice(H)),q.join("")}async function uQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,H]=K,W=H.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of W){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,_=R9(U,J,X);for(let L of _)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(F,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function mQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let H=q.index,W=H+q[0].length-1,U=1,j=W+1;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Q.substring(W+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){K.lastIndex=0;continue}let O=F[1],_,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)_=L.slice(w[0].length).trim();let D={};if(_)try{D=d0(_,Z)}catch(E){let A=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(H,V),`[Error parsing component props: ${A}]`);continue}let R="",M=V,N=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(N)R=N[1].trim(),M=V+N[0].length;let I=await I1(O,D,R,G,Z,J,X,z,Y);Q=Q.substring(0,H)+I+Q.substring(M),K.lastIndex=0}return Q}async function dQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=u0(Q);Q=K.output;let q=R$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,i7(E2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,E2),Q=K.restore(Q),Q;async function j(B,V,F,O){if(!B)return B;let _=B,L=n7(_,V,O),w=new Map;for(let M=L.length-1;M>=0;M--){let T=L[M],N=F?I9(T.tagName):T.tagName,I=xQ(vQ(T.attributes,Z,J)),E=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=SQ(I,Z,X,E),k=m1.getBuiltin(T.tagName),C=k?await T9(N,G,Z,J,X):!1;if(k&&!C){let h={context:Z,filePath:J,options:X,dependencies:Y},p=k.render(A,T.content,h);if(Object.keys(A.events).length>0){let u=X6(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${u}`)}if(Object.keys(A.clientReactive).length>0)p=Y6(p,A.clientReactive);w.set(M,p);continue}if(!F&&T.tagName.includes("-")&&!await T9(N,G,Z,J,X))continue;let y={};for(let[h,p]of Object.entries(A.static))y[h]=p;for(let[h,p]of Object.entries(A.serverDynamic))y[h]=p;let P=await I1(N,y,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=G6(P);if(h){let p=X6(A.events),u=Object.keys(A.events).map((r)=>r.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${u}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=Y6(P,A.clientReactive);w.set(M,P)}if(w.size===0)return _;let D="",R=0;for(let M=0;M<L.length;M++){let T=w.get(M);if(T===void 0)continue;D+=_.slice(R,L[M].startIndex),D+=T,R=L[M].endIndex}return D+=_.slice(R),D}}function Y6($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([H])=>!J.has(H)),Q=Y.filter(([H])=>!X.has(H)).map(([H])=>I9(H)).join(" "),G=$,z=Y.length>0?G6(G):null;if(z){let H=Y.map(([U,j])=>`:${I9(U)}="${j.replace(/"/g,"&quot;")}"`).join(" "),W=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${W} ${H}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function G6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function D$($,Z,J,X,Y){if(!J6)l7(m1),J6=!0;let Q=await hQ($,Z,J,X,Y);Q=await uQ(Q,Z,J,X,Y),Q=await mQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=V1(Q,E9,(W,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let H=Q;if(Q=await dQ(q.output,Z,J,X,Y),Q===H)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=gQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function N$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function cQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let H=X.substring(z+1,q-1),W=`${J}(${H})`;X=X.substring(0,G)+W+X.substring(q),Y.lastIndex=G+W.length,Q=Y.exec(X)}return X}function pQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function W6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(W)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let W=1;while(Q<G&&W>0)if(Z[Q]==="{")W++,Q++;else if(Z[Q]==="}")W--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3368
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(Y!==0)return;let W=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!X.has(B))J.push(B),X.add(B);return}let U=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();Q++}return J.join(", ")}function iQ($,Z=""){let J=W6($).split(",").map((X)=>X.trim()).filter(Boolean);return`
3366
+ `}function d7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function l7($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var F$={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=l7(Z,"fallback"),Y=X.rest,Q=l7(Y,"error"),G=Q.rest,z=X.region??d7($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??d7($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function A9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var _$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(A9($,"name")||"v").replace(/["'<>]/g,""),Y=(A9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=A9($,"class"),G=A9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function c7($=m1){$.registerBuiltin(X$),$.registerBuiltin(q$),$.registerBuiltin(W$),$.registerBuiltin(U$),$.registerBuiltin(j$),$.registerBuiltin(B$),$.registerBuiltin(V$),$.registerBuiltin(L$),$.registerBuiltin(F$),$.registerBuiltin(_$)}function I9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var p7=new Map;function yQ($){let Z=p7.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),p7.set($.source,Z);return Z}var i7=new WeakMap;function n7($){let Z=i7.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),i7.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function s7($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=yQ(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Y=G+1;continue}let q=K[1];if(Q&&Q(q)){let F=G+1+q.length;while(F<$.length&&$[F]!==">")F++;Y=F+1;continue}let H=G+1+q.length,W=null,U=H,j=-1,B=!1;while(H<$.length){let F=$[H];if(W){if(F==="\\"&&H+1<$.length){H+=2;continue}if(F===W)W=null;H++;continue}if(F==='"'||F==="'"){W=F,H++;continue}if(F==="/"&&H+1<$.length&&$[H+1]===">"){j=H+2,B=!0;break}if(F===">"){j=H+1;break}H++}if(j===-1){Y=G+1;continue}let V=$.slice(U,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:q,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let F=`<${q}`,O=`</${q}>`,_=1,L=j,w=-1;while(_>0&&L<$.length){let M=$.indexOf(F,L),T=$.indexOf(O,L);if(T===-1)break;if(M!==-1&&M<T){let N=$[M+F.length];if(N===" "||N===">"||N==="/"||N===`
3367
+ `||N==="\t")_++;L=M+F.length}else{if(_--,_===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let D=$.slice(j,w),R=w+O.length;X.push({fullMatch:$.slice(G,R),tagName:q,attributes:V,content:D,startIndex:G,endIndex:R,isSelfClosing:!1}),Y=R}}return X}function o7($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function r7($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function w$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function a7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(w$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var CQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),SQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function R$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||SQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let H=1,W=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(H--,H===0){W=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))H++;Z.push([Q,W])}return Z}function e7($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>e7(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $6($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...R$($));function G(W){return Y.some(([U,j])=>W>=U&&W<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,K=[],q=new Map,H=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let W=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,F=!1;while((B=j.exec(U))!==null){let O=B[1],_=B[2];if(t7(O))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),D=_.match(/^([a-zA-Z_$][\w$]*)/);if(D&&!L.includes(D[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(D[1]))continue;let R=JSON.stringify([L,_]),M=q.get(R);if(!M){if(M=Function(...L,`return (${_})`),q.size>=H)q.clear();q.set(R,M)}let T=M(...w);if(O==="class"){let N=e7(T);if(N){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${N}"`);else V=V.replace(B[0],` class="${N}"`)}else V=V.replace(B[0],"");F=!0;continue}if(CQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let N=String(T).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");V=V.replace(B[0],` ${O}="${N}"`)}F=!0}catch{continue}}if(F){let O=W.endsWith("/>")?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+W.length,replacement:L})}}if(K.length>0){let W=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:F}=K[j];W[j*2]=J.slice(U,B),W[j*2+1]=F,U=V}W[K.length*2]=J.slice(U),J=W.join("")}return J}import Z6 from"fs";import J6 from"path";var E2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function b2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...E2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return E2.has($)||/[A-Z]/.test($)}var X6=!1;function PQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(H)=>{if(Q.size===0)return!1;let W=z0(H),U=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Q.has(U))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},z=new Set(G6),K=(H)=>{if(!H.includes("-")||H.startsWith("@")||H.startsWith(":")||H.startsWith("x-")||H.startsWith("__"))return H;if(H.startsWith("aria-")||H.startsWith("data-"))return H;return H.replace(/-([a-z0-9])/g,(W,U)=>U.toUpperCase())},q=(H,W)=>{let U=K(H);if(Y.static[U]=W,U!==H)Y.staticNames[U]=H};for(let[H,W]of Object.entries($)){let U=H.startsWith("x-")&&!z.has(H)&&!H.startsWith("x-bind:")&&!H.startsWith("x-on:")?`:${H.slice(2)}`:H;if(U.startsWith("@")){Y.events[U]=W;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=r7(W,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=W===N1?j:W;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!B0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=U0(B,V)(...Object.values(Z));if(O===void 0){let _=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(k9(B).some((w)=>!_.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=O,j!==U.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=U.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let j=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(B0(B)){let F=U0(B,Object.keys(Z))(...Object.values(Z));q(U,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,W)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,W)}else{let B=W,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(W))!==null)try{let O=F[1];if(!B0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=U0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,W===N1?"true":o7(W))}return Y}var vQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function xQ($,Z,J){if(!$.includes("@"))return $;if(!vQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,J)}catch{return $}}function fQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=w$($,J),J+=Q.length;let G=a7(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=N1}return Z}function Y6($){return Object.entries($).map(([Z,J])=>J===N1?Z:`${Z}="${gQ(J)}"`).join(" ")}function gQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(m1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function uQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=J6.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let W of $.matchAll(K)){let[U,j,B]=W,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,O,_=[];while((O=V.exec(B))!==null){let[L,w,D,R]=O,M=null,T=null;if(R.startsWith(".")||R.startsWith("/")){let E=J6.resolve(G,R);if(E.endsWith(".stx"))T=E;else{let A=`${E}.stx`;try{if(Z6.statSync(A).isFile())T=A}catch{try{if(Z6.statSync(E).isDirectory())M=E}catch{}}}}else M=w9(R,G);if(!M&&!T)continue;let N=!1,I=(E,A)=>{Q.set(E,A),Q.set(E.toLowerCase(),A);let k=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(k,A),Y.add(A)};if(D&&T)I(D,T),N=!0;else if(w){let E=w.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let C=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C)return{source:C[1],local:C[2]};return{source:k,local:k}}),A=M?_9(M):null;for(let{source:k,local:C}of E){let y=null;if(T)y=T;else if(A)y=A.get(k)??A.get(k.toLowerCase())??A.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(y)I(C,y),N=!0}}if(N)_.push({start:O.index,end:O.index+L.length})}if(_.length===0)continue;for(let L=_.length-1;L>=0;L--)F=F.slice(0,_[L].start)+F.slice(_[L].end);z.push({start:W.index,end:W.index+U.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let q=[],H=0;for(let W of z)q.push($.slice(H,W.start),W.value),H=W.end;return q.push($.slice(H)),q.join("")}async function mQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,H]=K,W=H.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of W){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,_=R9(U,J,X);for(let L of _)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(F,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function dQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let H=q.index,W=H+q[0].length-1,U=1,j=W+1;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Q.substring(W+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){K.lastIndex=0;continue}let O=F[1],_,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)_=L.slice(w[0].length).trim();let D={};if(_)try{D=d0(_,Z)}catch(E){let A=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(H,V),`[Error parsing component props: ${A}]`);continue}let R="",M=V,N=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(N)R=N[1].trim(),M=V+N[0].length;let I=await I1(O,D,R,G,Z,J,X,z,Y);Q=Q.substring(0,H)+I+Q.substring(M),K.lastIndex=0}return Q}async function lQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=u0(Q);Q=K.output;let q=R$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,n7(E2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,E2),Q=K.restore(Q),Q;async function j(B,V,F,O){if(!B)return B;let _=B,L=s7(_,V,O),w=new Map;for(let M=L.length-1;M>=0;M--){let T=L[M],N=F?I9(T.tagName):T.tagName,I=fQ(xQ(T.attributes,Z,J)),E=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=PQ(I,Z,X,E),k=m1.getBuiltin(T.tagName),C=k?await T9(N,G,Z,J,X):!1;if(k&&!C){let h={context:Z,filePath:J,options:X,dependencies:Y},p=k.render(A,T.content,h);if(Object.keys(A.events).length>0){let u=Y6(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${u}`)}if(Object.keys(A.clientReactive).length>0)p=Q6(p,A.clientReactive);w.set(M,p);continue}if(!F&&T.tagName.includes("-")&&!await T9(N,G,Z,J,X))continue;let y={};for(let[h,p]of Object.entries(A.static))y[h]=p;for(let[h,p]of Object.entries(A.serverDynamic))y[h]=p;let P=await I1(N,y,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=z6(P);if(h){let p=Y6(A.events),u=Object.keys(A.events).map((r)=>r.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${u}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=Q6(P,A.clientReactive);w.set(M,P)}if(w.size===0)return _;let D="",R=0;for(let M=0;M<L.length;M++){let T=w.get(M);if(T===void 0)continue;D+=_.slice(R,L[M].startIndex),D+=T,R=L[M].endIndex}return D+=_.slice(R),D}}function Q6($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([H])=>!J.has(H)),Q=Y.filter(([H])=>!X.has(H)).map(([H])=>I9(H)).join(" "),G=$,z=Y.length>0?z6(G):null;if(z){let H=Y.map(([U,j])=>`:${I9(U)}="${j.replace(/"/g,"&quot;")}"`).join(" "),W=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${W} ${H}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function z6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function D$($,Z,J,X,Y){if(!X6)c7(m1),X6=!0;let Q=await uQ($,Z,J,X,Y);Q=await mQ(Q,Z,J,X,Y),Q=await dQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=V1(Q,E9,(W,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let H=Q;if(Q=await lQ(q.output,Z,J,X,Y),Q===H)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=hQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function N$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function pQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let H=X.substring(z+1,q-1),W=`${J}(${H})`;X=X.substring(0,G)+W+X.substring(q),Y.lastIndex=G+W.length,Q=Y.exec(X)}return X}function iQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function H6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(W)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let W=1;while(Q<G&&W>0)if(Z[Q]==="{")W++,Q++;else if(Z[Q]==="}")W--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3368
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(Y!==0)return;let W=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!X.has(B))J.push(B),X.add(B);return}let U=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();Q++}return J.join(", ")}function nQ($,Z=""){let J=H6($).split(",").map((X)=>X.trim()).filter(Boolean);return`
3369
3369
  (function() {
3370
3370
  ${o1("var",J)}
3371
3371
  var __destroyHooks = [];
@@ -3374,7 +3374,7 @@ document.addEventListener("focusout",function(e){
3374
3374
 
3375
3375
  ${$}
3376
3376
  ${Z}})();
3377
- `}function nQ($,Z){let Y=W6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3377
+ `}function sQ($,Z){let Y=H6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3378
3378
  `);return`
3379
3379
  // Register scope variables for STX runtime
3380
3380
  if (!window.stx._scopes) window.stx._scopes = {};
@@ -3386,7 +3386,7 @@ ${Y}
3386
3386
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3387
3387
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3388
3388
  window.stx._scopes['${Z}'] = __scopeRegistration;
3389
- `}function sQ($,Z){return $.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(J,X)=>X===Z?J:'<script data-stx-scoped data-stx-run="always"')}function z6($,Z){let J=nQ($,Z);return oQ(iQ($,J),Z)}function oQ($,Z){let J=`
3389
+ `}function oQ($,Z){return $.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(J,X)=>X===Z?J:'<script data-stx-scoped data-stx-run="always"')}function K6($,Z){let J=sQ($,Z);return rQ(nQ($,J),Z)}function rQ($,Z){let J=`
3390
3390
  (function() {
3391
3391
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
3392
3392
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -3403,25 +3403,25 @@ ${Y}
3403
3403
  } finally {
3404
3404
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3405
3405
  }
3406
- })();`}function rQ($,Z){if(i0($)){let Y=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var K6=0,M$=new Set;function oB(){M$.clear()}function q6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var rB=new r1(500),H6=new Set;function aB(){H6.clear()}function aQ($){if($.__onceStore instanceof Set)return $.__onceStore;return H6}async function A$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G))G=K0.resolve(process.cwd(),G);let z=cQ($,"@partial","@include"),K=aQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let D=z.substring(_+1,w-1),R=D.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),N="";if(T&&await Bun.file(T).exists())Y.add(T),N=`@include(${D})`;z=z.substring(0,O)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,D=1,R=w+1;while(R<z.length&&D>0){if(z[R]==="(")D++;else if(z[R]===")")D--;R++}if(D!==0)break;let M=z.substring(w+1,R-1),T=N$(M,0);if(T===-1){O.lastIndex=R;continue}let N=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=N$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${N})`,P;if(B0(b)){let u=U0(b,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(b,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,L)+p+z.substring(R),O.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(R),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,N,I,E]=M;try{let A,k=N.trim();if(B0(k))A=U0(k,Object.keys(Z))(...Object.values(Z));else A=X0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await U(T,b,$,O);C+=P}else if(E)C=await U(E,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${k}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],N=D.slice(M[0].length),I,E=N.match(/^\s*,\s*\{/);if(E){N=N.slice(E[0].length-1);let C=1,y=1;while(y<N.length&&C>0){if(N[y]==="{")C++;else if(N[y]==="}"){if(C--,C===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let A,k=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,R);z=z.replace(R,()=>p)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let h=q(P,G,J);if(!h)continue;if(await t(h)){let p=await U(P,y,$,O);z=z.replace(R,()=>p),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=O0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=K0.resolve(F),w=K0.resolve(K0.dirname(O)),D;if(!_.startsWith("./")&&!_.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=K0.resolve(E,_);if(A.startsWith(`${K0.resolve(E)}${K0.sep}`)&&lQ(A))return A}D=K0.resolve(F,_)}else D=K0.resolve(w,_);let R=K0.normalize(D),M=R.startsWith(L+K0.sep)||R===L,T=R.startsWith(w+K0.sep)||R===w,N=!1,I=K0.dirname(w);if(R.startsWith(I+K0.sep)){if(!K0.relative(I,R).split(K0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))N=!0}if(!M&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return R}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let H=K0.resolve(J);Q.add(H);function W(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,O,_);let w=K0.resolve(L);if(Q.has(w)){let D=[...Q,w].map((R)=>K0.basename(R)).join(" -> ");return W(V,`Circular include detected: ${D}`,O,_)}try{Y.add(L);let D;if(!D)try{D=await Bun.file(L).text()}catch(i){let W0=i instanceof Error?i.message:String(i);return W(V,`Error loading include file ${V}: ${W0}`,O,_)}if(D)D=D.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(D&&D.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-hxgmf1a8.js");D=i(D,Z)}if(D&&(X.debug||!y2()&&!C2()))try{let{warnUnbalancedTags:i}=await import("./chunk-71gg4a7z.js");i(D,L)}catch{}let R=D;try{let{processESImports:i}=await import("./chunk-2g3xnk2j.js");await i(D,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=O9(R);if(M)R=M.content.trim();let N=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;let E=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,W0,a)=>{if(!q6(W0))return"";return E.push({attrs:W0,body:a}),`__STX_DATA_BLOCK_${E.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(D,L);for(let[i,W0]of Object.entries(F))A[i]=W0;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...D.matchAll(k)],y="",b=null,P=!1;for(let i of C){let W0=i[1]||"",a=i[2]||"";if(q6(W0))continue;let L0=W0.includes("server"),c0=T1(W0);if(!L0&&a.trim()){let{interpolateScriptExpressions:f}=await import("./chunk-hgxc6601.js");a=f(a,A,V)}let p0="";try{let{extractAndStripCssImports:f,renderVendorStyleTags:l}=await import("./chunk-k0wkxgb7.js"),Z0=f(a,{filePath:L,projectRoot:process.cwd()});a=Z0.code,p0=l(Z0.styles)}catch(f){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,f instanceof Error?f.message:f)}if(c0&&a.trim())a=k1(a);if(!L0){try{let{injectBrowserCoreAutoImports:l}=await import("./chunk-k0wkxgb7.js");a=l(a).code;let{hasUserImports:Z0,bundleClientScript:j0}=await import("./chunk-rfqw1q2h.js");if(Z0(a))a=await j0(a,L,{projectRoot:process.cwd()})}catch(l){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,l instanceof Error?l.message:l)}let{stripStxRuntimeImports:f}=await import("./chunk-vrbjwgva.js");a=f(a)}let g0=pQ(a);if(g0&&!L0){P=!0,b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++K6}`;let f=e0(a),l=z6(f,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${l}</script>
3407
- `;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-rn0j7n49.js");await f(a,A,L)}catch(f){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,f)}if(!L0&&!g0){let f=W0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++K6}`;let l=e0(a),Z0=z6(l,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${f?` ${f}`:""}>${Z0}</script>
3408
- `}}if(E.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-hgxc6601.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(W0,a)=>{let L0=E[Number(a)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=rQ(R,b);if(R=i.html,i.mergedIntoExisting){let a=b,L0=i.mergedIntoExisting;y=y.split(`'${a}'`).join(`'${L0}'`).split(`"${a}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!M$.has(L))M$.add(L),console.warn(`[stx] ${K0.relative(process.cwd(),L)} 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.`);let W0=i.stamped&&i.root!==null&&b2(i.root);y=sQ(y,W0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await A$(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-jnv4283w.js"),u=h(R,A,L,void 0,!0);u=t0(u,A,L),u=p(u);let{processMetaDirectives:r,processSeoDirective:e,processStructuredData:Y0}=await import("./chunk-m8nmsr4g.js");if(u=r(u,A,L,X),u=Y0(u,A,L),u=e(u,A,L,X),u=L1(u,A,L),I)u+=`
3406
+ })();`}function aQ($,Z){if(i0($)){let Y=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var q6=0,M$=new Set;function rB(){M$.clear()}function W6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var aB=new r1(500),U6=new Set;function tB(){U6.clear()}function tQ($){if($.__onceStore instanceof Set)return $.__onceStore;return U6}async function A$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G))G=K0.resolve(process.cwd(),G);let z=pQ($,"@partial","@include"),K=tQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let D=z.substring(_+1,w-1),R=D.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),N="";if(T&&await Bun.file(T).exists())Y.add(T),N=`@include(${D})`;z=z.substring(0,O)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,D=1,R=w+1;while(R<z.length&&D>0){if(z[R]==="(")D++;else if(z[R]===")")D--;R++}if(D!==0)break;let M=z.substring(w+1,R-1),T=N$(M,0);if(T===-1){O.lastIndex=R;continue}let N=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=N$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${N})`,P;if(B0(b)){let u=U0(b,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(b,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,L)+p+z.substring(R),O.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(R),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,N,I,E]=M;try{let A,k=N.trim();if(B0(k))A=U0(k,Object.keys(Z))(...Object.values(Z));else A=X0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await U(T,b,$,O);C+=P}else if(E)C=await U(E,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${k}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],N=D.slice(M[0].length),I,E=N.match(/^\s*,\s*\{/);if(E){N=N.slice(E[0].length-1);let C=1,y=1;while(y<N.length&&C>0){if(N[y]==="{")C++;else if(N[y]==="}"){if(C--,C===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let A,k=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,R);z=z.replace(R,()=>p)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let h=q(P,G,J);if(!h)continue;if(await t(h)){let p=await U(P,y,$,O);z=z.replace(R,()=>p),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=O0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=K0.resolve(F),w=K0.resolve(K0.dirname(O)),D;if(!_.startsWith("./")&&!_.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=K0.resolve(E,_);if(A.startsWith(`${K0.resolve(E)}${K0.sep}`)&&cQ(A))return A}D=K0.resolve(F,_)}else D=K0.resolve(w,_);let R=K0.normalize(D),M=R.startsWith(L+K0.sep)||R===L,T=R.startsWith(w+K0.sep)||R===w,N=!1,I=K0.dirname(w);if(R.startsWith(I+K0.sep)){if(!K0.relative(I,R).split(K0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))N=!0}if(!M&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return R}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let H=K0.resolve(J);Q.add(H);function W(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,O,_);let w=K0.resolve(L);if(Q.has(w)){let D=[...Q,w].map((R)=>K0.basename(R)).join(" -> ");return W(V,`Circular include detected: ${D}`,O,_)}try{Y.add(L);let D;if(!D)try{D=await Bun.file(L).text()}catch(i){let W0=i instanceof Error?i.message:String(i);return W(V,`Error loading include file ${V}: ${W0}`,O,_)}if(D)D=D.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(D&&D.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-p2bbfek9.js");D=i(D,Z)}if(D&&(X.debug||!y2()&&!C2()))try{let{warnUnbalancedTags:i}=await import("./chunk-71gg4a7z.js");i(D,L)}catch{}let R=D;try{let{processESImports:i}=await import("./chunk-pdrtf7ga.js");await i(D,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=O9(R);if(M)R=M.content.trim();let N=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;let E=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,W0,a)=>{if(!W6(W0))return"";return E.push({attrs:W0,body:a}),`__STX_DATA_BLOCK_${E.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(D,L);for(let[i,W0]of Object.entries(F))A[i]=W0;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...D.matchAll(k)],y="",b=null,P=!1;for(let i of C){let W0=i[1]||"",a=i[2]||"";if(W6(W0))continue;let L0=W0.includes("server"),c0=T1(W0);if(!L0&&a.trim()){let{interpolateScriptExpressions:f}=await import("./chunk-5cjc1w05.js");a=f(a,A,V)}let p0="";try{let{extractAndStripCssImports:f,renderVendorStyleTags:l}=await import("./chunk-5p0bm54m.js"),Z0=f(a,{filePath:L,projectRoot:process.cwd()});a=Z0.code,p0=l(Z0.styles)}catch(f){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,f instanceof Error?f.message:f)}if(c0&&a.trim())a=k1(a);if(!L0){try{let{injectBrowserCoreAutoImports:l}=await import("./chunk-5p0bm54m.js");a=l(a).code;let{hasUserImports:Z0,bundleClientScript:j0}=await import("./chunk-e26spfv8.js");if(Z0(a))a=await j0(a,L,{projectRoot:process.cwd()})}catch(l){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,l instanceof Error?l.message:l)}let{stripStxRuntimeImports:f}=await import("./chunk-xgxf107n.js");a=f(a)}let g0=iQ(a);if(g0&&!L0){P=!0,b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++q6}`;let f=e0(a),l=K6(f,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${l}</script>
3407
+ `;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-h40194h3.js");await f(a,A,L)}catch(f){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,f)}if(!L0&&!g0){let f=W0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++q6}`;let l=e0(a),Z0=K6(l,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${f?` ${f}`:""}>${Z0}</script>
3408
+ `}}if(E.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-5cjc1w05.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(W0,a)=>{let L0=E[Number(a)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=aQ(R,b);if(R=i.html,i.mergedIntoExisting){let a=b,L0=i.mergedIntoExisting;y=y.split(`'${a}'`).join(`'${L0}'`).split(`"${a}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!M$.has(L))M$.add(L),console.warn(`[stx] ${K0.relative(process.cwd(),L)} 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.`);let W0=i.stamped&&i.root!==null&&b2(i.root);y=oQ(y,W0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await A$(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-v3mmcyvx.js"),u=h(R,A,L,void 0,!0);u=t0(u,A,L),u=p(u);let{processMetaDirectives:r,processSeoDirective:e,processStructuredData:Y0}=await import("./chunk-m8nmsr4g.js");if(u=r(u,A,L,X),u=Y0(u,A,L),u=e(u,A,L,X),u=L1(u,A,L),I)u+=`
3409
3409
  `+I;if(y)u+=`
3410
3410
  `+y;return u}catch(D){let R=D instanceof Error?D.message:String(D);return W(V,`Error processing include ${V}: ${R}`,O,_)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,O=1,_=F+1;while(_<z.length&&O>0){if(z[_]==="(")O++;else if(z[_]===")")O--;_++}if(O!==0)break;let L=z.substring(V,_),w=z.substring(F+1,_-1),D=w.match(/^\s*['"]([^'"]+)['"]/);if(!D){j.lastIndex=_;continue}let R=D[1],M,T=w.substring(D[0].length),N=N$(T,0);if(N!==-1)M=T.substring(N+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let k=A instanceof Error?A.message:String(A);z=z.replace(L,O0("Include",`Error parsing include variables for ${R}: ${k}`,J,$,V)),j.lastIndex=0;continue}let E=await U(R,I,$,V);z=z.substring(0,V)+E+z.substring(_),j.lastIndex=0}return z}function I$($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let H=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),W=K.match(H);if(!W||W.index===void 0)break;let U=W.index,j=W[1],B=U+W[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),O=1,_=B,L=-1;while(O>0&&_<K.length){let D=K.slice(_),R=D.match(V),M=D.match(F),T=R?_+R.index:1/0,N=M?_+M.index:1/0;if(T<N)O++,_=T+(R[0].length||1);else if(N<1/0){if(O--,O===0){L=N;break}_=N+G.length+1}else break}if(L===-1)break;let w=K.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,U)+K.substring(L+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function T$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3411
- `)})}import*as k$ from"path";async function U6($,Z,J=""){if(k$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return B6($,Z,J,"@js","@endjs")}async function j6($,Z,J=""){if(k$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return B6($,Z,J,"@ts","@endts")}async function B6($,Z,J,X,Y){let Q=$,G=R1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:H,index:W}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),V=H.trim();if(X==="@ts")V=V.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 O=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),_=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3411
+ `)})}import*as k$ from"path";async function j6($,Z,J=""){if(k$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return V6($,Z,J,"@js","@endjs")}async function B6($,Z,J=""){if(k$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return V6($,Z,J,"@ts","@endts")}async function V6($,Z,J,X,Y){let Q=$,G=R1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:H,index:W}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),V=H.trim();if(X==="@ts")V=V.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 O=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),_=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3412
3412
  ${V}
3413
3413
  ${_}
3414
- `,D=Function(...j,L)(...B);if(D&&typeof D==="object")Object.assign(Z,D);Q=Q.replace(q,"")}catch(U){console.error(`Error executing ${X} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=O0(`${X} Directive`,`Error executing code: ${j}`,J,$,W,q);console.error(B),Q=Q.replace(q,"")}return Q}function a1($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}var tQ=1000,eQ=!1;function $G($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),K=N0($,"(",")",z);if(K===-1)continue;let q=$.slice(G,K).trim();if(!q)continue;if(!Object.keys(Z).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let W;try{let U=d0(q,Z);if(!U||typeof U!=="object")continue;W=JSON.stringify(U)}catch{continue}X+=$.slice(Y,G)+W,Y=K,J.lastIndex=K}return Y===0?$:X+$.slice(Y)}function ZG($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")"){if(K--,K===0)break}q++}if(K!==0)continue;let H=X.substring(z+1,q),W=q+1,U=H.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=H.slice(U[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let F=B.slice(V[0].length).trim();if(!F)continue;try{let O=d0(F,Z),_=JSON.stringify(O),L=`@component('${j}', ${_})`;Q.push({start:G,end:W,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];X=X.substring(0,z)+q+X.substring(K)}return X}function y9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1,H=null,W=!1;while(q<X.length&&K>0){let B=X[q];if(W){W=!1,q++;continue}if(B==="\\"&&H){W=!0,q++;continue}if(H){if(B===H)H=null;q++;continue}if(B==='"'||B==="'"||B==="`"){H=B,q++;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=X.substring(z+1,q),j=J(U);X=X.substring(0,G)+j+X.substring(q+1)}return X}function JG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);F6(Q);let q=U0(Q,G)(...z),H=JSON.stringify(q);if(H===void 0){if(!k9(Q).some((j)=>!(j in Z)))return"";return X}let W=Buffer.from(H,"utf8").toString("base64");return`__stx_${Y}="${W}"`}catch(G){return X}}),J}var C9="<!--__STX_BREAK__-->",S9="<!--__STX_CONTINUE__-->";function XG($,Z){let J=$;return J=y9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?C9:""}catch{return""}}),J=y9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?S9:""}catch{return""}}),J}function YG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,C9),Z=Z.replace(/@continue(?!\()/g,S9),Z}function V6($){let Z=$.includes(C9),J=Z?$.substring(0,$.indexOf(C9)):$;return{hasBreak:Z,content:J}}function L6($){let Z=$.includes(S9),J=Z?$.substring(0,$.indexOf(S9)):$;return{hasContinue:Z,content:J}}function _6($){let Z=$;return Z=y9(Z,"@break",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=y9(Z,"@continue",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function QG($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((H,W)=>H.pos-W.pos);let z=[],K=0;for(let H of X)K+=H.delta,z.push({pos:H.pos,depth:K});function q(H){let W=0,U=z.length-1,j=0;while(W<=U){let B=W+U>>1;if(z[B].pos<=H)j=z[B].depth,W=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let H=J.index,W=J.index+J[0].length-1,U=1,j=W+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(W+1,B),F=a1(V);if(!F)continue;let{arrayExpr:O,itemVar:_}=F,L=B+1,w=1,D=L,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(w>0&&D<$.length){R.lastIndex=D,M.lastIndex=D;let C=R.exec($),y=M.exec($);if(!y)break;if(C&&C.index<y.index)w++,D=C.index+C[0].length;else{if(w--,w===0){T=y.index;break}D=y.index+11}}if(T===-1)continue;let N=$.substring(L,T),I=T+11,E=-1,A=0,k=0;while(k<N.length){let C=N.indexOf("@",k);if(C===-1)break;let y=N.substring(C);if(/^@forelse\s*\(/.test(y))A++,k=C+1;else if(y.startsWith("@endforelse"))A--,k=C+11;else if(A===0&&y.startsWith("@empty")){if(N.length<=C+6||!/[a-z]/i.test(N[C+6])){E=C;break}k=C+1}else k=C+1}if(E===-1)continue;return{start:H,end:I,arrayExpr:O,itemVar:_,foreachContent:N.substring(0,E),emptyContent:N.substring(E+6)}}return null}function O6($,Z){let J=$;while(!0){let X=QG(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let H;if(B0(G))H=U0(G,Object.keys(Z))(...Object.values(Z));else H=X0(G,Z);let W;if(!Array.isArray(H)||H.length===0)W=q;else W=`@foreach (${G} as ${z})${K}@endforeach`;J=J.substring(0,Y)+W+J.substring(Q)}catch(H){let W=H instanceof Error?H.message:String(H),U=D0("Forelse",`Error in @forelse(${G} as ${z}): ${W}`,R0.EVALUATION_ERROR);J=J.substring(0,Y)+U+J.substring(Q)}}return J}var w6="<!--stx:foreach-not-iterable:",GG=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function zG($,Z){return`${w6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function KG($,Z){console.warn(`[stx] @foreach(${$}) in ${Z}: ${$} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function E$($){if(!$.includes(w6))return $;return $.replace(GG,(Z,J,X)=>{return KG(decodeURIComponent(J),decodeURIComponent(X)),""})}function R6($,Z,J,X,Y=!1){let Q=$;Q=O6(Q,Z);function G(q){let H=/@foreach\s*\(/g,W;while((W=H.exec(q))!==null){let U=W.index,j=W.index+W[0].length-1,B=1,V=j+1,F=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){F=V;break}}V++}if(F===-1)continue;let O=q.substring(j+1,F),_=a1(O);if(!_)continue;let L=U,{arrayExpr:w,itemVar:D}=_,R=F+1,M=1,T=R,N=/@foreach\s*\(/g,I=/@endforeach/g;while(M>0&&T<q.length){N.lastIndex=T,I.lastIndex=T;let E=N.exec(q),A=I.exec(q);if(!A)break;if(E&&E.index<A.index)M++,T=E.index+E[0].length;else{if(M--,M===0){let k=q.substring(R,A.index),C=A.index+11;return{start:L,end:C,arrayExpr:w,itemVar:D,content:k}}T=A.index+11}}}return null}function z(q,H){let W=q;while(!0){let U=G(W);if(!U)break;let{start:j,end:B,arrayExpr:V,itemVar:F,content:O}=U;try{let _=V.trim(),L;if(B0(_))L=U0(_,Object.keys(H))(...Object.values(H));else L=X0(_,H);let w=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),w=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),w=!0;else{let A=zG(_,J)+D0("Foreach",`Error in @foreach: ${_} is not iterable`,R0.TYPE_ERROR);W=W.substring(0,j)+A+W.substring(B);continue}let D=X?.loops?.useAltLoopVariable??eQ,R=F.trim(),M=null,T,N=!1;if(R.includes("=>")){let A=R.split("=>").map((k)=>k.trim());if(A.length===2&&A[0]&&A[1])M=A[0],T=A[1];else T=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let A=R.split(",").map((k)=>k.trim());if(A.length===2&&A[0]&&A[1])T=A[0],M=A[1],N=!0;else T=R}else T=R;let I="",E=L;for(let A=0;A<E.length;A++){let k=E[A],C={index:A,iteration:A+1,first:A===0,last:A===E.length-1,count:E.length},y={...H,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let p=T.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(k))p.forEach((u,r)=>{if(u)y[u]=k[r]});else y[T]=k}else if(T.startsWith("{")&&T.endsWith("}")){let p=T.slice(1,-1).split(",").map((u)=>u.trim()).filter(Boolean);if(k!==null&&typeof k==="object")p.forEach((u)=>{let r=u.indexOf(":"),e=(r===-1?u:u.slice(0,r)).trim(),Y0=r===-1?e:u.slice(r+1).trim();if(e&&Y0)y[Y0]=k[e]});else y[T]=k}else y[T]=k;if(M)if(!N&&w&&Array.isArray(k)&&k.length===2)y[M]=k[0],y[T]=k[1];else y[M]=A;let b=XG(O,y),P=L6(b);if(P.hasContinue){I+=P.content;continue}let h=V6(b);if(h.hasBreak){I+=h.content;break}if(b=O6(b,y),b=z(b,y),b=t0(b,y,J),b=YG(b),h=V6(b),h.hasBreak){I+=h.content;break}if(P=L6(b),P.hasContinue){I+=P.content;continue}b=L1(b,y,J),b=JG(b,y),b=ZG(b,y),b=$G(b,y),I+=b}W=W.substring(0,j)+I+W.substring(B)}catch(_){let L=D0("Foreach",`Error in @foreach(${V.trim()} as ${F.trim()}): ${_ instanceof Error?_.message:String(_)}`,R0.EVALUATION_ERROR);W=W.substring(0,j)+L+W.substring(B)}}return W}Q=z(Q,Z),Q=N6(Q,Z,J,X);let K=X?.loops?.maxWhileIterations??tQ;return Q=UG(Q,Z,K),Y?Q:E$(Q)}function qG($){let Z=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec($);if(!Z||/^(?:const|let|var)$/.test(Z[2]))return $;return`${Z[1]}let ${$.slice(Z[1].length)}`}function D6($){return b9($)}function N6($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,q=N0(Y,"(",")",K);if(q===-1)break;let H=qG(Y.slice(K+1,q)),W=q+1,U=V9(Y.slice(z),"for","endfor");if(U.length===0)break;let j=U[0].content,B=z+U[0].end;if(!D6(H)){let V=D0("For",`Unsafe expression in @for: ${H}`,R0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=WG(H),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&F){let R=HG({forExpr:H,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+R+Y.substring(B),Q=!0;continue}let O=Object.keys(Z),_=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});L=_6(L);let D=Function(...O,`
3414
+ `,D=Function(...j,L)(...B);if(D&&typeof D==="object")Object.assign(Z,D);Q=Q.replace(q,"")}catch(U){console.error(`Error executing ${X} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=O0(`${X} Directive`,`Error executing code: ${j}`,J,$,W,q);console.error(B),Q=Q.replace(q,"")}return Q}function a1($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}var eQ=1000,$G=!1;function ZG($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),K=N0($,"(",")",z);if(K===-1)continue;let q=$.slice(G,K).trim();if(!q)continue;if(!Object.keys(Z).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let W;try{let U=d0(q,Z);if(!U||typeof U!=="object")continue;W=JSON.stringify(U)}catch{continue}X+=$.slice(Y,G)+W,Y=K,J.lastIndex=K}return Y===0?$:X+$.slice(Y)}function JG($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")"){if(K--,K===0)break}q++}if(K!==0)continue;let H=X.substring(z+1,q),W=q+1,U=H.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=H.slice(U[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let F=B.slice(V[0].length).trim();if(!F)continue;try{let O=d0(F,Z),_=JSON.stringify(O),L=`@component('${j}', ${_})`;Q.push({start:G,end:W,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];X=X.substring(0,z)+q+X.substring(K)}return X}function y9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1,H=null,W=!1;while(q<X.length&&K>0){let B=X[q];if(W){W=!1,q++;continue}if(B==="\\"&&H){W=!0,q++;continue}if(H){if(B===H)H=null;q++;continue}if(B==='"'||B==="'"||B==="`"){H=B,q++;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=X.substring(z+1,q),j=J(U);X=X.substring(0,G)+j+X.substring(q+1)}return X}function XG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);_6(Q);let q=U0(Q,G)(...z),H=JSON.stringify(q);if(H===void 0){if(!k9(Q).some((j)=>!(j in Z)))return"";return X}let W=Buffer.from(H,"utf8").toString("base64");return`__stx_${Y}="${W}"`}catch(G){return X}}),J}var C9="<!--__STX_BREAK__-->",S9="<!--__STX_CONTINUE__-->";function YG($,Z){let J=$;return J=y9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?C9:""}catch{return""}}),J=y9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?S9:""}catch{return""}}),J}function QG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,C9),Z=Z.replace(/@continue(?!\()/g,S9),Z}function L6($){let Z=$.includes(C9),J=Z?$.substring(0,$.indexOf(C9)):$;return{hasBreak:Z,content:J}}function O6($){let Z=$.includes(S9),J=Z?$.substring(0,$.indexOf(S9)):$;return{hasContinue:Z,content:J}}function w6($){let Z=$;return Z=y9(Z,"@break",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=y9(Z,"@continue",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function GG($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((H,W)=>H.pos-W.pos);let z=[],K=0;for(let H of X)K+=H.delta,z.push({pos:H.pos,depth:K});function q(H){let W=0,U=z.length-1,j=0;while(W<=U){let B=W+U>>1;if(z[B].pos<=H)j=z[B].depth,W=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let H=J.index,W=J.index+J[0].length-1,U=1,j=W+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(W+1,B),F=a1(V);if(!F)continue;let{arrayExpr:O,itemVar:_}=F,L=B+1,w=1,D=L,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(w>0&&D<$.length){R.lastIndex=D,M.lastIndex=D;let C=R.exec($),y=M.exec($);if(!y)break;if(C&&C.index<y.index)w++,D=C.index+C[0].length;else{if(w--,w===0){T=y.index;break}D=y.index+11}}if(T===-1)continue;let N=$.substring(L,T),I=T+11,E=-1,A=0,k=0;while(k<N.length){let C=N.indexOf("@",k);if(C===-1)break;let y=N.substring(C);if(/^@forelse\s*\(/.test(y))A++,k=C+1;else if(y.startsWith("@endforelse"))A--,k=C+11;else if(A===0&&y.startsWith("@empty")){if(N.length<=C+6||!/[a-z]/i.test(N[C+6])){E=C;break}k=C+1}else k=C+1}if(E===-1)continue;return{start:H,end:I,arrayExpr:O,itemVar:_,foreachContent:N.substring(0,E),emptyContent:N.substring(E+6)}}return null}function F6($,Z){let J=$;while(!0){let X=GG(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let H;if(B0(G))H=U0(G,Object.keys(Z))(...Object.values(Z));else H=X0(G,Z);let W;if(!Array.isArray(H)||H.length===0)W=q;else W=`@foreach (${G} as ${z})${K}@endforeach`;J=J.substring(0,Y)+W+J.substring(Q)}catch(H){let W=H instanceof Error?H.message:String(H),U=D0("Forelse",`Error in @forelse(${G} as ${z}): ${W}`,R0.EVALUATION_ERROR);J=J.substring(0,Y)+U+J.substring(Q)}}return J}var R6="<!--stx:foreach-not-iterable:",zG=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function KG($,Z){return`${R6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function qG($,Z){console.warn(`[stx] @foreach(${$}) in ${Z}: ${$} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function E$($){if(!$.includes(R6))return $;return $.replace(zG,(Z,J,X)=>{return qG(decodeURIComponent(J),decodeURIComponent(X)),""})}function D6($,Z,J,X,Y=!1){let Q=$;Q=F6(Q,Z);function G(q){let H=/@foreach\s*\(/g,W;while((W=H.exec(q))!==null){let U=W.index,j=W.index+W[0].length-1,B=1,V=j+1,F=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){F=V;break}}V++}if(F===-1)continue;let O=q.substring(j+1,F),_=a1(O);if(!_)continue;let L=U,{arrayExpr:w,itemVar:D}=_,R=F+1,M=1,T=R,N=/@foreach\s*\(/g,I=/@endforeach/g;while(M>0&&T<q.length){N.lastIndex=T,I.lastIndex=T;let E=N.exec(q),A=I.exec(q);if(!A)break;if(E&&E.index<A.index)M++,T=E.index+E[0].length;else{if(M--,M===0){let k=q.substring(R,A.index),C=A.index+11;return{start:L,end:C,arrayExpr:w,itemVar:D,content:k}}T=A.index+11}}}return null}function z(q,H){let W=q;while(!0){let U=G(W);if(!U)break;let{start:j,end:B,arrayExpr:V,itemVar:F,content:O}=U;try{let _=V.trim(),L;if(B0(_))L=U0(_,Object.keys(H))(...Object.values(H));else L=X0(_,H);let w=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),w=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),w=!0;else{let A=KG(_,J)+D0("Foreach",`Error in @foreach: ${_} is not iterable`,R0.TYPE_ERROR);W=W.substring(0,j)+A+W.substring(B);continue}let D=X?.loops?.useAltLoopVariable??$G,R=F.trim(),M=null,T,N=!1;if(R.includes("=>")){let A=R.split("=>").map((k)=>k.trim());if(A.length===2&&A[0]&&A[1])M=A[0],T=A[1];else T=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let A=R.split(",").map((k)=>k.trim());if(A.length===2&&A[0]&&A[1])T=A[0],M=A[1],N=!0;else T=R}else T=R;let I="",E=L;for(let A=0;A<E.length;A++){let k=E[A],C={index:A,iteration:A+1,first:A===0,last:A===E.length-1,count:E.length},y={...H,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let p=T.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(k))p.forEach((u,r)=>{if(u)y[u]=k[r]});else y[T]=k}else if(T.startsWith("{")&&T.endsWith("}")){let p=T.slice(1,-1).split(",").map((u)=>u.trim()).filter(Boolean);if(k!==null&&typeof k==="object")p.forEach((u)=>{let r=u.indexOf(":"),e=(r===-1?u:u.slice(0,r)).trim(),Y0=r===-1?e:u.slice(r+1).trim();if(e&&Y0)y[Y0]=k[e]});else y[T]=k}else y[T]=k;if(M)if(!N&&w&&Array.isArray(k)&&k.length===2)y[M]=k[0],y[T]=k[1];else y[M]=A;let b=YG(O,y),P=O6(b);if(P.hasContinue){I+=P.content;continue}let h=L6(b);if(h.hasBreak){I+=h.content;break}if(b=F6(b,y),b=z(b,y),b=t0(b,y,J),b=QG(b),h=L6(b),h.hasBreak){I+=h.content;break}if(P=O6(b),P.hasContinue){I+=P.content;continue}b=L1(b,y,J),b=XG(b,y),b=JG(b,y),b=ZG(b,y),I+=b}W=W.substring(0,j)+I+W.substring(B)}catch(_){let L=D0("Foreach",`Error in @foreach(${V.trim()} as ${F.trim()}): ${_ instanceof Error?_.message:String(_)}`,R0.EVALUATION_ERROR);W=W.substring(0,j)+L+W.substring(B)}}return W}Q=z(Q,Z),Q=M6(Q,Z,J,X);let K=X?.loops?.maxWhileIterations??eQ;return Q=jG(Q,Z,K),Y?Q:E$(Q)}function WG($){let Z=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec($);if(!Z||/^(?:const|let|var)$/.test(Z[2]))return $;return`${Z[1]}let ${$.slice(Z[1].length)}`}function N6($){return b9($)}function M6($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,q=N0(Y,"(",")",K);if(q===-1)break;let H=WG(Y.slice(K+1,q)),W=q+1,U=V9(Y.slice(z),"for","endfor");if(U.length===0)break;let j=U[0].content,B=z+U[0].end;if(!N6(H)){let V=D0("For",`Unsafe expression in @for: ${H}`,R0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=HG(H),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&F){let R=UG({forExpr:H,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+R+Y.substring(B),Q=!0;continue}let O=Object.keys(Z),_=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});L=w6(L);let D=Function(...O,`
3415
3415
  let result = '';
3416
3416
  for (${H}) {
3417
3417
  result += \`${L}\`;
3418
3418
  }
3419
3419
  return result;
3420
- `)(..._);Y=Y.substring(0,z)+D+Y.substring(B),Q=!0}catch(V){let F=D0("For",`Error in @for(${H}): ${V instanceof Error?V.message:String(V)}`,R0.EVALUATION_ERROR);Y=Y.substring(0,z)+F+Y.substring(B),Q=!0}}return Y}function WG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((z)=>{let K=z.trim();if(!K)return"";let q=K.indexOf(":");if(q>=0&&Q.startsWith("{")){let U=K.slice(q+1).trim(),j=U.indexOf("=");return(j>=0?U.slice(0,j):U).trim()}let H=K.indexOf("="),W=(H>=0?K.slice(0,H):K).trim();return/^[A-Za-z_$][\w$]*$/.test(W)?W:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function HG($){let{forExpr:Z,content:J,iterVarNames:X,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),K=Object.values(Y),q=Function(...z,"__pushIter",`
3420
+ `)(..._);Y=Y.substring(0,z)+D+Y.substring(B),Q=!0}catch(V){let F=D0("For",`Error in @for(${H}): ${V instanceof Error?V.message:String(V)}`,R0.EVALUATION_ERROR);Y=Y.substring(0,z)+F+Y.substring(B),Q=!0}}return Y}function HG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((z)=>{let K=z.trim();if(!K)return"";let q=K.indexOf(":");if(q>=0&&Q.startsWith("{")){let U=K.slice(q+1).trim(),j=U.indexOf("=");return(j>=0?U.slice(0,j):U).trim()}let H=K.indexOf("="),W=(H>=0?K.slice(0,H):K).trim();return/^[A-Za-z_$][\w$]*$/.test(W)?W:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function UG($){let{forExpr:Z,content:J,iterVarNames:X,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),K=Object.values(Y),q=Function(...z,"__pushIter",`
3421
3421
  for (${Z}) {
3422
3422
  __pushIter([${X.join(", ")}])
3423
3423
  }
3424
- `),H=[];q(...K,(j)=>{H.push(j)});let W=Q??"inline.stx",U="";for(let j of H){let B={...Y};X.forEach((F,O)=>{B[F]=j[O]});let V=N6(J,B,Q,G);V=t0(V,B,W),V=L1(V,B,W),U+=V}return U}function UG($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,K=N0(X,"(",")",z);if(K===-1)break;let q=X.slice(z+1,K),H=V9(X.slice(G),"while","endwhile");if(H.length===0)break;let W=H[0].content,U=G+H[0].end;if(!D6(q)){let j=D0("While",`Unsafe expression in @while: ${q}`,R0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(U),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(_,L)=>{return`\${${L}}`});V=_6(V);let O=Function(...j,`
3424
+ `),H=[];q(...K,(j)=>{H.push(j)});let W=Q??"inline.stx",U="";for(let j of H){let B={...Y};X.forEach((F,O)=>{B[F]=j[O]});let V=M6(J,B,Q,G);V=t0(V,B,W),V=L1(V,B,W),U+=V}return U}function jG($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,K=N0(X,"(",")",z);if(K===-1)break;let q=X.slice(z+1,K),H=V9(X.slice(G),"while","endwhile");if(H.length===0)break;let W=H[0].content,U=G+H[0].end;if(!N6(q)){let j=D0("While",`Unsafe expression in @while: ${q}`,R0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(U),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(_,L)=>{return`\${${L}}`});V=w6(V);let O=Function(...j,`
3425
3425
  let result = '';
3426
3426
  let maxIterations = ${J}; // Configurable safety limit
3427
3427
  let counter = 0;
@@ -3433,25 +3433,25 @@ ${Y}
3433
3433
  result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3434
3434
  }
3435
3435
  return result;
3436
- `)(...B);X=X.substring(0,G)+O+X.substring(U),Y=!0}catch(j){let B=D0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,R0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(U),Y=!0}}return X}function jG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function M6($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return jG(X,Q||"_method")})}async function A6($,Z,J,X,Y){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let K=await z.handler(Q,Z,J,X);if(typeof K==="string")Q=K;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(K){if(X.debug)console.error(`Error in middleware ${z.name}:`,K);if(X.debug){let q=O0("Middleware",`Error in middleware '${z.name}': ${K instanceof Error?K.message:String(K)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
3436
+ `)(...B);X=X.substring(0,G)+O+X.substring(U),Y=!0}catch(j){let B=D0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,R0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(U),Y=!0}}return X}function BG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function A6($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return BG(X,Q||"_method")})}async function I6($,Z,J,X,Y){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let K=await z.handler(Q,Z,J,X);if(typeof K==="string")Q=K;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(K){if(X.debug)console.error(`Error in middleware ${z.name}:`,K);if(X.debug){let q=O0("Middleware",`Error in middleware '${z.name}': ${K instanceof Error?K.message:String(K)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
3437
3437
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${q5(q)}</div>
3438
- `)}}}return Q}async function I6($,Z,J,X){return A6($,Z,J,X,"before")}async function T6($,Z,J,X){return A6($,Z,J,X,"after")}V2();V2();function k6($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?d0(Y,{}):{};return b$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function NV($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function MV($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function E6($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(l0.exact[$])for(let X of l0.exact[$])await Promise.resolve(X(Z,$));if(l0.exact[J])for(let X of l0.exact[J])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Y}of l0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Y(Z,$))}function AV(){l0.patterns=[],l0.exact={}}var BG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),VG=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function b1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let X=J.exec($);if(!X)return null;let Y=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&BG.has(X[1]),Q=Y?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:Y,start:X.index,end:X.index+X[0].length}}function LG($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),K=G.exec($);if(!K)return-1;if(z&&z.index<K.index)X++,Y=z.index+z[0].length;else{if(X--,X===0)return K.index+K[0].length;Y=K.index+K[0].length}}return-1}function E1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=LG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function b6($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function S2($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function W1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function t1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function OG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function FG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-for");if(Y===null){J=X.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=X.end;continue}let G=Q[1].trim(),z=Q[2].trim(),K;if(G.includes(",")){let F=G.split(",").map((L)=>L.trim()),O=F[0],_=F[1];K=`${z} as ${_} => ${O}`}else K=`${z} as ${G}`;let q=W1(X.attrs,"v-for"),H=W1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=E1(Z,X),U=Z.slice(W.outerStart,W.outerEnd),j=t1(U,{...X,start:0,end:X.end-X.start},H),B=`@foreach(${K})
3438
+ `)}}}return Q}async function T6($,Z,J,X){return I6($,Z,J,X,"before")}async function k6($,Z,J,X){return I6($,Z,J,X,"after")}V2();V2();function E6($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?d0(Y,{}):{};return b$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function MV($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function AV($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function b6($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(l0.exact[$])for(let X of l0.exact[$])await Promise.resolve(X(Z,$));if(l0.exact[J])for(let X of l0.exact[J])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Y}of l0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Y(Z,$))}function IV(){l0.patterns=[],l0.exact={}}var VG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),LG=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function b1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let X=J.exec($);if(!X)return null;let Y=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&VG.has(X[1]),Q=Y?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:Y,start:X.index,end:X.index+X[0].length}}function OG($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),K=G.exec($);if(!K)return-1;if(z&&z.index<K.index)X++,Y=z.index+z[0].length;else{if(X--,X===0)return K.index+K[0].length;Y=K.index+K[0].length}}return-1}function E1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=OG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function y6($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function S2($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function W1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function t1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function FG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function _G($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-for");if(Y===null){J=X.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=X.end;continue}let G=Q[1].trim(),z=Q[2].trim(),K;if(G.includes(",")){let F=G.split(",").map((L)=>L.trim()),O=F[0],_=F[1];K=`${z} as ${_} => ${O}`}else K=`${z} as ${G}`;let q=W1(X.attrs,"v-for"),H=W1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=E1(Z,X),U=Z.slice(W.outerStart,W.outerEnd),j=t1(U,{...X,start:0,end:X.end-X.start},H),B=`@foreach(${K})
3439
3439
  `,V=`${B}${j}
3440
- @endforeach`;Z=Z.slice(0,W.outerStart)+V+Z.slice(W.outerEnd),J=W.outerStart+B.length}return Z}function _G($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=E1(Z,X),z=W1(X.attrs,"v-if"),K=t1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:K,parsedTag:X});let q=G.outerEnd,H=!0;while(H){let V=Z.slice(q).match(/^\s*/),F=V?V[0].length:0,O=b1(Z,q+F);if(!O){H=!1;break}let _=S2(O.attrs,"v-else-if"),L=b6(O.attrs,"v-else");if(_!==null){let w=E1(Z,O),D=W1(O.attrs,"v-else-if"),R=t1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},D);Q.push({type:"else-if",expr:_,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),q=w.outerEnd}else if(L){let w=E1(Z,O),D=W1(O.attrs,"v-else"),R=t1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},D);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),H=!1}else H=!1}let W=[];for(let V of Q)if(V.type==="if")W.push(`@if(${V.expr})
3440
+ @endforeach`;Z=Z.slice(0,W.outerStart)+V+Z.slice(W.outerEnd),J=W.outerStart+B.length}return Z}function wG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=E1(Z,X),z=W1(X.attrs,"v-if"),K=t1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:K,parsedTag:X});let q=G.outerEnd,H=!0;while(H){let V=Z.slice(q).match(/^\s*/),F=V?V[0].length:0,O=b1(Z,q+F);if(!O){H=!1;break}let _=S2(O.attrs,"v-else-if"),L=y6(O.attrs,"v-else");if(_!==null){let w=E1(Z,O),D=W1(O.attrs,"v-else-if"),R=t1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},D);Q.push({type:"else-if",expr:_,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),q=w.outerEnd}else if(L){let w=E1(Z,O),D=W1(O.attrs,"v-else"),R=t1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},D);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),H=!1}else H=!1}let W=[];for(let V of Q)if(V.type==="if")W.push(`@if(${V.expr})
3441
3441
  ${V.element}`);else if(V.type==="else-if")W.push(`@elseif(${V.expr})
3442
3442
  ${V.element}`);else W.push(`@else
3443
3443
  ${V.element}`);W.push("@endif");let U=W.join(`
3444
- `),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function wG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function RG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=VG.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,K,q)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(K);if(!H||!q||!/^["']/.test(q))return z;let W=H[1]||"modelValue",U=H[2];if(Y&&!H[1])return`@model${U}=${q}`;let j=q[0],B=q.slice(1,-1),V=`:${W}=${q} @update:${W}=${j}${B} = $event${j}`;if(U){let F=H[1]?`${W}Modifiers`:"modelModifiers",O=U.slice(1).split(".").map((_)=>`${_}: true`).join(", ");V+=` :${F}="{ ${O} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=t1(X.full,{...X,start:0,end:X.full.length},Q);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function DG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function NG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function MG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=E1(Z,X),G=W1(X.attrs,"v-html"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{!! ${Y} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function AG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=E1(Z,X),G=W1(X.attrs,"v-text"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{{ ${Y} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function IG($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function TG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;if(!b6(X.attrs,"v-once")){J=X.end;continue}let Y=W1(X.attrs,"v-once"),Q=E1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),K=`@once
3444
+ `),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function RG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function DG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=LG.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,K,q)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(K);if(!H||!q||!/^["']/.test(q))return z;let W=H[1]||"modelValue",U=H[2];if(Y&&!H[1])return`@model${U}=${q}`;let j=q[0],B=q.slice(1,-1),V=`:${W}=${q} @update:${W}=${j}${B} = $event${j}`;if(U){let F=H[1]?`${W}Modifiers`:"modelModifiers",O=U.slice(1).split(".").map((_)=>`${_}: true`).join(", ");V+=` :${F}="{ ${O} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=t1(X.full,{...X,start:0,end:X.full.length},Q);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function NG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function MG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function AG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=E1(Z,X),G=W1(X.attrs,"v-html"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{!! ${Y} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function IG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;let Y=S2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=E1(Z,X),G=W1(X.attrs,"v-text"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{{ ${Y} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function TG($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function kG($){let Z=$,J=0;while(J<Z.length){let X=b1(Z,J);if(!X)break;if(!y6(X.attrs,"v-once")){J=X.end;continue}let Y=W1(X.attrs,"v-once"),Q=E1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),K=`@once
3445
3445
  ${t1(G,{...X,start:0,end:X.end-X.start},Y)}
3446
- @endonce`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function kG($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function EG($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function y6($){if(!OG($))return $;let Z=$;return Z=FG(Z),Z=_G(Z),Z=TG(Z),Z=DG(Z),Z=NG(Z),Z=RG(Z),Z=wG(Z),Z=EG(Z),Z=MG(Z),Z=AG(Z),Z=IG(Z),Z=kG(Z),Z}function P9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var y$=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),bG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function C6($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=X0(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return y$.has(Q)?Q:null}function S6($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function P6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(bG.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function v6($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let q=z.length-1;q>=0;q--){let H=z[q];try{let W=C6(H.expr,Z);if(!W||typeof W!=="string"){let _=`<!-- dynamic component: could not resolve "${P9(S6(H.expr))}" -->`;Q=Q.slice(0,H.index)+_+Q.slice(H.index+H.full.length);continue}if(y$.has(W)){let _=P6(W,H.attrs,H.slotContent);Q=Q.slice(0,H.index)+_+Q.slice(H.index+H.full.length);continue}let U=H.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,V;while((V=B.exec(U))!==null){let _=V[1]||V[2],L=V[3];if(V[1])try{j[_]=X0(L,Z)}catch{j[_]=L}else j[_]=L}let F=X.componentsDir||"components",O=await I1(W,j,H.slotContent,F,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,H.index)+O+Q.slice(H.index+H.full.length)}catch(W){let U=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${P9(U)} -->`;Q=Q.slice(0,H.index)+j+Q.slice(H.index+H.full.length)}}return Q=await yG(Q,Z,J,X,Y),Q}async function yG($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let q=z.length-1;q>=0;q--){let H=z[q];try{let W=C6(H.expr,Z);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${P9(S6(H.expr))}" -->`;Q=Q.slice(0,H.index)+B+Q.slice(H.index+H.full.length);continue}if(y$.has(W)){let B=P6(W,H.attrs,"");Q=Q.slice(0,H.index)+B+Q.slice(H.index+H.full.length);continue}let U=X.componentsDir||"components",j=await I1(W,{},"",U,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,H.index)+j+Q.slice(H.index+H.full.length)}catch(W){let U=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${P9(U)} -->`;Q=Q.slice(0,H.index)+j+Q.slice(H.index+H.full.length)}}return Q}function C$(){return{afterOpen:[],beforeClose:[]}}function CG($){return $.afterOpen.length>0||$.beforeClose.length>0}function f6($,Z){if(!CG(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?P2($):null,G=X&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${J}${$.slice(Q,G)}${X}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${J}${$.slice(Q)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var x6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function P2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;x6.lastIndex=J;let X=x6.exec($);return X?J+X[0].length:J}var P$="data-stx-color-mode-boot",SG="__STX_COLOR_MODE__",PG=new Set(["light","dark","auto","system"]),vG=new Set(["auto","system"]),xG=/^[a-z][\w:-]*$/i,fG=/^[\w-]+$/;function gG($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!PG.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!fG.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!xG.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!vG.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:X,attribute:Y,autoValue:Q}}function hG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function v$($={}){let Z=gG($),X=`(function(){"use strict";var c=${hG(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${SG}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${P$}>${X}</script>`}function u6($,Z={}){if($.includes(P$))return $;let J=S$($);if(J===null)return $;let X=v$(Z);return`${$.slice(0,J)}
3447
- ${X}${$.slice(J)}`}var S$=P2,uG=new RegExp(`<script\\b[^>]*\\b${P$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),g6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,h6=/<\/head>/gi;function mG($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;h6.lastIndex=J;let X=h6.exec($),Y=X?X.index:$.length;g6.lastIndex=J;let Q=g6.exec($);if(!Q||Q.index>=Y)return $;if($.slice(J,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,J)}
3448
- ${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function m6($){return dG(mG($))}function dG($){let Z=uG.exec($);if(!Z)return $;let J=S$($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=S$(X);if(Y===null)return $;return`${X.slice(0,Y)}
3449
- ${Z[0]}${X.slice(Y)}`}var vV="stx-build",xV="X-STX-Build",v2=Symbol.for("stx.buildId");function d6(){let $=globalThis;if(!$[v2])$[v2]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return $[v2]}function fV($){let Z=globalThis;if($===null)delete Z[v2];else Z[v2]=$}function gV($,Z=d6()){let J=x$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Y=X.index+X[0].length;return`${$.slice(0,Y)}${J}${$.slice(Y)}`}function x$($,Z=d6()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3450
- <meta name="stx-build" content="${Z}">`}import{AsyncLocalStorage as lG}from"async_hooks";var l6=new lG;function f$($){return $.__stx_server_data??={pending:new Map,values:new Map}}function c6($,Z){return l6.run(f$($),Z)}async function p6($,Z){let J=l6.getStore();if(!J)throw Error("useServerData must run inside a <script server> render");if(typeof $!=="string"||!$.trim())throw TypeError("useServerData requires a non-empty string key");let X=J.pending.get($);if(X)return X;let Y=Promise.resolve().then(Z).then((Q)=>{let G=JSON.stringify(Q,(K,q)=>{if(q===void 0||typeof q==="function"||typeof q==="symbol"||typeof q==="bigint"||typeof q==="number"&&!Number.isFinite(q))throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);if(q&&typeof q==="object"&&!Array.isArray(q)&&Object.getPrototypeOf(q)!==Object.prototype&&Object.getPrototypeOf(q)!==null)throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);return q}),z=JSON.parse(G);return J.values.set($,z),z}).catch((Q)=>{throw J.pending.delete($),Q});return J.pending.set($,Y),Y}function i6($){let Z=$.__stx_server_data;if(!Z?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(Z.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var o6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",v9="data-stx-html-attrs",x9="data-stx-html-class",r6=/^[A-Za-z_:][\w:.-]*$/;function $1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cG($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $2($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function e1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${$1(String(X))}"`).join(" ")}function pG($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,K]of Object.entries($||{})){if(K==null)continue;let q=z.trim();if(!r6.test(q))continue;let H=q.toLowerCase();if(H==="lang"){Q=String(K);continue}if(H==="class"){Y=String(K).trim();continue}J.push(` ${q}="${$1(String(K))}"`),X.push(q)}let G=` lang="${$1(Q)}"`;if(Y)G+=` class="${$1(Y)}"`;if(G+=J.join(""),Y)G+=` ${x9}="${$1(Y)}"`;if(X.length)G+=` ${v9}="${$1(X.join(" "))}"`;return G}function a6($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Y))X.push(Y);J.class=X.join(" ")}return J}function t6($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let H=G[1];if(!(H in X))Y.push(H);X[H]=G[2]??G[3]??G[4]??""}let z=[],K=[];for(let[H,W]of Object.entries(Z)){if(W==null)continue;let U=H.trim();if(!r6.test(U))continue;let j=U.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(W).split(/\s+/).filter(Boolean))if(!B.includes(V))B.push(V),z.push(V);if(!("class"in X))Y.push("class");X.class=B.join(" ");continue}if(!(U in X))Y.push(U);if(X[U]=String(W),j!=="lang")K.push(U)}if(z.length){if(!(x9 in X))Y.push(x9);X[x9]=z.join(" ")}if(K.length){if(!(v9 in X))Y.push(v9);X[v9]=K.join(" ")}let q=Y.map((H)=>` ${H}="${$1(X[H])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function lV($){let Z=u$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function u$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${o6}
3451
- `}function iG($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let W=$.indexOf("-->",J);if(W===-1)break;J=W+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let W=$.toLowerCase().indexOf("</script>",J+z[0].length);if(W===-1)break;J=W+9;continue}let K=Q.match(/^<link\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let H=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(H){Z.push(H[0]),J+=H[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Y=0;while(Y<$.length&&Y<J){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&Z.includes(K[0])){Y+=K[0].length;continue}X+=$[Y],Y++}return X+=$.slice(J),{body:X,hoisted:Z}}function nG($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:K="",htmlAttrs:q={},bodyClass:H="",bodyAttrs:W={}}=Z,U=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map($2).filter(Boolean)),F=[...j.filter((I)=>!B.has($2(I))),...Q].map((I)=>{return` <meta ${e1(I)}>`}).join(`
3446
+ @endonce`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function EG($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function bG($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function C6($){if(!FG($))return $;let Z=$;return Z=_G(Z),Z=wG(Z),Z=kG(Z),Z=NG(Z),Z=MG(Z),Z=DG(Z),Z=RG(Z),Z=bG(Z),Z=AG(Z),Z=IG(Z),Z=TG(Z),Z=EG(Z),Z}function P9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var y$=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),yG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function S6($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=X0(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return y$.has(Q)?Q:null}function P6($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function v6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(yG.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function x6($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let q=z.length-1;q>=0;q--){let H=z[q];try{let W=S6(H.expr,Z);if(!W||typeof W!=="string"){let _=`<!-- dynamic component: could not resolve "${P9(P6(H.expr))}" -->`;Q=Q.slice(0,H.index)+_+Q.slice(H.index+H.full.length);continue}if(y$.has(W)){let _=v6(W,H.attrs,H.slotContent);Q=Q.slice(0,H.index)+_+Q.slice(H.index+H.full.length);continue}let U=H.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,V;while((V=B.exec(U))!==null){let _=V[1]||V[2],L=V[3];if(V[1])try{j[_]=X0(L,Z)}catch{j[_]=L}else j[_]=L}let F=X.componentsDir||"components",O=await I1(W,j,H.slotContent,F,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,H.index)+O+Q.slice(H.index+H.full.length)}catch(W){let U=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${P9(U)} -->`;Q=Q.slice(0,H.index)+j+Q.slice(H.index+H.full.length)}}return Q=await CG(Q,Z,J,X,Y),Q}async function CG($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let q=z.length-1;q>=0;q--){let H=z[q];try{let W=S6(H.expr,Z);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${P9(P6(H.expr))}" -->`;Q=Q.slice(0,H.index)+B+Q.slice(H.index+H.full.length);continue}if(y$.has(W)){let B=v6(W,H.attrs,"");Q=Q.slice(0,H.index)+B+Q.slice(H.index+H.full.length);continue}let U=X.componentsDir||"components",j=await I1(W,{},"",U,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,H.index)+j+Q.slice(H.index+H.full.length)}catch(W){let U=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${P9(U)} -->`;Q=Q.slice(0,H.index)+j+Q.slice(H.index+H.full.length)}}return Q}function C$(){return{afterOpen:[],beforeClose:[]}}function SG($){return $.afterOpen.length>0||$.beforeClose.length>0}function g6($,Z){if(!SG(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?P2($):null,G=X&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${J}${$.slice(Q,G)}${X}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${J}${$.slice(Q)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var f6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function P2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;f6.lastIndex=J;let X=f6.exec($);return X?J+X[0].length:J}var P$="data-stx-color-mode-boot",PG="__STX_COLOR_MODE__",vG=new Set(["light","dark","auto","system"]),xG=new Set(["auto","system"]),fG=/^[a-z][\w:-]*$/i,gG=/^[\w-]+$/;function hG($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!vG.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!gG.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!fG.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!xG.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:X,attribute:Y,autoValue:Q}}function uG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function v$($={}){let Z=hG($),X=`(function(){"use strict";var c=${uG(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${PG}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${P$}>${X}</script>`}function m6($,Z={}){if($.includes(P$))return $;let J=S$($);if(J===null)return $;let X=v$(Z);return`${$.slice(0,J)}
3447
+ ${X}${$.slice(J)}`}var S$=P2,mG=new RegExp(`<script\\b[^>]*\\b${P$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),h6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,u6=/<\/head>/gi;function dG($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;u6.lastIndex=J;let X=u6.exec($),Y=X?X.index:$.length;h6.lastIndex=J;let Q=h6.exec($);if(!Q||Q.index>=Y)return $;if($.slice(J,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,J)}
3448
+ ${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function d6($){return lG(dG($))}function lG($){let Z=mG.exec($);if(!Z)return $;let J=S$($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=S$(X);if(Y===null)return $;return`${X.slice(0,Y)}
3449
+ ${Z[0]}${X.slice(Y)}`}var xV="stx-build",fV="X-STX-Build",v2=Symbol.for("stx.buildId");function l6(){let $=globalThis;if(!$[v2])$[v2]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return $[v2]}function gV($){let Z=globalThis;if($===null)delete Z[v2];else Z[v2]=$}function hV($,Z=l6()){let J=x$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Y=X.index+X[0].length;return`${$.slice(0,Y)}${J}${$.slice(Y)}`}function x$($,Z=l6()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3450
+ <meta name="stx-build" content="${Z}">`}import{AsyncLocalStorage as cG}from"async_hooks";var c6=new cG;function f$($){return $.__stx_server_data??={pending:new Map,values:new Map}}function p6($,Z){return c6.run(f$($),Z)}async function i6($,Z){let J=c6.getStore();if(!J)throw Error("useServerData must run inside a <script server> render");if(typeof $!=="string"||!$.trim())throw TypeError("useServerData requires a non-empty string key");let X=J.pending.get($);if(X)return X;let Y=Promise.resolve().then(Z).then((Q)=>{let G=JSON.stringify(Q,(K,q)=>{if(q===void 0||typeof q==="function"||typeof q==="symbol"||typeof q==="bigint"||typeof q==="number"&&!Number.isFinite(q))throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);if(q&&typeof q==="object"&&!Array.isArray(q)&&Object.getPrototypeOf(q)!==Object.prototype&&Object.getPrototypeOf(q)!==null)throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);return q}),z=JSON.parse(G);return J.values.set($,z),z}).catch((Q)=>{throw J.pending.delete($),Q});return J.pending.set($,Y),Y}function n6($){let Z=$.__stx_server_data;if(!Z?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(Z.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var r6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",v9="data-stx-html-attrs",x9="data-stx-html-class",a6=/^[A-Za-z_:][\w:.-]*$/;function $1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pG($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $2($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function e1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${$1(String(X))}"`).join(" ")}function iG($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,K]of Object.entries($||{})){if(K==null)continue;let q=z.trim();if(!a6.test(q))continue;let H=q.toLowerCase();if(H==="lang"){Q=String(K);continue}if(H==="class"){Y=String(K).trim();continue}J.push(` ${q}="${$1(String(K))}"`),X.push(q)}let G=` lang="${$1(Q)}"`;if(Y)G+=` class="${$1(Y)}"`;if(G+=J.join(""),Y)G+=` ${x9}="${$1(Y)}"`;if(X.length)G+=` ${v9}="${$1(X.join(" "))}"`;return G}function t6($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Y))X.push(Y);J.class=X.join(" ")}return J}function e6($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let H=G[1];if(!(H in X))Y.push(H);X[H]=G[2]??G[3]??G[4]??""}let z=[],K=[];for(let[H,W]of Object.entries(Z)){if(W==null)continue;let U=H.trim();if(!a6.test(U))continue;let j=U.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(W).split(/\s+/).filter(Boolean))if(!B.includes(V))B.push(V),z.push(V);if(!("class"in X))Y.push("class");X.class=B.join(" ");continue}if(!(U in X))Y.push(U);if(X[U]=String(W),j!=="lang")K.push(U)}if(z.length){if(!(x9 in X))Y.push(x9);X[x9]=z.join(" ")}if(K.length){if(!(v9 in X))Y.push(v9);X[v9]=K.join(" ")}let q=Y.map((H)=>` ${H}="${$1(X[H])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function cV($){let Z=u$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function u$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${r6}
3451
+ `}function nG($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let W=$.indexOf("-->",J);if(W===-1)break;J=W+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let W=$.toLowerCase().indexOf("</script>",J+z[0].length);if(W===-1)break;J=W+9;continue}let K=Q.match(/^<link\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let H=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(H){Z.push(H[0]),J+=H[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Y=0;while(Y<$.length&&Y<J){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&Z.includes(K[0])){Y+=K[0].length;continue}X+=$[Y],Y++}return X+=$.slice(J),{body:X,hoisted:Z}}function sG($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:K="",htmlAttrs:q={},bodyClass:H="",bodyAttrs:W={}}=Z,U=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map($2).filter(Boolean)),F=[...j.filter((I)=>!B.has($2(I))),...Q].map((I)=>{return` <meta ${e1(I)}>`}).join(`
3452
3452
  `),O=G.map((I)=>{return` <link ${e1(I)}>`}).join(`
3453
3453
  `),_=z.map((I)=>{if(I.src)return` <script ${e1(I,(E)=>E==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
3454
- `),L=pG(q,Y),w=Object.entries(W).map(([I,E])=>` ${I}="${$1(String(E))}"`).join(""),D=H?` class="${$1(H)}"`:"",{body:R,hoisted:M}=iG($),T=[F,J.colorMode?` ${v$(J.colorMode)}`:"",` <title>${J.titleIsHtml?U:cG(U)}</title>`,` ${o6}`,O,_,K?` ${K}`:"",...(J.styles||[]).map((I)=>` ${I}`),...M.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),N=[R,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3454
+ `),L=iG(q,Y),w=Object.entries(W).map(([I,E])=>` ${I}="${$1(String(E))}"`).join(""),D=H?` class="${$1(H)}"`:"",{body:R,hoisted:M}=nG($),T=[F,J.colorMode?` ${v$(J.colorMode)}`:"",` <title>${J.titleIsHtml?U:pG(U)}</title>`,` ${r6}`,O,_,K?` ${K}`:"",...(J.styles||[]).map((I)=>` ${I}`),...M.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),N=[R,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3455
3455
  <html${L}>
3456
3456
  <head>
3457
3457
  ${T.join(`
@@ -3461,24 +3461,24 @@ ${T.join(`
3461
3461
  ${N.join(`
3462
3462
  `)}
3463
3463
  </body>
3464
- </html>`}var g$=/\s+/y,h$=/<(script|style)\b[^>]*>/iy,sG=/<\/script>/gi,oG=/<\/style>/gi,n6=/<!DOCTYPE\b/iy,s6=/<html[\s>]/iy;function m$($){let Z=0;while(Z<$.length){if(g$.lastIndex=Z,g$.exec($)){Z=g$.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}h$.lastIndex=Z;let X=h$.exec($);if(X){let Y=X[1].toLowerCase()==="script"?sG:oG;Y.lastIndex=h$.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(n6.lastIndex=Z,n6.test($))return!0;return s6.lastIndex=Z,s6.test($)}return!1}function d$($){return m$($)}function e6($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,J),K=[];for(let q of X){let H=$2(q);if(H&&z.includes(H))continue;K.push(` <meta ${e1(q)}>`)}for(let q of Y){if(q.href&&z.includes(`href="${q.href}"`))continue;K.push(` <link ${e1(q)}>`)}for(let q of Q)if(q.src){if(z.includes(`src="${q.src}"`))continue;K.push(` <script ${e1(q,(H)=>H==="content")}></script>`)}else if(q.content){if(z.includes(q.content))continue;K.push(` <script>${q.content}</script>`)}if(G&&!z.includes(G))K.push(` ${G}`);if(K.length===0)return $;return`${$.slice(0,J)}${K.join(`
3464
+ </html>`}var g$=/\s+/y,h$=/<(script|style)\b[^>]*>/iy,oG=/<\/script>/gi,rG=/<\/style>/gi,s6=/<!DOCTYPE\b/iy,o6=/<html[\s>]/iy;function m$($){let Z=0;while(Z<$.length){if(g$.lastIndex=Z,g$.exec($)){Z=g$.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}h$.lastIndex=Z;let X=h$.exec($);if(X){let Y=X[1].toLowerCase()==="script"?oG:rG;Y.lastIndex=h$.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(s6.lastIndex=Z,s6.test($))return!0;return o6.lastIndex=Z,o6.test($)}return!1}function d$($){return m$($)}function $8($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,J),K=[];for(let q of X){let H=$2(q);if(H&&z.includes(H))continue;K.push(` <meta ${e1(q)}>`)}for(let q of Y){if(q.href&&z.includes(`href="${q.href}"`))continue;K.push(` <link ${e1(q)}>`)}for(let q of Q)if(q.src){if(z.includes(`src="${q.src}"`))continue;K.push(` <script ${e1(q,(H)=>H==="content")}></script>`)}else if(q.content){if(z.includes(q.content))continue;K.push(` <script>${q.content}</script>`)}if(G&&!z.includes(G))K.push(` ${G}`);if(K.length===0)return $;return`${$.slice(0,J)}${K.join(`
3465
3465
  `)}
3466
- ${$.slice(J)}`}function $8($,Z={},J={},X){if(X??d$($))return $;return nG($,Z,J)}var rG=/<\/(script)/gi;function Z2($){if(!$||$.indexOf("</")===-1)return $;return $.replace(rG,"<\\/$1")}var H1=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];import X8 from"path";V2();V2();function J8($,Z={}){return new Z8($,Z).routes}function tV($,Z){let J=l$($,Z);return J?J.params:null}var Y8=new Map;async function Q8($,Z){let J=$,X=Z;if(!J||!X)try{let z=await x5();J||=z?.pagesDir||"pages",X||=z?.root||"."}catch{J||="pages",X||="."}let Y=X8.isAbsolute(J)?J:X8.join(X,J),Q=Y8.get(Y);if(Q)return Q;let G=[];try{G=J8(".",{pagesDir:Y,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{G=[]}return Y8.set(Y,G),G}function aG($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function G8($){return aG(JSON.stringify($))}function z8($){return $.includes("data-stx-runtime")}function K8($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let X=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}function c$($,Z){let J=j2($),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
3466
+ ${$.slice(J)}`}function Z8($,Z={},J={},X){if(X??d$($))return $;return sG($,Z,J)}var aG=/<\/(script)/gi;function Z2($){if(!$||$.indexOf("</")===-1)return $;return $.replace(aG,"<\\/$1")}var H1=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];import Y8 from"path";V2();V2();function X8($,Z={}){return new J8($,Z).routes}function eV($,Z){let J=l$($,Z);return J?J.params:null}var Q8=new Map;async function G8($,Z){let J=$,X=Z;if(!J||!X)try{let z=await x5();J||=z?.pagesDir||"pages",X||=z?.root||"."}catch{J||="pages",X||="."}let Y=Y8.isAbsolute(J)?J:Y8.join(X,J),Q=Q8.get(Y);if(Q)return Q;let G=[];try{G=X8(".",{pagesDir:Y,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{G=[]}return Q8.set(Y,G),G}function tG($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function z8($){return tG(JSON.stringify($))}function K8($){return $.includes("data-stx-runtime")}function q8($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let X=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}function c$($,Z){let J=j2($),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
3467
3467
  `+$.slice(J);let Y=P2($);if(Y!==null)return`${$.slice(0,Y)}
3468
3468
  ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3469
3469
  `+$.slice(G)}if(i0($))return x1($,(G)=>`${G}
3470
3470
  ${Z}`);return`${Z}
3471
- ${$}`}async function f9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-nyw7c3e3.js"),{url:Q}=await Y("runtime",Z.debug===!0);return c$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return c$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-nyw7c3e3.js"),X=await J(Z.debug);return c$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function tG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function q8($){if($.includes("data-stx-tooltip-runtime")||!tG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${O$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3471
+ ${$}`}async function f9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-abffw83w.js"),{url:Q}=await Y("runtime",Z.debug===!0);return c$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return c$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-abffw83w.js"),X=await J(Z.debug);return c$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function eG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function W8($){if($.includes("data-stx-tooltip-runtime")||!eG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${O$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3472
3472
  ${Z}`;return`${$.slice(0,J)}${Z}
3473
- ${$.slice(J)}`}var eG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function $z($){return eG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function Zz($,Z){if(!$.includes("</body>"))return $;if($z($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await Q8(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${G8(K)};</script>
3474
- `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-nyw7c3e3.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3475
- </body>`+$.slice(z+7)}var W8=Symbol.for("stx.lazy-module-promises");function Jz(){let $=globalThis;return $[W8]??=new Map,$[W8]}function s($,Z){let J=Jz(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var p$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,_8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Xz=65536,Yz=4,h9=new Map;function IL(){h9.clear()}function Qz($){let Z=[];for(let J of x2($,H2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function Gz($,Z={}){let J=$.length>=Xz,X=J?h9.get($):void 0;if(X===void 0){if(X=Qz($),J)F8(h9,Yz),h9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function w8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=H8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=H8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function H8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function s$($,Z){return O8($,Z)}function zz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function Kz($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function qz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${p$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=x2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=w8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let H=G[1],U=/\/\s*>$/.test(Q.token)||u9.has(H.toLowerCase())?Q.end:D8($,Q.start,H,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var U8=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 Wz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function j8($,Z,J,X){if(!$)return!1;let Y=Wz($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(U8.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=H.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(U8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function g9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(_8);if(Q&&Hz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Hz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function R8($,Z){let J=Kz($);function X(Y){let Q=Y,G=qz(Y),z=(W)=>{let U=new Set;for(let j of G)if(W>j.start&&W<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,H=[];while((q=K.exec(Q))!==null){let W=q.index,U=W+q[0].length,j=1,B=U;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(U,B-1).trim(),F=B,O=1,_=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){_=w.index+w[0].length;break}}if(O!==0)continue;let D=Q.substring(F,_-6).trim(),R;if(zz(D)){let M=R2(Q.substring(W,_));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),N=z(W);if(!(T.length>0&&T.every((A)=>j8(A.condition,J,Z,N))))continue;R=M[0].branches.map((A)=>{let k=X(A.content);if(A.type==="elseif")return g9(k,"@else-if",A.condition??"");if(A.type==="else")return g9(k,"@else");return g9(k,"@if",A.condition??"")}).join(`
3476
- `)}else{if(!j8(V,J,Z,z(W)))continue;R=g9(X(D),"@if",V)}H.push({start:W,end:_,replacement:R}),K.lastIndex=_}for(let W=H.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=H[W];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function Uz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var u9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),B8=/<(script|style)\b/iy,jz=/<\/script/gi,Bz=/<\/style/gi;function D8($,Z,J,X){if(u9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let U=$.indexOf("-->",z+4);if(U===-1)return-1;z=U+3;continue}B8.lastIndex=z;let q=B8.exec($);if(q){let U=$.indexOf(">",z);if(U===-1)return-1;if($[U-1]==="/"){z=U+1;continue}let j=q[1].toLowerCase()==="script"?jz:Bz;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!U){z++;continue}if(U[1].toLowerCase()===Y){if(G--,z+=U[0].length,G===0)return z;continue}z+=U[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!H){z++;continue}let W=$.indexOf(">",z);if(W===-1)return-1;if(H[1].toLowerCase()===Y){let U=$.slice(z,W+1);if(!(/\/\s*>$/.test(U)||u9.has(Y)))G++}z=W+1}return-1}var Vz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Lz($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return Vz.test(Q)}function N8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(W)=>Z.some(([U,j])=>W>=U&&W<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[W,U,j,B,V,F,O]=z,_=Uz(V);if(_===void 0)continue;let L=z.index,w=L+W.length,M=!!O||/\/\s*>$/.test(W)||u9.has(U.toLowerCase())?w:D8($,L,U,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Lz($,M)){Q.lastIndex=w;continue}if(_===!0){let N=`<${U}${j}${F}${O}>`;G.push({start:L,end:w,replacement:N});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((W,U)=>W.start-U.start);let K=[],q=-1;for(let W of G){if(W.start<q)continue;K.push(W),q=W.end}let H=$;for(let W=K.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=K[W];H=H.substring(0,U)+B+H.substring(j)}return H}function o$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,H=1,W=q;while(W<J.length&&H>0){if(J[W]==="(")H++;else if(J[W]===")")H--;W++}if(H!==0)continue;let U=J.substring(q,W-1).trim(),j=W,B=w8(U),V=z==="for"?"@endfor":"@endforeach",F=1,O=j,_=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");_.lastIndex=j;let L;while((L=_.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){O=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:O,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let E=I.split(/[.[(]/)[0].trim(),A=Z?E in Z:!1,k=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(E));if(E&&(A||k)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let D=J.substring(j,O-V.length).trim(),R=Z?{...Z}:{};if(B.itemVar)delete R[B.itemVar];if(B.indexVar)delete R[B.indexVar];let M=o$(D,R),T=M.match(_8),N;if(T){let[,I,E,A]=T;N=`<${I}${E} @for="${U}">${A}</${I}>`}else N=`<template @for="${U}">${M}</template>`;Q.push({start:K,end:O,replacement:N}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:H}=Q[z];J=J.substring(0,K)+H+J.substring(q)}return J}function Oz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(H)=>{let W=X+1;while(W<Q){let U=$[W];if(U==="\\"){W+=2;continue}if(U===H)return W+1;W++}return Q},z=()=>{let H=X+2;while(H<Q&&$[H]!==`
3473
+ ${$.slice(J)}`}var $z=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Zz($){return $z.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function Jz($,Z){if(!$.includes("</body>"))return $;if(Zz($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await G8(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${z8(K)};</script>
3474
+ `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-abffw83w.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3475
+ </body>`+$.slice(z+7)}var H8=Symbol.for("stx.lazy-module-promises");function Xz(){let $=globalThis;return $[H8]??=new Map,$[H8]}function s($,Z){let J=Xz(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var p$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,w8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Yz=65536,Qz=4,h9=new Map;function TL(){h9.clear()}function Gz($){let Z=[];for(let J of x2($,H2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function zz($,Z={}){let J=$.length>=Yz,X=J?h9.get($):void 0;if(X===void 0){if(X=Gz($),J)_8(h9,Qz),h9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function R8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=U8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=U8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function U8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function s$($,Z){return F8($,Z)}function Kz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function qz($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function Wz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${p$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=x2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=R8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let H=G[1],U=/\/\s*>$/.test(Q.token)||u9.has(H.toLowerCase())?Q.end:N8($,Q.start,H,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var j8=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 Hz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function B8($,Z,J,X){if(!$)return!1;let Y=Hz($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(j8.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=H.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(j8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function g9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(w8);if(Q&&Uz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Uz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function D8($,Z){let J=qz($);function X(Y){let Q=Y,G=Wz(Y),z=(W)=>{let U=new Set;for(let j of G)if(W>j.start&&W<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,H=[];while((q=K.exec(Q))!==null){let W=q.index,U=W+q[0].length,j=1,B=U;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(U,B-1).trim(),F=B,O=1,_=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){_=w.index+w[0].length;break}}if(O!==0)continue;let D=Q.substring(F,_-6).trim(),R;if(Kz(D)){let M=R2(Q.substring(W,_));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),N=z(W);if(!(T.length>0&&T.every((A)=>B8(A.condition,J,Z,N))))continue;R=M[0].branches.map((A)=>{let k=X(A.content);if(A.type==="elseif")return g9(k,"@else-if",A.condition??"");if(A.type==="else")return g9(k,"@else");return g9(k,"@if",A.condition??"")}).join(`
3476
+ `)}else{if(!B8(V,J,Z,z(W)))continue;R=g9(X(D),"@if",V)}H.push({start:W,end:_,replacement:R}),K.lastIndex=_}for(let W=H.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=H[W];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function jz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var u9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),V8=/<(script|style)\b/iy,Bz=/<\/script/gi,Vz=/<\/style/gi;function N8($,Z,J,X){if(u9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let U=$.indexOf("-->",z+4);if(U===-1)return-1;z=U+3;continue}V8.lastIndex=z;let q=V8.exec($);if(q){let U=$.indexOf(">",z);if(U===-1)return-1;if($[U-1]==="/"){z=U+1;continue}let j=q[1].toLowerCase()==="script"?Bz:Vz;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!U){z++;continue}if(U[1].toLowerCase()===Y){if(G--,z+=U[0].length,G===0)return z;continue}z+=U[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!H){z++;continue}let W=$.indexOf(">",z);if(W===-1)return-1;if(H[1].toLowerCase()===Y){let U=$.slice(z,W+1);if(!(/\/\s*>$/.test(U)||u9.has(Y)))G++}z=W+1}return-1}var Lz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Oz($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return Lz.test(Q)}function M8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(W)=>Z.some(([U,j])=>W>=U&&W<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[W,U,j,B,V,F,O]=z,_=jz(V);if(_===void 0)continue;let L=z.index,w=L+W.length,M=!!O||/\/\s*>$/.test(W)||u9.has(U.toLowerCase())?w:N8($,L,U,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Oz($,M)){Q.lastIndex=w;continue}if(_===!0){let N=`<${U}${j}${F}${O}>`;G.push({start:L,end:w,replacement:N});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((W,U)=>W.start-U.start);let K=[],q=-1;for(let W of G){if(W.start<q)continue;K.push(W),q=W.end}let H=$;for(let W=K.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=K[W];H=H.substring(0,U)+B+H.substring(j)}return H}function o$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,H=1,W=q;while(W<J.length&&H>0){if(J[W]==="(")H++;else if(J[W]===")")H--;W++}if(H!==0)continue;let U=J.substring(q,W-1).trim(),j=W,B=R8(U),V=z==="for"?"@endfor":"@endforeach",F=1,O=j,_=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");_.lastIndex=j;let L;while((L=_.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){O=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:O,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let E=I.split(/[.[(]/)[0].trim(),A=Z?E in Z:!1,k=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(E));if(E&&(A||k)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let D=J.substring(j,O-V.length).trim(),R=Z?{...Z}:{};if(B.itemVar)delete R[B.itemVar];if(B.indexVar)delete R[B.indexVar];let M=o$(D,R),T=M.match(w8),N;if(T){let[,I,E,A]=T;N=`<${I}${E} @for="${U}">${A}</${I}>`}else N=`<template @for="${U}">${M}</template>`;Q.push({start:K,end:O,replacement:N}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:H}=Q[z];J=J.substring(0,K)+H+J.substring(q)}return J}function Fz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(H)=>{let W=X+1;while(W<Q){let U=$[W];if(U==="\\"){W+=2;continue}if(U===H)return W+1;W++}return Q},z=()=>{let H=X+2;while(H<Q&&$[H]!==`
3477
3477
  `)H++;return H},K=()=>{let H=X+2;while(H<Q-1){if($[H]==="*"&&$[H+1]==="/")return H+2;H++}return Q},q=(H)=>{let W=H,U=0;while(W<Q){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<Q&&$[B]!==`
3478
- `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){U++,W++;continue}if(j===")"||j==="]"||j==="}"){U--,W++;continue}if(j===";"&&U===0)return W+1;W++}return Q};while(X<Q){let H=$[X];if(H==="/"&&$[X+1]==="/"){let W=z();J.push($.slice(X,W)),X=W;continue}if(H==="/"&&$[X+1]==="*"){let W=K();J.push($.slice(X,W)),X=W;continue}if(H==='"'||H==="'"||H==="`"){let W=G(H);J.push($.slice(X,W)),X=W;continue}if(H==="{"){Y++,J.push(H),X++;continue}if(H==="}"){Y--,J.push(H),X++;continue}if(Y===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(H),X++}return J.join("")}var Fz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function i$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function _z($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!i$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function wz($,Z){if(_z($,"<body",Z)){let Y=new RegExp(`<body(${p$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!i$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${p$})>`,"gi"),X;while((X=J.exec($))!==null){if(i$(X.index,X.index+X[0].length,Z))continue;if(Fz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Rz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function Dz($,Z,J){let X=Gz($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|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*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-rfqw1q2h.js"));for(let _ of X){let L=_.body;if(T1(_.attrs))L=k1(L);if(Y.test(L)){Q.push({content:L,start:_.start,end:_.end});continue}if(!G(L))continue;try{let w=await z(J2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:_.start,end:_.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((_)=>_.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,H=[];for(let _=0;_<Q.length;_++){let L=Q[_].bundled??J2(Q[_].content).code;if(!Q[_].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Iz(L);let w=e0(L);H.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
3478
+ `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){U++,W++;continue}if(j===")"||j==="]"||j==="}"){U--,W++;continue}if(j===";"&&U===0)return W+1;W++}return Q};while(X<Q){let H=$[X];if(H==="/"&&$[X+1]==="/"){let W=z();J.push($.slice(X,W)),X=W;continue}if(H==="/"&&$[X+1]==="*"){let W=K();J.push($.slice(X,W)),X=W;continue}if(H==='"'||H==="'"||H==="`"){let W=G(H);J.push($.slice(X,W)),X=W;continue}if(H==="{"){Y++,J.push(H),X++;continue}if(H==="}"){Y--,J.push(H),X++;continue}if(Y===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(H),X++}return J.join("")}var _z=new Set(["script","style","html","head","meta","link","title","!doctype"]);function i$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function wz($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!i$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Rz($,Z){if(wz($,"<body",Z)){let Y=new RegExp(`<body(${p$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!i$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${p$})>`,"gi"),X;while((X=J.exec($))!==null){if(i$(X.index,X.index+X[0].length,Z))continue;if(_z.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Dz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function Nz($,Z,J){let X=zz($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|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*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-e26spfv8.js"));for(let _ of X){let L=_.body;if(T1(_.attrs))L=k1(L);if(Y.test(L)){Q.push({content:L,start:_.start,end:_.end});continue}if(!G(L))continue;try{let w=await z(J2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:_.start,end:_.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((_)=>_.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,H=[];for(let _=0;_<Q.length;_++){let L=Q[_].bundled??J2(Q[_].content).code;if(!Q[_].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Tz(L);let w=e0(L);H.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
3479
3479
  ${w}`)}let W=H.join(`
3480
3480
 
3481
- `);W=Oz(W);let U=Nz(W),j=U.split(",").map((_)=>_.trim()).filter(Boolean),B=n$(W,J),V=`
3481
+ `);W=Fz(W);let U=Mz(W),j=U.split(",").map((_)=>_.trim()).filter(Boolean),B=n$(W,J),V=`
3482
3482
  <script data-stx-scoped>
3483
3483
  function ${q}() {
3484
3484
  ${o1("const",j)}
@@ -3487,19 +3487,19 @@ ${Z2(`${B}${W}`)}
3487
3487
  }
3488
3488
  window.__stx_latestSetup=${q};
3489
3489
  if(window.stx)window.stx._latestSetup=${q};
3490
- </script>`,F=wz($,Q);return{output:Rz($,Q,F,q),setupCode:V}}function Nz($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z="",K=()=>{Q++;let B=!1;while(Q<G){let V=Z[Q];if(V==="\\"){Q+=2;continue}if(V==="["&&!B){B=!0,Q++;continue}if(V==="]"&&B){B=!1,Q++;continue}if(V==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(V===`
3490
+ </script>`,F=Rz($,Q);return{output:Dz($,Q,F,q),setupCode:V}}function Mz($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z="",K=()=>{Q++;let B=!1;while(Q<G){let V=Z[Q];if(V==="\\"){Q+=2;continue}if(V==="["&&!B){B=!0,Q++;continue}if(V==="]"&&B){B=!1,Q++;continue}if(V==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(V===`
3491
3491
  `)return;Q++}},q=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},H=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')H(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3492
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let L=B[2];if(!X.has(L))J.push(L),X.add(L);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let D=w.indexOf(":"),M=(D>=0?w.slice(D+1).trim():w).split(/[\s=]/)[0];if(M&&!X.has(M))J.push(M),X.add(M)});return}let F=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let D=w.split(/[\s=]/)[0];if(D&&!X.has(D))J.push(D),X.add(D)});return}let O=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))J.push(L),X.add(L);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let L=_[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){H(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){W(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){K(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function M8($,Z,J,X){if(!s$($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await Dz(Y,J,X);if(Y=Q,!G){let z=i0(Y);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let K=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Y=Y.slice(0,z.index)+K+Y.slice(z.index+z.tag.length)}}if(Y=await f9(Y,Z),G){let z=V8(Y,/<\/head>/i),K=z===-1?V8(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
3492
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let L=B[2];if(!X.has(L))J.push(L),X.add(L);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let D=w.indexOf(":"),M=(D>=0?w.slice(D+1).trim():w).split(/[\s=]/)[0];if(M&&!X.has(M))J.push(M),X.add(M)});return}let F=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let D=w.split(/[\s=]/)[0];if(D&&!X.has(D))J.push(D),X.add(D)});return}let O=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))J.push(L),X.add(L);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let L=_[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){H(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){W(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){K(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function A8($,Z,J,X){if(!s$($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await Nz(Y,J,X);if(Y=Q,!G){let z=i0(Y);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let K=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Y=Y.slice(0,z.index)+K+Y.slice(z.index+z.tag.length)}}if(Y=await f9(Y,Z),G){let z=L8(Y,/<\/head>/i),K=z===-1?L8(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
3493
3493
  ${Y.slice(z)}`;else if(K!==-1){let q=/<body[^>]*>/i.exec(Y.slice(K))[0],H=K+q.length;Y=`${Y.slice(0,H)}
3494
3494
  ${G}${Y.slice(H)}`}else Y=`${Y}
3495
- ${G}`}return Y}function V8($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Y;while((Y=J.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let K=G+z.index;if(!X.some(([H,W])=>K>=H&&K<W))return K;G=K+Math.max(z[0].length,1)}return-1}var L8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Mz($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Y=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return L8;return`var ${Z.join(", ")}; ${L8}`}var Az=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Iz($){return $.replace(Az,(Z,J)=>Mz(J))}import Y2 from"path";import A8 from"process";function X2($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(A8.env)){if(!X.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Y),J[X]=Y}return Z["import.meta.env"]=JSON.stringify(J),Z}function EL($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(A8.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function I8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function T8($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Y2.join(Y,$);if(await Bun.file(G).exists())return G;Y=Y2.dirname(Y)}X=Y2.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Y2.resolve(Z,$);else X=Y2.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var k8=Symbol.for("stx.inline-assets.import-meta");function Tz($,Z){if(!$.includes("import.meta"))return;let J=Error(`[stx] ${Z} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
3496
- `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw J[k8]=!0,J}async function E8($,Z,J){let X=$,Y=Y2.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[q,H,W,U]=G;if(I8(W))continue;let j=await T8(W,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:X2()});if(F.outputs.length>0)B=await F.outputs[0].text(),Tz(B,W)}let V=`<script>
3495
+ ${G}`}return Y}function L8($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Y;while((Y=J.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let K=G+z.index;if(!X.some(([H,W])=>K>=H&&K<W))return K;G=K+Math.max(z[0].length,1)}return-1}var O8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Az($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Y=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return O8;return`var ${Z.join(", ")}; ${O8}`}var Iz=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Tz($){return $.replace(Iz,(Z,J)=>Az(J))}import Y2 from"path";import I8 from"process";function X2($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(I8.env)){if(!X.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Y),J[X]=Y}return Z["import.meta.env"]=JSON.stringify(J),Z}function bL($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(I8.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function T8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function k8($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Y2.join(Y,$);if(await Bun.file(G).exists())return G;Y=Y2.dirname(Y)}X=Y2.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Y2.resolve(Z,$);else X=Y2.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var E8=Symbol.for("stx.inline-assets.import-meta");function kz($,Z){if(!$.includes("import.meta"))return;let J=Error(`[stx] ${Z} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
3496
+ `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw J[E8]=!0,J}async function b8($,Z,J){let X=$,Y=Y2.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[q,H,W,U]=G;if(T8(W))continue;let j=await k8(W,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:X2()});if(F.outputs.length>0)B=await F.outputs[0].text(),kz(B,W)}let V=`<script>
3497
3497
  // Source: ${W}
3498
3498
  ${B}
3499
- </script>`;X=X.replace(q,V),Q.lastIndex=0}catch(B){if(B?.[k8])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=z.exec(X))!==null){let[q,H,W,U]=K,j=H+U;if(I8(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let V=await T8(W,Y,Z);if(V)try{let F=await Bun.file(V).text();J.add(V);let O=`<style>
3499
+ </script>`;X=X.replace(q,V),Q.lastIndex=0}catch(B){if(B?.[E8])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=z.exec(X))!==null){let[q,H,W,U]=K,j=H+U;if(T8(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let V=await k8(W,Y,Z);if(V)try{let F=await Bun.file(V).text();J.add(V);let O=`<style>
3500
3500
  /* Source: ${W} */
3501
3501
  ${F}
3502
- </style>`;X=X.replace(q,O),z.lastIndex=0}catch(F){}}}return X}function r$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,K=G+1,q=null,H=!1;while(K<J.length&&z>0){let L=J[K];if(H){H=!1,K++;continue}if(L==="\\"&&q){H=!0,K++;continue}if(q){if(L===q)q=null;K++;continue}if(L==='"'||L==="'"||L==="`"){q=L,K++;continue}if(L==="(")z++;else if(L===")"){if(z--,z===0)break}K++}if(z!==0)break;let W=J.substring(G+1,K).trim(),U=J.substring(Q,K+1),j=-1,B=0,V=null,F=!1;for(let L=0;L<W.length;L++){let w=W[L];if(F){F=!1;continue}if(w==="\\"&&V){F=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=L;break}}let O=j>=0?W.substring(0,j).trim():W,_=j>=0?W.substring(j+1).trim():void 0;try{let L=O.trim(),w;if(B0(L))w=U0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let D;if(_==="true")D=JSON.stringify(w,null,2);else D=JSON.stringify(w);let R=D.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+R+J.substring(K+1),X.lastIndex=Q+R.length}catch(L){s0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+U.length}}return J}function a$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function C8($){let Z=$,J=/@memo\s*\(/g,X,Y=[];while((X=J.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,z=1,K=G;while(K<Z.length&&z>0){if(Z[K]==="(")z++;else if(Z[K]===")")z--;K++}if(z!==0)continue;let q=Z.slice(G,K-1).trim(),H=K,W=Z.slice(H),U=W.indexOf("@endmemo");if(U===-1)continue;let j=W.slice(0,U),B=H+U+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=V?V[0].length:0,O=j.slice(F),_=j.match(/(\s*)$/),L=_?_[0].length:0,w=O.slice(0,O.length-L),D=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(D){let[M,T,N="",I]=D,E=`<${T}${N} data-stx-memo="${q}"${I}>`;R=j.slice(0,F)+E+w.slice(M.length)+j.slice(F+w.length)}else R=`${j.slice(0,F)}<div data-stx-memo="${q}">${w}</div>${j.slice(F+w.length)}`;Y.push({start:Q,end:B,replacement:R}),J.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function t$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function S8($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=x2($,(K,q)=>{J.lastIndex=q;let H=J.exec(K);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:K,end:q,token:H}of X){let W=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===W)break}continue}let U=/\sdata-stx-scope\s*=/.test(H);if(!Q&&!U&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push($.slice(G,K),H.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=q;if(!P8.has(W)&&!/\/>$/.test(H)){if(Y.push({name:W,scoped:U}),U)Q++}}return z.push($.slice(G)),z.join("")}var P8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),v8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,b8=/<\/?\s*([a-z][\w-]*)/iy,kz=/\s/;function Ez($,Z){let J=Z-1;while(J>=0&&kz.test($[J]))J--;return J>=0&&$[J]==="/"}function bz($,Z){let J=!1,X=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(J){if(Q==="'")J=!1}else if(X){if(Q==='"')X=!1}else if(Q==="'")J=!0;else if(Q==='"')X=!0;else if(Q===">")return Y}return-1}function yz($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Y=!1,Q=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),K=z===-1?$.length:z;if(K>X){if(J===0)while(X<K){let W=$.indexOf(Q?"}":"{",X);if(W===-1||W>=K){if(Q)G=!1;else Y=!1;break}if(W>X)if(Q)G=!1;else Y=!1;if(Q){if(G)return!0;G=!0}else if(Y)Q=!0,G=!1;else Y=!0;X=W+1}X=K;continue}if($.startsWith("<!--",X)){let W=$.indexOf("-->",X);X=W===-1?$.length:W+3;continue}let q=bz($,X);if(q===-1)break;b8.lastIndex=X;let H=b8.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!Ez($,q)&&!P8.has(H))J++;X=q+1}return!1}function x8($){if($.length>=32768&&!y8($))return $;let J=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index,z=G+Q[0].length,K=!1,q=!1,H=-1;while(z<$.length){let U=$[z];if(K){if(U==="'")K=!1}else if(q){if(U==='"')q=!1}else if(U==="'")K=!0;else if(U==='"')q=!0;else if(U===">"){H=z;break}z++}if(H===-1)continue;let W=$.slice(G,H+1);if(v8.test(W))continue;if(W.includes("x-cloak"))continue;if(yz($,H+1))X+=$.slice(Y,H)+" x-cloak>",Y=H+1}return X+=$.slice(Y),X}var Cz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Sz=/<\/script>/gi,Pz=/<\/style>/gi;function f8($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?Sz:Pz;B.lastIndex=Q;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Q+Y[0].length,K=!1,q=!1,H=-1;while(z<$.length){let B=$[z];if(K){if(B==="'")K=!1}else if(q){if(B==='"')q=!1}else if(B==="'")K=!0;else if(B==='"')q=!0;else if(B===">"){H=z;break}z++}if(H===-1)continue;let W=$.slice(Q+Y[0].length,H);if(v8.test(W))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(W))continue;if(!Cz.test(W))continue;let U=$[H-1]==="/",j=U?H-1:H;J+=`${$.slice(X,j)} x-cloak${U?" ":""}`,X=j}return J+=$.slice(X),J}var e$=y1(256),vz=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}];function $3($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=U1($,Z,X,JSON.stringify(Y)),G=e$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],K=[],q=z0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of vz){if(z.some((O)=>/\w/.test(O)&&B.includes(O)))continue;j.lastIndex=0;let F=q.match(j);if(F&&F.length>0){let O=q.split(`
3502
+ </style>`;X=X.replace(q,O),z.lastIndex=0}catch(F){}}}return X}function r$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,K=G+1,q=null,H=!1;while(K<J.length&&z>0){let L=J[K];if(H){H=!1,K++;continue}if(L==="\\"&&q){H=!0,K++;continue}if(q){if(L===q)q=null;K++;continue}if(L==='"'||L==="'"||L==="`"){q=L,K++;continue}if(L==="(")z++;else if(L===")"){if(z--,z===0)break}K++}if(z!==0)break;let W=J.substring(G+1,K).trim(),U=J.substring(Q,K+1),j=-1,B=0,V=null,F=!1;for(let L=0;L<W.length;L++){let w=W[L];if(F){F=!1;continue}if(w==="\\"&&V){F=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=L;break}}let O=j>=0?W.substring(0,j).trim():W,_=j>=0?W.substring(j+1).trim():void 0;try{let L=O.trim(),w;if(B0(L))w=U0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let D;if(_==="true")D=JSON.stringify(w,null,2);else D=JSON.stringify(w);let R=D.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+R+J.substring(K+1),X.lastIndex=Q+R.length}catch(L){s0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+U.length}}return J}function a$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function S8($){let Z=$,J=/@memo\s*\(/g,X,Y=[];while((X=J.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,z=1,K=G;while(K<Z.length&&z>0){if(Z[K]==="(")z++;else if(Z[K]===")")z--;K++}if(z!==0)continue;let q=Z.slice(G,K-1).trim(),H=K,W=Z.slice(H),U=W.indexOf("@endmemo");if(U===-1)continue;let j=W.slice(0,U),B=H+U+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=V?V[0].length:0,O=j.slice(F),_=j.match(/(\s*)$/),L=_?_[0].length:0,w=O.slice(0,O.length-L),D=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(D){let[M,T,N="",I]=D,E=`<${T}${N} data-stx-memo="${q}"${I}>`;R=j.slice(0,F)+E+w.slice(M.length)+j.slice(F+w.length)}else R=`${j.slice(0,F)}<div data-stx-memo="${q}">${w}</div>${j.slice(F+w.length)}`;Y.push({start:Q,end:B,replacement:R}),J.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function t$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function P8($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=x2($,(K,q)=>{J.lastIndex=q;let H=J.exec(K);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:K,end:q,token:H}of X){let W=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===W)break}continue}let U=/\sdata-stx-scope\s*=/.test(H);if(!Q&&!U&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push($.slice(G,K),H.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=q;if(!v8.has(W)&&!/\/>$/.test(H)){if(Y.push({name:W,scoped:U}),U)Q++}}return z.push($.slice(G)),z.join("")}var v8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),x8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,y8=/<\/?\s*([a-z][\w-]*)/iy,Ez=/\s/;function bz($,Z){let J=Z-1;while(J>=0&&Ez.test($[J]))J--;return J>=0&&$[J]==="/"}function yz($,Z){let J=!1,X=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(J){if(Q==="'")J=!1}else if(X){if(Q==='"')X=!1}else if(Q==="'")J=!0;else if(Q==='"')X=!0;else if(Q===">")return Y}return-1}function Cz($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Y=!1,Q=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),K=z===-1?$.length:z;if(K>X){if(J===0)while(X<K){let W=$.indexOf(Q?"}":"{",X);if(W===-1||W>=K){if(Q)G=!1;else Y=!1;break}if(W>X)if(Q)G=!1;else Y=!1;if(Q){if(G)return!0;G=!0}else if(Y)Q=!0,G=!1;else Y=!0;X=W+1}X=K;continue}if($.startsWith("<!--",X)){let W=$.indexOf("-->",X);X=W===-1?$.length:W+3;continue}let q=yz($,X);if(q===-1)break;y8.lastIndex=X;let H=y8.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!bz($,q)&&!v8.has(H))J++;X=q+1}return!1}function f8($){if($.length>=32768&&!C8($))return $;let J=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index,z=G+Q[0].length,K=!1,q=!1,H=-1;while(z<$.length){let U=$[z];if(K){if(U==="'")K=!1}else if(q){if(U==='"')q=!1}else if(U==="'")K=!0;else if(U==='"')q=!0;else if(U===">"){H=z;break}z++}if(H===-1)continue;let W=$.slice(G,H+1);if(x8.test(W))continue;if(W.includes("x-cloak"))continue;if(Cz($,H+1))X+=$.slice(Y,H)+" x-cloak>",Y=H+1}return X+=$.slice(Y),X}var Sz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Pz=/<\/script>/gi,vz=/<\/style>/gi;function g8($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?Pz:vz;B.lastIndex=Q;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Q+Y[0].length,K=!1,q=!1,H=-1;while(z<$.length){let B=$[z];if(K){if(B==="'")K=!1}else if(q){if(B==='"')q=!1}else if(B==="'")K=!0;else if(B==='"')q=!0;else if(B===">"){H=z;break}z++}if(H===-1)continue;let W=$.slice(Q+Y[0].length,H);if(x8.test(W))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(W))continue;if(!Sz.test(W))continue;let U=$[H-1]==="/",j=U?H-1:H;J+=`${$.slice(X,j)} x-cloak${U?" ":""}`,X=j}return J+=$.slice(X),J}var e$=y1(256),xz=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}];function $3($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=U1($,Z,X,JSON.stringify(Y)),G=e$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],K=[],q=z0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of xz){if(z.some((O)=>/\w/.test(O)&&B.includes(O)))continue;j.lastIndex=0;let F=q.match(j);if(F&&F.length>0){let O=q.split(`
3503
3503
  `),_=$.split(`
3504
3504
  `),L=[];O.forEach((M,T)=>{if(j.lastIndex=0,j.test(M))L.push(T+1)});let w=L.length>0?` (script line${L.length>1?"s":""} ${L.join(", ")})`:"",D=L.slice(0,3).map((M)=>` ${M} | ${(_[M-1]??"").trim().slice(0,100)}`).join(`
3505
3505
  `),R=D?`
@@ -3507,40 +3507,40 @@ ${D}`:"";K.push(` \u2717 ${B}${w}
3507
3507
  \u2192 ${V}${R}`)}}if(K.length===0){e$.set(Q,"");return}let H=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},U=`[STX] DOM API violation in ${X&&X!==Z?`${H(X)} (composed into ${H(Z)})`:H(Z)}:
3508
3508
  ${K.join(`
3509
3509
  `)}
3510
- Tip: prefer useRef(), navigate(), and composables for component code`;if(e$.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}hz();import Z3 from"path";var xz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,fz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function gz($,Z){if(!Z||!$.includes("/"))return $;let J=Z3.dirname(Z);return $.replace(xz,(X,Y,Q,G)=>{let z=Z3.resolve(J,G);return`${Y}${Q}${z.split(Z3.sep).join("/")}${Q}`})}function g8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(fz,(J,X,Y,Q)=>`${X}${gz(Y,Z)}${Q}`)}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";function h8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function GZ($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
3510
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(e$.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}uz();import Z3 from"path";var fz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,gz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function hz($,Z){if(!Z||!$.includes("/"))return $;let J=Z3.dirname(Z);return $.replace(fz,(X,Y,Q,G)=>{let z=Z3.resolve(J,G);return`${Y}${Q}${z.split(Z3.sep).join("/")}${Q}`})}function h8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(gz,(J,X,Y,Q)=>`${X}${hz(Y,Z)}${Q}`)}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";function u8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zZ($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
3511
3511
  `,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let H=$[K];if(H==="\\"){K+=2;continue}if(H==="[")q=!0;else if(H==="]")q=!1;else if(H==="/"&&!q){K++;break}else if(H===`
3512
3512
  `){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
3513
- `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function zZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function u8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await s("stx/client-module-registry",()=>import("./chunk-bkhksb74.js")),Q=[],G=await Y(X(...$),{minify:Z.buildMode==="compile",collectInputs:Q});for(let z of Q)J?.add(z);if(!G)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-nyw7c3e3.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(G)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${G.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function mz($,Z=""){let J=zZ($,"data-stx-runtime");if(!J)return $;let X=j2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3513
+ `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function KZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function m8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await s("stx/client-module-registry",()=>import("./chunk-dmtvgwmm.js")),Q=[],G=await Y(X(...$),{minify:Z.buildMode==="compile",collectInputs:Q});for(let z of Q)J?.add(z);if(!G)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-abffw83w.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(G)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${G.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function dz($,Z=""){let J=KZ($,"data-stx-runtime");if(!J)return $;let X=j2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3514
3514
  `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=j2(Q);if(G===-1)return Y+Z+`
3515
3515
  `+Q;return Q.slice(0,G)+Y+Z+`
3516
- `+Q.slice(G)}async function X3($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;f$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await c9(Z,J,X.runtimeConfig);if(Q)T3(Z),Z.__stx_head_injections=C$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!y2()&&!C2())&&J&&J.endsWith(".stx"))ZZ($,J);try{return await a8.timeAsync("template-processing",async()=>{let G=await dz($,Z,J,X,Y);if(Q)G=t$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??$Z(),H=(Z.__stx_head_raw||"").trim(),W,U=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)W=U[1].trim(),H=H.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||W||j,V=!q.title&&(!!W||!!j),F=q.meta||[],O=new Set(F.map((M)=>$2(M)).filter(Boolean)),_={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!O.has($2(M))),...F],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
3517
- `),...q.htmlAttrs&&{htmlAttrs:a6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=d$(G);if(G=$8(G,_,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=e6(G,z),G=t6(G,_.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=o8(M);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3518
- <meta name="stx-layout" content="${h8(M)}">
3519
- <meta name="stx-layout-group" content="${h8(T)}">`)}let D=G.match(/function (__stx_setup_\w+)\(/),R=D?i0(G):null;if(D&&R&&!/\bdata-stx=/.test(R.tag)){G=x1(G,(T,N)=>`<body${N} data-stx="${D[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${D[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??C$(),K=u$(G);if(K!==null)z.beforeClose.push(K);let q=x$(G);if(q!==null)z.afterOpen.push(q);G=f6(G,z);let H=X.app?.colorMode;if(H)G=u6(G,H)}if(Q)if(zZ(G,"data-stx-runtime")){let K=null,q=null,H=null,W=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-bs64kcb6.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await u8([G,q],X,Y);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-rzwwtqxm.js"));W=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-04qfhvwh.js")),B=X.composablesDir,V=[K,q,W].filter((O)=>O!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)H=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${F}</script>`}catch{}let U=[K,q,H,W].filter((j)=>j!==null).map((j)=>`
3520
- ${j}`).join("");G=mz(G,U)}else{let K=await u8([G],X,Y);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
3521
- `+G.slice(q)}}if(Q)G=m6(G);if(Q&&Z.__stx_inject_css!==!1)G=await e8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=t8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=r8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=i6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof c8)throw G;let z=G instanceof Error?G.message:String(G),K=new f2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(s0.log(K,{filePath:J,context:Z}),i8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return p8.createFallbackContent("Template Processing",K)}}async function dz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!y0.isAbsolute(X.partialsDir)?y0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!y0.isAbsolute(X.componentsDir)?y0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!y0.isAbsolute(X.layoutsDir)?y0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await pz(J,Z),cz(Z,z),K=await g2(()=>I6(K,Z,J,z),K,(L)=>{s0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=V1(K,E9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let H=q.tokens,W=(L)=>H.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,D)=>H[Number(D)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=y6(K),K=await E8(K,J,Y);let j={};K=I$(K,j);let B={...Z.__sections||{}},V="",F=W4(q4($)),O=/@nolayout\b/.test(K)||F===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let _=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)V=_[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(K))K=`@section('content')
3516
+ `+Q.slice(G)}async function X3($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;f$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await c9(Z,J,X.runtimeConfig);if(Q)k3(Z),Z.__stx_head_injections=C$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!y2()&&!C2())&&J&&J.endsWith(".stx"))JZ($,J);try{return await t8.timeAsync("template-processing",async()=>{let G=await lz($,Z,J,X,Y);if(Q)G=t$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??ZZ(),H=(Z.__stx_head_raw||"").trim(),W,U=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)W=U[1].trim(),H=H.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||W||j,V=!q.title&&(!!W||!!j),F=q.meta||[],O=new Set(F.map((M)=>$2(M)).filter(Boolean)),_={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!O.has($2(M))),...F],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
3517
+ `),...q.htmlAttrs&&{htmlAttrs:t6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=d$(G);if(G=Z8(G,_,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=$8(G,z),G=e6(G,_.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=r8(M);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3518
+ <meta name="stx-layout" content="${u8(M)}">
3519
+ <meta name="stx-layout-group" content="${u8(T)}">`)}let D=G.match(/function (__stx_setup_\w+)\(/),R=D?i0(G):null;if(D&&R&&!/\bdata-stx=/.test(R.tag)){G=x1(G,(T,N)=>`<body${N} data-stx="${D[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${D[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??C$(),K=u$(G);if(K!==null)z.beforeClose.push(K);let q=x$(G);if(q!==null)z.afterOpen.push(q);G=g6(G,z);let H=X.app?.colorMode;if(H)G=m6(G,H)}if(Q)if(KZ(G,"data-stx-runtime")){let K=null,q=null,H=null,W=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-wpzcgwqj.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await m8([G,q],X,Y);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-hk88xttw.js"));W=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-8rt0vg06.js")),B=X.composablesDir,V=[K,q,W].filter((O)=>O!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)H=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${F}</script>`}catch{}let U=[K,q,H,W].filter((j)=>j!==null).map((j)=>`
3520
+ ${j}`).join("");G=dz(G,U)}else{let K=await m8([G],X,Y);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
3521
+ `+G.slice(q)}}if(Q)G=d6(G);if(Q&&Z.__stx_inject_css!==!1)G=await $Z(G,void 0,X.buildMode==="serve",!0);else if(Q)G=e8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=a8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=n6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof p8)throw G;let z=G instanceof Error?G.message:String(G),K=new f2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(s0.log(K,{filePath:J,context:Z}),n8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return i8.createFallbackContent("Template Processing",K)}}async function lz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!y0.isAbsolute(X.partialsDir)?y0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!y0.isAbsolute(X.componentsDir)?y0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!y0.isAbsolute(X.layoutsDir)?y0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await iz(J,Z),pz(Z,z),K=await g2(()=>T6(K,Z,J,z),K,(L)=>{s0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=V1(K,E9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let H=q.tokens,W=(L)=>H.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,D)=>H[Number(D)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=C6(K),K=await b8(K,J,Y);let j={};K=I$(K,j);let B={...Z.__sections||{}},V="",F=H4(W4($)),O=/@nolayout\b/.test(K)||F===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let _=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)V=_[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(K))K=`@section('content')
3522
3522
  ${K.trim()}
3523
3523
  @endsection`}if(!V&&!O&&z.defaultLayout){let L=m$(K),w=/@section\s*\(/.test(K);if(!L||w){let D="",R=y0.dirname(J),M=z.layoutsDir?y0.dirname(z.layoutsDir):process.cwd();for(let T=0;T<20;T++){let N=y0.join(R,"_layout.stx");if(await t(N)){D=N;break}let I=y0.dirname(R);if(I===R||I.length<M.length)break;R=I}if(D)V=D;else if(z.layoutsDir){let T=y0.isAbsolute(z.layoutsDir)?z.layoutsDir:y0.resolve(process.cwd(),z.layoutsDir),N=y0.join(T,`${z.defaultLayout}.stx`);if(await t(N))V=N}if(V&&!w)K=`@section('content')
3524
3524
  ${K.trim()}
3525
- @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,D)=>{return B[w]=D,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,D)=>{if(/^(['"]).*\1$/.test(D.trim()))return L;try{let R=X0(D.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,D)=>{if(D.includes("@parent"))B[w]=D.replace("@parent",C1);else B[w]=D.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,D)=>{return B[w]||D||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=T$(K,j),V){let L=[],w=u0(K),D=V1(w.output,Z9,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=D.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let N=M==="SCRIPT"?iz(w.scripts[Number(T)],J):D.tokens[Number(T)];if(N)L.push(N);return""}),L.length>0){let R=L.join(`
3525
+ @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,D)=>{return B[w]=D,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,D)=>{if(/^(['"]).*\1$/.test(D.trim()))return L;try{let R=X0(D.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,D)=>{if(D.includes("@parent"))B[w]=D.replace("@parent",C1);else B[w]=D.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,D)=>{return B[w]||D||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=T$(K,j),V){let L=[],w=u0(K),D=V1(w.output,Z9,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=D.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let N=M==="SCRIPT"?nz(w.scripts[Number(T)],J):D.tokens[Number(T)];if(N)L.push(N);return""}),L.length>0){let R=L.join(`
3526
3526
  `);B.content=B.content?`${B.content}
3527
- ${R}`:R,Z.__sections=B}}if(V)try{let L;if(y0.isAbsolute(V))L=V,Y.add(V);else L=await g2(()=>K9(V,J,G,Y),null,()=>{throw new f2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let N=(A)=>{if(!A)return[];try{let k=y0.isAbsolute(A)?A:y0.resolve(process.cwd(),A);return uz.readdirSync(k).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((A,k,C)=>C.indexOf(A)===k).sort(),E=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(s0.log(Error(E),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${E}`),G.debug)throw new f2(E,J);return K}let w=await g2(()=>Bun.file(L).text(),"",()=>{throw new f2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=g8(w,L);let D=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(D){if(G.debug)console.log(`Found nested layout: ${D[1]} in ${L}`);let N={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,C,y)=>{return N[C]=y.trim(),""});for(let[k,C]of Object.entries(N))if(B[k]&&B[k].includes(C1)){let y=B[k].indexOf(C1);B[k]=B[k].slice(0,y)+C+B[k].slice(y+C1.length)}else if(!B[k])B[k]=C;let E={...Z,__sections:B},A=`@layout('${D[1]}')${I}`;return await X3(A,E,L,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=I$(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,I,E)=>{return T[I]=E.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,I,E)=>{if(B[I]){let A=B[I];if(A.includes(C1)){let k=T[I]||"",C=A.indexOf(C1);A=A.slice(0,C)+k+A.slice(C+C1.length)}return A}return E||""}),M=lz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=T$(M,j),Z.__originalFilePath=J,K=await l8(M,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
3528
- ${K}`,W(K)}catch(L){return s0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return W(await l8(K,Z,J,G,Y))}function lz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function cz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function pz($,Z){await g2(()=>E6($,Z),void 0,(J)=>{s0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var J3="data-stx-source";function iz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(J3))return $;return`<script ${J3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function nz($){let Z=new RegExp(`${J3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function m8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function d8($,Z,J){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; ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${m8($)}</span><span style="display:block;margin-top:4px">${m8(J)}</span></div>`}async function sz($,Z,J){let{scanScriptTags:X}=await s("stx/signal-processing",()=>import("./chunk-vrbjwgva.js")),Y=[],Q=!y2()&&!C2();for(let z of X($)){let K=z.attrs;if(!/\bserver\b/.test(K))continue;let q=z.start+z.fullMatch.indexOf(">")+1,H=GZ($,q);if(H===-1)continue;let W=$.slice(q,H);if(!W.trim())continue;let U=nz(K)??J,j={index:z.start,length:H+9-z.start};try{let{extractVariables:B}=await s("stx/variable-extractor",()=>import("./chunk-rn0j7n49.js"));await B(W,Z,U,{preserveExisting:!0,onFailure:(V)=>{if(!Q||V.kind==="unknown")return;Y.push({...j,markup:d8(U,V.kind,V.message)})}})}catch(B){let V=B instanceof Error?B:Error(String(B));if(s0.log(V,{filePath:U,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${U}: ${V.message}`),Q)Y.push({...j,markup:d8(U,"unknown",V.message)})}}if(Y.length===0)return $;let G=$;for(let z of Y.sort((K,q)=>q.index-K.index))G=G.slice(0,z.index)+z.markup+G.slice(z.index+z.length);return G}async function oz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-hgxc6601.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return s0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function l8($,Z,J,X,Y){let Q=$,G=X;if(Q=await sz(Q,Z,J),Q=await oz(Q,Z,J),Q=await U6(Q,Z,J),Q=await j6(Q,Z,J),Q=await V7(Q,Z,J,G),X1(Q))Q=R8(Q,Z),Q=o$(Q,Z);Q=N8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-hxgmf1a8.js"));Q=z(Q,Z),Q=R6(Q,Z,J,G,!0),Q=await v6(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Q=K4(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-93z5qt1s.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-zxf0deg6.js"));Q=q(Q,Z,J);let{processTransitionDirectives:H,processTransitionAttributes:W}=await s("stx/transitions",()=>import("./chunk-a5cybvfv.js"));Q=H(Q,Z,J),Q=W(Q);let{processErrorBoundaryDirectives:U,stripRenderFailedMarkers:j}=await s("stx/error-boundaries",()=>import("./chunk-vcdd231w.js"));Q=U(Q,Z,J),Q=j(Q);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-83af26bs.js"));Q=B(Q,Z,J);let{processAsyncDirectives:V}=await s("stx/async-components",()=>import("./chunk-pt74619a.js"));Q=V(Q,Z,J);let{processKeepAliveDirectives:F}=await s("stx/keep-alive",()=>import("./chunk-175da6nh.js"));Q=F(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:_,processInfiniteListDirectives:L}=await s("stx/virtual-scrolling",()=>import("./chunk-1c2k7713.js"));Q=O(Q,Z,J),Q=_(Q,Z,J),Q=L(Q,Z,J);let{processPartialHydrationDirectives:w,processStaticDirectives:D}=await s("stx/partial-hydration",()=>import("./chunk-r55bx7r8.js"));Q=w(Q,Z,J),Q=D(Q);let{processComputedDirectives:R,processWatchDirectives:M}=await s("stx/computed",()=>import("./chunk-k11mck47.js"));Q=R(Q,Z,J),Q=M(Q,Z,J);let{processFormValidationDirectives:T}=await s("stx/forms-validation",()=>import("./chunk-55k6352k.js"));Q=T(Q,Z,J);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:E,resetHead:A}=await s("stx/head",()=>import("./chunk-vj5ywxmb.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)A();let k=N(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
3529
- `;if(Q=I(Q,Z),Q=E(Q,Z,J),Q=k6(Q),Q=d5(Q,Z),Q=U7(Q),Q=M6(Q),Q=await A$(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=k3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=t$(Q),Q=t0(Q,Z,J),Q=E$(Q),Q=U4(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=l5(Q,Z),Q=c5(Q,Z),Q=M2(Q,Z),Q=a5(Q,Z),Q=t5(Q,Z),Q=await $7(Q,Z,J,G),Q=await _4(Q,Z,J),Q=await n8(Q,Z,J,G),Q=s8(Q,Z,J,G),Q=JZ(Q,Z,J,G),Q=XZ(Q,Z,J),Q=YZ(Q,Z,J,G),Q=W7(Q,Z,J,G),Q=r$(Q,Z),Q=a$(Q),Q=C8(Q),!G.skipEventDirectives)Q=M3(Q,Z,J);if(Q=V4(Q,Z,J),G.debug){let f=/\bx-data\s*=/.test(Q),l=s$($);if(f&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3527
+ ${R}`:R,Z.__sections=B}}if(V)try{let L;if(y0.isAbsolute(V))L=V,Y.add(V);else L=await g2(()=>K9(V,J,G,Y),null,()=>{throw new f2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let N=(A)=>{if(!A)return[];try{let k=y0.isAbsolute(A)?A:y0.resolve(process.cwd(),A);return mz.readdirSync(k).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((A,k,C)=>C.indexOf(A)===k).sort(),E=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(s0.log(Error(E),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${E}`),G.debug)throw new f2(E,J);return K}let w=await g2(()=>Bun.file(L).text(),"",()=>{throw new f2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=h8(w,L);let D=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(D){if(G.debug)console.log(`Found nested layout: ${D[1]} in ${L}`);let N={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,C,y)=>{return N[C]=y.trim(),""});for(let[k,C]of Object.entries(N))if(B[k]&&B[k].includes(C1)){let y=B[k].indexOf(C1);B[k]=B[k].slice(0,y)+C+B[k].slice(y+C1.length)}else if(!B[k])B[k]=C;let E={...Z,__sections:B},A=`@layout('${D[1]}')${I}`;return await X3(A,E,L,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=I$(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,I,E)=>{return T[I]=E.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,I,E)=>{if(B[I]){let A=B[I];if(A.includes(C1)){let k=T[I]||"",C=A.indexOf(C1);A=A.slice(0,C)+k+A.slice(C+C1.length)}return A}return E||""}),M=cz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=T$(M,j),Z.__originalFilePath=J,K=await c8(M,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
3528
+ ${K}`,W(K)}catch(L){return s0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return W(await c8(K,Z,J,G,Y))}function cz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function pz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function iz($,Z){await g2(()=>b6($,Z),void 0,(J)=>{s0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var J3="data-stx-source";function nz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(J3))return $;return`<script ${J3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function sz($){let Z=new RegExp(`${J3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function d8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function l8($,Z,J){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; ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${d8($)}</span><span style="display:block;margin-top:4px">${d8(J)}</span></div>`}async function oz($,Z,J){let{scanScriptTags:X}=await s("stx/signal-processing",()=>import("./chunk-xgxf107n.js")),Y=[],Q=!y2()&&!C2();for(let z of X($)){let K=z.attrs;if(!/\bserver\b/.test(K))continue;let q=z.start+z.fullMatch.indexOf(">")+1,H=zZ($,q);if(H===-1)continue;let W=$.slice(q,H);if(!W.trim())continue;let U=sz(K)??J,j={index:z.start,length:H+9-z.start};try{let{extractVariables:B}=await s("stx/variable-extractor",()=>import("./chunk-h40194h3.js"));await B(W,Z,U,{preserveExisting:!0,onFailure:(V)=>{if(!Q||V.kind==="unknown")return;Y.push({...j,markup:l8(U,V.kind,V.message)})}})}catch(B){let V=B instanceof Error?B:Error(String(B));if(s0.log(V,{filePath:U,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${U}: ${V.message}`),Q)Y.push({...j,markup:l8(U,"unknown",V.message)})}}if(Y.length===0)return $;let G=$;for(let z of Y.sort((K,q)=>q.index-K.index))G=G.slice(0,z.index)+z.markup+G.slice(z.index+z.length);return G}async function rz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-5cjc1w05.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return s0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function c8($,Z,J,X,Y){let Q=$,G=X;if(Q=await oz(Q,Z,J),Q=await rz(Q,Z,J),Q=await j6(Q,Z,J),Q=await B6(Q,Z,J),Q=await L7(Q,Z,J,G),X1(Q))Q=D8(Q,Z),Q=o$(Q,Z);Q=M8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-p2bbfek9.js"));Q=z(Q,Z),Q=D6(Q,Z,J,G,!0),Q=await x6(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Q=q4(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-93z5qt1s.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-zxf0deg6.js"));Q=q(Q,Z,J);let{processTransitionDirectives:H,processTransitionAttributes:W}=await s("stx/transitions",()=>import("./chunk-a5cybvfv.js"));Q=H(Q,Z,J),Q=W(Q);let{processErrorBoundaryDirectives:U,stripRenderFailedMarkers:j}=await s("stx/error-boundaries",()=>import("./chunk-vcdd231w.js"));Q=U(Q,Z,J),Q=j(Q);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-83af26bs.js"));Q=B(Q,Z,J);let{processAsyncDirectives:V}=await s("stx/async-components",()=>import("./chunk-pt74619a.js"));Q=V(Q,Z,J);let{processKeepAliveDirectives:F}=await s("stx/keep-alive",()=>import("./chunk-175da6nh.js"));Q=F(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:_,processInfiniteListDirectives:L}=await s("stx/virtual-scrolling",()=>import("./chunk-1c2k7713.js"));Q=O(Q,Z,J),Q=_(Q,Z,J),Q=L(Q,Z,J);let{processPartialHydrationDirectives:w,processStaticDirectives:D}=await s("stx/partial-hydration",()=>import("./chunk-r55bx7r8.js"));Q=w(Q,Z,J),Q=D(Q);let{processComputedDirectives:R,processWatchDirectives:M}=await s("stx/computed",()=>import("./chunk-k11mck47.js"));Q=R(Q,Z,J),Q=M(Q,Z,J);let{processFormValidationDirectives:T}=await s("stx/forms-validation",()=>import("./chunk-55k6352k.js"));Q=T(Q,Z,J);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:E,resetHead:A}=await s("stx/head",()=>import("./chunk-vj5ywxmb.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)A();let k=N(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
3529
+ `;if(Q=I(Q,Z),Q=E(Q,Z,J),Q=E6(Q),Q=d5(Q,Z),Q=j7(Q),Q=A6(Q),Q=await A$(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=E3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=t$(Q),Q=t0(Q,Z,J),Q=E$(Q),Q=j4(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=l5(Q,Z),Q=c5(Q,Z),Q=M2(Q,Z),Q=a5(Q,Z),Q=t5(Q,Z),Q=await Z7(Q,Z,J,G),Q=await w4(Q,Z,J),Q=await s8(Q,Z,J,G),Q=o8(Q,Z,J,G),Q=XZ(Q,Z,J,G),Q=YZ(Q,Z,J),Q=QZ(Q,Z,J,G),Q=H7(Q,Z,J,G),Q=r$(Q,Z),Q=a$(Q),Q=S8(Q),!G.skipEventDirectives)Q=A3(Q,Z,J);if(Q=L4(Q,Z,J),G.debug){let f=/\bx-data\s*=/.test(Q),l=s$($);if(f&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3530
3530
  Both work on the same page, but they manage separate scopes.
3531
- Prefer signals (state/derived/effect) for new components.`)}Q=e7(Q,Z),Q=await L1(Q,Z,J),Q=x8(Q),Q=f8(Q),Q=$4(Q);let{processXElementDirectives:C}=await s("stx/x-element",()=>import("./chunk-2c907a77.js"));Q=C(Q);let y=Z.__originalFilePath||J,b=m9(Z);if(Q=await M8(Q,G,y,b),Q=_7(Q,Z),Q=await T6(Q,Z,J,G),G.media?.image?.autoSiblings){let f=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gzr4mcp2.js"));Q=await l(Q,{publicDir:f})}if(G.seo?.enabled)Q=QZ(Q,Z,G);let P=(f,l,Z0=!0)=>{if(!l)return f;let j0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),_0=f.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&_0){if(Z0)f=f.replace(_0[0],j0[0]);if(l=l.replace(j0[0],"").trim(),!l)return f}if(/<\/head>/i.test(f))return f.replace(/<\/head>/i,`${l}
3531
+ Prefer signals (state/derived/effect) for new components.`)}Q=$6(Q,Z),Q=await L1(Q,Z,J),Q=f8(Q),Q=g8(Q),Q=Z4(Q);let{processXElementDirectives:C}=await s("stx/x-element",()=>import("./chunk-2c907a77.js"));Q=C(Q);let y=Z.__originalFilePath||J,b=m9(Z);if(Q=await A8(Q,G,y,b),Q=w7(Q,Z),Q=await k6(Q,Z,J,G),G.media?.image?.autoSiblings){let f=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gzr4mcp2.js"));Q=await l(Q,{publicDir:f})}if(G.seo?.enabled)Q=GZ(Q,Z,G);let P=(f,l,Z0=!0)=>{if(!l)return f;let j0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),_0=f.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&_0){if(Z0)f=f.replace(_0[0],j0[0]);if(l=l.replace(j0[0],"").trim(),!l)return f}if(/<\/head>/i.test(f))return f.replace(/<\/head>/i,`${l}
3532
3532
  </head>`);if(/<head\b[^>]*>/i.test(f))return f.replace(/(<head\b[^>]*>)/i,`$1
3533
3533
  ${l}`);if(/<html\b[^>]*>/i.test(f))return f.replace(/(<html\b[^>]*>)/i,`$1
3534
3534
  <head>
3535
3535
  ${l}
3536
- </head>`);return f},{renderHead:h,getHead:p}=await s("stx/head",()=>import("./chunk-vj5ywxmb.js")),r=Z.__stx_runtime_head??p();if(r.title||r.meta?.length||r.link?.length){let f=h(r);if(f)Q=P(Q,f)}if(k.headContent)Q=P(Q,k.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=K7(Q,G.csp,Z);if(G.analytics?.enabled)Q=J4(Q,G);if(G.heatmap?.enabled)Q=Y4(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await s("stx/pwa/inject",()=>import("./chunk-syxe0cyd.js"));Q=f(Q,G)}let e=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),i=/window\.STX\s*=/.test(Q);if(e&&Y0&&!i){let l=`<script data-stx-scoped data-stx-run="once">
3537
- ${a3()}
3536
+ </head>`);return f},{renderHead:h,getHead:p}=await s("stx/head",()=>import("./chunk-vj5ywxmb.js")),r=Z.__stx_runtime_head??p();if(r.title||r.meta?.length||r.link?.length){let f=h(r);if(f)Q=P(Q,f)}if(k.headContent)Q=P(Q,k.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=q7(Q,G.csp,Z);if(G.analytics?.enabled)Q=X4(Q,G);if(G.heatmap?.enabled)Q=Q4(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await s("stx/pwa/inject",()=>import("./chunk-syxe0cyd.js"));Q=f(Q,G)}let e=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),i=/window\.STX\s*=/.test(Q);if(e&&Y0&&!i){let l=`<script data-stx-scoped data-stx-run="once">
3537
+ ${t3()}
3538
3538
  </script>`;if(Q.includes("</head>")){let Z0=Q.indexOf("</head>"),_0=Q.slice(0,Z0).indexOf("<script");if(_0!==-1){let Q0=Q.slice(0,_0),B1=Q.slice(_0);Q=Q0+l+`
3539
3539
  `+B1}else Q=Q.replace("</head>",`${l}
3540
3540
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3541
3541
  ${l}`);else Q=l+`
3542
- `+Q}{let{scanScriptTags:f}=await s("stx/signal-processing",()=>import("./chunk-vrbjwgva.js")),l=[];for(let Z0 of f(Q)){if(!/\bserver\b/i.test(Z0.attrs))continue;let j0=Z0.start+Z0.fullMatch.indexOf(">")+1,_0=GZ(Q,j0);if(_0===-1)continue;let Q0=_0+9;while(Q0<Q.length&&/\s/.test(Q[Q0]))Q0++;l.push({start:Z0.start,end:Q0})}if(l.length>0){let Z0=Array(l.length+1),j0=0;for(let _0=0;_0<l.length;_0++){let{start:Q0,end:B1}=l[_0];Z0[_0]=Q.slice(j0,Q0),j0=B1}Z0[l.length]=Q.slice(j0),Q=Z0.join("")}}let W0=l9(Q,J);if(W0.hasScoped)Q=W0.html;let a=Z.__stx_event_bindings||[],L0=!1,c0=[],p0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:g0}=await s("stx/signal-processing",()=>import("./chunk-vrbjwgva.js"));for(let f of g0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:l,content:Z0}of c0){L0=!0;let j0=Z0;$3(Z0,J,X.strict,Z.__originalFilePath);let _0=await d9(Z0,{eventBindings:a,attrs:l,hasColonDirectives:p0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(f,()=>_0)}if(L0)Z.__stx_event_bindings=[];if(!L0&&Z.__stxProcessingDepth===1){let f=Z.__stx_event_bindings||[];if(f.length>0){let l=X5(f);if(l){let Z0=Q.lastIndexOf("</body>");Q=Z0===-1?Q+l:Q.slice(0,Z0)+l+`
3543
- `+Q.slice(Z0)}Z.__stx_event_bindings=[]}}if(!z8(Q)&&K8(Q))Q=await f9(Q,G);if(Q=q8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=q7(Q,Z.cspNonce);return Q}import DZ from"path";import Q3 from"fs";import h2 from"path";function KZ($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function rz($){let Z=z0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function Y3($,Z){let J=z0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=KZ(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=KZ(J,Q,"(",")");if(z>=0)return{type:G,args:rz($.slice(Q+1,z))}}return null}var qZ=`
3542
+ `+Q}{let{scanScriptTags:f}=await s("stx/signal-processing",()=>import("./chunk-xgxf107n.js")),l=[];for(let Z0 of f(Q)){if(!/\bserver\b/i.test(Z0.attrs))continue;let j0=Z0.start+Z0.fullMatch.indexOf(">")+1,_0=zZ(Q,j0);if(_0===-1)continue;let Q0=_0+9;while(Q0<Q.length&&/\s/.test(Q[Q0]))Q0++;l.push({start:Z0.start,end:Q0})}if(l.length>0){let Z0=Array(l.length+1),j0=0;for(let _0=0;_0<l.length;_0++){let{start:Q0,end:B1}=l[_0];Z0[_0]=Q.slice(j0,Q0),j0=B1}Z0[l.length]=Q.slice(j0),Q=Z0.join("")}}let W0=l9(Q,J);if(W0.hasScoped)Q=W0.html;let a=Z.__stx_event_bindings||[],L0=!1,c0=[],p0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:g0}=await s("stx/signal-processing",()=>import("./chunk-xgxf107n.js"));for(let f of g0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:l,content:Z0}of c0){L0=!0;let j0=Z0;$3(Z0,J,X.strict,Z.__originalFilePath);let _0=await d9(Z0,{eventBindings:a,attrs:l,hasColonDirectives:p0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(f,()=>_0)}if(L0)Z.__stx_event_bindings=[];if(!L0&&Z.__stxProcessingDepth===1){let f=Z.__stx_event_bindings||[];if(f.length>0){let l=X5(f);if(l){let Z0=Q.lastIndexOf("</body>");Q=Z0===-1?Q+l:Q.slice(0,Z0)+l+`
3543
+ `+Q.slice(Z0)}Z.__stx_event_bindings=[]}}if(!K8(Q)&&q8(Q))Q=await f9(Q,G);if(Q=W8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=W7(Q,Z.cspNonce);return Q}import NZ from"path";import Q3 from"fs";import h2 from"path";function qZ($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function az($){let Z=z0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function Y3($,Z){let J=z0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=qZ(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=qZ(J,Q,"(",")");if(z>=0)return{type:G,args:az($.slice(Q+1,z))}}return null}var WZ=`
3544
3544
  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;
3545
3545
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
3546
3546
  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>;
@@ -3548,71 +3548,71 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
3548
3548
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
3549
3549
  type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
3550
3550
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
3551
- `;function WZ($,Z){let J=[],X={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Y=z0($),Q=$.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,j,B,V,F)=>{if(Y.slice(F,F+6)!=="import")return U;if(V.endsWith(".stx"))return"";let O=`${Z}Import${J.length}`;if(J.push(`import * as ${O} from ${JSON.stringify(V)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${O};`;if(!j.startsWith("{"))return`import ${j} = ${O}.default;`;return j.slice(1,-1).split(",").map((_)=>{let[L,w=L]=_.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!L)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(V)&&L in X)X[L].push(w);return`import ${w} = ${O}.${L};`}).join(`
3551
+ `;function HZ($,Z){let J=[],X={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Y=z0($),Q=$.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,j,B,V,F)=>{if(Y.slice(F,F+6)!=="import")return U;if(V.endsWith(".stx"))return"";let O=`${Z}Import${J.length}`;if(J.push(`import * as ${O} from ${JSON.stringify(V)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${O};`;if(!j.startsWith("{"))return`import ${j} = ${O}.default;`;return j.slice(1,-1).split(",").map((_)=>{let[L,w=L]=_.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!L)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(V)&&L in X)X[L].push(w);return`import ${w} = ${O}.${L};`}).join(`
3552
3552
  `)}),G=Y3($,X.defineProps),z=Y3($,X.defineEmits),K=Y3($,X.withDefaults);if(!G&&!z)return{declarations:"",props:null,events:null};let q=[],H=null,W=null;if(G){q.push(`const __options = (${G.args[0]||"{}"}) as const;`),q.push(`const __defaults = (${K?.args[1]||"{}"});`);let U=G.type||"__StxOptions<typeof __options>";q.push(`export type __StxProps = __StxDefaults<${U}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),H=`${Z}.__StxProps`}if(z)q.push(`const __events = (${z.args[0]||"[]"}) as const;`),q.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),W=`${Z}.__StxEvents`;return{declarations:`${J.join(`
3553
3553
  `)}
3554
3554
  namespace ${Z} {
3555
3555
  ${Q}
3556
3556
  ${q.join(`
3557
3557
  `)}
3558
- }`,props:H,events:W}}function*az($){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,J;while(J=Z.exec($)){let X=Z.lastIndex,Y=[];while(X<$.length){while(/\s/.test($[X]||""))X++;if($[X]===">"||$.slice(X,X+2)==="/>"){X+=$[X]===">"?1:2;break}let Q=/^[^\s=/>]+/.exec($.slice(X))?.[0];if(!Q){X++;continue}let G=X;X+=Q.length;while(/\s/.test($[X]||""))X++;if($[X]!=="="){Y.push({name:Q,value:!0,offset:G,braced:!1});continue}X++;while(/\s/.test($[X]||""))X++;let z=$[X],K=z==="{",q=z==='"'||z==="'";if(q||K)X++;let H=X;if(K){let W=z0($.slice(X)),U=1,j=0;for(;j<W.length;j++){if(W[j]==="{")U++;if(W[j]==="}"&&--U===0)break}X+=j}else if(q)while(X<$.length&&$[X]!==z)X++;else while(X<$.length&&!/[\s/>]/.test($[X]))X++;if(Y.push({name:Q,value:$.slice(H,X),offset:H,braced:K}),q||K)X++}Z.lastIndex=X,yield{name:J[1],offset:J.index,attributes:Y}}}function HZ($,Z,J){let X=[],Y=[qZ,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],Q=new Map,G=new Map,z=new Map,K=J.scriptCode($,J.filePath),q=z0(K);for(let B of K.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(q.slice(B.index,B.index+6)!=="import")continue;let V=B[2],F=h2.isAbsolute(V)||V.startsWith(".")?h2.resolve(h2.dirname(J.filePath),V):w9(V,h2.dirname(J.filePath));if(!F)continue;let O=F.endsWith(".stx")?F:Q3.existsSync(`${F}.stx`)?`${F}.stx`:void 0,_=O?null:_9(F,!1),L=B[1].startsWith("{")?B[1].slice(1,-1).split(","):[B[1]];for(let w of L){let[D,R=D]=w.trim().split(/\s+as\s+/),M=O||_?.get(D)||_?.get(D.toLowerCase());if(M)z.set(R,M),z.set(R.toLowerCase(),M),z.set(R.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M)}}for(let B of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let V of B[1].matchAll(/['"]([^'"]+)['"]/g)){let F=R9(V[1],J.filePath,J).find((O)=>Q3.statSync(O,{throwIfNoEntry:!1})?.isFile());if(F)z.set(h2.basename(V[1]).replace(/\.stx$/,""),F)}let H={__importedComponents:z},W=new Map,U=(B,V,F)=>{let O=$.slice(0,B);return{code:V,offset:B,attribute:F,anchor:!0,kind:"directive",line:O.split(`
3558
+ }`,props:H,events:W}}function*tz($){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,J;while(J=Z.exec($)){let X=Z.lastIndex,Y=[];while(X<$.length){while(/\s/.test($[X]||""))X++;if($[X]===">"||$.slice(X,X+2)==="/>"){X+=$[X]===">"?1:2;break}let Q=/^[^\s=/>]+/.exec($.slice(X))?.[0];if(!Q){X++;continue}let G=X;X+=Q.length;while(/\s/.test($[X]||""))X++;if($[X]!=="="){Y.push({name:Q,value:!0,offset:G,braced:!1});continue}X++;while(/\s/.test($[X]||""))X++;let z=$[X],K=z==="{",q=z==='"'||z==="'";if(q||K)X++;let H=X;if(K){let W=z0($.slice(X)),U=1,j=0;for(;j<W.length;j++){if(W[j]==="{")U++;if(W[j]==="}"&&--U===0)break}X+=j}else if(q)while(X<$.length&&$[X]!==z)X++;else while(X<$.length&&!/[\s/>]/.test($[X]))X++;if(Y.push({name:Q,value:$.slice(H,X),offset:H,braced:K}),q||K)X++}Z.lastIndex=X,yield{name:J[1],offset:J.index,attributes:Y}}}function UZ($,Z,J){let X=[],Y=[WZ,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],Q=new Map,G=new Map,z=new Map,K=J.scriptCode($,J.filePath),q=z0(K);for(let B of K.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(q.slice(B.index,B.index+6)!=="import")continue;let V=B[2],F=h2.isAbsolute(V)||V.startsWith(".")?h2.resolve(h2.dirname(J.filePath),V):w9(V,h2.dirname(J.filePath));if(!F)continue;let O=F.endsWith(".stx")?F:Q3.existsSync(`${F}.stx`)?`${F}.stx`:void 0,_=O?null:_9(F,!1),L=B[1].startsWith("{")?B[1].slice(1,-1).split(","):[B[1]];for(let w of L){let[D,R=D]=w.trim().split(/\s+as\s+/),M=O||_?.get(D)||_?.get(D.toLowerCase());if(M)z.set(R,M),z.set(R.toLowerCase(),M),z.set(R.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M)}}for(let B of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let V of B[1].matchAll(/['"]([^'"]+)['"]/g)){let F=R9(V[1],J.filePath,J).find((O)=>Q3.statSync(O,{throwIfNoEntry:!1})?.isFile());if(F)z.set(h2.basename(V[1]).replace(/\.stx$/,""),F)}let H={__importedComponents:z},W=new Map,U=(B,V,F)=>{let O=$.slice(0,B);return{code:V,offset:B,attribute:F,anchor:!0,kind:"directive",line:O.split(`
3559
3559
  `).length,column:B-O.lastIndexOf(`
3560
- `)}},j=(B,V,F)=>X.push({expression:B,statement:{text:V+B.code+F,prefixLength:V.length}});for(let B of az(Z)){if(b2(B.name)||B.name==="component")continue;let V=A7(B.name,J.filePath,J,H);if(!V)continue;let F=W.get(V);if(!F){let _;try{_=J.readComponent?J.readComponent(V):Q3.readFileSync(V,"utf8")}catch{continue}if(_===void 0)continue;G.set(V,_),F=WZ(J.scriptCode(_,V),`__StxComponent${W.size}`),W.set(V,F),Y.push(F.declarations)}let O=[];for(let _ of B.attributes){let{name:L,offset:w}=_,D=_.value===!0?"true":_.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(F.events&&_.value!==!0)Q.set(w,`__StxEvent<${F.events}, ${JSON.stringify(L.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let R=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(L);if(L.startsWith("v-")&&!L.startsWith("v-bind:")&&!R)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(L))continue;let M=(R?R[1]||"modelValue":L.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(I,E)=>E.toUpperCase());if(O.push(M),!F.props)continue;let N=L.startsWith(":")||L.startsWith("v-bind:")||!!R||_.braced?D:_.value!==!0?JSON.stringify(D):"true";j(U(w,N,L),";void ((",`) satisfies __StxProp<${F.props}, ${JSON.stringify(M)}>);`)}if(F.props){let _=[...new Set(O)].map((w)=>`${JSON.stringify(w)}: undefined as any`).join(", "),L=U(B.offset,`<${B.name}>`);X.push({expression:L,statement:{text:`;void ({ ${_} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:W.size?Y.join(`
3561
- `):"",checks:X,events:Q,dependencies:G}}var UZ=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function tz($){let Z=(J)=>J.replace(/[^\n]/g," ");return $.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function jZ($){let Z=[],J=tz($);UZ.lastIndex=0;let X;while((X=UZ.exec(J))!==null){let Y=(X[1]||"").trim(),Q=(X[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(X[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=X.index+Q,K=X.index+X[0].length-G,q=$.slice(z,K);if(/\bsrc\s*=/.test(Y))continue;let H=Y.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let W=/\bserver\b/.test(Y)?"server":/\bclient\b/.test(Y)?"client":"plain",U=u2($,z);Z.push({kind:W,code:q,startLine:U,startColumn:m2($,z),offset:z,attrs:Y})}return Z}function u2($,Z){let J=1;for(let X=0;X<Z&&X<$.length;X++)if($.charCodeAt(X)===10)J++;return J}function m2($,Z){let J=$.lastIndexOf(`
3560
+ `)}},j=(B,V,F)=>X.push({expression:B,statement:{text:V+B.code+F,prefixLength:V.length}});for(let B of tz(Z)){if(b2(B.name)||B.name==="component")continue;let V=I7(B.name,J.filePath,J,H);if(!V)continue;let F=W.get(V);if(!F){let _;try{_=J.readComponent?J.readComponent(V):Q3.readFileSync(V,"utf8")}catch{continue}if(_===void 0)continue;G.set(V,_),F=HZ(J.scriptCode(_,V),`__StxComponent${W.size}`),W.set(V,F),Y.push(F.declarations)}let O=[];for(let _ of B.attributes){let{name:L,offset:w}=_,D=_.value===!0?"true":_.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(F.events&&_.value!==!0)Q.set(w,`__StxEvent<${F.events}, ${JSON.stringify(L.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let R=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(L);if(L.startsWith("v-")&&!L.startsWith("v-bind:")&&!R)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(L))continue;let M=(R?R[1]||"modelValue":L.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(I,E)=>E.toUpperCase());if(O.push(M),!F.props)continue;let N=L.startsWith(":")||L.startsWith("v-bind:")||!!R||_.braced?D:_.value!==!0?JSON.stringify(D):"true";j(U(w,N,L),";void ((",`) satisfies __StxProp<${F.props}, ${JSON.stringify(M)}>);`)}if(F.props){let _=[...new Set(O)].map((w)=>`${JSON.stringify(w)}: undefined as any`).join(", "),L=U(B.offset,`<${B.name}>`);X.push({expression:L,statement:{text:`;void ({ ${_} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:W.size?Y.join(`
3561
+ `):"",checks:X,events:Q,dependencies:G}}var jZ=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function ez($){let Z=(J)=>J.replace(/[^\n]/g," ");return $.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function BZ($){let Z=[],J=ez($);jZ.lastIndex=0;let X;while((X=jZ.exec(J))!==null){let Y=(X[1]||"").trim(),Q=(X[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(X[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=X.index+Q,K=X.index+X[0].length-G,q=$.slice(z,K);if(/\bsrc\s*=/.test(Y))continue;let H=Y.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let W=/\bserver\b/.test(Y)?"server":/\bclient\b/.test(Y)?"client":"plain",U=u2($,z);Z.push({kind:W,code:q,startLine:U,startColumn:m2($,z),offset:z,attrs:Y})}return Z}function u2($,Z){let J=1;for(let X=0;X<Z&&X<$.length;X++)if($.charCodeAt(X)===10)J++;return J}function m2($,Z){let J=$.lastIndexOf(`
3562
3562
  `,Z-1)+1;return Z-J+1}function p9($){let Z=$.split(""),J=(Y,Q)=>{for(let G=Y;G<Q&&G<Z.length;G++)if(Z[G]!==`
3563
- `)Z[G]=" "},X=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let Y of X){Y.lastIndex=0;let Q;while((Q=Y.exec($))!==null)J(Q.index,Q.index+Q[0].length)}return Z.join("")}function ez($){let Z=0,J="";for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J="";continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{"){Z++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--;continue}if(Y==="|"&&Z===0){if($[X+1]==="|"){X++;continue}if($[X-1]==="|")continue;return $.slice(0,X)}}return $}var NZ=new Set([":for","x-for","v-for"]),i9=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,G3="__stx_interpolated",BZ="__StxElement",MZ="__StxTemplateValue",$K=`type ${MZ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function VZ($){return $.replace(/\{\{[\s\S]*?\}\}/g,G3).replace(/\{!![\s\S]*?!!\}/g,G3)}function ZK($){return $.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let J=Z.split(`
3563
+ `)Z[G]=" "},X=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let Y of X){Y.lastIndex=0;let Q;while((Q=Y.exec($))!==null)J(Q.index,Q.index+Q[0].length)}return Z.join("")}function $K($){let Z=0,J="";for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J="";continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{"){Z++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--;continue}if(Y==="|"&&Z===0){if($[X+1]==="|"){X++;continue}if($[X-1]==="|")continue;return $.slice(0,X)}}return $}var MZ=new Set([":for","x-for","v-for"]),i9=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,G3="__stx_interpolated",VZ="__StxElement",AZ="__StxTemplateValue",ZK=`type ${AZ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function LZ($){return $.replace(/\{\{[\s\S]*?\}\}/g,G3).replace(/\{!![\s\S]*?!!\}/g,G3)}function JK($){return $.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let J=Z.split(`
3564
3564
  `).length-1,X=Z.length-J;return`0${" ".repeat(Math.max(0,X-1))}${`
3565
- `.repeat(J)}`})}var JK=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],XK=new RegExp(String.raw`^[ \t]*@(?:${JK.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function YK($){return $.replace(XK,(Z)=>Z.replace(/[^\n]/g," "))}var LZ=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function QK($){let Z=p9($),J=[],X=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Y;while((Y=X.exec(Z))!==null){if(Y[1]||Y[3])continue;let z=Y[2]??Y[4]??"",K=Y[2]!==void 0?2:3,q=ez(z);if(!q.trim())continue;let H=Y.index+K+(q.length-q.trimStart().length);J.push({code:q.trim(),line:u2(Z,H),column:m2(Z,H),offset:H,kind:"interpolation"})}let Q=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((Y=Q.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=0,K=G;for(;K<Z.length;K++){let U=Z[K];if(U==="(")z++;else if(U===")"){if(z--,z===0)break}}if(z!==0)continue;let q=Z.slice(G+1,K),H=q.trim();if(Q.lastIndex=K+1,!H)continue;let W=G+1+(q.length-q.trimStart().length);J.push({code:H,line:u2(Z,W),column:m2(Z,W),offset:Y.index,kind:"condition"})}i9.lastIndex=0;while((Y=i9.exec(Z))!==null){let G=Y[1],z=Y[3]??"",K=G.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(LZ.has(K)||LZ.has(G))continue;if(!z.trim())continue;let q=Y.index+Y[0].indexOf(Y[2],Y[0].indexOf(G)+G.length)+1;if(NZ.has(K)){let W=z.match(/\s+(?:in|of)\s+/);if(!W||W.index===void 0)continue;let U=z.slice(W.index+W[0].length),j=W.index+W[0].length+(U.length-U.trimStart().length);J.push({code:VZ(U.trim()),line:u2(Z,q+j),column:m2(Z,q+j),offset:q+j,kind:"directive",attribute:K});continue}let H=z.length-z.trimStart().length;J.push({code:VZ(z.trim()),line:u2(Z,q+H),column:m2(Z,q+H),offset:q+H,kind:"directive",attribute:K})}return J.sort((G,z)=>G.line-z.line||G.column-z.column),J}var GK=2000;function zK($,Z){let J=0,X=Math.min($.length,Z+GK);for(let Y=Z;Y<X;Y++){let Q=$[Y];if(Q==="(")J++;else if(Q===")"){if(J--,J===0)return $.slice(Z+1,Y)}}return null}function KK($){let Z=new Map,J=(z,K)=>{let q=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of q){let W=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(W))continue;let U=q.length===1?K:void 0,j=Z.get(W);if(!j)Z.set(W,{name:W,iterable:U});else if(j.iterable!==U)j.iterable=void 0}},X=/^\$?[A-Z_$][\w$]*$/i,Y=(z)=>{let K=z.trim();return X.test(K)?K:void 0};for(let z of $.matchAll(/@for(?:each|else)\s*\(/g)){let K=zK($,z.index+z[0].length-1);if(K===null)continue;let q=a1(K);if(!q)continue;J(q.itemVar.replace(/=>/g," "),Y(q.arrayExpr))}for(let z of $.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))J(z[1],z[2]==="of"?Y(z[3]):void 0);for(let z of $.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))J(z[1]);let Q=p9($);i9.lastIndex=0;let G;while((G=i9.exec(Q))!==null){let z=G[1].replace(/\..*$/,"");if(!NZ.has(z))continue;let K=G[3].match(/\s+(?:in|of)\s+/);if(!K||K.index===void 0)continue;J(G[3].slice(0,K.index),Y(G[3].slice(K.index+K[0].length)))}for(let z of $.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let K of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))J(K[1]);return[...Z.values()].sort((z,K)=>z.name.localeCompare(K.name))}function j1($){let Z=new Set;for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let X of J[1].split(",")){let Y=X.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Y))Z.add(Y)}return[...Z].sort()}var z3=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],qK={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$uid:"declare var $uid: string"};function FF($=new Set){return[...z3.filter((Z)=>!$.has(Z)).map((Z)=>`declare var ${Z}: any`),...Object.entries(qK).filter(([Z])=>!$.has(Z)).map(([,Z])=>Z)].join(`
3566
- `)}function _F($){return new Set([...$.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((Z)=>Z[1]))}function AZ($){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,J,X=!1,Y=new Set,Q=z0($);while((J=Z.exec(Q))!==null){X=!0;for(let G of WK(J[1])){let z=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))Y.add(z)}}return X?[...Y]:null}function WK($){let Z=[],J=0,X="";for(let Y of $){if(Y===","&&J===0){Z.push(X),X="";continue}if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;X+=Y}return Z.push(X),Z.filter((Y)=>Y.trim().length>0)}function HK($){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,J=[],X=$.replace(Z,(Y)=>{return J.push(Y.trim()),Y.split(`
3565
+ `.repeat(J)}`})}var XK=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],YK=new RegExp(String.raw`^[ \t]*@(?:${XK.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function QK($){return $.replace(YK,(Z)=>Z.replace(/[^\n]/g," "))}var OZ=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function GK($){let Z=p9($),J=[],X=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Y;while((Y=X.exec(Z))!==null){if(Y[1]||Y[3])continue;let z=Y[2]??Y[4]??"",K=Y[2]!==void 0?2:3,q=$K(z);if(!q.trim())continue;let H=Y.index+K+(q.length-q.trimStart().length);J.push({code:q.trim(),line:u2(Z,H),column:m2(Z,H),offset:H,kind:"interpolation"})}let Q=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((Y=Q.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=0,K=G;for(;K<Z.length;K++){let U=Z[K];if(U==="(")z++;else if(U===")"){if(z--,z===0)break}}if(z!==0)continue;let q=Z.slice(G+1,K),H=q.trim();if(Q.lastIndex=K+1,!H)continue;let W=G+1+(q.length-q.trimStart().length);J.push({code:H,line:u2(Z,W),column:m2(Z,W),offset:Y.index,kind:"condition"})}i9.lastIndex=0;while((Y=i9.exec(Z))!==null){let G=Y[1],z=Y[3]??"",K=G.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(OZ.has(K)||OZ.has(G))continue;if(!z.trim())continue;let q=Y.index+Y[0].indexOf(Y[2],Y[0].indexOf(G)+G.length)+1;if(MZ.has(K)){let W=z.match(/\s+(?:in|of)\s+/);if(!W||W.index===void 0)continue;let U=z.slice(W.index+W[0].length),j=W.index+W[0].length+(U.length-U.trimStart().length);J.push({code:LZ(U.trim()),line:u2(Z,q+j),column:m2(Z,q+j),offset:q+j,kind:"directive",attribute:K});continue}let H=z.length-z.trimStart().length;J.push({code:LZ(z.trim()),line:u2(Z,q+H),column:m2(Z,q+H),offset:q+H,kind:"directive",attribute:K})}return J.sort((G,z)=>G.line-z.line||G.column-z.column),J}var zK=2000;function KK($,Z){let J=0,X=Math.min($.length,Z+zK);for(let Y=Z;Y<X;Y++){let Q=$[Y];if(Q==="(")J++;else if(Q===")"){if(J--,J===0)return $.slice(Z+1,Y)}}return null}function qK($){let Z=new Map,J=(z,K)=>{let q=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of q){let W=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(W))continue;let U=q.length===1?K:void 0,j=Z.get(W);if(!j)Z.set(W,{name:W,iterable:U});else if(j.iterable!==U)j.iterable=void 0}},X=/^\$?[A-Z_$][\w$]*$/i,Y=(z)=>{let K=z.trim();return X.test(K)?K:void 0};for(let z of $.matchAll(/@for(?:each|else)\s*\(/g)){let K=KK($,z.index+z[0].length-1);if(K===null)continue;let q=a1(K);if(!q)continue;J(q.itemVar.replace(/=>/g," "),Y(q.arrayExpr))}for(let z of $.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))J(z[1],z[2]==="of"?Y(z[3]):void 0);for(let z of $.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))J(z[1]);let Q=p9($);i9.lastIndex=0;let G;while((G=i9.exec(Q))!==null){let z=G[1].replace(/\..*$/,"");if(!MZ.has(z))continue;let K=G[3].match(/\s+(?:in|of)\s+/);if(!K||K.index===void 0)continue;J(G[3].slice(0,K.index),Y(G[3].slice(K.index+K[0].length)))}for(let z of $.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let K of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))J(K[1]);return[...Z.values()].sort((z,K)=>z.name.localeCompare(K.name))}function j1($){let Z=new Set;for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let X of J[1].split(",")){let Y=X.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Y))Z.add(Y)}return[...Z].sort()}var z3=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],WK={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$uid:"declare var $uid: string"};function _F($=new Set){return[...z3.filter((Z)=>!$.has(Z)).map((Z)=>`declare var ${Z}: any`),...Object.entries(WK).filter(([Z])=>!$.has(Z)).map(([,Z])=>Z)].join(`
3566
+ `)}function wF($){return new Set([...$.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((Z)=>Z[1]))}function IZ($){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,J,X=!1,Y=new Set,Q=z0($);while((J=Z.exec(Q))!==null){X=!0;for(let G of HK(J[1])){let z=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))Y.add(z)}}return X?[...Y]:null}function HK($){let Z=[],J=0,X="";for(let Y of $){if(Y===","&&J===0){Z.push(X),X="";continue}if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;X+=Y}return Z.push(X),Z.filter((Y)=>Y.trim().length>0)}function UK($){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,J=[],X=$.replace(Z,(Y)=>{return J.push(Y.trim()),Y.split(`
3567
3567
  `).map(()=>"").join(`
3568
3568
  `)});return{imports:J.join(`
3569
- `),body:X}}function IZ($){let Z=z0($),J=Array(Z.length),X=0;for(let z=0;z<Z.length;z++){let K=Z[z];if(K==="}"||K===")"||K==="]")X=Math.max(0,X-1);if(J[z]=X,K==="{"||K==="("||K==="[")X++}let Y=[],Q=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=Q.exec(Z))!==null){if(J[G.index]!==0)continue;let z=G[1],K=G[2],q;if(z==="interface"){let H=Z.indexOf("{",G.index);if(H===-1)continue;let W=0;q=-1;for(let U=H;U<Z.length;U++)if(Z[U]==="{")W++;else if(Z[U]==="}"&&--W===0){q=U+1;break}if(q===-1)continue}else{let H=0;q=Z.length;for(let W=Z.indexOf("=",G.index)+1;W<Z.length;W++){let U=Z[W];if(U==="{"||U==="["||U==="("||U==="<")H++;else if(U==="}"||U==="]"||U===")"||U===">")H--;else if(H<=0&&(U===";"||U===`
3570
- `&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,W-40),W)))){q=U===";"?W+1:W;break}}}Y.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Q.lastIndex=q}return Y}function UK($){return new Set(IZ($).map((Z)=>Z.name))}function wF($,Z=""){let J=AZ($),X=UK(Z),Y=IZ($).filter((q)=>!X.has(q.name)).map((q)=>q.text);if(!J){let q=j1($).filter((H)=>!o2(Z,H));if(q.length===0&&Y.length===0)return"";return["",`// ${BK}`,...Y,...q.map((H)=>`declare var ${H}: any`)].join(`
3571
- `)}if(J.length===0)return Y.length>0?["",`// ${OZ}`,...Y].join(`
3572
- `):"";let{imports:Q,body:G}=HK($),z=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),K=["",`// ${OZ}`];if(Q)K.push(Q);return K.push(...Y),K.push(`async function ${FZ}() {`,z,` return { ${J.join(", ")} }`,"}",`type ${_Z} = Awaited<ReturnType<typeof ${FZ}>>`,...J.map((q)=>`declare var ${q}: ${_Z}[${JSON.stringify(q)}]`)),K.join(`
3573
- `)}function jK($){let J=z0($).split(""),X=0;for(let Y=0;Y<J.length;Y++){let Q=J[Y];if(Q==="{"||Q==="("||Q==="["){X++;continue}if(Q==="}"||Q===")"||Q==="]"){X=Math.max(0,X-1);continue}if(X>0&&Q!==`
3574
- `)J[Y]=" "}return j1(J.join(""))}function RF($,Z){if(AZ($)!==null)return[];let J=z0(Z),X=new Set(Q2);return jK($).filter((Y)=>{if(X.has(Y))return!1;if(j1(Z).includes(Y))return!1;return new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J)})}var OZ="stx: types for the declared client payload (#1868)",BK="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",FZ="__stxServerScope",_Z="__StxClientPayload";var wZ=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var VK=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function LK($){let Z=new Map,J=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let X of $){let Y=z0(X),{depths:Q,balanced:G}=K2(Y);if(!G)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let K of Y.matchAll(z)){let q=K.index??0;if(Q[q+K[1].length]!==0)continue;let H=K[2],W=q+K[0].length-K[3].length,U=X.slice(W,q+K[0].length).trim().replace(/;$/,"").trim(),j=K[3],B=J.test(j)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(j)&&!/[,+\-*/%&|?:=]$/.test(U)&&K2(j).balanced;Z.set(H,Z.has(H)||!B?null:U)}}return new Map([...Z].filter((X)=>X[1]!==null))}function TZ($,Z,J=0,X=new Set){if(Z.size===0||J>=5)return $;let Y=z0($),Q="",G=0;for(let z of Y.matchAll(/[A-Za-z_$][\w$]*/g)){let K=z.index??0,q=z[0],H=Z.get(q);if(!H||X.has(q))continue;let W=Y.slice(0,K).trimEnd(),U=Y.slice(K+q.length).trimStart();if(W.endsWith(".")||/^:(?!:)/.test(U)&&/[{,]$/.test(W))continue;if(K>0&&/[\w$]/.test(Y[K-1]))continue;Q+=`${$.slice(G,K)}(${TZ(H,Z,J+1,new Set([...X,q]))})`,G=K+q.length}return Q+$.slice(G)}function OK($,Z){let J=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,X=[],Y;while((Y=J.exec($))!==null){if(Y.index>Z)break;let Q=Y[1];if(Y.index===Z){if(Q==="elseif"){let z=X[X.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(Q==="endif"||Q==="endunless"){X.pop();continue}let G="";if(Y[2]==="("){let z=0,K=Y.index+Y[0].length-1,q=K+1;for(;K<$.length;K++){let H=$[K];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}G=$.slice(q,K).trim(),J.lastIndex=K+1}if(Q==="if")X.push({seen:[],current:G});else if(Q==="unless")X.push({seen:[],current:`!(${G})`});else if(Q==="elseif"||Q==="else"){let z=X[X.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=Q==="elseif"?G:null}}return X.flatMap((Q)=>[...Q.seen.map((G)=>`!(${G})`),...Q.current?[Q.current]:[]]).filter(Boolean)}function FK($){let Z=$.code.trim();if(!Z)return null;if($.attribute?.startsWith("@")){if(VK.test(Z))return null;let X=";(($event: any): void => { ";return{text:`${X}${Z} });`,prefixLength:X.length}}let J=";void ((";return{text:`${J}${Z}));`,prefixLength:J.length}}var _K=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function RZ($,Z){if(!Z)return $;return $.replace(_K,(J,X,Y,Q)=>{let G=DZ.resolve(Z,Q).replace(/\\/g,"/");return`${X}${Y}${G}${Y}`})}function wK($){return" ".repeat(Math.max(0,($.startColumn??1)-1))}function RK($){let Z=new Set,J=z0($);for(let X of J.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let Y=X[1],Q=/\{([^}]*)\}/.exec(Y);for(let q of Q?.[1].split(",")??[]){let H=q.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))Z.add(H)}let G=Y.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(G);if(z)Z.add(z[1]);let K=/^\s*([A-Z_$][\w$]*)/i.exec(G);if(K&&K[1]!=="type")Z.add(K[1])}return[...Z].sort()}function DF($,Z={}){let J=jZ($),X=$.split(`
3575
- `),Y=Array.from({length:X.length},()=>""),Q=new Map,G=Z.filePath&&Z.templateExpressions!==!1?HZ($,p9($),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(W,U)=>jZ(W).map((j)=>RZ(j.code,DZ.dirname(U))).join(`
3576
- `)}):void 0,z=new Set,K=[];for(let W of J){let U=YK(ZK(W.code)),j=RZ(U,Z.originDir??"").split(`
3577
- `);j.forEach((B,V)=>{let F=W.startLine-1+V;if(F<Y.length)Y[F]=V===0?wK(W)+B:B,z.add(F)}),K.push(W.startLine-1+j.length-1)}for(let W of K){let U=Y[W]?.trim()===""?W:W+1;if(U<Y.length&&Y[U].trim()===""&&(U===W||!z.has(U)))Y[U]=";"}let q=(W,U)=>{for(let[j,B]of W.split(`
3578
- `).entries())if(Y.push(B),U)Q.set(Y.length,j===0?U:{...U,line:U.line+j,column:1,prefixLength:0})};if(Z.globals!==!1){q("");let W=new Set([...J.flatMap((V)=>j1(V.code)),...J.flatMap((V)=>RK(V.code))]),U=(V)=>{if(!W.has(V))q(`declare var ${V}: any`)};if(Z.runtimeGlobals!==!1){if(!W.has("window"))q("declare var window: any");for(let V of Q2)U(V)}let j=[...new Set([...z3,...H1,...wZ])].filter((V)=>Z.runtimeGlobals!==!1||!Q2.includes(V));if(Z.contextScope==="global"){q("declare global {");for(let V of j)q(` var ${V}: any`);q("}")}else{for(let V of z3)U(V);for(let V of H1)U(V);for(let V of wZ)U(V)}q(`declare var ${G3}: any`);let B=new Set(J.flatMap((V)=>j1(V.code)));q(`type ${BZ}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let V of KK($)){if(B.has(V.name))continue;let F=V.iterable&&B.has(V.iterable)?`${BZ}<typeof ${V.iterable}>`:"any";q(`declare var ${V.name}: ${F}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let U of G.declarations.split(`
3579
- `))q(U);let W=QK($).map((U)=>{let j=G?.events.get(U.offset??-1);if(j){U.anchor=!0;let B=U.code.trim(),V=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(B),F=V?`void ((${V[2]}) satisfies __StxAssignedValue<typeof ${V[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(B)?`${B} satisfies (($event: ${j}) => unknown)`:B,O=`;(($event: ${j}): void => { `;return{expression:U,statement:{text:`${O}${F} });`,prefixLength:O.length}}}return{expression:U,statement:FK(U)}}).filter((U)=>U.statement!==null);if(W.push(...G?.checks||[]),W.length>0){let U=p9($),j=LK(J.map((O)=>O.code)),V=[...new Set(J.flatMap((O)=>j1(O.code)))].filter((O)=>/^[A-Z_$][\w$]*$/i.test(O)),F=0;if(V.length>0){q($K);for(let O of V)q(`type __StxT_${O} = ${MZ}<typeof ${O}>`);q(`;((${V.map((O)=>`${O}: __StxT_${O}`).join(", ")}) => {`),F=1}for(let{expression:O,statement:_}of W){let L=" ".repeat(F),w=O.offset===void 0?[]:OK(U,O.offset),D=w.length>0?`${w.map((M)=>`if (${TZ(M,j)}) `).join("")}{ `:"",R=w.length>0?" }":"";q(L+D+_.text+R,{line:O.line,column:O.column,expression:O,prefixLength:_.prefixLength+L.length+D.length,guardPrefixLength:L.length+D.length})}if(F>0)q("});")}}let H=!1;if(Z.reference&&Y[0]!==void 0&&Y[0].trim()==="")Y[0]=`/// <reference path=${JSON.stringify(Z.reference.replace(/\\/g,"/"))} />`,H=!0;return q("export {}"),{text:Y.join(`
3580
- `),lineMap:Q,sourceLineCount:X.length,componentDependencies:G?.dependencies,referenced:H}}function NF($,Z){if(!$.expression)return!1;return $.inGuard===!0||Z===2774}function MF($,Z,J){let X=$.lineMap.get(Z);if(!X)return Z<=$.sourceLineCount?{line:Z,column:J}:null;let Y=X.expression?.anchor?0:Math.max(0,J-1-(X.prefixLength??0));return{line:X.line,column:X.column+Y,expression:X.expression,inGuard:J<=(X.guardPrefixLength??0)}}var DK=[{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"}],NK=[{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')"}],MK=[{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 AK($){let Z=[],J=[];return IK($,Z),TK($,Z,J),kK($,J),EK($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function IK($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function TK($,Z,J){for(let X of DK){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let K=new RegExp(X.altClose,"g");z+=($.match(K)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function kK($,Z){for(let J of NK)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function EK($,Z){for(let J of MK)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function bK($,Z){let J=$.slice(0,Z).split(`
3581
- `);return{line:J.length,column:J[J.length-1].length+1}}function yK($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.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(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function CK($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function SK($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import o0 from"path";import G2 from"process";var K3=["module","exports","require","props","$props","$bool","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 kZ=new Set(K3),PK=new Set(["props","$props","defineProps"]),vK=new Set(["stx","@stacksjs/stx"]),EZ=y1(128),bZ=y1(64);function xK($){let Z=[],J=0,X=$.split(`
3582
- `);for(let Y of X){let Q=J,G=null,z=!1;for(let K=0;K<Y.length;K++){let q=Y[K];if(z){z=!1;continue}if(q==="\\"){z=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&K+1<Y.length&&Y[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let K=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let q=Y.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let W=q[1].slice(1,-1).split(",").map((U)=>{let j=U.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((U)=>/^\w+$/.test(U));Z.push(...W)}}}}return[...new Set(Z)]}function fK($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,K=null;for(let q=0;q<X.length;q++){let H=X[q];if(K){if(Q+=H,H===K)K=null;continue}if(H==='"'||H==="'"||H==="`"){K=H,Q+=H;continue}if(H==="<")G++;else if(H===">"&&G>0)G--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=H}if(Q)Y.push(Q);return Y.map((q)=>{let H=q.trim(),W=H.startsWith("..."),U=W?H.slice(3):H,j=-1,B=0;for(let D=0;D<U.length;D++)if(U[D]==="<")B++;else if(U[D]===">")B--;else if(U[D]===":"&&B===0){j=D;break}if(j===-1)return q;let F=U.substring(0,j).trim().replace(/\?$/,""),O=U.substring(j+1),_=-1,L=0;for(let D=0;D<O.length;D++)if(O[D]==="<")L++;else if(O[D]===">")L--;else if(O[D]==="="&&L===0){_=D;break}let w=W?"...":"";if(_!==-1)return`${w}${F} = ${O.substring(_+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,K=G+1,q=0,H=null;while(K<Z.length&&z>0){let j=Z[K];if(H){if(j===H)H=null;K++;continue}if(j==='"'||j==="'"||j==="`"){H=j,K++;continue}if(j==="<")q++;else if(j===">"&&q>0)q--;else if(q===0){if(j==="(")z++;else if(j===")")z--}if(z>0)K++}if(z!==0)continue;let W=Z.substring(G+1,K);if(!W.includes(":"))continue;let U=J(W);Q.push({start:G+1,end:K,replacement:U})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];Z=Z.substring(0,z)+q+Z.substring(K)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...K]=G.split("="),q=z.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
3583
-
3584
- `),Z}function gK($){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test($)}function hK($){if($ instanceof SyntaxError)return!0;let Z=$ instanceof Error?$.message:String($);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(Z)}function uK($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}var yZ=new Set;async function mK($,Z,J,X={}){if(!$.trim())return;let Y=X2(),Q=U1($,JSON.stringify(Y)),G=EZ.get(Q);if(G===void 0){try{let S=W3({loader:"ts",target:"browser",define:Y}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(v)}catch{G=fK($)}EZ.set(Q,G)}let z={exports:{}},K=z.exports,q=G2.cwd(),H={},W=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),U=new Map;for(let S of W)try{if(S.startsWith(".")){H[S]=await import(o0.resolve(o0.dirname(J),S));continue}let v=o0.resolve(q,"node_modules",S),d=o0.join(v,"package.json"),J0=JSON.parse(x("fs").readFileSync(d,"utf8")),H0=J0.main||"index.js";if(J0.exports){let k0=typeof J0.exports==="string"?J0.exports:J0.exports["."];if(typeof k0==="string")H0=k0;else if(k0?.bun)H0=k0.bun;else if(k0?.import)H0=k0.import;else if(k0?.default)H0=k0.default}H[S]=await import(o0.resolve(v,H0))}catch(v){if(S.startsWith("."))U.set(S,v instanceof Error?v.message:String(v))}let j=(S)=>{if(H[S])return H[S];let v=U.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${J}: ${v}`);return x(S)},B=Z.props||{},V=(S)=>{if(!S)return B;let v={};for(let[d,J0]of Object.entries(S)){let H0=B[d];if(H0!==void 0)v[d]=H0;else if(typeof J0==="function")v[d]=J0();else v[d]=J0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let F=(S,v=!1)=>{if(S===void 0||S===null)return v;if(typeof S==="string"){let d=S.trim().toLowerCase();if(d===""||d==="true"||d==="1"||d==="on"||d==="yes")return!0;if(d==="false"||d==="0"||d==="off"||d==="no")return!1;return!0}return Boolean(S)};for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(V,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let O=(S)=>{if(!S)return B;let v={...B};for(let[d,J0]of Object.entries(S)){let H0=J0&&typeof J0==="object"&&!Array.isArray(J0)?J0:{type:J0};if(v[d]===void 0&&H0.default!==void 0)v[d]=typeof H0.default==="function"?H0.default():H0.default}return v},_=()=>Z.slots||{},L=(S,v)=>{let d={...S};for(let[J0,H0]of Object.entries(v))if(d[J0]===void 0)if(typeof H0==="function")d[J0]=H0();else d[J0]=H0;return d},w=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},D=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},R=(S)=>{},M=(S)=>S(),T=(S)=>{},N=(S)=>{},I=H4(Z);function E(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)b({title:v.title,description:v.description})}function A(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let k=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",J0=Object.fromEntries(new URLSearchParams(v)),H0=Z.query,k0=Object.keys(J0).length>0?J0:H0??{},r0=v||(Object.keys(k0).length>0?`?${new URLSearchParams(k0).toString()}`:"");return{params:Z.params??{},query:k0,path:d,name:"",fullPath:d+r0,hash:"",matched:[]}},C=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),y=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=dZ(v,S||{})},b=(S)=>{y(lZ(S||{}))},P=(S)=>({value:S}),h=(S)=>S,p=(S)=>({value:typeof S==="function"?S():S}),u=(S,v)=>{},r=(S)=>{},e=(S)=>{},Y0=(S)=>S?S():Promise.resolve(),i=(S)=>(v,...d)=>{},W0=(S)=>{},a=(S,v)=>{},L0=(S,v)=>v,c0=()=>({value:"light"}),p0=()=>w(!1),g0=(S)=>w(!1),f=()=>w(!1),l=()=>g0("(prefers-color-scheme: dark)"),Z0=()=>g0("(prefers-color-scheme: light)"),j0=()=>g0("(prefers-reduced-motion: reduce)"),_0=()=>g0("(prefers-contrast: more)"),Q0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},B1=new Proxy(Q0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),r9={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},a9=console;try{let S=cZ(G,J),v=new Set(Object.keys(B)),d=Object.keys(Z).filter((n)=>!v.has(n)&&!PK.has(n)&&z2(n)),J0=d.map((n)=>Z[n]);if(!d.includes("__stxServeContext"))d.push("__stxServeContext"),J0.push(void 0);let H0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),k0=[],r0=[];for(let[n,h0]of Object.entries(B)){if(!z2(n))continue;if(H0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(S))continue;k0.push(n),r0.push(h0)}let Z1=xK(S).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3569
+ `),body:X}}function TZ($){let Z=z0($),J=Array(Z.length),X=0;for(let z=0;z<Z.length;z++){let K=Z[z];if(K==="}"||K===")"||K==="]")X=Math.max(0,X-1);if(J[z]=X,K==="{"||K==="("||K==="[")X++}let Y=[],Q=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=Q.exec(Z))!==null){if(J[G.index]!==0)continue;let z=G[1],K=G[2],q;if(z==="interface"){let H=Z.indexOf("{",G.index);if(H===-1)continue;let W=0;q=-1;for(let U=H;U<Z.length;U++)if(Z[U]==="{")W++;else if(Z[U]==="}"&&--W===0){q=U+1;break}if(q===-1)continue}else{let H=0;q=Z.length;for(let W=Z.indexOf("=",G.index)+1;W<Z.length;W++){let U=Z[W];if(U==="{"||U==="["||U==="("||U==="<")H++;else if(U==="}"||U==="]"||U===")"||U===">")H--;else if(H<=0&&(U===";"||U===`
3570
+ `&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,W-40),W)))){q=U===";"?W+1:W;break}}}Y.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Q.lastIndex=q}return Y}function jK($){return new Set(TZ($).map((Z)=>Z.name))}function RF($,Z=""){let J=IZ($),X=jK(Z),Y=TZ($).filter((q)=>!X.has(q.name)).map((q)=>q.text);if(!J){let q=j1($).filter((H)=>!o2(Z,H));if(q.length===0&&Y.length===0)return"";return["",`// ${VK}`,...Y,...q.map((H)=>`declare var ${H}: any`)].join(`
3571
+ `)}if(J.length===0)return Y.length>0?["",`// ${FZ}`,...Y].join(`
3572
+ `):"";let{imports:Q,body:G}=UK($),z=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),K=["",`// ${FZ}`];if(Q)K.push(Q);return K.push(...Y),K.push(`async function ${_Z}() {`,z,` return { ${J.join(", ")} }`,"}",`type ${wZ} = Awaited<ReturnType<typeof ${_Z}>>`,...J.map((q)=>`declare var ${q}: ${wZ}[${JSON.stringify(q)}]`)),K.join(`
3573
+ `)}function BK($){let J=z0($).split(""),X=0;for(let Y=0;Y<J.length;Y++){let Q=J[Y];if(Q==="{"||Q==="("||Q==="["){X++;continue}if(Q==="}"||Q===")"||Q==="]"){X=Math.max(0,X-1);continue}if(X>0&&Q!==`
3574
+ `)J[Y]=" "}return j1(J.join(""))}function DF($,Z){if(IZ($)!==null)return[];let J=z0(Z),X=new Set(Q2);return BK($).filter((Y)=>{if(X.has(Y))return!1;if(j1(Z).includes(Y))return!1;return new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J)})}var FZ="stx: types for the declared client payload (#1868)",VK="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",_Z="__stxServerScope",wZ="__StxClientPayload";var RZ=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var LK=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function OK($){let Z=new Map,J=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let X of $){let Y=z0(X),{depths:Q,balanced:G}=K2(Y);if(!G)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let K of Y.matchAll(z)){let q=K.index??0;if(Q[q+K[1].length]!==0)continue;let H=K[2],W=q+K[0].length-K[3].length,U=X.slice(W,q+K[0].length).trim().replace(/;$/,"").trim(),j=K[3],B=J.test(j)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(j)&&!/[,+\-*/%&|?:=]$/.test(U)&&K2(j).balanced;Z.set(H,Z.has(H)||!B?null:U)}}return new Map([...Z].filter((X)=>X[1]!==null))}function kZ($,Z,J=0,X=new Set){if(Z.size===0||J>=5)return $;let Y=z0($),Q="",G=0;for(let z of Y.matchAll(/[A-Za-z_$][\w$]*/g)){let K=z.index??0,q=z[0],H=Z.get(q);if(!H||X.has(q))continue;let W=Y.slice(0,K).trimEnd(),U=Y.slice(K+q.length).trimStart();if(W.endsWith(".")||/^:(?!:)/.test(U)&&/[{,]$/.test(W))continue;if(K>0&&/[\w$]/.test(Y[K-1]))continue;Q+=`${$.slice(G,K)}(${kZ(H,Z,J+1,new Set([...X,q]))})`,G=K+q.length}return Q+$.slice(G)}function FK($,Z){let J=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,X=[],Y;while((Y=J.exec($))!==null){if(Y.index>Z)break;let Q=Y[1];if(Y.index===Z){if(Q==="elseif"){let z=X[X.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(Q==="endif"||Q==="endunless"){X.pop();continue}let G="";if(Y[2]==="("){let z=0,K=Y.index+Y[0].length-1,q=K+1;for(;K<$.length;K++){let H=$[K];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}G=$.slice(q,K).trim(),J.lastIndex=K+1}if(Q==="if")X.push({seen:[],current:G});else if(Q==="unless")X.push({seen:[],current:`!(${G})`});else if(Q==="elseif"||Q==="else"){let z=X[X.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=Q==="elseif"?G:null}}return X.flatMap((Q)=>[...Q.seen.map((G)=>`!(${G})`),...Q.current?[Q.current]:[]]).filter(Boolean)}function _K($){let Z=$.code.trim();if(!Z)return null;if($.attribute?.startsWith("@")){if(LK.test(Z))return null;let X=";(($event: any): void => { ";return{text:`${X}${Z} });`,prefixLength:X.length}}let J=";void ((";return{text:`${J}${Z}));`,prefixLength:J.length}}var wK=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function DZ($,Z){if(!Z)return $;return $.replace(wK,(J,X,Y,Q)=>{let G=NZ.resolve(Z,Q).replace(/\\/g,"/");return`${X}${Y}${G}${Y}`})}function RK($){return" ".repeat(Math.max(0,($.startColumn??1)-1))}function DK($){let Z=new Set,J=z0($);for(let X of J.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let Y=X[1],Q=/\{([^}]*)\}/.exec(Y);for(let q of Q?.[1].split(",")??[]){let H=q.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))Z.add(H)}let G=Y.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(G);if(z)Z.add(z[1]);let K=/^\s*([A-Z_$][\w$]*)/i.exec(G);if(K&&K[1]!=="type")Z.add(K[1])}return[...Z].sort()}function NF($,Z={}){let J=BZ($),X=$.split(`
3575
+ `),Y=Array.from({length:X.length},()=>""),Q=new Map,G=Z.filePath&&Z.templateExpressions!==!1?UZ($,p9($),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(W,U)=>BZ(W).map((j)=>DZ(j.code,NZ.dirname(U))).join(`
3576
+ `)}):void 0,z=new Set,K=[];for(let W of J){let U=QK(JK(W.code)),j=DZ(U,Z.originDir??"").split(`
3577
+ `);j.forEach((B,V)=>{let F=W.startLine-1+V;if(F<Y.length)Y[F]=V===0?RK(W)+B:B,z.add(F)}),K.push(W.startLine-1+j.length-1)}for(let W of K){let U=Y[W]?.trim()===""?W:W+1;if(U<Y.length&&Y[U].trim()===""&&(U===W||!z.has(U)))Y[U]=";"}let q=(W,U)=>{for(let[j,B]of W.split(`
3578
+ `).entries())if(Y.push(B),U)Q.set(Y.length,j===0?U:{...U,line:U.line+j,column:1,prefixLength:0})};if(Z.globals!==!1){q("");let W=new Set([...J.flatMap((V)=>j1(V.code)),...J.flatMap((V)=>DK(V.code))]),U=(V)=>{if(!W.has(V))q(`declare var ${V}: any`)};if(Z.runtimeGlobals!==!1){if(!W.has("window"))q("declare var window: any");for(let V of Q2)U(V)}let j=[...new Set([...z3,...H1,...RZ])].filter((V)=>Z.runtimeGlobals!==!1||!Q2.includes(V));if(Z.contextScope==="global"){q("declare global {");for(let V of j)q(` var ${V}: any`);q("}")}else{for(let V of z3)U(V);for(let V of H1)U(V);for(let V of RZ)U(V)}q(`declare var ${G3}: any`);let B=new Set(J.flatMap((V)=>j1(V.code)));q(`type ${VZ}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let V of qK($)){if(B.has(V.name))continue;let F=V.iterable&&B.has(V.iterable)?`${VZ}<typeof ${V.iterable}>`:"any";q(`declare var ${V.name}: ${F}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let U of G.declarations.split(`
3579
+ `))q(U);let W=GK($).map((U)=>{let j=G?.events.get(U.offset??-1);if(j){U.anchor=!0;let B=U.code.trim(),V=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(B),F=V?`void ((${V[2]}) satisfies __StxAssignedValue<typeof ${V[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(B)?`${B} satisfies (($event: ${j}) => unknown)`:B,O=`;(($event: ${j}): void => { `;return{expression:U,statement:{text:`${O}${F} });`,prefixLength:O.length}}}return{expression:U,statement:_K(U)}}).filter((U)=>U.statement!==null);if(W.push(...G?.checks||[]),W.length>0){let U=p9($),j=OK(J.map((O)=>O.code)),V=[...new Set(J.flatMap((O)=>j1(O.code)))].filter((O)=>/^[A-Z_$][\w$]*$/i.test(O)),F=0;if(V.length>0){q(ZK);for(let O of V)q(`type __StxT_${O} = ${AZ}<typeof ${O}>`);q(`;((${V.map((O)=>`${O}: __StxT_${O}`).join(", ")}) => {`),F=1}for(let{expression:O,statement:_}of W){let L=" ".repeat(F),w=O.offset===void 0?[]:FK(U,O.offset),D=w.length>0?`${w.map((M)=>`if (${kZ(M,j)}) `).join("")}{ `:"",R=w.length>0?" }":"";q(L+D+_.text+R,{line:O.line,column:O.column,expression:O,prefixLength:_.prefixLength+L.length+D.length,guardPrefixLength:L.length+D.length})}if(F>0)q("});")}}let H=!1;if(Z.reference&&Y[0]!==void 0&&Y[0].trim()==="")Y[0]=`/// <reference path=${JSON.stringify(Z.reference.replace(/\\/g,"/"))} />`,H=!0;return q("export {}"),{text:Y.join(`
3580
+ `),lineMap:Q,sourceLineCount:X.length,componentDependencies:G?.dependencies,referenced:H}}function MF($,Z){if(!$.expression)return!1;return $.inGuard===!0||Z===2774}function AF($,Z,J){let X=$.lineMap.get(Z);if(!X)return Z<=$.sourceLineCount?{line:Z,column:J}:null;let Y=X.expression?.anchor?0:Math.max(0,J-1-(X.prefixLength??0));return{line:X.line,column:X.column+Y,expression:X.expression,inGuard:J<=(X.guardPrefixLength??0)}}var NK=[{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"}],MK=[{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')"}],AK=[{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 IK($){let Z=[],J=[];return TK($,Z),kK($,Z,J),EK($,J),bK($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function TK($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function kK($,Z,J){for(let X of NK){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let K=new RegExp(X.altClose,"g");z+=($.match(K)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function EK($,Z){for(let J of MK)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function bK($,Z){for(let J of AK)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function yK($,Z){let J=$.slice(0,Z).split(`
3581
+ `);return{line:J.length,column:J[J.length-1].length+1}}function CK($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.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(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function SK($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function PK($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import o0 from"path";import G2 from"process";var K3=["module","exports","require","props","$props","$bool","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 EZ=new Set(K3),vK=new Set(["props","$props","defineProps"]),xK=new Set(["stx","@stacksjs/stx"]),bZ=y1(128),yZ=y1(64);function fK($){let Z=[],J=0,X=$.split(`
3582
+ `);for(let Y of X){let Q=J,G=null,z=!1;for(let K=0;K<Y.length;K++){let q=Y[K];if(z){z=!1;continue}if(q==="\\"){z=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&K+1<Y.length&&Y[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let K=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let q=Y.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let W=q[1].slice(1,-1).split(",").map((U)=>{let j=U.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((U)=>/^\w+$/.test(U));Z.push(...W)}}}}return[...new Set(Z)]}function gK($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,K=null;for(let q=0;q<X.length;q++){let H=X[q];if(K){if(Q+=H,H===K)K=null;continue}if(H==='"'||H==="'"||H==="`"){K=H,Q+=H;continue}if(H==="<")G++;else if(H===">"&&G>0)G--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=H}if(Q)Y.push(Q);return Y.map((q)=>{let H=q.trim(),W=H.startsWith("..."),U=W?H.slice(3):H,j=-1,B=0;for(let D=0;D<U.length;D++)if(U[D]==="<")B++;else if(U[D]===">")B--;else if(U[D]===":"&&B===0){j=D;break}if(j===-1)return q;let F=U.substring(0,j).trim().replace(/\?$/,""),O=U.substring(j+1),_=-1,L=0;for(let D=0;D<O.length;D++)if(O[D]==="<")L++;else if(O[D]===">")L--;else if(O[D]==="="&&L===0){_=D;break}let w=W?"...":"";if(_!==-1)return`${w}${F} = ${O.substring(_+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,K=G+1,q=0,H=null;while(K<Z.length&&z>0){let j=Z[K];if(H){if(j===H)H=null;K++;continue}if(j==='"'||j==="'"||j==="`"){H=j,K++;continue}if(j==="<")q++;else if(j===">"&&q>0)q--;else if(q===0){if(j==="(")z++;else if(j===")")z--}if(z>0)K++}if(z!==0)continue;let W=Z.substring(G+1,K);if(!W.includes(":"))continue;let U=J(W);Q.push({start:G+1,end:K,replacement:U})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];Z=Z.substring(0,z)+q+Z.substring(K)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...K]=G.split("="),q=z.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
3583
+
3584
+ `),Z}function hK($){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test($)}function uK($){if($ instanceof SyntaxError)return!0;let Z=$ instanceof Error?$.message:String($);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(Z)}function mK($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}var CZ=new Set;async function dK($,Z,J,X={}){if(!$.trim())return;let Y=X2(),Q=U1($,JSON.stringify(Y)),G=bZ.get(Q);if(G===void 0){try{let S=W3({loader:"ts",target:"browser",define:Y}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(v)}catch{G=gK($)}bZ.set(Q,G)}let z={exports:{}},K=z.exports,q=G2.cwd(),H={},W=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),U=new Map;for(let S of W)try{if(S.startsWith(".")){H[S]=await import(o0.resolve(o0.dirname(J),S));continue}let v=o0.resolve(q,"node_modules",S),d=o0.join(v,"package.json"),J0=JSON.parse(x("fs").readFileSync(d,"utf8")),H0=J0.main||"index.js";if(J0.exports){let k0=typeof J0.exports==="string"?J0.exports:J0.exports["."];if(typeof k0==="string")H0=k0;else if(k0?.bun)H0=k0.bun;else if(k0?.import)H0=k0.import;else if(k0?.default)H0=k0.default}H[S]=await import(o0.resolve(v,H0))}catch(v){if(S.startsWith("."))U.set(S,v instanceof Error?v.message:String(v))}let j=(S)=>{if(H[S])return H[S];let v=U.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${J}: ${v}`);return x(S)},B=Z.props||{},V=(S)=>{if(!S)return B;let v={};for(let[d,J0]of Object.entries(S)){let H0=B[d];if(H0!==void 0)v[d]=H0;else if(typeof J0==="function")v[d]=J0();else v[d]=J0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let F=(S,v=!1)=>{if(S===void 0||S===null)return v;if(typeof S==="string"){let d=S.trim().toLowerCase();if(d===""||d==="true"||d==="1"||d==="on"||d==="yes")return!0;if(d==="false"||d==="0"||d==="off"||d==="no")return!1;return!0}return Boolean(S)};for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(V,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let O=(S)=>{if(!S)return B;let v={...B};for(let[d,J0]of Object.entries(S)){let H0=J0&&typeof J0==="object"&&!Array.isArray(J0)?J0:{type:J0};if(v[d]===void 0&&H0.default!==void 0)v[d]=typeof H0.default==="function"?H0.default():H0.default}return v},_=()=>Z.slots||{},L=(S,v)=>{let d={...S};for(let[J0,H0]of Object.entries(v))if(d[J0]===void 0)if(typeof H0==="function")d[J0]=H0();else d[J0]=H0;return d},w=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},D=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},R=(S)=>{},M=(S)=>S(),T=(S)=>{},N=(S)=>{},I=U4(Z);function E(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)b({title:v.title,description:v.description})}function A(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let k=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",J0=Object.fromEntries(new URLSearchParams(v)),H0=Z.query,k0=Object.keys(J0).length>0?J0:H0??{},r0=v||(Object.keys(k0).length>0?`?${new URLSearchParams(k0).toString()}`:"");return{params:Z.params??{},query:k0,path:d,name:"",fullPath:d+r0,hash:"",matched:[]}},C=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),y=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=lZ(v,S||{})},b=(S)=>{y(cZ(S||{}))},P=(S)=>({value:S}),h=(S)=>S,p=(S)=>({value:typeof S==="function"?S():S}),u=(S,v)=>{},r=(S)=>{},e=(S)=>{},Y0=(S)=>S?S():Promise.resolve(),i=(S)=>(v,...d)=>{},W0=(S)=>{},a=(S,v)=>{},L0=(S,v)=>v,c0=()=>({value:"light"}),p0=()=>w(!1),g0=(S)=>w(!1),f=()=>w(!1),l=()=>g0("(prefers-color-scheme: dark)"),Z0=()=>g0("(prefers-color-scheme: light)"),j0=()=>g0("(prefers-reduced-motion: reduce)"),_0=()=>g0("(prefers-contrast: more)"),Q0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},B1=new Proxy(Q0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),r9={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},a9=console;try{let S=pZ(G,J),v=new Set(Object.keys(B)),d=Object.keys(Z).filter((n)=>!v.has(n)&&!vK.has(n)&&z2(n)),J0=d.map((n)=>Z[n]);if(!d.includes("__stxServeContext"))d.push("__stxServeContext"),J0.push(void 0);let H0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),k0=[],r0=[];for(let[n,h0]of Object.entries(B)){if(!z2(n))continue;if(H0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(S))continue;k0.push(n),r0.push(h0)}let Z1=fK(S).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3585
3585
  `),b0=Z.params??{},m=[],c=[];for(let n=0;n<d.length;n++){if(d[n]==="params")continue;m.push(d[n]),c.push(J0[n])}let G0=[...K3,...k0,...m],o=`return (async () => {
3586
3586
  ${S}
3587
3587
  ${Z1}
3588
3588
  return module.exports
3589
- })()`,w0=U1(o,G0.join("\x00")),q0=bZ.get(w0);if(!q0)q0=Function(...G0,o),bZ.set(w0,q0);let P0=Z.__stx_options?.runtimeConfig;if(P0||/\buse(?:Server)?RuntimeConfig\b/.test(G))await c9(Z,J,P0);let J1=await fZ(Z.__stx_runtime_config??gZ()??mZ(),()=>c6(Z,()=>q0(z,K,j,B,V,F,O,L,A,p6,uZ,hZ,w,D,R,M,T,N,E,k,C,y,b,I.setResponseStatus,I.setResponseHeader,I.notFound,P,h,p,u,r,e,Y0,i,W0,_,a,L0,c0,p0,g0,f,l,Z0,j0,_0,B1,r9,a9,Q0.confirm,Q0.alert,Q0.fetch,b0,...r0,...c)));if(X.preserveExisting){for(let[n,h0]of Object.entries(J1))if(!(n in Z)||Z[n]===void 0)Z[n]=h0}else Object.assign(Z,J1);for(let[n,h0]of Object.entries(B))if(!(n in Z))Z[n]=h0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(gK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`),X.onFailure?.({kind:"module-resolution",message:v,error:S});else if(hK(S))console.warn(`[stx] server <script> in ${J??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${v}`),X.onFailure?.({kind:"syntax",message:v,error:S});else if(uK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`),X.onFailure?.({kind:"missing-binding",message:v,error:S});else{let d=`${J??"<unknown>"}\x00${v}`;if(G2.env.STX_DEBUG||!yZ.has(d))yZ.add(d),console.warn(`[stx] server <script> in ${J??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${v}`);X.onFailure?.({kind:"unknown",message:v,error:S})}try{await oK(G,Z,J)}catch(d){if(G2.env.STX_DEBUG){let J0=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${J0}`)}}}}function dK($){let Z=0,J=null,X=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,X||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return J===null&&Z===0&&Y}var lK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function cZ($,Z){let J=Z?o0.dirname(Z):G2.cwd(),X=G2.cwd(),Y=$.split(`
3589
+ })()`,w0=U1(o,G0.join("\x00")),q0=yZ.get(w0);if(!q0)q0=Function(...G0,o),yZ.set(w0,q0);let P0=Z.__stx_options?.runtimeConfig;if(P0||/\buse(?:Server)?RuntimeConfig\b/.test(G))await c9(Z,J,P0);let J1=await gZ(Z.__stx_runtime_config??hZ()??dZ(),()=>p6(Z,()=>q0(z,K,j,B,V,F,O,L,A,i6,mZ,uZ,w,D,R,M,T,N,E,k,C,y,b,I.setResponseStatus,I.setResponseHeader,I.notFound,P,h,p,u,r,e,Y0,i,W0,_,a,L0,c0,p0,g0,f,l,Z0,j0,_0,B1,r9,a9,Q0.confirm,Q0.alert,Q0.fetch,b0,...r0,...c)));if(X.preserveExisting){for(let[n,h0]of Object.entries(J1))if(!(n in Z)||Z[n]===void 0)Z[n]=h0}else Object.assign(Z,J1);for(let[n,h0]of Object.entries(B))if(!(n in Z))Z[n]=h0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(hK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`),X.onFailure?.({kind:"module-resolution",message:v,error:S});else if(uK(S))console.warn(`[stx] server <script> in ${J??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${v}`),X.onFailure?.({kind:"syntax",message:v,error:S});else if(mK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`),X.onFailure?.({kind:"missing-binding",message:v,error:S});else{let d=`${J??"<unknown>"}\x00${v}`;if(G2.env.STX_DEBUG||!CZ.has(d))CZ.add(d),console.warn(`[stx] server <script> in ${J??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${v}`);X.onFailure?.({kind:"unknown",message:v,error:S})}try{await rK(G,Z,J)}catch(d){if(G2.env.STX_DEBUG){let J0=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${J0}`)}}}}function lK($){let Z=0,J=null,X=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,X||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return J===null&&Z===0&&Y}var cK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function pZ($,Z){let J=Z?o0.dirname(Z):G2.cwd(),X=G2.cwd(),Y=$.split(`
3590
3590
  `),Q=[],G=0;while(G<Y.length){let z=Y[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let K=0;for(;G<Y.length;G++){for(let q of Y[G])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let K=0,q=!1,H=G;for(let j=G;j<Y.length&&!q;j++){let B=null,V=!1,F=Y[j];for(let O=0;O<F.length;O++){let _=F[O];if(V){V=!1;continue}if(_==="\\"){V=!0;continue}if(B){if(_===B)B=null;continue}if(_==='"'||_==="'"||_==="`"){B=_;continue}if(_==="(")K++;else if(_===")"){if(K--,K===0){G=j+1,q=!0;break}}}}if(!q)G=Y.length;let W=Y.slice(H,G).join(`
3591
- `),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(W);if(B)U.push(`${j}: ${JSON.stringify(B[2])}`)}if(U.length>0)Q.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let K=z,q=0;while(!dK(K)&&G+q+1<Y.length)q++,K=`${K} ${Y[G+q].trim()}`;G+=q;let H=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),W=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+['"](.+?)['"]/),j=K,B=(V)=>{if(V.startsWith("."))return o0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return o0.resolve(X,V.slice(2));return V};if(H){let[,V,F]=H,O=B(F);Q.push(`const ${V} = (await import('${O}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(W){let[,V,F]=W,O=B(F),_=[],L=[],w=vK.has(F);for(let D of V.split(",")){let R=D.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,N]=[M[0].trim(),M[1].trim()];if(w&&kZ.has(T)){Q.push(`const ${N} = ${T};`);continue}_.push(`${T}: ${N}`),L.push(N)}else{if(w&&kZ.has(R))continue;_.push(R),L.push(R)}}if(_.length>0)Q.push(`const { ${_.join(", ")} } = await import('${O}')`);for(let D of L)Q.push(`module.exports.${D} = ${D};`)}else if(U){let V=B(U[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(lK.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let K=SZ(Y,G),{type:q,name:H,value:W}=K;Q.push(`${q} ${H} = ${W};`),Q.push(`module.exports.${H} = ${H};`),G=K.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let K=q3(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let K=SZ(Y,G),{type:q,name:H,value:W}=K;Q.push(`${q} ${H} = ${W};`),Q.push(`module.exports.${H} = ${H};`),G=K.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let K=q3(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let K=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[G]=K;let H=q3(q,G);if(Q.push(H.functionCode),H.name)Q.push(`module.exports.default = ${H.name};`);G=H.nextIndex}else if(z.startsWith("export default ")){let K=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let K=z.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],H=Y[G].replace(/^export\s+/,""),W=0,U=G;for(;U<Y.length;U++){let j=Y[U];for(let B of j)if(B==="{")W++;else if(B==="}")W--;if(U>G)H+=`
3592
- `+j;if(W<=0&&U>=G)break}Q.push(H),Q.push(`module.exports.${q} = ${q};`),G=U+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return cK(Q.join(`
3593
- `),J,X)}function cK($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,K=!1,q=0;while(Q<X){let H=$[Q],W=$[Q+1];if(z){if(Y+=H,H===`
3594
- `)z=!1;Q++;continue}if(K){if(Y+=H,H==="*"&&W==="/"){Y+=W,Q+=2,K=!1;continue}Q++;continue}if(!G&&H==="/"&&W==="/"){z=!0,Y+=H,Q++;continue}if(!G&&H==="/"&&W==="*"){K=!0,Y+=H,Q++;continue}if(G){if(Y+=H,H==="\\"){Y+=W,Q+=2;continue}if(H===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(H==="$"&&W==="{"){q++,Y+=W,Q+=2;continue}if(H==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(H==="{")q++;else if(H==="}")q--}if(H==='"'||H==="'"||H==="`"){G=H,Y+=H,Q++;continue}if(H==="a"&&$.startsWith("await",Q)){let U=pK($,Q);if(U){let{quote:j,path:B,end:V}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?o0.resolve(Z,B):o0.resolve(J,B.slice(2));Y+=`await import(${j}${F}${j})`,Q=V;continue}}}Y+=H,Q++}return Y}function pK($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let X=$[J];if(X!=="'"&&X!=='"')return null;J++;let Y=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(Y,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Q,end:J+1}}function pZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=N0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function iZ($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Y=0,Q="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Y===0?pZ(J,X):null;if(z){Z.push(...iZ(z.pattern)),X=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<J.length&&J[X]!==","&&Y===0){if(J[X]==="{"||J[X]==="[")Y++;else if(J[X]==="}"||J[X]==="]")Y--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function iK($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Y)=>Y===" "||Y==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Y=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[J+1],K=$[J-1];if(z!=="="&&z!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if($[J]!=="=")return null}while(J<$.length&&X($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function CZ($,Z,J,X){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function SZ($,Z){let J=$[Z].trim(),X=iK(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let H=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let W=J.slice(H[0].length),U=Z;if(W.startsWith("{")||W.startsWith("[")){let B=W[0],V=B==="{"?"}":"]",F=CZ(W,B,V,0),O=W;for(let _=Z+1;_<$.length&&F>0;_++)O+=` ${$[_].trim()}`,U=_,F=CZ($[_],B,V,F);if(F>0)O=W,U=Z;W=O}let j=pZ(W,0);if(j){let B=H[1],V=j.pattern,F=W.slice(j.endPos).trim();if(F.startsWith("=")){let O=F.slice(1).trim(),_=O,L=Math.max(U,Z);if(PZ(O)){let M=vZ($,L,O);_=M.value,L=M.nextIndex}else L=L+1;_=_.trim().replace(/;$/,"");let w=iZ(V),D=`__stx_src_${Z}`,R=w.map((M)=>`module.exports.${M} = ${M};`).join(`
3591
+ `),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(W);if(B)U.push(`${j}: ${JSON.stringify(B[2])}`)}if(U.length>0)Q.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let K=z,q=0;while(!lK(K)&&G+q+1<Y.length)q++,K=`${K} ${Y[G+q].trim()}`;G+=q;let H=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),W=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+['"](.+?)['"]/),j=K,B=(V)=>{if(V.startsWith("."))return o0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return o0.resolve(X,V.slice(2));return V};if(H){let[,V,F]=H,O=B(F);Q.push(`const ${V} = (await import('${O}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(W){let[,V,F]=W,O=B(F),_=[],L=[],w=xK.has(F);for(let D of V.split(",")){let R=D.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,N]=[M[0].trim(),M[1].trim()];if(w&&EZ.has(T)){Q.push(`const ${N} = ${T};`);continue}_.push(`${T}: ${N}`),L.push(N)}else{if(w&&EZ.has(R))continue;_.push(R),L.push(R)}}if(_.length>0)Q.push(`const { ${_.join(", ")} } = await import('${O}')`);for(let D of L)Q.push(`module.exports.${D} = ${D};`)}else if(U){let V=B(U[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(cK.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let K=PZ(Y,G),{type:q,name:H,value:W}=K;Q.push(`${q} ${H} = ${W};`),Q.push(`module.exports.${H} = ${H};`),G=K.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let K=q3(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let K=PZ(Y,G),{type:q,name:H,value:W}=K;Q.push(`${q} ${H} = ${W};`),Q.push(`module.exports.${H} = ${H};`),G=K.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let K=q3(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let K=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[G]=K;let H=q3(q,G);if(Q.push(H.functionCode),H.name)Q.push(`module.exports.default = ${H.name};`);G=H.nextIndex}else if(z.startsWith("export default ")){let K=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let K=z.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],H=Y[G].replace(/^export\s+/,""),W=0,U=G;for(;U<Y.length;U++){let j=Y[U];for(let B of j)if(B==="{")W++;else if(B==="}")W--;if(U>G)H+=`
3592
+ `+j;if(W<=0&&U>=G)break}Q.push(H),Q.push(`module.exports.${q} = ${q};`),G=U+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return pK(Q.join(`
3593
+ `),J,X)}function pK($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,K=!1,q=0;while(Q<X){let H=$[Q],W=$[Q+1];if(z){if(Y+=H,H===`
3594
+ `)z=!1;Q++;continue}if(K){if(Y+=H,H==="*"&&W==="/"){Y+=W,Q+=2,K=!1;continue}Q++;continue}if(!G&&H==="/"&&W==="/"){z=!0,Y+=H,Q++;continue}if(!G&&H==="/"&&W==="*"){K=!0,Y+=H,Q++;continue}if(G){if(Y+=H,H==="\\"){Y+=W,Q+=2;continue}if(H===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(H==="$"&&W==="{"){q++,Y+=W,Q+=2;continue}if(H==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(H==="{")q++;else if(H==="}")q--}if(H==='"'||H==="'"||H==="`"){G=H,Y+=H,Q++;continue}if(H==="a"&&$.startsWith("await",Q)){let U=iK($,Q);if(U){let{quote:j,path:B,end:V}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?o0.resolve(Z,B):o0.resolve(J,B.slice(2));Y+=`await import(${j}${F}${j})`,Q=V;continue}}}Y+=H,Q++}return Y}function iK($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let X=$[J];if(X!=="'"&&X!=='"')return null;J++;let Y=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(Y,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Q,end:J+1}}function iZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=N0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function nZ($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Y=0,Q="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Y===0?iZ(J,X):null;if(z){Z.push(...nZ(z.pattern)),X=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<J.length&&J[X]!==","&&Y===0){if(J[X]==="{"||J[X]==="[")Y++;else if(J[X]==="}"||J[X]==="]")Y--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function nK($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Y)=>Y===" "||Y==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Y=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[J+1],K=$[J-1];if(z!=="="&&z!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if($[J]!=="=")return null}while(J<$.length&&X($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function SZ($,Z,J,X){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function PZ($,Z){let J=$[Z].trim(),X=nK(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let H=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let W=J.slice(H[0].length),U=Z;if(W.startsWith("{")||W.startsWith("[")){let B=W[0],V=B==="{"?"}":"]",F=SZ(W,B,V,0),O=W;for(let _=Z+1;_<$.length&&F>0;_++)O+=` ${$[_].trim()}`,U=_,F=SZ($[_],B,V,F);if(F>0)O=W,U=Z;W=O}let j=iZ(W,0);if(j){let B=H[1],V=j.pattern,F=W.slice(j.endPos).trim();if(F.startsWith("=")){let O=F.slice(1).trim(),_=O,L=Math.max(U,Z);if(vZ(O)){let M=xZ($,L,O);_=M.value,L=M.nextIndex}else L=L+1;_=_.trim().replace(/;$/,"");let w=nZ(V),D=`__stx_src_${Z}`,R=w.map((M)=>`module.exports.${M} = ${M};`).join(`
3595
3595
  `);return{type:B,name:D,value:`${_}; ${B} ${V} = ${D};
3596
- ${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,K=z,q=Z;if(PZ(z)){let H=vZ($,Z,z);K=H.value,q=H.nextIndex}else q=Z+1;while(q<$.length){let H=$[q].trim();if(H.startsWith(".")||H.startsWith("?."))K+=`
3597
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:K,nextIndex:q}}function q3($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(nK(J)){let z=sK($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function PZ($){let Z=$.trim();if(Z.startsWith("{"))return N0(Z,"{","}",0)===-1;if(Z.startsWith("["))return N0(Z,"[","]",0)===-1;return!nZ(Z)}function nZ($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Q==="$"&&$[Y+1]==="{"){X++,Y++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function sZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=N0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function nK($){let Z=sZ($);if(Z===-1)return!0;return N0($,"{","}",Z)===-1}function vZ($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!nZ(X)){let Q=$[Y];X+=`
3596
+ ${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,K=z,q=Z;if(vZ(z)){let H=xZ($,Z,z);K=H.value,q=H.nextIndex}else q=Z+1;while(q<$.length){let H=$[q].trim();if(H.startsWith(".")||H.startsWith("?."))K+=`
3597
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:K,nextIndex:q}}function q3($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(sK(J)){let z=oK($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function vZ($){let Z=$.trim();if(Z.startsWith("{"))return N0(Z,"{","}",0)===-1;if(Z.startsWith("["))return N0(Z,"[","]",0)===-1;return!sZ(Z)}function sZ($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Q==="$"&&$[Y+1]==="{"){X++,Y++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function oZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=N0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function sK($){let Z=oZ($);if(Z===-1)return!0;return N0($,"{","}",Z)===-1}function xZ($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!sZ(X)){let Q=$[Y];X+=`
3598
3598
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
3599
- ${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function sK($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=sZ(X);if(Q!==-1){if(N0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
3600
- ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function xZ($,Z){let J=X0($,Z)??X0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...G2.env}})},Y=Object.keys(X).filter(z2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function oK($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let K=z.trim().replace(/;$/,""),q=xZ(K,Z);if(q!==void 0)Z[G]=q}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),q=xZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function rK($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function aK($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var d2=new r1(500),s9=new r1(1000),QJ=33554432,U3=QJ;function tK($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===U3)return;U3=Z,o9.setMaxBytes(Z)}var o9=new r1(2000,{maxBytes:QJ,sizeOf:($)=>$.output.length});function eK($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function oZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $q($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function T1($){return!$q($)}var n9=new Map;function W3($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=n9.get(Z);if(J)return J;if(n9.size>=16)n9.clear();let X=new Bun.Transpiler($);return n9.set(Z,X),X}var rZ=new WeakMap,Zq=256;function k1($){try{let Z=W3({loader:"ts",target:"browser",define:X2()}),J=rZ.get(Z);if(!J)J=new Map,rZ.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=Zq){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Jq($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(H)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===H){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let H=1;while(Y<Q&&H>0)if($[Y]==="{")H++,Y++;else if($[Y]==="}")H--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},K=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3601
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let H=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let B=H[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function Xq($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Yq($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Qq($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of Xq(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let H=Yq(q);if(H===-1)continue;let W=q.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let U=q.slice(H+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(z2),B=Function(...j,`"use strict"; return (${U});`);Z[W]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var Gq=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function zq($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!J)return null;let X=J[2].toLowerCase();if(!Gq.has(X))return null;if(($.match(new RegExp(`<${X}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${X}>\\s*$`,"i").test($))return null;let Q=J[0].length;return $.slice(0,Q)+Z+$.slice(Q)}async function T9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],H=typeof Y.root==="string"?g.resolve(Y.root):void 0,W=H??g.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),H)j(g.resolve(H,"resources/views/components")),j(g.resolve(H,"resources/components")),j(g.resolve(H,"src/components")),j(g.resolve(H,"components"));for(let O of Y._layerComponentDirs??[])j(O);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(g.resolve(g.dirname(X),`${Q}.stx`));let F=aZ(g.resolve(import.meta.dir,"components"));for(let O of U){let _=g.isAbsolute(O)?O:g.resolve(W,O);if(aZ(_)===F)continue;for(let L of q)if(await t(g.join(_,L)))return!0}return!1}function aZ($){try{return YJ.realpathSync($)}catch{return $}}function Kq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function qq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Wq($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Y,Q)=>{let G;try{G=C0(Y,Z)}catch{return Q}if(G===void 0||G===null)return"";let z=String(G);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${J??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return $.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>X(Q,Y)).replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>X(Q,Y))}var tZ=new Set;function eZ($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&tZ.has(Y))return;tZ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
3599
+ ${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function oK($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=oZ(X);if(Q!==-1){if(N0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
3600
+ ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function fZ($,Z){let J=X0($,Z)??X0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...G2.env}})},Y=Object.keys(X).filter(z2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function rK($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let K=z.trim().replace(/;$/,""),q=fZ(K,Z);if(q!==void 0)Z[G]=q}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),q=fZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function aK($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function tK($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var d2=new r1(500),s9=new r1(1000),GJ=33554432,U3=GJ;function eK($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===U3)return;U3=Z,o9.setMaxBytes(Z)}var o9=new r1(2000,{maxBytes:GJ,sizeOf:($)=>$.output.length});function $q($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function rZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function T1($){return!Zq($)}var n9=new Map;function W3($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=n9.get(Z);if(J)return J;if(n9.size>=16)n9.clear();let X=new Bun.Transpiler($);return n9.set(Z,X),X}var aZ=new WeakMap,Jq=256;function k1($){try{let Z=W3({loader:"ts",target:"browser",define:X2()}),J=aZ.get(Z);if(!J)J=new Map,aZ.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=Jq){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Xq($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(H)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===H){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let H=1;while(Y<Q&&H>0)if($[Y]==="{")H++,Y++;else if($[Y]==="}")H--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},K=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3601
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let H=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let B=H[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function Yq($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Qq($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Gq($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of Yq(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let H=Qq(q);if(H===-1)continue;let W=q.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let U=q.slice(H+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(z2),B=Function(...j,`"use strict"; return (${U});`);Z[W]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var zq=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function Kq($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!J)return null;let X=J[2].toLowerCase();if(!zq.has(X))return null;if(($.match(new RegExp(`<${X}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${X}>\\s*$`,"i").test($))return null;let Q=J[0].length;return $.slice(0,Q)+Z+$.slice(Q)}async function T9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],H=typeof Y.root==="string"?g.resolve(Y.root):void 0,W=H??g.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),H)j(g.resolve(H,"resources/views/components")),j(g.resolve(H,"resources/components")),j(g.resolve(H,"src/components")),j(g.resolve(H,"components"));for(let O of Y._layerComponentDirs??[])j(O);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(g.resolve(g.dirname(X),`${Q}.stx`));let F=tZ(g.resolve(import.meta.dir,"components"));for(let O of U){let _=g.isAbsolute(O)?O:g.resolve(W,O);if(tZ(_)===F)continue;for(let L of q)if(await t(g.join(_,L)))return!0}return!1}function tZ($){try{return QJ.realpathSync($)}catch{return $}}function qq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Wq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Hq($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Y,Q)=>{let G;try{G=C0(Y,Z)}catch{return Q}if(G===void 0||G===null)return"";let z=String(G);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${J??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return $.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>X(Q,Y)).replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>X(Q,Y))}var eZ=new Set;function $J($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&eZ.has(Y))return;eZ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
3602
3602
  searched:
3603
3603
  ${J.map((K)=>` - ${K}`).join(`
3604
- `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function $J($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Hq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function I1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-rn0j7n49.js")),H=z??new Set;if(H.has($))return`[Circular component reference: ${$}]`;let W=new Set(H);W.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&Kq(U)?U:"";try{let B=(m)=>m.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(m)=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,O=null,_=Y.__importedComponents;if(_){let m=[F,F.toLowerCase(),B(F),V(F)];for(let c of m)if(_.has(c)){O=_.get(c);break}}let L=[];if(!O){let m=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,o=[];if(o.push(...G._layerComponentDirs??[]),G0){let A0=g.join(g.dirname(G0),"components");o.push(A0)}if(X)o.push(X);let w0=G._rootComponentsDir;if(typeof w0==="string"&&!o.includes(w0))o.push(w0);let q0=g.join(g.dirname(Q),"components");if(!o.includes(q0))o.push(q0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let P0=typeof G.root==="string"?g.resolve(G.root):void 0,J1=P0??g.dirname(Q),n=[];if(P0)n.push(g.resolve(P0,"resources/views/components")),n.push(g.resolve(P0,"resources/components")),n.push(g.resolve(P0,"src/components")),n.push(g.resolve(P0,"components"));n.push(g.resolve(import.meta.dir,"components"));for(let A0 of n)if(!o.includes(A0))o.push(A0);let h0=G._pluginComponentDirs;if(Array.isArray(h0)){for(let A0 of h0)if(typeof A0==="string"&&!o.includes(A0))o.push(A0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let P1=[...new Set(o.map((A0)=>{if(!A0)return A0;return g.isAbsolute(A0)?A0:g.resolve(J1,A0)}))];o.length=0,o.push(...P1);let v1=`${F}\x00${Q}\x00${P1.join("\x00")}`,t9=s9.get(v1);if(t9)if(await t(t9))O=t9;else s9.delete(v1);if(!O&&(F.startsWith("./")||F.startsWith("../")))O=g.resolve(g.dirname(Q),`${F}.stx`),L.push(O);else if(!O)for(let A0 of o){if(!A0)continue;for(let p2 of c){let i2=g.join(A0,p2);if(L.push(i2),await t(i2)){O=i2;break}}if(O)break;if(!O)try{let p2=await import("fs");if(!p2.statSync(A0,{throwIfNoEntry:!1})?.isDirectory())continue;let BJ=8,e9=[{path:A0,depth:0}];while(e9.length>0&&!O){let n2=e9.pop();if(n2.depth>=BJ)continue;let L3;try{L3=p2.readdirSync(n2.path,{withFileTypes:!0})}catch{continue}for(let s2 of L3){if(!s2.isDirectory())continue;if(s2.name==="node_modules"||s2.name.startsWith("."))continue;let O3=g.join(n2.path,s2.name);for(let VJ of c){let $5=g.join(O3,VJ);if(L.push($5),await t($5)){O=$5;break}}if(O)break;e9.push({path:O3,depth:n2.depth+1})}}}catch{}if(O)break}if(O)s9.set(v1,O)}if(!O||!await t(O))return eZ($,Q,L),$J($);K.add(O);let w;if(d2.has(O))w=d2.get(O);else try{w=await Bun.file(O).text(),d2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return eZ($,Q,[O],c),$J($)}let D=new Set(["__originalFilePath","__importedComponents",r2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||D.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-qj8jfkst.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),N=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",o=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",w0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),q0=!w0||["module","text/javascript","application/javascript"].includes(w0);if(!/\bserver\b/i.test(o)&&q0)return N.push(G0),"";return G0}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-x3dxrzgq.js")),A=E(I),k={};if(A.defaultSlot?.trim())k.default=A.defaultSlot;for(let[m,c]of A.namedSlots)k[m]=c.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:k,__processedComponents:W,__sections:{},__stx_signals_gate:X1(w)||qq(J)};Qq(w,b);let P=w,h=O9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(p)],r=[],e=null,Y0=u.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),i=null,W0=null,a=null,L0=0,c0=null;if(tK(G),Y0&&U3>0){let m=eK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){i=`${O}\x00${U1(w)}\x00${m}`;let c=o9.get(i);if(c){for(let G0 of c.dependencies)K.add(G0);if(y3(Y,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of c.preservedClientExpressions)G0.add(o);Y.__stx_preserved_client_expressions=[...G0]}return c.output}W0=new Set(K),a=E3(Y),L0=C.n,c0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let p0=new Set;for(let m of u){let c=m[1]||"",G0=m[2]||"",o=c.includes("server");if(T1(c)&&G0.trim())G0=k1(G0);if(o&&G0){for(let q0 of j1(G0))p0.add(q0);try{await q(G0,b,O,{onFailure:(q0)=>{if(q0.kind!=="unknown")e=q0.kind}})}catch(q0){}}if(!o){let q0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=q0.includes("{{")&&q0.includes("}}"),J1=q0.includes("{!!")&&q0.includes("!!}");if(P0||J1)q0=H5(q0,b,O);let n=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${n}>${q0}</script>`)}}let f=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),l=f?f[1]:"",Z0=f?f[2]:"",j0="",_0=l&&/\bscoped\b/i.test(l);if(f)j0=`<style${l}>${Wq(Z0,b,O)}</style>`;let Q0=P;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(Q0=Q0.replace(m,(G0,o)=>{let w0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(w0)c.push(`<style${w0[1]}>${w0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)j0=`${j0}${c.join(`
3605
- `)}`}if(J&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B1}=await s("stx/slots",()=>import("./chunk-x3dxrzgq.js")),{defaultSlot:r9,namedSlots:a9}=A,S=r.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),v=(m)=>S?S8(m,y):m,d=new Map([...a9].map(([m,c])=>[m,{...c,content:v(c.content)}]));Q0=await B1(Q0,v(r9),d,b);let J0=Hq(r),H0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!p0.has(m));if(J0.length>0||H0.length>0)b.__stx_client_signal_names=[...new Set([...H0,...J0])];else delete b.__stx_client_signal_names;let k0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:S||r.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r0=await X3(Q0,b,O,k0,K),c2=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of r0.matchAll(/\{\{([\s\S]*?)\}\}/g))c2.add(m[1].trim());if(c2.size>0)Y.__stx_preserved_client_expressions=[...c2];let Z1=y,b0=r0;if(S){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${oZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${oZ(j)}"`:"",G0=` data-stx-scope="${Z1}"${m}${c}`;b0=zq(r0,G0)??`<div${G0}>${r0}</div>`;let o=await Promise.all(r.map(async(w0)=>{let q0=w0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!q0)return w0;let[,P0,J1]=q0,{vendorStyleTags:n,factoryBody:h0}=await Bq(J1,O,G.buildMode==="compile"),P1=j?null:Y5(Y,h0),v1=P1?`window.__stxComponentFactories[${JSON.stringify(P1)}](${JSON.stringify(Z1)});`:`(${h0})(${JSON.stringify(Z1)});`;if(j)return`${n}<script type="stx/island" data-stx-island="${Z1}" data-stx-scoped data-stx-owner="${Z1}"${P0}>${v1}</script>`;return`${n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Z1}"${P0}>${v1}</script>`}));if(b0=b0+`
3604
+ `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function ZJ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Uq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function I1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-h40194h3.js")),H=z??new Set;if(H.has($))return`[Circular component reference: ${$}]`;let W=new Set(H);W.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&qq(U)?U:"";try{let B=(m)=>m.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(m)=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,O=null,_=Y.__importedComponents;if(_){let m=[F,F.toLowerCase(),B(F),V(F)];for(let c of m)if(_.has(c)){O=_.get(c);break}}let L=[];if(!O){let m=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,o=[];if(o.push(...G._layerComponentDirs??[]),G0){let A0=g.join(g.dirname(G0),"components");o.push(A0)}if(X)o.push(X);let w0=G._rootComponentsDir;if(typeof w0==="string"&&!o.includes(w0))o.push(w0);let q0=g.join(g.dirname(Q),"components");if(!o.includes(q0))o.push(q0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let P0=typeof G.root==="string"?g.resolve(G.root):void 0,J1=P0??g.dirname(Q),n=[];if(P0)n.push(g.resolve(P0,"resources/views/components")),n.push(g.resolve(P0,"resources/components")),n.push(g.resolve(P0,"src/components")),n.push(g.resolve(P0,"components"));n.push(g.resolve(import.meta.dir,"components"));for(let A0 of n)if(!o.includes(A0))o.push(A0);let h0=G._pluginComponentDirs;if(Array.isArray(h0)){for(let A0 of h0)if(typeof A0==="string"&&!o.includes(A0))o.push(A0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let P1=[...new Set(o.map((A0)=>{if(!A0)return A0;return g.isAbsolute(A0)?A0:g.resolve(J1,A0)}))];o.length=0,o.push(...P1);let v1=`${F}\x00${Q}\x00${P1.join("\x00")}`,t9=s9.get(v1);if(t9)if(await t(t9))O=t9;else s9.delete(v1);if(!O&&(F.startsWith("./")||F.startsWith("../")))O=g.resolve(g.dirname(Q),`${F}.stx`),L.push(O);else if(!O)for(let A0 of o){if(!A0)continue;for(let p2 of c){let i2=g.join(A0,p2);if(L.push(i2),await t(i2)){O=i2;break}}if(O)break;if(!O)try{let p2=await import("fs");if(!p2.statSync(A0,{throwIfNoEntry:!1})?.isDirectory())continue;let VJ=8,e9=[{path:A0,depth:0}];while(e9.length>0&&!O){let n2=e9.pop();if(n2.depth>=VJ)continue;let L3;try{L3=p2.readdirSync(n2.path,{withFileTypes:!0})}catch{continue}for(let s2 of L3){if(!s2.isDirectory())continue;if(s2.name==="node_modules"||s2.name.startsWith("."))continue;let O3=g.join(n2.path,s2.name);for(let LJ of c){let $5=g.join(O3,LJ);if(L.push($5),await t($5)){O=$5;break}}if(O)break;e9.push({path:O3,depth:n2.depth+1})}}}catch{}if(O)break}if(O)s9.set(v1,O)}if(!O||!await t(O))return $J($,Q,L),ZJ($);K.add(O);let w;if(d2.has(O))w=d2.get(O);else try{w=await Bun.file(O).text(),d2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return $J($,Q,[O],c),ZJ($)}let D=new Set(["__originalFilePath","__importedComponents",r2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||D.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-cpjqmg8e.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),N=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",o=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",w0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),q0=!w0||["module","text/javascript","application/javascript"].includes(w0);if(!/\bserver\b/i.test(o)&&q0)return N.push(G0),"";return G0}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-mfxesx41.js")),A=E(I),k={};if(A.defaultSlot?.trim())k.default=A.defaultSlot;for(let[m,c]of A.namedSlots)k[m]=c.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:k,__processedComponents:W,__sections:{},__stx_signals_gate:X1(w)||Wq(J)};Gq(w,b);let P=w,h=O9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(p)],r=[],e=null,Y0=u.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),i=null,W0=null,a=null,L0=0,c0=null;if(eK(G),Y0&&U3>0){let m=$q({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){i=`${O}\x00${U1(w)}\x00${m}`;let c=o9.get(i);if(c){for(let G0 of c.dependencies)K.add(G0);if(C3(Y,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of c.preservedClientExpressions)G0.add(o);Y.__stx_preserved_client_expressions=[...G0]}return c.output}W0=new Set(K),a=b3(Y),L0=C.n,c0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let p0=new Set;for(let m of u){let c=m[1]||"",G0=m[2]||"",o=c.includes("server");if(T1(c)&&G0.trim())G0=k1(G0);if(o&&G0){for(let q0 of j1(G0))p0.add(q0);try{await q(G0,b,O,{onFailure:(q0)=>{if(q0.kind!=="unknown")e=q0.kind}})}catch(q0){}}if(!o){let q0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=q0.includes("{{")&&q0.includes("}}"),J1=q0.includes("{!!")&&q0.includes("!!}");if(P0||J1)q0=H5(q0,b,O);let n=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${n}>${q0}</script>`)}}let f=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),l=f?f[1]:"",Z0=f?f[2]:"",j0="",_0=l&&/\bscoped\b/i.test(l);if(f)j0=`<style${l}>${Hq(Z0,b,O)}</style>`;let Q0=P;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(Q0=Q0.replace(m,(G0,o)=>{let w0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(w0)c.push(`<style${w0[1]}>${w0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)j0=`${j0}${c.join(`
3605
+ `)}`}if(J&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B1}=await s("stx/slots",()=>import("./chunk-mfxesx41.js")),{defaultSlot:r9,namedSlots:a9}=A,S=r.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),v=(m)=>S?P8(m,y):m,d=new Map([...a9].map(([m,c])=>[m,{...c,content:v(c.content)}]));Q0=await B1(Q0,v(r9),d,b);let J0=Uq(r),H0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!p0.has(m));if(J0.length>0||H0.length>0)b.__stx_client_signal_names=[...new Set([...H0,...J0])];else delete b.__stx_client_signal_names;let k0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:S||r.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r0=await X3(Q0,b,O,k0,K),c2=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of r0.matchAll(/\{\{([\s\S]*?)\}\}/g))c2.add(m[1].trim());if(c2.size>0)Y.__stx_preserved_client_expressions=[...c2];let Z1=y,b0=r0;if(S){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${rZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${rZ(j)}"`:"",G0=` data-stx-scope="${Z1}"${m}${c}`;b0=Kq(r0,G0)??`<div${G0}>${r0}</div>`;let o=await Promise.all(r.map(async(w0)=>{let q0=w0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!q0)return w0;let[,P0,J1]=q0,{vendorStyleTags:n,factoryBody:h0}=await Vq(J1,O,G.buildMode==="compile"),P1=j?null:Y5(Y,h0),v1=P1?`window.__stxComponentFactories[${JSON.stringify(P1)}](${JSON.stringify(Z1)});`:`(${h0})(${JSON.stringify(Z1)});`;if(j)return`${n}<script type="stx/island" data-stx-island="${Z1}" data-stx-scoped data-stx-owner="${Z1}"${P0}>${v1}</script>`;return`${n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Z1}"${P0}>${v1}</script>`}));if(b0=b0+`
3606
3606
  `+o.join(`
3607
3607
  `),j0)b0+=`
3608
3608
  `+j0}else{if(j0)b0+=`
3609
3609
  `+j0;if(r.length>0){let m=b.__stx_event_bindings||[],c=m9(b),G0=await Promise.all(r.map(async(o)=>{let w0=o.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!w0)return o;return await d9(w0[1],{eventBindings:m,templateContent:b0,filePath:O,projectRoot:process.cwd(),serverData:c,instanceId:y})}));b0+=`
3610
3610
  `+G0.join(`
3611
- `),b.__stx_event_bindings=[]}}if(_0){let m=l9(b0,O);if(m.hasScoped)b0=m.html}if(i&&W0){let m=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];o9.set(i,{output:b0,dependencies:[...K].filter((c)=>!W0.has(c)),clientFactories:a?b3(Y,a):[],uidsConsumed:C.n-L0,preservedClientExpressions:c0?m.filter((c)=>!c0.has(c)):[]})}if(e)b0=`<!--stx-render-failed:${e}-->${b0}`;return N.length>0?`${b0}
3611
+ `),b.__stx_event_bindings=[]}}if(_0){let m=l9(b0,O);if(m.hasScoped)b0=m.html}if(i&&W0){let m=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];o9.set(i,{output:b0,dependencies:[...K].filter((c)=>!W0.has(c)),clientFactories:a?y3(Y,a):[],uidsConsumed:C.n-L0,preservedClientExpressions:c0?m.filter((c)=>!c0.has(c)):[]})}if(e)b0=`<!--stx-render-failed:${e}-->${b0}`;return N.length>0?`${b0}
3612
3612
  ${N.join(`
3613
- `)}`:b0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{H.delete($)}}async function t($){return Bun.file($).exists()}function j3($,Z){let J=g.resolve(Z),X=g.resolve($),Y=J.endsWith(g.sep)?J:J+g.sep;if(X===J||X.startsWith(Y))return X;return null}async function Uq($,Z,J,X){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await t(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function K9($,Z,J,X){let Y=await jq($,Z,J,X);if(Y===null)return null;let Q=j3(Y,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir,...J._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let K=g.isAbsolute(z)?z:g.resolve(process.cwd(),z);if(j3(Y,K))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function jq($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let U=g.join(Q,$),j=j3(U,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await t(j)&&X)X.add(j);return j}let G=g.join(Y,$);if(await t(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let j=`${G}${U}`;if(await t(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(z.push(...J._layerLayoutDirs??[]),J.layoutsDir)z.push(g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir));let K=g.resolve(Y),q=process.cwd();for(let U=0;U<10;U++){let j=g.join(K,"layouts"),B=!1;try{B=YJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=g.dirname(K);if(V===K||V.length<q.length)break;K=V}for(let U of z){let j=await Uq(U,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let U=g.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:g.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[g.join(U,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let V of B)if(await t(V)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(X)X.add(V);return V}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=g.join(J.partialsDir||Y,"layouts",U[1]);if(await t(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await t(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(J.partialsDir){let U=g.join(J.partialsDir,"layouts");if(await t(U)){let j=g.join(U,$);if(await t(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await t(B)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let H=J.partialsDir||g.join(process.cwd(),"views"),W=g.join(H,$);if(await t(W)){if(J.debug)console.log(`Found in views path: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let U=`${W}.stx`;if(await t(U)){if(J.debug)console.log(`Found in views path with extension: ${U}`);if(X)X.add(U);return U}}if(Y.includes("temp")){let U=g.join(g.dirname(Y),"layouts",$);if(await t(U)){if(J.debug)console.log(`Found in temp layouts dir: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await t(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function GJ($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3613
+ `)}`:b0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{H.delete($)}}async function t($){return Bun.file($).exists()}function j3($,Z){let J=g.resolve(Z),X=g.resolve($),Y=J.endsWith(g.sep)?J:J+g.sep;if(X===J||X.startsWith(Y))return X;return null}async function jq($,Z,J,X){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await t(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function K9($,Z,J,X){let Y=await Bq($,Z,J,X);if(Y===null)return null;let Q=j3(Y,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir,...J._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let K=g.isAbsolute(z)?z:g.resolve(process.cwd(),z);if(j3(Y,K))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function Bq($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let U=g.join(Q,$),j=j3(U,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await t(j)&&X)X.add(j);return j}let G=g.join(Y,$);if(await t(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let j=`${G}${U}`;if(await t(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(z.push(...J._layerLayoutDirs??[]),J.layoutsDir)z.push(g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir));let K=g.resolve(Y),q=process.cwd();for(let U=0;U<10;U++){let j=g.join(K,"layouts"),B=!1;try{B=QJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=g.dirname(K);if(V===K||V.length<q.length)break;K=V}for(let U of z){let j=await jq(U,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let U=g.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:g.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[g.join(U,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let V of B)if(await t(V)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(X)X.add(V);return V}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=g.join(J.partialsDir||Y,"layouts",U[1]);if(await t(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await t(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(J.partialsDir){let U=g.join(J.partialsDir,"layouts");if(await t(U)){let j=g.join(U,$);if(await t(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await t(B)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let H=J.partialsDir||g.join(process.cwd(),"views"),W=g.join(H,$);if(await t(W)){if(J.debug)console.log(`Found in views path: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let U=`${W}.stx`;if(await t(U)){if(J.debug)console.log(`Found in views path with extension: ${U}`);if(X)X.add(U);return U}}if(Y.includes("temp")){let U=g.join(g.dirname(Y),"layouts",$);if(await t(U)){if(J.debug)console.log(`Found in temp layouts dir: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await t(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function zJ($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3614
3614
  `),z=0;for(let K=0;K<G.length;K++)if(z+=G[K].length+1,z>=Z){X=K+1,Y=G[K].trim();let q=Math.max(0,K-2),H=Math.min(G.length,K+3);Q=G.slice(q,H).map((W,U)=>{let j=q+U+1;return`${j===X?"> ":" "}${j}: ${W}`}).join(`
3615
- `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return GJ($,G)}}catch{}return{lineNumber:X,lineContent:Y,context:Q}}var $0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function O0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=GJ(X,Y,Q),K=J.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&X){let W=X.lastIndexOf(`
3615
+ `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return zJ($,G)}}catch{}return{lineNumber:X,lineContent:Y,context:Q}}var $0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function O0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=zJ(X,Y,Q),K=J.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&X){let W=X.lastIndexOf(`
3616
3616
  `,Math.max(0,Y-1));q=Y-(W+1)+1}let H="";if(G>0)H+=`
3617
3617
  ${J}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
3618
3618
  `;if(H+=`
@@ -3625,8 +3625,8 @@ ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
3625
3625
  `,z)H+=`
3626
3626
  ${$0.blue}${$0.bold}Context:${$0.reset}
3627
3627
  ${$0.dim}${z}${$0.reset}
3628
- `;return H}function K_(){d2.clear(),s9.clear(),o9.clear()}function q_(){return{size:d2.size,maxSize:500}}var H3=y1(128);async function Bq($,Z,J){let X=U1($,Z,J),Y=H3.get(X);if(Y){if(XJ(Y.deps))return Y;H3.delete(X)}let Q=B3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=V3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-rfqw1q2h.js")),H=[],W=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:H}),W=G===O}let{stripStxRuntimeImports:U}=await s("stx/signal-processing",()=>import("./chunk-vrbjwgva.js"));G=U(G);let j=e0(G),B=Jq(j),V=`function(__scopeId) {
3629
- ${o1("const",[...ZJ,...B],j)}
3628
+ `;return H}function q_(){d2.clear(),s9.clear(),o9.clear()}function W_(){return{size:d2.size,maxSize:500}}var H3=y1(128);async function Vq($,Z,J){let X=U1($,Z,J),Y=H3.get(X);if(Y){if(YJ(Y.deps))return Y;H3.delete(X)}let Q=B3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=V3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-e26spfv8.js")),H=[],W=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:H}),W=G===O}let{stripStxRuntimeImports:U}=await s("stx/signal-processing",()=>import("./chunk-xgxf107n.js"));G=U(G);let j=e0(G),B=Xq(j),V=`function(__scopeId) {
3629
+ ${o1("const",[...JJ,...B],j)}
3630
3630
  const __scope = window.stx._scopes = window.stx._scopes || {};
3631
3631
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
3632
3632
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -3654,18 +3654,18 @@ catch (e) {}
3654
3654
  finally {
3655
3655
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3656
3656
  }
3657
- }`,F={vendorStyleTags:z,factoryBody:V,deps:JJ([...H,...Q.styles.map((O)=>O.resolvedPath)])};if(!W&&Q.unresolved.length===0)H3.set(X,F);return F}var Vq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Lq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Oq($,Z){let J=Z;while(!0){let X=S1.join(J,"node_modules",$,"package.json");if(l2.existsSync(X))return S1.dirname(X);let Y=S1.dirname(J);if(Y===J)return null;J=Y}}function Fq($,Z){if(!$||typeof $!=="object")return null;let J=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return J(Y.import);if(typeof Y.default==="object")return J(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Y,prefix:G,suffix:z}}if(X){let Y=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=J($[X.pattern]);if(Q)return Q.replace("*",Y)}return null}function _q($,Z){let J=Lq($);if(!J||!J.subpath)return null;let X=Oq(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(l2.readFileSync(S1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=Fq(Y.exports,Q);if(!G)return null;let z=S1.resolve(X,G);return l2.existsSync(z)?z:null}function B3($,Z){let J=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(Vq,(K,q)=>{let H;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(H=q.startsWith("/")?q:S1.resolve(J,q),!l2.existsSync(H))throw Error(`file not found: ${H}`)}else{let W=null;try{W=Bun.resolveSync(q,X)}catch{W=_q(q,X)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);H=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),G.push(q),""}if(Y.has(H))return"";Y.add(H);try{let W=l2.readFileSync(H,"utf8");Q.push({source:q,resolvedPath:H,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${H}: ${W?.message||W}`),G.push(q)}return""}),styles:Q,unresolved:G}}function wq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function V3($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${wq(Z.source)}" data-stx-layer="vendor">
3657
+ }`,F={vendorStyleTags:z,factoryBody:V,deps:XJ([...H,...Q.styles.map((O)=>O.resolvedPath)])};if(!W&&Q.unresolved.length===0)H3.set(X,F);return F}var Lq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Oq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Fq($,Z){let J=Z;while(!0){let X=S1.join(J,"node_modules",$,"package.json");if(l2.existsSync(X))return S1.dirname(X);let Y=S1.dirname(J);if(Y===J)return null;J=Y}}function _q($,Z){if(!$||typeof $!=="object")return null;let J=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return J(Y.import);if(typeof Y.default==="object")return J(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Y,prefix:G,suffix:z}}if(X){let Y=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=J($[X.pattern]);if(Q)return Q.replace("*",Y)}return null}function wq($,Z){let J=Oq($);if(!J||!J.subpath)return null;let X=Fq(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(l2.readFileSync(S1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=_q(Y.exports,Q);if(!G)return null;let z=S1.resolve(X,G);return l2.existsSync(z)?z:null}function B3($,Z){let J=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(Lq,(K,q)=>{let H;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(H=q.startsWith("/")?q:S1.resolve(J,q),!l2.existsSync(H))throw Error(`file not found: ${H}`)}else{let W=null;try{W=Bun.resolveSync(q,X)}catch{W=wq(q,X)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);H=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),G.push(q),""}if(Y.has(H))return"";Y.add(H);try{let W=l2.readFileSync(H,"utf8");Q.push({source:q,resolvedPath:H,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${H}: ${W?.message||W}`),G.push(q)}return""}),styles:Q,unresolved:G}}function Rq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function V3($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Rq(Z.source)}" data-stx-layer="vendor">
3658
3658
  @layer vendor {
3659
3659
  ${Z.contents}
3660
3660
  }
3661
3661
  </style>`}).join(`
3662
3662
  `)}
3663
- `}var Rq=Q2;function J2($){let Z=z0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of z[1].split(",")){let q=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)J.add(q)}let X=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of z[1].split(",")){let q=K.trim().split(/[:=]/).pop()?.trim();if(q)X.add(q)}let Y=H1.filter((z)=>{if(J.has(z)||X.has(z))return!1;return UJ(Z,z,!0)}),Q=WJ(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3663
+ `}var Dq=Q2;function J2($){let Z=z0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of z[1].split(",")){let q=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)J.add(q)}let X=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of z[1].split(",")){let q=K.trim().split(/[:=]/).pop()?.trim();if(q)X.add(q)}let Y=H1.filter((z)=>{if(J.has(z)||X.has(z))return!1;return jJ(Z,z,!0)}),Q=HJ(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3664
3664
  `)}
3665
- ${$}`,imports:Y,models:Q}}var Dq=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function WJ($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=J.exec($))!==null)if(!Dq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Nq($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of J[1].split(",")){let Y=X.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function HJ($){let Z=new Set,J=new Set,X=$;X=X.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let Y=new Set,Q=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of W.split(",")){let F=V.trim();if(!F||F.startsWith("type "))continue;let O=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!O)continue;let _=O[1],L=O[2]||_;if(Y.add(_),Y.add(L),U==="stx"||U==="@stacksjs/stx")Z.add(_);else J.add(_);if(L!==_)j.push(`${L} = ${_}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=Nq(X);for(let W of Rq){if(Y.has(W)||z.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(W)}let K=z0(X),q=new Set;for(let W of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of W[1].split(",")){let j=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let V=B.trim();if(V)q.add(V)}}for(let W of H1){if(Y.has(W)||z.has(W)||q.has(W))continue;if(UJ(K,W))J.add(W)}let H=WJ(X);for(let W of H)if(!Y.has(W)&&!z.has(W))J.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function UJ($,Z,J=!1){let X=new RegExp(`\\b${Z.replace(/[$]/g,"\\$")}\\b`,"g");for(let Y of $.matchAll(X)){let Q=Y.index??0,G=Q+Z.length,z=Q-1;while(z>=0&&/\s/.test($[z]))z--;if($[z]==="."&&$.slice(Math.max(0,z-2),z+1)!=="...")continue;let K=G;while(K<$.length&&/\s/.test($[K]))K++;if($[K]===":"&&$[K+1]!==":"&&($[z]==="{"||$[z]===","))continue;if(J&&!/^\s*(?:<[^>]*>)?\s*\(/.test($.slice(G)))continue;return!0}return!1}function jJ($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3665
+ ${$}`,imports:Y,models:Q}}var Nq=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function HJ($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=J.exec($))!==null)if(!Nq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Mq($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of J[1].split(",")){let Y=X.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function UJ($){let Z=new Set,J=new Set,X=$;X=X.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let Y=new Set,Q=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of W.split(",")){let F=V.trim();if(!F||F.startsWith("type "))continue;let O=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!O)continue;let _=O[1],L=O[2]||_;if(Y.add(_),Y.add(L),U==="stx"||U==="@stacksjs/stx")Z.add(_);else J.add(_);if(L!==_)j.push(`${L} = ${_}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=Mq(X);for(let W of Dq){if(Y.has(W)||z.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(W)}let K=z0(X),q=new Set;for(let W of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of W[1].split(",")){let j=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let V=B.trim();if(V)q.add(V)}}for(let W of H1){if(Y.has(W)||z.has(W)||q.has(W))continue;if(jJ(K,W))J.add(W)}let H=HJ(X);for(let W of H)if(!Y.has(W)&&!z.has(W))J.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function jJ($,Z,J=!1){let X=new RegExp(`\\b${Z.replace(/[$]/g,"\\$")}\\b`,"g");for(let Y of $.matchAll(X)){let Q=Y.index??0,G=Q+Z.length,z=Q-1;while(z>=0&&/\s/.test($[z]))z--;if($[z]==="."&&$.slice(Math.max(0,z-2),z+1)!=="...")continue;let K=G;while(K<$.length&&/\s/.test($[K]))K++;if($[K]===":"&&$[K+1]!==":"&&($[z]==="{"||$[z]===","))continue;if(J&&!/^\s*(?:<[^>]*>)?\s*\(/.test($.slice(G)))continue;return!0}return!1}function BJ($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3666
3666
  ${J.join(`
3667
3667
  `)}
3668
- ${Mq($,Z)}`;return""}function I_($,Z=[]){let{browserImports:J}=HJ($),X=new Set(Z);return jJ([],J.filter((Y)=>!X.has(Y)))}function Mq($,Z){let J=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3668
+ ${Aq($,Z)}`;return""}function T_($,Z=[]){let{browserImports:J}=UJ($),X=new Set(Z);return BJ([],J.filter((Y)=>!X.has(Y)))}function Aq($,Z){let J=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3669
3669
  [${J.join(", ")}].forEach(function (e) {
3670
3670
  if (e[1] !== 'undefined') return;
3671
3671
  console.error(
@@ -3674,10 +3674,10 @@ ${Mq($,Z)}`;return""}function I_($,Z=[]){let{browserImports:J}=HJ($),X=new Set(Z
3674
3674
  + 'or it should be imported from a relative path so the bundler includes it.'
3675
3675
  );
3676
3676
  });
3677
- `}function m9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function Aq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Iq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,zJ=new Set;function Tq($,Z){let J=Iq.test($),X=Z.length>32768;if(!J&&!X)return;if(zJ.has($))return;if(zJ.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function n$($,Z){if(!Z)return"";let J=z0($),X=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!Aq(J,Q))continue;if(o2($,Q)){if(X)console.warn(`[stx] defineClientPayload declares "${Q}", but this client block also declares "${Q}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Q}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;Tq(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3677
+ `}function m9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function Iq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Tq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,KJ=new Set;function kq($,Z){let J=Tq.test($),X=Z.length>32768;if(!J&&!X)return;if(KJ.has($))return;if(KJ.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function n$($,Z){if(!Z)return"";let J=z0($),X=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!Iq(J,Q))continue;if(o2($,Q)){if(X)console.warn(`[stx] defineClientPayload declares "${Q}", but this client block also declares "${Q}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Q}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;kq(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3678
3678
  ${Y.join(`
3679
3679
  `)}
3680
- `}var kq={left:0,middle:1,right:2};function Eq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=kq[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function bq($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=J5($.handler),G=Eq(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Z5(X,Y))z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let H=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),W=`var $emit = function(name, detail) {
3680
+ `}var Eq={left:0,middle:1,right:2};function bq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=Eq[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function yq($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=J5($.handler),G=bq(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Z5(X,Y))z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let H=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),W=`var $emit = function(name, detail) {
3681
3681
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3682
3682
  };`;function U(j){if(/\$emit\s*\(/.test(j))return`${W}
3683
3683
  ${j}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -3720,23 +3720,23 @@ else {
3720
3720
  else {
3721
3721
  ${Q}
3722
3722
  }
3723
- }${K})`}function yq($){if($.length===0)return"";return`
3723
+ }${K})`}function Cq($){if($.length===0)return"";return`
3724
3724
  // STX: auto-generated event bindings
3725
- ${$.map((J,X)=>bq(J,X)).join(`
3726
- `)}`}function KJ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3727
- `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let H=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=H[0].length;continue}let W=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let U=W[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=W[0].length;continue}}G++}return Z}var Cq=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 Sq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!Cq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);return Z}async function d9($,Z={}){let J=$,X="",Y=!1,Q=[],G=B3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=V3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:H}=await s("stx/client-script-bundler",()=>import("./chunk-rfqw1q2h.js"));if(q(J))J=await H(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=HJ(J);J=L.code,X=jJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${n$(J,Z.serverData)}${X}`,J=e0(J),!Y&&T1(Z.attrs||""))J=k1(J);let W=yq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3725
+ ${$.map((J,X)=>yq(J,X)).join(`
3726
+ `)}`}function qJ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3727
+ `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let H=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=H[0].length;continue}let W=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let U=W[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=W[0].length;continue}}G++}return Z}var Sq=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 Pq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!Sq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);return Z}async function d9($,Z={}){let J=$,X="",Y=!1,Q=[],G=B3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=V3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:H}=await s("stx/client-script-bundler",()=>import("./chunk-e26spfv8.js"));if(q(J))J=await H(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=UJ(J);J=L.code,X=BJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${n$(J,Z.serverData)}${X}`,J=e0(J),!Y&&T1(Z.attrs||""))J=k1(J);let W=Cq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3728
3728
  ${Z2(`${X}${J}
3729
3729
  ${W}`)}
3730
- </script>`}let V=qJ($),F=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function _(L){let w=L.length>0?`
3730
+ </script>`}let V=WJ($),F=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function _(L){let w=L.length>0?`
3731
3731
  return { ${L.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3732
3732
  window.stx.mount(function() {
3733
3733
  'use strict';
3734
3734
  ${Z2(`${X}${J}
3735
3735
  ${W}${w}`)}
3736
- })</script>`}if(!O&&!F){if(V)return _(KJ($));if(Z.templateContent){let L=KJ($);if(L.length>0){let w=Sq(Z.templateContent);if(L.some((R)=>w.has(R)))return _(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3736
+ })</script>`}if(!O&&!F){if(V)return _(qJ($));if(Z.templateContent){let L=qJ($);if(L.length>0){let w=Pq(Z.templateContent);if(L.some((R)=>w.has(R)))return _(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3737
3737
  ;(function() {
3738
3738
  'use strict';
3739
3739
  ${Z2(`${X}${J}
3740
3740
  ${W}`)}
3741
3741
  })()</script>`}
3742
- export{ZX as vl,JX as wl,XX as xl,a0 as yl,B5 as zl,V5 as Al,L5 as Bl,O5 as Cl,K4 as Dl,z4 as El,HX as Fl,jX as Gl,VX as Hl,NW as Il,MW as Jl,AW as Kl,IW as Ll,TW as Ml,eJ as Nl,X4 as Ol,Y4 as Pl,Q4 as Ql,G4 as Rl,RW as Sl,F4 as Tl,L2 as Ul,LJ as Vl,Z5 as Wl,J5 as Xl,X5 as Yl,RJ as Zl,M3 as _l,vq as $l,H1 as am,X2 as bm,EL as cm,B3 as dm,V3 as em,Rq as fm,J2 as gm,HJ as hm,UJ as im,jJ as jm,I_ as km,m9 as lm,n$ as mm,d9 as nm,mq as om,e2 as pm,dq as qm,lq as rm,cq as sm,pq as tm,J9 as um,SJ as vm,QW as wm,PJ as xm,GW as ym,vJ as zm,$9 as Am,q5 as Bm,W5 as Cm,X1 as Dm,H5 as Em,fJ as Fm,zW as Gm,L1 as Hm,gJ as Im,KW as Jm,C0 as Km,qW as Lm,jW as Mm,iJ as Nm,nJ as Om,$4 as Pm,Z4 as Qm,J4 as Rm,_W as Sm,q4 as Tm,_5 as Um,B2 as Vm,X9 as Wm,yW as Xm,F5 as Ym,FX as Zm,_X as _m,wX as $m,CW as an,H4 as bn,U4 as cn,z1 as dn,K1 as en,_1 as fn,Z7 as gn,R2 as hn,V9 as in,h5 as jn,TY as kn,EY as ln,Y7 as mn,yY as nn,CY as on,G7 as pn,w1 as qn,AU as rn,z7 as sn,n5 as tn,fY as un,i5 as vn,gY as wn,hY as xn,IU as yn,TU as zn,K7 as An,q7 as Bn,W7 as Cn,uY as Dn,mY as En,kU as Fn,EU as Gn,dY as Hn,bU as In,yU as Jn,V7 as Kn,_7 as Ln,r5 as Mn,lU as Nn,M2 as On,a5 as Pn,t5 as Qn,cU as Rn,QQ as Sn,pU as Tn,GQ as Un,D7 as Vn,iU as Wn,zQ as Xn,nU as Yn,sU as Zn,O9 as _n,Q$ as $n,Vj as ao,Lj as bo,Oj as co,Fj as do,EQ as eo,e7 as fo,b2 as go,hQ as ho,D$ as io,J8 as jo,tV as ko,z8 as lo,Zz as mo,IL as no,Gz as oo,w8 as po,s$ as qo,R8 as ro,N8 as so,o$ as to,Dz as uo,Nz as vo,M8 as wo,V8 as xo,Mz as yo,Iz as zo,f$ as Ao,p6 as Bo,i6 as Co,K3 as Do,fK as Eo,gK as Fo,hK as Go,uK as Ho,mK as Io,dK as Jo,cZ as Ko,iK as Lo,rK as Mo,aK as No,a1 as Oo,E$ as Po,R6 as Qo,qG as Ro,oB as So,rB as To,H6 as Uo,aB as Vo,A$ as Wo,I$ as Xo,T$ as Yo,A6 as Zo,I6 as _o,T6 as $o,NV as ap,MV as bp,E6 as cp,AV as dp,OG as ep,y6 as fp,v6 as gp,P$ as hp,SG as ip,v$ as jp,u6 as kp,m6 as lp,dG as mp,vV as np,xV as op,d6 as pp,fV as qp,gV as rp,x$ as sp,o6 as tp,v9 as up,x9 as vp,$2 as wp,pG as xp,a6 as yp,t6 as zp,lV as Ap,u$ as Bp,iG as Cp,nG as Dp,m$ as Ep,d$ as Fp,e6 as Gp,$8 as Hp,r$ as Ip,a$ as Jp,$3 as Kp,X3 as Lp,jZ as Mp,ZK as Np,YK as Op,QK as Pp,j1 as Qp,FF as Rp,_F as Sp,wF as Tp,RF as Up,RZ as Vp,wK as Wp,DF as Xp,NF as Yp,MF as Zp,AK as _p,bK as $p,yK as aq,CK as bq,SK as cq,$q as dq,T1 as eq,W3 as fq,k1 as gq,zq as hq,T9 as iq,Kq as jq,qq as kq,Hq as lq,I1 as mq,t as nq,K9 as oq,GJ as pq,O0 as qq,K_ as rq,q_ as sq,_4 as tq,w4 as uq,O1 as vq,R4 as wq,f1 as xq,D4 as yq,O2 as zq,pW as Aq,PX as Bq,R5 as Cq,iW as Dq,D5 as Eq,nW as Fq,sW as Gq,Q1 as Hq,oW as Iq,rW as Jq,aW as Kq,tW as Lq,eW as Mq,$H as Nq,vX as Oq,M5 as Pq,N4 as Qq,JH as Rq,XH as Sq,YH as Tq,QH as Uq,GH as Vq,A4 as Wq,zH as Xq,I4 as Yq,KH as Zq,qH as _q,F2 as $q,mX as ar,jH as br,lX as cr,C4 as dr,z9 as er,_H as fr,h4 as gr,y5 as hr,EH as ir,S5 as jr,QY as kr,qY as lr,bH as mr,yH as nr,CH as or,SH as pr,PH as qr,vH as rr,WY as sr,HY as tr,m4 as ur,P5 as vr,VY as wr,x5 as xr,e4 as yr,tH as zr,eH as Ar,g5 as Br,RY as Cr,$7 as Dr};
3742
+ export{JX as vl,XX as wl,YX as xl,a0 as yl,B5 as zl,V5 as Al,L5 as Bl,O5 as Cl,q4 as Dl,K4 as El,UX as Fl,BX as Gl,LX as Hl,MW as Il,AW as Jl,IW as Kl,TW as Ll,kW as Ml,$X as Nl,Y4 as Ol,Q4 as Pl,G4 as Ql,z4 as Rl,DW as Sl,_4 as Tl,L2 as Ul,OJ as Vl,Z5 as Wl,J5 as Xl,X5 as Yl,DJ as Zl,A3 as _l,xq as $l,H1 as am,X2 as bm,bL as cm,B3 as dm,V3 as em,Dq as fm,J2 as gm,UJ as hm,jJ as im,BJ as jm,T_ as km,m9 as lm,n$ as mm,d9 as nm,dq as om,e2 as pm,lq as qm,cq as rm,pq as sm,iq as tm,J9 as um,PJ as vm,GW as wm,vJ as xm,zW as ym,xJ as zm,$9 as Am,q5 as Bm,W5 as Cm,X1 as Dm,H5 as Em,gJ as Fm,KW as Gm,L1 as Hm,hJ as Im,qW as Jm,C0 as Km,WW as Lm,BW as Mm,nJ as Nm,sJ as Om,Z4 as Pm,J4 as Qm,X4 as Rm,wW as Sm,W4 as Tm,_5 as Um,B2 as Vm,X9 as Wm,CW as Xm,F5 as Ym,_X as Zm,wX as _m,RX as $m,SW as an,U4 as bn,j4 as cn,z1 as dn,K1 as en,_1 as fn,J7 as gn,R2 as hn,V9 as in,h5 as jn,kY as kn,bY as ln,Q7 as mn,CY as nn,SY as on,z7 as pn,w1 as qn,IU as rn,K7 as sn,n5 as tn,gY as un,i5 as vn,hY as wn,uY as xn,TU as yn,kU as zn,q7 as An,W7 as Bn,H7 as Cn,mY as Dn,dY as En,EU as Fn,bU as Gn,lY as Hn,yU as In,CU as Jn,L7 as Kn,w7 as Ln,r5 as Mn,cU as Nn,M2 as On,a5 as Pn,t5 as Qn,pU as Rn,GQ as Sn,iU as Tn,zQ as Un,N7 as Vn,nU as Wn,KQ as Xn,sU as Yn,oU as Zn,O9 as _n,Q$ as $n,Lj as ao,Oj as bo,Fj as co,_j as do,bQ as eo,$6 as fo,b2 as go,uQ as ho,D$ as io,X8 as jo,eV as ko,K8 as lo,Jz as mo,TL as no,zz as oo,R8 as po,s$ as qo,D8 as ro,M8 as so,o$ as to,Nz as uo,Mz as vo,A8 as wo,L8 as xo,Az as yo,Tz as zo,f$ as Ao,i6 as Bo,n6 as Co,K3 as Do,gK as Eo,hK as Fo,uK as Go,mK as Ho,dK as Io,lK as Jo,pZ as Ko,nK as Lo,aK as Mo,tK as No,a1 as Oo,E$ as Po,D6 as Qo,WG as Ro,rB as So,aB as To,U6 as Uo,tB as Vo,A$ as Wo,I$ as Xo,T$ as Yo,I6 as Zo,T6 as _o,k6 as $o,MV as ap,AV as bp,b6 as cp,IV as dp,FG as ep,C6 as fp,x6 as gp,P$ as hp,PG as ip,v$ as jp,m6 as kp,d6 as lp,lG as mp,xV as np,fV as op,l6 as pp,gV as qp,hV as rp,x$ as sp,r6 as tp,v9 as up,x9 as vp,$2 as wp,iG as xp,t6 as yp,e6 as zp,cV as Ap,u$ as Bp,nG as Cp,sG as Dp,m$ as Ep,d$ as Fp,$8 as Gp,Z8 as Hp,r$ as Ip,a$ as Jp,$3 as Kp,X3 as Lp,BZ as Mp,JK as Np,QK as Op,GK as Pp,j1 as Qp,_F as Rp,wF as Sp,RF as Tp,DF as Up,DZ as Vp,RK as Wp,NF as Xp,MF as Yp,AF as Zp,IK as _p,yK as $p,CK as aq,SK as bq,PK as cq,Zq as dq,T1 as eq,W3 as fq,k1 as gq,Kq as hq,T9 as iq,qq as jq,Wq as kq,Uq as lq,I1 as mq,t as nq,K9 as oq,zJ as pq,O0 as qq,q_ as rq,W_ as sq,w4 as tq,R4 as uq,O1 as vq,D4 as wq,f1 as xq,N4 as yq,O2 as zq,iW as Aq,vX as Bq,R5 as Cq,nW as Dq,D5 as Eq,sW as Fq,oW as Gq,Q1 as Hq,rW as Iq,aW as Jq,tW as Kq,eW as Lq,$H as Mq,ZH as Nq,xX as Oq,M5 as Pq,M4 as Qq,XH as Rq,YH as Sq,QH as Tq,GH as Uq,zH as Vq,I4 as Wq,KH as Xq,T4 as Yq,qH as Zq,WH as _q,F2 as $q,dX as ar,BH as br,cX as cr,S4 as dr,z9 as er,wH as fr,u4 as gr,y5 as hr,bH as ir,S5 as jr,GY as kr,WY as lr,yH as mr,CH as nr,SH as or,PH as pr,vH as qr,xH as rr,HY as sr,UY as tr,d4 as ur,P5 as vr,LY as wr,x5 as xr,$7 as yr,eH as zr,$U as Ar,g5 as Br,DY as Cr,Z7 as Dr};