@stacksjs/stx 0.2.413 → 0.2.414

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 (345) hide show
  1. package/dist/appearance-bootstrap.js +1 -1
  2. package/dist/binding-manifest.d.ts +1 -1
  3. package/dist/bundle-analyzer.js +20 -20
  4. package/dist/chunk-020xyn9q.js +3 -0
  5. package/dist/chunk-04jhmfbz.js +2 -0
  6. package/dist/chunk-10957mcb.js +2 -0
  7. package/dist/chunk-1098mas0.js +2 -0
  8. package/dist/chunk-169n1vpx.js +12 -0
  9. package/dist/chunk-1b6t12hd.js +2 -0
  10. package/dist/chunk-1chw8xsw.js +2 -0
  11. package/dist/chunk-1xdzcy9d.js +14 -0
  12. package/dist/chunk-2ce7f416.js +2 -0
  13. package/dist/chunk-2gr351s0.js +7 -0
  14. package/dist/chunk-2mkcjw08.js +2 -0
  15. package/dist/chunk-2v8wztd5.js +2 -0
  16. package/dist/chunk-340a824p.js +2 -0
  17. package/dist/chunk-39g1134q.js +2 -0
  18. package/dist/chunk-3c74vag1.js +2 -0
  19. package/dist/chunk-3kthfs03.js +3 -0
  20. package/dist/chunk-3qn1wcdg.js +2 -0
  21. package/dist/chunk-3s2vnqcf.js +2 -0
  22. package/dist/chunk-48bwk47q.js +2 -0
  23. package/dist/chunk-4bjravgk.js +2 -0
  24. package/dist/chunk-4jjme6a5.js +2 -0
  25. package/dist/chunk-5g3y8kym.js +2 -0
  26. package/dist/chunk-5gsxpaqk.js +2 -0
  27. package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
  28. package/dist/chunk-69mc2np8.js +2785 -0
  29. package/dist/chunk-6cfa3g0r.js +2 -0
  30. package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
  31. package/dist/chunk-6hc5vz20.js +3 -0
  32. package/dist/chunk-6q6g76vg.js +499 -0
  33. package/dist/{chunk-bwjxk1dw.js → chunk-6sgswrqw.js} +29 -29
  34. package/dist/chunk-6y8hnymb.js +2 -0
  35. package/dist/chunk-74j18qk0.js +930 -0
  36. package/dist/chunk-752hw7cd.js +4 -0
  37. package/dist/{chunk-kgd8kchy.js → chunk-765e1s44.js} +11 -76
  38. package/dist/chunk-7gkv67ky.js +4 -0
  39. package/dist/chunk-7z2ra0yf.js +2 -0
  40. package/dist/chunk-866n724v.js +2 -0
  41. package/dist/chunk-8nhshfz6.js +5 -0
  42. package/dist/chunk-92ps1xpk.js +2 -0
  43. package/dist/chunk-9g27ybyr.js +3 -0
  44. package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
  45. package/dist/{chunk-24zher49.js → chunk-9vrja6vp.js} +4 -4
  46. package/dist/chunk-9xrbve19.js +2 -0
  47. package/dist/chunk-a688m6js.js +3 -0
  48. package/dist/chunk-afhxw2t8.js +2 -0
  49. package/dist/chunk-ak1cgcah.js +5 -0
  50. package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
  51. package/dist/chunk-apg16xcn.js +2 -0
  52. package/dist/chunk-b52s5z0c.js +2 -0
  53. package/dist/chunk-b84h16er.js +61 -0
  54. package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
  55. package/dist/chunk-bmt7w2pk.js +2 -0
  56. package/dist/chunk-btmhj5t7.js +2 -0
  57. package/dist/chunk-ce1sejr3.js +3 -0
  58. package/dist/chunk-cg8hg6cs.js +3 -0
  59. package/dist/{chunk-4f9zyfdw.js → chunk-czxt605c.js} +4 -5
  60. package/dist/chunk-d44b9ktb.js +4 -0
  61. package/dist/chunk-daz5aqcf.js +24 -0
  62. package/dist/chunk-dgdm3hy3.js +2 -0
  63. package/dist/chunk-dvgv8nry.js +11 -0
  64. package/dist/chunk-dx7n22ed.js +2 -0
  65. package/dist/chunk-e57rhf65.js +3 -0
  66. package/dist/chunk-eed4fwps.js +3 -0
  67. package/dist/chunk-ej9j6k1q.js +3 -0
  68. package/dist/chunk-et0rr8c7.js +3 -0
  69. package/dist/chunk-f46qsp4m.js +4 -0
  70. package/dist/chunk-f6az0xj5.js +2 -0
  71. package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
  72. package/dist/chunk-fjs0a8h7.js +2 -0
  73. package/dist/chunk-fr2txj8q.js +829 -0
  74. package/dist/{chunk-xssw417m.js → chunk-ft4p6d28.js} +14 -14
  75. package/dist/chunk-fyzajkrx.js +2 -0
  76. package/dist/chunk-fzapbw9p.js +3 -0
  77. package/dist/chunk-g578mcb0.js +194 -0
  78. package/dist/chunk-gawrg4gb.js +216 -0
  79. package/dist/chunk-gw07qmjk.js +2 -0
  80. package/dist/chunk-h0atqq82.js +32 -0
  81. package/dist/chunk-h6zsqb9r.js +3 -0
  82. package/dist/{chunk-2snqdnk9.js → chunk-h85hrwkq.js} +13 -13
  83. package/dist/chunk-hbxz85wy.js +2 -0
  84. package/dist/chunk-hjg3ndgh.js +2 -0
  85. package/dist/chunk-hkxsewzk.js +2 -0
  86. package/dist/chunk-hrbbbtbn.js +2 -0
  87. package/dist/chunk-j03revz2.js +8 -0
  88. package/dist/chunk-j9qcrwbg.js +2 -0
  89. package/dist/chunk-jk4njz0w.js +2 -0
  90. package/dist/chunk-jmabeqfq.js +2 -0
  91. package/dist/chunk-jt0n43mk.js +2 -0
  92. package/dist/chunk-kjbv8a3m.js +2 -0
  93. package/dist/chunk-m1vdghnx.js +2 -0
  94. package/dist/chunk-m4sk62wb.js +5 -0
  95. package/dist/chunk-md8rqn48.js +30 -0
  96. package/dist/chunk-mepdnezf.js +17 -0
  97. package/dist/chunk-mhq0pjws.js +2 -0
  98. package/dist/chunk-mp6hy8g4.js +2 -0
  99. package/dist/chunk-ngc2wke4.js +3 -0
  100. package/dist/chunk-nn2vstke.js +2 -0
  101. package/dist/chunk-p2v2a68k.js +2 -0
  102. package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
  103. package/dist/chunk-pdt69hpb.js +2 -0
  104. package/dist/chunk-pgzvyrv6.js +29 -0
  105. package/dist/chunk-pj1wg7jg.js +2 -0
  106. package/dist/chunk-pqxzp1bb.js +3 -0
  107. package/dist/chunk-px7fvbj6.js +3 -0
  108. package/dist/chunk-q4c06e8x.js +20 -0
  109. package/dist/chunk-q6vrb2pe.js +2 -0
  110. package/dist/chunk-q7qchkvk.js +2 -0
  111. package/dist/chunk-q9bdh4s5.js +8 -0
  112. package/dist/chunk-qet5gc6s.js +2033 -0
  113. package/dist/chunk-qz519eyp.js +2 -0
  114. package/dist/chunk-r3f9jcf7.js +5 -0
  115. package/dist/chunk-rs4v4fha.js +4 -0
  116. package/dist/chunk-s2x4wcrz.js +2 -0
  117. package/dist/chunk-s5xezjps.js +3 -0
  118. package/dist/chunk-scezfp0w.js +30 -0
  119. package/dist/chunk-sd321bn3.js +2 -0
  120. package/dist/{chunk-smcj3442.js → chunk-sd47dzs0.js} +79 -79
  121. package/dist/chunk-se7mwqd1.js +2 -0
  122. package/dist/chunk-shr559s7.js +3 -0
  123. package/dist/chunk-syaw6b75.js +2 -0
  124. package/dist/chunk-t4hzprsm.js +3 -0
  125. package/dist/{chunk-pv3d7sfn.js → chunk-t61vdbje.js} +89 -89
  126. package/dist/chunk-tfexmdkt.js +3 -0
  127. package/dist/chunk-thyt8ed8.js +6 -0
  128. package/dist/chunk-v091jft4.js +12 -0
  129. package/dist/chunk-v4vaqxrf.js +33 -0
  130. package/dist/chunk-vgvtnwxa.js +4 -0
  131. package/dist/chunk-x0q32ees.js +3 -0
  132. package/dist/chunk-x5bpeb4a.js +2 -0
  133. package/dist/chunk-x72tv2cg.js +3 -0
  134. package/dist/chunk-xfp7k0v8.js +64 -0
  135. package/dist/chunk-xtdw3692.js +6 -0
  136. package/dist/chunk-y1cmjvk3.js +43 -0
  137. package/dist/chunk-y5310237.js +311 -0
  138. package/dist/chunk-ya0qecph.js +27 -0
  139. package/dist/chunk-yazk54jr.js +8 -0
  140. package/dist/chunk-ydjfar14.js +2 -0
  141. package/dist/chunk-ym95v4nc.js +3 -0
  142. package/dist/chunk-ynvdvbat.js +18 -0
  143. package/dist/chunk-yvx1ap9b.js +3 -0
  144. package/dist/chunk-z0g9jvv0.js +40 -0
  145. package/dist/chunk-z6d0jmjb.js +2 -0
  146. package/dist/{chunk-8sdhs0zk.js → chunk-zhxdpzga.js} +4 -4
  147. package/dist/cli.js +110 -110
  148. package/dist/craft-entry.js +7 -7
  149. package/dist/craft.js +7 -7
  150. package/dist/database.js +2 -2
  151. package/dist/image-optimization/component.js +4 -4
  152. package/dist/media/image/component.js +5 -5
  153. package/dist/media/protected/component.js +2 -2
  154. package/dist/media/video/index.js +4 -4
  155. package/dist/native/bridge/protocol.d.ts +325 -0
  156. package/dist/native/bridge/protocol.js +219 -0
  157. package/dist/native/cli.d.ts +24 -0
  158. package/dist/native/cli.js +52 -0
  159. package/dist/native/compiler/bundle.d.ts +41 -0
  160. package/dist/native/compiler/bundle.js +90 -0
  161. package/dist/native/compiler/client-script.d.ts +8 -0
  162. package/dist/native/compiler/client-script.js +31 -0
  163. package/dist/native/compiler/codegen.d.ts +10 -0
  164. package/dist/native/compiler/codegen.js +145 -0
  165. package/dist/native/compiler/headwind-to-style.d.ts +395 -0
  166. package/dist/native/compiler/headwind-to-style.js +1163 -0
  167. package/dist/native/compiler/html-to-ir.d.ts +41 -0
  168. package/dist/native/compiler/html-to-ir.js +411 -0
  169. package/dist/native/compiler/icons.d.ts +220 -0
  170. package/dist/native/compiler/icons.js +208 -0
  171. package/dist/native/compiler/ir.d.ts +234 -0
  172. package/dist/native/compiler/ir.js +15 -0
  173. package/dist/native/compiler/parser.d.ts +88 -0
  174. package/dist/native/compiler/parser.js +753 -0
  175. package/dist/native/compiler/render-screen.d.ts +26 -0
  176. package/dist/native/compiler/render-screen.js +31 -0
  177. package/dist/native/components/primitives.d.ts +291 -0
  178. package/dist/native/components/primitives.js +22 -0
  179. package/dist/native/hot-reload/client.d.ts +62 -0
  180. package/dist/native/hot-reload/client.js +324 -0
  181. package/dist/native/index.d.ts +90 -0
  182. package/dist/native/index.js +34 -0
  183. package/dist/native/primitives/ActivityIndicator.stx +5 -0
  184. package/dist/native/primitives/Button.stx +5 -0
  185. package/dist/native/primitives/DatePicker.stx +5 -0
  186. package/dist/native/primitives/FlatList.stx +5 -0
  187. package/dist/native/primitives/Image.stx +5 -0
  188. package/dist/native/primitives/ImageBackground.stx +5 -0
  189. package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
  190. package/dist/native/primitives/Modal.stx +5 -0
  191. package/dist/native/primitives/Picker.stx +5 -0
  192. package/dist/native/primitives/Pressable.stx +5 -0
  193. package/dist/native/primitives/RefreshControl.stx +5 -0
  194. package/dist/native/primitives/SafeAreaView.stx +5 -0
  195. package/dist/native/primitives/ScrollView.stx +5 -0
  196. package/dist/native/primitives/SectionList.stx +5 -0
  197. package/dist/native/primitives/Slider.stx +5 -0
  198. package/dist/native/primitives/StatusBar.stx +5 -0
  199. package/dist/native/primitives/Switch.stx +5 -0
  200. package/dist/native/primitives/Text.stx +5 -0
  201. package/dist/native/primitives/TextInput.stx +5 -0
  202. package/dist/native/primitives/TouchableHighlight.stx +5 -0
  203. package/dist/native/primitives/TouchableOpacity.stx +5 -0
  204. package/dist/native/primitives/View.stx +5 -0
  205. package/dist/native/runtime/craft.d.ts +75 -0
  206. package/dist/native/runtime/craft.js +0 -0
  207. package/dist/native/runtime/entry.d.ts +1 -0
  208. package/dist/native/runtime/entry.js +3 -0
  209. package/dist/native/runtime/index.d.ts +45 -0
  210. package/dist/native/runtime/index.js +165 -0
  211. package/dist/native/runtime/native-host.d.ts +33 -0
  212. package/dist/native/runtime/native-host.js +184 -0
  213. package/dist/native/runtime/screen.d.ts +43 -0
  214. package/dist/native/runtime/screen.js +808 -0
  215. package/dist/pwa/service-worker.js +1 -1
  216. package/dist/pwa/workbox.js +1 -1
  217. package/dist/pwa.js +8 -8
  218. package/dist/site-url.d.ts +1 -1
  219. package/dist/ssg.js +53 -53
  220. package/dist/visual-testing.js +42 -42
  221. package/dist/web-components/reactive-generator.js +2 -2
  222. package/package.json +9 -5
  223. package/dist/chunk-0btmm4m2.js +0 -147
  224. package/dist/chunk-0c2h69k2.js +0 -4
  225. package/dist/chunk-0d0qeqvv.js +0 -2
  226. package/dist/chunk-0psndabd.js +0 -2
  227. package/dist/chunk-0qv8yf53.js +0 -2
  228. package/dist/chunk-0vkxyvsd.js +0 -2
  229. package/dist/chunk-0we9nw1d.js +0 -3
  230. package/dist/chunk-0xqdmemy.js +0 -3
  231. package/dist/chunk-0y46fbkx.js +0 -3
  232. package/dist/chunk-158wqccn.js +0 -4422
  233. package/dist/chunk-1cyxbb8y.js +0 -16
  234. package/dist/chunk-1enwnh2a.js +0 -2
  235. package/dist/chunk-213pzm0d.js +0 -3
  236. package/dist/chunk-21hzqyja.js +0 -12
  237. package/dist/chunk-266t58b8.js +0 -5
  238. package/dist/chunk-27fgag95.js +0 -4
  239. package/dist/chunk-2a9n102n.js +0 -2
  240. package/dist/chunk-2eqzrczk.js +0 -2
  241. package/dist/chunk-2ke37m54.js +0 -14
  242. package/dist/chunk-35ds08e7.js +0 -3
  243. package/dist/chunk-3mtwkjcg.js +0 -2
  244. package/dist/chunk-4xr8zwkp.js +0 -2
  245. package/dist/chunk-58v77x2c.js +0 -2
  246. package/dist/chunk-5mhq8605.js +0 -2
  247. package/dist/chunk-5se8xt9e.js +0 -64
  248. package/dist/chunk-5zh0h080.js +0 -2
  249. package/dist/chunk-62435225.js +0 -2
  250. package/dist/chunk-6kdrncsx.js +0 -30
  251. package/dist/chunk-6n2rr3x7.js +0 -2
  252. package/dist/chunk-6xk87qf2.js +0 -30
  253. package/dist/chunk-72rwcbp6.js +0 -3
  254. package/dist/chunk-76w34xne.js +0 -3
  255. package/dist/chunk-7ekd7zj9.js +0 -2
  256. package/dist/chunk-7pr3wdd5.js +0 -3
  257. package/dist/chunk-7rxvafwc.js +0 -24
  258. package/dist/chunk-7tnwfa7w.js +0 -8
  259. package/dist/chunk-8c5je0wf.js +0 -2
  260. package/dist/chunk-8dz6nyvx.js +0 -2
  261. package/dist/chunk-98zj3fv2.js +0 -7
  262. package/dist/chunk-9e8t0twa.js +0 -3
  263. package/dist/chunk-9fqp72ze.js +0 -5
  264. package/dist/chunk-anydpa34.js +0 -3
  265. package/dist/chunk-ay6zjq8v.js +0 -3
  266. package/dist/chunk-az4v4ard.js +0 -3
  267. package/dist/chunk-ba5erggg.js +0 -2
  268. package/dist/chunk-bnagrdz6.js +0 -2
  269. package/dist/chunk-by8wghtf.js +0 -2
  270. package/dist/chunk-cd7h4q51.js +0 -2
  271. package/dist/chunk-cjmv8hgp.js +0 -33
  272. package/dist/chunk-cthf912y.js +0 -2
  273. package/dist/chunk-cxbpmwq5.js +0 -4
  274. package/dist/chunk-d3sy16qn.js +0 -2
  275. package/dist/chunk-dh6s7mrj.js +0 -1199
  276. package/dist/chunk-dm2nzg7a.js +0 -2
  277. package/dist/chunk-e2sgcnxc.js +0 -2
  278. package/dist/chunk-e3b7jj74.js +0 -2
  279. package/dist/chunk-ec4wq2sv.js +0 -6
  280. package/dist/chunk-ekzg97dn.js +0 -29
  281. package/dist/chunk-epjt342x.js +0 -2
  282. package/dist/chunk-eqe26g14.js +0 -18
  283. package/dist/chunk-ev0v1yma.js +0 -2
  284. package/dist/chunk-f53psr2y.js +0 -5
  285. package/dist/chunk-f8p69dsg.js +0 -3
  286. package/dist/chunk-f95drhdb.js +0 -194
  287. package/dist/chunk-ff5a6hvb.js +0 -17
  288. package/dist/chunk-fs5fy4h8.js +0 -2
  289. package/dist/chunk-fzsygce3.js +0 -2
  290. package/dist/chunk-g465x63k.js +0 -2
  291. package/dist/chunk-g708ekh1.js +0 -2
  292. package/dist/chunk-gcr9e83g.js +0 -11
  293. package/dist/chunk-gdmyrsr8.js +0 -4
  294. package/dist/chunk-gkms2ngq.js +0 -2
  295. package/dist/chunk-gnfywmgs.js +0 -7
  296. package/dist/chunk-hpf8kq7e.js +0 -2
  297. package/dist/chunk-j4x3faf8.js +0 -2
  298. package/dist/chunk-jkavtw9f.js +0 -2
  299. package/dist/chunk-kg1rdena.js +0 -3
  300. package/dist/chunk-km91wx0v.js +0 -2
  301. package/dist/chunk-kmsyvaex.js +0 -8
  302. package/dist/chunk-mrahwn5v.js +0 -8
  303. package/dist/chunk-nk3czvnk.js +0 -2
  304. package/dist/chunk-nmw4eewb.js +0 -2
  305. package/dist/chunk-nq5zxrk0.js +0 -4
  306. package/dist/chunk-ny67c03k.js +0 -3
  307. package/dist/chunk-p4wdxp2c.js +0 -2
  308. package/dist/chunk-pcxp4r9n.js +0 -3
  309. package/dist/chunk-pdyeaxc1.js +0 -2
  310. package/dist/chunk-pf06ded4.js +0 -2
  311. package/dist/chunk-pfs0gpzm.js +0 -2
  312. package/dist/chunk-pshdwq44.js +0 -2
  313. package/dist/chunk-pwgv84pn.js +0 -32
  314. package/dist/chunk-pwsnafp3.js +0 -4367
  315. package/dist/chunk-q9n5swx7.js +0 -3
  316. package/dist/chunk-qr346wnp.js +0 -2
  317. package/dist/chunk-r02hke04.js +0 -2
  318. package/dist/chunk-ranshpyc.js +0 -3
  319. package/dist/chunk-rn194bhp.js +0 -20
  320. package/dist/chunk-rn1hgyc8.js +0 -930
  321. package/dist/chunk-s7z5dp70.js +0 -43
  322. package/dist/chunk-s8jd13nb.js +0 -3
  323. package/dist/chunk-sn7exv0n.js +0 -2
  324. package/dist/chunk-t1tdjjht.js +0 -216
  325. package/dist/chunk-t6qx04s8.js +0 -499
  326. package/dist/chunk-t6y6gyps.js +0 -2
  327. package/dist/chunk-tjfs7cc3.js +0 -2
  328. package/dist/chunk-tkyrk66a.js +0 -3
  329. package/dist/chunk-tntv9hvq.js +0 -2
  330. package/dist/chunk-v3nwkveg.js +0 -12
  331. package/dist/chunk-vd4cb5xr.js +0 -2
  332. package/dist/chunk-vkhdce50.js +0 -2
  333. package/dist/chunk-w183av08.js +0 -2
  334. package/dist/chunk-w2m02njv.js +0 -2
  335. package/dist/chunk-wpjrcrs5.js +0 -2
  336. package/dist/chunk-wqmppf6b.js +0 -3
  337. package/dist/chunk-wtb9fxdy.js +0 -2
  338. package/dist/chunk-xmzygmcz.js +0 -3
  339. package/dist/chunk-xsng1mtq.js +0 -3
  340. package/dist/chunk-xxzefj4j.js +0 -2
  341. package/dist/chunk-yq8x8bxq.js +0 -47
  342. package/dist/chunk-ytma76qe.js +0 -3
  343. package/dist/chunk-yw1m115e.js +0 -2
  344. package/dist/chunk-z64a924m.js +0 -2
  345. package/dist/chunk-zcz9rs6p.js +0 -3
