@stacksjs/stx 0.2.690 → 0.2.691

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 (80) hide show
  1. package/dist/{chunk-cm8ad78x.js → chunk-0yvar2ha.js} +1 -1
  2. package/dist/{chunk-g9c284gf.js → chunk-11tvhxt0.js} +1 -1
  3. package/dist/chunk-1bpjqst8.js +2 -0
  4. package/dist/{chunk-5m42k74p.js → chunk-1db0zrz0.js} +1 -1
  5. package/dist/{chunk-yxp7jmnz.js → chunk-3dwr8pyh.js} +1 -1
  6. package/dist/{chunk-5mcwf93c.js → chunk-463r8dqk.js} +2 -2
  7. package/dist/{chunk-4f5bmy7h.js → chunk-467acz2w.js} +6 -6
  8. package/dist/{chunk-h176dx1q.js → chunk-5btsefqt.js} +2 -2
  9. package/dist/chunk-5f7vry8p.js +2 -0
  10. package/dist/{chunk-q3xesyn0.js → chunk-6kyhgvzh.js} +1 -1
  11. package/dist/chunk-7ynw1f29.js +2 -0
  12. package/dist/{chunk-psprkndv.js → chunk-806rdn0n.js} +1 -1
  13. package/dist/{chunk-c9fs966z.js → chunk-8e32860g.js} +1 -1
  14. package/dist/{chunk-mwmmmbxj.js → chunk-a0rymg4g.js} +4 -4
  15. package/dist/{chunk-sj6t3cj2.js → chunk-aw1wrygx.js} +1 -1
  16. package/dist/{chunk-smqgdmc4.js → chunk-ay262g2y.js} +1 -1
  17. package/dist/{chunk-4hbevevz.js → chunk-bkppc1rf.js} +1 -1
  18. package/dist/{chunk-j5127cxs.js → chunk-dg2f47za.js} +1 -1
  19. package/dist/{chunk-4566drka.js → chunk-dnwd04ch.js} +1 -1
  20. package/dist/{chunk-znhrftsf.js → chunk-e8nmm7g1.js} +1 -1
  21. package/dist/chunk-ez0pzhh7.js +2 -0
  22. package/dist/{chunk-hy4gaf8g.js → chunk-f9e5k693.js} +1 -1
  23. package/dist/{chunk-84vsb4v3.js → chunk-fbb68bw1.js} +1 -1
  24. package/dist/chunk-fvyhrmwt.js +2 -0
  25. package/dist/{chunk-tjwv101c.js → chunk-g5jtypvv.js} +1 -1
  26. package/dist/{chunk-jt9kxnva.js → chunk-h82f12we.js} +2 -2
  27. package/dist/{chunk-n42421az.js → chunk-hfsd13r5.js} +2 -2
  28. package/dist/{chunk-vvezfjt1.js → chunk-hnwcd41v.js} +1 -1
  29. package/dist/{chunk-91ytsvhd.js → chunk-j46gqse8.js} +1 -1
  30. package/dist/{chunk-43h27729.js → chunk-jg9zwx1t.js} +3 -3
  31. package/dist/{chunk-fk2m3xdd.js → chunk-jtbx9zgs.js} +1 -1
  32. package/dist/chunk-jxvyvz64.js +2 -0
  33. package/dist/{chunk-v7xpafs9.js → chunk-k74v03v7.js} +1 -1
  34. package/dist/{chunk-1k7js5nz.js → chunk-k7gcx130.js} +1 -1
  35. package/dist/{chunk-ppc64he4.js → chunk-k9j0cp1w.js} +1 -1
  36. package/dist/{chunk-s0ntt1cn.js → chunk-k9pk5yq0.js} +1 -1
  37. package/dist/{chunk-063y8kcp.js → chunk-kdz8yfdx.js} +1 -1
  38. package/dist/chunk-kkkcs6e6.js +2 -0
  39. package/dist/chunk-kv6z74k1.js +2 -0
  40. package/dist/chunk-m3sg02tk.js +2 -0
  41. package/dist/{chunk-jkhc0q7g.js → chunk-madrssd6.js} +1 -1
  42. package/dist/chunk-mc66eb1v.js +2 -0
  43. package/dist/{chunk-bzxfbh2x.js → chunk-mdx9fcej.js} +1 -1
  44. package/dist/{chunk-vjt6c16n.js → chunk-n1xyrx1a.js} +1 -1
  45. package/dist/{chunk-4mqq6896.js → chunk-nfh78ama.js} +5 -5
  46. package/dist/{chunk-67mex2d1.js → chunk-prr1meps.js} +1 -1
  47. package/dist/{chunk-s0vs1n7n.js → chunk-q2ph1a11.js} +1 -1
  48. package/dist/chunk-r82ywv0f.js +2 -0
  49. package/dist/{chunk-e9fmqn0g.js → chunk-smmwjt35.js} +1 -1
  50. package/dist/{chunk-s0226rfp.js → chunk-v2zmq70s.js} +4 -4
  51. package/dist/{chunk-jk0gba16.js → chunk-v4amxvbd.js} +2 -2
  52. package/dist/{chunk-8485q7dh.js → chunk-vhgrvw4p.js} +1 -1
  53. package/dist/{chunk-ejafjap5.js → chunk-vm2qnbvv.js} +1 -1
  54. package/dist/{chunk-ngd9dsrd.js → chunk-w91raavj.js} +1 -1
  55. package/dist/{chunk-nc85m4p9.js → chunk-waje9p23.js} +1 -1
  56. package/dist/{chunk-5gh02j5x.js → chunk-wkd5027b.js} +1 -1
  57. package/dist/{chunk-35cvjgj2.js → chunk-wxj9846e.js} +1 -1
  58. package/dist/{chunk-r86d03dv.js → chunk-xdvw04da.js} +1 -1
  59. package/dist/{chunk-hqzhej1p.js → chunk-y01dhmxc.js} +2 -2
  60. package/dist/{chunk-dsrgestd.js → chunk-yvvhgy8r.js} +5 -5
  61. package/dist/{chunk-1pzshxft.js → chunk-z7vpdebr.js} +1 -1
  62. package/dist/{chunk-a5agchz8.js → chunk-zjr0wrzw.js} +1 -1
  63. package/dist/cli.js +7 -7
  64. package/dist/craft-entry.js +1 -1
  65. package/dist/craft.js +1 -1
  66. package/dist/native/runtime/craft-bridge.js +4 -3
  67. package/dist/pwa.js +1 -1
  68. package/dist/ssg.js +2 -2
  69. package/package.json +5 -5
  70. package/dist/chunk-2mf8shg5.js +0 -2
  71. package/dist/chunk-5443hz48.js +0 -2
  72. package/dist/chunk-55eek6b1.js +0 -2
  73. package/dist/chunk-5y61b94b.js +0 -2
  74. package/dist/chunk-b6vwy6bd.js +0 -2
  75. package/dist/chunk-b8v19j69.js +0 -2
  76. package/dist/chunk-nrw84rpj.js +0 -2
  77. package/dist/chunk-p7nkw2nr.js +0 -2
  78. package/dist/chunk-pj1we4mn.js +0 -2
  79. package/dist/chunk-twk9kr73.js +0 -2
  80. package/dist/chunk-ywydtzba.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cd,zi,dl,ld,ud,dd,pd,fd,pl,fl,gd,md,hd,yd}from"./chunk-aw1wrygx.js";import"./chunk-nfh78ama.js";import"./chunk-h82f12we.js";import"./chunk-9bgb9n12.js";import"./chunk-806rdn0n.js";import"./chunk-a0rymg4g.js";import"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-waje9p23.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{dl as SUSPENSE_RESOLVER_RUNTIME,zi as buildSuspenseResolveScript,fd as createStreamRenderer,dd as extractStreamBoundaries,yd as generateHydrationRuntime,fl as islandDirective,md as processSectionDirectives,ud as processStreamDirectives,gd as registerStreamingDirectives,ld as renderStreamingPage,cd as streamTemplate,pd as streamTemplateSimple,hd as streamToResponse,pl as streamingSuspenseDirective};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gl,ml,Ee,hl,ra,Xt,Jt,cp,sa,Yt,Hn,yl,bl,vl,Js,Zt,wl,Qt,xl}from"./chunk-ejafjap5.js";import"./chunk-cm8ad78x.js";import"./chunk-374nhgyf.js";import"./chunk-h176dx1q.js";import"./chunk-s0ntt1cn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-4f5bmy7h.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Hn as MODULE_SPECIFIER_PREFIX,gl as bundleCacheDir,ml as bundleCacheEntryLimit,Qt as bundleClientScript,Jt as clearBundleFailures,Ee as clientBundleDependencies,Xt as getBundleFailures,Yt as hasUserImports,Zt as moduleSubstitutionKey,bl as normalizeRegistrySpecifiers,wl as queueClientBundleBuild,ra as recordBundleFailure,yl as registryIdForPath,sa as resolveBundlerFallback,vl as rewriteRegistryImports,cp as setBundlerFallbackMode,hl as shouldLogBundlerDiagnostics,xl as tempBuildName,Js as withModuleSubstitutes};
