@stacksjs/stx 0.2.876 → 0.2.881

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 (278) hide show
  1. package/dist/{chunk-h17pfbng.js → chunk-002zrse4.js} +2 -2
  2. package/dist/{chunk-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
  3. package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
  4. package/dist/chunk-08cb7cyw.js +2 -0
  5. package/dist/chunk-0h1dyd38.js +2 -0
  6. package/dist/chunk-1jk46ve0.js +2 -0
  7. package/dist/chunk-1z6rrqvm.js +2 -0
  8. package/dist/{chunk-w8k9fz1w.js → chunk-1zkymrw0.js} +7 -7
  9. package/dist/chunk-2cvwjtjh.js +16 -0
  10. package/dist/{chunk-k0t9ye9j.js → chunk-2gg3vjks.js} +126 -71
  11. package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
  12. package/dist/{chunk-3922g6sh.js → chunk-345waetq.js} +9 -9
  13. package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
  14. package/dist/{chunk-cvbwxskc.js → chunk-45jpwbzd.js} +5 -5
  15. package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
  16. package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
  17. package/dist/chunk-4frh1qg5.js +2 -0
  18. package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
  19. package/dist/chunk-4pjqj54a.js +2 -0
  20. package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
  21. package/dist/chunk-51qyxm0y.js +2 -0
  22. package/dist/chunk-53cc06w7.js +2 -0
  23. package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
  24. package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
  25. package/dist/chunk-5hrx1p6g.js +2 -0
  26. package/dist/chunk-5mwzea5d.js +2 -0
  27. package/dist/chunk-5rd0an89.js +2 -0
  28. package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
  29. package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
  30. package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
  31. package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
  32. package/dist/chunk-78zgmqhd.js +2 -0
  33. package/dist/chunk-7kqgp3p7.js +2 -0
  34. package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
  35. package/dist/chunk-86nsbxep.js +61 -0
  36. package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
  37. package/dist/chunk-8h5nje66.js +2 -0
  38. package/dist/chunk-8nqyyj1h.js +33 -0
  39. package/dist/chunk-8qr3cmpb.js +2 -0
  40. package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
  41. package/dist/chunk-909tgpxp.js +2 -0
  42. package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
  43. package/dist/chunk-95j7y1rt.js +2 -0
  44. package/dist/chunk-97kgrevs.js +4 -0
  45. package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
  46. package/dist/chunk-9fvjr9dd.js +4 -0
  47. package/dist/chunk-9kza7gxd.js +2 -0
  48. package/dist/chunk-9yx7cbhz.js +25 -0
  49. package/dist/{chunk-nn6hvsxp.js → chunk-9zj3xztb.js} +2 -2
  50. package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
  51. package/dist/chunk-a60ztvnp.js +3 -0
  52. package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
  53. package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
  54. package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
  55. package/dist/chunk-aqxh80vh.js +2 -0
  56. package/dist/chunk-asv4b65m.js +12 -0
  57. package/dist/chunk-axra1yas.js +2 -0
  58. package/dist/chunk-bhc25n2n.js +2 -0
  59. package/dist/chunk-brp8np3t.js +2 -0
  60. package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
  61. package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
  62. package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
  63. package/dist/chunk-cv1vm1w0.js +2 -0
  64. package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
  65. package/dist/{chunk-vnkvnenn.js → chunk-czzehcxs.js} +7 -7
  66. package/dist/chunk-d7b30bg6.js +2 -0
  67. package/dist/{chunk-cj44e8mw.js → chunk-d8qt6hjg.js} +5 -5
  68. package/dist/chunk-dfbbkjz6.js +3 -0
  69. package/dist/chunk-dv0cpmat.js +2 -0
  70. package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
  71. package/dist/chunk-dze7f9vv.js +2 -0
  72. package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
  73. package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
  74. package/dist/chunk-ekdhjm8p.js +54 -0
  75. package/dist/chunk-etavf6mr.js +2 -0
  76. package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
  77. package/dist/chunk-f3j1h3ch.js +2 -0
  78. package/dist/chunk-f6ac0gbe.js +2 -0
  79. package/dist/chunk-fwhr3jda.js +2 -0
  80. package/dist/chunk-fxhgj8tp.js +2 -0
  81. package/dist/chunk-fz4c5e9m.js +2 -0
  82. package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
  83. package/dist/chunk-g5q0wgzk.js +2 -0
  84. package/dist/{chunk-j0rqa9bk.js → chunk-gad3ebgr.js} +5 -5
  85. package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
  86. package/dist/{chunk-df6vjs3p.js → chunk-gmbw1xhm.js} +5 -5
  87. package/dist/chunk-gmp10259.js +2 -0
  88. package/dist/chunk-gs6geqeg.js +2 -0
  89. package/dist/chunk-h26mpqrh.js +2 -0
  90. package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
  91. package/dist/chunk-h3fv0q25.js +2 -0
  92. package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
  93. package/dist/{chunk-g15reb1h.js → chunk-hnxwqamj.js} +8 -8
  94. package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
  95. package/dist/{chunk-6kp4mg3h.js → chunk-jc74097x.js} +2 -2
  96. package/dist/chunk-jghpzx5m.js +2 -0
  97. package/dist/{chunk-fh72k2ks.js → chunk-jqvc2wbz.js} +6 -6
  98. package/dist/chunk-k52126rh.js +2 -0
  99. package/dist/chunk-k7ffxfgp.js +3 -0
  100. package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
  101. package/dist/chunk-kyh32kma.js +20 -0
  102. package/dist/{chunk-2tcyfrvb.js → chunk-m91jj8nq.js} +2 -2
  103. package/dist/chunk-my3yv4sg.js +2 -0
  104. package/dist/chunk-nb6erf75.js +9 -0
  105. package/dist/chunk-ndqq991c.js +26 -0
  106. package/dist/chunk-ngzyzcrp.js +2 -0
  107. package/dist/chunk-nj1ssjtd.js +2 -0
  108. package/dist/chunk-njza56wn.js +1198 -0
  109. package/dist/{chunk-ttjscvre.js → chunk-nnynrb97.js} +3 -3
  110. package/dist/chunk-p6hcrg3r.js +3 -0
  111. package/dist/chunk-pa2vt2ej.js +2 -0
  112. package/dist/chunk-pa6kgbmw.js +2 -0
  113. package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
  114. package/dist/chunk-pjjrx9pk.js +2 -0
  115. package/dist/{chunk-mkwavsb3.js → chunk-pm27mcfp.js} +3 -3
  116. package/dist/chunk-pstbfz5g.js +2 -0
  117. package/dist/chunk-pt3rp3zg.js +2 -0
  118. package/dist/chunk-pw9qqcw3.js +2 -0
  119. package/dist/chunk-q1jjgg4w.js +2 -0
  120. package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
  121. package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
  122. package/dist/chunk-qg1kw5yf.js +2 -0
  123. package/dist/chunk-r32ddrvn.js +21 -0
  124. package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
  125. package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
  126. package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
  127. package/dist/chunk-rw5sxr5a.js +2 -0
  128. package/dist/chunk-s29hp1qw.js +14 -0
  129. package/dist/chunk-s7xywsqd.js +3 -0
  130. package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
  131. package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
  132. package/dist/{chunk-zgds9nwv.js → chunk-smkerejj.js} +44 -44
  133. package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
  134. package/dist/{chunk-7rep2jqh.js → chunk-sq6werer.js} +23 -23
  135. package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
  136. package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
  137. package/dist/chunk-t8r40wgf.js +2 -0
  138. package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
  139. package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
  140. package/dist/chunk-v5cah9pt.js +2 -0
  141. package/dist/chunk-v8ea76j6.js +2 -0
  142. package/dist/chunk-vxw92h3q.js +2 -0
  143. package/dist/{chunk-ctjxcaxq.js → chunk-w53p65hy.js} +66 -66
  144. package/dist/chunk-w5zzwe2f.js +2 -0
  145. package/dist/chunk-wbmx0rge.js +2 -0
  146. package/dist/chunk-wfthd3n5.js +2 -0
  147. package/dist/chunk-wjafpvjv.js +2 -0
  148. package/dist/chunk-ws2h92mm.js +3 -0
  149. package/dist/chunk-xf6snj8e.js +38 -0
  150. package/dist/chunk-xfhxfcvk.js +2 -0
  151. package/dist/chunk-xhr35ctb.js +2 -0
  152. package/dist/chunk-xmmr0916.js +2 -0
  153. package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
  154. package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
  155. package/dist/{chunk-x4jzhgdm.js → chunk-yffqfgjx.js} +2 -2
  156. package/dist/chunk-yh2hnt3m.js +12 -0
  157. package/dist/{chunk-2mt2zc5y.js → chunk-ym0cdk7m.js} +10 -10
  158. package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
  159. package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
  160. package/dist/{chunk-fwbccyhw.js → chunk-ypsf5y5g.js} +2 -2
  161. package/dist/chunk-z7k1xn6k.js +2 -0
  162. package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
  163. package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
  164. package/dist/cli.js +23 -23
  165. package/dist/client/signals-dom-ready-runtime.js +6 -0
  166. package/dist/client/signals-mount-runtime.js +1 -1
  167. package/dist/client-module-registry.js +10 -4
  168. package/dist/client-parameter-bindings.d.ts +5 -0
  169. package/dist/client-parameter-bindings.js +47 -6
  170. package/dist/client-script-bundler.js +4 -3
  171. package/dist/component-library.d.ts +1 -0
  172. package/dist/component-library.js +42 -14
  173. package/dist/composable-loader.js +19 -9
  174. package/dist/craft-entry.js +2 -2
  175. package/dist/craft.js +2 -2
  176. package/dist/dev-server/ts-css.js +3 -3
  177. package/dist/html-masking.d.ts +2 -0
  178. package/dist/html-masking.js +10 -0
  179. package/dist/inherited-context.d.ts +1 -1
  180. package/dist/inherited-context.js +43 -14
  181. package/dist/module-syntax.d.ts +2 -0
  182. package/dist/module-syntax.js +21 -0
  183. package/dist/native-component-context.js +42 -16
  184. package/dist/page-module-order.d.ts +10 -0
  185. package/dist/page-module-order.js +139 -0
  186. package/dist/process.js +6 -4
  187. package/dist/pwa.js +3 -3
  188. package/dist/script-attributes.d.ts +4 -0
  189. package/dist/script-attributes.js +10 -0
  190. package/dist/ssg.js +39 -39
  191. package/dist/strip-literals.d.ts +2 -0
  192. package/dist/strip-literals.js +12 -6
  193. package/dist/stx-virtual-ts.d.ts +1 -0
  194. package/dist/stx-virtual-ts.js +21 -27
  195. package/dist/typecheck.js +8 -0
  196. package/package.json +5 -5
  197. package/dist/chunk-027meh1k.js +0 -2
  198. package/dist/chunk-0hs633pt.js +0 -2
  199. package/dist/chunk-0j8zre1m.js +0 -2
  200. package/dist/chunk-0v02qms8.js +0 -2
  201. package/dist/chunk-0z9gttw0.js +0 -2
  202. package/dist/chunk-11dwmcpy.js +0 -3
  203. package/dist/chunk-1a237qky.js +0 -33
  204. package/dist/chunk-1ehjzhnc.js +0 -25
  205. package/dist/chunk-1gfg6qmr.js +0 -2
  206. package/dist/chunk-1kgnk6ds.js +0 -2
  207. package/dist/chunk-1ztp5vkh.js +0 -3
  208. package/dist/chunk-32wvc376.js +0 -2
  209. package/dist/chunk-3k2d2jsn.js +0 -2
  210. package/dist/chunk-3te2y9qf.js +0 -2
  211. package/dist/chunk-40330tm5.js +0 -2
  212. package/dist/chunk-447jc6zc.js +0 -2
  213. package/dist/chunk-4dk6k0ad.js +0 -2
  214. package/dist/chunk-4e48zkq0.js +0 -2
  215. package/dist/chunk-5ep7p8te.js +0 -2
  216. package/dist/chunk-5gx403te.js +0 -1184
  217. package/dist/chunk-6q9a5bph.js +0 -2
  218. package/dist/chunk-7ds9mx4c.js +0 -2
  219. package/dist/chunk-7njy024g.js +0 -2
  220. package/dist/chunk-7tjewwmd.js +0 -2
  221. package/dist/chunk-85xabvtj.js +0 -2
  222. package/dist/chunk-880f8j99.js +0 -2
  223. package/dist/chunk-8f3dbthj.js +0 -2
  224. package/dist/chunk-99e3mxnn.js +0 -20
  225. package/dist/chunk-9gv847nn.js +0 -2
  226. package/dist/chunk-9mz2n39m.js +0 -2
  227. package/dist/chunk-akthsg33.js +0 -54
  228. package/dist/chunk-b1tcym2x.js +0 -2
  229. package/dist/chunk-bdh73gxd.js +0 -4
  230. package/dist/chunk-bspj1rf1.js +0 -2
  231. package/dist/chunk-bx3hpsxn.js +0 -2
  232. package/dist/chunk-byq488g4.js +0 -2
  233. package/dist/chunk-c4s25bm2.js +0 -2
  234. package/dist/chunk-csjqtzwc.js +0 -2
  235. package/dist/chunk-df78j74w.js +0 -4
  236. package/dist/chunk-dgs3d367.js +0 -2
  237. package/dist/chunk-dmf6zcf4.js +0 -2
  238. package/dist/chunk-dv56x3g8.js +0 -16
  239. package/dist/chunk-e2b2f502.js +0 -2
  240. package/dist/chunk-ec6mrad6.js +0 -2
  241. package/dist/chunk-eecctzgp.js +0 -17
  242. package/dist/chunk-fa57bncd.js +0 -2
  243. package/dist/chunk-g4eheg0t.js +0 -24
  244. package/dist/chunk-gfe1jrw9.js +0 -2
  245. package/dist/chunk-gn16yq49.js +0 -2
  246. package/dist/chunk-gvs61tqn.js +0 -2
  247. package/dist/chunk-h2928108.js +0 -2
  248. package/dist/chunk-hat353vx.js +0 -2
  249. package/dist/chunk-jmjgj3nh.js +0 -2
  250. package/dist/chunk-jqtpzzz4.js +0 -12
  251. package/dist/chunk-jvy7z3hz.js +0 -3
  252. package/dist/chunk-k9dne5by.js +0 -12
  253. package/dist/chunk-kq8mffgf.js +0 -2
  254. package/dist/chunk-kx06jzdw.js +0 -2
  255. package/dist/chunk-n5pvdrkb.js +0 -2
  256. package/dist/chunk-ne8q191s.js +0 -2
  257. package/dist/chunk-np8wgbsa.js +0 -3
  258. package/dist/chunk-nthw4dca.js +0 -2
  259. package/dist/chunk-pp99rmjm.js +0 -72
  260. package/dist/chunk-pqmjeea6.js +0 -2
  261. package/dist/chunk-qggwr60r.js +0 -2
  262. package/dist/chunk-qm3v4qb7.js +0 -2
  263. package/dist/chunk-qty0t69x.js +0 -2
  264. package/dist/chunk-rjv6885r.js +0 -2
  265. package/dist/chunk-rm5gbthk.js +0 -2
  266. package/dist/chunk-sgengtap.js +0 -2
  267. package/dist/chunk-snz2cxqv.js +0 -2
  268. package/dist/chunk-szp7ajfm.js +0 -33
  269. package/dist/chunk-ts37jw3s.js +0 -2
  270. package/dist/chunk-v4emesnw.js +0 -2
  271. package/dist/chunk-vnrbjbrw.js +0 -3
  272. package/dist/chunk-vxra53wq.js +0 -2
  273. package/dist/chunk-x76qvq1n.js +0 -2
  274. package/dist/chunk-x85z6dmw.js +0 -2
  275. package/dist/chunk-xkfe03y9.js +0 -2
  276. package/dist/chunk-y4hn1qh0.js +0 -2
  277. package/dist/chunk-yc8ggeh2.js +0 -2
  278. package/dist/chunk-yfed67yc.js +0 -2
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function gi(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
- `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function mi(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
- `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),X=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function $t(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&X.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function be(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function vr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Ds(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return be(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class xr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:G,params:P}=be(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:G,params:P,filePath:h,isDynamic:P.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");gi(this.routes,s),mi(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ms(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Ls(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function cg(e){k=e.replace(/\/$/,"")}function lg(e,t,a={}){f[e]={path:t,name:e,params:a}}function ug(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Sr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function dg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function pg(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function fg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function gg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Fc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function zc(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Hc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function hi(e,t){v.set(e,t)}function Vc(e){return v.get(e)}function mg(e){return v.has(e)}function Rt(){v.clear()}function At(){return Array.from(v.keys())}async function Pt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")hi(o,s);else if(typeof s==="function")hi(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function It(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Ot(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Fc(a,i):zc(),storage:Hc(),state:{},request:a,responseHeaders:i}}async function Nt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Vc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function js(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function it(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||js(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
2
+ import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function xi(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Si(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
+ `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Nt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ve(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Cr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function zs(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ve(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Er{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=ve(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");xi(this.routes,s),Si(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Hs(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Vs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function bg(e){k=e.replace(/\/$/,"")}function wg(e,t,a={}){f[e]={path:t,name:e,params:a}}function vg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Tr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function xg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function Sg(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function kg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function _g(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Gc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Xc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Jc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ki(e,t){v.set(e,t)}function Yc(e){return v.get(e)}function Cg(e){return v.has(e)}function Mt(){v.clear()}function Dt(){return Array.from(v.keys())}async function Lt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ki(o,s);else if(typeof s==="function")ki(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function jt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Bt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Gc(a,i):Xc(),storage:Jc(),state:{},request:a,responseHeaders:i}}async function Ft(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Yc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Us(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function dt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Us(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=8;
@@ -349,11 +349,13 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
349
349
  // with no animation) until they all have, capped so it can never hang.
350
350
  var scriptsPending=0;
351
351
  var hydrateWaiters=[];
352
- window.__stxScriptRan=function(){
352
+ var moduleCompletions={},moduleCompletionId=0;
353
+ window.__stxScriptRan=function(token){
354
+ if(token&&moduleCompletions[token]){var done=moduleCompletions[token];delete moduleCompletions[token];done();}
353
355
  if(scriptsPending>0)scriptsPending--;
354
356
  if(!scriptsPending){var w=hydrateWaiters;hydrateWaiters=[];w.forEach(function(f){f()})}
355
357
  };
356
- function markRan(code){scriptsPending++;return code+String.fromCharCode(10)+';window.__stxScriptRan&&window.__stxScriptRan();'}
358
+ function markRan(code,complete){scriptsPending++;var token=complete?'module-'+(++moduleCompletionId):'';if(complete)moduleCompletions[token]=complete;return code+String.fromCharCode(10)+';window.__stxScriptRan&&window.__stxScriptRan('+(token?JSON.stringify(token):'')+');'}
357
359
  function whenHydrated(capMs){
358
360
  return new Promise(function(resolve){
359
361
  var done=false;
@@ -1066,7 +1068,7 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
1066
1068
  var el=source;
1067
1069
  if(typeof source==='string')el=new DOMParser().parseFromString('<scr'+'ipt '+source+'></scr'+'ipt>','text/html').querySelector('script');
1068
1070
  var attrs={};
1069
- if(el)['src','type','integrity','crossorigin','referrerpolicy','nonce','nomodule','defer','fetchpriority','blocking'].forEach(function(name){
1071
+ if(el)['src','type','integrity','crossorigin','referrerpolicy','nonce','nomodule','defer','fetchpriority','blocking','data-stx-module-job'].forEach(function(name){
1070
1072
  if(el.hasAttribute(name))attrs[name]=name==='nonce'?(el.nonce||el.getAttribute(name)||''):(el.getAttribute(name)||'');
1071
1073
  });
1072
1074
  return attrs;
@@ -1107,6 +1109,25 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
1107
1109
  // Waits for the files a swap loads, then runs its scripts -- or, when one
1108
1110
  // of them was a module bundle that did not load, recovers the page instead
1109
1111
  // of running a setup that can only throw.
1112
+ // Classic entries stay synchronous. Once an ESM entry starts, execute the
1113
+ // rest only after its load event (which includes top-level await) completes.
1114
+ function runPageScriptEntries(entries,execute,complete,ctx){
1115
+ function current(){return !ctx||!ctx.id||ctx.id===navSeq}
1116
+ function run(entry){if(current())return execute(entry)}
1117
+ var pending=null;
1118
+ entries.forEach(function(entry){
1119
+ if(pending)pending=pending.then(function(){return run(entry)});
1120
+ else {var result=run(entry);if(result)pending=Promise.resolve(result)}
1121
+ });
1122
+ function finish(){
1123
+ if(!current())return;
1124
+ var ready=window.__stxPageModulesReady;
1125
+ if(ready){window.__stxPageModulesReady=null;return ready.then(function(){if(current())complete()},function(error){console.error('[router] page initialization failed',error)})}
1126
+ complete();
1127
+ }
1128
+ if(pending)return pending.then(finish,function(error){console.error('[router] page module failed',error)});
1129
+ return finish();
1130
+ }
1110
1131
  function afterExternalScripts(pending,run,url,ctx){
1111
1132
  if(!pending.length){run();return}
1112
1133
  var failed=false;
@@ -1819,7 +1840,7 @@ else {
1819
1840
  // incoming page's scripts register next (see beginSwap in the runtime).
1820
1841
  // Called after the outgoing page is put aside and before any incoming
1821
1842
  // script runs. Absent on an older runtime, which drains as it always has.
1822
- function beginPageSwap(){if(window.stx&&typeof window.stx._beginSwap==='function')window.stx._beginSwap()}
1843
+ function beginPageSwap(){window.__stxPageModulesReady=null;if(window.stx&&typeof window.stx._beginSwap==='function')window.stx._beginSwap()}
1823
1844
  function swap(html,url,pushState,hash){
1824
1845
  var fragMark=/^<!--stx-fragment(?: rt=([01]))?-->/.exec(html);
1825
1846
  var isFragment=!!fragMark;
@@ -1892,7 +1913,7 @@ else {
1892
1913
  var ownerDecl=(attrs.match(/data-stx-owner\\s*=\\s*["']([^"']+)["']/i)||[])[1]||'';
1893
1914
  var registry=/(?:^|\\s)data-stx-modules(?:\\s|=|$)/i.test(attrs)||REGISTRY_TEXT.test(code);
1894
1915
  var composables=/(?:^|\\s)data-stx-(?:framework-)?composables(?:\\s|=|$)/i.test(attrs)||COMPOSABLES_TEXT.test(code);
1895
- fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry,composables:composables});
1916
+ fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry,composables:composables,module:scriptType==='module',moduleJob:externalAttrs['data-stx-module-job']||''});
1896
1917
  // Retain scoped setup code in its inert placeholder. A placeholder
1897
1918
  // inside template.content is unreachable through document, so the
1898
1919
  // repeated component runtime must execute it for each clone.
@@ -1900,6 +1921,7 @@ else {
1900
1921
  +(scoped?' data-stx-scoped':'')
1901
1922
  +(runDecl?' data-stx-run="'+runDecl.toLowerCase()+'"':'')
1902
1923
  +(ownerDecl?' data-stx-owner="'+ownerDecl+'"':'')
1924
+ +(externalAttrs['data-stx-module-job']?' data-stx-module-job="'+externalAttrs['data-stx-module-job']+'"':'')
1903
1925
  +'>'+code+'<\\/scr'+'ipt>';
1904
1926
  }
1905
1927
  return '';
@@ -1987,7 +2009,7 @@ else {
1987
2009
  function fragOrder(entry){return entry.registry?0:entry.composables?1:entry.setupName?3:2}
1988
2010
  fragScripts.sort(function(a,b){return fragOrder(a)-fragOrder(b)});
1989
2011
  function runFragScripts(){
1990
- fragScripts.forEach(function(entry){
2012
+ return runPageScriptEntries(fragScripts,function(entry){
1991
2013
  var code=entry.text;
1992
2014
  log('[router] exec script len:', code.length, 'has __stx_setup:', code.indexOf('__stx_setup')>-1);
1993
2015
  if(branchSlots&&branchSlots[entry.slot]){
@@ -2033,11 +2055,14 @@ else {
2033
2055
  }
2034
2056
  executedScriptHashes[h]=1;
2035
2057
  var ns=ce('script');
2036
- var hasImport=hasStaticImport(code);
2058
+ var hasImport=entry.module||hasStaticImport(code);
2037
2059
  if(hasImport){
2038
2060
  ns.type='module';
2039
2061
  }
2040
- ns.textContent=markRan((hasImport||isAlreadyScoped)?code:'{'+code+'}');
2062
+ var moduleDone;
2063
+ var modulePending=hasImport?new Promise(function(resolve,reject){moduleDone=resolve;ns.onerror=reject}):null;
2064
+ if(entry.moduleJob)ns.setAttribute('data-stx-module-job',entry.moduleJob);
2065
+ ns.textContent=markRan((hasImport||isAlreadyScoped)?code:'{'+code+'}',moduleDone);
2041
2066
  ns.setAttribute('data-stx-page','');
2042
2067
  if(placeholder&&placeholder.parentNode){
2043
2068
  ns.setAttribute('data-stx-positioned','');
@@ -2045,7 +2070,8 @@ else {
2045
2070
  }else{
2046
2071
  document.body.appendChild(ns);
2047
2072
  }
2048
- });
2073
+ return modulePending;
2074
+ },function(){
2049
2075
  // Guarded: the router ships on every page, the signals runtime only on
2050
2076
  // pages that have a client script. log() is debug-gated but its
2051
2077
  // ARGUMENTS are evaluated at the call site regardless, so an unguarded
@@ -2054,6 +2080,7 @@ else {
2054
2080
  log('[router] scripts done. _latestSetup:', !!(window.stx&&window.stx._latestSetup));
2055
2081
  // THEN fire stx:load \u2014 now _latestSetup is set and processElement has the right scope
2056
2082
  window.dispatchEvent(new Event('stx:load'));
2083
+ },ctx);
2057
2084
  }
2058
2085
  // The container's own files first, for the same reason as the
2059
2086
  // full-document path: the inline scripts call into them. Only awaited
@@ -2280,7 +2307,7 @@ else {
2280
2307
  var slot='document-'+(++routedBodyScriptId);
2281
2308
  var setupName=generatedSetupName(text);
2282
2309
  if(setupName)incomingSetupName=setupName;
2283
- routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||'',registry:isModuleRegistryScript(s),composables:isComposablesScript(s)});
2310
+ routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||'',registry:isModuleRegistryScript(s),composables:isComposablesScript(s),module:type==='module',moduleJob:s.getAttribute('data-stx-module-job')||''});
2284
2311
  s.textContent='';
2285
2312
  s.setAttribute('type','application/stx-pending');
2286
2313
  s.setAttribute('data-stx-route-script',slot);
@@ -2356,8 +2383,8 @@ else {
2356
2383
  qsa('script[data-stx-page]').forEach(function(s){s.remove()});
2357
2384
 
2358
2385
  var scripts=routedBodyScripts.slice();
2359
- function addScript(text, runAlways, slot, owner){
2360
- scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||'',registry:REGISTRY_TEXT.test(text),composables:COMPOSABLES_TEXT.test(text)});
2386
+ function addScript(text, runAlways, slot, owner, module, moduleJob, registry, composables){
2387
+ scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||'',registry:!!registry||REGISTRY_TEXT.test(text),composables:!!composables||COMPOSABLES_TEXT.test(text),module:!!module,moduleJob:moduleJob||''});
2361
2388
  }
2362
2389
  if(isLayoutChange){
2363
2390
  // Also collect setup functions from <head>, and the page's module
@@ -2373,7 +2400,7 @@ else {
2373
2400
  if(s.hasAttribute('src'))return;
2374
2401
  if(!text.trim())return;
2375
2402
  if(isSignalsRuntimeScript(s,text))return;
2376
- if(isModuleRegistryScript(s)||isComposablesScript(s))addScript(text,true,'','');
2403
+ if(isModuleRegistryScript(s)||isComposablesScript(s))addScript(text,true,'','',s.type==='module',s.getAttribute('data-stx-module-job'),isModuleRegistryScript(s),isComposablesScript(s));
2377
2404
  else if(text.indexOf('__stx_setup_')!==-1)addScript(text,true);
2378
2405
  });
2379
2406
  } else {
@@ -2382,7 +2409,7 @@ else {
2382
2409
  // in <head>. Without this, SPA navigation on static sites never
2383
2410
  // runs the setup and reactive data stays empty.
2384
2411
  var seenSetups={};
2385
- scripts.forEach(function(entry){var t=entry.text;if(t.indexOf('__stx_setup_')!==-1)seenSetups[t.substring(0,80)]=1});
2412
+ scripts.forEach(function(entry){var t=entry.text;if(t.indexOf('__stx_setup_')!==-1)seenSetups[t]=1});
2386
2413
  doc.querySelectorAll('script').forEach(function(s){
2387
2414
  var text=s.textContent||'';
2388
2415
  if(s.hasAttribute('src'))return;
@@ -2404,12 +2431,12 @@ else {
2404
2431
  // incoming page's content (#1958). Fragments leave these out.
2405
2432
  if(s.hasAttribute('data-stx-instance'))return;
2406
2433
  if(text.indexOf('__stx_setup_')===-1&&!s.hasAttribute('data-stx-scoped')&&!s.hasAttribute('data-stx-page')&&!s.hasAttribute('data-stx-route-params'))return;
2407
- var key=text.substring(0,80);
2434
+ var key=text;
2408
2435
  if(seenSetups[key])return;
2409
2436
  seenSetups[key]=1;
2410
2437
  // A layout component outside the container carries its owner, so
2411
2438
  // execScripts skips it when it stayed on the page (#1958).
2412
- addScript(text,true,'',s.getAttribute('data-stx-owner')||'');
2439
+ addScript(text,true,'',s.getAttribute('data-stx-owner')||'',s.type==='module',s.getAttribute('data-stx-module-job'),isModuleRegistryScript(s),isComposablesScript(s));
2413
2440
  });
2414
2441
  }
2415
2442
  // Component setup scripts also assign window.stx._latestSetup. Run the
@@ -2492,7 +2519,7 @@ else {
2492
2519
  // onMount -- HQ's calendar wrote ?athlete_id into /relax. Fragments
2493
2520
  // never hit this only because the server prepends the same clear.
2494
2521
  if(window.stx)window.stx._latestSetup=null;
2495
- scripts.forEach(function(entry){
2522
+ return runPageScriptEntries(scripts,function(entry){
2496
2523
  var text=typeof entry==='string'?entry:entry.text;
2497
2524
  var runAlways=typeof entry==='string'?false:entry.runAlways;
2498
2525
  if(typeof entry!=='string'&&ownerStays(entry.owner))return;
@@ -2504,7 +2531,7 @@ else {
2504
2531
  // need special handling.
2505
2532
  var h=hashScript(text);
2506
2533
  var isSetup=text.indexOf('__stx_setup_')!==-1;
2507
- var hasImport=hasStaticImport(text);
2534
+ var hasImport=entry.module||hasStaticImport(text);
2508
2535
  if(!runAlways&&!isSetup&&executedScriptHashes[h])return;
2509
2536
  executedScriptHashes[h]=1;
2510
2537
  // Wrap scripts with import statements as modules (Bug 3 fix)
@@ -2519,7 +2546,10 @@ else {
2519
2546
  // ESM, and top-level 'import' is illegal inside a block, which
2520
2547
  // would throw SyntaxError before the script ever runs.
2521
2548
  var alreadyScoped=runsAlways(typeof entry==='string'?'':entry.run,text);
2522
- ns.textContent=markRan((hasImport||alreadyScoped)?text:'{'+text+republishTopLevel(text)+'}');
2549
+ var moduleDone;
2550
+ var modulePending=hasImport?new Promise(function(resolve,reject){moduleDone=resolve;ns.onerror=reject}):null;
2551
+ if(entry.moduleJob)ns.setAttribute('data-stx-module-job',entry.moduleJob);
2552
+ ns.textContent=markRan((hasImport||alreadyScoped)?text:'{'+text+republishTopLevel(text)+'}',moduleDone);
2523
2553
  ns.setAttribute('data-stx-page','');
2524
2554
  var placeholder=entry.slot?qs('script[data-stx-route-script="'+entry.slot+'"]'):null;
2525
2555
  if(placeholder&&placeholder.parentNode){
@@ -2528,9 +2558,11 @@ else {
2528
2558
  }else{
2529
2559
  document.body.appendChild(ns);
2530
2560
  }
2531
- });
2561
+ return modulePending;
2562
+ },function(){
2532
2563
  // THEN fire stx:load \u2014 now _latestSetup is set and processElement has the right scope
2533
2564
  window.dispatchEvent(new Event('stx:load'));
2565
+ },ctx);
2534
2566
  }
2535
2567
 
2536
2568
  afterExternalScripts(extPromises,execScripts,url+(hash||''),ctx);
@@ -2779,9 +2811,9 @@ else {
2779
2811
  // reach the other.
2780
2812
  var retagSeq=0;
2781
2813
  function retagCollisions(html){
2782
- var ids={},any=false;
2783
- html.replace(/data-stx-scope="([^"]+)"/g,function(m,id){ids[id]=1;any=true;return m});
2784
- if(!any)return;
2814
+ var ids={},found=false;
2815
+ html.replace(/data-stx-scope="([^"]+)"/g,function(m,id){ids[id]=1;found=true;return m});
2816
+ if(!found)return;
2785
2817
  var scopes=window.stx&&window.stx._scopes;
2786
2818
  eachEntry(function(e){
2787
2819
  if(!e.el)return;
@@ -4184,4 +4216,4 @@ else {
4184
4216
 
4185
4217
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
4186
4218
  })();
4187
- `}function at(){if(A)return A;return A=U(W(H()),!0),A}function hg(){if(C)return C;return C=U(H()),C}export{gi,mi,$t,be,vr,Ds,xr,Ms,Ls,cg,lg,ug,Sr,dg,pg,fg,gg,Fc,zc,Hc,hi,Vc,mg,Rt,At,Pt,It,Ot,Nt,js,it,at,hg};
4219
+ `}function pt(){if(A)return A;return A=U(W(H()),!0),A}function Eg(){if(C)return C;return C=U(H()),C}export{xi,Si,Nt,ve,Cr,zs,Er,Hs,Vs,bg,wg,vg,Tr,xg,Sg,kg,_g,Gc,Xc,Jc,ki,Yc,Cg,Mt,Dt,Lt,jt,Bt,Ft,Us,dt,pt,Eg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{M,jn}from"./chunk-hxhmhw23.js";export{jn as stripModuleImports,M as transformStoreImports};
@@ -0,0 +1,12 @@
1
+ // @bun
2
+ import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import"./chunk-s29hp1qw.js";import"./chunk-a60ztvnp.js";import{S,_,A,oe}from"./chunk-njza56wn.js";import"./chunk-86nsbxep.js";import"./chunk-6t04tqvh.js";import"./chunk-yffqfgjx.js";import{br}from"./chunk-7mcs59pr.js";import{existsSync as C}from"fs";import l from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var u=new Map,h=S(64),w=new Set,v=0,E=new Set(b);function z(){u.clear(),h.clear()}function R(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function P(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function I(s){if(!s)return[];let o=_(s,v),t=h.get(o);if(t)return t.slice();let i=s.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let a of E){if(w.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function M(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(C(l.join(s,`index.${o}`)))return s;let t=br("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=I(s);if(t.length===0)return null;let i=o??M();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=oe({loader:"ts",target:"browser",define:A()}),k=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=R(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>k.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
3
+ ${p.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${l.basename(n)} could not be bundled:`,c)}}let x=t.filter((n)=>!d.has(n)&&!P(s,n));if(x.length>0)console.warn(`[stx] could not bundle ${x.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return u.set(r,""),null;let O=[...d].map((n)=>` try { if (!(${JSON.stringify(n)} in __s)) { __s[${JSON.stringify(n)}] = ${n}; if (!(${JSON.stringify(n)} in window)) window[${JSON.stringify(n)}] = ${n}; } } catch (e) {}`).join(`
4
+ `),y=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
+ ;(function(){
6
+ var __s = window.stx = window.stx || {};
7
+ ${m.join(`
8
+
9
+ `)}
10
+ ${O}
11
+ })();
12
+ </script>`;return u.set(r,y),y}function q(s){w.clear();for(let o of s)w.add(o);v++}export{q as __setRuntimeOwnedForTest,z as clearFrameworkComposableCache,V as getFrameworkComposableScript,I as referencedFrameworkComposables,R as selectComposableFiles};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zm,Qm,eh,th,nh,rh,sh}from"./chunk-8va3fs07.js";export{Qm as createKeepAliveCache,th as generateKeepAliveCSS,nh as generateKeepAliveRuntime,rh as onActivated,sh as onDeactivated,Zm as processKeepAliveDirectives,eh as shouldCacheComponent};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Yr,So,gm,Zl,ko}from"./chunk-r32ddrvn.js";import"./chunk-nb6erf75.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";export{gm as buildModuleRegistryScript,ko as buildSharedModuleRegistries,Zl as exportsMutableBinding,Yr as registeredModuleIdsIn,So as registeredModuleNamesIn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Sm}from"./chunk-ypsf5y5g.js";import"./chunk-w53p65hy.js";import"./chunk-nnynrb97.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Sm as buildApp};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),b=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function w(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,r=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,t;while((t=p.exec(o))!==null){let e=t[1]==="/",n=t[2],a=t[3]==="/";if(f.has(n.toLowerCase()))continue;if(a)continue;if(e)r.set(n,(r.get(n)??0)+1);else{let g=s.get(n);if(g)g.count++;else{let d=o.slice(0,t.index).split(`
3
- `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function Ko(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
- export{Ko};
3
+ `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function ei(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
+ export{ei};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function $o(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function zn(i={}){$o(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
- export{$o,zn};
2
+ function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function Mo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function qn(i={}){Mo(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
+ export{Mo,qn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function V(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function rt(n,i){let e=V(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
3
- export{V,rt};
2
+ var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function U(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function ct(n,i){let e=U(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
3
+ export{U,ct};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tu,vm}from"./chunk-94ctmp0j.js";export{tu as captureScreenshot,vm as captureScreenshots};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ie,ae,ce,Hn,Se,Ne,vt,tn,Vn,Un,Wn,le,qn,Kn}from"./chunk-k1ew643q.js";import{Tt}from"./chunk-w6pzkcjp.js";function ql(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ce,placeholder:l="none",formats:f=ae,widths:y=ie,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Un(r),v=Vn(r),w=typeof m==="object"?tn(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=vt(z),Y=le(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
2
+ import{ce,le,ue,Kn,_e,Be,Et,cn,Gn,Xn,Jn,de,Yn,Zn}from"./chunk-q74affc4.js";import{Ot}from"./chunk-ymqm898x.js";function nu(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ue,placeholder:l="none",formats:f=le,widths:y=ce,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Xn(r),v=Gn(r),w=typeof m==="object"?cn(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=Et(z),Y=de(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
3
3
  #${k} {
4
4
  position: relative;
5
5
  background-image: url('${e.placeholder}');
@@ -23,14 +23,14 @@ ${M.join(`
23
23
  src="${v?.url||t}"
24
24
  alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
25
25
  />
26
- </picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=le(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Q,preloadLink:V,placeholderCss:T}}function K(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function Z(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ce,formats:u=ae,widths:l=ie,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?tn(a):a,C=`
26
+ </picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=de(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Q,preloadLink:V,placeholderCss:T}}function K(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function Z(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ue,formats:u=le,widths:l=ce,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?cn(a):a,C=`
27
27
  data-stx-image
28
28
  data-src="${r}"
29
29
  data-sizes="${R}"
30
30
  data-quality="${o}"
31
31
  data-formats="${u.join(",")}"
32
32
  data-widths="${l.join(",")}"
33
- `.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function ba(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Kl(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=ba(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D=new Map;function Gl(){D.clear()}async function G(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Ne(s,r);return D.set(e,t),t}catch{return null}}function wa(){return Tt({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=X(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:ie),formats:a.formats||ae,quality:a.quality||ce,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await Se())return q(t,n||"",a);let o=await G(t,i);if(!o)return q(t,n||"",a);return te(o,n||"",a)}})}function X(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ee(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ee(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function te(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=vt(p),w=le(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
33
+ `.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function Ea(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function ru(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=Ea(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D=new Map;function su(){D.clear()}async function G(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Be(s,r);return D.set(e,t),t}catch{return null}}function Ta(){return Ot({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=X(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:ce),formats:a.formats||le,quality:a.quality||ue,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await _e())return q(t,n||"",a);let o=await G(t,i);if(!o)return q(t,n||"",a);return te(o,n||"",a)}})}function X(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ee(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ee(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function te(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=Et(p),w=de(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
34
34
  `;if(d+=l.join(`
35
35
  `)+`
36
36
  `,d+=` <img ${c.join(" ")} />
@@ -38,6 +38,6 @@ ${M.join(`
38
38
  ${d}
39
39
  </div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
40
40
  ${d}
41
- </div>`}}if(e.priority&&y){let g=le(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
- `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Xl=wa();import P from"fs";import j from"path";function Jl(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=ae,widths:a=ie,quality:i=ce,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await Se()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Hn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=se(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ne(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await Se())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>re(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Ne(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=qn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Kn(c.stats.savedBytes)}`)}}}function se(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function re(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ne(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Wn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Yl(s,r,e={}){if(!await Se())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Ne(s,{...e,outputDir:r})}async function Zl(s,r,e={}){let{formats:t=ae,widths:n=ie,quality:a=ce,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await Se())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Ne(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function va(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Ql(s,r){let e=va(s);await Bun.write(r,JSON.stringify(e,null,2))}var ym={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
- export{ql,ba,Kl,Gl,wa,Xl,Jl,Yl,Zl,va,Ql,ym};
41
+ </div>`}}if(e.priority&&y){let g=de(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
+ `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var ou=Ta();import P from"fs";import j from"path";function iu(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=le,widths:a=ce,quality:i=ue,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await _e()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Kn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=se(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ae(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await _e())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>re(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Be(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Yn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Zn(c.stats.savedBytes)}`)}}}function se(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function re(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ae(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Jn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function au(s,r,e={}){if(!await _e())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Be(s,{...e,outputDir:r})}async function cu(s,r,e={}){let{formats:t=le,widths:n=ce,quality:a=ue,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await _e())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Be(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function $a(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function lu(s,r){let e=$a(s);await Bun.write(r,JSON.stringify(e,null,2))}var Em={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
+ export{nu,Ea,ru,su,Ta,ou,iu,au,cu,$a,lu,Em};