@stacksjs/stx 0.2.413 → 0.2.415

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 (346) hide show
  1. package/dist/appearance-bootstrap.js +1 -1
  2. package/dist/binding-manifest.d.ts +1 -1
  3. package/dist/builtins/image-delivery.js +19 -11
  4. package/dist/bundle-analyzer.js +20 -20
  5. package/dist/chunk-020xyn9q.js +3 -0
  6. package/dist/chunk-04jhmfbz.js +2 -0
  7. package/dist/chunk-0pnj3zt2.js +2 -0
  8. package/dist/{chunk-bwjxk1dw.js → chunk-0zaess6f.js} +29 -29
  9. package/dist/chunk-1098mas0.js +2 -0
  10. package/dist/chunk-169n1vpx.js +12 -0
  11. package/dist/chunk-18vmfkcc.js +2 -0
  12. package/dist/chunk-1b6t12hd.js +2 -0
  13. package/dist/chunk-1xdzcy9d.js +14 -0
  14. package/dist/chunk-1zs30k3y.js +2 -0
  15. package/dist/chunk-2ce7f416.js +2 -0
  16. package/dist/chunk-340a824p.js +2 -0
  17. package/dist/chunk-393341w7.js +2 -0
  18. package/dist/chunk-39g1134q.js +2 -0
  19. package/dist/chunk-3efw27as.js +2785 -0
  20. package/dist/chunk-3kthfs03.js +3 -0
  21. package/dist/chunk-3qn1wcdg.js +2 -0
  22. package/dist/chunk-3s2vnqcf.js +2 -0
  23. package/dist/chunk-42wbs8vq.js +17 -0
  24. package/dist/chunk-4bjravgk.js +2 -0
  25. package/dist/chunk-5gsxpaqk.js +2 -0
  26. package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
  27. package/dist/chunk-6cfa3g0r.js +2 -0
  28. package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
  29. package/dist/chunk-6hc5vz20.js +3 -0
  30. package/dist/chunk-6q6g76vg.js +499 -0
  31. package/dist/chunk-74j18qk0.js +930 -0
  32. package/dist/chunk-752hw7cd.js +4 -0
  33. package/dist/{chunk-kgd8kchy.js → chunk-765e1s44.js} +11 -76
  34. package/dist/chunk-7gkv67ky.js +4 -0
  35. package/dist/chunk-7z2ra0yf.js +2 -0
  36. package/dist/chunk-8eqrwj1k.js +20 -0
  37. package/dist/chunk-8nhshfz6.js +5 -0
  38. package/dist/chunk-92ps1xpk.js +2 -0
  39. package/dist/chunk-96k8s808.js +3 -0
  40. package/dist/chunk-9amp82bx.js +7 -0
  41. package/dist/chunk-9g27ybyr.js +3 -0
  42. package/dist/chunk-9p9qkbtg.js +3 -0
  43. package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
  44. package/dist/{chunk-24zher49.js → chunk-9vrja6vp.js} +4 -4
  45. package/dist/chunk-9xrbve19.js +2 -0
  46. package/dist/chunk-a688m6js.js +3 -0
  47. package/dist/chunk-ak1cgcah.js +5 -0
  48. package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
  49. package/dist/chunk-amtr3rmf.js +11 -0
  50. package/dist/chunk-atws6p5s.js +2 -0
  51. package/dist/chunk-b84h16er.js +61 -0
  52. package/dist/chunk-b98be3yp.js +32 -0
  53. package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
  54. package/dist/chunk-ce1sejr3.js +3 -0
  55. package/dist/chunk-cg8hg6cs.js +3 -0
  56. package/dist/{chunk-4f9zyfdw.js → chunk-czxt605c.js} +4 -5
  57. package/dist/chunk-dd8cja4h.js +2 -0
  58. package/dist/chunk-dgdm3hy3.js +2 -0
  59. package/dist/chunk-e9hs7kk6.js +12 -0
  60. package/dist/chunk-eed4fwps.js +3 -0
  61. package/dist/chunk-ej9j6k1q.js +3 -0
  62. package/dist/chunk-et0rr8c7.js +3 -0
  63. package/dist/chunk-f1sxycmv.js +2 -0
  64. package/dist/chunk-f46qsp4m.js +4 -0
  65. package/dist/chunk-fbcv4fes.js +2 -0
  66. package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
  67. package/dist/chunk-fjs0a8h7.js +2 -0
  68. package/dist/chunk-fpfzm238.js +2 -0
  69. package/dist/chunk-fr2txj8q.js +829 -0
  70. package/dist/{chunk-xssw417m.js → chunk-ft4p6d28.js} +14 -14
  71. package/dist/chunk-fyzajkrx.js +2 -0
  72. package/dist/chunk-fzapbw9p.js +3 -0
  73. package/dist/chunk-g03s93qr.js +3 -0
  74. package/dist/chunk-g186znp9.js +33 -0
  75. package/dist/chunk-gawrg4gb.js +216 -0
  76. package/dist/chunk-gc1drn2p.js +2 -0
  77. package/dist/chunk-gea5hf0v.js +2 -0
  78. package/dist/chunk-gqv3ta5d.js +2 -0
  79. package/dist/chunk-h6kp2m9r.js +2 -0
  80. package/dist/chunk-h6zsqb9r.js +3 -0
  81. package/dist/{chunk-2snqdnk9.js → chunk-h85hrwkq.js} +13 -13
  82. package/dist/chunk-hbxz85wy.js +2 -0
  83. package/dist/chunk-hepd9qgx.js +6 -0
  84. package/dist/chunk-hhnw2sn3.js +2 -0
  85. package/dist/chunk-hjg3ndgh.js +2 -0
  86. package/dist/chunk-hk1mj4tz.js +2 -0
  87. package/dist/{chunk-smcj3442.js → chunk-hkrmcbwy.js} +79 -79
  88. package/dist/chunk-hn9pkyv8.js +2 -0
  89. package/dist/chunk-hpgr4qgp.js +2 -0
  90. package/dist/chunk-hrbbbtbn.js +2 -0
  91. package/dist/chunk-j03revz2.js +8 -0
  92. package/dist/chunk-j9qcrwbg.js +2 -0
  93. package/dist/chunk-jk4njz0w.js +2 -0
  94. package/dist/chunk-jmabeqfq.js +2 -0
  95. package/dist/chunk-jnkrn913.js +4 -0
  96. package/dist/chunk-jp10q90g.js +2 -0
  97. package/dist/chunk-jt0n43mk.js +2 -0
  98. package/dist/chunk-kjbv8a3m.js +2 -0
  99. package/dist/chunk-m1vdghnx.js +2 -0
  100. package/dist/chunk-m4sk62wb.js +5 -0
  101. package/dist/chunk-md8rqn48.js +30 -0
  102. package/dist/chunk-mp6hy8g4.js +2 -0
  103. package/dist/chunk-nc8my58s.js +2 -0
  104. package/dist/chunk-ngc2wke4.js +3 -0
  105. package/dist/chunk-nn2vstke.js +2 -0
  106. package/dist/chunk-nppdrf0x.js +2 -0
  107. package/dist/chunk-p2v2a68k.js +2 -0
  108. package/dist/chunk-pazfr1a1.js +2 -0
  109. package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
  110. package/dist/chunk-pdb5fw3r.js +2 -0
  111. package/dist/chunk-pdt69hpb.js +2 -0
  112. package/dist/chunk-pgzvyrv6.js +29 -0
  113. package/dist/chunk-px7fvbj6.js +3 -0
  114. package/dist/chunk-q6vrb2pe.js +2 -0
  115. package/dist/chunk-q7qchkvk.js +2 -0
  116. package/dist/chunk-q9bdh4s5.js +8 -0
  117. package/dist/chunk-qghxz7jm.js +194 -0
  118. package/dist/chunk-r3f9jcf7.js +5 -0
  119. package/dist/chunk-re8b5r9x.js +3 -0
  120. package/dist/chunk-s5xezjps.js +3 -0
  121. package/dist/chunk-sd321bn3.js +2 -0
  122. package/dist/chunk-shr559s7.js +3 -0
  123. package/dist/chunk-t4hzprsm.js +3 -0
  124. package/dist/chunk-t5pvq5mx.js +2 -0
  125. package/dist/{chunk-pv3d7sfn.js → chunk-t61vdbje.js} +89 -89
  126. package/dist/chunk-tafqyf2g.js +2033 -0
  127. package/dist/chunk-tfexmdkt.js +3 -0
  128. package/dist/chunk-thyt8ed8.js +6 -0
  129. package/dist/chunk-v91p6ekp.js +24 -0
  130. package/dist/chunk-vgvtnwxa.js +4 -0
  131. package/dist/chunk-w72qx0eb.js +2 -0
  132. package/dist/chunk-wfy1zq53.js +30 -0
  133. package/dist/chunk-wzx0164n.js +18 -0
  134. package/dist/chunk-x0q32ees.js +3 -0
  135. package/dist/chunk-xfp7k0v8.js +64 -0
  136. package/dist/chunk-xtvf6n6f.js +4 -0
  137. package/dist/chunk-xwzvfqcb.js +2 -0
  138. package/dist/chunk-y1cmjvk3.js +43 -0
  139. package/dist/chunk-y5310237.js +311 -0
  140. package/dist/chunk-ya0qecph.js +27 -0
  141. package/dist/chunk-yazk54jr.js +8 -0
  142. package/dist/chunk-ydjfar14.js +2 -0
  143. package/dist/chunk-ym95v4nc.js +3 -0
  144. package/dist/chunk-z0g9jvv0.js +40 -0
  145. package/dist/chunk-z23kaxq6.js +2 -0
  146. package/dist/chunk-z8xn5ta3.js +2 -0
  147. package/dist/{chunk-8sdhs0zk.js → chunk-zhxdpzga.js} +4 -4
  148. package/dist/cli.js +110 -110
  149. package/dist/craft-entry.js +7 -7
  150. package/dist/craft.js +7 -7
  151. package/dist/database.js +2 -2
  152. package/dist/image-optimization/component.js +4 -4
  153. package/dist/media/image/component.js +5 -5
  154. package/dist/media/protected/component.js +2 -2
  155. package/dist/media/video/index.js +4 -4
  156. package/dist/native/bridge/protocol.d.ts +325 -0
  157. package/dist/native/bridge/protocol.js +219 -0
  158. package/dist/native/cli.d.ts +24 -0
  159. package/dist/native/cli.js +52 -0
  160. package/dist/native/compiler/bundle.d.ts +41 -0
  161. package/dist/native/compiler/bundle.js +90 -0
  162. package/dist/native/compiler/client-script.d.ts +8 -0
  163. package/dist/native/compiler/client-script.js +31 -0
  164. package/dist/native/compiler/codegen.d.ts +10 -0
  165. package/dist/native/compiler/codegen.js +145 -0
  166. package/dist/native/compiler/headwind-to-style.d.ts +395 -0
  167. package/dist/native/compiler/headwind-to-style.js +1163 -0
  168. package/dist/native/compiler/html-to-ir.d.ts +41 -0
  169. package/dist/native/compiler/html-to-ir.js +411 -0
  170. package/dist/native/compiler/icons.d.ts +220 -0
  171. package/dist/native/compiler/icons.js +208 -0
  172. package/dist/native/compiler/ir.d.ts +234 -0
  173. package/dist/native/compiler/ir.js +15 -0
  174. package/dist/native/compiler/parser.d.ts +88 -0
  175. package/dist/native/compiler/parser.js +753 -0
  176. package/dist/native/compiler/render-screen.d.ts +26 -0
  177. package/dist/native/compiler/render-screen.js +31 -0
  178. package/dist/native/components/primitives.d.ts +291 -0
  179. package/dist/native/components/primitives.js +22 -0
  180. package/dist/native/hot-reload/client.d.ts +62 -0
  181. package/dist/native/hot-reload/client.js +324 -0
  182. package/dist/native/index.d.ts +90 -0
  183. package/dist/native/index.js +34 -0
  184. package/dist/native/primitives/ActivityIndicator.stx +5 -0
  185. package/dist/native/primitives/Button.stx +5 -0
  186. package/dist/native/primitives/DatePicker.stx +5 -0
  187. package/dist/native/primitives/FlatList.stx +5 -0
  188. package/dist/native/primitives/Image.stx +5 -0
  189. package/dist/native/primitives/ImageBackground.stx +5 -0
  190. package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
  191. package/dist/native/primitives/Modal.stx +5 -0
  192. package/dist/native/primitives/Picker.stx +5 -0
  193. package/dist/native/primitives/Pressable.stx +5 -0
  194. package/dist/native/primitives/RefreshControl.stx +5 -0
  195. package/dist/native/primitives/SafeAreaView.stx +5 -0
  196. package/dist/native/primitives/ScrollView.stx +5 -0
  197. package/dist/native/primitives/SectionList.stx +5 -0
  198. package/dist/native/primitives/Slider.stx +5 -0
  199. package/dist/native/primitives/StatusBar.stx +5 -0
  200. package/dist/native/primitives/Switch.stx +5 -0
  201. package/dist/native/primitives/Text.stx +5 -0
  202. package/dist/native/primitives/TextInput.stx +5 -0
  203. package/dist/native/primitives/TouchableHighlight.stx +5 -0
  204. package/dist/native/primitives/TouchableOpacity.stx +5 -0
  205. package/dist/native/primitives/View.stx +5 -0
  206. package/dist/native/runtime/craft.d.ts +75 -0
  207. package/dist/native/runtime/craft.js +0 -0
  208. package/dist/native/runtime/entry.d.ts +1 -0
  209. package/dist/native/runtime/entry.js +3 -0
  210. package/dist/native/runtime/index.d.ts +45 -0
  211. package/dist/native/runtime/index.js +165 -0
  212. package/dist/native/runtime/native-host.d.ts +33 -0
  213. package/dist/native/runtime/native-host.js +184 -0
  214. package/dist/native/runtime/screen.d.ts +43 -0
  215. package/dist/native/runtime/screen.js +808 -0
  216. package/dist/pwa/service-worker.js +1 -1
  217. package/dist/pwa/workbox.js +1 -1
  218. package/dist/pwa.js +8 -8
  219. package/dist/site-url.d.ts +1 -1
  220. package/dist/ssg.js +53 -53
  221. package/dist/visual-testing.js +42 -42
  222. package/dist/web-components/reactive-generator.js +2 -2
  223. package/package.json +9 -5
  224. package/dist/chunk-0btmm4m2.js +0 -147
  225. package/dist/chunk-0c2h69k2.js +0 -4
  226. package/dist/chunk-0d0qeqvv.js +0 -2
  227. package/dist/chunk-0psndabd.js +0 -2
  228. package/dist/chunk-0qv8yf53.js +0 -2
  229. package/dist/chunk-0vkxyvsd.js +0 -2
  230. package/dist/chunk-0we9nw1d.js +0 -3
  231. package/dist/chunk-0xqdmemy.js +0 -3
  232. package/dist/chunk-0y46fbkx.js +0 -3
  233. package/dist/chunk-158wqccn.js +0 -4422
  234. package/dist/chunk-1cyxbb8y.js +0 -16
  235. package/dist/chunk-1enwnh2a.js +0 -2
  236. package/dist/chunk-213pzm0d.js +0 -3
  237. package/dist/chunk-21hzqyja.js +0 -12
  238. package/dist/chunk-266t58b8.js +0 -5
  239. package/dist/chunk-27fgag95.js +0 -4
  240. package/dist/chunk-2a9n102n.js +0 -2
  241. package/dist/chunk-2eqzrczk.js +0 -2
  242. package/dist/chunk-2ke37m54.js +0 -14
  243. package/dist/chunk-35ds08e7.js +0 -3
  244. package/dist/chunk-3mtwkjcg.js +0 -2
  245. package/dist/chunk-4xr8zwkp.js +0 -2
  246. package/dist/chunk-58v77x2c.js +0 -2
  247. package/dist/chunk-5mhq8605.js +0 -2
  248. package/dist/chunk-5se8xt9e.js +0 -64
  249. package/dist/chunk-5zh0h080.js +0 -2
  250. package/dist/chunk-62435225.js +0 -2
  251. package/dist/chunk-6kdrncsx.js +0 -30
  252. package/dist/chunk-6n2rr3x7.js +0 -2
  253. package/dist/chunk-6xk87qf2.js +0 -30
  254. package/dist/chunk-72rwcbp6.js +0 -3
  255. package/dist/chunk-76w34xne.js +0 -3
  256. package/dist/chunk-7ekd7zj9.js +0 -2
  257. package/dist/chunk-7pr3wdd5.js +0 -3
  258. package/dist/chunk-7rxvafwc.js +0 -24
  259. package/dist/chunk-7tnwfa7w.js +0 -8
  260. package/dist/chunk-8c5je0wf.js +0 -2
  261. package/dist/chunk-8dz6nyvx.js +0 -2
  262. package/dist/chunk-98zj3fv2.js +0 -7
  263. package/dist/chunk-9e8t0twa.js +0 -3
  264. package/dist/chunk-9fqp72ze.js +0 -5
  265. package/dist/chunk-anydpa34.js +0 -3
  266. package/dist/chunk-ay6zjq8v.js +0 -3
  267. package/dist/chunk-az4v4ard.js +0 -3
  268. package/dist/chunk-ba5erggg.js +0 -2
  269. package/dist/chunk-bnagrdz6.js +0 -2
  270. package/dist/chunk-by8wghtf.js +0 -2
  271. package/dist/chunk-cd7h4q51.js +0 -2
  272. package/dist/chunk-cjmv8hgp.js +0 -33
  273. package/dist/chunk-cthf912y.js +0 -2
  274. package/dist/chunk-cxbpmwq5.js +0 -4
  275. package/dist/chunk-d3sy16qn.js +0 -2
  276. package/dist/chunk-dh6s7mrj.js +0 -1199
  277. package/dist/chunk-dm2nzg7a.js +0 -2
  278. package/dist/chunk-e2sgcnxc.js +0 -2
  279. package/dist/chunk-e3b7jj74.js +0 -2
  280. package/dist/chunk-ec4wq2sv.js +0 -6
  281. package/dist/chunk-ekzg97dn.js +0 -29
  282. package/dist/chunk-epjt342x.js +0 -2
  283. package/dist/chunk-eqe26g14.js +0 -18
  284. package/dist/chunk-ev0v1yma.js +0 -2
  285. package/dist/chunk-f53psr2y.js +0 -5
  286. package/dist/chunk-f8p69dsg.js +0 -3
  287. package/dist/chunk-f95drhdb.js +0 -194
  288. package/dist/chunk-ff5a6hvb.js +0 -17
  289. package/dist/chunk-fs5fy4h8.js +0 -2
  290. package/dist/chunk-fzsygce3.js +0 -2
  291. package/dist/chunk-g465x63k.js +0 -2
  292. package/dist/chunk-g708ekh1.js +0 -2
  293. package/dist/chunk-gcr9e83g.js +0 -11
  294. package/dist/chunk-gdmyrsr8.js +0 -4
  295. package/dist/chunk-gkms2ngq.js +0 -2
  296. package/dist/chunk-gnfywmgs.js +0 -7
  297. package/dist/chunk-hpf8kq7e.js +0 -2
  298. package/dist/chunk-j4x3faf8.js +0 -2
  299. package/dist/chunk-jkavtw9f.js +0 -2
  300. package/dist/chunk-kg1rdena.js +0 -3
  301. package/dist/chunk-km91wx0v.js +0 -2
  302. package/dist/chunk-kmsyvaex.js +0 -8
  303. package/dist/chunk-mrahwn5v.js +0 -8
  304. package/dist/chunk-nk3czvnk.js +0 -2
  305. package/dist/chunk-nmw4eewb.js +0 -2
  306. package/dist/chunk-nq5zxrk0.js +0 -4
  307. package/dist/chunk-ny67c03k.js +0 -3
  308. package/dist/chunk-p4wdxp2c.js +0 -2
  309. package/dist/chunk-pcxp4r9n.js +0 -3
  310. package/dist/chunk-pdyeaxc1.js +0 -2
  311. package/dist/chunk-pf06ded4.js +0 -2
  312. package/dist/chunk-pfs0gpzm.js +0 -2
  313. package/dist/chunk-pshdwq44.js +0 -2
  314. package/dist/chunk-pwgv84pn.js +0 -32
  315. package/dist/chunk-pwsnafp3.js +0 -4367
  316. package/dist/chunk-q9n5swx7.js +0 -3
  317. package/dist/chunk-qr346wnp.js +0 -2
  318. package/dist/chunk-r02hke04.js +0 -2
  319. package/dist/chunk-ranshpyc.js +0 -3
  320. package/dist/chunk-rn194bhp.js +0 -20
  321. package/dist/chunk-rn1hgyc8.js +0 -930
  322. package/dist/chunk-s7z5dp70.js +0 -43
  323. package/dist/chunk-s8jd13nb.js +0 -3
  324. package/dist/chunk-sn7exv0n.js +0 -2
  325. package/dist/chunk-t1tdjjht.js +0 -216
  326. package/dist/chunk-t6qx04s8.js +0 -499
  327. package/dist/chunk-t6y6gyps.js +0 -2
  328. package/dist/chunk-tjfs7cc3.js +0 -2
  329. package/dist/chunk-tkyrk66a.js +0 -3
  330. package/dist/chunk-tntv9hvq.js +0 -2
  331. package/dist/chunk-v3nwkveg.js +0 -12
  332. package/dist/chunk-vd4cb5xr.js +0 -2
  333. package/dist/chunk-vkhdce50.js +0 -2
  334. package/dist/chunk-w183av08.js +0 -2
  335. package/dist/chunk-w2m02njv.js +0 -2
  336. package/dist/chunk-wpjrcrs5.js +0 -2
  337. package/dist/chunk-wqmppf6b.js +0 -3
  338. package/dist/chunk-wtb9fxdy.js +0 -2
  339. package/dist/chunk-xmzygmcz.js +0 -3
  340. package/dist/chunk-xsng1mtq.js +0 -3
  341. package/dist/chunk-xxzefj4j.js +0 -2
  342. package/dist/chunk-yq8x8bxq.js +0 -47
  343. package/dist/chunk-ytma76qe.js +0 -3
  344. package/dist/chunk-yw1m115e.js +0 -2
  345. package/dist/chunk-z64a924m.js +0 -2
  346. package/dist/chunk-zcz9rs6p.js +0 -3
