@stacksjs/stx 0.2.759 → 0.2.760

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 (99) hide show
  1. package/dist/{chunk-m5fjhrpd.js → chunk-0ggwm837.js} +12 -12
  2. package/dist/{chunk-fpagqrd1.js → chunk-0y2zzqsq.js} +24 -24
  3. package/dist/chunk-1khg5vjs.js +2 -0
  4. package/dist/{chunk-nv9dy71x.js → chunk-2qz891k4.js} +8 -8
  5. package/dist/{chunk-0dkd26t4.js → chunk-30j6mbrf.js} +4 -4
  6. package/dist/{chunk-xcq41ah8.js → chunk-3kmwgpm1.js} +1 -1
  7. package/dist/{chunk-06zn167b.js → chunk-3m9vrhja.js} +2 -2
  8. package/dist/{chunk-5ffdtfwg.js → chunk-3wfewscj.js} +1 -1
  9. package/dist/chunk-5e2ez5n0.js +2 -0
  10. package/dist/{chunk-3ajnrfa2.js → chunk-5vmbycy5.js} +1 -1
  11. package/dist/{chunk-4m8bexrn.js → chunk-76679dw7.js} +7 -7
  12. package/dist/chunk-7kac7hdw.js +2 -0
  13. package/dist/chunk-7nz28a6c.js +16 -0
  14. package/dist/{chunk-geb6zyxg.js → chunk-7v2srnpv.js} +7 -7
  15. package/dist/chunk-8av44gw2.js +2 -0
  16. package/dist/{chunk-mcynmrbe.js → chunk-94ymndc5.js} +5 -5
  17. package/dist/chunk-9epeb4sn.js +2 -0
  18. package/dist/{chunk-qt17792g.js → chunk-9zmb7dcv.js} +1 -1
  19. package/dist/{chunk-6n195hvc.js → chunk-afj19nsj.js} +1 -1
  20. package/dist/chunk-akgt21vw.js +2 -0
  21. package/dist/chunk-b561wv5x.js +2 -0
  22. package/dist/chunk-bfdd0nmc.js +2 -0
  23. package/dist/{chunk-b6g24qj0.js → chunk-bsgg8zzk.js} +1 -1
  24. package/dist/{chunk-90er677t.js → chunk-c9xq89nt.js} +1 -1
  25. package/dist/{chunk-0y44f9rk.js → chunk-cr7mn65s.js} +1 -1
  26. package/dist/{chunk-ny2qzraq.js → chunk-e9kajy9a.js} +1 -1
  27. package/dist/{chunk-76fcwbe1.js → chunk-eazvp48w.js} +1 -1
  28. package/dist/{chunk-k37472gm.js → chunk-ec5q50ve.js} +1 -1
  29. package/dist/{chunk-fhwn8j9p.js → chunk-ec8gn2m0.js} +1 -1
  30. package/dist/{chunk-v20cwjgz.js → chunk-ej1jkt9a.js} +2 -2
  31. package/dist/{chunk-6xt3kvq1.js → chunk-ex2397dc.js} +1 -1
  32. package/dist/chunk-f4j42tsg.js +2 -0
  33. package/dist/{chunk-r5jytt0f.js → chunk-frk6rzrq.js} +1 -1
  34. package/dist/{chunk-x9haxcsj.js → chunk-g4e6egrr.js} +2 -2
  35. package/dist/{chunk-gvaee1w0.js → chunk-gk775pcy.js} +32 -25
  36. package/dist/{chunk-aakkjjgr.js → chunk-ha6tr22a.js} +1 -1
  37. package/dist/{chunk-2x112fxs.js → chunk-hfbzfrpv.js} +1 -1
  38. package/dist/chunk-htc7pasb.js +2 -0
  39. package/dist/{chunk-5q551m4w.js → chunk-jfvr1135.js} +1 -1
  40. package/dist/{chunk-93j4atq9.js → chunk-m220n98m.js} +1 -1
  41. package/dist/{chunk-0jn79fkt.js → chunk-mmdfjmgk.js} +5 -5
  42. package/dist/chunk-mreh1t5x.js +2 -0
  43. package/dist/{chunk-4npabwne.js → chunk-n7s4n62j.js} +2 -2
  44. package/dist/{chunk-79y41h1d.js → chunk-n839v6az.js} +1 -1
  45. package/dist/{chunk-gz38jt5j.js → chunk-n8s5301s.js} +1 -1
  46. package/dist/chunk-py7g5hxd.js +2 -0
  47. package/dist/{chunk-x1q2ape8.js → chunk-q49ykyq9.js} +2 -2
  48. package/dist/{chunk-0e9xdrzx.js → chunk-q9npggak.js} +1 -1
  49. package/dist/{chunk-mmhbn7xt.js → chunk-qvcs4f4v.js} +1 -1
  50. package/dist/{chunk-wp9y6x33.js → chunk-qw9kgzb3.js} +2 -2
  51. package/dist/{chunk-yftw25sa.js → chunk-rcfmwx8r.js} +1 -1
  52. package/dist/{chunk-a5d888es.js → chunk-rprewgyj.js} +1 -1
  53. package/dist/chunk-s0wst4wj.js +2 -0
  54. package/dist/{chunk-00ns0516.js → chunk-se28p2xy.js} +3 -3
  55. package/dist/chunk-stddpecv.js +2 -0
  56. package/dist/{chunk-mgx71bfg.js → chunk-tdjw105v.js} +1 -1
  57. package/dist/chunk-tp2g09ca.js +3 -0
  58. package/dist/{chunk-11kejz35.js → chunk-v5afjcy3.js} +1 -1
  59. package/dist/{chunk-t5gabs4x.js → chunk-vtv7165t.js} +1 -1
  60. package/dist/{chunk-v2egd4zh.js → chunk-vvc39v6p.js} +2 -2
  61. package/dist/{chunk-ghzycypz.js → chunk-wpgq0tq4.js} +1 -1
  62. package/dist/{chunk-hmae7ha6.js → chunk-wz5m7ybz.js} +1 -1
  63. package/dist/{chunk-spjpdymh.js → chunk-xabs41cv.js} +1 -1
  64. package/dist/{chunk-qwds327k.js → chunk-xgegyttg.js} +2 -2
  65. package/dist/{chunk-1mfj2j5g.js → chunk-xsf7ax50.js} +1 -1
  66. package/dist/{chunk-5ge5h2y3.js → chunk-y8srg0q3.js} +3 -3
  67. package/dist/chunk-zg5xh20b.js +2 -0
  68. package/dist/cli.js +8 -8
  69. package/dist/craft-entry.js +1 -1
  70. package/dist/craft.js +1 -1
  71. package/dist/native/compiler/bundle.js +8 -3
  72. package/dist/native/compiler/html-to-ir.js +32 -0
  73. package/dist/native/compiler/render-screen.js +1 -1
  74. package/dist/native/compiler/setup-script.d.ts +1 -0
  75. package/dist/native/compiler/shared-scripts.js +10 -0
  76. package/dist/native/runtime/compact-document.d.ts +20 -0
  77. package/dist/native/runtime/compact-document.js +101 -0
  78. package/dist/pwa.js +1 -1
  79. package/dist/ssg.js +2 -2
  80. package/dist/store-loader.d.ts +1 -1
  81. package/dist/store-loader.js +36 -1
  82. package/package.json +5 -5
  83. package/dist/chunk-055v5qz2.js +0 -2
  84. package/dist/chunk-3jfes9b0.js +0 -2
  85. package/dist/chunk-8n2gj4q2.js +0 -11
  86. package/dist/chunk-cvwn6mga.js +0 -2
  87. package/dist/chunk-davr7z73.js +0 -2
  88. package/dist/chunk-f4mmk2cx.js +0 -2
  89. package/dist/chunk-g387j1qv.js +0 -2
  90. package/dist/chunk-gefpzry6.js +0 -2
  91. package/dist/chunk-mzcbfra0.js +0 -2
  92. package/dist/chunk-pg15tx9c.js +0 -2
  93. package/dist/chunk-ppc5s12t.js +0 -2
  94. package/dist/chunk-qn4gt8sx.js +0 -3
  95. package/dist/chunk-qryg0hgn.js +0 -2
  96. package/dist/chunk-rvc0pb16.js +0 -2
  97. package/dist/chunk-y3jbkk7a.js +0 -2
  98. package/dist/chunk-yv8jeqdn.js +0 -2
  99. package/dist/chunk-zq7g0687.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Tf,is}from"./chunk-0e9xdrzx.js";import"./chunk-qn4gt8sx.js";import"./chunk-sgm6tg8h.js";import"./chunk-3kfbs0mw.js";import{wr}from"./chunk-m5fjhrpd.js";import"./chunk-b6g24qj0.js";import"./chunk-gs373714.js";import{nt}from"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-qwds327k.js";export{nt as freeIdentifiers,is as processComponents,Tf as processESImports,wr as rendersAsElement};
