@stacksjs/stx 0.2.343 → 0.2.344

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 (169) hide show
  1. package/dist/binding-manifest.d.ts +32 -0
  2. package/dist/binding-manifest.js +64 -0
  3. package/dist/chunk-020hpw7m.js +2 -0
  4. package/dist/{chunk-zr1x54bt.js → chunk-05zfez2g.js} +1 -1
  5. package/dist/{chunk-jagf7h9y.js → chunk-0k1mtwby.js} +1 -1
  6. package/dist/chunk-1bct7pfj.js +2 -0
  7. package/dist/{chunk-jh6f1a9y.js → chunk-1c9453w0.js} +1 -1
  8. package/dist/chunk-1exk54qt.js +2 -0
  9. package/dist/{chunk-7zxv2631.js → chunk-1vt1h19d.js} +1 -1
  10. package/dist/{chunk-p3awq80d.js → chunk-1yh6pq6b.js} +1 -1
  11. package/dist/{chunk-wyhb3nb0.js → chunk-34f8c48f.js} +1 -1
  12. package/dist/chunk-39qy76ek.js +2 -0
  13. package/dist/{chunk-safmgrq5.js → chunk-3n8avn17.js} +1 -1
  14. package/dist/{chunk-hq3phk1a.js → chunk-3xpk99z4.js} +1 -1
  15. package/dist/{chunk-57dxdvjh.js → chunk-4kbaky4w.js} +1 -1
  16. package/dist/{chunk-wdaf98ya.js → chunk-59906baj.js} +1 -1
  17. package/dist/chunk-5apmxb4e.js +2 -0
  18. package/dist/{chunk-xgw269cf.js → chunk-5atmahe4.js} +286 -286
  19. package/dist/{chunk-yefnrr5z.js → chunk-5yhv1pe5.js} +1 -1
  20. package/dist/{chunk-z9hb80mk.js → chunk-64n10kpa.js} +1 -1
  21. package/dist/{chunk-1bfvdjpy.js → chunk-6h3r8v55.js} +1 -1
  22. package/dist/chunk-6z9pm31g.js +2 -0
  23. package/dist/{chunk-q6825wwz.js → chunk-72x5v5an.js} +1 -1
  24. package/dist/{chunk-53sjbp3z.js → chunk-72x62kch.js} +2 -2
  25. package/dist/chunk-7d2gfyk8.js +2 -0
  26. package/dist/{chunk-7mc1k1tq.js → chunk-7h9fajgs.js} +1 -1
  27. package/dist/{chunk-amfq5rnz.js → chunk-7kcfbc0j.js} +2 -2
  28. package/dist/{chunk-3d3x7dwy.js → chunk-7qp3zphs.js} +1 -1
  29. package/dist/{chunk-kbah2k8e.js → chunk-7t6h8crt.js} +2 -2
  30. package/dist/{chunk-grnmr3y1.js → chunk-86c461ca.js} +1 -1
  31. package/dist/chunk-86q2h34b.js +2 -0
  32. package/dist/{chunk-7r79j1hs.js → chunk-89mqnh67.js} +1 -1
  33. package/dist/{chunk-5hq25yky.js → chunk-8cc4vdkh.js} +1 -1
  34. package/dist/chunk-8tjg4wbr.js +2 -0
  35. package/dist/{chunk-45ydb29q.js → chunk-8v2k21n4.js} +1 -1
  36. package/dist/{chunk-aqxwwq6w.js → chunk-8y1ve8tc.js} +2 -2
  37. package/dist/chunk-94sxzp5x.js +2 -0
  38. package/dist/{chunk-ag8gdk51.js → chunk-99b5tfxc.js} +1 -1
  39. package/dist/{chunk-4vd0rqfs.js → chunk-9jbssgem.js} +197 -88
  40. package/dist/{chunk-s60eccqk.js → chunk-9nrgjtah.js} +1 -1
  41. package/dist/chunk-9p5gbhwp.js +2 -0
  42. package/dist/chunk-9yqt0nf2.js +2 -0
  43. package/dist/{chunk-stqm4brp.js → chunk-a1ghxrb1.js} +1 -1
  44. package/dist/chunk-a29x23g7.js +2 -0
  45. package/dist/{chunk-k8skvm0d.js → chunk-at622hg0.js} +1 -1
  46. package/dist/{chunk-1qtd4ex2.js → chunk-avwywzsj.js} +2 -2
  47. package/dist/{chunk-a0ajg9z5.js → chunk-b5hank5e.js} +1 -1
  48. package/dist/{chunk-4fafxr8d.js → chunk-bk1zb1xp.js} +1 -1
  49. package/dist/{chunk-rns7wjy9.js → chunk-bpb3xkg4.js} +1 -1
  50. package/dist/{chunk-hrdd26r4.js → chunk-bqdfbwdf.js} +1 -1
  51. package/dist/{chunk-c7qdnc5d.js → chunk-c30qnb6z.js} +1 -1
  52. package/dist/chunk-cappe4hd.js +2 -0
  53. package/dist/{chunk-7yfk9393.js → chunk-cdq28mek.js} +1 -1
  54. package/dist/chunk-cmccdayf.js +2 -0
  55. package/dist/chunk-csv48xrx.js +2 -0
  56. package/dist/{chunk-fbmjw0bh.js → chunk-d86q27j8.js} +1 -1
  57. package/dist/{chunk-dj5mqnp1.js → chunk-dgv43ccd.js} +1 -1
  58. package/dist/{chunk-em8cr7wy.js → chunk-dsztk2kp.js} +1 -1
  59. package/dist/{chunk-daxr6p6q.js → chunk-dx2s51rr.js} +1 -1
  60. package/dist/{chunk-mwvxhv0r.js → chunk-dxkjvajv.js} +1 -1
  61. package/dist/chunk-e4yskgtb.js +2 -0
  62. package/dist/{chunk-4pg6wbt6.js → chunk-e631svvs.js} +1 -1
  63. package/dist/{chunk-h6y99nak.js → chunk-e7np0h2q.js} +1 -1
  64. package/dist/chunk-efx05ah0.js +2 -0
  65. package/dist/{chunk-0s3ry262.js → chunk-ejqpq0wc.js} +1 -1
  66. package/dist/chunk-erb294sv.js +2 -0
  67. package/dist/{chunk-5azeswj2.js → chunk-evfr2zgg.js} +1 -1
  68. package/dist/chunk-ewpbxy5m.js +2 -0
  69. package/dist/chunk-fs2t4rs3.js +33 -0
  70. package/dist/{chunk-62vng8g8.js → chunk-g28fs4aa.js} +2 -2
  71. package/dist/chunk-gmm82dst.js +2 -0
  72. package/dist/{chunk-5zemhhwe.js → chunk-gsc2vds7.js} +1 -1
  73. package/dist/chunk-hke0k33t.js +2 -0
  74. package/dist/{chunk-e53pwshq.js → chunk-hsbbfp0c.js} +1 -1
  75. package/dist/chunk-j5qygdy9.js +2 -0
  76. package/dist/{chunk-zcytk5w9.js → chunk-jekrtm2j.js} +1 -1
  77. package/dist/chunk-jzfk5ect.js +2 -0
  78. package/dist/{chunk-brjfzbq9.js → chunk-kfkf9v2d.js} +1 -1
  79. package/dist/chunk-kq30wqp6.js +2 -0
  80. package/dist/{chunk-s7qbba8r.js → chunk-krfx5562.js} +10 -10
  81. package/dist/{chunk-0dpgh7a6.js → chunk-kw9cgyfc.js} +1 -1
  82. package/dist/{chunk-0fp16c1x.js → chunk-m2j5skez.js} +1 -1
  83. package/dist/{chunk-vj3nx26v.js → chunk-mph46gkj.js} +1 -1
  84. package/dist/{chunk-e6rxvz3p.js → chunk-mpyjnwje.js} +1 -1
  85. package/dist/{chunk-1h1c2048.js → chunk-msywnv5n.js} +1 -1
  86. package/dist/{chunk-8ah5mhst.js → chunk-mvat8js5.js} +2 -2
  87. package/dist/{chunk-pwhf5kte.js → chunk-mz4breg8.js} +1 -1
  88. package/dist/{chunk-649dfqqz.js → chunk-n5657hm3.js} +1 -1
  89. package/dist/{chunk-gvfgrve8.js → chunk-nexpxxsa.js} +1 -1
  90. package/dist/{chunk-t00ga194.js → chunk-njx93b4z.js} +1 -1
  91. package/dist/{chunk-m0xaw0qw.js → chunk-nm60wh6r.js} +1 -1
  92. package/dist/{chunk-ey1tsk22.js → chunk-ppzz953j.js} +1 -1
  93. package/dist/chunk-q5gzpn1n.js +2 -0
  94. package/dist/{chunk-tqw1yean.js → chunk-rwwfzkz4.js} +1 -1
  95. package/dist/{chunk-rzg9pars.js → chunk-san1eq0r.js} +2 -2
  96. package/dist/{chunk-eh3meyd3.js → chunk-tc4pj651.js} +2 -2
  97. package/dist/chunk-tscr6bs8.js +2 -0
  98. package/dist/{chunk-y5sxa2sq.js → chunk-tthrw91n.js} +1 -1
  99. package/dist/{chunk-6g8rvnhc.js → chunk-v6e35j4g.js} +1 -1
  100. package/dist/{chunk-wnmegbw0.js → chunk-v7aa7v85.js} +1 -1
  101. package/dist/{chunk-k3dtvay1.js → chunk-vhta1be7.js} +1 -1
  102. package/dist/{chunk-tz68qv47.js → chunk-w5j9tbsk.js} +1 -1
  103. package/dist/{chunk-hzbty7hz.js → chunk-wfwj4390.js} +1 -1
  104. package/dist/{chunk-ec18ftcg.js → chunk-wj21f1e0.js} +1 -1
  105. package/dist/{chunk-12qteqk8.js → chunk-ws0282jr.js} +1 -1
  106. package/dist/chunk-x054qzma.js +2 -0
  107. package/dist/{chunk-36j9qset.js → chunk-xh9paa2g.js} +2 -2
  108. package/dist/{chunk-q9ckfwhh.js → chunk-xj6bcwqa.js} +1 -1
  109. package/dist/{chunk-ay336sqb.js → chunk-xvh1k1a4.js} +1 -1
  110. package/dist/{chunk-vaggjvsm.js → chunk-y2f41kaq.js} +1 -1
  111. package/dist/{chunk-1zav2sf1.js → chunk-y6xzr30x.js} +1 -1
  112. package/dist/{chunk-kgbz86sa.js → chunk-yg5r7bnm.js} +2 -2
  113. package/dist/{chunk-2853ye06.js → chunk-zkwk82ss.js} +2 -2
  114. package/dist/chunk-zkxnarrh.js +2 -0
  115. package/dist/chunk-zp14ksx1.js +2 -0
  116. package/dist/{chunk-g0dbtyk7.js → chunk-zwhnkxgy.js} +1 -1
  117. package/dist/cli.js +14 -14
  118. package/dist/craft-entry.js +1 -1
  119. package/dist/craft.js +1 -1
  120. package/dist/database.js +1 -1
  121. package/dist/expressions.d.ts +1 -1
  122. package/dist/expressions.js +15 -3
  123. package/dist/includes.js +2 -2
  124. package/dist/pwa.js +2 -2
  125. package/dist/runtime-globals.d.ts +22 -0
  126. package/dist/runtime-globals.js +46 -0
  127. package/dist/signals.js +193 -84
  128. package/dist/slots.js +3 -3
  129. package/dist/ssg.js +2 -2
  130. package/dist/theme-tokens.d.ts +59 -0
  131. package/dist/theme-tokens.js +77 -17
  132. package/dist/ts-css-config.js +4 -2
  133. package/dist/utils.d.ts +10 -0
  134. package/dist/utils.js +77 -12
  135. package/dist/variable-extractor.d.ts +1 -1
  136. package/dist/variable-extractor.js +23 -3
  137. package/dist/visual-testing.js +1 -1
  138. package/package.json +5 -5
  139. package/dist/chunk-160g7ynw.js +0 -2
  140. package/dist/chunk-16hr5y08.js +0 -2
  141. package/dist/chunk-3h97y3n3.js +0 -2
  142. package/dist/chunk-3j915h2d.js +0 -2
  143. package/dist/chunk-4hkg6kx4.js +0 -2
  144. package/dist/chunk-57494khk.js +0 -2
  145. package/dist/chunk-5xavmr4t.js +0 -2
  146. package/dist/chunk-6rsfkms1.js +0 -2
  147. package/dist/chunk-6xs80tka.js +0 -32
  148. package/dist/chunk-905j49fe.js +0 -2
  149. package/dist/chunk-9czj483k.js +0 -2
  150. package/dist/chunk-9kv0qavn.js +0 -2
  151. package/dist/chunk-bcz8yp2g.js +0 -2
  152. package/dist/chunk-bxefsc7k.js +0 -2
  153. package/dist/chunk-c4kv3r8t.js +0 -2
  154. package/dist/chunk-fytemc96.js +0 -2
  155. package/dist/chunk-g7gc0ten.js +0 -2
  156. package/dist/chunk-gqsxxd81.js +0 -2
  157. package/dist/chunk-gx9z0wmm.js +0 -2
  158. package/dist/chunk-jnxzzzm4.js +0 -2
  159. package/dist/chunk-jy6jwxhs.js +0 -2
  160. package/dist/chunk-khqn40gv.js +0 -2
  161. package/dist/chunk-mhbzrh5y.js +0 -2
  162. package/dist/chunk-p8anntjb.js +0 -2
  163. package/dist/chunk-pwe51myj.js +0 -2
  164. package/dist/chunk-rqqdvnp5.js +0 -2
  165. package/dist/chunk-w1mbrq1g.js +0 -2
  166. package/dist/chunk-w84qe2m6.js +0 -2
  167. package/dist/chunk-wjm7hv5e.js +0 -2
  168. package/dist/chunk-yr7s02f7.js +0 -2
  169. package/dist/chunk-zq3tm2c2.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{_r as Q}from"./chunk-aqxwwq6w.js";import"./chunk-t00ga194.js";import{mt as R}from"./chunk-vaggjvsm.js";import"./chunk-1qtd4ex2.js";import"./chunk-0s3ry262.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(" STX Story Visual Regression Tests"),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),b.join(`
2
+ import{$r as Q}from"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import{nt as R}from"./chunk-y2f41kaq.js";import"./chunk-avwywzsj.js";import"./chunk-ejqpq0wc.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(" STX Story Visual Regression Tests"),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),b.push(""),b.join(`
3
3
  `)}async function S(j,b={}){let q=performance.now(),z=[],K=0,B=0;for(let G of j.storyFiles)try{let L=await Bun.file(G.path).text(),M=await Q(L,G.path);if(M.length>0){for(let N of M)z.push({storyId:G.id,variantId:"default",component:G.component,message:`A11y: ${N.message}`,expected:"No accessibility violations",actual:`${N.type}: ${N.message} (impact: ${N.impact})`});B++}else K++}catch(L){z.push({storyId:G.id,variantId:"default",component:G.component,message:`Failed to check a11y: ${L instanceof Error?L.message:String(L)}`,expected:"File readable for a11y check",actual:"File read error"}),B++}let J=performance.now()-q;return{total:j.storyFiles.length,passed:K,failed:B,new:0,failures:z,duration:J}}export{A as updateSnapshots,W as runVisualTests,S as runA11yTests,I as formatTestResults};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vi as a,wi as b,xi as c,yi as d,zi as e}from"./chunk-zk6ghjnj.js";import"./chunk-0s3ry262.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
