@stacksjs/stx 0.2.881 → 0.2.882

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 (93) hide show
  1. package/dist/{chunk-w53p65hy.js → chunk-0k7khseq.js} +2 -2
  2. package/dist/{chunk-h2tq6cbr.js → chunk-0rdh8bw3.js} +1 -1
  3. package/dist/{chunk-ym0cdk7m.js → chunk-22mdphq2.js} +2 -2
  4. package/dist/{chunk-86nsbxep.js → chunk-295bykzd.js} +26 -26
  5. package/dist/{chunk-d8qt6hjg.js → chunk-30z4s1n3.js} +2 -2
  6. package/dist/{chunk-sq6werer.js → chunk-3869n9nd.js} +1 -1
  7. package/dist/chunk-3abd3gw8.js +2 -0
  8. package/dist/{chunk-njza56wn.js → chunk-3jndqseh.js} +6 -6
  9. package/dist/{chunk-asv4b65m.js → chunk-47bsv8xy.js} +1 -1
  10. package/dist/{chunk-wfthd3n5.js → chunk-4adb8bmp.js} +1 -1
  11. package/dist/{chunk-dze7f9vv.js → chunk-4hfsbdqa.js} +1 -1
  12. package/dist/chunk-5508z01x.js +2 -0
  13. package/dist/chunk-5v93fj91.js +2 -0
  14. package/dist/{chunk-hnxwqamj.js → chunk-5yga68j4.js} +1 -1
  15. package/dist/chunk-65899mj8.js +2 -0
  16. package/dist/{chunk-my3yv4sg.js → chunk-678nhepd.js} +1 -1
  17. package/dist/{chunk-f6ac0gbe.js → chunk-6vr0yfbt.js} +1 -1
  18. package/dist/{chunk-8nqyyj1h.js → chunk-75yst7df.js} +3 -3
  19. package/dist/{chunk-4frh1qg5.js → chunk-7z94thkd.js} +1 -1
  20. package/dist/chunk-8s365b62.js +2 -0
  21. package/dist/{chunk-002zrse4.js → chunk-8vb1m3t3.js} +1 -1
  22. package/dist/{chunk-9zj3xztb.js → chunk-93b6syb0.js} +1 -1
  23. package/dist/chunk-93fvjs6g.js +2 -0
  24. package/dist/{chunk-kyh32kma.js → chunk-99spzsmw.js} +1 -1
  25. package/dist/{chunk-95j7y1rt.js → chunk-9zc1cnw8.js} +1 -1
  26. package/dist/{chunk-fxhgj8tp.js → chunk-9zqggj7t.js} +1 -1
  27. package/dist/{chunk-dfbbkjz6.js → chunk-a81bwn7b.js} +1 -1
  28. package/dist/{chunk-9yx7cbhz.js → chunk-a852vdv3.js} +1 -1
  29. package/dist/{chunk-m91jj8nq.js → chunk-bgddx531.js} +1 -1
  30. package/dist/{chunk-yffqfgjx.js → chunk-c3413bgh.js} +1 -1
  31. package/dist/{chunk-v1s838fe.js → chunk-cb0c6959.js} +1 -1
  32. package/dist/{chunk-xf6snj8e.js → chunk-cekzqze8.js} +1 -1
  33. package/dist/{chunk-jc74097x.js → chunk-cn2bgt0w.js} +1 -1
  34. package/dist/chunk-cn6dqyfh.js +2 -0
  35. package/dist/{chunk-jqvc2wbz.js → chunk-d0c5q7b7.js} +1 -1
  36. package/dist/{chunk-t94y8g35.js → chunk-d2pexm3z.js} +1 -1
  37. package/dist/chunk-ddws4zp2.js +3 -0
  38. package/dist/{chunk-r32ddrvn.js → chunk-e44br2vs.js} +2 -2
  39. package/dist/{chunk-czzehcxs.js → chunk-e9hm254p.js} +4 -4
  40. package/dist/{chunk-bhc25n2n.js → chunk-h0nsb8b0.js} +1 -1
  41. package/dist/{chunk-gs6geqeg.js → chunk-j58b7xen.js} +1 -1
  42. package/dist/{chunk-45jpwbzd.js → chunk-j7bkrvey.js} +1 -1
  43. package/dist/{chunk-ekdhjm8p.js → chunk-kjz7g83q.js} +4 -4
  44. package/dist/chunk-ktk4eg8c.js +2 -0
  45. package/dist/{chunk-etavf6mr.js → chunk-kx4svden.js} +1 -1
  46. package/dist/chunk-kzagptvq.js +2 -0
  47. package/dist/{chunk-xfhxfcvk.js → chunk-mhdkk9a4.js} +1 -1
  48. package/dist/{chunk-fwhr3jda.js → chunk-n163nwke.js} +1 -1
  49. package/dist/{chunk-q1jjgg4w.js → chunk-nghybhas.js} +1 -1
  50. package/dist/{chunk-gmbw1xhm.js → chunk-nmz9j39s.js} +2 -2
  51. package/dist/{chunk-1jk46ve0.js → chunk-p5qac909.js} +1 -1
  52. package/dist/{chunk-v5cah9pt.js → chunk-pxemb9dg.js} +1 -1
  53. package/dist/{chunk-pm27mcfp.js → chunk-qjqvhke7.js} +1 -1
  54. package/dist/{chunk-2gg3vjks.js → chunk-qpybh7ss.js} +5 -5
  55. package/dist/{chunk-nnynrb97.js → chunk-qxthb2a1.js} +1 -1
  56. package/dist/{chunk-2cvwjtjh.js → chunk-radvtjwt.js} +2 -2
  57. package/dist/{chunk-gad3ebgr.js → chunk-rn2kk4r8.js} +1 -1
  58. package/dist/{chunk-345waetq.js → chunk-s9xavhdb.js} +1 -1
  59. package/dist/chunk-sb93fb2w.js +2 -0
  60. package/dist/chunk-twewtvyt.js +2 -0
  61. package/dist/{chunk-k52126rh.js → chunk-v65efeh1.js} +1 -1
  62. package/dist/{chunk-ypsf5y5g.js → chunk-v99zjh93.js} +1 -1
  63. package/dist/{chunk-9fvjr9dd.js → chunk-vtgqgx8t.js} +1 -1
  64. package/dist/{chunk-1zkymrw0.js → chunk-whmk0m8x.js} +4 -4
  65. package/dist/{chunk-ndqq991c.js → chunk-x5608pnk.js} +1 -1
  66. package/dist/chunk-x7asbgvc.js +2 -0
  67. package/dist/chunk-xc6w4x0w.js +2 -0
  68. package/dist/{chunk-smkerejj.js → chunk-yfphz58r.js} +5 -5
  69. package/dist/{chunk-78zgmqhd.js → chunk-ywnqjqns.js} +1 -1
  70. package/dist/chunk-zen0ef4k.js +2 -0
  71. package/dist/cli.js +7 -7
  72. package/dist/craft-entry.js +1 -1
  73. package/dist/craft.js +1 -1
  74. package/dist/pwa.js +1 -1
  75. package/dist/safe-evaluator.d.ts +0 -8
  76. package/dist/safe-evaluator.js +14 -1
  77. package/dist/ssg.js +2 -2
  78. package/package.json +5 -5
  79. package/dist/chunk-51qyxm0y.js +0 -2
  80. package/dist/chunk-5hrx1p6g.js +0 -2
  81. package/dist/chunk-5mwzea5d.js +0 -2
  82. package/dist/chunk-8qr3cmpb.js +0 -2
  83. package/dist/chunk-909tgpxp.js +0 -2
  84. package/dist/chunk-brp8np3t.js +0 -2
  85. package/dist/chunk-dv0cpmat.js +0 -2
  86. package/dist/chunk-g5q0wgzk.js +0 -2
  87. package/dist/chunk-h26mpqrh.js +0 -2
  88. package/dist/chunk-k7ffxfgp.js +0 -3
  89. package/dist/chunk-nj1ssjtd.js +0 -2
  90. package/dist/chunk-pstbfz5g.js +0 -2
  91. package/dist/chunk-pw9qqcw3.js +0 -2
  92. package/dist/chunk-v8ea76j6.js +0 -2
  93. package/dist/chunk-vxw92h3q.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Yr,So,gm,Zl,ko}from"./chunk-r32ddrvn.js";import"./chunk-nb6erf75.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";export{gm as buildModuleRegistryScript,ko as buildSharedModuleRegistries,Zl as exportsMutableBinding,Yr as registeredModuleIdsIn,So as registeredModuleNamesIn};