2
+ import{gl,ml,Ee,hl,ra,Xt,Jt,cp,sa,Yt,Hn,yl,bl,vl,Js,Zt,wl,Qt,xl}from"./chunk-vm2qnbvv.js";import"./chunk-0yvar2ha.js";import"./chunk-374nhgyf.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Hn as MODULE_SPECIFIER_PREFIX,gl as bundleCacheDir,ml as bundleCacheEntryLimit,Qt as bundleClientScript,Jt as clearBundleFailures,Ee as clientBundleDependencies,Xt as getBundleFailures,Yt as hasUserImports,Zt as moduleSubstitutionKey,bl as normalizeRegistrySpecifiers,wl as queueClientBundleBuild,ra as recordBundleFailure,yl as registryIdForPath,sa as resolveBundlerFallback,vl as rewriteRegistryImports,cp as setBundlerFallbackMode,hl as shouldLogBundlerDiagnostics,xl as tempBuildName,Js as withModuleSubstitutes};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{bp,Rl,uo,Ur,Xn,po,fo,Wr,qr,Kr,go,ua,Al,ht}from"./chunk-n42421az.js";import"./chunk-s0226rfp.js";import"./chunk-jgxzbthg.js";import"./chunk-h176dx1q.js";import"./chunk-s0ntt1cn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import{L}from"./chunk-4f5bmy7h.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{bp as clearScriptScanCache,Wr as convertServerLoopAttributesToDirectives,po as convertSignalDirectivesToAttributes,qr as convertSignalLoopsToAttributes,Xn as extractClientSignalNames,L as extractExports,ua as findMarkupIndexOutsideScripts,Ur as hasSignalsSyntax,uo as parseLoopExpression,fo as preEvalLiteralReactiveIfs,Kr as processScriptSetup,go as processSignals,Al as rewriteStxImportSpecifiers,Rl as scanScriptTags,ht as stripStxRuntimeImports};
2
+ import{bp,Rl,uo,Ur,Xn,po,fo,Wr,qr,Kr,go,ua,Al,ht}from"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import{L}from"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{bp as clearScriptScanCache,Wr as convertServerLoopAttributesToDirectives,po as convertSignalDirectivesToAttributes,qr as convertSignalLoopsToAttributes,Xn as extractClientSignalNames,L as extractExports,ua as findMarkupIndexOutsideScripts,Ur as hasSignalsSyntax,uo as parseLoopExpression,fo as preEvalLiteralReactiveIfs,Kr as processScriptSetup,go as processSignals,Al as rewriteStxImportSpecifiers,Rl as scanScriptTags,ht as stripStxRuntimeImports};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{S}from"./chunk-gtktv6nn.js";import{ve,Rt,Ao,Po,Oa,Na,Da,Ma,gs,Oo,La,ja,Ba,pn}from"./chunk-4f5bmy7h.js";import{i}from"./chunk-h176dx1q.js";import{Ws}from"./chunk-35cvjgj2.js";import{c}from"./chunk-xvs84gas.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=pn.filter((e)=>!ge.has(e)).sort(),te=[...S].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function xe(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let r=[];for(let u of t){if(u.offset===void 0)continue;let s=u.kind==="server"?he:be;Y.lastIndex=0;for(let l of u.code.matchAll(Y)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let o=y[1];if(!ye.has(o)||s.has(o))continue;let f=u.offset+g+m.index+y[0].length-o.length,p=e.slice(0,f),w=p.split(`
2
+ import{S}from"./chunk-gtktv6nn.js";import{ve,Rt,Ao,Po,Oa,Na,Da,Ma,gs,Oo,La,ja,Ba,pn}from"./chunk-467acz2w.js";import{i}from"./chunk-5btsefqt.js";import{Ws}from"./chunk-wxj9846e.js";import{c}from"./chunk-xvs84gas.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=pn.filter((e)=>!ge.has(e)).sort(),te=[...S].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function xe(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let r=[];for(let u of t){if(u.offset===void 0)continue;let s=u.kind==="server"?he:be;Y.lastIndex=0;for(let l of u.code.matchAll(Y)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let o=y[1];if(!ye.has(o)||s.has(o))continue;let f=u.offset+g+m.index+y[0].length-o.length,p=e.slice(0,f),w=p.split(`
3
3
  `).length;r.push({line:w,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:o.length,name:o,kind:u.kind,message:xe(o,u.kind)})}}}return r}import T from"path";var Se="@stacksjs/stx-typescript-plugin";function ke(e,t){let r=T.resolve(e);for(;;){let u=T.join(r,"tsconfig.json");if(t(u))return u;let s=T.dirname(r);if(s===r)return;r=s}}function ie(e,t,r){let u=ke(e,r);if(!u)return;let s=new Set,l=(g)=>{if(s.has(g))return;s.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let o=x.find((p)=>p?.name===Se),f=Array.isArray(o?.libs)?o.libs.filter((p)=>typeof p==="string"):[];return o?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let o of[...y].reverse()){if(typeof o!=="string"||!o.startsWith("."))continue;let f=T.resolve(T.dirname(g),o.endsWith(".json")?o:`${o}.json`),p=l(f);if(p!==void 0)return p}return};return l(u)??void 0}function Mc(e,t="",r=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",s=Oo(e)+Po(Ao(e.code)),l=e.kind==="client"||e.kind==="plain"?Da(t,e.code):"";return gs(`${u+s}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{E,t,a}from"./chunk-r0ys9aqa.js";import{Y}from"./chunk-4f5bmy7h.js";import{bo}from"./chunk-tenbwcts.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!J(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