2
+ import{Tf,is}from"./chunk-q9npggak.js";import"./chunk-tp2g09ca.js";import"./chunk-sgm6tg8h.js";import"./chunk-3kfbs0mw.js";import{wr}from"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import{nt}from"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{nt as freeIdentifiers,is as processComponents,Tf as processESImports,wr as rendersAsElement};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Xr}from"./chunk-jevd16gq.js";import{S}from"./chunk-m5fjhrpd.js";import{a}from"./chunk-x1q2ape8.js";import{We,re}from"./chunk-pes27snj.js";import{Va}from"./chunk-wp9y6x33.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var au=`
2
+ import{Xr}from"./chunk-jevd16gq.js";import{S}from"./chunk-0ggwm837.js";import{a}from"./chunk-q49ykyq9.js";import{We,re}from"./chunk-pes27snj.js";import{Va}from"./chunk-qw9kgzb3.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var au=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{fh,Ef,Ge,ec,gh,ns,rs,ss}from"./chunk-2qz891k4.js";import"./chunk-q9npggak.js";import"./chunk-tp2g09ca.js";import"./chunk-sgm6tg8h.js";import"./chunk-3kfbs0mw.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{gh as clearOnceStore,ec as onceStore,Ge as partialsCache,ns as processIncludes,rs as processStackPushDirectives,ss as processStackReplacements,fh as resetUnscopedSignalWarnings,Ef as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ve,js,ig,Nh,ag,Dh,Nt,p,V,Z,bn,xe,cg,fi,lg,Mh,k,ug,Lh,E,jh}from"./chunk-m5fjhrpd.js";import"./chunk-b6g24qj0.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-qwds327k.js";export{ug as applyFilters,Dh as clearCustomFilters,cg as clientLoopScopes,js as defaultFilters,bn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,E as evaluateExpression,ve as findMustacheEnd,ag as getAllFilters,lg as interpolateScriptAttributes,fi as interpolateScriptExpressions,Mh as interpolateScriptsInTemplate,k as processExpressions,ig as registerFilter,Nh as registerFilters,Nt as replaceInterpolations,Lh as resetRejectedExpressionWarnings,jh as unescapeHtml,xe as usesSignalsInScript};
2
+ import{ve,js,ig,Nh,ag,Dh,Nt,p,V,Z,bn,xe,cg,fi,lg,Mh,_,ug,Lh,E,jh}from"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{ug as applyFilters,Dh as clearCustomFilters,cg as clientLoopScopes,js as defaultFilters,bn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,E as evaluateExpression,ve as findMustacheEnd,ag as getAllFilters,lg as interpolateScriptAttributes,fi as interpolateScriptExpressions,Mh as interpolateScriptsInTemplate,_ as processExpressions,ig as registerFilter,Nh as registerFilters,Nt as replaceInterpolations,Lh as resetRejectedExpressionWarnings,jh as unescapeHtml,xe as usesSignalsInScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-x1q2ape8.js";import{uo}from"./chunk-jb1dk0w7.js";import p from"path";async function Zg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(uo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-ppc5s12t.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
2
+ import{a}from"./chunk-q49ykyq9.js";import{uo}from"./chunk-jb1dk0w7.js";import p from"path";async function Zg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(uo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-8av44gw2.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
3
  export{Zg};
@@ -1,25 +1,25 @@
1
1
  // @bun
2
- import{hi,zs,u,f,R,nt,d,Hs,t,c,b}from"./chunk-465resq9.js";import{ve,Rt,J,I,Nt,Z,k}from"./chunk-m5fjhrpd.js";import{sr}from"./chunk-06zn167b.js";import{se}from"./chunk-sgm6tg8h.js";import{ps}from"./chunk-3kfbs0mw.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.exec(n))!==null){let g=i.index+i[0].length,y=i.index+i[0].indexOf("("),x=b(n,"(",")",y);if(x===-1)continue;let p=n.slice(g,x).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=x,l.lastIndex=x}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.exec(e))!==null){let g=o.index,y=g+o[0].length-1,x=1,p=y+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")"){if(x--,x===0)break}p++}if(x!==0)continue;let s=e.substring(y+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let E=a[1],h=s.slice(a[0].length),w=h.match(/^\s*,\s*/);if(!w)continue;let S=h.slice(w[0].length).trim();if(!S)continue;try{let v=R(S,r),W=JSON.stringify(v),F=`@component('${E}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:y,end:x,replacement:p}=i[g];e=e.substring(0,y)+p+e.substring(x)}return e}function oe(n,r,l){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,y=g+i[0].length-1,x=1,p=y+1,s=null,m=!1;while(p<e.length&&x>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")x++;else if(h===")"){if(x--,x===0)break}p++}if(x!==0)break;let a=e.substring(y+1,p),E=l(a);e=e.substring(0,g)+E+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),y=Object.values(r);hi(i);let x=!1,s=d(i,g,()=>{x=!0})(...y);if(x)return e;let m=JSON.stringify(s);if(m===void 0){if(!nt(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.lastIndex,y=!0,x=/^\s*\(/.exec(n.slice(g));if(x){let p=g+x[0].length-1,s=b(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;y=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{y=!1}}if(e+=n.slice(o,i.index),y)return e+(i[1]==="break"?ee:ne);o=g,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Nt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!Hs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!Hs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,l,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let y=[],x=0;for(let s of e)x+=s.delta,y.push({pos:s.pos,depth:x});function p(s){let m=0,a=y.length-1,E=0;while(m<=a){let h=m+a>>1;if(y[h].pos<=s)E=y[h].depth,m=h+1;else a=h-1}return E}while((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[0].length-1,a=1,E=m+1,h=-1;while(E<n.length&&a>0){if(n[E]==="(")a++;else if(n[E]===")"){if(a--,a===0){h=E;break}}E++}if(h===-1)continue;let w=n.substring(m+1,h),S=Rt(w);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,A=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),_=L.exec(n);if(!_)break;if(P&&P.index<_.index)A++,B=P.index+P[0].length;else{if(A--,A===0){V=_.index;break}B=_.index+11}}if(V===-1)continue;let O=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<O.length){let P=O.indexOf("@",N);if(P===-1)break;let _=O.substring(P);if(/^@forelse\s*\(/.test(_))z++,N=P+1;else if(_.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&_.startsWith("@empty")){if(O.length<=P+6||!/[a-z]/i.test(O[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:O.substring(0,U),emptyContent:O.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:y,foreachContent:x,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${y})${x}@endforeach`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${y}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ts(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function rr(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of sr(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function y(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let E=a.index,h=a.index+a[0].length-1,w=1,S=h+1,v=-1;while(S<s.length&&w>0){if(s[S]==="(")w++;else if(s[S]===")"){if(w--,w===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=Rt(W);if(!F)continue;let A=E,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,O=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&O<s.length){K.lastIndex=O,U.lastIndex=O;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,O=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),_=N.index+11;return{start:A,end:_,arrayExpr:B,itemVar:D,content:P}}O=N.index+11}}}return null}function x(s,m){let a=s;while(!0){let E=y(a);if(!E)break;let{start:h,end:w,arrayExpr:S,itemVar:v,content:W}=E;try{let F=S.trim(),A;if(f(F))A=d(F,Object.keys(m))(...Object.values(m));else A=u(F,m);let B=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),B=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),B=!0;else{let _=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+_+a.substring(w);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,O,K=!1;if(L.includes("=>")){let _=L.split("=>").map((j)=>j.trim());if(_.length===2&&_[0]&&_[1])V=_[0],O=_[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let _=L.split(",").map((j)=>j.trim());if(_.length===2&&_[0]&&_[1])O=_[0],V=_[1],K=!0;else O=L}else O=L;let U="",z=new Set(J(`${S} as ${v}`)),N=A,P=m[zs]??new WeakMap;for(let _=0;_<N.length;_++){let j=N[_],te={index:_,iteration:_+1,first:_===0,last:_===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[zs]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[O]=j}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[O]=j}else M[O]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[O]=j[1];else M[V]=_;let C=ce(W,M);C=rr(C,M,l,e,!0),C=se(C,M,l),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=k(C,M,l),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(w)}catch(F){let A=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+A+a.substring(w)}}return a}i=x(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:ts(i)}function Cf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return Hs(n)}function $e(n,r,l,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let y=g.index,x=y+g[0].length-1,p=b(o,"(",")",x);if(p===-1)break;let s=Cf(o.slice(x+1,p)),m=p+1,a=ps(o.slice(y),"for","endfor");if(a.length===0)break;let E=a[0].content,h=y+a[0].end;if(!ge(s)){let w=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,y)+w+o.substring(h),i=!0;continue}try{let w=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(E);if(w.length>0&&S){let D=Re({forExpr:s,content:E,iterVarNames:w,context:r,filePath:l,options:e});o=o.substring(0,y)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(E),B=Function(...v,"__stxRenderLoopValue",`
2
+ import{hi,zs,u,f,R,nt,d,Hs,t,c,b}from"./chunk-465resq9.js";import{ve,Rt,J,I,Nt,Z,_}from"./chunk-0ggwm837.js";import{sr}from"./chunk-3m9vrhja.js";import{se}from"./chunk-sgm6tg8h.js";import{ps}from"./chunk-3kfbs0mw.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.exec(n))!==null){let g=i.index+i[0].length,y=i.index+i[0].indexOf("("),x=b(n,"(",")",y);if(x===-1)continue;let p=n.slice(g,x).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=x,l.lastIndex=x}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.exec(e))!==null){let g=o.index,y=g+o[0].length-1,x=1,p=y+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")"){if(x--,x===0)break}p++}if(x!==0)continue;let s=e.substring(y+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let E=a[1],h=s.slice(a[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let S=h.slice(O[0].length).trim();if(!S)continue;try{let v=R(S,r),W=JSON.stringify(v),F=`@component('${E}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:y,end:x,replacement:p}=i[g];e=e.substring(0,y)+p+e.substring(x)}return e}function oe(n,r,l){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,y=g+i[0].length-1,x=1,p=y+1,s=null,m=!1;while(p<e.length&&x>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")x++;else if(h===")"){if(x--,x===0)break}p++}if(x!==0)break;let a=e.substring(y+1,p),E=l(a);e=e.substring(0,g)+E+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),y=Object.values(r);hi(i);let x=!1,s=d(i,g,()=>{x=!0})(...y);if(x)return e;let m=JSON.stringify(s);if(m===void 0){if(!nt(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.lastIndex,y=!0,x=/^\s*\(/.exec(n.slice(g));if(x){let p=g+x[0].length-1,s=b(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;y=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{y=!1}}if(e+=n.slice(o,i.index),y)return e+(i[1]==="break"?ee:ne);o=g,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Nt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!Hs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!Hs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,l,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let y=[],x=0;for(let s of e)x+=s.delta,y.push({pos:s.pos,depth:x});function p(s){let m=0,a=y.length-1,E=0;while(m<=a){let h=m+a>>1;if(y[h].pos<=s)E=y[h].depth,m=h+1;else a=h-1}return E}while((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[0].length-1,a=1,E=m+1,h=-1;while(E<n.length&&a>0){if(n[E]==="(")a++;else if(n[E]===")"){if(a--,a===0){h=E;break}}E++}if(h===-1)continue;let O=n.substring(m+1,h),S=Rt(O);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,w=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(w>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),A=L.exec(n);if(!A)break;if(P&&P.index<A.index)w++,B=P.index+P[0].length;else{if(w--,w===0){V=A.index;break}B=A.index+11}}if(V===-1)continue;let k=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<k.length){let P=k.indexOf("@",N);if(P===-1)break;let A=k.substring(P);if(/^@forelse\s*\(/.test(A))z++,N=P+1;else if(A.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&A.startsWith("@empty")){if(k.length<=P+6||!/[a-z]/i.test(k[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:k.substring(0,U),emptyContent:k.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:y,foreachContent:x,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${y})${x}@endforeach`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${y}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ts(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function rr(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of sr(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function y(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let E=a.index,h=a.index+a[0].length-1,O=1,S=h+1,v=-1;while(S<s.length&&O>0){if(s[S]==="(")O++;else if(s[S]===")"){if(O--,O===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=Rt(W);if(!F)continue;let w=E,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,k=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&k<s.length){K.lastIndex=k,U.lastIndex=k;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,k=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),A=N.index+11;return{start:w,end:A,arrayExpr:B,itemVar:D,content:P}}k=N.index+11}}}return null}function x(s,m){let a=s;while(!0){let E=y(a);if(!E)break;let{start:h,end:O,arrayExpr:S,itemVar:v,content:W}=E;try{let F=S.trim(),w;if(f(F))w=d(F,Object.keys(m))(...Object.values(m));else w=u(F,m);let B=!1;if(!Array.isArray(w))if(w instanceof Map)w=Array.from(w),B=!0;else if(w instanceof Set)w=Array.from(w);else if(typeof w==="string")w=Array.from(w);else if(w&&typeof w==="object"&&!(w instanceof Date)&&!(w instanceof RegExp))w=Object.entries(w),B=!0;else{let A=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+A+a.substring(O);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,k,K=!1;if(L.includes("=>")){let A=L.split("=>").map((j)=>j.trim());if(A.length===2&&A[0]&&A[1])V=A[0],k=A[1];else k=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let A=L.split(",").map((j)=>j.trim());if(A.length===2&&A[0]&&A[1])k=A[0],V=A[1],K=!0;else k=L}else k=L;let U="",z=new Set(J(`${S} as ${v}`)),N=w,P=m[zs]??new WeakMap;for(let A=0;A<N.length;A++){let j=N[A],te={index:A,iteration:A+1,first:A===0,last:A===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[zs]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(k.startsWith("[")&&k.endsWith("]")){let H=k.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[k]=j}else if(k.startsWith("{")&&k.endsWith("}")){let H=k.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[k]=j}else M[k]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[k]=j[1];else M[V]=A;let C=ce(W,M);C=rr(C,M,l,e,!0),C=se(C,M,l),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=_(C,M,l),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(O)}catch(F){let w=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+w+a.substring(O)}}return a}i=x(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:ts(i)}function Cf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return Hs(n)}function $e(n,r,l,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let y=g.index,x=y+g[0].length-1,p=b(o,"(",")",x);if(p===-1)break;let s=Cf(o.slice(x+1,p)),m=p+1,a=ps(o.slice(y),"for","endfor");if(a.length===0)break;let E=a[0].content,h=y+a[0].end;if(!ge(s)){let O=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,y)+O+o.substring(h),i=!0;continue}try{let O=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(E);if(O.length>0&&S){let D=Re({forExpr:s,content:E,iterVarNames:O,context:r,filePath:l,options:e});o=o.substring(0,y)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(E),B=Function(...v,"__stxRenderLoopValue",`
3
3
  let result = '';
4
4
  for (${s}) {
5
5
  result += \`${F}\`;
6
6
  }
7
7
  return result;
8
- `)(...W,(D,L,V)=>ue(E,D,L,V));o=o.substring(0,y)+B+o.substring(h),i=!0}catch(w){let S=c("For",`Error in @for(${s}): ${w instanceof Error?w.message:String(w)}`,t.EVALUATION_ERROR);o=o.substring(0,y)+S+o.substring(h),i=!0}}return o}function Ae(n){let r=n.trim(),l=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(l){let i=l[1];return i.slice(1,-1).split(",").map((y)=>{let x=y.trim();if(!x)return"";let p=x.indexOf(":");if(p>=0&&i.startsWith("{")){let a=x.slice(p+1).trim(),E=a.indexOf("=");return(E>=0?a.slice(0,E):a).trim()}let s=x.indexOf("="),m=(s>=0?x.slice(0,s):x).trim();return/^[A-Za-z_$][\w$]*$/.test(m)?m:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let o=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(o)return[o[1]];return[]}function Re(n){let{forExpr:r,content:l,iterVarNames:e,context:o,filePath:i,options:g}=n,y=Object.keys(o),x=Object.values(o),p=i??"inline.stx",s="";return Function(...y,"__renderIteration",`
8
+ `)(...W,(D,L,V)=>ue(E,D,L,V));o=o.substring(0,y)+B+o.substring(h),i=!0}catch(O){let S=c("For",`Error in @for(${s}): ${O instanceof Error?O.message:String(O)}`,t.EVALUATION_ERROR);o=o.substring(0,y)+S+o.substring(h),i=!0}}return o}function Ae(n){let r=n.trim(),l=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(l){let i=l[1];return i.slice(1,-1).split(",").map((y)=>{let x=y.trim();if(!x)return"";let p=x.indexOf(":");if(p>=0&&i.startsWith("{")){let a=x.slice(p+1).trim(),E=a.indexOf("=");return(E>=0?a.slice(0,E):a).trim()}let s=x.indexOf("="),m=(s>=0?x.slice(0,s):x).trim();return/^[A-Za-z_$][\w$]*$/.test(m)?m:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let o=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(o)return[o[1]];return[]}function Re(n){let{forExpr:r,content:l,iterVarNames:e,context:o,filePath:i,options:g}=n,y=Object.keys(o),x=Object.values(o),p=i??"inline.stx",s="";return Function(...y,"__renderIteration",`
9
9
  for (${r}) {
10
10
  if (!__renderIteration([${e.join(", ")}])) break;
11
11
  }
12
- `)(...x,(a)=>{let E={...o};e.forEach((W,F)=>{E[W]=a[F]});let h=rr(l,E,p,g,!0);h=se(h,E,p),h=le(h,E);let w=h.indexOf(ee),S=h.indexOf(ne),v=w<0?S:S<0?w:Math.min(w,S);if(v>=0)h=h.slice(0,v);return s+=k(h,E,p),v<0||v!==w}),s}function we(n,r,l){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,y=g+i[0].length-1,x=b(e,"(",")",y);if(x===-1)break;let p=e.slice(y+1,x),s=ps(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,a=g+s[0].end;if(!ge(p)){let E=c("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+E+e.substring(a),o=!0;continue}try{let E=Object.keys(r),h=Object.values(r),w=ae(m),v=Function(...E,"__stxRenderLoopValue",`
12
+ `)(...x,(a)=>{let E={...o};e.forEach((W,F)=>{E[W]=a[F]});let h=rr(l,E,p,g,!0);h=se(h,E,p),h=le(h,E);let O=h.indexOf(ee),S=h.indexOf(ne),v=O<0?S:S<0?O:Math.min(O,S);if(v>=0)h=h.slice(0,v);return s+=_(h,E,p),v<0||v!==O}),s}function we(n,r,l){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,y=g+i[0].length-1,x=b(e,"(",")",y);if(x===-1)break;let p=e.slice(y+1,x),s=ps(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,a=g+s[0].end;if(!ge(p)){let E=c("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+E+e.substring(a),o=!0;continue}try{let E=Object.keys(r),h=Object.values(r),O=ae(m),v=Function(...E,"__stxRenderLoopValue",`
13
13
  let result = '';
14
14
  let maxIterations = ${l}; // Configurable safety limit
15
15
  let counter = 0;
16
16
  while (${p} && counter < maxIterations) {
17
17
  counter++;
18
- result += \`${w}\`;
18
+ result += \`${O}\`;
19
19
  }
20
20
  if (counter > maxIterations) {
21
21
  result += '<!-- [While Error [1104]]: Maximum iterations (${l}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
22
22
  }
23
23
  return result;
24
- `)(...h,(W,F,A)=>ue(m,W,F,A));e=e.substring(0,g)+v+e.substring(a),o=!0}catch(E){let h=c("While",`Error in @while(${p}): ${E instanceof Error?E.message:String(E)}`,t.EVALUATION_ERROR);e=e.substring(0,g)+h+e.substring(a),o=!0}}return e}
24
+ `)(...h,(W,F,w)=>ue(m,W,F,w));e=e.substring(0,g)+v+e.substring(a),o=!0}catch(E){let h=c("While",`Error in @while(${p}): ${E instanceof Error?E.message:String(E)}`,t.EVALUATION_ERROR);e=e.substring(0,g)+h+e.substring(a),o=!0}}return e}
25
25
  export{ts,rr,Cf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pg}from"./chunk-y8srg0q3.js";import"./chunk-0y2zzqsq.js";import"./chunk-g4e6egrr.js";import"./chunk-jt28zh50.js";import"./chunk-mmdfjmgk.js";import"./chunk-2qz891k4.js";import"./chunk-q9npggak.js";import"./chunk-tp2g09ca.js";import"./chunk-sgm6tg8h.js";import"./chunk-3m9vrhja.js";import"./chunk-30j6mbrf.js";import"./chunk-3kfbs0mw.js";import"./chunk-wz5m7ybz.js";import"./chunk-q49ykyq9.js";import"./chunk-xsf7ax50.js";import"./chunk-yp6w740k.js";import"./chunk-5q9ss7ty.js";import"./chunk-3cn9y08d.js";import"./chunk-z8k3fx4r.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{Pg as startInteractive};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{k}from"./chunk-m5fjhrpd.js";import{le}from"./chunk-pwmkhs7z.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ua(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Ql=ua;class jn{rules=[];defaultValue="";addRule(e){let t=new jn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new jn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new jn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var om=new jn;function eu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
3
- `)}catch{return""}})}function tu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
2
+ import{_}from"./chunk-0ggwm837.js";import{le}from"./chunk-pwmkhs7z.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ua(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Ql=ua;class jn{rules=[];defaultValue="";addRule(e){let t=new jn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new jn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new jn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var om=new jn;function eu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>_(c,{...t,message:l},r)).join(`
3
+ `)}catch{return""}})}function tu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>_(c,{...t,message:l},r)).join(`
4
4
  `)}catch{return""}})}function nu(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function im(e,t,r){let n=e;return n=eu(n,t,r),n=tu(n,t,r),n=nu(n,t,r),n}export{ua,Ql,jn,om,eu,tu,nu,im};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gt,Fn,Gm}from"./chunk-76fcwbe1.js";import{le,zn,Xm,Hn,fo,Wr,qr,Jm,Ym,Zm,Vn,Un,go,Kr,Qm}from"./chunk-pwmkhs7z.js";import"./chunk-qwds327k.js";export{fo as batch,Gm as default,zn as derived,Hn as effect,gt as generateSignalsRuntime,Fn as generateSignalsRuntimeDev,Un as isDerived,Vn as isSignal,Xm as memo,qr as onDestroy,Wr as onMount,Kr as peek,Zm as pendingLifecycleCounts,Ym as runDestroyCallbacks,Jm as runMountCallbacks,le as state,go as untrack,Qm as useOptimistic};
2
+ import{gt,Fn,Gm}from"./chunk-eazvp48w.js";import{le,zn,Xm,Hn,fo,Wr,qr,Jm,Ym,Zm,Vn,Un,go,Kr,Qm}from"./chunk-pwmkhs7z.js";import"./chunk-xgegyttg.js";export{fo as batch,Gm as default,zn as derived,Hn as effect,gt as generateSignalsRuntime,Fn as generateSignalsRuntimeDev,Un as isDerived,Vn as isSignal,Xm as memo,qr as onDestroy,Wr as onMount,Kr as peek,Zm as pendingLifecycleCounts,Ym as runDestroyCallbacks,Jm as runMountCallbacks,le as state,go as untrack,Qm as useOptimistic};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{f,d}from"./chunk-465resq9.js";import{J,I,p}from"./chunk-m5fjhrpd.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Dl(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function em(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Ml(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Ll(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await Ml(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function tm(t){let o=Dl(t);return{defaultSlot:o.default,namedSlots:o.named}}async function nm(t,o,i,r,e){return await Ll(t,{default:o,named:i},r,e)}
2
+ import{f,d}from"./chunk-465resq9.js";import{J,I,p}from"./chunk-0ggwm837.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Dl(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function em(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Ml(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Ll(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await Ml(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function tm(t){let o=Dl(t);return{defaultSlot:o.default,namedSlots:o.named}}async function nm(t,o,i,r,e){return await Ll(t,{default:o,named:i},r,e)}
3
3
  export{Dl,em,Ml,Ll,tm,nm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{po,qm,Km}from"./chunk-76679dw7.js";import"./chunk-frk6rzrq.js";import"./chunk-afj19nsj.js";import"./chunk-19safa6y.js";import"./chunk-3m9vrhja.js";import"./chunk-30j6mbrf.js";import"./chunk-3kfbs0mw.js";import"./chunk-q49ykyq9.js";import"./chunk-xsf7ax50.js";import"./chunk-yp6w740k.js";import"./chunk-5q9ss7ty.js";import"./chunk-3cn9y08d.js";import"./chunk-z8k3fx4r.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{Km as clearComposableCache,qm as getComposableScript,po as listComposableModules};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,c}from"./chunk-465resq9.js";import{r,yn,h}from"./chunk-m5fjhrpd.js";import{Qe}from"./chunk-z8k3fx4r.js";import{bs,vs}from"./chunk-3cn9y08d.js";import{mc,Uo,hs,ys}from"./chunk-5q9ss7ty.js";import{pc,fc}from"./chunk-1mfj2j5g.js";import{vt}from"./chunk-am4wadh7.js";import{cn,xc,fr,gr}from"./chunk-c05r0rzw.js";import{g}from"./chunk-0dve54ne.js";import{Xs}from"./chunk-4s9kytdz.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,s={}){let{duration:i,delay:o,ease:n,direction:l,custom:d}={...B,...s};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{t,c}from"./chunk-465resq9.js";import{r,yn,h}from"./chunk-0ggwm837.js";import{Qe}from"./chunk-z8k3fx4r.js";import{bs,vs}from"./chunk-3cn9y08d.js";import{mc,Uo,hs,ys}from"./chunk-5q9ss7ty.js";import{pc,fc}from"./chunk-xsf7ax50.js";import{vt}from"./chunk-am4wadh7.js";import{cn,xc,fr,gr}from"./chunk-c05r0rzw.js";import{g}from"./chunk-0dve54ne.js";import{Xs}from"./chunk-4s9kytdz.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,s={}){let{duration:i,delay:o,ease:n,direction:l,custom:d}={...B,...s};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${l==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1307,6 +1307,6 @@ ${y}
1307
1307
  customElements.define('${s}', ${d});
1308
1308
  `}async function Ze(e,s,i,o){if(s.length<1)return c("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let n=s[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${n}.stx`),q.join(q.dirname(o),`${n}.stx`)]:[q.join(q.dirname(o),d,`${n}.stx`),q.join(process.cwd(),d,`${n}.stx`),q.join(q.dirname(o),`${n}.stx`)],u=null;for(let f of p)if(await r(f)){u=await Bun.file(f).text();break}if(!u)return c("WebComponent",`Component file not found: ${n}.stx`,t.FILE_NOT_FOUND);let m=Ft(u,n);return`<script type="module">
1309
1309
  ${qt(m)}
1310
- </script>`}var j={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:cn,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:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},pc,fc,bs,vs,De,ke,Ae,Pe,_e,Oe,Fe,$e,...Xs],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 Ut(e,s,i){let o=s||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),l=N.join(n,"resources","views"),d=N.join(n,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,s){let i=s.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function If(e,s){let i=!e.root,o=Ut(e.root,e.pagesDir,s);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${s}::${o.root}`;if(!et.has(n))et.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let n={};for(let l of ue){let d=e[l];if(typeof d==="string"&&d)n[l]=d}Se.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let l of ue){let d=e[l];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Bt(d,n))continue;e[l]=N.join(n,d)}}for(let n of ue){let l=e[n];if(typeof l!=="string"||!l||N.isAbsolute(l))continue;e[n]=N.resolve(s,l)}return e}function Jt(e,s){let i=Se.get(e);for(let o of ue){let n=e[o];if(typeof n!=="string"||!n)continue;let l=N.isAbsolute(n)?n:N.join(s,n);if(Q.existsSync(l))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(xc(e.stateDir),e.stateDir=fr(),e.cachePath=gr(e.cachePath),e.build)e.build.cacheDir=gr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=gr(e.media.cache.directory);if(e.story)e.story.outDir=gr(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function Ho(e,s=Ht){try{return await s(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let s=e?N.resolve(e):process.cwd(),i=de.get(s);if(i&&i.signature!==hs(i.graph)){let l=Y.get(s);if(Y.delete(s),de.delete(s),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-5ffdtfwg.js"),{partialsCache:p}=await import("./chunk-yv8jeqdn.js");if(d(),p.clear(),l&&i.configSignature===ys(i.graph)){let u=l.then(async(m)=>{let y={...i.graph};await Uo(y,s),de.set(s,{graph:y,signature:hs(y),configSignature:ys(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(s,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(s);if(o)return o;let n=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(N.join(s,`stx.config${v}`))),p=l.some((v)=>Q.existsSync(N.join(s,"config",`ui${v}`))),u;if(d&&p){let v=await Ho({name:"ui",cwd:N.join(s,"config"),defaultConfig:j,errorPolicy:"throw",verbose:!1});u=(await Ho({name:"stx",alias:"ui",cwd:s,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Ho({name:"stx",alias:"ui",cwd:s,defaultConfig:j,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await mc(s,j);u=v.config,de.set(s,{graph:v.graph,signature:hs(v.graph),configSignature:ys(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-exg7ry7b.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-qt17792g.js");await b(s,u.runtimeConfig)}Kt(u),Gt(u),If(u,s),Jt(u,s);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[s]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-qz9fzz5k.js"),b=[],x=[];for(let k of f){let S=typeof k==="string"?k:k[0],_=typeof k==="string"?{}:k[1]||{};try{let A,E;try{let w=g.resolve(S,{paths:[s]});A=await import(w),E=N.dirname(w)}catch{let w=N.resolve(s,S);A=await import(w),E=N.dirname(w)}let I=A.default||A;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(N.resolve(E,C))}if(I.pages){let w=N.resolve(E,I.pages),C=_.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(_,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1310
+ </script>`}var j={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:cn,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:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},pc,fc,bs,vs,De,ke,Ae,Pe,_e,Oe,Fe,$e,...Xs],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 Ut(e,s,i){let o=s||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),l=N.join(n,"resources","views"),d=N.join(n,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,s){let i=s.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function If(e,s){let i=!e.root,o=Ut(e.root,e.pagesDir,s);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${s}::${o.root}`;if(!et.has(n))et.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let n={};for(let l of ue){let d=e[l];if(typeof d==="string"&&d)n[l]=d}Se.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let l of ue){let d=e[l];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Bt(d,n))continue;e[l]=N.join(n,d)}}for(let n of ue){let l=e[n];if(typeof l!=="string"||!l||N.isAbsolute(l))continue;e[n]=N.resolve(s,l)}return e}function Jt(e,s){let i=Se.get(e);for(let o of ue){let n=e[o];if(typeof n!=="string"||!n)continue;let l=N.isAbsolute(n)?n:N.join(s,n);if(Q.existsSync(l))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(xc(e.stateDir),e.stateDir=fr(),e.cachePath=gr(e.cachePath),e.build)e.build.cacheDir=gr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=gr(e.media.cache.directory);if(e.story)e.story.outDir=gr(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function Ho(e,s=Ht){try{return await s(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let s=e?N.resolve(e):process.cwd(),i=de.get(s);if(i&&i.signature!==hs(i.graph)){let l=Y.get(s);if(Y.delete(s),de.delete(s),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-3wfewscj.js"),{partialsCache:p}=await import("./chunk-htc7pasb.js");if(d(),p.clear(),l&&i.configSignature===ys(i.graph)){let u=l.then(async(m)=>{let y={...i.graph};await Uo(y,s),de.set(s,{graph:y,signature:hs(y),configSignature:ys(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(s,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(s);if(o)return o;let n=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(N.join(s,`stx.config${v}`))),p=l.some((v)=>Q.existsSync(N.join(s,"config",`ui${v}`))),u;if(d&&p){let v=await Ho({name:"ui",cwd:N.join(s,"config"),defaultConfig:j,errorPolicy:"throw",verbose:!1});u=(await Ho({name:"stx",alias:"ui",cwd:s,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Ho({name:"stx",alias:"ui",cwd:s,defaultConfig:j,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await mc(s,j);u=v.config,de.set(s,{graph:v.graph,signature:hs(v.graph),configSignature:ys(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-exg7ry7b.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-9zmb7dcv.js");await b(s,u.runtimeConfig)}Kt(u),Gt(u),If(u,s),Jt(u,s);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[s]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-qz9fzz5k.js"),b=[],x=[];for(let k of f){let S=typeof k==="string"?k:k[0],_=typeof k==="string"?{}:k[1]||{};try{let A,E;try{let w=g.resolve(S,{paths:[s]});A=await import(w),E=N.dirname(w)}catch{let w=N.resolve(s,S);A=await import(w),E=N.dirname(w)}let I=A.default||A;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(N.resolve(E,C))}if(I.pages){let w=N.resolve(E,I.pages),C=_.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(_,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1311
1311
  `)}catch(A){console.warn(`[stx] Failed to load plugin ${S}:`,A.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}return u})();if(Y.set(s,n),n.catch(()=>{if(Y.get(s)===n)Y.delete(s)}),!e)se=n,n.then((l)=>{K=l}).catch(()=>{});return n}var P=new Proxy(j,{get(e,s){if(K&&s in K)return K[s];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[s]}});function Ch(e){return e}function Eh(e){let s=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")s.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")s.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")s.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")s.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)s.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)s.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))s.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))s.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)s.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)s.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))s.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))s.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))s.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))s.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")s.push({path:`customDirectives[${n}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")s.push({path:`customDirectives[${n}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))s.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")s.push({path:`middleware[${n}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")s.push({path:`middleware[${n}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))s.push({path:`middleware[${n}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)s.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))s.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))s.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((n,l)=>{if(!n.pattern||typeof n.pattern!=="string")s.push({path:`pwa.routes[${l}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(n.strategy))s.push({path:`pwa.routes[${l}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(n.maxAgeSeconds!==void 0&&(typeof n.maxAgeSeconds!=="number"||n.maxAgeSeconds<0))s.push({path:`pwa.routes[${l}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(n.maxEntries!==void 0&&(typeof n.maxEntries!=="number"||n.maxEntries<1))s.push({path:`pwa.routes[${l}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))s.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((n)=>typeof n!=="number"||n<16||n>1024).length>0)s.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((l)=>!o.includes(l)).length>0)s.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:s.length===0,errors:s,warnings:i}}
1312
1312
  export{ic,ac,lr,Ye,cc,ms,j,If,Ho,a,P,Ch,Eh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{il,al}from"./chunk-qwds327k.js";import{H,mr,Ts,$s,Zo,Qo,Rs,yr,Oe,pe,X,Ps,ie,J,I,tt,vr,ri,Sr,Be,r,p,V,bn}from"./chunk-m5fjhrpd.js";import{f,R,nt,d}from"./chunk-465resq9.js";import{n}from"./chunk-qn4gt8sx.js";import{se}from"./chunk-sgm6tg8h.js";import{s}from"./chunk-cehjp06v.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Rt}from"crypto";import Q from"fs";import K from"path";import{decode as on,generateThumbHash as an}from"ts-images";import{createImageDeliveryCatalog as bt}from"ts-images/delivery";import je from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=je.readSync(e,o,0,i,t);return o.subarray(0,a)}function Me(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Le(e){let t;try{t=je.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(Me(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)je.closeSync(t)}}import Yt from"fs";import Re from"os";import{join as gt}from"path";import{fileURLToPath as mt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Qt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,yt=[];async function en(){if(Ae<Qt()){Ae++;return}await new Promise((e)=>yt.push(e)),Ae++}function tn(){Ae--,yt.shift()?.()}var nn="@stacksjs/stx/builtins/image-warmup-worker";function rn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Yt.existsSync(mt(i)))return mt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(nn,e):void 0;return i&&sn(i)?i:void 0}catch{return}}function sn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,gt(t.BUN_INSTALL||gt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var ht=!1;function he(e){if(!ht)ht=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function ze(e){return e instanceof Error?e.message:String(e)}async function Ue(e,t){if(typeof pt!=="function")return he("node:worker_threads has no Worker in this runtime");let i=rn();if(!i)return he("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await en();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(he(`could not start ${i}: ${ze(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(ze(y)||"image worker crashed")):o(he(`the worker failed before it was ready: ${ze(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(he(`the worker exited with code ${y} before it was ready`)))})})}finally{tn()}}var cn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ln=[320,640,960,1280,1920],ye="/_stx/images",un=`stx:${ye}:alpha-1`,fn=`stx:${ye}:opaque-1`,dn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function gn(e,t){let i=K.dirname(Bun.resolveSync(e,t));while(i!==K.dirname(i)){let o=K.join(i,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=K.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=dn.map((t)=>{let i;try{i=e?gn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var vt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[vt]??={catalog:new Map,transparent:new Set},e[vt]}var wt=new Set;function mn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=K.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Rt("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function $t(e,t=`stx:${ye}`){let i=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=K.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Q.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function At(e,t=e){let i=await Q.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=K.join(t,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!cn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function St(e,t){return e.map((i)=>({key:mn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...hn(i.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Le(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await on(new Uint8Array(await Q.promises.readFile(m?.path??l.fallback.path)));if(yn(u.data))i.add(c)}catch{i.add(c)}}));return i}function vn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=Q.openSync(m.path,"r"),!Me(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)Q.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!wt.has(o))wt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function wn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await an(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Fe(e){return K.join(e,"undecodable.json")}function $n(e){try{let t=Q.readFileSync(Fe(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function Sn(e,t){try{Q.mkdirSync(K.dirname(Fe(e)),{recursive:!0}),Q.writeFileSync(Fe(e),JSON.stringify(t))}catch{}}function Ct(e){try{let t=Q.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function kt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Ao(e){let t=kt(e);return t?be().catalog.get(t):void 0}function Po(e){let t=kt(e);return t?be().transparent.has(t):!1}function Io(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function mh(e){let t=Ao(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Io(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:Po(e)?void 0:t.placeholder?.dataUrl}}function os(){let e=be();e.catalog=new Map,e.transparent=new Set}function Cn(e){let t=be();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function hh(e,t,i={}){if(!e||!Q.existsSync(e))return os(),{count:0,fingerprint:""};if(i.offThread){let h=await Ue("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Cn(h.state),h.result}let o=await At(e);if(o.length===0)return os(),{count:0,fingerprint:""};let a=$n(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=Ct(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return os(),{count:0,fingerprint:""};let l=$t(K.join(t,"_stx","images"),`${un}:${xt()}`),m={outDir:K.join(t,"_stx","images"),storage:$t(K.join(t,"_stx","images"),`${fn}:${xt()}`),baseUrl:ye,widths:ln,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await bt({...m,entries:St(c,l)})}catch(h){if(u=await wn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=Ct(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)Sn(t,a);if(u.length===0)return os(),{count:0,fingerprint:""};y=await bt({...m,entries:St(u,l)})}let v=await xn(y.entries),b=vn(y.entries,v),C=be();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Rt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Zo(e,o);if(a!==void 0)return a;for(let c of Qo(e,t,i,o))if(await r(c))return c;return null}}var ue=new Pt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Rn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function He(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Rn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${bn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${bn(c,We(String(a)))}"`)}return i}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var qe={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(yr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var kn=new Map;function Xe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return kn.get(t)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function G(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ve(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ge(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function In(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function En(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ke={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=G(e,"src")||"",a=Ao(o),c=G(e,"alt")||"",l=G(e,"width")||(a?String(a.source.width):void 0),m=G(e,"height")||(a?String(a.source.height):void 0),u=G(e,"sizes"),y=G(e,"srcset"),v=G(e,"densities"),b=G(e,"format"),C=Po(o)||Xe(o)?.transparent===!0,x=G(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=G(e,"placeholderColor")||"#e5e7eb",w=G(e,"provider"),S=G(e,"class")||G(e,"className")||"",A=G(e,"style")||"",P=G(e,"objectFit")||G(e,"fit"),k=G(e,"objectPosition")||G(e,"position"),O=G(e,"quality"),W=Ie(e,"lazy",!0),z=Ie(e,"preload",!1),U=Ie(e,"priority",!1),q=G(e,"loading"),B=G(e,"decoding")||"async",N=!!a||Ie(e,"picture",!1)||!!b,T=l?Number.parseInt(l):void 0,j=m?Number.parseInt(m):void 0,F=y||"",Z="";if(a)F=a.sources[a.fallback.format]||"",Z=u?Ve(u):"100vw";else if(!F&&u&&w&&w!=="local"&&w!=="static")F=Ge(o,Ze,w,b),Z=Ve(u);else if(!F&&v){let _=v.split(/\s+/).map((E)=>Number.parseFloat(E.replace("x","")));F=In(o,_,T,w,b)}else if(u)Z=Ve(u);let L=[];if(A)L.push(A);if(P)L.push(`object-fit:${P}`);if(k)L.push(`object-position:${k}`);if(T&&j)L.push(`aspect-ratio:${T}/${j}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:Xe(o);if(_&&x==="color")L.push(`background-color:${_.color}`),D.push("backgroundColor");else if(_)L.push(`background-color:${_.color}`),L.push(`background-image:url(${_.dataUrl})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let E=En(T||16,j||9,h);L.push(`background-image:url(${E})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")L.push(`background-image:url(${n(x)})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||xe(o,T,j,w,b),Y=[];if(Y.push(`src="${n(yr($e,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let le=q||(U||z?"eager":W?"lazy":"");if(le)Y.push(`loading="${n(le)}"`);if(U)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(B)}"`),S)Y.push(`class="${n(S)}"`);if(L.length>0)Y.push(`style="${n(L.join(";"))}"`);if(F)Y.push(`srcset="${n(yr(F,"fetched"))}"`);if(Z)Y.push(`sizes="${n(Z)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",E=_n(D)+(_?`;${_}`:"");Y.push(`onload="${n(E)}"`),te.add("onload")}Y.push(...oe(e,te)),Y.push(...ae(e,te));let De=`<img ${Y.join(" ")} />`,M="";if(z){let E=b==="webp"?"image/webp":b==="avif"?"image/avif":"";M=`<link rel="preload" as="image" href="${n($e)}"${E?` type="${E}"`:""}${F?` imagesrcset="${n(F)}"`:""}${Z?` imagesizes="${n(Z)}"`:""} />
2
+ import{il,al}from"./chunk-xgegyttg.js";import{H,mr,Ts,$s,Zo,Qo,Rs,yr,Oe,pe,X,Ps,ie,J,I,tt,vr,ri,Sr,Be,r,p,V,bn}from"./chunk-0ggwm837.js";import{f,R,nt,d}from"./chunk-465resq9.js";import{n}from"./chunk-tp2g09ca.js";import{se}from"./chunk-sgm6tg8h.js";import{s}from"./chunk-cehjp06v.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Rt}from"crypto";import Q from"fs";import K from"path";import{decode as on,generateThumbHash as an}from"ts-images";import{createImageDeliveryCatalog as bt}from"ts-images/delivery";import je from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=je.readSync(e,o,0,i,t);return o.subarray(0,a)}function Me(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Le(e){let t;try{t=je.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(Me(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)je.closeSync(t)}}import Yt from"fs";import Re from"os";import{join as gt}from"path";import{fileURLToPath as mt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Qt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,yt=[];async function en(){if(Ae<Qt()){Ae++;return}await new Promise((e)=>yt.push(e)),Ae++}function tn(){Ae--,yt.shift()?.()}var nn="@stacksjs/stx/builtins/image-warmup-worker";function rn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Yt.existsSync(mt(i)))return mt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(nn,e):void 0;return i&&sn(i)?i:void 0}catch{return}}function sn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,gt(t.BUN_INSTALL||gt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var ht=!1;function he(e){if(!ht)ht=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function ze(e){return e instanceof Error?e.message:String(e)}async function Ue(e,t){if(typeof pt!=="function")return he("node:worker_threads has no Worker in this runtime");let i=rn();if(!i)return he("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await en();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(he(`could not start ${i}: ${ze(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(ze(y)||"image worker crashed")):o(he(`the worker failed before it was ready: ${ze(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(he(`the worker exited with code ${y} before it was ready`)))})})}finally{tn()}}var cn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ln=[320,640,960,1280,1920],ye="/_stx/images",un=`stx:${ye}:alpha-1`,fn=`stx:${ye}:opaque-1`,dn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function gn(e,t){let i=K.dirname(Bun.resolveSync(e,t));while(i!==K.dirname(i)){let o=K.join(i,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=K.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=dn.map((t)=>{let i;try{i=e?gn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var vt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[vt]??={catalog:new Map,transparent:new Set},e[vt]}var wt=new Set;function mn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=K.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Rt("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function $t(e,t=`stx:${ye}`){let i=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=K.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Q.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function At(e,t=e){let i=await Q.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=K.join(t,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!cn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function St(e,t){return e.map((i)=>({key:mn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...hn(i.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Le(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await on(new Uint8Array(await Q.promises.readFile(m?.path??l.fallback.path)));if(yn(u.data))i.add(c)}catch{i.add(c)}}));return i}function vn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=Q.openSync(m.path,"r"),!Me(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)Q.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!wt.has(o))wt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function wn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await an(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Fe(e){return K.join(e,"undecodable.json")}function $n(e){try{let t=Q.readFileSync(Fe(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function Sn(e,t){try{Q.mkdirSync(K.dirname(Fe(e)),{recursive:!0}),Q.writeFileSync(Fe(e),JSON.stringify(t))}catch{}}function Ct(e){try{let t=Q.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function kt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Ao(e){let t=kt(e);return t?be().catalog.get(t):void 0}function Po(e){let t=kt(e);return t?be().transparent.has(t):!1}function Io(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function mh(e){let t=Ao(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Io(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:Po(e)?void 0:t.placeholder?.dataUrl}}function os(){let e=be();e.catalog=new Map,e.transparent=new Set}function Cn(e){let t=be();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function hh(e,t,i={}){if(!e||!Q.existsSync(e))return os(),{count:0,fingerprint:""};if(i.offThread){let h=await Ue("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Cn(h.state),h.result}let o=await At(e);if(o.length===0)return os(),{count:0,fingerprint:""};let a=$n(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=Ct(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return os(),{count:0,fingerprint:""};let l=$t(K.join(t,"_stx","images"),`${un}:${xt()}`),m={outDir:K.join(t,"_stx","images"),storage:$t(K.join(t,"_stx","images"),`${fn}:${xt()}`),baseUrl:ye,widths:ln,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await bt({...m,entries:St(c,l)})}catch(h){if(u=await wn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=Ct(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)Sn(t,a);if(u.length===0)return os(),{count:0,fingerprint:""};y=await bt({...m,entries:St(u,l)})}let v=await xn(y.entries),b=vn(y.entries,v),C=be();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Rt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Zo(e,o);if(a!==void 0)return a;for(let c of Qo(e,t,i,o))if(await r(c))return c;return null}}var ue=new Pt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Rn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function He(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Rn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${bn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${bn(c,We(String(a)))}"`)}return i}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var qe={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(yr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var kn=new Map;function Xe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return kn.get(t)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function G(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ve(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ge(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function In(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function En(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ke={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=G(e,"src")||"",a=Ao(o),c=G(e,"alt")||"",l=G(e,"width")||(a?String(a.source.width):void 0),m=G(e,"height")||(a?String(a.source.height):void 0),u=G(e,"sizes"),y=G(e,"srcset"),v=G(e,"densities"),b=G(e,"format"),C=Po(o)||Xe(o)?.transparent===!0,x=G(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=G(e,"placeholderColor")||"#e5e7eb",w=G(e,"provider"),S=G(e,"class")||G(e,"className")||"",A=G(e,"style")||"",P=G(e,"objectFit")||G(e,"fit"),k=G(e,"objectPosition")||G(e,"position"),O=G(e,"quality"),W=Ie(e,"lazy",!0),z=Ie(e,"preload",!1),U=Ie(e,"priority",!1),q=G(e,"loading"),B=G(e,"decoding")||"async",N=!!a||Ie(e,"picture",!1)||!!b,T=l?Number.parseInt(l):void 0,j=m?Number.parseInt(m):void 0,F=y||"",Z="";if(a)F=a.sources[a.fallback.format]||"",Z=u?Ve(u):"100vw";else if(!F&&u&&w&&w!=="local"&&w!=="static")F=Ge(o,Ze,w,b),Z=Ve(u);else if(!F&&v){let _=v.split(/\s+/).map((E)=>Number.parseFloat(E.replace("x","")));F=In(o,_,T,w,b)}else if(u)Z=Ve(u);let L=[];if(A)L.push(A);if(P)L.push(`object-fit:${P}`);if(k)L.push(`object-position:${k}`);if(T&&j)L.push(`aspect-ratio:${T}/${j}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:Xe(o);if(_&&x==="color")L.push(`background-color:${_.color}`),D.push("backgroundColor");else if(_)L.push(`background-color:${_.color}`),L.push(`background-image:url(${_.dataUrl})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let E=En(T||16,j||9,h);L.push(`background-image:url(${E})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")L.push(`background-image:url(${n(x)})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||xe(o,T,j,w,b),Y=[];if(Y.push(`src="${n(yr($e,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let le=q||(U||z?"eager":W?"lazy":"");if(le)Y.push(`loading="${n(le)}"`);if(U)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(B)}"`),S)Y.push(`class="${n(S)}"`);if(L.length>0)Y.push(`style="${n(L.join(";"))}"`);if(F)Y.push(`srcset="${n(yr(F,"fetched"))}"`);if(Z)Y.push(`sizes="${n(Z)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",E=_n(D)+(_?`;${_}`:"");Y.push(`onload="${n(E)}"`),te.add("onload")}Y.push(...oe(e,te)),Y.push(...ae(e,te));let De=`<img ${Y.join(" ")} />`,M="";if(z){let E=b==="webp"?"image/webp":b==="avif"?"image/avif":"";M=`<link rel="preload" as="image" href="${n($e)}"${E?` type="${E}"`:""}${F?` imagesrcset="${n(F)}"`:""}${Z?` imagesizes="${n(Z)}"`:""} />
3
3
  `}if(N){let _=[];if(a)for(let E of Io(a))_.push(`<source type="image/${E.format}" srcset="${n(E.srcset)}"${Z?` sizes="${n(Z)}"`:""} />`);if(!a&&(b==="avif"||b==="auto")){let E=xe(o,T,j,w,"avif"),ee=F?Ge(o,Ze,w,"avif"):`${E}`;_.push(`<source type="image/avif" srcset="${n(ee)}"${Z?` sizes="${n(Z)}"`:""} />`)}if(!a&&(b==="webp"||b==="auto")){let E=xe(o,T,j,w,"webp"),ee=F?Ge(o,Ze,w,"webp"):`${E}`;_.push(`<source type="image/webp" srcset="${n(ee)}"${Z?` sizes="${n(Z)}"`:""} />`)}return`${M}<picture>
4
4
  ${_.join(`
5
5
  `)}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{mn,Uf,Wf,qf,Kf,Gf,m,Xf,ai,Jf,Bc,Fc}from"./chunk-m5fjhrpd.js";import"./chunk-b6g24qj0.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-qwds327k.js";export{mn as STX_ENGINE_BINDING_NAMES,ai as convertToCommonJS,Bc as extractScriptFromTemplate,m as extractVariables,Fc as hasVariables,Xf as isCompleteImport,Gf as isMissingBindingFailure,qf as isModuleResolutionFailure,Kf as isSyntaxFailure,Jf as splitDeclaration,Uf as stripTypeScript,Wf as withoutStxReferrer};
2
+ import{mn,Uf,Wf,qf,Kf,Gf,m,Xf,ai,Jf,Bc,Fc}from"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{mn as STX_ENGINE_BINDING_NAMES,ai as convertToCommonJS,Bc as extractScriptFromTemplate,m as extractVariables,Fc as hasVariables,Xf as isCompleteImport,Gf as isMissingBindingFailure,qf as isModuleResolutionFailure,Kf as isSyntaxFailure,Jf as splitDeclaration,Uf as stripTypeScript,Wf as withoutStxReferrer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{de,Ic,Ns,gn,m,De,Me}from"./chunk-m5fjhrpd.js";import{lr,Ye,j}from"./chunk-x1q2ape8.js";import{Qn,i}from"./chunk-fpagqrd1.js";import{be}from"./chunk-0dkd26t4.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=lr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
2
+ import{de,Ic,Ns,gn,m,De,Me}from"./chunk-0ggwm837.js";import{lr,Ye,j}from"./chunk-q49ykyq9.js";import{Qn,i}from"./chunk-0y2zzqsq.js";import{be}from"./chunk-30j6mbrf.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=lr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=De(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Me(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await Qn(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
16
16
  $1`);else t+=`
17
- ${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-davr7z73.js");t=await o(t)}catch{}return t}
17
+ ${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-1khg5vjs.js");t=await o(t)}catch{}return t}
18
18
  export{Va};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Qe}from"./chunk-z8k3fx4r.js";import{gt,Fn}from"./chunk-76fcwbe1.js";import{Ne,fn,Wc,qc}from"./chunk-m5fjhrpd.js";import{Cr,Er,Tr,Rr,ke}from"./chunk-465resq9.js";import{O}from"./chunk-gs373714.js";import{gi}from"./chunk-b6g24qj0.js";import{y}from"./chunk-x9haxcsj.js";import{i}from"./chunk-fpagqrd1.js";import{j,a}from"./chunk-x1q2ape8.js";import{hc}from"./chunk-5q9ss7ty.js";import{Rn,Ue,Ce,na,ra,An}from"./chunk-00ns0516.js";import{rn,_o}from"./chunk-6n195hvc.js";import{Pn}from"./chunk-jb1dk0w7.js";import{Jt,Xn,Jn}from"./chunk-tn40nh9e.js";import{G}from"./chunk-0dkd26t4.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Fn():gt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=Qe(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Wc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Ne(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...j,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Rn(b)+Ue(b),P=qc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:fn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Fg(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=ke(e.app?.head,{known:Rr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Pn(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)rn(o,w);if(e.runtimeConfig)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let f=T(s.pattern),H=f.rendering==="prerender";if(H&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Tr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Cr(t.html,u);if(g.htmlAttrs)t.html=Er(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),H){let p=await An(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ce(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:H}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(o,d);if(m.existsSync(E)){let{copied:s,bytes:f}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let F=Jn(o);if(F){let{copied:s,bytes:f}=Z(F,c.join(r,"public",Xn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Jt}/`)}let N={runtime:v.filename,router:x.filename},C=na(k,N,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await _o(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await gi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(hc(e._layerGraph),null,2));ra(C,r);let K=Date.now()-l;return console.log(`
2
+ import{Qe}from"./chunk-z8k3fx4r.js";import{gt,Fn}from"./chunk-eazvp48w.js";import{Ne,fn,Wc,qc}from"./chunk-0ggwm837.js";import{Cr,Er,Tr,Rr,ke}from"./chunk-465resq9.js";import{O}from"./chunk-gs373714.js";import{gi}from"./chunk-bsgg8zzk.js";import{y}from"./chunk-g4e6egrr.js";import{i}from"./chunk-0y2zzqsq.js";import{j,a}from"./chunk-q49ykyq9.js";import{hc}from"./chunk-5q9ss7ty.js";import{Rn,Ue,Ce,na,ra,An}from"./chunk-se28p2xy.js";import{rn,_o}from"./chunk-afj19nsj.js";import{Pn}from"./chunk-jb1dk0w7.js";import{Jt,Xn,Jn}from"./chunk-tn40nh9e.js";import{G}from"./chunk-30j6mbrf.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Fn():gt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=Qe(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Wc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Ne(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...j,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Rn(b)+Ue(b),P=qc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:fn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Fg(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=ke(e.app?.head,{known:Rr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Pn(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)rn(o,w);if(e.runtimeConfig)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let f=T(s.pattern),H=f.rendering==="prerender";if(H&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Tr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Cr(t.html,u);if(g.htmlAttrs)t.html=Er(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),H){let p=await An(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ce(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:H}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(o,d);if(m.existsSync(E)){let{copied:s,bytes:f}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let F=Jn(o);if(F){let{copied:s,bytes:f}=Z(F,c.join(r,"public",Xn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Jt}/`)}let N={runtime:v.filename,router:x.filename},C=na(k,N,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await _o(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await gi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(hc(e._layerGraph),null,2));ra(C,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:N,outputDir:r,duration:K}}
4
4
  export{Fg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{m,h,p}from"./chunk-m5fjhrpd.js";import{j}from"./chunk-x1q2ape8.js";import{i}from"./chunk-fpagqrd1.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function am(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{m,h,p}from"./chunk-0ggwm837.js";import{j}from"./chunk-q49ykyq9.js";import{i}from"./chunk-0y2zzqsq.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function am(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Dl,em,Ml,Ll,tm,nm}from"./chunk-n8s5301s.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{nm as applySlots,tm as extractSlotContent,em as parseSlotElement,Dl as parseSlots,Ll as processSlots,Ml as renderSlot};