2
+ import{Yr,So,gm,Zl,ko}from"./chunk-e44br2vs.js";import"./chunk-nb6erf75.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";export{gm as buildModuleRegistryScript,ko as buildSharedModuleRegistries,Zl as exportsMutableBinding,Yr as registeredModuleIdsIn,So as registeredModuleNamesIn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Re,io,Ug,Ty,Wg,$y,Pn,g,Y,ie,In,Oe,qg,zi,Kg,Ry,P,Hi,Gg,Ay,O,Py}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Gg as applyFilters,$y as clearCustomFilters,qg as clientLoopScopes,io as defaultFilters,In as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ie as escapeInterpolatedHtmlValue,O as evaluateExpression,Re as findMustacheEnd,Wg as getAllFilters,Kg as interpolateScriptAttributes,zi as interpolateScriptExpressions,Ry as interpolateScriptsInTemplate,P as processExpressions,Hi as processExpressionsChunked,Ug as registerFilter,Ty as registerFilters,Pn as replaceInterpolations,Ay as resetRejectedExpressionWarnings,Py as unescapeHtml,Oe as usesSignalsInScript};
2
+ import{Re,io,Ug,Ty,Wg,$y,Pn,g,Y,ie,In,Oe,qg,zi,Kg,Ry,P,Hi,Gg,Ay,O,Py}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Gg as applyFilters,$y as clearCustomFilters,qg as clientLoopScopes,io as defaultFilters,In as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ie as escapeInterpolatedHtmlValue,O as evaluateExpression,Re as findMustacheEnd,Wg as getAllFilters,Kg as interpolateScriptAttributes,zi as interpolateScriptExpressions,Ry as interpolateScriptsInTemplate,P as processExpressions,Hi as processExpressionsChunked,Ug as registerFilter,Ty as registerFilters,Pn as replaceInterpolations,Ay as resetRejectedExpressionWarnings,Py as unescapeHtml,Oe as usesSignalsInScript};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{ve}from"./chunk-agd2b928.js";import{Ye,F}from"./chunk-6t04tqvh.js";import{Wc}from"./chunk-ssg6ne5b.js";import{l}from"./chunk-s7xywsqd.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function wn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Go(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ve(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
3
  `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Xo(s,c,o={}){let i=wn(s,o);await Go(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ve(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Jo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function ey(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=wn(s,o);return await Go(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=wn(s,o);await Go(s,t);let{loadStxConfig:e}=await import("./chunk-51qyxm0y.js"),a=F((await e(s)).runtimeConfig);return await Ye(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
4
+ `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ve(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Jo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function ey(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=wn(s,o);return await Go(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=wn(s,o);await Go(s,t);let{loadStxConfig:e}=await import("./chunk-8s365b62.js"),a=F((await e(s)).runtimeConfig);return await Ye(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Yo(s,c,o){if(Wc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
6
6
  export{wn,Go,Xo,Jo,ey,Yo};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{d,m,N,p,ee}from"./chunk-86nsbxep.js";import{T}from"./chunk-s29hp1qw.js";import{G,Ws,Ue,j,Ht,Dr,Ge,Xe,s,y,Oe,P}from"./chunk-njza56wn.js";import{wt}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{fe}from"./chunk-t94y8g35.js";import{U,ct}from"./chunk-care745q.js";import{I,Ln}from"./chunk-ws2h92mm.js";import A from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let b=c[r];if(b==="("||b==="["||b==="{")a++;else if(b===")"||b==="]"||b==="}")a--;else if(b===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,b=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=b.exec(r);while(n){let u=n.index,t=u+n[0].length-1,C=1,W=t+1;while(W<r.length&&C>0){if(r[W]==="(")C++;else if(r[W]===")")C--;W++}if(C!==0)break;let ie=r.substring(t+1,W-1),B=`${a}(${ie})`;r=r.substring(0,u)+B+r.substring(W),b.lastIndex=u+B.length,n=b.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,b=0,n=0,u=e.length,t=(B)=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]===B){n++;return}n++}},C=()=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let B=1;while(n<u&&B>0)if(e[n]==="{")B++,n++;else if(e[n]==="}")B--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")C();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<u&&e[n]!==`
2
+ import{d,m,N,p,ee}from"./chunk-295bykzd.js";import{T}from"./chunk-s29hp1qw.js";import{G,Ws,Ue,j,Ht,Dr,Ge,Xe,s,y,Oe,P}from"./chunk-3jndqseh.js";import{wt}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{fe}from"./chunk-d2pexm3z.js";import{U,ct}from"./chunk-care745q.js";import{I,Ln}from"./chunk-ws2h92mm.js";import A from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let b=c[r];if(b==="("||b==="["||b==="{")a++;else if(b===")"||b==="]"||b==="}")a--;else if(b===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,b=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=b.exec(r);while(n){let u=n.index,t=u+n[0].length-1,C=1,W=t+1;while(W<r.length&&C>0){if(r[W]==="(")C++;else if(r[W]===")")C--;W++}if(C!==0)break;let ie=r.substring(t+1,W-1),B=`${a}(${ie})`;r=r.substring(0,u)+B+r.substring(W),b.lastIndex=u+B.length,n=b.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,b=0,n=0,u=e.length,t=(B)=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]===B){n++;return}n++}},C=()=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let B=1;while(n<u&&B>0)if(e[n]==="{")B++,n++;else if(e[n]==="}")B--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")C();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<u&&e[n]!==`
3
3
  `)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<u-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},ie=()=>{if(b!==0)return;let B=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let H=B[2];if(!r.has(H))a.push(H),r.add(H);return}let se=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(se){let H=se[1];if(!r.has(H))a.push(H),r.add(H);return}let Y=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!r.has(H))a.push(H),r.add(H)}};while(n<u){if(W())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){C();continue}if(e[n]==="{"){b++,n++;continue}if(e[n]==="}"){b--,n++;continue}if(b===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))ie();n++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${wt("var",a)}
@@ -44,10 +44,10 @@ ${n}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return a+c+r}function Me(c,e){if(U(c)){let n=U(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:ct(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Ht(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let b=r[1]+r[2],n=r[1].slice(1),u=b.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),C=r[1],W=r[2];return{html:`${t}${C} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Te=0;function ue(c,e){let a=A.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Te}`}var le=new Set,pe=new Set;function sy(){le.clear(),pe.clear()}var Ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ag(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],b=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",C=u[2],W=u[3]==="/"||Ae.has(C.toLowerCase());if(t){b=Math.max(0,b-1);continue}if(b===0)r.push(C);if(!W)b++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var at=new T(500),Ac=new Set;function oy(){Ac.clear()}function Ce(c){if(c.__onceStore instanceof Set)return c.__onceStore;return Ac}async function xs(c,e,a,r,b,n=new Set){let u=r.partialsDir||A.join(A.dirname(a),"partials");if(u&&!A.isAbsolute(u))u=A.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),C=Ce(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,h)=>{let g=v.trim(),i=`${a}:${g}`;if(C.has(i))return"";return C.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let D=o[1],z=W(D,u,a),E="";if(z&&await Bun.file(z).exists())b.add(z),E=`@include(${l})`;t=t.substring(0,h)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let h=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=h.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let D=t.substring(x+1,o-1),z=ae(D,0);if(z===-1){h.lastIndex=o;continue}let E=D.substring(0,z).trim(),V=D.substring(z+1).trim(),F=V.match(/^\s*['"]([^'"]+)['"]/);if(!F){h.lastIndex=o;continue}let _=F[1],q=V.substring(F[0].length),O,R=ae(q,0);if(R!==-1)O=q.substring(R+1).trim();try{let k=`Boolean(${E})`,L;if(m(k)){let oe=p(k,Object.keys(e));L=Boolean(oe(...Object.values(e)))}else L=Boolean(d(k,e));let te=v?!L:L,re="";if(te){let oe=W(_,u,a);if(oe&&await Bun.file(oe).exists())b.add(oe);re=`@include('${_}'${O?`, ${O}`:""})`}t=t.substring(0,i)+re+t.substring(o),h.lastIndex=0}catch(k){let L=k instanceof Error?k.message:String(k),te=y("Include",`Error evaluating ${f} condition: ${L}`,a,c,i);t=t.substring(0,i)+te+t.substring(o),h.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),D=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!D){f.lastIndex=0,t=t.replace(o,"");continue}let[,z,E,V,F]=D;try{let _,q=E.trim();if(m(q))_=p(q,Object.keys(e))(...Object.values(e));else _=d(q,e);let O="";if(Array.isArray(_)&&_.length>0)for(let R of _){let k={...e,[V]:R},L=await se(z,k,c,h);O+=L}else if(F)O=await se(F,{},c,h);t=t.substring(0,h)+O+t.substring(x+1),f.lastIndex=0}catch(_){let q=_ instanceof Error?_.message:String(_);t=t.substring(0,h)+y("Each",`Error in @each: ${q}`,a,c,h)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),D=l.match(/^\s*(\[[^\]]+\])/);if(!D){f.lastIndex=0,t=t.replace(o,"");continue}let z=D[1],E=l.slice(D[0].length),V,F=E.match(/^\s*,\s*\{/);if(F){E=E.slice(F[0].length-1);let O=1,R=1;while(R<E.length&&O>0){if(E[R]==="{")O++;else if(E[R]==="}"){if(O--,O===0)break}R++}V=E.substring(0,R+1),E=E.slice(R+1)}let _,q=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(q)_=q[1];try{let O=JSON.parse(z.replace(/'/g,'"')),R={};if(V)try{R=N(V,e)}catch(L){let te=L instanceof Error?L.message:String(L);if(r.debug){let re=y("Include",`Error parsing includeFirst variables: ${te}`,a,c,h,o);t=t.replace(o,()=>re)}else t=t.replace(o,()=>_||"");continue}let k=!1;for(let L of O){let te=W(L,u,a);if(!te)continue;if(await s(te)){let re=await se(L,R,c,h);t=t.replace(o,()=>re),k=!0;break}}if(!k)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let L=y("Include",`None of the includeFirst paths exist: ${z}`,a,c,h,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(O){let R=O instanceof Error?O.message:String(O),k=y("Include",`Error processing @includeFirst: ${R}`,a,c,h,o);t=t.replace(o,()=>k)}f.lastIndex=0}}function W(f,v,h){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=A.resolve(v),x=A.resolve(A.dirname(h)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let F of r._layerPartialDirs??[]){let _=A.resolve(F,g);if(_.startsWith(`${A.resolve(F)}${A.sep}`)&&ye(_))return _}l=A.resolve(v,g)}else l=A.resolve(x,g);let o=A.normalize(l),D=o.startsWith(i+A.sep)||o===i,z=o.startsWith(x+A.sep)||o===x,E=!1,V=A.dirname(x);if(o.startsWith(V+A.sep)){if(!A.relative(V,o).split(A.sep).some((O)=>O.startsWith(".")&&O!=="."&&O!==".."))E=!0}if(!D&&!z&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let ie=A.resolve(a);n.add(ie);function B(f,v,h,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),y("Include",v,a,h,g)}async function se(f,v={},h,g){let i=W(f,u,a);if(!i)return B(f,`Could not resolve path for include: ${f}`,h,g);let x=A.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>A.basename(o)).join(" -> ");return B(f,`Circular include detected: ${l}`,h,g)}try{b.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(S){let K=S instanceof Error?S.message:String(S);return B(f,`Error loading include file ${f}: ${K}`,h,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-v8ea76j6.js");l=S(l,e)}if(l&&(r.debug||!I()&&!Ln()))try{let{warnUnbalancedTags:S}=await import("./chunk-w5zzwe2f.js");S(l,i)}catch{}try{let{processESImports:S}=await import("./chunk-q1jjgg4w.js");l=await S(l,e,i,r,b)}catch(S){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,S instanceof Error?S.message:S)}let o=l,D=j(o);if(D)o=D.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(S,K,w)=>{if(!me(K))return"";return F.push({attrs:K,body:w}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _={...e};_.__stx_signals_gate=Oe(l,i);for(let[S,K]of Object.entries(v))_[S]=K;let q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,O=[...l.matchAll(q)].sort((S,K)=>{let w=(S[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(w)}),R="",k=null,L=!1,te=!1;for(let S of O){let K=S[1]||"",w=S[2]||"";if(me(K))continue;let X=K.includes("server"),be=Ge(K);if(!X&&!/\bsrc\s*=/i.test(K))Ue(w,i,r.strict);if(!X&&w.trim()){let{interpolateScriptExpressions:Z}=await import("./chunk-gs6geqeg.js");w=Z(w,_,f)}let ce="";try{let{extractAndStripCssImports:Z,renderVendorStyleTags:Q}=await import("./chunk-v5cah9pt.js"),ne=Z(w,{filePath:i,projectRoot:process.cwd()});w=ne.code,ce=Q(ne.styles)}catch(Z){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,Z instanceof Error?Z.message:Z)}if(be&&w.trim())w=Xe(w);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-v5cah9pt.js");w=Q(w).code;let{hasUserImports:ne,bundleClientScript:Se}=await import("./chunk-95j7y1rt.js");if(ne(w))w=await Se(w,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:Z}=await import("./chunk-my3yv4sg.js");w=Z(w)}let de=Ee(w);if(!X){let{extractBridgeData:Z,generateServerDataBridge:Q}=await import("./chunk-v5cah9pt.js"),ne=Q(w,Z(_));if(ne)w=`${ne}
47
+ })();`;return a+c+r}function Me(c,e){if(U(c)){let n=U(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:ct(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Ht(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let b=r[1]+r[2],n=r[1].slice(1),u=b.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),C=r[1],W=r[2];return{html:`${t}${C} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Te=0;function ue(c,e){let a=A.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Te}`}var le=new Set,pe=new Set;function sy(){le.clear(),pe.clear()}var Ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ag(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],b=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",C=u[2],W=u[3]==="/"||Ae.has(C.toLowerCase());if(t){b=Math.max(0,b-1);continue}if(b===0)r.push(C);if(!W)b++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var at=new T(500),Ac=new Set;function oy(){Ac.clear()}function Ce(c){if(c.__onceStore instanceof Set)return c.__onceStore;return Ac}async function xs(c,e,a,r,b,n=new Set){let u=r.partialsDir||A.join(A.dirname(a),"partials");if(u&&!A.isAbsolute(u))u=A.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),C=Ce(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,h)=>{let g=v.trim(),i=`${a}:${g}`;if(C.has(i))return"";return C.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let D=o[1],z=W(D,u,a),E="";if(z&&await Bun.file(z).exists())b.add(z),E=`@include(${l})`;t=t.substring(0,h)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let h=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=h.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let D=t.substring(x+1,o-1),z=ae(D,0);if(z===-1){h.lastIndex=o;continue}let E=D.substring(0,z).trim(),V=D.substring(z+1).trim(),F=V.match(/^\s*['"]([^'"]+)['"]/);if(!F){h.lastIndex=o;continue}let _=F[1],q=V.substring(F[0].length),O,R=ae(q,0);if(R!==-1)O=q.substring(R+1).trim();try{let k=`Boolean(${E})`,L;if(m(k)){let oe=p(k,Object.keys(e));L=Boolean(oe(...Object.values(e)))}else L=Boolean(d(k,e));let te=v?!L:L,re="";if(te){let oe=W(_,u,a);if(oe&&await Bun.file(oe).exists())b.add(oe);re=`@include('${_}'${O?`, ${O}`:""})`}t=t.substring(0,i)+re+t.substring(o),h.lastIndex=0}catch(k){let L=k instanceof Error?k.message:String(k),te=y("Include",`Error evaluating ${f} condition: ${L}`,a,c,i);t=t.substring(0,i)+te+t.substring(o),h.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),D=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!D){f.lastIndex=0,t=t.replace(o,"");continue}let[,z,E,V,F]=D;try{let _,q=E.trim();if(m(q))_=p(q,Object.keys(e))(...Object.values(e));else _=d(q,e);let O="";if(Array.isArray(_)&&_.length>0)for(let R of _){let k={...e,[V]:R},L=await se(z,k,c,h);O+=L}else if(F)O=await se(F,{},c,h);t=t.substring(0,h)+O+t.substring(x+1),f.lastIndex=0}catch(_){let q=_ instanceof Error?_.message:String(_);t=t.substring(0,h)+y("Each",`Error in @each: ${q}`,a,c,h)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),D=l.match(/^\s*(\[[^\]]+\])/);if(!D){f.lastIndex=0,t=t.replace(o,"");continue}let z=D[1],E=l.slice(D[0].length),V,F=E.match(/^\s*,\s*\{/);if(F){E=E.slice(F[0].length-1);let O=1,R=1;while(R<E.length&&O>0){if(E[R]==="{")O++;else if(E[R]==="}"){if(O--,O===0)break}R++}V=E.substring(0,R+1),E=E.slice(R+1)}let _,q=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(q)_=q[1];try{let O=JSON.parse(z.replace(/'/g,'"')),R={};if(V)try{R=N(V,e)}catch(L){let te=L instanceof Error?L.message:String(L);if(r.debug){let re=y("Include",`Error parsing includeFirst variables: ${te}`,a,c,h,o);t=t.replace(o,()=>re)}else t=t.replace(o,()=>_||"");continue}let k=!1;for(let L of O){let te=W(L,u,a);if(!te)continue;if(await s(te)){let re=await se(L,R,c,h);t=t.replace(o,()=>re),k=!0;break}}if(!k)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let L=y("Include",`None of the includeFirst paths exist: ${z}`,a,c,h,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(O){let R=O instanceof Error?O.message:String(O),k=y("Include",`Error processing @includeFirst: ${R}`,a,c,h,o);t=t.replace(o,()=>k)}f.lastIndex=0}}function W(f,v,h){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=A.resolve(v),x=A.resolve(A.dirname(h)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let F of r._layerPartialDirs??[]){let _=A.resolve(F,g);if(_.startsWith(`${A.resolve(F)}${A.sep}`)&&ye(_))return _}l=A.resolve(v,g)}else l=A.resolve(x,g);let o=A.normalize(l),D=o.startsWith(i+A.sep)||o===i,z=o.startsWith(x+A.sep)||o===x,E=!1,V=A.dirname(x);if(o.startsWith(V+A.sep)){if(!A.relative(V,o).split(A.sep).some((O)=>O.startsWith(".")&&O!=="."&&O!==".."))E=!0}if(!D&&!z&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let ie=A.resolve(a);n.add(ie);function B(f,v,h,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),y("Include",v,a,h,g)}async function se(f,v={},h,g){let i=W(f,u,a);if(!i)return B(f,`Could not resolve path for include: ${f}`,h,g);let x=A.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>A.basename(o)).join(" -> ");return B(f,`Circular include detected: ${l}`,h,g)}try{b.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(S){let K=S instanceof Error?S.message:String(S);return B(f,`Error loading include file ${f}: ${K}`,h,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-3abd3gw8.js");l=S(l,e)}if(l&&(r.debug||!I()&&!Ln()))try{let{warnUnbalancedTags:S}=await import("./chunk-w5zzwe2f.js");S(l,i)}catch{}try{let{processESImports:S}=await import("./chunk-nghybhas.js");l=await S(l,e,i,r,b)}catch(S){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,S instanceof Error?S.message:S)}let o=l,D=j(o);if(D)o=D.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(S,K,w)=>{if(!me(K))return"";return F.push({attrs:K,body:w}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _={...e};_.__stx_signals_gate=Oe(l,i);for(let[S,K]of Object.entries(v))_[S]=K;let q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,O=[...l.matchAll(q)].sort((S,K)=>{let w=(S[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(w)}),R="",k=null,L=!1,te=!1;for(let S of O){let K=S[1]||"",w=S[2]||"";if(me(K))continue;let X=K.includes("server"),be=Ge(K);if(!X&&!/\bsrc\s*=/i.test(K))Ue(w,i,r.strict);if(!X&&w.trim()){let{interpolateScriptExpressions:Z}=await import("./chunk-j58b7xen.js");w=Z(w,_,f)}let ce="";try{let{extractAndStripCssImports:Z,renderVendorStyleTags:Q}=await import("./chunk-pxemb9dg.js"),ne=Z(w,{filePath:i,projectRoot:process.cwd()});w=ne.code,ce=Q(ne.styles)}catch(Z){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,Z instanceof Error?Z.message:Z)}if(be&&w.trim())w=Xe(w);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-pxemb9dg.js");w=Q(w).code;let{hasUserImports:ne,bundleClientScript:Se}=await import("./chunk-9zc1cnw8.js");if(ne(w))w=await Se(w,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:Z}=await import("./chunk-678nhepd.js");w=Z(w)}let de=Ee(w);if(!X){let{extractBridgeData:Z,generateServerDataBridge:Q}=await import("./chunk-pxemb9dg.js"),ne=Q(w,Z(_));if(ne)w=`${ne}
48
48
  ${w}`}if(de&&!X){L=!0,k=ue(i,e);let Z=M(w),Q=ge(Z,k);R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:Z}=await import("./chunk-k52126rh.js");await Z(w,_,i)}catch(Z){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,Z)}if(!X&&!de){let Z=K.replace(/\bclient\b/i,"").trim();k=ue(i,e);let Q=M(w),ne=ge(Q,k);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(ne))te=!0;R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}"${Z?` ${Z}`:""}>${ne}</script>
50
- `}}if(F.length>0){let{interpolateScriptExpressions:S}=await import("./chunk-gs6geqeg.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,w)=>{let X=F[Number(w)];return`<script${X.attrs}>${S(X.body,_,f)}</script>`})}if(k){let S=Me(o,k);if(o=S.html,S.mergedIntoExisting){let w=k,X=S.mergedIntoExisting;R=R.split(`'${w}'`).join(`'${X}'`).split(`"${w}"`).join(`"${X}"`),k=X}else if(!S.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${A.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(S.stamped&&S.root!=="body"&&(L||te)&&!pe.has(i)){let w=ag(o);if(w.length>1)pe.add(i),console.warn(`[stx] ${A.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${w.length} top-level elements (${w.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=S.stamped&&S.root!==null&&Dr(S.root);R=ke(R,K?k:null)}if(o.includes("@include")||o.includes("@partial"))o=await xs(o,_,i,r,b,n);let{processLoops:re,reportDeferredLoopWarnings:oe}=await import("./chunk-nj1ssjtd.js"),J=re(o,_,i,void 0,!0);J=fe(J,_,i),J=oe(J);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-78zgmqhd.js");if(J=xe(J,_,i,r),J=we(J,_,i),J=_e(J,_,i,r),J=P(J,_,i),V)J+=`
49
+ `;continue}if(X)try{let{extractVariables:Z}=await import("./chunk-v65efeh1.js");await Z(w,_,i)}catch(Z){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,Z)}if(!X&&!de){let Z=K.replace(/\bclient\b/i,"").trim();k=ue(i,e);let Q=M(w),ne=ge(Q,k);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(ne))te=!0;R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}"${Z?` ${Z}`:""}>${ne}</script>
50
+ `}}if(F.length>0){let{interpolateScriptExpressions:S}=await import("./chunk-j58b7xen.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,w)=>{let X=F[Number(w)];return`<script${X.attrs}>${S(X.body,_,f)}</script>`})}if(k){let S=Me(o,k);if(o=S.html,S.mergedIntoExisting){let w=k,X=S.mergedIntoExisting;R=R.split(`'${w}'`).join(`'${X}'`).split(`"${w}"`).join(`"${X}"`),k=X}else if(!S.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${A.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(S.stamped&&S.root!=="body"&&(L||te)&&!pe.has(i)){let w=ag(o);if(w.length>1)pe.add(i),console.warn(`[stx] ${A.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${w.length} top-level elements (${w.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=S.stamped&&S.root!==null&&Dr(S.root);R=ke(R,K?k:null)}if(o.includes("@include")||o.includes("@partial"))o=await xs(o,_,i,r,b,n);let{processLoops:re,reportDeferredLoopWarnings:oe}=await import("./chunk-zen0ef4k.js"),J=re(o,_,i,void 0,!0);J=fe(J,_,i),J=oe(J);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-ywnqjqns.js");if(J=xe(J,_,i,r),J=we(J,_,i),J=_e(J,_,i,r),J=P(J,_,i),V)J+=`
51
51
  `+V;if(R)J+=`
52
52
  `+R;return J}catch(l){if(l instanceof ee)throw l;let o=l instanceof Error?l.message:String(l);return B(f,`Error processing include ${f}: ${o}`,h,g)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(t))!==null){let f=H.index,v=f+H[0].length-1,h=1,g=v+1;while(g<t.length&&h>0){if(t[g]==="(")h++;else if(t[g]===")")h--;g++}if(h!==0)break;let i=t.substring(f,g),x=t.substring(v+1,g-1),l=x.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=g;continue}let o=l[1],D,z=x.substring(l[0].length),E=ae(z,0);if(E!==-1)D=z.substring(E+1).trim();let V={};if(D)try{V=N(D,e)}catch(_){let q=_ instanceof Error?_.message:String(_);t=t.replace(i,y("Include",`Error parsing include variables for ${o}: ${q}`,a,c,f)),Y.lastIndex=0;continue}let F=await se(o,V,c,f);t=t.substring(0,f)+F+t.substring(g),Y.lastIndex=0}return t}function Ss(c,e){let a=c;function r(b,n,u,t){let C=b,W=!0;while(W){W=!1;let ie=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),B=C.match(ie);if(!B||B.index===void 0)break;let se=B.index,Y=B[1],H=se+B[0].length,f=new RegExp(`@${n}\\(`),v=new RegExp(`@${u}(?![a-z])`),h=1,g=H,i=-1;while(h>0&&g<C.length){let l=C.slice(g),o=l.match(f),D=l.match(v),z=o?g+o.index:1/0,E=D?g+D.index:1/0;if(z<E)h++,g=z+(o[0].length||1);else if(E<1/0){if(h--,h===0){i=E;break}g=E+u.length+1}else break}if(i===-1)break;let x=C.slice(H,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(x);else e[Y].push(x);C=C.substring(0,se)+C.substring(i+`@${u}`.length),W=!0}return C}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function ks(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
53
53
  `)})}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Lo,jh,Bh}from"./chunk-cekzqze8.js";import"./chunk-99spzsmw.js";import"./chunk-j7bkrvey.js";import"./chunk-9f31gs4m.js";import"./chunk-22mdphq2.js";import"./chunk-whmk0m8x.js";import"./chunk-cb0c6959.js";import"./chunk-nb6erf75.js";import"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Bh as clearComposableCache,jh as getComposableScript,Lo as listComposableModules};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{wn,Go,Xo,Jo,ey,Yo}from"./chunk-45jpwbzd.js";import"./chunk-ssg6ne5b.js";import"./chunk-agd2b928.js";import"./chunk-6t04tqvh.js";export{Xo as buildServerApi,ey as createServerApi,wn as discoverServerApi,Go as generateApiTypes,Yo as isServerApiSource,Jo as productionApiDispatcher};
