@stacksjs/stx 0.2.363 → 0.2.365

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 (62) hide show
  1. package/dist/{chunk-725npc6m.js → chunk-0t0b5yex.js} +1 -1
  2. package/dist/{chunk-6557pfz9.js → chunk-0thch80p.js} +1 -1
  3. package/dist/{chunk-9rx9bbqh.js → chunk-11v2ysbe.js} +1 -1
  4. package/dist/{chunk-4my2kn5x.js → chunk-1nv116m3.js} +1 -1
  5. package/dist/{chunk-9y0btmfc.js → chunk-1q2b0r3v.js} +1 -1
  6. package/dist/{chunk-00hwz03z.js → chunk-2aqq5j7c.js} +1 -1
  7. package/dist/{chunk-fxt2hxh0.js → chunk-346jyc33.js} +1 -1
  8. package/dist/{chunk-25yvh46m.js → chunk-4dzsp35z.js} +1 -1
  9. package/dist/{chunk-5mjz2qgs.js → chunk-55k6352k.js} +1 -1
  10. package/dist/{chunk-5ppdkjhy.js → chunk-5qs1t2cd.js} +1 -1
  11. package/dist/{chunk-e45zxsgj.js → chunk-5t826ypq.js} +1 -1
  12. package/dist/{chunk-asshx9sb.js → chunk-6njr31wk.js} +1 -1
  13. package/dist/{chunk-kzg9gjmy.js → chunk-6tk817fg.js} +1 -1
  14. package/dist/{chunk-egnck8vx.js → chunk-77g77ygz.js} +1 -1
  15. package/dist/{chunk-t2yqh8nb.js → chunk-7ptewn2w.js} +2 -2
  16. package/dist/{chunk-3fd7w2va.js → chunk-7yyfbhna.js} +1 -1
  17. package/dist/{chunk-14fy0xrz.js → chunk-8zdq8kk5.js} +1 -1
  18. package/dist/{chunk-51tct8h7.js → chunk-a47e67th.js} +1 -1
  19. package/dist/{chunk-hs1azpgz.js → chunk-atf4tj9y.js} +1 -1
  20. package/dist/{chunk-5fqs93qg.js → chunk-bh1m0x85.js} +1 -1
  21. package/dist/{chunk-khaasesy.js → chunk-bszp4vx1.js} +1 -1
  22. package/dist/{chunk-gv6a9fsn.js → chunk-bxnx8sga.js} +1 -1
  23. package/dist/{chunk-pwctc0m1.js → chunk-czzy14fj.js} +80 -39
  24. package/dist/{chunk-sxnb6ws9.js → chunk-d5r4zwyd.js} +8 -8
  25. package/dist/{chunk-cbh9bfk7.js → chunk-dk40tcv1.js} +1 -1
  26. package/dist/{chunk-phq051sh.js → chunk-eczq4cxz.js} +1 -1
  27. package/dist/{chunk-yp1cbwvf.js → chunk-g63sh9bx.js} +1 -1
  28. package/dist/{chunk-3n0hpd5m.js → chunk-hyrm54da.js} +1 -1
  29. package/dist/{chunk-cjz5nzak.js → chunk-jerrq5k1.js} +1 -1
  30. package/dist/{chunk-3e0ba18k.js → chunk-k10f0c00.js} +1 -1
  31. package/dist/{chunk-jwna46yq.js → chunk-k3ktx8w2.js} +1 -1
  32. package/dist/{chunk-wk7wn1nw.js → chunk-kmd694ky.js} +2 -2
  33. package/dist/{chunk-mwj6w2r7.js → chunk-mks2cgty.js} +1 -1
  34. package/dist/{chunk-yvv9qjcd.js → chunk-n5791wn3.js} +1 -1
  35. package/dist/{chunk-y6ysrzx8.js → chunk-p33qyhtc.js} +1 -1
  36. package/dist/{chunk-ttfb1v63.js → chunk-p8nasx5y.js} +1 -1
  37. package/dist/{chunk-q92wr6a0.js → chunk-pbt7f5h9.js} +1 -1
  38. package/dist/{chunk-bcd9byk3.js → chunk-q28ekhhb.js} +2 -2
  39. package/dist/{chunk-pw8q3ety.js → chunk-r5dta1qf.js} +16 -16
  40. package/dist/{chunk-tcsgynpc.js → chunk-r8hr3jhh.js} +1 -1
  41. package/dist/{chunk-jtzfd61j.js → chunk-ry56srm9.js} +1 -1
  42. package/dist/{chunk-n3xxhvng.js → chunk-se8fh272.js} +1 -1
  43. package/dist/{chunk-2bsaq9kq.js → chunk-syy0njsk.js} +1 -1
  44. package/dist/{chunk-k1trppjz.js → chunk-tfnq0cj6.js} +1 -1
  45. package/dist/{chunk-a127v0w5.js → chunk-ttw7qrz0.js} +1 -1
  46. package/dist/{chunk-sf45fhg4.js → chunk-v8ccphfs.js} +1 -1
  47. package/dist/{chunk-4n3vnzs0.js → chunk-wkeymrkg.js} +1 -1
  48. package/dist/{chunk-xy3gx0x7.js → chunk-xr8ergcp.js} +1 -1
  49. package/dist/chunk-y32dbdta.js +3 -0
  50. package/dist/{chunk-ec4072zn.js → chunk-y3ns6824.js} +1 -1
  51. package/dist/{chunk-yg0qm73a.js → chunk-ys4hpkrp.js} +1 -1
  52. package/dist/{chunk-1e0jj83h.js → chunk-z274qgsn.js} +1 -1
  53. package/dist/{chunk-pkandp4e.js → chunk-zjqw2fde.js} +1 -1
  54. package/dist/cli.js +8 -8
  55. package/dist/craft-entry.js +1 -1
  56. package/dist/craft.js +1 -1
  57. package/dist/pwa.js +1 -1
  58. package/dist/signals-api.js +16 -2
  59. package/dist/signals.js +79 -38
  60. package/dist/ssg.js +2 -2
  61. package/package.json +5 -5
  62. package/dist/chunk-0t1yyn1d.js +0 -3
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Yr as n8,as as s8,ks as l4,ls as c4}from"./chunk-jc6wrxrh.js";import{qs as z0,rs as K2}from"./chunk-v90kxg77.js";import{ts as s4,us as o4,vs as W9,ws as H9}from"./chunk-4arms0am.js";import{Cs as G9}from"./chunk-135mme4g.js";import{$s as t8,Hs as r1,Is as R1,Js as a8,Ks as y1,Ms as U1,Ns as JJ,Os as XJ,Ps as H2,Qs as Z9,Rs as E9,Ss as x2,Ts as y8,Us as F8,Vs as V1,Ws as u0,Xs as K5,at as l9,nt as e8}from"./chunk-sf45fhg4.js";import{ot as p4,qt as i4,rt as n4,tt as _2}from"./chunk-w1asc0zd.js";import{At as y7,Bt as C7,vt as T7,wt as k7,xt as E7}from"./chunk-kd95t585.js";import{Gt as c9}from"./chunk-asshx9sb.js";import{It as fZ,Jt as gZ,Kt as hZ,Lt as uZ,Mt as mZ,Ot as r8}from"./chunk-xk402w4a.js";import{Pt as JZ,Qt as XZ,Rt as YZ,St as QZ,Tt as r4,Ut as a4}from"./chunk-dnard9gp.js";import{$t as u5,au as N0,cu as m5,du as j7,fu as B7,mu as $Z,qu as dZ,su as lZ}from"./chunk-vgx5077x.js";import{Iu as R0,Ku as y2,Lu as m3,Mu as C2,Tu as f2,Wu as c8,Yu as D0,av as g2,bv as p8,dv as s0,ev as i8,lv as d3,mv as F6,ov as X0,pv as B0,qv as d0,rv as k9,sv as z2,tv as U0,uv as b9}from"./chunk-met6wtbk.js";import{vv as e0}from"./chunk-ta6z7k4p.js";import{yv as ZZ}from"./chunk-zxptxz2b.js";import{Av as Q2,Bv as ZJ,Cv as o1,Gv as qJ,Hv as R3,Iv as O8,Kv as a7,Nv as Q6,zv as l3}from"./chunk-7racewc5.js";import{Cw as o8,Ew as hz,Fw as w5,Iw as V2,bw as l$,ew as Z8,lw as b$}from"./chunk-e03m4har.js";import{Nw as t4}from"./chunk-vsqx756d.js";import{Sw as x}from"./chunk-m8kem5ca.js";import S1 from"path";import l2 from"fs";var LJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Z5($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return LJ.has($.toLowerCase())}var F3=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),_3={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},OJ=new Set(["ctrl","alt","shift","meta"]),D3={left:0,middle:1,right:2};function w3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(X==="nonpassive")Z.nonpassive=!0;else if(OJ.has(X))Z.systemKeys.push(X);else if(X in D3)Z.mouse=X;else if(X in _3||/^[a-z]$/.test(X))Z.keys.push(_3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function N3($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,K=Y.index,q=K+Q.length,H=`__stx_evt_${J++}`,W=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,F]=j,O=V.split("."),_=O[0];if(!F3.has(_))continue;W.push({attribute:`@${V}`,event:_,handler:F,modifiers:w3(O.slice(1)),elementId:H})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,O=V.split("."),_=O[0];if(!F3.has(_))continue;W.push({attribute:`@${V}`,event:_,handler:F,modifiers:w3(O.slice(1)),elementId:H})}if(W.length>0)Z.push({originalTag:Q,elementId:H,events:W,startIndex:K,endIndex:q})}return Z}function FJ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=D3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function _J($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function J5($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function wJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=FJ($),Y=_J(J5($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z5($.event,Z))Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{Yr as n8,as as s8,ks as l4,ls as c4}from"./chunk-jc6wrxrh.js";import{qs as z0,rs as K2}from"./chunk-v90kxg77.js";import{ts as s4,us as o4,vs as W9,ws as H9}from"./chunk-4arms0am.js";import{Cs as G9}from"./chunk-135mme4g.js";import{$s as t8,Hs as r1,Is as R1,Js as a8,Ks as y1,Ms as U1,Ns as JJ,Os as XJ,Ps as H2,Qs as Z9,Rs as E9,Ss as x2,Ts as y8,Us as F8,Vs as V1,Ws as u0,Xs as K5,at as l9,nt as e8}from"./chunk-v8ccphfs.js";import{ot as p4,qt as i4,rt as n4,tt as _2}from"./chunk-w1asc0zd.js";import{At as y7,Bt as C7,vt as T7,wt as k7,xt as E7}from"./chunk-kd95t585.js";import{Gt as c9}from"./chunk-6njr31wk.js";import{It as fZ,Jt as gZ,Kt as hZ,Lt as uZ,Mt as mZ,Ot as r8}from"./chunk-xk402w4a.js";import{Pt as JZ,Qt as XZ,Rt as YZ,St as QZ,Tt as r4,Ut as a4}from"./chunk-dnard9gp.js";import{$t as u5,au as N0,cu as m5,du as j7,fu as B7,mu as $Z,qu as dZ,su as lZ}from"./chunk-vgx5077x.js";import{Iu as R0,Ku as y2,Lu as m3,Mu as C2,Tu as f2,Wu as c8,Yu as D0,av as g2,bv as p8,dv as s0,ev as i8,lv as d3,mv as F6,ov as X0,pv as B0,qv as d0,rv as k9,sv as z2,tv as U0,uv as b9}from"./chunk-met6wtbk.js";import{vv as e0}from"./chunk-ta6z7k4p.js";import{yv as ZZ}from"./chunk-zxptxz2b.js";import{Av as Q2,Bv as ZJ,Cv as o1,Gv as qJ,Hv as R3,Iv as O8,Kv as a7,Nv as Q6,zv as l3}from"./chunk-7racewc5.js";import{Cw as o8,Ew as hz,Fw as w5,Iw as V2,bw as l$,ew as Z8,lw as b$}from"./chunk-e03m4har.js";import{Nw as t4}from"./chunk-vsqx756d.js";import{Sw as x}from"./chunk-m8kem5ca.js";import S1 from"path";import l2 from"fs";var LJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Z5($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return LJ.has($.toLowerCase())}var F3=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),_3={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},OJ=new Set(["ctrl","alt","shift","meta"]),D3={left:0,middle:1,right:2};function w3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(X==="nonpassive")Z.nonpassive=!0;else if(OJ.has(X))Z.systemKeys.push(X);else if(X in D3)Z.mouse=X;else if(X in _3||/^[a-z]$/.test(X))Z.keys.push(_3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function N3($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,K=Y.index,q=K+Q.length,H=`__stx_evt_${J++}`,W=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,F]=j,O=V.split("."),_=O[0];if(!F3.has(_))continue;W.push({attribute:`@${V}`,event:_,handler:F,modifiers:w3(O.slice(1)),elementId:H})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,O=V.split("."),_=O[0];if(!F3.has(_))continue;W.push({attribute:`@${V}`,event:_,handler:F,modifiers:w3(O.slice(1)),elementId:H})}if(W.length>0)Z.push({originalTag:Q,elementId:H,events:W,startIndex:K,endIndex:q})}return Z}function FJ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=D3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function _J($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function J5($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function wJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=FJ($),Y=_J(J5($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z5($.event,Z))Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${J}');
5
5
  if (!$el) return;
@@ -3167,7 +3167,7 @@ ${H}
3167
3167
  customElements.define('${Z}', ${G});
3168
3168
  `}async function m4($,Z,J,X){if(Z.length<1)return D0("WebComponent","@webcomponent directive requires at least the tag name parameter",R0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=x0.isAbsolute(G)?[x0.join(G,`${Y}.stx`),x0.join(x0.dirname(X),`${Y}.stx`)]:[x0.join(x0.dirname(X),G,`${Y}.stx`),x0.join(process.cwd(),G,`${Y}.stx`),x0.join(x0.dirname(X),`${Y}.stx`)],K=null;for(let W of z)if(await t(W)){K=await Bun.file(W).text();break}if(!K)return D0("WebComponent",`Component file not found: ${Y}.stx`,R0.FILE_NOT_FOUND);let q=WY(K,Y);return`<script type="module">
3169
3169
  ${HY(q)}
3170
- </script>`}var P5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:p4,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:w4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:m4,hasEndTag:!1,description:"Include a web component in the template"},l4,c4,r4,a4,B5,L5,O5,V5,L4,Q4,C4,y5,...t4],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function jY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(U9.existsSync(Q)&&U9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(U9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var d4=new Set,j9=["partialsDir","componentsDir","layoutsDir"],v5=new WeakMap;function BY($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function VY($,Z){let J=!$.root,X=jY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!d4.has(Y))d4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!v5.has($)){let Y={};for(let Q of j9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}v5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of j9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||BY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of j9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function LY($,Z){let J=v5.get($);for(let X of j9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(U9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function OY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function FY($){if(i4($.stateDir),$.stateDir=n4(),$.cachePath=_2($.cachePath),$.build)$.build.cacheDir=_2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=_2($.media.cache.directory);if($.story)$.story.outDir=_2($.story.outDir)}var G1=null,F1=new Map,q9=new Map,w2=null;async function x5($){let Z=$?S0.resolve($):process.cwd(),J=q9.get(Z);if(J&&J.signature!==W9(J.graph)){let Q=F1.get(Z);if(F1.delete(Z),q9.delete(Z),!$)G1=null,w2=null;let{clearComponentCache:G}=await import("./chunk-cbh9bfk7.js"),{partialsCache:z}=await import("./chunk-3fd7w2va.js");if(G(),z.clear(),Q&&J.configSignature===H9(J.graph)){let K=Q.then(async(q)=>{let H={...J.graph};await o4(H,Z),q9.set(Z,{graph:H,signature:W9(H),configSignature:H9(H)});let W={...q,_layerGraph:H};if(!$)G1=W;return W});return F1.set(Z,K),K}}if(!$){if(G1)return G1;if(w2)return w2}let X=F1.get(Z);if(X)return X;let Y=(async()=>{let G=(await UY({name:"stx",alias:"ui",cwd:Z,defaultConfig:P5,verbose:!1})).config;if(G.extends!==void 0||J){let H=await s4(Z,P5);G=H.config,q9.set(Z,{graph:H.graph,signature:W9(H.graph),configSignature:H9(H.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zd172hvg.js");H(G.runtimeConfig,{});let{generateRuntimeConfigTypes:W}=await import("./chunk-y6ysrzx8.js");await W(Z,G.runtimeConfig)}OY(G),FY(G),VY(G,Z),LY(G,Z);let z=[],K=new Set((G.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of G.componentPackages??["@stacksjs/components"]){let W=`${H}/stx-plugin`;if(K.has(W)||K.has(H))continue;try{x.resolve(W,{paths:[Z]}),z.push(W)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:H}=await import("./chunk-ct8tvahc.js"),W=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=S0.dirname(L)}catch{let L=S0.resolve(Z,B);F=await import(L),O=S0.dirname(L)}let _=F.default||F;if(!H.has(_.name))await H.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)W.push(S0.resolve(O,w))}if(_.pages){let L=S0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,D)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=D},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=W,G._pluginPageDirs=U}return G})();if(F1.set(Z,Y),Y.catch(()=>{if(F1.get(Z)===Y)F1.delete(Z)}),!$)w2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var e4=new Proxy(P5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!w2)x5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function tH($){return $}function eH($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var g5=new Map;async function RY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await _Y.promises.stat($)).mtime.getTime();if(Z.cache&&g5.has($)){let W=g5.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=F4(Y),z=Z.markdown||e4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=L2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await DY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:q,data:Q||{}};if(Z.cache)g5.set($,{...H,updatedAt:X});return H}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var B9=null;async function DY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!B9)try{B9=await wY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,H)=>{let W=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!B9.getSupportedLanguages().includes(U))return z;return(await B9.highlight(W,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,H,W]=z,U=await Y(K,q,H,W);Q=Q.replace(K,U)}return Q}async function $7($,Z,J="",X={}){return await NY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let H=z;if(!f5.isAbsolute(z))H=f5.resolve(f5.dirname(J),z);let W={};if(K)try{try{W=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let D=L.substring(0,w).trim(),R=L.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);W[D]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await RY(H,X),B={...Z,...j,...W},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(H){let W=H instanceof Error?H.message:String(H);return O0("Markdown File",`Error including markdown file: ${W}`,J,$,q,G)}})}async function NY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((H)=>({match:z,replacement:H,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=MY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function MY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=N0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function AY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),H=K?K.index:1/0,W=q?q.index:1/0;if(H<W)Y++,Q=H+K[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+q[0].length}else break}return-1}function Z7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H="if",W=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(AY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}H="elseif",W=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q}),H="else",W=void 0,q+=5,U=q;continue}}q++}return K.push({type:H,condition:W,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function R2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=Z7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function V9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=N0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let H=$.slice(K+1,q),W=q+1,U=_1($,Z,J,W);if(U===-1){Q=Y.exec($);continue}let j=$.slice(W,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:H,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function h5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H=null,W=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(W++,H)H.content+=j[0];q+=j[0].length;continue}if(B){if(W--,H)H.content+=B[0];q+=B[0].length;continue}if(W>0){if(H)H.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(H)K.push(H);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}H={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(H)K.push(H);H={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(H)H.content+=z[q];q++}}if(H)K.push(H);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function TY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,H=kY($,q,K);if(H===-1){J=G+1;continue}let W=$.slice(q,H).trim(),U=H+K.length;Z.push({fullMatch:$.slice(G,U),expression:W,start:G,end:U,isRaw:Q}),J=U}return Z}function kY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function EY($){let Z=m5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=bY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function bY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=N0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=Y7(G);return{name:X,args:z}}function Y7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function yY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=N0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function CY($){let Z=[],X=new u5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let W=Y<X.length?X[Y].start:$.length,U=J7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:H,value:$.slice(W,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let H=q.start,W=q.value==="{"?"}":"]",U=N0($,q.value,W,H);if(U!==-1){let j=$.slice(H,U+1);if(Y=X7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=J7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;Y++;let W=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){W=X[Y].start;break}Y++}if(W!==-1){let U=N0($,"{","}",W);if(U!==-1)Z.push({type:"function",name:H,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=X7(X,U+1)}}}else Y++}return Z}function J7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function X7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function SY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=h5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",H=!1;for(let W of z.cases)if(W.type==="default"){if(!H)q=W.content.trim()}else try{let U;if(W.value&&B0(W.value))U=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)U=X0(W.value,Z);if(K===U){q=W.content.trim(),H=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),H=D0("Switch",`Error evaluating @switch expression: ${q}`,R0.EVALUATION_ERROR);X=X.substring(0,G)+H+X.substring(z.end);break}}return X}function PY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function vY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=PY($);return vY(xY(X,Z,J),Y)}function xY($,Z,J){let X=$;X=SY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,H=_1(X,"unless","endunless",q);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=X.slice(q,H),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(W))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(W))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(W))!==null)L.push({pos:w.index,type:"else"});L.sort((D,R)=>D.pos-R.pos);for(let D of L)if(D.type==="open")V++;else if(D.type==="close")V--;else if(D.type==="else"&&V===0){j=D.pos;break}}let B;if(j!==-1){let V=W.slice(0,j),F=W.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${W}@endif`;X=X.substring(0,z)+B+X.substring(H+10),Q=!0}}X=l5(X,Z,J),X=c5(X,Z,J),X=d5(X,Z);let Y=()=>{let Q=R2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let H=Q[q];try{let W="",U=!1;for(let j of H.branches){if(U)break;if(j.type==="else")W=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)W=j.content,U=!0}catch(B){W=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,R0.EVALUATION_ERROR),U=!0}}G[q]=W}catch(W){let U=W instanceof Error?W.message:String(W);G[q]=D0("If",`Error processing @if block: ${U}`,R0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let H=Q[q];z[q*2]=X.slice(K,H.start),z[q*2+1]=G[q],K=H.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function Q7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function d5($,Z){let J=$;function X(z,K,q,H){let W=1,U=H,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&W>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)W++,U=O+V[0].length;else if(_<1/0){if(W--,W===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let H=0,W=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=W.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")H++;else if(F.type==="close")H--;else if(F.type==="else"&&H===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+5),j=Q7(U);if(j)H=j.value,W=q+5+j.consumed;else W=q+5;let B=X(J,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=H?z1(`auth?.check && auth?.user?.[${H}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+6),j=Q7(U);if(j)H=j.value,W=q+6+j.consumed;else W=q+6;let B=X(J,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=H?z1(`!auth?.check || !auth?.user?.[${H}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[z];if(K)H.push(K);if(q){let W=z1(q,Z);H.push(W)}return Z.permissions.check(...H)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let W=J.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let U=W.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),D=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],N;while((N=w.exec(O))!==null)T.push({pos:N.index,type:"open"});while((N=D.exec(O))!==null)T.push({pos:N.index,type:"close"});while((N=R.exec(O))!==null)T.push({pos:N.index,type:"elseDirective"});while((N=M.exec(O))!==null)T.push({pos:N.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){L++;continue}if(y.type==="close"){L--;continue}if(L===0)_.push(y)}let I=[],E=0;for(let y=0;y<_.length;y++){let b=_[y];if(I.push({content:O.slice(E,b.pos),ability:void 0}),b.type==="elseDirective"){let P=O.slice(b.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(E,b.pos)},E=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[y+1],u=p?p.pos:O.length;I.push({content:O.slice(E,u),ability:h.ability,type:h.type,id:h.id}),E=u}}else E=b.pos+5}if(E<O.length){let y=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(E)})}let A=Q(B.ability,B.type,B.id),k=z==="can"?A:!A,C="";if(k)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,U)+C+J.substring(F+`@${K}`.length),H=!0}}return J}function l5($,Z,J){let X=$;function Y(Q,G,z,K,q){let H=!0;while(H){H=!1;let W=new RegExp(`@${G}\\s*\\(`),U=Q.match(W);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=_1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,D=0;while(D<O.length){let R=O.indexOf("@",D);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,D=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,D=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}D=R+1}try{let R=K(_.trim()),M;if(L!==-1){let T=O.slice(0,L),N=O.slice(L+5);M=R?T:N}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(F+`@${z}`.length),H=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,R0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function c5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let H=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,H.lastIndex=0;let F=H.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,D=-1;while(L>0&&w<B.length){H.lastIndex=w,W.lastIndex=w;let A=H.exec(B),k=W.exec(B),C=A?A.index:1/0,y=k?k.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){D=y;break}w=y+k[0].length}else break}if(D===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(_,D),M=-1,T=0,N=0;while(N<R.length){let A=R.indexOf("@",N);if(A===-1)break;let k=R.substring(A);if(U.test(k)){T++,N=A+1;continue}if(j.test(k)){T--,N=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(k)){M=A;break}N=A+1}let I;if(M!==-1){let A=R.slice(0,M),k=R.slice(M+5);I=q?A:k}else I=q?R:"";let E=`@${K}`.length;B=B.substring(0,O)+I+B.substring(D+E),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var p5=new WeakMap;function G7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function w1($,Z){if(!$)return Z?.nonceGenerator?.()??G7();let J=p5.get($);if(!J)J=Z?.nonceGenerator?.()??G7(),p5.set($,J);return J}function AU($){p5.delete($)}function z7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function n5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${z7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var fY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},i5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},gY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},hY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function IU($){return{enabled:!0,directives:{strict:fY,moderate:i5,relaxed:gY,api:hY}[$]||i5,useNonce:$==="strict",addMetaTag:!0}}function TU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function K7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?w1(J,Z):void 0,Y=n5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3170
+ </script>`}var P5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:p4,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:w4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:m4,hasEndTag:!1,description:"Include a web component in the template"},l4,c4,r4,a4,B5,L5,O5,V5,L4,Q4,C4,y5,...t4],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function jY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(U9.existsSync(Q)&&U9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(U9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var d4=new Set,j9=["partialsDir","componentsDir","layoutsDir"],v5=new WeakMap;function BY($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function VY($,Z){let J=!$.root,X=jY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!d4.has(Y))d4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!v5.has($)){let Y={};for(let Q of j9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}v5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of j9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||BY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of j9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function LY($,Z){let J=v5.get($);for(let X of j9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(U9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function OY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function FY($){if(i4($.stateDir),$.stateDir=n4(),$.cachePath=_2($.cachePath),$.build)$.build.cacheDir=_2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=_2($.media.cache.directory);if($.story)$.story.outDir=_2($.story.outDir)}var G1=null,F1=new Map,q9=new Map,w2=null;async function x5($){let Z=$?S0.resolve($):process.cwd(),J=q9.get(Z);if(J&&J.signature!==W9(J.graph)){let Q=F1.get(Z);if(F1.delete(Z),q9.delete(Z),!$)G1=null,w2=null;let{clearComponentCache:G}=await import("./chunk-dk40tcv1.js"),{partialsCache:z}=await import("./chunk-7yyfbhna.js");if(G(),z.clear(),Q&&J.configSignature===H9(J.graph)){let K=Q.then(async(q)=>{let H={...J.graph};await o4(H,Z),q9.set(Z,{graph:H,signature:W9(H),configSignature:H9(H)});let W={...q,_layerGraph:H};if(!$)G1=W;return W});return F1.set(Z,K),K}}if(!$){if(G1)return G1;if(w2)return w2}let X=F1.get(Z);if(X)return X;let Y=(async()=>{let G=(await UY({name:"stx",alias:"ui",cwd:Z,defaultConfig:P5,verbose:!1})).config;if(G.extends!==void 0||J){let H=await s4(Z,P5);G=H.config,q9.set(Z,{graph:H.graph,signature:W9(H.graph),configSignature:H9(H.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zd172hvg.js");H(G.runtimeConfig,{});let{generateRuntimeConfigTypes:W}=await import("./chunk-p33qyhtc.js");await W(Z,G.runtimeConfig)}OY(G),FY(G),VY(G,Z),LY(G,Z);let z=[],K=new Set((G.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of G.componentPackages??["@stacksjs/components"]){let W=`${H}/stx-plugin`;if(K.has(W)||K.has(H))continue;try{x.resolve(W,{paths:[Z]}),z.push(W)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:H}=await import("./chunk-ct8tvahc.js"),W=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=S0.dirname(L)}catch{let L=S0.resolve(Z,B);F=await import(L),O=S0.dirname(L)}let _=F.default||F;if(!H.has(_.name))await H.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)W.push(S0.resolve(O,w))}if(_.pages){let L=S0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,D)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=D},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=W,G._pluginPageDirs=U}return G})();if(F1.set(Z,Y),Y.catch(()=>{if(F1.get(Z)===Y)F1.delete(Z)}),!$)w2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var e4=new Proxy(P5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!w2)x5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function tH($){return $}function eH($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var g5=new Map;async function RY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await _Y.promises.stat($)).mtime.getTime();if(Z.cache&&g5.has($)){let W=g5.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=F4(Y),z=Z.markdown||e4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=L2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await DY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:q,data:Q||{}};if(Z.cache)g5.set($,{...H,updatedAt:X});return H}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var B9=null;async function DY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!B9)try{B9=await wY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,H)=>{let W=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!B9.getSupportedLanguages().includes(U))return z;return(await B9.highlight(W,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,H,W]=z,U=await Y(K,q,H,W);Q=Q.replace(K,U)}return Q}async function $7($,Z,J="",X={}){return await NY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let H=z;if(!f5.isAbsolute(z))H=f5.resolve(f5.dirname(J),z);let W={};if(K)try{try{W=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let D=L.substring(0,w).trim(),R=L.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);W[D]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await RY(H,X),B={...Z,...j,...W},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(H){let W=H instanceof Error?H.message:String(H);return O0("Markdown File",`Error including markdown file: ${W}`,J,$,q,G)}})}async function NY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((H)=>({match:z,replacement:H,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=MY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function MY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=N0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function AY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),H=K?K.index:1/0,W=q?q.index:1/0;if(H<W)Y++,Q=H+K[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+q[0].length}else break}return-1}function Z7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H="if",W=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(AY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}H="elseif",W=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:H,condition:W,content:z.substring(U,q),start:Q+U,end:Q+q}),H="else",W=void 0,q+=5,U=q;continue}}q++}return K.push({type:H,condition:W,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function R2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=Z7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function V9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=N0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let H=$.slice(K+1,q),W=q+1,U=_1($,Z,J,W);if(U===-1){Q=Y.exec($);continue}let j=$.slice(W,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:H,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function h5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,H=null,W=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(W++,H)H.content+=j[0];q+=j[0].length;continue}if(B){if(W--,H)H.content+=B[0];q+=B[0].length;continue}if(W>0){if(H)H.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(H)K.push(H);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}H={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(H)K.push(H);H={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(H)H.content+=z[q];q++}}if(H)K.push(H);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function TY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,H=kY($,q,K);if(H===-1){J=G+1;continue}let W=$.slice(q,H).trim(),U=H+K.length;Z.push({fullMatch:$.slice(G,U),expression:W,start:G,end:U,isRaw:Q}),J=U}return Z}function kY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function EY($){let Z=m5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=bY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function bY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=N0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=Y7(G);return{name:X,args:z}}function Y7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function yY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=N0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function CY($){let Z=[],X=new u5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let W=Y<X.length?X[Y].start:$.length,U=J7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:H,value:$.slice(W,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let H=q.start,W=q.value==="{"?"}":"]",U=N0($,q.value,W,H);if(U!==-1){let j=$.slice(H,U+1);if(Y=X7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=J7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let H=q.value;Y++;let W=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){W=X[Y].start;break}Y++}if(W!==-1){let U=N0($,"{","}",W);if(U!==-1)Z.push({type:"function",name:H,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=X7(X,U+1)}}}else Y++}return Z}function J7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function X7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function SY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=h5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",H=!1;for(let W of z.cases)if(W.type==="default"){if(!H)q=W.content.trim()}else try{let U;if(W.value&&B0(W.value))U=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)U=X0(W.value,Z);if(K===U){q=W.content.trim(),H=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),H=D0("Switch",`Error evaluating @switch expression: ${q}`,R0.EVALUATION_ERROR);X=X.substring(0,G)+H+X.substring(z.end);break}}return X}function PY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function vY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=PY($);return vY(xY(X,Z,J),Y)}function xY($,Z,J){let X=$;X=SY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,H=_1(X,"unless","endunless",q);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=X.slice(q,H),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(W))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(W))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(W))!==null)L.push({pos:w.index,type:"else"});L.sort((D,R)=>D.pos-R.pos);for(let D of L)if(D.type==="open")V++;else if(D.type==="close")V--;else if(D.type==="else"&&V===0){j=D.pos;break}}let B;if(j!==-1){let V=W.slice(0,j),F=W.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${W}@endif`;X=X.substring(0,z)+B+X.substring(H+10),Q=!0}}X=l5(X,Z,J),X=c5(X,Z,J),X=d5(X,Z);let Y=()=>{let Q=R2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let H=Q[q];try{let W="",U=!1;for(let j of H.branches){if(U)break;if(j.type==="else")W=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)W=j.content,U=!0}catch(B){W=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,R0.EVALUATION_ERROR),U=!0}}G[q]=W}catch(W){let U=W instanceof Error?W.message:String(W);G[q]=D0("If",`Error processing @if block: ${U}`,R0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let H=Q[q];z[q*2]=X.slice(K,H.start),z[q*2+1]=G[q],K=H.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function Q7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function d5($,Z){let J=$;function X(z,K,q,H){let W=1,U=H,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&W>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)W++,U=O+V[0].length;else if(_<1/0){if(W--,W===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let H=0,W=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=W.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")H++;else if(F.type==="close")H--;else if(F.type==="else"&&H===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+5),j=Q7(U);if(j)H=j.value,W=q+5+j.consumed;else W=q+5;let B=X(J,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=H?z1(`auth?.check && auth?.user?.[${H}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,H,W,U=J.slice(q+6),j=Q7(U);if(j)H=j.value,W=q+6+j.consumed;else W=q+6;let B=X(J,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(W,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=H?z1(`!auth?.check || !auth?.user?.[${H}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[z];if(K)H.push(K);if(q){let W=z1(q,Z);H.push(W)}return Z.permissions.check(...H)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let W=J.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let U=W.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),D=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],N;while((N=w.exec(O))!==null)T.push({pos:N.index,type:"open"});while((N=D.exec(O))!==null)T.push({pos:N.index,type:"close"});while((N=R.exec(O))!==null)T.push({pos:N.index,type:"elseDirective"});while((N=M.exec(O))!==null)T.push({pos:N.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){L++;continue}if(y.type==="close"){L--;continue}if(L===0)_.push(y)}let I=[],E=0;for(let y=0;y<_.length;y++){let b=_[y];if(I.push({content:O.slice(E,b.pos),ability:void 0}),b.type==="elseDirective"){let P=O.slice(b.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(E,b.pos)},E=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[y+1],u=p?p.pos:O.length;I.push({content:O.slice(E,u),ability:h.ability,type:h.type,id:h.id}),E=u}}else E=b.pos+5}if(E<O.length){let y=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(E)})}let A=Q(B.ability,B.type,B.id),k=z==="can"?A:!A,C="";if(k)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,U)+C+J.substring(F+`@${K}`.length),H=!0}}return J}function l5($,Z,J){let X=$;function Y(Q,G,z,K,q){let H=!0;while(H){H=!1;let W=new RegExp(`@${G}\\s*\\(`),U=Q.match(W);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=_1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,D=0;while(D<O.length){let R=O.indexOf("@",D);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,D=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,D=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}D=R+1}try{let R=K(_.trim()),M;if(L!==-1){let T=O.slice(0,L),N=O.slice(L+5);M=R?T:N}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(F+`@${z}`.length),H=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,R0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function c5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let H=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,H.lastIndex=0;let F=H.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,D=-1;while(L>0&&w<B.length){H.lastIndex=w,W.lastIndex=w;let A=H.exec(B),k=W.exec(B),C=A?A.index:1/0,y=k?k.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){D=y;break}w=y+k[0].length}else break}if(D===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(_,D),M=-1,T=0,N=0;while(N<R.length){let A=R.indexOf("@",N);if(A===-1)break;let k=R.substring(A);if(U.test(k)){T++,N=A+1;continue}if(j.test(k)){T--,N=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(k)){M=A;break}N=A+1}let I;if(M!==-1){let A=R.slice(0,M),k=R.slice(M+5);I=q?A:k}else I=q?R:"";let E=`@${K}`.length;B=B.substring(0,O)+I+B.substring(D+E),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var p5=new WeakMap;function G7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function w1($,Z){if(!$)return Z?.nonceGenerator?.()??G7();let J=p5.get($);if(!J)J=Z?.nonceGenerator?.()??G7(),p5.set($,J);return J}function AU($){p5.delete($)}function z7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function n5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${z7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var fY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},i5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},gY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},hY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function IU($){return{enabled:!0,directives:{strict:fY,moderate:i5,relaxed:gY,api:hY}[$]||i5,useNonce:$==="strict",addMetaTag:!0}}function TU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function K7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?w1(J,Z):void 0,Y=n5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3171
3171
  ${Y}`)}function q7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function W7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?w1(Z,Q):void 0;return n5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return w1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=w1(Z,Q);return Y}var uY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?w1(J,Q):void 0;return n5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},mY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return w1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function kU(){return[uY,mY]}function EU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function dY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function bU($,Z){if(!$.enabled)return{};let J=$.useNonce?w1(Z,$):void 0,X=z7($.directives,J);return{[dY($.reportOnly)]:X}}var yU={enabled:!1,reportOnly:!1,directives:i5,useNonce:!1,addMetaTag:!0};import lY from"crypto";var cY=40,H7="_token",s5=null;function pY($=cY){let Z=lY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return s5=Z,Z}function iY(){if(!s5)pY();return s5}function nY($=H7){let Z=iY();return`<input type="hidden" name="${$}" value="${Z}">`}function U7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return nY(X||H7)})}async function V7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await sY(Y,Q,Z,J,X);else Y=await oY(Y,Q,Z,J,X)}return Y}async function sY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,H=R1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),W=[],U=H.exec(q);while(U!==null){let[j,B="",V=""]=U,F=U.index||0;try{let O=B?L7(Z,B):[],_=V.trim(),L=await G(_,O,J,X);W.push({original:j,processed:L,startIndex:F})}catch(O){let _=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:j,processed:D0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${_}`,R0.EVALUATION_ERROR),startIndex:F})}U=H.exec(q)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:V}=W[j];q=q.replace(B,V)}return q}async function oY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of j7(z,R1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=R1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=L7(Z,j),F=await G("",V,J,X);K.push({original:U,processed:F,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}(${j}): ${F}`,R0.EVALUATION_ERROR),startIndex:B})}let H=R1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),W=H.exec(z);while(W!==null){let[U]=W,j=W.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}: ${V}`,R0.EVALUATION_ERROR),startIndex:j})}W=H.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function L7($,Z){return $.rawParams?B7(Z):rY(Z)}function rY($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var O7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,F7=/^[A-Za-z_$][\w$]*$/,aY=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function tY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(J.key,"appearance.key"),D1(J.attribute,"appearance.attribute"),D1(J.default,"appearance.default"),D1(X.key,"colorMode.key"),D1(X.attribute,"colorMode.attribute"),D1(X.default,"colorMode.default"),!F7.test(J.key)||!F7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!O7.test(J.attribute)||!O7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!aY.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function eY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $Q($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${eY($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function ZQ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function _7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=ZQ(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=X0(`(${z})`,Z),q=$Q(tY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import JQ from"crypto";function M0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var r5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function XQ($){return{...r5,...$.forms?.classes}}function L9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function f0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function u1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${M0(Z)}"`}function o5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${M0(`${f0($)}-error`)}"`;return X}function YQ(){return JQ.randomUUID()}function lU($,Z,J,X){let Y=XQ(X),Q=$;return Q=GQ(Q,Z),Q=M2(Q,Z),Q=a5(Q,Z,Y),Q=t5(Q,Z,Y),Q}function M2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=YQ();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${M0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${M0(Q)}">`;return X}),J}function a5($,Z,J=r5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let H=Q||G||"POST",W=z||K||"",U=q1(q),j=H.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${M0(B)}" action="${M0(W)}"${U?` ${U}`:""}>`;if(V+=`
3172
3172
  ${M2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
3173
3173
  ${M2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let H=Q||G||"",W=z||K||"",U=q1(q),j=D2(H,Z),B=j!==void 0&&j!==null?j:W||"",V=U.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",O=N2(H,Z),_=U.match(/class=['"]([^'"]+)['"]/i),L=L9(_?_[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${M0(F)}" name="${M0(H)}"${u1(U,f0(H))} value="${M0(B)}" class="${L}"${o5(H,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=D2(Q,Z)||z.trim(),H=N2(Q,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=L9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${M0(Q)}"${u1(K,f0(Q))} class="${U}"${o5(Q,H,K)}${j?` ${j}`:""}>${M0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=D2(Q,Z),H=N2(Q,Z),W=K.match(/class=['"]([^'"]+)['"]/i),U=L9(W?W[1]:"",J.input,H,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${M0(Q)}"${u1(K,f0(Q))} class="${U}"${o5(Q,H,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?f0(Q):`${f0(Q)}-${f0(K)}`,H=q1(z),W=D2(Q,Z),U=W!==void 0&&(Array.isArray(W)?W.some((F)=>String(F)===K):W===!0||String(W)===K),j=H.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${M0(Q)}"${u1(H,q)} value="${M0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=D2(Q,Z),H=q!==void 0&&q===G,W=K.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${M0(Q)}"${u1(K,`${f0(Q)}-${f0(G)}`)} value="${M0(G)}" class="${U}"${H?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",H=z.includes("multiple"),W=N2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=L9(U?U[1]:"",J.input,W,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${M0(Q)}"${u1(z,f0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${M0(q)}"`);if(H)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),H=q?q[1]:J.label,W=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${M0(f0(Q))}" class="${H}"${W?` ${W}`:""}>${z}</label>`}),X}function t5($,Z,J=r5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(N2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return w7(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return w7(Y,Z)}let q=K.trim();if(B0(q)){let H=X0(q,Z);return H!==void 0?String(H):q}return q}catch{return K}});return`<div id="${M0(`${f0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function N2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function w7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function D2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var R7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function cU($,Z){R7[$]=Z}function e5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function QQ($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=e5(G),K=R7[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let H=`${$}_confirmation`;z.params=[X[H]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function pU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=QQ(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function GQ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=e5(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var D7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function iU($){D7[$.name]=$}function zQ($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=e5(Q),z=D7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function nU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=zQ($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function sU($,Z){let J=JSON.stringify(Z);return`
@@ -3403,9 +3403,9 @@ ${Y}
3403
3403
  } finally {
3404
3404
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3405
3405
  }
3406
- })();`}function rQ($,Z){if(i0($)){let Y=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var K6=0,M$=new Set;function oB(){M$.clear()}function q6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var rB=new r1(500),H6=new Set;function aB(){H6.clear()}function aQ($){if($.__onceStore instanceof Set)return $.__onceStore;return H6}async function A$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G))G=K0.resolve(process.cwd(),G);let z=cQ($,"@partial","@include"),K=aQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let D=z.substring(_+1,w-1),R=D.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),N="";if(T&&await Bun.file(T).exists())Y.add(T),N=`@include(${D})`;z=z.substring(0,O)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,D=1,R=w+1;while(R<z.length&&D>0){if(z[R]==="(")D++;else if(z[R]===")")D--;R++}if(D!==0)break;let M=z.substring(w+1,R-1),T=N$(M,0);if(T===-1){O.lastIndex=R;continue}let N=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=N$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${N})`,P;if(B0(b)){let u=U0(b,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(b,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,L)+p+z.substring(R),O.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(R),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,N,I,E]=M;try{let A,k=N.trim();if(B0(k))A=U0(k,Object.keys(Z))(...Object.values(Z));else A=X0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await U(T,b,$,O);C+=P}else if(E)C=await U(E,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${k}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],N=D.slice(M[0].length),I,E=N.match(/^\s*,\s*\{/);if(E){N=N.slice(E[0].length-1);let C=1,y=1;while(y<N.length&&C>0){if(N[y]==="{")C++;else if(N[y]==="}"){if(C--,C===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let A,k=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,R);z=z.replace(R,()=>p)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let h=q(P,G,J);if(!h)continue;if(await t(h)){let p=await U(P,y,$,O);z=z.replace(R,()=>p),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=O0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=K0.resolve(F),w=K0.resolve(K0.dirname(O)),D;if(!_.startsWith("./")&&!_.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=K0.resolve(E,_);if(A.startsWith(`${K0.resolve(E)}${K0.sep}`)&&lQ(A))return A}D=K0.resolve(F,_)}else D=K0.resolve(w,_);let R=K0.normalize(D),M=R.startsWith(L+K0.sep)||R===L,T=R.startsWith(w+K0.sep)||R===w,N=!1,I=K0.dirname(w);if(R.startsWith(I+K0.sep)){if(!K0.relative(I,R).split(K0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))N=!0}if(!M&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return R}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let H=K0.resolve(J);Q.add(H);function W(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,O,_);let w=K0.resolve(L);if(Q.has(w)){let D=[...Q,w].map((R)=>K0.basename(R)).join(" -> ");return W(V,`Circular include detected: ${D}`,O,_)}try{Y.add(L);let D;if(!D)try{D=await Bun.file(L).text()}catch(i){let W0=i instanceof Error?i.message:String(i);return W(V,`Error loading include file ${V}: ${W0}`,O,_)}if(D)D=D.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(D&&D.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-2bsaq9kq.js");D=i(D,Z)}if(D&&(X.debug||!y2()&&!C2()))try{let{warnUnbalancedTags:i}=await import("./chunk-71gg4a7z.js");i(D,L)}catch{}let R=D;try{let{processESImports:i}=await import("./chunk-e45zxsgj.js");await i(D,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=O9(R);if(M)R=M.content.trim();let N=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;let E=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,W0,a)=>{if(!q6(W0))return"";return E.push({attrs:W0,body:a}),`__STX_DATA_BLOCK_${E.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(D,L);for(let[i,W0]of Object.entries(F))A[i]=W0;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...D.matchAll(k)],y="",b=null,P=!1;for(let i of C){let W0=i[1]||"",a=i[2]||"";if(q6(W0))continue;let L0=W0.includes("server"),c0=T1(W0);if(!L0&&a.trim()){let{interpolateScriptExpressions:f}=await import("./chunk-5fqs93qg.js");a=f(a,A,V)}let p0="";try{let{extractAndStripCssImports:f,renderVendorStyleTags:l}=await import("./chunk-xy3gx0x7.js"),Z0=f(a,{filePath:L,projectRoot:process.cwd()});a=Z0.code,p0=l(Z0.styles)}catch(f){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,f instanceof Error?f.message:f)}if(c0&&a.trim())a=k1(a);if(!L0){try{let{injectBrowserCoreAutoImports:l}=await import("./chunk-xy3gx0x7.js");a=l(a).code;let{hasUserImports:Z0,bundleClientScript:j0}=await import("./chunk-3n0hpd5m.js");if(Z0(a))a=await j0(a,L,{projectRoot:process.cwd()})}catch(l){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,l instanceof Error?l.message:l)}let{stripStxRuntimeImports:f}=await import("./chunk-9y0btmfc.js");a=f(a)}let g0=pQ(a);if(g0&&!L0){P=!0,b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++K6}`;let f=e0(a),l=z6(f,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${l}</script>
3407
- `;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-yvv9qjcd.js");await f(a,A,L)}catch(f){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,f)}if(!L0&&!g0){let f=W0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++K6}`;let l=e0(a),Z0=z6(l,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${f?` ${f}`:""}>${Z0}</script>
3408
- `}}if(E.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-5fqs93qg.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(W0,a)=>{let L0=E[Number(a)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=rQ(R,b);if(R=i.html,i.mergedIntoExisting){let a=b,L0=i.mergedIntoExisting;y=y.split(`'${a}'`).join(`'${L0}'`).split(`"${a}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!M$.has(L))M$.add(L),console.warn(`[stx] ${K0.relative(process.cwd(),L)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let W0=i.stamped&&i.root!==null&&b2(i.root);y=sQ(y,W0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await A$(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-pkandp4e.js"),u=h(R,A,L,void 0,!0);u=t0(u,A,L),u=p(u);let{processMetaDirectives:r,processSeoDirective:e,processStructuredData:Y0}=await import("./chunk-m8nmsr4g.js");if(u=r(u,A,L,X),u=Y0(u,A,L),u=e(u,A,L,X),u=L1(u,A,L),I)u+=`
3406
+ })();`}function rQ($,Z){if(i0($)){let Y=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var K6=0,M$=new Set;function oB(){M$.clear()}function q6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var rB=new r1(500),H6=new Set;function aB(){H6.clear()}function aQ($){if($.__onceStore instanceof Set)return $.__onceStore;return H6}async function A$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G))G=K0.resolve(process.cwd(),G);let z=cQ($,"@partial","@include"),K=aQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let D=z.substring(_+1,w-1),R=D.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),N="";if(T&&await Bun.file(T).exists())Y.add(T),N=`@include(${D})`;z=z.substring(0,O)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,D=1,R=w+1;while(R<z.length&&D>0){if(z[R]==="(")D++;else if(z[R]===")")D--;R++}if(D!==0)break;let M=z.substring(w+1,R-1),T=N$(M,0);if(T===-1){O.lastIndex=R;continue}let N=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=N$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${N})`,P;if(B0(b)){let u=U0(b,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(b,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,L)+p+z.substring(R),O.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(R),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,N,I,E]=M;try{let A,k=N.trim();if(B0(k))A=U0(k,Object.keys(Z))(...Object.values(Z));else A=X0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await U(T,b,$,O);C+=P}else if(E)C=await U(E,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${k}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let D=z.substring(_+1,w),R=z.substring(O,w+1),M=D.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],N=D.slice(M[0].length),I,E=N.match(/^\s*,\s*\{/);if(E){N=N.slice(E[0].length-1);let C=1,y=1;while(y<N.length&&C>0){if(N[y]==="{")C++;else if(N[y]==="}"){if(C--,C===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let A,k=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,R);z=z.replace(R,()=>p)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let h=q(P,G,J);if(!h)continue;if(await t(h)){let p=await U(P,y,$,O);z=z.replace(R,()=>p),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=O0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=K0.resolve(F),w=K0.resolve(K0.dirname(O)),D;if(!_.startsWith("./")&&!_.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=K0.resolve(E,_);if(A.startsWith(`${K0.resolve(E)}${K0.sep}`)&&lQ(A))return A}D=K0.resolve(F,_)}else D=K0.resolve(w,_);let R=K0.normalize(D),M=R.startsWith(L+K0.sep)||R===L,T=R.startsWith(w+K0.sep)||R===w,N=!1,I=K0.dirname(w);if(R.startsWith(I+K0.sep)){if(!K0.relative(I,R).split(K0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))N=!0}if(!M&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return R}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let H=K0.resolve(J);Q.add(H);function W(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,O,_);let w=K0.resolve(L);if(Q.has(w)){let D=[...Q,w].map((R)=>K0.basename(R)).join(" -> ");return W(V,`Circular include detected: ${D}`,O,_)}try{Y.add(L);let D;if(!D)try{D=await Bun.file(L).text()}catch(i){let W0=i instanceof Error?i.message:String(i);return W(V,`Error loading include file ${V}: ${W0}`,O,_)}if(D)D=D.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(D&&D.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-syy0njsk.js");D=i(D,Z)}if(D&&(X.debug||!y2()&&!C2()))try{let{warnUnbalancedTags:i}=await import("./chunk-71gg4a7z.js");i(D,L)}catch{}let R=D;try{let{processESImports:i}=await import("./chunk-5t826ypq.js");await i(D,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=O9(R);if(M)R=M.content.trim();let N=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;let E=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,W0,a)=>{if(!q6(W0))return"";return E.push({attrs:W0,body:a}),`__STX_DATA_BLOCK_${E.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(D,L);for(let[i,W0]of Object.entries(F))A[i]=W0;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...D.matchAll(k)],y="",b=null,P=!1;for(let i of C){let W0=i[1]||"",a=i[2]||"";if(q6(W0))continue;let L0=W0.includes("server"),c0=T1(W0);if(!L0&&a.trim()){let{interpolateScriptExpressions:f}=await import("./chunk-bh1m0x85.js");a=f(a,A,V)}let p0="";try{let{extractAndStripCssImports:f,renderVendorStyleTags:l}=await import("./chunk-xr8ergcp.js"),Z0=f(a,{filePath:L,projectRoot:process.cwd()});a=Z0.code,p0=l(Z0.styles)}catch(f){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,f instanceof Error?f.message:f)}if(c0&&a.trim())a=k1(a);if(!L0){try{let{injectBrowserCoreAutoImports:l}=await import("./chunk-xr8ergcp.js");a=l(a).code;let{hasUserImports:Z0,bundleClientScript:j0}=await import("./chunk-hyrm54da.js");if(Z0(a))a=await j0(a,L,{projectRoot:process.cwd()})}catch(l){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,l instanceof Error?l.message:l)}let{stripStxRuntimeImports:f}=await import("./chunk-1q2b0r3v.js");a=f(a)}let g0=pQ(a);if(g0&&!L0){P=!0,b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++K6}`;let f=e0(a),l=z6(f,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${l}</script>
3407
+ `;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-n5791wn3.js");await f(a,A,L)}catch(f){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,f)}if(!L0&&!g0){let f=W0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++K6}`;let l=e0(a),Z0=z6(l,b);y+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${f?` ${f}`:""}>${Z0}</script>
3408
+ `}}if(E.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-bh1m0x85.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(W0,a)=>{let L0=E[Number(a)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=rQ(R,b);if(R=i.html,i.mergedIntoExisting){let a=b,L0=i.mergedIntoExisting;y=y.split(`'${a}'`).join(`'${L0}'`).split(`"${a}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!M$.has(L))M$.add(L),console.warn(`[stx] ${K0.relative(process.cwd(),L)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let W0=i.stamped&&i.root!==null&&b2(i.root);y=sQ(y,W0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await A$(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-zjqw2fde.js"),u=h(R,A,L,void 0,!0);u=t0(u,A,L),u=p(u);let{processMetaDirectives:r,processSeoDirective:e,processStructuredData:Y0}=await import("./chunk-m8nmsr4g.js");if(u=r(u,A,L,X),u=Y0(u,A,L),u=e(u,A,L,X),u=L1(u,A,L),I)u+=`
3409
3409
  `+I;if(y)u+=`
3410
3410
  `+y;return u}catch(D){let R=D instanceof Error?D.message:String(D);return W(V,`Error processing include ${V}: ${R}`,O,_)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,O=1,_=F+1;while(_<z.length&&O>0){if(z[_]==="(")O++;else if(z[_]===")")O--;_++}if(O!==0)break;let L=z.substring(V,_),w=z.substring(F+1,_-1),D=w.match(/^\s*['"]([^'"]+)['"]/);if(!D){j.lastIndex=_;continue}let R=D[1],M,T=w.substring(D[0].length),N=N$(T,0);if(N!==-1)M=T.substring(N+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let k=A instanceof Error?A.message:String(A);z=z.replace(L,O0("Include",`Error parsing include variables for ${R}: ${k}`,J,$,V)),j.lastIndex=0;continue}let E=await U(R,I,$,V);z=z.substring(0,V)+E+z.substring(_),j.lastIndex=0}return z}function I$($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let H=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),W=K.match(H);if(!W||W.index===void 0)break;let U=W.index,j=W[1],B=U+W[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),O=1,_=B,L=-1;while(O>0&&_<K.length){let D=K.slice(_),R=D.match(V),M=D.match(F),T=R?_+R.index:1/0,N=M?_+M.index:1/0;if(T<N)O++,_=T+(R[0].length||1);else if(N<1/0){if(O--,O===0){L=N;break}_=N+G.length+1}else break}if(L===-1)break;let w=K.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,U)+K.substring(L+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function T$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3411
3411
  `)})}import*as k$ from"path";async function U6($,Z,J=""){if(k$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return B6($,Z,J,"@js","@endjs")}async function j6($,Z,J=""){if(k$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return B6($,Z,J,"@ts","@endts")}async function B6($,Z,J,X,Y){let Q=$,G=R1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:H,index:W}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),V=H.trim();if(X==="@ts")V=V.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),_=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
@@ -3468,14 +3468,14 @@ ${$.slice(J)}`}function $8($,Z={},J={},X){if(X??d$($))return $;return nG($,Z,J)}
3468
3468
  ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3469
3469
  `+$.slice(G)}if(i0($))return x1($,(G)=>`${G}
3470
3470
  ${Z}`);return`${Z}
3471
- ${$}`}async function f9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-kzg9gjmy.js"),{url:Q}=await Y("runtime",Z.debug===!0);return c$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return c$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-kzg9gjmy.js"),X=await J(Z.debug);return c$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function tG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function q8($){if($.includes("data-stx-tooltip-runtime")||!tG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${O$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3471
+ ${$}`}async function f9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-6tk817fg.js"),{url:Q}=await Y("runtime",Z.debug===!0);return c$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return c$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-6tk817fg.js"),X=await J(Z.debug);return c$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function tG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function q8($){if($.includes("data-stx-tooltip-runtime")||!tG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${O$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3472
3472
  ${Z}`;return`${$.slice(0,J)}${Z}
3473
3473
  ${$.slice(J)}`}var eG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function $z($){return eG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function Zz($,Z){if(!$.includes("</body>"))return $;if($z($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await Q8(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${G8(K)};</script>
3474
- `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-kzg9gjmy.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+`
3474
+ `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-6tk817fg.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
3475
  </body>`+$.slice(z+7)}var W8=Symbol.for("stx.lazy-module-promises");function Jz(){let $=globalThis;return $[W8]??=new Map,$[W8]}function s($,Z){let J=Jz(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var p$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,_8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Xz=65536,Yz=4,h9=new Map;function IL(){h9.clear()}function Qz($){let Z=[];for(let J of x2($,H2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function Gz($,Z={}){let J=$.length>=Xz,X=J?h9.get($):void 0;if(X===void 0){if(X=Qz($),J)F8(h9,Yz),h9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function w8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=H8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=H8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function H8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function s$($,Z){return O8($,Z)}function zz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function Kz($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function qz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${p$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=x2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=w8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let H=G[1],U=/\/\s*>$/.test(Q.token)||u9.has(H.toLowerCase())?Q.end:D8($,Q.start,H,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var U8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function Wz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function j8($,Z,J,X){if(!$)return!1;let Y=Wz($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(U8.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=H.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(U8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function g9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(_8);if(Q&&Hz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Hz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function R8($,Z){let J=Kz($);function X(Y){let Q=Y,G=qz(Y),z=(W)=>{let U=new Set;for(let j of G)if(W>j.start&&W<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,H=[];while((q=K.exec(Q))!==null){let W=q.index,U=W+q[0].length,j=1,B=U;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(U,B-1).trim(),F=B,O=1,_=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){_=w.index+w[0].length;break}}if(O!==0)continue;let D=Q.substring(F,_-6).trim(),R;if(zz(D)){let M=R2(Q.substring(W,_));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),N=z(W);if(!(T.length>0&&T.every((A)=>j8(A.condition,J,Z,N))))continue;R=M[0].branches.map((A)=>{let k=X(A.content);if(A.type==="elseif")return g9(k,"@else-if",A.condition??"");if(A.type==="else")return g9(k,"@else");return g9(k,"@if",A.condition??"")}).join(`
3476
3476
  `)}else{if(!j8(V,J,Z,z(W)))continue;R=g9(X(D),"@if",V)}H.push({start:W,end:_,replacement:R}),K.lastIndex=_}for(let W=H.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=H[W];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function Uz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var u9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),B8=/<(script|style)\b/iy,jz=/<\/script/gi,Bz=/<\/style/gi;function D8($,Z,J,X){if(u9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let U=$.indexOf("-->",z+4);if(U===-1)return-1;z=U+3;continue}B8.lastIndex=z;let q=B8.exec($);if(q){let U=$.indexOf(">",z);if(U===-1)return-1;if($[U-1]==="/"){z=U+1;continue}let j=q[1].toLowerCase()==="script"?jz:Bz;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!U){z++;continue}if(U[1].toLowerCase()===Y){if(G--,z+=U[0].length,G===0)return z;continue}z+=U[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!H){z++;continue}let W=$.indexOf(">",z);if(W===-1)return-1;if(H[1].toLowerCase()===Y){let U=$.slice(z,W+1);if(!(/\/\s*>$/.test(U)||u9.has(Y)))G++}z=W+1}return-1}var Vz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Lz($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return Vz.test(Q)}function N8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(W)=>Z.some(([U,j])=>W>=U&&W<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[W,U,j,B,V,F,O]=z,_=Uz(V);if(_===void 0)continue;let L=z.index,w=L+W.length,M=!!O||/\/\s*>$/.test(W)||u9.has(U.toLowerCase())?w:D8($,L,U,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Lz($,M)){Q.lastIndex=w;continue}if(_===!0){let N=`<${U}${j}${F}${O}>`;G.push({start:L,end:w,replacement:N});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((W,U)=>W.start-U.start);let K=[],q=-1;for(let W of G){if(W.start<q)continue;K.push(W),q=W.end}let H=$;for(let W=K.length-1;W>=0;W--){let{start:U,end:j,replacement:B}=K[W];H=H.substring(0,U)+B+H.substring(j)}return H}function o$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,H=1,W=q;while(W<J.length&&H>0){if(J[W]==="(")H++;else if(J[W]===")")H--;W++}if(H!==0)continue;let U=J.substring(q,W-1).trim(),j=W,B=w8(U),V=z==="for"?"@endfor":"@endforeach",F=1,O=j,_=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");_.lastIndex=j;let L;while((L=_.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){O=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:O,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let E=I.split(/[.[(]/)[0].trim(),A=Z?E in Z:!1,k=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(E));if(E&&(A||k)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let D=J.substring(j,O-V.length).trim(),R=Z?{...Z}:{};if(B.itemVar)delete R[B.itemVar];if(B.indexVar)delete R[B.indexVar];let M=o$(D,R),T=M.match(_8),N;if(T){let[,I,E,A]=T;N=`<${I}${E} @for="${U}">${A}</${I}>`}else N=`<template @for="${U}">${M}</template>`;Q.push({start:K,end:O,replacement:N}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:H}=Q[z];J=J.substring(0,K)+H+J.substring(q)}return J}function Oz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(H)=>{let W=X+1;while(W<Q){let U=$[W];if(U==="\\"){W+=2;continue}if(U===H)return W+1;W++}return Q},z=()=>{let H=X+2;while(H<Q&&$[H]!==`
3477
3477
  `)H++;return H},K=()=>{let H=X+2;while(H<Q-1){if($[H]==="*"&&$[H+1]==="/")return H+2;H++}return Q},q=(H)=>{let W=H,U=0;while(W<Q){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<Q&&$[B]!==`
3478
- `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){U++,W++;continue}if(j===")"||j==="]"||j==="}"){U--,W++;continue}if(j===";"&&U===0)return W+1;W++}return Q};while(X<Q){let H=$[X];if(H==="/"&&$[X+1]==="/"){let W=z();J.push($.slice(X,W)),X=W;continue}if(H==="/"&&$[X+1]==="*"){let W=K();J.push($.slice(X,W)),X=W;continue}if(H==='"'||H==="'"||H==="`"){let W=G(H);J.push($.slice(X,W)),X=W;continue}if(H==="{"){Y++,J.push(H),X++;continue}if(H==="}"){Y--,J.push(H),X++;continue}if(Y===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(H),X++}return J.join("")}var Fz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function i$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function _z($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!i$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function wz($,Z){if(_z($,"<body",Z)){let Y=new RegExp(`<body(${p$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!i$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${p$})>`,"gi"),X;while((X=J.exec($))!==null){if(i$(X.index,X.index+X[0].length,Z))continue;if(Fz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Rz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function Dz($,Z,J){let X=Gz($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-3n0hpd5m.js"));for(let _ of X){let L=_.body;if(T1(_.attrs))L=k1(L);if(Y.test(L)){Q.push({content:L,start:_.start,end:_.end});continue}if(!G(L))continue;try{let w=await z(J2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:_.start,end:_.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((_)=>_.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,H=[];for(let _=0;_<Q.length;_++){let L=Q[_].bundled??J2(Q[_].content).code;if(!Q[_].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Iz(L);let w=e0(L);H.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
3478
+ `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){U++,W++;continue}if(j===")"||j==="]"||j==="}"){U--,W++;continue}if(j===";"&&U===0)return W+1;W++}return Q};while(X<Q){let H=$[X];if(H==="/"&&$[X+1]==="/"){let W=z();J.push($.slice(X,W)),X=W;continue}if(H==="/"&&$[X+1]==="*"){let W=K();J.push($.slice(X,W)),X=W;continue}if(H==='"'||H==="'"||H==="`"){let W=G(H);J.push($.slice(X,W)),X=W;continue}if(H==="{"){Y++,J.push(H),X++;continue}if(H==="}"){Y--,J.push(H),X++;continue}if(Y===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(H),X++}return J.join("")}var Fz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function i$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function _z($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!i$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function wz($,Z){if(_z($,"<body",Z)){let Y=new RegExp(`<body(${p$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!i$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${p$})>`,"gi"),X;while((X=J.exec($))!==null){if(i$(X.index,X.index+X[0].length,Z))continue;if(Fz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Rz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function Dz($,Z,J){let X=Gz($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-hyrm54da.js"));for(let _ of X){let L=_.body;if(T1(_.attrs))L=k1(L);if(Y.test(L)){Q.push({content:L,start:_.start,end:_.end});continue}if(!G(L))continue;try{let w=await z(J2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:_.start,end:_.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((_)=>_.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,H=[];for(let _=0;_<Q.length;_++){let L=Q[_].bundled??J2(Q[_].content).code;if(!Q[_].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Iz(L);let w=e0(L);H.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
3479
3479
  ${w}`)}let W=H.join(`
3480
3480
 
3481
3481
  `);W=Oz(W);let U=Nz(W),j=U.split(",").map((_)=>_.trim()).filter(Boolean),B=n$(W,J),V=`
@@ -3510,13 +3510,13 @@ ${K.join(`
3510
3510
  Tip: prefer useRef(), navigate(), and composables for component code`;if(e$.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}hz();import Z3 from"path";var xz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,fz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function gz($,Z){if(!Z||!$.includes("/"))return $;let J=Z3.dirname(Z);return $.replace(xz,(X,Y,Q,G)=>{let z=Z3.resolve(J,G);return`${Y}${Q}${z.split(Z3.sep).join("/")}${Q}`})}function g8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(fz,(J,X,Y,Q)=>`${X}${gz(Y,Z)}${Q}`)}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";function h8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function GZ($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
3511
3511
  `,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let H=$[K];if(H==="\\"){K+=2;continue}if(H==="[")q=!0;else if(H==="]")q=!1;else if(H==="/"&&!q){K++;break}else if(H===`
3512
3512
  `){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
3513
- `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function zZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function u8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await s("stx/client-module-registry",()=>import("./chunk-hs1azpgz.js")),Q=[],G=await Y(X(...$),{minify:Z.buildMode==="compile",collectInputs:Q});for(let z of Q)J?.add(z);if(!G)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-kzg9gjmy.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(G)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${G.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function mz($,Z=""){let J=zZ($,"data-stx-runtime");if(!J)return $;let X=j2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3513
+ `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function zZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function u8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await s("stx/client-module-registry",()=>import("./chunk-atf4tj9y.js")),Q=[],G=await Y(X(...$),{minify:Z.buildMode==="compile",collectInputs:Q});for(let z of Q)J?.add(z);if(!G)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-6tk817fg.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(G)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${G.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function mz($,Z=""){let J=zZ($,"data-stx-runtime");if(!J)return $;let X=j2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3514
3514
  `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=j2(Q);if(G===-1)return Y+Z+`
3515
3515
  `+Q;return Q.slice(0,G)+Y+Z+`
3516
3516
  `+Q.slice(G)}async function X3($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;f$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await c9(Z,J,X.runtimeConfig);if(Q)T3(Z),Z.__stx_head_injections=C$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!y2()&&!C2())&&J&&J.endsWith(".stx"))ZZ($,J);try{return await a8.timeAsync("template-processing",async()=>{let G=await dz($,Z,J,X,Y);if(Q)G=t$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??$Z(),H=(Z.__stx_head_raw||"").trim(),W,U=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)W=U[1].trim(),H=H.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||W||j,V=!q.title&&(!!W||!!j),F=q.meta||[],O=new Set(F.map((M)=>$2(M)).filter(Boolean)),_={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!O.has($2(M))),...F],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
3517
3517
  `),...q.htmlAttrs&&{htmlAttrs:a6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=d$(G);if(G=$8(G,_,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=e6(G,z),G=t6(G,_.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=o8(M);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3518
3518
  <meta name="stx-layout" content="${h8(M)}">
3519
- <meta name="stx-layout-group" content="${h8(T)}">`)}let D=G.match(/function (__stx_setup_\w+)\(/),R=D?i0(G):null;if(D&&R&&!/\bdata-stx=/.test(R.tag)){G=x1(G,(T,N)=>`<body${N} data-stx="${D[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${D[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??C$(),K=u$(G);if(K!==null)z.beforeClose.push(K);let q=x$(G);if(q!==null)z.afterOpen.push(q);G=f6(G,z);let H=X.app?.colorMode;if(H)G=u6(G,H)}if(Q)if(zZ(G,"data-stx-runtime")){let K=null,q=null,H=null,W=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-q92wr6a0.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await u8([G,q],X,Y);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-mwj6w2r7.js"));W=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-egnck8vx.js")),B=X.composablesDir,V=[K,q,W].filter((O)=>O!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)H=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${F}</script>`}catch{}let U=[K,q,H,W].filter((j)=>j!==null).map((j)=>`
3519
+ <meta name="stx-layout-group" content="${h8(T)}">`)}let D=G.match(/function (__stx_setup_\w+)\(/),R=D?i0(G):null;if(D&&R&&!/\bdata-stx=/.test(R.tag)){G=x1(G,(T,N)=>`<body${N} data-stx="${D[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${D[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??C$(),K=u$(G);if(K!==null)z.beforeClose.push(K);let q=x$(G);if(q!==null)z.afterOpen.push(q);G=f6(G,z);let H=X.app?.colorMode;if(H)G=u6(G,H)}if(Q)if(zZ(G,"data-stx-runtime")){let K=null,q=null,H=null,W=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-pbt7f5h9.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await u8([G,q],X,Y);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-mks2cgty.js"));W=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-77g77ygz.js")),B=X.composablesDir,V=[K,q,W].filter((O)=>O!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)H=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${F}</script>`}catch{}let U=[K,q,H,W].filter((j)=>j!==null).map((j)=>`
3520
3520
  ${j}`).join("");G=mz(G,U)}else{let K=await u8([G],X,Y);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
3521
3521
  `+G.slice(q)}}if(Q)G=m6(G);if(Q&&Z.__stx_inject_css!==!1)G=await e8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=t8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=r8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=i6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof c8)throw G;let z=G instanceof Error?G.message:String(G),K=new f2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(s0.log(K,{filePath:J,context:Z}),i8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return p8.createFallbackContent("Template Processing",K)}}async function dz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!y0.isAbsolute(X.partialsDir)?y0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!y0.isAbsolute(X.componentsDir)?y0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!y0.isAbsolute(X.layoutsDir)?y0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await pz(J,Z),cz(Z,z),K=await g2(()=>I6(K,Z,J,z),K,(L)=>{s0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=V1(K,E9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let H=q.tokens,W=(L)=>H.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,D)=>H[Number(D)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=y6(K),K=await E8(K,J,Y);let j={};K=I$(K,j);let B={...Z.__sections||{}},V="",F=W4(q4($)),O=/@nolayout\b/.test(K)||F===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let _=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)V=_[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(K))K=`@section('content')
3522
3522
  ${K.trim()}
@@ -3525,7 +3525,7 @@ ${K.trim()}
3525
3525
  @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,D)=>{return B[w]=D,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,D)=>{if(/^(['"]).*\1$/.test(D.trim()))return L;try{let R=X0(D.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,D)=>{if(D.includes("@parent"))B[w]=D.replace("@parent",C1);else B[w]=D.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,D)=>{return B[w]||D||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=T$(K,j),V){let L=[],w=u0(K),D=V1(w.output,Z9,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=D.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let N=M==="SCRIPT"?iz(w.scripts[Number(T)],J):D.tokens[Number(T)];if(N)L.push(N);return""}),L.length>0){let R=L.join(`
3526
3526
  `);B.content=B.content?`${B.content}
3527
3527
  ${R}`:R,Z.__sections=B}}if(V)try{let L;if(y0.isAbsolute(V))L=V,Y.add(V);else L=await g2(()=>K9(V,J,G,Y),null,()=>{throw new f2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let N=(A)=>{if(!A)return[];try{let k=y0.isAbsolute(A)?A:y0.resolve(process.cwd(),A);return uz.readdirSync(k).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((A,k,C)=>C.indexOf(A)===k).sort(),E=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(s0.log(Error(E),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${E}`),G.debug)throw new f2(E,J);return K}let w=await g2(()=>Bun.file(L).text(),"",()=>{throw new f2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=g8(w,L);let D=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(D){if(G.debug)console.log(`Found nested layout: ${D[1]} in ${L}`);let N={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,C,y)=>{return N[C]=y.trim(),""});for(let[k,C]of Object.entries(N))if(B[k]&&B[k].includes(C1)){let y=B[k].indexOf(C1);B[k]=B[k].slice(0,y)+C+B[k].slice(y+C1.length)}else if(!B[k])B[k]=C;let E={...Z,__sections:B},A=`@layout('${D[1]}')${I}`;return await X3(A,E,L,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=I$(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,I,E)=>{return T[I]=E.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,I,E)=>{if(B[I]){let A=B[I];if(A.includes(C1)){let k=T[I]||"",C=A.indexOf(C1);A=A.slice(0,C)+k+A.slice(C+C1.length)}return A}return E||""}),M=lz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=T$(M,j),Z.__originalFilePath=J,K=await l8(M,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
3528
- ${K}`,W(K)}catch(L){return s0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return W(await l8(K,Z,J,G,Y))}function lz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function cz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function pz($,Z){await g2(()=>E6($,Z),void 0,(J)=>{s0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var J3="data-stx-source";function iz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(J3))return $;return`<script ${J3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function nz($){let Z=new RegExp(`${J3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function m8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function d8($,Z,J){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${m8($)}</span><span style="display:block;margin-top:4px">${m8(J)}</span></div>`}async function sz($,Z,J){let{scanScriptTags:X}=await s("stx/signal-processing",()=>import("./chunk-9y0btmfc.js")),Y=[],Q=!y2()&&!C2();for(let z of X($)){let K=z.attrs;if(!/\bserver\b/.test(K))continue;let q=z.start+z.fullMatch.indexOf(">")+1,H=GZ($,q);if(H===-1)continue;let W=$.slice(q,H);if(!W.trim())continue;let U=nz(K)??J,j={index:z.start,length:H+9-z.start};try{let{extractVariables:B}=await s("stx/variable-extractor",()=>import("./chunk-yvv9qjcd.js"));await B(W,Z,U,{preserveExisting:!0,onFailure:(V)=>{if(!Q||V.kind==="unknown")return;Y.push({...j,markup:d8(U,V.kind,V.message)})}})}catch(B){let V=B instanceof Error?B:Error(String(B));if(s0.log(V,{filePath:U,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${U}: ${V.message}`),Q)Y.push({...j,markup:d8(U,"unknown",V.message)})}}if(Y.length===0)return $;let G=$;for(let z of Y.sort((K,q)=>q.index-K.index))G=G.slice(0,z.index)+z.markup+G.slice(z.index+z.length);return G}async function oz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-5fqs93qg.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return s0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function l8($,Z,J,X,Y){let Q=$,G=X;if(Q=await sz(Q,Z,J),Q=await oz(Q,Z,J),Q=await U6(Q,Z,J),Q=await j6(Q,Z,J),Q=await V7(Q,Z,J,G),X1(Q))Q=R8(Q,Z),Q=o$(Q,Z);Q=N8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-2bsaq9kq.js"));Q=z(Q,Z),Q=R6(Q,Z,J,G,!0),Q=await v6(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Q=K4(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-93z5qt1s.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-zxf0deg6.js"));Q=q(Q,Z,J);let{processTransitionDirectives:H,processTransitionAttributes:W}=await s("stx/transitions",()=>import("./chunk-a5cybvfv.js"));Q=H(Q,Z,J),Q=W(Q);let{processErrorBoundaryDirectives:U,stripRenderFailedMarkers:j}=await s("stx/error-boundaries",()=>import("./chunk-vcdd231w.js"));Q=U(Q,Z,J),Q=j(Q);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-83af26bs.js"));Q=B(Q,Z,J);let{processAsyncDirectives:V}=await s("stx/async-components",()=>import("./chunk-pt74619a.js"));Q=V(Q,Z,J);let{processKeepAliveDirectives:F}=await s("stx/keep-alive",()=>import("./chunk-175da6nh.js"));Q=F(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:_,processInfiniteListDirectives:L}=await s("stx/virtual-scrolling",()=>import("./chunk-1c2k7713.js"));Q=O(Q,Z,J),Q=_(Q,Z,J),Q=L(Q,Z,J);let{processPartialHydrationDirectives:w,processStaticDirectives:D}=await s("stx/partial-hydration",()=>import("./chunk-r55bx7r8.js"));Q=w(Q,Z,J),Q=D(Q);let{processComputedDirectives:R,processWatchDirectives:M}=await s("stx/computed",()=>import("./chunk-k11mck47.js"));Q=R(Q,Z,J),Q=M(Q,Z,J);let{processFormValidationDirectives:T}=await s("stx/forms-validation",()=>import("./chunk-5mjz2qgs.js"));Q=T(Q,Z,J);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:E,resetHead:A}=await s("stx/head",()=>import("./chunk-vj5ywxmb.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)A();let k=N(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
3528
+ ${K}`,W(K)}catch(L){return s0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return W(await l8(K,Z,J,G,Y))}function lz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function cz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function pz($,Z){await g2(()=>E6($,Z),void 0,(J)=>{s0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var J3="data-stx-source";function iz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(J3))return $;return`<script ${J3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function nz($){let Z=new RegExp(`${J3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function m8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function d8($,Z,J){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${m8($)}</span><span style="display:block;margin-top:4px">${m8(J)}</span></div>`}async function sz($,Z,J){let{scanScriptTags:X}=await s("stx/signal-processing",()=>import("./chunk-1q2b0r3v.js")),Y=[],Q=!y2()&&!C2();for(let z of X($)){let K=z.attrs;if(!/\bserver\b/.test(K))continue;let q=z.start+z.fullMatch.indexOf(">")+1,H=GZ($,q);if(H===-1)continue;let W=$.slice(q,H);if(!W.trim())continue;let U=nz(K)??J,j={index:z.start,length:H+9-z.start};try{let{extractVariables:B}=await s("stx/variable-extractor",()=>import("./chunk-n5791wn3.js"));await B(W,Z,U,{preserveExisting:!0,onFailure:(V)=>{if(!Q||V.kind==="unknown")return;Y.push({...j,markup:d8(U,V.kind,V.message)})}})}catch(B){let V=B instanceof Error?B:Error(String(B));if(s0.log(V,{filePath:U,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${U}: ${V.message}`),Q)Y.push({...j,markup:d8(U,"unknown",V.message)})}}if(Y.length===0)return $;let G=$;for(let z of Y.sort((K,q)=>q.index-K.index))G=G.slice(0,z.index)+z.markup+G.slice(z.index+z.length);return G}async function oz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-bh1m0x85.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return s0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function l8($,Z,J,X,Y){let Q=$,G=X;if(Q=await sz(Q,Z,J),Q=await oz(Q,Z,J),Q=await U6(Q,Z,J),Q=await j6(Q,Z,J),Q=await V7(Q,Z,J,G),X1(Q))Q=R8(Q,Z),Q=o$(Q,Z);Q=N8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-syy0njsk.js"));Q=z(Q,Z),Q=R6(Q,Z,J,G,!0),Q=await v6(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Q=K4(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-93z5qt1s.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-zxf0deg6.js"));Q=q(Q,Z,J);let{processTransitionDirectives:H,processTransitionAttributes:W}=await s("stx/transitions",()=>import("./chunk-a5cybvfv.js"));Q=H(Q,Z,J),Q=W(Q);let{processErrorBoundaryDirectives:U,stripRenderFailedMarkers:j}=await s("stx/error-boundaries",()=>import("./chunk-vcdd231w.js"));Q=U(Q,Z,J),Q=j(Q);let{processSuspenseDirectives:B}=await s("stx/suspense",()=>import("./chunk-83af26bs.js"));Q=B(Q,Z,J);let{processAsyncDirectives:V}=await s("stx/async-components",()=>import("./chunk-pt74619a.js"));Q=V(Q,Z,J);let{processKeepAliveDirectives:F}=await s("stx/keep-alive",()=>import("./chunk-175da6nh.js"));Q=F(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:_,processInfiniteListDirectives:L}=await s("stx/virtual-scrolling",()=>import("./chunk-1c2k7713.js"));Q=O(Q,Z,J),Q=_(Q,Z,J),Q=L(Q,Z,J);let{processPartialHydrationDirectives:w,processStaticDirectives:D}=await s("stx/partial-hydration",()=>import("./chunk-r55bx7r8.js"));Q=w(Q,Z,J),Q=D(Q);let{processComputedDirectives:R,processWatchDirectives:M}=await s("stx/computed",()=>import("./chunk-k11mck47.js"));Q=R(Q,Z,J),Q=M(Q,Z,J);let{processFormValidationDirectives:T}=await s("stx/forms-validation",()=>import("./chunk-55k6352k.js"));Q=T(Q,Z,J);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:E,resetHead:A}=await s("stx/head",()=>import("./chunk-vj5ywxmb.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)A();let k=N(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
3529
3529
  `;if(Q=I(Q,Z),Q=E(Q,Z,J),Q=k6(Q),Q=d5(Q,Z),Q=U7(Q),Q=M6(Q),Q=await A$(Q,Z,J,G,Y),Q=await D$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=k3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=t$(Q),Q=t0(Q,Z,J),Q=E$(Q),Q=U4(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=l5(Q,Z),Q=c5(Q,Z),Q=M2(Q,Z),Q=a5(Q,Z),Q=t5(Q,Z),Q=await $7(Q,Z,J,G),Q=await _4(Q,Z,J),Q=await n8(Q,Z,J,G),Q=s8(Q,Z,J,G),Q=JZ(Q,Z,J,G),Q=XZ(Q,Z,J),Q=YZ(Q,Z,J,G),Q=W7(Q,Z,J,G),Q=r$(Q,Z),Q=a$(Q),Q=C8(Q),!G.skipEventDirectives)Q=M3(Q,Z,J);if(Q=V4(Q,Z,J),G.debug){let f=/\bx-data\s*=/.test(Q),l=s$($);if(f&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3530
3530
  Both work on the same page, but they manage separate scopes.
3531
3531
  Prefer signals (state/derived/effect) for new components.`)}Q=e7(Q,Z),Q=await L1(Q,Z,J),Q=x8(Q),Q=f8(Q),Q=$4(Q);let{processXElementDirectives:C}=await s("stx/x-element",()=>import("./chunk-2c907a77.js"));Q=C(Q);let y=Z.__originalFilePath||J,b=m9(Z);if(Q=await M8(Q,G,y,b),Q=_7(Q,Z),Q=await T6(Q,Z,J,G),G.media?.image?.autoSiblings){let f=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gzr4mcp2.js"));Q=await l(Q,{publicDir:f})}if(G.seo?.enabled)Q=QZ(Q,Z,G);let P=(f,l,Z0=!0)=>{if(!l)return f;let j0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),_0=f.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&_0){if(Z0)f=f.replace(_0[0],j0[0]);if(l=l.replace(j0[0],"").trim(),!l)return f}if(/<\/head>/i.test(f))return f.replace(/<\/head>/i,`${l}
@@ -3539,7 +3539,7 @@ ${a3()}
3539
3539
  `+B1}else Q=Q.replace("</head>",`${l}
3540
3540
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3541
3541
  ${l}`);else Q=l+`
3542
- `+Q}{let{scanScriptTags:f}=await s("stx/signal-processing",()=>import("./chunk-9y0btmfc.js")),l=[];for(let Z0 of f(Q)){if(!/\bserver\b/i.test(Z0.attrs))continue;let j0=Z0.start+Z0.fullMatch.indexOf(">")+1,_0=GZ(Q,j0);if(_0===-1)continue;let Q0=_0+9;while(Q0<Q.length&&/\s/.test(Q[Q0]))Q0++;l.push({start:Z0.start,end:Q0})}if(l.length>0){let Z0=Array(l.length+1),j0=0;for(let _0=0;_0<l.length;_0++){let{start:Q0,end:B1}=l[_0];Z0[_0]=Q.slice(j0,Q0),j0=B1}Z0[l.length]=Q.slice(j0),Q=Z0.join("")}}let W0=l9(Q,J);if(W0.hasScoped)Q=W0.html;let a=Z.__stx_event_bindings||[],L0=!1,c0=[],p0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:g0}=await s("stx/signal-processing",()=>import("./chunk-9y0btmfc.js"));for(let f of g0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:l,content:Z0}of c0){L0=!0;let j0=Z0;$3(Z0,J,X.strict,Z.__originalFilePath);let _0=await d9(Z0,{eventBindings:a,attrs:l,hasColonDirectives:p0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(f,()=>_0)}if(L0)Z.__stx_event_bindings=[];if(!L0&&Z.__stxProcessingDepth===1){let f=Z.__stx_event_bindings||[];if(f.length>0){let l=X5(f);if(l){let Z0=Q.lastIndexOf("</body>");Q=Z0===-1?Q+l:Q.slice(0,Z0)+l+`
3542
+ `+Q}{let{scanScriptTags:f}=await s("stx/signal-processing",()=>import("./chunk-1q2b0r3v.js")),l=[];for(let Z0 of f(Q)){if(!/\bserver\b/i.test(Z0.attrs))continue;let j0=Z0.start+Z0.fullMatch.indexOf(">")+1,_0=GZ(Q,j0);if(_0===-1)continue;let Q0=_0+9;while(Q0<Q.length&&/\s/.test(Q[Q0]))Q0++;l.push({start:Z0.start,end:Q0})}if(l.length>0){let Z0=Array(l.length+1),j0=0;for(let _0=0;_0<l.length;_0++){let{start:Q0,end:B1}=l[_0];Z0[_0]=Q.slice(j0,Q0),j0=B1}Z0[l.length]=Q.slice(j0),Q=Z0.join("")}}let W0=l9(Q,J);if(W0.hasScoped)Q=W0.html;let a=Z.__stx_event_bindings||[],L0=!1,c0=[],p0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:g0}=await s("stx/signal-processing",()=>import("./chunk-1q2b0r3v.js"));for(let f of g0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:l,content:Z0}of c0){L0=!0;let j0=Z0;$3(Z0,J,X.strict,Z.__originalFilePath);let _0=await d9(Z0,{eventBindings:a,attrs:l,hasColonDirectives:p0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(f,()=>_0)}if(L0)Z.__stx_event_bindings=[];if(!L0&&Z.__stxProcessingDepth===1){let f=Z.__stx_event_bindings||[];if(f.length>0){let l=X5(f);if(l){let Z0=Q.lastIndexOf("</body>");Q=Z0===-1?Q+l:Q.slice(0,Z0)+l+`
3543
3543
  `+Q.slice(Z0)}Z.__stx_event_bindings=[]}}if(!z8(Q)&&K8(Q))Q=await f9(Q,G);if(Q=q8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=q7(Q,Z.cspNonce);return Q}import DZ from"path";import Q3 from"fs";import h2 from"path";function KZ($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function rz($){let Z=z0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function Y3($,Z){let J=z0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=KZ(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=KZ(J,Q,"(",")");if(z>=0)return{type:G,args:rz($.slice(Q+1,z))}}return null}var qZ=`
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;
@@ -3601,8 +3601,8 @@ ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function xZ($,Z){let J=X0($,Z)??X0(
3601
3601
  `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let H=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let B=H[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function Xq($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Yq($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Qq($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of Xq(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let H=Yq(q);if(H===-1)continue;let W=q.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let U=q.slice(H+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(z2),B=Function(...j,`"use strict"; return (${U});`);Z[W]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var Gq=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function zq($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!J)return null;let X=J[2].toLowerCase();if(!Gq.has(X))return null;if(($.match(new RegExp(`<${X}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${X}>\\s*$`,"i").test($))return null;let Q=J[0].length;return $.slice(0,Q)+Z+$.slice(Q)}async function T9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],H=typeof Y.root==="string"?g.resolve(Y.root):void 0,W=H??g.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),H)j(g.resolve(H,"resources/views/components")),j(g.resolve(H,"resources/components")),j(g.resolve(H,"src/components")),j(g.resolve(H,"components"));for(let O of Y._layerComponentDirs??[])j(O);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(g.resolve(g.dirname(X),`${Q}.stx`));let F=aZ(g.resolve(import.meta.dir,"components"));for(let O of U){let _=g.isAbsolute(O)?O:g.resolve(W,O);if(aZ(_)===F)continue;for(let L of q)if(await t(g.join(_,L)))return!0}return!1}function aZ($){try{return YJ.realpathSync($)}catch{return $}}function Kq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function qq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Wq($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Y,Q)=>{let G;try{G=C0(Y,Z)}catch{return Q}if(G===void 0||G===null)return"";let z=String(G);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${J??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return $.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>X(Q,Y)).replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>X(Q,Y))}var tZ=new Set;function eZ($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&tZ.has(Y))return;tZ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
3602
3602
  searched:
3603
3603
  ${J.map((K)=>` - ${K}`).join(`
3604
- `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function $J($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Hq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function I1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-yvv9qjcd.js")),H=z??new Set;if(H.has($))return`[Circular component reference: ${$}]`;let W=new Set(H);W.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&Kq(U)?U:"";try{let B=(m)=>m.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(m)=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,O=null,_=Y.__importedComponents;if(_){let m=[F,F.toLowerCase(),B(F),V(F)];for(let c of m)if(_.has(c)){O=_.get(c);break}}let L=[];if(!O){let m=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,o=[];if(o.push(...G._layerComponentDirs??[]),G0){let A0=g.join(g.dirname(G0),"components");o.push(A0)}if(X)o.push(X);let w0=G._rootComponentsDir;if(typeof w0==="string"&&!o.includes(w0))o.push(w0);let q0=g.join(g.dirname(Q),"components");if(!o.includes(q0))o.push(q0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let P0=typeof G.root==="string"?g.resolve(G.root):void 0,J1=P0??g.dirname(Q),n=[];if(P0)n.push(g.resolve(P0,"resources/views/components")),n.push(g.resolve(P0,"resources/components")),n.push(g.resolve(P0,"src/components")),n.push(g.resolve(P0,"components"));n.push(g.resolve(import.meta.dir,"components"));for(let A0 of n)if(!o.includes(A0))o.push(A0);let h0=G._pluginComponentDirs;if(Array.isArray(h0)){for(let A0 of h0)if(typeof A0==="string"&&!o.includes(A0))o.push(A0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let P1=[...new Set(o.map((A0)=>{if(!A0)return A0;return g.isAbsolute(A0)?A0:g.resolve(J1,A0)}))];o.length=0,o.push(...P1);let v1=`${F}\x00${Q}\x00${P1.join("\x00")}`,t9=s9.get(v1);if(t9)if(await t(t9))O=t9;else s9.delete(v1);if(!O&&(F.startsWith("./")||F.startsWith("../")))O=g.resolve(g.dirname(Q),`${F}.stx`),L.push(O);else if(!O)for(let A0 of o){if(!A0)continue;for(let p2 of c){let i2=g.join(A0,p2);if(L.push(i2),await t(i2)){O=i2;break}}if(O)break;if(!O)try{let p2=await import("fs");if(!p2.statSync(A0,{throwIfNoEntry:!1})?.isDirectory())continue;let BJ=8,e9=[{path:A0,depth:0}];while(e9.length>0&&!O){let n2=e9.pop();if(n2.depth>=BJ)continue;let L3;try{L3=p2.readdirSync(n2.path,{withFileTypes:!0})}catch{continue}for(let s2 of L3){if(!s2.isDirectory())continue;if(s2.name==="node_modules"||s2.name.startsWith("."))continue;let O3=g.join(n2.path,s2.name);for(let VJ of c){let $5=g.join(O3,VJ);if(L.push($5),await t($5)){O=$5;break}}if(O)break;e9.push({path:O3,depth:n2.depth+1})}}}catch{}if(O)break}if(O)s9.set(v1,O)}if(!O||!await t(O))return eZ($,Q,L),$J($);K.add(O);let w;if(d2.has(O))w=d2.get(O);else try{w=await Bun.file(O).text(),d2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return eZ($,Q,[O],c),$J($)}let D=new Set(["__originalFilePath","__importedComponents",r2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||D.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-3fd7w2va.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),N=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",o=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",w0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),q0=!w0||["module","text/javascript","application/javascript"].includes(w0);if(!/\bserver\b/i.test(o)&&q0)return N.push(G0),"";return G0}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-4my2kn5x.js")),A=E(I),k={};if(A.defaultSlot?.trim())k.default=A.defaultSlot;for(let[m,c]of A.namedSlots)k[m]=c.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:k,__processedComponents:W,__sections:{},__stx_signals_gate:X1(w)||qq(J)};Qq(w,b);let P=w,h=O9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(p)],r=[],e=null,Y0=u.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),i=null,W0=null,a=null,L0=0,c0=null;if(tK(G),Y0&&U3>0){let m=eK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){i=`${O}\x00${U1(w)}\x00${m}`;let c=o9.get(i);if(c){for(let G0 of c.dependencies)K.add(G0);if(y3(Y,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of c.preservedClientExpressions)G0.add(o);Y.__stx_preserved_client_expressions=[...G0]}return c.output}W0=new Set(K),a=E3(Y),L0=C.n,c0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let p0=new Set;for(let m of u){let c=m[1]||"",G0=m[2]||"",o=c.includes("server");if(T1(c)&&G0.trim())G0=k1(G0);if(o&&G0){for(let q0 of j1(G0))p0.add(q0);try{await q(G0,b,O,{onFailure:(q0)=>{if(q0.kind!=="unknown")e=q0.kind}})}catch(q0){}}if(!o){let q0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=q0.includes("{{")&&q0.includes("}}"),J1=q0.includes("{!!")&&q0.includes("!!}");if(P0||J1)q0=H5(q0,b,O);let n=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${n}>${q0}</script>`)}}let f=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),l=f?f[1]:"",Z0=f?f[2]:"",j0="",_0=l&&/\bscoped\b/i.test(l);if(f)j0=`<style${l}>${Wq(Z0,b,O)}</style>`;let Q0=P;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(Q0=Q0.replace(m,(G0,o)=>{let w0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(w0)c.push(`<style${w0[1]}>${w0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)j0=`${j0}${c.join(`
3605
- `)}`}if(J&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B1}=await s("stx/slots",()=>import("./chunk-4my2kn5x.js")),{defaultSlot:r9,namedSlots:a9}=A,S=r.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),v=(m)=>S?S8(m,y):m,d=new Map([...a9].map(([m,c])=>[m,{...c,content:v(c.content)}]));Q0=await B1(Q0,v(r9),d,b);let J0=Hq(r),H0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!p0.has(m));if(J0.length>0||H0.length>0)b.__stx_client_signal_names=[...new Set([...H0,...J0])];else delete b.__stx_client_signal_names;let k0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:S||r.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r0=await X3(Q0,b,O,k0,K),c2=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of r0.matchAll(/\{\{([\s\S]*?)\}\}/g))c2.add(m[1].trim());if(c2.size>0)Y.__stx_preserved_client_expressions=[...c2];let Z1=y,b0=r0;if(S){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${oZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${oZ(j)}"`:"",G0=` data-stx-scope="${Z1}"${m}${c}`;b0=zq(r0,G0)??`<div${G0}>${r0}</div>`;let o=await Promise.all(r.map(async(w0)=>{let q0=w0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!q0)return w0;let[,P0,J1]=q0,{vendorStyleTags:n,factoryBody:h0}=await Bq(J1,O,G.buildMode==="compile"),P1=j?null:Y5(Y,h0),v1=P1?`window.__stxComponentFactories[${JSON.stringify(P1)}](${JSON.stringify(Z1)});`:`(${h0})(${JSON.stringify(Z1)});`;if(j)return`${n}<script type="stx/island" data-stx-island="${Z1}" data-stx-scoped data-stx-owner="${Z1}"${P0}>${v1}</script>`;return`${n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Z1}"${P0}>${v1}</script>`}));if(b0=b0+`
3604
+ `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function $J($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Hq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function I1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-n5791wn3.js")),H=z??new Set;if(H.has($))return`[Circular component reference: ${$}]`;let W=new Set(H);W.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&Kq(U)?U:"";try{let B=(m)=>m.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(m)=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,O=null,_=Y.__importedComponents;if(_){let m=[F,F.toLowerCase(),B(F),V(F)];for(let c of m)if(_.has(c)){O=_.get(c);break}}let L=[];if(!O){let m=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,o=[];if(o.push(...G._layerComponentDirs??[]),G0){let A0=g.join(g.dirname(G0),"components");o.push(A0)}if(X)o.push(X);let w0=G._rootComponentsDir;if(typeof w0==="string"&&!o.includes(w0))o.push(w0);let q0=g.join(g.dirname(Q),"components");if(!o.includes(q0))o.push(q0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let P0=typeof G.root==="string"?g.resolve(G.root):void 0,J1=P0??g.dirname(Q),n=[];if(P0)n.push(g.resolve(P0,"resources/views/components")),n.push(g.resolve(P0,"resources/components")),n.push(g.resolve(P0,"src/components")),n.push(g.resolve(P0,"components"));n.push(g.resolve(import.meta.dir,"components"));for(let A0 of n)if(!o.includes(A0))o.push(A0);let h0=G._pluginComponentDirs;if(Array.isArray(h0)){for(let A0 of h0)if(typeof A0==="string"&&!o.includes(A0))o.push(A0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let P1=[...new Set(o.map((A0)=>{if(!A0)return A0;return g.isAbsolute(A0)?A0:g.resolve(J1,A0)}))];o.length=0,o.push(...P1);let v1=`${F}\x00${Q}\x00${P1.join("\x00")}`,t9=s9.get(v1);if(t9)if(await t(t9))O=t9;else s9.delete(v1);if(!O&&(F.startsWith("./")||F.startsWith("../")))O=g.resolve(g.dirname(Q),`${F}.stx`),L.push(O);else if(!O)for(let A0 of o){if(!A0)continue;for(let p2 of c){let i2=g.join(A0,p2);if(L.push(i2),await t(i2)){O=i2;break}}if(O)break;if(!O)try{let p2=await import("fs");if(!p2.statSync(A0,{throwIfNoEntry:!1})?.isDirectory())continue;let BJ=8,e9=[{path:A0,depth:0}];while(e9.length>0&&!O){let n2=e9.pop();if(n2.depth>=BJ)continue;let L3;try{L3=p2.readdirSync(n2.path,{withFileTypes:!0})}catch{continue}for(let s2 of L3){if(!s2.isDirectory())continue;if(s2.name==="node_modules"||s2.name.startsWith("."))continue;let O3=g.join(n2.path,s2.name);for(let VJ of c){let $5=g.join(O3,VJ);if(L.push($5),await t($5)){O=$5;break}}if(O)break;e9.push({path:O3,depth:n2.depth+1})}}}catch{}if(O)break}if(O)s9.set(v1,O)}if(!O||!await t(O))return eZ($,Q,L),$J($);K.add(O);let w;if(d2.has(O))w=d2.get(O);else try{w=await Bun.file(O).text(),d2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return eZ($,Q,[O],c),$J($)}let D=new Set(["__originalFilePath","__importedComponents",r2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||D.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-7yyfbhna.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),N=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",o=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",w0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),q0=!w0||["module","text/javascript","application/javascript"].includes(w0);if(!/\bserver\b/i.test(o)&&q0)return N.push(G0),"";return G0}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-1nv116m3.js")),A=E(I),k={};if(A.defaultSlot?.trim())k.default=A.defaultSlot;for(let[m,c]of A.namedSlots)k[m]=c.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:k,__processedComponents:W,__sections:{},__stx_signals_gate:X1(w)||qq(J)};Qq(w,b);let P=w,h=O9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(p)],r=[],e=null,Y0=u.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),i=null,W0=null,a=null,L0=0,c0=null;if(tK(G),Y0&&U3>0){let m=eK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){i=`${O}\x00${U1(w)}\x00${m}`;let c=o9.get(i);if(c){for(let G0 of c.dependencies)K.add(G0);if(y3(Y,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of c.preservedClientExpressions)G0.add(o);Y.__stx_preserved_client_expressions=[...G0]}return c.output}W0=new Set(K),a=E3(Y),L0=C.n,c0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let p0=new Set;for(let m of u){let c=m[1]||"",G0=m[2]||"",o=c.includes("server");if(T1(c)&&G0.trim())G0=k1(G0);if(o&&G0){for(let q0 of j1(G0))p0.add(q0);try{await q(G0,b,O,{onFailure:(q0)=>{if(q0.kind!=="unknown")e=q0.kind}})}catch(q0){}}if(!o){let q0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=q0.includes("{{")&&q0.includes("}}"),J1=q0.includes("{!!")&&q0.includes("!!}");if(P0||J1)q0=H5(q0,b,O);let n=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${n}>${q0}</script>`)}}let f=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),l=f?f[1]:"",Z0=f?f[2]:"",j0="",_0=l&&/\bscoped\b/i.test(l);if(f)j0=`<style${l}>${Wq(Z0,b,O)}</style>`;let Q0=P;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(Q0=Q0.replace(m,(G0,o)=>{let w0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(w0)c.push(`<style${w0[1]}>${w0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)j0=`${j0}${c.join(`
3605
+ `)}`}if(J&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B1}=await s("stx/slots",()=>import("./chunk-1nv116m3.js")),{defaultSlot:r9,namedSlots:a9}=A,S=r.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),v=(m)=>S?S8(m,y):m,d=new Map([...a9].map(([m,c])=>[m,{...c,content:v(c.content)}]));Q0=await B1(Q0,v(r9),d,b);let J0=Hq(r),H0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!p0.has(m));if(J0.length>0||H0.length>0)b.__stx_client_signal_names=[...new Set([...H0,...J0])];else delete b.__stx_client_signal_names;let k0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:S||r.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r0=await X3(Q0,b,O,k0,K),c2=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of r0.matchAll(/\{\{([\s\S]*?)\}\}/g))c2.add(m[1].trim());if(c2.size>0)Y.__stx_preserved_client_expressions=[...c2];let Z1=y,b0=r0;if(S){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${oZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${oZ(j)}"`:"",G0=` data-stx-scope="${Z1}"${m}${c}`;b0=zq(r0,G0)??`<div${G0}>${r0}</div>`;let o=await Promise.all(r.map(async(w0)=>{let q0=w0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!q0)return w0;let[,P0,J1]=q0,{vendorStyleTags:n,factoryBody:h0}=await Bq(J1,O,G.buildMode==="compile"),P1=j?null:Y5(Y,h0),v1=P1?`window.__stxComponentFactories[${JSON.stringify(P1)}](${JSON.stringify(Z1)});`:`(${h0})(${JSON.stringify(Z1)});`;if(j)return`${n}<script type="stx/island" data-stx-island="${Z1}" data-stx-scoped data-stx-owner="${Z1}"${P0}>${v1}</script>`;return`${n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Z1}"${P0}>${v1}</script>`}));if(b0=b0+`
3606
3606
  `+o.join(`
3607
3607
  `),j0)b0+=`
3608
3608
  `+j0}else{if(j0)b0+=`
@@ -3625,7 +3625,7 @@ ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
3625
3625
  `,z)H+=`
3626
3626
  ${$0.blue}${$0.bold}Context:${$0.reset}
3627
3627
  ${$0.dim}${z}${$0.reset}
3628
- `;return H}function K_(){d2.clear(),s9.clear(),o9.clear()}function q_(){return{size:d2.size,maxSize:500}}var H3=y1(128);async function Bq($,Z,J){let X=U1($,Z,J),Y=H3.get(X);if(Y){if(XJ(Y.deps))return Y;H3.delete(X)}let Q=B3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=V3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-3n0hpd5m.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-9y0btmfc.js"));G=U(G);let j=e0(G),B=Jq(j),V=`function(__scopeId) {
3628
+ `;return H}function K_(){d2.clear(),s9.clear(),o9.clear()}function q_(){return{size:d2.size,maxSize:500}}var H3=y1(128);async function Bq($,Z,J){let X=U1($,Z,J),Y=H3.get(X);if(Y){if(XJ(Y.deps))return Y;H3.delete(X)}let Q=B3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=V3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-hyrm54da.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-1q2b0r3v.js"));G=U(G);let j=e0(G),B=Jq(j),V=`function(__scopeId) {
3629
3629
  ${o1("const",[...ZJ,...B],j)}
3630
3630
  const __scope = window.stx._scopes = window.stx._scopes || {};
3631
3631
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -3724,7 +3724,7 @@ else {
3724
3724
  // STX: auto-generated event bindings
3725
3725
  ${$.map((J,X)=>bq(J,X)).join(`
3726
3726
  `)}`}function KJ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3727
- `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let H=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=H[0].length;continue}let W=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let U=W[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=W[0].length;continue}}G++}return Z}var Cq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Sq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!Cq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);return Z}async function d9($,Z={}){let J=$,X="",Y=!1,Q=[],G=B3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=V3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:H}=await s("stx/client-script-bundler",()=>import("./chunk-3n0hpd5m.js"));if(q(J))J=await H(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=HJ(J);J=L.code,X=jJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${n$(J,Z.serverData)}${X}`,J=e0(J),!Y&&T1(Z.attrs||""))J=k1(J);let W=yq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3727
+ `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let H=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=H[0].length;continue}let W=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let U=W[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=W[0].length;continue}}G++}return Z}var Cq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Sq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!Cq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);return Z}async function d9($,Z={}){let J=$,X="",Y=!1,Q=[],G=B3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=V3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:H}=await s("stx/client-script-bundler",()=>import("./chunk-hyrm54da.js"));if(q(J))J=await H(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=HJ(J);J=L.code,X=jJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${n$(J,Z.serverData)}${X}`,J=e0(J),!Y&&T1(Z.attrs||""))J=k1(J);let W=yq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3728
3728
  ${Z2(`${X}${J}
3729
3729
  ${W}`)}
3730
3730
  </script>`}let V=qJ($),F=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function _(L){let w=L.length>0?`