@@ -1,21 +1,21 @@
1
1
  // @bun
2
- function L(b,j={}){return{enterFrom:j.enterClass||`${b}-enter-from`,enterActive:j.enterActiveClass||`${b}-enter-active`,enterTo:j.enterToClass||`${b}-enter-to`,leaveFrom:j.leaveClass||`${b}-leave-from`,leaveActive:j.leaveActiveClass||`${b}-leave-active`,leaveTo:j.leaveToClass||`${b}-leave-to`}}function Q(b){let j=getComputedStyle(b),B=j.transitionDuration||"0s",q=j.animationDuration||"0s",A=(z)=>{let F=z.match(/^([\d.]+)(s|ms)?$/);if(!F)return 0;let G=parseFloat(F[1]);return(F[2]||"s")==="ms"?G:G*1000};return Math.max(A(B),A(q))}function N(b,j){return new Promise((B)=>{let q=j??Q(b);if(q===0){B();return}let A=!1,z=()=>{if(A)return;A=!0,b.removeEventListener("transitionend",F),b.removeEventListener("animationend",F),B()},F=(G)=>{if(G.target===b)z()};b.addEventListener("transitionend",F),b.addEventListener("animationend",F),setTimeout(z,q+50)})}function P(b){b.offsetHeight}async function W(b,j={}){let B=j.name||"stx",q=L(B,j),A=typeof j.duration==="object"?j.duration.enter:j.duration;if(j.onBeforeEnter?.(b),b.classList.add(q.enterFrom),b.classList.add(q.enterActive),P(b),b.classList.remove(q.enterFrom),b.classList.add(q.enterTo),j.onEnter)await new Promise((z)=>{j.onEnter(b,z)});else await N(b,A);b.classList.remove(q.enterActive),b.classList.remove(q.enterTo),j.onAfterEnter?.(b)}async function X(b,j={}){let B=j.name||"stx",q=L(B,j),A=typeof j.duration==="object"?j.duration.leave:j.duration;if(j.onBeforeLeave?.(b),b.classList.add(q.leaveFrom),b.classList.add(q.leaveActive),P(b),b.classList.remove(q.leaveFrom),b.classList.add(q.leaveTo),j.onLeave)await new Promise((z)=>{j.onLeave(b,z)});else await N(b,A);b.classList.remove(q.leaveActive),b.classList.remove(q.leaveTo),j.onAfterLeave?.(b)}function Y(b,j={},B){let q=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return b.replace(q,(A,z,F)=>{let G=U(z),H=G.name||"stx",J=G.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
2
+ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function kl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function Cl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function $l(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
3
3
  <div
4
4
  class="stx-transition-wrapper"
5
- data-transition="${H}"
6
- data-transition-id="${K}"
7
- data-transition-duration="${J}"
8
- ${G.mode?`data-transition-mode="${G.mode}"`:""}
5
+ data-transition="${l}"
6
+ data-transition-id="${d}"
7
+ data-transition-duration="${c}"
8
+ ${r.mode?`data-transition-mode="${r.mode}"`:""}
9
9
  >
10
- ${F.trim()}
10
+ ${i.trim()}
11
11
  </div>
12
12
  <script>
13
13
  (function() {
14
- const wrapper = document.querySelector('[data-transition-id="${K}"]');
14
+ const wrapper = document.querySelector('[data-transition-id="${d}"]');
15
15
  if (!wrapper) return;
16
16
 
17
- const name = '${H}';
18
- const duration = ${J};
17
+ const name = '${l}';
18
+ const duration = ${c};
19
19
 
20
20
  // Observe for child changes to trigger transitions
21
21
  const observer = new MutationObserver(function(mutations) {
@@ -41,7 +41,7 @@ function L(b,j={}){return{enterFrom:j.enterClass||`${b}-enter-from`,enterActive:
41
41
  });
42
42
  })();
43
43
  </script>
44
- `})}function U(b){let j={},B=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,q;while((q=B.exec(b))!==null){let A=q[1],z=q[2]||q[3]||q[4]||q[5];switch(A){case"name":j.name=z;break;case"duration":j.duration=parseInt(z,10);break;case"mode":j.mode=z;break;case"easing":j.easing=z;break}}return j}function Z(){return`
44
+ `})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function El(){return`
45
45
  /* STX Transition Presets */
46
46
 
47
47
  /* Fade */
@@ -228,7 +228,7 @@ function L(b,j={}){return{enterFrom:j.enterClass||`${b}-enter-from`,enterActive:
228
228
  opacity: 1;
229
229
  max-height: 1000px;
230
230
  }
231
- `}function _(){return`
231
+ `}function Tl(){return`
232
232
  // STX Transition Runtime
233
233
  (function() {
234
234
  if (typeof window === 'undefined') return;
@@ -317,5 +317,5 @@ else {
317
317
 
318
318
  console.log('[stx] Transition runtime initialized');
319
319
  })();
320
- `}function $(b){let j=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return b.replace(j,(B,q,A,z)=>{let F=A||"300",G=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${q}" data-stx-transition-duration="${F}" data-stx-transition-condition="${z}" data-stx-transition-id="${G}"`})}
321
- export{W as si,X as ti,Y as ui,Z as vi,_ as wi,$ as xi};
320
+ `}function _l(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
321
+ export{kl,Cl,$l,El,Tl,_l};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kl,mi,_a,Gl,Jl,Yl,Zl,Ql,Ra,Aa,eu,tu,nu,ru}from"./chunk-g578mcb0.js";import"./chunk-69mc2np8.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-2gr351s0.js";import"./chunk-h0atqq82.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{_a as SUSPENSE_RESOLVER_RUNTIME,mi as buildSuspenseResolveScript,Ql as createStreamRenderer,Yl as extractStreamBoundaries,ru as generateHydrationRuntime,Aa as islandDirective,tu as processSectionDirectives,Jl as processStreamDirectives,eu as registerStreamingDirectives,Gl as renderStreamingPage,Kl as streamTemplate,Zl as streamTemplateSimple,nu as streamToResponse,Ra as streamingSuspenseDirective};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{St,as,Ki,dc}from"./chunk-69mc2np8.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-2gr351s0.js";import"./chunk-h0atqq82.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{dc as declareBareLoopHead,St as parseLoopBinding,Ki as processLoops,as as reportDeferredLoopWarnings};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import u from"fs";import l from"path";var g=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,x=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=l.resolve(l.dirname(t),e);for(let o of b){let s=r+o;try{if(u.statSync(s).isFile())return s}catch{}}return null}function hn(e,t,r=0,o=new Set){if(!t||r>=h)return!1;for(let s of e.matchAll(x)){let n=y(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=u.readFileSync(n,"utf8")}catch{continue}if(g.test(i))return!0;if(hn(i,n,r+1,o))return!0}return!1}var m=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setKeptScope","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],ko=["onMount","onDestroy"];function It(e="const",t=[],r){let o=t.length?m.filter((s)=>!t.includes(s)):m;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var E=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=m.filter((e)=>!E.includes(e));function Ds(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],T=/\s@[a-z][\w.:-]*\s*=/i;function Co(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Ds(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(hn(r[1],t))return!0;return!1}function $o(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Eo(e){return _.includes(e.toLowerCase())}var p=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],To=[...p,...w];function _o(){return`{${p.map((e)=>`'${e}':1`).join(",")}}`}var A=["class","style","text","html","show","model","if","ref"];function Ro(){return`{${A.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var N=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Ao(){return`/^(${N.join("|")})/`}var M=65536,L=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=M;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=L){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{hn,m,ko,It,Ds,Co,$o,Eo,To,_o,Ro,Ao};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ var u=import.meta.require;
3
+ export{u};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{ix as v$,jx as G}from"./chunk-ay6zjq8v.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
3
- `),L=E.join(U,"route-types.d.ts");try{if(W.existsSync(L)&&W.readFileSync(L,"utf8")===B)return;W.mkdirSync(U,{recursive:!0}),W.writeFileSync(L,B)}catch{}}function q($,U,O){let I=process.cwd(),B=E.relative(I,O),L=$.filter((V)=>!A(V.pattern)),K=["// Auto-generated by stx \u2014 do not edit",`// Source: ${B||"pages"}/`,"","export const routes = ["];for(let V of L){let J=E.relative(I,V.filePath).replace(/\\/g,"/"),X=JSON.stringify(V.params),Y=V.layout?`, layout: '${E.relative(I,V.layout).replace(/\\/g,"/")}'`:"";K.push(` { pattern: '${V.pattern}', filePath: '${J}', isDynamic: ${V.isDynamic}, params: ${X}${Y} },`)}K.push("] as const",""),K.push("export type RouteName = typeof routes[number]['pattern']",""),W.mkdirSync(U,{recursive:!0}),W.writeFileSync(E.join(U,"routes.ts"),K.join(`
4
- `))}var f=G(()=>{C()});import i from"path";function N($,U){let I=i.relative(U,$).replace(/\.(stx|md)$/,"");if(I=I.split(i.sep).join("/"),I==="index")return"/";if(I.endsWith("/index"))I=I.slice(0,-6);return I=I.replace(/\[\[([^\]]+)\]\]/g,":$1?"),I=I.replace(/\[([^\]]+)\]/g,":$1"),I=I.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${I}`}function j($){let U=[],O="",I=0;while(I<$.length){let B=$.slice(I),L=/^\/:([^/?*]+)\?/.exec(B);if(L){U.push(L[1]),O+="(?:/([^/]+))?",I+=L[0].length;continue}let K=/^:([^/?*]+)\*/.exec(B);if(K){U.push(K[1]),O+="(.+)",I+=K[0].length;continue}let V=/^:([^/?*]+)/.exec(B);if(V){U.push(V[1]),O+="([^/]+)",I+=V[0].length;continue}O+=$[I].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),I+=1}return{regex:new RegExp(`^${O}$`),params:U}}function o($,U){let O=$===""?"/":$;for(let I of U){let B=O.match(I.regex);if(B){let L={};return I.params.forEach((K,V)=>{L[K]=B[V+1]}),{route:I,params:L}}}return null}function r($){let U=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return j(U)}var g=()=>{};import b$ from"fs";import d from"path";function R($,U){let O=[],I=d.dirname($);while(I.startsWith(U)||I===U){let B=d.join(I,"_layout.stx");if(b$.existsSync(B))O.unshift(B);if(I===U)break;I=d.dirname(I)}return O}var m=()=>{};import S from"fs";import Q from"path";function t($,U){let O=[];if(!S.existsSync($))return O;let I=S.readdirSync($,{withFileTypes:!0});for(let B of I){let L=Q.join($,B.name);if(B.isDirectory()){if(B.name.startsWith("."))continue;if(F.includes(B.name))continue;O.push(...t(L,U))}else if(B.isFile()){let K=Q.extname(B.name);if(U.includes(K)){if(B.name.startsWith("_")&&B.name!=="_layout.stx")continue;if(B.name==="_layout.stx")continue;O.push(L)}}}return O}class b{routes;pagesDir;pagesDirs;config;constructor($,U={}){this.config=U;let O=U.pagesDirs&&U.pagesDirs.length>0?U.pagesDirs:[U.pagesDir||"pages"];this.pagesDirs=O.map((J)=>Q.resolve($,J)),this.pagesDir=this.pagesDirs[0];let I=U.extensions||[".stx"],B=(J)=>{let X=Q.resolve($,J);try{return S.realpathSync(X)}catch{return X}},L=(U.exclude??[]).filter((J)=>typeof J==="string"&&J.trim()!=="").map(B),K=(J)=>{if(L.length===0)return!1;let X=B(J);return L.some((Y)=>X===Y||X.startsWith(`${Y}${Q.sep}`))},V=new Set;this.routes=[];for(let J of this.pagesDirs){let X=t(J,I).filter((Z)=>!K(Z)),Y=new Map;for(let Z of X){let _=N(Z,J),z=U.pagesDirs?_.replace(/:[\w]+/g,":param"):_;if(U.pagesDirs&&Y.has(z))throw Error(`Conflicting layer pages for ${_}: ${Y.get(z)} and ${Z}`);if(Y.set(z,Z),V.has(z))continue;V.add(z);let{regex:S$,params:s}=j(_),D=U.layouts!==!1?R(Z,J):[];this.routes.push({pattern:_,regex:S$,params:s,filePath:Z,isDynamic:s.length>0,layout:D.length>0?D[D.length-1]:void 0})}}if(this.routes.sort((J,X)=>{if(!J.isDynamic&&X.isDynamic)return-1;if(J.isDynamic&&!X.isDynamic)return 1;let Y=J.pattern.split("/").length,Z=X.pattern.split("/").length;if(Y!==Z)return Z-Y;return J.pattern.localeCompare(X.pattern)}),U.emit!==!1){let J=Q.resolve($,U.stateDir||process.env.STX_DIR?.trim()||".stx");H(this.routes,J),q(this.routes,J,this.pagesDir)}}match($){let U=$===""?"/":$;for(let O of this.routes){let I=U.match(O.regex);if(I){let B={};return O.params.forEach((L,K)=>{B[L]=I[K+1]}),{route:O,params:B}}}return null}resolve($,U){let O=this.routes.find((B)=>B.pattern===$||B.filePath.includes($));if(!O)return"#not-found";let I=O.pattern;if(U)for(let[B,L]of Object.entries(U))I=I.replace(`:${B}`,encodeURIComponent(L));return I}addRoute($){this.routes.push($),this.routes.sort((U,O)=>{if(!U.isDynamic&&O.isDynamic)return-1;if(U.isDynamic&&!O.isDynamic)return 1;return U.pattern.localeCompare(O.pattern)})}getLayout($){return $.layout??null}}function a($,U){return new b($,U)}function e($,U){let O=[`${U}.stx`,"error.stx"];for(let I of O){let B=Q.join($,I);if(S.existsSync(B))return B}return null}function $$($,U){return $.map((O)=>{let I=Q.relative(U,O.filePath),B=O.isDynamic?" (dynamic)":"";return`${O.pattern} \u2192 ${I}${B}`})}var U$=G(()=>{f();g();m();C()});function I$($){x=$.replace(/\/$/,"")}function O$($,U,O={}){M[$]={path:U,name:$,params:O}}function B$($){for(let[U,O]of Object.entries($))if(typeof O==="string")M[U]={path:O,name:U};else M[U]={...O,name:U}}function J$($,U={},O=!1){let I=M[$];if(!I)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let B={...I.params,...U},L=I.path;L=L.replace(/:(\w+)/g,(V,J)=>{let X=B[J];if(X===void 0)return console.warn(`Missing parameter [${J}] for route [${$}].`),`:${J}`;return delete B[J],encodeURIComponent(String(X))});let K=Object.entries(B);if(K.length>0){let V=K.map(([J,X])=>`${encodeURIComponent(J)}=${encodeURIComponent(String(X))}`).join("&");L+=(L.includes("?")?"&":"?")+V}return O&&x?`${x}${L}`:L}function K$(){for(let $ of Object.keys(M))delete M[$];x=""}var M,x="";var L$=G(()=>{M={}});import V$ from"fs";import X$ from"path";function Y$($,U={}){return{type:"redirect",path:$,options:{replace:U.replace??!1,external:U.external??!1,redirectCode:U.redirectCode??302}}}function Z$($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function G$($,U={}){return{handler:$,mode:U.mode??"universal"}}function h($){let U={};if(!$)return U;let O=$.split(";");for(let I of O){let[B,...L]=I.split("=");if(B){let K=B.trim(),V=L.join("=").trim();if(K)U[K]=decodeURIComponent(V)}}return U}function k($,U,O={}){let I=`${encodeURIComponent($)}=${encodeURIComponent(U)}`;if(O.expires){let B=typeof O.expires==="number"?new Date(Date.now()+O.expires*1000):O.expires;I+=`; Expires=${B.toUTCString()}`}if(O.path)I+=`; Path=${O.path}`;if(O.domain)I+=`; Domain=${O.domain}`;if(O.secure)I+="; Secure";if(O.httpOnly)I+="; HttpOnly";if(O.sameSite)I+=`; SameSite=${O.sameSite}`;return I}function c($,U){let O=$.headers.get("cookie")||"",I=h(O);return{get(B){return I[B]},set(B,L,K={}){I[B]=L,U.append("Set-Cookie",k(B,L,K))},delete(B){delete I[B],U.append("Set-Cookie",k(B,"",{expires:new Date(0),path:"/"}))},getAll(){return{...I}}}}function u(){return{get($){if(typeof document>"u")return;return h(document.cookie)[$]},set($,U,O={}){if(typeof document>"u")return;document.cookie=k($,U,O)},delete($){if(typeof document>"u")return;document.cookie=k($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return h(document.cookie)}}}function l(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(U){if(!$)return null;try{return window.localStorage.getItem(U)}catch{return null}},set(U,O){if(!$)return;try{window.localStorage.setItem(U,O)}catch{}},remove(U){if(!$)return;try{window.localStorage.removeItem(U)}catch{}},isAvailable(){return $}}}function v($,U){T.set($,U)}function p($){return T.get($)}function Q$($){return T.has($)}function W$(){T.clear()}function M$(){return Array.from(T.keys())}async function _$($,U="middleware"){let O=X$.resolve($,U);if(!V$.existsSync(O))return;let I=V$.readdirSync(O);for(let B of I){if(!B.endsWith(".ts")&&!B.endsWith(".js"))continue;if(B.includes(".test.")||B.includes(".spec."))continue;let L=B.replace(/\.(ts|js)$/,""),K=X$.join(O,B);try{let J=(await import(K)).default;if(J&&typeof J.handler==="function")v(L,J);else if(typeof J==="function")v(L,{handler:J,mode:"universal"})}catch(V){console.warn(`Failed to load middleware '${L}' from ${K}:`,V)}}}function x$($){let U={};if(!$)return U;let O=new URLSearchParams($);for(let[I,B]of O)U[I]=B;return U}function z$($,U,O,I=""){return{path:$,params:U,query:x$(I),fullPath:I?`${$}?${I}`:$,meta:O}}function F$($,U,O,I){let B=I?.isServer??typeof window>"u",L=!B,K=new Headers;return{to:$,from:U,isClient:L,isServer:B,cookies:B&&O?c(O,K):u(),storage:l(),state:{},request:O,responseHeaders:K}}async function A$($,U){let O=Array.isArray($)?$:[$],I=U.isServer;for(let B of O){let L=p(B);if(!L)return console.error(`Route middleware '${B}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${B}' is not registered`}},state:U.state,responseHeaders:U.responseHeaders};if(L.mode==="server"&&!I)continue;try{let K=await L.handler(U);if(K){if(K.type==="redirect")return{passed:!1,redirect:K,state:U.state,responseHeaders:U.responseHeaders};if(K.type==="abort")return{passed:!1,abort:K,state:U.state,responseHeaders:U.responseHeaders}}}catch(K){return console.error(`Error in middleware '${B}':`,K),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:K instanceof Error?K.message:"Middleware error"}},state:U.state,responseHeaders:U.responseHeaders}}}return{passed:!0,state:U.state,responseHeaders:U.responseHeaders}}var T;var E$=G(()=>{T=new Map});function n($){let O=$.replace(/\\/g,"/").split("/").filter(Boolean),I=O.lastIndexOf("layouts"),B=I>=0?O[I+1]:O.at(-1);if(!B)return"app";return B.replace(/\.stx$/i,"")||"app"}function j$($){let U=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),O=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),I=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),B=U?.[1]||I?.[1]||"";return{layout:B,group:O?.[1]||n(B)}}var T$=()=>{};function k$($){let U=[],O="log(",I=0;while(I<$.length){let B=$.indexOf("log(",I);if(B===-1){U.push($.slice(I));break}let L=B>0?$[B-1]:" ",K=/\bfunction\s+$/.test($.slice(Math.max(0,B-16),B));if(/[\w$.]/.test(L)||K){U.push($.slice(I,B+4)),I=B+4;continue}U.push($.slice(I,B));let V=1,J=B+4;while(J<$.length&&V>0){let X=$[J];if(X==='"'||X==="'"||X==="`"){let Y=X;J++;while(J<$.length&&$[J]!==Y){if($[J]==="\\")J++;J++}J++;continue}if(X==="(")V++;else if(X===")")V--;J++}U.push("0"),I=J}return U.join("")}function C$($,U=!1){try{return new Bun.Transpiler(U?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function H$(){return`
2
+ import x from"fs";import u from"path";import p from"fs";import v 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 Os(e,t){let a=e.filter((o)=>!b(o.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 o of a){let l=[];for(let c of o.params){let d=o.pattern.includes(`:${c}?`)?"?":"";l.push(`${c}${d}: string`)}let s=l.join("; ");r.push(` '${o.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),i=v.join(t,"route-types.d.ts");try{if(p.existsSync(i)&&p.readFileSync(i,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(i,n)}catch{}}function Ms(e,t,a){let r=process.cwd(),n=v.relative(r,a),i=e.filter((l)=>!b(l.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let l of i){let s=v.relative(r,l.filePath).replace(/\\/g,"/"),c=JSON.stringify(l.params),d=l.layout?`, layout: '${v.relative(r,l.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${l.pattern}', filePath: '${s}', isDynamic: ${l.isDynamic}, params: ${c}${d} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(v.join(t,"routes.ts"),o.join(`
4
+ `))}import P from"path";function R(e,t){let r=P.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(P.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 Y(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),i=/^\/:([^/?*]+)\?/.exec(n);if(i){t.push(i[1]),a+="(?:/([^/]+))?",r+=i[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let l=/^:([^/?*]+)/.exec(n);if(l){t.push(l[1]),a+="([^/]+)",r+=l[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function yn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let i={};return r.params.forEach((o,l)=>{i[o]=n[l+1]}),{route:r,params:i}}}return null}function ar(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Y(t)}import U from"fs";import E from"path";function L(e,t){let a=[],r=E.dirname(e);while(r.startsWith(t)||r===t){let n=E.join(r,"_layout.stx");if(U.existsSync(n))a.unshift(n);if(r===t)break;r=E.dirname(r)}return a}function N(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let i=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...N(i,t))}else if(n.isFile()){let o=u.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(i)}}}return a}class bn{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 c=u.resolve(e,s);try{return x.realpathSync(c)}catch{return c}},i=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),o=(s)=>{if(i.length===0)return!1;let c=n(s);return i.some((d)=>c===d||c.startsWith(`${d}${u.sep}`))},l=new Set;this.routes=[];for(let s of this.pagesDirs){let c=N(s,r).filter((h)=>!o(h)),d=new Map;for(let h of c){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),l.has(m))continue;l.add(m);let{regex:q,params:O}=Y(g),T=t.layouts!==!1?L(h,s):[];this.routes.push({pattern:g,regex:q,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,c)=>{if(!s.isDynamic&&c.isDynamic)return-1;if(s.isDynamic&&!c.isDynamic)return 1;let d=s.pattern.split("/").length,h=c.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(c.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");Os(this.routes,s),Ms(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((i,o)=>{n[i]=r[o+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,i]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(i));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 cr(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 lr(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 Rc(e){k=e.replace(/\/$/,"")}function Ac(e,t,a={}){f[e]={path:t,name:e,params:a}}function Pc(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 vn(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},i=r.path;i=i.replace(/:(\w+)/g,(l,s)=>{let c=n[s];if(c===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let l=o.map(([s,c])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(c))}`).join("&");i+=(i.includes("?")?"&":"?")+l}return a&&k?`${k}${i}`:i}function Ic(){for(let e of Object.keys(f))delete f[e];k=""}import D from"fs";import I from"path";function Dc(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Oc(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Mc(e,t={}){return{handler:e,mode:t.mode??"universal"}}function _(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...i]=r.split("=");if(n){let o=n.trim(),l=i.join("=").trim();if(o)t[o]=decodeURIComponent(l)}}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 Po(e,t){let a=e.headers.get("cookie")||"",r=_(a);return{get(n){return r[n]},set(n,i,o={}){r[n]=i,t.append("Set-Cookie",S(n,i,o))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Io(){return{get(e){if(typeof document>"u")return;return _(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 _(document.cookie)}}}function Do(){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 w=new Map;function Ns(e,t){w.set(e,t)}function Oo(e){return w.get(e)}function Nc(e){return w.has(e)}function Qe(){w.clear()}function et(){return Array.from(w.keys())}async function tt(e,t="middleware"){let a=I.resolve(e,t);if(!D.existsSync(a))return;let r=D.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let i=n.replace(/\.(ts|js)$/,""),o=I.join(a,n);try{let s=(await import(o)).default;if(s&&typeof s.handler==="function")Ns(i,s);else if(typeof s==="function")Ns(i,{handler:s,mode:"universal"})}catch(l){console.warn(`Failed to load middleware '${i}' from ${o}:`,l)}}}function X(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function nt(e,t,a,r=""){return{path:e,params:t,query:X(r),fullPath:r?`${e}?${r}`:e,meta:a}}function rt(e,t,a,r){let n=r?.isServer??typeof window>"u",i=!n,o=new Headers;return{to:e,from:t,isClient:i,isServer:n,cookies:n&&a?Po(a,o):Io(),storage:Do(),state:{},request:a,responseHeaders:o}}async function st(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let i=Oo(n);if(!i)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(i.mode==="server"&&!r)continue;try{let o=await i.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function ur(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 Ce(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]||ur(n)}}var A,C;function G(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 i=n>0?e[n-1]:" ",o=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(i)||o){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let l=1,s=n+4;while(s<e.length&&l>0){let c=e[s];if(c==='"'||c==="'"||c==="`"){let d=c;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(c==="(")l++;else if(c===")")l--;s++}t.push("0"),r=s}return t.join("")}function F(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 B(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -3532,5 +3532,4 @@ else {
3532
3532
 
3533
3533
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
3534
3534
  })();
3535
- `}function q$(){if(w)return w;return w=C$(k$(H$()),!0),w}function N$(){if(P)return P;return P=C$(H$()),P}var w,P;var R$=()=>{};var w$={};v$(w$,{setAppUrl:()=>I$,runMiddleware:()=>A$,route:()=>J$,resolveLayoutChain:()=>R,resetRoutes:()=>K$,registerMiddleware:()=>v,patternToRegex:()=>j,navigateTo:()=>Y$,matchRoute:()=>o,loadMiddlewareFromDirectory:()=>_$,isNonPageRoutePattern:()=>A,isNonPageRoutePath:()=>y,hasMiddleware:()=>Q$,getRouterScriptDev:()=>N$,getRouterScript:()=>q$,getMiddlewareNames:()=>M$,getMiddleware:()=>p,generateRouteTypes:()=>H,generateRouteManifest:()=>q,formatRoutes:()=>$$,findErrorPage:()=>e,filePathToPattern:()=>N,extractLayoutMetadata:()=>j$,deriveLayoutGroup:()=>n,defineRoutes:()=>B$,defineRoute:()=>O$,defineMiddleware:()=>G$,createStorageManager:()=>l,createServerCookieManager:()=>c,createRouter:()=>a,createRouteLocation:()=>z$,createMiddlewareContext:()=>F$,createClientCookieManager:()=>u,clearMiddleware:()=>W$,bracketPathToRegex:()=>r,abortNavigation:()=>Z$,Router:()=>b,NON_PAGE_DIRS:()=>F});var P$=G(()=>{U$();g();L$();E$();m();T$();f();C();R$()});
3536
- export{F as kw,y as lw,A as mw,H as nw,q as ow,N as pw,j as qw,o as rw,r as sw,R as tw,b as uw,a as vw,e as ww,$$ as xw,I$ as yw,O$ as zw,B$ as Aw,J$ as Bw,K$ as Cw,Y$ as Dw,Z$ as Ew,G$ as Fw,c as Gw,u as Hw,l as Iw,v as Jw,p as Kw,Q$ as Lw,W$ as Mw,M$ as Nw,_$ as Ow,z$ as Pw,F$ as Qw,A$ as Rw,n as Sw,j$ as Tw,T$ as Uw,q$ as Vw,N$ as Ww,w$ as Xw,P$ as Yw};
3535
+ `}function $e(){if(A)return A;return A=F(G(B()),!0),A}function Lc(){if(C)return C;return C=F(B()),C}export{Os,Ms,Y,yn,ar,bn,cr,lr,Rc,Ac,Pc,vn,Ic,Dc,Oc,Mc,Po,Io,Do,Ns,Oo,Nc,Qe,et,tt,nt,rt,st,ur,Ce,$e,Lc};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import g from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...r){let o=new Set;for(let s of r){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{o.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...o].sort()}async function M(r,o={}){if(r.length===0)return null;let s=process.cwd(),e=[],l=[];r.forEach((t,h)=>{let x=t.startsWith("npm:")?t.slice(4):g.resolve(s,t),a=`__stxRegistered${h}`,d=JSON.stringify(t);e.push(`import * as ${a} from ${JSON.stringify(x)};`),l.push(`if (!globalThis.__stxModules[${d}]) globalThis.__stxModules[${d}] = ${a};`)});let u=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...l].join(`
3
+ `),n;try{let{bundleClientScript:t}=await import("./chunk-pj1wg7jg.js");n=await t(u,g.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:o.minify,externalizeUserModules:!1,collectInputs:o.collectInputs})}catch(t){return console.warn("[stx] could not build the page module registry (#1957):",t),null}let{transformAutoImports:p,generateAutoImportDestructuring:m}=await import("./chunk-866n724v.js"),i=p(n),f=m(i.stxImports,i.browserImports),{transformStoreImports:_}=await import("./chunk-2ce7f416.js");n=_(i.code);let c=JSON.stringify(new Bun.CryptoHasher("md5").update(u).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${c}]) return;`,` __stxBundles[${c}] = true;`,f,n,"})();"].join(`
4
+ `)}export{M as buildModuleRegistryScript,I as registeredModuleIdsIn};
@@ -0,0 +1,24 @@
1
+ // @bun
2
+ import{q,r}from"./chunk-69mc2np8.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
+ ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
+ `)}else{console.log(`
5
+ ${e.bold}Available Commands:${e.reset}
6
+ `);for(let[n,s]of Object.entries(u))console.log(` ${e.cyan}${n.padEnd(12)}${e.reset} ${s.description}`);console.log(`
7
+ ${e.dim}Type 'help <command>' for more details${e.reset}
8
+ `)}}},render:{description:"Render a template file",usage:"render <file> [--raw]",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file to render${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let s=await Bun.file(n).text(),l=t.includes("--raw");console.log(`
9
+ ${e.dim}Rendering ${n}...${e.reset}
10
+ `);let c=await r(s,o.context,n,{},new Set);if(o.lastResult=c,l)console.log(c);else c.split(`
11
+ `).forEach((d,i)=>{let f=String(i+1).padStart(3," ");console.log(`${e.dim}${f}${e.reset} ${d}`)});console.log()}catch(s){console.log(`${e.red}Error rendering template:${e.reset}`,s)}}},eval:{description:"Evaluate an expression",usage:"eval <expression>",handler:async(t,o)=>{if(!t.length){console.log(`${e.red}Error: Please provide an expression to evaluate${e.reset}`);return}let n=t.join(" ");try{let s=`{{ ${n} }}`,c=(await q(s,o.context,"eval")).trim();o.lastResult=c,console.log(`${e.green}\u2192${e.reset} ${c}`)}catch(s){console.log(`${e.red}Error:${e.reset}`,s)}}},set:{description:"Set a context variable",usage:"set <key> <value>",handler:async(t,o)=>{if(t.length<2){console.log(`${e.red}Error: Usage: set <key> <value>${e.reset}`);return}let n=t[0],s=t.slice(1).join(" "),l;try{l=JSON.parse(s)}catch{l=s}o.context[n]=l,console.log(`${e.green}\u2713${e.reset} ${n} = ${JSON.stringify(l)}`)}},unset:{description:"Remove a context variable",usage:"unset <key>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a variable to remove${e.reset}`);return}if(t[0]in o.context)delete o.context[t[0]],console.log(`${e.green}\u2713${e.reset} Removed ${t[0]}`);else console.log(`${e.yellow}Variable not found: ${t[0]}${e.reset}`)}},context:{description:"Show current context variables",usage:"context",handler:async(t,o)=>{let n=Object.keys(o.context);if(n.length===0){console.log(`${e.dim}Context is empty${e.reset}`);return}console.log(`
12
+ ${e.bold}Context Variables:${e.reset}
13
+ `);for(let s of n){let l=o.context[s],c=Array.isArray(l)?"array":typeof l,a=JSON.stringify(l).slice(0,50);console.log(` ${e.cyan}${s}${e.reset} ${e.dim}(${c})${e.reset}: ${a}${a.length>=50?"...":""}`)}console.log()}},clear:{description:"Clear context or screen",usage:"clear [context|screen]",handler:async(t,o)=>{if(t[0]==="context"||!t[0])o.context={},console.log(`${e.green}\u2713${e.reset} Context cleared`);if(t[0]==="screen"||!t[0])console.clear()}},cd:{description:"Change working directory",usage:"cd <directory>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.cyan}${o.cwd}${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!p.existsSync(n)){console.log(`${e.red}Error: Directory not found: ${n}${e.reset}`);return}if(!p.statSync(n).isDirectory()){console.log(`${e.red}Error: Not a directory: ${n}${e.reset}`);return}o.cwd=n,console.log(`${e.green}\u2713${e.reset} ${n}`)}},ls:{description:"List files in current directory",usage:"ls [pattern]",handler:async(t,o)=>{let n=t[0]||"*",s=new Bun.Glob(n),l=[];for await(let i of s.scan({cwd:o.cwd,onlyFiles:!1}))l.push(i);if(l.length===0){console.log(`${e.dim}No files found${e.reset}`);return}l.sort();let c=l.filter((i)=>i.endsWith(".stx")),a=l.filter((i)=>i.endsWith(".md")),d=l.filter((i)=>!i.endsWith(".stx")&&!i.endsWith(".md"));if(c.length>0)console.log(`
14
+ ${e.bold}Templates:${e.reset}`),c.forEach((i)=>console.log(` ${e.green}${i}${e.reset}`));if(a.length>0)console.log(`
15
+ ${e.bold}Markdown:${e.reset}`),a.forEach((i)=>console.log(` ${e.blue}${i}${e.reset}`));if(d.length>0)console.log(`
16
+ ${e.bold}Other:${e.reset}`),d.forEach((i)=>console.log(` ${e.dim}${i}${e.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}let l=(await Bun.file(n).text()).split(`
17
+ `);console.log(),l.forEach((c,a)=>{let d=String(a+1).padStart(3," ");console.log(`${e.dim}${d}${e.reset} ${c}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a JSON file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let s=await Bun.file(n).text(),l=JSON.parse(s);o.context={...o.context,...l},console.log(`${e.green}\u2713${e.reset} Loaded ${Object.keys(l).length} variables from ${t[0]}`)}catch(s){console.log(`${e.red}Error parsing JSON:${e.reset}`,s)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file name${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);try{await Bun.write(n,JSON.stringify(o.context,null,2)),console.log(`${e.green}\u2713${e.reset} Context saved to ${t[0]}`)}catch(s){console.log(`${e.red}Error saving file:${e.reset}`,s)}}},history:{description:"Show command history",usage:"history [count]",handler:async(t,o)=>{let n=t[0]?Number.parseInt(t[0],10):20,s=o.history.slice(-n);if(s.length===0){console.log(`${e.dim}No history${e.reset}`);return}console.log(),s.forEach((l,c)=>{let a=String(o.history.length-s.length+c+1).padStart(3," ");console.log(`${e.dim}${a}${e.reset} ${l}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(t,o)=>{o.running=!1,console.log(`
18
+ ${e.dim}Goodbye!${e.reset}
19
+ `)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),s=n[0];if(n.length===1)return Object.keys(u).filter((l)=>l.startsWith(s));if(["render","cat","load","cd"].includes(s)){let l=n.slice(1).join(" "),c=g.dirname(l)||".",a=g.basename(l),d=g.resolve(o.cwd,c);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${s} ${c==="."?"":`${c}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(s)){let l=n[1]||"";return Object.keys(o.context).filter((c)=>c.startsWith(l)).map((c)=>`${s} ${c}`)}return[]}async function Gc(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},n=y.createInterface({input:process.stdin,output:process.stdout,completer:(l)=>[h(l,o),l],historySize:t.maxHistory||100});console.log(`
20
+ ${e.bold}${e.blue}stx Interactive Mode${e.reset}
21
+ ${e.dim}Type 'help' for available commands, 'exit' to quit${e.reset}
22
+ `);let s=()=>{let l=o.cwd.replace(process.env.HOME||"","~");n.question(`${e.cyan}stx${e.reset} ${e.dim}${l}${e.reset} ${e.green}>${e.reset} `,async(c)=>{let a=c.trim();if(!a){if(o.running)s();return}o.history.push(a);let d=a.match(/(?:[^\s"]|"[^"]*")+/g)||[],i=d[0]?.toLowerCase(),f=d.slice(1).map((m)=>m.replace(/^"|"$/g,""));if(i&&u[i])try{await u[i].handler(f,o)}catch(m){console.log(`${e.red}Error:${e.reset}`,m)}else if(i)if(a.includes("{{")||a.includes("}}"))try{let m=await q(a,o.context,"eval");console.log(`${e.green}\u2192${e.reset} ${m}`)}catch{console.log(`${e.red}Unknown command: ${i}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`)}else console.log(`${e.red}Unknown command: ${i}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`);if(o.running)s();else n.close()})};n.on("SIGINT",()=>{console.log(`
23
+ ${e.dim}(Use 'exit' to quit)${e.reset}`),s()}),s()}
24
+ export{Gc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Yc,Zc,Qc,el,Go,tl,nl,rl,sl,il,ol,al}from"./chunk-x0q32ees.js";export{ol as Broadcast,al as BroadcastServer,Go as broadcast,sl as broadcastPresence,rl as broadcastPrivate,il as channel,Yc as getBroadcastServer,el as loadChannels,Zc as startBroadcasting,Qc as stopBroadcasting,tl as toUser,nl as toUsers};
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ import{m}from"./chunk-ce1sejr3.js";import{R,Pt}from"./chunk-8nhshfz6.js";import{y,ze,N,i}from"./chunk-69mc2np8.js";import{ce,mt,ht}from"./chunk-mepdnezf.js";import{De,Xt,Q}from"./chunk-f46qsp4m.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let o=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(o))s.add(o)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function ql(a){let s;if(a)s=f.resolve(a);else{let t=await i();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return Q(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ce(t))])],o=De(c()),d=Xt(l,s,o);if(d!==void 0)return d||null;if(r.length===0)return Q(l,s,o,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let w=p.map((t)=>t.file),u=[],g=new Set,b=N({loader:"ts",target:"browser",define:y()});for(let t of w)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,g),mt(e))e=await ht(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=ze(e),e=R(e),e=Pt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
3
+ ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(u.length===0)return Q(l,s,o,""),null;let h=u.join(`
4
+
5
+ `),S=`;(function(){
6
+ var __stx = window.stx || {};
7
+ ${m.filter((t)=>!g.has(t)&&new RegExp(`\\b${t}\\b`).test(h)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
8
+ `)}
9
+ ${h}
10
+ })();`;return o=De(c()),Q(l,s,o,S),S}function Xl(){l.clear()}
11
+ export{ql,Xl};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{an,xs}from"./chunk-2gr351s0.js";import"./chunk-ngc2wke4.js";export{xs as generateRuntimeConfigTypes,an as prepareRuntimeConfig};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{i}from"./chunk-69mc2np8.js";import{Cr}from"./chunk-9g27ybyr.js";import p from"path";async function cl(t={}){let d=performance.now(),o=t.root||process.cwd(),e=await i(o),u=t.ssr?.routeRules??e.routeRules??{};if(Cr(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:s}=await import("./ssg.js");n=await s({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:s}=await import("./chunk-6y8hnymb.js");l=await s({root:o,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
3
+ export{cl};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import I from"fs";import u from"path";import V from"os";import x from"crypto";import{generatePlaceholder as C,processImage as D}from"ts-images";var L=[320,640,768,1024,1280,1536,1920],j=["webp","jpeg"],B=80,O=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],k={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},w=null,v=!1;async function p(){if(v)return w;v=!0;try{let t=await import("sharp");return w=t.default||t,w}catch{return null}}async function Lt(){return await p()!==null}async function Z(){return!0}async function oe(t,e={}){let{widths:a=L,formats:r=j,quality:n=B,fit:i="cover",placeholder:m="none",outputDir:o=".stx/images",baseUrl:b="/images"}=e,h,g;if(typeof t==="string"){if(g=t,!await Bun.file(t).exists())throw new _n(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else g="buffer-input",h=t;let y=x.createHash("sha256").update(h).digest("hex").slice(0,12),R=await Tn(h),{width:c,height:S}=R,P=c/S;await I.promises.mkdir(o,{recursive:!0});let E=[],T=u.basename(g,u.extname(g)),l=a.filter((s)=>s<=c);if(!l.includes(c)&&c<=Math.max(...a))l.push(c);l.sort((s,f)=>s-f);for(let s of l){let f=Math.round(s/P);for(let d of r){let U=`${T}-${s}w-${y}.${d}`,A=u.join(o,U),z=`${b}/${U}`,q=await Yo(h,{width:s,height:f,format:d,quality:n,fit:i});await Bun.write(A,q),E.push({path:A,url:z,width:s,height:f,format:d,size:q.length})}}let M;if(m!=="none")M=await _(h,m);return{src:g,variants:E,placeholder:M,width:c,height:S,aspectRatio:P,hash:y}}async function Tn(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await p();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return N(e)}function N(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new _n("Unable to parse image dimensions","PARSE_ERROR")}async function Yo(t,e){let a=await p();if(a){let n=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":n=n.webp({quality:e.quality});break;case"avif":n=n.avif({quality:e.quality});break;case"jpeg":n=n.jpeg({quality:e.quality});break;case"png":n=n.png({quality:e.quality});break}return n.toBuffer()}let r=u.join(V.tmpdir(),`stx-img-${x.randomBytes(8).toString("hex")}.${e.format}`);try{return await D({input:t,output:r,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(r).arrayBuffer())}finally{await I.promises.unlink(r).catch(()=>{})}}async function _(t,e){let a=await p();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),o=await Tn(t);return`data:${k[o.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let o=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Tn(t),n=u.join(V.tmpdir(),`stx-ph-${x.randomBytes(8).toString("hex")}.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(n,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",o=await C(n,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&o.dominantColor)return o.dominantColor;if(o.dataURL)return o.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await I.promises.unlink(n).catch(()=>{})}}function Ie(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function ut(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function jt(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Bt(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Ft(t){let e=u.extname(t).toLowerCase();return O.includes(e)}function F(t){return k[t]||"application/octet-stream"}function zt(t){return t.reduce((e,a)=>e+a.size,0)}function Ht(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class _n extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
+ export{L,j,B,Lt,Z,oe,Tn,Yo,Ie,ut,jt,Bt,Ft,F,zt,Ht,_n};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{F}from"./chunk-eed4fwps.js";import S from"fs";import g from"path";import q from"crypto";var T=new Set(["webp","avif","jpeg","png"]),k=new Set(["cover","contain","fill","inside","outside"]),D=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),C=4096,U=80,A="cover";async function ei(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=L(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=S.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await S.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=q.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":F(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await N(),R=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,R),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(R),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Jo(e){return async(t)=>await ei(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function L(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!D.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??C,l=t.maxHeight??C,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!T.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...T].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??U;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||A;if(!k.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...k].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function N(){return await import("./chunk-04jhmfbz.js")}
3
+ export{ei,Jo};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function he(){if(i)return i;let t="unknown";try{t=String(JSON.parse(n.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let o=a.dirname(s(import.meta.url)),e=0;for(let r of n.readdirSync(o,{recursive:!0,withFileTypes:!0}))if(r.isFile()&&r.name.endsWith(".ts"))e=Math.max(e,n.statSync(a.join(r.parentPath,r.name)).mtimeMs);t+=`+src.${Math.trunc(e)}`}catch{}return i=t,t}
3
+ export{he};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import i from"fs";function De(e){return[...e].sort().map((n)=>{try{let t=i.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
3
+ `)}function Xt(e,n,t){let r=e.get(n);return r!==void 0&&r.signature===t?r.value:void 0}function Q(e,n,t,r){return e.set(n,{signature:t,value:r}),r}
4
+ export{De,Xt,Q};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xt,sc,ic,oc,ac,cc,d,lc,os,uc,qi,Xi}from"./chunk-69mc2np8.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-2gr351s0.js";import"./chunk-h0atqq82.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{xt as STX_ENGINE_BINDING_NAMES,os as convertToCommonJS,qi as extractScriptFromTemplate,d as extractVariables,Xi as hasVariables,lc as isCompleteImport,cc as isMissingBindingFailure,oc as isModuleResolutionFailure,ac as isSyntaxFailure,uc as splitDeclaration,sc as stripTypeScript,ic as withoutStxReferrer};
@@ -1,18 +1,18 @@
1
1
  // @bun
2
- var J=0;function K(){return`suspense-${++J}-${Date.now().toString(36)}`}function N(q,v={},w){let j=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return q.replace(j,(z,A,B,D)=>{let E=K(),F=L(A||"");return M(E,B.trim(),D.trim(),F)})}function L(q){let v={},w=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,j;while((j=w.exec(q))!==null){let z=j[1],A=j[2]||j[3],B=j[4];switch(z){case"id":v.id=A;break;case"timeout":v.timeout=B?parseInt(B,10):void 0;break}}return v}function M(q,v,w,j){let z=j.timeout||30000,A=j.id||q;return`
3
- <div class="stx-suspense" data-suspense-id="${q}" data-custom-id="${A}" data-status="pending">
4
- <div class="stx-suspense-fallback" data-suspense-fallback="${q}">
5
- ${w}
2
+ var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function Rl(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
3
+ <div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
4
+ <div class="stx-suspense-fallback" data-suspense-fallback="${s}">
5
+ ${t}
6
6
  </div>
7
- <div class="stx-suspense-content" data-suspense-content="${q}" style="display: none;">
8
- ${v}
7
+ <div class="stx-suspense-content" data-suspense-content="${s}" style="display: none;">
8
+ ${n}
9
9
  </div>
10
10
  </div>
11
11
  <script>
12
12
  (function() {
13
- const suspenseId = '${q}';
14
- const customId = '${A}';
15
- const timeout = ${z};
13
+ const suspenseId = '${s}';
14
+ const customId = '${i}';
15
+ const timeout = ${r};
16
16
 
17
17
  const container = document.querySelector('[data-suspense-id="' + suspenseId + '"]');
18
18
  const fallbackEl = document.querySelector('[data-suspense-fallback="' + suspenseId + '"]');
@@ -189,32 +189,32 @@ else {
189
189
  }, 0);
190
190
  })();
191
191
  </script>
192
- `}function Q(q,v,w){return{id:q,fallback:w,content:v}}async function T(q){let v=q.map((j)=>`
193
- <div id="stx-ssr-suspense-${j.id}" class="stx-ssr-suspense">
194
- ${j.fallback}
192
+ `}function Al(s,n,t){return{id:s,fallback:t,content:n}}async function Pl(s){let n=s.map((e)=>`
193
+ <div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
194
+ ${e.fallback}
195
195
  </div>
196
196
  `).join(`
197
- `);async function*w(){for(let j of q)try{let z=await j.content;yield`
197
+ `);async function*t(){for(let e of s)try{let r=await e.content;yield`
198
198
  <script>
199
199
  (function() {
200
- const el = document.getElementById('stx-ssr-suspense-${j.id}');
200
+ const el = document.getElementById('stx-ssr-suspense-${e.id}');
201
201
  if (el) {
202
- el.innerHTML = ${JSON.stringify(z)};
202
+ el.innerHTML = ${JSON.stringify(r)};
203
203
  el.classList.add('stx-ssr-suspense-resolved');
204
204
  }
205
205
  })();
206
206
  </script>
207
- `}catch(z){yield`
207
+ `}catch(r){yield`
208
208
  <script>
209
209
  (function() {
210
- const el = document.getElementById('stx-ssr-suspense-${j.id}');
210
+ const el = document.getElementById('stx-ssr-suspense-${e.id}');
211
211
  if (el) {
212
212
  el.classList.add('stx-ssr-suspense-error');
213
- console.error('SSR Suspense error for ${j.id}:', ${JSON.stringify(String(z))});
213
+ console.error('SSR Suspense error for ${e.id}:', ${JSON.stringify(String(r))});
214
214
  }
215
215
  })();
216
216
  </script>
217
- `}}return{initial:v,streaming:w()}}function U(){return`
217
+ `}}return{initial:n,streaming:t()}}function Il(){return`
218
218
  /* STX Suspense Styles */
219
219
  .stx-suspense {
220
220
  position: relative;
@@ -270,7 +270,7 @@ else {
270
270
  background-size: 200% 100%;
271
271
  }
272
272
  }
273
- `}function W(){return`
273
+ `}function Dl(){return`
274
274
  // STX Suspense Runtime
275
275
  (function() {
276
276
  if (typeof window === 'undefined') return;
@@ -338,4 +338,4 @@ else {
338
338
  console.log('[stx] Suspense runtime initialized');
339
339
  })();
340
340
  `}
341
- export{N as yi,Q as zi,T as Ai,U as Bi,W as Ci};
341
+ export{Rl,Al,Pl,Il,Dl};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Fr,ki,Ci,Cu}from"./chunk-j03revz2.js";export{Fr as NATIVE_COMPONENTS,ki as compileToNative,Ci as createHotReloadServer,Cu as default};