2
+ import{E,t,a}from"./chunk-r0ys9aqa.js";import{Y}from"./chunk-467acz2w.js";import{bo}from"./chunk-tenbwcts.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!J(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
3
  `),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,p]=o,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=ae(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return R(r[l],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=ne(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(o))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function ya(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...P,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>E(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?Y(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return a("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(o)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>E(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Y(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return a("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function ba(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||p} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),f=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function va(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await bo(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let p=await Ae(g,o);if(u.push(o),p.length>0)i[o]=p}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:i,scannedFiles:u}}var wa={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},xa={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{ya,ba,va,wa,xa};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{N,Nl,yo,i,R,Ep,Tp}from"./chunk-h176dx1q.js";import"./chunk-s0ntt1cn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-4f5bmy7h.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{R as config,N as defaultConfig,Ep as defineStxConfig,yo as discoverConfig,i as loadStxConfig,Nl as resolveStxDirectories,Tp as validateConfig};
2
+ import{N,Nl,yo,i,R,Ep,Tp}from"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{R as config,N as defaultConfig,Ep as defineStxConfig,yo as discoverConfig,i as loadStxConfig,Nl as resolveStxDirectories,Tp as validateConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ec,Tc}from"./chunk-yvvhgy8r.js";import"./chunk-ay262g2y.js";import"./chunk-mdx9fcej.js";import"./chunk-xr9a0hcr.js";import"./chunk-km37yrk4.js";import"./chunk-k9j0cp1w.js";import"./chunk-58dv14c3.js";import"./chunk-j46gqse8.js";import"./chunk-v4amxvbd.js";import"./chunk-5tbey00z.js";import"./chunk-xvnrm5c3.js";import"./chunk-wkd5027b.js";import"./chunk-f4z9w4kc.js";import"./chunk-vhgrvw4p.js";import"./chunk-brftzqzj.js";import"./chunk-cjf01cp4.js";import"./chunk-3zbege39.js";import"./chunk-dg2f47za.js";import"./chunk-pzxy40a2.js";import"./chunk-aw1wrygx.js";import"./chunk-qh7fvr2z.js";import"./chunk-ae12wgc5.js";import"./chunk-d7js6v1m.js";import"./chunk-ry501z40.js";import"./chunk-974prn41.js";import"./chunk-d1ssvg9k.js";import"./chunk-q2ph1a11.js";import"./chunk-wxj9846e.js";import"./chunk-ct0ee0fr.js";import"./chunk-463r8dqk.js";import"./chunk-03xn8244.js";import"./chunk-rspe6qa5.js";import{Gt}from"./chunk-f9e5k693.js";import"./chunk-vm2qnbvv.js";import"./chunk-0yvar2ha.js";import"./chunk-374nhgyf.js";import{$e,o}from"./chunk-nfh78ama.js";import"./chunk-h82f12we.js";import"./chunk-9bgb9n12.js";import"./chunk-806rdn0n.js";import"./chunk-a0rymg4g.js";import"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-hfsd13r5.js";import{ye}from"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import{Zn,Qn}from"./chunk-waje9p23.js";import{Jr,N,i}from"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import{g,De}from"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";import"./chunk-b7z6rqfg.js";import"./chunk-drabexxq.js";export{Jr as buildWebComponents,Qn as cacheTemplate,Zn as checkCache,Gt as classifyAllScripts,Ec as createMiddleware,Tc as createRoute,N as defaultConfig,g as extractVariables,ye as injectRouterScript,i as loadStxConfig,De as processClientScript,o as processDirectives,$e as readMarkdownFile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Un,o}from"./chunk-nfh78ama.js";import"./chunk-h82f12we.js";import"./chunk-9bgb9n12.js";import"./chunk-806rdn0n.js";import"./chunk-a0rymg4g.js";import"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-hfsd13r5.js";import{ye}from"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-waje9p23.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import{Pe,ys,bs}from"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Un as buildModulesTag,ye as injectRouterScript,o as processDirectives,ys as processJsonDirective,bs as processOnceDirective,Pe as validateClientScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ou}from"./chunk-mdx9fcej.js";import"./chunk-v4amxvbd.js";import"./chunk-f9e5k693.js";import"./chunk-0yvar2ha.js";import"./chunk-v2zmq70s.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Ou as startProductionServer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pl,vp,wp,xp,Sp,Il,Ol,kp,_p,ho,Cp,Zn,Qn,Xr}from"./chunk-nc85m4p9.js";import{Qe}from"./chunk-yn9kvsk1.js";import"./chunk-4f5bmy7h.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Sp as __setSignalsGeneratorsForTest,Qe as cacheEngineFingerprint,Qn as cacheTemplate,Zn as checkCache,Cp as clearDevCaches,Ol as getCachedRouterScript,Il as getCachedSignalsRuntime,kp as getServeClientAsset,ho as getServeModuleBundle,Xr as hashFilePath,wp as invalidateFileCache,xp as invalidateFileCacheByDir,vp as readFileCached,_p as registerServeModuleBundle,Pl as templateCache};
2
+ import{Pl,vp,wp,xp,Sp,Il,Ol,kp,_p,ho,Cp,Zn,Qn,Xr}from"./chunk-waje9p23.js";import{Qe}from"./chunk-yn9kvsk1.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Sp as __setSignalsGeneratorsForTest,Qe as cacheEngineFingerprint,Qn as cacheTemplate,Zn as checkCache,Cp as clearDevCaches,Ol as getCachedRouterScript,Il as getCachedSignalsRuntime,kp as getServeClientAsset,ho as getServeModuleBundle,Xr as hashFilePath,wp as invalidateFileCache,xp as invalidateFileCacheByDir,vp as readFileCached,_p as registerServeModuleBundle,Pl as templateCache};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{zu}from"./chunk-j46gqse8.js";import"./chunk-v4amxvbd.js";import"./chunk-ct0ee0fr.js";import"./chunk-f9e5k693.js";import"./chunk-0yvar2ha.js";import"./chunk-nfh78ama.js";import"./chunk-h82f12we.js";import"./chunk-9bgb9n12.js";import"./chunk-806rdn0n.js";import"./chunk-a0rymg4g.js";import"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-waje9p23.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{zu as buildForProduction};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{B}from"./chunk-4f5bmy7h.js";import{Be,A,Nt}from"./chunk-t6m5d64b.js";import{ut,ke,O,_e,Ni,Vs,Di,Cn}from"./chunk-jk0gba16.js";import{vt,le,Ye}from"./chunk-kypwg2ws.js";import{Qs}from"./chunk-cm8ad78x.js";import{En}from"./chunk-pfn70zdr.js";import{he}from"./chunk-s0226rfp.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function kn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ke(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Ou(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Ni(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=En(r.routeRules),f=new G,h=Qs(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Nt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ye(i.html)),M.set(n.pattern,he(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Nt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=le(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return kn(n,await Be(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=ke(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Vs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Cn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Di(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-2mf8shg5.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Ye(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",he(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?_e(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Ye(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",he(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(_e(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{B}from"./chunk-467acz2w.js";import{Be,A,Nt}from"./chunk-t6m5d64b.js";import{ut,ke,O,_e,Ni,Vs,Di,Cn}from"./chunk-v4amxvbd.js";import{vt,le,Ye}from"./chunk-kypwg2ws.js";import{Qs}from"./chunk-0yvar2ha.js";import{En}from"./chunk-pfn70zdr.js";import{he}from"./chunk-v2zmq70s.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function kn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ke(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Ou(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Ni(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=En(r.routeRules),f=new G,h=Qs(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Nt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ye(i.html)),M.set(n.pattern,he(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Nt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=le(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return kn(n,await Be(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=ke(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Vs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Cn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Di(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-jxvyvz64.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Ye(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",he(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?_e(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Ye(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",he(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(_e(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{kn,Ou};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ve,Lo,jo,Ql,It,Xa,Bo,Ja,Op,Ne,fn,De}from"./chunk-4f5bmy7h.js";import{nc,r}from"./chunk-9tg4995v.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{ve as BROWSER_CORE_IMPORTS,Ql as STX_AUTO_IMPORTS,Lo as extractAndStripCssImports,Ne as extractBridgeData,nc as findInterpolationEnd,Ja as generateAutoImportDestructuring,Op as generateBrowserAutoImportDestructuring,fn as generateServerDataBridge,It as injectBrowserCoreAutoImports,De as processClientScript,Bo as referencesName,jo as renderVendorStyleTags,r as stripCommentsAndLiterals,Xa as transformAutoImports};
2
+ import{ve,Lo,jo,Ql,It,Xa,Bo,Ja,Op,Ne,fn,De}from"./chunk-467acz2w.js";import{nc,r}from"./chunk-9tg4995v.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{ve as BROWSER_CORE_IMPORTS,Ql as STX_AUTO_IMPORTS,Lo as extractAndStripCssImports,Ne as extractBridgeData,nc as findInterpolationEnd,Ja as generateAutoImportDestructuring,Op as generateBrowserAutoImportDestructuring,fn as generateServerDataBridge,It as injectBrowserCoreAutoImports,De as processClientScript,Bo as referencesName,jo as renderVendorStyleTags,r as stripCommentsAndLiterals,Xa as transformAutoImports};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ro,Aa,s,Tt,se,k,Pe,cn,Ie,de,G,cr,ln,ms,za,dn,dr,ys,bs,Ha,Do,Va,Ua,Wa,qa,Ne,De,vs,je,n,gn,m,d,V,Y,we,x,_}from"./chunk-4f5bmy7h.js";import{l,p,E,t,ie,U,a,xe,qo,D,bn,Ko,Lt,Go,oc,mr,ic,rt,ac,hr,cc,vn,Xo,lc,yr,vr,Se,Jo}from"./chunk-r0ys9aqa.js";import{Nt}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-tjwv101c.js";import{h}from"./chunk-jt9kxnva.js";import{rr,os}from"./chunk-kypwg2ws.js";import{ga,ma,er,Je,ha,R}from"./chunk-h176dx1q.js";import{wo,xo,So,ko}from"./chunk-ygb33q5w.js";import{la,Vr}from"./chunk-vvezfjt1.js";import{Br,Fr,zr}from"./chunk-mwmmmbxj.js";import{Ur,po,fo,Wr,qr,go}from"./chunk-n42421az.js";import{jr,Gn}from"./chunk-psprkndv.js";import{ro}from"./chunk-9bgb9n12.js";import{re,ao,co,lo}from"./chunk-hx787tfa.js";import{Jn,he,da,Yn,pa}from"./chunk-s0226rfp.js";import{K,Ge}from"./chunk-yft8yn6y.js";import{ya,ba}from"./chunk-s0ntt1cn.js";import{C,wn,Yo}from"./chunk-078as147.js";import gs from"fs";import ce from"path";function lt(){return`
2
+ import{Ro,Aa,s,Tt,se,k,Pe,cn,Ie,de,G,cr,ln,ms,za,dn,dr,ys,bs,Ha,Do,Va,Ua,Wa,qa,Ne,De,vs,je,n,gn,m,d,V,Y,we,x,_}from"./chunk-467acz2w.js";import{l,p,E,t,ie,U,a,xe,qo,D,bn,Ko,Lt,Go,oc,mr,ic,rt,ac,hr,cc,vn,Xo,lc,yr,vr,Se,Jo}from"./chunk-r0ys9aqa.js";import{Nt}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-g5jtypvv.js";import{h}from"./chunk-h82f12we.js";import{rr,os}from"./chunk-kypwg2ws.js";import{ga,ma,er,Je,ha,R}from"./chunk-5btsefqt.js";import{wo,xo,So,ko}from"./chunk-ygb33q5w.js";import{la,Vr}from"./chunk-hnwcd41v.js";import{Br,Fr,zr}from"./chunk-a0rymg4g.js";import{Ur,po,fo,Wr,qr,go}from"./chunk-hfsd13r5.js";import{jr,Gn}from"./chunk-806rdn0n.js";import{ro}from"./chunk-9bgb9n12.js";import{re,ao,co,lo}from"./chunk-hx787tfa.js";import{Jn,he,da,Yn,pa}from"./chunk-v2zmq70s.js";import{K,Ge}from"./chunk-yft8yn6y.js";import{ya,ba}from"./chunk-k9pk5yq0.js";import{C,wn,Yo}from"./chunk-078as147.js";import gs from"fs";import ce from"path";function lt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -1558,13 +1558,13 @@ ${I}
1558
1558
  </style>`;c=c.replace(S,P),v.lastIndex=0}catch(I){}}}return c}import it from"path";var ds=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ps=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function fs(i,e){if(!e||!i.includes("/"))return i;let u=it.dirname(e);return i.replace(ds,(c,g,r,f)=>{let v=it.resolve(u,f);return`${g}${r}${v.split(it.sep).join("/")}${r}`})}function un(i,e){if(!e||!i.includes("<script"))return i;return i.replace(ps,(u,c,g,r)=>`${c}${fs(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function pn(i){return i.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sn(i,e){let u=i.length,c=e,g=!0,r=[],f=(v)=>v+9<=u&&i[v]==="<"&&i[v+1]==="/"&&(i[v+2]==="s"||i[v+2]==="S")&&(i[v+3]==="c"||i[v+3]==="C")&&(i[v+4]==="r"||i[v+4]==="R")&&(i[v+5]==="i"||i[v+5]==="I")&&(i[v+6]==="p"||i[v+6]==="P")&&(i[v+7]==="t"||i[v+7]==="T")&&(i[v+8]===">"||/\s/.test(i[v+8]));while(c<u){let v=i[c];if(f(c))return c;if(v==="/"&&i[c+1]==="/"){if(c=i.indexOf(`
1559
1559
  `,c+2),c===-1)return-1;c+=1,g=!0;continue}if(v==="/"&&i[c+1]==="*"){let y=i.indexOf("*/",c+2);if(y===-1)return-1;c=y+2,g=!0;continue}if(v==="/"&&g){let y=c+1,S=!1;while(y<u){let b=i[y];if(b==="\\"){y+=2;continue}if(b==="[")S=!0;else if(b==="]")S=!1;else if(b==="/"&&!S){y++;break}else if(b===`
1560
1560
  `){y=-1;break}y++}if(y===-1){c++,g=!1;continue}while(y<u&&/[a-z]/.test(i[y]))y++;c=y,g=!1;continue}if(v==="'"||v==='"'){let y=v;c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]===y){c++;break}if(i[c]===`
1561
- `)break;c++}g=!1;continue}if(v==="`"){c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++,g=!1;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;c++}return-1}function $n(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(i);if(!c)return null;let g=c.index+c[0].length,r=i.indexOf("</script>",g);if(r===-1)return null;let f=i.indexOf(">",r);if(f===-1)return null;return{start:c.index,end:f+1}}var hs=4096;async function fn(i,e,u){if(u.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:c}=await import("./chunk-jkhc0q7g.js");return`<script ${i} src="${c(e)}"></script>`}async function Un(i,e,u){try{let{registeredModuleIdsIn:c,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-c9fs966z.js")),r=[],f=await g(c(...i),{minify:Yo(e.buildMode,e.minifyClient),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-jkhc0q7g.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ws(i,e=""){let u=$n(i,"data-stx-runtime");if(!u)return i;let c=Jn(i);if(c===-1||c===u.start){if(!e)return i;return i.slice(0,u.end)+e+i.slice(u.end)}if(c<u.start)return i.slice(0,c)+i.slice(u.start,u.end)+e+`
1561
+ `)break;c++}g=!1;continue}if(v==="`"){c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++,g=!1;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;c++}return-1}function $n(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(i);if(!c)return null;let g=c.index+c[0].length,r=i.indexOf("</script>",g);if(r===-1)return null;let f=i.indexOf(">",r);if(f===-1)return null;return{start:c.index,end:f+1}}var hs=4096;async function fn(i,e,u){if(u.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:c}=await import("./chunk-madrssd6.js");return`<script ${i} src="${c(e)}"></script>`}async function Un(i,e,u){try{let{registeredModuleIdsIn:c,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-8e32860g.js")),r=[],f=await g(c(...i),{minify:Yo(e.buildMode,e.minifyClient),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-madrssd6.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ws(i,e=""){let u=$n(i,"data-stx-runtime");if(!u)return i;let c=Jn(i);if(c===-1||c===u.start){if(!e)return i;return i.slice(0,u.end)+e+i.slice(u.end)}if(c<u.start)return i.slice(0,c)+i.slice(u.start,u.end)+e+`
1562
1562
  `+i.slice(c,u.start)+i.slice(u.end);let g=i.slice(u.start,u.end),r=i.slice(0,u.start)+i.slice(u.end),f=Jn(r);if(f===-1)return g+e+`
1563
1563
  `+r;return r.slice(0,f)+g+e+`
1564
1564
  `+r.slice(f)}function xs(i){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return i.replace(e,(u,c,g)=>{let r=i.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${c}}}`:`{<!--stx-literal-->{${c}}}`})}async function o(i,e,u,c,g){if(c.ssr===!1&&!c.autoShell&&c.buildMode==="spa")return i;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(i,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of c._layerGraph?.configDependencies??[])g.add(f);if(r&&c.runtimeConfig)await hn(e,u,c.runtimeConfig);if(r)Wa(e),e.__stx_scope_seq??={n:0,key:vs(String(e.__filename??u))},e.__stx_head_injections=Go(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((c.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))ro(i,u);try{return await se.timeAsync("template-processing",async()=>{let f=await ks(i,e,u,c,g);if(r)f=Do(f);if(r&&c.autoShell&&c.buildMode!=="compile"){let v=Se(c.app?.head,{known:vr,source:"app.head"}),S=(e.__stx_runtime_head||null)??Jo(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?x(A,e,u):void 0,M=S.title||w||O,I=!S.title&&(!!w||!!O),P=S.meta||[],N=new Set(P.map((W)=>rt(W)).filter(Boolean)),F={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((W)=>!N.has(rt(W))),...P],link:[...v.link||[],...S.link||[]],script:[...v.script||[],...S.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
1565
1565
  `),...S.htmlAttrs&&{htmlAttrs:ac(v.htmlAttrs,S.htmlAttrs)},...S.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...S.bodyAttrs}}},z=Xo(f);if(f=yr(f,F,{...I&&{titleIsHtml:!0},...c.app?.colorMode&&{colorMode:c.app.colorMode}},z),z)f=lc(f,v),f=hr(f,F.htmlAttrs);let L=f.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&f.includes("<head")){let W=L[1],X=os(W);f=f.replace(/<head\b[^>]*>/i,(Q)=>`${Q}
1566
1566
  <meta name="stx-layout" content="${pn(W)}">
1567
- <meta name="stx-layout-group" content="${pn(X)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),H=j?K(f):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){f=Ge(f,(X,Q)=>`<body${Q} data-stx="${j[1]}">`);let W=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(W,"$1")}}if(r){let v=e.__stx_head_injections??Go(),y=cc(f);if(y!==null)v.beforeClose.push(y);let S=tn(f);if(S!==null)v.afterOpen.push(S);if(c.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=oc(f,v);let b=c.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,S=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-nrw84rpj.js")),M=c.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,S=await fn("data-stx-stores",I,c)??b}catch{}y=await Un([f,b],c,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-znhrftsf.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-55eek6b1.js")),M=c.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(c._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,c)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,S,w,T].filter((O)=>O!==null).map((O)=>`
1567
+ <meta name="stx-layout-group" content="${pn(X)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),H=j?K(f):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){f=Ge(f,(X,Q)=>`<body${Q} data-stx="${j[1]}">`);let W=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(W,"$1")}}if(r){let v=e.__stx_head_injections??Go(),y=cc(f);if(y!==null)v.beforeClose.push(y);let S=tn(f);if(S!==null)v.afterOpen.push(S);if(c.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=oc(f,v);let b=c.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,S=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-7ynw1f29.js")),M=c.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,S=await fn("data-stx-stores",I,c)??b}catch{}y=await Un([f,b],c,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-e8nmm7g1.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-ez0pzhh7.js")),M=c.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(c._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,c)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,S,w,T].filter((O)=>O!==null).map((O)=>`
1568
1568
  ${O}`).join("");f=ws(f,A)}else{let y=await Un([f],c,g);if(y){let S=f.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(S!==-1)f=f.slice(0,S)+y+`
1569
1569
  `+f.slice(S)}}if(r)f=ic(f);if(r&&e.__stx_inject_css!==!1)f=await h(f,void 0,c.buildMode==="serve",!0);else if(r)f=ln(f);if(f=f.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),f=xs(f),r&&e.__stx_runtime_config)f=Nt(f,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let v=dr(e);if(v){let y=/<head\b[^>]*>/i.exec(f),S=y?y.index+y[0].length:0;f=f.slice(0,S)+v+f.slice(S)}}return f})}catch(f){if(f instanceof U)throw f;let v=f instanceof Error?f.message:String(f),y=new ie(`Template processing failed: ${v}`,u,void 0,void 0,i.substring(0,200)+(i.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),bn.logDetailedError(y,{filePath:u,template:i.substring(0,500)}),C()&&!c.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(c.debug)throw y;return qo.createFallbackContent("Template Processing",y)}}async function ks(i,e,u,c,g){let r=process.cwd(),f={...c,partialsDir:c.partialsDir&&!ce.isAbsolute(c.partialsDir)?ce.resolve(r,c.partialsDir):c.partialsDir,componentsDir:c.componentsDir&&!ce.isAbsolute(c.componentsDir)?ce.resolve(r,c.componentsDir):c.componentsDir,layoutsDir:c.layoutsDir&&!ce.isAbsolute(c.layoutsDir)?ce.resolve(r,c.layoutsDir):c.layoutsDir},v=f,y=i;await Es(u,e),$s(e,v),y=await xe(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let S=de(y,Ie,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=S.output;let b=S.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,H)=>b[Number(H)]??""),T="\x00STX_ESCAPED_AT\x00",A="\x00STX_ESC_MUSTACHE_OPEN\x00",O="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,T),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(L,j)=>`${A}${j}${O}`),y=Jt(y),y=await an(y,u,g);let M={};y=Fr(y,M);let I={...e.__sections||{}},P="",N=mt(gt(i)),F=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let z=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(z)P=z[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
1570
1570
  ${y.trim()}
@@ -1573,7 +1573,7 @@ ${y.trim()}
1573
1573
  @endsection`}}if(P&&y.includes("<script")){let L=G(y),j=L.scripts.map((H)=>mn(H,u)??H);y=cr(L.output,j)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,j,H)=>(I[j]=H,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,j,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return L;try{let W=l(H.trim(),e);if(W===void 0)return L;let Q=(e.__stx_inline_section_values??=[]).push(W)-1;return I[j]=`{{ __stx_inline_section_values[${Q}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,H)=>{if(H.includes("@parent"))I[j]=H.replace("@parent",Te);else I[j]=H.trim();return""}),e.__sections=I,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,j,H)=>I[j]||H||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||"");if(y=zr(y,M),P){let L=[],j=G(y),H=de(j.output,cn,(W,X)=>`\x00STX_ORPHAN_STYLE_${X}\x00`);if(y=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(W,X,Q)=>{let ee=X==="SCRIPT"?mn(j.scripts[Number(Q)],u):H.tokens[Number(Q)];if(ee)L.push(ee);return""}),L.length>0){let W=L.join(`
1574
1574
  `);I.content=I.content?`${I.content}
1575
1575
  ${W}`:W,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await xe(()=>gn(P,u,f,g),null,()=>{throw new ie(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ee=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return gs.readdirSync(ae).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(f.layoutsDir),...ee(f.fallbackLayoutsDir)].filter((oe,ae,le)=>le.indexOf(oe)===ae).sort(),ue=`Layout not found: ${P} (referenced from ${u})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:f.layoutsDir?`. No .stx layouts found in ${f.layoutsDir}`:"");if(D.log(Error(ue),{layoutPath:P,filePath:u,available:te},"error"),console.error(`[stx] ${ue}`),f.debug)throw new ie(ue,u);return y}let j=await xe(()=>Bun.file(L).text(),"",()=>{throw new ie(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=un(j,L);let H=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(f.debug)console.log(`Found nested layout: ${H[1]} in ${L}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,le,be)=>(ee[le]=be.trim(),""));for(let[ae,le]of Object.entries(ee))if(I[ae]&&I[ae].includes(Te)){let be=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,be)+le+I[ae].slice(be+Te.length)}else if(!I[ae])I[ae]=le;let ue={...e,__sections:I},oe=`@layout('${H[1]}')${te}`;return await o(oe,ue,L,f,g)}let W=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=Fr(W,M),Q={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Q[te]=ue.trim(),`@slot('${te}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(I[te]){let oe=I[te];if(oe.includes(Te)){let ae=Q[te]||"",le=oe.indexOf(Te);oe=oe.slice(0,le)+ae+oe.slice(le+Te.length)}return oe}return ue||""}),X=Ss(X,I),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),X=zr(X,M),e.__originalFilePath=u,y=await kn(X,e,L,f,g),y=`<!-- stx-layout: ${P} -->
1576
- ${y}`,w(y)}catch(L){if(L instanceof U)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function Ss(i,e){return i.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,c,g)=>{let r=e[c];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function $s(i,e){if(i.__stx_sfc_mode=!0,i.__stx_options=e,e.buildMode)i.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",c={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)c[g]=r;i.$env=c}async function Es(i,e){await xe(()=>Kt(i,e),void 0,(u)=>{D.log(u,{filePath:i,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${i}: ${u.message}`)})}var ot="data-stx-source";function mn(i,e){if(!i)return i;let u=/^<script\b([^>]*)>/i.exec(i);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return i;return`<script ${ot}="${encodeURIComponent(e)}"${i.slice(7)}`}function _s(i){let e=new RegExp(`${ot}="([^"]*)"`).exec(i);return e?decodeURIComponent(e[1]):void 0}function yn(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(i,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(i)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function Ts(i,e,u,c){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-1k7js5nz.js")),r=[],f=!C()&&!wn();for(let y of g(i)){let S=y.attrs;if(!/\bserver\b/.test(S))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(i,b);if(w===-1)continue;let T=i.slice(b,w);if(!T.trim())continue;let A=_s(S)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-r86d03dv.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(c?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return i;let v=i;for(let y of r.sort((S,b)=>b.index-S.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Cs(i,e,u){try{let{interpolateScriptsInTemplate:c}=await s("stx/expressions",()=>import("./chunk-a5agchz8.js"));return c(i,e,{skipServer:!0})}catch(c){let g=c instanceof Error?c:Error(String(c));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),i}}async function kn(i,e,u,c,g){let r=i,f=c;if(r=await Ts(r,e,u,c),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Cs(r,e,u),r=await At(r,e,u,f),we(r))r=po(r,e),r=qr(r,e),r=Wr(r,e);r=fo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-2mf8shg5.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Vr(r,e,u,f,g),r=ga(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-c9jnkbdb.js"));r=y(r,e,u);let{processTeleportDirectives:S}=await s("stx/teleport",()=>import("./chunk-kerxevf9.js"));r=S(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-sqvdrk81.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-8j0zcyd7.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-sncp7jhv.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-myc60z74.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-a1r3jbt4.js"));r=P(r,e,u),r=N(r,e,u),r=F(r,e,u);let{processPartialHydrationDirectives:z,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-7jxj6cv1.js"));r=z(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:H}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=H(r,e,u);let{processFormValidationDirectives:W}=await s("stx/forms-validation",()=>import("./chunk-4566drka.js"));r=W(r,e,u);let{processHeadDirective:X,processTitleDirective:Q,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-vnnwp1cg.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=X(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
1576
+ ${y}`,w(y)}catch(L){if(L instanceof U)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function Ss(i,e){return i.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,c,g)=>{let r=e[c];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function $s(i,e){if(i.__stx_sfc_mode=!0,i.__stx_options=e,e.buildMode)i.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",c={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)c[g]=r;i.$env=c}async function Es(i,e){await xe(()=>Kt(i,e),void 0,(u)=>{D.log(u,{filePath:i,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${i}: ${u.message}`)})}var ot="data-stx-source";function mn(i,e){if(!i)return i;let u=/^<script\b([^>]*)>/i.exec(i);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return i;return`<script ${ot}="${encodeURIComponent(e)}"${i.slice(7)}`}function _s(i){let e=new RegExp(`${ot}="([^"]*)"`).exec(i);return e?decodeURIComponent(e[1]):void 0}function yn(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(i,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(i)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function Ts(i,e,u,c){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-k7gcx130.js")),r=[],f=!C()&&!wn();for(let y of g(i)){let S=y.attrs;if(!/\bserver\b/.test(S))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(i,b);if(w===-1)continue;let T=i.slice(b,w);if(!T.trim())continue;let A=_s(S)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-xdvw04da.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(c?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return i;let v=i;for(let y of r.sort((S,b)=>b.index-S.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Cs(i,e,u){try{let{interpolateScriptsInTemplate:c}=await s("stx/expressions",()=>import("./chunk-zjr0wrzw.js"));return c(i,e,{skipServer:!0})}catch(c){let g=c instanceof Error?c:Error(String(c));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),i}}async function kn(i,e,u,c,g){let r=i,f=c;if(r=await Ts(r,e,u,c),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Cs(r,e,u),r=await At(r,e,u,f),we(r))r=po(r,e),r=qr(r,e),r=Wr(r,e);r=fo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-jxvyvz64.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Vr(r,e,u,f,g),r=ga(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-c9jnkbdb.js"));r=y(r,e,u);let{processTeleportDirectives:S}=await s("stx/teleport",()=>import("./chunk-kerxevf9.js"));r=S(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-sqvdrk81.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-8j0zcyd7.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-sncp7jhv.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-myc60z74.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-a1r3jbt4.js"));r=P(r,e,u),r=N(r,e,u),r=F(r,e,u);let{processPartialHydrationDirectives:z,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-7jxj6cv1.js"));r=z(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:H}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=H(r,e,u);let{processFormValidationDirectives:W}=await s("stx/forms-validation",()=>import("./chunk-dnwd04ch.js"));r=W(r,e,u);let{processHeadDirective:X,processTitleDirective:Q,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-vnnwp1cg.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=X(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
1577
1577
  `;if(r=Q(r,e),r=ee(r,e,u),r=Xt(r),r=ao(r,e),r=Ct(r),r=Ut(r),r=await Br(r,e,u,f,g),r=await Vr(r,e,u,f,g),e.__stxProcessingDepth===1)r=qa(r,e);if(r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=Do(r),r=re(r,e,u),r=jr(r),r=za(r,e,{filePath:u,buildMode:f.buildMode}),r=co(r,e),r=lo(r,e),r=ze(r,e),r=jt(r,e),r=Ht(r,e),r=await bt(r,e,u,f),r=await ha(r,e,u),r=await ya(r,e,u,f),r=ba(r,e,u,f),r=wo(r,e,u,f),r=xo(r,e,u),r=So(r,e,u,f),r=Et(r,e,u,f),r=ys(r,e),r=bs(r),r=Ha(r),!f.skipEventDirectives)r=Aa(r,e,u);if(r=vt(r,e,u),f.debug){let B=/\bx-data\s*=/.test(r),q=Ur(i);if(B&&q)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1578
1578
  Both work on the same page, but they manage separate scopes.
1579
1579
  Prefer signals (state/derived/effect) for new components.`)}r=la(r,e),r=await x(r,e,u),r=Va(r),r=Ua(r),r=pt(r);let{processXElementDirectives:oe}=await s("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=oe(r);let ae=e.__originalFilePath||u,le=Ne(e);if(r=await go(r,f,ae,le),r=It(r,e),r=await Wt(r,e,u,f),f.media?.image?.autoSiblings){let B=f.publicDir||"public",{rewriteImagesWithSiblings:q}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-01ks1244.js"));r=await q(r,{publicDir:B})}if(f.seo?.enabled)r=ko(r,e,f);let be=(B,q,J=!0)=>{if(!q)return B;let me=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(B),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Ce=ne.index+fe.index;B=B.slice(0,Ce)+me[0]+B.slice(Ce+fe[0].length)}if(q=q.replace(me[0],"").trim(),!q)return B}if(/<\/head>/i.test(B))return B.replace(/<\/head>/i,`${q}
@@ -1587,6 +1587,6 @@ ${lt()}
1587
1587
  `+Ce}else r=r.replace("</head>",`${q}
1588
1588
  </head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
1589
1589
  ${q}`);else r=q+`
1590
- `+r}{let{scanScriptTags:B}=await s("stx/signal-processing",()=>import("./chunk-1k7js5nz.js")),q=[];for(let J of B(r)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=Sn(r,me);if(ne===-1)continue;let fe=ne+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;q.push({start:J.start,end:fe})}if(q.length>0){let J=Array(q.length+1),me=0;for(let ne=0;ne<q.length;ne++){let{start:fe,end:Ce}=q[ne];J[ne]=r.slice(me,fe),me=Ce}J[q.length]=r.slice(me),r=J.join("")}}let at=ms(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-1k7js5nz.js"));for(let B of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:B.fullMatch,attrs:B.attrs,content:B.body});for(let{match:B,attrs:q,content:J}of ct){Xe=!0;let me=J;Pe(J,u,c.strict,e.__originalFilePath);let ne=await De(J,{eventBindings:Rn,attrs:q,hasColonDirectives:Mn,templateContent:i,filePath:u,projectRoot:process.cwd(),production:Yo(c.buildMode,c.minifyClient),serverData:le});r=r.replace(B,()=>ne)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let B=e.__stx_event_bindings||[];if(B.length>0){let q=Ro(B);if(q){let J=r.lastIndexOf("</body>");r=J===-1?r+q:r.slice(0,J)+q+`
1590
+ `+r}{let{scanScriptTags:B}=await s("stx/signal-processing",()=>import("./chunk-k7gcx130.js")),q=[];for(let J of B(r)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=Sn(r,me);if(ne===-1)continue;let fe=ne+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;q.push({start:J.start,end:fe})}if(q.length>0){let J=Array(q.length+1),me=0;for(let ne=0;ne<q.length;ne++){let{start:fe,end:Ce}=q[ne];J[ne]=r.slice(me,fe),me=Ce}J[q.length]=r.slice(me),r=J.join("")}}let at=ms(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-k7gcx130.js"));for(let B of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:B.fullMatch,attrs:B.attrs,content:B.body});for(let{match:B,attrs:q,content:J}of ct){Xe=!0;let me=J;Pe(J,u,c.strict,e.__originalFilePath);let ne=await De(J,{eventBindings:Rn,attrs:q,hasColonDirectives:Mn,templateContent:i,filePath:u,projectRoot:process.cwd(),production:Yo(c.buildMode,c.minifyClient),serverData:le});r=r.replace(B,()=>ne)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let B=e.__stx_event_bindings||[];if(B.length>0){let q=Ro(B);if(q){let J=r.lastIndexOf("</body>");r=J===-1?r+q:r.slice(0,J)+q+`
1591
1591
  `+r.slice(J)}e.__stx_event_bindings=[]}}if(!he(r)&&da(r))r=await Yn(r,f);if(r=pa(r),f.csp?.enabled&&f.csp.useNonce&&typeof e.cspNonce==="string")r=$t(r,e.cspNonce);return r}
1592
1592
  export{gt,$e,oa,Lr,to,no,Un,o};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qu}from"./chunk-5gh02j5x.js";import"./chunk-h176dx1q.js";import"./chunk-s0ntt1cn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-4f5bmy7h.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Qu as buildApp};
2
+ import{Qu}from"./chunk-wkd5027b.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Qu as buildApp};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{k,J}from"./chunk-4f5bmy7h.js";import{i}from"./chunk-h176dx1q.js";import{Ee,Yt,Zt,Qt}from"./chunk-ejafjap5.js";import{ht}from"./chunk-n42421az.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-078as147.js";import p from"path";var a=new Map;function _(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Ud(c){let n;if(c)n=p.resolve(c);else{let t=await i();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Zt()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ae(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Ee(t))])],f=pt(l()),d=qt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return ae(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,y=J({loader:"ts",target:"browser",define:k()});for(let t of x)try{let e=await Bun.file(t).text(),v=p.basename(t,".ts");if(_(e,g),Yt(e))e=await Qt(e,t,{projectRoot:process.cwd(),externalizeUserModules:C()});e=ht(e),e=T(e),e=xn(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=y.transformSync(e),m.push(`// Store: ${v}
2
+ import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{k,J}from"./chunk-467acz2w.js";import{i}from"./chunk-5btsefqt.js";import{Ee,Yt,Zt,Qt}from"./chunk-vm2qnbvv.js";import{ht}from"./chunk-hfsd13r5.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-078as147.js";import p from"path";var a=new Map;function _(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Ud(c){let n;if(c)n=p.resolve(c);else{let t=await i();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Zt()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ae(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Ee(t))])],f=pt(l()),d=qt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return ae(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,y=J({loader:"ts",target:"browser",define:k()});for(let t of x)try{let e=await Bun.file(t).text(),v=p.basename(t,".ts");if(_(e,g),Yt(e))e=await Qt(e,t,{projectRoot:process.cwd(),externalizeUserModules:C()});e=ht(e),e=T(e),e=xn(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=y.transformSync(e),m.push(`// Store: ${v}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return ae(a,s,f,""),null;let h=m.join(`
4
4
 
5
5
  `),w=`;(function(){
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Iu}from"./chunk-ay262g2y.js";import"./chunk-nfh78ama.js";import"./chunk-h82f12we.js";import"./chunk-9bgb9n12.js";import"./chunk-806rdn0n.js";import"./chunk-a0rymg4g.js";import"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-waje9p23.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Iu as startInteractive};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$l,Vr}from"./chunk-vvezfjt1.js";import"./chunk-hx787tfa.js";import"./chunk-jgxzbthg.js";import{ur}from"./chunk-4f5bmy7h.js";import"./chunk-tjwv101c.js";import"./chunk-t6m5d64b.js";import{tt}from"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{tt as freeIdentifiers,Vr as processComponents,$l as processESImports,ur as rendersAsElement};
2
+ import{$l,Vr}from"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-jgxzbthg.js";import{ur}from"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import{tt}from"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{tt as freeIdentifiers,Vr as processComponents,$l as processESImports,ur as rendersAsElement};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{nr}from"./chunk-kypwg2ws.js";import{gr}from"./chunk-r0ys9aqa.js";import{i}from"./chunk-h176dx1q.js";import{K,Ge}from"./chunk-yft8yn6y.js";import{fa}from"./chunk-k3e0hcv7.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function Jn(e){let r=0,t=0,o=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let u=p.exec(e);if(u){x.lastIndex=n+u[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let c=b.exec(e);if(c){if(t===0)o=n;t++,r=n+c[0].length;continue}S.lastIndex=n;let a=S.exec(e);if(a){if(t>0)t--;r=n+a[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?o:n;r=n+1}return-1}function q(e,r={}){return new nr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,o=r;if(!t||!o)try{let a=await i();t||=a?.pagesDir||"pages",o||=a?.root||"."}catch{t||="pages",o||="."}let n=w.isAbsolute(t)?t:w.join(o,t),u=T.get(n);if(u)return u;let c=[];try{c=q(".",{pagesDir:n,emit:!1}).map((a)=>a.regex.source).filter(Boolean)}catch{c=[]}return T.set(n,c),c}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function he(e){return e.includes("data-stx-runtime")}function da(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let o=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(o))continue;return!0}return!1}function f(e,r){let t=Jn(e),o=e.search(/<!doctype\b/i);if(t!==-1&&(o===-1||t>o))return e.slice(0,t)+r+`
2
+ import{nr}from"./chunk-kypwg2ws.js";import{gr}from"./chunk-r0ys9aqa.js";import{i}from"./chunk-5btsefqt.js";import{K,Ge}from"./chunk-yft8yn6y.js";import{fa}from"./chunk-k3e0hcv7.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function Jn(e){let r=0,t=0,o=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let u=p.exec(e);if(u){x.lastIndex=n+u[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let c=b.exec(e);if(c){if(t===0)o=n;t++,r=n+c[0].length;continue}S.lastIndex=n;let a=S.exec(e);if(a){if(t>0)t--;r=n+a[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?o:n;r=n+1}return-1}function q(e,r={}){return new nr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,o=r;if(!t||!o)try{let a=await i();t||=a?.pagesDir||"pages",o||=a?.root||"."}catch{t||="pages",o||="."}let n=w.isAbsolute(t)?t:w.join(o,t),u=T.get(n);if(u)return u;let c=[];try{c=q(".",{pagesDir:n,emit:!1}).map((a)=>a.regex.source).filter(Boolean)}catch{c=[]}return T.set(n,c),c}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function he(e){return e.includes("data-stx-runtime")}function da(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let o=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(o))continue;return!0}return!1}function f(e,r){let t=Jn(e),o=e.search(/<!doctype\b/i);if(t!==-1&&(o===-1||t>o))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=gr(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let c=e.indexOf("</head>");return e.slice(0,c)+r+`
5
5
  `+e.slice(c)}if(K(e))return Ge(e,(c)=>`${c}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function Yn(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-jkhc0q7g.js"),{url:u}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-jkhc0q7g.js"),o=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${o}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function pa(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${fa()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
7
+ ${e}`}async function Yn(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-madrssd6.js"),{url:u}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-madrssd6.js"),o=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${o}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function pa(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${fa()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ye(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,o="",n="";{let s={};if(t){if(t.container)s.container=t.container;if(t.interceptAllLinks!==void 0)s.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)s.progress=t.progress;if(t.viewTransitions!==void 0)s.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)s.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)s.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)s.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)s.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)s.prefetch=t.prefetch;if(t.cache!==void 0)s.cache=t.cache;if(t.progressColor!==void 0)s.progressColor=t.progressColor;if(t.progressHeight!==void 0)s.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)s.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)s.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)s.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-jkhc0q7g.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
9
+ ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ye(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,o="",n="";{let s={};if(t){if(t.container)s.container=t.container;if(t.interceptAllLinks!==void 0)s.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)s.progress=t.progress;if(t.viewTransitions!==void 0)s.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)s.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)s.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)s.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)s.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)s.prefetch=t.prefetch;if(t.cache!==void 0)s.cache=t.cache;if(t.progressColor!==void 0)s.progressColor=t.progressColor;if(t.progressHeight!==void 0)s.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)s.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)s.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)s.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-madrssd6.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
10
10
  `)}"></script>
11
11
  `}else s.ownedRoutes=g}catch{}if(Object.keys(s).length>0)o=`<script>window.__stxRouterConfig=${l(s)};</script>
12
- `}let{getCachedRouterScript:u,getServeClientAsset:c}=await import("./chunk-jkhc0q7g.js"),a=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await c("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+o+n+a+`
12
+ `}let{getCachedRouterScript:u,getServeClientAsset:c}=await import("./chunk-madrssd6.js"),a=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await c("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+o+n+a+`
13
13
  </body>`+e.slice(d+7)}
14
14
  export{Jn,q,he,da,Yn,pa,ye};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{vn}from"./chunk-r0ys9aqa.js";import{F,z,At,Pt,dr,g,tc,zo,V,_}from"./chunk-4f5bmy7h.js";import{Gt}from"./chunk-hy4gaf8g.js";import{W}from"./chunk-078as147.js";var H=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function B(e){let n=[],t=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=t.exec(e))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(e,n){return n.some((t)=>e>=t.start&&e<t.end)}function q(e){let n=(e||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let t={},r=n,s=r.match(/^[a-z][\w-]*/i);if(s)t.tag=s[0].toLowerCase(),r=r.slice(s[0].length);while(r.length>0){let o=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(t.attr=o[1],o[3]!==void 0&&o[3]!=="")t.attrValue=o[3];r=r.slice(o[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){t.id=a[1],r=r.slice(a[0].length);continue}let i=r.match(/^\.([\w-]+)/);if(i){t.className=i[1],r=r.slice(i[0].length);continue}return null}if(!t.tag&&!t.attr&&!t.id&&!t.className)return null;return t}function U(e,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(e))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(e))return!1}if(n.className){let t=e.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!t)return!1;if(!t[2].split(/\s+/).includes(n.className))return!1}return!0}function T(e,n="main"){let t=q(n);if(!t)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,s=B(e),o;while((o=r.exec(e))!==null){if(P(o.index,s))continue;let a=o[1].toLowerCase(),i=o[2]||"";if(i.trimEnd().endsWith("/")||H.has(a))continue;if(t.tag&&t.tag!==a)continue;if(!U(i,t))continue;let c=o[0],u=o.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,m;while((m=l.exec(e))!==null){if(P(m.index,s))continue;let x=m[1]==="/";if(!x&&(m[2]||"").trimEnd().endsWith("/"))continue;if(f+=x?-1:1,f===0)return{openTag:c,openIndex:o.index,start:u,end:m.index,tagName:a}}return null}return null}var ut="private, no-store";function Ri(e){return e.replace(/&#(\d+);/g,(n,t)=>M(Number(t),n)).replace(/&#x([0-9a-f]+);/gi,(n,t)=>M(Number.parseInt(t,16),n)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function M(e,n){if(!Number.isInteger(e)||e<0||e>1114111)return n;try{return String.fromCodePoint(e)}catch{return n}}function ke(e){return e.headers.get("X-STX-Router")==="true"}function G(e,n){if(!e)return n;return e.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?e:`${e}, ${n}`}function O(e){return{Vary:G(e,"X-STX-Router")}}import E from"path";var X="stx-page-head:",J=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,C={dev:null,prod:null};function K(){let e=W()?"dev":"prod",n=C[e];if(n!==null)return n;try{let t=import.meta.require("./chunk-mkaw0bn4.js"),r=e==="dev"&&typeof t.getRouterScriptDev==="function"?t.getRouterScriptDev:t.getRouterScript;C[e]=`<script>${r()}</script>`}catch{C[e]=""}return C[e]}async function Ai(e,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=E.resolve(e,n);if(await Bun.file(r).exists())return r;return null}let t=E.join(e,"app.stx");if(await Bun.file(t).exists())return t;return null}async function Hs(e,n){try{let t=await Bun.file(e).text(),r=t,s=t.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(s)r=s[1].trim();let o=Gt(t),a=[...o.client.map((d)=>d.fullTag),...o.signals.map((d)=>d.fullTag)],i=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(t))!==null)i.push(u[0]);let l=r;for(let d of o.server)l=l.replace(d.fullTag,"");for(let d of o.client)l=l.replace(d.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${e} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:x,defaultConfig:y,loadStxConfig:R}=await import("./chunk-twk9kr73.js"),S=await R(),p={__filename:e,__dirname:E.dirname(e)};for(let d of a){let w=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(w&&!d.includes("client")&&!d.includes('type="module"'))await x(w[1],p,e)}let b=await m(l,p,e,{...y,...S,...n},new Set),h=b.indexOf(f);if(h===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:b.substring(0,h),afterSlot:b.substring(h+f.length),filePath:e,shellScripts:a,shellStyles:i}}catch(t){return console.error(`[stx] Error processing shell ${e}:`,t),null}}function Pr(e,n,t){let r,s="",o=n.match(J);if(o){n=n.replace(o[0],"");try{let l=Buffer.from(o[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();s=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=t||r||"stx App",i=K(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{vn}from"./chunk-r0ys9aqa.js";import{F,z,At,Pt,dr,g,tc,zo,V,_}from"./chunk-467acz2w.js";import{Gt}from"./chunk-f9e5k693.js";import{W}from"./chunk-078as147.js";var H=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function B(e){let n=[],t=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=t.exec(e))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(e,n){return n.some((t)=>e>=t.start&&e<t.end)}function q(e){let n=(e||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let t={},r=n,s=r.match(/^[a-z][\w-]*/i);if(s)t.tag=s[0].toLowerCase(),r=r.slice(s[0].length);while(r.length>0){let o=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(t.attr=o[1],o[3]!==void 0&&o[3]!=="")t.attrValue=o[3];r=r.slice(o[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){t.id=a[1],r=r.slice(a[0].length);continue}let i=r.match(/^\.([\w-]+)/);if(i){t.className=i[1],r=r.slice(i[0].length);continue}return null}if(!t.tag&&!t.attr&&!t.id&&!t.className)return null;return t}function U(e,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(e))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(e))return!1}if(n.className){let t=e.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!t)return!1;if(!t[2].split(/\s+/).includes(n.className))return!1}return!0}function T(e,n="main"){let t=q(n);if(!t)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,s=B(e),o;while((o=r.exec(e))!==null){if(P(o.index,s))continue;let a=o[1].toLowerCase(),i=o[2]||"";if(i.trimEnd().endsWith("/")||H.has(a))continue;if(t.tag&&t.tag!==a)continue;if(!U(i,t))continue;let c=o[0],u=o.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,m;while((m=l.exec(e))!==null){if(P(m.index,s))continue;let x=m[1]==="/";if(!x&&(m[2]||"").trimEnd().endsWith("/"))continue;if(f+=x?-1:1,f===0)return{openTag:c,openIndex:o.index,start:u,end:m.index,tagName:a}}return null}return null}var ut="private, no-store";function Ri(e){return e.replace(/&#(\d+);/g,(n,t)=>M(Number(t),n)).replace(/&#x([0-9a-f]+);/gi,(n,t)=>M(Number.parseInt(t,16),n)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function M(e,n){if(!Number.isInteger(e)||e<0||e>1114111)return n;try{return String.fromCodePoint(e)}catch{return n}}function ke(e){return e.headers.get("X-STX-Router")==="true"}function G(e,n){if(!e)return n;return e.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?e:`${e}, ${n}`}function O(e){return{Vary:G(e,"X-STX-Router")}}import E from"path";var X="stx-page-head:",J=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,C={dev:null,prod:null};function K(){let e=W()?"dev":"prod",n=C[e];if(n!==null)return n;try{let t=import.meta.require("./chunk-mkaw0bn4.js"),r=e==="dev"&&typeof t.getRouterScriptDev==="function"?t.getRouterScriptDev:t.getRouterScript;C[e]=`<script>${r()}</script>`}catch{C[e]=""}return C[e]}async function Ai(e,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=E.resolve(e,n);if(await Bun.file(r).exists())return r;return null}let t=E.join(e,"app.stx");if(await Bun.file(t).exists())return t;return null}async function Hs(e,n){try{let t=await Bun.file(e).text(),r=t,s=t.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(s)r=s[1].trim();let o=Gt(t),a=[...o.client.map((d)=>d.fullTag),...o.signals.map((d)=>d.fullTag)],i=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(t))!==null)i.push(u[0]);let l=r;for(let d of o.server)l=l.replace(d.fullTag,"");for(let d of o.client)l=l.replace(d.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${e} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:x,defaultConfig:y,loadStxConfig:R}=await import("./chunk-kkkcs6e6.js"),S=await R(),p={__filename:e,__dirname:E.dirname(e)};for(let d of a){let w=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(w&&!d.includes("client")&&!d.includes('type="module"'))await x(w[1],p,e)}let b=await m(l,p,e,{...y,...S,...n},new Set),h=b.indexOf(f);if(h===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:b.substring(0,h),afterSlot:b.substring(h+f.length),filePath:e,shellScripts:a,shellStyles:i}}catch(t){return console.error(`[stx] Error processing shell ${e}:`,t),null}}function Pr(e,n,t){let r,s="",o=n.match(J);if(o){n=n.replace(o[0],"");try{let l=Buffer.from(o[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();s=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=t||r||"stx App",i=K(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -27,5 +27,5 @@ ${i}
27
27
  `));if(s.length>0)S.push(s.filter((p)=>!c.has(p)).join(`
28
28
  `));if(x.length>0)S.push(x.filter((p)=>!c.has(p)).join(`
29
29
  `));return S.push(m),S.join(`
30
- `)}import v from"fs";import I from"path";function Ii(e,n,t){return{version:1,buildTime:new Date().toISOString(),routes:e,assets:n,outputDir:t}}function Oi(e,n){let t=I.join(n,"manifest.json");v.writeFileSync(t,JSON.stringify(e,null,2))}function Ni(e){let n=I.join(e,"manifest.json");if(!v.existsSync(n))return null;try{let t=v.readFileSync(n,"utf-8"),r=JSON.parse(t);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(t){return console.warn("[stx] Failed to load manifest:",t),null}}function k(e,n,t={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(n)}`;if(t.maxAge!==void 0)r+=`; Max-Age=${t.maxAge}`;if(t.expires)r+=`; Expires=${t.expires.toUTCString()}`;if(t.path)r+=`; Path=${t.path}`;if(t.domain)r+=`; Domain=${t.domain}`;if(t.secure)r+="; Secure";if(t.httpOnly)r+="; HttpOnly";if(t.sameSite)r+=`; SameSite=${t.sameSite}`;return r}async function Z(e){let n=e.headers.get("content-type")||"",t={},r=(s,o)=>{let a=t[s];if(a===void 0)t[s]=o;else if(Array.isArray(a))a.push(o);else t[s]=[a,o]};if(n.includes("multipart/form-data")){let s=await e.formData();for(let[o,a]of s.entries())if(typeof a==="string")r(o,a);return t}if(n.includes("application/x-www-form-urlencoded")){for(let[s,o]of new URLSearchParams(await e.text()).entries())r(s,o);return t}return t}function Vs(e){if(!e)return!1;let n=e.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function D(e,n={}){let t=n.request,r=n.method??t?.method;if(!t||!Vs(r))return{ran:!1};if(typeof e.action!=="function")return{ran:!1};let s={};try{s=await Z(t)}catch{}let o=await e.action({request:t,form:s,params:n.params??{},query:e.query??{},cookies:n.cookies??{}});if(o&&typeof o==="object"){let a=o,i=Q(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(e,f),i.length>0)return{ran:!0,cookies:i}}return{ran:!0}}function Q(e){if(!e||typeof e!=="object"||Array.isArray(e))return[];let n=[];for(let[t,r]of Object.entries(e)){if(!t)continue;if(typeof r==="string"){n.push(k(t,r));continue}if(r&&typeof r==="object"){let s=r;if(typeof s.value!=="string")continue;n.push(k(t,s.value,s))}}return n}function Di(e,n=[],t){let r=new Headers({Location:e,"Cache-Control":"no-store"});for(let s of n)r.append("Set-Cookie",s);for(let[s,o]of Object.entries(t??{}))if(s.toLowerCase()!=="location")r.set(s,o);return new Response(null,{status:303,headers:r})}async function Cn(e,n={}){let{html:t,context:r,redirect:s,cookies:o}=await tt(e,n),a=At(r),i=Pt(r);if(s)return{html:t,redirect:s,cookies:o,status:a,headers:i};let{extractStreamBoundaries:c}=await import("./chunk-2mf8shg5.js"),u=c(r),l=e.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-5443hz48.js"),{defaultConfig:m}=await import("./chunk-063y8kcp.js"),x=r.streamBoundaries||{},y={...m,autoShell:!1},R=Object.keys(l).map((p)=>({id:p,render:async()=>{let b=typeof x[p]==="function"?await x[p]():void 0;return f(l[p],{...r,$boundary:b},e.sourceFile,y,new Set)}})),S=new Set(R.map((p)=>p.id));u=[...(u||[]).filter((p)=>!S.has(p.id)),...R]}return{html:t,boundaries:u&&u.length>0?u:void 0,cookies:o,status:a,headers:i}}async function tt(e,n){let t={__filename:e.sourceFile,__dirname:e.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!e.hasServerScripts&&!zo(e.html))return{html:e.html,context:t};for(let a of e.serverScriptContent)try{await g(a,t,e.sourceFile)}catch(i){if(n.__stx_strict_hydration)throw i;console.warn(`[stx] Server script error in ${e.sourceFile}:`,i)}let r=await D(t,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),s=(a)=>{let i=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=dr(t);if(!c)return i;let u=i.indexOf("</head>");return u<0?c+i:i.slice(0,u)+c+i.slice(u)};if(r.redirect)return{html:e.html,context:t,redirect:r.redirect,cookies:r.cookies};if(!zo(e.html))return{html:s(e.html),context:t,cookies:r.cookies};let o=new Map;for(let[a,i]of Object.entries(e.placeholders))if(i.expression)try{let c=_(i.expression,t);if(i.type==="raw")o.set(a,c!==void 0&&c!==null?String(c):"");else o.set(a,c!==void 0&&c!==null?V(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;o.set(a,"")}return{html:s(tc(e.html,o)),context:t,cookies:r.cookies}}
30
+ `)}import v from"fs";import I from"path";function Ii(e,n,t){return{version:1,buildTime:new Date().toISOString(),routes:e,assets:n,outputDir:t}}function Oi(e,n){let t=I.join(n,"manifest.json");v.writeFileSync(t,JSON.stringify(e,null,2))}function Ni(e){let n=I.join(e,"manifest.json");if(!v.existsSync(n))return null;try{let t=v.readFileSync(n,"utf-8"),r=JSON.parse(t);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(t){return console.warn("[stx] Failed to load manifest:",t),null}}function k(e,n,t={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(n)}`;if(t.maxAge!==void 0)r+=`; Max-Age=${t.maxAge}`;if(t.expires)r+=`; Expires=${t.expires.toUTCString()}`;if(t.path)r+=`; Path=${t.path}`;if(t.domain)r+=`; Domain=${t.domain}`;if(t.secure)r+="; Secure";if(t.httpOnly)r+="; HttpOnly";if(t.sameSite)r+=`; SameSite=${t.sameSite}`;return r}async function Z(e){let n=e.headers.get("content-type")||"",t={},r=(s,o)=>{let a=t[s];if(a===void 0)t[s]=o;else if(Array.isArray(a))a.push(o);else t[s]=[a,o]};if(n.includes("multipart/form-data")){let s=await e.formData();for(let[o,a]of s.entries())if(typeof a==="string")r(o,a);return t}if(n.includes("application/x-www-form-urlencoded")){for(let[s,o]of new URLSearchParams(await e.text()).entries())r(s,o);return t}return t}function Vs(e){if(!e)return!1;let n=e.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function D(e,n={}){let t=n.request,r=n.method??t?.method;if(!t||!Vs(r))return{ran:!1};if(typeof e.action!=="function")return{ran:!1};let s={};try{s=await Z(t)}catch{}let o=await e.action({request:t,form:s,params:n.params??{},query:e.query??{},cookies:n.cookies??{}});if(o&&typeof o==="object"){let a=o,i=Q(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(e,f),i.length>0)return{ran:!0,cookies:i}}return{ran:!0}}function Q(e){if(!e||typeof e!=="object"||Array.isArray(e))return[];let n=[];for(let[t,r]of Object.entries(e)){if(!t)continue;if(typeof r==="string"){n.push(k(t,r));continue}if(r&&typeof r==="object"){let s=r;if(typeof s.value!=="string")continue;n.push(k(t,s.value,s))}}return n}function Di(e,n=[],t){let r=new Headers({Location:e,"Cache-Control":"no-store"});for(let s of n)r.append("Set-Cookie",s);for(let[s,o]of Object.entries(t??{}))if(s.toLowerCase()!=="location")r.set(s,o);return new Response(null,{status:303,headers:r})}async function Cn(e,n={}){let{html:t,context:r,redirect:s,cookies:o}=await tt(e,n),a=At(r),i=Pt(r);if(s)return{html:t,redirect:s,cookies:o,status:a,headers:i};let{extractStreamBoundaries:c}=await import("./chunk-jxvyvz64.js"),u=c(r),l=e.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-kv6z74k1.js"),{defaultConfig:m}=await import("./chunk-kdz8yfdx.js"),x=r.streamBoundaries||{},y={...m,autoShell:!1},R=Object.keys(l).map((p)=>({id:p,render:async()=>{let b=typeof x[p]==="function"?await x[p]():void 0;return f(l[p],{...r,$boundary:b},e.sourceFile,y,new Set)}})),S=new Set(R.map((p)=>p.id));u=[...(u||[]).filter((p)=>!S.has(p.id)),...R]}return{html:t,boundaries:u&&u.length>0?u:void 0,cookies:o,status:a,headers:i}}async function tt(e,n){let t={__filename:e.sourceFile,__dirname:e.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!e.hasServerScripts&&!zo(e.html))return{html:e.html,context:t};for(let a of e.serverScriptContent)try{await g(a,t,e.sourceFile)}catch(i){if(n.__stx_strict_hydration)throw i;console.warn(`[stx] Server script error in ${e.sourceFile}:`,i)}let r=await D(t,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),s=(a)=>{let i=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=dr(t);if(!c)return i;let u=i.indexOf("</head>");return u<0?c+i:i.slice(0,u)+c+i.slice(u)};if(r.redirect)return{html:e.html,context:t,redirect:r.redirect,cookies:r.cookies};if(!zo(e.html))return{html:s(e.html),context:t,cookies:r.cookies};let o=new Map;for(let[a,i]of Object.entries(e.placeholders))if(i.expression)try{let c=_(i.expression,t);if(i.type==="raw")o.set(a,c!==void 0&&c!==null?String(c):"");else o.set(a,c!==void 0&&c!==null?V(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;o.set(a,"")}return{html:s(tc(e.html,o)),context:t,cookies:r.cookies}}
31
31
  export{ut,Ri,ke,O,Ai,Hs,Pr,Ve,Pi,_e,Ii,Oi,Ni,Vs,Di,Cn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,u}from"./chunk-r0ys9aqa.js";import{X,H,d}from"./chunk-4f5bmy7h.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 f=t.slice(s,a),c=f.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(f))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),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[2].toLowerCase();if(f[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),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[1]==="/",g=f[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 Hc(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 td(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 Vc(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,f=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)f.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else f.add(n);e=j(e,s,a,f)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(H(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!H(s,r))return e;let a=_(s,o);if(a===void 0)return e;return d(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(!p(t))return;return u(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Uc(t,o,i,r){let e=t;e=await I(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,f,c,g)=>{let m=o.named.get(f),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=X(`${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=d(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${d(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await Vc(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,f,c)=>{if(/\bname\s*=/.test(f||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function I(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let c=f[f.length-2];return e.push({match:a,index:c}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+f.length)}return s}function nd(t){let o=Hc(t);return{defaultSlot:o.default,namedSlots:o.named}}async function rd(t,o,i,r,e){return await Uc(t,{default:o,named:i},r,e)}
2
+ import{p,u}from"./chunk-r0ys9aqa.js";import{X,H,d}from"./chunk-467acz2w.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 f=t.slice(s,a),c=f.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(f))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),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[2].toLowerCase();if(f[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),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[1]==="/",g=f[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 Hc(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 td(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 Vc(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,f=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)f.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else f.add(n);e=j(e,s,a,f)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(H(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!H(s,r))return e;let a=_(s,o);if(a===void 0)return e;return d(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(!p(t))return;return u(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Uc(t,o,i,r){let e=t;e=await I(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,f,c,g)=>{let m=o.named.get(f),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=X(`${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=d(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${d(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await Vc(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,f,c)=>{if(/\bname\s*=/.test(f||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function I(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let c=f[f.length-2];return e.push({match:a,index:c}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+f.length)}return s}function nd(t){let o=Hc(t);return{defaultSlot:o.default,namedSlots:o.named}}async function rd(t,o,i,r,e){return await Uc(t,{default:o,named:i},r,e)}
3
3
  export{Hc,td,Vc,Uc,nd,rd};