2
+ import{vi as a,wi as b,xi as c,yi as d,zi as e}from"./chunk-zk6ghjnj.js";import"./chunk-ejqpq0wc.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ye as a}from"./chunk-wfwj4390.js";import"./chunk-xh9paa2g.js";import"./chunk-57atgbyq.js";import"./chunk-zkwk82ss.js";import"./chunk-5atmahe4.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-fs2t4rs3.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-7t6h8crt.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as startProductionServer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ih as x,nh as M,oh as C,ph as v,qh as P}from"./chunk-18018jkn.js";import{Hw as y}from"./chunk-0s3ry262.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as Qg,w as Rg,Q as Sg,d as Tg,g as Ug,n as Vg,D as Wg,t as Xg,KJ as Yg};
2
+ import{ih as x,nh as M,oh as C,ph as v,qh as P}from"./chunk-18018jkn.js";import{Nw as y}from"./chunk-ejqpq0wc.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as Qg,w as Rg,Q as Sg,d as Tg,g as Ug,n as Vg,D as Wg,t as Xg,KJ as Yg};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Cu as Y,Su as y,fv as A,hv as H,lv as q,nv as b}from"./chunk-1qtd4ex2.js";import M from"path";class S{source;pos=0;line=1;column=0;tokens=[];constructor(K){this.source=K}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let K=this.nextToken();if(K)this.tokens.push(K)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let K=this.pos,Q=this.line,Z=this.column,$=this.source[this.pos];if(/\s/.test($))return this.readWhitespace(K,Q,Z);if($==="/"&&this.peek(1)==="/")return this.readLineComment(K,Q,Z);if($==="/"&&this.peek(1)==="*")return this.readBlockComment(K,Q,Z);if($==='"'||$==="'")return this.readString($,K,Q,Z);if($==="`")return this.readTemplateString(K,Q,Z);if(/\d/.test($)||$==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(K,Q,Z);if(/[a-z_$]/i.test($))return this.readIdentifier(K,Q,Z);if($==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:K,end:this.pos,line:Q,column:Z}}if($==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:K,end:this.pos,line:Q,column:Z}}if($==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:K,end:this.pos,line:Q,column:Z};if($==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(K,Q,Z);let z=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let j of z)if(this.source.slice(this.pos,this.pos+j.length)===j)return this.advance(j.length),{type:"OPERATOR",value:j,start:K,end:this.pos,line:Q,column:Z};if(/[+\-*/%<>=!&|^~?:]/.test($))return this.advance(),{type:"OPERATOR",value:$,start:K,end:this.pos,line:Q,column:Z};if(/[()[\]{},;.]/.test($))return this.advance(),{type:"PUNCTUATION",value:$,start:K,end:this.pos,line:Q,column:Z};return this.advance(),{type:"PUNCTUATION",value:$,start:K,end:this.pos,line:Q,column:Z}}readWhitespace(K,Q,Z){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readLineComment(K,Q,Z){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
2
+ import{Du as Y,Tu as y,gv as A,iv as H,mv as q,ov as b}from"./chunk-avwywzsj.js";import M from"path";class S{source;pos=0;line=1;column=0;tokens=[];constructor(K){this.source=K}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let K=this.nextToken();if(K)this.tokens.push(K)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let K=this.pos,Q=this.line,Z=this.column,$=this.source[this.pos];if(/\s/.test($))return this.readWhitespace(K,Q,Z);if($==="/"&&this.peek(1)==="/")return this.readLineComment(K,Q,Z);if($==="/"&&this.peek(1)==="*")return this.readBlockComment(K,Q,Z);if($==='"'||$==="'")return this.readString($,K,Q,Z);if($==="`")return this.readTemplateString(K,Q,Z);if(/\d/.test($)||$==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(K,Q,Z);if(/[a-z_$]/i.test($))return this.readIdentifier(K,Q,Z);if($==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:K,end:this.pos,line:Q,column:Z}}if($==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:K,end:this.pos,line:Q,column:Z};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:K,end:this.pos,line:Q,column:Z}}if($==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:K,end:this.pos,line:Q,column:Z};if($==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(K,Q,Z);let z=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let j of z)if(this.source.slice(this.pos,this.pos+j.length)===j)return this.advance(j.length),{type:"OPERATOR",value:j,start:K,end:this.pos,line:Q,column:Z};if(/[+\-*/%<>=!&|^~?:]/.test($))return this.advance(),{type:"OPERATOR",value:$,start:K,end:this.pos,line:Q,column:Z};if(/[()[\]{},;.]/.test($))return this.advance(),{type:"PUNCTUATION",value:$,start:K,end:this.pos,line:Q,column:Z};return this.advance(),{type:"PUNCTUATION",value:$,start:K,end:this.pos,line:Q,column:Z}}readWhitespace(K,Q,Z){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readLineComment(K,Q,Z){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3
3
  `)this.advance();return{type:"COMMENT",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readBlockComment(K,Q,Z){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readString(K,Q,Z,$){this.advance();while(this.pos<this.source.length){let z=this.source[this.pos];if(z==="\\"){this.advance(2);continue}if(z===K){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readTemplateString(K,Q,Z){this.advance();let $=0,z=256;while(this.pos<this.source.length){let j=this.source[this.pos];if(j==="\\"){this.advance(2);continue}if(j==="$"&&this.peek(1)==="{"){if($>=z){this.pos=this.source.length;break}this.advance(2),$++;continue}if(j==="{"&&$>0){$++,this.advance();continue}if(j==="}"&&$>0){$--,this.advance();continue}if(j==="`"&&$===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readNumber(K,Q,Z){if(this.source[this.pos]==="0"){let $=this.peek(1)?.toLowerCase();if($==="x"||$==="o"||$==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readIdentifier(K,Q,Z){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}readDirective(K,Q,Z){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice(K,this.pos),start:K,end:this.pos,line:Q,column:Z}}advance(K=1){for(let Q=0;Q<K&&this.pos<this.source.length;Q++){if(this.source[this.pos]===`
