@stacksjs/stx 0.2.344 → 0.2.346

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 (60) hide show
  1. package/dist/{chunk-krfx5562.js → chunk-1bws4afs.js} +183 -171
  2. package/dist/{chunk-7kcfbc0j.js → chunk-1caep9rn.js} +1 -1
  3. package/dist/{chunk-e4yskgtb.js → chunk-1djdz98r.js} +1 -1
  4. package/dist/{chunk-mvat8js5.js → chunk-1vyz6kr8.js} +2 -2
  5. package/dist/{chunk-efx05ah0.js → chunk-1xayahc6.js} +1 -1
  6. package/dist/{chunk-hsbbfp0c.js → chunk-1xts7768.js} +1 -1
  7. package/dist/{chunk-7t6h8crt.js → chunk-21mmq3aj.js} +1 -1
  8. package/dist/{chunk-7d2gfyk8.js → chunk-3pggfwbf.js} +1 -1
  9. package/dist/{chunk-tscr6bs8.js → chunk-5hhng72w.js} +1 -1
  10. package/dist/{chunk-bpb3xkg4.js → chunk-7hjjckat.js} +1 -1
  11. package/dist/{chunk-jzfk5ect.js → chunk-7w66sc17.js} +1 -1
  12. package/dist/{chunk-mz4breg8.js → chunk-864m3xp2.js} +1 -1
  13. package/dist/{chunk-3n8avn17.js → chunk-8tghv8cf.js} +1 -1
  14. package/dist/{chunk-tthrw91n.js → chunk-akb6mgrb.js} +1 -1
  15. package/dist/{chunk-94sxzp5x.js → chunk-b08taxsf.js} +1 -1
  16. package/dist/{chunk-1bct7pfj.js → chunk-bxwanj4g.js} +1 -1
  17. package/dist/{chunk-dx2s51rr.js → chunk-byn0ptqt.js} +1 -1
  18. package/dist/{chunk-nexpxxsa.js → chunk-ddsgfmhv.js} +1 -1
  19. package/dist/{chunk-a1ghxrb1.js → chunk-dyy74sdv.js} +1 -1
  20. package/dist/{chunk-39qy76ek.js → chunk-es275g3w.js} +1 -1
  21. package/dist/{chunk-8tjg4wbr.js → chunk-fvvdq3ev.js} +1 -1
  22. package/dist/{chunk-csv48xrx.js → chunk-fynb9e02.js} +1 -1
  23. package/dist/{chunk-zkwk82ss.js → chunk-hfvknn03.js} +1 -1
  24. package/dist/{chunk-cmccdayf.js → chunk-j8s9akdq.js} +1 -1
  25. package/dist/{chunk-cdq28mek.js → chunk-jwe0cwff.js} +1 -1
  26. package/dist/{chunk-020hpw7m.js → chunk-k5hv1qqy.js} +1 -1
  27. package/dist/{chunk-72x5v5an.js → chunk-k80kr2t2.js} +1 -1
  28. package/dist/{chunk-cappe4hd.js → chunk-km92eab7.js} +1 -1
  29. package/dist/{chunk-a29x23g7.js → chunk-maq5jag2.js} +1 -1
  30. package/dist/{chunk-5yhv1pe5.js → chunk-p04rck27.js} +1 -1
  31. package/dist/{chunk-gmm82dst.js → chunk-pc8np1bb.js} +1 -1
  32. package/dist/{chunk-6z9pm31g.js → chunk-q45fva8h.js} +1 -1
  33. package/dist/{chunk-9yqt0nf2.js → chunk-qp7sk0ex.js} +1 -1
  34. package/dist/{chunk-ewpbxy5m.js → chunk-rf2cejt3.js} +1 -1
  35. package/dist/{chunk-mpyjnwje.js → chunk-rwk5hwvk.js} +1 -1
  36. package/dist/{chunk-5apmxb4e.js → chunk-s11e8aq9.js} +1 -1
  37. package/dist/{chunk-wfwj4390.js → chunk-s3jyec9k.js} +1 -1
  38. package/dist/{chunk-fs2t4rs3.js → chunk-skd72bn4.js} +2 -2
  39. package/dist/{chunk-3xpk99z4.js → chunk-t2py7vc3.js} +1 -1
  40. package/dist/{chunk-j5qygdy9.js → chunk-t83m2pkm.js} +1 -1
  41. package/dist/{chunk-4kbaky4w.js → chunk-tnm0nez5.js} +1 -1
  42. package/dist/{chunk-g28fs4aa.js → chunk-vw83y4we.js} +2 -2
  43. package/dist/{chunk-zwhnkxgy.js → chunk-vzbcdxd5.js} +1 -1
  44. package/dist/{chunk-q5gzpn1n.js → chunk-washyj03.js} +1 -1
  45. package/dist/{chunk-1exk54qt.js → chunk-wbp4vbm0.js} +1 -1
  46. package/dist/{chunk-xh9paa2g.js → chunk-xytgvfbf.js} +2 -2
  47. package/dist/{chunk-5atmahe4.js → chunk-zdq7emrd.js} +322 -322
  48. package/dist/{chunk-9p5gbhwp.js → chunk-zz2yxsf9.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/component-library.d.ts +0 -31
  51. package/dist/component-library.js +279 -17
  52. package/dist/craft-entry.js +1 -1
  53. package/dist/craft.js +1 -1
  54. package/dist/process.js +25 -3
  55. package/dist/pwa.js +1 -1
  56. package/dist/ssg.js +2 -2
  57. package/dist/theme-tokens.js +15 -5
  58. package/dist/variable-extractor.d.ts +31 -0
  59. package/dist/variable-extractor.js +9 -5
  60. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Tr as h8,Xr as u8,fs as x7,gs as f7}from"./chunk-8y1ve8tc.js";import{ls as H0,ms as ZJ}from"./chunk-bqdfbwdf.js";import{os as m7,ps as d7,qs as J9,rs as X9}from"./chunk-89mqnh67.js";import{xs as t2}from"./chunk-xvh1k1a4.js";import{Cs as o1,Ds as w1,Es as l8,Fs as y1,Hs as H1,Is as iZ,Js as nZ,Ks as K2,Ls as n2,Ms as R9,Ns as y2,Os as A8,Ps as U8,Qs as B1,Rs as u0,Ss as X5,Ws as c8,Xs as f9,it as p8}from"./chunk-fs2t4rs3.js";import{jt as g7,lt as h7,mt as u7,ot as L2}from"./chunk-y2f41kaq.js";import{qt as w4,rt as R4,st as N4,vt as M4,wt as A4}from"./chunk-xj6bcwqa.js";import{Bt as g9}from"./chunk-7t6h8crt.js";import{Dt as IZ,Et as TZ,Ft as kZ,Gt as EZ,Ht as bZ,Jt as d8}from"./chunk-vhta1be7.js";import{Kt as s8,Lt as o8,Mt as r8,Nt as a8,Ot as l7,Pt as c7}from"./chunk-tc4pj651.js";import{Wt as v5,Xt as M0,Zt as x5,_t as G4,au as z4,hu as i8,lu as yZ,nu as CZ}from"./chunk-san1eq0r.js";import{$u as g8,Du as N0,Fu as N9,Gu as P$,Hu as D9,Ou as C2,Ru as x8,Tu as D0,Xu as S2,Yu as f8,_u as n0,gv as v$,hv as H6,jv as Y0,kv as j0,lv as d0,mv as w9,nv as Y2,ov as W0,pv as M9}from"./chunk-avwywzsj.js";import{qv as a0}from"./chunk-wj21f1e0.js";import{tv as n8}from"./chunk-d86q27j8.js";import{Bv as $J,Cv as V$,Dv as H8,Fv as c4,Iv as t4,uv as x$,vv as v2,wv as pZ,xv as s1}from"./chunk-72x62kch.js";import{$v as o6,Aw as V5,Dw as U2,Yv as g3,gw as A3,xw as m8,zw as bz}from"./chunk-yg5r7bnm.js";import{Iw as p7}from"./chunk-9nrgjtah.js";import{Nw as x}from"./chunk-ejqpq0wc.js";import P1 from"path";import f2 from"fs";var KJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function r9($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return KJ.has($.toLowerCase())}var U$=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"]),j$={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"},qJ=new Set(["ctrl","alt","shift","meta"]),L$={left:0,middle:1,right:2};function B$($){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(qJ.has(X))Z.systemKeys.push(X);else if(X in L$)Z.mouse=X;else if(X in j$||/^[a-z]$/.test(X))Z.keys.push(j$[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 O$($){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,W=`__stx_evt_${J++}`,H=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;H.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;H.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:W})}if(H.length>0)Z.push({originalTag:Q,elementId:W,events:H,startIndex:K,endIndex:q})}return Z}function WJ($){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=L$[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 HJ($,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 a9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function UJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=WJ($),Y=HJ(a9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(r9($.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{Tr as m8,Xr as d8,fs as x7,gs as f7}from"./chunk-8y1ve8tc.js";import{ls as H0,ms as XJ}from"./chunk-bqdfbwdf.js";import{os as m7,ps as d7,qs as Y9,rs as Q9}from"./chunk-89mqnh67.js";import{xs as $9}from"./chunk-xvh1k1a4.js";import{Cs as o1,Ds as w1,Es as p8,Fs as y1,Hs as H1,Is as sZ,Js as oZ,Ks as K2,Ls as o2,Ms as D9,Ns as S2,Os as A8,Ps as U8,Qs as B1,Rs as u0,Ss as X5,Ws as i8,Xs as f9,it as n8}from"./chunk-skd72bn4.js";import{jt as g7,lt as h7,mt as u7,ot as L2}from"./chunk-y2f41kaq.js";import{qt as w4,rt as R4,st as N4,vt as M4,wt as A4}from"./chunk-xj6bcwqa.js";import{Bt as g9}from"./chunk-21mmq3aj.js";import{Dt as kZ,Et as EZ,Ft as bZ,Gt as yZ,Ht as CZ,Jt as c8}from"./chunk-vhta1be7.js";import{Kt as r8,Lt as a8,Mt as t8,Nt as e8,Ot as l7,Pt as c7}from"./chunk-tc4pj651.js";import{Wt as v5,Xt as M0,Zt as x5,_t as G4,au as z4,hu as s8,lu as SZ,nu as PZ}from"./chunk-san1eq0r.js";import{$u as u8,Du as N0,Fu as k2,Gu as P$,Hu as E2,Ou as P2,Ru as g8,Tu as D0,Xu as v2,Yu as h8,_u as n0,gv as v$,hv as H6,jv as Y0,kv as j0,lv as d0,mv as N9,nv as Y2,ov as W0,pv as M9}from"./chunk-avwywzsj.js";import{qv as a0}from"./chunk-wj21f1e0.js";import{tv as o8}from"./chunk-d86q27j8.js";import{Bv as JJ,Cv as V$,Dv as H8,Fv as c4,Iv as t4,uv as x$,vv as f2,wv as nZ,xv as s1}from"./chunk-72x62kch.js";import{$v as o6,Aw as V5,Dw as U2,Yv as g3,gw as A3,xw as l8,zw as Cz}from"./chunk-yg5r7bnm.js";import{Iw as p7}from"./chunk-9nrgjtah.js";import{Nw as x}from"./chunk-ejqpq0wc.js";import P1 from"path";import h2 from"fs";var WJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function r9($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return WJ.has($.toLowerCase())}var U$=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"]),j$={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"},HJ=new Set(["ctrl","alt","shift","meta"]),L$={left:0,middle:1,right:2};function B$($){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(HJ.has(X))Z.systemKeys.push(X);else if(X in L$)Z.mouse=X;else if(X in j$||/^[a-z]$/.test(X))Z.keys.push(j$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function O$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[Y,G,z]=Q,K=Q.index,q=K+Y.length,H=`__stx_evt_${J++}`,W=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;W.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:H})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;W.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:H})}if(W.length>0)Z.push({originalTag:Y,elementId:H,events:W,startIndex:K,endIndex:q})}return Z}function UJ($){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((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=L$[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 jJ($,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 a9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function BJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=UJ($),Q=jJ(a9($.handler),Z),Y=[];if(Z.once)Y.push("once: true");if(Z.capture)Y.push("capture: true");if(r9($.event,Z))Y.push("passive: true");let G=Y.length>0?`, { ${Y.join(", ")} }`:"",z=Q.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,20 +108,20 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${$.map(UJ).join(`
111
+ ${$.map(BJ).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function jJ($){let Z=O$($);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"),W=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(W,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),X.push(...Q.events)}return{template:J,bindings:X}}function _$($,Z,J){if(V$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:K}=jJ($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...K],z}let X=O$($);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 W=q.match(/id=["']([^"']+)["']/);if(W)for(let H of K.events)H.elementId=W[1]}for(let W of K.events){let H=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${H}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${H}\\s*=\\s*'[^']*'`,"g");q=q.replace(U,""),q=q.replace(j,"")}Y=Y.slice(0,K.startIndex)+q+Y.slice(K.endIndex)}let Q=t9(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 Iq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}import sZ from"fs";import f from"path";import{createHash as BJ}from"crypto";var d2="__stx_component_client_factories";function l2($){let Z=$[d2];return Z instanceof Map?Z:null}function w$($){$[d2]=new Map}function e9($,Z){let J=l2($);if(!J)return null;let X=BJ("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 R$($,Z){let J=l2(Z);if(!J?.size)return $;let X=new Map;for(let[W,H]of J)if(H.instances===1)X.set(W,H.body);let Y=[];if(X.size>0){let W=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),H=new RegExp(`window\\.__stxComponentFactories\\[(${W})\\]\\(("[^"]+")\\);`,"g"),U=H.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=H.exec($)}}let Q=[...J].filter(([,W])=>W.instances>1);if(Q.length===0)return F$($,Y);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
114
+ </script>`}function VJ($){let Z=O$($);if(Z.length===0)return{template:$,bindings:[]};let J=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let Y=Z[Q],G=Y.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Y.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let K of Y.events)K.elementId=z[1]}for(let z of Y.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,Y.startIndex)+G+J.slice(Y.endIndex),X.push(...Y.events)}return{template:J,bindings:X}}function _$($,Z,J){if(V$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:K}=VJ($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...K],z}let X=O$($);if(X.length===0)return $;let Q=$;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,"")}Q=Q.slice(0,K.startIndex)+q+Q.slice(K.endIndex)}let Y=t9(X.flatMap((z)=>z.events)),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+Y+`
115
+ `+Q.slice(G);else Q+=Y;return Q}function kq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}import rZ from"fs";import f from"path";import{createHash as LJ}from"crypto";var c2="__stx_component_client_factories";function p2($){let Z=$[c2];return Z instanceof Map?Z:null}function w$($){$[c2]=new Map}function e9($,Z){let J=p2($);if(!J)return null;let X=LJ("sha256").update(Z).digest("hex").slice(0,16),Q=J.get(X);if(Q)Q.instances++;else J.set(X,{body:Z,instances:1});return X}function R$($,Z){let J=p2(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 Q=[];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)Q.push({start:U.index,end:U.index+U[0].length,replacement:`(${j})(${U[2]});`});U=W.exec($)}}let Y=[...J].filter(([,H])=>H.instances>1);if(Y.length===0)return F$($,Q);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
- ${Q.map(([W,H])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${H.body}; }
119
- catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(W)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
118
+ ${Y.map(([H,W])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${W.body}; }
119
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(H)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
120
120
  `)}
121
121
  })();
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
- `}),F$($,Y)}function F$($,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 N$($){let Z=l2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function D$($,Z){let J=l2($);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 M$($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)e9($,J)}import k$ from"fs";var A$=0,c2=new Map;function bq(){A$=0,c2.clear()}function p2($,Z){let J=A$++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return c2.set(X,{type:$,expression:Z}),X}function yq(){let $={};for(let[Z,J]of c2)$[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=c2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function Sq($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function Pq($){return $.includes("<!--__STX_")}var VJ=/@(?=[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 LJ($){return Array.from({length:$},()=>"&#123;").join("&#8288;")}function I$($){return $.replace(/\{{2,}/g,(Z)=>LJ(Z.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(VJ,"&#64;")}var OJ=/^(?:javascript|vbscript|livescript|mocha|view-source):/,_J=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,FJ=/^data:(?:text\/html|application\/xhtml\+xml)/,wJ=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function RJ($){return $.replace(wJ,"").toLowerCase()}function NJ($){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 T$($,Z="navigable"){let J=RJ($);if(OJ.test(J))return!0;return Z==="navigable"?_J.test(J):FJ.test(J)}function G2($,Z="navigable"){return T$($,Z)?"unsafe:"+$:$}function DJ($){let Z=$.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!Z)return null;if(Z[3].trim()!=="")return null;return NJ(Z[1])}function $5($,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 Z5($,Z,J=Z){let X=DJ($);return X&&T$(Z,X)?"unsafe:"+J:J}var q2={},E$=new Map;function MJ($){let Z=E$.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),E$.set($,Z)}return Z.lastIndex=0,Z}var s2={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 Q5(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(MJ(K),String(q))}),z},t:($,Z,J={})=>{return s2.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 AJ($,Z){if($ in s2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);q2[$]=Z}function sq($){for(let[Z,J]of Object.entries($))AJ(Z,J)}function IJ(){return{...s2,...q2}}function oq(){for(let $ of Object.keys(q2))delete q2[$]}function TJ($,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 i2($,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=TJ($,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 Y5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Q5($){return I$(Y5($))}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(x$(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 b$($,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 W=X[q];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[q+1]==="{"){G++,q++,Y+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Y+=W;continue}continue}Y+=W}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 kJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=H0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}var y$=new Set;function C$($){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test($.trim())}function S$($,Z){let J=`${Z??"<unknown>"}\x00${$}`;if(process.env.STX_DEBUG||!y$.has(J))y$.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 G5($,Z,J){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let G=C0(Q,Z);if(G===void 0)return C$(Q)?S$(Q.trim(),J):Y;return G===null?"":String(G)}catch{return Y}}),X=i2(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 C$(z)?S$(z,J):Y;return JSON.stringify(K).replace(/</g,"\\u003c")}catch{return Y}}),X}function EJ($,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=i2(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 Z5($5(J,Q),K,Q5(K))}catch{return X}}),J}function rq($,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 W=z[1],H=z[2];if(/\bdata-raw\b/.test(W))return G;if(J.skipServer&&/\bserver\b/.test(W))return G;let j=`<script${EJ(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+H+G.slice(q);return j+G5(H,Z)+G.slice(q)});return X5(X,Q)}function V1($,Z,J){let X=$,Y=(H,U)=>{let j=n2(H,U);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(H.slice(U,j))?-1:j},Q=(H,U,j,B)=>{let V=j.length,{output:_,tokens:O}=B1(H,U,(F,L)=>B(V+L));return j.push(...O),_},G=[];X=Q(X,Y,G,(H)=>`<!--__STX_STYLE_${H}__-->`);let z=[];X=Q(X,K2,z,(H)=>`<!--__STX_SCRIPT_EXPR_${H}__-->`);let K=Z?.__stx_signals_gate===!0||X1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),W=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(X=i2(X,(H,U,j)=>{try{let B=C0(U,Z,!1,(V)=>J5(V,H,J,$));return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${V}`,J,$,j,H)}},3),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(H,U,j)=>{try{let B=C0(U,Z,!1,(V)=>J5(V,H,J,$));if(B===void 0&&Z.__stx_buildMode==="compile")return p2("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return p2("raw",U.trim());let V=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${V}`,J,$,j,H)}}),X=Q(X,K2,z,(H)=>`<!--__STX_SCRIPT_EXPR_${H}__-->`),X=Q(X,Y,G,(H)=>`<!--__STX_STYLE_${H}__-->`),X=i2(X,(H,U,j)=>{let B=U.trim();if(W.has(B))return H;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],_=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(_)?.[1],L=F&&((F in Z)||V.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),M=R&&!V.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";let T;try{let D=C0(U,Z,!1,(k)=>{T=k});if(w)return H;if(K&&!b$(B,Z))return H;if(T)J5(T,H,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(D===void 0||kJ(B,Z)))return p2("expr",B);if(D===void 0||D===null)return"";let I=String(D);return Z5($5(X,j),I,Q5(I))}catch(D){if(w)return H;if(K&&!b$(B,Z))return H;if(M)return H;let I=D instanceof Error?D.message:String(D);return _0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,J,$,j,H)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(H,U)=>z[Number(U)]??H);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(H,U)=>G[Number(U)]??H);return X}function bJ($,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=q2[G]||s2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(IJ()).join(", ")}`);let K=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let W=q[1].trim();try{let H=Number(W);K=[Number.isNaN(H)?W:H]}catch{K=[W]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,W=1;while(q>0&&W<Y.length){if(Y[W]==="(")q++;if(Y[W]===")")q--;W++}if(q===0){let H=Y.substring(1,W-1).trim();if(H)try{if(H.startsWith("{")&&H.endsWith("}"))K=[C0(`(${H})`,J,!0)];else{let U=[],j="",B=null,V=0,_=0,O=0,F=!1;for(let L=0;L<H.length;L++){let w=H[L];if(F){j+=w,F=!1;continue}if(w==="\\"){j+=w,F=!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==="[")_++;else if(w==="]")_--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&V===0&&_===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=[H]}Y=Y.substring(W).trim()}}try{X=z(X,J,...K)}catch(q){let W=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${W}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function yJ($){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 W=1;z+=2;while(z<$.length&&W>0){if($[z]==="{")W++;else if($[z]==="}")W--;if(W>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 z2=new Set,CJ=1000;function aq(){z2.clear()}function J5($,Z,J,X){if(!P$())return;let Y=`${J}\x00${$.expression}`;if(z2.has(Y))return;if(z2.size>=CJ)z2.clear();z2.add(Y);let Q=J,G=X;try{if(J&&k$.existsSync(J))G=k$.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=yJ(Y);if(Q>0){let z=Y.substring(0,Q).trim(),K=Y.substring(Q+1).trim(),q=C0(z,Z,!0,X);return bJ(q,K,Z)}let G=v$(Y);if(G!==null){X?.({expression:Y,rule:G});return}try{let z=Object.keys(Z),K=Object.values(Z);return W0(Y,z)(...K)}catch{return Y0(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=SJ(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 SJ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=PJ($,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 PJ($,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 tq($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import yz from"fs";import y0 from"path";var z5=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],f$=/<body\b([^>]*)>/gi;function p0($){let Z=0,J,X=z5.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)f$.lastIndex=Z,J=f$.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let K=0;K<z5.length;K++){let q=z5[K],W=X[K];if(W===void 0||W!==null&&W.index<Z)q.open.lastIndex=Z,W=q.open.exec($),X[K]=W;if(!W)continue;if(W.index<Y&&(Q===-1||W.index<Q))Q=W.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 v1($,Z){let J=p0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var g$=/<style\b[^>]*>/iy,h$=/<\/style>/gi,u$=/<script\b[^>]*>/iy,m$=/<template(?=[\s>/])[^>]*>/iy,d$=/<\/template\s*>/iy;function W2($){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}g$.lastIndex=Y;let Q=g$.exec($);if(Q){h$.lastIndex=Y+Q[0].length;let K=h$.exec($);Z=K===null?$.length:K.index+8;continue}m$.lastIndex=Y;let G=m$.exec($);if(G){if(J===0)X=Y;J++,Z=Y+G[0].length;continue}d$.lastIndex=Y;let z=d$.exec($);if(z){if(J>0)J--;Z=Y+z[0].length;continue}if(u$.lastIndex=Y,u$.test($))return J>0?X:Y;Z=Y+1}return-1}var l$=null;function vJ($){if(!l$)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return l$}function JW($){let Z=vJ("onUpdate");if(Z)Z.updateHooks.push($)}function c$(){return`
122
+ </script>`,K=$.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),q=K<0?0:K;return Q.push({start:q,end:q,replacement:`${z}
123
+ `}),F$($,Q)}function F$($,Z){if(Z.length===0)return $;Z.sort((Y,G)=>Y.start-G.start||Y.end-G.end);let J=Array(Z.length*2+1),X=0,Q=0;for(let Y of Z)J[Q++]=$.slice(X,Y.start),J[Q++]=Y.replacement,X=Y.end;return J[Q]=$.slice(X),J.join("")}function N$($){let Z=p2($),J=new Map;if(Z)for(let[X,Q]of Z)J.set(X,Q.instances);return J}function D$($,Z){let J=p2($);if(!J)return[];let X=[];for(let[Q,Y]of J){let G=Y.instances-(Z.get(Q)??0);if(G>0)X.push({body:Y.body,count:G})}return X}function M$($,Z){for(let{body:J,count:X}of Z)for(let Q=0;Q<X;Q++)e9($,J)}import k$ from"fs";var A$=0,i2=new Map;function Cq(){A$=0,i2.clear()}function n2($,Z){let J=A$++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return i2.set(X,{type:$,expression:Z}),X}function Sq(){let $={};for(let[Z,J]of i2)$[Z]={type:J.type,expression:J.expression};return $}function Pq($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Q=X[0],Y=X[1].toLowerCase(),G=i2.get(Q);Z[Q]={type:Y,expression:G?.expression||""}}return Z}function vq($,Z){let J=$;for(let[X,Q]of Z)J=J.split(X).join(Q);return J}function xq($){return $.includes("<!--__STX_")}var OJ=/@(?=[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 _J($){return Array.from({length:$},()=>"&#123;").join("&#8288;")}function I$($){return $.replace(/\{{2,}/g,(Z)=>_J(Z.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(OJ,"&#64;")}var FJ=/^(?:javascript|vbscript|livescript|mocha|view-source):/,wJ=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,RJ=/^data:(?:text\/html|application\/xhtml\+xml)/,NJ=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function DJ($){return $.replace(NJ,"").toLowerCase()}function MJ($){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 T$($,Z="navigable"){let J=DJ($);if(FJ.test(J))return!0;return Z==="navigable"?wJ.test(J):RJ.test(J)}function G2($,Z="navigable"){return T$($,Z)?"unsafe:"+$:$}function AJ($){let Z=$.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!Z)return null;if(Z[3].trim()!=="")return null;return MJ(Z[1])}function $5($,Z,J=256){if(Z<=J)return $.slice(0,Z);let X=$.slice(Z-J,Z),Q=X.search(/[\s"'`/]/);return Q===-1?"":X.slice(Q)}function Z5($,Z,J=Z){let X=AJ($);return X&&T$(Z,X)?"unsafe:"+J:J}var q2={},E$=new Map;function IJ($){let Z=E$.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),E$.set($,Z)}return Z.lastIndex=0,Z}var r2={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 Q5(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,Y=String($).split("."),G=X;for(let K of Y){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Q?$:"";let z=String(G);return Object.entries(J).forEach(([K,q])=>{z=z.replace(IJ(K),String(q))}),z},t:($,Z,J={})=>{return r2.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=J)return Q;if(J<=X.length)return X.substring(0,J);return Q.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let Y={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 Q.toISOString();return new Intl.DateTimeFormat(X,Y[J]||Y.short).format(Q)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Q)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Q=Number($);if(Number.isNaN(Q))return J;let Y=X||`${J}s`;return Q===1?J:Y},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 Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"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 Q=10**J;return Math.round(X*Q)/Q}};function TJ($,Z){if($ in r2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);q2[$]=Z}function rq($){for(let[Z,J]of Object.entries($))TJ(Z,J)}function kJ(){return{...r2,...q2}}function aq(){for(let $ of Object.keys(q2))delete q2[$]}function EJ($,Z,J=2){let X=0,Q=null;for(let Y=Z+J;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="{"){X++;continue}if(G==="}"){if(X>0){X--;continue}let z=0;while($[Y+z]==="}")z++;if(z>=J)return Y}}return-1}function s2($,Z,J=2){let X="{".repeat(J);if(!$.includes(X))return $;let Q="",Y=0;for(;;){let G=$.indexOf(X,Y);if(G===-1)break;let z=EJ($,G,J);if(z===-1)break;Q+=$.slice(Y,G)+Z($.slice(G,z+J),$.slice(G+J,z),G),Y=z+J}return Y===0?$:Q+$.slice(Y)}function Y5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Q5($){return I$(Y5($))}function X1($,Z){let{scripts:J}=u0($);for(let X of J){let Q=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Q||/\bserver\b|\bsrc\s*=/.test(Q[1]))continue;let Y=Q[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0;if(x$(Y,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 b$($,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,""),Q="",Y=!1,G=0;for(let q=0;q<X.length;q++){let H=X[q];if(!Y&&H==="`"){Y=!0,G=0;continue}if(Y){if(H==="`"&&G===0){Y=!1;continue}if(H==="$"&&X[q+1]==="{"){G++,q++,Q+=" ";continue}if(H==="}"&&G>0){G--;continue}if(G>0){Q+=H;continue}continue}Q+=H}X=Q;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 bJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=H0($);for(let Q of J)if(new RegExp(`(?<![.#\\w$])${Q}(?![\\w$])`).test(X))return!0;return!1}var y$=new Set;function C$($){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test($.trim())}function S$($,Z){let J=`${Z??"<unknown>"}\x00${$}`;if(process.env.STX_DEBUG||!y$.has(J))y$.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 G5($,Z,J){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Q,Y)=>{try{let G=C0(Y,Z);if(G===void 0)return C$(Y)?S$(Y.trim(),J):Q;return G===null?"":String(G)}catch{return Q}}),X=s2(X,(Q,Y,G)=>{let z=Y.trim();if(/^__[A-Z_]+__$/.test(z))return Q;try{let K=C0(Y,Z);if(K===void 0)return C$(z)?S$(z,J):Q;return JSON.stringify(K).replace(/</g,"\\u003c")}catch{return Q}}),X}function yJ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let Y=C0(Q,Z);if(Y===void 0)return X;return Y===null?"":String(Y)}catch{return X}}),J=s2(J,(X,Q,Y)=>{let G=Q.trim();if(/^__[A-Z_]+__$/.test(G))return X;try{let z=C0(Q,Z);if(z===void 0)return X;if(z===null)return"";let K=String(z);return Z5($5(J,Y),K,Q5(K))}catch{return X}}),J}function tq($,Z,J={}){let{output:X,scripts:Q}=u0($),Y=Q.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${yJ(H,Z)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return j+W+G.slice(q);return j+G5(W,Z)+G.slice(q)});return X5(X,Y)}function V1($,Z,J){let X=$,Q=(W,U)=>{let j=o2(W,U);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(U,j))?-1:j},Y=(W,U,j,B)=>{let V=j.length,{output:_,tokens:O}=B1(W,U,(F,L)=>B(V+L));return j.push(...O),_},G=[];X=Y(X,Q,G,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=[];X=Y(X,K2,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=s2(X,(W,U,j)=>{try{let B=C0(U,Z,!1,(V)=>J5(V,W,J,$));return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return _0("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)=>J5(V,W,J,$));if(B===void 0&&Z.__stx_buildMode==="compile")return n2("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return n2("raw",U.trim());let V=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${V}`,J,$,j,W)}}),X=Y(X,K2,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),X=Y(X,Q,G,(W)=>`<!--__STX_STYLE_${W}__-->`),X=s2(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"],_=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(_)?.[1],L=F&&((F in Z)||V.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),M=R&&!V.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";let T;try{let D=C0(U,Z,!1,(k)=>{T=k});if(w)return W;if(K&&!b$(B,Z))return W;if(T)J5(T,W,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(D===void 0||bJ(B,Z)))return n2("expr",B);if(D===void 0||D===null)return"";let I=String(D);return Z5($5(X,j),I,Q5(I))}catch(D){if(w)return W;if(K&&!b$(B,Z))return W;if(M)return W;let I=D instanceof Error?D.message:String(D);return _0("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 CJ($,Z,J){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let Y=Q.match(/^(\w+)/);if(!Y)break;let G=Y[1];Q=Q.substring(G.length).trim();let z=q2[G]||r2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(kJ()).join(", ")}`);let K=[];if(Q.startsWith(":")){let q=Q.match(/^:([^|\s]+)/);if(q){let H=q[1].trim();try{let W=Number(H);K=[Number.isNaN(W)?H:W]}catch{K=[H]}Q=Q.substring(q[0].length).trim()}}else if(Q.startsWith("(")){let q=1,H=1;while(q>0&&H<Q.length){if(Q[H]==="(")q++;if(Q[H]===")")q--;H++}if(q===0){let W=Q.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,_=0,O=0,F=!1;for(let L=0;L<W.length;L++){let w=W[L];if(F){j+=w,F=!1;continue}if(w==="\\"){j+=w,F=!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==="[")_++;else if(w==="]")_--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&V===0&&_===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]}Q=Q.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(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function SJ($){let Z=!1,J="",X=0,Q=0,Y=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==="[")Q++;else if(K==="]")Q--;else if(K==="{")Y++;else if(K==="}")Y--;if(K==="|"&&X===0&&Q===0&&Y===0){if(q==="|"){z++;continue}if(q==="="){z++;continue}return z}}return-1}var z2=new Set,PJ=1000;function eq(){z2.clear()}function J5($,Z,J,X){if(!P$())return;let Q=`${J}\x00${$.expression}`;if(z2.has(Q))return;if(z2.size>=PJ)z2.clear();z2.add(Q);let Y=J,G=X;try{if(J&&k$.existsSync(J))G=k$.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Y=`${J}:${G.slice(0,z).split(`
124
+ `).length}`;console.warn(`${Y}: 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 Q=$.trim(),Y=SJ(Q);if(Y>0){let z=Q.substring(0,Y).trim(),K=Q.substring(Y+1).trim(),q=C0(z,Z,!0,X);return CJ(q,K,Z)}let G=v$(Q);if(G!==null){X?.({expression:Q,rule:G});return}try{let z=Object.keys(Z),K=Object.values(Z);return W0(Q,z)(...K)}catch{return Y0(Q,Z)}}catch(Q){if(Q instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(Q.message);if(Y){let G=Y[1],z=vJ(G,Object.keys(Z));if(z&&z!==G)Q.message=`${Q.message} \u2014 did you mean '${z}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Q);throw Q}}function vJ($,Z){let J=null;for(let Q of Z){if(Q===$)continue;let Y=xJ($,Q);if(J===null||Y<J.dist)J={key:Q,dist:Y}}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 xJ($,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,$],Q=Array(J.length+1),Y=Array(J.length+1);for(let G=0;G<=J.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){Y[0]=G;for(let z=1;z<=J.length;z++){let K=J[z-1]===X[G-1]?0:1;Y[z]=Math.min(Y[z-1]+1,Q[z]+1,Q[z-1]+K)}for(let z=0;z<=J.length;z++)Q[z]=Y[z]}return Q[J.length]}function $W($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Sz from"fs";import y0 from"path";var z5=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],f$=/<body\b([^>]*)>/gi;function p0($){let Z=0,J,X=z5.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)f$.lastIndex=Z,J=f$.exec($);if(!J)return null;let Q=J.index,Y=-1,G=null;for(let K=0;K<z5.length;K++){let q=z5[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<Q&&(Y===-1||H.index<Y))Y=H.index,G=q.close}if(Y===-1||!G)return{index:Q,tag:J[0],attrs:J[1]??""};G.lastIndex=Y;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function v1($,Z){let J=p0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var g$=/<style\b[^>]*>/iy,h$=/<\/style>/gi,u$=/<script\b[^>]*>/iy,m$=/<template(?=[\s>/])[^>]*>/iy,d$=/<\/template\s*>/iy;function W2($){let Z=0,J=0,X=-1;while(Z<$.length){let Q=$.indexOf("<",Z);if(Q===-1)return-1;if($.startsWith("<!--",Q)){let K=$.indexOf("-->",Q+4);Z=K===-1?$.length:K+3;continue}g$.lastIndex=Q;let Y=g$.exec($);if(Y){h$.lastIndex=Q+Y[0].length;let K=h$.exec($);Z=K===null?$.length:K.index+8;continue}m$.lastIndex=Q;let G=m$.exec($);if(G){if(J===0)X=Q;J++,Z=Q+G[0].length;continue}d$.lastIndex=Q;let z=d$.exec($);if(z){if(J>0)J--;Z=Q+z[0].length;continue}if(u$.lastIndex=Q,u$.test($))return J>0?X:Q;Z=Q+1}return-1}var l$=null;function fJ($){if(!l$)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return l$}function YW($){let Z=fJ("onUpdate");if(Z)Z.updateHooks.push($)}function c$(){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 K5($){return Symbol($)}var XW=K5("theme"),YW=K5("router"),QW=K5("i18n");import*as i$ from"crypto";function p$($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function xJ(){return`stx-${i$.randomBytes(4).toString("hex")}`}function fJ($){return/\$\w+\./.test($)}function gJ($){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=[],W=!1,H=z,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(U)];for(let _ of j){let O=_[0],F=_[1],L=_[2];if(fJ(L)){W=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let N=w[1];if(q.push({attr:F,expr:N,fullMatch:O,originalAttr:F}),p$(N).forEach((M)=>J.add(M)),F==="text")H=H.replace(O,"");else if(F==="class")H=H.replace(O,'class=""');else if(F==="disabled"||F==="hidden")H=H.replace(O,"");else H=H.replace(O,`${F}=""`)}}}if(!W)return Q;let B=H.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=xJ(),H=` id="${V}"${H}`;for(let _ of q)Z.push({elementId:V,attribute:_.attr,expression:_.expr,stores:p$(_.expr)});return`<${G}${H}${K}`}),{html:Y,bindings:Z,stores:J}}function hJ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
472
+ `}function K5($){return Symbol($)}var QW=K5("theme"),GW=K5("router"),zW=K5("i18n");import*as i$ from"crypto";function p$($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function gJ(){return`stx-${i$.randomBytes(4).toString("hex")}`}function hJ($){return/\$\w+\./.test($)}function uJ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(Y,G,z,K)=>{if(["script","style","template"].includes(G.toLowerCase()))return Y;let q=[],H=!1,W=z,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(U)];for(let _ of j){let O=_[0],F=_[1],L=_[2];if(hJ(L)){H=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let N=w[1];if(q.push({attr:F,expr:N,fullMatch:O,originalAttr:F}),p$(N).forEach((M)=>J.add(M)),F==="text")W=W.replace(O,"");else if(F==="class")W=W.replace(O,'class=""');else if(F==="disabled"||F==="hidden")W=W.replace(O,"");else W=W.replace(O,`${F}=""`)}}}if(!H)return Y;let B=W.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=gJ(),W=` id="${V}"${W}`;for(let _ of q)Z.push({elementId:V,attribute:_.attr,expression:_.expr,stores:p$(_.expr)});return`<${G}${W}${K}`}),{html:Q,bindings:Z,stores:J}}function mJ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
473
473
  <script>
474
474
  (function() {
475
475
  'use strict';
@@ -485,12 +485,12 @@ else {
485
485
  // Store references for expressions
486
486
  // eslint-disable-next-line pickier/no-unused-vars
487
487
  var $state = {};
488
- `;for(let Y of J)X+=` $state.${Y} = stores.${Y} ? stores.${Y}.get() : {};
488
+ `;for(let Q of J)X+=` $state.${Q} = stores.${Q} ? stores.${Q}.get() : {};
489
489
  `;X+=`
490
490
  // Binding update functions
491
491
  function updateBindings() {
492
- `;for(let Y of $){let{elementId:Q,attribute:G,expression:z}=Y,K=z.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")X+=` (function() {
493
- var el = document.getElementById('${Q}');
492
+ `;for(let Q of $){let{elementId:Y,attribute:G,expression:z}=Q,K=z.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")X+=` (function() {
493
+ var el = document.getElementById('${Y}');
494
494
  if (el) {
495
495
  try {
496
496
  el.textContent = ${K};
@@ -499,7 +499,7 @@ catch (e) { console.error('Binding error:', e); }
499
499
  }
500
500
  })();
501
501
  `;else if(G==="html")X+=` (function() {
502
- var el = document.getElementById('${Q}');
502
+ var el = document.getElementById('${Y}');
503
503
  if (el) {
504
504
  try {
505
505
  el.innerHTML = ${K};
@@ -508,7 +508,7 @@ catch (e) { console.error('Binding error:', e); }
508
508
  }
509
509
  })();
510
510
  `;else if(G==="class")X+=` (function() {
511
- var el = document.getElementById('${Q}');
511
+ var el = document.getElementById('${Y}');
512
512
  if (el) {
513
513
  try {
514
514
  var value = ${K};
@@ -537,7 +537,7 @@ catch (e) { console.error('Binding error:', e); }
537
537
  }
538
538
  })();
539
539
  `;else if(G==="show")X+=` (function() {
540
- var el = document.getElementById('${Q}');
540
+ var el = document.getElementById('${Y}');
541
541
  if (el) {
542
542
  try {
543
543
  el.style.display = (${K}) ? '' : 'none';
@@ -546,7 +546,7 @@ catch (e) { console.error('Binding error:', e); }
546
546
  }
547
547
  })();
548
548
  `;else if(G==="if")X+=` (function() {
549
- var el = document.getElementById('${Q}');
549
+ var el = document.getElementById('${Y}');
550
550
  if (el) {
551
551
  try {
552
552
  el.style.visibility = (${K}) ? 'visible' : 'hidden';
@@ -555,7 +555,7 @@ catch (e) { console.error('Binding error:', e); }
555
555
  }
556
556
  })();
557
557
  `;else X+=` (function() {
558
- var el = document.getElementById('${Q}');
558
+ var el = document.getElementById('${Y}');
559
559
  if (el) {
560
560
  try {
561
561
  var value = ${K};
@@ -580,14 +580,14 @@ catch (e) { console.error('Binding error:', e); }
580
580
  // using reactive-bindings stacked another subscription on every store,
581
581
  // walking detached DOM forever. See stacksjs/stx#1709.
582
582
  var _disposers = [];
583
- `;for(let Y of J)X+=` if (stores.${Y}) {
584
- var _unsub_${Y} = stores.${Y}.subscribe(function(state) {
585
- $state.${Y} = state;
583
+ `;for(let Q of J)X+=` if (stores.${Q}) {
584
+ var _unsub_${Q} = stores.${Q}.subscribe(function(state) {
585
+ $state.${Q} = state;
586
586
  updateBindings();
587
587
  });
588
588
  // store.subscribe() may return the disposer (preferred) or void; both
589
589
  // are tolerated here.
590
- if (typeof _unsub_${Y} === 'function') _disposers.push(_unsub_${Y});
590
+ if (typeof _unsub_${Q} === 'function') _disposers.push(_unsub_${Q});
591
591
  }
592
592
  `;return X+=`
593
593
  // Initial update
@@ -627,10 +627,10 @@ else {
627
627
  }
628
628
  })();
629
629
  </script>
630
- `,X}function n$($){let{html:Z,bindings:J,stores:X}=gJ($);if(J.length===0)return $;let Y=hJ(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function s$($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return uJ(Z);case"google-analytics":return mJ(Z);case"plausible":return dJ(Z);case"self-hosted":return lJ(Z);case"custom":return cJ(Z);default:return""}}function uJ($){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="${x0(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="${x0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
630
+ `,X}function n$($){let{html:Z,bindings:J,stores:X}=uJ($);if(J.length===0)return $;let Q=mJ(J,X),Y=Z.lastIndexOf("</body>");if(Y!==-1)return Z.slice(0,Y)+Q+Z.slice(Y);return Z+Q}function s$($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return dJ(Z);case"google-analytics":return lJ(Z);case"plausible":return cJ(Z);case"self-hosted":return pJ(Z);case"custom":return iJ(Z);default:return""}}function dJ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${x0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${x0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
631
631
  <!-- Fathom Analytics -->
632
- <script src="${x0(J)}" ${Y.join(" ")}${X}></script>
633
- `}function mJ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=x0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
632
+ <script src="${x0(J)}" ${Q.join(" ")}${X}></script>
633
+ `}function lJ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=x0(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 dJ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${x0(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 cJ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${x0(Z.domain)}"`],Q=J,Y=[];if(Z.trackLocalhost)Y.push("local");if(Z.hashMode)Y.push("hash");if(Y.length>0&&J==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${Y.join(".")}.js`;return`
644
644
  <!-- Plausible Analytics -->
645
- <script defer data-domain="${x0(Z.domain)}" src="${x0(Y)}"></script>
646
- `}function lJ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=x0(Z.siteId),X=x0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
645
+ <script defer data-domain="${x0(Z.domain)}" src="${x0(Q)}"></script>
646
+ `}function pJ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=x0(Z.siteId),X=x0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Y=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){
@@ -656,7 +656,7 @@ else {
656
656
  'use strict';
657
657
  var d=document,w=window,n=navigator,s=d.currentScript;
658
658
  var site=s.dataset.site,api=s.dataset.api;
659
- ${Y}
659
+ ${Q}
660
660
  var q=[],sid=Math.random().toString(36).slice(2);
661
661
  function t(e,p){
662
662
  var x=new XMLHttpRequest();
@@ -669,22 +669,22 @@ else {
669
669
  }));
670
670
  }
671
671
  function pv(){t('pageview');}
672
- ${Q}
672
+ ${Y}
673
673
  ${G}
674
674
  if(d.readyState==='complete')pv();
675
675
  else w.addEventListener('load',pv);
676
676
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
677
677
  })();
678
678
  </script>
679
- `}function cJ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
679
+ `}function iJ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
680
680
  <!-- Custom Analytics -->
681
681
  <script>
682
682
  ${Z.inlineScript}
683
683
  </script>
684
- `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${x0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))J.push(`${x0(Y)}="${x0(Q)}"`);return`
684
+ `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${x0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,Y]of Object.entries(Z.attributes))J.push(`${x0(Q)}="${x0(Y)}"`);return`
685
685
  <!-- Custom Analytics -->
686
686
  <script${J.length>0?` ${J.join(" ")}`:""} src="${x0(Z.scriptUrl)}" defer></script>
687
- `}function o$($,Z){let J=s$(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 x0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var KW={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return s$(Y)}};var pJ={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 r$($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...pJ,...Z};return`
687
+ `}function o$($,Z){let J=s$(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 x0($){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 Q=J.__stx_config||{};return s$(Q)}};var nJ={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 r$($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...nJ,...Z};return`
688
688
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
689
689
  <script>
690
690
  (function() {
@@ -1067,17 +1067,17 @@ else {
1067
1067
  };
1068
1068
  })();
1069
1069
  </script>
1070
- `}function a$($,Z){let J=r$(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var t$={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=iJ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return r$(Y)}};function iJ($){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 e${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 WW(){return new e$}var nJ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(nJ||={});var sJ;((X)=>{X.In="in";X.Out="out";X.Both="both"})(sJ||={});var oJ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(oJ||={});var o0={duration:300,delay:0,ease:"ease",direction:"both"};function rJ($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...o0,...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 a$($,Z){let J=r$(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var t$={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Q=J.__stx_config||{};if(Z.length>0){let Y=sJ(Z.join(" "));Q.heatmap={...Q.heatmap,...Y,enabled:!0}}return r$(Q)}};function sJ($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Q,Y]=X.split("="),G=Y?.replace(/["']/g,"");switch(Q){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 e${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,Q])=>({depth:X,count:Q})).sort((X,Q)=>X.depth-Q.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Q=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Q.clicks++;else if(X.type==="move")Q.hovers++;Z.set(X.zone,Q)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Y=0;Y<Z;Y++){X[Y]=[];for(let G=0;G<Z;G++)X[Y][G]=0}for(let Y of J){let G=Math.min(Math.floor(Y.x/100*Z),Z-1),z=Math.min(Math.floor(Y.y/100*Z),Z-1);X[z][G]+=Y.type==="click"?3:1}let Q=0;for(let Y of X)for(let G of Y)Q=Math.max(Q,G);return X.map((Y,G)=>Y.map((z,K)=>({x:K,y:G,intensity:Q>0?z/Q: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 UW(){return new e$}var oJ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(oJ||={});var rJ;((X)=>{X.In="in";X.Out="out";X.Both="both"})(rJ||={});var aJ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(aJ||={});var o0={duration:300,delay:0,ease:"ease",direction:"both"};function tJ($,Z={}){let{duration:J,delay:X,ease:Q,direction:Y,custom:G}={...o0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Y==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="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
- @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);"}
1072
+ @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Y==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="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; } }
1074
- @keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${Q==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); 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);"}
1074
+ @keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${Y==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); 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);"}
1075
1075
  @keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
1076
- @keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${Q==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(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);"}
1076
+ @keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${Y==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(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);"}
1077
1077
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
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);"}
1078
+ @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Y==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Y==="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 aJ(){return`
1080
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function eJ(){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 tJ($){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 eJ($=0.1,Z="0px"){return`
1108
+ `}function $X($){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`
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 $X(){return`
1151
+ `}function JX(){return`
1152
1152
  <style id="stx-animation-base">
1153
1153
  :root {
1154
1154
  --stx-transition-duration: 300ms;
@@ -1263,13 +1263,13 @@ 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 ZX($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
1266
+ `}function XX($,Z,J={}){let{staggerDelay:X=50,sequence:Q=!1}=J;return`
1267
1267
  <script data-stx-scoped data-stx-run="always">
1268
1268
  // Animation Group: ${$}
1269
1269
  (function() {
1270
1270
  const elements = ${JSON.stringify(Z)};
1271
1271
  const staggerDelay = ${X};
1272
- const sequence = ${Y};
1272
+ const sequence = ${Q};
1273
1273
 
1274
1274
  function animateGroup() {
1275
1275
  elements.forEach((selector, index) => {
@@ -1300,21 +1300,21 @@ else {
1300
1300
  }
1301
1301
  })();
1302
1302
  </script>
1303
- `}var q5={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)||o0.duration:o0.duration,G=Z.length>2?Z[2]||o0.ease:o0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||o0.delay:o0.delay,K=Z.length>4?Z[4]||o0.direction:o0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=rJ(Y,{duration:Q,delay:z,ease:G,direction:K}),H="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="${H} ${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"},W5={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)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,H="stx-transition stx-observe stx-out";if(Y==="fade")H+=" stx-fade";else if(Y==="slide-up"||Y==="slide")H+=" stx-from-bottom";else if(Y==="slide-down")H+=" stx-from-top";else if(Y==="slide-left")H+=" stx-from-right";else if(Y==="slide-right")H+=" stx-from-left";else if(Y==="scale")H+=" stx-scale";else if(Y.includes("-"))H+=` stx-${Y}`;else H+=` stx-${Y}`;return`<div id="${q}" class="${H}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},H5={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=ZX(Y,Q,{staggerDelay:G,sequence:z});return`${$}
1305
- ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},U5={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=aJ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Z7($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!tJ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=$X();Y=Y.replace("</head>",`${z}
1306
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let K=eJ(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+K+`
1307
- `+Y.slice(q)}}return Y}var $7={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 JX($,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 q5={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 Q=Z[0],Y=Z.length>1?Number.parseInt(Z[1],10)||o0.duration:o0.duration,G=Z.length>2?Z[2]||o0.ease:o0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||o0.delay:o0.delay,K=Z.length>4?Z[4]||o0.direction:o0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=tJ(Q,{duration:Y,delay:z,ease:G,direction:K}),W="stx-transition",U="";if(Q==="fade")U="stx-fade";else if(Q==="slide")U="stx-slide";else if(Q==="scale")U="stx-scale";else if(Q==="flip")U="stx-flip";else if(Q==="rotate")U="stx-rotate";return`<div id="${q}" class="${W} ${U} ${K==="out"?"stx-out":""}"
1304
+ style="--stx-transition-duration: ${Y}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},W5={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 Q=Z[0],Y=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: ${Y}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Q==="fade")W+=" stx-fade";else if(Q==="slide-up"||Q==="slide")W+=" stx-from-bottom";else if(Q==="slide-down")W+=" stx-from-top";else if(Q==="slide-left")W+=" stx-from-right";else if(Q==="slide-right")W+=" stx-from-left";else if(Q==="scale")W+=" stx-scale";else if(Q.includes("-"))W+=` stx-${Q}`;else W+=` stx-${Q}`;return`<div id="${q}" class="${W}" style="${H}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},H5={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 Q=Z[0],Y=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,z=J.sequence||!0,K=XX(Q,Y,{staggerDelay:G,sequence:z});return`${$}
1305
+ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},U5={name:"motion",handler:($,Z,J,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,Y=eJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${Y}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Z7($,Z,J,X){let Q=$;if(X.animation?.enabled===!1)return Q;let Y=J.includes("test")&&J.includes("animation");if(!$X(Q)&&!Y)return Q;if(!Q.includes('<style id="stx-animation-base">')){let z=JX();Q=Q.replace("</head>",`${z}
1306
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let K=ZX(),q=Q.lastIndexOf("</body>");if(q!==-1)Q=Q.slice(0,q)+K+`
1307
+ `+Q.slice(q)}}return Q}var $7={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 YX($,Z){let J=Z.map((X)=>{let Q=X.offset!==void 0?`${X.offset*100}%`:"from",Y=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Q} { ${Y} }`}).join(`
1308
1308
  `);return`@keyframes ${$} {
1309
1309
  ${J}
1310
- }`}var XX={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",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,H=`
1311
- animation-name: ${Y};
1312
- animation-duration: ${Q}ms;
1310
+ }`}var QX={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Q=Z[0].replace(/['"`]/g,""),Y=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
+ animation-name: ${Q};
1312
+ animation-duration: ${Y}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="${W}" style="${H}">${$}</div>`},description:"Applies a keyframe animation to an element"};function YX($,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 GX($,Z,J,X,Q){return`
1318
1318
  <script data-stx-scoped data-stx-run="always">
1319
1319
  (function() {
1320
1320
  const container = document.getElementById('${$}');
@@ -1325,10 +1325,10 @@ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1325
1325
  const delay = ${J} + (index * ${X});
1326
1326
  child.style.setProperty('--stx-stagger-delay', delay + 'ms');
1327
1327
  child.style.animationDelay = delay + 'ms';
1328
- child.classList.add('${Y}');
1328
+ child.classList.add('${Q}');
1329
1329
  });
1330
1330
  })();
1331
- </script>`}var QX={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 W=YX(K,Y,G,Q,q);return`${`
1331
+ </script>`}var zX={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Q=Z[0]?.replace(/['"`]/g,"")||"> *",Y=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=GX(K,Q,G,Y,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>${W}`},description:"Applies staggered animations to child elements"};function GX($){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 zX={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if($7[Y])Q=$7[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=GX(Q),q=`
1341
+ </style>`}<div id="${K}" class="stx-stagger-container">${$}</div>${H}`},description:"Applies staggered animations to child elements"};function KX($){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 qX={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Q=Z[0]?.replace(/['"`]/g,"")||"default",Y;if($7[Q])Y=$7[Q];else Y={stiffness:Number.parseInt(Q,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=KX(Y),q=`
1342
1342
  transition: all ${G}ms ${K};
1343
- --stx-spring-stiffness: ${Q.stiffness};
1344
- --stx-spring-damping: ${Q.damping};
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 UW($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1343
+ --stx-spring-stiffness: ${Y.stiffness};
1344
+ --stx-spring-damping: ${Y.damping};
1345
+ --stx-spring-mass: ${Y.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 BW($){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 jW($,Z,J){let X=JX($,Z),Y=`
1383
+ </script>`}function VW($,Z,J){let X=YX($,Z),Q=`
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 BW($){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 VW(){return`
1393
+ ${Q}`}function LW($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Q=Z[X];if(/^\d+(?:ms|s)?$/.test(Q)){let Y=Number.parseInt(Q,10);if(X===0)J.duration=Q.endsWith("s")&&!Q.endsWith("ms")?Y*1000:Y;else J.delay=Q.endsWith("s")&&!Q.endsWith("ms")?Y*1000:Y}else if(Q==="infinite"||/^\d+$/.test(Q))J.iterations=Q==="infinite"?"infinite":Number.parseInt(Q,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Q))J.direction=Q;else if(["none","forwards","backwards","both"].includes(Q))J.fill=Q;else J.easing=Q}return J}function OW(){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 LW($){let Z=$.customDirectives||[];return Z.push(q5),Z.push(H5),Z.push(U5),Z.push(W5),Z.push(XX),Z.push(QX),Z.push(zX),{...$,customDirectives:Z}}function J7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function X7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var KX=100,qX=599,B5="__stxResponseStatus",H2="__stxResponseHeaders";function o2($){return typeof $==="number"&&Number.isInteger($)&&$>=KX&&$<=qX}function wW($){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(o2(X))return X}return}function j5($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!o2(J))return!1;return $[B5]=J,!0}function WX($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[H2]={...$[H2],[X]:String(J)}}function HX($){let Z=$?.[B5];return o2(Z)?Z:void 0}function UX($){let Z=$?.[H2];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 RW($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=HX($);if(J!==void 0)Z[B5]=J;let X=UX($);if(X)Z[H2]={...Z[H2],...X}}function Y7($){return{setResponseStatus:(Z)=>{j5($,Z)},notFound:(Z=404)=>{let J=o2(Z)&&Z>=400?Z:404;j5($,J)},setResponseHeader:(Z,J)=>{WX($,Z,J)}}}function Q7($,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 W=jX($,q.index+q[0].length-1);if(W<0)break;let H=$.slice(q.index+q[0].length,W).trim(),U=/^\d+$/.test(H)?Number(H):Y0(H,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${H})${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(${H}) from <script server> instead \u2014 that runs per request.`);else if(!j5(Z,U))console.warn(`[stx] @status(${H})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,q.index),z=W+1+($.slice(W+1).match(/^[^\S\n]*\n?/)?.[0].length??0),K.lastIndex=z}return z===0?$:G+$.slice(z)}function jX($,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 BX=0,VX=0;function G7($,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 LX($){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=G7(G,"x-data");if(!K)continue;let q=`__stx_scope_${BX++}`,W=G7(G,"x-init"),H=OX($,Q,z+Y.length),U=$.slice(z,H.endIndex),j=_X(U);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:K,initExpr:W,bindings:[],refs:j})}return Z}function OX($,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($),W=z.exec($);if(W&&W.index<(K?.index??1/0)){Y=W.index+W[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 _X($){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=FX(Q);Z.set(G,z)}return Z}function FX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${VX++}`}function wX(){return`
1465
+ </script>`}function _W($){let Z=$.customDirectives||[];return Z.push(q5),Z.push(H5),Z.push(U5),Z.push(W5),Z.push(QX),Z.push(zX),Z.push(qX),{...$,customDirectives:Z}}function J7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function X7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var WX=100,HX=599,B5="__stxResponseStatus",H2="__stxResponseHeaders";function a2($){return typeof $==="number"&&Number.isInteger($)&&$>=WX&&$<=HX}function NW($){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(a2(X))return X}return}function j5($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!a2(J))return!1;return $[B5]=J,!0}function UX($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[H2]={...$[H2],[X]:String(J)}}function jX($){let Z=$?.[B5];return a2(Z)?Z:void 0}function BX($){let Z=$?.[H2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Q])=>[X,String(Q)]);return J.length>0?Object.fromEntries(J):void 0}function DW($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=jX($);if(J!==void 0)Z[B5]=J;let X=BX($);if(X)Z[H2]={...Z[H2],...X}}function Y7($){return{setResponseStatus:(Z)=>{j5($,Z)},notFound:(Z=404)=>{let J=a2(Z)&&Z>=400?Z:404;j5($,J)},setResponseHeader:(Z,J)=>{UX($,Z,J)}}}function Q7($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Q}=J,Y=Q==="compile",G="",z=0,K=/@status\s*\(/g,q;while((q=K.exec($))!==null){let H=VX($,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):Y0(W,Z),j=X?` in ${X}`:"";if(Y)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(!j5(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 VX($,Z){let J=1,X=null,Q=!1;for(let Y=Z+1;Y<$.length;Y++){let G=$[Y];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Y}return-1}var LX=0,OX=0;function G7($,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 _X($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,Y,G]=X,z=X.index,K=G7(G,"x-data");if(!K)continue;let q=`__stx_scope_${LX++}`,H=G7(G,"x-init"),W=FX($,Y,z+Q.length),U=$.slice(z,W.endIndex),j=wX(U);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:K,initExpr:H,bindings:[],refs:j})}return Z}function FX($,Z,J){let X=1,Q=J,Y=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){Y.lastIndex=Q,G.lastIndex=Q,z.lastIndex=Q;let K=Y.exec($),q=G.exec($),H=z.exec($);if(H&&H.index<(K?.index??1/0)){Q=H.index+H[0].length;continue}if(!q)return{endIndex:$.length};if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return{endIndex:q.index+q[0].length};Q=q.index+q[0].length}}return{endIndex:$.length}}function wX($){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,Q;while((Q=X.exec(J))!==null){let[,Y,G]=Q,z=RX(Y);Z.set(G,z)}return Z}function RX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${OX++}`}function NX(){return`
1466
1466
  // STX Reactive Runtime - x-cloak and transition CSS
1467
1467
  (function() {
1468
1468
  var style = document.createElement('style');
@@ -1669,21 +1669,21 @@ window.__stx_reactive = (function() {
1669
1669
 
1670
1670
  return { initScope: initScope, reactive: reactive };
1671
1671
  })();
1672
- `}function z7($,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 W;try{W=C0(z,Z,!0)}catch{return K}if(W===void 0)return K;if(q){let H=String(W).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?H.replace(/\$\{/g,"\\${"):H}if(typeof W==="string"){let H=W.trim();if(H.startsWith("{")&&H.endsWith("}")||H.startsWith("[")&&H.endsWith("]"))try{return JSON.parse(H),H}catch{}}return JSON.stringify(W)}}function RX($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=z7(X.stateExpr,Z),G=X.initExpr?z7(X.initExpr,Z):null,z=JSON.stringify(Q),K=G?JSON.stringify(G):"null";return`
1672
+ `}function z7($,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="",Q=0,Y=null;while(Q<J.length){let z=J[Q];if(Y&&z==="\\"){X+=z+(J[Q+1]??""),Q+=2;continue}if(z==="{"&&J[Q+1]==="{"){let K=J.indexOf("}}",Q+2);if(K!==-1){let q=J.slice(Q,K+2);X+=G(J.slice(Q+2,K),q,Y),Q=K+2;continue}}if(Y){if(z===Y)Y=null}else if(z==="'"||z==='"'||z==="`")Y=z;X+=z,Q++}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 DX($,Z){if($.length===0)return"";let J=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),Y=z7(X.stateExpr,Z),G=X.initExpr?z7(X.initExpr,Z):null,z=JSON.stringify(Y),K=G?JSON.stringify(G):"null";return`
1673
1673
  (function() {
1674
1674
  var scopeEl = document.querySelector('${X.selector}');
1675
1675
  if (!scopeEl) return;
1676
- var refs = ${Y};
1676
+ var refs = ${Q};
1677
1677
  __stx_reactive.initScope(scopeEl, ${z}, [], refs, ${K});
1678
1678
  })();`}).join(`
1679
1679
  `);return`
1680
1680
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1681
- ${wX()}
1681
+ ${NX()}
1682
1682
  ${J}
1683
- </script>`}function K7($,Z,J){if(!DX($))return $;let X=LX($);if(X.length===0)return $;let Y=NX($,X),Q=RX(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 NX($,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 DX($){return/x-data\s*=\s*["']/.test($)}import HY from"fs";import C5 from"path";import{createHighlighter as UY}from"ts-syntax-highlighter";import Y9 from"fs";import S0 from"path";import{loadConfigWithResult as YY}from"bunfig";U2();async function MX($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=V5();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var q7={name:"stxRouter",handler:MX,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 W7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function H7($){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(),W=z.slice(K+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[q]=W}return{data:Q,content:Y.trim()}}function j2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(W,H,U)=>{let j=Q.length,B=H?` class="language-${Y1(H)}"`:"";return Q.push(`<pre><code${B}>${Y1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(W,H)=>`<code>${Y1(H)}</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,(W,H,U)=>{return`<img src="${W7(U)?Y1(U):""}" alt="${Y1(H)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,H,U)=>{return`<a href="${W7(U)?Y1(U):""}">${H}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
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,(W,H,U)=>{let B=`<tr>${H.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<th>${Y1(_)}</th>`).join("")}</tr>`,V=U.trim().split(`
1683
+ </script>`}function K7($,Z,J){if(!AX($))return $;let X=_X($);if(X.length===0)return $;let Q=MX($,X),Y=DX(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+Y+`
1684
+ `+Q.slice(G);else Q+=Y;return Q}function MX($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Q,Y,G)=>{let z=Z[J++];if(!z)return Q;let K=/data-stx-scope="([^"]*)"/.exec(G);if(K)return z.id=K[1],z.selector=`[data-stx-scope="${z.id}"]`,Q;return`<${Y} 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 AX($){return/x-data\s*=\s*["']/.test($)}import jY from"fs";import C5 from"path";import{createHighlighter as BY}from"ts-syntax-highlighter";import G9 from"fs";import S0 from"path";import{loadConfigWithResult as GY}from"bunfig";U2();async function IX($,Z,J,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",Y=V5();if(Q!=="main")Y=Y.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${Y}</script>`}var q7={name:"stxRouter",handler:IX,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 W7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function H7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Q=$.slice(J[0].length),Y={};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)}Y[q]=H}return{data:Y,content:Q.trim()}}function j2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Q=$,Y=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(H,W,U)=>{let j=Y.length,B=W?` class="language-${Y1(W)}"`:"";return Y.push(`<pre><code${B}>${Y1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(H,W)=>`<code>${Y1(W)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,W,U)=>{return`<img src="${W7(U)?Y1(U):""}" alt="${Y1(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,W,U)=>{return`<a href="${W7(U)?Y1(U):""}">${W}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1686
+ `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(H,W,U)=>{let B=`<tr>${W.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<th>${Y1(_)}</th>`).join("")}</tr>`,V=U.trim().split(`
1687
1687
  `).map((_)=>{return`<tr>${_.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<td>${Y1(F)}</td>`).join("")}</tr>`}).join(`
1688
1688
  `);return`<table>
1689
1689
  <thead>
@@ -1692,16 +1692,16 @@ ${B}
1692
1692
  <tbody>
1693
1693
  ${V}
1694
1694
  </tbody>
1695
- </table>`});if(J)Y=Y.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Y=Y.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Y.split(`
1696
- `),z=[],K=!1,q=[];for(let W of G){let H=W.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(H)||/^\0CODEBLOCK\d+\0$/.test(H)||H===""){if(K&&q.length>0)z.push(`<p>${q.join(X?`<br />
1695
+ </table>`});if(J)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
1696
+ `),z=[],K=!1,q=[];for(let H of G){let W=H.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(W)||/^\0CODEBLOCK\d+\0$/.test(W)||W===""){if(K&&q.length>0)z.push(`<p>${q.join(X?`<br />
1697
1697
  `:`
1698
- `)}</p>`),q=[],K=!1;z.push(W)}else K=!0,q.push(H)}if(K&&q.length>0)z.push(`<p>${q.join(X?`<br />
1698
+ `)}</p>`),q=[],K=!1;z.push(H)}else K=!0,q.push(W)}if(K&&q.length>0)z.push(`<p>${q.join(X?`<br />
1699
1699
  `:`
1700
- `)}</p>`);if(Y=z.join(`
1701
- `),X)Y=Y.replace(/\n/g,`<br />
1702
- `);for(let W=0;W<Q.length;W++)Y=Y.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function U7($,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]:"",W=z+G[0].length,H=1,U=W,j=-1;while(H>0&&U<$.length){let _=$.indexOf("@markdown",U),O=$.indexOf("@endmarkdown",U);if(O===-1)break;if(_!==-1&&_<O&&_!==z){let F=$[_+9];if(F==="("||F===`
1703
- `||F==="\r"||F===" "||F===void 0)H++;U=_+9}else{if(H--,H===0){j=O;break}U=O+12}}if(j===-1)continue;let B=$.slice(W,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:W}of Y)try{let H={};if(K)K.split(",").forEach((B)=>{let V=B.trim();if(V)H[V]=!0});let U={gfm:H.gfm??!0,breaks:H.breaks??!1},j=j2(q.trim(),U);X=X.split(z).join(j)}catch(H){let U=H instanceof Error?H.message:String(H),j=_0("Markdown Directive",`Error processing markdown: ${U}`,J,$,W,z);X=X.split(z).join(j)}return X}async function j7($,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}),j2($.trim(),Y)}var L1=[320,480,640,768,1024,1280,1536,1920,2560],B7=[1,1.5,2,3],x1=["avif","webp","jpeg"],V7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},AX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function B2($,Z=L1,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=IX(Z,J,X);return B2($,G,Y,Q)}function IX($,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 L5($,Z,J=B7,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 vW($,Z,J=B7,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 O5($,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 xW($,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 fW={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 gW($){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 hW($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=x1,baseUrl:G="",params:z={}}=$,K=[];for(let q of Q){let W,H;if(Y!==void 0&&X)W=L5(Z,Y,X,z,q),H=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||L1;W=B2(Z,U,z,q),H=U.map((j)=>({path:"",url:Q1(Z,{...z,w:j,fm:q}),width:j,height:0,format:q,size:0}))}K.push({srcset:W,format:q,mimeType:V7[q],variants:H})}return K}function uW($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
1704
- `)}function mW($,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 _5($){return V7[$]||"application/octet-stream"}function dW($){return AX[$]||$}function lW($){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 TX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},F5=`
1700
+ `)}</p>`);if(Q=z.join(`
1701
+ `),X)Q=Q.replace(/\n/g,`<br />
1702
+ `);for(let H=0;H<Y.length;H++)Q=Q.replace(`\x00CODEBLOCK${H}\x00`,Y[H]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}async function U7($,Z,J=""){let X=$,Q=[],Y=/@markdown(?:\([^)]*\))?/g,G;while((G=Y.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 _=$.indexOf("@markdown",U),O=$.indexOf("@endmarkdown",U);if(O===-1)break;if(_!==-1&&_<O&&_!==z){let F=$[_+9];if(F==="("||F===`
1703
+ `||F==="\r"||F===" "||F===void 0)W++;U=_+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);Q.push({fullMatch:V,options:q,content:B,index:z}),Y.lastIndex=j+12}for(let{fullMatch:z,options:K,content:q,index:H}of Q)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=j2(q.trim(),U);X=X.split(z).join(j)}catch(W){let U=W instanceof Error?W.message:String(W),j=_0("Markdown Directive",`Error processing markdown: ${U}`,J,$,H,z);X=X.split(z).join(j)}return X}async function j7($,Z,J,X){let Q={gfm:!0,breaks:!1};return Z.forEach((Y)=>{let G=Y.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),j2($.trim(),Q)}var L1=[320,480,640,768,1024,1280,1536,1920,2560],B7=[1,1.5,2,3],x1=["avif","webp","jpeg"],V7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},TX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function B2($,Z=L1,J={},X){return Z.sort((Q,Y)=>Q-Y).map((Q)=>{return`${Q1($,{...J,w:Q,fm:X})} ${Q}w`}).join(", ")}function xW($,Z=320,J=2560,X=0.08,Q={},Y){let G=kX(Z,J,X);return B2($,G,Q,Y)}function kX($,Z,J=0.08){let X=[],Q=$;while(Q<Z)X.push(Math.round(Q)),Q*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function L5($,Z,J=B7,X={},Q){return J.sort((Y,G)=>Y-G).map((Y)=>{let G=Math.round(Z*Y);return`${Q1($,{...X,w:G,dpr:Y,fm:Q})} ${Y}x`}).join(", ")}function fW($,Z,J=B7,X=80,Q={},Y){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($,{...Q,w:K,q,dpr:z,fm:Y})} ${z}x`}).join(", ")}function O5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,Y])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:Y,numericBp:Number.parseInt(G)||0}}).sort((Q,Y)=>Q.numericBp-Y.numericBp).map(({bp:Q,size:Y})=>`(max-width: ${Q}) ${Y}`);return X.push(Z),X.join(", ")}function gW($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Q,Y)=>(Q.maxWidth||0)-(Y.maxWidth||0)).filter((Q)=>Q.maxWidth).map((Q)=>`(max-width: ${Q.maxWidth}px) ${Q.imageWidth}`);return X.push(Z),X.join(", ")}var hW={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(([,Y])=>Y!==void 0&&Y!==null).map(([Y,G])=>{if(Array.isArray(G))return[Y,G.join(",")];return[Y,String(G)]});if(J.length===0)return $;let X=J.map(([Y,G])=>`${Y}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function uW($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Y,G)=>{if(/^\d+$/.test(Y))X[G]=Number.parseInt(Y,10);else if(/^\d+\.\d+$/.test(Y))X[G]=Number.parseFloat(Y);else if(Y==="true")X[G]=!0;else if(Y==="false")X[G]=!1;else X[G]=Y});return{src:Z,params:X}}function mW($){let{src:Z,widths:J,dprValues:X,fixedWidth:Q,formats:Y=x1,baseUrl:G="",params:z={}}=$,K=[];for(let q of Y){let H,W;if(Q!==void 0&&X)H=L5(Z,Q,X,z,q),W=X.map((U)=>({path:"",url:Q1(Z,{...z,w:Math.round(Q*U),fm:q}),width:Math.round(Q*U),height:0,format:q,size:0,dpr:U}));else{let U=J||L1;H=B2(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:V7[q],variants:W})}return K}function dW($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
1704
+ `)}function lW($,Z){if($.length===0)return;let J=[...$].sort((Q,Y)=>Q.width-Y.width),X=J.find((Q)=>Q.width>=Z);if(X)return X;return J[J.length-1]}function _5($){return V7[$]||"application/octet-stream"}function cW($){return TX[$]||$}function pW($){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 EX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},F5=`
1705
1705
  .stx-img-placeholder {
1706
1706
  position: relative;
1707
1707
  overflow: hidden;
@@ -1730,12 +1730,12 @@ ${V}
1730
1730
  filter: blur(0);
1731
1731
  transform: scale(1);
1732
1732
  }
1733
- `.trim();async function w5(){try{return await import("ts-images")}catch{return null}}async function L7($,Z={}){let J={...TX,...Z},X=await w5();if(X)try{return await kX($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return O7($,J)}async function kX($,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 O7($,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 pW($){let Z=await w5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await O7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function iW($){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,W=z>>15!==0,H=Math.max(3,W?G?5:7:G?5:7),U=Math.max(3,W?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),_=Math.max(0,Math.min(255,Math.round(J*255))),O=Math.max(0,Math.min(255,Math.round((J-X)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1733
+ `.trim();async function w5(){try{return await import("ts-images")}catch{return null}}async function L7($,Z={}){let J={...EX,...Z},X=await w5();if(X)try{return await bX($,J,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return O7($,J)}async function bX($,Z,J){let{generatePlaceholder:X,generateThumbHash:Q}=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 Q($)).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 O7($,Z){let J=Z.width||20,X=Z.height||J,Q="#e5e7eb",Y=`<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(Y)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function nW($){let Z=await w5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await O7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function sW($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Q=(Z>>12&63)/31.5-1,Y=(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))),_=Math.max(0,Math.min(255,Math.round(J*255))),O=Math.max(0,Math.min(255,Math.round((J-X)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1734
1734
  <rect fill="rgb(${V},${_},${O})" width="32" height="32"/>
1735
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function nW($,Z=20,J=50){return L7($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function sW($){let Z=await w5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function oW($,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 _7($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
1735
+ </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function oW($,Z=20,J=50){return L7($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function rW($){let Z=await w5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function aW($,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 _7($,Z,J={}){let X=J.transitionDuration||300,Q=J.easing||"ease-out";return`
1736
1736
  #${$} {
1737
1737
  --stx-img-transition-duration: ${X}ms;
1738
- --stx-img-transition-easing: ${Y};
1738
+ --stx-img-transition-easing: ${Q};
1739
1739
  background-image: url('${Z.dataURL}');
1740
1740
  background-size: cover;
1741
1741
  background-position: center;
@@ -1749,8 +1749,8 @@ ${V}
1749
1749
  #${$}.stx-img-loaded img {
1750
1750
  opacity: 1;
1751
1751
  }
1752
- `.trim()}function rW($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var f1=new Map;async function F7($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(f1.has(J))return f1.get(J);let X=await L7($,Z);return f1.set(J,X),X}function aW(){f1.clear()}function tW(){return{size:f1.size,keys:Array.from(f1.keys())}}async function EX(){try{return await import("./chunk-86c461ca.js")}catch($){if(!w7)console.warn("[stx-media] Image processor not available, some features disabled:",$),w7=!0;return null}}var w7=!1,R5=80,r2="async",a2="lazy",R7=!1;async function V2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return PX(X,J)}if(J.processedResult?.processed)return M5($,J.processedResult,Z);if(J.responsiveVariants)return M7($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=L1,dpr:W,formats:H=x1,quality:U=R5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:_=!0,priority:O=!1,loading:F=O?"eager":a2,decoding:L=r2,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:M,referrerpolicy:T}=$,D=$.class,I=$.style,k=$.id,A=$.data||{},{isDev:E=!1,baseUrl:C=""}=Z;if(E&&!Z.optimize)return CX($);let y,b,P=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await F7(Y,{strategy:B,...V}),b=_7(P,y,V)}catch{}let h=W!==void 0&&G!==void 0,p;if(h)p=yX($,P,y,Z);else p=await bX($,P,y,Z);let g;if(O){let e=H.includes("webp")?"webp":H[0],i=B2(Y,q,{...j,q:U},e),q0=typeof K==="object"?O5(K):K||"100vw";g=`<link rel="preload" as="image" imagesrcset="${i}" imagesizes="${q0}" />`}let Z0=[];if(!R7&&B!=="none")Z0.push(F5),R7=!0;if(b)Z0.push(b);let J0=_?D7(P):void 0;return{html:p,preloadLink:g,css:Z0.length>0?Z0.join(`
1753
- `):void 0,script:J0}}async function bX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=L1,formats:W=x1,quality:H=R5,params:U={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":a2,decoding:_=r2,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N}=$,R=$.class,M=$.style,T=$.data||{},D=typeof K==="object"?O5(K):K||"100vw",I=[];for(let E of W){let C=B2(Y,q,{...U,q:H},E),y=_5(E);if(j&&!B)I.push(` <source type="${y}" data-srcset="${C}" data-sizes="${D}" />`);else I.push(` <source type="${y}" srcset="${C}" sizes="${D}" />`)}let k=N5({src:Q1(Y,{...U,q:H}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:_,fetchpriority:B?"high":O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N,className:N7(R,J),style:D5(M,F,L,J),lazy:j&&!B,data:T}),A;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;A=`<div id="${Z}" class="stx-img-placeholder" style="${E}">
1752
+ `.trim()}function tW($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var f1=new Map;async function F7($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(f1.has(J))return f1.get(J);let X=await L7($,Z);return f1.set(J,X),X}function eW(){f1.clear()}function $H(){return{size:f1.size,keys:Array.from(f1.keys())}}async function yX(){try{return await import("./chunk-86c461ca.js")}catch($){if(!w7)console.warn("[stx-media] Image processor not available, some features disabled:",$),w7=!0;return null}}var w7=!1,R5=80,t2="async",e2="lazy",R7=!1;async function V2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return xX(X,J)}if(J.processedResult?.processed)return M5($,J.processedResult,Z);if(J.responsiveVariants)return M7($,J.responsiveVariants,Z);let{src:Q,alt:Y,width:G,height:z,sizes:K,widths:q=L1,dpr:H,formats:W=x1,quality:U=R5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:_=!0,priority:O=!1,loading:F=O?"eager":e2,decoding:L=t2,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:M,referrerpolicy:T}=$,D=$.class,I=$.style,k=$.id,A=$.data||{},{isDev:E=!1,baseUrl:C=""}=Z;if(E&&!Z.optimize)return PX($);let y,b,P=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await F7(Q,{strategy:B,...V}),b=_7(P,y,V)}catch{}let h=H!==void 0&&G!==void 0,p;if(h)p=SX($,P,y,Z);else p=await CX($,P,y,Z);let g;if(O){let e=W.includes("webp")?"webp":W[0],i=B2(Q,q,{...j,q:U},e),q0=typeof K==="object"?O5(K):K||"100vw";g=`<link rel="preload" as="image" imagesrcset="${i}" imagesizes="${q0}" />`}let Z0=[];if(!R7&&B!=="none")Z0.push(F5),R7=!0;if(b)Z0.push(b);let J0=_?D7(P):void 0;return{html:p,preloadLink:g,css:Z0.length>0?Z0.join(`
1753
+ `):void 0,script:J0}}async function CX($,Z,J,X){let{src:Q,alt:Y,width:G,height:z,sizes:K,widths:q=L1,formats:H=x1,quality:W=R5,params:U={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":e2,decoding:_=t2,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N}=$,R=$.class,M=$.style,T=$.data||{},D=typeof K==="object"?O5(K):K||"100vw",I=[];for(let E of H){let C=B2(Q,q,{...U,q:W},E),y=_5(E);if(j&&!B)I.push(` <source type="${y}" data-srcset="${C}" data-sizes="${D}" />`);else I.push(` <source type="${y}" srcset="${C}" sizes="${D}" />`)}let k=N5({src:Q1(Q,{...U,q:W}),alt:Y,width:G,height:z,loading:B?void 0:V,decoding:_,fetchpriority:B?"high":O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N,className:N7(R,J),style:D5(M,F,L,J),lazy:j&&!B,data:T}),A;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;A=`<div id="${Z}" class="stx-img-placeholder" style="${E}">
1754
1754
  <picture>
1755
1755
  ${I.join(`
1756
1756
  `)}
@@ -1760,9 +1760,9 @@ ${I.join(`
1760
1760
  ${I.join(`
1761
1761
  `)}
1762
1762
  <img ${k} />
1763
- </picture>`;return A}function yX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:K=[1,2,3],quality:q=R5,params:W={},lazy:H=!0,priority:U=!1,loading:j=U?"eager":a2,decoding:B=r2,fetchpriority:V,objectFit:_,objectPosition:O,crossorigin:F,referrerpolicy:L}=$,w=$.class,N=$.style,R=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=L5(Y,M,K,{...W,q}),D=N5({src:Q1(Y,{...W,w:M,q}),alt:Q,width:G,height:z,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":V,objectFit:_,objectPosition:O,crossorigin:F,referrerpolicy:L,className:N7(w,J),style:D5(N,_,O,J),lazy:H&&!U,data:R}),I=H&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1763
+ </picture>`;return A}function SX($,Z,J,X){let{src:Q,alt:Y,width:G,height:z,dpr:K=[1,2,3],quality:q=R5,params:H={},lazy:W=!0,priority:U=!1,loading:j=U?"eager":e2,decoding:B=t2,fetchpriority:V,objectFit:_,objectPosition:O,crossorigin:F,referrerpolicy:L}=$,w=$.class,N=$.style,R=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),T=L5(Q,M,K,{...H,q}),D=N5({src:Q1(Q,{...H,w:M,q}),alt:Y,width:G,height:z,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":V,objectFit:_,objectPosition:O,crossorigin:F,referrerpolicy:L,className:N7(w,J),style:D5(N,_,O,J),lazy:W&&!U,data:R}),I=W&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1764
1764
  <img ${D} ${I} />
1765
- </div>`}return`<img ${Z?`id="${Z}" `:""}${D} ${I} />`}function CX($){let{src:Z,alt:J,width:X,height:Y,loading:Q=a2,decoding:G=r2,fetchpriority:z,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:H,priority:U=!1}=$,j=$.class,B=$.style,V=$.id,_=$.data||{};return{html:`<img ${N5({src:Z,alt:J,width:X,height:Y,loading:U?"eager":Q,decoding:G,fetchpriority:U?"high":z,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:H,className:j,style:D5(B,K,q),id:V,data:_})} />`}}function N5($){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 N7($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function D5($,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 D7($){return`
1765
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${D} ${I} />`}function PX($){let{src:Z,alt:J,width:X,height:Q,loading:Y=e2,decoding:G=t2,fetchpriority:z,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W,priority:U=!1}=$,j=$.class,B=$.style,V=$.id,_=$.data||{};return{html:`<img ${N5({src:Z,alt:J,width:X,height:Q,loading:U?"eager":Y,decoding:G,fetchpriority:U?"high":z,objectFit:K,objectPosition:q,crossorigin:H,referrerpolicy:W,className:j,style:D5(B,K,q),id:V,data:_})} />`}}function N5($){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 N7($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function D5($,Z,J,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(J)Q.push(`object-position: ${J}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D7($){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 SX($){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,W]=Q,H=K??q??W??!0;if(G===":"&&typeof H==="string")try{X[z]=JSON.parse(H)}catch{X[z]=H}else switch(z){case"src":X.src=String(H);break;case"alt":X.alt=String(H);break;case"width":X.width=Number(H)||H;break;case"height":X.height=Number(H)||H;break;case"sizes":X.sizes=String(H);break;case"quality":X.quality=Number(H);break;case"placeholder":X.placeholder=H;break;case"lazy":X.lazy=H===!0||H==="true";break;case"priority":X.priority=H===!0||H==="true";break;case"class":X.class=String(H);break;case"style":X.style=String(H);break;case"id":X.id=String(H);break;case"loading":X.loading=H;break;case"decoding":X.decoding=H;break;case"fetchpriority":X.fetchpriority=H;break;case"objectFit":X.objectFit=H;break;case"objectPosition":X.objectPosition=String(H);break;case"crossorigin":X.crossorigin=H;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:W}=z[q],H=SX(W);if(H){let U=await V2(H,Z);if(G=G.replace(W,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 PX($,Z){let J=await EX();if(!J)return V2({...$,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 M7($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return M5($,Q,Z)}return V2({...$,process:!1},Z)}async function M5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:H}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},_=Z.variants||[],O=_.find((b)=>b.format==="jpeg")||_.find((b)=>b.format==="webp")||_[0],F=O?.url||$.src,L=_.filter((b)=>b.format===(O?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),w=new Map;for(let b of _){if(!w.has(b.format))w.set(b.format,[]);w.get(b.format).push(b)}let N=[],R=["avif","webp","jpeg","png"];for(let b of R){let P=w.get(b);if(P&&P.length>0){let h=P.map((g)=>`${g.url} ${g.width}w`).join(", "),p=_5(b);if(G&&!z)N.push(` <source type="${p}" data-srcset="${h}" />`);else N.push(` <source type="${p}" srcset="${h}" />`)}}let M=[];if(G&&!z){if(M.push(`data-src="${m0(F)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)M.push(`data-srcset="${L}"`)}else if(M.push(`src="${m0(F)}"`),L)M.push(`srcset="${L}"`);M.push(`alt="${m0(X)}"`);let T=Y||Z.originalWidth,D=Q||Z.originalHeight;if(T)M.push(`width="${T}"`);if(D)M.push(`height="${D}"`);if(!z)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),z)M.push('fetchpriority="high"');if(W)M.push(`crossorigin="${W}"`);if(H)M.push(`referrerpolicy="${H}"`);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 k=[];if(U)k.push(U);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)M.push(`class="${k.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 vX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Q=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Y;while((Y=Q.exec(J))!==null){let[,G,z,K,q,H]=Y,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 YH($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Q=[],Y=[],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=vX(H);if(W){let U=await V2(W,Z);if(G=G.replace(H,U.html),U.preloadLink)X.push(U.preloadLink);if(U.css)Q.push(U.css);if(U.script)Y.push(U.script)}}return{html:G,preloadLinks:X,styles:Q,scripts:Y}}async function xX($,Z){let J=await yX();if(!J)return V2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Y=await J.generateResponsiveVariants($.src,$,X);if(Y)return M7($,Y,Z)}else{let Y=await J.processImage($.src,$,X);if(Y.processed)return M5($,Y,Z)}return V2({...$,process:!1},Z)}async function M5($,Z,J){let{alt:X,width:Q,height:Y,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||{},_=Z.variants||[],O=_.find((b)=>b.format==="jpeg")||_.find((b)=>b.format==="webp")||_[0],F=O?.url||$.src,L=_.filter((b)=>b.format===(O?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),w=new Map;for(let b of _){if(!w.has(b.format))w.set(b.format,[]);w.get(b.format).push(b)}let N=[],R=["avif","webp","jpeg","png"];for(let b of R){let P=w.get(b);if(P&&P.length>0){let h=P.map((g)=>`${g.url} ${g.width}w`).join(", "),p=_5(b);if(G&&!z)N.push(` <source type="${p}" data-srcset="${h}" />`);else N.push(` <source type="${p}" srcset="${h}" />`)}}let M=[];if(G&&!z){if(M.push(`data-src="${m0(F)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)M.push(`data-srcset="${L}"`)}else if(M.push(`src="${m0(F)}"`),L)M.push(`srcset="${L}"`);M.push(`alt="${m0(X)}"`);let T=Q||Z.originalWidth,D=Y||Z.originalHeight;if(T)M.push(`width="${T}"`);if(D)M.push(`height="${D}"`);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 k=[];if(U)k.push(U);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)M.push(`class="${k.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
  ${N.join(`
1805
1805
  `)}
@@ -1810,10 +1810,10 @@ ${N.join(`
1810
1810
  `)}
1811
1811
  <img ${M.join(" ")} />
1812
1812
  </picture>`;let E=[];if(Z.placeholder)E.push(F5);let C=G?D7(B):void 0,y;if(z&&L)y=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:A,preloadLink:y,css:E.length>0?E.join(`
1813
- `):void 0,script:C}}async function M7($,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 M5($,X,J)}function vX(){return t2({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}=xX($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||L1,formats:G.formats||x1,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 V2(z,{isDev:K}),W=q.html;if(q.preloadLink)W=q.preloadLink+`
1814
- `+W;if(q.css)W+=`
1815
- <style>${q.css}</style>`;if(q.script)W+=`
1816
- <script>${q.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function xX($,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=fX(X),Q=A5(Y[0],J)||"",G=A5(Y[1],J)||"",z={};if(Y[2]){let K=A5(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 fX($){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 A5($,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 A7=vX();async function T7(){try{return await import("./chunk-64n10kpa.js")}catch($){if(!I7)console.warn("[stx-media] Video processor not available, some features disabled:",$),I7=!0;return null}}var I7=!1,k7=!0,E7="metadata",gX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function e2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return lX(X,J)}if(J.processedResult?.processed)return y7($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await cX(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:K,controls:q=k7,autoplay:W=!1,muted:H=!1,loop:U=!1,preload:j=E7,playsinline:B=!0,lazy:V=!0,player:_="native",type:O,width:F,height:L,crossorigin:w,disablePictureInPicture:N=!1,disableRemotePlayback:R=!1}=$,M=Y||z,T=$.class,D=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(_==="ts-video")return uX($,Z);if(O&&O!=="video")return hX(Q||"",O,$);let k=G.length>0?G:Q?[{src:Q,type:b7(Q)}]:[],A=[`id="${I}"`];if(q)A.push("controls");if(W)A.push("autoplay");if(H)A.push("muted");if(U)A.push("loop");if(B)A.push("playsinline");if(N)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="${k0(M)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${j}"`),M)A.push(`poster="${k0(M)}"`);if(F)A.push(`width="${F}"`);if(L)A.push(`height="${L}"`);if(T)A.push(`class="${k0(T)}"`);if(D)A.push(`style="${k0(D)}"`);let E=k.map((b)=>{return` <source ${V?`data-src="${k0(b.src)}"`:`src="${k0(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
1813
+ `):void 0,script:C}}async function M7($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,Y]of Object.entries(Z.byFormat))if(Y)X.variants.push(...Y);return M5($,X,J)}function fX(){return $9({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Q,alt:Y,options:G}=gX($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Q,alt:Y||"",widths:G.widths||L1,formats:G.formats||x1,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 V2(z,{isDev:K}),H=q.html;if(q.preloadLink)H=q.preloadLink+`
1814
+ `+H;if(q.css)H+=`
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 gX($,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 Q=hX(X),Y=A5(Q[0],J)||"",G=A5(Q[1],J)||"",z={};if(Q[2]){let K=A5(Q[2],J);if(typeof K==="object"&&K!==null)z=K;else if(typeof Q[2]==="string")try{z=JSON.parse(Q[2])}catch{}}return{src:Y,alt:G,options:z}}function hX($){let Z=[],J="",X=!1,Q="",Y=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,Q=K;else if(K===Q)X=!1,Q="";else J+=K;continue}if(!X){if(K==="{")Y++;if(K==="}")Y--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Y===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function A5($,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 A7=fX();async function T7(){try{return await import("./chunk-64n10kpa.js")}catch($){if(!I7)console.warn("[stx-media] Video processor not available, some features disabled:",$),I7=!0;return null}}var I7=!1,k7=!0,E7="metadata",uX="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 pX(X,J)}if(J.processedResult?.processed)return y7($,J.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await iX(X,J);let{src:Y,sources:G=[],poster:z,posterPlaceholder:K,controls:q=k7,autoplay:H=!1,muted:W=!1,loop:U=!1,preload:j=E7,playsinline:B=!0,lazy:V=!0,player:_="native",type:O,width:F,height:L,crossorigin:w,disablePictureInPicture:N=!1,disableRemotePlayback:R=!1}=$,M=Q||z,T=$.class,D=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(_==="ts-video")return dX($,Z);if(O&&O!=="video")return mX(Y||"",O,$);let k=G.length>0?G:Y?[{src:Y,type:b7(Y)}]:[],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(N)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="${k0(M)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${j}"`),M)A.push(`poster="${k0(M)}"`);if(F)A.push(`width="${F}"`);if(L)A.push(`height="${L}"`);if(T)A.push(`class="${k0(T)}"`);if(D)A.push(`style="${k0(D)}"`);let E=k.map((b)=>{return` <source ${V?`data-src="${k0(b.src)}"`:`src="${k0(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
1817
1817
  `),C=`<video ${A.join(" ")}>
1818
1818
  ${E}
1819
1819
  Your browser does not support the video tag.
@@ -1852,20 +1852,20 @@ ${E}
1852
1852
 
1853
1853
  observer.observe(video);
1854
1854
  })();
1855
- `.trim();return{html:C,script:y}}function hX($,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=mX($),K=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=dX($),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 W=[`id="${z}"`,`src="${k0(K)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${k0(Q)}"`);if(G)W.push(`style="${k0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1856
- <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1857
- </div>`}}function uX($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:K=!1,preload:q="metadata",playsinline:W=!0,lazy:H=!0,width:U,height:j}=$,B=$.class,V=$.style,_=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:X.length>0?X:J,autoplay:G,loop:K,muted:z,playsinline:W,preload:q,poster:Y,controls:Q,title:$.title},F=["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=`
1855
+ `.trim();return{html:C,script:y}}function mX($,Z,J){let{width:X=640,height:Q=360}=J,Y=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=lX($),K=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=cX($),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="${k0(K)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Y)H.push(`class="${k0(Y)}"`);if(G)H.push(`style="${k0(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
+ <iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1857
+ </div>`}}function dX($,Z={}){let{src:J,sources:X=[],poster:Q,controls:Y=!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,_=$.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:Q,controls:Y,title:$.title},F=["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="${_}"
1860
1860
  class="ts-video-player${B?" "+k0(B):""}"
1861
1861
  style="${F}"
1862
1862
  data-ts-video-player
1863
1863
  data-config='${JSON.stringify(O)}'
1864
- ${H?"data-lazy":""}
1864
+ ${W?"data-lazy":""}
1865
1865
  >
1866
1866
  <div class="ts-video-player__container">
1867
- ${Y?`
1868
- <div class="ts-video-player__placeholder" style="background-image: url('${k0(Y)}');">
1867
+ ${Q?`
1868
+ <div class="ts-video-player__placeholder" style="background-image: url('${k0(Q)}');">
1869
1869
  <button class="ts-video-player__play-button" aria-label="Play video">
1870
1870
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1871
1871
  <path d="M8 5v14l11-7z"/>
@@ -1891,7 +1891,7 @@ ${E}
1891
1891
 
1892
1892
  // Load ts-video-player from CDN
1893
1893
  var script = document.createElement('script');
1894
- script.src = '${gX}';
1894
+ script.src = '${uX}';
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:N}}function b7($){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 mX($){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 dX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function KH($,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 lX($,Z){let J=await T7();if(!J)return e2({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return y7($,Y,Z);return e2({...$,process:!1},Z)}async function cX($,Z){let J=await T7();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 y7($,Z,J){let{controls:X=k7,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=E7,playsinline:K=!0,lazy:q=!0,width:W,height:H,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,_=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=b7(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let N=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"'),N)R.push(`data-poster="${k0(N)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${z}"`),N)R.push(`poster="${k0(N)}"`);let M=W||Z.metadata?.width,T=H||Z.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(V)R.push(`class="${k0(V)}"`);if(_)R.push(`style="${k0(_)}"`);let I=` <source ${q?`data-src="${k0(F)}"`:`src="${k0(F)}"`} type="${L}" />`,k=`<video ${R.join(" ")}>
2024
+ `.trim();return{html:L,script:w,css:N}}function b7($){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 lX($){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 cX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function k0($){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 Q=X.indexOf(",");if(Q===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Y=X.slice(0,Q).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Q+1).trim();try{let z=JSON.parse(G);return{src:Y,...z}}catch{return{src:Y}}}async function pX($,Z){let J=await T7();if(!J)return Z9({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await J.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return y7($,Q,Z);return Z9({...$,process:!1},Z)}async function iX($,Z){let J=await T7();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function y7($,Z,J){let{controls:X=k7,autoplay:Q=!1,muted:Y=!1,loop:G=!1,preload:z=E7,playsinline:K=!0,lazy:q=!0,width:H,height:W,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,_=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=b7(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let N=Z.poster?.url||$.poster,R=[`id="${O}"`];if(X)R.push("controls");if(Q)R.push("autoplay");if(Y)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"'),N)R.push(`data-poster="${k0(N)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${z}"`),N)R.push(`poster="${k0(N)}"`);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="${k0(V)}"`);if(_)R.push(`style="${k0(_)}"`);let I=` <source ${q?`data-src="${k0(F)}"`:`src="${k0(F)}"`} type="${L}" />`,k=`<video ${R.join(" ")}>
2025
2025
  ${I}
2026
2026
  Your browser does not support the video tag.
2027
2027
  </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${k0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -2070,9 +2070,9 @@ ${k}
2070
2070
  width: 100%;
2071
2071
  height: auto;
2072
2072
  }
2073
- `.trim();return{html:k,script:A,css:E}}function C7(){return t2({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}=pX($,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 e2(G,K),W=q.html;if(q.css)W+=`
2074
- <style>${q.css}</style>`;if(q.script)W+=`
2075
- <script>${q.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function pX($,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=iX(X),Q=S7(Y[0],J)||"",G={};if(Y[1]){let z=S7(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 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 S7($,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 I5=C7();import nX from"fs";import f0 from"path";async function _H($,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 sX(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 sX($,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(f0.isAbsolute(Y)&&await t(Y))z=Y;else if(Z.componentsDir){let V=f0.join(Z.componentsDir,Y);if(await t(V))z=V}if(!z)z=await $9(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 W=($.outputFormat||"js")==="ts",H=W?rX({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):oX({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 nX.promises.mkdir(U,{recursive:!0});let j=W?"ts":"js",B=f0.join(U,`${Q}.${j}`);if(await Bun.write(B,H),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function oX($){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 W="";if(z)W=`<link rel="stylesheet" href="${z}">`;return`/**
2073
+ `.trim();return{html:k,script:A,css:E}}function C7(){return $9({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Q,options:Y}=nX($,Z,J);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:Y.poster,controls:Y.controls!==!1,autoplay:Y.autoplay||!1,muted:Y.muted||!1,loop:Y.loop||!1,preload:Y.preload||"metadata",playsinline:Y.playsinline!==!1,lazy:Y.lazy!==!1,player:Y.player||"native",type:Y.type,width:Y.width,height:Y.height,class:Y.class,style:Y.style,id:Y.id,crossorigin:Y.crossorigin,disablePictureInPicture:Y.disablePictureInPicture,disableRemotePlayback:Y.disableRemotePlayback,title:Y.title,quality:Y.quality,platform:Y.platform,process:Y.process,generatePoster:Y.generatePoster,streaming:Y.streaming,transcode:Y.transcode,spriteSheet:Y.spriteSheet,waveform:Y.waveform},K={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},q=await Z9(G,K),H=q.html;if(q.css)H+=`
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 nX($,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 Q=sX(X),Y=S7(Q[0],J)||"",G={};if(Q[1]){let z=S7(Q[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:Y,options:G}}function sX($){let Z=[],J="",X=!1,Q="",Y=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,Q=K;else if(K===Q)X=!1,Q="";else J+=K;continue}if(!X){if(K==="{")Y++;if(K==="}")Y--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Y===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function S7($,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 I5=C7();import oX from"fs";import f0 from"path";async function wH($,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 Q of J)try{let Y=await rX(Q,$,Z);if(Y)X.push(Y)}catch(Y){if(console.error(`Error building web component ${Q.name}:`,Y),$.debug)throw Y}}return X}async function rX($,Z,J){let{name:X,file:Q,tag:Y,extends:G}=$;if(!X||!Q||!Y)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(f0.isAbsolute(Q)&&await t(Q))z=Q;else if(Z.componentsDir){let V=f0.join(Z.componentsDir,Q);if(await t(V))z=V}if(!z)z=await J9(Q,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Q}`),null;let K=await Bun.file(z).text();J.add(z);let H=($.outputFormat||"js")==="ts",W=H?tX({name:X,tag:Y,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):aX({name:X,tag:Y,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),U=Z.webComponents?.outputDir||"dist/web-components";await oX.promises.mkdir(U,{recursive:!0});let j=H?"ts":"js",B=f0.join(U,`${Y}.${j}`);if(await Bun.write(B,W),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function aX($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Q,shadowDOM:Y,template:G,styleSource:z,attributes:K=[]}=$,q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Y)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
  */
@@ -2080,26 +2080,26 @@ class ${Z.replace(/\W/g,"")} extends ${X} {
2080
2080
  constructor() {
2081
2081
  super()
2082
2082
  this._initialized = false
2083
- ${Q?"":"this._slotContent = []"}
2084
- ${Q?'this.attachShadow({ mode: "open" })':""}
2083
+ ${Y?"":"this._slotContent = []"}
2084
+ ${Y?'this.attachShadow({ mode: "open" })':""}
2085
2085
  }
2086
2086
 
2087
2087
  ${G?`
2088
2088
  _createTemplate() {
2089
2089
  const template = document.createElement('template')
2090
- template.innerHTML = \`${W}${q}\`
2091
- ${Q?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
2090
+ template.innerHTML = \`${H}${q}\`
2091
+ ${Y?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
2092
2092
  this._processSlots()
2093
2093
  }
2094
2094
  `:`
2095
2095
  _render() {
2096
- ${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${W}${q}\`
2096
+ ${Y?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${H}${q}\`
2097
2097
  this._processSlots()
2098
2098
  }
2099
2099
  `}
2100
2100
 
2101
2101
  _processSlots() {
2102
- ${Q?`// Shadow DOM handles slot assignment automatically
2102
+ ${Y?`// Shadow DOM handles slot assignment automatically
2103
2103
  // Listen for slot changes if needed
2104
2104
  const slots = this.shadowRoot.querySelectorAll('slot')
2105
2105
  slots.forEach(slot => {
@@ -2139,7 +2139,7 @@ class ${Z.replace(/\W/g,"")} extends ${X} {
2139
2139
 
2140
2140
  ${K.length>0?`
2141
2141
  static get observedAttributes() {
2142
- return [${K.map((H)=>`'${H}'`).join(", ")}]
2142
+ return [${K.map((W)=>`'${W}'`).join(", ")}]
2143
2143
  }
2144
2144
 
2145
2145
  attributeChangedCallback(name, oldValue, newValue) {
@@ -2152,7 +2152,7 @@ class ${Z.replace(/\W/g,"")} extends ${X} {
2152
2152
 
2153
2153
  connectedCallback() {
2154
2154
  if (this._initialized) return
2155
- ${Q?"":"this._slotContent = Array.from(this.childNodes)"}
2155
+ ${Y?"":"this._slotContent = Array.from(this.childNodes)"}
2156
2156
  this._initialized = true
2157
2157
  ${G?"this._createTemplate()":"this._render()"}
2158
2158
  }
@@ -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 rX($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[],attributeTypes:q={}}=$,W=Z.replace(/\W/g,""),H=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)H=H.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),H=H.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),H=H.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),H=H.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");H=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let U=z?`<link rel="stylesheet" href="${z}">`:"",j=(N)=>{switch(q[N]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(N)=>N.replace(/-([a-z])/g,(R,M)=>M.toUpperCase()),V=K.map((N)=>` private _${B(N)}: ${j(N)} | null = null;`).join(`
2167
+ `}function tX($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Q,shadowDOM:Y,template:G,styleSource:z,attributes:K=[],attributeTypes:q={}}=$,H=Z.replace(/\W/g,""),W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Y)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=(N)=>{switch(q[N]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(N)=>N.replace(/-([a-z])/g,(R,M)=>M.toUpperCase()),V=K.map((N)=>` private _${B(N)}: ${j(N)} | null = null;`).join(`
2168
2168
  `),_=K.map((N)=>{let R=j(N),M=B(N);return`
2169
2169
  get ${M}(): ${R} | null {
2170
2170
  return this._${M};
@@ -2182,7 +2182,7 @@ else {
2182
2182
  `),O=K.length>0?`/**
2183
2183
  * Props interface for ${Z}
2184
2184
  */
2185
- export interface ${W}Props {
2185
+ export interface ${H}Props {
2186
2186
  ${K.map((N)=>{let R=j(N);return` ${B(N)}?: ${R};`}).join(`
2187
2187
  `)}
2188
2188
  }
@@ -2214,12 +2214,12 @@ catch { return value; }
2214
2214
  `:"",L=G?`
2215
2215
  private _createTemplate(): void {
2216
2216
  const template = document.createElement('template');
2217
- template.innerHTML = \`${U}${H}\`;
2218
- ${Q?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2217
+ template.innerHTML = \`${U}${W}\`;
2218
+ ${Y?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2219
2219
  this._processSlots();
2220
2220
  }`:`
2221
2221
  private _render(): void {
2222
- ${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${U}${H}\`;
2222
+ ${Y?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${U}${W}\`;
2223
2223
  this._processSlots();
2224
2224
  }`;return`/**
2225
2225
  * ${Z} Web Component
@@ -2244,17 +2244,17 @@ ${O}
2244
2244
  * ${Z} custom element class
2245
2245
  * @customElement ${J}
2246
2246
  */
2247
- export class ${W} extends ${X} {
2247
+ export class ${H} extends ${X} {
2248
2248
  ${V}
2249
2249
  private _initialized = false;
2250
- ${Q?"":"private _slotContent: Node[] = [];"}
2250
+ ${Y?"":"private _slotContent: Node[] = [];"}
2251
2251
 
2252
2252
  constructor() {
2253
2253
  super();
2254
- ${Q?'this.attachShadow({ mode: "open" });':""}
2254
+ ${Y?'this.attachShadow({ mode: "open" });':""}
2255
2255
  }
2256
2256
  ${L}
2257
- ${Q?`
2257
+ ${Y?`
2258
2258
  private _processSlots(): void {
2259
2259
  const slots = this.shadowRoot!.querySelectorAll('slot');
2260
2260
  slots.forEach((slot) => {
@@ -2296,7 +2296,7 @@ ${_}
2296
2296
 
2297
2297
  connectedCallback(): void {
2298
2298
  if (this._initialized) return;
2299
- ${Q?"":"this._slotContent = Array.from(this.childNodes);"}
2299
+ ${Y?"":"this._slotContent = Array.from(this.childNodes);"}
2300
2300
  this._initialized = true;
2301
2301
  ${G?"this._createTemplate();":"this._render();"}
2302
2302
  }
@@ -2313,15 +2313,15 @@ ${_}
2313
2313
  // Type augmentation for HTMLElementTagNameMap
2314
2314
  declare global {
2315
2315
  interface HTMLElementTagNameMap {
2316
- '${J}': ${W};
2316
+ '${J}': ${H};
2317
2317
  }
2318
2318
  }
2319
2319
 
2320
2320
  // Register the web component
2321
- customElements.define('${J}', ${W});
2322
- `}var T5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function k5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function aX($,Z,J={}){let X={...T5,...J},Y=k5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return eX($,X.prefix||Z,X.preserveOriginal);case"attribute":return tX($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return $Y($,Z,X.preserveOriginal);default:return $}}function tX($,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 eX($,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 $Y($,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 ZY($,Z,J={}){let X={...T5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=k5(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 W=q.trimEnd().endsWith("/"),H=W?q.slice(0,-1):q;return`<${K}${H} ${G}${W?"/":""}>`})}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 FH($,Z={}){let J={...T5,...Z},X=k5($);return`${J.attributeName||"data-v"}-${X}`}function wH($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,K)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${aX(K,Z,J)}
2321
+ customElements.define('${J}', ${H});
2322
+ `}var T5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function k5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function eX($,Z,J={}){let X={...T5,...J},Q=k5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return ZY($,X.prefix||Z,X.preserveOriginal);case"attribute":return $Y($,Q,X.attributeName||"data-v",X.preserveOriginal);case"bem":return JY($,Z,X.preserveOriginal);default:return $}}function $Y($,Z,J,X){let Q=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Y,G,z)=>{if(G.startsWith("@"))return Y;if(/^(?::root|:host|html|body)$/i.test(G))return Y;return`${X?`${G}${Q}`:`${G}${Q}`}${z}`})}function ZY($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Q)=>{if(Q.startsWith(Z))return X;let Y=`${Z}__${Q}`;return J?`.${Y}`:`.${Y}`})}function JY($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Q,Y)=>{if(Y.includes("__")||Y.includes("--")){if(!Y.startsWith(X))return`.${X}__${Y}`;return Q}let G=`${X}__${Y}`;return J?`.${G}`:`.${G}`})}function XY($,Z,J={}){let X={...T5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Q=k5(Z),G=`${X.attributeName||"data-v"}-${Q}`;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 Q=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Y,G)=>{return`class="${G.split(/\s+/).map((K)=>{if(!K)return K;if(K.startsWith(Q))return K;return`${Q}__${K}`}).join(" ")}"`})}return $}function RH($,Z={}){let J={...T5,...Z},X=k5($);return`${J.attributeName||"data-v"}-${X}`}function NH($,Z,J={}){let X="",Q=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,K)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${eX(K,Z,J)}
2323
2323
  `;else X+=`${K}
2324
- `;return""});return{html:ZY(Y,Z,J),css:X.trim()}}function g1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function RH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:W={},state:H={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||g1(T)),V=j.map((T)=>{let D=z[T],I=D.default!==void 0?JSON.stringify(D.default):D.type==="string"?'""':D.type==="number"?"0":D.type==="boolean"?"false":D.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
2324
+ `;return""});return{html:XY(Q,Z,J),css:X.trim()}}function g1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function DH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Q,styles:Y="",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||g1(T)),V=j.map((T)=>{let D=z[T],I=D.default!==void 0?JSON.stringify(D.default):D.type==="string"?'""':D.type==="number"?"0":D.type==="boolean"?"false":D.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
2325
2325
  `),_=j.map((T)=>{let D=z[T],I=D.attribute!==!1?D.attribute||g1(T):null,k=D.reflect&&I?`
2326
2326
  if (value !== null && value !== undefined) {
2327
2327
  ${D.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
@@ -2359,11 +2359,11 @@ else {
2359
2359
  }
2360
2360
  ${K.attributeChanged||""}
2361
2361
  }`:"",F=Object.entries(q).map(([T,D])=>{return`this._root.addEventListener('${T}', (e) => { ${D} });`}).join(`
2362
- `),L=Object.entries(W).map(([T,D])=>{return`
2362
+ `),L=Object.entries(H).map(([T,D])=>{return`
2363
2363
  ${T}() {
2364
2364
  ${D}
2365
2365
  }`}).join(`
2366
- `),w=JSON.stringify(Object.fromEntries(j.map((T)=>[T,z[T]]))),N=JSON.stringify(Object.fromEntries(j.filter((T)=>z[T].attribute!==!1).map((T)=>[z[T].attribute||g1(T),T]))),R=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),M=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2366
+ `),w=JSON.stringify(Object.fromEntries(j.map((T)=>[T,z[T]]))),N=JSON.stringify(Object.fromEntries(j.filter((T)=>z[T].attribute!==!1).map((T)=>[z[T].attribute||g1(T),T]))),R=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),M=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2367
2367
  * ${Z} - Reactive Web Component
2368
2368
  * Auto-generated with reactive properties and lifecycle management
2369
2369
  *
@@ -2375,7 +2375,7 @@ class ${U} extends ${X} {
2375
2375
  _attrToProp = ${N};
2376
2376
 
2377
2377
  // Internal state
2378
- _state = ${JSON.stringify(H)};
2378
+ _state = ${JSON.stringify(W)};
2379
2379
  _renderPending = false;
2380
2380
  _isConnected = false;
2381
2381
 
@@ -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 NH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:W={},state:H={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((D)=>z[D].attribute!==!1).map((D)=>z[D].attribute||g1(D)),V=(D)=>{switch(D){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"}},_=j.length>0?`
2526
+ `}function MH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Q,styles:Y="",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((D)=>z[D].attribute!==!1).map((D)=>z[D].attribute||g1(D)),V=(D)=>{switch(D){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"}},_=j.length>0?`
2527
2527
  /**
2528
2528
  * Props interface for ${Z}
2529
2529
  */
@@ -2531,12 +2531,12 @@ export interface ${U}Props {
2531
2531
  ${j.map((D)=>` ${D}?: ${V(z[D].type)};`).join(`
2532
2532
  `)}
2533
2533
  }
2534
- `:"",O=Object.keys(H).length>0?`
2534
+ `:"",O=Object.keys(W).length>0?`
2535
2535
  /**
2536
2536
  * State interface for ${Z}
2537
2537
  */
2538
2538
  export interface ${U}State {
2539
- ${Object.entries(H).map(([D,I])=>` ${D}: ${typeof I};`).join(`
2539
+ ${Object.entries(W).map(([D,I])=>` ${D}: ${typeof I};`).join(`
2540
2540
  `)}
2541
2541
  }
2542
2542
  `:`
@@ -2583,11 +2583,11 @@ else {
2583
2583
  }
2584
2584
  ${K.attributeChanged||""}
2585
2585
  }`:"",N=Object.entries(q).map(([D,I])=>{return`this._root.addEventListener('${D}', (e: Event) => { ${I} });`}).join(`
2586
- `),R=Object.entries(W).map(([D,I])=>{return`
2586
+ `),R=Object.entries(H).map(([D,I])=>{return`
2587
2587
  ${D}(): void {
2588
2588
  ${I}
2589
2589
  }`}).join(`
2590
- `),M=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),T=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2590
+ `),M=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),T=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2591
2591
  * ${Z} - Reactive Web Component (TypeScript)
2592
2592
  * Auto-generated with reactive properties and lifecycle management
2593
2593
  *
@@ -2618,7 +2618,7 @@ export class ${U} extends ${X} {
2618
2618
  private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(j.filter((D)=>z[D].attribute!==!1).map((D)=>[z[D].attribute||g1(D),D])))};
2619
2619
 
2620
2620
  // Internal state
2621
- private _state: ${U}State = ${JSON.stringify(H)};
2621
+ private _state: ${U}State = ${JSON.stringify(W)};
2622
2622
  private _renderPending = false;
2623
2623
  private _isConnected = false;
2624
2624
  private _root: ShadowRoot | HTMLElement;
@@ -2775,7 +2775,7 @@ declare global {
2775
2775
  customElements.define('${J}', ${U});
2776
2776
 
2777
2777
  export default ${U};
2778
- `}function DH(){return`/**
2778
+ `}function AH(){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 MH(){return`/**
2900
+ `}function IH(){return`/**
2901
2901
  * stx Reactive Web Components Runtime
2902
2902
  * Provides base classes and utilities for reactive web components
2903
2903
  */
@@ -3114,16 +3114,16 @@ else {
3114
3114
  };
3115
3115
 
3116
3116
  })(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
3117
- `}function JY($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let H=X.match(/export\s+default\s+({[\s\S]*})/);if(H)try{let U=H[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((_)=>_.trim().replace(/['"`]/g,"")).filter((_)=>_.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),W=q?q[1].trim():"";return{tag:Y,props:Q,template:K,styles:W,script:X,shadowDOM:G}}function XY($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((H)=>H.charAt(0).toUpperCase()+H.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((H)=>`'${H}'`).join(", "),W=J.map((H)=>`
3118
- get ${H}() {
3119
- return this.getAttribute('${H}') || '';
3117
+ `}function YY($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Q=Z,Y=[],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)Q=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Y=B[1].split(",").map((_)=>_.trim().replace(/['"`]/g,"")).filter((_)=>_.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:Q,props:Y,template:K,styles:H,script:X,shadowDOM:G}}function QY($){let{tag:Z,props:J,template:X,styles:Q,shadowDOM:Y}=$,G=Z.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((W)=>`'${W}'`).join(", "),H=J.map((W)=>`
3118
+ get ${W}() {
3119
+ return this.getAttribute('${W}') || '';
3120
3120
  }
3121
- set ${H}(value) {
3121
+ set ${W}(value) {
3122
3122
  if (value) {
3123
- this.setAttribute('${H}', value);
3123
+ this.setAttribute('${W}', value);
3124
3124
  }
3125
3125
  else {
3126
- this.removeAttribute('${H}');
3126
+ this.removeAttribute('${W}');
3127
3127
  }
3128
3128
  }`).join(`
3129
3129
  `);return`/**
@@ -3133,7 +3133,7 @@ else {
3133
3133
  class ${G} extends HTMLElement {
3134
3134
  constructor() {
3135
3135
  super();
3136
- ${Q?"this.attachShadow({ mode: 'open' });":""}
3136
+ ${Y?"this.attachShadow({ mode: 'open' });":""}
3137
3137
  this._render();
3138
3138
  }
3139
3139
 
@@ -3146,7 +3146,7 @@ class ${G} extends HTMLElement {
3146
3146
  this._render();
3147
3147
  }
3148
3148
  }
3149
- ${W}
3149
+ ${H}
3150
3150
 
3151
3151
  _render() {
3152
3152
  const template = \`${K?`<style>${K}</style>`:""}${z}\`;
@@ -3156,7 +3156,7 @@ ${W}
3156
3156
  return this.getAttribute(prop) || '';
3157
3157
  });
3158
3158
 
3159
- ${Q?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
3159
+ ${Y?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
3160
3160
  }
3161
3161
 
3162
3162
  connectedCallback() {
@@ -3165,12 +3165,12 @@ ${W}
3165
3165
  }
3166
3166
 
3167
3167
  customElements.define('${Z}', ${G});
3168
- `}async function P7($,Z,J,X){if(Z.length<1)return D0("WebComponent","@webcomponent directive requires at least the tag name parameter",N0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=f0.isAbsolute(G)?[f0.join(G,`${Y}.stx`),f0.join(f0.dirname(X),`${Y}.stx`)]:[f0.join(f0.dirname(X),G,`${Y}.stx`),f0.join(process.cwd(),G,`${Y}.stx`),f0.join(f0.dirname(X),`${Y}.stx`)],K=null;for(let H of z)if(await t(H)){K=await Bun.file(H).text();break}if(!K)return D0("WebComponent",`Component file not found: ${Y}.stx`,N0.FILE_NOT_FOUND);let q=JY(K,Y);return`<script type="module">
3169
- ${XY(q)}
3170
- </script>`}var E5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g7,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:j7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:P7,hasEndTag:!1,description:"Include a web component in the template"},x7,f7,l7,c7,q5,H5,U5,W5,q7,t$,A7,I5,...p7],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 QY($,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(Y9.existsSync(Q)&&Y9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(Y9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var v7=new Set,Q9=["partialsDir","componentsDir","layoutsDir"],b5=new WeakMap;function GY($,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 zY($,Z){let J=!$.root,X=QY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!v7.has(Y))v7.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(!b5.has($)){let Y={};for(let Q of Q9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}b5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Q9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||GY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of Q9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function KY($,Z){let J=b5.get($);for(let X of Q9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(Y9.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 qY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function WY($){if(h7($.stateDir),$.stateDir=u7(),$.cachePath=L2($.cachePath),$.build)$.build.cacheDir=L2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L2($.media.cache.directory);if($.story)$.story.outDir=L2($.story.outDir)}var G1=null,O1=new Map,Z9=new Map,O2=null;async function y5($){let Z=$?S0.resolve($):process.cwd(),J=Z9.get(Z);if(J&&J.signature!==J9(J.graph)){let Q=O1.get(Z);if(O1.delete(Z),Z9.delete(Z),!$)G1=null,O2=null;let{clearComponentCache:G}=await import("./chunk-94sxzp5x.js"),{partialsCache:z}=await import("./chunk-cmccdayf.js");if(G(),z.clear(),Q&&J.configSignature===X9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await d7(W,Z),Z9.set(Z,{graph:W,signature:J9(W),configSignature:X9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return O1.set(Z,K),K}}if(!$){if(G1)return G1;if(O2)return O2}let X=O1.get(Z);if(X)return X;let Y=(async()=>{let G=(await YY({name:"stx",alias:"ui",cwd:Z,defaultConfig:E5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await m7(Z,E5);G=z.config,Z9.set(Z,{graph:z.graph,signature:J9(z.graph),configSignature:X9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-34f8c48f.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-cappe4hd.js");await K(Z,G.runtimeConfig)}if(qY(G),WY(G),zY(G,Z),KY(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-dgv43ccd.js"),K=[],q=[];for(let W of G.plugins){let H=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(H),B=S0.dirname(x.resolve(H))}catch{let _=S0.resolve(Z,H);j=await import(_),B=S0.dirname(_)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let _=Array.isArray(V.components)?V.components:[V.components];for(let O of _)K.push(S0.resolve(B,O))}if(V.pages){let _=S0.resolve(B,V.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(V.setup){let _={addDirective:(O)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(O)},addRoute:(O,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[O]=F},addMiddleware:(O)=>{G.middleware=G.middleware||[],G.middleware.push(O)},pluginDir:B,config:G};await V.setup(U,_)}console.log(`[stx] Plugin loaded: ${V.name||H}`)}catch(j){console.warn(`[stx] Failed to load plugin ${H}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Y),Y.catch(()=>{if(O1.get(Z)===Y)O1.delete(Z)}),!$)O2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var i7=new Proxy(E5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!O2)y5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function mH($){return $}function dH($){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 S5=new Map;async function jY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await HY.promises.stat($)).mtime.getTime();if(Z.cache&&S5.has($)){let H=S5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=H7(Y),z=Z.markdown||i7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=j2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await BY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)S5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var G9=null;async function BY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!G9)try{G9=await UY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.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(!G9.getSupportedLanguages().includes(U))return z;return(await G9.highlight(H,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,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function n7($,Z,J="",X={}){return await VY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!C5.isAbsolute(z))W=C5.resolve(C5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=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);H[N]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await jY(W,X),B={...Z,...j,...H},V=U,_=/\{\{([^}]+)\}\}/g;return V=V.replace(_,(O,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return _0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function VY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,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(j0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}function K1($,Z){let J=LY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function LY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function OY($,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($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function s7($,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,W="if",H=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(OY(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 _=V.match(/^@elseif\s*/);if(_){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+_[0].length,F=K1(z,O);if(!F){q++;continue}W="elseif",H=F.expression,q=F.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function _2($){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=s7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function z9($,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=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=_1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function P5($,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,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),_=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let F=q+V[0].length,L=K1(z,F);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(_&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=_[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function FY($){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,W=wY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function wY($,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 RY($){let Z=x5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=NY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function NY($){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=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=a7(G);return{name:X,args:z}}function a7($){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 DY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function MY($){let Z=[],X=new v5($).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 W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=o7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=r7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=o7(X,Y,$);Y=V.nextIndex;let _=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:_,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${_}`,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 W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=r7(X,U+1)}}}else Y++}return Z}function o7($,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 r7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function AY($,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=P5(X,G);if(!z)break;try{let K;if(j0(z.expression))K=W0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Y0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&j0(H.value))U=W0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=Y0(H.value,Z);if(K===U){q=H.content.trim(),W=!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),W=D0("Switch",`Error evaluating @switch expression: ${q}`,N0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function IY($){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 TY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function r0($,Z,J){let{masked:X,scripts:Y}=IY($);return TY(kY(X,Z,J),Y)}function kY($,Z,J){let X=$;X=AY(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,W=_1(X,"unless","endunless",q);if(W===-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 H=X.slice(q,W),U=K.expression,j=-1;{let V=0,_=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=_.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")V++;else if(N.type==="close")V--;else if(N.type==="else"&&V===0){j=N.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),_=H.slice(j+5);B=`@if (${U})${_}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=g5(X,Z,J),X=h5(X,Z,J),X=f5(X,Z);let Y=()=>{let Q=_2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&j0(j.condition))B=W0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=Y0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,N0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=D0("If",`Error processing @if block: ${U}`,N0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.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 t7($){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 f5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),_=B.exec(z),O=V?V.index:1/0,F=_?_.index:1/0;if(O<F)H++,U=O+V[0].length;else if(F<1/0){if(H--,H===0)return F;U=F+_[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.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((_,O)=>_.pos-O.pos);for(let _ of B)if(_.type==="open")W++;else if(_.type==="close")W--;else if(_.type==="else"&&W===0)return _.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,W,H,U=J.slice(q+5),j=t7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);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(H,B),_=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+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,W,H,U=J.slice(q+6),j=t7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);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(H,B),_=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+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 W=[z];if(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}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",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,_=X(J,z,K,V);if(_===-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"),N=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],D;while((D=w.exec(O))!==null)T.push({pos:D.index,type:"open"});while((D=N.exec(O))!==null)T.push({pos:D.index,type:"close"});while((D=R.exec(O))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=M.exec(O))!==null)T.push({pos:D.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)F.push(y)}let I=[],k=0;for(let y=0;y<F.length;y++){let b=F[y];if(I.push({content:O.slice(k,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(k,b.pos)},k=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=F[y+1],g=p?p.pos:O.length;I.push({content:O.slice(k,g),ability:h.ability,type:h.type,id:h.id}),k=g}}else k=b.pos+5}if(k<O.length){let y=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,C="";if(E)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(_+`@${K}`.length),W=!0}}return J}function g5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,_=_1(Q,G,z,V);if(_===-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,N=0;while(N<O.length){let R=O.indexOf("@",N);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}N=R+1}try{let R=K(F.trim()),M;if(L!==-1){let T=O.slice(0,L),D=O.slice(L+5);M=R?T:D}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(_+`@${z}`.length),W=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,N0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(_+`@${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 h5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=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,W.lastIndex=0;let _=W.exec(B);if(!_)break;let O=_.index,F=O+_[0].length;if(z==="env"){let A=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;F+=A[0].length,q=Y===A[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),C=A?A.index:1/0,y=E?E.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){N=y;break}w=y+E[0].length}else break}if(N===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(F,N),M=-1,T=0,D=0;while(D<R.length){let A=R.indexOf("@",D);if(A===-1)break;let E=R.substring(A);if(U.test(E)){T++,D=A+1;continue}if(j.test(E)){T--,D=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){M=A;break}D=A+1}let I;if(M!==-1){let A=R.slice(0,M),E=R.slice(M+5);I=q?A:E}else I=q?R:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(N+k),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 u5=new WeakMap;function e7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??e7();let J=u5.get($);if(!J)J=Z?.nonceGenerator?.()??e7(),u5.set($,J);return J}function BU($){u5.delete($)}function $4($,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 d5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$4($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var EY={"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},m5={"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},bY={"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'"]},yY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function VU($){return{enabled:!0,directives:{strict:EY,moderate:m5,relaxed:bY,api:yY}[$]||m5,useNonce:$==="strict",addMetaTag:!0}}function LU($,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 Z4($,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?F1(J,Z):void 0,Y=d5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3171
- ${Y}`)}function J4($,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 X4($,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?F1(Z,Q):void 0;return d5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return F1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=F1(Z,Q);return Y}var CY={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?F1(J,Q):void 0;return d5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},SY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return F1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function OU(){return[CY,SY]}function _U($){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 PY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function FU($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=$4($.directives,J);return{[PY($.reportOnly)]:X}}var wU={enabled:!1,reportOnly:!1,directives:m5,useNonce:!1,addMetaTag:!0};import vY from"crypto";var xY=40,Y4="_token",l5=null;function fY($=xY){let Z=vY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return l5=Z,Z}function gY(){if(!l5)fY();return l5}function hY($=Y4){let Z=gY();return`<input type="hidden" name="${$}" value="${Z}">`}function Q4($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return hY(X||Y4)})}async function K4($,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 uY(Y,Q,Z,J,X);else Y=await mY(Y,Q,Z,J,X)}return Y}async function uY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=w1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),H=[],U=W.exec(q);while(U!==null){let[j,B="",V=""]=U,_=U.index||0;try{let O=B?q4(Z,B):[],F=V.trim(),L=await G(F,O,J,X);H.push({original:j,processed:L,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);H.push({original:j,processed:D0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${F}`,N0.EVALUATION_ERROR),startIndex:_})}U=W.exec(q)}for(let j=H.length-1;j>=0;j--){let{original:B,processed:V}=H[j];q=q.replace(B,V)}return q}async function mY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of G4(z,w1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=w1(`@${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=q4(Z,j),_=await G("",V,J,X);K.push({original:U,processed:_,startIndex:B})}catch(V){let _=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}): ${_}`,N0.EVALUATION_ERROR),startIndex:B})}let W=w1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[U]=H,j=H.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}`,N0.EVALUATION_ERROR),startIndex:j})}H=W.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 q4($,Z){return $.rawParams?z4(Z):dY(Z)}function dY($){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 W4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,H4=/^[A-Za-z_$][\w$]*$/,lY=new Set(["light","dark","system"]);function R1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function cY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(R1(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(R1(J.key,"appearance.key"),R1(J.attribute,"appearance.attribute"),R1(J.default,"appearance.default"),R1(X.key,"colorMode.key"),R1(X.attribute,"colorMode.attribute"),R1(X.default,"colorMode.default"),!H4.test(J.key)||!H4.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!W4.test(J.attribute)||!W4.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(!lY.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 pY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function iY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${pY($)};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 nY($,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 U4($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=nY(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=Y0(`(${z})`,Z),q=iY(cY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import sY from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var p5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function oY($){return{...p5,...$.forms?.classes}}function K9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function g0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function h1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${A0(Z)}"`}function c5($,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="${A0(`${g0($)}-error`)}"`;return X}function rY(){return sY.randomUUID()}function CU($,Z,J,X){let Y=oY(X),Q=$;return Q=tY(Q,Z),Q=R2(Q,Z),Q=i5(Q,Z,Y),Q=n5(Q,Z,Y),Q}function R2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=rY();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(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="${A0(Q)}">`;return X}),J}function i5($,Z,J=p5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",H=z||K||"",U=q1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${A0(B)}" action="${A0(H)}"${U?` ${U}`:""}>`;if(V+=`
3168
+ `}async function P7($,Z,J,X){if(Z.length<1)return D0("WebComponent","@webcomponent directive requires at least the tag name parameter",N0.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=f0.isAbsolute(G)?[f0.join(G,`${Q}.stx`),f0.join(f0.dirname(X),`${Q}.stx`)]:[f0.join(f0.dirname(X),G,`${Q}.stx`),f0.join(process.cwd(),G,`${Q}.stx`),f0.join(f0.dirname(X),`${Q}.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: ${Q}.stx`,N0.FILE_NOT_FOUND);let q=YY(K,Q);return`<script type="module">
3169
+ ${QY(q)}
3170
+ </script>`}var E5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g7,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:j7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:P7,hasEndTag:!1,description:"Include a web component in the template"},x7,f7,l7,c7,q5,H5,U5,W5,q7,t$,A7,I5,...p7],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 zY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Q=J||process.cwd(),Y=S0.join(Q,"resources","views"),G=S0.join(Q,"resources","layouts");if(G9.existsSync(Y)&&G9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Q,"resources","views","pages");if(G9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var v7=new Set,z9=["partialsDir","componentsDir","layoutsDir"],b5=new WeakMap;function KY($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Q=J.replace(/\\/g,"/");return X===Q||X.startsWith(`${Q}/`)}function qY($,Z){let J=!$.root,X=zY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Q=`${Z}::${X.root}`;if(!v7.has(Q))v7.add(Q),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(!b5.has($)){let Q={};for(let Y of z9){let G=$[Y];if(typeof G==="string"&&G)Q[Y]=G}b5.set($,Q)}if($.root&&$.root!=="."){let Q=$.root;for(let Y of z9){let G=$[Y];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||KY(G,Q))continue;$[Y]=S0.join(Q,G)}}for(let Q of z9){let Y=$[Q];if(typeof Y!=="string"||!Y||S0.isAbsolute(Y))continue;$[Q]=S0.resolve(Z,Y)}return $}function WY($,Z){let J=b5.get($);for(let X of z9){let Q=$[X];if(typeof Q!=="string"||!Q)continue;let Y=S0.isAbsolute(Q)?Q:S0.join(Z,Q);if(G9.existsSync(Y))continue;let G=J?.[X]??Q,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Y}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function HY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function UY($){if(h7($.stateDir),$.stateDir=u7(),$.cachePath=L2($.cachePath),$.build)$.build.cacheDir=L2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L2($.media.cache.directory);if($.story)$.story.outDir=L2($.story.outDir)}var G1=null,O1=new Map,X9=new Map,O2=null;async function y5($){let Z=$?S0.resolve($):process.cwd(),J=X9.get(Z);if(J&&J.signature!==Y9(J.graph)){let Y=O1.get(Z);if(O1.delete(Z),X9.delete(Z),!$)G1=null,O2=null;let{clearComponentCache:G}=await import("./chunk-b08taxsf.js"),{partialsCache:z}=await import("./chunk-j8s9akdq.js");if(G(),z.clear(),Y&&J.configSignature===Q9(J.graph)){let K=Y.then(async(q)=>{let H={...J.graph};await d7(H,Z),X9.set(Z,{graph:H,signature:Y9(H),configSignature:Q9(H)});let W={...q,_layerGraph:H};if(!$)G1=W;return W});return O1.set(Z,K),K}}if(!$){if(G1)return G1;if(O2)return O2}let X=O1.get(Z);if(X)return X;let Q=(async()=>{let G=(await GY({name:"stx",alias:"ui",cwd:Z,defaultConfig:E5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await m7(Z,E5);G=z.config,X9.set(Z,{graph:z.graph,signature:Y9(z.graph),configSignature:Q9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-34f8c48f.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-km92eab7.js");await K(Z,G.runtimeConfig)}if(HY(G),UY(G),qY(G,Z),WY(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-dgv43ccd.js"),K=[],q=[];for(let H of G.plugins){let W=typeof H==="string"?H:H[0],U=typeof H==="string"?{}:H[1]||{};try{let j,B;try{j=await import(W),B=S0.dirname(x.resolve(W))}catch{let _=S0.resolve(Z,W);j=await import(_),B=S0.dirname(_)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let _=Array.isArray(V.components)?V.components:[V.components];for(let O of _)K.push(S0.resolve(B,O))}if(V.pages){let _=S0.resolve(B,V.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(V.setup){let _={addDirective:(O)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(O)},addRoute:(O,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[O]=F},addMiddleware:(O)=>{G.middleware=G.middleware||[],G.middleware.push(O)},pluginDir:B,config:G};await V.setup(U,_)}console.log(`[stx] Plugin loaded: ${V.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Q),Q.catch(()=>{if(O1.get(Z)===Q)O1.delete(Z)}),!$)O2=Q,Q.then((Y)=>{G1=Y}).catch(()=>{});return Q}var i7=new Proxy(E5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!O2)y5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function lH($){return $}function cH($){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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].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((Q,Y)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${Y}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${Y}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Y}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${Y}].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((Q)=>typeof Q!=="number"||Q<16||Q>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((Y)=>!X.includes(Y)).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 S5=new Map;async function VY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await jY.promises.stat($)).mtime.getTime();if(Z.cache&&S5.has($)){let W=S5.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:Y,content:G}=H7(Q),z=Z.markdown||i7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=j2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await LY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:q,data:Y||{}};if(Z.cache)S5.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:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var K9=null;async function LY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!K9)try{K9=await BY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Q=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(!K9.getSupportedLanguages().includes(U))return z;return(await K9.highlight(W,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Y=$,G=$.matchAll(X);for(let z of G){let[K,q,H,W]=z,U=await Q(K,q,H,W);Y=Y.replace(K,U)}return Y}async function n7($,Z,J="",X={}){return await OY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let H=z;if(!C5.isAbsolute(z))H=C5.resolve(C5.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 F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=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[N]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await VY(H,X),B={...Z,...j,...W},V=U,_=/\{\{([^}]+)\}\}/g;return V=V.replace(_,(O,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(H){let W=H instanceof Error?H.message:String(H);return _0("Markdown File",`Error including markdown file: ${W}`,J,$,q,G)}})}async function OY($,Z,J){let X=[],Q;while((Q=Z.exec($))!==null){let z=Q[0],K=Q.index,q=Q;X.push(J(...q).then((H)=>({match:z,replacement:H,index:K})))}let Y=await Promise.all(X);Y.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Y)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(j0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}function K1($,Z){let J=_Y($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function _Y($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function FY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Q=1,Y=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Y<$.length&&Q>0){G.lastIndex=Y,z.lastIndex=Y;let K=G.exec($),q=z.exec($),H=K?K.index:1/0,W=q?q.index:1/0;if(H<W)Q++,Y=H+K[0].length;else if(W<1/0){if(Q--,Q===0)return W;Y=W+q[0].length}else break}return-1}function s7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Q=K1($,X);if(!Q)return null;let Y=Q.endPos,G=_1($,"if","endif",Y);if(G===-1)return null;let z=$.slice(Y,G),K=[],q=0,H="if",W=Q.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(FY(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 _=V.match(/^@elseif\s*/);if(_){K.push({type:H,condition:W,content:z.substring(U,q),start:Y+U,end:Y+q});let O=q+_[0].length,F=K1(z,O);if(!F){q++;continue}H="elseif",W=F.expression,q=F.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:H,condition:W,content:z.substring(U,q),start:Y+U,end:Y+q}),H="else",W=void 0,q+=5,U=q;continue}}q++}return K.push({type:H,condition:W,content:z.slice(U),start:Y+U,end:Y+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function _2($){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 Y=s7($,X.index);if(Y)Z.push(Y),J.lastIndex=Y.end;X=J.exec($)}return Z}function q9($,Z,J){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),Y=Q.exec($);while(Y!==null){if(X.some((V)=>Y.index>V.start&&Y.index<V.end)){Y=Q.exec($);continue}let z=Y.index,K=z+Y[0].length-1,q=M0($,"(",")",K);if(q===-1){Y=Q.exec($);continue}let H=$.slice(K+1,q),W=q+1,U=_1($,Z,J,W);if(U===-1){Y=Q.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}),Q.lastIndex=B,Y=Q.exec($)}return X}function P5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Q=K1($,X);if(!Q)return null;let Y=Q.endPos,G=_1($,"switch","endswitch",Y);if(G===-1)return null;let z=$.slice(Y,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*/),_=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(H)K.push(H);let F=q+V[0].length,L=K1(z,F);if(!L){q++;continue}H={type:"case",value:L.expression,content:""},q=L.endPos}else if(_&&U.startsWith("@default")){if(H)K.push(H);H={type:"default",content:""},q+=_[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:Q.expression,cases:K,start:Z,end:G+10}}function RY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Q=$.indexOf("{!!",J),Y=!1,G;if(X===-1&&Q===-1)break;else if(X===-1)G=Q,Y=!0;else if(Q===-1)G=X,Y=!1;else if(Q<X)G=Q,Y=!0;else G=X,Y=!1;if(!Y&&$.slice(G,G+3)==="{{{")Y=!0;let z=Y?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Y?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,H=NY($,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:Y}),J=U}return Z}function NY($,Z,J){let X=Z,Q=null,Y={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Q){X++;continue}if((z==='"'||z==="'")&&!Q){Q=z,X++;continue}if(z===Q&&Q!=="`"){Q=null,X++;continue}if(z==="`"&&!Q){Q="`",X++;continue}if(z==="`"&&Q==="`"&&G===0){Q=null,X++;continue}if(Q==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Q){X++;continue}if(z==="(")Y.paren++;else if(z===")")Y.paren--;else if(z==="[")Y.bracket++;else if(z==="]")Y.bracket--;else if(z==="{")Y.brace++;else if(z==="}")Y.brace--;if(Y.paren===0&&Y.bracket===0&&Y.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function DY($){let Z=x5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Q=1;Q<Z.length;Q++){let Y=MY(Z[Q]);if(Y)X.push(Y)}return{baseExpression:J,filters:X}}function MY($){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(),Q=J+1,Y=M0(Z,"(",")",J);if(Y===-1)return{name:X,args:[]};let G=Z.slice(Q,Y),z=a7(G);return{name:X,args:z}}function a7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Q=null,Y=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Q){J+=z;continue}if((z==='"'||z==="'")&&!Q){Q=z,J+=z;continue}if(z===Q&&Q!=="`"){Q=null,J+=z;continue}if(z==="`"&&!Q){Q="`",J+=z;continue}if(z==="`"&&Q==="`"&&Y===0){Q=null,J+=z;continue}if(Q==="`"&&z==="$"&&$[G+1]==="{"){Y++,J+="${",G++;continue}if(Y>0&&z==="{"){Y++,J+=z;continue}if(Y>0&&z==="}"){Y--,J+=z;continue}if(Q){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 AY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function IY($){let Z=[],X=new v5($).tokenize().filter((Y)=>Y.type!=="WHITESPACE"&&Y.type!=="COMMENT"),Q=0;while(Q<X.length){let Y=X[Q],G=!1;if(Y.type==="IDENTIFIER"&&Y.value==="export"){if(G=!0,Q++,Q>=X.length)break}let z=X[Q];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Q++,Q>=X.length)break;let q=X[Q];if(q.type==="IDENTIFIER"){let H=q.value;if(Q++,Q<X.length&&X[Q].type==="OPERATOR"&&X[Q].value==="="){Q++;let W=Q<X.length?X[Q].start:$.length,U=o7(X,Q,$);Q=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=M0($,q.value,W,H);if(U!==-1){let j=$.slice(H,U+1);if(Q=r7(X,U+1),Q<X.length&&X[Q].type==="OPERATOR"&&X[Q].value==="="){Q++;let B=Q<X.length?X[Q].start:$.length,V=o7(X,Q,$);Q=V.nextIndex;let _=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:_,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${_}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Q-1].start:z.start;if(Q++,Q>=X.length)break;let q=X[Q];if(q.type==="IDENTIFIER"){let H=q.value;Q++;let W=-1;while(Q<X.length){if(X[Q].type==="PUNCTUATION"&&X[Q].value==="{"){W=X[Q].start;break}Q++}if(W!==-1){let U=M0($,"{","}",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}),Q=r7(X,U+1)}}}else Q++}return Z}function o7($,Z,J){let X=Z,Q={paren:0,bracket:0,brace:0},Y=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Q.paren++;else if(G.value===")")Q.paren--;else if(G.value==="[")Q.bracket++;else if(G.value==="]")Q.bracket--;else if(G.value==="{")Q.brace++;else if(G.value==="}")Q.brace--;if(G.value===";"&&Q.paren===0&&Q.bracket===0&&Q.brace===0){Y=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Q.paren===0&&Q.bracket===0&&Q.brace===0){Y=$[X-1]?.end??G.start;break}}Y=G.end,X++}return{nextIndex:X,endPos:Y}}function r7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function TY($,Z,J){let X=$,Q=!0;while(Q){Q=!1;let Y=X.match(/@switch\s*\(/);if(!Y||Y.index===void 0)break;let G=Y.index,z=P5(X,G);if(!z)break;try{let K;if(j0(z.expression))K=W0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Y0(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&&j0(W.value))U=W0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)U=Y0(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),Q=!0}catch(K){let q=K instanceof Error?K.message:String(K),H=D0("Switch",`Error evaluating @switch expression: ${q}`,N0.EVALUATION_ERROR);X=X.substring(0,G)+H+X.substring(z.end);break}}return X}function kY($){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 EY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function r0($,Z,J){let{masked:X,scripts:Q}=kY($);return EY(bY(X,Z,J),Q)}function bY($,Z,J){let X=$;X=TY(X,Z,J);{let Y=!0;while(Y){Y=!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,_=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=_.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=F.exec(W))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")V++;else if(N.type==="close")V--;else if(N.type==="else"&&V===0){j=N.pos;break}}let B;if(j!==-1){let V=W.slice(0,j),_=W.slice(j+5);B=`@if (${U})${_}@else ${V}@endif`}else B=`@if (!(${U}))${W}@endif`;X=X.substring(0,z)+B+X.substring(H+10),Y=!0}}X=g5(X,Z,J),X=h5(X,Z,J),X=f5(X,Z);let Q=()=>{let Y=_2(X);if(Y.length===0)return!1;let G=Array(Y.length);for(let q=Y.length-1;q>=0;q--){let H=Y[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&&j0(j.condition))B=W0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=Y0(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)}`,N0.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}`,N0.EVALUATION_ERROR)}}let z=Array(Y.length*2+1),K=0;for(let q=0;q<Y.length;q++){let H=Y[q];z[q*2]=X.slice(K,H.start),z[q*2+1]=G[q],K=H.end}return z[Y.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Y=X;if(!Q())break;if(X===Y)break}return X}function t7($){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 Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===J){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function f5($,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),_=B.exec(z),O=V?V.index:1/0,F=_?_.index:1/0;if(O<F)W++,U=O+V[0].length;else if(F<1/0){if(W--,W===0)return F;U=F+_[0].length}else break}return-1}function Q(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((_,O)=>_.pos-O.pos);for(let _ of B)if(_.type==="open")H++;else if(_.type==="close")H--;else if(_.type==="else"&&H===0)return _.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=t7(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),_=Q(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=H?z1(`auth?.check && auth?.user?.[${H}]`,Z):z1("auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+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=t7(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),_=Q(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=H?z1(`!auth?.check || !auth?.user?.[${H}]`,Z):z1("!auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+J.substring(B+9),z=!0}}function Y(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,_=X(J,z,K,V);if(_===-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"),N=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],D;while((D=w.exec(O))!==null)T.push({pos:D.index,type:"open"});while((D=N.exec(O))!==null)T.push({pos:D.index,type:"close"});while((D=R.exec(O))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=M.exec(O))!==null)T.push({pos:D.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)F.push(y)}let I=[],k=0;for(let y=0;y<F.length;y++){let b=F[y];if(I.push({content:O.slice(k,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(k,b.pos)},k=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=F[y+1],g=p?p.pos:O.length;I.push({content:O.slice(k,g),ability:h.ability,type:h.type,id:h.id}),k=g}}else k=b.pos+5}if(k<O.length){let y=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Y(B.ability,B.type,B.id),E=z==="can"?A:!A,C="";if(E)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=Y(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(_+`@${K}`.length),H=!0}}return J}function g5($,Z,J){let X=$;function Q(Y,G,z,K,q){let H=!0;while(H){H=!1;let W=new RegExp(`@${G}\\s*\\(`),U=Y.match(W);if(!U||U.index===void 0)break;let j=U.index,B=K1(Y,j+`@${G}`.length);if(!B)break;let V=B.endPos,_=_1(Y,G,z,V);if(_===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Y.slice(V,_),F=B.expression,L=-1,w=0,N=0;while(N<O.length){let R=O.indexOf("@",N);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}N=R+1}try{let R=K(F.trim()),M;if(L!==-1){let T=O.slice(0,L),D=O.slice(L+5);M=R?T:D}else M=R?O:"";Y=Y.substring(0,j)+M+Y.substring(_+`@${z}`.length),H=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,N0.EVALUATION_ERROR);Y=Y.substring(0,j)+T+Y.substring(_+`@${z}`.length);break}}return Y}return X=Q(X,"isset","endisset",(Y)=>{let G=z1(Y,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(Y)=>{let G=z1(Y,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 h5($,Z,J){let X=$,Q="development";function Y(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 _=H.exec(B);if(!_)break;let O=_.index,F=O+_[0].length;if(z==="env"){let A=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;F+=A[0].length,q=Q===A[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){H.lastIndex=w,W.lastIndex=w;let A=H.exec(B),E=W.exec(B),C=A?A.index:1/0,y=E?E.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){N=y;break}w=y+E[0].length}else break}if(N===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(F,N),M=-1,T=0,D=0;while(D<R.length){let A=R.indexOf("@",D);if(A===-1)break;let E=R.substring(A);if(U.test(E)){T++,D=A+1;continue}if(j.test(E)){T--,D=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){M=A;break}D=A+1}let I;if(M!==-1){let A=R.slice(0,M),E=R.slice(M+5);I=q?A:E}else I=q?R:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(N+k),V=!0}return B}return X=Y(X,"env","endenv",!1),X=Y(X,"production","endproduction",Q==="production"),X=Y(X,"development","enddevelopment",Q==="development"),X=Y(X,"staging","endstaging",Q==="staging"),X=Y(X,"testing","endtesting",Q==="testing"),X}var u5=new WeakMap;function e7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??e7();let J=u5.get($);if(!J)J=Z?.nonceGenerator?.()??e7(),u5.set($,J);return J}function LU($){u5.delete($)}function $4($,Z){let J=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)J.push(X);continue}if(Array.isArray(Q)){let Y=[...Q];if(Z&&(X==="script-src"||X==="style-src"))Y=Y.filter((G)=>!G.startsWith("'nonce-")),Y.push(`'nonce-${Z}'`);if(Y.length>0)J.push(`${X} ${Y.join(" ")}`)}}return J.join("; ")}function d5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$4($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var yY={"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},m5={"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},CY={"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'"]},SY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function OU($){return{enabled:!0,directives:{strict:yY,moderate:m5,relaxed:CY,api:SY}[$]||m5,useNonce:$==="strict",addMetaTag:!0}}function _U($,Z){let J={...$};for(let[X,Q]of Object.entries(Z)){let Y=X,G=J[Y];if(Q===void 0||Q===null)continue;if(typeof Q==="boolean")J[Y]=G||Q;else if(Array.isArray(Q)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Q])];J[Y]=K}}return J}function Z4($,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?F1(J,Z):void 0,Q=d5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3171
+ ${Q}`)}function J4($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),J}function X4($,Z,J,X){let Q=$,Y=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!Y?.enabled||!Y.directives)return"<!-- CSP not configured -->";let G=Y.useNonce?F1(Z,Y):void 0;return d5(Y.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!Y?.enabled||!Y.useNonce)return"";return F1(Z,Y)}),Y?.enabled&&Y.useNonce)Z.cspNonce=F1(Z,Y);return Q}var PY={name:"csp",handler:($,Z,J,X)=>{let Y=J.__stx_options?.csp;if(!Y?.enabled||!Y.directives)return"<!-- CSP not configured -->";let G=Y.useNonce?F1(J,Y):void 0;return d5(Y.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},vY={name:"cspNonce",handler:($,Z,J,X)=>{let Y=J.__stx_options?.csp;if(!Y?.enabled||!Y.useNonce)return"";return F1(J,Y)},hasEndTag:!1,description:"Output the current CSP nonce value"};function FU(){return[PY,vY]}function wU($){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 xY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function RU($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=$4($.directives,J);return{[xY($.reportOnly)]:X}}var NU={enabled:!1,reportOnly:!1,directives:m5,useNonce:!1,addMetaTag:!0};import fY from"crypto";var gY=40,Y4="_token",l5=null;function hY($=gY){let Z=fY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return l5=Z,Z}function uY(){if(!l5)hY();return l5}function mY($=Y4){let Z=uY();return`<input type="hidden" name="${$}" value="${Z}">`}function Q4($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return mY(X||Y4)})}async function K4($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let Y of X.customDirectives){if(!Y.name||typeof Y.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Y);continue}if(Y.hasEndTag)Q=await dY(Q,Y,Z,J,X);else Q=await lY(Q,Y,Z,J,X)}return Q}async function dY($,Z,J,X,Q){let{name:Y,handler:G}=Z,z=`@${Y}`,K=`@end${Y}`,q=$,H=w1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),W=[],U=H.exec(q);while(U!==null){let[j,B="",V=""]=U,_=U.index||0;try{let O=B?q4(Z,B):[],F=V.trim(),L=await G(F,O,J,X);W.push({original:j,processed:L,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${Y}:`,O);W.push({original:j,processed:D0("CustomDirective",`Error in @${Y}${B?`(${B})`:""}: ${F}`,N0.EVALUATION_ERROR),startIndex:_})}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 lY($,Z,J,X,Q){let{name:Y,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of G4(z,w1(`(?<![\\w$@])@${Y}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=w1(`@${Y}\\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=q4(Z,j),_=await G("",V,J,X);K.push({original:U,processed:_,startIndex:B})}catch(V){let _=V instanceof Error?V.message:String(V);if(Q.debug)console.error(`Error processing custom directive @${Y}:`,V);K.push({original:U,processed:D0("CustomDirective",`Error in @${Y}(${j}): ${_}`,N0.EVALUATION_ERROR),startIndex:B})}let H=w1(`@${Y}(?!\\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(Q.debug)console.error(`Error processing custom directive @${Y}:`,B);K.push({original:U,processed:D0("CustomDirective",`Error in @${Y}: ${V}`,N0.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 q4($,Z){return $.rawParams?z4(Z):cY(Z)}function cY($){if(!$.trim())return[];let Z=[],J="",X=!1,Q="";for(let Y=0;Y<$.length;Y++){let G=$[Y];if((G==='"'||G==="'")&&(Y===0||$[Y-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)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((Y)=>{let G=Y.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var W4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,H4=/^[A-Za-z_$][\w$]*$/,pY=new Set(["light","dark","system"]);function R1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function iY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(R1(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(R1(J.key,"appearance.key"),R1(J.attribute,"appearance.attribute"),R1(J.default,"appearance.default"),R1(X.key,"colorMode.key"),R1(X.attribute,"colorMode.attribute"),R1(X.default,"colorMode.default"),!H4.test(J.key)||!H4.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!W4.test(J.attribute)||!W4.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((Q)=>typeof Q!=="string"||Q.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(!pY.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 nY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function sY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${nY($)};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 oY($,Z){let J=1,X=null,Q=!1;for(let Y=Z+1;Y<$.length;Y++){let G=$[Y];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Y}return-1}function U4($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(J))!==null){let Y=Q.index+Q[0].length-1,G=oY(J,Y);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Y+1,G).trim(),K=Y0(`(${z})`,Z),q=sY(iY(K));J=J.slice(0,Q.index)+q+J.slice(G+1),X.lastIndex=Q.index+q.length}return J}import rY from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var p5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function aY($){return{...p5,...$.forms?.classes}}function W9($,Z,J,X){let Q=$||Z;return J?`${Q} ${X}`:Q}function g0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function h1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${A0(Z)}"`}function c5($,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="${A0(`${g0($)}-error`)}"`;return X}function tY(){return rY.randomUUID()}function PU($,Z,J,X){let Q=aY(X),Y=$;return Y=$Q(Y,Z),Y=R2(Y,Z),Y=i5(Y,Z,Q),Y=n5(Y,Z,Q),Y}function R2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=tY();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let Y=Q.toUpperCase();if(Q&&!["GET","POST"].includes(Y))return`<input type="hidden" name="_method" value="${A0(Y)}">`;return X}),J}function i5($,Z,J=p5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,Y,G,z,K,q="")=>{let H=Y||G||"POST",W=z||K||"",U=q1(q),j=H.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${A0(B)}" action="${A0(W)}"${U?` ${U}`:""}>`;if(V+=`
3172
3172
  ${R2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
3173
- ${R2(`@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 W=Q||G||"",H=z||K||"",U=q1(q),j=F2(W,Z),B=j!==void 0&&j!==null?j:H||"",V=U.match(/type=['"]([^'"]+)['"]/i),_=V?V[1]:"text",O=w2(W,Z),F=U.match(/class=['"]([^'"]+)['"]/i),L=K9(F?F[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(_)}" name="${A0(W)}"${h1(U,g0(W))} value="${A0(B)}" class="${L}"${c5(W,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=F2(Q,Z)||z.trim(),W=w2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=K9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(Q)}"${h1(K,g0(Q))} class="${U}"${c5(Q,W,K)}${j?` ${j}`:""}>${A0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=F2(Q,Z),W=w2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=K9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,_,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!_.includes("selected"))return _.replace(/(<option)/,"$1 selected");return V});return`<select name="${A0(Q)}"${h1(K,g0(Q))} class="${U}"${c5(Q,W,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?g0(Q):`${g0(Q)}-${g0(K)}`,W=q1(z),H=F2(Q,Z),U=H!==void 0&&(Array.isArray(H)?H.some((_)=>String(_)===K):H===!0||String(H)===K),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(Q)}"${h1(W,q)} value="${A0(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=F2(Q,Z),W=q!==void 0&&q===G,H=K.match(/class=['"]([^'"]+)['"]/i),U=H?H[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(Q)}"${h1(K,`${g0(Q)}-${g0(G)}`)} value="${A0(G)}" class="${U}"${W?" 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]:"",W=z.includes("multiple"),H=w2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=K9(U?U[1]:"",J.input,H,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${A0(Q)}"${h1(z,g0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${A0(q)}"`);if(W)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),W=q?q[1]:J.label,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(g0(Q))}" class="${W}"${H?` ${H}`:""}>${z}</label>`}),X}function n5($,Z,J=p5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(w2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return j4(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 j4(Y,Z)}let q=K.trim();if(j0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return`<div id="${A0(`${g0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function w2($,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 j4($,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 F2($,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 B4={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 SU($,Z){B4[$]=Z}function s5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function aY($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=s5(G),K=B4[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}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=aY(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function tY($,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=s5(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 V4={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 vU($){V4[$.name]=$}function eY($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=s5(Q),z=V4[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 xU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=eY($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function fU($,Z){let J=JSON.stringify(Z);return`
3173
+ ${R2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,Y,G,z,K,q="")=>{let H=Y||G||"",W=z||K||"",U=q1(q),j=F2(H,Z),B=j!==void 0&&j!==null?j:W||"",V=U.match(/type=['"]([^'"]+)['"]/i),_=V?V[1]:"text",O=w2(H,Z),F=U.match(/class=['"]([^'"]+)['"]/i),L=W9(F?F[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(_)}" name="${A0(H)}"${h1(U,g0(H))} value="${A0(B)}" class="${L}"${c5(H,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,Y,G="",z="")=>{let K=q1(G),q=F2(Y,Z)||z.trim(),H=w2(Y,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=W9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(Y)}"${h1(K,g0(Y))} class="${U}"${c5(Y,H,K)}${j?` ${j}`:""}>${A0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,Y,G="",z)=>{let K=q1(G),q=F2(Y,Z),H=w2(Y,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=W9(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,_,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!_.includes("selected"))return _.replace(/(<option)/,"$1 selected");return V});return`<select name="${A0(Y)}"${h1(K,g0(Y))} class="${U}"${c5(Y,H,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,Y,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?g0(Y):`${g0(Y)}-${g0(K)}`,H=q1(z),W=F2(Y,Z),U=W!==void 0&&(Array.isArray(W)?W.some((_)=>String(_)===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="${A0(Y)}"${h1(H,q)} value="${A0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,Y,G,z="")=>{let K=q1(z),q=F2(Y,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="${A0(Y)}"${h1(K,`${g0(Y)}-${g0(G)}`)} value="${A0(G)}" class="${U}"${H?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,Y,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",H=z.includes("multiple"),W=w2(Y,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=W9(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="${A0(Y)}"${h1(z,g0(Y))}`,`class="${j}"`];if(q)V.push(`accept="${A0(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,(Q,Y,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="${A0(g0(Y))}" class="${H}"${W?` ${W}`:""}>${z}</label>`}),X}function n5($,Z,J=p5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,Y)=>{try{if(w2(Q,Z)){let G=Y.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return j4(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return j4(Q,Z)}let q=K.trim();if(j0(q)){let H=Y0(q,Z);return H!==void 0?String(H):q}return q}catch{return K}});return`<div id="${A0(`${g0(Q)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function w2($,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 j4($,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 F2($,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,Q;while((Q=X.exec(J))!==null){let[,Y,,G]=Q;Z.push(`${Y}="${G.trim()}"`)}return Z.join(" ")}var B4={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($),Q=new Date(Z[0]);if(X>=Q)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Q=new Date(Z[0]);if(X<=Q)return`The ${J} field must be after ${Z[0]}.`;return null}};function vU($,Z){B4[$]=Z}function s5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function eY($,Z,J,X={}){let Q=[],Y=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Y){let z=s5(G),K=B4[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)Q.push(z.message||q)}return{field:$,valid:Q.length===0,errors:Q}}function xU($,Z){let J={};for(let[X,Q]of Object.entries(Z)){let Y=eY(X,$[X],Q,$);if(!Y.valid)J[X]=Y.errors}return J}function $Q($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Q,Y)=>{let G=Q.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=s5(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}:${Q} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var V4={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 Q of X)if(Q.endsWith("_confirmation")&&J[Q]===$)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 fU($){V4[$.name]=$}function ZQ($,Z,J={}){let X=[],Q=Z.split("|").map((Y)=>Y.trim());for(let Y of Q){let G=s5(Y),z=V4[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 gU($,Z){let J={},X=!0;for(let[Q,Y]of Object.entries(Z)){let G=ZQ($[Q],Y,$);if(!G.valid)X=!1,J[Q]=G.errors}return{valid:X,errors:J}}function hU($,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 N2=/<\/?template\b[^>]*>/gi,$Q=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function ZQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return $Q.test(Z)}function q9($){N2.lastIndex=0;let Z;while((Z=N2.exec($))!==null){if(Z[0].startsWith("</")||ZQ(Z[0]))continue;let J=Z.index,X=N2.lastIndex,Y=1,Q;while((Q=N2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:N2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import z0 from"path";import{existsSync as vQ}from"fs";import W9 from"fs";import V0 from"path";var L4=new Map;function H9($,Z=!0){let J=L4.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=W9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of K){let W=V0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,z+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let H=q.name.slice(0,-4);if(!X.has(H))X.set(H,W);let U=H.toLowerCase();if(!X.has(U))X.set(U,W);let j=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,W)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)L4.set($,X);return X}function U9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=V0.join(J,"node_modules",$);try{if(W9.statSync(X).isDirectory())return X}catch{}let Y=V0.dirname(J);if(Y===J)return null;J=Y}}function j9($,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 O4($){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 o5($,Z){let[J,X,Y]=O4($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*r5($,Z,J={},X){let Y=O4($);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 W9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let W of Q)yield V0.join(K,q.name,W)}catch{}}}function _4($,Z,J={},X){let Y=o5($,X);if(Y!==void 0)return Y;for(let Q of r5($,Z,J,X))try{if(W9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class F4{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=o5($,X);if(Y!==void 0)return Y;for(let Q of r5($,Z,J,X))if(await t(Q))return Q;return null}}var u1=new F4;function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var N1="\x00stx-boolean-attribute";function a5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function m1($,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(T0(Q));continue}if(Y===N1){J.push(T0(Q));continue}J.push(`${T0(Q)}="${T0(a5(String(Y)))}"`)}return J}function d1($,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(T0(Q));continue}if(typeof Y==="object")continue;J.push(`${T0(Q)}="${T0(a5(String(Y)))}"`)}return J}function l1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function JQ($){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 t5={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=JQ($),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="${l1(X.value)}"`);else K.push(`href="${l1(G2(X.value,"navigable"))}"`);if(Y)K.push(`class="${l1(Y)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${l1(Q)}"`),K.push(`data-stx-exact-active-class="${l1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${l1(q)}"`);let W=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...m1($,W)),K.push(...d1($,W)),`<a ${K.join(" ")}>${Z}</a>`}};import c1 from"fs";import e5 from"path";var XQ=new Set([".jpg",".jpeg",".png",".webp",".avif"]),i0=new Map,D1=!1;function $3($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return i0.get(Z)}function Yj(){return D1}function Qj(){i0.clear(),D1=!1}function Gj($,Z){i0.set($,Z),D1=!0}function YQ($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function QQ($){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 GQ($,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)),W=Math.floor(G*J/Y),H=Math.max(W+1,Math.floor((G+1)*J/Y)),U=0,j=0,B=0,V=0;for(let O=W;O<H;O++)for(let F=K;F<q;F++){let L=(O*Z+F)*4;U+=$[L],j+=$[L+1],B+=$[L+2],V++}let _=(O)=>Math.round(O/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${_(U)}${_(j)}${_(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 zQ($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function KQ($){try{return JSON.parse(c1.readFileSync($,"utf8"))}catch{return{}}}function qQ($,Z){try{c1.mkdirSync(e5.dirname($),{recursive:!0}),c1.writeFileSync($,JSON.stringify(Z))}catch{}}function D4($,Z,J=[]){let X;try{X=c1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=e5.join($,Y.name);if(Y.isDirectory()){D4(Q,`${Z}/${Y.name}`,J);continue}if(!XQ.has(e5.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function zj($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000,offThread:Q}=Z;if(!$||!c1.existsSync($))return D1=!0,i0.size;if(Q){let U=await N4("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Y}});if(U!==R4){for(let[j,B]of U.placeholders)i0.set(j,B);return D1=!0,i0.size}}let G;try{G=await import("ts-images")}catch{return D1=!0,i0.size}let z=J?KQ(J):{},K=!1,q=D4($,"").slice(0,Y),W=8,H=async([U,j])=>{let B;try{B=c1.statSync(j)}catch{return}if(B.size>X)return;let V=z[U];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let _=V.transparent;if(typeof _!=="boolean"&&w4(j)==="none")_=!1,z[U]={...V,transparent:_},K=!0;if(typeof _==="boolean"){i0.set(U,{dataUrl:V.dataUrl,color:V.color,transparent:_});return}}try{let{hash:_}=await G.generateThumbHash(j);if(!_)return;let{rgba:O,w:F,h:L}=G.thumbHashToRGBA(_),w={dataUrl:zQ(GQ(O,F,L)),color:QQ(O),transparent:YQ(O)};i0.set(U,w),z[U]={mtimeMs:B.mtimeMs,size:B.size,...w},K=!0}catch{}};for(let U=0;U<q.length;U+=W)await Promise.all(q.slice(U,U+W).map(H));if(J&&K)qQ(J,z);return D1=!0,i0.size}var WQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Z3=[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 B9($,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 HQ($){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 J3($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=WQ[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 X3($,Z,J,X){return Z.map((Y)=>`${D2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function UQ($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${D2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function D2($,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 jQ($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function BQ($,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 Y3={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Y=M4(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"),W=E0($,"densities"),H=E0($,"format"),U=A4(X)||$3(X)?.transparent===!0,j=E0($,"placeholder")||(Y&&!U?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),_=E0($,"class")||E0($,"className")||"",O=E0($,"style")||"",F=E0($,"quality"),L=B9($,"lazy",!0),w=B9($,"preload",!1),N=B9($,"priority",!1),R=E0($,"loading"),M=E0($,"decoding")||"async",T=!!Y||B9($,"picture",!1)||!!H,D=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,k=q||"",A="";if(Y)k=Y.sources[Y.fallback.format]||"",A=K?J3(K):"100vw";else if(!k&&K&&V&&V!=="local"&&V!=="static")k=X3(X,Z3,V,H),A=J3(K);else if(!k&&W){let J0=W.split(/\s+/).map((e)=>Number.parseFloat(e.replace("x","")));k=UQ(X,J0,D,V,H)}else if(K)A=J3(K);let E=[];if(O)E.push(O);if(D&&I)E.push(`aspect-ratio:${D}/${I}`);let C=[],y=j==="blur"||j==="color"||j==="thumbhash";if(y&&!U){let J0=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:$3(X);if(J0&&j==="color")E.push(`background-color:${J0.color}`),C.push("backgroundColor");else if(J0)E.push(`background-color:${J0.color}`),E.push(`background-image:url(${J0.dataUrl})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),C.push("backgroundColor","backgroundImage");else{let e=BQ(D||16,I||9,B);E.push(`background-image:url(${e})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),C.push("backgroundImage")}}else if(!y&&j&&j!=="empty"&&j!=="none")E.push(`background-image:url(${F0(j)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),C.push("backgroundImage");let b=Y?.fallback.url||D2(X,D,I,V,H),P=[];if(P.push(`src="${F0(G2(b,"fetched"))}"`),P.push(`alt="${F0(Q)}"`),G)P.push(`width="${F0(G)}"`);if(z)P.push(`height="${F0(z)}"`);let h=R||(N||w?"eager":L?"lazy":"");if(h)P.push(`loading="${F0(h)}"`);if(N)P.push('fetchpriority="high"');if(P.push(`decoding="${F0(M)}"`),_)P.push(`class="${F0(_)}"`);if(E.length>0)P.push(`style="${F0(E.join(";"))}"`);if(k)P.push(`srcset="${F0(G2(k,"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 J0=typeof $.static.onload==="string"?$.static.onload:"",e=jQ(C)+(J0?`;${J0}`:"");P.push(`onload="${F0(e)}"`),p.add("onload")}P.push(...m1($,p)),P.push(...d1($,p));let g=`<img ${P.join(" ")} />`,Z0="";if(w){let e=H==="webp"?"image/webp":H==="avif"?"image/avif":"";Z0=`<link rel="preload" as="image" href="${F0(b)}"${e?` type="${e}"`:""}${k?` imagesrcset="${F0(k)}"`:""}${A?` imagesizes="${F0(A)}"`:""} />
3226
- `}if(T){let J0=[];if(Y)for(let e of HQ(Y))J0.push(`<source type="image/${e.format}" srcset="${F0(e.srcset)}"${A?` sizes="${F0(A)}"`:""} />`);if(!Y&&(H==="avif"||H==="auto")){let e=D2(X,D,I,V,"avif"),i=k?X3(X,Z3,V,"avif"):`${e}`;J0.push(`<source type="image/avif" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}if(!Y&&(H==="webp"||H==="auto")){let e=D2(X,D,I,V,"webp"),i=k?X3(X,Z3,V,"webp"):`${e}`;J0.push(`<source type="image/webp" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}return`${Z0}<picture>
3225
+ </script>`.trim()}var N2=/<\/?template\b[^>]*>/gi,JQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function XQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return JQ.test(Z)}function H9($){N2.lastIndex=0;let Z;while((Z=N2.exec($))!==null){if(Z[0].startsWith("</")||XQ(Z[0]))continue;let J=Z.index,X=N2.lastIndex,Q=1,Y;while((Y=N2.exec($))!==null)if(Y[0].startsWith("</")){if(Q--,Q===0){let G=Y.index;return{start:J,openEnd:X,closeStart:G,end:N2.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}import z0 from"path";import{existsSync as fQ}from"fs";import U9 from"fs";import V0 from"path";var L4=new Map;function j9($,Z=!0){let J=L4.get($);if(Z&&J)return J;let X=new Map,Q=[V0.join($,"src"),V0.join($,"dist"),$];function Y(G,z){if(z>6)return;let K;try{K=U9.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;Y(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 Q)if(Y(G,0),X.size>0)break;if(Z)L4.set($,X);return X}function B9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=V0.join(J,"node_modules",$);try{if(U9.statSync(X).isDirectory())return X}catch{}let Q=V0.dirname(J);if(Q===J)return null;J=Q}}function V9($,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 O4($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Q)=>Q.charAt(0).toUpperCase()+Q.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function o5($,Z){let[J,X,Q]=O4($);for(let Y of[J,J.toLowerCase(),X,Q]){let G=Z?.__importedComponents?.get(Y);if(G!==void 0)return G}}function*r5($,Z,J={},X){let Q=O4($);if(Q[0].startsWith("./")||Q[0].startsWith("../")){yield V0.resolve(V0.dirname(Z),`${Q[0]}.stx`);return}let Y=[...new Set(Q.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 Y)yield V0.join(K,q);try{for(let q of U9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let H of Y)yield V0.join(K,q.name,H)}catch{}}}function _4($,Z,J={},X){let Q=o5($,X);if(Q!==void 0)return Q;for(let Y of r5($,Z,J,X))try{if(U9.statSync(Y,{throwIfNoEntry:!1})?.isFile())return Y}catch{}return null}class F4{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 Q=o5($,X);if(Q!==void 0)return Q;for(let Y of r5($,Z,J,X))if(await t(Y))return Y;return null}}var u1=new F4;function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var N1="\x00stx-boolean-attribute";function a5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function m1($,Z){let J=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let Y=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)J.push(T0(Y));continue}if(Q===N1){J.push(T0(Y));continue}J.push(`${T0(Y)}="${T0(a5(String(Q)))}"`)}return J}function d1($,Z){let J=[];for(let[X,Q]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Q===null||Q===void 0||Q===!1)continue;let Y=$.serverDynamicNames?.[X]??X;if(Q===!0){J.push(T0(Y));continue}if(typeof Q==="object")continue;J.push(`${T0(Y)}="${T0(a5(String(Q)))}"`)}return J}function l1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YQ($){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 t5={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=YQ($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Y=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="${l1(X.value)}"`);else K.push(`href="${l1(G2(X.value,"navigable"))}"`);if(Q)K.push(`class="${l1(Q)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${l1(Y)}"`),K.push(`data-stx-exact-active-class="${l1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${l1(q)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...m1($,H)),K.push(...d1($,H)),`<a ${K.join(" ")}>${Z}</a>`}};import c1 from"fs";import e5 from"path";var QQ=new Set([".jpg",".jpeg",".png",".webp",".avif"]),i0=new Map,D1=!1;function $3($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return i0.get(Z)}function Gj(){return D1}function zj(){i0.clear(),D1=!1}function Kj($,Z){i0.set($,Z),D1=!0}function GQ($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function zQ($){let Z=0,J=0,X=0,Q=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Q++;if(Q===0)return"#e5e7eb";let Y=(G)=>Math.round(G/Q).toString(16).padStart(2,"0");return`#${Y(Z)}${Y(J)}${Y(X)}`}function KQ($,Z,J,X=4,Q=3){let Y=[];for(let G=0;G<Q;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/Q),W=Math.max(H+1,Math.floor((G+1)*J/Q)),U=0,j=0,B=0,V=0;for(let O=H;O<W;O++)for(let F=K;F<q;F++){let L=(O*Z+F)*4;U+=$[L],j+=$[L+1],B+=$[L+2],V++}let _=(O)=>Math.round(O/V).toString(16).padStart(2,"0");Y.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${_(U)}${_(j)}${_(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Q}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Y.join("")}</g></svg>`}function qQ($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function WQ($){try{return JSON.parse(c1.readFileSync($,"utf8"))}catch{return{}}}function HQ($,Z){try{c1.mkdirSync(e5.dirname($),{recursive:!0}),c1.writeFileSync($,JSON.stringify(Z))}catch{}}function D4($,Z,J=[]){let X;try{X=c1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Q of X){let Y=e5.join($,Q.name);if(Q.isDirectory()){D4(Y,`${Z}/${Q.name}`,J);continue}if(!QQ.has(e5.extname(Q.name).toLowerCase()))continue;J.push([`${Z}/${Q.name}`,Y])}return J}async function qj($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Q=2000,offThread:Y}=Z;if(!$||!c1.existsSync($))return D1=!0,i0.size;if(Y){let U=await N4("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Q}});if(U!==R4){for(let[j,B]of U.placeholders)i0.set(j,B);return D1=!0,i0.size}}let G;try{G=await import("ts-images")}catch{return D1=!0,i0.size}let z=J?WQ(J):{},K=!1,q=D4($,"").slice(0,Q),H=8,W=async([U,j])=>{let B;try{B=c1.statSync(j)}catch{return}if(B.size>X)return;let V=z[U];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let _=V.transparent;if(typeof _!=="boolean"&&w4(j)==="none")_=!1,z[U]={...V,transparent:_},K=!0;if(typeof _==="boolean"){i0.set(U,{dataUrl:V.dataUrl,color:V.color,transparent:_});return}}try{let{hash:_}=await G.generateThumbHash(j);if(!_)return;let{rgba:O,w:F,h:L}=G.thumbHashToRGBA(_),w={dataUrl:qQ(KQ(O,F,L)),color:zQ(O),transparent:GQ(O)};i0.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)HQ(J,z);return D1=!0,i0.size}var UQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Z3=[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 L9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function jQ($){let Z=(X)=>$.variants.filter((Q)=>Q.format===X).reduce((Q,Y)=>Q+Y.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,Q)=>X.bytes-Q.bytes).map(({format:X,srcset:Q})=>({format:X,srcset:Q}))}function J3($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Q,Y]=X.split(":"),G=UQ[Q];if(G)J.push(`(max-width: ${G}px) ${Y}`);else{let z=Number.parseInt(Q);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Y}`)}}else J.push(X);return J.join(", ")}function X3($,Z,J,X){return Z.map((Q)=>`${D2($,Q,void 0,J,X)} ${Q}w`).join(", ")}function BQ($,Z,J,X,Q){return Z.map((Y)=>{let G=J?J*Y:void 0;return`${D2($,G,void 0,X,Q)} ${Y}x`}).join(", ")}function D2($,Z,J,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Y=[];if(Z)Y.push(`w_${Z}`);if(J)Y.push(`h_${J}`);if(Q)Y.push(`f_${Q}`);Y.push("q_auto");let G=Y.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Y=new URLSearchParams;if(Z)Y.set("w",String(Z));if(J)Y.set("h",String(J));if(Q)Y.set("fm",Q);Y.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Y.toString()}`}if(X==="bunny"){let Y=new URLSearchParams;if(Z)Y.set("width",String(Z));if(J)Y.set("height",String(J));if(Q)Y.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${Y.toString()}`}return $}function VQ($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function LQ($,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 Y3={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Q=M4(X),Y=E0($,"alt")||"",G=E0($,"width")||(Q?String(Q.source.width):void 0),z=E0($,"height")||(Q?String(Q.source.height):void 0),K=E0($,"sizes"),q=E0($,"srcset"),H=E0($,"densities"),W=E0($,"format"),U=A4(X)||$3(X)?.transparent===!0,j=E0($,"placeholder")||(Q&&!U?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),_=E0($,"class")||E0($,"className")||"",O=E0($,"style")||"",F=E0($,"quality"),L=L9($,"lazy",!0),w=L9($,"preload",!1),N=L9($,"priority",!1),R=E0($,"loading"),M=E0($,"decoding")||"async",T=!!Q||L9($,"picture",!1)||!!W,D=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,k=q||"",A="";if(Q)k=Q.sources[Q.fallback.format]||"",A=K?J3(K):"100vw";else if(!k&&K&&V&&V!=="local"&&V!=="static")k=X3(X,Z3,V,W),A=J3(K);else if(!k&&H){let J0=H.split(/\s+/).map((e)=>Number.parseFloat(e.replace("x","")));k=BQ(X,J0,D,V,W)}else if(K)A=J3(K);let E=[];if(O)E.push(O);if(D&&I)E.push(`aspect-ratio:${D}/${I}`);let C=[],y=j==="blur"||j==="color"||j==="thumbhash";if(y&&!U){let J0=Q?.placeholder?{dataUrl:Q.placeholder.dataUrl,color:B}:$3(X);if(J0&&j==="color")E.push(`background-color:${J0.color}`),C.push("backgroundColor");else if(J0)E.push(`background-color:${J0.color}`),E.push(`background-image:url(${J0.dataUrl})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),C.push("backgroundColor","backgroundImage");else{let e=LQ(D||16,I||9,B);E.push(`background-image:url(${e})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),C.push("backgroundImage")}}else if(!y&&j&&j!=="empty"&&j!=="none")E.push(`background-image:url(${F0(j)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),C.push("backgroundImage");let b=Q?.fallback.url||D2(X,D,I,V,W),P=[];if(P.push(`src="${F0(G2(b,"fetched"))}"`),P.push(`alt="${F0(Y)}"`),G)P.push(`width="${F0(G)}"`);if(z)P.push(`height="${F0(z)}"`);let h=R||(N||w?"eager":L?"lazy":"");if(h)P.push(`loading="${F0(h)}"`);if(N)P.push('fetchpriority="high"');if(P.push(`decoding="${F0(M)}"`),_)P.push(`class="${F0(_)}"`);if(E.length>0)P.push(`style="${F0(E.join(";"))}"`);if(k)P.push(`srcset="${F0(G2(k,"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 J0=typeof $.static.onload==="string"?$.static.onload:"",e=VQ(C)+(J0?`;${J0}`:"");P.push(`onload="${F0(e)}"`),p.add("onload")}P.push(...m1($,p)),P.push(...d1($,p));let g=`<img ${P.join(" ")} />`,Z0="";if(w){let e=W==="webp"?"image/webp":W==="avif"?"image/avif":"";Z0=`<link rel="preload" as="image" href="${F0(b)}"${e?` type="${e}"`:""}${k?` imagesrcset="${F0(k)}"`:""}${A?` imagesizes="${F0(A)}"`:""} />
3226
+ `}if(T){let J0=[];if(Q)for(let e of jQ(Q))J0.push(`<source type="image/${e.format}" srcset="${F0(e.srcset)}"${A?` sizes="${F0(A)}"`:""} />`);if(!Q&&(W==="avif"||W==="auto")){let e=D2(X,D,I,V,"avif"),i=k?X3(X,Z3,V,"avif"):`${e}`;J0.push(`<source type="image/avif" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}if(!Q&&(W==="webp"||W==="auto")){let e=D2(X,D,I,V,"webp"),i=k?X3(X,Z3,V,"webp"):`${e}`;J0.push(`<source type="image/webp" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}return`${Z0}<picture>
3227
3227
  ${J0.join(`
3228
3228
  `)}
3229
3229
  ${g}
3230
- </picture>`}return`${Z0}${g}`}};var I4="/images/safe-image-default.svg";function M2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var VQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${I4}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Q3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=p1($,"src")||"",Y=p1($,"alt")||"",Q=p1($,"fallback")||I4,G=p1($,"class")||p1($,"className")||"",z=p1($,"fallbackClassName")||"",K=[];if(K.push(`src="${M2(X)}"`),K.push(`alt="${M2(Y)}"`),G)K.push(`class="${M2(G)}"`);if(K.push(`data-fallback="${M2(Q)}"`),z)K.push(`data-fallback-class="${M2(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...m1($,q)),K.push(...d1($,q));let W=`<img ${K.join(" ")} />`,H=J.context;if(!H.__safeImageHandlerEmitted)return H.__safeImageHandlerEmitted=!0,`${VQ}${W}`;return W}};function G3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function A2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function V9($,Z,J){let X=A2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var z3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=G3(A2($,"color")||"#6366f1"),Y=G3(A2($,"initialColor")||A2($,"initial-color")||""),Q=G3(A2($,"height")||"3px"),G=V9($,"duration",2000),z=V9($,"throttle",200),K=V9($,"zIndex",999999)||V9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
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">
3230
+ </picture>`}return`${Z0}${g}`}};var I4="/images/safe-image-default.svg";function M2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var OQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${I4}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Q3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=p1($,"src")||"",Q=p1($,"alt")||"",Y=p1($,"fallback")||I4,G=p1($,"class")||p1($,"className")||"",z=p1($,"fallbackClassName")||"",K=[];if(K.push(`src="${M2(X)}"`),K.push(`alt="${M2(Q)}"`),G)K.push(`class="${M2(G)}"`);if(K.push(`data-fallback="${M2(Y)}"`),z)K.push(`data-fallback-class="${M2(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...m1($,q)),K.push(...d1($,q));let H=`<img ${K.join(" ")} />`,W=J.context;if(!W.__safeImageHandlerEmitted)return W.__safeImageHandlerEmitted=!0,`${OQ}${H}`;return H}};function G3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function A2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function O9($,Z,J){let X=A2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return J}var z3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=G3(A2($,"color")||"#6366f1"),Q=G3(A2($,"initialColor")||A2($,"initial-color")||""),Y=G3(A2($,"height")||"3px"),G=O9($,"duration",2000),z=O9($,"throttle",200),K=O9($,"zIndex",999999)||O9($,"z-index",999999),q=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3231
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Y};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 k4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function LQ($,Z,J){let X=k4($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var T4={"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%)"},K3={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=T0(k4($,"position")||"top-right"),Y=LQ($,"max",5),Q=T4[X]||T4["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 k4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function _Q($,Z,J){let X=k4($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return J}var T4={"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%)"},K3={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=T0(k4($,"position")||"top-right"),Q=_Q($,"max",5),Y=T4[X]||T4["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${Y};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 @@ ${g}
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 L9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var E4={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)"},q3={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=L9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=T0(X),Q=L9($,"size")||"md",G=L9($,"closeOnBackdrop")!=="false",z=L9($,"closeOnEscape")!=="false",K=E4[Q]||E4.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 _9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var E4={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)"},q3={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=_9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=T0(X),Y=_9($,"size")||"md",G=_9($,"closeOnBackdrop")!=="false",z=_9($,"closeOnEscape")!=="false",K=E4[Y]||E4.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" 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,8 +3251,8 @@ ${g}
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 i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var b4={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},W3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=i1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=T0(X),Q=i1($,"side")||"right",G=i1($,"size")||"md",z=i1($,"closeOnBackdrop")!=="false",K=i1($,"closeOnEscape")!=="false",q=i1($,"overlay")!=="false",W=b4[G]||b4.md,H=Q==="left",U=H?"left:0":"right:0",j=H?"translateX(-100%)":"translateX(100%)",B=H?"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
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${U};width:${W};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">
3254
+ </style>`}};function i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var b4={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},W3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=i1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=T0(X),Y=i1($,"side")||"right",G=i1($,"size")||"md",z=i1($,"closeOnBackdrop")!=="false",K=i1($,"closeOnEscape")!=="false",q=i1($,"overlay")!=="false",H=b4[G]||b4.md,W=Y==="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-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" 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
+ <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>
3258
3258
  </div>
@@ -3260,7 +3260,7 @@ ${g}
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 OQ,readFileSync as _Q}from"fs";var M1=new Map,y4=new Set;function C4($){if(y4.has($))return;y4.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function S4($){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(OQ(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function FQ($){if(M1.has($))return M1.get($);let Z=S4($);if(!Z)return C4($),null;try{let J=JSON.parse(_Q(Z,"utf8"));return M1.set($,J.icons),J.icons}catch{return null}}async function wQ($,Z=!1){if(M1.has($))return M1.get($);let J=S4($);if(!J){if(!Z)C4($);return null}try{let X=await Bun.file(J).json();return M1.set($,X.icons),X.icons}catch{return null}}function n1($,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 H3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=n1($,"name")??n1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let F=X.split(":");Y=F[0],Q=F[1]}let G=T0(n1($,"size")||"24"),z=T0(n1($,"color")||"currentColor"),K=T0(n1($,"class")||""),q=T0(n1($,"style")||""),W=M1.get(Y)??FQ(Y);if(!W)return`<!-- Icon: collection "${Y}" not loaded -->`;let H=W[Q];if(!H)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let U=H.width||24,j=H.height||24,B=`0 0 ${U} ${j}`,V=H.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let _=K?` class="${K}"`:"",O=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${_}${O}>${V}</svg>`}};async function RQ($="lucide",Z={}){await wQ($,Z.speculative??!0)}function U3(){return`
3263
+ </style>`}};import{existsSync as FQ,readFileSync as wQ}from"fs";var M1=new Map,y4=new Set;function C4($){if(y4.has($))return;y4.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function S4($){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(FQ(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function RQ($){if(M1.has($))return M1.get($);let Z=S4($);if(!Z)return C4($),null;try{let J=JSON.parse(wQ(Z,"utf8"));return M1.set($,J.icons),J.icons}catch{return null}}async function NQ($,Z=!1){if(M1.has($))return M1.get($);let J=S4($);if(!J){if(!Z)C4($);return null}try{let X=await Bun.file(J).json();return M1.set($,X.icons),X.icons}catch{return null}}function n1($,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 H3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=n1($,"name")??n1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",Y=X;if(X.includes(":")){let F=X.split(":");Q=F[0],Y=F[1]}let G=T0(n1($,"size")||"24"),z=T0(n1($,"color")||"currentColor"),K=T0(n1($,"class")||""),q=T0(n1($,"style")||""),H=M1.get(Q)??RQ(Q);if(!H)return`<!-- Icon: collection "${Q}" not loaded -->`;let W=H[Y];if(!W)return`<!-- Icon: "${Y}" not found in ${Q} -->`;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 _=K?` class="${K}"`:"",O=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${_}${O}>${V}</svg>`}};async function DQ($="lucide",Z={}){await NQ($,Z.speculative??!0)}function U3(){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 P4($,...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 v4($,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 j3={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=v4(Z,"fallback"),Y=X.rest,Q=v4(Y,"error"),G=Q.rest,z=X.region??P4($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??P4($,"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 O9($,...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 B3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(O9($,"name")||"v").replace(/["'<>]/g,""),Y=(O9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=O9($,"class"),G=O9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function x4($=u1){$.registerBuiltin(t5),$.registerBuiltin(Y3),$.registerBuiltin(Q3),$.registerBuiltin(z3),$.registerBuiltin(K3),$.registerBuiltin(q3),$.registerBuiltin(W3),$.registerBuiltin(H3),$.registerBuiltin(j3),$.registerBuiltin(B3)}function _9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var f4=new Map;function NQ($){let Z=f4.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),f4.set($.source,Z);return Z}var g4=new WeakMap;function h4($){let Z=g4.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),g4.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function u4($,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=NQ(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Y=G+1;continue}let q=K[1];if(Q&&Q(q)){let _=G+1+q.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=G+1+q.length,H=null,U=W,j=-1,B=!1;while(W<$.length){let _=$[W];if(H){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===H)H=null;W++;continue}if(_==='"'||_==="'"){H=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(_===">"){j=W+1;break}W++}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 _=`<${q}`,O=`</${q}>`,F=1,L=j,w=-1;while(F>0&&L<$.length){let M=$.indexOf(_,L),T=$.indexOf(O,L);if(T===-1)break;if(M!==-1&&M<T){let D=$[M+_.length];if(D===" "||D===">"||D==="/"||D===`
3367
- `||D==="\t")F++;L=M+_.length}else{if(F--,F===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let N=$.slice(j,w),R=w+O.length;X.push({fullMatch:$.slice(G,R),tagName:q,attributes:V,content:N,startIndex:G,endIndex:R,isSelfClosing:!1}),Y=R}}return X}function m4($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function d4($,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 V3($,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 l4($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(V3(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var DQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),MQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function L3($){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("/>")||MQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let W=1,H=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(W--,W===0){H=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))W++;Z.push([Q,H])}return Z}function p4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>p4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function i4($,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(...L3($));function G(H){return Y.some(([U,j])=>H>=U&&H<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,K=[],q=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let H=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,_=!1;while((B=j.exec(U))!==null){let O=B[1],F=B[2];if(c4(O))continue;if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),N=F.match(/^([a-zA-Z_$][\w$]*)/);if(N&&!L.includes(N[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(N[1]))continue;let R=JSON.stringify([L,F]),M=q.get(R);if(!M){if(M=Function(...L,`return (${F})`),q.size>=W)q.clear();q.set(R,M)}let T=M(...w);if(O==="class"){let D=p4(T);if(D){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${D}"`);else V=V.replace(B[0],` class="${D}"`)}else V=V.replace(B[0],"");_=!0;continue}if(DQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");_=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let D=String(T).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");V=V.replace(B[0],` ${O}="${D}"`)}_=!0}catch{continue}}if(_){let O=H.endsWith("/>")?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+H.length,replacement:L})}}if(K.length>0){let H=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:_}=K[j];H[j*2]=J.slice(U,B),H[j*2+1]=_,U=V}H[K.length*2]=J.slice(U),J=H.join("")}return J}import n4 from"fs";import s4 from"path";var I2=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 T2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...I2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return I2.has($)||/[A-Z]/.test($)}var o4=!1;function AQ($,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=(W)=>{if(Q.size===0)return!1;let H=H0(W),U=H.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(H))return!0}return!1},z=new Set(t4),K=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(H,U)=>U.toUpperCase())},q=(W,H)=>{let U=K(W);if(Y.static[U]=H,U!==W)Y.staticNames[U]=W};for(let[W,H]of Object.entries($)){let U=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(U.startsWith("@")){Y.events[U]=H;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=d4(H,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=H===N1?j:H;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(!j0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=W0(B,V)(...Object.values(Z));if(O===void 0){let F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(w9(B).some((w)=>!F.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 H==="string"&&H.includes("{{")&&H.includes("}}")){let j=H.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(j0(B)){let _=W0(B,Object.keys(Z))(...Object.values(Z));q(U,_!=null?String(_):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,H)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,H)}else{let B=H,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=V.exec(H))!==null)try{let O=_[1];if(!j0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=W0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,H===N1?"true":m4(H))}return Y}var IQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function TQ($,Z,J){if(!$.includes("@"))return $;if(!IQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return r0($,Z,J)}catch{return $}}function kQ($){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=V3($,J),J+=Q.length;let G=l4(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 r4($){return Object.entries($).map(([Z,J])=>J===N1?Z:`${Z}="${EQ(J)}"`).join(" ")}function EQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bQ($){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(u1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function yQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=s4.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of $.matchAll(K)){let[U,j,B]=H,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=B,O,F=[];while((O=V.exec(B))!==null){let[L,w,N,R]=O,M=null,T=null;if(R.startsWith(".")||R.startsWith("/")){let k=s4.resolve(G,R);if(k.endsWith(".stx"))T=k;else{let A=`${k}.stx`;try{if(n4.statSync(A).isFile())T=A}catch{try{if(n4.statSync(k).isDirectory())M=k}catch{}}}}else M=U9(R,G);if(!M&&!T)continue;let D=!1,I=(k,A)=>{Q.set(k,A),Q.set(k.toLowerCase(),A);let E=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,A),Y.add(A)};if(N&&T)I(N,T),D=!0;else if(w){let k=w.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let C=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C)return{source:C[1],local:C[2]};return{source:E,local:E}}),A=M?H9(M):null;for(let{source:E,local:C}of k){let y=null;if(T)y=T;else if(A)y=A.get(E)??A.get(E.toLowerCase())??A.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(y)I(C,y),D=!0}}if(D)F.push({start:O.index,end:O.index+L.length})}if(F.length===0)continue;for(let L=F.length-1;L>=0;L--)_=_.slice(0,F[L].start)+_.slice(F[L].end);z.push({start:H.index,end:H.index+U.length,value:`<script${j}>${_}</script>`})}if(z.length===0)return $;let q=[],W=0;for(let H of z)q.push($.slice(W,H.start),H.value),W=H.end;return q.push($.slice(W)),q.join("")}async function CQ($,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,W]=K,H=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of H){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),_=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,F=j9(U,J,X);for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(_,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${_} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function SQ($,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 W=q.index,H=W+q[0].length-1,U=1,j=H+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(H+1,j),V=j+1,_=B.match(/^\s*['"]([^'"]+)['"]/);if(!_){K.lastIndex=0;continue}let O=_[1],F,L=B.slice(_[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let N={};if(F)try{N=d0(F,Z)}catch(k){let A=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${A}]`);continue}let R="",M=V,D=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(D)R=D[1].trim(),M=V+D[0].length;let I=await A1(O,N,R,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(M),K.lastIndex=0}return Q}async function PQ($,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=L3(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,h4(I2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,I2),Q=K.restore(Q),Q;async function j(B,V,_,O){if(!B)return B;let F=B,L=u4(F,V,O),w=new Map;for(let M=L.length-1;M>=0;M--){let T=L[M],D=_?_9(T.tagName):T.tagName,I=kQ(TQ(T.attributes,Z,J)),k=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=AQ(I,Z,X,k),E=u1.getBuiltin(T.tagName),C=E?await F9(D,G,Z,J,X):!1;if(E&&!C){let h={context:Z,filePath:J,options:X,dependencies:Y},p=E.render(A,T.content,h);if(Object.keys(A.events).length>0){let g=r4(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${g}`)}if(Object.keys(A.clientReactive).length>0)p=a4(p,A.clientReactive);w.set(M,p);continue}if(!_&&T.tagName.includes("-")&&!await F9(D,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 A1(D,y,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=e4(P);if(h){let p=r4(A.events),g=Object.keys(A.events).map((Z0)=>Z0.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${g}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=a4(P,A.clientReactive);w.set(M,P)}if(w.size===0)return F;let N="",R=0;for(let M=0;M<L.length;M++){let T=w.get(M);if(T===void 0)continue;N+=F.slice(R,L[M].startIndex),N+=T,R=L[M].endIndex}return N+=F.slice(R),N}}function a4($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>_9(W)).join(" "),G=$,z=Y.length>0?e4(G):null;if(z){let W=Y.map(([U,j])=>`:${_9(U)}="${j.replace(/"/g,"&quot;")}"`).join(" "),H=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${H} ${W}`+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 e4($){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 O3($,Z,J,X,Y){if(!o4)x4(u1),o4=!0;let Q=await yQ($,Z,J,X,Y);Q=await CQ(Q,Z,J,X,Y),Q=await SQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=B1(Q,R9,(H,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let W=Q;if(Q=await PQ(q.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=bQ(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 _3($,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 xQ($,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 W=X.substring(z+1,q-1),H=`${J}(${W})`;X=X.substring(0,G)+H+X.substring(q),Y.lastIndex=G+H.length,Q=Y.exec(X)}return X}function fQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function X6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(H)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===H){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 H=1;while(Q<G&&H>0)if(Z[Q]==="{")H++,Q++;else if(Z[Q]==="}")H--,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},W=()=>{if(Y!==0)return;let H=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[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])))W();Q++}return J.join(", ")}function gQ($,Z=""){let J=X6($).split(",").map((X)=>X.trim()).filter(Boolean);return`
3366
+ `}function P4($,...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 v4($,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 j3={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=v4(Z,"fallback"),Q=X.rest,Y=v4(Q,"error"),G=Y.rest,z=X.region??P4($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Y.region??P4($,"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 F9($,...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 B3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(F9($,"name")||"v").replace(/["'<>]/g,""),Q=(F9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Y=F9($,"class"),G=F9($,"id"),z=[`data-stx-transition-group="${X}"`,Y?`class="${Y}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${z}>${Z}</${Q}>`}};function x4($=u1){$.registerBuiltin(t5),$.registerBuiltin(Y3),$.registerBuiltin(Q3),$.registerBuiltin(z3),$.registerBuiltin(K3),$.registerBuiltin(q3),$.registerBuiltin(W3),$.registerBuiltin(H3),$.registerBuiltin(j3),$.registerBuiltin(B3)}function w9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var f4=new Map;function MQ($){let Z=f4.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),f4.set($.source,Z);return Z}var g4=new WeakMap;function h4($){let Z=g4.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),g4.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function u4($,Z,J){let X=[],Q=0,Y=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Q<$.length){let G=$.indexOf("<",Q);if(G===-1)break;let z=MQ(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Q=G+1;continue}let q=K[1];if(Y&&Y(q)){let _=G+1+q.length;while(_<$.length&&$[_]!==">")_++;Q=_+1;continue}let H=G+1+q.length,W=null,U=H,j=-1,B=!1;while(H<$.length){let _=$[H];if(W){if(_==="\\"&&H+1<$.length){H+=2;continue}if(_===W)W=null;H++;continue}if(_==='"'||_==="'"){W=_,H++;continue}if(_==="/"&&H+1<$.length&&$[H+1]===">"){j=H+2,B=!0;break}if(_===">"){j=H+1;break}H++}if(j===-1){Q=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}),Q=j;else{let _=`<${q}`,O=`</${q}>`,F=1,L=j,w=-1;while(F>0&&L<$.length){let M=$.indexOf(_,L),T=$.indexOf(O,L);if(T===-1)break;if(M!==-1&&M<T){let D=$[M+_.length];if(D===" "||D===">"||D==="/"||D===`
3367
+ `||D==="\t")F++;L=M+_.length}else{if(F--,F===0){w=T;break}L=T+O.length}}if(w===-1){Q=j;continue}let N=$.slice(j,w),R=w+O.length;X.push({fullMatch:$.slice(G,R),tagName:q,attributes:V,content:N,startIndex:G,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function m4($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function d4($,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 V3($,Z){let J=0,X="",Q=Z;while(Q<$.length){let Y=$[Q];if(X){if(Y==="\\")Q++;else if(Y===X)X=""}else if(Y==='"'||Y==="'"||Y==="`")X=Y;else if(Y==="{")J++;else if(Y==="}"){if(J--,J===0)return $.slice(Z,Q+1)}Q++}return $.slice(Z)}function l4($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(V3(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var AQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),IQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function L3($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Q=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Q))continue;let Y=X.index,G=Y+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||IQ.has(z)){Z.push([Y,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([Y,W])}return Z}function p4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>p4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function i4($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],Y;while((Y=X.exec($))!==null)Q.push([Y.index,Y.index+Y[0].length]);Q.push(...L3($));function G(W){return Q.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((Y=z.exec(J))!==null){if(G(Y.index))continue;let W=Y[0],U=Y[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,_=!1;while((B=j.exec(U))!==null){let O=B[1],F=B[2];if(c4(O))continue;if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),N=F.match(/^([a-zA-Z_$][\w$]*)/);if(N&&!L.includes(N[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(N[1]))continue;let R=JSON.stringify([L,F]),M=q.get(R);if(!M){if(M=Function(...L,`return (${F})`),q.size>=H)q.clear();q.set(R,M)}let T=M(...w);if(O==="class"){let D=p4(T);if(D){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${D}"`);else V=V.replace(B[0],` class="${D}"`)}else V=V.replace(B[0],"");_=!0;continue}if(AQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");_=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let D=String(T).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");V=V.replace(B[0],` ${O}="${D}"`)}_=!0}catch{continue}}if(_){let O=W.endsWith("/>")?" /":"",L=`<${Y[1]}${V}${O}>`;K.push({start:Y.index,end:Y.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:_}=K[j];W[j*2]=J.slice(U,B),W[j*2+1]=_,U=V}W[K.length*2]=J.slice(U),J=W.join("")}return J}import n4 from"fs";import s4 from"path";var I2=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 T2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...I2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return I2.has($)||/[A-Z]/.test($)}var o4=!1;function TQ($,Z,J,X=!1){let Q={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(H)=>{if(Y.size===0)return!1;let W=H0(H),U=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Y.has(U))return!0;for(let j of Y){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},z=new Set(t4),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(Q.static[U]=W,U!==H)Q.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("@")){Q.events[U]=W;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Q.serverDynamic[j]=d4(W,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=W===N1?j:W;if(j==="if"||j==="for"||j==="show"){Q.clientReactive[j]=B;continue}if(X){Q.clientReactive[j]=B;continue}if(G(B)){Q.clientReactive[j]=B;continue}try{if(!j0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Q.clientReactive[j]=B;continue}let V=Object.keys(Z),O=W0(B,V)(...Object.values(Z));if(O===void 0){let F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(N9(B).some((w)=>!F.has(w)&&!V.includes(w))){Q.clientReactive[j]=B;continue}}if(Q.serverDynamic[j]=O,j!==U.slice(1)&&Q.serverDynamicNames)Q.serverDynamicNames[j]=U.slice(1)}catch{Q.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(j0(B)){let _=W0(B,Object.keys(Z))(...Object.values(Z));q(U,_!=null?String(_):"")}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,_;while((_=V.exec(W))!==null)try{let O=_[1];if(!j0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=W0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(_[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":m4(W))}return Q}var kQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function EQ($,Z,J){if(!$.includes("@"))return $;if(!kQ.some(([Q,Y])=>Q.test($)&&$.includes(Y)))return $;try{return r0($,Z,J)}catch{return $}}function bQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Q="";while(J<X&&!/[\s=]/.test($[J]))Q+=$[J],J++;if(!Q)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Y="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Y+=$[J],J++;continue}if(z===G){J++;break}Y+=z,J++}}else if($[J]==="{"){Y=V3($,J),J+=Y.length;let G=l4(Y);if(G!==null){Z[`:${Q}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Y+=$[J],J++;Z[Q]=Y}else Z[Q]=N1}return Z}function r4($){return Object.entries($).map(([Z,J])=>J===N1?Z:`${Z}="${yQ(J)}"`).join(" ")}function yQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function CQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Q=X[1];if(u1.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}async function SQ($,Z,J,X,Q){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Y=Z.__importedComponents,G=s4.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,_=B,O,F=[];while((O=V.exec(B))!==null){let[L,w,N,R]=O,M=null,T=null;if(R.startsWith(".")||R.startsWith("/")){let k=s4.resolve(G,R);if(k.endsWith(".stx"))T=k;else{let A=`${k}.stx`;try{if(n4.statSync(A).isFile())T=A}catch{try{if(n4.statSync(k).isDirectory())M=k}catch{}}}}else M=B9(R,G);if(!M&&!T)continue;let D=!1,I=(k,A)=>{Y.set(k,A),Y.set(k.toLowerCase(),A);let E=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Y.set(E,A),Q.add(A)};if(N&&T)I(N,T),D=!0;else if(w){let k=w.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let C=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C)return{source:C[1],local:C[2]};return{source:E,local:E}}),A=M?j9(M):null;for(let{source:E,local:C}of k){let y=null;if(T)y=T;else if(A)y=A.get(E)??A.get(E.toLowerCase())??A.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(y)I(C,y),D=!0}}if(D)F.push({start:O.index,end:O.index+L.length})}if(F.length===0)continue;for(let L=F.length-1;L>=0;L--)_=_.slice(0,F[L].start)+_.slice(F[L].end);z.push({start:W.index,end:W.index+U.length,value:`<script${j}>${_}</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 PQ($,Z,J,X,Q){let Y=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Y))!==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$/,""),_=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,F=V9(U,J,X);for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(_,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Q.add(O),X.debug)console.log(`Imported component: ${_} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Y=Y.replace(q,""),z.lastIndex=0}return Y}async function vQ($,Z,J,X,Q){let Y=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Y))!==null){let H=q.index,W=H+q[0].length-1,U=1,j=W+1;while(j<Y.length&&U>0){if(Y[j]==="(")U++;else if(Y[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Y.substring(W+1,j),V=j+1,_=B.match(/^\s*['"]([^'"]+)['"]/);if(!_){K.lastIndex=0;continue}let O=_[1],F,L=B.slice(_[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let N={};if(F)try{N=d0(F,Z)}catch(k){let A=k instanceof Error?k.message:String(k);Y=Y.replace(Y.substring(H,V),`[Error parsing component props: ${A}]`);continue}let R="",M=V,D=Y.substring(V).match(/^([\s\S]*?)@endcomponent/);if(D)R=D[1].trim(),M=V+D[0].length;let I=await A1(O,N,R,G,Z,J,X,z,Q);Y=Y.substring(0,H)+I+Y.substring(M),K.lastIndex=0}return Y}async function xQ($,Z,J,X,Q){if(!$)return $;let Y=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=u0(Y);Y=K.output;let q=L3(Y);return Y=await j(Y,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Y=await j(Y,/[A-Z][a-zA-Z0-9]*/,!0,h4(I2)),Y=await j(Y,/[a-z][a-z0-9]*/,!1,I2),Y=K.restore(Y),Y;async function j(B,V,_,O){if(!B)return B;let F=B,L=u4(F,V,O),w=new Map;for(let M=L.length-1;M>=0;M--){let T=L[M],D=_?w9(T.tagName):T.tagName,I=bQ(EQ(T.attributes,Z,J)),k=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=TQ(I,Z,X,k),E=u1.getBuiltin(T.tagName),C=E?await R9(D,G,Z,J,X):!1;if(E&&!C){let h={context:Z,filePath:J,options:X,dependencies:Q},p=E.render(A,T.content,h);if(Object.keys(A.events).length>0){let g=r4(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${g}`)}if(Object.keys(A.clientReactive).length>0)p=a4(p,A.clientReactive);w.set(M,p);continue}if(!_&&T.tagName.includes("-")&&!await R9(D,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 A1(D,y,K.restore(T.content),G,Z,J,X,z,Q);if(Object.keys(A.events).length>0){let h=e4(P);if(h){let p=r4(A.events),g=Object.keys(A.events).map((Z0)=>Z0.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${g}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=a4(P,A.clientReactive);w.set(M,P)}if(w.size===0)return F;let N="",R=0;for(let M=0;M<L.length;M++){let T=w.get(M);if(T===void 0)continue;N+=F.slice(R,L[M].startIndex),N+=T,R=L[M].endIndex}return N+=F.slice(R),N}}function a4($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([H])=>!J.has(H)),Y=Q.filter(([H])=>!X.has(H)).map(([H])=>w9(H)).join(" "),G=$,z=Q.length>0?e4(G):null;if(z){let H=Q.map(([U,j])=>`:${w9(U)}="${j.replace(/"/g,"&quot;")}"`).join(" "),W=Y?` data-stx-parent-bindings="${Y}"`:"";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 e4($){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),Q=X.match(/^\s+/);if(Q){J+=Q[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let z=`</${Y[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Y[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 O3($,Z,J,X,Q){if(!o4)x4(u1),o4=!0;let Y=await SQ($,Z,J,X,Q);Y=await PQ(Y,Z,J,X,Q),Y=await vQ(Y,Z,J,X,Q);let G=[];for(let z=0;z<3;z++){let K=G.length,q=B1(Y,D9,(W,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let H=Y;if(Y=await xQ(q.output,Z,J,X,Q),Y===H)break}if(G.length>0)Y=Y.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=CQ(Y);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 Y}function _3($,Z){let J=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return X}return-1}function gQ($,Z,J){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Y=Q.exec(X);while(Y){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]===")")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),Q.lastIndex=G+W.length,Y=Q.exec(X)}return X}function hQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function X6($){let Z=$,J=[],X=new Set,Q=0,Y=0,G=Z.length,z=(W)=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]===W){Y++;return}Y++}},K=()=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]==="`"){Y++;return}if(Z[Y]==="$"&&Z[Y+1]==="{"){Y+=2;let W=1;while(Y<G&&W>0)if(Z[Y]==="{")W++,Y++;else if(Z[Y]==="}")W--,Y++;else if(Z[Y]==="'"||Z[Y]==='"')z(Z[Y]);else if(Z[Y]==="`")K();else Y++;continue}Y++}},q=()=>{if(Z[Y]==="/"&&Z[Y+1]==="/"){while(Y<G&&Z[Y]!==`
3368
+ `)Y++;return!0}if(Z[Y]==="/"&&Z[Y+1]==="*"){Y+=2;while(Y<G-1&&!(Z[Y]==="*"&&Z[Y+1]==="/"))Y++;return Y+=2,!0}return!1},H=()=>{if(Q!==0)return;let W=Z.slice(Y).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(Y).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(Y).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(Y<G){if(q())continue;if(Z[Y]==="'"||Z[Y]==='"'){z(Z[Y]);continue}if(Z[Y]==="`"){K();continue}if(Z[Y]==="{"){Q++,Y++;continue}if(Z[Y]==="}"){Q--,Y++;continue}if(Q===0&&/[a-z]/i.test(Z[Y])&&(Y===0||/\s|[;{}()]/.test(Z[Y-1])))H();Y++}return J.join(", ")}function uQ($,Z=""){let J=X6($).split(",").map((X)=>X.trim()).filter(Boolean);return`
3369
3369
  (function() {
3370
3370
  ${s1("var",J)}
3371
3371
  var __destroyHooks = [];
@@ -3374,19 +3374,19 @@ document.addEventListener("focusout",function(e){
3374
3374
 
3375
3375
  ${$}
3376
3376
  ${Z}})();
3377
- `}function hQ($,Z){let Y=X6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3377
+ `}function mQ($,Z){let Q=X6($).split(",").map((Y)=>Y.trim()).filter(Boolean).map((Y)=>` try { __scopeRegistration[${JSON.stringify(Y)}] = ${Y}; } 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 = {};
3381
3381
  var __scopeRegistration = window.stx._scopes['${Z}'] || { __destroyCallbacks: __destroyHooks };
3382
- ${Y}
3382
+ ${Q}
3383
3383
  // #1767: when the bundler renamed a component const that collided with an
3384
3384
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
3385
3385
  // renamed declaration so it resolves to the component's value, not the
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 uQ($,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 $6($,Z){let J=hQ($,Z);return mQ(gQ($,J),Z)}function mQ($,Z){let J=`
3389
+ `}function dQ($,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 $6($,Z){let J=mQ($,Z);return lQ(uQ($,J),Z)}function lQ($,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 dQ($,Z){if(p0($)){let Y=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:v1($,(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 Z6=0,F3=new Set;function gB(){F3.clear()}function J6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var hB=new o1(500),Y6=new Set;function uB(){Y6.clear()}function lQ($){if($.__onceStore instanceof Set)return $.__onceStore;return Y6}async function w3($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=xQ($,"@partial","@include"),K=lQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,_,O)=>{let F=_.trim(),L=`${J}:${F}`;if(K.has(L))return"";return K.add(L),_});{let V=/@includeIf\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${N})`;z=z.substring(0,O)+D+z.substring(w),V.lastIndex=0}}for(let[V,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(z))!==null){let L=F.index,w=L+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=_3(M,0);if(T===-1){O.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=R;continue}let A=k[1],E=I.substring(k[0].length),C,y=_3(E,0);if(y!==-1)C=E.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(j0(b)){let g=W0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Y0(b,Z));let h=_?!P:P,p="";if(h){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Y.add(g);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=_0("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,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,k]=M;try{let A,E=D.trim();if(j0(E))A=W0(E,Object.keys(Z))(...Object.values(Z));else A=Y0(E,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(k)C=await U(k,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+_0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,E=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[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=_0("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=_0("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=_0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,_,O){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let L=z0.resolve(_),w=z0.resolve(z0.dirname(O)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,F);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&vQ(A))return A}N=z0.resolve(_,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(L+z0.sep)||R===L,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)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(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let W=z0.resolve(J);Q.add(W);function H(V,_,O,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:_,partialsDir:G}),_0("Include",_,J,O,F)}async function U(V,_={},O,F){let L=q(V,G,J);if(!L)return H(V,`Could not resolve path for include: ${V}`,O,F);let w=z0.resolve(L);if(Q.has(w)){let N=[...Q,w].map((R)=>z0.basename(R)).join(" -> ");return H(V,`Circular include detected: ${N}`,O,F)}try{Y.add(L);let N;if(!N)try{N=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return H(V,`Error loading include file ${V}: ${q0}`,O,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-39qy76ek.js");N=i(N,Z)}if(N&&(X.debug||!N9()&&!D9()))try{let{warnUnbalancedTags:i}=await import("./chunk-x054qzma.js");i(N,L)}catch{}let R=N;try{let{processESImports:i}=await import("./chunk-1exk54qt.js");await i(N,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=q9(R);if(M)R=M.content.trim();let D=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(D)I=`<style${D[1]}>${D[2]}</style>`;let k=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,q0,r)=>{if(!J6(q0))return"";return k.push({attrs:q0,body:r}),`__STX_DATA_BLOCK_${k.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(N,L);for(let[i,q0]of Object.entries(_))A[i]=q0;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...N.matchAll(E)],y="",b=null,P=!1;for(let i of C){let q0=i[1]||"",r=i[2]||"";if(J6(q0))continue;let L0=q0.includes("server"),e0=I1(q0);if(!L0&&r.trim()){let{interpolateScriptExpressions:u}=await import("./chunk-hsbbfp0c.js");r=u(r,A,V)}let $1="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:o}=await import("./chunk-020hpw7m.js"),Q0=u(r,{filePath:L,projectRoot:process.cwd()});r=Q0.code,$1=o(Q0.styles)}catch(u){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,u instanceof Error?u.message:u)}if(e0&&r.trim())r=T1(r);if(!L0){try{let{injectBrowserCoreAutoImports:o}=await import("./chunk-020hpw7m.js");r=o(r).code;let{hasUserImports:Q0,bundleClientScript:B0}=await import("./chunk-tscr6bs8.js");if(Q0(r))r=await B0(r,L,{projectRoot:process.cwd()})}catch(o){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,o instanceof Error?o.message:o)}let{stripStxRuntimeImports:u}=await import("./chunk-8tjg4wbr.js");r=u(r)}let l=fQ(r);if(l&&!L0){P=!0,b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let u=a0(r),o=$6(u,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${o}</script>
3407
- `;continue}if(L0)try{let{extractVariables:u}=await import("./chunk-jzfk5ect.js");await u(r,A,L)}catch(u){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,u)}if(!L0&&!l){let u=q0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let o=a0(r),Q0=$6(o,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${u?` ${u}`:""}>${Q0}</script>
3408
- `}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-hsbbfp0c.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q0,r)=>{let L0=k[Number(r)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=dQ(R,b);if(R=i.html,i.mergedIntoExisting){let r=b,L0=i.mergedIntoExisting;y=y.split(`'${r}'`).join(`'${L0}'`).split(`"${r}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!F3.has(L))F3.add(L),console.warn(`[stx] ${z0.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 q0=i.stamped&&i.root!==null&&T2(i.root);y=uQ(y,q0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await w3(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-6z9pm31g.js"),g=h(R,A,L,void 0,!0);g=r0(g,A,L),g=p(g);let{processMetaDirectives:Z0,processSeoDirective:J0,processStructuredData:e}=await import("./chunk-bk1zb1xp.js");if(g=Z0(g,A,L,X),g=e(g,A,L),g=J0(g,A,L,X),g=V1(g,A,L),I)g+=`
3406
+ })();`}function cQ($,Z){if(p0($)){let Q=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:"body"};return{html:v1($,(Y,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],Q=J[2].slice(1),Y=X.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:Q};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:Q}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var Z6=0,F3=new Set;function uB(){F3.clear()}function J6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var mB=new o1(500),Y6=new Set;function dB(){Y6.clear()}function pQ($){if($.__onceStore instanceof Set)return $.__onceStore;return Y6}async function w3($,Z,J,X,Q,Y=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=gQ($,"@partial","@include"),K=pQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,_,O)=>{let F=_.trim(),L=`${J}:${F}`;if(K.has(L))return"";return K.add(L),_});{let V=/@includeIf\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Q.add(T),D=`@include(${N})`;z=z.substring(0,O)+D+z.substring(w),V.lastIndex=0}}for(let[V,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(z))!==null){let L=F.index,w=L+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=_3(M,0);if(T===-1){O.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=R;continue}let A=k[1],E=I.substring(k[0].length),C,y=_3(E,0);if(y!==-1)C=E.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(j0(b)){let g=W0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Y0(b,Z));let h=_?!P:P,p="";if(h){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Q.add(g);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=_0("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,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,k]=M;try{let A,E=D.trim();if(j0(E))A=W0(E,Object.keys(Z))(...Object.values(Z));else A=Y0(E,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(k)C=await U(k,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+_0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,E=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[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=_0("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=_0("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=_0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,_,O){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let L=z0.resolve(_),w=z0.resolve(z0.dirname(O)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,F);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&fQ(A))return A}N=z0.resolve(_,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(L+z0.sep)||R===L,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)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(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let H=z0.resolve(J);Y.add(H);function W(V,_,O,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:_,partialsDir:G}),_0("Include",_,J,O,F)}async function U(V,_={},O,F){let L=q(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,O,F);let w=z0.resolve(L);if(Y.has(w)){let N=[...Y,w].map((R)=>z0.basename(R)).join(" -> ");return W(V,`Circular include detected: ${N}`,O,F)}try{Q.add(L);let N;if(!N)try{N=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return W(V,`Error loading include file ${V}: ${q0}`,O,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-es275g3w.js");N=i(N,Z)}if(N&&(X.debug||!k2()&&!E2()))try{let{warnUnbalancedTags:i}=await import("./chunk-x054qzma.js");i(N,L)}catch{}let R=N;try{let{processESImports:i}=await import("./chunk-wbp4vbm0.js");await i(N,Z,L,X,Q)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=H9(R);if(M)R=M.content.trim();let D=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(D)I=`<style${D[1]}>${D[2]}</style>`;let k=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,q0,r)=>{if(!J6(q0))return"";return k.push({attrs:q0,body:r}),`__STX_DATA_BLOCK_${k.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(N,L);for(let[i,q0]of Object.entries(_))A[i]=q0;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...N.matchAll(E)],y="",b=null,P=!1;for(let i of C){let q0=i[1]||"",r=i[2]||"";if(J6(q0))continue;let L0=q0.includes("server"),e0=I1(q0);if(!L0&&r.trim()){let{interpolateScriptExpressions:u}=await import("./chunk-1xts7768.js");r=u(r,A,V)}let $1="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:o}=await import("./chunk-k5hv1qqy.js"),Q0=u(r,{filePath:L,projectRoot:process.cwd()});r=Q0.code,$1=o(Q0.styles)}catch(u){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,u instanceof Error?u.message:u)}if(e0&&r.trim())r=T1(r);if(!L0){try{let{injectBrowserCoreAutoImports:o}=await import("./chunk-k5hv1qqy.js");r=o(r).code;let{hasUserImports:Q0,bundleClientScript:B0}=await import("./chunk-5hhng72w.js");if(Q0(r))r=await B0(r,L,{projectRoot:process.cwd()})}catch(o){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,o instanceof Error?o.message:o)}let{stripStxRuntimeImports:u}=await import("./chunk-fvvdq3ev.js");r=u(r)}let l=hQ(r);if(l&&!L0){P=!0,b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let u=a0(r),o=$6(u,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${o}</script>
3407
+ `;continue}if(L0)try{let{extractVariables:u}=await import("./chunk-7w66sc17.js");await u(r,A,L)}catch(u){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,u)}if(!L0&&!l){let u=q0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let o=a0(r),Q0=$6(o,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${u?` ${u}`:""}>${Q0}</script>
3408
+ `}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-1xts7768.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q0,r)=>{let L0=k[Number(r)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=cQ(R,b);if(R=i.html,i.mergedIntoExisting){let r=b,L0=i.mergedIntoExisting;y=y.split(`'${r}'`).join(`'${L0}'`).split(`"${r}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!F3.has(L))F3.add(L),console.warn(`[stx] ${z0.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 q0=i.stamped&&i.root!==null&&T2(i.root);y=dQ(y,q0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await w3(R,A,L,X,Q,Y);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-q45fva8h.js"),g=h(R,A,L,void 0,!0);g=r0(g,A,L),g=p(g);let{processMetaDirectives:Z0,processSeoDirective:J0,processStructuredData:e}=await import("./chunk-bk1zb1xp.js");if(g=Z0(g,A,L,X),g=e(g,A,L),g=J0(g,A,L,X),g=V1(g,A,L),I)g+=`
3409
3409
  `+I;if(y)g+=`
3410
- `+y;return g}catch(N){let R=N instanceof Error?N.message:String(N);return H(V,`Error processing include ${V}: ${R}`,O,F)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,_=V+B[0].length-1,O=1,F=_+1;while(F<z.length&&O>0){if(z[F]==="(")O++;else if(z[F]===")")O--;F++}if(O!==0)break;let L=z.substring(V,F),w=z.substring(_+1,F-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=F;continue}let R=N[1],M,T=w.substring(N[0].length),D=_3(T,0);if(D!==-1)M=T.substring(D+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let E=A instanceof Error?A.message:String(A);z=z.replace(L,_0("Include",`Error parsing include variables for ${R}: ${E}`,J,$,V)),j.lastIndex=0;continue}let k=await U(R,I,$,V);z=z.substring(0,V)+k+z.substring(F),j.lastIndex=0}return z}function R3($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),H=K.match(W);if(!H||H.index===void 0)break;let U=H.index,j=H[1],B=U+H[0].length,V=new RegExp(`@${Q}\\(`),_=new RegExp(`@${G}(?![a-z])`),O=1,F=B,L=-1;while(O>0&&F<K.length){let N=K.slice(F),R=N.match(V),M=N.match(_),T=R?F+R.index:1/0,D=M?F+M.index:1/0;if(T<D)O++,F=T+(R[0].length||1);else if(D<1/0){if(O--,O===0){L=D;break}F=D+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 N3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3411
- `)})}import*as D3 from"path";async function Q6($,Z,J=""){if(D3.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 z6($,Z,J,"@js","@endjs")}async function G6($,Z,J=""){if(D3.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 z6($,Z,J,"@ts","@endts")}async function z6($,Z,J,X,Y){let Q=$,G=w1(`${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:W,index:H}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),V=W.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),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3410
+ `+y;return g}catch(N){let R=N instanceof Error?N.message:String(N);return W(V,`Error processing include ${V}: ${R}`,O,F)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,_=V+B[0].length-1,O=1,F=_+1;while(F<z.length&&O>0){if(z[F]==="(")O++;else if(z[F]===")")O--;F++}if(O!==0)break;let L=z.substring(V,F),w=z.substring(_+1,F-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=F;continue}let R=N[1],M,T=w.substring(N[0].length),D=_3(T,0);if(D!==-1)M=T.substring(D+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let E=A instanceof Error?A.message:String(A);z=z.replace(L,_0("Include",`Error parsing include variables for ${R}: ${E}`,J,$,V)),j.lastIndex=0;continue}let k=await U(R,I,$,V);z=z.substring(0,V)+k+z.substring(F),j.lastIndex=0}return z}function R3($,Z){let J=$;function X(Q,Y,G,z){let K=Q,q=!0;while(q){q=!1;let H=new RegExp(`@${Y}\\(['"]([^'"]+)['"]\\)`),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(`@${Y}\\(`),_=new RegExp(`@${G}(?![a-z])`),O=1,F=B,L=-1;while(O>0&&F<K.length){let N=K.slice(F),R=N.match(V),M=N.match(_),T=R?F+R.index:1/0,D=M?F+M.index:1/0;if(T<D)O++,F=T+(R[0].length||1);else if(D<1/0){if(O--,O===0){L=D;break}F=D+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 N3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3411
+ `)})}import*as D3 from"path";async function Q6($,Z,J=""){if(D3.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 z6($,Z,J,"@js","@endjs")}async function G6($,Z,J=""){if(D3.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Y)=>({...Y,displayName:`User ${Y.id}: ${Y.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return z6($,Z,J,"@ts","@endts")}async function z6($,Z,J,X,Q){let Y=$,G=w1(`${X}([\\s\\S]*?)${Q}`,"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),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3412
3412
  ${V}
3413
3413
  ${F}
3414
- `,N=Function(...j,L)(...B);if(N&&typeof N==="object")Object.assign(Z,N);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=_0(`${X} Directive`,`Error executing code: ${j}`,J,$,H,q);console.error(B),Q=Q.replace(q,"")}return Q}var cQ=1000,pQ=!1;function iQ($,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=M0($,"(",")",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 H;try{let U=d0(q,Z);if(!U||typeof U!=="object")continue;H=JSON.stringify(U)}catch{continue}X+=$.slice(Y,G)+H,Y=K,J.lastIndex=K}return Y===0?$:X+$.slice(Y)}function nQ($,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 W=X.substring(z+1,q),H=q+1,U=W.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=W.slice(U[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let _=B.slice(V[0].length).trim();if(!_)continue;try{let O=d0(_,Z),F=JSON.stringify(O),L=`@component('${j}', ${F})`;Q.push({start:G,end:H,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 A9($,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,W=null,H=!1;while(q<X.length&&K>0){let B=X[q];if(H){H=!1,q++;continue}if(B==="\\"&&W){H=!0,q++;continue}if(W){if(B===W)W=null;q++;continue}if(B==='"'||B==="'"||B==="`"){W=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 sQ($,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);H6(Q);let q=W0(Q,G)(...z),W=JSON.stringify(q);if(W===void 0){if(!w9(Q).some((j)=>!(j in Z)))return"";return X}let H=Buffer.from(W,"utf8").toString("base64");return`__stx_${Y}="${H}"`}catch(G){return X}}),J}var I9="<!--__STX_BREAK__-->",T9="<!--__STX_CONTINUE__-->";function oQ($,Z){let J=$;return J=A9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(j0(Q)){let z=W0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?I9:""}catch{return""}}),J=A9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(j0(Q)){let z=W0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?T9:""}catch{return""}}),J}function rQ($){let Z=$;return Z=Z.replace(/@break(?!\()/g,I9),Z=Z.replace(/@continue(?!\()/g,T9),Z}function K6($){let Z=$.includes(I9),J=Z?$.substring(0,$.indexOf(I9)):$;return{hasBreak:Z,content:J}}function q6($){let Z=$.includes(T9),J=Z?$.substring(0,$.indexOf(T9)):$;return{hasContinue:Z,content:J}}function U6($){let Z=$;return Z=A9(Z,"@break",(J)=>{let X=J.trim();if(!M9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A9(Z,"@continue",(J)=>{let X=J.trim();if(!M9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function aQ($){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((W,H)=>W.pos-H.pos);let z=[],K=0;for(let W of X)K+=W.delta,z.push({pos:W.pos,depth:K});function q(W){let H=0,U=z.length-1,j=0;while(H<=U){let B=H+U>>1;if(z[B].pos<=W)j=z[B].depth,H=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let W=J.index,H=J.index+J[0].length-1,U=1,j=H+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(H+1,B),_=j6(V);if(!_)continue;let{arrayExpr:O,itemVar:F}=_,L=B+1,w=1,N=L,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(w>0&&N<$.length){R.lastIndex=N,M.lastIndex=N;let C=R.exec($),y=M.exec($);if(!y)break;if(C&&C.index<y.index)w++,N=C.index+C[0].length;else{if(w--,w===0){T=y.index;break}N=y.index+11}}if(T===-1)continue;let D=$.substring(L,T),I=T+11,k=-1,A=0,E=0;while(E<D.length){let C=D.indexOf("@",E);if(C===-1)break;let y=D.substring(C);if(/^@forelse\s*\(/.test(y))A++,E=C+1;else if(y.startsWith("@endforelse"))A--,E=C+11;else if(A===0&&y.startsWith("@empty")){if(D.length<=C+6||!/[a-z]/i.test(D[C+6])){k=C;break}E=C+1}else E=C+1}if(k===-1)continue;return{start:W,end:I,arrayExpr:O,itemVar:F,foreachContent:D.substring(0,k),emptyContent:D.substring(k+6)}}return null}function W6($,Z){let J=$;while(!0){let X=aQ(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let W;if(j0(G))W=W0(G,Object.keys(Z))(...Object.values(Z));else W=Y0(G,Z);let H;if(!Array.isArray(W)||W.length===0)H=q;else H=`@foreach (${G} as ${z})${K}@endforeach`;J=J.substring(0,Y)+H+J.substring(Q)}catch(W){let H=W instanceof Error?W.message:String(W),U=D0("Forelse",`Error in @forelse(${G} as ${z}): ${H}`,N0.EVALUATION_ERROR);J=J.substring(0,Y)+U+J.substring(Q)}}return J}function j6($){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 B6="<!--stx:foreach-not-iterable:",tQ=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function eQ($,Z){return`${B6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function $G($,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 M3($){if(!$.includes(B6))return $;return $.replace(tQ,(Z,J,X)=>{return $G(decodeURIComponent(J),decodeURIComponent(X)),""})}function V6($,Z,J,X,Y=!1){let Q=$;Q=W6(Q,Z);function G(q){let W=/@foreach\s*\(/g,H;while((H=W.exec(q))!==null){let U=H.index,j=H.index+H[0].length-1,B=1,V=j+1,_=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){_=V;break}}V++}if(_===-1)continue;let O=q.substring(j+1,_),F=j6(O);if(!F)continue;let L=U,{arrayExpr:w,itemVar:N}=F,R=_+1,M=1,T=R,D=/@foreach\s*\(/g,I=/@endforeach/g;while(M>0&&T<q.length){D.lastIndex=T,I.lastIndex=T;let k=D.exec(q),A=I.exec(q);if(!A)break;if(k&&k.index<A.index)M++,T=k.index+k[0].length;else{if(M--,M===0){let E=q.substring(R,A.index),C=A.index+11;return{start:L,end:C,arrayExpr:w,itemVar:N,content:E}}T=A.index+11}}}return null}function z(q,W){let H=q;while(!0){let U=G(H);if(!U)break;let{start:j,end:B,arrayExpr:V,itemVar:_,content:O}=U;try{let F=V.trim(),L;if(j0(F))L=W0(F,Object.keys(W))(...Object.values(W));else L=Y0(F,W);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=eQ(F,J)+D0("Foreach",`Error in @foreach: ${F} is not iterable`,N0.TYPE_ERROR);H=H.substring(0,j)+A+H.substring(B);continue}let N=X?.loops?.useAltLoopVariable??pQ,R=_.trim(),M=null,T,D=!1;if(R.includes("=>")){let A=R.split("=>").map((E)=>E.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((E)=>E.trim());if(A.length===2&&A[0]&&A[1])T=A[0],M=A[1],D=!0;else T=R}else T=R;let I="",k=L;for(let A=0;A<k.length;A++){let E=k[A],C={index:A,iteration:A+1,first:A===0,last:A===k.length-1,count:k.length},y={...W,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let p=T.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(E))p.forEach((g,Z0)=>{if(g)y[g]=E[Z0]});else y[T]=E}else if(T.startsWith("{")&&T.endsWith("}")){let p=T.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);if(E!==null&&typeof E==="object")p.forEach((g)=>{let Z0=g.indexOf(":"),J0=(Z0===-1?g:g.slice(0,Z0)).trim(),e=Z0===-1?J0:g.slice(Z0+1).trim();if(J0&&e)y[e]=E[J0]});else y[T]=E}else y[T]=E;if(M)if(!D&&w&&Array.isArray(E)&&E.length===2)y[M]=E[0],y[T]=E[1];else y[M]=A;let b=oQ(O,y),P=q6(b);if(P.hasContinue){I+=P.content;continue}let h=K6(b);if(h.hasBreak){I+=h.content;break}if(b=W6(b,y),b=z(b,y),b=r0(b,y,J),b=rQ(b),h=K6(b),h.hasBreak){I+=h.content;break}if(P=q6(b),P.hasContinue){I+=P.content;continue}b=V1(b,y,J),b=sQ(b,y),b=nQ(b,y),b=iQ(b,y),I+=b}H=H.substring(0,j)+I+H.substring(B)}catch(F){let L=D0("Foreach",`Error in @foreach(${V.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,N0.EVALUATION_ERROR);H=H.substring(0,j)+L+H.substring(B)}}return H}Q=z(Q,Z),Q=O6(Q,Z,J,X);let K=X?.loops?.maxWhileIterations??cQ;return Q=XG(Q,Z,K),Y?Q:M3(Q)}function L6($){return M9($)}function O6($,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=M0(Y,"(",")",K);if(q===-1)break;let W=Y.slice(K+1,q),H=q+1,U=z9(Y.slice(z),"for","endfor");if(U.length===0)break;let j=U[0].content,B=z+U[0].end;if(!L6(W)){let V=D0("For",`Unsafe expression in @for: ${W}`,N0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=ZG(W),_=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&_){let R=JG({forExpr:W,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),F=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});L=U6(L);let N=Function(...O,`
3414
+ `,N=Function(...j,L)(...B);if(N&&typeof N==="object")Object.assign(Z,N);Y=Y.replace(q,"")}catch(U){console.error(`Error executing ${X} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=_0(`${X} Directive`,`Error executing code: ${j}`,J,$,W,q);console.error(B),Y=Y.replace(q,"")}return Y}var iQ=1000,nQ=!1;function sQ($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Q=0,Y;while((Y=J.exec($))!==null){let G=Y.index+Y[0].length,z=Y.index+Y[0].indexOf("("),K=M0($,"(",")",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(Q,G)+W,Q=K,J.lastIndex=K}return Q===0?$:X+$.slice(Q)}function oQ($,Z){let J=/@component\s*\(/g,X=$,Q,Y=[];while((Q=J.exec(X))!==null){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]===")"){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 _=B.slice(V[0].length).trim();if(!_)continue;try{let O=d0(_,Z),F=JSON.stringify(O),L=`@component('${j}', ${F})`;Y.push({start:G,end:W,replacement:L})}catch{continue}}for(let G=Y.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Y[G];X=X.substring(0,z)+q+X.substring(K)}return X}function A9($,Z,J){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Y;while((Y=Q.exec(X))!==null){let G=Y.index,z=G+Y[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 rQ($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,Y)=>{try{let G=Object.keys(Z),z=Object.values(Z);H6(Y);let q=W0(Y,G)(...z),H=JSON.stringify(q);if(H===void 0){if(!N9(Y).some((j)=>!(j in Z)))return"";return X}let W=Buffer.from(H,"utf8").toString("base64");return`__stx_${Q}="${W}"`}catch(G){return X}}),J}var I9="<!--__STX_BREAK__-->",T9="<!--__STX_CONTINUE__-->";function aQ($,Z){let J=$;return J=A9(J,"@break",(X)=>{try{let Y=`!!(${X.trim()})`,G;if(j0(Y)){let z=W0(Y,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Y0(Y,Z));return G?I9:""}catch{return""}}),J=A9(J,"@continue",(X)=>{try{let Y=`!!(${X.trim()})`,G;if(j0(Y)){let z=W0(Y,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Y0(Y,Z));return G?T9:""}catch{return""}}),J}function tQ($){let Z=$;return Z=Z.replace(/@break(?!\()/g,I9),Z=Z.replace(/@continue(?!\()/g,T9),Z}function K6($){let Z=$.includes(I9),J=Z?$.substring(0,$.indexOf(I9)):$;return{hasBreak:Z,content:J}}function q6($){let Z=$.includes(T9),J=Z?$.substring(0,$.indexOf(T9)):$;return{hasContinue:Z,content:J}}function U6($){let Z=$;return Z=A9(Z,"@break",(J)=>{let X=J.trim();if(!M9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A9(Z,"@continue",(J)=>{let X=J.trim();if(!M9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function eQ($){let Z=/@forelse\s*\(/g,J,X=[],Q=/@foreach\s*\(/g,Y=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Y.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),_=j6(V);if(!_)continue;let{arrayExpr:O,itemVar:F}=_,L=B+1,w=1,N=L,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(w>0&&N<$.length){R.lastIndex=N,M.lastIndex=N;let C=R.exec($),y=M.exec($);if(!y)break;if(C&&C.index<y.index)w++,N=C.index+C[0].length;else{if(w--,w===0){T=y.index;break}N=y.index+11}}if(T===-1)continue;let D=$.substring(L,T),I=T+11,k=-1,A=0,E=0;while(E<D.length){let C=D.indexOf("@",E);if(C===-1)break;let y=D.substring(C);if(/^@forelse\s*\(/.test(y))A++,E=C+1;else if(y.startsWith("@endforelse"))A--,E=C+11;else if(A===0&&y.startsWith("@empty")){if(D.length<=C+6||!/[a-z]/i.test(D[C+6])){k=C;break}E=C+1}else E=C+1}if(k===-1)continue;return{start:H,end:I,arrayExpr:O,itemVar:F,foreachContent:D.substring(0,k),emptyContent:D.substring(k+6)}}return null}function W6($,Z){let J=$;while(!0){let X=eQ(J);if(!X)break;let{start:Q,end:Y,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let H;if(j0(G))H=W0(G,Object.keys(Z))(...Object.values(Z));else H=Y0(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,Q)+W+J.substring(Y)}catch(H){let W=H instanceof Error?H.message:String(H),U=D0("Forelse",`Error in @forelse(${G} as ${z}): ${W}`,N0.EVALUATION_ERROR);J=J.substring(0,Q)+U+J.substring(Y)}}return J}function j6($){let Z=$.indexOf(" as ");if(Z!==-1){let Y=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Y&&G?{arrayExpr:Y,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(),Q=J[2].trim();return X&&Q?{arrayExpr:Q,itemVar:X}:null}var B6="<!--stx:foreach-not-iterable:",$G=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function ZG($,Z){return`${B6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function JG($,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 M3($){if(!$.includes(B6))return $;return $.replace($G,(Z,J,X)=>{return JG(decodeURIComponent(J),decodeURIComponent(X)),""})}function V6($,Z,J,X,Q=!1){let Y=$;Y=W6(Y,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,_=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){_=V;break}}V++}if(_===-1)continue;let O=q.substring(j+1,_),F=j6(O);if(!F)continue;let L=U,{arrayExpr:w,itemVar:N}=F,R=_+1,M=1,T=R,D=/@foreach\s*\(/g,I=/@endforeach/g;while(M>0&&T<q.length){D.lastIndex=T,I.lastIndex=T;let k=D.exec(q),A=I.exec(q);if(!A)break;if(k&&k.index<A.index)M++,T=k.index+k[0].length;else{if(M--,M===0){let E=q.substring(R,A.index),C=A.index+11;return{start:L,end:C,arrayExpr:w,itemVar:N,content:E}}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:_,content:O}=U;try{let F=V.trim(),L;if(j0(F))L=W0(F,Object.keys(H))(...Object.values(H));else L=Y0(F,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(F,J)+D0("Foreach",`Error in @foreach: ${F} is not iterable`,N0.TYPE_ERROR);W=W.substring(0,j)+A+W.substring(B);continue}let N=X?.loops?.useAltLoopVariable??nQ,R=_.trim(),M=null,T,D=!1;if(R.includes("=>")){let A=R.split("=>").map((E)=>E.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((E)=>E.trim());if(A.length===2&&A[0]&&A[1])T=A[0],M=A[1],D=!0;else T=R}else T=R;let I="",k=L;for(let A=0;A<k.length;A++){let E=k[A],C={index:A,iteration:A+1,first:A===0,last:A===k.length-1,count:k.length},y={...H,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let p=T.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(E))p.forEach((g,Z0)=>{if(g)y[g]=E[Z0]});else y[T]=E}else if(T.startsWith("{")&&T.endsWith("}")){let p=T.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);if(E!==null&&typeof E==="object")p.forEach((g)=>{let Z0=g.indexOf(":"),J0=(Z0===-1?g:g.slice(0,Z0)).trim(),e=Z0===-1?J0:g.slice(Z0+1).trim();if(J0&&e)y[e]=E[J0]});else y[T]=E}else y[T]=E;if(M)if(!D&&w&&Array.isArray(E)&&E.length===2)y[M]=E[0],y[T]=E[1];else y[M]=A;let b=aQ(O,y),P=q6(b);if(P.hasContinue){I+=P.content;continue}let h=K6(b);if(h.hasBreak){I+=h.content;break}if(b=W6(b,y),b=z(b,y),b=r0(b,y,J),b=tQ(b),h=K6(b),h.hasBreak){I+=h.content;break}if(P=q6(b),P.hasContinue){I+=P.content;continue}b=V1(b,y,J),b=rQ(b,y),b=oQ(b,y),b=sQ(b,y),I+=b}W=W.substring(0,j)+I+W.substring(B)}catch(F){let L=D0("Foreach",`Error in @foreach(${V.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,N0.EVALUATION_ERROR);W=W.substring(0,j)+L+W.substring(B)}}return W}Y=z(Y,Z),Y=O6(Y,Z,J,X);let K=X?.loops?.maxWhileIterations??iQ;return Y=QG(Y,Z,K),Q?Y:M3(Y)}function L6($){return M9($)}function O6($,Z,J,X){let Q=$,Y=!0;while(Y){Y=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,q=M0(Q,"(",")",K);if(q===-1)break;let H=Q.slice(K+1,q),W=q+1,U=q9(Q.slice(z),"for","endfor");if(U.length===0)break;let j=U[0].content,B=z+U[0].end;if(!L6(H)){let V=D0("For",`Unsafe expression in @for: ${H}`,N0.UNSAFE_EXPRESSION);Q=Q.substring(0,z)+V+Q.substring(B),Y=!0;continue}try{let V=XG(H),_=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&_){let R=YG({forExpr:H,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Q=Q.substring(0,z)+R+Q.substring(B),Y=!0;continue}let O=Object.keys(Z),F=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});L=U6(L);let N=Function(...O,`
3415
3415
  let result = '';
3416
- for (${W}) {
3416
+ for (${H}) {
3417
3417
  result += \`${L}\`;
3418
3418
  }
3419
3419
  return result;
3420
- `)(...F);Y=Y.substring(0,z)+N+Y.substring(B),Q=!0}catch(V){let _=D0("For",`Error in @for(${W}): ${V instanceof Error?V.message:String(V)}`,N0.EVALUATION_ERROR);Y=Y.substring(0,z)+_+Y.substring(B),Q=!0}}return Y}function ZG($){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 W=K.indexOf("="),H=(W>=0?K.slice(0,W):K).trim();return/^[A-Za-z_$][\w$]*$/.test(H)?H:""}).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 JG($){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
+ `)(...F);Q=Q.substring(0,z)+N+Q.substring(B),Y=!0}catch(V){let _=D0("For",`Error in @for(${H}): ${V instanceof Error?V.message:String(V)}`,N0.EVALUATION_ERROR);Q=Q.substring(0,z)+_+Q.substring(B),Y=!0}}return Q}function XG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Y=J[1];return Y.slice(1,-1).split(",").map((z)=>{let K=z.trim();if(!K)return"";let q=K.indexOf(":");if(q>=0&&Y.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 Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function YG($){let{forExpr:Z,content:J,iterVarNames:X,context:Q,filePath:Y,options:G}=$,z=Object.keys(Q),K=Object.values(Q),q=Function(...z,"__pushIter",`
3421
3421
  for (${Z}) {
3422
3422
  __pushIter([${X.join(", ")}])
3423
3423
  }
3424
- `),W=[];q(...K,(j)=>{W.push(j)});let H=Q??"inline.stx",U="";for(let j of W){let B={...Y};X.forEach((_,O)=>{B[_]=j[O]});let V=O6(J,B,Q,G);V=r0(V,B,H),V=V1(V,B,H),U+=V}return U}function XG($,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=M0(X,"(",")",z);if(K===-1)break;let q=X.slice(z+1,K),W=z9(X.slice(G),"while","endwhile");if(W.length===0)break;let H=W[0].content,U=G+W[0].end;if(!L6(q)){let j=D0("While",`Unsafe expression in @while: ${q}`,N0.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=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(F,L)=>{return`\${${L}}`});V=U6(V);let O=Function(...j,`
3424
+ `),H=[];q(...K,(j)=>{H.push(j)});let W=Y??"inline.stx",U="";for(let j of H){let B={...Q};X.forEach((_,O)=>{B[_]=j[O]});let V=O6(J,B,Y,G);V=r0(V,B,W),V=V1(V,B,W),U+=V}return U}function QG($,Z,J){let X=$,Q=!0;while(Q){Q=!1;let Y=X.match(/@while\s*\(/);if(!Y||Y.index===void 0)break;let G=Y.index,z=G+Y[0].length-1,K=M0(X,"(",")",z);if(K===-1)break;let q=X.slice(z+1,K),H=q9(X.slice(G),"while","endwhile");if(H.length===0)break;let W=H[0].content,U=G+H[0].end;if(!L6(q)){let j=D0("While",`Unsafe expression in @while: ${q}`,N0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(U),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(F,L)=>{return`\${${L}}`});V=U6(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)}`,N0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(U),Y=!0}}return X}function YG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function _6($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return YG(X,Q||"_method")})}async function F6($,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=_0("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),Q=!0}catch(j){let B=D0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,N0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(U),Q=!0}}return X}function GG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function _6($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Q,Y)=>{return GG(X,Y||"_method")})}async function F6($,Z,J,X,Q){if(!X.middleware||X.middleware.length===0)return $;let Y=$,G=X.middleware.filter((z)=>z.timing===Q);if(G.length===0)return Y;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(Y,Z,J,X);if(typeof K==="string")Y=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=_0("Middleware",`Error in middleware '${z.name}': ${K instanceof Error?K.message:String(K)}`,J,$);Y=Y.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;">${Y5(q)}</div>
3438
- `)}}}return Q}async function w6($,Z,J,X){return F6($,Z,J,X,"before")}async function R6($,Z,J,X){return F6($,Z,J,X,"after")}U2();U2();function N6($){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 A3(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function qV($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function WV($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function D6($,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 HV(){l0.patterns=[],l0.exact={}}var QG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),GG=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 E1($,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()&&QG.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 zG($,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 k1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=zG($,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 M6($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function k2($,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 r1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function KG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function qG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Y=k2(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 _=G.split(",").map((L)=>L.trim()),O=_[0],F=_[1];K=`${z} as ${F} => ${O}`}else K=`${z} as ${G}`;let q=W1(X.attrs,"v-for"),W=W1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),H=k1(Z,X),U=Z.slice(H.outerStart,H.outerEnd),j=r1(U,{...X,start:0,end:X.end-X.start},W),B=`@foreach(${K})
3438
+ `)}}}return Y}async function w6($,Z,J,X){return F6($,Z,J,X,"before")}async function R6($,Z,J,X){return F6($,Z,J,X,"after")}U2();U2();function N6($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Q,Y)=>{try{let G=Q?d0(Q,{}):{};return A3(X,G,Y==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function HV($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function UV($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function D6($,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:Q}of l0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Q(Z,$))}function jV(){l0.patterns=[],l0.exact={}}var zG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),KG=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 E1($,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 Q=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&zG.has(X[1]),Y=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Y,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function qG($,Z,J){let X=1,Q=J,Y=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){Y.lastIndex=Q,G.lastIndex=Q;let z=Y.exec($),K=G.exec($);if(!K)return-1;if(z&&z.index<K.index)X++,Q=z.index+z[0].length;else{if(X--,X===0)return K.index+K[0].length;Q=K.index+K[0].length}}return-1}function k1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=qG($,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 M6($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function b2($,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 r1($,Z,J){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function WG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function HG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Q=b2(X.attrs,"v-for");if(Q===null){J=X.end;continue}let Y=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Y){J=X.end;continue}let G=Y[1].trim(),z=Y[2].trim(),K;if(G.includes(",")){let _=G.split(",").map((L)=>L.trim()),O=_[0],F=_[1];K=`${z} as ${F} => ${O}`}else K=`${z} as ${G}`;let q=W1(X.attrs,"v-for"),H=W1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=k1(Z,X),U=Z.slice(W.outerStart,W.outerEnd),j=r1(U,{...X,start:0,end:X.end-X.start},H),B=`@foreach(${K})
3439
3439
  `,V=`${B}${j}
3440
- @endforeach`;Z=Z.slice(0,H.outerStart)+V+Z.slice(H.outerEnd),J=H.outerStart+B.length}return Z}function WG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Y=k2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=k1(Z,X),z=W1(X.attrs,"v-if"),K=r1(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,W=!0;while(W){let V=Z.slice(q).match(/^\s*/),_=V?V[0].length:0,O=E1(Z,q+_);if(!O){W=!1;break}let F=k2(O.attrs,"v-else-if"),L=M6(O.attrs,"v-else");if(F!==null){let w=k1(Z,O),N=W1(O.attrs,"v-else-if"),R=r1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},N);Q.push({type:"else-if",expr:F,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),q=w.outerEnd}else if(L){let w=k1(Z,O),N=W1(O.attrs,"v-else"),R=r1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},N);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),W=!1}else W=!1}let H=[];for(let V of Q)if(V.type==="if")H.push(`@if(${V.expr})
3441
- ${V.element}`);else if(V.type==="else-if")H.push(`@elseif(${V.expr})
3442
- ${V.element}`);else H.push(`@else
3443
- ${V.element}`);H.push("@endif");let U=H.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 HG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function UG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Y=GG.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,K,q)=>{let W=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(K);if(!W||!q||!/^["']/.test(q))return z;let H=W[1]||"modelValue",U=W[2];if(Y&&!W[1])return`@model${U}=${q}`;let j=q[0],B=q.slice(1,-1),V=`:${H}=${q} @update:${H}=${j}${B} = $event${j}`;if(U){let _=W[1]?`${H}Modifiers`:"modelModifiers",O=U.slice(1).split(".").map((F)=>`${F}: true`).join(", ");V+=` :${_}="{ ${O} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=r1(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 jG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function BG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function VG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Y=k2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=k1(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 LG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Y=k2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=k1(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 OG($){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 _G($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;if(!M6(X.attrs,"v-once")){J=X.end;continue}let Y=W1(X.attrs,"v-once"),Q=k1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),K=`@once
3445
- ${r1(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 FG($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function wG($){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 A6($){if(!KG($))return $;let Z=$;return Z=qG(Z),Z=WG(Z),Z=_G(Z),Z=jG(Z),Z=BG(Z),Z=UG(Z),Z=HG(Z),Z=wG(Z),Z=VG(Z),Z=LG(Z),Z=OG(Z),Z=FG(Z),Z}function k9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var I3=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"]),RG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function I6($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=Y0(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return I3.has(Q)?Q:null}function T6($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function k6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(RG.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function E6($,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 W=z[q];try{let H=I6(W.expr,Z);if(!H||typeof H!=="string"){let F=`<!-- dynamic component: could not resolve "${k9(T6(W.expr))}" -->`;Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length);continue}if(I3.has(H)){let F=k6(H,W.attrs,W.slotContent);Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length);continue}let U=W.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 F=V[1]||V[2],L=V[3];if(V[1])try{j[F]=Y0(L,Z)}catch{j[F]=L}else j[F]=L}let _=X.componentsDir||"components",O=await A1(H,j,W.slotContent,_,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length)}catch(H){let U=H instanceof Error?H.message:String(H),j=`<!-- dynamic component error: ${k9(U)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q=await NG(Q,Z,J,X,Y),Q}async function NG($,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 W=z[q];try{let H=I6(W.expr,Z);if(!H||typeof H!=="string"){let B=`<!-- dynamic component: could not resolve "${k9(T6(W.expr))}" -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}if(I3.has(H)){let B=k6(H,W.attrs,"");Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}let U=X.componentsDir||"components",j=await A1(H,{},"",U,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}catch(H){let U=H instanceof Error?H.message:String(H),j=`<!-- dynamic component error: ${k9(U)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q}function T3(){return{afterOpen:[],beforeClose:[]}}function DG($){return $.afterOpen.length>0||$.beforeClose.length>0}function y6($,Z){if(!DG(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?E2($):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 b6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function E2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;b6.lastIndex=J;let X=b6.exec($);return X?J+X[0].length:J}var E3="data-stx-color-mode-boot",MG="__STX_COLOR_MODE__",AG=new Set(["light","dark","auto","system"]),IG=new Set(["auto","system"]),TG=/^[a-z][\w:-]*$/i,kG=/^[\w-]+$/;function EG($){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(!AG.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"||!kG.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"||!TG.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!IG.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 bG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function b3($={}){let Z=EG($),X=`(function(){"use strict";var c=${bG(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.${MG}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${E3}>${X}</script>`}function P6($,Z={}){if($.includes(E3))return $;let J=k3($);if(J===null)return $;let X=b3(Z);return`${$.slice(0,J)}
3447
- ${X}${$.slice(J)}`}var k3=E2,yG=new RegExp(`<script\\b[^>]*\\b${E3}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),C6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,S6=/<\/head>/gi;function CG($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;S6.lastIndex=J;let X=S6.exec($),Y=X?X.index:$.length;C6.lastIndex=J;let Q=C6.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 v6($){return SG(CG($))}function SG($){let Z=yG.exec($);if(!Z)return $;let J=k3($);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=k3(X);if(Y===null)return $;return`${X.slice(0,Y)}
3449
- ${Z[0]}${X.slice(Y)}`}var RV="stx-build",NV="X-STX-Build",b2=Symbol.for("stx.buildId");function x6(){let $=globalThis;if(!$[b2])$[b2]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return $[b2]}function DV($){let Z=globalThis;if($===null)delete Z[b2];else Z[b2]=$}function MV($,Z=x6()){let J=y3($,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 y3($,Z=x6()){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 PG}from"async_hooks";var f6=new PG;function C3($){return $.__stx_server_data??={pending:new Map,values:new Map}}function g6($,Z){return f6.run(C3($),Z)}async function h6($,Z){let J=f6.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 u6($){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 l6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",E9="data-stx-html-attrs",b9="data-stx-html-class",c6=/^[A-Za-z_:][\w:.-]*$/;function t0($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vG($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t1($){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 a1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${t0(String(X))}"`).join(" ")}function xG($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,K]of Object.entries($||{})){if(K==null)continue;let q=z.trim();if(!c6.test(q))continue;let W=q.toLowerCase();if(W==="lang"){Q=String(K);continue}if(W==="class"){Y=String(K).trim();continue}J.push(` ${q}="${t0(String(K))}"`),X.push(q)}let G=` lang="${t0(Q)}"`;if(Y)G+=` class="${t0(Y)}"`;if(G+=J.join(""),Y)G+=` ${b9}="${t0(Y)}"`;if(X.length)G+=` ${E9}="${t0(X.join(" "))}"`;return G}function p6($={},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 i6($,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 W=G[1];if(!(W in X))Y.push(W);X[W]=G[2]??G[3]??G[4]??""}let z=[],K=[];for(let[W,H]of Object.entries(Z)){if(H==null)continue;let U=W.trim();if(!c6.test(U))continue;let j=U.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(H).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(H),j!=="lang")K.push(U)}if(z.length){if(!(b9 in X))Y.push(b9);X[b9]=z.join(" ")}if(K.length){if(!(E9 in X))Y.push(E9);X[E9]=K.join(" ")}let q=Y.map((W)=>` ${W}="${t0(X[W])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function EV($){let Z=v3($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function v3($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${l6}
3451
- `}function fG($){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 H=$.indexOf("-->",J);if(H===-1)break;J=H+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let H=$.toLowerCase().indexOf("</script>",J+z[0].length);if(H===-1)break;J=H+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 W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){Z.push(W[0]),J+=W[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 gG($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:K="",htmlAttrs:q={},bodyClass:W="",bodyAttrs:H={}}=Z,U=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(t1).filter(Boolean)),_=[...j.filter((I)=>!B.has(t1(I))),...Q].map((I)=>{return` <meta ${a1(I)}>`}).join(`
3440
+ @endforeach`;Z=Z.slice(0,W.outerStart)+V+Z.slice(W.outerEnd),J=W.outerStart+B.length}return Z}function UG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Q=b2(X.attrs,"v-if");if(Q===null){J=X.end;continue}let Y=[],G=k1(Z,X),z=W1(X.attrs,"v-if"),K=r1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Y.push({type:"if",expr:Q,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*/),_=V?V[0].length:0,O=E1(Z,q+_);if(!O){H=!1;break}let F=b2(O.attrs,"v-else-if"),L=M6(O.attrs,"v-else");if(F!==null){let w=k1(Z,O),N=W1(O.attrs,"v-else-if"),R=r1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},N);Y.push({type:"else-if",expr:F,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),q=w.outerEnd}else if(L){let w=k1(Z,O),N=W1(O.attrs,"v-else"),R=r1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},N);Y.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:O}),H=!1}else H=!1}let W=[];for(let V of Y)if(V.type==="if")W.push(`@if(${V.expr})
3441
+ ${V.element}`);else if(V.type==="else-if")W.push(`@elseif(${V.expr})
3442
+ ${V.element}`);else W.push(`@else
3443
+ ${V.element}`);W.push("@endif");let U=W.join(`
3444
+ `),j=Y[0].outerStart,B=Y[Y.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function jG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function BG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Q=KG.has(X.tag),Y=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(Q&&!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 _=H[1]?`${W}Modifiers`:"modelModifiers",O=U.slice(1).split(".").map((F)=>`${F}: true`).join(", ");V+=` :${_}="{ ${O} }"`}return V});if(Y===X.attrs){J=X.end;continue}let G=r1(X.full,{...X,start:0,end:X.full.length},Y);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function VG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function LG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function OG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Q=b2(X.attrs,"v-html");if(Q===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Y=k1(Z,X),G=W1(X.attrs,"v-html"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,Y.outerStart)+K+Z.slice(Y.outerEnd),J=Y.outerStart+K.length}return Z}function _G($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;let Q=b2(X.attrs,"v-text");if(Q===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Y=k1(Z,X),G=W1(X.attrs,"v-text"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,Y.outerStart)+K+Z.slice(Y.outerEnd),J=Y.outerStart+K.length}return Z}function FG($){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 wG($){let Z=$,J=0;while(J<Z.length){let X=E1(Z,J);if(!X)break;if(!M6(X.attrs,"v-once")){J=X.end;continue}let Q=W1(X.attrs,"v-once"),Y=k1(Z,X),G=Z.slice(Y.outerStart,Y.outerEnd),K=`@once
3445
+ ${r1(G,{...X,start:0,end:X.end-X.start},Q)}
3446
+ @endonce`;Z=Z.slice(0,Y.outerStart)+K+Z.slice(Y.outerEnd),J=Y.outerStart+K.length}return Z}function RG($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function NG($){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 A6($){if(!WG($))return $;let Z=$;return Z=HG(Z),Z=UG(Z),Z=wG(Z),Z=VG(Z),Z=LG(Z),Z=BG(Z),Z=jG(Z),Z=NG(Z),Z=OG(Z),Z=_G(Z),Z=FG(Z),Z=RG(Z),Z}function k9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var I3=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"]),DG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function I6($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Q=Y0(X,Z);if(Q&&typeof Q==="string")return Q;let Y=X.trim();return I3.has(Y)?Y:null}function T6($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function k6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Q=X?`<${$} ${X}>`:`<${$}>`;if(DG.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Q}${J}</${$}>`}async function E6($,Z,J,X,Q){let Y=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],K;while((K=G.exec(Y))!==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=I6(H.expr,Z);if(!W||typeof W!=="string"){let F=`<!-- dynamic component: could not resolve "${k9(T6(H.expr))}" -->`;Y=Y.slice(0,H.index)+F+Y.slice(H.index+H.full.length);continue}if(I3.has(W)){let F=k6(W,H.attrs,H.slotContent);Y=Y.slice(0,H.index)+F+Y.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 F=V[1]||V[2],L=V[3];if(V[1])try{j[F]=Y0(L,Z)}catch{j[F]=L}else j[F]=L}let _=X.componentsDir||"components",O=await A1(W,j,H.slotContent,_,Z,J,X,new Set,Q??new Set);Y=Y.slice(0,H.index)+O+Y.slice(H.index+H.full.length)}catch(W){let U=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${k9(U)} -->`;Y=Y.slice(0,H.index)+j+Y.slice(H.index+H.full.length)}}return Y=await MG(Y,Z,J,X,Q),Y}async function MG($,Z,J,X,Q){let Y=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],K;while((K=G.exec(Y))!==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=I6(H.expr,Z);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${k9(T6(H.expr))}" -->`;Y=Y.slice(0,H.index)+B+Y.slice(H.index+H.full.length);continue}if(I3.has(W)){let B=k6(W,H.attrs,"");Y=Y.slice(0,H.index)+B+Y.slice(H.index+H.full.length);continue}let U=X.componentsDir||"components",j=await A1(W,{},"",U,Z,J,X,new Set,Q??new Set);Y=Y.slice(0,H.index)+j+Y.slice(H.index+H.full.length)}catch(W){let U=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${k9(U)} -->`;Y=Y.slice(0,H.index)+j+Y.slice(H.index+H.full.length)}}return Y}function T3(){return{afterOpen:[],beforeClose:[]}}function AG($){return $.afterOpen.length>0||$.beforeClose.length>0}function y6($,Z){if(!AG(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Q=$.lastIndexOf("</head>"),Y=J?y2($):null,G=X&&Q!==-1?Q:null;if(Y===null&&G===null)return $;if(Y!==null&&G!==null)return`${$.slice(0,Y)}${J}${$.slice(Y,G)}${X}${$.slice(G)}`;if(Y!==null)return`${$.slice(0,Y)}${J}${$.slice(Y)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var b6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function y2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;b6.lastIndex=J;let X=b6.exec($);return X?J+X[0].length:J}var E3="data-stx-color-mode-boot",IG="__STX_COLOR_MODE__",TG=new Set(["light","dark","auto","system"]),kG=new Set(["auto","system"]),EG=/^[a-z][\w:-]*$/i,bG=/^[\w-]+$/;function yG($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Q=$.attribute??null,Y=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!TG.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"||!bG.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&(typeof Q!=="string"||!EG.test(Q)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Q)}`);if(Y!==null&&!kG.has(Y))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Y)}`);if(X===null&&Q===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:Q,autoValue:Y}}function CG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function b3($={}){let Z=yG($),X=`(function(){"use strict";var c=${CG(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.${IG}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${E3}>${X}</script>`}function P6($,Z={}){if($.includes(E3))return $;let J=k3($);if(J===null)return $;let X=b3(Z);return`${$.slice(0,J)}
3447
+ ${X}${$.slice(J)}`}var k3=y2,SG=new RegExp(`<script\\b[^>]*\\b${E3}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),C6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,S6=/<\/head>/gi;function PG($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;S6.lastIndex=J;let X=S6.exec($),Q=X?X.index:$.length;C6.lastIndex=J;let Y=C6.exec($);if(!Y||Y.index>=Q)return $;if($.slice(J,Y.index).trim()==="")return $;let G=Y.index+Y[0].length;return`${$.slice(0,J)}
3448
+ ${Y[0]}${$.slice(J,Y.index)}${$.slice(G,Q)}${$.slice(Q)}`}function v6($){return vG(PG($))}function vG($){let Z=SG.exec($);if(!Z)return $;let J=k3($);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),Q=k3(X);if(Q===null)return $;return`${X.slice(0,Q)}
3449
+ ${Z[0]}${X.slice(Q)}`}var DV="stx-build",MV="X-STX-Build",C2=Symbol.for("stx.buildId");function x6(){let $=globalThis;if(!$[C2])$[C2]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return $[C2]}function AV($){let Z=globalThis;if($===null)delete Z[C2];else Z[C2]=$}function IV($,Z=x6()){let J=y3($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Q=X.index+X[0].length;return`${$.slice(0,Q)}${J}${$.slice(Q)}`}function y3($,Z=x6()){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 xG}from"async_hooks";var f6=new xG;function C3($){return $.__stx_server_data??={pending:new Map,values:new Map}}function g6($,Z){return f6.run(C3($),Z)}async function h6($,Z){let J=f6.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 Q=Promise.resolve().then(Z).then((Y)=>{let G=JSON.stringify(Y,(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((Y)=>{throw J.pending.delete($),Y});return J.pending.set($,Q),Q}function u6($){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 l6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",E9="data-stx-html-attrs",b9="data-stx-html-class",c6=/^[A-Za-z_:][\w:.-]*$/;function t0($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fG($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t1($){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 a1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${t0(String(X))}"`).join(" ")}function gG($={},Z="en"){let J=[],X=[],Q="",Y=Z;for(let[z,K]of Object.entries($||{})){if(K==null)continue;let q=z.trim();if(!c6.test(q))continue;let H=q.toLowerCase();if(H==="lang"){Y=String(K);continue}if(H==="class"){Q=String(K).trim();continue}J.push(` ${q}="${t0(String(K))}"`),X.push(q)}let G=` lang="${t0(Y)}"`;if(Q)G+=` class="${t0(Q)}"`;if(G+=J.join(""),Q)G+=` ${b9}="${t0(Q)}"`;if(X.length)G+=` ${E9}="${t0(X.join(" "))}"`;return G}function p6($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Q of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Q))X.push(Q);J.class=X.join(" ")}return J}function i6($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Q=[],Y=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Y.exec(J[1]))!==null){let H=G[1];if(!(H in X))Q.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(!c6.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))Q.push("class");X.class=B.join(" ");continue}if(!(U in X))Q.push(U);if(X[U]=String(W),j!=="lang")K.push(U)}if(z.length){if(!(b9 in X))Q.push(b9);X[b9]=z.join(" ")}if(K.length){if(!(E9 in X))Q.push(E9);X[E9]=K.join(" ")}let q=Q.map((H)=>` ${H}="${t0(X[H])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function yV($){let Z=v3($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function v3($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${l6}
3451
+ `}function hG($){let Z=[],J=0;while(J<$.length){let Y=$.slice(J),G=Y.match(/^\s+/);if(G){J+=G[0].length;continue}if(Y.startsWith("<!--")){let W=$.indexOf("-->",J);if(W===-1)break;J=W+3;continue}let z=Y.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=Y.match(/^<link\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let q=Y.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let H=Y.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="",Q=0;while(Q<$.length&&Q<J){let Y=$.slice(Q),G=Y.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let z=Y.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Q+=z[0].length;continue}let K=Y.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}X+=$[Q],Q++}return X+=$.slice(J),{body:X,hoisted:Z}}function uG($,Z={},J={}){let{title:X="stx App",lang:Q="en",meta:Y=[],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(Y.map(t1).filter(Boolean)),_=[...j.filter((I)=>!B.has(t1(I))),...Y].map((I)=>{return` <meta ${a1(I)}>`}).join(`
3452
3452
  `),O=G.map((I)=>{return` <link ${a1(I)}>`}).join(`
3453
3453
  `),F=z.map((I)=>{if(I.src)return` <script ${a1(I,(k)=>k==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
3454
- `),L=xG(q,Y),w=Object.entries(H).map(([I,k])=>` ${I}="${t0(String(k))}"`).join(""),N=W?` class="${t0(W)}"`:"",{body:R,hoisted:M}=fG($),T=[_,J.colorMode?` ${b3(J.colorMode)}`:"",` <title>${J.titleIsHtml?U:vG(U)}</title>`,` ${l6}`,O,F,K?` ${K}`:"",...(J.styles||[]).map((I)=>` ${I}`),...M.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),D=[R,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3454
+ `),L=gG(q,Q),w=Object.entries(W).map(([I,k])=>` ${I}="${t0(String(k))}"`).join(""),N=H?` class="${t0(H)}"`:"",{body:R,hoisted:M}=hG($),T=[_,J.colorMode?` ${b3(J.colorMode)}`:"",` <title>${J.titleIsHtml?U:fG(U)}</title>`,` ${l6}`,O,F,K?` ${K}`:"",...(J.styles||[]).map((I)=>` ${I}`),...M.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),D=[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,86 +3461,86 @@ ${T.join(`
3461
3461
  ${D.join(`
3462
3462
  `)}
3463
3463
  </body>
3464
- </html>`}var S3=/\s+/y,P3=/<(script|style)\b[^>]*>/iy,hG=/<\/script>/gi,uG=/<\/style>/gi,m6=/<!DOCTYPE\b/iy,d6=/<html[\s>]/iy;function x3($){let Z=0;while(Z<$.length){if(S3.lastIndex=Z,S3.exec($)){Z=S3.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}P3.lastIndex=Z;let X=P3.exec($);if(X){let Y=X[1].toLowerCase()==="script"?hG:uG;Y.lastIndex=P3.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(m6.lastIndex=Z,m6.test($))return!0;return d6.lastIndex=Z,d6.test($)}return!1}function f3($){return x3($)}function n6($,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 W=t1(q);if(W&&z.includes(W))continue;K.push(` <meta ${a1(q)}>`)}for(let q of Y){if(q.href&&z.includes(`href="${q.href}"`))continue;K.push(` <link ${a1(q)}>`)}for(let q of Q)if(q.src){if(z.includes(`src="${q.src}"`))continue;K.push(` <script ${a1(q,(W)=>W==="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 S3=/\s+/y,P3=/<(script|style)\b[^>]*>/iy,mG=/<\/script>/gi,dG=/<\/style>/gi,m6=/<!DOCTYPE\b/iy,d6=/<html[\s>]/iy;function x3($){let Z=0;while(Z<$.length){if(S3.lastIndex=Z,S3.exec($)){Z=S3.lastIndex;continue}if($.startsWith("<!--",Z)){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}P3.lastIndex=Z;let X=P3.exec($);if(X){let Q=X[1].toLowerCase()==="script"?mG:dG;Q.lastIndex=P3.lastIndex;let Y=Q.exec($);if(Y===null)return!1;Z=Y.index+Y[0].length;continue}if(m6.lastIndex=Z,m6.test($))return!0;return d6.lastIndex=Z,d6.test($)}return!1}function f3($){return x3($)}function n6($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Q=[],script:Y=[],headRaw:G=""}=Z,z=$.slice(0,J),K=[];for(let q of X){let H=t1(q);if(H&&z.includes(H))continue;K.push(` <meta ${a1(q)}>`)}for(let q of Q){if(q.href&&z.includes(`href="${q.href}"`))continue;K.push(` <link ${a1(q)}>`)}for(let q of Y)if(q.src){if(z.includes(`src="${q.src}"`))continue;K.push(` <script ${a1(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 s6($,Z={},J={},X){if(X??f3($))return $;return gG($,Z,J)}var mG=/<\/(script)/gi;function e1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(mG,"<\\/$1")}var b1=["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 a6 from"path";U2();U2();function r6($,Z={}){return new o6($,Z).routes}function gV($,Z){let J=g3($,Z);return J?J.params:null}var t6=new Map;async function e6($,Z){let J=$,X=Z;if(!J||!X)try{let z=await y5();J||=z?.pagesDir||"pages",X||=z?.root||"."}catch{J||="pages",X||="."}let Y=a6.isAbsolute(J)?J:a6.join(X,J),Q=t6.get(Y);if(Q)return Q;let G=[];try{G=r6(".",{pagesDir:Y,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{G=[]}return t6.set(Y,G),G}function dG($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $8($){return dG(JSON.stringify($))}function Z8($){return $.includes("data-stx-runtime")}function J8($){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 h3($,Z){let J=W2($),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
3467
- `+$.slice(J);let Y=E2($);if(Y!==null)return`${$.slice(0,Y)}
3468
- ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3466
+ ${$.slice(J)}`}function s6($,Z={},J={},X){if(X??f3($))return $;return uG($,Z,J)}var lG=/<\/(script)/gi;function e1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(lG,"<\\/$1")}var b1=["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 a6 from"path";U2();U2();function r6($,Z={}){return new o6($,Z).routes}function uV($,Z){let J=g3($,Z);return J?J.params:null}var t6=new Map;async function e6($,Z){let J=$,X=Z;if(!J||!X)try{let z=await y5();J||=z?.pagesDir||"pages",X||=z?.root||"."}catch{J||="pages",X||="."}let Q=a6.isAbsolute(J)?J:a6.join(X,J),Y=t6.get(Q);if(Y)return Y;let G=[];try{G=r6(".",{pagesDir:Q,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{G=[]}return t6.set(Q,G),G}function cG($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $8($){return cG(JSON.stringify($))}function Z8($){return $.includes("data-stx-runtime")}function J8($){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 h3($,Z){let J=W2($),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
3467
+ `+$.slice(J);let Q=y2($);if(Q!==null)return`${$.slice(0,Q)}
3468
+ ${Z}${$.slice(Q)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3469
3469
  `+$.slice(G)}if(p0($))return v1($,(G)=>`${G}
3470
3470
  ${Z}`);return`${Z}
3471
- ${$}`}async function y9($,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-e4yskgtb.js"),{url:Q}=await Y("runtime",Z.debug===!0);return h3($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return h3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-e4yskgtb.js"),X=await J(Z.debug);return h3($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function lG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function X8($){if($.includes("data-stx-tooltip-runtime")||!lG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${U3()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3471
+ ${$}`}async function y9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Q}=await import("./chunk-1djdz98r.js"),{url:Y}=await Q("runtime",Z.debug===!0);return h3($,`<script data-stx-runtime src="${Y}"></script>`)}if(Z.buildMode==="compile")return h3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-1djdz98r.js"),X=await J(Z.debug);return h3($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function pG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function X8($){if($.includes("data-stx-tooltip-runtime")||!pG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${U3()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3472
3472
  ${Z}`;return`${$.slice(0,J)}${Z}
3473
- ${$.slice(J)}`}var cG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function pG($){return cG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function iG($,Z){if(!$.includes("</body>"))return $;if(pG($))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 e6(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${$8(K)};</script>
3474
- `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-e4yskgtb.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 Y8=Symbol.for("stx.lazy-module-promises");function nG(){let $=globalThis;return $[Y8]??=new Map,$[Y8]}function s($,Z){let J=nG(),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 u3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,j8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,sG=65536,oG=4,S9=new Map;function UL(){S9.clear()}function rG($){let Z=[];for(let J of y2($,K2)){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 aG($,Z={}){let J=$.length>=sG,X=J?S9.get($):void 0;if(X===void 0){if(X=rG($),J)U8(S9,oG),S9.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 B8($){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}=Q8(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}=Q8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Q8($){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 l3($,Z){return H8($,Z)}function tG($){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 eG($){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 $z($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${u3})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=y2($,(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=B8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let W=G[1],U=/\/\s*>$/.test(Q.token)||P9.has(W.toLowerCase())?Q.end:L8($,Q.start,W,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var G8=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 Zz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function z8($,Z,J,X){if(!$)return!1;let Y=Zz($),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(G8.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,H;while((H=W.exec(Y))!==null){let j=H[1];if(Y.slice(0,H.index).trimEnd().endsWith("."))continue;if(G8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function C9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(j8);if(Q&&Jz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Jz($,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 V8($,Z){let J=eG($);function X(Y){let Q=Y,G=$z(Y),z=(H)=>{let U=new Set;for(let j of G)if(H>j.start&&H<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,W=[];while((q=K.exec(Q))!==null){let H=q.index,U=H+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(),_=B,O=1,F=_,L=/@(if\s*\(|endif)/g;L.lastIndex=_;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let N=Q.substring(_,F-6).trim(),R;if(tG(N)){let M=_2(Q.substring(H,F));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),D=z(H);if(!(T.length>0&&T.every((A)=>z8(A.condition,J,Z,D))))continue;R=M[0].branches.map((A)=>{let E=X(A.content);if(A.type==="elseif")return C9(E,"@else-if",A.condition??"");if(A.type==="else")return C9(E,"@else");return C9(E,"@if",A.condition??"")}).join(`
3476
- `)}else{if(!z8(V,J,Z,z(H)))continue;R=C9(X(N),"@if",V)}W.push({start:H,end:F,replacement:R}),K.lastIndex=F}for(let H=W.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=W[H];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function Xz($){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 P9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),K8=/<(script|style)\b/iy,Yz=/<\/script/gi,Qz=/<\/style/gi;function L8($,Z,J,X){if(P9.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}K8.lastIndex=z;let q=K8.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"?Yz:Qz;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 W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let H=$.indexOf(">",z);if(H===-1)return-1;if(W[1].toLowerCase()===Y){let U=$.slice(z,H+1);if(!(/\/\s*>$/.test(U)||P9.has(Y)))G++}z=H+1}return-1}var Gz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function zz($,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 Gz.test(Q)}function O8($){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=(H)=>Z.some(([U,j])=>H>=U&&H<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[H,U,j,B,V,_,O]=z,F=Xz(V);if(F===void 0)continue;let L=z.index,w=L+H.length,M=!!O||/\/\s*>$/.test(H)||P9.has(U.toLowerCase())?w:L8($,L,U,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&zz($,M)){Q.lastIndex=w;continue}if(F===!0){let D=`<${U}${j}${_}${O}>`;G.push({start:L,end:w,replacement:D});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((H,U)=>H.start-U.start);let K=[],q=-1;for(let H of G){if(H.start<q)continue;K.push(H),q=H.end}let W=$;for(let H=K.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=K[H];W=W.substring(0,U)+B+W.substring(j)}return W}function c3($,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,W=1,H=q;while(H<J.length&&W>0){if(J[H]==="(")W++;else if(J[H]===")")W--;H++}if(W!==0)continue;let U=J.substring(q,H-1).trim(),j=H,B=B8(U),V=z==="for"?"@endfor":"@endforeach",_=1,O=j,F=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");F.lastIndex=j;let L;while((L=F.exec(J))!==null)if(L[1].startsWith(z))_++;else if(_--,_===0){O=L.index+L[0].length;break}if(_!==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 k=I.split(/[.[(]/)[0].trim(),A=Z?k in Z:!1,E=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(k));if(k&&(A||E)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=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=c3(N,R),T=M.match(j8),D;if(T){let[,I,k,A]=T;D=`<${I}${k} @for="${U}">${A}</${I}>`}else D=`<template @for="${U}">${M}</template>`;Q.push({start:K,end:O,replacement:D}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:W}=Q[z];J=J.substring(0,K)+W+J.substring(q)}return J}function Kz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let H=X+1;while(H<Q){let U=$[H];if(U==="\\"){H+=2;continue}if(U===W)return H+1;H++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
3477
- `)W++;return W},K=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},q=(W)=>{let H=W,U=0;while(H<Q){let j=$[H];if(j==="/"&&$[H+1]==="/"){let B=H+2;while(B<Q&&$[B]!==`
3478
- `)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){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(W),X++}return J.join("")}var qz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function m3($,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(!m3(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Hz($,Z){if(Wz($,"<body",Z)){let Y=new RegExp(`<body(${u3})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!m3(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(${u3})>`,"gi"),X;while((X=J.exec($))!==null){if(m3(X.index,X.index+X[0].length,Z))continue;if(qz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Uz($,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 jz($,Z,J){let X=aG($,{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-tscr6bs8.js"));for(let F of X){let L=F.body;if(I1(F.attrs))L=T1(L);if(Y.test(L)){Q.push({content:L,start:F.start,end:F.end});continue}if(!G(L))continue;try{let w=await z($2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:F.start,end:F.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((F)=>F.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let F=0;F<Q.length;F++){let L=Q[F].bundled??$2(Q[F].content).code;if(!Q[F].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Oz(L);let w=a0(L);W.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
3479
- ${w}`)}let H=W.join(`
3480
-
3481
- `);H=Kz(H);let U=Bz(H),j=U.split(",").map((F)=>F.trim()).filter(Boolean),B=d3(H,J),V=`
3473
+ ${$.slice(J)}`}var iG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function nG($){return iG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function sG($,Z){if(!$.includes("</body>"))return $;if(nG($))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 e6(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${$8(K)};</script>
3474
+ `}let{getCachedRouterScript:Q,getServeClientAsset:Y}=await import("./chunk-1djdz98r.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 Y("router")).url}"></script>`:`<script data-stx-router>${await Q()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3475
+ </body>`+$.slice(z+7)}var Y8=Symbol.for("stx.lazy-module-promises");function oG(){let $=globalThis;return $[Y8]??=new Map,$[Y8]}function s($,Z){let J=oG(),X=`${import.meta.url}\x00${$}`,Q=J.get(X);if(Q)return Q;let Y=Z();return J.set(X,Y),Y.catch(()=>{if(J.get(X)===Y)J.delete(X)}),Y}var u3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,j8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,rG=65536,aG=4,S9=new Map;function BL(){S9.clear()}function tG($){let Z=[];for(let J of S2($,K2)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let Y=X[0].length,G=J.token.length-Q[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Y,G),start:J.start,end:J.end}))}return Z}function eG($,Z={}){let J=$.length>=rG,X=J?S9.get($):void 0;if(X===void 0){if(X=tG($),J)U8(S9,aG),S9.set($,X)}let Q=Z.skipAttrs;if(!Q)return X.slice();let Y=[];for(let G of X)if(Q.lastIndex=0,!Q.test(G.attrs))Y.push(G);return Y}function B8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),Y=J[2].trim(),{itemVar:G,indexVar:z}=Q8(Y);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),Y=X[2].trim(),{itemVar:G,indexVar:z}=Q8(Q);if(G)return{style:"in",iterable:Y,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Q8($){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 Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let Y=Z.match(/^(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:null};return{itemVar:null,indexVar:null}}function l3($,Z){return H8($,Z)}function $z($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function Zz($){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,Q;while((Q=J.exec($))!==null){let Y=Q[1],G;while((G=X.exec(Y))!==null)Z.add(G[1])}return Z}function Jz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${u3})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=S2($,(Y,G)=>{Z.lastIndex=G;let z=Z.exec(Y);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Q=[];for(let Y of X){Z.lastIndex=0;let G=Z.exec(Y.token);if(!G)continue;let z=G[2].match(J),K=B8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let H=G[1],U=/\/\s*>$/.test(Y.token)||P9.has(H.toLowerCase())?Y.end:L8($,Y.start,H,Y.end);if(U!==-1)Q.push({start:Y.start,end:U,vars:new Set(q)})}return Q}var G8=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 Xz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function z8($,Z,J,X){if(!$)return!1;let Q=Xz($),Y=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Q))!==null){let j=q[1];if(Q.slice(0,q.index).trimEnd().endsWith("."))continue;if(G8.has(j))continue;if(Z.has(j)||X?.has(j))Y=!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(Q))!==null){let j=W[1];if(Q.slice(0,W.index).trimEnd().endsWith("."))continue;if(G8.has(j)||J&&j in J)continue;z=!0}return(Y||z)&&!G}function C9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Q=$.trim(),Y=Q.match(j8);if(Y&&Yz(Y[3],Y[1])){let[,G,z,K]=Y;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Q}</template>`}function Yz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=J.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function V8($,Z){let J=Zz($);function X(Q){let Y=Q,G=Jz(Q),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(Y))!==null){let W=q.index,U=W+q[0].length,j=1,B=U;while(B<Y.length&&j>0){if(Y[B]==="(")j++;else if(Y[B]===")")j--;B++}if(j!==0)continue;let V=Y.substring(U,B-1).trim(),_=B,O=1,F=_,L=/@(if\s*\(|endif)/g;L.lastIndex=_;let w;while((w=L.exec(Y))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let N=Y.substring(_,F-6).trim(),R;if($z(N)){let M=_2(Y.substring(W,F));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),D=z(W);if(!(T.length>0&&T.every((A)=>z8(A.condition,J,Z,D))))continue;R=M[0].branches.map((A)=>{let E=X(A.content);if(A.type==="elseif")return C9(E,"@else-if",A.condition??"");if(A.type==="else")return C9(E,"@else");return C9(E,"@if",A.condition??"")}).join(`
3476
+ `)}else{if(!z8(V,J,Z,z(W)))continue;R=C9(X(N),"@if",V)}H.push({start:W,end:F,replacement:R}),K.lastIndex=F}for(let W=H.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=H[W];Y=Y.substring(0,U)+B+Y.substring(j)}return Y}return X($)}function Qz($){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 Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var P9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),K8=/<(script|style)\b/iy,Gz=/<\/script/gi,zz=/<\/style/gi;function L8($,Z,J,X){if(P9.has(J.toLowerCase()))return X;let Q=J.toLowerCase(),Y=$.length,G=1,z=X;while(z<Y){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}K8.lastIndex=z;let q=K8.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"?Gz:zz;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()===Q){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()===Q){let U=$.slice(z,W+1);if(!(/\/\s*>$/.test(U)||P9.has(Q)))G++}z=W+1}return-1}var Kz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function qz($,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 Q=$.indexOf(">",J);if(Q===-1)return!1;let Y=$.slice(J,Q+1);return Kz.test(Y)}function O8($){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 Q=(W)=>Z.some(([U,j])=>W>=U&&W<j),Y=/<([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=Y.exec($))!==null){if(Q(z.index))continue;let[W,U,j,B,V,_,O]=z,F=Qz(V);if(F===void 0)continue;let L=z.index,w=L+W.length,M=!!O||/\/\s*>$/.test(W)||P9.has(U.toLowerCase())?w:L8($,L,U,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&qz($,M)){Y.lastIndex=w;continue}if(F===!0){let D=`<${U}${j}${_}${O}>`;G.push({start:L,end:w,replacement:D});continue}G.push({start:L,end:M,replacement:""}),Y.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 c3($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Q,Y=[],G=[];while((Q=X.exec(J))!==null){let z=Q[1],K=Q.index,q=K+Q[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=B8(U),V=z==="for"?"@endfor":"@endforeach",_=1,O=j,F=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");F.lastIndex=j;let L;while((L=F.exec(J))!==null)if(L[1].startsWith(z))_++;else if(_--,_===0){O=L.index+L[0].length;break}if(_!==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 k=I.split(/[.[(]/)[0].trim(),A=Z?k in Z:!1,E=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(k));if(k&&(A||E)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=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=c3(N,R),T=M.match(j8),D;if(T){let[,I,k,A]=T;D=`<${I}${k} @for="${U}">${A}</${I}>`}else D=`<template @for="${U}">${M}</template>`;Y.push({start:K,end:O,replacement:D}),X.lastIndex=O}for(let z=Y.length-1;z>=0;z--){let{start:K,end:q,replacement:H}=Y[z];J=J.substring(0,K)+H+J.substring(q)}return J}function Wz($){let Z=new Set,J=[],X=0,Q=0,Y=$.length,G=(H)=>{let W=X+1;while(W<Y){let U=$[W];if(U==="\\"){W+=2;continue}if(U===H)return W+1;W++}return Y},z=()=>{let H=X+2;while(H<Y&&$[H]!==`
3477
+ `)H++;return H},K=()=>{let H=X+2;while(H<Y-1){if($[H]==="*"&&$[H+1]==="/")return H+2;H++}return Y},q=(H)=>{let W=H,U=0;while(W<Y){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<Y&&$[B]!==`
3478
+ `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Y-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Y){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 Y};while(X<Y){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==="{"){Q++,J.push(H),X++;continue}if(H==="}"){Q--,J.push(H),X++;continue}if(Q===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 Hz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function m3($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function Uz($,Z,J){let X=0;while(X<$.length){let Q=$.indexOf(Z,X);if(Q===-1)return!1;if(!m3(Q,Q+Z.length,J))return!0;X=Q+Z.length}return!1}function jz($,Z){if(Uz($,"<body",Z)){let Q=new RegExp(`<body(${u3})>`,"g"),Y;while((Y=Q.exec($))!==null)if(!m3(Y.index,Y.index+Y[0].length,Z))return Y.index+Y[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${u3})>`,"gi"),X;while((X=J.exec($))!==null){if(m3(X.index,X.index+X[0].length,Z))continue;if(Hz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Bz($,Z,J,X){let Q=[],Y=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Q.push($.slice(G,J),Y,$.slice(J,q)),z=!0;else Q.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Q.join("")}async function Vz($,Z,J){let X=eG($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\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*\(/,Y=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-5hhng72w.js"));for(let F of X){let L=F.body;if(I1(F.attrs))L=T1(L);if(Q.test(L)){Y.push({content:L,start:F.start,end:F.end});continue}if(!G(L))continue;try{let w=await z($2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Q.test(w))Y.push({content:L,start:F.start,end:F.end})}catch{}}if(Y.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Y.map((F)=>F.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,H=[];for(let F=0;F<Y.length;F++){let L=Y[F].bundled??$2(Y[F].content).code;if(!Y[F].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Fz(L);let w=a0(L);H.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
3479
+ ${w}`)}let W=H.join(`
3480
+
3481
+ `);W=Wz(W);let U=Lz(W),j=U.split(",").map((F)=>F.trim()).filter(Boolean),B=d3(W,J),V=`
3482
3482
  <script data-stx-scoped>
3483
3483
  function ${q}() {
3484
3484
  ${s1("const",j)}
3485
- ${e1(`${B}${H}`)}
3485
+ ${e1(`${B}${W}`)}
3486
3486
  return { ${U} };
3487
3487
  }
3488
3488
  window.__stx_latestSetup=${q};
3489
3489
  if(window.stx)window.stx._latestSetup=${q};
3490
- </script>`,_=Hz($,Q);return{output:Uz($,Q,_,q),setupCode:V}}function Bz($){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
- `)return;Q++}},q=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},W=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},H=()=>{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]==='"')W(Z[Q]);else if(Z[Q]==="`")H();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 N=w.indexOf(":"),M=(N>=0?w.slice(N+1).trim():w).split(/[\s=]/)[0];if(M&&!X.has(M))J.push(M),X.add(M)});return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let N=w.split(/[\s=]/)[0];if(N&&!X.has(N))J.push(N),X.add(N)});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 F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){H(),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 _8($,Z,J,X){if(!l3($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await jz(Y,J,X);if(Y=Q,!G){let z=p0(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 y9(Y,Z),G){let z=q8(Y,/<\/head>/i),K=z===-1?q8(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
3493
- ${Y.slice(z)}`;else if(K!==-1){let q=/<body[^>]*>/i.exec(Y.slice(K))[0],W=K+q.length;Y=`${Y.slice(0,W)}
3494
- ${G}${Y.slice(W)}`}else Y=`${Y}
3495
- ${G}`}return Y}function q8($,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(([W,H])=>K>=W&&K<H))return K;G=K+Math.max(z[0].length,1)}return-1}var W8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Vz($){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 W8;return`var ${Z.join(", ")}; ${W8}`}var Lz=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Oz($){return $.replace(Lz,(Z,J)=>Vz(J))}import J2 from"path";import F8 from"process";function Z2($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(F8.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 VL($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(F8.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function w8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function R8($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=J2.join(Y,$);if(await Bun.file(G).exists())return G;Y=J2.dirname(Y)}X=J2.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=J2.resolve(Z,$);else X=J2.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var N8=Symbol.for("stx.inline-assets.import-meta");function _z($,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[N8]=!0,J}async function D8($,Z,J){let X=$,Y=J2.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[q,W,H,U]=G;if(w8(H))continue;let j=await R8(H,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),H.endsWith(".ts")||H.endsWith(".tsx")){let _=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:Z2()});if(_.outputs.length>0)B=await _.outputs[0].text(),_z(B,H)}let V=`<script>
3497
- // Source: ${H}
3490
+ </script>`,_=jz($,Y);return{output:Bz($,Y,_,q),setupCode:V}}function Lz($){let Z=$,J=[],X=new Set,Q=0,Y=0,G=Z.length,z="",K=()=>{Y++;let B=!1;while(Y<G){let V=Z[Y];if(V==="\\"){Y+=2;continue}if(V==="["&&!B){B=!0,Y++;continue}if(V==="]"&&B){B=!1,Y++;continue}if(V==="/"&&!B){Y++;while(Y<G&&/[gimsuyd]/.test(Z[Y]))Y++;return}if(V===`
3491
+ `)return;Y++}},q=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},H=(B)=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]===B){Y++;return}Y++}},W=()=>{Y++;while(Y<G){if(Z[Y]==="\\"){Y+=2;continue}if(Z[Y]==="`"){Y++;return}if(Z[Y]==="$"&&Z[Y+1]==="{"){Y+=2;let B=1;while(Y<G&&B>0)if(Z[Y]==="{")B++,Y++;else if(Z[Y]==="}")B--,Y++;else if(Z[Y]==="'"||Z[Y]==='"')H(Z[Y]);else if(Z[Y]==="`")W();else Y++;continue}Y++}},U=()=>{if(Z[Y]==="/"&&Z[Y+1]==="/"){while(Y<G&&Z[Y]!==`
3492
+ `)Y++;return!0}if(Z[Y]==="/"&&Z[Y+1]==="*"){Y+=2;while(Y<G-1&&!(Z[Y]==="*"&&Z[Y+1]==="/"))Y++;return Y+=2,!0}return!1},j=()=>{if(Q!==0)return;let B=Z.slice(Y).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(Y).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let N=w.indexOf(":"),M=(N>=0?w.slice(N+1).trim():w).split(/[\s=]/)[0];if(M&&!X.has(M))J.push(M),X.add(M)});return}let _=Z.slice(Y).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let N=w.split(/[\s=]/)[0];if(N&&!X.has(N))J.push(N),X.add(N)});return}let O=Z.slice(Y).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 F=Z.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!X.has(L))J.push(L),X.add(L)}};while(Y<G){if(U())continue;if(Z[Y]==="'"||Z[Y]==='"'){H(Z[Y]),z=Z[Y-1];continue}if(Z[Y]==="`"){W(),z="`";continue}if(Z[Y]==="/"&&Z[Y+1]!=="/"&&Z[Y+1]!=="*"&&q()){K(),z="/";continue}if(Z[Y]==="{"){Q++,z="{",Y++;continue}if(Z[Y]==="}"){Q--,z="}",Y++;continue}if(Q===0&&/[a-z]/i.test(Z[Y])&&(Y===0||/\s|[;{}()]/.test(Z[Y-1])))j();if(!/\s/.test(Z[Y]))z=Z[Y];Y++}return J.join(", ")}async function _8($,Z,J,X){if(!l3($,J))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:Y,setupCode:G}=await Vz(Q,J,X);if(Q=Y,!G){let z=p0(Q);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>");Q=Q.slice(0,z.index)+K+Q.slice(z.index+z.tag.length)}}if(Q=await y9(Q,Z),G){let z=q8(Q,/<\/head>/i),K=z===-1?q8(Q,/<body[^>]*>/i):-1;if(z!==-1)Q=`${Q.slice(0,z)}${G}
3493
+ ${Q.slice(z)}`;else if(K!==-1){let q=/<body[^>]*>/i.exec(Q.slice(K))[0],H=K+q.length;Q=`${Q.slice(0,H)}
3494
+ ${G}${Q.slice(H)}`}else Q=`${Q}
3495
+ ${G}`}return Q}function q8($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let Y=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Y.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 W8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Oz($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return W8;return`var ${Z.join(", ")}; ${W8}`}var _z=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Fz($){return $.replace(_z,(Z,J)=>Oz(J))}import J2 from"path";import F8 from"process";function Z2($="STX_PUBLIC_"){let Z={},J={};for(let[X,Q]of Object.entries(F8.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),J[X]=Q}return Z["import.meta.env"]=JSON.stringify(J),Z}function OL($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(F8.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function w8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function R8($,Z,J){try{let X;if($.startsWith("/")){let Q=Z;for(let Y=0;Y<5;Y++){let G=J2.join(Q,$);if(await Bun.file(G).exists())return G;Q=J2.dirname(Q)}X=J2.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=J2.resolve(Z,$);else X=J2.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var N8=Symbol.for("stx.inline-assets.import-meta");function wz($,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[N8]=!0,J}async function D8($,Z,J){let X=$,Q=J2.dirname(Z),Y=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Y.exec(X))!==null){let[q,H,W,U]=G;if(w8(W))continue;let j=await R8(W,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let _=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:Z2()});if(_.outputs.length>0)B=await _.outputs[0].text(),wz(B,W)}let V=`<script>
3497
+ // Source: ${W}
3498
3498
  ${B}
3499
- </script>`;X=X.replace(q,V),Q.lastIndex=0}catch(B){if(B?.[N8])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=z.exec(X))!==null){let[q,W,H,U]=K,j=W+U;if(w8(H))continue;if(/rel=["']stylesheet["']/.test(j)||H.endsWith(".css")){let V=await R8(H,Y,Z);if(V)try{let _=await Bun.file(V).text();J.add(V);let O=`<style>
3500
- /* Source: ${H} */
3499
+ </script>`;X=X.replace(q,V),Y.lastIndex=0}catch(B){if(B?.[N8])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(w8(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let V=await R8(W,Q,Z);if(V)try{let _=await Bun.file(V).text();J.add(V);let O=`<style>
3500
+ /* Source: ${W} */
3501
3501
  ${_}
3502
- </style>`;X=X.replace(q,O),z.lastIndex=0}catch(_){}}}return X}function p3($,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,W=!1;while(K<J.length&&z>0){let L=J[K];if(W){W=!1,K++;continue}if(L==="\\"&&q){W=!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 H=J.substring(G+1,K).trim(),U=J.substring(Q,K+1),j=-1,B=0,V=null,_=!1;for(let L=0;L<H.length;L++){let w=H[L];if(_){_=!1;continue}if(w==="\\"&&V){_=!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?H.substring(0,j).trim():H,F=j>=0?H.substring(j+1).trim():void 0;try{let L=O.trim(),w;if(j0(L))w=W0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let N;if(F==="true")N=JSON.stringify(w,null,2);else N=JSON.stringify(w);let R=N.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){n0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+U.length}}return J}function i3($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function I8($){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(),W=K,H=Z.slice(W),U=H.indexOf("@endmemo");if(U===-1)continue;let j=H.slice(0,U),B=W+U+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),_=V?V[0].length:0,O=j.slice(_),F=j.match(/(\s*)$/),L=F?F[0].length:0,w=O.slice(0,O.length-L),N=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(N){let[M,T,D="",I]=N,k=`<${T}${D} data-stx-memo="${q}"${I}>`;R=j.slice(0,_)+k+w.slice(M.length)+j.slice(_+w.length)}else R=`${j.slice(0,_)}<div data-stx-memo="${q}">${w}</div>${j.slice(_+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 n3($){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 T8($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=y2($,(K,q)=>{J.lastIndex=q;let W=J.exec(K);if(!W||/^(?:script|style)$/i.test(W[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:K,end:q,token:W}of X){let H=/^<\/?([\w-]+)/.exec(W)[1].toLowerCase();if(W.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===H)break}continue}let U=/\sdata-stx-scope\s*=/.test(W);if(!Q&&!U&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(W)&&!/\sdata-stx-ref-caller\s*=/.test(W))z.push($.slice(G,K),W.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=q;if(!k8.has(H)&&!/\/>$/.test(W)){if(Y.push({name:H,scoped:U}),U)Q++}}return z.push($.slice(G)),z.join("")}var k8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,M8=/<\/?\s*([a-z][\w-]*)/iy,Fz=/\s/;function wz($,Z){let J=Z-1;while(J>=0&&Fz.test($[J]))J--;return J>=0&&$[J]==="/"}function Rz($,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 Nz($,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 H=$.indexOf(Q?"}":"{",X);if(H===-1||H>=K){if(Q)G=!1;else Y=!1;break}if(H>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=H+1}X=K;continue}if($.startsWith("<!--",X)){let H=$.indexOf("-->",X);X=H===-1?$.length:H+3;continue}let q=Rz($,X);if(q===-1)break;M8.lastIndex=X;let W=M8.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!wz($,q)&&!k8.has(W))J++;X=q+1}return!1}function b8($){if($.length>=32768&&!A8($))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,W=-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===">"){W=z;break}z++}if(W===-1)continue;let H=$.slice(G,W+1);if(E8.test(H))continue;if(H.includes("x-cloak"))continue;if(Nz($,W+1))X+=$.slice(Y,W)+" x-cloak>",Y=W+1}return X+=$.slice(Y),X}var Dz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Mz=/<\/script>/gi,Az=/<\/style>/gi;function y8($){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"?Mz:Az;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,W=-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===">"){W=z;break}z++}if(W===-1)continue;let H=$.slice(Q+Y[0].length,W);if(E8.test(H))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(H))continue;if(!Dz.test(H))continue;let U=$[W-1]==="/",j=U?W-1:W;J+=`${$.slice(X,j)} x-cloak${U?" ":""}`,X=j}return J+=$.slice(X),J}var s3=y1(256),Iz=[{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 o3($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=H1($,Z,X,JSON.stringify(Y)),G=s3.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],K=[],q=H0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of Iz){if(z.some((O)=>/\w/.test(O)&&B.includes(O)))continue;j.lastIndex=0;let _=q.match(j);if(_&&_.length>0){let O=q.split(`
3502
+ </style>`;X=X.replace(q,O),z.lastIndex=0}catch(_){}}}return X}function p3($,Z){let J=$,X=/@json\s*\(/g,Q;while((Q=X.exec(J))!==null){let Y=Q.index,G=Y+Q[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(Y,K+1),j=-1,B=0,V=null,_=!1;for(let L=0;L<W.length;L++){let w=W[L];if(_){_=!1;continue}if(w==="\\"&&V){_=!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,F=j>=0?W.substring(j+1).trim():void 0;try{let L=O.trim(),w;if(j0(L))w=W0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let N;if(F==="true")N=JSON.stringify(w,null,2);else N=JSON.stringify(w);let R=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Y)+R+J.substring(K+1),X.lastIndex=Y+R.length}catch(L){n0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Y+U.length}}return J}function i3($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function I8($){let Z=$,J=/@memo\s*\(/g,X,Q=[];while((X=J.exec(Z))!==null){let Y=X.index,G=Y+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*)*)/),_=V?V[0].length:0,O=j.slice(_),F=j.match(/(\s*)$/),L=F?F[0].length:0,w=O.slice(0,O.length-L),N=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(N){let[M,T,D="",I]=N,k=`<${T}${D} data-stx-memo="${q}"${I}>`;R=j.slice(0,_)+k+w.slice(M.length)+j.slice(_+w.length)}else R=`${j.slice(0,_)}<div data-stx-memo="${q}">${w}</div>${j.slice(_+w.length)}`;Q.push({start:Y,end:B,replacement:R}),J.lastIndex=B}for(let Y=Q.length-1;Y>=0;Y--){let G=Q[Y];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function n3($){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 T8($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=S2($,(K,q)=>{J.lastIndex=q;let H=J.exec(K);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return J.lastIndex}),Q=[],Y=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=Q.pop()){if(j.scoped)Y--;if(j.name===W)break}continue}let U=/\sdata-stx-scope\s*=/.test(H);if(!Y&&!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(!k8.has(W)&&!/\/>$/.test(H)){if(Q.push({name:W,scoped:U}),U)Y++}}return z.push($.slice(G)),z.join("")}var k8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,M8=/<\/?\s*([a-z][\w-]*)/iy,Rz=/\s/;function Nz($,Z){let J=Z-1;while(J>=0&&Rz.test($[J]))J--;return J>=0&&$[J]==="/"}function Dz($,Z){let J=!1,X=!1;for(let Q=Z;Q<$.length;Q++){let Y=$[Q];if(J){if(Y==="'")J=!1}else if(X){if(Y==='"')X=!1}else if(Y==="'")J=!0;else if(Y==='"')X=!0;else if(Y===">")return Q}return-1}function Mz($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Q=!1,Y=!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(Y?"}":"{",X);if(W===-1||W>=K){if(Y)G=!1;else Q=!1;break}if(W>X)if(Y)G=!1;else Q=!1;if(Y){if(G)return!0;G=!0}else if(Q)Y=!0,G=!1;else Q=!0;X=W+1}X=K;continue}if($.startsWith("<!--",X)){let W=$.indexOf("-->",X);X=W===-1?$.length:W+3;continue}let q=Dz($,X);if(q===-1)break;M8.lastIndex=X;let H=M8.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!Nz($,q)&&!k8.has(H))J++;X=q+1}return!1}function b8($){if($.length>=32768&&!A8($))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="",Q=0,Y;while((Y=J.exec($))!==null){let G=Y.index,z=G+Y[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(E8.test(W))continue;if(W.includes("x-cloak"))continue;if(Mz($,H+1))X+=$.slice(Q,H)+" x-cloak>",Q=H+1}return X+=$.slice(Q),X}var Az=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Iz=/<\/script>/gi,Tz=/<\/style>/gi;function y8($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Q;while((Q=Z.exec($))!==null){let Y=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?Iz:Tz;B.lastIndex=Y;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Y+Q[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(Y+Q[0].length,H);if(E8.test(W))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(W))continue;if(!Az.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 s3=y1(256),kz=[{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 o3($,Z,J,X){let Q=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Q.enabled)return;let Y=H1($,Z,X,JSON.stringify(Q)),G=s3.get(Y);if(G!==void 0){if(G&&Q.failOnViolation)throw Error(G);return}let z=Q.allowPatterns??[],K=[],q=H0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of kz){if(z.some((O)=>/\w/.test(O)&&B.includes(O)))continue;j.lastIndex=0;let _=q.match(j);if(_&&_.length>0){let O=q.split(`
3503
3503
  `),F=$.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(", ")})`:"",N=L.slice(0,3).map((M)=>` ${M} | ${(F[M-1]??"").trim().slice(0,100)}`).join(`
3505
3505
  `),R=N?`
3506
3506
  ${N}`:"";K.push(` \u2717 ${B}${w}
3507
- \u2192 ${V}${R}`)}}if(K.length===0){s3.set(Q,"");return}let W=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},U=`[STX] DOM API violation in ${X&&X!==Z?`${W(X)} (composed into ${W(Z)})`:W(Z)}:
3507
+ \u2192 ${V}${R}`)}}if(K.length===0){s3.set(Y,"");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(s3.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}bz();import r3 from"path";var Tz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,kz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Ez($,Z){if(!Z||!$.includes("/"))return $;let J=r3.dirname(Z);return $.replace(Tz,(X,Y,Q,G)=>{let z=r3.resolve(J,G);return`${Y}${Q}${z.split(r3.sep).join("/")}${Q}`})}function C8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(kz,(J,X,Y,Q)=>`${X}${Ez(Y,Z)}${Q}`)}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";function S8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Cz($,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
- `,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 W=$[K];if(W==="\\"){K+=2;continue}if(W==="[")q=!0;else if(W==="]")q=!1;else if(W==="/"&&!q){K++;break}else if(W===`
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 t8($,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 P8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-7kcfbc0j.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:Q}=await import("./chunk-e4yskgtb.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${Q(Y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function Sz($,Z=""){let J=t8($,"data-stx-runtime");if(!J)return $;let X=W2($);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
- `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=W2(Q);if(G===-1)return Y+Z+`
3515
- `+Q;return Q.slice(0,G)+Y+Z+`
3516
- `+Q.slice(G)}async function t3($,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;C3(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await g9(Z,J,X.runtimeConfig);if(Q)w$(Z),Z.__stx_head_injections=T3(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!N9()&&!D9())&&J&&J.endsWith(".stx"))n8($,J);try{return await l8.timeAsync("template-processing",async()=>{let G=await Pz($,Z,J,X,Y);if(Q)G=n3(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??i8(),W=(Z.__stx_head_raw||"").trim(),H,U=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)H=U[1].trim(),W=W.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||H||j,V=!q.title&&(!!H||!!j),_=q.meta||[],O=new Set(_.map((M)=>t1(M)).filter(Boolean)),F={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!O.has(t1(M))),..._],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
3517
- `),...q.htmlAttrs&&{htmlAttrs:p6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=f3(G);if(G=s6(G,F,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=n6(G,z),G=i6(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=m8(M);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
3510
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(s3.set(Y,U),Q.failOnViolation)throw Error(U);else console.warn(U)}Cz();import r3 from"path";var Ez=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,bz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function yz($,Z){if(!Z||!$.includes("/"))return $;let J=r3.dirname(Z);return $.replace(Ez,(X,Q,Y,G)=>{let z=r3.resolve(J,G);return`${Q}${Y}${z.split(r3.sep).join("/")}${Y}`})}function C8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(bz,(J,X,Q,Y)=>`${X}${yz(Q,Z)}${Y}`)}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";function S8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pz($,Z){let J=$.length,X=Z,Q=!0,Y=[],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
+ `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Q=!0;continue}if(z==="/"&&Q){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
+ `){K=-1;break}K++}if(K===-1){X++,Q=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Q=!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++}Q=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}if(Y.length===0)Q=!1;continue}if(z==="}"&&Y.length>0){Y.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Q=!1;else Q=!0;X++}return-1}function $Z($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,Y=$.indexOf("</script>",Q);if(Y===-1)return null;let G=$.indexOf(">",Y);if(G===-1)return null;return{start:X.index,end:G+1}}async function P8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-1caep9rn.js")),Q=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Q)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:Y}=await import("./chunk-1djdz98r.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${Y(Q)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Q.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function vz($,Z=""){let J=$Z($,"data-stx-runtime");if(!J)return $;let X=W2($);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
+ `+$.slice(X,J.start)+$.slice(J.end);let Q=$.slice(J.start,J.end),Y=$.slice(0,J.start)+$.slice(J.end),G=W2(Y);if(G===-1)return Q+Z+`
3515
+ `+Y;return Y.slice(0,G)+Q+Z+`
3516
+ `+Y.slice(G)}async function t3($,Z,J,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Y=!Z.__stxProcessingDepth;C3(Z);for(let G of X._layerGraph?.configDependencies??[])Q.add(G);if(Y&&X.runtimeConfig)await g9(Z,J,X.runtimeConfig);if(Y)w$(Z),Z.__stx_head_injections=T3(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!k2()&&!E2())&&J&&J.endsWith(".stx"))o8($,J);try{return await p8.timeAsync("template-processing",async()=>{let G=await xz($,Z,J,X,Q);if(Y)G=n3(G);if(Y&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??s8(),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),_=q.meta||[],O=new Set(_.map((M)=>t1(M)).filter(Boolean)),F={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!O.has(t1(M))),..._],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
3517
+ `),...q.htmlAttrs&&{htmlAttrs:p6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=f3(G);if(G=s6(G,F,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=n6(G,z),G=i6(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=l8(M);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
3518
3518
  <meta name="stx-layout" content="${S8(M)}">
3519
- <meta name="stx-layout-group" content="${S8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=v1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??T3(),K=v3(G);if(K!==null)z.beforeClose.push(K);let q=y3(G);if(q!==null)z.afterOpen.push(q);G=y6(G,z);let W=X.app?.colorMode;if(W)G=P6(G,W)}if(Q)if(t8(G,"data-stx-runtime")){let K=null,q=null,W=null,H=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-9p5gbhwp.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await P8([G,q],X);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-3n8avn17.js"));H=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-a29x23g7.js")),B=X.composablesDir,V=[K,q,H].filter((O)=>O!==null),_=await j(X._layerComposableDirs??B,G,V);if(_)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${_}</script>`}catch{}let U=[K,q,W,H].filter((j)=>j!==null).map((j)=>`
3520
- ${j}`).join("");G=Sz(G,U)}else{let K=await P8([G],X);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=v6(G);if(Q&&Z.__stx_inject_css!==!1)G=await p8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=c8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=d8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=u6(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 x8)throw G;let z=G instanceof Error?G.message:String(G),K=new C2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(n0.log(K,{filePath:J,context:Z}),g8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return f8.createFallbackContent("Template Processing",K)}}async function Pz($,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 fz(J,Z),xz(Z,z),K=await S2(()=>w6(K,Z,J,z),K,(L)=>{n0.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=B1(K,R9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let W=q.tokens,H=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,N)=>W[Number(N)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=A6(K),K=await D8(K,J,Y);let j={};K=R3(K,j);let B={...Z.__sections||{}},V="",_=X7(J7($)),O=/@nolayout\b/.test(K)||_===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let F=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)V=F[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof _==="string"){if(V=_,!/@section\s*\(/.test(K))K=`@section('content')
3519
+ <meta name="stx-layout-group" content="${S8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=v1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Y){let z=Z.__stx_head_injections??T3(),K=v3(G);if(K!==null)z.beforeClose.push(K);let q=y3(G);if(q!==null)z.afterOpen.push(q);G=y6(G,z);let H=X.app?.colorMode;if(H)G=P6(G,H)}if(Y)if($Z(G,"data-stx-runtime")){let K=null,q=null,H=null,W=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-zz2yxsf9.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await P8([G,q],X);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-8tghv8cf.js"));W=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-maq5jag2.js")),B=X.composablesDir,V=[K,q,W].filter((O)=>O!==null),_=await j(X._layerComposableDirs??B,G,V);if(_)H=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${_}</script>`}catch{}let U=[K,q,H,W].filter((j)=>j!==null).map((j)=>`
3520
+ ${j}`).join("");G=vz(G,U)}else{let K=await P8([G],X);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(Y)G=v6(G);if(Y&&Z.__stx_inject_css!==!1)G=await n8(G,void 0,X.buildMode==="serve",!0);else if(Y)G=i8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Y&&Z.__stx_runtime_config)G=c8(G,Z.__stx_runtime_config);if(Y&&!Z.__stx_defer_server_data){let z=u6(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 g8)throw G;let z=G instanceof Error?G.message:String(G),K=new P2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(n0.log(K,{filePath:J,context:Z}),u8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return h8.createFallbackContent("Template Processing",K)}}async function xz($,Z,J,X,Q){let Y=process.cwd(),G={...X,partialsDir:X.partialsDir&&!y0.isAbsolute(X.partialsDir)?y0.resolve(Y,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!y0.isAbsolute(X.componentsDir)?y0.resolve(Y,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!y0.isAbsolute(X.layoutsDir)?y0.resolve(Y,X.layoutsDir):X.layoutsDir},z=G,K=$;await hz(J,Z),gz(Z,z),K=await v2(()=>w6(K,Z,J,z),K,(L)=>{n0.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=B1(K,D9,(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,N)=>H[Number(N)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=A6(K),K=await D8(K,J,Q);let j={};K=R3(K,j);let B={...Z.__sections||{}},V="",_=X7(J7($)),O=/@nolayout\b/.test(K)||_===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let F=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)V=F[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof _==="string"){if(V=_,!/@section\s*\(/.test(K))K=`@section('content')
3522
3522
  ${K.trim()}
3523
3523
  @endsection`}if(!V&&!O&&z.defaultLayout){let L=x3(K),w=/@section\s*\(/.test(K);if(!L||w){let N="",R=y0.dirname(J),M=z.layoutsDir?y0.dirname(z.layoutsDir):process.cwd();for(let T=0;T<20;T++){let D=y0.join(R,"_layout.stx");if(await t(D)){N=D;break}let I=y0.dirname(R);if(I===R||I.length<M.length)break;R=I}if(N)V=N;else if(z.layoutsDir){let T=y0.isAbsolute(z.layoutsDir)?z.layoutsDir:y0.resolve(process.cwd(),z.layoutsDir),D=y0.join(T,`${z.defaultLayout}.stx`);if(await t(D))V=D}if(V&&!w)K=`@section('content')
3524
3524
  ${K.trim()}
3525
- @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,N)=>{return B[w]=N,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return L;try{let R=Y0(N.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,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",C1);else B[w]=N.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=N3(K,j),V){let L=[],w=u0(K),N=B1(w.output,n2,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let D=M==="SCRIPT"?gz(w.scripts[Number(T)],J):N.tokens[Number(T)];if(D)L.push(D);return""}),L.length>0){let R=L.join(`
3525
+ @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,N)=>{return B[w]=N,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return L;try{let R=Y0(N.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,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",C1);else B[w]=N.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=N3(K,j),V){let L=[],w=u0(K),N=B1(w.output,o2,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let D=M==="SCRIPT"?uz(w.scripts[Number(T)],J):N.tokens[Number(T)];if(D)L.push(D);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 S2(()=>$9(V,J,G,Y),null,()=>{throw new C2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let D=(A)=>{if(!A)return[];try{let E=y0.isAbsolute(A)?A:y0.resolve(process.cwd(),A);return yz.readdirSync(E).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((A,E,C)=>C.indexOf(A)===E).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(n0.log(Error(k),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${k}`),G.debug)throw new C2(k,J);return K}let w=await S2(()=>Bun.file(L).text(),"",()=>{throw new C2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=C8(w,L);let N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${L}`);let D={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,y)=>{return D[C]=y.trim(),""});for(let[E,C]of Object.entries(D))if(B[E]&&B[E].includes(C1)){let y=B[E].indexOf(C1);B[E]=B[E].slice(0,y)+C+B[E].slice(y+C1.length)}else if(!B[E])B[E]=C;let k={...Z,__sections:B},A=`@layout('${N[1]}')${I}`;return await t3(A,k,L,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=R3(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,k)=>{return T[I]=k.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,I,k)=>{if(B[I]){let A=B[I];if(A.includes(C1)){let E=T[I]||"",C=A.indexOf(C1);A=A.slice(0,C)+E+A.slice(C+C1.length)}return A}return k||""}),M=vz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=N3(M,j),Z.__originalFilePath=J,K=await v8(M,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
3528
- ${K}`,H(K)}catch(L){return n0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await v8(K,Z,J,G,Y))}function vz($,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 xz($,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 fz($,Z){await S2(()=>D6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var a3="data-stx-source";function gz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(a3))return $;return`<script ${a3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function hz($){let Z=new RegExp(`${a3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function uz($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;let K=hz(Q)??J;try{let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-jzfk5ect.js"));await q(G,Z,K,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));n0.log(W,{filePath:K,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${K}: ${W.message}`)}}}async function mz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-hsbbfp0c.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return n0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function v8($,Z,J,X,Y){let Q=$,G=X;if(await uz(Q,Z,J),Q=await mz(Q,Z,J),Q=await Q6(Q,Z,J),Q=await G6(Q,Z,J),Q=await K4(Q,Z,J,G),X1(Q))Q=V8(Q,Z),Q=c3(Q,Z);Q=O8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-39qy76ek.js"));Q=z(Q,Z),Q=V6(Q,Z,J,G,!0),Q=await E6(Q,Z,J,G,Y),Q=await O3(Q,Z,J,G,Y),Q=Z7(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-86q2h34b.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-1vt1h19d.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:H}=await s("stx/transitions",()=>import("./chunk-w5j9tbsk.js"));Q=W(Q,Z,J),Q=H(Q);let{processErrorBoundaryDirectives:U}=await s("stx/error-boundaries",()=>import("./chunk-mph46gkj.js"));Q=U(Q,Z,J);let{processSuspenseDirectives:j}=await s("stx/suspense",()=>import("./chunk-m2j5skez.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await s("stx/async-components",()=>import("./chunk-ppzz953j.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await s("stx/keep-alive",()=>import("./chunk-1c9453w0.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:_,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-dsztk2kp.js"));Q=_(Q,Z,J),Q=O(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-v6e35j4g.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await s("stx/computed",()=>import("./chunk-99b5tfxc.js"));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:M}=await s("stx/forms-validation",()=>import("./chunk-evfr2zgg.js"));Q=M(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:I,resetHead:k}=await s("stx/head",()=>import("./chunk-at622hg0.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let A=T(Q);if(Q=A.content,A.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${A.headContent}
3529
- `;if(Q=D(Q,Z),Q=I(Q,Z,J),Q=N6(Q),Q=f5(Q,Z),Q=Q4(Q),Q=_6(Q),Q=await w3(Q,Z,J,G,Y),Q=await O3(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=R$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=n3(Q),Q=r0(Q,Z,J),Q=M3(Q),Q=Q7(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=g5(Q,Z),Q=h5(Q,Z),Q=R2(Q,Z),Q=i5(Q,Z),Q=n5(Q,Z),Q=await n7(Q,Z,J,G),Q=await U7(Q,Z,J),Q=await h8(Q,Z,J,G),Q=u8(Q,Z,J,G),Q=s8(Q,Z,J,G),Q=o8(Q,Z,J),Q=r8(Q,Z,J,G),Q=X4(Q,Z,J,G),Q=p3(Q,Z),Q=i3(Q),Q=I8(Q),!G.skipEventDirectives)Q=_$(Q,Z,J);if(Q=K7(Q,Z,J),G.debug){let l=/\bx-data\s*=/.test(Q),u=l3($);if(l&&u)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,Q.add(V);else L=await v2(()=>J9(V,J,G,Q),null,()=>{throw new P2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let D=(A)=>{if(!A)return[];try{let E=y0.isAbsolute(A)?A:y0.resolve(process.cwd(),A);return Sz.readdirSync(E).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((A,E,C)=>C.indexOf(A)===E).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(n0.log(Error(k),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${k}`),G.debug)throw new P2(k,J);return K}let w=await v2(()=>Bun.file(L).text(),"",()=>{throw new P2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=C8(w,L);let N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${L}`);let D={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,y)=>{return D[C]=y.trim(),""});for(let[E,C]of Object.entries(D))if(B[E]&&B[E].includes(C1)){let y=B[E].indexOf(C1);B[E]=B[E].slice(0,y)+C+B[E].slice(y+C1.length)}else if(!B[E])B[E]=C;let k={...Z,__sections:B},A=`@layout('${N[1]}')${I}`;return await t3(A,k,L,G,Q)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=R3(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,k)=>{return T[I]=k.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,I,k)=>{if(B[I]){let A=B[I];if(A.includes(C1)){let E=T[I]||"",C=A.indexOf(C1);A=A.slice(0,C)+E+A.slice(C+C1.length)}return A}return k||""}),M=fz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=N3(M,j),Z.__originalFilePath=J,K=await f8(M,Z,L,G,Q),K=`<!-- stx-layout: ${V} -->
3528
+ ${K}`,W(K)}catch(L){return n0.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 f8(K,Z,J,G,Q))}function fz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Q)=>{let Y=Z[X];if(Y!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Y))return Y}return Q||""})}function gz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,Y]of Object.entries(process.env))if(Q.startsWith(J)&&Y!==void 0)X[Q]=Y;$.$env=X}async function hz($,Z){await v2(()=>D6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var a3="data-stx-source";function uz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(a3))return $;return`<script ${a3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function mz($){let Z=new RegExp(`${a3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function v8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function x8($,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">${v8($)}</span><span style="display:block;margin-top:4px">${v8(J)}</span></div>`}async function dz($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q,Y=[],G=!k2()&&!E2();while((Q=X.exec($))!==null){let K=Q[1],q=Q[2];if(!/\bserver\b/.test(K)||!q.trim())continue;let W=mz(K)??J,U={index:Q.index,length:Q[0].length};try{let{extractVariables:j}=await s("stx/variable-extractor",()=>import("./chunk-7w66sc17.js"));await j(q,Z,W,{preserveExisting:!0,onFailure:(B)=>{if(!G||B.kind==="unknown")return;Y.push({...U,markup:x8(W,B.kind,B.message)})}})}catch(j){let B=j instanceof Error?j:Error(String(j));if(n0.log(B,{filePath:W,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${W}: ${B.message}`),G)Y.push({...U,markup:x8(W,"unknown",B.message)})}}if(Y.length===0)return $;let z=$;for(let K of Y.sort((q,H)=>H.index-q.index))z=z.slice(0,K.index)+K.markup+z.slice(K.index+K.length);return z}async function lz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-1xts7768.js"));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return n0.log(Q,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Q.message}`),$}}async function f8($,Z,J,X,Q){let Y=$,G=X;if(Y=await dz(Y,Z,J),Y=await lz(Y,Z,J),Y=await Q6(Y,Z,J),Y=await G6(Y,Z,J),Y=await K4(Y,Z,J,G),X1(Y))Y=V8(Y,Z),Y=c3(Y,Z);Y=O8(Y);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-es275g3w.js"));Y=z(Y,Z),Y=V6(Y,Z,J,G,!0),Y=await E6(Y,Z,J,G,Q),Y=await O3(Y,Z,J,G,Q),Y=Z7(Y,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-86q2h34b.js"));Y=K(Y,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-1vt1h19d.js"));Y=q(Y,Z,J);let{processTransitionDirectives:H,processTransitionAttributes:W}=await s("stx/transitions",()=>import("./chunk-w5j9tbsk.js"));Y=H(Y,Z,J),Y=W(Y);let{processErrorBoundaryDirectives:U}=await s("stx/error-boundaries",()=>import("./chunk-mph46gkj.js"));Y=U(Y,Z,J);let{processSuspenseDirectives:j}=await s("stx/suspense",()=>import("./chunk-m2j5skez.js"));Y=j(Y,Z,J);let{processAsyncDirectives:B}=await s("stx/async-components",()=>import("./chunk-ppzz953j.js"));Y=B(Y,Z,J);let{processKeepAliveDirectives:V}=await s("stx/keep-alive",()=>import("./chunk-1c9453w0.js"));Y=V(Y,Z,J);let{processVirtualListDirectives:_,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-dsztk2kp.js"));Y=_(Y,Z,J),Y=O(Y,Z,J),Y=F(Y,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-v6e35j4g.js"));Y=L(Y,Z,J),Y=w(Y);let{processComputedDirectives:N,processWatchDirectives:R}=await s("stx/computed",()=>import("./chunk-99b5tfxc.js"));Y=N(Y,Z,J),Y=R(Y,Z,J);let{processFormValidationDirectives:M}=await s("stx/forms-validation",()=>import("./chunk-evfr2zgg.js"));Y=M(Y,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:I,resetHead:k}=await s("stx/head",()=>import("./chunk-at622hg0.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let A=T(Y);if(Y=A.content,A.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${A.headContent}
3529
+ `;if(Y=D(Y,Z),Y=I(Y,Z,J),Y=N6(Y),Y=f5(Y,Z),Y=Q4(Y),Y=_6(Y),Y=await w3(Y,Z,J,G,Q),Y=await O3(Y,Z,J,G,Q),Z.__stxProcessingDepth===1)Y=R$(Y,Z);if(Y=Y.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Y=n3(Y),Y=r0(Y,Z,J),Y=M3(Y),Y=Q7(Y,Z,{filePath:J,buildMode:G.buildMode}),Y=g5(Y,Z),Y=h5(Y,Z),Y=R2(Y,Z),Y=i5(Y,Z),Y=n5(Y,Z),Y=await n7(Y,Z,J,G),Y=await U7(Y,Z,J),Y=await m8(Y,Z,J,G),Y=d8(Y,Z,J,G),Y=r8(Y,Z,J,G),Y=a8(Y,Z,J),Y=t8(Y,Z,J,G),Y=X4(Y,Z,J,G),Y=p3(Y,Z),Y=i3(Y),Y=I8(Y),!G.skipEventDirectives)Y=_$(Y,Z,J);if(Y=K7(Y,Z,J),G.debug){let l=/\bx-data\s*=/.test(Y),u=l3($);if(l&&u)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=i4(Q,Z),Q=await V1(Q,Z,J),Q=b8(Q),Q=y8(Q),Q=n$(Q);let{processXElementDirectives:E}=await s("stx/x-element",()=>import("./chunk-0k1mtwby.js"));Q=E(Q);let C=Z.__originalFilePath||J,y=v9(Z);if(Q=await _8(Q,G,C,y),Q=U4(Q,Z),Q=await R6(Q,Z,J,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:u}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-kq30wqp6.js"));Q=await u(Q,{publicDir:l})}if(G.seo?.enabled)Q=a8(Q,Z,G);let b=(l,u,o=!0)=>{if(!u)return l;let Q0=u.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),B0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Q0&&B0){if(o)l=l.replace(B0[0],Q0[0]);if(u=u.replace(Q0[0],"").trim(),!u)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${u}
3531
+ Prefer signals (state/derived/effect) for new components.`)}Y=i4(Y,Z),Y=await V1(Y,Z,J),Y=b8(Y),Y=y8(Y),Y=n$(Y);let{processXElementDirectives:E}=await s("stx/x-element",()=>import("./chunk-0k1mtwby.js"));Y=E(Y);let C=Z.__originalFilePath||J,y=v9(Z);if(Y=await _8(Y,G,C,y),Y=U4(Y,Z),Y=await R6(Y,Z,J,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:u}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-kq30wqp6.js"));Y=await u(Y,{publicDir:l})}if(G.seo?.enabled)Y=e8(Y,Z,G);let b=(l,u,o=!0)=>{if(!u)return l;let Q0=u.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),B0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Q0&&B0){if(o)l=l.replace(B0[0],Q0[0]);if(u=u.replace(Q0[0],"").trim(),!u)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${u}
3532
3532
  </head>`);if(/<head\b[^>]*>/i.test(l))return l.replace(/(<head\b[^>]*>)/i,`$1
3533
3533
  ${u}`);if(/<html\b[^>]*>/i.test(l))return l.replace(/(<html\b[^>]*>)/i,`$1
3534
3534
  <head>
3535
3535
  ${u}
3536
- </head>`);return l},{renderHead:P,getHead:h}=await s("stx/head",()=>import("./chunk-at622hg0.js")),g=Z.__stx_runtime_head??h();if(g.title||g.meta?.length||g.link?.length){let l=P(g);if(l)Q=b(Q,l)}if(A.headContent)Q=b(Q,A.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=Z4(Q,G.csp,Z);if(G.analytics?.enabled)Q=o$(Q,G);if(G.heatmap?.enabled)Q=a$(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:l}=await s("stx/pwa/inject",()=>import("./chunk-zp14ksx1.js"));Q=l(Q,G)}let Z0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),J0=/\bSTX\.\w+/.test(Q),e=/window\.STX\s*=/.test(Q);if(Z0&&J0&&!e){let u=`<script data-stx-scoped data-stx-run="once">
3536
+ </head>`);return l},{renderHead:P,getHead:h}=await s("stx/head",()=>import("./chunk-at622hg0.js")),g=Z.__stx_runtime_head??h();if(g.title||g.meta?.length||g.link?.length){let l=P(g);if(l)Y=b(Y,l)}if(A.headContent)Y=b(Y,A.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Y=Z4(Y,G.csp,Z);if(G.analytics?.enabled)Y=o$(Y,G);if(G.heatmap?.enabled)Y=a$(Y,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:l}=await s("stx/pwa/inject",()=>import("./chunk-zp14ksx1.js"));Y=l(Y,G)}let Z0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Y),J0=/\bSTX\.\w+/.test(Y),e=/window\.STX\s*=/.test(Y);if(Z0&&J0&&!e){let u=`<script data-stx-scoped data-stx-run="once">
3537
3537
  ${c$()}
3538
- </script>`;if(Q.includes("</head>")){let o=Q.indexOf("</head>"),B0=Q.slice(0,o).indexOf("<script");if(B0!==-1){let K0=Q.slice(0,B0),c0=Q.slice(B0);Q=K0+u+`
3539
- `+c0}else Q=Q.replace("</head>",`${u}
3540
- </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3541
- ${u}`);else Q=u+`
3542
- `+Q}{let{scanScriptTags:l}=await s("stx/signal-processing",()=>import("./chunk-8tjg4wbr.js")),u=[];for(let o of l(Q)){if(!/\bserver\b/i.test(o.attrs))continue;let Q0=o.start+o.fullMatch.indexOf(">")+1,B0=Cz(Q,Q0);if(B0===-1)continue;let K0=B0+9;while(K0<Q.length&&/\s/.test(Q[K0]))K0++;u.push({start:o.start,end:K0})}if(u.length>0){let o=Array(u.length+1),Q0=0;for(let B0=0;B0<u.length;B0++){let{start:K0,end:c0}=u[B0];o[B0]=Q.slice(Q0,K0),Q0=c0}o[u.length]=Q.slice(Q0),Q=o.join("")}}let i=f9(Q,J);if(i.hasScoped)Q=i.html;let q0=Z.__stx_event_bindings||[],r=!1,L0=[],e0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:$1}=await s("stx/signal-processing",()=>import("./chunk-8tjg4wbr.js"));for(let l of $1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))L0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:u,content:o}of L0){r=!0;let Q0=o;o3(o,J,X.strict,Z.__originalFilePath);let B0=await x9(o,{eventBindings:q0,attrs:u,hasColonDirectives:e0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(l,()=>B0)}if(r)Z.__stx_event_bindings=[];if(!r&&Z.__stxProcessingDepth===1){let l=Z.__stx_event_bindings||[];if(l.length>0){let u=t9(l);if(u){let o=Q.lastIndexOf("</body>");Q=o===-1?Q+u:Q.slice(0,o)+u+`
3543
- `+Q.slice(o)}Z.__stx_event_bindings=[]}}if(!Z8(Q)&&J8(Q))Q=await y9(Q,G);if(Q=X8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=J4(Q,Z.cspNonce);return Q}import UZ from"path";import $$ from"fs";import P2 from"path";function e8($,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 dz($){let Z=H0($),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 e3($,Z){let J=H0($),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=e8(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=e8(J,Q,"(",")");if(z>=0)return{type:G,args:dz($.slice(Q+1,z))}}return null}var $Z=`
3538
+ </script>`;if(Y.includes("</head>")){let o=Y.indexOf("</head>"),B0=Y.slice(0,o).indexOf("<script");if(B0!==-1){let K0=Y.slice(0,B0),c0=Y.slice(B0);Y=K0+u+`
3539
+ `+c0}else Y=Y.replace("</head>",`${u}
3540
+ </head>`)}else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
3541
+ ${u}`);else Y=u+`
3542
+ `+Y}{let{scanScriptTags:l}=await s("stx/signal-processing",()=>import("./chunk-fvvdq3ev.js")),u=[];for(let o of l(Y)){if(!/\bserver\b/i.test(o.attrs))continue;let Q0=o.start+o.fullMatch.indexOf(">")+1,B0=Pz(Y,Q0);if(B0===-1)continue;let K0=B0+9;while(K0<Y.length&&/\s/.test(Y[K0]))K0++;u.push({start:o.start,end:K0})}if(u.length>0){let o=Array(u.length+1),Q0=0;for(let B0=0;B0<u.length;B0++){let{start:K0,end:c0}=u[B0];o[B0]=Y.slice(Q0,K0),Q0=c0}o[u.length]=Y.slice(Q0),Y=o.join("")}}let i=f9(Y,J);if(i.hasScoped)Y=i.html;let q0=Z.__stx_event_bindings||[],r=!1,L0=[],e0=/\s:[a-z][\w.-]*\s*=/.test(Y),{scanScriptTags:$1}=await s("stx/signal-processing",()=>import("./chunk-fvvdq3ev.js"));for(let l of $1(Y,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))L0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:u,content:o}of L0){r=!0;let Q0=o;o3(o,J,X.strict,Z.__originalFilePath);let B0=await x9(o,{eventBindings:q0,attrs:u,hasColonDirectives:e0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Y=Y.replace(l,()=>B0)}if(r)Z.__stx_event_bindings=[];if(!r&&Z.__stxProcessingDepth===1){let l=Z.__stx_event_bindings||[];if(l.length>0){let u=t9(l);if(u){let o=Y.lastIndexOf("</body>");Y=o===-1?Y+u:Y.slice(0,o)+u+`
3543
+ `+Y.slice(o)}Z.__stx_event_bindings=[]}}if(!Z8(Y)&&J8(Y))Y=await y9(Y,G);if(Y=X8(Y),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Y=J4(Y,Z.cspNonce);return Y}import BZ from"path";import $$ from"fs";import x2 from"path";function ZZ($,Z,J,X){let Q=0;for(let Y=Z;Y<$.length;Y++)if($[Y]===J)Q++;else if($[Y]===X&&!(X===">"&&$[Y-1]==="=")){if(--Q===0)return Y}return-1}function cz($){let Z=H0($),J=0,X=0,Q=[];for(let Y=0;Y<Z.length;Y++)if("([{".includes(Z[Y]))J++;else if(")]}".includes(Z[Y]))J--;else if(Z[Y]===","&&J===0)Q.push($.slice(X,Y).trim()),X=Y+1;return Q.push($.slice(X).trim()),Q}function e3($,Z){let J=H0($),X=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of J.matchAll(X)){let Y=Q.index+Q[0].length,G="";if(J[Y]==="<"){let K=ZZ(J,Y,"<",">");if(K<0)continue;G=$.slice(Y+1,K),Y=K+1;while(/\s/.test(J[Y]||"")&&Y<J.length)Y++}if(J[Y]!=="(")continue;let z=ZZ(J,Y,"(",")");if(z>=0)return{type:G,args:cz($.slice(Y+1,z))}}return null}var JZ=`
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,88 +3548,88 @@ 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 ZZ($,Z){let J=[],X={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Y=H0($),Q=$.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,j,B,V,_)=>{if(Y.slice(_,_+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((F)=>{let[L,w=L]=F.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
- `)}),G=e3($,X.defineProps),z=e3($,X.defineEmits),K=e3($,X.withDefaults);if(!G&&!z)return{declarations:"",props:null,events:null};let q=[],W=null,H=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>>;`),W=`${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[]>"};`),H=`${Z}.__StxEvents`;return{declarations:`${J.join(`
3551
+ `;function XZ($,Z){let J=[],X={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Q=H0($),Y=$.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,j,B,V,_)=>{if(Q.slice(_,_+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((F)=>{let[L,w=L]=F.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
+ `)}),G=e3($,X.defineProps),z=e3($,X.defineEmits),K=e3($,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
- ${Q}
3555
+ ${Y}
3556
3556
  ${q.join(`
3557
3557
  `)}
3558
- }`,props:W,events:H}}function*lz($){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 W=X;if(K){let H=H0($.slice(X)),U=1,j=0;for(;j<H.length;j++){if(H[j]==="{")U++;if(H[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(W,X),offset:W,braced:K}),q||K)X++}Z.lastIndex=X,yield{name:J[1],offset:J.index,attributes:Y}}}function JZ($,Z,J){let X=[],Y=[$Z,"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=H0(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],_=P2.isAbsolute(V)||V.startsWith(".")?P2.resolve(P2.dirname(J.filePath),V):U9(V,P2.dirname(J.filePath));if(!_)continue;let O=_.endsWith(".stx")?_:$$.existsSync(`${_}.stx`)?`${_}.stx`:void 0,F=O?null:H9(_,!1),L=B[1].startsWith("{")?B[1].slice(1,-1).split(","):[B[1]];for(let w of L){let[N,R=N]=w.trim().split(/\s+as\s+/),M=O||F?.get(N)||F?.get(N.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 _=j9(V[1],J.filePath,J).find((O)=>$$.statSync(O,{throwIfNoEntry:!1})?.isFile());if(_)z.set(P2.basename(V[1]).replace(/\.stx$/,""),_)}let W={__importedComponents:z},H=new Map,U=(B,V,_)=>{let O=$.slice(0,B);return{code:V,offset:B,attribute:_,anchor:!0,kind:"directive",line:O.split(`
3558
+ }`,props:H,events:W}}function*pz($){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,J;while(J=Z.exec($)){let X=Z.lastIndex,Q=[];while(X<$.length){while(/\s/.test($[X]||""))X++;if($[X]===">"||$.slice(X,X+2)==="/>"){X+=$[X]===">"?1:2;break}let Y=/^[^\s=/>]+/.exec($.slice(X))?.[0];if(!Y){X++;continue}let G=X;X+=Y.length;while(/\s/.test($[X]||""))X++;if($[X]!=="="){Q.push({name:Y,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=H0($.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(Q.push({name:Y,value:$.slice(H,X),offset:H,braced:K}),q||K)X++}Z.lastIndex=X,yield{name:J[1],offset:J.index,attributes:Q}}}function YZ($,Z,J){let X=[],Q=[JZ,"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;'],Y=new Map,G=new Map,z=new Map,K=J.scriptCode($,J.filePath),q=H0(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],_=x2.isAbsolute(V)||V.startsWith(".")?x2.resolve(x2.dirname(J.filePath),V):B9(V,x2.dirname(J.filePath));if(!_)continue;let O=_.endsWith(".stx")?_:$$.existsSync(`${_}.stx`)?`${_}.stx`:void 0,F=O?null:j9(_,!1),L=B[1].startsWith("{")?B[1].slice(1,-1).split(","):[B[1]];for(let w of L){let[N,R=N]=w.trim().split(/\s+as\s+/),M=O||F?.get(N)||F?.get(N.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 _=V9(V[1],J.filePath,J).find((O)=>$$.statSync(O,{throwIfNoEntry:!1})?.isFile());if(_)z.set(x2.basename(V[1]).replace(/\.stx$/,""),_)}let H={__importedComponents:z},W=new Map,U=(B,V,_)=>{let O=$.slice(0,B);return{code:V,offset:B,attribute:_,anchor:!0,kind:"directive",line:O.split(`
3559
3559
  `).length,column:B-O.lastIndexOf(`
3560
- `)}},j=(B,V,_)=>X.push({expression:B,statement:{text:V+B.code+_,prefixLength:V.length}});for(let B of lz(Z)){if(T2(B.name)||B.name==="component")continue;let V=_4(B.name,J.filePath,J,W);if(!V)continue;let _=H.get(V);if(!_){let F;try{F=J.readComponent?J.readComponent(V):$$.readFileSync(V,"utf8")}catch{continue}if(F===void 0)continue;G.set(V,F),_=ZZ(J.scriptCode(F,V),`__StxComponent${H.size}`),H.set(V,_),Y.push(_.declarations)}let O=[];for(let F of B.attributes){let{name:L,offset:w}=F,N=F.value===!0?"true":F.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(_.events&&F.value!==!0)Q.set(w,`__StxEvent<${_.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,k)=>k.toUpperCase());if(O.push(M),!_.props)continue;let D=L.startsWith(":")||L.startsWith("v-bind:")||!!R||F.braced?N:F.value!==!0?JSON.stringify(N):"true";j(U(w,D,L),";void ((",`) satisfies __StxProp<${_.props}, ${JSON.stringify(M)}>);`)}if(_.props){let F=[...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 ({ ${F} } satisfies ${_.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:H.size?Y.join(`
3561
- `):"",checks:X,events:Q,dependencies:G}}var XZ=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function cz($){let Z=(J)=>J.replace(/[^\n]/g," ");return $.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function YZ($){let Z=[],J=cz($);XZ.lastIndex=0;let X;while((X=XZ.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 W=Y.match(/\btype\s*=\s*["']([^"']+)["']/i);if(W&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(W[1]))continue;let H=/\bserver\b/.test(Y)?"server":/\bclient\b/.test(Y)?"client":"plain",U=h9($,z);Z.push({kind:H,code:q,startLine:U,attrs:Y})}return Z}function h9($,Z){let J=1;for(let X=0;X<Z&&X<$.length;X++)if($.charCodeAt(X)===10)J++;return J}function Z$($,Z){let J=$.lastIndexOf(`
3562
- `,Z-1)+1;return Z-J+1}function u9($){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 pz($){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 jZ=new Set([":for","x-for","v-for"]),m9=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,J$="__stx_interpolated",QZ="__StxElement",BZ="__StxTemplateValue",iz=`type ${BZ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function GZ($){return $.replace(/\{\{[\s\S]*?\}\}/g,J$).replace(/\{!![\s\S]*?!!\}/g,J$)}function J_($){return $.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let J=Z.split(`
3560
+ `)}},j=(B,V,_)=>X.push({expression:B,statement:{text:V+B.code+_,prefixLength:V.length}});for(let B of pz(Z)){if(T2(B.name)||B.name==="component")continue;let V=_4(B.name,J.filePath,J,H);if(!V)continue;let _=W.get(V);if(!_){let F;try{F=J.readComponent?J.readComponent(V):$$.readFileSync(V,"utf8")}catch{continue}if(F===void 0)continue;G.set(V,F),_=XZ(J.scriptCode(F,V),`__StxComponent${W.size}`),W.set(V,_),Q.push(_.declarations)}let O=[];for(let F of B.attributes){let{name:L,offset:w}=F,N=F.value===!0?"true":F.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(_.events&&F.value!==!0)Y.set(w,`__StxEvent<${_.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,k)=>k.toUpperCase());if(O.push(M),!_.props)continue;let D=L.startsWith(":")||L.startsWith("v-bind:")||!!R||F.braced?N:F.value!==!0?JSON.stringify(N):"true";j(U(w,D,L),";void ((",`) satisfies __StxProp<${_.props}, ${JSON.stringify(M)}>);`)}if(_.props){let F=[...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 ({ ${F} } satisfies ${_.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:W.size?Q.join(`
3561
+ `):"",checks:X,events:Y,dependencies:G}}var QZ=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function iz($){let Z=(J)=>J.replace(/[^\n]/g," ");return $.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function GZ($){let Z=[],J=iz($);QZ.lastIndex=0;let X;while((X=QZ.exec(J))!==null){let Q=(X[1]||"").trim(),Y=(X[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(X[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=X.index+Y,K=X.index+X[0].length-G,q=$.slice(z,K);if(/\bsrc\s*=/.test(Q))continue;let H=Q.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let W=/\bserver\b/.test(Q)?"server":/\bclient\b/.test(Q)?"client":"plain",U=h9($,z);Z.push({kind:W,code:q,startLine:U,attrs:Q})}return Z}function h9($,Z){let J=1;for(let X=0;X<Z&&X<$.length;X++)if($.charCodeAt(X)===10)J++;return J}function Z$($,Z){let J=$.lastIndexOf(`
3562
+ `,Z-1)+1;return Z-J+1}function u9($){let Z=$.split(""),J=(Q,Y)=>{for(let G=Q;G<Y&&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 Q of X){Q.lastIndex=0;let Y;while((Y=Q.exec($))!==null)J(Y.index,Y.index+Y[0].length)}return Z.join("")}function nz($){let Z=0,J="";for(let X=0;X<$.length;X++){let Q=$[X];if(J){if(Q==="\\"){X++;continue}if(Q===J)J="";continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{"){Z++;continue}if(Q===")"||Q==="]"||Q==="}"){Z--;continue}if(Q==="|"&&Z===0){if($[X+1]==="|"){X++;continue}if($[X-1]==="|")continue;return $.slice(0,X)}}return $}var VZ=new Set([":for","x-for","v-for"]),m9=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,J$="__stx_interpolated",zZ="__StxElement",LZ="__StxTemplateValue",sz=`type ${LZ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function KZ($){return $.replace(/\{\{[\s\S]*?\}\}/g,J$).replace(/\{!![\s\S]*?!!\}/g,J$)}function Y_($){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 nz=["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"],sz=new RegExp(String.raw`^[ \t]*@(?:${nz.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function X_($){return $.replace(sz,(Z)=>Z.replace(/[^\n]/g," "))}var zZ=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function oz($){let Z=u9($),J=[],X=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Y;while((Y=X.exec(Z))!==null){if(Y[1]||Y[3])continue;let G=Y[2]??Y[4]??"",z=Y[2]!==void 0?2:3,K=pz(G);if(!K.trim())continue;let q=Y.index+z+(K.length-K.trimStart().length);J.push({code:K.trim(),line:h9(Z,q),column:Z$(Z,q),offset:q,kind:"interpolation"})}m9.lastIndex=0;while((Y=m9.exec(Z))!==null){let Q=Y[1],G=Y[3]??"",z=Q.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(zZ.has(z)||zZ.has(Q))continue;if(!G.trim())continue;let K=Y.index+Y[0].indexOf(Y[2],Y[0].indexOf(Q)+Q.length)+1;if(jZ.has(z)){let W=G.match(/\s+(?:in|of)\s+/);if(!W||W.index===void 0)continue;let H=G.slice(W.index+W[0].length),U=W.index+W[0].length+(H.length-H.trimStart().length);J.push({code:GZ(H.trim()),line:h9(Z,K+U),column:Z$(Z,K+U),offset:K+U,kind:"directive",attribute:z});continue}let q=G.length-G.trimStart().length;J.push({code:GZ(G.trim()),line:h9(Z,K+q),column:Z$(Z,K+q),offset:K+q,kind:"directive",attribute:z})}return J.sort((Q,G)=>Q.line-G.line||Q.column-G.column),J}var rz=2000;function az($,Z){let J=0,X=Math.min($.length,Z+rz);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 tz($){let Z=new Map,J=(z,K)=>{let q=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let W of q){let H=W.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(H))continue;let U=q.length===1?K:void 0,j=Z.get(H);if(!j)Z.set(H,{name:H,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=az($,z.index+z[0].length-1);if(K===null)continue;let q=K.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!q)continue;J(q[2].replace(/=>/g," "),Y(q[1]))}for(let z of $.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))J(z[1]);let Q=u9($);m9.lastIndex=0;let G;while((G=m9.exec(Q))!==null){let z=G[1].replace(/\..*$/,"");if(!jZ.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 S1($){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()}function ez(){return["declare var window: any",...v2.map(($)=>`declare var ${$}: any`)].join(`
3566
- `)}var $K=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function ZK(){return $K.map(($)=>`declare var ${$}: any`).join(`
3567
- `)}function VZ($){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,J,X=!1,Y=new Set,Q=H0($);while((J=Z.exec(Q))!==null){X=!0;for(let G of JK(J[1])){let z=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))Y.add(z)}}return X?[...Y]:null}function JK($){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 XK($){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 oz=["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"],rz=new RegExp(String.raw`^[ \t]*@(?:${oz.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Q_($){return $.replace(rz,(Z)=>Z.replace(/[^\n]/g," "))}var qZ=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function az($){let Z=u9($),J=[],X=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Q;while((Q=X.exec(Z))!==null){if(Q[1]||Q[3])continue;let G=Q[2]??Q[4]??"",z=Q[2]!==void 0?2:3,K=nz(G);if(!K.trim())continue;let q=Q.index+z+(K.length-K.trimStart().length);J.push({code:K.trim(),line:h9(Z,q),column:Z$(Z,q),offset:q,kind:"interpolation"})}m9.lastIndex=0;while((Q=m9.exec(Z))!==null){let Y=Q[1],G=Q[3]??"",z=Y.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(qZ.has(z)||qZ.has(Y))continue;if(!G.trim())continue;let K=Q.index+Q[0].indexOf(Q[2],Q[0].indexOf(Y)+Y.length)+1;if(VZ.has(z)){let H=G.match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;let W=G.slice(H.index+H[0].length),U=H.index+H[0].length+(W.length-W.trimStart().length);J.push({code:KZ(W.trim()),line:h9(Z,K+U),column:Z$(Z,K+U),offset:K+U,kind:"directive",attribute:z});continue}let q=G.length-G.trimStart().length;J.push({code:KZ(G.trim()),line:h9(Z,K+q),column:Z$(Z,K+q),offset:K+q,kind:"directive",attribute:z})}return J.sort((Y,G)=>Y.line-G.line||Y.column-G.column),J}var tz=2000;function ez($,Z){let J=0,X=Math.min($.length,Z+tz);for(let Q=Z;Q<X;Q++){let Y=$[Q];if(Y==="(")J++;else if(Y===")"){if(J--,J===0)return $.slice(Z+1,Q)}}return null}function $K($){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,Q=(z)=>{let K=z.trim();return X.test(K)?K:void 0};for(let z of $.matchAll(/@for(?:each|else)\s*\(/g)){let K=ez($,z.index+z[0].length-1);if(K===null)continue;let q=K.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!q)continue;J(q[2].replace(/=>/g," "),Q(q[1]))}for(let z of $.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))J(z[1]);let Y=u9($);m9.lastIndex=0;let G;while((G=m9.exec(Y))!==null){let z=G[1].replace(/\..*$/,"");if(!VZ.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),Q(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 S1($){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 Q=X.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Q))Z.add(Q)}return[...Z].sort()}function ZK(){return["declare var window: any",...f2.map(($)=>`declare var ${$}: any`)].join(`
3566
+ `)}var JK=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function XK(){return JK.map(($)=>`declare var ${$}: any`).join(`
3567
+ `)}function OZ($){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,J,X=!1,Q=new Set,Y=H0($);while((J=Z.exec(Y))!==null){X=!0;for(let G of YK(J[1])){let z=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))Q.add(z)}}return X?[...Q]:null}function YK($){let Z=[],J=0,X="";for(let Q of $){if(Q===","&&J===0){Z.push(X),X="";continue}if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;X+=Q}return Z.push(X),Z.filter((Q)=>Q.trim().length>0)}function QK($){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,J=[],X=$.replace(Z,(Q)=>{return J.push(Q.trim()),Q.split(`
3568
3568
  `).map(()=>"").join(`
3569
3569
  `)});return{imports:J.join(`
3570
- `),body:X}}function LZ($){let Z=H0($),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 W=Z.indexOf("{",G.index);if(W===-1)continue;let H=0;q=-1;for(let U=W;U<Z.length;U++)if(Z[U]==="{")H++;else if(Z[U]==="}"&&--H===0){q=U+1;break}if(q===-1)continue}else{let W=0;q=Z.length;for(let H=Z.indexOf("=",G.index)+1;H<Z.length;H++){let U=Z[H];if(U==="{"||U==="["||U==="("||U==="<")W++;else if(U==="}"||U==="]"||U===")"||U===">")W--;else if(W<=0&&(U===";"||U===`
3571
- `&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,H-40),H)))){q=U===";"?H+1:H;break}}}Y.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Q.lastIndex=q}return Y}function YK($){return new Set(LZ($).map((Z)=>Z.name))}function Y_($,Z=""){let J=VZ($),X=YK(Z),Y=LZ($).filter((q)=>!X.has(q.name)).map((q)=>q.text);if(!J){let q=S1($);if(q.length===0&&Y.length===0)return"";return["",`// ${GK}`,...Y,...q.map((W)=>`declare var ${W}: any`)].join(`
3572
- `)}if(J.length===0)return Y.length>0?["",`// ${KZ}`,...Y].join(`
3573
- `):"";let{imports:Q,body:G}=XK($),z=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),K=["",`// ${KZ}`];if(Q)K.push(Q);return K.push(...Y),K.push(`async function ${qZ}() {`,z,` return { ${J.join(", ")} }`,"}",`type ${WZ} = Awaited<ReturnType<typeof ${qZ}>>`,...J.map((q)=>`declare var ${q}: ${WZ}[${JSON.stringify(q)}]`)),K.join(`
3574
- `)}function QK($){let J=H0($).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!==`
3575
- `)J[Y]=" "}return S1(J.join(""))}function Q_($,Z){if(VZ($)!==null)return[];let J=H0(Z),X=new Set(v2);return QK($).filter((Y)=>{if(X.has(Y))return!1;if(S1(Z).includes(Y))return!1;return new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J)})}var KZ="stx: types for the declared client payload (#1868)",GK="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",qZ="__stxServerScope",WZ="__StxClientPayload";var zK=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var KK=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function qK($,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(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 W=$[K];if(W==="(")z++;else if(W===")"){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 WK($){let Z=$.code.trim();if(!Z)return null;if($.attribute?.startsWith("@")){if(KK.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 HK=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function HZ($,Z){if(!Z)return $;return $.replace(HK,(J,X,Y,Q)=>{let G=UZ.resolve(Z,Q).replace(/\\/g,"/");return`${X}${Y}${G}${Y}`})}function G_($,Z={}){let J=YZ($),X=$.split(`
3576
- `),Y=Array.from({length:X.length},()=>""),Q=new Map,G=Z.filePath&&Z.templateExpressions!==!1?JZ($,u9($),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(K,q)=>YZ(K).map((W)=>HZ(W.code,UZ.dirname(q))).join(`
3577
- `)}):void 0;for(let K of J)HZ(K.code,Z.originDir??"").split(`
3578
- `).forEach((W,H)=>{let U=K.startLine-1+H;if(U<Y.length)Y[U]=W});let z=(K,q)=>{for(let[W,H]of K.split(`
3579
- `).entries())if(Y.push(H),q)Q.set(Y.length,W===0?q:{...q,line:q.line+W,column:1,prefixLength:0})};if(Z.globals!==!1){if(z(""),Z.runtimeGlobals!==!1)for(let q of ez().split(`
3580
- `))z(q);for(let q of ZK().split(`
3581
- `))z(q);for(let q of b1)z(`declare var ${q}: any`);for(let q of zK)z(`declare var ${q}: any`);z(`declare var ${J$}: any`);let K=new Set(J.flatMap((q)=>S1(q.code)));z(`type ${QZ}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let q of tz($)){if(K.has(q.name))continue;let W=q.iterable&&K.has(q.iterable)?`${QZ}<typeof ${q.iterable}>`:"any";z(`declare var ${q.name}: ${W}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let q of G.declarations.split(`
3582
- `))z(q);let K=oz($).map((q)=>{let W=G?.events.get(q.offset??-1);if(W){q.anchor=!0;let H=q.code.trim(),U=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(H),j=U?`void ((${U[2]}) satisfies __StxAssignedValue<typeof ${U[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(H)?`${H}($event)`:H,B=`;(($event: ${W}): void => { `;return{expression:q,statement:{text:`${B}${j} });`,prefixLength:B.length}}}return{expression:q,statement:WK(q)}}).filter((q)=>q.statement!==null);if(K.push(...G?.checks||[]),K.length>0){let q=u9($),H=[...new Set(J.flatMap((j)=>S1(j.code)))].filter((j)=>/^[A-Z_$][\w$]*$/i.test(j)),U=0;if(H.length>0){z(iz);for(let j of H)z(`type __StxT_${j} = ${BZ}<typeof ${j}>`);z(`;((${H.map((j)=>`${j}: __StxT_${j}`).join(", ")}) => {`),U=1}for(let{expression:j,statement:B}of K){let V=" ".repeat(U),_=j.offset===void 0?[]:qK(q,j.offset),O=_.length>0?`${_.map((L)=>`if (${L}) `).join("")}{ `:"",F=_.length>0?" }":"";z(V+O+B.text+F,{line:j.line,column:j.column,expression:j,prefixLength:B.prefixLength+V.length+O.length})}if(U>0)z("});")}}return z("export {}"),{text:Y.join(`
3583
- `),lineMap:Q,sourceLineCount:X.length,componentDependencies:G?.dependencies}}function z_($,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}}var UK=[{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"}],jK=[{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')"}],BK=[{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 VK($){let Z=[],J=[];return LK($,Z),OK($,Z,J),_K($,J),FK($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function LK($,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 OK($,Z,J){for(let X of UK){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 _K($,Z){for(let J of jK)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function FK($,Z){for(let J of BK)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function wK($,Z){let J=$.slice(0,Z).split(`
3584
- `);return{line:J.length,column:J[J.length-1].length+1}}function RK($,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 NK($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function DK($){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 s0 from"path";import X2 from"process";var SZ=["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"],OZ=new Set(SZ),MK=new Set(["props","$props","defineProps"]),AK=new Set(["stx","@stacksjs/stx"]),_Z=y1(128),FZ=y1(64);function IK($){let Z=[],J=0,X=$.split(`
3585
- `);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 H=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(...H)}}}}return[...new Set(Z)]}function TK($){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 W=X[q];if(K){if(Q+=W,W===K)K=null;continue}if(W==='"'||W==="'"||W==="`"){K=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=W}if(Q)Y.push(Q);return Y.map((q)=>{let W=q.trim(),H=W.startsWith("..."),U=H?W.slice(3):W,j=-1,B=0;for(let N=0;N<U.length;N++)if(U[N]==="<")B++;else if(U[N]===">")B--;else if(U[N]===":"&&B===0){j=N;break}if(j===-1)return q;let _=U.substring(0,j).trim().replace(/\?$/,""),O=U.substring(j+1),F=-1,L=0;for(let N=0;N<O.length;N++)if(O[N]==="<")L++;else if(O[N]===">")L--;else if(O[N]==="="&&L===0){F=N;break}let w=H?"...":"";if(F!==-1)return`${w}${_} = ${O.substring(F+1).trim()}`;return`${w}${_}`}).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,W=null;while(K<Z.length&&z>0){let j=Z[K];if(W){if(j===W)W=null;K++;continue}if(j==='"'||j==="'"||j==="`"){W=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 H=Z.substring(G+1,K);if(!H.includes(":"))continue;let U=J(H);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,`
3586
-
3587
- `),Z}function kK($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function EK($){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 bK($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}var wZ=new Set;async function yK($,Z,J,X={}){if(!$.trim())return;let Y=Z2(),Q=H1($,JSON.stringify(Y)),G=_Z.get(Q);if(G===void 0){try{let S=Y$({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=TK($)}_Z.set(Q,G)}let z={exports:{}},K=z.exports,q=X2.cwd(),W={},H=[...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 H)try{if(S.startsWith(".")){W[S]=await import(s0.resolve(s0.dirname(J),S));continue}let v=s0.resolve(q,"node_modules",S),d=s0.join(v,"package.json"),X0=JSON.parse(x("fs").readFileSync(d,"utf8")),U0=X0.main||"index.js";if(X0.exports){let w0=typeof X0.exports==="string"?X0.exports:X0.exports["."];if(typeof w0==="string")U0=w0;else if(w0?.bun)U0=w0.bun;else if(w0?.import)U0=w0.import;else if(w0?.default)U0=w0.default}W[S]=await import(s0.resolve(v,U0))}catch(v){if(S.startsWith("."))U.set(S,v instanceof Error?v.message:String(v))}let j=(S)=>{if(W[S])return W[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,X0]of Object.entries(S)){let U0=B[d];if(U0!==void 0)v[d]=U0;else if(typeof X0==="function")v[d]=X0();else v[d]=X0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let _=(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,X0]of Object.entries(S)){let U0=X0&&typeof X0==="object"&&!Array.isArray(X0)?X0:{type:X0};if(v[d]===void 0&&U0.default!==void 0)v[d]=typeof U0.default==="function"?U0.default():U0.default}return v},F=()=>Z.slots||{},L=(S,v)=>{let d={...S};for(let[X0,U0]of Object.entries(v))if(d[X0]===void 0)if(typeof U0==="function")d[X0]=U0();else d[X0]=U0;return d},w=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},N=(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)=>{},D=(S)=>{},I=Y7(Z);function k(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 E=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",X0=Object.fromEntries(new URLSearchParams(v)),U0=Z.query,w0=Object.keys(X0).length>0?X0:U0??{},Z1=v||(Object.keys(w0).length>0?`?${new URLSearchParams(w0).toString()}`:"");return{params:Z.params??{},query:w0,path:d,name:"",fullPath:d+Z1,hash:"",matched:[]}},C=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),y=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=yZ(v,S||{})},b=(S)=>{y(CZ(S||{}))},P=(S)=>({value:S}),h=(S)=>S,p=(S)=>({value:typeof S==="function"?S():S}),g=(S,v)=>{},Z0=(S)=>{},J0=(S)=>{},e=(S)=>S?S():Promise.resolve(),i=(S)=>(v,...d)=>{},q0=(S)=>{},r=(S,v)=>{},L0=(S,v)=>v,e0=()=>({value:"light"}),$1=()=>w(!1),l=(S)=>w(!1),u=()=>w(!1),o=()=>l("(prefers-color-scheme: dark)"),Q0=()=>l("(prefers-color-scheme: light)"),B0=()=>l("(prefers-reduced-motion: reduce)"),K0=()=>l("(prefers-contrast: more)"),c0={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:{}},p9=new Proxy(c0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),i9={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Q2=console;try{let S=PZ(G,J),v=new Set(Object.keys(B)),d=Object.keys(Z).filter((a)=>!v.has(a)&&!MK.has(a)&&Y2(a)),X0=d.map((a)=>Z[a]);if(!d.includes("__stxServeContext"))d.push("__stxServeContext"),X0.push(void 0);let U0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),w0=[],Z1=[];for(let[a,h0]of Object.entries(B)){if(!Y2(a))continue;if(U0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(S))continue;w0.push(a),Z1.push(h0)}let P0=IK(S).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
3588
- `),m=Z.params??{},c=[],G0=[];for(let a=0;a<d.length;a++){if(d[a]==="params")continue;c.push(d[a]),G0.push(X0[a])}let n=[...SZ,...w0,...c],R0=`return (async () => {
3570
+ `),body:X}}function _Z($){let Z=H0($),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 Q=[],Y=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=Y.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===`
3571
+ `&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,W-40),W)))){q=U===";"?W+1:W;break}}}Q.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Y.lastIndex=q}return Q}function GK($){return new Set(_Z($).map((Z)=>Z.name))}function G_($,Z=""){let J=OZ($),X=GK(Z),Q=_Z($).filter((q)=>!X.has(q.name)).map((q)=>q.text);if(!J){let q=S1($);if(q.length===0&&Q.length===0)return"";return["",`// ${KK}`,...Q,...q.map((H)=>`declare var ${H}: any`)].join(`
3572
+ `)}if(J.length===0)return Q.length>0?["",`// ${WZ}`,...Q].join(`
3573
+ `):"";let{imports:Y,body:G}=QK($),z=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),K=["",`// ${WZ}`];if(Y)K.push(Y);return K.push(...Q),K.push(`async function ${HZ}() {`,z,` return { ${J.join(", ")} }`,"}",`type ${UZ} = Awaited<ReturnType<typeof ${HZ}>>`,...J.map((q)=>`declare var ${q}: ${UZ}[${JSON.stringify(q)}]`)),K.join(`
3574
+ `)}function zK($){let J=H0($).split(""),X=0;for(let Q=0;Q<J.length;Q++){let Y=J[Q];if(Y==="{"||Y==="("||Y==="["){X++;continue}if(Y==="}"||Y===")"||Y==="]"){X=Math.max(0,X-1);continue}if(X>0&&Y!==`
3575
+ `)J[Q]=" "}return S1(J.join(""))}function z_($,Z){if(OZ($)!==null)return[];let J=H0(Z),X=new Set(f2);return zK($).filter((Q)=>{if(X.has(Q))return!1;if(S1(Z).includes(Q))return!1;return new RegExp(`(?<![.#\\w$])${Q}(?![\\w$])`).test(J)})}var WZ="stx: types for the declared client payload (#1868)",KK="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",HZ="__stxServerScope",UZ="__StxClientPayload";var qK=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var WK=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function HK($,Z){let J=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,X=[],Q;while((Q=J.exec($))!==null){if(Q.index>=Z)break;let Y=Q[1];if(Y==="endif"||Y==="endunless"){X.pop();continue}let G="";if(Q[2]==="("){let z=0,K=Q.index+Q[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(Y==="if")X.push({seen:[],current:G});else if(Y==="unless")X.push({seen:[],current:`!(${G})`});else if(Y==="elseif"||Y==="else"){let z=X[X.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=Y==="elseif"?G:null}}return X.flatMap((Y)=>[...Y.seen.map((G)=>`!(${G})`),...Y.current?[Y.current]:[]]).filter(Boolean)}function UK($){let Z=$.code.trim();if(!Z)return null;if($.attribute?.startsWith("@")){if(WK.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 jK=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function jZ($,Z){if(!Z)return $;return $.replace(jK,(J,X,Q,Y)=>{let G=BZ.resolve(Z,Y).replace(/\\/g,"/");return`${X}${Q}${G}${Q}`})}function K_($,Z={}){let J=GZ($),X=$.split(`
3576
+ `),Q=Array.from({length:X.length},()=>""),Y=new Map,G=Z.filePath&&Z.templateExpressions!==!1?YZ($,u9($),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(K,q)=>GZ(K).map((H)=>jZ(H.code,BZ.dirname(q))).join(`
3577
+ `)}):void 0;for(let K of J)jZ(K.code,Z.originDir??"").split(`
3578
+ `).forEach((H,W)=>{let U=K.startLine-1+W;if(U<Q.length)Q[U]=H});let z=(K,q)=>{for(let[H,W]of K.split(`
3579
+ `).entries())if(Q.push(W),q)Y.set(Q.length,H===0?q:{...q,line:q.line+H,column:1,prefixLength:0})};if(Z.globals!==!1){if(z(""),Z.runtimeGlobals!==!1)for(let q of ZK().split(`
3580
+ `))z(q);for(let q of XK().split(`
3581
+ `))z(q);for(let q of b1)z(`declare var ${q}: any`);for(let q of qK)z(`declare var ${q}: any`);z(`declare var ${J$}: any`);let K=new Set(J.flatMap((q)=>S1(q.code)));z(`type ${zZ}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let q of $K($)){if(K.has(q.name))continue;let H=q.iterable&&K.has(q.iterable)?`${zZ}<typeof ${q.iterable}>`:"any";z(`declare var ${q.name}: ${H}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let q of G.declarations.split(`
3582
+ `))z(q);let K=az($).map((q)=>{let H=G?.events.get(q.offset??-1);if(H){q.anchor=!0;let W=q.code.trim(),U=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(W),j=U?`void ((${U[2]}) satisfies __StxAssignedValue<typeof ${U[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(W)?`${W}($event)`:W,B=`;(($event: ${H}): void => { `;return{expression:q,statement:{text:`${B}${j} });`,prefixLength:B.length}}}return{expression:q,statement:UK(q)}}).filter((q)=>q.statement!==null);if(K.push(...G?.checks||[]),K.length>0){let q=u9($),W=[...new Set(J.flatMap((j)=>S1(j.code)))].filter((j)=>/^[A-Z_$][\w$]*$/i.test(j)),U=0;if(W.length>0){z(sz);for(let j of W)z(`type __StxT_${j} = ${LZ}<typeof ${j}>`);z(`;((${W.map((j)=>`${j}: __StxT_${j}`).join(", ")}) => {`),U=1}for(let{expression:j,statement:B}of K){let V=" ".repeat(U),_=j.offset===void 0?[]:HK(q,j.offset),O=_.length>0?`${_.map((L)=>`if (${L}) `).join("")}{ `:"",F=_.length>0?" }":"";z(V+O+B.text+F,{line:j.line,column:j.column,expression:j,prefixLength:B.prefixLength+V.length+O.length})}if(U>0)z("});")}}return z("export {}"),{text:Q.join(`
3583
+ `),lineMap:Y,sourceLineCount:X.length,componentDependencies:G?.dependencies}}function q_($,Z,J){let X=$.lineMap.get(Z);if(!X)return Z<=$.sourceLineCount?{line:Z,column:J}:null;let Q=X.expression?.anchor?0:Math.max(0,J-1-(X.prefixLength??0));return{line:X.line,column:X.column+Q,expression:X.expression}}var BK=[{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"}],VK=[{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')"}],LK=[{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 OK($){let Z=[],J=[];return _K($,Z),FK($,Z,J),wK($,J),RK($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function _K($,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 FK($,Z,J){for(let X of BK){let Q=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Y=new RegExp(X.close,"g"),G=($.match(Q)||[]).length,z=($.match(Y)||[]).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 wK($,Z){for(let J of VK)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function RK($,Z){for(let J of LK)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function NK($,Z){let J=$.slice(0,Z).split(`
3584
+ `);return{line:J.length,column:J[J.length-1].length+1}}function DK($,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 MK($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function AK($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Q=X[1].toLowerCase();if(!Q.startsWith("end"))J.add(Q)}return Array.from(J)}import s0 from"path";import X2 from"process";var vZ=["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"],FZ=new Set(vZ),IK=new Set(["props","$props","defineProps"]),TK=new Set(["stx","@stacksjs/stx"]),wZ=y1(128),RZ=y1(64);function kK($){let Z=[],J=0,X=$.split(`
3585
+ `);for(let Q of X){let Y=J,G=null,z=!1;for(let K=0;K<Q.length;K++){let q=Q[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<Q.length&&Q[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Y===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let q=Q.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=Q.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 EK($){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 Q=[],Y="",G=0,z=0,K=null;for(let q=0;q<X.length;q++){let H=X[q];if(K){if(Y+=H,H===K)K=null;continue}if(H==='"'||H==="'"||H==="`"){K=H,Y+=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){Q.push(Y),Y="";continue}Y+=H}if(Y)Q.push(Y);return Q.map((q)=>{let H=q.trim(),W=H.startsWith("..."),U=W?H.slice(3):H,j=-1,B=0;for(let N=0;N<U.length;N++)if(U[N]==="<")B++;else if(U[N]===">")B--;else if(U[N]===":"&&B===0){j=N;break}if(j===-1)return q;let _=U.substring(0,j).trim().replace(/\?$/,""),O=U.substring(j+1),F=-1,L=0;for(let N=0;N<O.length;N++)if(O[N]==="<")L++;else if(O[N]===">")L--;else if(O[N]==="="&&L===0){F=N;break}let w=W?"...":"";if(F!==-1)return`${w}${_} = ${O.substring(F+1).trim()}`;return`${w}${_}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,Y)=>{if(!Y.includes(":"))return X;return`${Q}(${J(Y)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,Y=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[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);Y.push({start:G+1,end:K,replacement:U})}for(let G=Y.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Y[G];Z=Z.substring(0,z)+q+Z.substring(K)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.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,`
3586
+
3587
+ `),Z}function bK($){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test($)}function yK($){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 CK($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}var NZ=new Set;async function SK($,Z,J,X={}){if(!$.trim())return;let Q=Z2(),Y=H1($,JSON.stringify(Q)),G=wZ.get(Y);if(G===void 0){try{let S=Y$({loader:"ts",target:"browser",define:Q}),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=EK($)}wZ.set(Y,G)}let z={exports:{}},K=z.exports,q=X2.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(s0.resolve(s0.dirname(J),S));continue}let v=s0.resolve(q,"node_modules",S),d=s0.join(v,"package.json"),X0=JSON.parse(x("fs").readFileSync(d,"utf8")),U0=X0.main||"index.js";if(X0.exports){let w0=typeof X0.exports==="string"?X0.exports:X0.exports["."];if(typeof w0==="string")U0=w0;else if(w0?.bun)U0=w0.bun;else if(w0?.import)U0=w0.import;else if(w0?.default)U0=w0.default}H[S]=await import(s0.resolve(v,U0))}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,X0]of Object.entries(S)){let U0=B[d];if(U0!==void 0)v[d]=U0;else if(typeof X0==="function")v[d]=X0();else v[d]=X0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let _=(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,X0]of Object.entries(S)){let U0=X0&&typeof X0==="object"&&!Array.isArray(X0)?X0:{type:X0};if(v[d]===void 0&&U0.default!==void 0)v[d]=typeof U0.default==="function"?U0.default():U0.default}return v},F=()=>Z.slots||{},L=(S,v)=>{let d={...S};for(let[X0,U0]of Object.entries(v))if(d[X0]===void 0)if(typeof U0==="function")d[X0]=U0();else d[X0]=U0;return d},w=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},N=(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)=>{},D=(S)=>{},I=Y7(Z);function k(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 E=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",X0=Object.fromEntries(new URLSearchParams(v)),U0=Z.query,w0=Object.keys(X0).length>0?X0:U0??{},Z1=v||(Object.keys(w0).length>0?`?${new URLSearchParams(w0).toString()}`:"");return{params:Z.params??{},query:w0,path:d,name:"",fullPath:d+Z1,hash:"",matched:[]}},C=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),y=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=SZ(v,S||{})},b=(S)=>{y(PZ(S||{}))},P=(S)=>({value:S}),h=(S)=>S,p=(S)=>({value:typeof S==="function"?S():S}),g=(S,v)=>{},Z0=(S)=>{},J0=(S)=>{},e=(S)=>S?S():Promise.resolve(),i=(S)=>(v,...d)=>{},q0=(S)=>{},r=(S,v)=>{},L0=(S,v)=>v,e0=()=>({value:"light"}),$1=()=>w(!1),l=(S)=>w(!1),u=()=>w(!1),o=()=>l("(prefers-color-scheme: dark)"),Q0=()=>l("(prefers-color-scheme: light)"),B0=()=>l("(prefers-reduced-motion: reduce)"),K0=()=>l("(prefers-contrast: more)"),c0={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:{}},p9=new Proxy(c0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),i9={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Q2=console;try{let S=xZ(G,J),v=new Set(Object.keys(B)),d=Object.keys(Z).filter((a)=>!v.has(a)&&!IK.has(a)&&Y2(a)),X0=d.map((a)=>Z[a]);if(!d.includes("__stxServeContext"))d.push("__stxServeContext"),X0.push(void 0);let U0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),w0=[],Z1=[];for(let[a,h0]of Object.entries(B)){if(!Y2(a))continue;if(U0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(S))continue;w0.push(a),Z1.push(h0)}let P0=kK(S).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
3588
+ `),m=Z.params??{},c=[],G0=[];for(let a=0;a<d.length;a++){if(d[a]==="params")continue;c.push(d[a]),G0.push(X0[a])}let n=[...vZ,...w0,...c],R0=`return (async () => {
3589
3589
  ${S}
3590
3590
  ${P0}
3591
3591
  return module.exports
3592
- })()`,O0=H1(R0,n.join("\x00")),b0=FZ.get(O0);if(!b0)b0=Function(...n,R0),FZ.set(O0,b0);let J1=Z.__stx_options?.runtimeConfig;if(J1||/\buse(?:Server)?RuntimeConfig\b/.test(G))await g9(Z,J,J1);let v0=await IZ(Z.__stx_runtime_config??TZ()??bZ(),()=>g6(Z,()=>b0(z,K,j,B,V,_,O,L,A,h6,EZ,kZ,w,N,R,M,T,D,k,E,C,y,b,I.setResponseStatus,I.setResponseHeader,I.notFound,P,h,p,g,Z0,J0,e,i,q0,F,r,L0,e0,$1,l,u,o,Q0,B0,K0,p9,i9,Q2,c0.confirm,c0.alert,c0.fetch,m,...Z1,...G0)));if(X.preserveExisting){for(let[a,h0]of Object.entries(v0))if(!(a in Z)||Z[a]===void 0)Z[a]=h0}else Object.assign(Z,v0);for(let[a,h0]of Object.entries(B))if(!(a in Z))Z[a]=h0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(kK(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}`);else if(EK(S))console.warn(`[stx] server <script> in ${J??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${v}`);else if(bK(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}`);else{let d=`${J??"<unknown>"}\x00${v}`;if(X2.env.STX_DEBUG||!wZ.has(d))wZ.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}`)}try{await hK(G,Z,J)}catch(d){if(X2.env.STX_DEBUG){let X0=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${X0}`)}}}}function CK($){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 SK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function PZ($,Z){let J=Z?s0.dirname(Z):X2.cwd(),X=X2.cwd(),Y=$.split(`
3593
- `),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,W=G;for(let j=G;j<Y.length&&!q;j++){let B=null,V=!1,_=Y[j];for(let O=0;O<_.length;O++){let F=_[O];if(V){V=!1;continue}if(F==="\\"){V=!0;continue}if(B){if(F===B)B=null;continue}if(F==='"'||F==="'"||F==="`"){B=F;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0){G=j+1,q=!0;break}}}}if(!q)G=Y.length;let H=Y.slice(W,G).join(`
3594
- `),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(H);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(!CK(K)&&G+q+1<Y.length)q++,K=`${K} ${Y[G+q].trim()}`;G+=q;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),H=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+['"](.+?)['"]/),j=K,B=(V)=>{if(V.startsWith("."))return s0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return s0.resolve(X,V.slice(2));return V};if(W){let[,V,_]=W,O=B(_);Q.push(`const ${V} = (await import('${O}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(H){let[,V,_]=H,O=B(_),F=[],L=[],w=AK.has(_);for(let N of V.split(",")){let R=N.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,D]=[M[0].trim(),M[1].trim()];if(w&&OZ.has(T)){Q.push(`const ${D} = ${T};`);continue}F.push(`${T}: ${D}`),L.push(D)}else{if(w&&OZ.has(R))continue;F.push(R),L.push(R)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${O}')`);for(let N of L)Q.push(`module.exports.${N} = ${N};`)}else if(U){let V=B(U[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(SK.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let K=NZ(Y,G),{type:q,name:W,value:H}=K;Q.push(`${q} ${W} = ${H};`),Q.push(`module.exports.${W} = ${W};`),G=K.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let K=X$(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=NZ(Y,G),{type:q,name:W,value:H}=K;Q.push(`${q} ${W} = ${H};`),Q.push(`module.exports.${W} = ${W};`),G=K.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let K=X$(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 W=X$(q,G);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);G=W.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],W=Y[G].replace(/^export\s+/,""),H=0,U=G;for(;U<Y.length;U++){let j=Y[U];for(let B of j)if(B==="{")H++;else if(B==="}")H--;if(U>G)W+=`
3595
- `+j;if(H<=0&&U>=G)break}Q.push(W),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(`
3596
- `),J,X)}function PK($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,K=!1,q=0;while(Q<X){let W=$[Q],H=$[Q+1];if(z){if(Y+=W,W===`
3597
- `)z=!1;Q++;continue}if(K){if(Y+=W,W==="*"&&H==="/"){Y+=H,Q+=2,K=!1;continue}Q++;continue}if(!G&&W==="/"&&H==="/"){z=!0,Y+=W,Q++;continue}if(!G&&W==="/"&&H==="*"){K=!0,Y+=W,Q++;continue}if(G){if(Y+=W,W==="\\"){Y+=H,Q+=2;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(W==="$"&&H==="{"){q++,Y+=H,Q+=2;continue}if(W==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){G=W,Y+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=vK($,Q);if(U){let{quote:j,path:B,end:V}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let _=B.startsWith(".")?s0.resolve(Z,B):s0.resolve(J,B.slice(2));Y+=`await import(${j}${_}${j})`,Q=V;continue}}}Y+=W,Q++}return Y}function vK($,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 vZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=M0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function xZ($){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?vZ(J,X):null;if(z){Z.push(...xZ(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 xK($){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 RZ($,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 NZ($,Z){let J=$[Z].trim(),X=xK(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let W=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let H=J.slice(W[0].length),U=Z;if(H.startsWith("{")||H.startsWith("[")){let B=H[0],V=B==="{"?"}":"]",_=RZ(H,B,V,0),O=H;for(let F=Z+1;F<$.length&&_>0;F++)O+=` ${$[F].trim()}`,U=F,_=RZ($[F],B,V,_);if(_>0)O=H,U=Z;H=O}let j=vZ(H,0);if(j){let B=W[1],V=j.pattern,_=H.slice(j.endPos).trim();if(_.startsWith("=")){let O=_.slice(1).trim(),F=O,L=Math.max(U,Z);if(DZ(O)){let M=MZ($,L,O);F=M.value,L=M.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=xZ(V),N=`__stx_src_${Z}`,R=w.map((M)=>`module.exports.${M} = ${M};`).join(`
3592
+ })()`,O0=H1(R0,n.join("\x00")),b0=RZ.get(O0);if(!b0)b0=Function(...n,R0),RZ.set(O0,b0);let J1=Z.__stx_options?.runtimeConfig;if(J1||/\buse(?:Server)?RuntimeConfig\b/.test(G))await g9(Z,J,J1);let v0=await kZ(Z.__stx_runtime_config??EZ()??CZ(),()=>g6(Z,()=>b0(z,K,j,B,V,_,O,L,A,h6,yZ,bZ,w,N,R,M,T,D,k,E,C,y,b,I.setResponseStatus,I.setResponseHeader,I.notFound,P,h,p,g,Z0,J0,e,i,q0,F,r,L0,e0,$1,l,u,o,Q0,B0,K0,p9,i9,Q2,c0.confirm,c0.alert,c0.fetch,m,...Z1,...G0)));if(X.preserveExisting){for(let[a,h0]of Object.entries(v0))if(!(a in Z)||Z[a]===void 0)Z[a]=h0}else Object.assign(Z,v0);for(let[a,h0]of Object.entries(B))if(!(a in Z))Z[a]=h0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(bK(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(yK(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(CK(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(X2.env.STX_DEBUG||!NZ.has(d))NZ.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 mK(G,Z,J)}catch(d){if(X2.env.STX_DEBUG){let X0=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${X0}`)}}}}function PK($){let Z=0,J=null,X=!1,Q=!1;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(J){if(G===J){if(J=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Y)&&Z===0)X=!0}return J===null&&Z===0&&Q}var vK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function xZ($,Z){let J=Z?s0.dirname(Z):X2.cwd(),X=X2.cwd(),Q=$.split(`
3593
+ `),Y=[],G=0;while(G<Q.length){let z=Q[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<Q.length;G++){for(let q of Q[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<Q.length&&!q;j++){let B=null,V=!1,_=Q[j];for(let O=0;O<_.length;O++){let F=_[O];if(V){V=!1;continue}if(F==="\\"){V=!0;continue}if(B){if(F===B)B=null;continue}if(F==='"'||F==="'"||F==="`"){B=F;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0){G=j+1,q=!0;break}}}}if(!q)G=Q.length;let W=Q.slice(H,G).join(`
3594
+ `),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)Y.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let K=z,q=0;while(!PK(K)&&G+q+1<Q.length)q++,K=`${K} ${Q[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 s0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return s0.resolve(X,V.slice(2));return V};if(H){let[,V,_]=H,O=B(_);Y.push(`const ${V} = (await import('${O}')).default`),Y.push(`module.exports.${V} = ${V};`)}else if(W){let[,V,_]=W,O=B(_),F=[],L=[],w=TK.has(_);for(let N of V.split(",")){let R=N.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,D]=[M[0].trim(),M[1].trim()];if(w&&FZ.has(T)){Y.push(`const ${D} = ${T};`);continue}F.push(`${T}: ${D}`),L.push(D)}else{if(w&&FZ.has(R))continue;F.push(R),L.push(R)}}if(F.length>0)Y.push(`const { ${F.join(", ")} } = await import('${O}')`);for(let N of L)Y.push(`module.exports.${N} = ${N};`)}else if(U){let V=B(U[1]);Y.push(`await import('${V}')`)}else Y.push(j);G++;continue}if(vK.test(z))Y.push(Q[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let K=MZ(Q,G),{type:q,name:H,value:W}=K;Y.push(`${q} ${H} = ${W};`),Y.push(`module.exports.${H} = ${H};`),G=K.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let K=X$(Q,G);Y.push(K.functionCode),Y.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let K=MZ(Q,G),{type:q,name:H,value:W}=K;Y.push(`${q} ${H} = ${W};`),Y.push(`module.exports.${H} = ${H};`),G=K.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let K=X$(Q,G);Y.push(K.functionCode),Y.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=Q[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Q];q[G]=K;let H=X$(q,G);if(Y.push(H.functionCode),H.name)Y.push(`module.exports.default = ${H.name};`);G=H.nextIndex}else if(z.startsWith("export default ")){let K=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Y.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=Q[G].replace(/^export\s+/,""),W=0,U=G;for(;U<Q.length;U++){let j=Q[U];for(let B of j)if(B==="{")W++;else if(B==="}")W--;if(U>G)H+=`
3595
+ `+j;if(W<=0&&U>=G)break}Y.push(H),Y.push(`module.exports.${q} = ${q};`),G=U+1}else Y.push(z),G++}else if(z.includes("module.exports"))Y.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Y.push(z),G++;else G++}return xK(Y.join(`
3596
+ `),J,X)}function xK($,Z,J){let X=$.length,Q="",Y=0,G=null,z=!1,K=!1,q=0;while(Y<X){let H=$[Y],W=$[Y+1];if(z){if(Q+=H,H===`
3597
+ `)z=!1;Y++;continue}if(K){if(Q+=H,H==="*"&&W==="/"){Q+=W,Y+=2,K=!1;continue}Y++;continue}if(!G&&H==="/"&&W==="/"){z=!0,Q+=H,Y++;continue}if(!G&&H==="/"&&W==="*"){K=!0,Q+=H,Y++;continue}if(G){if(Q+=H,H==="\\"){Q+=W,Y+=2;continue}if(H===G&&G!=="`"){G=null,Y++;continue}if(G==="`"){if(H==="$"&&W==="{"){q++,Q+=W,Y+=2;continue}if(H==="`"){G=null,Y++;continue}}Y++;continue}if(q>0){if(H==="{")q++;else if(H==="}")q--}if(H==='"'||H==="'"||H==="`"){G=H,Q+=H,Y++;continue}if(H==="a"&&$.startsWith("await",Y)){let U=fK($,Y);if(U){let{quote:j,path:B,end:V}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let _=B.startsWith(".")?s0.resolve(Z,B):s0.resolve(J,B.slice(2));Q+=`await import(${j}${_}${j})`,Y=V;continue}}}Q+=H,Y++}return Q}function fK($,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 Q=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Y=$.slice(Q,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Y,end:J+1}}function fZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Q=M0($,J,J==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function gZ($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Q=0,Y="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Q===0?fZ(J,X):null;if(z){Z.push(...gZ(z.pattern)),X=z.endPos,Y="";continue}Q++}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(Y.trim())Z.push(Y.trim());Y="",X++;continue}if(G===":"){Y="",X++;continue}if(G==="="){if(Y.trim())Z.push(Y.trim());Y="",X++;while(X<J.length&&J[X]!==","&&Q===0){if(J[X]==="{"||J[X]==="[")Q++;else if(J[X]==="}"||J[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))Y+=G;X++}if(Y.trim())Z.push(Y.trim());return Z}function gK($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Q=0,Y=null;J++;for(;J<$.length;J++){let G=$[J];if(Y){if(G==="\\"){J++;continue}if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=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 DZ($,Z,J,X){let Q=null,Y=!1;for(let G of $){if(Y){Y=!1;continue}if(G==="\\"){Y=!0;continue}if(Q){if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function MZ($,Z){let J=$[Z].trim(),X=gK(J),Q=X?[J,X.type,X.name,X.value]:null;if(!Q){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==="{"?"}":"]",_=DZ(W,B,V,0),O=W;for(let F=Z+1;F<$.length&&_>0;F++)O+=` ${$[F].trim()}`,U=F,_=DZ($[F],B,V,_);if(_>0)O=W,U=Z;W=O}let j=fZ(W,0);if(j){let B=H[1],V=j.pattern,_=W.slice(j.endPos).trim();if(_.startsWith("=")){let O=_.slice(1).trim(),F=O,L=Math.max(U,Z);if(AZ(O)){let M=IZ($,L,O);F=M.value,L=M.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=gZ(V),N=`__stx_src_${Z}`,R=w.map((M)=>`module.exports.${M} = ${M};`).join(`
3598
3598
  `);return{type:B,name:N,value:`${F}; ${B} ${V} = ${N};
3599
- ${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,K=z,q=Z;if(DZ(z)){let W=MZ($,Z,z);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
3600
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:K,nextIndex:q}}function X$($,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(fK(J)){let z=gK($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function DZ($){let Z=$.trim();if(Z.startsWith("{"))return M0(Z,"{","}",0)===-1;if(Z.startsWith("["))return M0(Z,"[","]",0)===-1;return!fZ(Z)}function fZ($){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 gZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=M0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function fK($){let Z=gZ($);if(Z===-1)return!0;return M0($,"{","}",Z)===-1}function MZ($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!fZ(X)){let Q=$[Y];X+=`
3601
- ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
3602
- ${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function gK($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=gZ(X);if(Q!==-1){if(M0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
3603
- ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function AZ($,Z){let J=Y0($,Z)??Y0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...X2.env}})},Y=Object.keys(X).filter(Y2),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 hK($,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=AZ(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=AZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function uK($){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 mK($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var x2=new o1(500),l9=new o1(1000),oZ=33554432,G$=oZ;function dK($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===G$)return;G$=Z,c9.setMaxBytes(Z)}var c9=new o1(2000,{maxBytes:oZ,sizeOf:($)=>$.output.length});function lK($){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 hZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function I1($){return!cK($)}var d9=new Map;function Y$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=d9.get(Z);if(J)return J;if(d9.size>=16)d9.clear();let X=new Bun.Transpiler($);return d9.set(Z,X),X}var uZ=new WeakMap,pK=256;function T1($){try{let Z=Y$({loader:"ts",target:"browser",define:Z2()}),J=uZ.get(Z);if(!J)J=new Map,uZ.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>=pK){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 iK($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},K=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3604
- `)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 W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let _=V.trim().split(":");return _[_.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 H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[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 nK($){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 sK($){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 oK($,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 nK(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=sK(q);if(W===-1)continue;let H=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(H))continue;if(Z[H]!==void 0)continue;let U=q.slice(W+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(Y2),B=Function(...j,`"use strict"; return (${U});`);Z[H]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var rK=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function aK($,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(!rK.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 F9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.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`])],W=typeof Y.root==="string"?f.resolve(Y.root):void 0,H=W??f.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(f.join(f.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(f.join(f.dirname(X),"components")),j(Y.componentsDir),W)j(f.resolve(W,"resources/views/components")),j(f.resolve(W,"resources/components")),j(f.resolve(W,"src/components")),j(f.resolve(W,"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(f.resolve(f.dirname(X),`${Q}.stx`));let _=mZ(f.resolve(import.meta.dir,"components"));for(let O of U){let F=f.isAbsolute(O)?O:f.resolve(H,O);if(mZ(F)===_)continue;for(let L of q)if(await t(f.join(F,L)))return!0}return!1}function mZ($){try{return sZ.realpathSync($)}catch{return $}}function tK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function eK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function $q($,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 dZ=new Set;function lZ($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&dZ.has(Y))return;dZ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
3599
+ ${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Y,G,z]=Q,K=z,q=Z;if(AZ(z)){let H=IZ($,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+=`
3600
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Y,name:G,value:K,nextIndex:q}}function X$($,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[,Q]=X,Y=J.replace(/^export\s+/,""),G=Z;if(hK(J)){let z=uK($,Z,Y);Y=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Q,functionCode:Y,nextIndex:G}}function AZ($){let Z=$.trim();if(Z.startsWith("{"))return M0(Z,"{","}",0)===-1;if(Z.startsWith("["))return M0(Z,"[","]",0)===-1;return!hZ(Z)}function hZ($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Q=0;Q<$.length;Q++){let Y=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&J)continue;if((Y==='"'||Y==="'")&&!J){J=Y;continue}if(Y===J&&J!=="`"){J=null;continue}if(Y==="`"&&!J){J="`";continue}if(Y==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Y==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&Y==="{"){X++;continue}if(X>0&&Y==="}"){X--;continue}if(J)continue;if(Y==="(")Z.paren++;else if(Y===")")Z.paren--;else if(Y==="[")Z.bracket++;else if(Y==="]")Z.bracket--;else if(Y==="{")Z.brace++;else if(Y==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function uZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=M0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function hK($){let Z=uZ($);if(Z===-1)return!0;return M0($,"{","}",Z)===-1}function IZ($,Z,J){let X=J,Q=Z+1;while(Q<$.length&&!hZ(X)){let Y=$[Q];X+=`
3601
+ ${Y}`,Q++}while(Q<$.length){let Y=$[Q].trim();if(Y.startsWith(".")||Y.startsWith("?."))X+=`
3602
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function uK($,Z,J){let X=J,Q=Z+1;while(Q<$.length){let Y=uZ(X);if(Y!==-1){if(M0(X,"{","}",Y)!==-1)break}let G=$[Q];X+=`
3603
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function TZ($,Z){let J=Y0($,Z)??Y0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...X2.env}})},Q=Object.keys(X).filter(Y2),Y=Q.map((G)=>X[G]);try{return Function(...Q,`'use strict'; return (${$});`)(...Y)}catch{try{return Function(...Q,`'use strict'; return ${$};`)(...Y)}catch{return}}}async function mK($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Y of X){let[,,G,z]=Y;try{let K=z.trim().replace(/;$/,""),q=TZ(K,Z);if(q!==void 0)Z[G]=q}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Y of Q){let[,,G,z]=Y;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),q=TZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function dK($){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 lK($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var g2=new o1(500),l9=new o1(1000),aZ=33554432,G$=aZ;function cK($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===G$)return;G$=Z,c9.setMaxBytes(Z)}var c9=new o1(2000,{maxBytes:aZ,sizeOf:($)=>$.output.length});function pK($){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 Q={};for(let Y of Object.keys(X).sort())Q[Y]=J(X[Y]);return Q};return JSON.stringify(J($))}catch{return null}}function mZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function I1($){return!iK($)}var d9=new Map;function Y$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=d9.get(Z);if(J)return J;if(d9.size>=16)d9.clear();let X=new Bun.Transpiler($);return d9.set(Z,X),X}var dZ=new WeakMap,nK=256;function T1($){try{let Z=Y$({loader:"ts",target:"browser",define:Z2()}),J=dZ.get(Z);if(!J)J=new Map,dZ.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Q=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Q=Q.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Q=Q.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let K=Y.length;return Y.push(z),`"__STX_EXPR_${K}__"`}),Q=Q.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let K=Y.length;return Y.push(z),`"__STX_EXPR_${K}__"`}),Q=Q.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let K=Y.length;return Y.push(z),`"__STX_EXPR_${K}__"`});let G=Z.transformSync(Q);for(let z=0;z<Y.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Y[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Y[z]);if(J.size>=nK){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 sK($){let Z=[],J=new Set,X=0,Q=0,Y=$.length,G=(H)=>{Q++;while(Q<Y){if($[Q]==="\\"){Q+=2;continue}if($[Q]===H){Q++;return}Q++}},z=()=>{Q++;while(Q<Y){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let H=1;while(Q<Y&&H>0)if($[Q]==="{")H++,Q++;else if($[Q]==="}")H--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")z();else Q++;continue}Q++}},K=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<Y&&$[Q]!==`
3604
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<Y-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},q=()=>{if(X!==0)return;let H=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let B=H[2].split(",").map((V)=>{let _=V.trim().split(":");return _[_.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(Q).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(Q).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(Q).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(Q<Y){if(K())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){z();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))q();Q++}return Z}function oK($){let Z=[],J=0,X=0,Q=null;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Y)),X=Y+1}if(X<$.length)Z.push($.slice(X));return Z}function rK($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Q=$[X];if(J){if(Q==="\\"){X++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let Y=$[X-1],G=$[X+1];if(Y==="!"||Y==="<"||Y===">"||Y==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function aK($,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 Q=X,Y=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Y++;else if(K==="{"){if(Y--,Y===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Q);for(let K of oK(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let H=rK(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(Y2),B=Function(...j,`"use strict"; return (${U});`);Z[W]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var tK=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function eK($,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(!tK.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 Y=J[0].length;return $.slice(0,Y)+Z+$.slice(Y)}async function R9($,Z,J,X,Q){let Y=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.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[Y,Y.toLowerCase(),G(Y),z(Y)])if(K.has(O))return!0}let q=[...new Set([`${Y}.stx`,`${G(Y)}.stx`,`${z(Y)}.stx`])],H=typeof Q.root==="string"?f.resolve(Q.root):void 0,W=H??f.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(f.join(f.dirname(B),"components"));if(j(Z),j(Q._rootComponentsDir),j(f.join(f.dirname(X),"components")),j(Q.componentsDir),H)j(f.resolve(H,"resources/views/components")),j(f.resolve(H,"resources/components")),j(f.resolve(H,"src/components")),j(f.resolve(H,"components"));for(let O of Q._layerComponentDirs??[])j(O);let V=Q._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Q.fallbackComponentsDir),Y.startsWith("./")||Y.startsWith("../"))return t(f.resolve(f.dirname(X),`${Y}.stx`));let _=lZ(f.resolve(import.meta.dir,"components"));for(let O of U){let F=f.isAbsolute(O)?O:f.resolve(W,O);if(lZ(F)===_)continue;for(let L of q)if(await t(f.join(F,L)))return!0}return!1}function lZ($){try{return rZ.realpathSync($)}catch{return $}}function $q($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Zq($){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 Jq($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Q,Y)=>{let G;try{G=C0(Q,Z)}catch{return Y}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,(Q,Y)=>X(Y,Q)).replace(/\{\{([\s\S]*?)\}\}/g,(Q,Y)=>X(Y,Q))}var cZ=new Set;function pZ($,Z,J,X){let Q=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&cZ.has(Q))return;cZ.add(Q);let Y=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
3605
3605
  searched:
3606
3606
  ${J.map((K)=>` - ${K}`).join(`
3607
- `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function cZ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Zq($){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 A1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-jzfk5ect.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let H=new Set(W);H.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&tK(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(),_=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Y.__importedComponents;if(F){let m=[_,_.toLowerCase(),B(_),V(_)];for(let c of m)if(F.has(c)){O=F.get(c);break}}let L=[];if(!O){let m=[`${_}.stx`,`${B(_)}.stx`,`${V(_)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let I0=f.join(f.dirname(G0),"components");n.push(I0)}if(X)n.push(X);let R0=G._rootComponentsDir;if(typeof R0==="string"&&!n.includes(R0))n.push(R0);let O0=f.join(f.dirname(Q),"components");if(!n.includes(O0))n.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let b0=typeof G.root==="string"?f.resolve(G.root):void 0,J1=b0??f.dirname(Q),v0=[];if(b0)v0.push(f.resolve(b0,"resources/views/components")),v0.push(f.resolve(b0,"resources/components")),v0.push(f.resolve(b0,"src/components")),v0.push(f.resolve(b0,"components"));v0.push(f.resolve(import.meta.dir,"components"));for(let I0 of v0)if(!n.includes(I0))n.push(I0);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let I0 of a)if(typeof I0==="string"&&!n.includes(I0))n.push(I0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let h0=[...new Set(n.map((I0)=>{if(!I0)return I0;return f.isAbsolute(I0)?I0:f.resolve(J1,I0)}))];n.length=0,n.push(...h0);let j1=`${_}\x00${Q}\x00${h0.join("\x00")}`,n9=l9.get(j1);if(n9)if(await t(n9))O=n9;else l9.delete(j1);if(!O&&(_.startsWith("./")||_.startsWith("../")))O=f.resolve(f.dirname(Q),`${_}.stx`),L.push(O);else if(!O)for(let I0 of n){if(!I0)continue;for(let g2 of c){let h2=f.join(I0,g2);if(L.push(h2),await t(h2)){O=h2;break}}if(O)break;if(!O)try{let g2=await import("fs");if(!g2.statSync(I0,{throwIfNoEntry:!1})?.isDirectory())continue;let GJ=8,s9=[{path:I0,depth:0}];while(s9.length>0&&!O){let u2=s9.pop();if(u2.depth>=GJ)continue;let W$;try{W$=g2.readdirSync(u2.path,{withFileTypes:!0})}catch{continue}for(let m2 of W$){if(!m2.isDirectory())continue;if(m2.name==="node_modules"||m2.name.startsWith("."))continue;let H$=f.join(u2.path,m2.name);for(let zJ of c){let o9=f.join(H$,zJ);if(L.push(o9),await t(o9)){O=o9;break}}if(O)break;s9.push({path:H$,depth:u2.depth+1})}}}catch{}if(O)break}if(O)l9.set(j1,O)}if(!O||!await t(O))return lZ($,Q,L),cZ($);K.add(O);let w;if(x2.has(O))w=x2.get(O);else try{w=await Bun.file(O).text(),x2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return lZ($,Q,[O],c),cZ($)}let N=new Set(["__originalFilePath","__importedComponents",d2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||N.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-cmccdayf.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),D=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",R0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!R0||["module","text/javascript","application/javascript"].includes(R0);if(!/\bserver\b/i.test(n)&&O0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await s("stx/slots",()=>import("./chunk-ewpbxy5m.js")),A=k(I),E={};if(A.defaultSlot?.trim())E.default=A.defaultSlot;for(let[m,c]of A.namedSlots)E[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_${_.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:E,__processedComponents:H,__sections:{},__stx_signals_gate:X1(w)||eK(J)};oK(w,b);let P=w,h=q9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(p)],Z0=[],J0=g.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),e=null,i=null,q0=null,r=0,L0=null;if(dK(G),J0&&G$>0){let m=lK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){e=`${O}\x00${H1(w)}\x00${m}`;let c=c9.get(e);if(c){for(let G0 of c.dependencies)K.add(G0);if(M$(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 n of c.preservedClientExpressions)G0.add(n);Y.__stx_preserved_client_expressions=[...G0]}return c.output}i=new Set(K),q0=N$(Y),r=C.n,L0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let e0=new Set;for(let m of g){let c=m[1]||"",G0=m[2]||"",n=c.includes("server");if(I1(c)&&G0.trim())G0=T1(G0);if(n&&G0){for(let O0 of S1(G0))e0.add(O0);try{await q(G0,b,O)}catch(O0){}}if(!n){let O0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b0=O0.includes("{{")&&O0.includes("}}"),J1=O0.includes("{!!")&&O0.includes("!!}");if(b0||J1)O0=G5(O0,b,O);let v0=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Z0.push(`<script${v0}>${O0}</script>`)}}let l=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),u=l?l[1]:"",o=l?l[2]:"",Q0="",B0=u&&/\bscoped\b/i.test(u);if(l)Q0=`<style${u}>${$q(o,b,O)}</style>`;let K0=P;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(K0=K0.replace(m,(G0,n)=>{let R0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(R0)c.push(`<style${R0[1]}>${R0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)Q0=`${Q0}${c.join(`
3608
- `)}`}if(J&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:c0}=await s("stx/slots",()=>import("./chunk-ewpbxy5m.js")),{defaultSlot:p9,namedSlots:i9}=A,Q2=Z0.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),S=(m)=>Q2?T8(m,y):m,v=new Map([...i9].map(([m,c])=>[m,{...c,content:S(c.content)}]));K0=await c0(K0,S(p9),v,b);let d=Zq(Z0),X0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!e0.has(m));if(d.length>0||X0.length>0)b.__stx_client_signal_names=[...new Set([...X0,...d])];else delete b.__stx_client_signal_names;let U0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:Q2||Z0.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let w0=await t3(K0,b,O,U0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of w0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(m[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let U1=y,P0=w0;if(Q2){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${hZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${hZ(j)}"`:"",G0=` data-stx-scope="${U1}"${m}${c}`;P0=aK(w0,G0)??`<div${G0}>${w0}</div>`;let n=await Promise.all(Z0.map(async(R0)=>{let O0=R0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return R0;let[,b0,J1]=O0,{vendorStyleTags:v0,factoryBody:a}=await Yq(J1,O,G.buildMode==="compile"),h0=j?null:e9(Y,a),j1=h0?`window.__stxComponentFactories[${JSON.stringify(h0)}](${JSON.stringify(U1)});`:`(${a})(${JSON.stringify(U1)});`;if(j)return`${v0}<script type="stx/island" data-stx-island="${U1}" data-stx-scoped data-stx-owner="${U1}"${b0}>${j1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${U1}"${b0}>${j1}</script>`}));if(P0=P0+`
3607
+ `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Y}, so it rendered as nothing.${G}${z}`)}function iZ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Xq($){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 Q;while((Q=J.exec(X))!==null)Z.add(Q[1]);J.lastIndex=0}return[...Z]}async function A1($,Z,J,X,Q,Y,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-7w66sc17.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"&&$q(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(),_=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Q.__importedComponents;if(F){let m=[_,_.toLowerCase(),B(_),V(_)];for(let c of m)if(F.has(c)){O=F.get(c);break}}let L=[];if(!O){let m=[`${_}.stx`,`${B(_)}.stx`,`${V(_)}.stx`],c=[...new Set(m)],G0=Q.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let I0=f.join(f.dirname(G0),"components");n.push(I0)}if(X)n.push(X);let R0=G._rootComponentsDir;if(typeof R0==="string"&&!n.includes(R0))n.push(R0);let O0=f.join(f.dirname(Y),"components");if(!n.includes(O0))n.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let b0=typeof G.root==="string"?f.resolve(G.root):void 0,J1=b0??f.dirname(Y),v0=[];if(b0)v0.push(f.resolve(b0,"resources/views/components")),v0.push(f.resolve(b0,"resources/components")),v0.push(f.resolve(b0,"src/components")),v0.push(f.resolve(b0,"components"));v0.push(f.resolve(import.meta.dir,"components"));for(let I0 of v0)if(!n.includes(I0))n.push(I0);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let I0 of a)if(typeof I0==="string"&&!n.includes(I0))n.push(I0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let h0=[...new Set(n.map((I0)=>{if(!I0)return I0;return f.isAbsolute(I0)?I0:f.resolve(J1,I0)}))];n.length=0,n.push(...h0);let j1=`${_}\x00${Y}\x00${h0.join("\x00")}`,n9=l9.get(j1);if(n9)if(await t(n9))O=n9;else l9.delete(j1);if(!O&&(_.startsWith("./")||_.startsWith("../")))O=f.resolve(f.dirname(Y),`${_}.stx`),L.push(O);else if(!O)for(let I0 of n){if(!I0)continue;for(let u2 of c){let m2=f.join(I0,u2);if(L.push(m2),await t(m2)){O=m2;break}}if(O)break;if(!O)try{let u2=await import("fs");if(!u2.statSync(I0,{throwIfNoEntry:!1})?.isDirectory())continue;let KJ=8,s9=[{path:I0,depth:0}];while(s9.length>0&&!O){let d2=s9.pop();if(d2.depth>=KJ)continue;let W$;try{W$=u2.readdirSync(d2.path,{withFileTypes:!0})}catch{continue}for(let l2 of W$){if(!l2.isDirectory())continue;if(l2.name==="node_modules"||l2.name.startsWith("."))continue;let H$=f.join(d2.path,l2.name);for(let qJ of c){let o9=f.join(H$,qJ);if(L.push(o9),await t(o9)){O=o9;break}}if(O)break;s9.push({path:H$,depth:d2.depth+1})}}}catch{}if(O)break}if(O)l9.set(j1,O)}if(!O||!await t(O))return pZ($,Y,L),iZ($);K.add(O);let w;if(g2.has(O))w=g2.get(O);else try{w=await Bun.file(O).text(),g2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return pZ($,Y,[O],c),iZ($)}let N=new Set(["__originalFilePath","__importedComponents",c2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Q))if(!m.startsWith("__")||N.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-j8s9akdq.js"));M=await m(J,Q,Y,G,K)}let T=u0(M),D=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",R0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!R0||["module","text/javascript","application/javascript"].includes(R0);if(!/\bserver\b/i.test(n)&&O0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await s("stx/slots",()=>import("./chunk-rf2cejt3.js")),A=k(I),E={};if(A.defaultSlot?.trim())E.default=A.defaultSlot;for(let[m,c]of A.namedSlots)E[m]=c.content;let C=Q.__stx_scope_seq??={n:0,key:Bun.hash(String(Q.__filename??Y)).toString(36).slice(0,6)},y=`stx_${_.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:E,__processedComponents:W,__sections:{},__stx_signals_gate:X1(w)||Zq(J)};aK(w,b);let P=w,h=H9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(p)],Z0=[],J0=g.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),e=null,i=null,q0=null,r=0,L0=null;if(cK(G),J0&&G$>0){let m=pK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){e=`${O}\x00${H1(w)}\x00${m}`;let c=c9.get(e);if(c){for(let G0 of c.dependencies)K.add(G0);if(M$(Q,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let n of c.preservedClientExpressions)G0.add(n);Q.__stx_preserved_client_expressions=[...G0]}return c.output}i=new Set(K),q0=N$(Q),r=C.n,L0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[])}}let e0=new Set;for(let m of g){let c=m[1]||"",G0=m[2]||"",n=c.includes("server");if(I1(c)&&G0.trim())G0=T1(G0);if(n&&G0){for(let O0 of S1(G0))e0.add(O0);try{await q(G0,b,O)}catch(O0){}}if(!n){let O0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b0=O0.includes("{{")&&O0.includes("}}"),J1=O0.includes("{!!")&&O0.includes("!!}");if(b0||J1)O0=G5(O0,b,O);let v0=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Z0.push(`<script${v0}>${O0}</script>`)}}let l=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),u=l?l[1]:"",o=l?l[2]:"",Q0="",B0=u&&/\bscoped\b/i.test(u);if(l)Q0=`<style${u}>${Jq(o,b,O)}</style>`;let K0=P;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(K0=K0.replace(m,(G0,n)=>{let R0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(R0)c.push(`<style${R0[1]}>${R0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)Q0=`${Q0}${c.join(`
3608
+ `)}`}if(J&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:c0}=await s("stx/slots",()=>import("./chunk-rf2cejt3.js")),{defaultSlot:p9,namedSlots:i9}=A,Q2=Z0.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),S=(m)=>Q2?T8(m,y):m,v=new Map([...i9].map(([m,c])=>[m,{...c,content:S(c.content)}]));K0=await c0(K0,S(p9),v,b);let d=Xq(Z0),X0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!e0.has(m));if(d.length>0||X0.length>0)b.__stx_client_signal_names=[...new Set([...X0,...d])];else delete b.__stx_client_signal_names;let U0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:Q2||Z0.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let w0=await t3(K0,b,O,U0,K),Z1=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let m of w0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(m[1].trim());if(Z1.size>0)Q.__stx_preserved_client_expressions=[...Z1];let U1=y,P0=w0;if(Q2){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${mZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${mZ(j)}"`:"",G0=` data-stx-scope="${U1}"${m}${c}`;P0=eK(w0,G0)??`<div${G0}>${w0}</div>`;let n=await Promise.all(Z0.map(async(R0)=>{let O0=R0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return R0;let[,b0,J1]=O0,{vendorStyleTags:v0,factoryBody:a}=await Gq(J1,O,G.buildMode==="compile"),h0=j?null:e9(Q,a),j1=h0?`window.__stxComponentFactories[${JSON.stringify(h0)}](${JSON.stringify(U1)});`:`(${a})(${JSON.stringify(U1)});`;if(j)return`${v0}<script type="stx/island" data-stx-island="${U1}" data-stx-scoped data-stx-owner="${U1}"${b0}>${j1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${U1}"${b0}>${j1}</script>`}));if(P0=P0+`
3609
3609
  `+n.join(`
3610
3610
  `),Q0)P0+=`
3611
3611
  `+Q0}else{if(Q0)P0+=`
3612
3612
  `+Q0;if(Z0.length>0){let m=b.__stx_event_bindings||[],c=v9(b),G0=await Promise.all(Z0.map(async(n)=>{let R0=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!R0)return n;return await x9(R0[1],{eventBindings:m,templateContent:P0,filePath:O,projectRoot:process.cwd(),serverData:c,instanceId:y})}));P0+=`
3613
3613
  `+G0.join(`
3614
- `),b.__stx_event_bindings=[]}}if(B0){let m=f9(P0,O);if(m.hasScoped)P0=m.html}if(e&&i){let m=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];c9.set(e,{output:P0,dependencies:[...K].filter((c)=>!i.has(c)),clientFactories:q0?D$(Y,q0):[],uidsConsumed:C.n-r,preservedClientExpressions:L0?m.filter((c)=>!L0.has(c)):[]})}return D.length>0?`${P0}
3614
+ `),b.__stx_event_bindings=[]}}if(B0){let m=f9(P0,O);if(m.hasScoped)P0=m.html}if(e&&i){let m=Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[];c9.set(e,{output:P0,dependencies:[...K].filter((c)=>!i.has(c)),clientFactories:q0?D$(Q,q0):[],uidsConsumed:C.n-r,preservedClientExpressions:L0?m.filter((c)=>!L0.has(c)):[]})}return D.length>0?`${P0}
3615
3615
  ${D.join(`
3616
- `)}`:P0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function t($){return Bun.file($).exists()}function z$($,Z){let J=f.resolve(Z),X=f.resolve($),Y=J.endsWith(f.sep)?J:J+f.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=f.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 $9($,Z,J,X){let Y=await Xq($,Z,J,X);if(Y===null)return null;let Q=z$(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=f.isAbsolute(z)?z:f.resolve(process.cwd(),z);if(z$(Y,K))return f.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function Xq($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let U=f.join(Q,$),j=z$(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=f.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(f.isAbsolute(J.layoutsDir)?J.layoutsDir:f.resolve(process.cwd(),J.layoutsDir));let K=f.resolve(Y),q=process.cwd();for(let U=0;U<10;U++){let j=f.join(K,"layouts"),B=!1;try{B=sZ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=f.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=f.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:f.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[f.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=f.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=f.join(J.partialsDir,"layouts");if(await t(U)){let j=f.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 W=J.partialsDir||f.join(process.cwd(),"views"),H=f.join(W,$);if(await t(H)){if(J.debug)console.log(`Found in views path: ${H}`);if(X)X.add(H);return H}if(!$.endsWith(".stx")){let U=`${H}.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=f.join(f.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 rZ($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3617
- `),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),W=Math.min(G.length,K+3);Q=G.slice(q,W).map((H,U)=>{let j=q+U+1;return`${j===X?"> ":" "}${j}: ${H}`}).join(`
3618
- `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return rZ($,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 _0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=rZ(X,Y,Q),K=J.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&X){let H=X.lastIndexOf(`
3619
- `,Math.max(0,Y-1));q=Y-(H+1)+1}let W="";if(G>0)W+=`
3616
+ `)}`:P0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{H.delete($)}}async function t($){return Bun.file($).exists()}function z$($,Z){let J=f.resolve(Z),X=f.resolve($),Q=J.endsWith(f.sep)?J:J+f.sep;if(X===J||X.startsWith(Q))return X;return null}async function Yq($,Z,J,X){let Q=Z.startsWith("layouts/")?Z.slice(8):Z,Y=f.join($,Q);for(let G of Y.endsWith(".stx")?[Y]:[Y,`${Y}.stx`])if(await t(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function J9($,Z,J,X){let Q=await Qq($,Z,J,X);if(Q===null)return null;let Y=z$(Q,process.cwd());if(Y)return Y;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=f.isAbsolute(z)?z:f.resolve(process.cwd(),z);if(z$(Q,K))return f.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function Qq($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=f.dirname(Z),Y=process.cwd();if($.startsWith("/")){let U=f.join(Y,$),j=z$(U,Y);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=f.join(Q,$);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(f.isAbsolute(J.layoutsDir)?J.layoutsDir:f.resolve(process.cwd(),J.layoutsDir));let K=f.resolve(Q),q=process.cwd();for(let U=0;U<10;U++){let j=f.join(K,"layouts"),B=!1;try{B=rZ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=f.dirname(K);if(V===K||V.length<q.length)break;K=V}for(let U of z){let j=await Yq(U,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let U=f.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:f.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[f.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=f.join(J.partialsDir||Q,"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=f.join(J.partialsDir,"layouts");if(await t(U)){let j=f.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||f.join(process.cwd(),"views"),W=f.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(Q.includes("temp")){let U=f.join(f.dirname(Q),"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 tZ($,Z,J){let X=0,Q="",Y="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3617
+ `),z=0;for(let K=0;K<G.length;K++)if(z+=G[K].length+1,z>=Z){X=K+1,Q=G[K].trim();let q=Math.max(0,K-2),H=Math.min(G.length,K+3);Y=G.slice(q,H).map((W,U)=>{let j=q+U+1;return`${j===X?"> ":" "}${j}: ${W}`}).join(`
3618
+ `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return tZ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:Y}}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 _0($,Z,J,X,Q,Y){let{lineNumber:G,context:z}=tZ(X,Q,Y),K=J.split("/").pop(),q=0;if(typeof Q==="number"&&Q>=0&&X){let W=X.lastIndexOf(`
3619
+ `,Math.max(0,Q-1));q=Q-(W+1)+1}let H="";if(G>0)H+=`
3620
3620
  ${J}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
3621
- `;if(W+=`
3621
+ `;if(H+=`
3622
3622
  ${$0.bold}${$0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${$0.reset}
3623
- `,W+=`${$0.bold}${$0.red}\u2502${$0.reset} ${$0.bold}${$0.bgRed} ERROR ${$0.reset} ${$0.red}${$} Error${$0.reset}${" ".repeat(Math.max(0,43-$.length))}${$0.bold}${$0.red}\u2502${$0.reset}
3624
- `,W+=`${$0.bold}${$0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${$0.reset}
3625
- `,W+=`
3626
- ${$0.cyan}${$0.bold}File:${$0.reset} ${$0.dim}${K}${$0.reset}`,G>0)W+=` ${$0.gray}(line ${G}${q>0?`, col ${q}`:""})${$0.reset}`;if(W+=`
3623
+ `,H+=`${$0.bold}${$0.red}\u2502${$0.reset} ${$0.bold}${$0.bgRed} ERROR ${$0.reset} ${$0.red}${$} Error${$0.reset}${" ".repeat(Math.max(0,43-$.length))}${$0.bold}${$0.red}\u2502${$0.reset}
3624
+ `,H+=`${$0.bold}${$0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${$0.reset}
3625
+ `,H+=`
3626
+ ${$0.cyan}${$0.bold}File:${$0.reset} ${$0.dim}${K}${$0.reset}`,G>0)H+=` ${$0.gray}(line ${G}${q>0?`, col ${q}`:""})${$0.reset}`;if(H+=`
3627
3627
  ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
3628
- `,z)W+=`
3628
+ `,z)H+=`
3629
3629
  ${$0.blue}${$0.bold}Context:${$0.reset}
3630
3630
  ${$0.dim}${z}${$0.reset}
3631
- `;return W}function l_(){x2.clear(),l9.clear(),c9.clear()}function c_(){return{size:x2.size,maxSize:500}}var Q$=y1(128);async function Yq($,Z,J){let X=H1($,Z,J),Y=Q$.get(X);if(Y){if(nZ(Y.deps))return Y;Q$.delete(X)}let Q=K$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=q$(Q.styles);G=$2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-tscr6bs8.js")),W=[],H=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),H=G===O}let{stripStxRuntimeImports:U}=await s("stx/signal-processing",()=>import("./chunk-8tjg4wbr.js"));G=U(G);let j=a0(G),B=iK(j),V=`function(__scopeId) {
3632
- ${s1("const",[...pZ,...B],j)}
3631
+ `;return H}function p_(){g2.clear(),l9.clear(),c9.clear()}function i_(){return{size:g2.size,maxSize:500}}var Q$=y1(128);async function Gq($,Z,J){let X=H1($,Z,J),Q=Q$.get(X);if(Q){if(oZ(Q.deps))return Q;Q$.delete(X)}let Y=K$($,{filePath:Z,projectRoot:process.cwd()}),G=Y.code,z=q$(Y.styles);G=$2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-5hhng72w.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-fvvdq3ev.js"));G=U(G);let j=a0(G),B=sK(j),V=`function(__scopeId) {
3632
+ ${s1("const",[...nZ,...B],j)}
3633
3633
  const __scope = window.stx._scopes = window.stx._scopes || {};
3634
3634
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
3635
3635
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -3657,18 +3657,18 @@ catch (e) {}
3657
3657
  finally {
3658
3658
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3659
3659
  }
3660
- }`,_={vendorStyleTags:z,factoryBody:V,deps:iZ([...W,...Q.styles.map((O)=>O.resolvedPath)])};if(!H&&Q.unresolved.length===0)Q$.set(X,_);return _}var Qq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Gq($){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 zq($,Z){let J=Z;while(!0){let X=P1.join(J,"node_modules",$,"package.json");if(f2.existsSync(X))return P1.dirname(X);let Y=P1.dirname(J);if(Y===J)return null;J=Y}}function Kq($,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 qq($,Z){let J=Gq($);if(!J||!J.subpath)return null;let X=zq(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(f2.readFileSync(P1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=Kq(Y.exports,Q);if(!G)return null;let z=P1.resolve(X,G);return f2.existsSync(z)?z:null}function K$($,Z){let J=Z.filePath?P1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(Qq,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:P1.resolve(J,q),!f2.existsSync(W))throw Error(`file not found: ${W}`)}else{let H=null;try{H=Bun.resolveSync(q,X)}catch{H=qq(q,X)}if(!H)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=H}}catch(H){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${H?.message||H}`),G.push(q),""}if(Y.has(W))return"";Y.add(W);try{let H=f2.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:H})}catch(H){console.warn(`[stx:vendor-css] could not read ${W}: ${H?.message||H}`),G.push(q)}return""}),styles:Q,unresolved:G}}function Wq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function q$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Wq(Z.source)}" data-stx-layer="vendor">
3660
+ }`,_={vendorStyleTags:z,factoryBody:V,deps:sZ([...H,...Y.styles.map((O)=>O.resolvedPath)])};if(!W&&Y.unresolved.length===0)Q$.set(X,_);return _}var zq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Kq($){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 qq($,Z){let J=Z;while(!0){let X=P1.join(J,"node_modules",$,"package.json");if(h2.existsSync(X))return P1.dirname(X);let Q=P1.dirname(J);if(Q===J)return null;J=Q}}function Wq($,Z){if(!$||typeof $!=="object")return null;let J=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return J(Q.import);if(typeof Q.default==="object")return J(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Q of Object.keys($)){let Y=Q.indexOf("*");if(Y===-1)continue;let G=Q.slice(0,Y),z=Q.slice(Y+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:Q,prefix:G,suffix:z}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),Y=J($[X.pattern]);if(Y)return Y.replace("*",Q)}return null}function Hq($,Z){let J=Kq($);if(!J||!J.subpath)return null;let X=qq(J.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(h2.readFileSync(P1.join(X,"package.json"),"utf8"))}catch{return null}let Y=`.${J.subpath}`,G=Wq(Q.exports,Y);if(!G)return null;let z=P1.resolve(X,G);return h2.existsSync(z)?z:null}function K$($,Z){let J=Z.filePath?P1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,Y=[],G=[];return{code:$.replace(zq,(K,q)=>{let H;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(H=q.startsWith("/")?q:P1.resolve(J,q),!h2.existsSync(H))throw Error(`file not found: ${H}`)}else{let W=null;try{W=Bun.resolveSync(q,X)}catch{W=Hq(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(Q.has(H))return"";Q.add(H);try{let W=h2.readFileSync(H,"utf8");Y.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:Y,unresolved:G}}function Uq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function q$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Uq(Z.source)}" data-stx-layer="vendor">
3661
3661
  @layer vendor {
3662
3662
  ${Z.contents}
3663
3663
  }
3664
3664
  </style>`}).join(`
3665
3665
  `)}
3666
- `}var Hq=v2;function $2($){let Z=H0($),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=b1.filter((z)=>{if(J.has(z)||X.has(z))return!1;return YJ(Z,z,!0)}),Q=JJ(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(`
3666
+ `}var jq=f2;function $2($){let Z=H0($),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 Q=b1.filter((z)=>{if(J.has(z)||X.has(z))return!1;return GJ(Z,z,!0)}),Y=YJ(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Q.length===0&&Y.length===0)return{code:$,imports:Q,models:Y};return{code:`${[Q.length>0?`import { ${Q.join(", ")} } from '@stacksjs/browser'`:"",Y.length>0?"import '@stacksjs/browser'":"",Y.length>0?`const { ${Y.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3667
3667
  `)}
3668
- ${$}`,imports:Y,models:Q}}var Uq=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 JJ($){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(!Uq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function jq($){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 XJ($){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 H=G[1],U=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of H.split(",")){let _=V.trim();if(!_||_.startsWith("type "))continue;let O=_.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!O)continue;let F=O[1],L=O[2]||F;if(Y.add(F),Y.add(L),U==="stx"||U==="@stacksjs/stx")Z.add(F);else J.add(F);if(L!==F)j.push(`${L} = ${F}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=jq(X);for(let H of Hq){if(Y.has(H)||z.has(H))continue;if(new RegExp(`\\b${H}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(H)}let K=H0(X),q=new Set;for(let H of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of H[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 H of b1){if(Y.has(H)||z.has(H)||q.has(H))continue;if(YJ(K,H))J.add(H)}let W=JJ(X);for(let H of W)if(!Y.has(H)&&!z.has(H))J.add(H);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function YJ($,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 QJ($,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
3668
+ ${$}`,imports:Q,models:Y}}var Bq=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 YJ($){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(!Bq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Vq($){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 Q=X.trim().split(/[:=]/).pop()?.trim();if(Q&&/^[A-Za-z_$][\w$]*$/.test(Q))Z.add(Q)}return Z}function QJ($){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 Q=new Set,Y=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Y.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 _=V.trim();if(!_||_.startsWith("type "))continue;let O=_.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!O)continue;let F=O[1],L=O[2]||F;if(Q.add(F),Q.add(L),U==="stx"||U==="@stacksjs/stx")Z.add(F);else J.add(F);if(L!==F)j.push(`${L} = ${F}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=Vq(X);for(let W of jq){if(Q.has(W)||z.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(W)}let K=H0(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 b1){if(Q.has(W)||z.has(W)||q.has(W))continue;if(GJ(K,W))J.add(W)}let H=YJ(X);for(let W of H)if(!Q.has(W)&&!z.has(W))J.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function GJ($,Z,J=!1){let X=new RegExp(`\\b${Z.replace(/[$]/g,"\\$")}\\b`,"g");for(let Q of $.matchAll(X)){let Y=Q.index??0,G=Y+Z.length,z=Y-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 zJ($,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
3669
3669
  ${J.join(`
3670
3670
  `)}
3671
- ${Bq($,Z)}`;return""}function GF($,Z=[]){let{browserImports:J}=XJ($),X=new Set(Z);return QJ([],J.filter((Y)=>!X.has(Y)))}function Bq($,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
3671
+ ${Lq($,Z)}`;return""}function KF($,Z=[]){let{browserImports:J}=QJ($),X=new Set(Z);return zJ([],J.filter((Q)=>!X.has(Q)))}function Lq($,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
3672
3672
  [${J.join(", ")}].forEach(function (e) {
3673
3673
  if (e[1] !== 'undefined') return;
3674
3674
  console.error(
@@ -3677,69 +3677,69 @@ ${Bq($,Z)}`;return""}function GF($,Z=[]){let{browserImports:J}=XJ($),X=new Set(Z
3677
3677
  + 'or it should be imported from a relative path so the bundler includes it.'
3678
3678
  );
3679
3679
  });
3680
- `}function v9($){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 aZ($,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 Vq($,Z){let J=H0($),{depths:X,balanced:Y}=ZJ(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)&&aZ(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&aZ(z[1],!1).has(Z))return!0;return!1}function Lq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Oq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,tZ=new Set;function _q($,Z){let J=Oq.test($),X=Z.length>32768;if(!J&&!X)return;if(tZ.has($))return;if(tZ.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 d3($,Z){if(!Z)return"";let J=H0($),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&&!Lq(J,Q))continue;if(Vq($,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;_q(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)
3681
- ${Y.join(`
3680
+ `}function v9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Q in Z){let Y=Z[Q];if(typeof Y==="function")continue;X[Q]=Y}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Q=$[X];if(typeof Q==="function")continue;J[X]=Q}return J}function eZ($,Z){let J=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let Y=Q.lastIndexOf(":");if(Y!==-1)Q=Q.slice(Y+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))J.add(Q)}return J}function Oq($,Z){let J=H0($),{depths:X,balanced:Q}=XJ(J),Y=(z)=>!Q||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(Y(K))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Y(z.index??0)&&eZ(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Y(z.index??0)&&eZ(z[1],!1).has(Z))return!0;return!1}function _q($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Fq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,$J=new Set;function wq($,Z){let J=Fq.test($),X=Z.length>32768;if(!J&&!X)return;if($J.has($))return;if($J.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 d3($,Z){if(!Z)return"";let J=H0($),X=Z.__stxDeclaredPayload===!0,Q=[];for(let[Y,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Y))continue;if(Y.startsWith("__")||Y.startsWith("$"))continue;if(!X&&!_q(J,Y))continue;if(Oq($,Y)){if(X)console.warn(`[stx] defineClientPayload declares "${Y}", but this client block also declares "${Y}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Y}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;wq(Y,z),Q.push(` var ${Y} = ${z.replace(/</g,"\\u003c")};`)}if(Q.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3681
+ ${Q.join(`
3682
3682
  `)}
3683
- `}var Fq={left:0,middle:1,right:2};function wq($){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=Fq[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Rq($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=a9($.handler),G=wq(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(r9(X,Y))z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),H=`var $emit = function(name, detail) {
3683
+ `}var Rq={left:0,middle:1,right:2};function Nq($){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=Rq[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Dq($,Z){let{elementId:J,event:X,modifiers:Q}=$,Y=a9($.handler),G=Nq(Q),z=[];if(Q.once)z.push("once: true");if(Q.capture)z.push("capture: true");if(r9(X,Q))z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let H=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),W=`var $emit = function(name, detail) {
3684
3684
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3685
- };`;function U(j){if(/\$emit\s*\(/.test(j))return`${H}
3685
+ };`;function U(j){if(/\$emit\s*\(/.test(j))return`${W}
3686
3686
  ${j}`;return`var scope = $el.closest('[data-stx-scope]');
3687
3687
  if (scope && scope.__stx_execute) {
3688
- scope.__stx_execute('${W}', $event, $el);
3688
+ scope.__stx_execute('${H}', $event, $el);
3689
3689
  }
3690
3690
  else {
3691
3691
  ${j}
3692
- }`}if(Y.debounce!==null)return` ;(function() {
3692
+ }`}if(Q.debounce!==null)return` ;(function() {
3693
3693
  // eslint-disable-next-line pickier/no-unused-vars
3694
3694
  var $el = document.getElementById('${J}')
3695
3695
  if (!$el) return
3696
3696
  var __timer
3697
3697
  $el.addEventListener('${X}', function($event) {
3698
3698
  ${G?G+"; ":""}clearTimeout(__timer)
3699
- __timer = setTimeout(function() { ${U(Q)} }, ${Y.debounce})
3699
+ __timer = setTimeout(function() { ${U(Y)} }, ${Q.debounce})
3700
3700
  }${K})
3701
- })()`;if(Y.throttle!==null)return` ;(function() {
3701
+ })()`;if(Q.throttle!==null)return` ;(function() {
3702
3702
  // eslint-disable-next-line pickier/no-unused-vars
3703
3703
  var $el = document.getElementById('${J}')
3704
3704
  if (!$el) return
3705
3705
  var __last = 0
3706
3706
  $el.addEventListener('${X}', function($event) {
3707
3707
  ${G?G+"; ":""}var __now = Date.now()
3708
- if (__now - __last >= ${Y.throttle}) {
3708
+ if (__now - __last >= ${Q.throttle}) {
3709
3709
  __last = __now
3710
- ${U(Q)}
3710
+ ${U(Y)}
3711
3711
  }
3712
3712
  }${K})
3713
- })()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${J}')
3713
+ })()`;if(/\$emit\s*\(/.test(Y))return` var $el = document.getElementById('${J}')
3714
3714
  if ($el) $el.addEventListener('${X}', function($event) {
3715
- ${q}${H}
3716
- ${Q}
3715
+ ${q}${W}
3716
+ ${Y}
3717
3717
  }${K})`;return` var $el = document.getElementById('${J}')
3718
3718
  if ($el) $el.addEventListener('${X}', function($event) {
3719
3719
  ${q}var scope = $el.closest('[data-stx-scope]');
3720
3720
  if (scope && scope.__stx_execute) {
3721
- scope.__stx_execute('${W}', $event, $el);
3721
+ scope.__stx_execute('${H}', $event, $el);
3722
3722
  }
3723
3723
  else {
3724
- ${Q}
3724
+ ${Y}
3725
3725
  }
3726
- }${K})`}function Nq($){if($.length===0)return"";return`
3726
+ }${K})`}function Mq($){if($.length===0)return"";return`
3727
3727
  // STX: auto-generated event bindings
3728
- ${$.map((J,X)=>Rq(J,X)).join(`
3729
- `)}`}function eZ($){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]!==`
3730
- `)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 W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[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+=W[0].length;continue}let H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var Dq=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 Mq($){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(!Dq.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 W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);return Z}async function x9($,Z={}){let J=$,X="",Y=!1,Q=[],G=K$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=q$(G.styles),K=$2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-tscr6bs8.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=XJ(J);J=L.code,X=QJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${d3(J,Z.serverData)}${X}`,J=a0(J),!Y&&I1(Z.attrs||""))J=T1(J);let H=Nq(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
+ ${$.map((J,X)=>Dq(J,X)).join(`
3729
+ `)}`}function ZJ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,Y=X.length,G=0;while(G<Y){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Y){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<Y){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Y&&X[G]!==`
3730
+ `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Y-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Q++,G++;continue}if(z==="}"){Q--,G++;continue}if(Q===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 Aq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Iq($){let Z=new Set,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(!Aq.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,Y;while((Y=Q.exec($))!==null)X(Y[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Y=G.exec($))!==null)X(Y[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Y=z.exec($))!==null)X(Y[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Y=K.exec($))!==null)X(Y[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Y=q.exec($))!==null)X(Y[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((Y=H.exec($))!==null)X(Y[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Y=W.exec($))!==null)X(Y[1]);return Z}async function x9($,Z={}){let J=$,X="",Q=!1,Y=[],G=K$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=q$(G.styles),K=$2(J);J=K.code,Y=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:H}=await s("stx/client-script-bundler",()=>import("./chunk-5hhng72w.js"));if(q(J))J=await H(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=QJ(J);J=L.code,X=zJ(L.stxImports,L.browserImports.filter((w)=>!Y.includes(w)))}if(X=`${d3(J,Z.serverData)}${X}`,J=a0(J),!Q&&I1(Z.attrs||""))J=T1(J);let W=Mq(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}>
3731
3731
  ${e1(`${X}${J}
3732
- ${H}`)}
3733
- </script>`}let V=$J($),_=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let w=L.length>0?`
3732
+ ${W}`)}
3733
+ </script>`}let V=JJ($),_=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let w=L.length>0?`
3734
3734
  return { ${L.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3735
3735
  window.stx.mount(function() {
3736
3736
  'use strict';
3737
3737
  ${e1(`${X}${J}
3738
- ${H}${w}`)}
3739
- })</script>`}if(!O&&!_){if(V)return F(eZ($));if(Z.templateContent){let L=eZ($);if(L.length>0){let w=Mq(Z.templateContent);if(L.some((R)=>w.has(R)))return F(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3738
+ ${W}${w}`)}
3739
+ })</script>`}if(!O&&!_){if(V)return F(ZJ($));if(Z.templateContent){let L=ZJ($);if(L.length>0){let w=Iq(Z.templateContent);if(L.some((R)=>w.has(R)))return F(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3740
3740
  ;(function() {
3741
3741
  'use strict';
3742
3742
  ${e1(`${X}${J}
3743
- ${H}`)}
3743
+ ${W}`)}
3744
3744
  })()</script>`}
3745
- export{nJ as ul,sJ as vl,oJ as wl,o0 as xl,q5 as yl,W5 as zl,H5 as Al,U5 as Bl,Z7 as Cl,$7 as Dl,XX as El,QX as Fl,zX as Gl,UW as Hl,jW as Il,BW as Jl,VW as Kl,LW as Ll,pJ as Ml,r$ as Nl,a$ as Ol,t$ as Pl,e$ as Ql,WW as Rl,H7 as Sl,j2 as Tl,KJ as Ul,r9 as Vl,a9 as Wl,t9 as Xl,jJ as Yl,_$ as Zl,Iq as _l,b1 as $l,Z2 as am,VL as bm,K$ as cm,q$ as dm,Hq as em,$2 as fm,XJ as gm,YJ as hm,QJ as im,GF as jm,v9 as km,d3 as lm,x9 as mm,bq as nm,p2 as om,yq as pm,Cq as qm,Sq as rm,Pq as sm,s2 as tm,AJ as um,sq as vm,IJ as wm,oq as xm,TJ as ym,i2 as zm,Y5 as Am,Q5 as Bm,X1 as Cm,G5 as Dm,EJ as Em,rq as Fm,V1 as Gm,bJ as Hm,aq as Im,C0 as Jm,tq as Km,JW as Lm,gJ as Mm,hJ as Nm,n$ as Om,s$ as Pm,o$ as Qm,KW as Rm,J7 as Sm,B5 as Tm,H2 as Um,o2 as Vm,wW as Wm,j5 as Xm,WX as Ym,HX as Zm,UX as _m,RW as $m,Y7 as an,Q7 as bn,z1 as cn,K1 as dn,_1 as en,s7 as fn,_2 as gn,z9 as hn,P5 as in,FY as jn,RY as kn,a7 as ln,DY as mn,MY as nn,e7 as on,F1 as pn,BU as qn,$4 as rn,d5 as sn,EY as tn,m5 as un,bY as vn,yY as wn,VU as xn,LU as yn,Z4 as zn,J4 as An,X4 as Bn,CY as Cn,SY as Dn,OU as En,_U as Fn,PY as Gn,FU as Hn,wU as In,K4 as Jn,U4 as Kn,p5 as Ln,CU as Mn,R2 as Nn,i5 as On,n5 as Pn,SU as Qn,aY as Rn,PU as Sn,tY as Tn,V4 as Un,vU as Vn,eY as Wn,xU as Xn,fU as Yn,q9 as Zn,$3 as _n,Yj as $n,Qj as ao,Gj as bo,zj as co,RQ as do,i4 as eo,T2 as fo,yQ as go,O3 as ho,r6 as io,gV as jo,Z8 as ko,iG as lo,UL as mo,aG as no,B8 as oo,l3 as po,V8 as qo,O8 as ro,c3 as so,jz as to,Bz as uo,_8 as vo,q8 as wo,Vz as xo,Oz as yo,C3 as zo,h6 as Ao,u6 as Bo,SZ as Co,TK as Do,kK as Eo,EK as Fo,bK as Go,yK as Ho,CK as Io,PZ as Jo,xK as Ko,uK as Lo,mK as Mo,j6 as No,M3 as Oo,V6 as Po,gB as Qo,hB as Ro,Y6 as So,uB as To,w3 as Uo,R3 as Vo,N3 as Wo,F6 as Xo,w6 as Yo,R6 as Zo,qV as _o,WV as $o,D6 as ap,HV as bp,KG as cp,A6 as dp,E6 as ep,E3 as fp,MG as gp,b3 as hp,P6 as ip,v6 as jp,SG as kp,RV as lp,NV as mp,x6 as np,DV as op,MV as pp,y3 as qp,l6 as rp,E9 as sp,b9 as tp,t1 as up,xG as vp,p6 as wp,i6 as xp,EV as yp,v3 as zp,fG as Ap,gG as Bp,x3 as Cp,f3 as Dp,n6 as Ep,s6 as Fp,p3 as Gp,i3 as Hp,o3 as Ip,t3 as Jp,YZ as Kp,J_ as Lp,X_ as Mp,oz as Np,S1 as Op,ZK as Pp,Y_ as Qp,Q_ as Rp,HZ as Sp,G_ as Tp,z_ as Up,VK as Vp,wK as Wp,RK as Xp,NK as Yp,DK as Zp,cK as _p,I1 as $p,Y$ as aq,T1 as bq,aK as cq,F9 as dq,tK as eq,eK as fq,Zq as gq,A1 as hq,t as iq,$9 as jq,rZ as kq,_0 as lq,l_ as mq,c_ as nq,U7 as oq,j7 as pq,L1 as qq,B7 as rq,x1 as sq,V7 as tq,B2 as uq,PW as vq,IX as wq,L5 as xq,vW as yq,O5 as zq,xW as Aq,fW as Bq,Q1 as Cq,gW as Dq,hW as Eq,uW as Fq,mW as Gq,dW as Hq,lW as Iq,TX as Jq,F5 as Kq,L7 as Lq,pW as Mq,iW as Nq,nW as Oq,sW as Pq,oW as Qq,_7 as Rq,rW as Sq,F7 as Tq,aW as Uq,tW as Vq,V2 as Wq,SX as Xq,JH as Yq,vX as Zq,A7 as _q,e2 as $q,KH as ar,C7 as br,I5 as cr,_H as dr,k5 as er,aX as fr,ZY as gr,FH as hr,wH as ir,RH as jr,NH as kr,DH as lr,MH as mr,JY as nr,XY as or,P7 as pr,E5 as qr,zY as rr,y5 as sr,i7 as tr,mH as ur,dH as vr,S5 as wr,jY as xr,n7 as yr};
3745
+ export{oJ as ul,rJ as vl,aJ as wl,o0 as xl,q5 as yl,W5 as zl,H5 as Al,U5 as Bl,Z7 as Cl,$7 as Dl,QX as El,zX as Fl,qX as Gl,BW as Hl,VW as Il,LW as Jl,OW as Kl,_W as Ll,nJ as Ml,r$ as Nl,a$ as Ol,t$ as Pl,e$ as Ql,UW as Rl,H7 as Sl,j2 as Tl,WJ as Ul,r9 as Vl,a9 as Wl,t9 as Xl,VJ as Yl,_$ as Zl,kq as _l,b1 as $l,Z2 as am,OL as bm,K$ as cm,q$ as dm,jq as em,$2 as fm,QJ as gm,GJ as hm,zJ as im,KF as jm,v9 as km,d3 as lm,x9 as mm,Cq as nm,n2 as om,Sq as pm,Pq as qm,vq as rm,xq as sm,r2 as tm,TJ as um,rq as vm,kJ as wm,aq as xm,EJ as ym,s2 as zm,Y5 as Am,Q5 as Bm,X1 as Cm,G5 as Dm,yJ as Em,tq as Fm,V1 as Gm,CJ as Hm,eq as Im,C0 as Jm,$W as Km,YW as Lm,uJ as Mm,mJ as Nm,n$ as Om,s$ as Pm,o$ as Qm,WW as Rm,J7 as Sm,B5 as Tm,H2 as Um,a2 as Vm,NW as Wm,j5 as Xm,UX as Ym,jX as Zm,BX as _m,DW as $m,Y7 as an,Q7 as bn,z1 as cn,K1 as dn,_1 as en,s7 as fn,_2 as gn,q9 as hn,P5 as in,RY as jn,DY as kn,a7 as ln,AY as mn,IY as nn,e7 as on,F1 as pn,LU as qn,$4 as rn,d5 as sn,yY as tn,m5 as un,CY as vn,SY as wn,OU as xn,_U as yn,Z4 as zn,J4 as An,X4 as Bn,PY as Cn,vY as Dn,FU as En,wU as Fn,xY as Gn,RU as Hn,NU as In,K4 as Jn,U4 as Kn,p5 as Ln,PU as Mn,R2 as Nn,i5 as On,n5 as Pn,vU as Qn,eY as Rn,xU as Sn,$Q as Tn,V4 as Un,fU as Vn,ZQ as Wn,gU as Xn,hU as Yn,H9 as Zn,$3 as _n,Gj as $n,zj as ao,Kj as bo,qj as co,DQ as do,i4 as eo,T2 as fo,SQ as go,O3 as ho,r6 as io,uV as jo,Z8 as ko,sG as lo,BL as mo,eG as no,B8 as oo,l3 as po,V8 as qo,O8 as ro,c3 as so,Vz as to,Lz as uo,_8 as vo,q8 as wo,Oz as xo,Fz as yo,C3 as zo,h6 as Ao,u6 as Bo,vZ as Co,EK as Do,bK as Eo,yK as Fo,CK as Go,SK as Ho,PK as Io,xZ as Jo,gK as Ko,dK as Lo,lK as Mo,j6 as No,M3 as Oo,V6 as Po,uB as Qo,mB as Ro,Y6 as So,dB as To,w3 as Uo,R3 as Vo,N3 as Wo,F6 as Xo,w6 as Yo,R6 as Zo,HV as _o,UV as $o,D6 as ap,jV as bp,WG as cp,A6 as dp,E6 as ep,E3 as fp,IG as gp,b3 as hp,P6 as ip,v6 as jp,vG as kp,DV as lp,MV as mp,x6 as np,AV as op,IV as pp,y3 as qp,l6 as rp,E9 as sp,b9 as tp,t1 as up,gG as vp,p6 as wp,i6 as xp,yV as yp,v3 as zp,hG as Ap,uG as Bp,x3 as Cp,f3 as Dp,n6 as Ep,s6 as Fp,p3 as Gp,i3 as Hp,o3 as Ip,t3 as Jp,GZ as Kp,Y_ as Lp,Q_ as Mp,az as Np,S1 as Op,XK as Pp,G_ as Qp,z_ as Rp,jZ as Sp,K_ as Tp,q_ as Up,OK as Vp,NK as Wp,DK as Xp,MK as Yp,AK as Zp,iK as _p,I1 as $p,Y$ as aq,T1 as bq,eK as cq,R9 as dq,$q as eq,Zq as fq,Xq as gq,A1 as hq,t as iq,J9 as jq,tZ as kq,_0 as lq,p_ as mq,i_ as nq,U7 as oq,j7 as pq,L1 as qq,B7 as rq,x1 as sq,V7 as tq,B2 as uq,xW as vq,kX as wq,L5 as xq,fW as yq,O5 as zq,gW as Aq,hW as Bq,Q1 as Cq,uW as Dq,mW as Eq,dW as Fq,lW as Gq,cW as Hq,pW as Iq,EX as Jq,F5 as Kq,L7 as Lq,nW as Mq,sW as Nq,oW as Oq,rW as Pq,aW as Qq,_7 as Rq,tW as Sq,F7 as Tq,eW as Uq,$H as Vq,V2 as Wq,vX as Xq,YH as Yq,fX as Zq,A7 as _q,Z9 as $q,WH as ar,C7 as br,I5 as cr,wH as dr,k5 as er,eX as fr,XY as gr,RH as hr,NH as ir,DH as jr,MH as kr,AH as lr,IH as mr,YY as nr,QY as or,P7 as pr,E5 as qr,qY as rr,y5 as sr,i7 as tr,lH as ur,cH as vr,S5 as wr,VY as xr,n7 as yr};