@@ -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-3efw27as.js";import{ce,mt,ht}from"./chunk-42wbs8vq.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{ql,Xl}from"./chunk-amtr3rmf.js";import"./chunk-42wbs8vq.js";import"./chunk-hepd9qgx.js";import"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.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{Xl as clearStoreCache,ql as getStoreScript};
@@ -0,0 +1,61 @@
1
+ // @bun
2
+ import{Oe}from"./chunk-fr2txj8q.js";function On(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Oe(e),i=`
3
+ <!-- stx PWA Meta Tags -->
4
+ <link rel="manifest" href="/manifest.json">
5
+ <meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
6
+ <meta name="mobile-web-app-capable" content="yes">
7
+ <meta name="apple-mobile-web-app-capable" content="yes">
8
+ <meta name="apple-mobile-web-app-status-bar-style" content="default">
9
+ <meta name="apple-mobile-web-app-title" content="${a(r?.shortName||r?.name||"App")}">`;if(n.icons?.generateAppleIcons!==!1)i+=`
10
+ <link rel="apple-touch-icon" href="${t}/apple-touch-icon.png">
11
+ <link rel="apple-touch-icon" sizes="120x120" href="${t}/apple-touch-icon-120x120.png">
12
+ <link rel="apple-touch-icon" sizes="152x152" href="${t}/apple-touch-icon-152x152.png">
13
+ <link rel="apple-touch-icon" sizes="167x167" href="${t}/apple-touch-icon-167x167.png">
14
+ <link rel="apple-touch-icon" sizes="180x180" href="${t}/apple-touch-icon-180x180.png">`;return i+=`
15
+ <link rel="icon" type="image/png" sizes="32x32" href="${t}/favicon-32x32.png">
16
+ <link rel="icon" type="image/png" sizes="16x16" href="${t}/favicon-16x16.png">
17
+ <link rel="icon" type="image/png" sizes="192x192" href="${t}/icon-192x192.png">`,i+=`
18
+ <!-- stx Service Worker Registration -->
19
+ <script>
20
+ if ('serviceWorker' in navigator) {
21
+ window.addEventListener('load', function() {
22
+ navigator.serviceWorker.register('/${o}')
23
+ .then(function(registration) {
24
+ console.log('[PWA] Service Worker registered:', registration.scope);
25
+
26
+ // Check for updates
27
+ registration.addEventListener('updatefound', function() {
28
+ const newWorker = registration.installing;
29
+ if (newWorker) {
30
+ newWorker.addEventListener('statechange', function() {
31
+ if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
32
+ console.log('[PWA] New content available, refresh to update');
33
+ // Optionally dispatch a custom event for UI notification
34
+ window.dispatchEvent(new CustomEvent('pwa-update-available'));
35
+ }
36
+ });
37
+ }
38
+ });
39
+ })
40
+ .catch(function(error) {
41
+ console.error('[PWA] Service Worker registration failed:', error);
42
+ });
43
+ });
44
+ }
45
+ </script>
46
+ <!-- End stx PWA -->`,i}function zr(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=On(n);return e.slice(0,o)+i+`
47
+ `+e.slice(o)}return e+On(n)}let t=On(n);return e.replace("</head>",`${t}
48
+ </head>`)}function Na(e){if(!e.pwa?.enabled)return"";return`<script>
49
+ if ('serviceWorker' in navigator) {
50
+ window.addEventListener('load', function() {
51
+ navigator.serviceWorker.register('/${Oe(e)}')
52
+ .then(function(registration) {
53
+ console.log('[PWA] Service Worker registered:', registration.scope);
54
+ })
55
+ .catch(function(error) {
56
+ console.error('[PWA] Service Worker registration failed:', error);
57
+ });
58
+ });
59
+ }
60
+ </script>`}function La(){return'<link rel="manifest" href="/manifest.json">'}function ja(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
61
+ export{On,zr,Na,La,ja};
@@ -0,0 +1,32 @@
1
+ // @bun
2
+ import{o}from"./chunk-fzapbw9p.js";import h from"path";import{hasLocalConfig as Ae}from"bunfig";var ue={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function N(t){return`--stx-${t}`}function W(t,n){let r=n.lastIndexOf("-");if(r===-1)return typeof t[n]==="string"?t[n]:void 0;let s=t[n.slice(0,r)];if(!s||typeof s!=="object")return;let i=s[n.slice(r+1)];return typeof i==="string"?i:void 0}function de(t){let n={};for(let[r,s]of Object.entries(ue)){let i=W(t,s.light);if(i===void 0)continue;n[r]=`var(${N(r)}, ${i})`}return n}function ge(t){let n=[],r=[];for(let[s,i]of Object.entries(ue)){let a=W(t,i.light),c=W(t,i.dark);if(a===void 0)continue;if(n.push(` ${N(s)}: ${a};`),c!==void 0)r.push(` ${N(s)}: ${c};`)}if(n.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...n,"}",".dark {",...r,"}",""].join(`
3
+ `)}var fe={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function pe(t){return`--stx-radius-${t}`}function he(){let t={};for(let[n,r]of Object.entries(fe))t[n]=`var(${pe(n)}, ${r.value})`;return t}function me(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(fe).map(([t,n])=>` ${pe(t)}: ${n.value};`),"}",""].join(`
4
+ `)}function ye(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function F(t,n){let r={...t};for(let[s,i]of Object.entries(n))r[s]=ye(i)&&ye(r[s])?F(r[s],i):i;return r}function be(t={},n={}){let r=t.theme||{},s=n.theme||{},{extend:i,...a}=s,{extend:c,...d}=r,l=d.colors||{};d.colors={...l,...de(l)};let u=d.borderRadius||{};d.borderRadius={...u,...he()};let g=F(d,a),p=F(c||{},i||{});if(Object.keys(p).length>0)g.extend=p;let m=[...t.safelist||[],...n.safelist||[]],S={...t.shortcuts||{},...n.shortcuts||{}},C=[...t.preflights||[],...n.preflights||[]];return{config:{...t,...n,theme:g,safelist:m,shortcuts:S,...C.length>0?{preflights:C}:{},content:[],output:""},safelist:m,shortcuts:S,includePreflight:n.preflight!==!1,minify:n.minify===!0,tokenCSS:ge(l)+me()}}var _=/<script\b[^>]*>/iy,q=/<\/script\s*>/ig,M=/<style\b[^>]*>/iy,Q=/<\/style\s*>/ig;function Se(t,n,r,s){r.lastIndex=n;let i=r.exec(t);if(!i||i.index!==n)return-1;s.lastIndex=r.lastIndex;let a=s.exec(t);if(!a)return-1;return a.index+a[0].length}function G(t,n){return Se(t,n,_,q)}function Ct(t,n){return Se(t,n,M,Q)}function xe(t,n){if(!t.startsWith("<!--",n))return-1;let r=t.indexOf("-->",n+4);if(r===-1)return-1;return r+3}function Ce(t,n){if(t.startsWith("<!--",n)){let i=xe(t,n);return i===-1?t.length:i}if(_.lastIndex=n,_.exec(t)?.index===n){q.lastIndex=_.lastIndex;let i=q.exec(t);return i?i.index+i[0].length:t.length}if(M.lastIndex=n,M.exec(t)?.index===n){Q.lastIndex=M.lastIndex;let i=Q.exec(t);return i?i.index+i[0].length:t.length}return-1}function $t(t,n){let r=[],s=0,i=t.length,a=!1,c=null;while(s<i){let d=t[s];if(a){if(c){if(d===c)c=null}else if(d==='"'||d==="'")c=d;else if(d===">")a=!1;s++;continue}if(d!=="<"){let p=t.indexOf("<",s+1);if(p===-1)break;s=p;continue}let l=n(t,s);if(l>s){r.push({start:s,end:l,token:t.slice(s,l)}),s=l;continue}let u=Ce(t,s);if(u>s){s=u;continue}let g=t.charCodeAt(s+1);if(g>=65&&g<=90||g>=97&&g<=122)a=!0;s++}return r}function bo(t){let n=0,r=0,s=0,i=!1,a=null;while(s<t.length){if(i){let p=t[s];if(a){if(p===a)a=null}else if(p==='"'||p==="'")a=p;else if(p===">")i=!1;s++;continue}let c=t.indexOf("<",s),d=c===-1?t.length:c;while(s<d){let p=t[s++];if(p==="{")n++;else if(p==="}")r++;if(n>=2&&r>=2)return!0}if(c===-1)break;let l=Ce(t,c);if(l>c){s=l;continue}let u=t.charCodeAt(c+1),g=u===47?t.charCodeAt(c+2):u;if(g>=65&&g<=90||g>=97&&g<=122)i=!0;s=c+1}return!1}function Yn(t,n){while(t.size>=n){let r=t.keys().next();if(r.done)return;t.delete(r.value)}}var Ve=65536,He=12,U=new Map;function ne(t,n,r,s){let i=s!==void 0&&t.length>=Ve,a=i?`${s}\x00${t}`:"";if(i){let g=U.get(a);if(g)return{output:g.output,tokens:g.tokens.slice()}}let c=$t(t,n);if(c.length===0)return{output:t,tokens:[]};let d=c.map((g)=>g.token),l="",u=0;for(let g=0;g<c.length;g++){let p=c[g];l+=t.slice(u,p.start),l+=r(p.token,g),u=p.end}if(l+=t.slice(u),i)return Yn(U,He),U.set(a,{output:l,tokens:d}),{output:l,tokens:d.slice()};return{output:l,tokens:d}}var Ke=65536,Ne=4,Y=new Map;function X(t,n,r){return{output:n,scripts:r,restore:(s)=>s===n?t:Et(s,r)}}function V(t){let n=t.length>=Ke;if(n){let i=Y.get(t);if(i)return X(t,i.output,i.scripts.slice())}let{output:r,tokens:s}=ne(t,G,(i,a)=>`\x00STX_SCRIPT_${a}\x00`);if(n)return Yn(Y,Ne),Y.set(t,{output:r,scripts:s}),X(t,r,s.slice());return X(t,r,s)}function Et(t,n){if(n.length===0)return t;return t.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,s)=>n[+s]??"")}function ke(t,n=""){let r=`${t}${n}`,s=0;for(let i=0;i<r.length;i++){let a=r.charCodeAt(i);s=(s<<5)-s+a,s=s&s}return`stx-${Math.abs(s).toString(36)}`}function we(t,n,r={}){let{prefix:s="",preserveHost:i=!0,scopeKeyframes:a=!0,scopeCustomProperties:c=!1}=r;if(!t.trim())return"";let d=J(t),l=[],u=new Map;if(a)for(let g of d){let p=g.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(p){let m=p[1],S=`${n}_${m}`;u.set(m,S)}}for(let g of d){let p=Te(g,n,s,i,u,c);l.push(p)}return l.join(`
5
+
6
+ `)}function J(t){let n=[],r=t.replace(/\/\*[\s\S]*?\*\//g,""),s=0,i="",a=!1,c="";for(let d=0;d<r.length;d++){let l=r[d];if(l==="@"&&s===0)a=!0;if(l==="{")s++;else if(l==="}"){if(s--,s===0){if(a){c+=l;let u=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(u){let[,g,p,m]=u;if(g==="keyframes")n.push({selector:`@keyframes ${p.trim()}`,declarations:m.trim()});else if(g==="media"||g==="supports"||g==="container"){let S=J(m);n.push({selector:`@${g} ${p.trim()}`,declarations:S.map((C)=>`${C.selector} { ${C.declarations} }`).join(`
7
+ `)})}else n.push({selector:`@${g} ${p.trim()}`,declarations:m.trim()})}c="",a=!1}else if(i.trim()){i+=l;let u=i.match(/([^{]+)\{([^}]*)\}/);if(u)n.push({selector:u[1].trim(),declarations:u[2].trim()});i=""}continue}}if(a)c+=l;else i+=l}return n}function Te(t,n,r,s,i,a){let{selector:c,declarations:d}=t;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let g=c.replace("@keyframes ","").trim();return`@keyframes ${i.get(g)||g} { ${d} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let p=J(`x { ${d} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((m)=>Te(m,n,r,s,i,a)).join(`
8
+ `);return`${c} {
9
+ ${p}
10
+ }`}return`${c} { ${d} }`}let l=We(c,n,r,s),u=d;for(let[g,p]of i)u=u.replace(new RegExp(`\\b${g}\\b`,"g"),p);if(a)u=u.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${l} { ${u} }`}function We(t,n,r,s){let i=t.split(",").map((c)=>c.trim()),a=[];for(let c of i){if(c.startsWith(":host")){if(s)a.push(c);else{let u=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);a.push(u)}continue}if(c.includes("::slotted")){a.push(c);continue}if(c===":root"){a.push(`:root .${n}`);continue}let d=r?`${r} .${n}`:`.${n}`;a.push(`${d} ${c}`);let l=Fe(c,n);if(l)a.push(r?`${r} ${l}`:l)}return a.join(", ")}function Fe(t,n){let r=0,s=t.length;for(let l=0;l<t.length;l++){let u=t[l];if(u==="["||u==="(")r++;else if(u==="]"||u===")")r--;else if(r===0&&(u===" "||u===">"||u==="+"||u==="~")){s=l;break}}let i=t.slice(0,s),a=t.slice(s);if(!i)return"";let c=i.length,d=0;for(let l=0;l<i.length;l++){let u=i[l];if(u==="["||u==="(")d++;else if(u==="]"||u===")")d--;else if(r===0&&d===0&&u===":"){c=l;break}}return`${i.slice(0,c)}.${n}${i.slice(c)}${a}`}var Ee=String.raw`(?<![\w-])scoped(?![\w-])`,Z=/<style\s+([^>]*)>/gi,ve=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Re=new RegExp(Ee,"i"),Ue=new RegExp(Ee,"gi"),ee=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ge(t){Z.lastIndex=0;let n=Z.exec(t);while(n!==null){if(Re.test(n[1]))return!0;n=Z.exec(t)}return!1}function te(t){let n=new Set,r=[];ee.lastIndex=0;let s=ee.exec(t);while(s!==null){let i=s[0].trim();if(n.has(i))r.push({start:s.index,end:s.index+s[0].length});else n.add(i);s=ee.exec(t)}return r}function cn(t){let n=te(t);if(n.length===0)return t;let r=Array(n.length+1),s=0;for(let i=0;i<n.length;i++){let a=n[i];r[i]=t.slice(s,a.start),s=a.end}return r[n.length]=t.slice(s),r.join("")}function Zn(t,n){if(!Ge(t))return{html:t,hasScoped:!1};let r=ke(n),s=`data-v-${r}`,i=t,a=!1;if(ve.lastIndex=0,i=i.replace(ve,(c,d,l)=>{if(!Re.test(d))return c;a=!0;let u=Ye(l,s),g=d.replace(Ue,"").trim(),p=g?` ${g}`:"";return`<style data-stx-scoped="${r}"${p}>${u}</style>`}),!a)return{html:t,hasScoped:!1};return i=Qe(i,s),{html:i,hasScoped:!0}}function Ye(t,n){return we(t,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var qe=(t)=>`\x00stx-scope-mask-${t}\x00`,$e=/\u0000stx-scope-mask-(\d+)\u0000/g;function Qe(t,n){let r=ne(t,(i,a)=>{let c=G(i,a);return c>a?c:Ct(i,a)},(i,a)=>qe(a)),s=Je(r.output,n);return $e.lastIndex=0,s.replace($e,(i,a)=>r.tokens[Number(a)])}function Je(t,n){let r=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return t.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(s,i,a)=>{if(r.has(i.toLowerCase()))return s;if(s.includes(n))return s;if(i.toLowerCase()==="style"||i.toLowerCase()==="script")return s;if(a)return s.replace(`<${i}${a}`,`<${i} ${n}${a}`);if(s.endsWith("/>"))return`<${i} ${n} />`;return`<${i} ${n}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import _e from"fs";class z{cache=new Map;maxSize;options;sizes;bytes=0;constructor(t=100,n){this.maxSize=t,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(t){if(!this.options)return;this.options={...this.options,maxBytes:t};while(this.bytes>t&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(t){if(!this.cache.has(t))return;let n=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,n),n}set(t,n){if(this.cache.has(t))this.delete(t);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}if(this.cache.set(t,n),this.sizes)this.sizes.set(t,r),this.bytes+=r}has(t){return this.cache.has(t)}delete(t){if(this.sizes){let n=this.sizes.get(t);if(n!==void 0)this.bytes-=n,this.sizes.delete(t)}return this.cache.delete(t)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var T=new Map,Ze=500;function Xe(t,n){if(n?.includes("g"))return new RegExp(t,n);let r=`${t}:${n||""}`;if(!T.has(r)){if(T.size>=Ze){let s=T.keys().next().value;if(s)T.delete(s)}T.set(r,new RegExp(t,n))}return T.get(r)}class Pe{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(t){let n=Array.from(new Set(t)),r=n.sort().join(","),s=this.pool.find((d)=>d.context.join(",")===r);if(s)return s.func;let i=this.fnCache,a=this.fnCacheMaxSize,c=(...d)=>(l)=>{try{let u=`${r}:${l}`,g=i.get(u);if(!g){if(i.size>=a){let p=i.keys().next().value;if(p)i.delete(p)}g=Function(...n,`
11
+ 'use strict';
12
+ try {
13
+ return ${l};
14
+ }
15
+ catch (e) {
16
+ if (e instanceof ReferenceError || e instanceof TypeError) {
17
+ return undefined;
18
+ }
19
+ throw e;
20
+ }
21
+ `),i.set(u,g)}return g(...d)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:n.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var St=new Pe;class Be{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}setBudget(t,n){this.budgets.set(t,{warnThreshold:0.8,action:"warn",...n})}setBudgets(t){for(let[n,r]of Object.entries(t))this.setBudget(n,r)}removeBudget(t){this.budgets.delete(t)}getBudgets(){let t={};for(let[n,r]of this.budgets.entries())t[n]=r;return t}onViolation(t){this.violationHandlers.push(t)}offViolation(t){let n=this.violationHandlers.indexOf(t);if(n!==-1)this.violationHandlers.splice(n,1)}time(t,n){if(!this.enabled)return n();let r=performance.now(),s=n(),i=performance.now()-r;return this.recordTime(t,i),this.checkBudget(t,i),s}async timeAsync(t,n){if(!this.enabled)return n();let r=performance.now(),s=await n(),i=performance.now()-r;return this.recordTime(t,i),this.checkBudget(t,i),s}checkBudget(t,n){let r=this.budgets.get(t);if(!r)return;let s=n/r.maxTime*100,i=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,a=n>=r.maxTime;if(!i&&!a)return;let c={label:t,actualTime:n,budgetTime:r.maxTime,exceedancePercent:s,timestamp:new Date,isWarning:i};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let l of this.violationHandlers)try{l(c)}catch{}let d=i?`[Performance Warning] "${t}" took ${n.toFixed(2)}ms (${s.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${t}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(s-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d);break;case"throw":if(a)throw Error(d);else console.warn(d);break}}recordTime(t,n){let r=this.metrics.get(t);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(t,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(t){if(t){let r=this.metrics.get(t);if(!r)return{};let s=this.budgets.get(t);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:s?.maxTime,budgetUtilization:s?r.totalTime/r.count/s.maxTime*100:void 0}}let n={};for(let[r,s]of this.metrics.entries()){let i=this.budgets.get(r);n[r]={count:s.count,avgTime:s.totalTime/s.count,totalTime:s.totalTime,maxTime:s.maxTime,minTime:s.minTime,budget:i?.maxTime,budgetUtilization:i?s.totalTime/s.count/i.maxTime*100:void 0}}return n}getViolations(t){if(t)return this.violations.filter((n)=>n.label===t);return[...this.violations]}getViolationStats(){let t={},n=0,r=0;for(let s of this.violations)if(t[s.label]=(t[s.label]||0)+1,s.isWarning)n++;else r++;return{total:this.violations.length,byLabel:t,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var se=null;function et(){if(!se)se=new Be;return se}var H=new Proxy({},{get(t,n){return et()[n]}});var Me=[];function P(t){let n=new z(t);return Me.push(n),n}function ho(){for(let t of Me)t.clear()}function D(t,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${t.length}\x00${Bun.hash(t)}`}function yo(t){let n=[];for(let r of new Set(t))try{n.push({path:r,mtimeMs:_e.statSync(r).mtimeMs})}catch{}return n}function kt(t){for(let n of t)try{if(_e.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var y=null,ie=!1,w=null,B="",v=!1,De=256,k=new Map,b=new Map,A=null,ze=null,O=new Map;function j(t){return Bun.hash(t).toString(16).padStart(16,"0").slice(0,16)}function re(t,n){if(k.has(t))k.delete(t);else if(k.size>=De)k.delete(k.keys().next().value);k.set(t,n)}function tt(t){let n=j(t);if(b.has(n))b.delete(n);else if(b.size>=De)b.delete(b.keys().next().value);return b.set(n,t),n}function zu(t){let n=b.get(t);if(n===void 0)return;return b.delete(t),b.set(t,n),n}async function nt(t,n=A){if(!n)return null;try{let r=Bun.file(h.join(n,`cw-${j(t)}.css`));if(!await r.exists())return null;return await r.text()}catch{return null}}async function st(t,n,r=A){if(!r)return;try{if(!fs.existsSync(r))fs.mkdirSync(r,{recursive:!0});await Bun.write(h.join(r,`cw-${j(t)}.css`),n)}catch{}}async function Oe(t){try{let n=await import(t);if(n&&n.CSSGenerator)return{CSSGenerator:n.CSSGenerator,config:n.config,build:n.build,defaultConfig:n.defaultConfig,extractClasses:n.extractClasses}}catch{}return null}var rt=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],it=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ot(){let t=[],n=process.cwd();while(n!==h.dirname(n)){for(let r of["node_modules","pantry"])for(let s of rt)t.push(h.join(n,r,...s));n=h.dirname(n)}return t}function at(){let t=[],n=process.env.HOME||process.env.USERPROFILE||"",r=[n&&h.join(n,"Code","Tools","ts-css"),n&&h.join(n,"Code","Tools","crosswind"),n&&h.join(n,"repos","stacks-org","ts-css"),n&&h.join(n,"repos","stacks-org","crosswind"),h.join(process.cwd(),"..","ts-css"),h.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let s of r)t.push(h.join(s,"packages","toolkit","dist","engine","index.js")),t.push(h.join(s,"packages","toolkit","src","engine","index.ts"));if(n)t.push(h.join(n,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return t}async function vo(){if(ie)return y;ie=!0;try{let t=async(i)=>{for(let a of i){if(!await Bun.file(a).exists())continue;let c=await Oe(a);if(c){if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${h.dirname(h.dirname(a))}`);return c}}return null};if(process.env.CROSSWIND_SRC){let i=h.resolve(process.env.CROSSWIND_SRC),a=await t([i]);if(!a)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return y=a,y}let n=await t(ot());if(n)return y=n,y;let r=it;for(let i of r){let a=await Oe(i);if(a){if(y=a,!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return y}}let s=await t(at());if(s)return y=s,y;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Hu(){oe.clear(),y=null,ie=!1,w=null,B="",k.clear(),b.clear(),ze=null,O.clear()}var je=!1;async function wo(t){try{let n=Ae({name:"css",cwd:t})?"css":Ae({name:"crosswind",cwd:t})?"crosswind":null;if(!n)return null;if(n==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!je)je=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:r}=await import("bunfig"),s=await r({name:n,cwd:t,defaultConfig:{},checkEnv:!1,verbose:!1});if(!s?.path||!s.config||Object.keys(s.config).length===0)return null;let i=h.relative(t,s.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||s.path}`);return s.config}catch(n){if(n instanceof Error&&n.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,n instanceof Error?n.message:n),null}}async function Cc(t){let n=null;try{let{loadStxConfig:r}=await import("./chunk-hpgr4qgp.js"),s=await r(t);if(s.css)if(typeof s.css==="string"){let i=h.isAbsolute(s.css)?s.css:h.resolve(t,s.css);if(await Bun.file(i).exists()){let a=await import(i);n=a.default||a,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${s.css}`)}}else{if(n={...s.css,content:s.css.content||[],preflight:s.css.preflight??!0,minify:s.css.minify??!1},s.css.config){let i=h.isAbsolute(s.css.config)?s.css.config:h.resolve(t,s.css.config);if(await Bun.file(i).exists()){let a=await import(i);n={...a.default||a,...n}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return n||await wo(t)}function $c(t){try{let n=new WeakSet;return j(JSON.stringify(t??{},(r,s)=>{if(typeof s==="function")return`[fn]${String(s)}`;if(typeof s==="object"&&s!==null){if(n.has(s))return"[circular]";n.add(s)}return s})??"")}catch{return"unhashable"}}async function Tt(t){if(v)return B;v=!0;try{let n=await vo();if(!n||!n.build)return v=!1,"";if(!w)w=await wo(t);if(!w)return v=!1,"";let r=n.defaultConfig?.theme||{},s=w.theme||{},i={...n.defaultConfig,...w,theme:{...r,...s,extend:{...r.extend||{},...s.extend||{}}}},a=performance.now(),c=await n.build(i),d=performance.now()-a;if(B=c.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${c.classes.size} classes in ${d.toFixed(1)}ms`),i.output){let l=h.isAbsolute(i.output)?i.output:h.join(t,i.output),u=h.dirname(l);if(!fs.existsSync(u))fs.mkdirSync(u,{recursive:!0});await Bun.write(l,c.css)}return v=!1,c.css}catch(n){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,n),v=!1,B}}async function ln(t){w=null,await Tt(t)}function Vu(){return B}function Ec(t){let n=new Set,r=/class\s*=\s*["']([^"']+)["']/gi,s=r.exec(t);while(s!==null){for(let c of s[1].split(/\s+/))if(c.trim())n.add(c.trim());s=r.exec(t)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,a=i.exec(t);while(a!==null){let c=a[1].match(/'([^']+)'/g);if(c){for(let d of c)for(let l of d.slice(1,-1).split(/\s+/))if(l.trim())n.add(l.trim())}a=i.exec(t)}return n}var oe=P(64);async function Tc(t,n){let r=()=>O.get(n?h.resolve(n):process.cwd())?.fingerprint??null,s=oe.get(D(t,n,r()));if(s!==void 0)return s;let i=await ct(t,n);if(i)oe.set(D(t,n,r()),i);return i}async function ct(t,n){try{let r=await vo();if(!r)return"";let s=typeof r.extractClasses==="function"?r.extractClasses(t):Ec(t);if(s.size===0)return"";let i=n?h.resolve(n):process.cwd(),a=o(i,"cache");if(!A)A=a;let c=O.get(i);if(!c){let x=await Cc(i);c={config:x,fingerprint:$c(x)},O.set(i,c),ze=c.fingerprint}let d=[...s].sort().join(" "),l=`${c.fingerprint||"default"}::${d}`,u=k.get(l);if(u!==void 0)return re(l,u),u;let g=await nt(l,a);if(g!==null)return re(l,g),g;let p=r.defaultConfig||r.config,m=c.config||{},S=be(p,m),{safelist:C,includePreflight:ae,minify:ce,tokenCSS:Ie}=S,I=S.config,L=new r.CSSGenerator(I),K=I.shortcuts||m.shortcuts||{},le=Object.keys(K).filter((x)=>s.has(x)||C.includes(x));for(let x of C)if(!K[x])L.generate(x);for(let x of s)if(!K[x])L.generate(x);let E="";if(le.length>0){let x=new r.CSSGenerator(I);for(let Le of le)x.generate(Le);if(E=x.toCSS(!1,ce),E&&!E.endsWith(`
22
+ `))E+=`
23
+ `}let R=E+L.toCSS(ae,ce);return R=Ie+R,re(l,R),st(l,R,a),R}catch(r){return console.warn("Failed to generate Css CSS:",r),""}}async function f(t,n,r=!1,s=!1){let i=await Tc(t,n);if(!i)return s?cn(t):t;let a=r?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${tt(i)}.css">`:`<style data-css="generated">
24
+ ${i}
25
+ </style>`;if(s)return lt(t,a);let c=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(c.test(t)){let d=!1;return t.replace(c,()=>{if(d)return"";return d=!0,a})}if(t.includes("</head>"))return t.replace("</head>",`${a}
26
+ </head>`);if(t.includes("<body"))return t.replace(/<body([^>]*)>/,`<body$1>
27
+ ${a}`);return a+t}function lt(t,n){let r=te(t).map((l)=>({...l,replacement:""})),s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=s.exec(t);if(i!==null){let l=!0;while(i!==null)r.push({start:i.index,end:i.index+i[0].length,replacement:l?n:""}),l=!1,i=s.exec(t)}else{let l=t.indexOf("</head>");if(l!==-1)r.push({start:l,end:l,replacement:`${n}
28
+ `});else{let u=t.match(/<body([^>]*)>/);if(u?.index!==void 0)r.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
29
+ ${n}`});else r.push({start:0,end:0,replacement:n})}}r.sort((l,u)=>l.start-u.start||l.end-u.end);for(let l=1;l<r.length;l++)if(r[l].start<r[l-1].end)return ut(cn(t),n);let a=Array(r.length*2+1),c=0,d=0;for(let l of r)a[d++]=t.slice(c,l.start),a[d++]=l.replacement,c=l.end;return a[d]=t.slice(c),a.join("")}function ut(t,n){let r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(r.test(t)){let s=!1;return t.replace(r,()=>{if(s)return"";return s=!0,n})}if(t.includes("</head>"))return t.replace("</head>",`${n}
30
+ </head>`);if(t.includes("<body"))return t.replace(/<body([^>]*)>/,`<body$1>
31
+ ${n}`);return n+t}
32
+ export{z,Xe,H,P,ho,D,yo,kt,G,Ct,xe,$t,bo,Yn,ne,V,Et,cn,Zn,e,zu,vo,Hu,wo,Cc,$c,Tt,ln,Vu,Ec,Tc,f};
@@ -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,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,2 @@
1
+ // @bun
2
+ import{wi,xi,Si,ku}from"./chunk-hkrmcbwy.js";import"./chunk-wzx0164n.js";import"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.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{wi as buildNative,ku as default,Si as getAvailableFormats,xi as getAvailableTargets};
@@ -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,12 @@
1
+ // @bun
2
+ import"./chunk-ce1sejr3.js";import"./chunk-8nhshfz6.js";import{y,N}from"./chunk-3efw27as.js";import"./chunk-z0g9jvv0.js";import{P,D}from"./chunk-b98be3yp.js";import"./chunk-shr559s7.js";import"./chunk-czxt605c.js";import"./chunk-m4sk62wb.js";import"./chunk-xfp7k0v8.js";import"./chunk-ak1cgcah.js";import"./chunk-ngc2wke4.js";import"./chunk-9amp82bx.js";import"./chunk-7gkv67ky.js";import"./chunk-752hw7cd.js";import f 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","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","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","useVisibility","useWakeLock","useWindowSize"],M=new Set(b);var l=new Map,h=P(64),S=new Set,v=0,C=new Set(b);function W(){l.clear(),h.clear()}function E(o){let n=new Map;for(let r of o){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function R(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function I(o){if(!o)return[];let n=D(o,v),r=h.get(n);if(r)return r.slice();let a=o.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,""),t=[];for(let i of C){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(n,t),t.slice()}async function U(o,n){let r=I(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=N({loader:"ts",target:"browser",define:y()}),k=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=E(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.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(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
+ ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let w=r.filter((s)=>!d.has(s)&&!R(o,s));if(w.length>0)console.warn(`[stx] could not bundle ${w.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 l.set(t,""),null;let O=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
+ `),x=`<script data-stx-framework-composables>
5
+ ;(function(){
6
+ var __s = window.stx = window.stx || {};
7
+ ${m.join(`
8
+
9
+ `)}
10
+ ${O}
11
+ })();
12
+ </script>`;return l.set(t,x),x}function A(o){S.clear();for(let n of o)S.add(n);v++}export{A as __setRuntimeOwnedForTest,W as clearFrameworkComposableCache,U as getFrameworkComposableScript,I as referencedFrameworkComposables,E as selectComposableFiles};
@@ -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,2 @@
1
+ // @bun
2
+ import{Gc}from"./chunk-v91p6ekp.js";import"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.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{Gc as startInteractive};
@@ -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{Mo,No}from"./chunk-tafqyf2g.js";import"./chunk-md8rqn48.js";import"./chunk-y1cmjvk3.js";import"./chunk-8eqrwj1k.js";import"./chunk-3kthfs03.js";import"./chunk-v91p6ekp.js";import"./chunk-xtvf6n6f.js";import"./chunk-x0q32ees.js";import"./chunk-ej9j6k1q.js";import"./chunk-9p9qkbtg.js";import"./chunk-g03s93qr.js";import{ti}from"./chunk-wfy1zq53.js";import"./chunk-340a824p.js";import"./chunk-eed4fwps.js";import"./chunk-96k8s808.js";import"./chunk-mp6hy8g4.js";import"./chunk-pgzvyrv6.js";import"./chunk-gawrg4gb.js";import"./chunk-6h38kkjf.js";import"./chunk-vgvtnwxa.js";import"./chunk-t4hzprsm.js";import"./chunk-g186znp9.js";import"./chunk-5qns2sdz.js";import"./chunk-9pt8fd2n.js";import"./chunk-bay9s6rs.js";import"./chunk-fh1qrp68.js";import"./chunk-pbh4smw3.js";import"./chunk-amd6ey3t.js";import"./chunk-amtr3rmf.js";import"./chunk-qghxz7jm.js";import"./chunk-765e1s44.js";import{Zt,Qt}from"./chunk-re8b5r9x.js";import"./chunk-wzx0164n.js";import"./chunk-r3f9jcf7.js";import"./chunk-42wbs8vq.js";import"./chunk-hepd9qgx.js";import{ye,X,d,r,Kn,A,i,ue}from"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.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{Kn as buildWebComponents,Qt as cacheTemplate,Zt as checkCache,ti as classifyAllScripts,Mo as createMiddleware,No as createRoute,A as defaultConfig,d as extractVariables,X as injectRouterScript,i as loadStxConfig,ye as processClientScript,r as processDirectives,ue as readMarkdownFile};