4
4
  `)this.line++,this.column=0;else this.column++;this.pos++}}peek(K){return this.source[this.pos+K]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(K){this.pos=K.pos,this.line=K.line,this.column=K.column}}function D(K,Q,Z,$=0){let z=0,j=$,J=null,W=0,X=!1;while(j<K.length){let B=K[j];if(J&&X){X=!1,j++;continue}if(J&&B==="\\"){X=!0,j++;continue}if(X=!1,(B==='"'||B==="'"||B==="`")&&!J){J=B,j++;continue}if(B===J&&J!=="`"){J=null,j++;continue}if(J==="`"&&B==="$"&&K[j+1]==="{"){W++,j+=2;continue}if(W>0&&B==="}"){W--,j++;continue}if(B==="`"&&J==="`"&&W===0){J=null,j++;continue}if(J){j++;continue}if(B===Q)z++;else if(B===Z){if(z--,z===0)return j}j++}return-1}function g(K,Q){let Z=Q,$={paren:0,bracket:0,brace:0},z=null,j=0;while(Z<K.length){let J=K[Z];if((Z>0?K[Z-1]:"")==="\\"&&z){Z++;continue}if((J==='"'||J==="'")&&!z){z=J,Z++;continue}if(J===z&&z!=="`"){z=null,Z++;continue}if(J==="`"&&!z){z="`",Z++;continue}if(J==="`"&&z==="`"&&j===0){z=null,Z++;continue}if(z==="`"&&J==="$"&&K[Z+1]==="{"){j++,Z+=2;continue}if(j>0){if(J==="{")j++;else if(J==="}")j--;Z++;continue}if(z){Z++;continue}if($.paren===0&&$.bracket===0&&$.brace===0){if(K.slice(Z,Z+2)==="}}"||K.slice(Z,Z+3)==="!!}")break;if(J===","||J===";")break}if(J==="(")$.paren++;else if(J===")"){if($.paren--,$.paren<0)break}else if(J==="[")$.bracket++;else if(J==="]"){if($.bracket--,$.bracket<0)break}else if(J==="{")$.brace++;else if(J==="}"){if($.brace--,$.brace<0)break}Z++}return{expression:K.slice(Q,Z),endPos:Z}}function l(K){let Q=[],Z="",$={paren:0,bracket:0,brace:0},z=null,j=0;for(let J=0;J<K.length;J++){let W=K[J];if((J>0?K[J-1]:"")==="\\"&&z){Z+=W;continue}if((W==='"'||W==="'")&&!z){z=W,Z+=W;continue}if(W===z&&z!=="`"){z=null,Z+=W;continue}if(W==="`"&&!z){z="`",Z+=W;continue}if(W==="`"&&z==="`"&&j===0){z=null,Z+=W;continue}if(z==="`"&&W==="$"&&K[J+1]==="{"){j++,Z+=W+K[J+1],J++;continue}if(j>0&&W==="{"){j++,Z+=W;continue}if(j>0&&W==="}"){j--,Z+=W;continue}if(z){Z+=W;continue}if(W==="(")$.paren++;else if(W===")")$.paren--;else if(W==="[")$.bracket++;else if(W==="]")$.bracket--;else if(W==="{")$.brace++;else if(W==="}")$.brace--;if(W==="|"&&K[J+1]!=="|"&&(J===0||K[J-1]!=="|")&&K[J-1]!=="\\"&&$.paren===0&&$.bracket===0&&$.brace===0){Q.push(Z.trim()),Z="";continue}if(W==="|"&&K[J-1]==="\\"&&!z){Z=Z.slice(0,-1)+W;continue}Z+=W}if(Z.trim())Q.push(Z.trim());return Q}function C(K,Q){let Z=[];Q.lastIndex=0;let $;while(($=Q.exec(K))!==null){let z=$.index,j=z+$[0].length-1,J=D(K,"(",")",j);if(J===-1){Z.push({start:z,end:-1,args:"",call:K.slice(z,Math.min(K.length,z+80))}),Q.lastIndex=j+1;continue}Z.push({start:z,end:J+1,args:K.slice(j+1,J),call:K.slice(z,J+1)}),Q.lastIndex=J+1}return Z}function w(K,Q,Z,$){let z="",j=0;for(let J of C(K,Q)){if(z+=K.slice(j,J.start),J.end===-1){z+=$(J.call),j=J.start;continue}z+=Z(J.args,J.call),j=J.end}return z+K.slice(j)}function k(K){let Q=[],Z=0,$=null,z="";for(let j=0;j<K.length;j++){let J=K[j];if($){if(z+=J,J==="\\"&&j+1<K.length){z+=K[++j];continue}if(J===$)$=null;continue}if(J==="'"||J==='"'||J==="`")$=J;else if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0){Q.push(z.trim()),z="";continue}z+=J}if(z.trim())Q.push(z.trim());return Q}function V(K){let Q=K.trim(),Z=Q[0];if(Z!=="'"&&Z!=='"'&&Z!=="`"||Q.length<2||Q.at(-1)!==Z)return null;let $="";for(let z=1;z<Q.length-1;z++){let j=Q[z];if(j==="\\"&&z+1<Q.length-1){let J=Q[++z];$+=J==="n"?`
5
5
  `:J==="t"?"\t":J;continue}if(j===Z)return null;if(Z==="`"&&j==="$"&&Q[z+1]==="{")return null;$+=j}return $}var x=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function N(K,Q){let Z=K.trim();if(!Z)return{ok:!1,message:"the argument is empty",code:Y.INVALID_DIRECTIVE_SYNTAX};let $=A(Z);if($)return{ok:!1,message:`the expression is not allowed (${$})`,code:Y.UNSAFE_EXPRESSION};let z=H(Q),j;try{j=b(Z,Object.keys(z))(...Object.values(z))}catch(W){return{ok:!1,message:`the expression could not be evaluated: ${W instanceof Error?W.message:String(W)}`,code:Y.EVALUATION_ERROR}}if(j!==void 0&&j!==null)return{ok:!0,value:j};let J=[...new Set(q(Z))].filter((W)=>!x.has(W)&&!(W in z)&&!(W in globalThis));if(J.length>0)return{ok:!1,message:`${J.map((X)=>`"${X}"`).join(", ")} ${J.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:Y.UNDEFINED_VARIABLE};if(j===void 0&&(Z.startsWith("{")||Z.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:Y.EVALUATION_ERROR};return{ok:!0,value:j}}function _(K){if(K===null)return"null";if(Array.isArray(K))return"an array";if(typeof K==="object")return"an object";if(typeof K==="string")return`a string ("${K.length>40?`${K.slice(0,40)}...`:K}")`;return`${/^[aeiou]/.test(typeof K)?"an":"a"} ${typeof K}`}function T(K){return typeof K==="object"&&K!==null&&!Array.isArray(K)}function L(K){if(!K)return"";return M.isAbsolute(K)?M.relative(process.cwd(),K)||K:K}function G(K){let Q=K.replace(/\s+/g," ").trim();return Q.length>80?`${Q.slice(0,77)}...`:Q}function I(K,Q,Z,$,z=Y.EVALUATION_ERROR){let j=$?` in ${L($)}`:"";return console.warn(`[stx] ${G(Q)}${j}: ${Z}`),y(K,`${G(Q)}: ${Z}`,z)}function a(K,Q,Z){let $=Z?` in ${L(Z)}`:"";console.warn(`[stx] ${G(K)}${$}: ${Q}`)}var v=["og:","article:","book:","profile:","fb:","music:","video:"],d=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function E(K,Q){if(K.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:Y.INVALID_DIRECTIVE_SYNTAX};if(K.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${K.length} arguments`,code:Y.INVALID_DIRECTIVE_SYNTAX};let Z=m(K[0],Q);if(typeof Z!=="string")return Z;let $;if(K.length===2){let j=h(K[1],Q);if(typeof j!=="string")return j;$=j}else{let j=Z.includes(":")?Z.slice(Z.indexOf(":")+1):Z,J=Q.openGraph,W=Q[j]??(T(J)?J[j]:void 0);$=W===void 0||W===null||typeof W==="object"?"":String(W)}if(!$)return{kind:"empty"};return{kind:"tag",tag:v.some((j)=>Z.startsWith(j))?{property:Z,content:$}:{name:Z,content:$}}}function m(K,Q){let Z=V(K);if(Z!==null)return Z.trim()?Z:{kind:"error",message:"the meta name is empty",code:Y.INVALID_DIRECTIVE_SYNTAX};if(d.test(K.trim()))return K.trim();let $=N(K,Q);if(!$.ok)return{kind:"error",message:`meta name: ${$.message}`,code:$.code};if(typeof $.value!=="string"||!$.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${_($.value)}`,code:Y.TYPE_ERROR};return $.value}function h(K,Q){let Z=V(K);if(Z!==null)return Z;let $=N(K,Q);if(!$.ok)return{kind:"error",message:$.message,code:$.code};let z=$.value;if(z===void 0||z===null||z===!1)return"";if(Array.isArray(z))return z.filter((j)=>j!==void 0&&j!==null&&j!=="").map(String).join(", ");if(typeof z==="object"&&!(z instanceof Date))return{kind:"error",message:`the content must be text, got ${_(z)}`,code:Y.TYPE_ERROR};return String(z)}var O={},p=[],F={};function jK(){return O}function zK(){return F}function JK(){O={},p.length=0,F={}}function P(K){O=R(O,K)}function R(K,Q){return{title:Q.title??K.title,titleTemplate:Q.titleTemplate??K.titleTemplate,base:Q.base??K.base,meta:[...K.meta||[],...Q.meta||[]],link:[...K.link||[],...Q.link||[]],script:[...K.script||[],...Q.script||[]],style:[...K.style||[],...Q.style||[]],htmlAttrs:{...K.htmlAttrs,...Q.htmlAttrs},bodyAttrs:{...K.bodyAttrs,...Q.bodyAttrs}}}function u(K){P(f(K))}function f(K){let Q=[];if(K.description)Q.push({name:"description",content:K.description});if(K.keywords){let X=Array.isArray(K.keywords)?K.keywords.join(", "):K.keywords;Q.push({name:"keywords",content:X})}if(K.author)Q.push({name:"author",content:K.author});if(K.robots)Q.push({name:"robots",content:K.robots});let Z=K.ogTitle??K.title,$=K.ogDescription??K.description;if(Z)Q.push({property:"og:title",content:Z});if($)Q.push({property:"og:description",content:$});if(K.ogImage){if(Q.push({property:"og:image",content:K.ogImage}),K.ogImageType)Q.push({property:"og:image:type",content:K.ogImageType});if(K.ogImageWidth)Q.push({property:"og:image:width",content:String(K.ogImageWidth)});if(K.ogImageHeight)Q.push({property:"og:image:height",content:String(K.ogImageHeight)});if(K.ogImageAlt)Q.push({property:"og:image:alt",content:K.ogImageAlt})}if(K.ogUrl)Q.push({property:"og:url",content:K.ogUrl});if(K.ogType)Q.push({property:"og:type",content:K.ogType});if(K.ogSiteName)Q.push({property:"og:site_name",content:K.ogSiteName});if(K.ogLocale)Q.push({property:"og:locale",content:K.ogLocale});if(K.profileFirstName)Q.push({property:"profile:first_name",content:K.profileFirstName});if(K.profileLastName)Q.push({property:"profile:last_name",content:K.profileLastName});if(K.profileUsername)Q.push({property:"profile:username",content:K.profileUsername});let z=K.twitterTitle??K.title,j=K.twitterDescription??K.description,J=K.twitterImage??K.ogImage;if(K.twitterCard)Q.push({name:"twitter:card",content:K.twitterCard});if(z)Q.push({name:"twitter:title",content:z});if(j)Q.push({name:"twitter:description",content:j});if(J){Q.push({name:"twitter:image",content:J});let X=K.twitterImageAlt??(K.twitterImage?void 0:K.ogImageAlt);if(X)Q.push({name:"twitter:image:alt",content:X})}if(K.twitterSite)Q.push({name:"twitter:site",content:K.twitterSite});if(K.twitterCreator)Q.push({name:"twitter:creator",content:K.twitterCreator});if(K.articleAuthor)Q.push({property:"article:author",content:K.articleAuthor});if(K.articlePublishedTime)Q.push({property:"article:published_time",content:K.articlePublishedTime});if(K.articleModifiedTime)Q.push({property:"article:modified_time",content:K.articleModifiedTime});if(K.articleSection)Q.push({property:"article:section",content:K.articleSection});if(K.articleTags)for(let X of K.articleTags)Q.push({property:"article:tag",content:X});let W=[];if(K.canonical)W.push({rel:"canonical",href:K.canonical});return{title:K.title,titleTemplate:K.titleTemplate,meta:Q,link:W}}function WK(K){if(F={...F,...K},K.title||K.description)u({title:K.title,description:K.description})}function XK(K){let Q=typeof K==="function"?K():K;P({title:Q})}function YK(K=O){let Q=[];if(K.title){let Z=K.title;if(K.titleTemplate)Z=typeof K.titleTemplate==="function"?K.titleTemplate(Z):K.titleTemplate.replace("%s",Z);Q.push(`<title>${U(Z)}</title>`)}if(K.base){let Z=Object.entries(K.base).map(([$,z])=>`${$}="${U(z)}"`).join(" ");Q.push(`<base ${Z}>`)}for(let Z of K.meta||[]){let $=Object.entries(Z).filter(([z,j])=>j!==void 0).map(([z,j])=>{return`${z==="httpEquiv"?"http-equiv":z}="${U(String(j))}"`}).join(" ");Q.push(`<meta ${$}>`)}for(let Z of K.link||[]){let $=Object.entries(Z).filter(([z,j])=>j!==void 0).map(([z,j])=>`${z}="${U(String(j))}"`).join(" ");Q.push(`<link ${$}>`)}for(let Z of K.script||[]){let{content:$,...z}=Z,j=Object.entries(z).filter(([J,W])=>W!==void 0).map(([J,W])=>{if(typeof W==="boolean")return W?J:"";return`${J}="${U(String(W))}"`}).filter(Boolean).join(" ");if($)Q.push(`<script ${j}>${$}</script>`);else Q.push(`<script ${j}></script>`)}for(let Z of K.style||[]){let $=Z.type?` type="${Z.type}"`:"";Q.push(`<style${$}>${Z.content}</style>`)}return Q.join(`
6
6
  `)}function BK(K=O){if(!K.htmlAttrs)return"";return Object.entries(K.htmlAttrs).map(([Q,Z])=>`${Q}="${U(Z)}"`).join(" ")}function OK(K=O){if(!K.bodyAttrs)return"";return Object.entries(K.bodyAttrs).map(([Q,Z])=>`${Q}="${U(Z)}"`).join(" ")}function U(K){return K.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function UK(K=O){if(typeof document>"u")return;if(K.title){let Q=K.title;if(K.titleTemplate)Q=typeof K.titleTemplate==="function"?K.titleTemplate(Q):K.titleTemplate.replace("%s",Q);document.title=Q}for(let Q of K.meta||[]){let Z=Q.name?`meta[name="${Q.name}"]`:Q.property?`meta[property="${Q.property}"]`:null;if(Z){let $=document.querySelector(Z);if(!$){if($=document.createElement("meta"),Q.name)$.setAttribute("name",Q.name);if(Q.property)$.setAttribute("property",Q.property);document.head.appendChild($)}$.setAttribute("content",Q.content)}}for(let Q of K.link||[]){let Z=`link[rel="${Q.rel}"]${Q.href?`[href="${Q.href}"]`:""}`,$=document.querySelector(Z);if(!$)$=document.createElement("link"),document.head.appendChild($);for(let[z,j]of Object.entries(Q))if(j!==void 0)$.setAttribute(z,String(j))}if(K.htmlAttrs)for(let[Q,Z]of Object.entries(K.htmlAttrs))if(Q==="class")for(let $ of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add($);else document.documentElement.setAttribute(Q,Z);if(K.bodyAttrs)for(let[Q,Z]of Object.entries(K.bodyAttrs))document.body.setAttribute(Q,Z)}function FK(K){let Q="";return{content:K.replace(/@head\s*([\s\S]*?)@endhead/g,($,z)=>{return Q+=z.trim()+`
7
- `,""}),headContent:Q.trim()}}function GK(K,Q){return K.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,$,z,j)=>{let J=$?z:Q[(j||"").trim()]??j,W=Q.__stx_runtime_head??{};return Q.__stx_runtime_head=R(W,{title:J}),""})}function VK(K,Q,Z=""){if(!K.includes("@meta"))return K;return w(K,/(?<![\w$@])@meta\s*\(/g,($,z)=>{let j=E(k($),Q);if(j.kind==="error")return I("Meta",z,j.message,Z,j.code);if(j.kind==="tag"){let J=Q.__stx_runtime_head??{};Q.__stx_runtime_head=R(J,{meta:[j.tag]})}return""},($)=>I("Meta",$,"the call has no closing parenthesis",Z,Y.INVALID_DIRECTIVE_SYNTAX))}export{S as Vt,D as Wt,g as Xt,l as Yt,C as Zt,w as _t,k as $t,N as au,_ as bu,T as cu,I as du,a as eu,E as fu,jK as gu,zK as hu,JK as iu,P as ju,R as ku,u as lu,f as mu,WK as nu,XK as ou,YK as pu,BK as qu,OK as ru,UK as su,FK as tu,GK as uu,VK as vu};
7
+ `,""}),headContent:Q.trim()}}function GK(K,Q){return K.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,$,z,j)=>{let J=$?z:Q[(j||"").trim()]??j,W=Q.__stx_runtime_head??{};return Q.__stx_runtime_head=R(W,{title:J}),""})}function VK(K,Q,Z=""){if(!K.includes("@meta"))return K;return w(K,/(?<![\w$@])@meta\s*\(/g,($,z)=>{let j=E(k($),Q);if(j.kind==="error")return I("Meta",z,j.message,Z,j.code);if(j.kind==="tag"){let J=Q.__stx_runtime_head??{};Q.__stx_runtime_head=R(J,{meta:[j.tag]})}return""},($)=>I("Meta",$,"the call has no closing parenthesis",Z,Y.INVALID_DIRECTIVE_SYNTAX))}export{S as Wt,D as Xt,g as Yt,l as Zt,C as _t,w as $t,k as au,N as bu,_ as cu,T as du,I as eu,a as fu,E as gu,jK as hu,zK as iu,JK as ju,P as ku,R as lu,u as mu,f as nu,WK as ou,XK as pu,YK as qu,BK as ru,OK as su,UK as tu,FK as uu,GK as vu,VK as wu};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$t as H,_t as _,au as A,bu as X,cu as U,du as K,eu as S,fu as C,ku as T}from"./chunk-rzg9pars.js";import{Cu as I,Su as L}from"./chunk-1qtd4ex2.js";var h=/(?<![\w$@])@meta\s*\(/g,u=/(?<![\w$@])@metaTag\s*\(/g,f=/(?<![\w$@])@structuredData\s*\(/g,p=/(?<![\w$@])@seo\s*\(/g;function b(z,J){return(Q)=>K(z,Q,"the call has no closing parenthesis",J,I.INVALID_DIRECTIVE_SYNTAX)}function g(z){return"property"in z?`<meta property="${B(z.property)}" content="${B(z.content)}">`:`<meta name="${B(z.name)}" content="${B(z.content)}">`}function Qz(z,J,Q,N){if(!z.includes("@meta"))return z;let W=_(z,h,(Z,G)=>{let $=C(H(Z),J);if($.kind==="tag")return g($.tag);if($.kind==="empty")return"";return K("Meta",G,$.message,Q,$.code)},b("Meta",Q));return W=_(W,u,(Z,G)=>{let $=A(Z,J);if(!$.ok)return K("MetaTag",G,$.message,Q,$.code);if($.value===void 0||$.value===null)return"";if(!U($.value))return K("MetaTag",G,`expected an object such as { name, content }, got ${X($.value)}`,Q,I.TYPE_ERROR);let q=$.value;if(!q.name&&!q.property&&!q.httpEquiv)return K("MetaTag",G,"the tag needs a name, property or httpEquiv",Q,I.INVALID_DIRECTIVE_SYNTAX);if(q.content===void 0||q.content===null||q.content===""||q.content===!1)return"";let j="<meta";if(q.name)j+=` name="${B(q.name)}"`;if(q.property)j+=` property="${B(q.property)}"`;if(q.httpEquiv)j+=` http-equiv="${B(q.httpEquiv)}"`;return j+=` content="${B(q.content)}">`,j},b("MetaTag",Q)),W}function v(z){let J=(Q)=>Q["@context"]?{...Q}:{...Q,"@context":"https://schema.org"};if(U(z))return J(z);if(Array.isArray(z)&&z.length>0&&z.every(U))return z.map(J);return null}function E(z){return`<script type="application/ld+json">${JSON.stringify(z).replace(/<\//g,"<\\/")}</script>`}function Wz(z,J,Q){if(!z.includes("@structuredData"))return z;return _(z,f,(N,W)=>{let Z=A(N,J);if(!Z.ok)return K("StructuredData",W,Z.message,Q,Z.code);if(Z.value===void 0||Z.value===null)return"";let G=v(Z.value);if(!G)return K("StructuredData",W,`expected an object or an array of objects, got ${X(Z.value)}`,Q,I.TYPE_ERROR);try{return E(G)}catch($){let q=$ instanceof Error?$.message:String($);return K("StructuredData",W,`the data cannot be written as JSON: ${q}`,Q,I.EVALUATION_ERROR)}},b("StructuredData",Q))}var m=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),D={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Zz(z,J,Q,N){if(!z.includes("@seo"))return z;return _(z,p,(W,Z)=>{if(!W.trim())return K("SEO",Z,"expected an object: @seo({ title, description }) or @seo(seoVariable)",Q,I.INVALID_DIRECTIVE_SYNTAX);let G=A(W,J);if(!G.ok)return K("SEO",Z,G.message,Q,G.code);if(G.value===void 0||G.value===null)return"";if(!U(G.value))return K("SEO",Z,`expected an object such as { title, description }, got ${X(G.value)}`,Q,I.TYPE_ERROR);try{return c(G.value,Z,Q)}catch($){let q=$ instanceof Error?$.message:String($);return K("SEO",Z,`Error processing @seo directive: ${q}`,Q,I.EVALUATION_ERROR)}},b("SEO",Q))}function y(z,J,Q,N){let W=z[J];if(W===void 0||W===null||W===!1)return;if(U(W))return W;S(Q,`${J} must be an object, got ${X(W)}; its tags were left out`,N);return}function c(z,J,Q){let N=Object.keys(z).filter(($)=>!m.has($));if(N.length>0){let $=N.map((q)=>D[q]?`${q} (use ${D[q]})`:q).join(", ");S(J,`@seo does not read ${$}; ${N.length===1?"it was":"they were"} ignored`,Q)}let W="";if(z.title)W+=`<title>${B(z.title)}</title>
2
+ import{$t as _,au as H,bu as A,cu as X,du as U,eu as K,fu as S,gu as C,lu as T}from"./chunk-san1eq0r.js";import{Du as I,Tu as L}from"./chunk-avwywzsj.js";var h=/(?<![\w$@])@meta\s*\(/g,u=/(?<![\w$@])@metaTag\s*\(/g,f=/(?<![\w$@])@structuredData\s*\(/g,p=/(?<![\w$@])@seo\s*\(/g;function b(z,J){return(Q)=>K(z,Q,"the call has no closing parenthesis",J,I.INVALID_DIRECTIVE_SYNTAX)}function g(z){return"property"in z?`<meta property="${B(z.property)}" content="${B(z.content)}">`:`<meta name="${B(z.name)}" content="${B(z.content)}">`}function Qz(z,J,Q,N){if(!z.includes("@meta"))return z;let W=_(z,h,(Z,G)=>{let $=C(H(Z),J);if($.kind==="tag")return g($.tag);if($.kind==="empty")return"";return K("Meta",G,$.message,Q,$.code)},b("Meta",Q));return W=_(W,u,(Z,G)=>{let $=A(Z,J);if(!$.ok)return K("MetaTag",G,$.message,Q,$.code);if($.value===void 0||$.value===null)return"";if(!U($.value))return K("MetaTag",G,`expected an object such as { name, content }, got ${X($.value)}`,Q,I.TYPE_ERROR);let q=$.value;if(!q.name&&!q.property&&!q.httpEquiv)return K("MetaTag",G,"the tag needs a name, property or httpEquiv",Q,I.INVALID_DIRECTIVE_SYNTAX);if(q.content===void 0||q.content===null||q.content===""||q.content===!1)return"";let j="<meta";if(q.name)j+=` name="${B(q.name)}"`;if(q.property)j+=` property="${B(q.property)}"`;if(q.httpEquiv)j+=` http-equiv="${B(q.httpEquiv)}"`;return j+=` content="${B(q.content)}">`,j},b("MetaTag",Q)),W}function v(z){let J=(Q)=>Q["@context"]?{...Q}:{...Q,"@context":"https://schema.org"};if(U(z))return J(z);if(Array.isArray(z)&&z.length>0&&z.every(U))return z.map(J);return null}function E(z){return`<script type="application/ld+json">${JSON.stringify(z).replace(/<\//g,"<\\/")}</script>`}function Wz(z,J,Q){if(!z.includes("@structuredData"))return z;return _(z,f,(N,W)=>{let Z=A(N,J);if(!Z.ok)return K("StructuredData",W,Z.message,Q,Z.code);if(Z.value===void 0||Z.value===null)return"";let G=v(Z.value);if(!G)return K("StructuredData",W,`expected an object or an array of objects, got ${X(Z.value)}`,Q,I.TYPE_ERROR);try{return E(G)}catch($){let q=$ instanceof Error?$.message:String($);return K("StructuredData",W,`the data cannot be written as JSON: ${q}`,Q,I.EVALUATION_ERROR)}},b("StructuredData",Q))}var m=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),D={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Zz(z,J,Q,N){if(!z.includes("@seo"))return z;return _(z,p,(W,Z)=>{if(!W.trim())return K("SEO",Z,"expected an object: @seo({ title, description }) or @seo(seoVariable)",Q,I.INVALID_DIRECTIVE_SYNTAX);let G=A(W,J);if(!G.ok)return K("SEO",Z,G.message,Q,G.code);if(G.value===void 0||G.value===null)return"";if(!U(G.value))return K("SEO",Z,`expected an object such as { title, description }, got ${X(G.value)}`,Q,I.TYPE_ERROR);try{return c(G.value,Z,Q)}catch($){let q=$ instanceof Error?$.message:String($);return K("SEO",Z,`Error processing @seo directive: ${q}`,Q,I.EVALUATION_ERROR)}},b("SEO",Q))}function y(z,J,Q,N){let W=z[J];if(W===void 0||W===null||W===!1)return;if(U(W))return W;S(Q,`${J} must be an object, got ${X(W)}; its tags were left out`,N);return}function c(z,J,Q){let N=Object.keys(z).filter(($)=>!m.has($));if(N.length>0){let $=N.map((q)=>D[q]?`${q} (use ${D[q]})`:q).join(", ");S(J,`@seo does not read ${$}; ${N.length===1?"it was":"they were"} ignored`,Q)}let W="";if(z.title)W+=`<title>${B(z.title)}</title>
3
3
  `,W+=`<meta name="title" content="${B(z.title)}">
4
4
  `;if(z.description)W+=`<meta name="description" content="${B(z.description)}">
5
5
  `;if(z.keywords){let $=Array.isArray(z.keywords)?z.keywords.join(", "):z.keywords;W+=`<meta name="keywords" content="${B($)}">
@@ -61,4 +61,4 @@ ${z.map((Z)=>{let G=Z.startsWith("http")?Z:`${Q}${Z.startsWith("/")?"":"/"}${Z}`
61
61
  `)}
62
62
  </sitemapindex>`}async function Nz(z,J){let{extensions:Q=[".stx",".html",".htm"],ignore:N=["_*",".*","node_modules","components","partials","layouts"]}=J,W=[],Z=Q.length===1?`*${Q[0]}`:`*{${Q.join(",")}}`,G=new Bun.Glob(`**/${Z}`);for await(let $ of G.scan(z)){if(N.some((V)=>{if(V.startsWith("*"))return $.includes(V.slice(1));return $.startsWith(V)||$.includes(`/${V}`)}))continue;let j=$.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!j.startsWith("/"))j=`/${j}`;if(j!=="/"&&j.endsWith("/"))j=j.slice(0,-1);let Y=`${z}/${$}`,O;try{let V=await Bun.file(Y).stat();if(V)O=new Date(V.mtime).toISOString().split("T")[0]}catch{}W.push({loc:j||"/",lastmod:O,priority:j==="/"?1:0.5})}return W.sort(($,q)=>$.loc.localeCompare(q.loc)),W}function a(z){let J=[];for(let Q of z.rules){if(J.push(`User-agent: ${Q.userAgent}`),Q.allow)for(let N of Q.allow)J.push(`Allow: ${N}`);if(Q.disallow)for(let N of Q.disallow)J.push(`Disallow: ${N}`);if(Q.crawlDelay!==void 0)J.push(`Crawl-delay: ${Q.crawlDelay}`);J.push("")}if(z.sitemap){let Q=Array.isArray(z.sitemap)?z.sitemap:[z.sitemap];for(let N of Q)J.push(`Sitemap: ${N}`)}if(z.host)J.push(`Host: ${z.host}`);return J.join(`
63
63
  `).trim()}function jz(z){return a({rules:[{userAgent:"*",allow:["/"]}],sitemap:z})}function d(z){return z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
64
- export{Qz as Jt,Wz as Kt,Zz as Lt,$z as Mt,i as Nt,l as Ot,Gz as Pt,qz as Qt,Bz as Rt,Nz as St,a as Tt,jz as Ut};
64
+ export{Qz as Kt,Wz as Lt,Zz as Mt,$z as Nt,i as Ot,l as Pt,Gz as Qt,qz as Rt,Bz as St,Nz as Tt,a as Ut,jz as Vt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$k as c,Zk as a,_k as b,al as d,bl as e,cl as f,dl as g,el as h,fl as i,gl as j,hl as k,il as l,jl as m,kl as n,ll as o}from"./chunk-4kbaky4w.js";import"./chunk-zkwk82ss.js";import"./chunk-fvsefztj.js";import"./chunk-5atmahe4.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-fs2t4rs3.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-7t6h8crt.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{o as tempBuildName,b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ml as a,nl as b,ol as c,pl as d,ql as e,rl as f,sl as g}from"./chunk-2853ye06.js";import"./chunk-7r79j1hs.js";import"./chunk-vaggjvsm.js";import"./chunk-k3dtvay1.js";import"./chunk-kgbz86sa.js";import"./chunk-0s3ry262.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
2
+ import{ml as a,nl as b,ol as c,pl as d,ql as e,rl as f,sl as g}from"./chunk-zkwk82ss.js";import"./chunk-89mqnh67.js";import"./chunk-y2f41kaq.js";import"./chunk-vhta1be7.js";import"./chunk-yg5r7bnm.js";import"./chunk-ejqpq0wc.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Mh as a,Nh as b,Oh as c,Ph as d,Qh as e,Rh as f,Sh as g,Th as h,Uh as i,Vh as j,Wh as k}from"./chunk-a959m68j.js";import"./chunk-0s3ry262.js";export{i as processStaticDirectives,b as processPartialHydrationDirectives,h as onHydrated,g as isHydrated,d as hydrateIsland,e as hydrateByStrategy,f as hydrateAll,c as generatePartialHydrationCSS,j as generateIslandManifest,k as default,a as createIslandRegistry};
2
+ import{Mh as a,Nh as b,Oh as c,Ph as d,Qh as e,Rh as f,Sh as g,Th as h,Uh as i,Vh as j,Wh as k}from"./chunk-a959m68j.js";import"./chunk-ejqpq0wc.js";export{i as processStaticDirectives,b as processPartialHydrationDirectives,h as onHydrated,g as isHydrated,d as hydrateIsland,e as hydrateByStrategy,f as hydrateAll,c as generatePartialHydrationCSS,j as generateIslandManifest,k as default,a as createIslandRegistry};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{xw as y}from"./chunk-kgbz86sa.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-css="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
2
+ import{Dw as y}from"./chunk-yg5r7bnm.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-css="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
3
3
  `);return C.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...M.map((v)=>` '${v}': true`)," }","}","","export {}",""),C.join(`
4
4
  `)}function HM(M,C){if(!M)return[];let v=F.isAbsolute(M)?M:F.resolve(process.cwd(),M),q=f(v),g=c(q),j=F.join(C,h);try{if(Z.existsSync(j)&&Z.readFileSync(j,"utf8")===g)return q;Z.mkdirSync(C,{recursive:!0}),Z.writeFileSync(j,g)}catch{}return q}
5
5
  export{Y as uk,_ as vk,a as wk,s as xk,h as yk,f as zk,c as Ak,HM as Bk};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{AsyncLocalStorage as U}from"async_hooks";var V=Symbol.for("stx.runtime-config.scope"),W=globalThis,Q=W[V]??=new U;function b(x,H){return Q.run(x,H)}function A(){return Q.getStore()}function X(){let x=Q.getStore();if(!x)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:x.public},"private",{value:x.private}))}function N(){return X().public}function O(x={},H=process.env){let I=new Set;function E(j,z){if(z===null)return j===null;if(Array.isArray(z))return Array.isArray(j)&&(!z.length||j.every((B)=>z.some((F)=>E(B,F))));if(typeof z==="object")return j!==null&&typeof j==="object"&&!Array.isArray(j)&&Object.entries(z).every(([B,F])=>Object.hasOwn(j,B)&&E(j[B],F));return typeof j===typeof z}function J(j,z){if(j&&typeof j==="object"&&!Array.isArray(j)){if(Object.getPrototypeOf(j)!==Object.prototype&&Object.getPrototypeOf(j)!==null)throw TypeError(`Runtime config ${z.join(".")} must contain JSON values`);let q=Object.create(null);for(let[G,P]of Object.entries(j)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(G)||["constructor","prototype","__proto__"].includes(G))throw TypeError(`Invalid runtime config key: ${G}`);q[G]=J(P,[...z,G])}return Object.freeze(q)}let B=`STX_RUNTIME_${z.map((q)=>q.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(I.has(B))throw TypeError(`Ambiguous runtime config environment key: ${B}`);I.add(B);let F=H[B],K=j;if(F!==void 0){try{K=typeof j==="string"?F:JSON.parse(F)}catch{throw TypeError(`Invalid runtime config override: ${B}`)}if(!E(K,j))throw TypeError(`Wrong runtime config override type: ${B}`)}function M(q){if(q===null||typeof q==="string"||typeof q==="boolean")return q;if(typeof q==="number"&&Number.isFinite(q))return q;if(Array.isArray(q))return Object.freeze(q.map(M));if(q&&typeof q==="object"&&(Object.getPrototypeOf(q)===Object.prototype||Object.getPrototypeOf(q)===null))return Object.freeze(Object.fromEntries(Object.entries(q).map(([G,P])=>[G,M(P)])));throw TypeError(`Runtime config ${z.join(".")} must contain JSON values`)}return M(K)}return Object.freeze({public:J(x.public??{},["public"]),private:J(x.private??{},["private"])})}function Z(x){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(x.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function T(x,H){let I=x.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),E=/<head\b[^>]*>/i.exec(I),J=E?E.index+E[0].length:0;return I.slice(0,J)+Z(H)+I.slice(J)}
3
- export{b as Ct,A as Dt,X as Et,N as Ft,O as Gt,Z as Ht,T as It};
3
+ export{b as Dt,A as Et,X as Ft,N as Gt,O as Ht,Z as It,T as Jt};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ki as a,li as b,mi as c,ni as d,oi as e,pi as f}from"./chunk-qsbjtp60.js";import"./chunk-0s3ry262.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
2
+ import{ki as a,li as b,mi as c,ni as d,oi as e,pi as f}from"./chunk-qsbjtp60.js";import"./chunk-ejqpq0wc.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ag as ZJ,cg as g,eg as A,kg as n,ng as GJ,qg as WJ,sg as YJ,ug as jJ}from"./chunk-36j9qset.js";import{xg as $J}from"./chunk-57atgbyq.js";import{ql as XJ}from"./chunk-2853ye06.js";import{ko as h}from"./chunk-xgw269cf.js";import{Bs as e}from"./chunk-6xs80tka.js";import{Ct as QJ,Gt as i,It as p}from"./chunk-k3dtvay1.js";import{Rv as KJ,sw as l,xw as VJ}from"./chunk-kgbz86sa.js";import{Hw as DJ}from"./chunk-0s3ry262.js";import JJ from"fs";import k from"path";var{serve:wJ}=globalThis.Bun;VJ();import y from"zlib";import{promisify as a}from"util";var IJ=a(y.brotliCompress),OJ=a(y.gzip),UJ=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],BJ=["text/event-stream","multipart/x-mixed-replace"],_J=1024;function zJ(K){if(!K)return!1;let J=K.toLowerCase();if(BJ.some((G)=>J.startsWith(G)))return!1;return UJ.some((G)=>J.startsWith(G))}function FJ(K){let J=new Map;for(let G of K.split(",")){let[Z,...W]=G.trim().split(";"),O=Z.trim().toLowerCase();if(!O)continue;let U=1;for(let B of W){let w=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(B);if(!w)continue;let F=Number.parseFloat(w[1]);if(Number.isFinite(F))U=F}J.set(O,U)}return J}function LJ(K){if(!K)return null;let J=FJ(K),G=J.get("*"),Z=(W)=>J.get(W)??G??0;if(Z("br")>0)return"br";if(Z("gzip")>0)return"gzip";return null}async function t(K,J,G={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!zJ(J.headers.get("content-type")))return J;let Z=LJ(K.headers.get("accept-encoding"));if(!Z)return J;let W;try{W=new Uint8Array(await J.arrayBuffer())}catch{return J}let O=()=>new Response(W,{status:J.status,statusText:J.statusText,headers:s(J.headers)});if(W.length<(G.threshold??_J))return O();try{let U=Z==="br"?await IJ(W,{params:{[y.constants.BROTLI_PARAM_QUALITY]:G.quality??5,[y.constants.BROTLI_PARAM_SIZE_HINT]:W.length}}):await OJ(W);if(U.length>=W.length)return O();let B=s(J.headers);return B.set("Content-Encoding",Z),B.set("Content-Length",String(U.length)),new Response(U,{status:J.status,statusText:J.statusText,headers:B})}catch{return O()}}function s(K){let J=new Headers(K),G=J.get("Vary");if(!G)return J.set("Vary","Accept-Encoding"),J;if(!G.split(",").some((W)=>W.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${G}, Accept-Encoding`);return J}class d{now;entries=new e(1000,{maxBytes:33554432,sizeOf:(K)=>K.body.byteLength+JSON.stringify(K.headers).length*2});pending=new Map;generation=0;constructor(K=Date.now){this.now=K}invalidate(K){this.generation++,this.pending.clear();for(let J of Array.from(this.entries.keys()))if(K===void 0||this.entries.get(J)?.path===K)this.entries.delete(J)}async respond(K,J,G){let Z,W=async()=>{let X=Z??await G();return X.headers.set("Cache-Control","private, no-store"),X.headers.set("Vary",A(X.headers.get("Vary")).Vary),X};if(!J||K.method!=="GET"||K.headers.has("Cookie")||K.headers.has("Authorization")||K.headers.has("Range"))return W();let O=new URL(K.url),U=`${O.origin}${O.pathname}${O.search}|${g(K)?"fragment":"document"}`,B=this.entries.get(U),w=(X)=>{let T=new Headers(X.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-X.created)/1000)))),new Response(X.body.slice(0),{headers:T})},F=B?(this.now()-B.created)/1000:1/0;if(B&&F<J.maxAge)return w(B);let S=this.generation,q=async()=>{let X=await G();Z=X;let T=(X.headers.get("Vary")??"").toLowerCase().split(",").map((L)=>L.trim()).filter(Boolean);if(X.status!==200||X.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(X.headers.get("Cache-Control")??"")||T.some((L)=>L!=="x-stx-router"&&L!=="accept-encoding"))return null;let M=await X.clone().arrayBuffer();if(M.byteLength>1048576)return null;X.headers.set("Vary",A(X.headers.get("Vary")).Vary);let Q={body:M,headers:Array.from(X.headers.entries()),created:this.now(),path:O.pathname};if(this.generation===S)this.entries.set(U,Q);return Q},H=this.pending.get(U);if(!H){if(this.pending.size>=1000)return W();H=q().finally(()=>{if(this.pending.get(U)===H)this.pending.delete(U)}),this.pending.set(U,H)}if(B&&F<J.maxAge+(J.swr??0))return H.catch(()=>{}),w(B);let x=await H;return x?w(x):W()}}var HJ={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function uJ(K={}){let J=k.resolve(K.outputDir||".output"),G=K.port??3000,Z=GJ(J);if(!Z)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Z.routes.length} routes...`);let W=$J(Z.routeRules),O=new d,U=XJ(J,Z.apiRoutes??[]),B=Bun.file(k.join(J,"server/runtime-config.json")),w=K.runtimeConfig??(await B.exists()?await B.json():void 0),F=w?i(w):void 0,S=new Map,q=new Map,H=new Map,x=new Map;for(let Q of Z.routes)try{let L=k.join(J,Q.compiledPath),Y=JSON.parse(await Bun.file(L).text());if(F)Y.html=p(Y.html,F);S.set(Q.pattern,Y),H.set(Q.pattern,l(Y.html)),x.set(Q.pattern,h(Y.html));let C=k.join(J,Q.fragmentPath);if(await Bun.file(C).exists()){let P=await Bun.file(C).text();q.set(Q.pattern,F?p(P,F):P)}}catch(L){console.warn(`[stx] Failed to load route ${Q.pattern}:`,L)}let X=new Map,T=[];for(let Q of Z.routes)if(Q.hasParams){let{regex:L,params:Y}=KJ(Q.pattern);T.push({regex:L,route:Q,paramNames:Y})}else X.set(Q.pattern,Q);let M=wJ({port:G,async fetch(Q){return t(Q,await QJ(F??i(),async()=>{let Y=new URL(Q.url).pathname;if(K.onRequest){let j=await K.onRequest(Q);if(j)return j}if(K.apiRouter){let j=await K.apiRouter.handleRequest(Q);if(j.status!==404)return j}if(K.apiRoutes?.[Y])return K.apiRoutes[Y](Q);let C=await U(Q);if(C)return C;if((Q.method==="GET"||Q.method==="HEAD")&&Y!=="/"){let j=k.resolve(J,"public"),_;try{_=decodeURIComponent(Y)}catch{_=Y}if(!_.includes("\x00")){let I=k.resolve(j,`.${_}`);if(I===j||I.startsWith(`${j}${k.sep}`))try{if(JJ.existsSync(I)&&JJ.statSync(I).isFile()){let z=k.extname(I).toLowerCase(),E=HJ[z]||"application/octet-stream",v=Y.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(Y);return new Response(Bun.file(I),{headers:{"Content-Type":E,"Cache-Control":v?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=g(Q),D=null,o={};if(D=X.get(Y)||null,!D)for(let{regex:j,route:_,paramNames:I}of T){let $=Y.match(j);if($){D=_,I.forEach((z,E)=>{o[z]=$[E+1]});break}}if(!D){let j=X.get("/404")||null;if(j){let _=S.get(j.pattern);if(_)return new Response(_.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}let R=W(Y),r=Object.keys(R).length>0;return O.respond(Q,R.cache,async()=>{let j=S.get(D.pattern);if(P&&Q.method==="GET"&&j&&!j.hasServerScripts&&Object.keys(j.placeholders).length===0){let $=q.get(D.pattern);if($){let z=H.get(D.pattern);return new Response($,{status:j.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...x.has(D.pattern)?{"X-STX-Runtime":x.get(D.pattern)?"true":"false"}:{},...z?{"X-STX-Layout":z.layout,"X-STX-Layout-Group":z.group}:{},...A(),...R.cache?{}:{"Cache-Control":ZJ}}})}}let _=WJ(Q.method),I=S.get(D.pattern);if(!I){let $=X.get("/500")||null;if($){let z=S.get($.pattern);if(z)return new Response(z.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(D.prerendered&&_)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!_&&!I.hasServerScripts&&Object.keys(I.placeholders).length===0)return new Response(I.html,{status:I.status??200,headers:{"Content-Type":"text/html",...A(),"Cache-Control":"public, max-age=60"}});try{let{html:$,boundaries:z,redirect:E,cookies:v,status:m,headers:c}=await jJ(I,{params:o,request:Q,method:Q.method,__stx_strict_hydration:r,__stx_runtime_config:F});if(E)return YJ(E,v,c);if(z&&z.length>0){let{renderStreamingPage:N,streamToResponse:u}=await import("./chunk-jy6jwxhs.js"),b=new Headers({...A(),...c,"Cache-Control":"private, no-store"});for(let f of v??[])b.append("Set-Cookie",f);if(P&&!_){let f=l($);b.set("X-STX-Fragment","true"),b.set("X-STX-Runtime",h($)?"true":"false"),b.set("X-STX-Layout",f.layout),b.set("X-STX-Layout-Group",f.group)}return u(N(P&&!_?n($,Z.routerContainer||"main"):$,z,{timeoutMs:30000}),{status:m??I.status??200,headers:b})}let V=new Headers({"Content-Type":"text/html",...A(),...R.cache?{}:{"Cache-Control":"private, no-store"}});for(let N of v??[])V.append("Set-Cookie",N);for(let[N,u]of Object.entries(c??{}))V.set(N,u);if(V.set("Vary",A(V.get("Vary")).Vary),P&&!_){let N=l($);return V.set("X-STX-Fragment","true"),V.set("X-STX-Runtime",h($)?"true":"false"),V.set("X-STX-Layout",N.layout),V.set("X-STX-Layout-Group",N.group),new Response(n($,Z.routerContainer||"main"),{status:m??I.status??200,headers:V})}return new Response($,{status:m??I.status??200,headers:V})}catch($){if(console.error(`[stx] Hydration error for ${Y}:`,$),r)return new Response("Internal Server Error",{status:500});return new Response(I.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${M.port}`),console.log(`[stx] Serving ${Z.routes.length} routes (${S.size} pre-loaded)`),{port:M.port,stop:()=>{O.invalidate(),M.stop()},invalidate:(Q)=>O.invalidate(Q)}}
2
+ import{ag as ZJ,cg as g,eg as A,kg as n,ng as GJ,qg as WJ,sg as YJ,ug as jJ}from"./chunk-xh9paa2g.js";import{xg as $J}from"./chunk-57atgbyq.js";import{ql as XJ}from"./chunk-zkwk82ss.js";import{ko as h}from"./chunk-5atmahe4.js";import{Cs as e}from"./chunk-fs2t4rs3.js";import{Dt as QJ,Ht as i,Jt as p}from"./chunk-vhta1be7.js";import{Dw as VJ,Xv as KJ,yw as l}from"./chunk-yg5r7bnm.js";import{Nw as DJ}from"./chunk-ejqpq0wc.js";import JJ from"fs";import k from"path";var{serve:wJ}=globalThis.Bun;VJ();import y from"zlib";import{promisify as a}from"util";var IJ=a(y.brotliCompress),OJ=a(y.gzip),UJ=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],BJ=["text/event-stream","multipart/x-mixed-replace"],_J=1024;function zJ(K){if(!K)return!1;let J=K.toLowerCase();if(BJ.some((G)=>J.startsWith(G)))return!1;return UJ.some((G)=>J.startsWith(G))}function FJ(K){let J=new Map;for(let G of K.split(",")){let[Z,...W]=G.trim().split(";"),O=Z.trim().toLowerCase();if(!O)continue;let U=1;for(let B of W){let w=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(B);if(!w)continue;let F=Number.parseFloat(w[1]);if(Number.isFinite(F))U=F}J.set(O,U)}return J}function LJ(K){if(!K)return null;let J=FJ(K),G=J.get("*"),Z=(W)=>J.get(W)??G??0;if(Z("br")>0)return"br";if(Z("gzip")>0)return"gzip";return null}async function t(K,J,G={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!zJ(J.headers.get("content-type")))return J;let Z=LJ(K.headers.get("accept-encoding"));if(!Z)return J;let W;try{W=new Uint8Array(await J.arrayBuffer())}catch{return J}let O=()=>new Response(W,{status:J.status,statusText:J.statusText,headers:s(J.headers)});if(W.length<(G.threshold??_J))return O();try{let U=Z==="br"?await IJ(W,{params:{[y.constants.BROTLI_PARAM_QUALITY]:G.quality??5,[y.constants.BROTLI_PARAM_SIZE_HINT]:W.length}}):await OJ(W);if(U.length>=W.length)return O();let B=s(J.headers);return B.set("Content-Encoding",Z),B.set("Content-Length",String(U.length)),new Response(U,{status:J.status,statusText:J.statusText,headers:B})}catch{return O()}}function s(K){let J=new Headers(K),G=J.get("Vary");if(!G)return J.set("Vary","Accept-Encoding"),J;if(!G.split(",").some((W)=>W.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${G}, Accept-Encoding`);return J}class d{now;entries=new e(1000,{maxBytes:33554432,sizeOf:(K)=>K.body.byteLength+JSON.stringify(K.headers).length*2});pending=new Map;generation=0;constructor(K=Date.now){this.now=K}invalidate(K){this.generation++,this.pending.clear();for(let J of Array.from(this.entries.keys()))if(K===void 0||this.entries.get(J)?.path===K)this.entries.delete(J)}async respond(K,J,G){let Z,W=async()=>{let X=Z??await G();return X.headers.set("Cache-Control","private, no-store"),X.headers.set("Vary",A(X.headers.get("Vary")).Vary),X};if(!J||K.method!=="GET"||K.headers.has("Cookie")||K.headers.has("Authorization")||K.headers.has("Range"))return W();let O=new URL(K.url),U=`${O.origin}${O.pathname}${O.search}|${g(K)?"fragment":"document"}`,B=this.entries.get(U),w=(X)=>{let T=new Headers(X.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-X.created)/1000)))),new Response(X.body.slice(0),{headers:T})},F=B?(this.now()-B.created)/1000:1/0;if(B&&F<J.maxAge)return w(B);let S=this.generation,q=async()=>{let X=await G();Z=X;let T=(X.headers.get("Vary")??"").toLowerCase().split(",").map((L)=>L.trim()).filter(Boolean);if(X.status!==200||X.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(X.headers.get("Cache-Control")??"")||T.some((L)=>L!=="x-stx-router"&&L!=="accept-encoding"))return null;let M=await X.clone().arrayBuffer();if(M.byteLength>1048576)return null;X.headers.set("Vary",A(X.headers.get("Vary")).Vary);let Q={body:M,headers:Array.from(X.headers.entries()),created:this.now(),path:O.pathname};if(this.generation===S)this.entries.set(U,Q);return Q},H=this.pending.get(U);if(!H){if(this.pending.size>=1000)return W();H=q().finally(()=>{if(this.pending.get(U)===H)this.pending.delete(U)}),this.pending.set(U,H)}if(B&&F<J.maxAge+(J.swr??0))return H.catch(()=>{}),w(B);let x=await H;return x?w(x):W()}}var HJ={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function uJ(K={}){let J=k.resolve(K.outputDir||".output"),G=K.port??3000,Z=GJ(J);if(!Z)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Z.routes.length} routes...`);let W=$J(Z.routeRules),O=new d,U=XJ(J,Z.apiRoutes??[]),B=Bun.file(k.join(J,"server/runtime-config.json")),w=K.runtimeConfig??(await B.exists()?await B.json():void 0),F=w?i(w):void 0,S=new Map,q=new Map,H=new Map,x=new Map;for(let Q of Z.routes)try{let L=k.join(J,Q.compiledPath),Y=JSON.parse(await Bun.file(L).text());if(F)Y.html=p(Y.html,F);S.set(Q.pattern,Y),H.set(Q.pattern,l(Y.html)),x.set(Q.pattern,h(Y.html));let C=k.join(J,Q.fragmentPath);if(await Bun.file(C).exists()){let P=await Bun.file(C).text();q.set(Q.pattern,F?p(P,F):P)}}catch(L){console.warn(`[stx] Failed to load route ${Q.pattern}:`,L)}let X=new Map,T=[];for(let Q of Z.routes)if(Q.hasParams){let{regex:L,params:Y}=KJ(Q.pattern);T.push({regex:L,route:Q,paramNames:Y})}else X.set(Q.pattern,Q);let M=wJ({port:G,async fetch(Q){return t(Q,await QJ(F??i(),async()=>{let Y=new URL(Q.url).pathname;if(K.onRequest){let j=await K.onRequest(Q);if(j)return j}if(K.apiRouter){let j=await K.apiRouter.handleRequest(Q);if(j.status!==404)return j}if(K.apiRoutes?.[Y])return K.apiRoutes[Y](Q);let C=await U(Q);if(C)return C;if((Q.method==="GET"||Q.method==="HEAD")&&Y!=="/"){let j=k.resolve(J,"public"),_;try{_=decodeURIComponent(Y)}catch{_=Y}if(!_.includes("\x00")){let I=k.resolve(j,`.${_}`);if(I===j||I.startsWith(`${j}${k.sep}`))try{if(JJ.existsSync(I)&&JJ.statSync(I).isFile()){let z=k.extname(I).toLowerCase(),E=HJ[z]||"application/octet-stream",v=Y.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(Y);return new Response(Bun.file(I),{headers:{"Content-Type":E,"Cache-Control":v?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=g(Q),D=null,o={};if(D=X.get(Y)||null,!D)for(let{regex:j,route:_,paramNames:I}of T){let $=Y.match(j);if($){D=_,I.forEach((z,E)=>{o[z]=$[E+1]});break}}if(!D){let j=X.get("/404")||null;if(j){let _=S.get(j.pattern);if(_)return new Response(_.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}let R=W(Y),r=Object.keys(R).length>0;return O.respond(Q,R.cache,async()=>{let j=S.get(D.pattern);if(P&&Q.method==="GET"&&j&&!j.hasServerScripts&&Object.keys(j.placeholders).length===0){let $=q.get(D.pattern);if($){let z=H.get(D.pattern);return new Response($,{status:j.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...x.has(D.pattern)?{"X-STX-Runtime":x.get(D.pattern)?"true":"false"}:{},...z?{"X-STX-Layout":z.layout,"X-STX-Layout-Group":z.group}:{},...A(),...R.cache?{}:{"Cache-Control":ZJ}}})}}let _=WJ(Q.method),I=S.get(D.pattern);if(!I){let $=X.get("/500")||null;if($){let z=S.get($.pattern);if(z)return new Response(z.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(D.prerendered&&_)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!_&&!I.hasServerScripts&&Object.keys(I.placeholders).length===0)return new Response(I.html,{status:I.status??200,headers:{"Content-Type":"text/html",...A(),"Cache-Control":"public, max-age=60"}});try{let{html:$,boundaries:z,redirect:E,cookies:v,status:m,headers:c}=await jJ(I,{params:o,request:Q,method:Q.method,__stx_strict_hydration:r,__stx_runtime_config:F});if(E)return YJ(E,v,c);if(z&&z.length>0){let{renderStreamingPage:N,streamToResponse:u}=await import("./chunk-39qy76ek.js"),b=new Headers({...A(),...c,"Cache-Control":"private, no-store"});for(let f of v??[])b.append("Set-Cookie",f);if(P&&!_){let f=l($);b.set("X-STX-Fragment","true"),b.set("X-STX-Runtime",h($)?"true":"false"),b.set("X-STX-Layout",f.layout),b.set("X-STX-Layout-Group",f.group)}return u(N(P&&!_?n($,Z.routerContainer||"main"):$,z,{timeoutMs:30000}),{status:m??I.status??200,headers:b})}let V=new Headers({"Content-Type":"text/html",...A(),...R.cache?{}:{"Cache-Control":"private, no-store"}});for(let N of v??[])V.append("Set-Cookie",N);for(let[N,u]of Object.entries(c??{}))V.set(N,u);if(V.set("Vary",A(V.get("Vary")).Vary),P&&!_){let N=l($);return V.set("X-STX-Fragment","true"),V.set("X-STX-Runtime",h($)?"true":"false"),V.set("X-STX-Layout",N.layout),V.set("X-STX-Layout-Group",N.group),new Response(n($,Z.routerContainer||"main"),{status:m??I.status??200,headers:V})}return new Response($,{status:m??I.status??200,headers:V})}catch($){if(console.error(`[stx] Hydration error for ${Y}:`,$),r)return new Response("Internal Server Error",{status:500});return new Response(I.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${M.port}`),console.log(`[stx] Serving ${Z.routes.length} routes (${S.size} pre-loaded)`),{port:M.port,stop:()=>{O.invalidate(),M.stop()},invalidate:(Q)=>O.invalidate(Q)}}
3
3
  export{zJ as Ve,LJ as We,t as Xe,uJ as Ye};
@@ -2,4 +2,4 @@
2
2
  function A(h){let q=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;h=h.replace(q,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3
3
  `});let v=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return h=h.replace(v,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__composables
4
4
  `}),h}function B(h){return h.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
- export{A as pv,B as qv};
5
+ export{A as qv,B as rv};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-0s3ry262.js";import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{createHash as g}from"crypto";var D={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},b=[/node_modules/,/vendor/,/bower_components/,/\.min\./],B=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function L(X,Z={}){let{includeSourceMaps:Q=!1,parseImports:$=!0,detectDuplicates:U=!0,topModulesCount:K=20}=Z;if(!v.existsSync(X))throw Error(`Build directory not found: ${X}`);if(!v.statSync(X).isDirectory())throw Error(`Not a directory: ${X}`);let q=await k(X,Q),J=[],F=[];for(let A of q)try{let O=await f(A,X,$);J.push(O)}catch(O){F.push(`Failed to process ${A}: ${O}`)}let Y=c(J,X),V=J.reduce((A,O)=>A+O.size,0),_=J.reduce((A,O)=>A+O.gzipSize,0),w=m(J),G=U?p(J):[],C=[...J].sort((A,O)=>O.size-A.size).slice(0,K);return{timestamp:Date.now(),buildDir:H.resolve(X),chunks:Y,totalSize:V,totalGzipSize:_,moduleCount:J.length,duplicates:G,byType:w,largestModules:C,warnings:F}}async function k(X,Z){let Q=[];async function $(U){let K=await v.promises.readdir(U,{withFileTypes:!0});for(let j of K){let q=H.join(U,j.name);if(j.isDirectory()){if(!j.name.startsWith(".")&&j.name!=="node_modules")await $(q)}else if(j.isFile()){if(!Z&&j.name.endsWith(".map"))continue;Q.push(q)}}}return await $(X),Q}async function f(X,Z,Q){let $=await v.promises.readFile(X),U=H.relative(Z,X),K=H.extname(X).toLowerCase(),j=$.length,q=y($),J=h($,K),F=g("md5").update($).digest("hex").slice(0,8),Y=D[K]||"other",V=[];if(Q&&Y==="js")V.push(...d($.toString("utf-8")));return{id:U,path:U,size:j,gzipSize:q,parsedSize:J,extension:K,type:Y,imports:V,importedBy:[],hash:F}}function y(X){try{let Z=z(X,{level:9}).length;return Math.min(Z,X.length)}catch{return X.length}}function h(X,Z){if(Z.includes(".min.")||X.length<1000)return X.length;let $=D[Z];if($==="js")return Math.round(X.length*0.6);if($==="css")return Math.round(X.length*0.7);return X.length}function d(X){let Z=[],Q=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,$;while(($=Q.exec(X))!==null)Z.push($[1]);let U=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=U.exec(X))!==null)Z.push($[1]);let K=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=K.exec(X))!==null)Z.push($[1]);return[...new Set(Z)]}function c(X,Z){let Q=new Map;for(let U of X){let K=U.path.split(H.sep),j;if(K.length===1)j=H.basename(U.path,U.extension);else j=K[0];let q=Q.get(j)||[];q.push(U),Q.set(j,q)}let $=[];for(let[U,K]of Q){let j=K.reduce((Y,V)=>Y+V.size,0),q=K.reduce((Y,V)=>Y+V.gzipSize,0),J=K.some((Y)=>B.some((V)=>V.test(Y.path))),F=K.some((Y)=>b.some((V)=>V.test(Y.path)));$.push({name:U,files:K.map((Y)=>Y.path),modules:K,size:j,gzipSize:q,isEntry:J,isVendor:F})}return $.sort((U,K)=>K.size-U.size)}function m(X){let Z={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let Q of X)Z[Q.type].count++,Z[Q.type].size+=Q.size,Z[Q.type].gzipSize+=Q.gzipSize;return Z}function p(X){let Z=new Map;for(let $ of X){let U=Z.get($.hash)||[];U.push($),Z.set($.hash,U)}let Q=[];for(let[,$]of Z)if($.length>1){let U=$[0];Q.push({path:U.path,count:$.length,wastedBytes:U.size*($.length-1),locations:$.map((K)=>K.path)})}return Q.sort(($,U)=>U.wastedBytes-$.wastedBytes)}function W(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(2)} KB`;return`${(X/1048576).toFixed(2)} MB`}function I(X){let Z=X.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!Z)return 0;let Q=Number.parseFloat(Z[1]);switch((Z[2]||"B").toUpperCase()){case"KB":return Q*1024;case"MB":return Q*1024*1024;case"GB":return Q*1024*1024*1024;default:return Q}}function E(X,Z){if(Z===0)return"0%";return`${(X/Z*100).toFixed(1)}%`}function R(X,Z){switch(Z.format){case"json":return u(X,Z);case"markdown":return l(X,Z);case"text":default:return r(X,Z)}}function u(X,Z){let Q=N(X,Z);return JSON.stringify({timestamp:X.timestamp,buildDir:X.buildDir,summary:{totalSize:X.totalSize,totalSizeFormatted:W(X.totalSize),totalGzipSize:X.totalGzipSize,totalGzipSizeFormatted:W(X.totalGzipSize),moduleCount:X.moduleCount,chunkCount:X.chunks.length,duplicateCount:X.duplicates.length},byType:Object.fromEntries(Object.entries(X.byType).map(([$,U])=>[$,{...U,sizeFormatted:W(U.size),gzipSizeFormatted:W(U.gzipSize)}])),chunks:X.chunks.map(($)=>({name:$.name,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),moduleCount:$.modules.length,isEntry:$.isEntry,isVendor:$.isVendor})),largestModules:X.largestModules.slice(0,Z.topModules||10).map(($)=>({path:$.path,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),type:$.type})),duplicates:X.duplicates,analysis:Q,warnings:X.warnings},null,2)}function r(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push(""),Q.push("Bundle Analysis Report"),Q.push("\u2550".repeat(50)),Q.push(""),Q.push("Summary"),Q.push("\u2500".repeat(50)),$)Q.push(`Total Size: ${W(X.totalSize)} (${W(X.totalGzipSize)} gzip)`);else Q.push(`Total Size: ${W(X.totalSize)}`);if(Q.push(`Modules: ${X.moduleCount}`),Q.push(`Chunks: ${X.chunks.length}`),X.duplicates.length>0)Q.push(`Duplicates: ${X.duplicates.length}`);if(Q.push(""),Z.threshold&&X.totalSize>Z.threshold)Q.push(`\u26A0\uFE0F Bundle exceeds threshold of ${W(Z.threshold)}!`),Q.push("");Q.push("Size by Type"),Q.push("\u2500".repeat(50));let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0){let J=E(q.size,X.totalSize),F=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${j.padEnd(8)} ${W(q.size).padStart(12)}${F} ${J.padStart(6)} (${q.count} files)`)}}Q.push(""),Q.push("Chunks"),Q.push("\u2500".repeat(50));for(let j of X.chunks.slice(0,10)){let q=[];if(j.isEntry)q.push("entry");if(j.isVendor)q.push("vendor");let J=q.length>0?` [${q.join(", ")}]`:"",F=$?` (${W(j.gzipSize)} gzip)`:"";Q.push(` ${j.name.padEnd(20)} ${W(j.size).padStart(12)}${F}${J}`)}if(X.chunks.length>10)Q.push(` ... and ${X.chunks.length-10} more chunks`);Q.push("");let K=Z.topModules||10;Q.push(`Largest Modules (Top ${K})`),Q.push("\u2500".repeat(50));for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j],J=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${(j+1).toString().padStart(2)}. ${q.path}`),Q.push(` ${W(q.size)}${J}`)}if(Q.push(""),X.duplicates.length>0){Q.push("Duplicate Modules"),Q.push("\u2500".repeat(50));for(let j of X.duplicates.slice(0,5))Q.push(` ${j.path}`),Q.push(` ${j.count} copies, wasting ${W(j.wastedBytes)}`);if(X.duplicates.length>5)Q.push(` ... and ${X.duplicates.length-5} more duplicates`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("Recommendations"),Q.push("\u2500".repeat(50));for(let q of j.recommendations.slice(0,5)){let J=q.impact==="high"?"\u26A1":q.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";Q.push(` ${J} ${q.title}`),Q.push(` ${q.description}`)}Q.push("")}}if(X.warnings.length>0){Q.push("Warnings"),Q.push("\u2500".repeat(50));for(let j of X.warnings)Q.push(` \u26A0\uFE0F ${j}`);Q.push("")}return Q.join(`
2
+ import"./chunk-ejqpq0wc.js";import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{createHash as g}from"crypto";var D={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},b=[/node_modules/,/vendor/,/bower_components/,/\.min\./],B=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function L(X,Z={}){let{includeSourceMaps:Q=!1,parseImports:$=!0,detectDuplicates:U=!0,topModulesCount:K=20}=Z;if(!v.existsSync(X))throw Error(`Build directory not found: ${X}`);if(!v.statSync(X).isDirectory())throw Error(`Not a directory: ${X}`);let q=await k(X,Q),J=[],F=[];for(let A of q)try{let O=await f(A,X,$);J.push(O)}catch(O){F.push(`Failed to process ${A}: ${O}`)}let Y=c(J,X),V=J.reduce((A,O)=>A+O.size,0),_=J.reduce((A,O)=>A+O.gzipSize,0),w=m(J),G=U?p(J):[],C=[...J].sort((A,O)=>O.size-A.size).slice(0,K);return{timestamp:Date.now(),buildDir:H.resolve(X),chunks:Y,totalSize:V,totalGzipSize:_,moduleCount:J.length,duplicates:G,byType:w,largestModules:C,warnings:F}}async function k(X,Z){let Q=[];async function $(U){let K=await v.promises.readdir(U,{withFileTypes:!0});for(let j of K){let q=H.join(U,j.name);if(j.isDirectory()){if(!j.name.startsWith(".")&&j.name!=="node_modules")await $(q)}else if(j.isFile()){if(!Z&&j.name.endsWith(".map"))continue;Q.push(q)}}}return await $(X),Q}async function f(X,Z,Q){let $=await v.promises.readFile(X),U=H.relative(Z,X),K=H.extname(X).toLowerCase(),j=$.length,q=y($),J=h($,K),F=g("md5").update($).digest("hex").slice(0,8),Y=D[K]||"other",V=[];if(Q&&Y==="js")V.push(...d($.toString("utf-8")));return{id:U,path:U,size:j,gzipSize:q,parsedSize:J,extension:K,type:Y,imports:V,importedBy:[],hash:F}}function y(X){try{let Z=z(X,{level:9}).length;return Math.min(Z,X.length)}catch{return X.length}}function h(X,Z){if(Z.includes(".min.")||X.length<1000)return X.length;let $=D[Z];if($==="js")return Math.round(X.length*0.6);if($==="css")return Math.round(X.length*0.7);return X.length}function d(X){let Z=[],Q=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,$;while(($=Q.exec(X))!==null)Z.push($[1]);let U=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=U.exec(X))!==null)Z.push($[1]);let K=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=K.exec(X))!==null)Z.push($[1]);return[...new Set(Z)]}function c(X,Z){let Q=new Map;for(let U of X){let K=U.path.split(H.sep),j;if(K.length===1)j=H.basename(U.path,U.extension);else j=K[0];let q=Q.get(j)||[];q.push(U),Q.set(j,q)}let $=[];for(let[U,K]of Q){let j=K.reduce((Y,V)=>Y+V.size,0),q=K.reduce((Y,V)=>Y+V.gzipSize,0),J=K.some((Y)=>B.some((V)=>V.test(Y.path))),F=K.some((Y)=>b.some((V)=>V.test(Y.path)));$.push({name:U,files:K.map((Y)=>Y.path),modules:K,size:j,gzipSize:q,isEntry:J,isVendor:F})}return $.sort((U,K)=>K.size-U.size)}function m(X){let Z={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let Q of X)Z[Q.type].count++,Z[Q.type].size+=Q.size,Z[Q.type].gzipSize+=Q.gzipSize;return Z}function p(X){let Z=new Map;for(let $ of X){let U=Z.get($.hash)||[];U.push($),Z.set($.hash,U)}let Q=[];for(let[,$]of Z)if($.length>1){let U=$[0];Q.push({path:U.path,count:$.length,wastedBytes:U.size*($.length-1),locations:$.map((K)=>K.path)})}return Q.sort(($,U)=>U.wastedBytes-$.wastedBytes)}function W(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(2)} KB`;return`${(X/1048576).toFixed(2)} MB`}function I(X){let Z=X.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!Z)return 0;let Q=Number.parseFloat(Z[1]);switch((Z[2]||"B").toUpperCase()){case"KB":return Q*1024;case"MB":return Q*1024*1024;case"GB":return Q*1024*1024*1024;default:return Q}}function E(X,Z){if(Z===0)return"0%";return`${(X/Z*100).toFixed(1)}%`}function R(X,Z){switch(Z.format){case"json":return u(X,Z);case"markdown":return l(X,Z);case"text":default:return r(X,Z)}}function u(X,Z){let Q=N(X,Z);return JSON.stringify({timestamp:X.timestamp,buildDir:X.buildDir,summary:{totalSize:X.totalSize,totalSizeFormatted:W(X.totalSize),totalGzipSize:X.totalGzipSize,totalGzipSizeFormatted:W(X.totalGzipSize),moduleCount:X.moduleCount,chunkCount:X.chunks.length,duplicateCount:X.duplicates.length},byType:Object.fromEntries(Object.entries(X.byType).map(([$,U])=>[$,{...U,sizeFormatted:W(U.size),gzipSizeFormatted:W(U.gzipSize)}])),chunks:X.chunks.map(($)=>({name:$.name,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),moduleCount:$.modules.length,isEntry:$.isEntry,isVendor:$.isVendor})),largestModules:X.largestModules.slice(0,Z.topModules||10).map(($)=>({path:$.path,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),type:$.type})),duplicates:X.duplicates,analysis:Q,warnings:X.warnings},null,2)}function r(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push(""),Q.push("Bundle Analysis Report"),Q.push("\u2550".repeat(50)),Q.push(""),Q.push("Summary"),Q.push("\u2500".repeat(50)),$)Q.push(`Total Size: ${W(X.totalSize)} (${W(X.totalGzipSize)} gzip)`);else Q.push(`Total Size: ${W(X.totalSize)}`);if(Q.push(`Modules: ${X.moduleCount}`),Q.push(`Chunks: ${X.chunks.length}`),X.duplicates.length>0)Q.push(`Duplicates: ${X.duplicates.length}`);if(Q.push(""),Z.threshold&&X.totalSize>Z.threshold)Q.push(`\u26A0\uFE0F Bundle exceeds threshold of ${W(Z.threshold)}!`),Q.push("");Q.push("Size by Type"),Q.push("\u2500".repeat(50));let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0){let J=E(q.size,X.totalSize),F=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${j.padEnd(8)} ${W(q.size).padStart(12)}${F} ${J.padStart(6)} (${q.count} files)`)}}Q.push(""),Q.push("Chunks"),Q.push("\u2500".repeat(50));for(let j of X.chunks.slice(0,10)){let q=[];if(j.isEntry)q.push("entry");if(j.isVendor)q.push("vendor");let J=q.length>0?` [${q.join(", ")}]`:"",F=$?` (${W(j.gzipSize)} gzip)`:"";Q.push(` ${j.name.padEnd(20)} ${W(j.size).padStart(12)}${F}${J}`)}if(X.chunks.length>10)Q.push(` ... and ${X.chunks.length-10} more chunks`);Q.push("");let K=Z.topModules||10;Q.push(`Largest Modules (Top ${K})`),Q.push("\u2500".repeat(50));for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j],J=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${(j+1).toString().padStart(2)}. ${q.path}`),Q.push(` ${W(q.size)}${J}`)}if(Q.push(""),X.duplicates.length>0){Q.push("Duplicate Modules"),Q.push("\u2500".repeat(50));for(let j of X.duplicates.slice(0,5))Q.push(` ${j.path}`),Q.push(` ${j.count} copies, wasting ${W(j.wastedBytes)}`);if(X.duplicates.length>5)Q.push(` ... and ${X.duplicates.length-5} more duplicates`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("Recommendations"),Q.push("\u2500".repeat(50));for(let q of j.recommendations.slice(0,5)){let J=q.impact==="high"?"\u26A1":q.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";Q.push(` ${J} ${q.title}`),Q.push(` ${q.description}`)}Q.push("")}}if(X.warnings.length>0){Q.push("Warnings"),Q.push("\u2500".repeat(50));for(let j of X.warnings)Q.push(` \u26A0\uFE0F ${j}`);Q.push("")}return Q.join(`
3
3
  `)}function l(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push("# Bundle Analysis Report"),Q.push(""),Q.push(`Generated: ${new Date(X.timestamp).toISOString()}`),Q.push(""),Q.push("## Summary"),Q.push(""),Q.push("| Metric | Value |"),Q.push("|--------|-------|"),Q.push(`| Total Size | ${W(X.totalSize)} |`),$)Q.push(`| Gzip Size | ${W(X.totalGzipSize)} |`);Q.push(`| Modules | ${X.moduleCount} |`),Q.push(`| Chunks | ${X.chunks.length} |`),Q.push(`| Duplicates | ${X.duplicates.length} |`),Q.push(""),Q.push("## Size by Type"),Q.push(""),Q.push("| Type | Size | Gzip | % | Files |"),Q.push("|------|------|------|---|-------|");let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0)Q.push(`| ${j} | ${W(q.size)} | ${W(q.gzipSize)} | ${E(q.size,X.totalSize)} | ${q.count} |`)}Q.push(""),Q.push("## Chunks"),Q.push(""),Q.push("| Name | Size | Gzip | Modules | Type |"),Q.push("|------|------|------|---------|------|");for(let j of X.chunks.slice(0,15)){let q=j.isEntry?"Entry":j.isVendor?"Vendor":"-";Q.push(`| ${j.name} | ${W(j.size)} | ${W(j.gzipSize)} | ${j.modules.length} | ${q} |`)}Q.push("");let K=Z.topModules||10;Q.push(`## Largest Modules (Top ${K})`),Q.push(""),Q.push("| # | Path | Size | Gzip |"),Q.push("|---|------|------|------|");for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j];Q.push(`| ${j+1} | \`${q.path}\` | ${W(q.size)} | ${W(q.gzipSize)} |`)}if(Q.push(""),X.duplicates.length>0){Q.push("## Duplicates"),Q.push(""),Q.push("| Path | Copies | Wasted |"),Q.push("|------|--------|--------|");for(let j of X.duplicates.slice(0,10))Q.push(`| \`${j.path}\` | ${j.count} | ${W(j.wastedBytes)} |`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("## Recommendations"),Q.push("");for(let q of j.recommendations)Q.push(`### ${q.title}`),Q.push(""),Q.push(q.description),Q.push(""),Q.push(`- **Impact:** ${q.impact}`),Q.push(`- **Effort:** ${q.effort}`),Q.push("")}}return Q.join(`
4
4
  `)}function N(X,Z){let Q=[],$=[];if(Z.threshold&&X.totalSize>Z.threshold)Q.push({severity:"error",message:`Bundle size (${W(X.totalSize)}) exceeds threshold (${W(Z.threshold)})`});if(X.totalSize>1048576)Q.push({severity:"warning",message:`Bundle is over 1MB (${W(X.totalSize)})`,details:"Large bundles can significantly impact load time"});if(X.duplicates.length>0){let q=X.duplicates.reduce((J,F)=>J+F.wastedBytes,0);Q.push({severity:"warning",message:`${X.duplicates.length} duplicate modules found, wasting ${W(q)}`}),$.push({title:"Remove Duplicate Modules",description:"Consider using import aliases or ensuring consistent package versions to eliminate duplicates.",impact:"medium",effort:"low"})}if(X.byType.js.size/X.totalSize>0.8&&X.totalSize>512000)$.push({title:"Code Splitting",description:"Over 80% of your bundle is JavaScript. Consider splitting code by route or feature.",impact:"high",effort:"medium"});let K=X.largestModules.filter((q)=>q.size>102400);if(K.length>0){Q.push({severity:"info",message:`${K.length} modules are over 100KB`});for(let q of K){if(q.path.includes("lodash")&&!q.path.includes("lodash-es"))$.push({title:"Use lodash-es instead of lodash",description:"lodash-es supports tree-shaking and can significantly reduce bundle size.",impact:"high",effort:"low"});if(q.path.includes("moment"))$.push({title:"Replace moment.js",description:"Consider using date-fns or dayjs for smaller date handling libraries.",impact:"high",effort:"medium"})}}if(X.byType.image.size>512000)$.push({title:"Optimize Images",description:`Images account for ${W(X.byType.image.size)}. Consider using WebP/AVIF formats and responsive images.`,impact:"high",effort:"low"});let j=100;if(X.totalSize>1048576)j-=20;else if(X.totalSize>512000)j-=10;if(j-=Math.min(20,X.duplicates.length*2),j-=Math.min(15,K.length*3),Z.threshold&&X.totalSize>Z.threshold)j-=25;return{score:Math.max(0,j),issues:Q,recommendations:$}}var i={lodash:{alternative:"lodash-es or individual imports",savings:"~70%"},moment:{alternative:"date-fns or dayjs",savings:"~90%"},"chart.js":{alternative:"chart.js with tree-shaking",savings:"~50%"},"highlight.js":{alternative:"Selective language imports",savings:"~80%"},fontawesome:{alternative:"Individual icon imports",savings:"~90%"},"material-ui":{alternative:"Named imports from @mui/*",savings:"~60%"}};function n(X){for(let[Z,Q]of Object.entries(i))if(X.includes(Z))return{title:`Optimize ${Z}`,description:`Consider using ${Q.alternative}. Potential savings: ${Q.savings}`,impact:"high",effort:"low"};return null}var o={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}};function x(X,Z={}){let{title:Q="Bundle Analysis",gzip:$=!0,colorScheme:U="default"}=Z,K=o[U],j=a(X),q=JSON.stringify(j);return`<!DOCTYPE html>
5
5
  <html lang="en">
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sv as a,tv as b}from"./chunk-d86q27j8.js";import"./chunk-ejqpq0wc.js";export{b as warnUnbalancedTags,a as findUnbalancedTags};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Bm as P,Bo as i,Cp as h,Ho as T,Jm as k,Zm as c,_m as l,rm as R,sm as O}from"./chunk-xgw269cf.js";import{Js as S,Ls as y}from"./chunk-6xs80tka.js";import{Fu as m}from"./chunk-1qtd4ex2.js";import{tw as YJ,ww as ZJ,xw as $J}from"./chunk-kgbz86sa.js";import{Ew as XJ,Hw as q}from"./chunk-0s3ry262.js";var r=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function s(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(r.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var o=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function C(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=y(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=o.exec(j);if(F){let K=s(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var a=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function t(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function v(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function e(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function JJ(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=e(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=t(J),Z;while((Z=X.exec(J))!==null){if(v(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||a.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!JJ(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(v(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var NJ="X-STX-Router",_J="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function QJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:QJ(J,"X-STX-Router")}}import E from"path";YJ();var UJ="stx-page-head:",WJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,D={dev:null,prod:null};function jJ(){let J=m()?"dev":"prod",Y=D[J];if(Y!==null)return Y;try{let Q=($J(),XJ(ZJ)),X=J==="dev"&&typeof Q.getRouterScriptDev==="function"?Q.getRouterScriptDev:Q.getRouterScript;D[J]=`<script>${X()}</script>`}catch{D[J]=""}return D[J]}async function RJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function PJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=C(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:A}=await import("./chunk-905j49fe.js"),I=await A(),z={__filename:J,__dirname:E.dirname(J)};for(let V of U){let L=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(L&&!V.includes("client")&&!V.includes('type="module"'))await w(L[1],z,J)}let _=await B(K,z,J,{...N,...I,...Y},new Set),H=_.indexOf(G);if(H===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:_.substring(0,H),afterSlot:_.substring(H+G.length),filePath:J,shellScripts:U,shellStyles:W}}catch(Q){return console.error(`[stx] Error processing shell ${J}:`,Q),null}}function kJ(J,Y,Q){let X,$="",Z=Y.match(WJ);if(Z){Y=Y.replace(Z[0],"");try{let K=Buffer.from(Z[1],"base64").toString("utf8"),G=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(G)X=G[1].trim();$=K.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=Q||X||"stx App",W=jJ(),j="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Bm as P,Bo as i,Cp as h,Ho as T,Jm as k,Zm as c,_m as l,rm as R,sm as O}from"./chunk-5atmahe4.js";import{Ks as S,Ms as y}from"./chunk-fs2t4rs3.js";import{Gu as m}from"./chunk-avwywzsj.js";import{Cw as ZJ,Dw as $J,zw as YJ}from"./chunk-yg5r7bnm.js";import{Kw as XJ,Nw as q}from"./chunk-ejqpq0wc.js";var r=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function s(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(r.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var o=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function C(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=y(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=o.exec(j);if(F){let K=s(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var a=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function t(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function v(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function e(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function JJ(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=e(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=t(J),Z;while((Z=X.exec(J))!==null){if(v(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||a.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!JJ(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(v(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var NJ="X-STX-Router",_J="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function QJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:QJ(J,"X-STX-Router")}}import E from"path";YJ();var UJ="stx-page-head:",WJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,D={dev:null,prod:null};function jJ(){let J=m()?"dev":"prod",Y=D[J];if(Y!==null)return Y;try{let Q=($J(),XJ(ZJ)),X=J==="dev"&&typeof Q.getRouterScriptDev==="function"?Q.getRouterScriptDev:Q.getRouterScript;D[J]=`<script>${X()}</script>`}catch{D[J]=""}return D[J]}async function RJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function PJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=C(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:A}=await import("./chunk-1bct7pfj.js"),I=await A(),z={__filename:J,__dirname:E.dirname(J)};for(let V of U){let L=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(L&&!V.includes("client")&&!V.includes('type="module"'))await w(L[1],z,J)}let _=await B(K,z,J,{...N,...I,...Y},new Set),H=_.indexOf(G);if(H===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:_.substring(0,H),afterSlot:_.substring(H+G.length),filePath:J,shellScripts:U,shellStyles:W}}catch(Q){return console.error(`[stx] Error processing shell ${J}:`,Q),null}}function kJ(J,Y,Q){let X,$="",Z=Y.match(WJ);if(Z){Y=Y.replace(Z[0],"");try{let K=Buffer.from(Z[1],"base64").toString("utf8"),G=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(G)X=G[1].trim();$=K.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=Q||X||"stx App",W=jJ(),j="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -26,5 +26,5 @@ ${W}
26
26
  `));if($.length>0)N.push($.join(`
27
27
  `));if(G.length>0)N.push(G.join(`
28
28
  `));return N.push(K),N.join(`
29
- `)}import M from"fs";import p from"path";function fJ(J,Y,Q){return{version:1,buildTime:new Date().toISOString(),routes:J,assets:Y,outputDir:Q}}function gJ(J,Y){let Q=p.join(Y,"manifest.json");M.writeFileSync(Q,JSON.stringify(J,null,2))}function uJ(J){let Y=p.join(J,"manifest.json");if(!M.existsSync(Y))return null;try{let Q=M.readFileSync(Y,"utf-8"),X=JSON.parse(Q);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Q){return console.warn("[stx] Failed to load manifest:",Q),null}}function b(J,Y,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(Y)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function FJ(J){let Y=J.headers.get("content-type")||"",Q={},X=($,Z)=>{let U=Q[$];if(U===void 0)Q[$]=Z;else if(Array.isArray(U))U.push(Z);else Q[$]=[U,Z]};if(Y.includes("multipart/form-data")){let $=await J.formData();for(let[Z,U]of $.entries())if(typeof U==="string")X(Z,U);return Q}if(Y.includes("application/x-www-form-urlencoded")){for(let[$,Z]of new URLSearchParams(await J.text()).entries())X($,Z);return Q}return Q}function GJ(J){if(!J)return!1;let Y=J.toUpperCase();return Y!=="GET"&&Y!=="HEAD"}async function d(J,Y={}){let Q=Y.request,X=Y.method??Q?.method;if(!Q||!GJ(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let $={};try{$=await FJ(Q)}catch{}let Z=await J.action({request:Q,form:$,params:Y.params??{},query:J.query??{},cookies:Y.cookies??{}});if(Z&&typeof Z==="object"){let U=Z,W=zJ(U.cookies),j=U.redirect;if(typeof j==="string"&&j)return{redirect:j,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:F,redirect:K,...G}=U;if(Object.assign(J,G),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function zJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let Y=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){Y.push(b(Q,X));continue}if(X&&typeof X==="object"){let $=X;if(typeof $.value!=="string")continue;Y.push(b(Q,$.value,$))}}return Y}function dJ(J,Y=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let $ of Y)X.append("Set-Cookie",$);for(let[$,Z]of Object.entries(Q??{}))if($.toLowerCase()!=="location")X.set($,Z);return new Response(null,{status:303,headers:X})}async function aJ(J,Y={}){return(await n(J,Y)).html}async function tJ(J,Y={}){let{html:Q,context:X,redirect:$,cookies:Z}=await n(J,Y),U=c(X),W=l(X);if($)return{html:Q,redirect:$,cookies:Z,status:U,headers:W};let{extractStreamBoundaries:j}=await import("./chunk-jy6jwxhs.js"),F=j(X),K=J.streamTemplates;if(K&&Object.keys(K).length>0){let{processDirectives:G}=await import("./chunk-fytemc96.js"),{defaultConfig:B}=await import("./chunk-w1mbrq1g.js"),w=X.streamBoundaries||{},N={...B,autoShell:!1},A=Object.keys(K).map((z)=>({id:z,render:async()=>{let _=typeof w[z]==="function"?await w[z]():void 0;return G(K[z],{...X,$boundary:_},J.sourceFile,N,new Set)}})),I=new Set(A.map((z)=>z.id));F=[...(F||[]).filter((z)=>!I.has(z.id)),...A]}return{html:Q,boundaries:F&&F.length>0?F:void 0,cookies:Z,status:U,headers:W}}async function n(J,Y){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};if(!J.hasServerScripts&&!O(J.html))return{html:J.html,context:Q};for(let U of J.serverScriptContent)try{await T(U,Q,J.sourceFile)}catch(W){if(Y.__stx_strict_hydration)throw W;console.warn(`[stx] Server script error in ${J.sourceFile}:`,W)}let X=await d(Q,{request:Y.request,method:Y.method,params:Y.params??{},cookies:Y.cookies??{}}),$=(U)=>{let W=U.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),j=i(Q);if(!j)return W;let F=W.indexOf("</head>");return F<0?j+W:W.slice(0,F)+j+W.slice(F)};if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!O(J.html))return{html:$(J.html),context:Q,cookies:X.cookies};let Z=new Map;for(let[U,W]of Object.entries(J.placeholders))if(W.expression)try{let j=k(W.expression,Q);if(W.type==="raw")Z.set(U,j!==void 0&&j!==null?String(j):"");else Z.set(U,j!==void 0&&j!==null?P(String(j)):"")}catch(j){if(Y.__stx_strict_hydration)throw j;Z.set(U,"")}return{html:$(R(J.html,Z)),context:Q,cookies:X.cookies}}async function eJ(J,Y={}){if(!J.hasServerScripts&&!O(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};for(let $ of J.serverScriptContent)try{await T($,Q,J.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${J.sourceFile}:`,Z)}if(!O(J.fragment))return J.fragment;let X=new Map;for(let[$,Z]of Object.entries(J.placeholders))if(Z.expression)try{let U=k(Z.expression,Q);if(Z.type==="raw")X.set($,U!==void 0&&U!==null?String(U):"");else X.set($,U!==void 0&&U!==null?P(String(U)):"")}catch{X.set($,"")}return R(J.fragment,X)}
29
+ `)}import M from"fs";import p from"path";function fJ(J,Y,Q){return{version:1,buildTime:new Date().toISOString(),routes:J,assets:Y,outputDir:Q}}function gJ(J,Y){let Q=p.join(Y,"manifest.json");M.writeFileSync(Q,JSON.stringify(J,null,2))}function uJ(J){let Y=p.join(J,"manifest.json");if(!M.existsSync(Y))return null;try{let Q=M.readFileSync(Y,"utf-8"),X=JSON.parse(Q);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Q){return console.warn("[stx] Failed to load manifest:",Q),null}}function b(J,Y,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(Y)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function FJ(J){let Y=J.headers.get("content-type")||"",Q={},X=($,Z)=>{let U=Q[$];if(U===void 0)Q[$]=Z;else if(Array.isArray(U))U.push(Z);else Q[$]=[U,Z]};if(Y.includes("multipart/form-data")){let $=await J.formData();for(let[Z,U]of $.entries())if(typeof U==="string")X(Z,U);return Q}if(Y.includes("application/x-www-form-urlencoded")){for(let[$,Z]of new URLSearchParams(await J.text()).entries())X($,Z);return Q}return Q}function GJ(J){if(!J)return!1;let Y=J.toUpperCase();return Y!=="GET"&&Y!=="HEAD"}async function d(J,Y={}){let Q=Y.request,X=Y.method??Q?.method;if(!Q||!GJ(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let $={};try{$=await FJ(Q)}catch{}let Z=await J.action({request:Q,form:$,params:Y.params??{},query:J.query??{},cookies:Y.cookies??{}});if(Z&&typeof Z==="object"){let U=Z,W=zJ(U.cookies),j=U.redirect;if(typeof j==="string"&&j)return{redirect:j,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:F,redirect:K,...G}=U;if(Object.assign(J,G),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function zJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let Y=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){Y.push(b(Q,X));continue}if(X&&typeof X==="object"){let $=X;if(typeof $.value!=="string")continue;Y.push(b(Q,$.value,$))}}return Y}function dJ(J,Y=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let $ of Y)X.append("Set-Cookie",$);for(let[$,Z]of Object.entries(Q??{}))if($.toLowerCase()!=="location")X.set($,Z);return new Response(null,{status:303,headers:X})}async function aJ(J,Y={}){return(await n(J,Y)).html}async function tJ(J,Y={}){let{html:Q,context:X,redirect:$,cookies:Z}=await n(J,Y),U=c(X),W=l(X);if($)return{html:Q,redirect:$,cookies:Z,status:U,headers:W};let{extractStreamBoundaries:j}=await import("./chunk-39qy76ek.js"),F=j(X),K=J.streamTemplates;if(K&&Object.keys(K).length>0){let{processDirectives:G}=await import("./chunk-j5qygdy9.js"),{defaultConfig:B}=await import("./chunk-7d2gfyk8.js"),w=X.streamBoundaries||{},N={...B,autoShell:!1},A=Object.keys(K).map((z)=>({id:z,render:async()=>{let _=typeof w[z]==="function"?await w[z]():void 0;return G(K[z],{...X,$boundary:_},J.sourceFile,N,new Set)}})),I=new Set(A.map((z)=>z.id));F=[...(F||[]).filter((z)=>!I.has(z.id)),...A]}return{html:Q,boundaries:F&&F.length>0?F:void 0,cookies:Z,status:U,headers:W}}async function n(J,Y){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};if(!J.hasServerScripts&&!O(J.html))return{html:J.html,context:Q};for(let U of J.serverScriptContent)try{await T(U,Q,J.sourceFile)}catch(W){if(Y.__stx_strict_hydration)throw W;console.warn(`[stx] Server script error in ${J.sourceFile}:`,W)}let X=await d(Q,{request:Y.request,method:Y.method,params:Y.params??{},cookies:Y.cookies??{}}),$=(U)=>{let W=U.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),j=i(Q);if(!j)return W;let F=W.indexOf("</head>");return F<0?j+W:W.slice(0,F)+j+W.slice(F)};if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!O(J.html))return{html:$(J.html),context:Q,cookies:X.cookies};let Z=new Map;for(let[U,W]of Object.entries(J.placeholders))if(W.expression)try{let j=k(W.expression,Q);if(W.type==="raw")Z.set(U,j!==void 0&&j!==null?String(j):"");else Z.set(U,j!==void 0&&j!==null?P(String(j)):"")}catch(j){if(Y.__stx_strict_hydration)throw j;Z.set(U,"")}return{html:$(R(J.html,Z)),context:Q,cookies:X.cookies}}async function eJ(J,Y={}){if(!J.hasServerScripts&&!O(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};for(let $ of J.serverScriptContent)try{await T($,Q,J.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${J.sourceFile}:`,Z)}if(!O(J.fragment))return J.fragment;let X=new Map;for(let[$,Z]of Object.entries(J.placeholders))if(Z.expression)try{let U=k(Z.expression,Q);if(Z.type==="raw")X.set($,U!==void 0&&U!==null?String(U):"");else X.set($,U!==void 0&&U!==null?P(String(U)):"")}catch{X.set($,"")}return R(J.fragment,X)}
30
30
  export{s as Xf,C as Yf,e as Zf,x as _f,NJ as $f,_J as ag,AJ as bg,g as cg,QJ as dg,IJ as eg,RJ as fg,PJ as gg,kJ as hg,KJ as ig,TJ as jg,SJ as kg,fJ as lg,gJ as mg,uJ as ng,b as og,FJ as pg,GJ as qg,d as rg,dJ as sg,aJ as tg,tJ as ug,eJ as vg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{createHash as n}from"crypto";import x from"fs";import K from"path";import{decode as $Q,generateThumbHash as JQ}from"ts-images";import{createImageDeliveryCatalog as f}from"ts-images/delivery";import R from"fs";function T(Q,$,Z){let M=Buffer.alloc(Z),J=R.readSync(Q,M,0,Z,$);return M.subarray(0,J)}function P(Q){if(Q.length<25)return!1;let $=(M,J)=>String.fromCharCode(...Q.subarray(M,J));if($(0,4)!=="RIFF"||$(8,12)!=="WEBP")return!1;let Z=$(12,16);if(Z==="VP8X")return(Q[20]&16)!==0;if(Z==="VP8L")return((Q[21]|Q[22]<<8|Q[23]<<16|Q[24]<<24)>>>28&1)===1;return!1}function m(Q){let $;try{$=R.openSync(Q,"r");let Z=T($,0,33);if(Z.length>=3&&Z[0]===255&&Z[1]===216&&Z[2]===255)return"none";if(Z.length>=26&&Z[0]===137&&Z.toString("latin1",1,4)==="PNG"){let M=Z[25];if(M===4||M===6)return"possible";let J=8;for(let X=0;X<64;X++){let G=T($,J,8);if(G.length<8)return"unknown";let Y=G.toString("latin1",4,8);if(Y==="tRNS")return"possible";if(Y==="IDAT"||Y==="IEND")return"none";J+=12+G.readUInt32BE(0)}return"unknown"}if(Z.length>=25&&Z.toString("latin1",0,4)==="RIFF"&&Z.toString("latin1",8,12)==="WEBP"){if(P(Z))return"possible";let M=Z.toString("latin1",12,16);return M==="VP8 "||M==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if($!==void 0)R.closeSync($)}}import i from"fs";import O from"os";import{join as k}from"path";import{fileURLToPath as b}from"url";import{Worker as v}from"worker_threads";var I=Symbol("stx.image-worker.unavailable");function t(Q=typeof O.availableParallelism==="function"?O.availableParallelism():O.cpus().length){return Math.max(1,Math.min(2,Q-1))}var C=0,y=[];async function a(){if(C<t()){C++;return}await new Promise((Q)=>y.push(Q)),C++}function r(){C--,y.shift()?.()}var e="@stacksjs/stx/builtins/image-warmup-worker";function QQ(Q=process.cwd()){let $=import.meta.url.endsWith(".ts")?"ts":"js";try{let Z=new URL(`./image-warmup-worker.${$}`,import.meta.url);if(Z.protocol==="file:"&&i.existsSync(b(Z)))return b(Z)}catch{}try{let Z=typeof Bun<"u"?Bun.resolveSync(e,Q):void 0;return Z&&ZQ(Z)?Z:void 0}catch{return}}function ZQ(Q,$=process.env){let Z=Q.replace(/\\/g,"/");if(Z.split("/").some((J)=>/@\d[^/]*@@@\d+$/.test(J)))return!1;return![$.BUN_INSTALL_CACHE_DIR,k($.BUN_INSTALL||k(O.homedir(),".bun"),"install","cache")].filter((J)=>!!J).map((J)=>`${J.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((J)=>Z.startsWith(J))}var g=!1;function N(Q){if(!g)g=!0,console.warn(`[stx] image worker unavailable (${Q}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return I}function A(Q){return Q instanceof Error?Q.message:String(Q)}async function u(Q,$){if(typeof v!=="function")return N("node:worker_threads has no Worker in this runtime");let Z=QQ();if(!Z)return N("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await a();try{return await new Promise((M,J)=>{let X;try{X=new v(Z)}catch(B){M(N(`could not start ${Z}: ${A(B)}`));return}let G=!1,Y=!1,q=(B)=>{if(Y)return;Y=!0,B(),X.terminate()};X.on("message",(B)=>{if(B.type==="ready"){G=!0,X.postMessage({task:Q,args:$});return}if(B.type==="result"){q(()=>M(B.value));return}let j=Error(B.error?.message??"image worker failed");if(B.error?.name)j.name=B.error.name;if(B.error?.stack)j.stack=B.error.stack;q(()=>J(j))}),X.on("error",(B)=>{q(()=>G?J(B instanceof Error?B:Error(A(B)||"image worker crashed")):M(N(`the worker failed before it was ready: ${A(B)}`)))}),X.on("exit",(B)=>{q(()=>G?J(Error("image worker exited before it finished")):M(N(`the worker exited with code ${B} before it was ready`)))})})}finally{r()}}var MQ=new Set([".avif",".jpeg",".jpg",".png",".webp"]),XQ=[320,640,960,1280,1920],L="/_stx/images",BQ=`stx:${L}:alpha-1`,GQ=["@stacksjs/ts-webp","@stacksjs/ts-avif"],W;function qQ(Q,$){let Z=K.dirname(Bun.resolveSync(Q,$));while(Z!==K.dirname(Z)){let M=K.join(Z,"package.json");if(x.existsSync(M)){let J=JSON.parse(x.readFileSync(M,"utf8"));if(J.name===Q)return J.version}Z=K.dirname(Z)}return}function bQ(Q){W=Q}function KQ(){if(W!==void 0)return W;let Q;try{Q=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return W=GQ.map(($)=>{let Z;try{Z=Q?qQ($,Q):void 0}catch{}return`${$.replace("@stacksjs/","")}@${Z??"unknown"}`}).join("+"),W}var U=new Map,_=new Set,c=new Set;function YQ(Q){return`/${Q.split(K.sep).map(encodeURIComponent).join("/")}`}function xQ(Q){let $=K.extname(Q),Z=Q.slice(0,-$.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),M=n("sha256").update(Q).digest("hex").slice(0,8);return`${Z||"image"}-${M}`}function h(Q,$=`stx:${L}`){let Z=(M)=>`${L}/${M.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:$,async stat(M){let J=K.join(Q,M);try{let X=await x.promises.stat(J);return X.size>0?{bytes:X.size,path:J,url:Z(M)}:null}catch{return null}},async write(M,J){let X=K.join(Q,M);await x.promises.mkdir(K.dirname(X),{recursive:!0});let G=`${X}.${process.pid}.tmp`;return await x.promises.writeFile(G,J),await x.promises.rename(G,X),{bytes:J.byteLength,path:X,url:Z(M)}},url:Z}}async function l(Q,$=Q){let Z=await x.promises.readdir($,{withFileTypes:!0});Z.sort((J,X)=>J.name.localeCompare(X.name));let M=[];for(let J of Z){let X=K.join($,J.name);if(J.isDirectory()){M.push(...await l(Q,X));continue}if(!J.isFile()||!MQ.has(K.extname(J.name).toLowerCase()))continue;M.push({absolutePath:X,relativePath:K.relative(Q,X)})}return M}function p(Q,$){return Q.map((Z)=>({key:YQ(Z.relativePath),input:Z.absolutePath,name:xQ(Z.relativePath),...jQ(Z.absolutePath)?{options:{storage:$}}:{}}))}function jQ(Q){return m(Q)==="possible"}function zQ(Q){for(let $=3;$<Q.length;$+=4)if(Q[$]!==255)return!0;return!1}async function FQ(Q){let $=Object.entries(Q).filter(([,J])=>J.fallback.format==="png"),Z=new Set,M=8;for(let J=0;J<$.length;J+=8)await Promise.all($.slice(J,J+8).map(async([X,G])=>{let Y=G.variants.filter((q)=>q.format==="png").sort((q,B)=>q.width-B.width)[0];try{let q=await $Q(new Uint8Array(await x.promises.readFile(Y?.path??G.fallback.path)));if(zQ(q.data))Z.add(X)}catch{Z.add(X)}}));return Z}function VQ(Q,$){let Z=[];for(let M of $){let J=Q[M],X=J?.variants.filter((Y)=>Y.format==="webp")??[];if(!J||X.length===0)continue;if(!X.some((Y)=>{let q;try{return q=x.openSync(Y.path,"r"),!P(T(q,0,32))}catch{return!0}finally{if(q!==void 0)x.closeSync(q)}}))continue;if(J.variants=J.variants.filter((Y)=>Y.format!=="webp"),delete J.sources.webp,Z.push(M),!c.has(M))c.add(M),console.warn(`[stx-images] ${M} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return Z}async function HQ(Q){let $=[],Z=8;for(let M=0;M<Q.length;M+=8){let J=Q.slice(M,M+8),X=await Promise.all(J.map(async(G)=>{try{return await JQ(G.absolutePath),G}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${G.relativePath}`),null}}));$.push(...X.filter((G)=>G!==null))}return $}function E(Q){return K.join(Q,"undecodable.json")}function NQ(Q){try{let $=x.readFileSync(E(Q),"utf-8"),Z=JSON.parse($);return Z&&typeof Z==="object"?Z:{}}catch{return{}}}function OQ(Q,$){try{x.mkdirSync(K.dirname(E(Q)),{recursive:!0}),x.writeFileSync(E(Q),JSON.stringify($))}catch{}}function d(Q){try{let $=x.statSync(Q);return{mtimeMs:$.mtimeMs,size:$.size}}catch{return}}function o(Q){if(!Q||Q.startsWith("data:")||Q.startsWith("blob:")||/^https?:\/\//i.test(Q)||Q.startsWith("//"))return;let $=Q.split(/[?#]/,1)[0];if(!$)return;try{return`/${$.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function vQ(Q){let $=o(Q);return $?U.get($):void 0}function gQ(Q){let $=o(Q);return $?_.has($):!1}function S(){U=new Map,_=new Set}function yQ(){return{entries:[...U],transparent:[..._]}}function WQ(Q){U=new Map(Q.entries),_=new Set(Q.transparent)}async function uQ(Q,$,Z={}){if(!Q||!x.existsSync(Q))return S(),{count:0,fingerprint:""};if(Z.offThread){let z=await u("delivery",{publicDir:Q,outputDir:$});if(z!==I)return WQ(z.state),z.result}let M=await l(Q);if(M.length===0)return S(),{count:0,fingerprint:""};let J=NQ($),X=M.filter((z)=>{let V=J[z.relativePath];if(!V)return!0;let F=d(z.absolutePath);return!F||F.mtimeMs!==V.mtimeMs||F.size!==V.size});if(X.length===0)return S(),{count:0,fingerprint:""};let G=h(K.join($,"_stx","images"),`${BQ}:${KQ()}`),Y={outDir:K.join($,"_stx","images"),storage:h(K.join($,"_stx","images")),baseUrl:L,widths:XQ,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},q=X,B;try{B=await f({...Y,entries:p(X,G)})}catch(z){if(q=await HQ(X),q.length===X.length)throw z;let V=new Set(q.map((H)=>H.relativePath)),F=!1;for(let H of X){if(V.has(H.relativePath))continue;let D=d(H.absolutePath);if(!D)continue;J[H.relativePath]=D,F=!0}if(F)OQ($,J);if(q.length===0)return S(),{count:0,fingerprint:""};B=await f({...Y,entries:p(q,G)})}let j=await FQ(B.entries),w=VQ(B.entries,j);U=new Map(Object.entries(B.entries)),_=j;let s=j.size===0&&w.length===0?B.fingerprint:n("sha256").update(B.fingerprint).update(JSON.stringify({transparent:[...j].sort(),droppedWebp:w.sort()})).digest("hex");return{count:q.length,fingerprint:s}}
3
- export{P as ot,m as pt,I as qt,u as rt,bQ as st,KQ as tt,vQ as ut,gQ as vt,S as wt,yQ as xt,WQ as yt,uQ as zt};
3
+ export{P as pt,m as qt,I as rt,u as st,bQ as tt,KQ as ut,vQ as vt,gQ as wt,S as xt,yQ as yt,WQ as zt,uQ as At};
@@ -144,4 +144,4 @@ var N=new Map,Q=new Map;function T(A){if(N.set(A.name,A),A.client)Q.set(A.name,A
144
144
  console.log('[stx] Directive runtime initialized');
145
145
  })();
146
146
  `}function $(A){let B=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return A.replace(B,(C,F,H,L,J)=>{let E=(L?L.split("."):[]).reduce((M,S)=>{return M[S]=!0,M},{});return`data-stx-directive="${F}:${J}" data-stx-directive-arg="${H||""}" data-stx-directive-modifiers='${JSON.stringify(E)}'`})}
147
- export{T as ss,V as ts,W as us,X as vs,G as ws,Y as xs,Z as ys,_ as zs,$ as As};
147
+ export{T as ts,V as us,W as vs,X as ws,G as xs,Y as ys,Z as zs,_ as As,$ as Bs};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import C from"path";var G=".stx",K="STX_DIR",J=null;function O(j){J=j?.trim()||null}function H(){return process.env[K]?.trim()||J||G}function Q(j=process.cwd(),...q){let B=H();return C.isAbsolute(B)?C.join(B,...q):C.join(j,B,...q)}function W(j){if(!j||C.isAbsolute(j))return j;let q=j.replace(/\\/g,"/");if(q!==G&&!q.startsWith(`${G}/`))return j;let B=q.slice(G.length+1);return B?C.join(H(),B):H()}
3
- export{G as it,K as jt,O as kt,H as lt,Q as mt,W as nt};
3
+ export{G as jt,K as kt,O as lt,H as mt,Q as nt,W as ot};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{mf as t,nf as u,of as v,pf as w,qf as x,rf as y,sf as z,tf as A,uf as B,vf as C,wf as D,xf as E}from"./chunk-1h1c2048.js";import{yf as r,zf as s}from"./chunk-a0ajg9z5.js";import{Af as b,Bf as c,Cf as d,Df as e,Ef as f,Ff as g,Gf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-3d3x7dwy.js";import{di as a}from"./chunk-g6czgcg4.js";import"./chunk-ay336sqb.js";import"./chunk-0s3ry262.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
2
+ import{mf as t,nf as u,of as v,pf as w,qf as x,rf as y,sf as z,tf as A,uf as B,vf as C,wf as D,xf as E}from"./chunk-msywnv5n.js";import{yf as r,zf as s}from"./chunk-b5hank5e.js";import{Af as b,Bf as c,Cf as d,Df as e,Ef as f,Ff as g,Gf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-7qp3zphs.js";import{di as a}from"./chunk-g6czgcg4.js";import"./chunk-xvh1k1a4.js";import"./chunk-ejqpq0wc.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fw as v$,Gw as G}from"./chunk-0s3ry262.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
2
+ import{Lw as v$,Mw as G}from"./chunk-ejqpq0wc.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
3
3
  `),L=E.join(U,"route-types.d.ts");try{if(W.existsSync(L)&&W.readFileSync(L,"utf8")===B)return;W.mkdirSync(U,{recursive:!0}),W.writeFileSync(L,B)}catch{}}function q($,U,O){let I=process.cwd(),B=E.relative(I,O),L=$.filter((V)=>!A(V.pattern)),K=["// Auto-generated by stx \u2014 do not edit",`// Source: ${B||"pages"}/`,"","export const routes = ["];for(let V of L){let J=E.relative(I,V.filePath).replace(/\\/g,"/"),X=JSON.stringify(V.params),Y=V.layout?`, layout: '${E.relative(I,V.layout).replace(/\\/g,"/")}'`:"";K.push(` { pattern: '${V.pattern}', filePath: '${J}', isDynamic: ${V.isDynamic}, params: ${X}${Y} },`)}K.push("] as const",""),K.push("export type RouteName = typeof routes[number]['pattern']",""),W.mkdirSync(U,{recursive:!0}),W.writeFileSync(E.join(U,"routes.ts"),K.join(`
4
4
  `))}var f=G(()=>{C()});import i from"path";function N($,U){let I=i.relative(U,$).replace(/\.(stx|md)$/,"");if(I=I.split(i.sep).join("/"),I==="index")return"/";if(I.endsWith("/index"))I=I.slice(0,-6);return I=I.replace(/\[\[([^\]]+)\]\]/g,":$1?"),I=I.replace(/\[([^\]]+)\]/g,":$1"),I=I.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${I}`}function j($){let U=[],O="",I=0;while(I<$.length){let B=$.slice(I),L=/^\/:([^/?*]+)\?/.exec(B);if(L){U.push(L[1]),O+="(?:/([^/]+))?",I+=L[0].length;continue}let K=/^:([^/?*]+)\*/.exec(B);if(K){U.push(K[1]),O+="(.+)",I+=K[0].length;continue}let V=/^:([^/?*]+)/.exec(B);if(V){U.push(V[1]),O+="([^/]+)",I+=V[0].length;continue}O+=$[I].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),I+=1}return{regex:new RegExp(`^${O}$`),params:U}}function o($,U){let O=$===""?"/":$;for(let I of U){let B=O.match(I.regex);if(B){let L={};return I.params.forEach((K,V)=>{L[K]=B[V+1]}),{route:I,params:L}}}return null}function r($){let U=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return j(U)}var g=()=>{};import b$ from"fs";import d from"path";function R($,U){let O=[],I=d.dirname($);while(I.startsWith(U)||I===U){let B=d.join(I,"_layout.stx");if(b$.existsSync(B))O.unshift(B);if(I===U)break;I=d.dirname(I)}return O}var m=()=>{};import S from"fs";import Q from"path";function t($,U){let O=[];if(!S.existsSync($))return O;let I=S.readdirSync($,{withFileTypes:!0});for(let B of I){let L=Q.join($,B.name);if(B.isDirectory()){if(B.name.startsWith("."))continue;if(F.includes(B.name))continue;O.push(...t(L,U))}else if(B.isFile()){let K=Q.extname(B.name);if(U.includes(K)){if(B.name.startsWith("_")&&B.name!=="_layout.stx")continue;if(B.name==="_layout.stx")continue;O.push(L)}}}return O}class b{routes;pagesDir;pagesDirs;config;constructor($,U={}){this.config=U;let O=U.pagesDirs&&U.pagesDirs.length>0?U.pagesDirs:[U.pagesDir||"pages"];this.pagesDirs=O.map((J)=>Q.resolve($,J)),this.pagesDir=this.pagesDirs[0];let I=U.extensions||[".stx"],B=(J)=>{let X=Q.resolve($,J);try{return S.realpathSync(X)}catch{return X}},L=(U.exclude??[]).filter((J)=>typeof J==="string"&&J.trim()!=="").map(B),K=(J)=>{if(L.length===0)return!1;let X=B(J);return L.some((Y)=>X===Y||X.startsWith(`${Y}${Q.sep}`))},V=new Set;this.routes=[];for(let J of this.pagesDirs){let X=t(J,I).filter((Z)=>!K(Z)),Y=new Map;for(let Z of X){let _=N(Z,J),z=U.pagesDirs?_.replace(/:[\w]+/g,":param"):_;if(U.pagesDirs&&Y.has(z))throw Error(`Conflicting layer pages for ${_}: ${Y.get(z)} and ${Z}`);if(Y.set(z,Z),V.has(z))continue;V.add(z);let{regex:S$,params:s}=j(_),D=U.layouts!==!1?R(Z,J):[];this.routes.push({pattern:_,regex:S$,params:s,filePath:Z,isDynamic:s.length>0,layout:D.length>0?D[D.length-1]:void 0})}}if(this.routes.sort((J,X)=>{if(!J.isDynamic&&X.isDynamic)return-1;if(J.isDynamic&&!X.isDynamic)return 1;let Y=J.pattern.split("/").length,Z=X.pattern.split("/").length;if(Y!==Z)return Z-Y;return J.pattern.localeCompare(X.pattern)}),U.emit!==!1){let J=Q.resolve($,U.stateDir||process.env.STX_DIR?.trim()||".stx");H(this.routes,J),q(this.routes,J,this.pagesDir)}}match($){let U=$===""?"/":$;for(let O of this.routes){let I=U.match(O.regex);if(I){let B={};return O.params.forEach((L,K)=>{B[L]=I[K+1]}),{route:O,params:B}}}return null}resolve($,U){let O=this.routes.find((B)=>B.pattern===$||B.filePath.includes($));if(!O)return"#not-found";let I=O.pattern;if(U)for(let[B,L]of Object.entries(U))I=I.replace(`:${B}`,encodeURIComponent(L));return I}addRoute($){this.routes.push($),this.routes.sort((U,O)=>{if(!U.isDynamic&&O.isDynamic)return-1;if(U.isDynamic&&!O.isDynamic)return 1;return U.pattern.localeCompare(O.pattern)})}getLayout($){return $.layout??null}}function a($,U){return new b($,U)}function e($,U){let O=[`${U}.stx`,"error.stx"];for(let I of O){let B=Q.join($,I);if(S.existsSync(B))return B}return null}function $$($,U){return $.map((O)=>{let I=Q.relative(U,O.filePath),B=O.isDynamic?" (dynamic)":"";return`${O.pattern} \u2192 ${I}${B}`})}var U$=G(()=>{f();g();m();C()});function I$($){x=$.replace(/\/$/,"")}function O$($,U,O={}){M[$]={path:U,name:$,params:O}}function B$($){for(let[U,O]of Object.entries($))if(typeof O==="string")M[U]={path:O,name:U};else M[U]={...O,name:U}}function J$($,U={},O=!1){let I=M[$];if(!I)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let B={...I.params,...U},L=I.path;L=L.replace(/:(\w+)/g,(V,J)=>{let X=B[J];if(X===void 0)return console.warn(`Missing parameter [${J}] for route [${$}].`),`:${J}`;return delete B[J],encodeURIComponent(String(X))});let K=Object.entries(B);if(K.length>0){let V=K.map(([J,X])=>`${encodeURIComponent(J)}=${encodeURIComponent(String(X))}`).join("&");L+=(L.includes("?")?"&":"?")+V}return O&&x?`${x}${L}`:L}function K$(){for(let $ of Object.keys(M))delete M[$];x=""}var M,x="";var L$=G(()=>{M={}});import V$ from"fs";import X$ from"path";function Y$($,U={}){return{type:"redirect",path:$,options:{replace:U.replace??!1,external:U.external??!1,redirectCode:U.redirectCode??302}}}function Z$($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function G$($,U={}){return{handler:$,mode:U.mode??"universal"}}function h($){let U={};if(!$)return U;let O=$.split(";");for(let I of O){let[B,...L]=I.split("=");if(B){let K=B.trim(),V=L.join("=").trim();if(K)U[K]=decodeURIComponent(V)}}return U}function k($,U,O={}){let I=`${encodeURIComponent($)}=${encodeURIComponent(U)}`;if(O.expires){let B=typeof O.expires==="number"?new Date(Date.now()+O.expires*1000):O.expires;I+=`; Expires=${B.toUTCString()}`}if(O.path)I+=`; Path=${O.path}`;if(O.domain)I+=`; Domain=${O.domain}`;if(O.secure)I+="; Secure";if(O.httpOnly)I+="; HttpOnly";if(O.sameSite)I+=`; SameSite=${O.sameSite}`;return I}function c($,U){let O=$.headers.get("cookie")||"",I=h(O);return{get(B){return I[B]},set(B,L,K={}){I[B]=L,U.append("Set-Cookie",k(B,L,K))},delete(B){delete I[B],U.append("Set-Cookie",k(B,"",{expires:new Date(0),path:"/"}))},getAll(){return{...I}}}}function l(){return{get($){if(typeof document>"u")return;return h(document.cookie)[$]},set($,U,O={}){if(typeof document>"u")return;document.cookie=k($,U,O)},delete($){if(typeof document>"u")return;document.cookie=k($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return h(document.cookie)}}}function u(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(U){if(!$)return null;try{return window.localStorage.getItem(U)}catch{return null}},set(U,O){if(!$)return;try{window.localStorage.setItem(U,O)}catch{}},remove(U){if(!$)return;try{window.localStorage.removeItem(U)}catch{}},isAvailable(){return $}}}function v($,U){T.set($,U)}function p($){return T.get($)}function Q$($){return T.has($)}function W$(){T.clear()}function M$(){return Array.from(T.keys())}async function _$($,U="middleware"){let O=X$.resolve($,U);if(!V$.existsSync(O))return;let I=V$.readdirSync(O);for(let B of I){if(!B.endsWith(".ts")&&!B.endsWith(".js"))continue;if(B.includes(".test.")||B.includes(".spec."))continue;let L=B.replace(/\.(ts|js)$/,""),K=X$.join(O,B);try{let J=(await import(K)).default;if(J&&typeof J.handler==="function")v(L,J);else if(typeof J==="function")v(L,{handler:J,mode:"universal"})}catch(V){console.warn(`Failed to load middleware '${L}' from ${K}:`,V)}}}function x$($){let U={};if(!$)return U;let O=new URLSearchParams($);for(let[I,B]of O)U[I]=B;return U}function z$($,U,O,I=""){return{path:$,params:U,query:x$(I),fullPath:I?`${$}?${I}`:$,meta:O}}function F$($,U,O,I){let B=I?.isServer??typeof window>"u",L=!B,K=new Headers;return{to:$,from:U,isClient:L,isServer:B,cookies:B&&O?c(O,K):l(),storage:u(),state:{},request:O,responseHeaders:K}}async function A$($,U){let O=Array.isArray($)?$:[$],I=U.isServer;for(let B of O){let L=p(B);if(!L)return console.error(`Route middleware '${B}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${B}' is not registered`}},state:U.state,responseHeaders:U.responseHeaders};if(L.mode==="server"&&!I)continue;try{let K=await L.handler(U);if(K){if(K.type==="redirect")return{passed:!1,redirect:K,state:U.state,responseHeaders:U.responseHeaders};if(K.type==="abort")return{passed:!1,abort:K,state:U.state,responseHeaders:U.responseHeaders}}}catch(K){return console.error(`Error in middleware '${B}':`,K),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:K instanceof Error?K.message:"Middleware error"}},state:U.state,responseHeaders:U.responseHeaders}}}return{passed:!0,state:U.state,responseHeaders:U.responseHeaders}}var T;var E$=G(()=>{T=new Map});function n($){let O=$.replace(/\\/g,"/").split("/").filter(Boolean),I=O.lastIndexOf("layouts"),B=I>=0?O[I+1]:O.at(-1);if(!B)return"app";return B.replace(/\.stx$/i,"")||"app"}function j$($){let U=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),O=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),I=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),B=U?.[1]||I?.[1]||"";return{layout:B,group:O?.[1]||n(B)}}var T$=()=>{};function k$($){let U=[],O="log(",I=0;while(I<$.length){let B=$.indexOf("log(",I);if(B===-1){U.push($.slice(I));break}let L=B>0?$[B-1]:" ",K=/\bfunction\s+$/.test($.slice(Math.max(0,B-16),B));if(/[\w$.]/.test(L)||K){U.push($.slice(I,B+4)),I=B+4;continue}U.push($.slice(I,B));let V=1,J=B+4;while(J<$.length&&V>0){let X=$[J];if(X==='"'||X==="'"||X==="`"){let Y=X;J++;while(J<$.length&&$[J]!==Y){if($[J]==="\\")J++;J++}J++;continue}if(X==="(")V++;else if(X===")")V--;J++}U.push("0"),I=J}return U.join("")}function C$($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function H$(){return`
5
5
  ;(function(){
@@ -2251,4 +2251,4 @@ else {
2251
2251
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
2252
2252
  })();
2253
2253
  `}function q$(){if(w)return w;return w=C$(k$(H$())),w}function N$(){if(P)return P;return P=C$(H$()),P}var w,P;var R$=()=>{};var w$={};v$(w$,{setAppUrl:()=>I$,runMiddleware:()=>A$,route:()=>J$,resolveLayoutChain:()=>R,resetRoutes:()=>K$,registerMiddleware:()=>v,patternToRegex:()=>j,navigateTo:()=>Y$,matchRoute:()=>o,loadMiddlewareFromDirectory:()=>_$,isNonPageRoutePattern:()=>A,isNonPageRoutePath:()=>y,hasMiddleware:()=>Q$,getRouterScriptDev:()=>N$,getRouterScript:()=>q$,getMiddlewareNames:()=>M$,getMiddleware:()=>p,generateRouteTypes:()=>H,generateRouteManifest:()=>q,formatRoutes:()=>$$,findErrorPage:()=>e,filePathToPattern:()=>N,extractLayoutMetadata:()=>j$,deriveLayoutGroup:()=>n,defineRoutes:()=>B$,defineRoute:()=>O$,defineMiddleware:()=>G$,createStorageManager:()=>u,createServerCookieManager:()=>c,createRouter:()=>a,createRouteLocation:()=>z$,createMiddlewareContext:()=>F$,createClientCookieManager:()=>l,clearMiddleware:()=>W$,bracketPathToRegex:()=>r,abortNavigation:()=>Z$,Router:()=>b,NON_PAGE_DIRS:()=>F});var P$=G(()=>{U$();g();L$();E$();m();T$();f();C();R$()});
2254
- export{F as Lv,y as Mv,A as Nv,H as Ov,q as Pv,N as Qv,j as Rv,o as Sv,r as Tv,R as Uv,b as Vv,a as Wv,e as Xv,$$ as Yv,I$ as Zv,O$ as _v,B$ as $v,J$ as aw,K$ as bw,Y$ as cw,Z$ as dw,G$ as ew,c as fw,l as gw,u as hw,v as iw,p as jw,Q$ as kw,W$ as lw,M$ as mw,_$ as nw,z$ as ow,F$ as pw,A$ as qw,n as rw,j$ as sw,T$ as tw,q$ as uw,N$ as vw,w$ as ww,P$ as xw};
2254
+ export{F as Rv,y as Sv,A as Tv,H as Uv,q as Vv,N as Wv,j as Xv,o as Yv,r as Zv,R as _v,b as $v,a as aw,e as bw,$$ as cw,I$ as dw,O$ as ew,B$ as fw,J$ as gw,K$ as hw,Y$ as iw,Z$ as jw,G$ as kw,c as lw,l as mw,u as nw,v as ow,p as pw,Q$ as qw,W$ as rw,M$ as sw,_$ as tw,z$ as uw,F$ as vw,A$ as ww,n as xw,j$ as yw,T$ as zw,q$ as Aw,N$ as Bw,w$ as Cw,P$ as Dw};