2
+ import{wn,Go,Xo,Jo,ey,Yo}from"./chunk-j7bkrvey.js";import"./chunk-ssg6ne5b.js";import"./chunk-agd2b928.js";import"./chunk-6t04tqvh.js";export{Xo as buildServerApi,ey as createServerApi,wn as discoverServerApi,Go as generateApiTypes,Yo as isServerApiSource,Jo as productionApiDispatcher};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Sm}from"./chunk-v99zjh93.js";import"./chunk-0k7khseq.js";import"./chunk-qxthb2a1.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Sm as buildApp};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ng,$c,ty,Rc,rg,sg,xn,yr,ny,og,ig,ry,x}from"./chunk-2cvwjtjh.js";import"./chunk-jc74097x.js";import"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{xn as buildCss,og as extractClassNames,sg as fingerprintConfig,ig as generateCss,ny as getCachedCSS,ng as getCssServeAsset,x as injectCss,$c as loadCssEngine,Rc as loadCssEngineConfig,yr as rebuildCss,ty as resetCssCache,rg as resolveUserCssConfig,ry as withLinkedModuleBundles};
2
+ import{ng,$c,ty,Rc,rg,sg,xn,yr,ny,og,ig,ry,x}from"./chunk-radvtjwt.js";import"./chunk-cn2bgt0w.js";import"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{xn as buildCss,og as extractClassNames,sg as fingerprintConfig,ig as generateCss,ny as getCachedCSS,ng as getCssServeAsset,x as injectCss,$c as loadCssEngine,Rc as loadCssEngineConfig,yr as rebuildCss,ty as resetCssCache,rg as resolveUserCssConfig,ry as withLinkedModuleBundles};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Fa,Ou,Qn,ah,Nu,Mu,Du,ch}from"./chunk-pm27mcfp.js";import"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Qn as Validator,Ou as defineForm,Nu as processErrorDirective,Mu as processErrorsDirective,ch as processFormValidationDirectives,Du as processHasErrorsDirective,Fa as useForm,ah as v};
2
+ import{Fa,Ou,Qn,ah,Nu,Mu,Du,ch}from"./chunk-qjqvhke7.js";import"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Qn as Validator,Ou as defineForm,Nu as processErrorDirective,Mu as processErrorsDirective,ch as processFormValidationDirectives,Du as processHasErrorsDirective,Fa as useForm,ah as v};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{cy,ly,cg,Cs}from"./chunk-345waetq.js";import"./chunk-k7ffxfgp.js";import"./chunk-t94y8g35.js";import"./chunk-v1s838fe.js";import{Dr}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import{ht}from"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{ht as freeIdentifiers,Cs as processComponents,cg as processESImports,Dr as rendersAsElement,cy as resetMarginStackWarnings,ly as resetTemplateLoopWarnings};
2
+ import{cy,ly,cg,Cs}from"./chunk-s9xavhdb.js";import"./chunk-ddws4zp2.js";import"./chunk-d2pexm3z.js";import"./chunk-cb0c6959.js";import{Dr}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import{ht}from"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{ht as freeIdentifiers,Cs as processComponents,cg as processESImports,Dr as rendersAsElement,cy as resetMarginStackWarnings,ly as resetTemplateLoopWarnings};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{j,cl,no,$n,h,qe,Ke}from"./chunk-njza56wn.js";import{_r,ut,W}from"./chunk-w53p65hy.js";import{gr,i}from"./chunk-2gg3vjks.js";import{$e}from"./chunk-1zkymrw0.js";import{ra}from"./chunk-xpbakn6t.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=_r(s),a=await(e.renderer??((n)=>ut(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=j(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
2
+ import{j,cl,no,$n,h,qe,Ke}from"./chunk-3jndqseh.js";import{_r,ut,W}from"./chunk-0k7khseq.js";import{gr,i}from"./chunk-qpybh7ss.js";import{$e}from"./chunk-whmk0m8x.js";import{ra}from"./chunk-xpbakn6t.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=_r(s),a=await(e.renderer??((n)=>ut(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=j(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -12,5 +12,5 @@ ${s}
12
12
  </html>`}async function bc(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};$n(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...W,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...no(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await h(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),cl(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
13
13
  ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=qe(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Ke(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await gr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
- `);t=ra(t,f)}t=await $e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-xfhxfcvk.js");t=await o(t)}catch{}return t}
15
+ `);t=ra(t,f)}t=await $e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-mhdkk9a4.js");t=await o(t)}catch{}return t}
16
16
  export{bc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ji,Iy,Oy,Ol,Qe,Xg,go,Ny,My,Dy,Ly,jy,By,Fy,zy,Hy}from"./chunk-86nsbxep.js";import"./chunk-s29hp1qw.js";export{By as applyHead,Ny as definePageMeta,Ji as getHead,Iy as getPageMeta,Qe as mergeHeadConfigs,Fy as processHeadDirective,Hy as processMetaDirective,zy as processTitleDirective,jy as renderBodyAttrs,Dy as renderHead,Ly as renderHtmlAttrs,Oy as resetHead,go as seoMetaToHeadConfig,Ol as useHead,My as usePageTitle,Xg as useSeoMeta,My as useTitle};
2
+ import{Ji,Iy,Oy,Ol,Qe,Xg,go,Ny,My,Dy,Ly,jy,By,Fy,zy,Hy}from"./chunk-295bykzd.js";import"./chunk-s29hp1qw.js";export{By as applyHead,Ny as definePageMeta,Ji as getHead,Iy as getPageMeta,Qe as mergeHeadConfigs,Fy as processHeadDirective,Hy as processMetaDirective,zy as processTitleDirective,jy as renderBodyAttrs,Dy as renderHead,Ly as renderHtmlAttrs,Oy as resetHead,go as seoMetaToHeadConfig,Ol as useHead,My as usePageTitle,Xg as useSeoMeta,My as useTitle};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ae,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Dl,t}from"./chunk-yh2hnt3m.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ae as BROWSER_CORE_IMPORTS,Ng as STX_AUTO_IMPORTS,Li as extractAndStripCssImports,qe as extractBridgeData,Dl as findInterpolationEnd,wl as generateAutoImportDestructuring,Cy as generateBrowserAutoImportDestructuring,Rn as generateServerDataBridge,Kt as injectBrowserCoreAutoImports,Ke as processClientScript,Mg as referencesName,ji as renderVendorStyleTags,t as stripCommentsAndLiterals,bl as transformAutoImports};
2
+ import{Ae,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke}from"./chunk-3jndqseh.js";import"./chunk-c3413bgh.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Dl,t}from"./chunk-yh2hnt3m.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ae as BROWSER_CORE_IMPORTS,Ng as STX_AUTO_IMPORTS,Li as extractAndStripCssImports,qe as extractBridgeData,Dl as findInterpolationEnd,wl as generateAutoImportDestructuring,Cy as generateBrowserAutoImportDestructuring,Rn as generateServerDataBridge,Kt as injectBrowserCoreAutoImports,Ke as processClientScript,Mg as referencesName,ji as renderVendorStyleTags,t as stripCommentsAndLiterals,bl as transformAutoImports};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{P}from"./chunk-njza56wn.js";import{we}from"./chunk-rsxxajv6.js";function g(e,t){let r={};for(let n of e)r[n]=we(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=we(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Fa(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=we(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Ou=Fa;class Qn{rules=[];defaultValue="";addRule(e){let t=new Qn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Qn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Qn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var ah=new Qn;function Nu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
2
+ import{P}from"./chunk-3jndqseh.js";import{we}from"./chunk-rsxxajv6.js";function g(e,t){let r={};for(let n of e)r[n]=we(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=we(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Fa(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=we(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Ou=Fa;class Qn{rules=[];defaultValue="";addRule(e){let t=new Qn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Qn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Qn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var ah=new Qn;function Nu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
3
3
  `)}catch{return""}})}function Mu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
4
4
  `)}catch{return""}})}function Du(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function ch(e,t,r){let n=e;return n=Nu(n,t,r),n=Mu(n,t,r),n=Du(n,t,r),n}export{Fa,Ou,Qn,ah,Nu,Mu,Du,ch};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Qt,ye,R}from"./chunk-s29hp1qw.js";import{Ti,Qc,o,A,Ue,Pe,_n,We,xe,re,Ir,J,En,to,ll,ul,$n,Lr,ro,so,dl,Mi,pl,fl,gl,ml,qe,Ke,oo,Je,s,An,y,g,Y,ie,Oe,P,Hi}from"./chunk-njza56wn.js";import{d,m,N,n,ae,ee,u,Ne,qi,q,Mn,Ki,Yt,Gi,$l,zr,Rl,bt,Al,Hr,Pl,Dn,Xi,Il,Vr,Wr,Me,Ji}from"./chunk-86nsbxep.js";import{Gt}from"./chunk-6t04tqvh.js";import{On}from"./chunk-yffqfgjx.js";import{x}from"./chunk-2cvwjtjh.js";import{Tr,Us}from"./chunk-agd2b928.js";import{Dc,Lc,_r,ut,jc,L}from"./chunk-w53p65hy.js";import{yi,bi,wi,vi}from"./chunk-h2tq6cbr.js";import{Pc,Cs}from"./chunk-345waetq.js";import{xs,Ss,ks}from"./chunk-ekdhjm8p.js";import{$s,li,ui,Rs,As,di}from"./chunk-ym0cdk7m.js";import{Es,si}from"./chunk-9yx7cbhz.js";import{ei}from"./chunk-c0g30cjs.js";import{fe,oi,ii,ai}from"./chunk-t94y8g35.js";import{vr,Te,Oc,xr,Nc}from"./chunk-1zkymrw0.js";import{U,ct}from"./chunk-care745q.js";import{Z}from"./chunk-nb6erf75.js";import{Fc,zc}from"./chunk-nnynrb97.js";import{I,Ln,Yi}from"./chunk-ws2h92mm.js";import{Bn}from"./chunk-yh2hnt3m.js";import{D,c,f}from"./chunk-xpbakn6t.js";function Ge(r){return/\bimport\s*\.\s*meta\b/.test(Bn(r))}function Fr(r){let e=Pe(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,"&quot;")}"`).join(" ")}function vt(r){let e=Fr(r);if(e.some((b)=>J(b.attrs).has("data-stx-module-bootstrap")))return r;let l=(b)=>{if(Ge(b))return!0;try{return Z(b)}catch{return!1}};if(!e.some((b)=>l(b.body)||J(b.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let b of e){let S=J(b.attrs),v=S.get("type");if(b.inert||S.has("data-stx-module-job")||S.has("data-stx-runtime")||S.has("data-stx-router"))continue;if(typeof v==="string"&&!["module","text/javascript","application/javascript"].includes(v.toLowerCase()))continue;if(![...S.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=v==="module"||l(b.body);if(_)p=!0;if(!p)continue;if(!_&&(S.has("data-stx-owner")||S.has("data-stx-instance")))continue;h+=r.slice(t,b.start);let E=b.body,M=S.get("src");if(typeof M==="string")S.delete("src"),S.set("data-stx-source-url",M),E=`${_?"await":"return"} new Promise(function(resolve,reject){
2
+ import{Qt,ye,R}from"./chunk-s29hp1qw.js";import{Ti,Qc,o,A,Ue,Pe,_n,We,xe,re,Ir,J,En,to,ll,ul,$n,Lr,ro,so,dl,Mi,pl,fl,gl,ml,qe,Ke,oo,Je,s,An,y,g,Y,ie,Oe,P,Hi}from"./chunk-3jndqseh.js";import{d,m,N,n,ae,ee,u,Ne,qi,q,Mn,Ki,Yt,Gi,$l,zr,Rl,bt,Al,Hr,Pl,Dn,Xi,Il,Vr,Wr,Me,Ji}from"./chunk-295bykzd.js";import{Gt}from"./chunk-6t04tqvh.js";import{On}from"./chunk-c3413bgh.js";import{x}from"./chunk-radvtjwt.js";import{Tr,Us}from"./chunk-agd2b928.js";import{Dc,Lc,_r,ut,jc,L}from"./chunk-0k7khseq.js";import{yi,bi,wi,vi}from"./chunk-0rdh8bw3.js";import{Pc,Cs}from"./chunk-s9xavhdb.js";import{xs,Ss,ks}from"./chunk-kjz7g83q.js";import{$s,li,ui,Rs,As,di}from"./chunk-22mdphq2.js";import{Es,si}from"./chunk-a852vdv3.js";import{ei}from"./chunk-c0g30cjs.js";import{fe,oi,ii,ai}from"./chunk-d2pexm3z.js";import{vr,Te,Oc,xr,Nc}from"./chunk-whmk0m8x.js";import{U,ct}from"./chunk-care745q.js";import{Z}from"./chunk-nb6erf75.js";import{Fc,zc}from"./chunk-qxthb2a1.js";import{I,Ln,Yi}from"./chunk-ws2h92mm.js";import{Bn}from"./chunk-yh2hnt3m.js";import{D,c,f}from"./chunk-xpbakn6t.js";function Ge(r){return/\bimport\s*\.\s*meta\b/.test(Bn(r))}function Fr(r){let e=Pe(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,"&quot;")}"`).join(" ")}function vt(r){let e=Fr(r);if(e.some((b)=>J(b.attrs).has("data-stx-module-bootstrap")))return r;let l=(b)=>{if(Ge(b))return!0;try{return Z(b)}catch{return!1}};if(!e.some((b)=>l(b.body)||J(b.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let b of e){let S=J(b.attrs),v=S.get("type");if(b.inert||S.has("data-stx-module-job")||S.has("data-stx-runtime")||S.has("data-stx-router"))continue;if(typeof v==="string"&&!["module","text/javascript","application/javascript"].includes(v.toLowerCase()))continue;if(![...S.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=v==="module"||l(b.body);if(_)p=!0;if(!p)continue;if(!_&&(S.has("data-stx-owner")||S.has("data-stx-instance")))continue;h+=r.slice(t,b.start);let E=b.body,M=S.get("src");if(typeof M==="string")S.delete("src"),S.set("data-stx-source-url",M),E=`${_?"await":"return"} new Promise(function(resolve,reject){
3
3
  var source=globalThis.__stxExecutingScript,script=document.createElement('script');
4
4
  for(var attr of source.attributes)if(!['type','src','data-stx-module-job'].includes(attr.name))script.setAttribute(attr.name,attr.value);
5
5
  ${_?"script.type='module';":""}
@@ -1350,7 +1350,7 @@ ${C}
1350
1350
  </style>`;a=a.replace(S,O),w.lastIndex=0}catch(C){}}}return a}import gt from"path";var ts=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,rs=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ns(r,e){if(!e||!r.includes("/"))return r;let l=gt.dirname(e);return r.replace(ts,(a,h,t,p)=>{let w=gt.resolve(l,p);return`${h}${t}${w.split(gt.sep).join("/")}${t}`})}function br(r,e){if(!e||!r.includes("<script"))return r;return r.replace(rs,(l,a,h,t)=>`${a}${ns(h,e)}${t}`)}var Re="<!--PARENT_CONTENT_PLACEHOLDER-->";function wr(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Mr(r,e){let l=r.length,a=e,h=!0,t=[],p=(w)=>w+9<=l&&r[w]==="<"&&r[w+1]==="/"&&(r[w+2]==="s"||r[w+2]==="S")&&(r[w+3]==="c"||r[w+3]==="C")&&(r[w+4]==="r"||r[w+4]==="R")&&(r[w+5]==="i"||r[w+5]==="I")&&(r[w+6]==="p"||r[w+6]==="P")&&(r[w+7]==="t"||r[w+7]==="T")&&(r[w+8]===">"||/\s/.test(r[w+8]));while(a<l){let w=r[a];if(p(a))return a;if(w==="/"&&r[a+1]==="/"){if(a=r.indexOf(`
1351
1351
  `,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&r[a+1]==="*"){let b=r.indexOf("*/",a+2);if(b===-1)return-1;a=b+2,h=!0;continue}if(w==="/"&&h){let b=a+1,S=!1;while(b<l){let v=r[b];if(v==="\\"){b+=2;continue}if(v==="[")S=!0;else if(v==="]")S=!1;else if(v==="/"&&!S){b++;break}else if(v===`
1352
1352
  `){b=-1;break}b++}if(b===-1){a++,h=!1;continue}while(b<l&&/[a-z]/.test(r[b]))b++;a=b,h=!1;continue}if(w==="'"||w==='"'){let b=w;a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]===b){a++;break}if(r[a]===`
1353
- `)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Rr(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var is=4096;async function mt(r,e,l){if(Ge(e)||Z(e)||l.buildMode!=="serve"||e.length<is)return null;let{registerServeModuleBundle:a}=await import("./chunk-wfthd3n5.js");return`<script ${r} src="${a(e)}"></script>`}async function gr(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-bhc25n2n.js")),p=[],w=await t(h(...r),{minify:Yi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!Ge(w)&&!Z(w)){let{registerServeModuleBundle:b}=await import("./chunk-wfthd3n5.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function os(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-asv4b65m.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-pstbfz5g.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),b=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let _=0;_<8;_++){let E=null,M="",T=!1;try{if(t){let F=w?await t.getStoreScript(p).then((W)=>W?{code:W,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[b],{reads:t.storesReadInFiles([...S,...v]),runOnce:!0});if(F)E=F.code,M=F.stores.join(","),T=!!F.functions&&!w}}catch{}if(k!==null&&M===k)break;k=M;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",O=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??O:null;let B={};h.modulesTag=await gr([r,O],e,l,B),h.modulesCode=B.code??null,S=B.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:F}=await o("stx/composable-loader",()=>import("./chunk-dv0cpmat.js")),W=e.composablesDir,j=[h.modulesCode??h.modulesTag,O,h.frameworkScript].filter((V)=>V!==null),H=await F(e._layerComposableDirs??W,r,j,v);if(H)h.composableCode=H,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',H,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${H.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function as(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-95j7y1rt.js"),p=await import("./chunk-7kqgp3p7.js"),{messages:w,webModules:b}=e,S=null,v=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(C){cs(C)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-3sema2js.js")).loadWebModules(process.cwd(),b)}catch(C){ls(C)}let _=new Map([...v??[],...S?.stubs??[]]),E=()=>os(r,e,l,a),M=_.size?await h(_,E):await E(),T=null;if(S){let C=p.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),O=p.pageMessagesScript(S,p.pageLanguages(r,S),C);if(O)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',O,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${O.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((C)=>C!==null)}var Sr=!1;function cs(r){if(Sr)return;Sr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var kr=!1;function ls(r){if(kr)return;kr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function us(r,e=""){let l=Rr(r,"data-stx-runtime");if(!l)return r;let a=vr(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
1353
+ `)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Rr(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var is=4096;async function mt(r,e,l){if(Ge(e)||Z(e)||l.buildMode!=="serve"||e.length<is)return null;let{registerServeModuleBundle:a}=await import("./chunk-4adb8bmp.js");return`<script ${r} src="${a(e)}"></script>`}async function gr(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-h0nsb8b0.js")),p=[],w=await t(h(...r),{minify:Yi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!Ge(w)&&!Z(w)){let{registerServeModuleBundle:b}=await import("./chunk-4adb8bmp.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function os(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-47bsv8xy.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-93fvjs6g.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),b=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let _=0;_<8;_++){let E=null,M="",T=!1;try{if(t){let F=w?await t.getStoreScript(p).then((W)=>W?{code:W,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[b],{reads:t.storesReadInFiles([...S,...v]),runOnce:!0});if(F)E=F.code,M=F.stores.join(","),T=!!F.functions&&!w}}catch{}if(k!==null&&M===k)break;k=M;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",O=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??O:null;let B={};h.modulesTag=await gr([r,O],e,l,B),h.modulesCode=B.code??null,S=B.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:F}=await o("stx/composable-loader",()=>import("./chunk-ktk4eg8c.js")),W=e.composablesDir,j=[h.modulesCode??h.modulesTag,O,h.frameworkScript].filter((V)=>V!==null),H=await F(e._layerComposableDirs??W,r,j,v);if(H)h.composableCode=H,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',H,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${H.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function as(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-9zc1cnw8.js"),p=await import("./chunk-7kqgp3p7.js"),{messages:w,webModules:b}=e,S=null,v=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(C){cs(C)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-3sema2js.js")).loadWebModules(process.cwd(),b)}catch(C){ls(C)}let _=new Map([...v??[],...S?.stubs??[]]),E=()=>os(r,e,l,a),M=_.size?await h(_,E):await E(),T=null;if(S){let C=p.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),O=p.pageMessagesScript(S,p.pageLanguages(r,S),C);if(O)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',O,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${O.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((C)=>C!==null)}var Sr=!1;function cs(r){if(Sr)return;Sr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var kr=!1;function ls(r){if(kr)return;kr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function us(r,e=""){let l=Rr(r,"data-stx-runtime");if(!l)return r;let a=vr(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
1354
1354
  `+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=vr(t);if(p===-1)return h+e+`
1355
1355
  `+t;return t.slice(0,p)+h+e+`
1356
1356
  `+t.slice(p)}function ds(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(l,a,h)=>{let t=r.slice(0,h);return t.lastIndexOf("<")>t.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,l,a,h){if(await R(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Oe(r,l);let t=!e.__stxProcessingDepth;$n(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(t&&a.runtimeConfig)await On(e,l,a.runtimeConfig);if(t)gl(e),e.__stx_scope_seq??={n:0,key:oo(String(e.__filename??l))},e.__stx_head_injections=Gi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!I()&&!Ln())&&l&&l.endsWith(".stx"))ei(r,l);try{return await ye.timeAsync("template-processing",async()=>{let p=await ps(r,e,l,a,h);if(t)p=Mi(p);if(t&&a.autoShell&&a.buildMode!=="compile"){let w=Me(a.app?.head,{known:Wr,source:"app.head"}),S=(e.__stx_runtime_head||null)??Ji(),v=(e.__stx_head_raw||"").trim(),k,_=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)k=_[1].trim(),v=v.replace(_[0],"").trim();let E=e.__sections?.title,M=E?P(E,e,l):void 0,T=S.title||k||M,C=!S.title&&(!!k||!!M),O=S.meta||[],B=new Set(O.map((K)=>bt(K)).filter(Boolean)),F={...w,...T&&{title:T},meta:[...(w.meta||[]).filter((K)=>!B.has(bt(K))),...O],link:[...w.link||[],...S.link||[]],script:[...w.script||[],...S.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
@@ -1365,18 +1365,18 @@ ${b.trim()}
1365
1365
  @endsection`}}if(O&&b.includes("<script")){let j=re(b),H=j.scripts.map((V)=>$r(V,l)??V);b=Ir(j.output,H)}if(b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(j,H,V)=>(C[H]=V,"")),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(j,H,V)=>{if(/^(['"]).*\1$/.test(V.trim()))return j;try{let K=d(V.trim(),e);if(K===void 0)return j;let G=(e.__stx_inline_section_values??=[]).push(K)-1;return C[H]=`{{ __stx_inline_section_values[${G}] }}`,""}catch{return j}}),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(j,H,V)=>{if(V.includes("@parent"))C[H]=V.replace("@parent",Re);else C[H]=V.trim();return""}),e.__sections=C,b=b.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(j,H,V)=>C[H]||V||""),!("slot"in e)||e.slot===void 0)b=b.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||"");if(b=ks(b,T),O){let j=[],H=re(b),V=xe(H.output,_n,(K,de)=>`\x00STX_ORPHAN_STYLE_${de}\x00`);if(b=V.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,de,G)=>{let pe=de==="SCRIPT"?$r(H.scripts[Number(G)],l):V.tokens[Number(G)];if(pe)j.push(pe);return""}),j.length>0){let K=j.join(`
1366
1366
  `);C.content=C.content?`${C.content}
1367
1367
  ${K}`:K,e.__sections=C}}if(O)try{let j;if(le.isAbsolute(O))j=O,h.add(O);else j=await Ne(()=>An(O,l,p,h),null,()=>{throw new ae(`Failed to resolve layout path: ${O}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!j){let ue=(Q)=>{if(!Q)return[];try{let Se=le.isAbsolute(Q)?Q:le.resolve(process.cwd(),Q);return ss.readdirSync(Se).filter(($e)=>$e.endsWith(".stx")).map(($e)=>$e.replace(/\.stx$/,""))}catch{return[]}},se=[...ue(p.layoutsDir),...ue(p.fallbackLayoutsDir)].filter((Q,Se,$e)=>$e.indexOf(Q)===Se).sort(),ve=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),me=ve.length>0?` Searched: ${ve.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",oe=`Layout not found: ${O} (referenced from ${l})`+(se.length>0?`. Available layouts: ${se.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+me;if(q.log(Error(oe),{layoutPath:O,filePath:l,available:se},"error"),console.error(`[stx] ${oe}`),p.debug)throw new ae(oe,l);return b}let H=await Ne(()=>Bun.file(j).text(),"",()=>{throw new ae(`Failed to read layout file: ${j}`,l,void 0,void 0,"Layout content could not be loaded")});H=br(H,j),H=H.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(V.includes(j)){let ue=[...V.slice(V.indexOf(j)),j];throw new ae(ue.length===2?`Circular layout: ${j} extends itself`:`Circular layout: ${ue.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let K=H.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(K){if(p.debug)console.log(`Found nested layout: ${K[1]} in ${j}`);let ue={},se=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(oe,Q,Se)=>(ue[Q]=Se.trim(),""));for(let[oe,Q]of Object.entries(ue))if(C[oe]&&C[oe].includes(Re)){let Se=C[oe].indexOf(Re);C[oe]=C[oe].slice(0,Se)+Q+C[oe].slice(Se+Re.length)}else if(!C[oe])C[oe]=Q;let ve={...e,__sections:C,__layoutChain:[...V,j]},me=`@layout('${K[1]}')${se}`;return await i(me,ve,j,p,h)}let de=H.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Ss(de,T),pe={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ue,se,ve)=>(pe[se]=ve.trim(),`@slot('${se}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ue,se,ve)=>{if(C[se]){let me=C[se];if(me.includes(Re)){let oe=pe[se]||"",Q=me.indexOf(Re);me=me.slice(0,Q)+oe+me.slice(Q+Re.length)}return me}return ve||""}),G=fs(G,C),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||""),G=ks(G,T),e.__originalFilePath=l,b=await Ar(G,e,j,p,h),b=`<!-- stx-layout: ${O} -->
1368
- ${b}`,k(b)}catch(j){if(j instanceof ee)throw j;throw new ae(`Error processing layout ${O}: ${j instanceof Error?j.message:String(j)}`,l)}return k(await Ar(b,e,l,p,h))}function fs(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function gs(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function ms(r,e){await Ne(()=>sr(r,e),void 0,(l)=>{q.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function $r(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function hs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Cr(r,e,l){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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function ys(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-my3yv4sg.js")),t=[],p=!I()&&!Ln();for(let b of h(r)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Mr(r,v);if(k===-1)continue;let _=r.slice(v,k);if(!_.trim())continue;let E=hs(S)??l,M={index:b.start,length:k+9-b.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-k52126rh.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...M,markup:Cr(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(q.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...M,markup:Cr(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let b of t.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function bs(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-gs6geqeg.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return q.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Ar(r,e,l,a,h){let t=r;await R();let p=a;if(t=await ys(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await bs(t,e,l),await R(),t=await Nt(t,e,l,p),Oe(t))t=li(t,e),t=As(t,e),t=Rs(t,e);t=ui(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-v8ea76j6.js"));t=w(t,e),t=await si(t,e,l,p,!0),await R(),t=await ur(t,e,l,p,h),t=await Cs(t,e,l,p,h),await R(),t=Dc(t,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-t8r40wgf.js"));t=b(t,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-fz4c5e9m.js"));t=S(t,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-d7b30bg6.js"));t=v(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-gmp10259.js"));t=M(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-pjjrx9pk.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-axra1yas.js"));t=C(t,e,l);let{processVirtualListDirectives:O,processVirtualGridDirectives:B,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-jghpzx5m.js"));t=O(t,e,l),t=B(t,e,l),t=F(t,e,l),await R();let{processPartialHydrationDirectives:W,processStaticDirectives:j}=await o("stx/partial-hydration",()=>import("./chunk-4pjqj54a.js"));t=W(t,e,l),t=j(t);let{processComputedDirectives:H,processWatchDirectives:V}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=H(t,e,l),t=V(t,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-fwhr3jda.js"));t=K(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-1jk46ve0.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let se=de(t);if(t=se.content,se.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${se.headContent}
1368
+ ${b}`,k(b)}catch(j){if(j instanceof ee)throw j;throw new ae(`Error processing layout ${O}: ${j instanceof Error?j.message:String(j)}`,l)}return k(await Ar(b,e,l,p,h))}function fs(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function gs(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function ms(r,e){await Ne(()=>sr(r,e),void 0,(l)=>{q.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function $r(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function hs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Cr(r,e,l){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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function ys(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-678nhepd.js")),t=[],p=!I()&&!Ln();for(let b of h(r)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Mr(r,v);if(k===-1)continue;let _=r.slice(v,k);if(!_.trim())continue;let E=hs(S)??l,M={index:b.start,length:k+9-b.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-v65efeh1.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...M,markup:Cr(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(q.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...M,markup:Cr(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let b of t.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function bs(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-j58b7xen.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return q.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Ar(r,e,l,a,h){let t=r;await R();let p=a;if(t=await ys(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await bs(t,e,l),await R(),t=await Nt(t,e,l,p),Oe(t))t=li(t,e),t=As(t,e),t=Rs(t,e);t=ui(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-3abd3gw8.js"));t=w(t,e),t=await si(t,e,l,p,!0),await R(),t=await ur(t,e,l,p,h),t=await Cs(t,e,l,p,h),await R(),t=Dc(t,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-t8r40wgf.js"));t=b(t,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-fz4c5e9m.js"));t=S(t,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-d7b30bg6.js"));t=v(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-gmp10259.js"));t=M(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-pjjrx9pk.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-axra1yas.js"));t=C(t,e,l);let{processVirtualListDirectives:O,processVirtualGridDirectives:B,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-jghpzx5m.js"));t=O(t,e,l),t=B(t,e,l),t=F(t,e,l),await R();let{processPartialHydrationDirectives:W,processStaticDirectives:j}=await o("stx/partial-hydration",()=>import("./chunk-4pjqj54a.js"));t=W(t,e,l),t=j(t);let{processComputedDirectives:H,processWatchDirectives:V}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=H(t,e,l),t=V(t,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-n163nwke.js"));t=K(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-p5qac909.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let se=de(t);if(t=se.content,se.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${se.headContent}
1369
1369
  `;if(t=G(t,e),t=pe(t,e,l),t=nr(t),t=oi(t,e),t=jt(t),t=Zt(t),t=await xs(t,e,l,p,h),t=await Cs(t,e,l,p,h),await R(),t=t.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),t=Mi(t),t=fe(t,e,l),t=Es(t),await R(),e.__stxProcessingDepth===1)t=ml(t,e);if(t=ll(t,e,{filePath:l,buildMode:p.buildMode}),t=ii(t,e),t=ai(t,e),t=et(t,e),t=Wt(t,e),t=Xt(t,e),t=await Ct(t,e,l,p),t=await jc(t,e,l),t=await Fc(t,e,l,p),await R(),t=zc(t,e,l,p),t=yi(t,e,l,p),t=bi(t,e,l),t=wi(t,e,l,p),t=Lt(t,e,l,p),t=ro(t,e),t=so(t),t=dl(t),!p.skipEventDirectives)t=Qc(t,e,l);if(t=ul(t,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await R(),p.debug){let X=/\bx-data\s*=/.test(t),z=$s(r);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1370
1370
  Both work on the same page, but they manage separate scopes.
1371
1371
  Prefer signals (state/derived/effect) for new components.`)}t=Pc(t,e),t=await Hi(t,e,l),await R(),t=pl(t),t=fl(t),t=$t(t);let{processXElementDirectives:ve}=await o("stx/x-element",()=>import("./chunk-satrf398.js"));t=ve(t);let me=e.__originalFilePath||l,oe=qe(e);if(t=await di(t,p,me,oe),await R(),t=qt(t,e),t=await rr(t,e,l,p),await R(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-f3j1h3ch.js"));t=await z(t,{publicDir:X})}if(p.seo?.enabled)t=vi(t,e,p);let Q=(X,z,te=!0)=>{if(!z)return X;let we=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ce=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),he=ce?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ce[0]):null;if(we&&ce&&he){if(te){let De=ce.index+he.index;X=X.slice(0,De)+we[0]+X.slice(De+he[0].length)}if(z=z.replace(we[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
1372
1372
  ${z}`);if(/<html\b[^>]*>/i.test(X))return X.replace(/(<html\b[^>]*>)/i,`$1
1373
1373
  <head>
1374
1374
  ${z}
1375
- </head>`);return X},{renderHead:Se,getHead:$e}=await o("stx/head",()=>import("./chunk-1jk46ve0.js")),He=e.__stx_runtime_head??$e();if(He.title||He.meta?.length||He.link?.length){let X=Se(He);if(X)t=Q(t,X)}if(se.headContent)t=Q(t,se.headContent,!He.title);if(p.csp?.enabled&&p.csp.addMetaTag)t=It(t,p.csp,e);if(p.analytics?.enabled)t=Et(t,p);if(p.heatmap?.enabled)t=Lc(t,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:X}=await o("stx/pwa/inject",()=>import("./chunk-wjafpvjv.js"));t=X(t,p)}let Dr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(t),Or=/\bSTX\.\w+/.test(t),Pr=/window\.STX\s*=/.test(t);if(Dr&&Or&&!Pr){let z=`<script data-stx-scoped data-stx-run="once">
1375
+ </head>`);return X},{renderHead:Se,getHead:$e}=await o("stx/head",()=>import("./chunk-p5qac909.js")),He=e.__stx_runtime_head??$e();if(He.title||He.meta?.length||He.link?.length){let X=Se(He);if(X)t=Q(t,X)}if(se.headContent)t=Q(t,se.headContent,!He.title);if(p.csp?.enabled&&p.csp.addMetaTag)t=It(t,p.csp,e);if(p.analytics?.enabled)t=Et(t,p);if(p.heatmap?.enabled)t=Lc(t,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:X}=await o("stx/pwa/inject",()=>import("./chunk-wjafpvjv.js"));t=X(t,p)}let Dr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(t),Or=/\bSTX\.\w+/.test(t),Pr=/window\.STX\s*=/.test(t);if(Dr&&Or&&!Pr){let z=`<script data-stx-scoped data-stx-run="once">
1376
1376
  ${St()}
1377
1377
  </script>`;if(t.includes("</head>")){let te=D(t),ce=t.slice(0,te).indexOf("<script");if(ce!==-1){let he=t.slice(0,ce),De=t.slice(ce);t=he+z+`
1378
1378
  `+De}else t=f(t,z)}else if(t.includes("<body"))t=t.replace(/<body([^>]*)>/,`<body$1>
1379
1379
  ${z}`);else t=z+`
1380
- `+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-my3yv4sg.js")),z=[];for(let te of X(t)){if(!/\bserver\b/i.test(te.attrs))continue;let we=te.start+te.fullMatch.indexOf(">")+1,ce=Mr(t,we);if(ce===-1)continue;let he=ce+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:te.start,end:he})}if(z.length>0){let te=Array(z.length+1),we=0;for(let ce=0;ce<z.length;ce++){let{start:he,end:De}=z[ce];te[ce]=t.slice(we,he),we=De}te[z.length]=t.slice(we),t=te.join("")}}let yt=to(t,l);if(yt.hasScoped)t=yt.html;let jr=e.__stx_event_bindings||[],rt=!1,wt=[],Nr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Br}=await o("stx/signal-processing",()=>import("./chunk-my3yv4sg.js"));for(let X of Br(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))wt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:te}of wt){rt=!0;let we=te;Ue(te,l,a.strict,e.__originalFilePath);let ce=await Ke(te,{eventBindings:jr,attrs:z,hasColonDirectives:Nr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:Yi(a.buildMode,a.minifyClient),serverData:oe});t=t.replace(X,()=>ce)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Ti(X);if(z){let te=c(t);t=te===-1?t+z:t.slice(0,te)+z+`
1380
+ `+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-678nhepd.js")),z=[];for(let te of X(t)){if(!/\bserver\b/i.test(te.attrs))continue;let we=te.start+te.fullMatch.indexOf(">")+1,ce=Mr(t,we);if(ce===-1)continue;let he=ce+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:te.start,end:he})}if(z.length>0){let te=Array(z.length+1),we=0;for(let ce=0;ce<z.length;ce++){let{start:he,end:De}=z[ce];te[ce]=t.slice(we,he),we=De}te[z.length]=t.slice(we),t=te.join("")}}let yt=to(t,l);if(yt.hasScoped)t=yt.html;let jr=e.__stx_event_bindings||[],rt=!1,wt=[],Nr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Br}=await o("stx/signal-processing",()=>import("./chunk-678nhepd.js"));for(let X of Br(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))wt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:te}of wt){rt=!0;let we=te;Ue(te,l,a.strict,e.__originalFilePath);let ce=await Ke(te,{eventBindings:jr,attrs:z,hasColonDirectives:Nr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:Yi(a.buildMode,a.minifyClient),serverData:oe});t=t.replace(X,()=>ce)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Ti(X);if(z){let te=c(t);t=te===-1?t+z:t.slice(0,te)+z+`
1381
1381
  `+t.slice(te)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!Te(t)&&Oc(t))t=await xr(t,p);if(t=Nc(t),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")t=Ot(t,e.cspNonce);return t}
1382
1382
  export{Rt,ze,Tc,vs,Zo,Qo,gr,i};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{N,n,u}from"./chunk-86nsbxep.js";import{ie}from"./chunk-njza56wn.js";import{mi}from"./chunk-h63ma36g.js";import E 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 T={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({...T,...s.i18n}.cache&&v[e]){let t=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(t,o))return t.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let r=C(e,s).then((t)=>(k[e]="loaded",delete L[e],t)).catch((t)=>{throw k[e]="error",L[e]={promise:r,state:"error",error:t instanceof Error?t:Error(String(t))},t});return L[e]={promise:r,state:"loading"},r}async function C(e,s){let i={...T,...s.i18n},r=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let t=await W(),o=t?await t(e,{translationsDir:r,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,r);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(t){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,t);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let r=E.join(i,`${e}${Z(s.format)}`);try{let t=await import(r);return t.default||t}catch(t){try{let o=await Bun.file(r).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw t}catch{return}}}function Z(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 Q(e){let s={},i=e.split(`
2
+ import{N,n,u}from"./chunk-295bykzd.js";import{ie}from"./chunk-3jndqseh.js";import{mi}from"./chunk-h63ma36g.js";import E 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 T={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({...T,...s.i18n}.cache&&v[e]){let t=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(t,o))return t.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let r=C(e,s).then((t)=>(k[e]="loaded",delete L[e],t)).catch((t)=>{throw k[e]="error",L[e]={promise:r,state:"error",error:t instanceof Error?t:Error(String(t))},t});return L[e]={promise:r,state:"loading"},r}async function C(e,s){let i={...T,...s.i18n},r=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let t=await W(),o=t?await t(e,{translationsDir:r,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,r);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(t){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,t);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let r=E.join(i,`${e}${Z(s.format)}`);try{let t=await import(r);return t.default||t}catch(t){try{let o=await Bun.file(r).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw t}catch{return}}}function Z(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 Q(e){let s={},i=e.split(`
3
3
  `),r=[{obj:s,indent:-1}];for(let t of i){let o=t.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(r.length>1&&r[r.length-1].indent>=l)r.pop();let c=r[r.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")c[f]={},r.push({obj:c[f],indent:l});else c[f]=X(m)}}return s}function X(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 ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let r=i.trim(),t=r.match(/^\{(\d+)\}\s*(.*)$/);if(t){let l=Number.parseInt(t[1],10);if(s===l)return t[2];continue}let o=r.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),c=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=c)return o[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 ne(e,s={}){return j(e,s)}function j(e,s){let i="",r=0;while(r<e.length)if(e[r]==="{"){let t=se(e,r);if(t===-1){i+=e[r],r++;continue}let o=e.slice(r+1,t);i+=ae(o,s),r=t+1}else if(e[r]==="'"&&r+1<e.length)if(e[r+1]==="'")i+="'",r+=2;else if(e[r+1]==="{"||e[r+1]==="}")i+=e[r+1],r+=2;else i+=e[r],r++;else i+=e[r],r++;return i}function se(e,s){let i=0;for(let r=s;r<e.length;r++)if(e[r]==="{")i++;else if(e[r]==="}"){if(i--,i===0)return r}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let r=i[0].trim(),t=s[r];if(i.length===1)return t!==void 0?String(t):`{${r}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(t,i.slice(2).join(","),s);case"select":return ue(t,i.slice(2).join(","));case"selectordinal":return de(t,i.slice(2).join(","));case"number":return pe(t,i[2]?.trim());case"date":return fe(t,i[2]?.trim());case"time":return me(t,i[2]?.trim());default:return t!==void 0?String(t):`{${e}}`}}function oe(e){let s=[],i="",r=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="{")r++,i+=o;else if(o==="}")r--,i+=o;else if(o===","&&r===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let r=Number(e)||0,t=P(s),o=`=${r}`;if(t[o])return R(t[o],r,i);let l=ce(r);if(t[l])return R(t[l],r,i);if(t.other)return R(t.other,r,i);return String(r)}function R(e,s,i){let r=e.replace(/#/g,String(s));return j(r,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),r=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&r===0)return"one";return"other"}function ue(e,s){let i=String(e||""),r=P(s);if(r[i])return r[i];return r.other||String(e)}function de(e,s){let i=Number(e)||0,r=P(s),t=ge(i);if(r[t])return r[t].replace(/#/g,String(i));if(r.other)return r.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,r=s%100;if(i===1&&r!==11)return"one";if(i===2&&r!==12)return"two";if(i===3&&r!==13)return"few";return"other"}function P(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,r=i.exec(e);while(r!==null)s[r[1]]=r[2],r=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 r={};switch(s){case"short":r.dateStyle="short";break;case"medium":r.dateStyle="medium";break;case"long":r.dateStyle="long";break;case"full":r.dateStyle="full";break;default:r.dateStyle="medium"}return i.toLocaleDateString(void 0,r)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let r={};switch(s){case"short":r.timeStyle="short";break;case"medium":r.timeStyle="medium";break;case"long":r.timeStyle="long";break;case"full":r.timeStyle="full";break;default:r.timeStyle="short"}return i.toLocaleTimeString(void 0,r)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,r={}){let t=e.split("."),o=s;for(let c of t){if(o===void 0||o===null)break;o=o[c]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ne(l,r);if(l.includes("|")&&"count"in r){let c=Number(r.count),a=l.split("|");l=re(a,c)}for(let[c,a]of Object.entries(r)){let g=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}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 r=s[1]?.length===4?s[1]:void 0;if(r)return he.has(r)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function Fc(e,s,i,r){let t=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...T,...r.i18n},c=await te(l.locale,r);s.__translations=c,s.__locale=l.locale,s.__i18nConfig=l,t=await F(t,o,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:{}},()=>N(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(r.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,c,l.fallbackToKey,b);return y?ie(t,h,y,!1,p.length):w.trim()}catch(b){if(r.debug)console.error("Error processing @translate directive:",b);return u("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,n.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(r.debug){console.warn(`Processing translations in template. Sections: ${t.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...t.matchAll(a)];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 t=await F(t,/@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:{}},()=>N(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(r.debug)console.error("Error parsing parameters for @translate directive:",b)}return ie(t,w,O(f,c,l.fallbackToKey,h),!1,p.length)}catch(h){if(r.debug)console.error("Error processing @translate directive:",h);return u("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,n.EVALUATION_ERROR)}}),t}async function F(e,s,i){let r=[];return e.replace(s,(o,...l)=>{let c=i(o,...l).then((a)=>({match:o,replacement:a}));return r.push(c),o}),(await Promise.all(r)).reduce((o,{match:l,replacement:c})=>o.replace(l,()=>c),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 I(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 zc(e,s,i,r){let t=e;t=t.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,c,a)=>{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"}[c]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return t=t.replace(o,(l,c)=>`<span class="sr-only">${c.trim()}</span>`),t=t.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,c,a)=>`<span id="${`desc-${c}`}" class="sr-only">${a}</span>`),t}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,(t,o,l)=>{let c=s.get(l);if(!c)c=`stx-a11y-component-${s.size}`,s.set(l,c);return`<${o}${c}`}),r=new Map([...s.entries()].map(([t,o])=>[o,t]));return{protectedSource:i,restore:(t)=>t.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,c)=>{let a=r.get(c);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],r=/<img\s+([^>]*)>/gi,t;t=r.exec(e);while(t!==null){let d=t[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:t[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/"});t=r.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;t=o.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:t[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/"});t=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;t=l.exec(e);while(t!==null){let d=t[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:t[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"});t=l.exec(e)}let c=/<(input|select|textarea)\s+([^>]*)>/gi;t=c.exec(e);while(t!==null){let d=t[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){t=c.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),U=t.index,M=e.substring(0,U),Se=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:t[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/"})}t=c.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];t=a.exec(e);while(t!==null)g.push(Number.parseInt(t[1],10)),t=a.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&&_(I(f[1],"lang"),I(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;t=m.exec(e);while(t!==null){let d=t[2];if(!V(I(t[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"});t=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;t=w.exec(e);while(t!==null){if(!/\bmuted\b/i.test(t[0]))i.push({type:"autoplay-audio",element:`<${t[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"});t=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;t=h.exec(e);while(t!==null)i.push({type:"positive-tabindex",element:`tabindex="${t[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"}),t=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;t=b.exec(e);while(t!==null){let d=t[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"});t=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;t=y.exec(e);while(t!==null){let d=t[1].toLowerCase(),x=t[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:t[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/"});t=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let r=[];try{let t=globalThis.document.createElement("div");t.innerHTML=i,t.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))r.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),t.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))r.push({type:"missing-accessible-name",element:`<${a.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/"})}),t.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&t.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)r.push({type:"input-missing-label",element:`<${a.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 o=Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)r.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let c=t.querySelector("html");if(i.includes("<html")&&c&&!c.hasAttribute("lang"))r.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(c&&_(c.getAttribute("lang"),c.getAttribute("dir")))r.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(t.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)r.push({type:"link-missing-text",element:`<${a.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(!t.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&t.querySelectorAll("a").length>5)r.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(t.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))r.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&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))r.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"})}),t.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))r.push({type:"potential-contrast-issue",element:`<${a.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/"})}),t.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))r.push({type:"autoplay-audio",element:`<${a.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"})}),t.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)r.push({type:"positive-tabindex",element:`<${a.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"})}),t.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))r.push({type:"button-not-focusable",element:`<${a.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")&&!t.querySelector('main, [role="main"]'))r.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"});t.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))r.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(t){console.error(`Error checking accessibility in ${s}:`,t)}return r}async function Hc(e,s={}){let i={},{recursive:r=!0,ignorePaths:t=[]}=s,o=Array.isArray(e)?e:[e],l=await mi(o,{recursive:r,ignorePaths:t}),c=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(c.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:c}}var Vc={name:"a11y",handler:(e,s,i,r)=>{if(!s.length)return e;let t=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",c={"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"}[t]||"Make this element accessible";return`<!-- a11y-hint: ${o||c} -->${e}`},hasEndTag:!1},Uc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{Fc,zc,Hc,Vc,Uc};