@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,311 @@
1
+ // @bun
2
+ import{ae,pt}from"./chunk-thyt8ed8.js";import{ge}from"./chunk-px7fvbj6.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
3
+ maxEntries: ${o},
4
+ ${u?`maxAgeSeconds: ${u},`:""}
5
+ purgeOnQuotaError: true,
6
+ })`)}if(a.strategy==="network-first"||a.strategy==="stale-while-revalidate")s.push(`new CacheableResponsePlugin({
7
+ statuses: [0, 200],
8
+ })`);let l=p(a.pattern);c.push(`
9
+ // ${a.pattern}
10
+ registerRoute(
11
+ ${l},
12
+ new ${i}({
13
+ cacheName: '${a.cacheName||h(a.pattern)}',
14
+ ${s.length>0?`plugins: [
15
+ ${s.join(`,
16
+ `)}
17
+ ],`:""}
18
+ })
19
+ );`)}return c.join(`
20
+ `)}function p(e){if(e.startsWith("*.")){let t=e.slice(2);return`({ request }) => request.destination === '${f(t)}'`}if(e.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${e.slice(0,-3)}')`;if(e.endsWith("/*")){let t=e.slice(0,-2);return`({ url }) => url.pathname.startsWith('${t}') && !url.pathname.slice(${t.length+1}).includes('/')`}if(e.includes("*")&&!e.startsWith("*")){let[t,r]=e.split("*");return`({ url }) => url.pathname.startsWith('${t}') && url.pathname.endsWith('${r}')`}if(e==="/"||!e.includes("*"))return`({ url }) => url.pathname === '${e}'`;return`new RegExp('${x(e).replace(/\\\*/g,".*")}')`}function f(e){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[e.toLowerCase()]||"empty"}function h(e){return"stx-"+e.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(e,t){let r=e.pwa;if(!r?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let n=r.serviceWorker||{},c=r.routes||[],a=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],i=new Set;for(let o of c)i.add(g(o.strategy));if(i.size>0)a.push({name:"workbox-strategies",exports:Array.from(i)});if(c.some((o)=>o.maxAgeSeconds||o.maxEntries)||r.cacheStorage)a.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(c.some((o)=>o.strategy==="network-first"||o.strategy==="stale-while-revalidate"))a.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(r.backgroundSync?.enabled)a.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(n.navigationPreload)a.push({name:"workbox-navigation-preload",exports:["enable"]});let l=t?ae(t,e):void 0;return{mode:"generate",modules:a,precacheManifest:l?.entries,skipWaiting:n.skipWaiting??!0,clientsClaim:n.clientsClaim??!0,offlineFallback:r.offline?.enabled?"/offline.html":void 0,navigationPreload:n.navigationPreload??!1,cacheVersion:n.cacheVersion||"1.0.0"}}function W(e,t){let r=e.pwa;if(!r?.enabled)return"";let n=b(e,t),c=r.serviceWorker||{},{push:a,backgroundSync:i}=r,s=t?ae(t,e):null,l=s?pt(s):"[]",o=k(n.modules),u=d(e);return`/**
21
+ * Service Worker - Generated by stx with Workbox
22
+ * Cache Version: ${n.cacheVersion}
23
+ *
24
+ * This service worker uses Google's Workbox library for robust caching.
25
+ * https://developers.google.com/web/tools/workbox
26
+ *
27
+ * Features:
28
+ * - Precaching with automatic revision management
29
+ * - Runtime caching with multiple strategies
30
+ * - Offline fallback support
31
+ * - Push notifications: ${a?.enabled?"enabled":"disabled"}
32
+ * - Background sync: ${i?.enabled?"enabled":"disabled"}
33
+ */
34
+
35
+ // Import Workbox modules from CDN
36
+ importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js');
37
+
38
+ // Disable Workbox logging in production. Through isProduction() rather than
39
+ // off process.env.NODE_ENV: this is inside a template literal, so the
40
+ // comparison is evaluated when the service worker is GENERATED -- and the
41
+ // build's transpiler folds that particular read to a constant, so every
42
+ // published copy of stx emitted "debug: true" and no app could turn Workbox's
43
+ // logging off in production however it set NODE_ENV (see ../env.ts).
44
+ workbox.setConfig({ debug: ${!ge()} });
45
+
46
+ // Extract modules from workbox global
47
+ ${o}
48
+
49
+ const CACHE_VERSION = '${n.cacheVersion}';
50
+ const OFFLINE_PAGE = '${n.offlineFallback||"/offline.html"}';
51
+
52
+ // ============================================================================
53
+ // Precaching
54
+ // ============================================================================
55
+
56
+ // Clean up outdated caches from previous versions
57
+ cleanupOutdatedCaches();
58
+
59
+ // Precache static assets
60
+ // The manifest is injected during build or defined below
61
+ const PRECACHE_MANIFEST = ${l};
62
+
63
+ // Add essential assets
64
+ PRECACHE_MANIFEST.push(
65
+ { url: '/', revision: CACHE_VERSION },
66
+ { url: '/manifest.json', revision: CACHE_VERSION },
67
+ ${n.offlineFallback?`{ url: '${n.offlineFallback}', revision: CACHE_VERSION },`:""}
68
+ );
69
+
70
+ // Precache and route all manifest entries
71
+ precacheAndRoute(PRECACHE_MANIFEST);
72
+
73
+ // ============================================================================
74
+ // Navigation Preload
75
+ // ============================================================================
76
+
77
+ ${n.navigationPreload?`// Enable navigation preload for faster page loads
78
+ enable();`:"// Navigation preload disabled"}
79
+
80
+ // ============================================================================
81
+ // Runtime Caching
82
+ // ============================================================================
83
+
84
+ ${u}
85
+
86
+ // ============================================================================
87
+ // Offline Fallback
88
+ // ============================================================================
89
+
90
+ ${n.offlineFallback?`
91
+ // Set up offline fallback for navigation requests
92
+ const navigationRoute = new NavigationRoute(
93
+ new NetworkFirst({
94
+ cacheName: 'stx-pages-cache',
95
+ plugins: [
96
+ new CacheableResponsePlugin({ statuses: [0, 200] }),
97
+ ],
98
+ }),
99
+ {
100
+ // Return offline page when navigation fails
101
+ async allowedHandler(request) {
102
+ try {
103
+ const response = await this.handle(request);
104
+ return response;
105
+ }
106
+ catch (error) {
107
+ const cache = await caches.open('stx-offline-cache');
108
+ return cache.match(OFFLINE_PAGE) || new Response('You are offline', {
109
+ status: 503,
110
+ statusText: 'Service Unavailable',
111
+ });
112
+ }
113
+ },
114
+ }
115
+ );
116
+ registerRoute(navigationRoute);
117
+ `:"// No offline fallback configured"}
118
+
119
+ // Default handler for unmatched requests
120
+ setDefaultHandler(new NetworkFirst({
121
+ cacheName: 'stx-default-cache',
122
+ plugins: [
123
+ new CacheableResponsePlugin({ statuses: [0, 200] }),
124
+ new ExpirationPlugin({ maxEntries: 100, maxAgeSeconds: 60 * 60 * 24 }), // 1 day
125
+ ],
126
+ }));
127
+
128
+ // ============================================================================
129
+ // Service Worker Lifecycle
130
+ // ============================================================================
131
+
132
+ ${n.skipWaiting?`// Skip waiting - activate immediately
133
+ self.skipWaiting();`:"// Manual skipWaiting - user must trigger update"}
134
+
135
+ ${n.clientsClaim?`// Claim clients - take control immediately
136
+ self.addEventListener('activate', () => {
137
+ self.clients.claim();
138
+ });`:"// Manual clients claim"}
139
+
140
+ // ============================================================================
141
+ // Message Handling
142
+ // ============================================================================
143
+
144
+ self.addEventListener('message', (event) => {
145
+ const { type, payload } = event.data || {};
146
+
147
+ switch (type) {
148
+ case 'SKIP_WAITING':
149
+ self.skipWaiting();
150
+ break;
151
+
152
+ case 'GET_VERSION':
153
+ event.source?.postMessage({ type: 'VERSION', payload: CACHE_VERSION });
154
+ break;
155
+
156
+ case 'CACHE_URLS':
157
+ if (Array.isArray(payload)) {
158
+ event.waitUntil(
159
+ caches.open('stx-dynamic-cache').then(cache => cache.addAll(payload))
160
+ );
161
+ }
162
+ break;
163
+
164
+ case 'CLEAR_CACHE':
165
+ event.waitUntil(
166
+ caches.keys().then(names =>
167
+ Promise.all(names.map(name => caches.delete(name)))
168
+ )
169
+ );
170
+ break;
171
+ }
172
+ });
173
+
174
+ ${a?.enabled?y(a):"// Push notifications disabled"}
175
+
176
+ ${i?.enabled?S(i):"// Background sync disabled"}
177
+
178
+ console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
179
+ `}function k(e){let t=[];for(let r of e){let n=r.name.replace("workbox-","");t.push(`const { ${r.exports.join(", ")} } = workbox.${w(n)};`)}return t.join(`
180
+ `)}function w(e){return e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function y(e){return`
181
+ // ============================================================================
182
+ // Push Notifications
183
+ // ============================================================================
184
+
185
+ const PUSH_CONFIG = {
186
+ defaultIcon: '${e?.defaultIcon||"/pwa-icons/icon-192x192.png"}',
187
+ defaultBadge: '${e?.defaultBadge||"/pwa-icons/icon-72x72.png"}',
188
+ };
189
+
190
+ self.addEventListener('push', (event) => {
191
+ console.log('[Workbox SW] Push notification received');
192
+
193
+ let data = {
194
+ title: 'Notification',
195
+ body: 'You have a new notification',
196
+ icon: PUSH_CONFIG.defaultIcon,
197
+ badge: PUSH_CONFIG.defaultBadge,
198
+ };
199
+
200
+ if (event.data) {
201
+ try {
202
+ const payload = event.data.json();
203
+ data = { ...data, ...payload };
204
+ }
205
+ catch {
206
+ data.body = event.data.text();
207
+ }
208
+ }
209
+
210
+ const options = {
211
+ body: data.body,
212
+ icon: data.icon || PUSH_CONFIG.defaultIcon,
213
+ badge: data.badge || PUSH_CONFIG.defaultBadge,
214
+ vibrate: data.vibrate || [100, 50, 100],
215
+ data: {
216
+ url: data.url || '/',
217
+ ...data.data,
218
+ },
219
+ actions: data.actions || [],
220
+ tag: data.tag,
221
+ renotify: data.renotify || false,
222
+ requireInteraction: data.requireInteraction || false,
223
+ };
224
+
225
+ event.waitUntil(
226
+ self.registration.showNotification(data.title, options)
227
+ );
228
+ });
229
+
230
+ self.addEventListener('notificationclick', (event) => {
231
+ console.log('[Workbox SW] Notification clicked');
232
+ event.notification.close();
233
+
234
+ const url = event.notification.data?.url || '/';
235
+
236
+ event.waitUntil(
237
+ clients.matchAll({ type: 'window', includeUncontrolled: true }).then(windowClients => {
238
+ for (const client of windowClients) {
239
+ if (client.url === url && 'focus' in client) {
240
+ return client.focus();
241
+ }
242
+ }
243
+ if (clients.openWindow) {
244
+ return clients.openWindow(url);
245
+ }
246
+ })
247
+ );
248
+ });
249
+ `}function S(e){return`
250
+ // ============================================================================
251
+ // Background Sync
252
+ // ============================================================================
253
+
254
+ const syncQueue = new Queue('${e?.queueName||"stx-sync-queue"}', {
255
+ maxRetentionTime: ${e?.maxRetentionMinutes||1440}, // minutes
256
+ onSync: async ({ queue }) => {
257
+ let entry;
258
+ while ((entry = await queue.shiftRequest())) {
259
+ try {
260
+ await fetch(entry.request.clone());
261
+ console.log('[Workbox SW] Sync succeeded:', entry.request.url);
262
+
263
+ // Notify clients
264
+ const allClients = await self.clients.matchAll();
265
+ allClients.forEach(client => {
266
+ client.postMessage({
267
+ type: 'SYNC_COMPLETE',
268
+ url: entry.request.url,
269
+ success: true,
270
+ });
271
+ });
272
+ }
273
+ catch (error) {
274
+ console.log('[Workbox SW] Sync failed, re-queuing:', entry.request.url);
275
+ await queue.unshiftRequest(entry);
276
+ throw error;
277
+ }
278
+ }
279
+ },
280
+ });
281
+
282
+ // Register routes that should use background sync
283
+ ${e?.endpoints?.map((t)=>`
284
+ registerRoute(
285
+ ({ url }) => url.pathname.startsWith('${t}'),
286
+ new NetworkOnly({
287
+ plugins: [
288
+ new BackgroundSyncPlugin('${e?.queueName||"stx-sync-queue"}', {
289
+ maxRetentionTime: ${e?.maxRetentionMinutes||1440},
290
+ }),
291
+ ],
292
+ }),
293
+ 'POST'
294
+ );`).join(`
295
+ `)||"// No background sync endpoints configured"}
296
+
297
+ // Handle form sync messages
298
+ self.addEventListener('message', (event) => {
299
+ if (event.data?.type === 'REGISTER_FORM_SYNC') {
300
+ const { action, method, data } = event.data.payload;
301
+
302
+ const request = new Request(action, {
303
+ method: method || 'POST',
304
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
305
+ body: new URLSearchParams(data).toString(),
306
+ });
307
+
308
+ event.waitUntil(syncQueue.pushRequest({ request }));
309
+ }
310
+ });
311
+ `}export{W as generateWorkboxServiceWorker};
@@ -0,0 +1,27 @@
1
+ // @bun
2
+ import{existsSync as W,mkdirSync as We,readFileSync as H}from"fs";import x from"path";import{existsSync as Re,mkdirSync as Ne}from"fs";import w from"path";var Z=/^[A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*$/,Q=new Bun.Transpiler({loader:"ts"});function N(t){try{return Q.transformSync(t),!0}catch{return!1}}function O(t){let e=[...new Set(t)];return e.length?`const { ${e.join(", ")} } = __s; `:""}function L(t){return t._source?`<${t.type}> at ${t._source.file}:${t._source.line}`:`<${t.type}>`}function T(t,e,n,r,i){let s=e.trim();if(!s||!N(`(${s}
3
+ )`))throw Error(`Cannot compile ${i} "${e}" on ${L(r)}`);return t.functions.push(`function (__s) { ${O(n)}return (${s}
4
+ ) }`),t.functions.length-1}function ee(t,e,n,r,i){let s=e.trim(),o;if(Z.test(s))o=`return typeof ${s} === 'function' ? ${s}($event) : undefined`;else if(N(`(${s}
5
+ )`))o=`const __r = (${s}
6
+ ); return typeof __r === 'function' ? __r($event) : __r`;else if(N(s))o=s;else throw Error(`Cannot compile handler ${i}="${e}" on ${L(r)}`);return t.functions.push(`function (__s, $event) { ${O(n)}${o}
7
+ }`),t.functions.length-1}function te(t){let e=[],n=0,r=-1,i=0;for(let s=0;s<t.length;s++){let o=t[s];if(o==="{"){if(n===0)r=s;n++}else if(o==="}"&&n>0){if(n--,n===0){if(r>i)e.push({text:t.slice(i,r)});e.push({expression:t.slice(r+1,s)}),i=s+1}}}if(!e.some((s)=>("expression"in s)))return null;if(i<t.length)e.push({text:t.slice(i)});return e}function R(t,e,n,r,i){if(typeof e!=="string")return e;let s=te(e);if(!s)return e;if(s.length===1&&"expression"in s[0])return{$x:T(t,s[0].expression,n,r,i)};let o=s.map((c)=>("text"in c)?JSON.stringify(c.text):`__stxText(${c.expression.trim()}
8
+ )`).join(" + ");return{$x:T(t,o,n,r,i)}}function I(t,e,n){let r=e.directives,i={type:e.type,props:{},style:e.style??{},events:{},children:[]};if(e.darkStyle)i.darkStyle=e.darkStyle;let s=n;if(r?.for){let a=r.for;i.directives={for:{source:T(t,a.source,n,e,":for"),item:a.item,...a.index?{index:a.index}:{}}},s=[...n,a.item,...a.index?[a.index]:[]]}if(r){let a=i.directives??{};if(r.if!==void 0)a.if=T(t,r.if,s,e,":if");if(r.elseIf!==void 0)a.elseIf=T(t,r.elseIf,s,e,":else-if");if(r.else)a.else=!0;if(r.show!==void 0)a.show=T(t,r.show,s,e,":show");if(Object.keys(a).length)i.directives=a}if(e.bindings){let a={};for(let[d,S]of Object.entries(e.bindings)){if(d!=="class"&&d!=="style")continue;a[d]=T(t,S,s,e,`:${d}`)}if(Object.keys(a).length)i.bindings=a}if(e.key!==void 0)i.key=R(t,e.key,s,e,"key");let o=e.type==="FlatList"&&e.props.data!==void 0,c=o?[...s,"item","index"]:s,l=i.props;for(let[a,d]of Object.entries(e.props))l[a]=R(t,d,a==="keyExtractor"&&o?c:s,e,a);let h=i.events;for(let[a,d]of Object.entries(e.events))h[a]=ee(t,d,s,e,a);return i.children=e.children.map((a)=>typeof a==="string"?R(t,a,c,e,"text"):I(t,a,c)),i}function z(t){let e={functions:[],warnings:[...t.meta.warnings??[]],source:t.meta.source},n=I(e,t.root,[]),r=t.script.functions.filter((s)=>/^[A-Za-z_$][\w$]*$/.test(s)).map((s)=>`${JSON.stringify(s)}: typeof ${s} === 'function' ? ${s} : undefined`);return{code:[`import { mount as __stxMount } from ${JSON.stringify("stx:native-runtime")}`,"",t.script.code,"","// Generated by stx native from the template below the script.","function __stxText(value: any): string { return value == null || value === false ? '' : String(value) }","__stxMount({",` document: { root: ${JSON.stringify(n)} },`,` expressions: [
9
+ ${e.functions.join(`,
10
+ `)}
11
+ ] as any[],`,` functions: { ${r.join(", ")} },`,"})",""].join(`
12
+ `),template:n,warnings:e.warnings}}function v(t,e={},n={},r={},i=[]){return{type:t,props:e,style:n,events:r,children:i}}function B(t,e,n={}){return{version:"1.0.0",root:t,script:e,meta:{source:n.source||"unknown",compiledAt:n.compiledAt||Date.now(),headwindConfig:n.headwindConfig}}}var ne={transparent:"transparent",current:"currentColor",black:"#000000",white:"#ffffff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},P={px:1,0:0,0.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},A={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128},b={none:0,sm:2,DEFAULT:4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999};function k(t){let e=t.lastIndexOf("/");if(e>0&&!t.endsWith("]")){let r=k(t.slice(0,e)),i=t.slice(e+1),s=/^\[(.+)\]$/.test(i)?Number.parseFloat(i.slice(1,-1))*(i.includes("%")?1:100):Number.parseFloat(i);if(!r||!Number.isFinite(s))return;return re(r,s/100)}if(t==="transparent")return"transparent";if(t==="current")return"currentColor";if(t==="black")return"#000000";if(t==="white")return"#ffffff";let n=t.split("-");if(n.length===2){let[r,i]=n,s=ne[r];if(s&&typeof s==="object")return s[i]}if(t.startsWith("[")&&t.endsWith("]")){let r=t.slice(1,-1);return/^(#|rgba?\(|hsla?\(|[a-z]+$)/i.test(r)?r:void 0}return}function re(t,e){if(t==="transparent")return t;let n=t.startsWith("#")?t.slice(1):"";if(n.length===3)n=n.split("").map((i)=>i+i).join("");if(n.length===8)n=n.slice(0,6);if(n.length!==6)return;let r=Math.round(Math.min(1,Math.max(0,e))*255);return`#${n}${r.toString(16).padStart(2,"0")}`}function C(t,e=16){if(!t.startsWith("[")||!t.endsWith("]"))return;let n=t.slice(1,-1),r=Number.parseFloat(n);if(!Number.isFinite(r))return;if(n.endsWith("rem"))return r*16;if(n.endsWith("em"))return r*e;return r}function p(t){if(t.startsWith("[")&&t.endsWith("]")){let e=t.slice(1,-1),n=e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e);return Number.isFinite(n)?n:void 0}return P[t]}var ie={flex:(t,e)=>(e.display="flex",!0),hidden:(t,e)=>(e.display="none",!0),grid:(t,e)=>(e.display="grid",!0),"flex-row":(t,e)=>(e.flexDirection="row",!0),"flex-col":(t,e)=>(e.flexDirection="column",!0),"flex-row-reverse":(t,e)=>(e.flexDirection="row-reverse",!0),"flex-col-reverse":(t,e)=>(e.flexDirection="column-reverse",!0),"flex-wrap":(t,e)=>(e.flexWrap="wrap",!0),"flex-nowrap":(t,e)=>(e.flexWrap="nowrap",!0),"flex-wrap-reverse":(t,e)=>(e.flexWrap="wrap-reverse",!0),"flex-1":(t,e)=>(e.flex=1,e.flexGrow=1,e.flexShrink=1,e.flexBasis=0,!0),"flex-auto":(t,e)=>(e.flexGrow=1,e.flexShrink=1,!0),"flex-initial":(t,e)=>(e.flexGrow=0,e.flexShrink=1,!0),"flex-none":(t,e)=>(e.flexGrow=0,e.flexShrink=0,!0),grow:(t,e)=>(e.flexGrow=1,!0),"grow-0":(t,e)=>(e.flexGrow=0,!0),shrink:(t,e)=>(e.flexShrink=1,!0),"shrink-0":(t,e)=>(e.flexShrink=0,!0),"justify-start":(t,e)=>(e.justifyContent="flex-start",!0),"justify-center":(t,e)=>(e.justifyContent="center",!0),"justify-end":(t,e)=>(e.justifyContent="flex-end",!0),"justify-between":(t,e)=>(e.justifyContent="space-between",!0),"justify-around":(t,e)=>(e.justifyContent="space-around",!0),"justify-evenly":(t,e)=>(e.justifyContent="space-evenly",!0),"items-start":(t,e)=>(e.alignItems="flex-start",!0),"items-center":(t,e)=>(e.alignItems="center",!0),"items-end":(t,e)=>(e.alignItems="flex-end",!0),"items-stretch":(t,e)=>(e.alignItems="stretch",!0),"items-baseline":(t,e)=>(e.alignItems="baseline",!0),"self-auto":(t,e)=>(e.alignSelf="auto",!0),"self-start":(t,e)=>(e.alignSelf="flex-start",!0),"self-center":(t,e)=>(e.alignSelf="center",!0),"self-end":(t,e)=>(e.alignSelf="flex-end",!0),"self-stretch":(t,e)=>(e.alignSelf="stretch",!0),"self-baseline":(t,e)=>(e.alignSelf="baseline",!0),"min-w-0":(t,e)=>(e.minWidth=0,!0),"aspect-square":(t,e)=>(e.aspectRatio=1,!0),"inset-0":(t,e)=>(e.top=0,e.right=0,e.bottom=0,e.left=0,!0),"tracking-tighter":(t,e)=>(e.letterSpacing=-0.8,!0),"tracking-tight":(t,e)=>(e.letterSpacing=-0.4,!0),"tracking-normal":(t,e)=>(e.letterSpacing=0,!0),"tracking-wide":(t,e)=>(e.letterSpacing=0.4,!0),"tracking-wider":(t,e)=>(e.letterSpacing=0.8,!0),"tracking-widest":(t,e)=>(e.letterSpacing=1.6,!0),"tabular-nums":()=>!0,block:()=>!0,"inline-flex":(t,e)=>(e.display="flex",!0),truncate:()=>!0,relative:(t,e)=>(e.position="relative",!0),absolute:(t,e)=>(e.position="absolute",!0),"overflow-visible":(t,e)=>(e.overflow="visible",!0),"overflow-hidden":(t,e)=>(e.overflow="hidden",!0),"overflow-scroll":(t,e)=>(e.overflow="scroll",!0),"font-thin":(t,e)=>(e.fontWeight="100",!0),"font-extralight":(t,e)=>(e.fontWeight="200",!0),"font-light":(t,e)=>(e.fontWeight="300",!0),"font-normal":(t,e)=>(e.fontWeight="400",!0),"font-medium":(t,e)=>(e.fontWeight="500",!0),"font-semibold":(t,e)=>(e.fontWeight="600",!0),"font-bold":(t,e)=>(e.fontWeight="bold",!0),"font-extrabold":(t,e)=>(e.fontWeight="800",!0),"font-black":(t,e)=>(e.fontWeight="900",!0),italic:(t,e)=>(e.fontStyle="italic",!0),"not-italic":(t,e)=>(e.fontStyle="normal",!0),"text-left":(t,e)=>(e.textAlign="left",!0),"text-center":(t,e)=>(e.textAlign="center",!0),"text-right":(t,e)=>(e.textAlign="right",!0),"text-justify":(t,e)=>(e.textAlign="justify",!0),uppercase:(t,e)=>(e.textTransform="uppercase",!0),lowercase:(t,e)=>(e.textTransform="lowercase",!0),capitalize:(t,e)=>(e.textTransform="capitalize",!0),"normal-case":(t,e)=>(e.textTransform="none",!0),underline:(t,e)=>(e.textDecorationLine="underline",!0),"line-through":(t,e)=>(e.textDecorationLine="line-through",!0),"no-underline":(t,e)=>(e.textDecorationLine="none",!0)};function se(t,e){if(!t.startsWith("bg-"))return!1;let n=t.slice(3),r=k(n);if(r)return e.backgroundColor=r,!0;return!1}function oe(t,e){if(!t.startsWith("text-"))return!1;let n=t.slice(5);if(A[n])return e.fontSize=A[n],!0;if(n.startsWith("[")&&n.endsWith("]")){let i=n.slice(1,-1);if(/^-?[\d.]+(?:px|r?em)?$/.test(i)){let s=i.endsWith("rem")||i.endsWith("em")?Number.parseFloat(i)*16:Number.parseFloat(i);if(Number.isFinite(s))return e.fontSize=s,!0}}let r=k(n);if(r)return e.color=r,!0;return!1}function ae(t,e){if(t.startsWith("p-")){let n=p(t.slice(2));if(n!==void 0)return e.padding=n,!0}if(t.startsWith("px-")){let n=p(t.slice(3));if(n!==void 0)return e.paddingHorizontal=n,!0}if(t.startsWith("py-")){let n=p(t.slice(3));if(n!==void 0)return e.paddingVertical=n,!0}if(t.startsWith("pt-")){let n=p(t.slice(3));if(n!==void 0)return e.paddingTop=n,!0}if(t.startsWith("pr-")){let n=p(t.slice(3));if(n!==void 0)return e.paddingRight=n,!0}if(t.startsWith("pb-")){let n=p(t.slice(3));if(n!==void 0)return e.paddingBottom=n,!0}if(t.startsWith("pl-")){let n=p(t.slice(3));if(n!==void 0)return e.paddingLeft=n,!0}return!1}function ce(t,e){if(t.startsWith("m-")){let n=p(t.slice(2));if(n!==void 0)return e.margin=n,!0}if(t.startsWith("mx-")){let n=p(t.slice(3));if(n!==void 0)return e.marginHorizontal=n,!0}if(t.startsWith("my-")){let n=p(t.slice(3));if(n!==void 0)return e.marginVertical=n,!0}if(t.startsWith("mt-")){let n=p(t.slice(3));if(n!==void 0)return e.marginTop=n,!0}if(t.startsWith("mr-")){let n=p(t.slice(3));if(n!==void 0)return e.marginRight=n,!0}if(t.startsWith("mb-")){let n=p(t.slice(3));if(n!==void 0)return e.marginBottom=n,!0}if(t.startsWith("ml-")){let n=p(t.slice(3));if(n!==void 0)return e.marginLeft=n,!0}return!1}function le(t,e){if(!t.startsWith("w-"))return!1;let n=t.slice(2);if(n==="full")return e.width="100%",!0;if(n==="screen")return e.width="100%",!0;if(n==="auto")return e.width="auto",!0;if(n.includes("/")){let[i,s]=n.split("/"),o=Number.parseInt(i)/Number.parseInt(s)*100;return e.width=`${o}%`,!0}let r=p(n);if(r!==void 0)return e.width=r,!0;return!1}function ue(t,e){if(!t.startsWith("h-"))return!1;let n=t.slice(2);if(n==="full")return e.height="100%",!0;if(n==="screen")return e.height="100%",!0;if(n==="auto")return e.height="auto",!0;let r=p(n);if(r!==void 0)return e.height=r,!0;return!1}function fe(t,e){if(!t.startsWith("rounded"))return!1;if(t==="rounded")return e.borderRadius=b.DEFAULT,!0;let n=t.slice(8);if(n==="")return!1;let r=/^(?:(t|b|l|r)-)?(\[[^\]]+\])$/.exec(n);if(r){let s=C(r[2]);if(s===void 0)return!1;let o={t:["borderTopLeftRadius","borderTopRightRadius"],b:["borderBottomLeftRadius","borderBottomRightRadius"],l:["borderTopLeftRadius","borderBottomLeftRadius"],r:["borderTopRightRadius","borderBottomRightRadius"]};for(let c of r[1]?o[r[1]]:["borderRadius"])e[c]=s;return!0}if(n.startsWith("t-")){let s=b[n.slice(2)]??b.DEFAULT;return e.borderTopLeftRadius=s,e.borderTopRightRadius=s,!0}if(n.startsWith("b-")){let s=b[n.slice(2)]??b.DEFAULT;return e.borderBottomLeftRadius=s,e.borderBottomRightRadius=s,!0}if(n.startsWith("l-")){let s=b[n.slice(2)]??b.DEFAULT;return e.borderTopLeftRadius=s,e.borderBottomLeftRadius=s,!0}if(n.startsWith("r-")){let s=b[n.slice(2)]??b.DEFAULT;return e.borderTopRightRadius=s,e.borderBottomRightRadius=s,!0}let i=b[n];if(i!==void 0)return e.borderRadius=i,!0;return!1}function de(t,e){if(!t.startsWith("border"))return!1;if(t==="border")return e.borderWidth=1,!0;let n=t.match(/^border-(\d+)$/);if(n)return e.borderWidth=Number.parseInt(n[1]),!0;let r=t.match(/^border-(t|r|b|l)-?(\d*)$/);if(r){let[,i,s]=r,o=s?Number.parseInt(s):1;switch(i){case"t":e.borderTopWidth=o;break;case"r":e.borderRightWidth=o;break;case"b":e.borderBottomWidth=o;break;case"l":e.borderLeftWidth=o;break}return!0}return!1}function pe(t,e){if(!t.startsWith("border-"))return!1;let n=t.slice(7),r=k(n);if(r)return e.borderColor=r,!0;return!1}function he(t,e){if(!t.startsWith("opacity-"))return!1;let n=Number.parseInt(t.slice(8));if(!Number.isNaN(n))return e.opacity=n/100,!0;return!1}function ge(t,e){if(t.startsWith("tracking-[")){let n=C(t.slice(9),typeof e.fontSize==="number"?e.fontSize:16);if(n===void 0)return!1;return e.letterSpacing=n,!0}if(t.startsWith("leading-")){let n=t.slice(8),r=typeof e.fontSize==="number"?e.fontSize:16,i={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},s=n.startsWith("[")?/^\[[\d.]+\]$/.test(n)?Number.parseFloat(n.slice(1,-1))*r:C(n,r):i[n]!==void 0?i[n]*r:P[n];if(s===void 0||!Number.isFinite(s))return!1;return e.lineHeight=s,!0}return!1}function me(t,e){let n=/^grid-cols-(\d+)$/.exec(t);if(!n)return!1;return e.gridColumns=Number(n[1]),!0}function be(t,e){if(!t.startsWith("size-"))return!1;let n=t.slice(5),r=n==="full"?"100%":p(n);if(r===void 0)return!1;return e.width=r,e.height=r,!0}function xe(t,e){let n=/^(-?)(top|right|bottom|left)-(.+)$/.exec(t);if(!n)return!1;let r=n[3]==="full"?"100%":p(n[3]);if(r===void 0)return!1;return e[n[2]]=typeof r==="number"&&n[1]?-r:r,!0}function we(t,e){let n=/^space-(x|y)-(.+)$/.exec(t);if(!n)return!1;let r=p(n[2]);if(r===void 0)return!1;return e.gap=r,!0}function Se(t,e){if(t.startsWith("gap-")){let n=p(t.slice(4));if(n!==void 0)return e.gap=n,!0}if(t.startsWith("gap-x-")){let n=p(t.slice(6));if(n!==void 0)return e.columnGap=n,!0}if(t.startsWith("gap-y-")){let n=p(t.slice(6));if(n!==void 0)return e.rowGap=n,!0}return!1}function D(t){let e=[],n=[];for(let o of t.split(/\s+/).filter(Boolean))if(o.startsWith("dark:"))n.push(o.slice(5));else if(!o.includes(":")||o.startsWith("["))e.push(o);let r=[],s={style:F(e.join(" "),r),unknown:r};if(n.length)s.dark=F(n.join(" "),r);for(let o of e){if(o==="truncate")s.numberOfLines=1;let c=/^line-clamp-(\d+)$/.exec(o);if(c)s.numberOfLines=Number(c[1]);if(!s.icon&&/^i-[a-z0-9]+-[a-z0-9-]+$/.test(o))s.icon=o}return s.unknown=r.filter((o)=>!/^line-clamp-\d+$/.test(o)),s}function F(t,e){let n={},r=t.split(/\s+/).filter(Boolean);for(let i of r){if(/^i-[a-z0-9]+-/.test(i))continue;let s=ie[i];if(s){s("",n);continue}if(se(i,n))continue;if(oe(i,n))continue;if(ae(i,n))continue;if(ce(i,n))continue;if(le(i,n))continue;if(ue(i,n))continue;if(fe(i,n))continue;if(de(i,n))continue;if(pe(i,n))continue;if(he(i,n))continue;if(Se(i,n))continue;if(ge(i,n))continue;if(be(i,n))continue;if(me(i,n))continue;if(xe(i,n))continue;if(we(i,n))continue;if(e?.push(i),typeof process<"u"&&process.env?.NODE_ENV==="development")console.warn(`[STX Native] Unknown Headwind class: ${i}`)}return n}var Te={activity:"waveform.path.ecg","alarm-clock":"alarm","alert-circle":"exclamationmark.circle","alert-triangle":"exclamationmark.triangle",archive:"archivebox","arrow-down":"arrow.down","arrow-left":"arrow.left","arrow-right":"arrow.right","arrow-up":"arrow.up","arrow-up-right":"arrow.up.right","at-sign":"at","audio-lines":"waveform",award:"rosette","badge-check":"checkmark.seal","bar-chart":"chart.bar","bar-chart-2":"chart.bar","bar-chart-3":"chart.bar",battery:"battery.100",bed:"bed.double",bell:"bell","bell-off":"bell.slash",bike:"figure.outdoor.cycle",bluetooth:"antenna.radiowaves.left.and.right",book:"book","book-open":"book",bookmark:"bookmark",brain:"brain",calendar:"calendar","calendar-check":"calendar.badge.checkmark","calendar-clock":"calendar.badge.clock","calendar-days":"calendar","calendar-plus":"calendar.badge.plus","calendar-range":"calendar","calendar-sync":"arrow.triangle.2.circlepath",camera:"camera","chart-bar":"chart.bar","chart-line":"chart.xyaxis.line",check:"checkmark","check-circle":"checkmark.circle","check-circle-2":"checkmark.circle","chevron-down":"chevron.down","chevron-left":"chevron.left","chevron-right":"chevron.right","chevron-up":"chevron.up",circle:"circle","circle-alert":"exclamationmark.circle","circle-check":"checkmark.circle","circle-check-big":"checkmark.circle","circle-help":"questionmark.circle","circle-play":"play.circle","circle-plus":"plus.circle","circle-user":"person.crop.circle","circle-x":"xmark.circle",clapperboard:"film",clipboard:"clipboard","clipboard-list":"list.clipboard",clock:"clock",cloud:"cloud","cloud-off":"icloud.slash",coffee:"cup.and.saucer",copy:"doc.on.doc","credit-card":"creditcard",download:"arrow.down.circle",droplet:"drop",droplets:"drop",dumbbell:"dumbbell",edit:"pencil","external-link":"arrow.up.right.square",eye:"eye","eye-off":"eye.slash",file:"doc","file-text":"doc.text",filter:"line.3.horizontal.decrease",flag:"flag",flame:"flame",footprints:"figure.run",gauge:"gauge",gift:"gift",globe:"globe","graduation-cap":"graduationcap","grip-vertical":"line.3.horizontal",heart:"heart","heart-pulse":"heart.text.square","help-circle":"questionmark.circle",history:"clock.arrow.circlepath",home:"house",house:"house",image:"photo",inbox:"tray",info:"info.circle",layers:"square.3.layers.3d","layout-grid":"square.grid.2x2",library:"books.vertical",link:"link",list:"list.bullet","list-checks":"checklist",loader:"arrow.triangle.2.circlepath","loader-2":"arrow.triangle.2.circlepath","loader-circle":"arrow.triangle.2.circlepath",lock:"lock","log-in":"arrow.right.to.line","log-out":"rectangle.portrait.and.arrow.right",mail:"envelope",map:"map","map-pin":"mappin.and.ellipse",medal:"medal",menu:"line.3.horizontal","message-circle":"bubble.left","message-square":"text.bubble","message-square-quote":"quote.bubble",mic:"mic",minus:"minus",moon:"moon","more-horizontal":"ellipsis","more-vertical":"ellipsis",mountain:"mountain.2",music:"music.note",package:"shippingbox",pause:"pause","pause-circle":"pause.circle",pencil:"pencil","person-standing":"figure.walk",phone:"phone",play:"play.fill",plug:"powerplug",plus:"plus","plus-circle":"plus.circle","refresh-cw":"arrow.clockwise",repeat:"repeat","rotate-ccw":"arrow.counterclockwise",route:"point.topleft.down.to.point.bottomright.curvepath",ruler:"ruler",sailboat:"sailboat",satellite:"antenna.radiowaves.left.and.right",save:"square.and.arrow.down",scale:"scalemass",search:"magnifyingglass",send:"paperplane",settings:"gearshape","settings-2":"slider.horizontal.3",share:"square.and.arrow.up","share-2":"square.and.arrow.up",shield:"shield","shield-check":"checkmark.shield","shopping-bag":"bag","shopping-cart":"cart","skip-back":"backward.end","skip-forward":"forward.end",sliders:"slider.horizontal.3","sliders-horizontal":"slider.horizontal.3",smartphone:"iphone",snowflake:"snowflake",sparkles:"sparkles",square:"square",star:"star",stopwatch:"stopwatch",store:"storefront",sun:"sun.max",sunrise:"sunrise",sunset:"sunset",tag:"tag",target:"scope",thermometer:"thermometer.medium","thumbs-up":"hand.thumbsup",timer:"timer",trash:"trash","trash-2":"trash","trending-down":"chart.line.downtrend.xyaxis","trending-up":"chart.line.uptrend.xyaxis",trophy:"trophy",unlink:"personalhotspot.slash",upload:"arrow.up.circle",user:"person","user-plus":"person.badge.plus","user-round":"person",users:"person.2",video:"video","volume-2":"speaker.wave.2",watch:"applewatch",waves:"figure.pool.swim",weight:"scalemass",wifi:"wifi","wifi-off":"wifi.slash",wind:"wind",x:"xmark","x-circle":"xmark.circle",zap:"bolt"};function j(t,e=!1){let n=String(t??"").trim();if(!n)return{symbol:"circle",known:!1};if(e)return{symbol:n,known:!0};let r=/^i-([a-z0-9]+)-(.+)$/.exec(n)??/^([a-z0-9]+):(.+)$/.exec(n),i=r?r[1]:"lucide",s=r?r[2]:n;if(i==="lucide"){let o=Te[s];if(o)return{symbol:o,iconify:`i-lucide-${s}`,known:!0};if(!r&&n.includes("."))return{symbol:n,known:!0}}return{symbol:"circle",iconify:r?n:`i-lucide-${s}`,known:!1}}function V(t){return t.split(/\s+/).find((e)=>/^i-[a-z0-9]+-[a-z0-9-]+$/.test(e))}class M{input;pos=0;line=1;column=1;inTag=!1;templates=[];constructor(t){this.input=t}tokenize(){let t=[];while(this.pos<this.input.length){let e=this.nextToken();if(e)t.push(e)}return t.push({type:"EOF",value:"",line:this.line,column:this.column}),t}nextToken(){if(this.inTag)this.skipWhitespace();if(this.pos>=this.input.length)return null;let t=this.line,e=this.column;if(this.match("<!--")){let r=this.input.indexOf("-->",this.pos);if(r===-1)throw Error(`Unclosed comment at line ${t}`);let i=this.input.slice(this.pos,r);return this.advance(r-this.pos+3),{type:"COMMENT",value:i,line:t,column:e}}if(this.match("<script")){let i=this.input.indexOf(">",this.pos)+1,s=this.input.indexOf("</script>",i);if(s===-1)throw Error(`Unclosed <script> block at line ${t}`);let o=this.input.slice(i,s).trim(),c=this.input.slice(this.pos+7,i-1);if(this.advance(s-this.pos+9),/\bserver\b/.test(c))return null;return{type:"SCRIPT_BLOCK",value:o,line:t,column:e}}if(this.match("<style")){let i=this.input.indexOf(">",this.pos)+1,s=this.input.indexOf("</style>",i);if(s===-1)throw Error(`Unclosed <style> block at line ${t}`);let o=this.input.slice(i,s).trim();return this.advance(s-this.pos+8),{type:"STYLE_BLOCK",value:o,line:t,column:e}}if(this.match("<template>"))return this.templates.push(!1),this.advance(10),null;if(this.match("<template"))this.templates.push(!0);if(this.match("</template>")&&this.templates.pop()!==!0)return this.advance(11),null;if(this.match("</")){this.advance(2);let r=this.readTagName();if(this.skipWhitespace(),this.peek()!==">")throw Error(`Expected > at line ${this.line}`);return this.advance(1),this.inTag=!1,{type:"TAG_CLOSE",value:r,line:t,column:e}}if(this.peek()==="<"){this.advance(1);let r=this.readTagName();return this.inTag=!0,{type:"TAG_OPEN",value:r,line:t,column:e}}if(this.match("/>"))return this.advance(2),this.inTag=!1,{type:"TAG_SELF_CLOSE",value:"/>",line:t,column:e};if(this.peek()===">")return this.advance(1),this.inTag=!1,{type:"TAG_END",value:">",line:t,column:e};if(!this.inTag&&this.match("{{")){let r=this.input.indexOf("}}",this.pos+2);if(r!==-1){let i=this.input.slice(this.pos+2,r);return this.advance(r-this.pos+2),{type:"EXPRESSION",value:i.trim(),line:t,column:e}}}if(this.peek()==="{"){this.advance(1);let r=1,i="";while(r>0&&this.pos<this.input.length){let s=this.peek();if(s==="{")r++;else if(s==="}")r--;if(r>0)i+=s;this.advance(1)}return{type:"EXPRESSION",value:i.trim(),line:t,column:e}}if(this.inTag&&(this.isAlpha(this.peek())||this.peek()===":"||this.peek()==="@")){let r=this.readAttributeName();if(this.skipWhitespace(),this.peek()==="="){this.advance(1),this.skipWhitespace();let i,s;if(this.peek()==='"'||this.peek()==="'"){let o=this.peek();this.advance(1),i="";while(this.peek()!==o&&this.pos<this.input.length)i+=this.peek(),this.advance(1);this.advance(1)}else if(this.peek()==="{"){this.advance(1);let o=1;i="";while(o>0&&this.pos<this.input.length){let c=this.peek();if(c==="{")o++;else if(c==="}")o--;if(o>0)i+=c;this.advance(1)}s=`{${i}}`,i=i.trim()}else throw Error(`Expected " or { after = at line ${this.line}`);return{type:"ATTRIBUTE",value:`${r}=${i}`,raw:s,line:t,column:e}}return{type:"ATTRIBUTE",value:`${r}=true`,line:t,column:e}}let n="";while(this.pos<this.input.length&&this.peek()!=="<"&&this.peek()!=="{")n+=this.peek(),this.advance(1);if(n.trim()||n&&!n.includes(`
13
+ `))return{type:"TEXT",value:n,line:t,column:e};return null}match(t){return this.input.slice(this.pos,this.pos+t.length)===t}peek(){return this.input[this.pos]||""}advance(t){for(let e=0;e<t;e++){if(this.input[this.pos]===`
14
+ `)this.line++,this.column=1;else this.column++;this.pos++}}skipWhitespace(){while(this.pos<this.input.length&&/\s/.test(this.peek()))this.advance(1)}readTagName(){let t="";while(this.pos<this.input.length&&/[a-zA-Z0-9_-]/.test(this.peek()))t+=this.peek(),this.advance(1);return t}readAttributeName(){let t="";while(this.pos<this.input.length&&/[a-zA-Z0-9_\-:@]/.test(this.peek()))t+=this.peek(),this.advance(1);return t}isAlpha(t){return/[a-zA-Z_]/.test(t)}}class G{ctx;constructor(t,e){this.ctx={source:e,tokens:t,pos:0,scriptCode:"",exports:{},functions:[],warnings:[]}}parse(){this.extractScriptBlocks(),this.ctx.pos=0;let t=this.parseElement();if(!t)throw Error("No root element found in template");let e=B(t,{exports:this.ctx.exports,functions:this.ctx.functions,code:this.ctx.scriptCode},{source:this.ctx.source,compiledAt:Date.now()});if(this.ctx.warnings.length)e.meta.warnings=[...new Set(this.ctx.warnings)];return e}extractScriptBlocks(){while(this.ctx.pos<this.ctx.tokens.length){let t=this.peek();if(t.type==="SCRIPT_BLOCK")this.ctx.scriptCode+=`${t.value}
15
+ `,this.extractExportsAndFunctions(t.value);this.advance()}}extractExportsAndFunctions(t){let e=/(?:let|const|var)\s+(\w+)\s*=\s*([^;\n]+)/g,n;while((n=e.exec(t))!==null){let[,s,o]=n;try{this.ctx.exports[s]=JSON.parse(o.trim())}catch{this.ctx.exports[s]=o.trim()}}let r=/(?:function\s+(\w+)|const\s+(\w+)\s*=\s*(?:\([^)]*\)|[^=])\s*=>)/g;while((n=r.exec(t))!==null){let s=n[1]||n[2];if(s&&!this.ctx.functions.includes(s))this.ctx.functions.push(s)}let i=/async\s+function\s+(\w+)/g;while((n=i.exec(t))!==null){let s=n[1];if(s&&!this.ctx.functions.includes(s))this.ctx.functions.push(s)}}parseElement(){this.skipNonElements();let t=this.peek();if(t.type==="EOF")return null;if(t.type!=="TAG_OPEN"){if(t.type==="TEXT")return this.advance(),v("Text",{},{},{},[t.value]);if(t.type==="EXPRESSION")return this.advance(),v("Text",{},{},{},[`{${t.value}}`]);return null}let e=t.value,n={file:this.ctx.source,line:t.line,column:t.column};this.advance();let r=this.parseAttributes(e,t.line),{props:i,style:s,events:o}=r,c=this.peek();if(c.type==="TAG_SELF_CLOSE"){this.advance();let a=v(e,i,s,o,[]);return this.finishNode(a,r,n),a}if(c.type!=="TAG_END")throw Error(`Expected > or /> at line ${c.line}, got ${c.type}`);this.advance();let l=[];while(!0){this.skipComments();let a=this.peek();if(a.type==="EOF")throw Error(`Unclosed tag <${e}> at line ${t.line}`);if(a.type==="TAG_CLOSE"){if(a.value!==e)throw Error(`Mismatched closing tag: expected </${e}>, got </${a.value}> at line ${a.line}`);this.advance();break}if(a.type==="TEXT"){l.push(a.value),this.advance();continue}if(a.type==="EXPRESSION"){l.push(`{${a.value}}`),this.advance();continue}if(a.type==="TAG_OPEN"){let d=this.parseElement();if(d)l.push(d);continue}this.advance()}let h=v(e,i,s,o,l);return this.finishNode(h,r,n),h}finishNode(t,e,n){if(typeof t.props.__text==="string")t.children=[`{${t.props.__text}}`],delete t.props.__text;if(ve(t),e.classes)t._classes=e.classes;if(t._source=n,e.darkStyle)t.darkStyle=e.darkStyle;if(Object.keys(e.directives).length)t.directives=e.directives;if(Object.keys(e.bindings).length)t.bindings=e.bindings;if(e.numberOfLines!==void 0&&t.props.numberOfLines===void 0)t.props.numberOfLines=e.numberOfLines;if(t.type==="Icon")this.finishIcon(t,e.icon)}finishIcon(t,e){let n=t.props,r=(o)=>typeof o==="string"&&/\{[^}]*\}/.test(o);if(n.size!==void 0){let o=Number(n.size);if(Number.isFinite(o))t.style.width??=o,t.style.height??=o,delete n.size}if(t.children=[],n.symbol!==void 0){delete n.name;return}let i=n.name??n.icon??e;if(delete n.icon,i===void 0){if(!t.bindings?.class)this.ctx.warnings.push(`<Icon> without symbol, name or an i-* class in ${this.ctx.source}; drawn as circle`);return}if(r(i)){n.name=i;return}delete n.name;let s=j(String(i));if(n.symbol=s.symbol,s.iconify)n.iconify=s.iconify;if(!s.known)this.ctx.warnings.push(`Unknown icon ${i} in ${this.ctx.source}; drawn as ${s.symbol}`)}parseAttributes(t,e){let n={},r={},i={},s={},o="",c={};while(this.peek().type==="ATTRIBUTE"){let a=this.peek();this.advance();let[d,...S]=a.value.split("="),u=S.join("="),f=d.startsWith("x-bind:")?`:${d.slice(7)}`:d.startsWith("x-on:")?`@${d.slice(5)}`:d,g=f.startsWith(":")||f.startsWith("x-")&&f!=="x-cloak",m=g?f.startsWith(":")?f.slice(1):f.slice(2):"",Y=!a.raw&&u==="true"&&!a.value.endsWith('="true"');if(g&&m==="if"){i.if=u;continue}if(g&&(m==="else-if"||m==="elseif")){i.elseIf=u;continue}if(g&&m==="else"){i.else=!0;continue}if(g&&m==="show"){i.show=u;continue}if(g&&m==="for"){let y=U(u);if(!y)throw Error(`Cannot read :for="${u}" at line ${e}: expected "item in items" or "(item, index) in items"`);i.for=y;continue}if(g&&m==="key"){n.key=`{${u}}`;continue}if(g&&m==="text"){n.__text=u;continue}if(f==="x-cloak"||f==="x-data")continue;if(f==="class"||f==="className"||g&&(m==="class"||m==="className")){if(g||a.raw)s.class=u;else o=o?`${o} ${u}`:u;continue}if(f==="style"||g&&m==="style"){if(g){s.style=u;continue}if(a.raw){try{c={...c,...JSON.parse(u)}}catch{s.style=u}continue}try{if(u.startsWith("{")&&u.endsWith("}"))c={...c,...JSON.parse(u)};else c={...c,...JSON.parse(`{${u}}`)}}catch{c={...c,...this.parseCSSInJS(u)}}continue}if(/^on[A-Z]/.test(f)&&!ye.has(f)||f.startsWith("@")){let y=f.startsWith("@")?_e(f.slice(1)):f;if(!Y)r[y]=u;continue}if(f==="key"){n.key=a.raw??u;continue}if(g){n[m]=`{${u}}`;continue}if(a.raw){try{n[f]=JSON.parse(u)}catch{n[f]=a.raw}continue}try{n[f]=JSON.parse(u)}catch{n[f]=u}}let l=o?D(o):null;if(l&&l.unknown.length)this.ctx.warnings.push(`Classes with no native style on <${t}> at line ${e}: ${l.unknown.join(" ")}`);let h={...l?.style??{},...c};return{props:n,style:h,events:r,classes:o,directives:i,bindings:s,darkStyle:l?.dark,numberOfLines:l?.numberOfLines,icon:l?.icon??(o?V(o):void 0)}}parseCSSInJS(t){let e={},n=t.split(",").map((r)=>r.trim());for(let r of n){let i=r.indexOf(":");if(i===-1)continue;let s=r.slice(0,i).trim(),o=r.slice(i+1).trim();if(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))o=o.slice(1,-1);let c=Number(o);e[s]=Number.isNaN(c)?o:c}return e}skipNonElements(){while(this.peek().type==="SCRIPT_BLOCK"||this.peek().type==="STYLE_BLOCK"||this.peek().type==="COMMENT")this.advance()}skipComments(){while(this.peek().type==="COMMENT")this.advance()}peek(){return this.ctx.tokens[this.ctx.pos]||{type:"EOF",value:"",line:0,column:0}}advance(){this.ctx.pos++}}function ve(t){let e=t.children.some((r)=>typeof r!=="string"),n=t.children.map((r)=>typeof r==="string"&&!/^\{[\s\S]*\}$/.test(r)?r.replace(/\s+/g," "):r).filter((r)=>!(e&&typeof r==="string"&&!r.trim()));if(!e&&n.length){let r=n[0],i=n[n.length-1];if(typeof r==="string")n[0]=r.replace(/^\s+/,"");if(typeof i==="string")n[n.length-1]=n[n.length-1].replace(/\s+$/,"");n=n.filter((s)=>s!=="")}t.children=n}var ye=new Set(["onEndReachedThreshold"]),ke={click:"onPress",press:"onPress",tap:"onPress",longpress:"onLongPress",contextmenu:"onLongPress",input:"onChangeText",change:"onChange",focus:"onFocus",blur:"onBlur",submit:"onSubmitEditing",scroll:"onScroll",refresh:"onRefresh",close:"onRequestClose",layout:"onLayout"};function _e(t){let[e]=t.split(".");return ke[e.toLowerCase()]??`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}function U(t){let e=t.trim(),n=/^\(?\s*([$\w]+)\s*(?:,\s*([$\w]+)\s*)?\)?\s+(?:in|of)\s+([\s\S]+)$/.exec(e);if(n)return{item:n[1],index:n[2],source:n[3].trim()};let r=/^([\s\S]+?)\s+as\s+(?:([$\w]+)\s*=>\s*)?([$\w]+)$/.exec(e);if(r)return{item:r[3],index:r[2],source:r[1].trim()};return null}function $e(t,e){let n=0,r="";for(let i=e;i<t.length;i++){let s=t[i];if(r){if(s==="\\")i++;else if(s===r)r="";continue}if(s==='"'||s==="'"||s==="`")r=s;else if(s==="(")n++;else if(s===")"&&--n===0)return i}return-1}function _(t,e){return e.includes('"')?`${t}={${e}}`:`${t}="${e}"`}function Ee(t){let e=/<script\b[\s\S]*?<\/script>|<style\b[\s\S]*?<\/style>|@(if|elseif|unless|foreach|for)\s*\(|@(else|endif|endunless|endforeach|endfor)\b/g,n="",r=0;for(let i=e.exec(t);i;i=e.exec(t)){if(i[0].startsWith("<"))continue;let s=t[i.index-1];if(s&&/[\w@.]/.test(s))continue;if(n+=t.slice(r,i.index),i[1]){let o=i.index+i[0].length-1,c=$e(t,o);if(c===-1)throw Error(`Unclosed @${i[1]}( in template`);let l=t.slice(o+1,c).trim();if(i[1]==="if")n+=`<Fragment ${_(":if",l)}>`;else if(i[1]==="unless")n+=`<Fragment ${_(":if",`!(${l})`)}>`;else if(i[1]==="elseif")n+=`</Fragment><Fragment ${_(":else-if",l)}>`;else{let h=U(l);if(!h)throw Error(`Cannot read @${i[1]}(${l})`);let a=h.index?`(${h.item}, ${h.index})`:h.item;n+=`<Fragment ${_(":for",`${a} in ${h.source}`)}>`}r=c+1,e.lastIndex=r}else n+=i[2]==="else"?"</Fragment><Fragment :else>":"</Fragment>",r=i.index+i[0].length}return n+t.slice(r)}function E(t,e="unknown.stx"){let r=new M(Ee(t)).tokenize();return new G(r,e).parse()}function Ce(){let t=[w.join(import.meta.dir,"..","runtime","entry.ts"),w.join(import.meta.dir,"..","runtime","entry.js"),w.join(import.meta.dir,"native","runtime","entry.js")];return t.find((e)=>Re(e))??t[0]}async function q(t,e,n){let r=await Bun.build({entrypoints:[t],target:"browser",format:"iife",minify:n,plugins:e,define:{"process.env.NODE_ENV":JSON.stringify(n?"production":"development")}});if(!r.success){let i=r.logs.map((s)=>String(s.message??s)).join(`
16
+ `);throw Error(`Could not bundle ${t}:
17
+ ${i}`)}return(await r.outputs[0].text()).trim()}function Xe(t){return{name:"stx-native-screen",setup(e){e.onResolve({filter:/^stx:native-runtime$/},()=>({path:"runtime",namespace:"stx-native-runtime"})),e.onLoad({filter:/.*/,namespace:"stx-native-runtime"},()=>({contents:"export function mount(screen) { return globalThis.__stxNative.mount(screen) }",loader:"js"})),e.onLoad({filter:/\.stx$/},async(n)=>{let r=await Bun.file(n.path).text(),i=z(E(r,n.path));return t.push(...i.warnings),{contents:i.code,loader:"ts"}})}}}async function X(t){let e=Object.keys(t.screens);if(e.length===0)throw Error("screens must name at least one .stx file");let n=t.routed??!0,r=t.initialScreen??e[0];if(!t.screens[r])throw Error(`Initial screen ${r} is not in screens`);let i=t.minify??!1,s=w.resolve(t.root??process.cwd()),o=[],c=n?`(function () {
18
+ var names = ${JSON.stringify(e)};
19
+ var name = globalThis.__stxNativeRoute || ${JSON.stringify(r)};
20
+ if (names.indexOf(name) === -1) throw new Error(['Unknown native screen:', name].join(' '));
21
+ globalThis.__stxNativeRoute = name;
22
+ globalThis.__stxNativeRuntimeOptions = { routeName: name, routeNames: names };
23
+ })();`:"globalThis.__stxNativeRuntimeOptions = { routeName: 'main', routeNames: ['main'] };",l=await q(Ce(),[],i),h=[];for(let u of e){let f=w.resolve(s,t.screens[u]);if(!f.endsWith(".stx"))throw Error(`Screen ${u} must name a .stx file`);let g=await q(f,[Xe(o)],i),m=n?`globalThis.__stxNativeRoute === ${JSON.stringify(u)} && globalThis.__stxNativeBridge`:"globalThis.__stxNativeBridge";h.push(`// Screen ${u}: ${w.basename(f)}
24
+ if (${m}) {
25
+ ${g}
26
+ }`)}let a=[`// STX Native bundle (${e.join(", ")})`,c,l,...h,""].join(`
27
+ `),d=[...new Set(o)].map((u)=>({level:"warning",message:u}));if(!t.outFile)return{code:a,diagnostics:d};let S=w.resolve(s,t.outFile);return Ne(w.dirname(S),{recursive:!0}),await Bun.write(S,a),{code:a,outFile:S,diagnostics:d}}function J(t,e={}){return X({...e,screens:{main:t},routed:!1})}var K=["native.config.json","stx-native.config.json"];function Oe(t=process.cwd(),e){let n=e?x.resolve(t,e):K.map((c)=>x.join(t,c)).find((c)=>W(c));if(!n)return null;if(!W(n))throw Error(`Native config not found: ${n}`);let r=JSON.parse(H(n,"utf8")),i=Object.entries(r.screens??{});if(i.length===0)throw Error(`${x.basename(n)} must name at least one screen in "screens"`);let s={};for(let[c,l]of i){if(!/^[A-Z][\w-]*$/i.test(c))throw Error(`Invalid native screen name: ${c}`);if(typeof l!=="string"||!l.endsWith(".stx"))throw Error(`Screen ${c} must name a .stx file`);if(s[c]=x.resolve(x.dirname(n),l),!W(s[c]))throw Error(`Screen ${c} not found: ${s[c]}`)}let o=r.initialScreen||i[0][0];if(!s[o])throw Error(`Initial screen ${o} is not in screens`);return{initialScreen:o,screens:s,file:n}}async function Ze(t,e={}){let n=x.resolve(e.cwd??process.cwd()),r=e.format??"ir";if(r!=="ir"&&r!=="bundle")throw Error(`Unknown compile format: ${r}. Expected ir or bundle.`);let i=t?null:Oe(n,e.config);if(!t&&!i)throw Error(`Please specify an input file: stx native compile <file.stx>, or add ${K[0]}`);let s,o=[];if(r==="bundle"){let l=i?await X({screens:i.screens,initialScreen:i.initialScreen,minify:e.minify,root:n}):await J(x.resolve(n,t),{minify:e.minify});s=l.code,o=l.diagnostics}else{let l=(a)=>E(H(a,"utf8"),a),h=i?{initialScreen:i.initialScreen,screens:Object.fromEntries(Object.entries(i.screens).map(([a,d])=>[a,l(d)]))}:l(x.resolve(n,t));s=JSON.stringify(h,null,2)}if(!e.output)return{output:s,diagnostics:o};let c=x.resolve(n,e.output);return We(x.dirname(c),{recursive:!0}),await Bun.write(c,s),{output:s,written:c,diagnostics:o}}export{Ze as runNativeCompile};
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ import{s}from"./chunk-169n1vpx.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
3
+ `)i++;return i}function b(e,n){let i=e.lastIndexOf(`
4
+ `,n)+1,o=e.indexOf(`
5
+ `,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let t=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return r+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return r+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):s(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),r=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?r:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let r=e;if(i.includes("confirm"))r=A(r,o,l);if(i.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),r=[];if(i.length>0){r.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
6
+ ${t.reason}`)}if(l.length>0){r.push("",`An stx primitive already covers this \u2014 ${l.length} site(s):`);for(let t of l)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
7
+ use ${t.reason}`)}return r.join(`
8
+ `)}export{q as codemodSource,I as formatCodemodFindings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bl,Fl,zl,Hl,Vl,Ul,Wl}from"./chunk-amd6ey3t.js";export{Fl as createKeepAliveCache,Hl as generateKeepAliveCSS,Vl as generateKeepAliveRuntime,Ul as onActivated,Wl as onDeactivated,Bl as processKeepAliveDirectives,zl as shouldCacheComponent};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{createHash as g}from"crypto";import{readFile as v,stat as y}from"fs/promises";async function E(e){try{let t=await v(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function x(e){try{return await y(e),!0}catch{return!1}}import{mkdir as A,readFile as P,writeFile as k,readdir as H,rm as D,stat as O}from"fs/promises";import{join as w,dirname as S}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function M(e){try{await A(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function Vt(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await x(o))try{let u=await P(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function Ut(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await E(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await M(S(f)),await k(f,JSON.stringify(s,null,2))}catch(b){console.warn(`[stx-media] Failed to write cache: ${b}`)}}async function Wt(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await D(n,{recursive:!0,force:!0})}catch{}}}
3
+ export{E,x,Vt,Ut,Wt};
@@ -0,0 +1,40 @@
1
+ // @bun
2
+ import{O}from"./chunk-px7fvbj6.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function N(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import ee from"path";var te={showRelativePaths:!1,enableAutoRecovery:O(),logRecoveryWarnings:!0},L={...te};function R(){return{...L}}function k(e){if(!L.showRelativePaths||!e)return e;let r=L.baseDir||process.cwd();try{let n=ee.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class v extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,i,s,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=i;this.context=s;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=k(this.filePath)}}class J extends v{constructor(e,r,n,o,i,s){super(e,"stx_RUNTIME_ERROR",r,n,o,i,s||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class fn extends v{constructor(e,r,n,o,i,s){super(e,"stx_FILE_ERROR",r,n,o,i,s||t.FILE_NOT_FOUND);this.name="StxFileError"}}class ir extends v{isFatal=!0;constructor(e,r,n,o,i,s){super(e,"stx_VALIDATION_ERROR",r,n,o,i,s||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function U(e){let{type:r,message:n,code:o,filePath:i,line:s,column:g,template:u,offset:d,snippet:f,suggestion:m,format:h="text"}=e,E=s,x=g;if(!E&&u&&d!==void 0){let z=ce(u,d);E=z.line,x=z.column}let y=i?k(i):void 0,K=o?N(o):void 0,w={type:r,code:o,codeName:K,message:n,filePath:y,line:E,column:x,snippet:f,suggestion:m,timestamp:new Date().toISOString()},S;switch(h){case"html":S=oe(w);break;case"json":S=JSON.stringify(w,null,2);break;case"console":S=ie(w,u,d);break;case"text":default:S=ne(w,u,d);break}return{formatted:S,data:w}}function ne(e,r,n){let o=[],i=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${i}]`),e.filePath){let s=e.filePath;if(e.line){if(s+=`:${e.line}`,e.column)s+=`:${e.column}`}o.push(`at ${s}`)}if(o.push(`
3
+ ${e.message}`),r&&e.line){let s=se(r,e.line,2);if(s)o.push(`
4
+ ${s}`)}if(e.snippet)o.push(`
5
+ Snippet: ${e.snippet}`);if(e.suggestion)o.push(`
6
+ Suggestion: ${e.suggestion}`);return o.join(" ")}function oe(e){let r=e.code?` [${e.code}]`:"",n=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",o=`<!-- [${e.type} Error${r}]${n}: ${M(e.message)}`;if(e.suggestion)o+=` | Suggestion: ${M(e.suggestion)}`;return o+=" -->",o}function ie(e,r,n){let f=[],m=e.code?` [${e.codeName||e.code}]`:"";if(f.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${m} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let h=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(h+=`\x1B[90m:${e.line}\x1B[0m`,e.column)h+=`\x1B[90m:${e.column}\x1B[0m`}f.push(`
7
+ \x1B[90mat\x1B[0m ${h}`)}if(f.push(`
8
+
9
+ ${e.message}`),r&&e.line){let h=ae(r,e.line,2);if(h)f.push(`
10
+
11
+ \x1B[90mContext:\x1B[0m
12
+ ${h}`)}if(e.suggestion)f.push(`
13
+
14
+ \x1B[33mSuggestion:\x1B[0m ${e.suggestion}`);return f.push(`
15
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),f.join("")}function se(e,r,n){let o=e.split(`
16
+ `),i=Math.max(0,r-n-1),s=Math.min(o.length-1,r+n-1),g=[];for(let u=i;u<=s;u++){let d=(u+1).toString().padStart(4),f=u===r-1?">":" ";g.push(`${f}${d} | ${o[u]}`)}return g.join(`
17
+ `)}function ae(e,r,n){let o=e.split(`
18
+ `),i=Math.max(0,r-n-1),s=Math.min(o.length-1,r+n-1),g="\x1B[90m",u="\x1B[31m",d="\x1B[0m",f=[];for(let m=i;m<=s;m++){let h=(m+1).toString().padStart(4),E=m===r-1,x=E?"\x1B[31m>\x1B[0m":" ",y=E?`\x1B[31m${o[m]}\x1B[0m`:`\x1B[90m${o[m]}\x1B[0m`;f.push(`${x}\x1B[90m${h}\x1B[0m | ${y}`)}return f.join(`
19
+ `)}function M(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function ce(e,r){let o=e.substring(0,r).split(`
20
+ `);return{line:o.length,column:o[o.length-1].length}}function a(e,r,n){return U({type:e,message:r,code:n,format:"html"}).formatted}async function re(e,r,n){try{return await e()}catch(o){if(n&&o instanceof Error)n(o);return r}}var Rs={isEnabled(){return R().enableAutoRecovery},fixCommonSyntaxErrors(e){let r=R();if(!r.enableAutoRecovery)return{fixed:e,fixes:[]};let n=e,o=[],i=(n.match(/\{\{/g)||[]).length,s=(n.match(/\}\}/g)||[]).length;if(i>s){let u=i-s;n+="}}".repeat(u),o.push(`Added ${u} missing closing braces '}}'`)}let g=["if","foreach","for","switch","section"];for(let u of g){let d=(n.match(new RegExp(`@${u}\\b`,"g"))||[]).length,f=(n.match(new RegExp(`@end${u}\\b`,"g"))||[]).length;if(d>f){let m=d-f;for(let h=0;h<m;h++)n+=`
21
+ @end${u}`;o.push(`Added ${m} missing @end${u}`)}}if(o.length>0&&r.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),o.forEach((u)=>console.warn(` - ${u}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:n,fixes:o}},createFallbackContent(e,r){if(O())return`<!-- ${e} failed: ${r.message} -->`;return"<!-- stx rendering error -->"}};class A{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,r,n="error"){let o={timestamp:new Date,error:e,context:r,level:n};if(this.errors.push(o),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(n))this.writeToFile(o)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let r=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)r.push(` Stack: ${e.error.stack.split(`
22
+ `).slice(1).join(`
23
+ `)}`);if(e.context)r.push(` Context: ${JSON.stringify(e.context)}`);return r.join(`
24
+ `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let r=await import("fs"),n=await import("path"),o=n.dirname(this.logFilePath);if(!r.existsSync(o))r.mkdirSync(o,{recursive:!0});await this.rotateIfNeeded(r);let i=`${this.formatEntry(e)}
25
+ `;r.appendFileSync(this.logFilePath,i,"utf-8")}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",r)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let n=this.maxLogFiles-1;n>=1;n--){let o=`${this.logFilePath}.${n}`,i=`${this.logFilePath}.${n+1}`;if(e.existsSync(o))if(n>=this.maxLogFiles-1)e.unlinkSync(o);else e.renameSync(o,i)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",r)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((r)=>r.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((r)=>r.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},r={error:0,warning:0,info:0};for(let n of this.errors){let o=n.error.constructor.name;e[o]=(e[o]||0)+1;let i=n.level||"error";r[i]=(r[i]||0)+1}return{total:this.errors.length,byType:e,byLevel:r}}async exportToFile(e,r="json"){let n=await import("fs"),o=await import("path"),i=o.dirname(e);if(!n.existsSync(i))n.mkdirSync(i,{recursive:!0});if(r==="json"){let s=this.errors.map((g)=>({timestamp:g.timestamp.toISOString(),level:g.level||"error",type:g.error.constructor.name,message:g.error.message,stack:g.error.stack,context:g.context}));n.writeFileSync(e,JSON.stringify(s,null,2),"utf-8")}else{let s=this.errors.map((g)=>this.formatEntry(g));n.writeFileSync(e,s.join(`
26
+
27
+ `),"utf-8")}}async flush(){await this.writeQueue}}var _=new A,At={isDevelopment(){return O()},logDetailedError(e,r){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),r)console.error("Context:",r);console.error("========================")},createErrorReport(e,r){let n=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(r)n.push(`Context: ${JSON.stringify(r,null,2)}`);return n.push("========================"),n.join(`
28
+ `)}};var le={maxSanitizeDepth:10,allowBracketNotation:!1},X={...le};var F=/\bnew\s+/,P="__stx_safe_ctors",G=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,F,/\bdelete\s+/,/\bthis\b/],ue=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",P]),H=new Set(["__proto__","constructor","prototype"]),ge=/[\w)\]]\s*\[\s*['"]/;function q(e){let r="",n=[],o=null,i=!1;for(let s=0;s<e.length;s++){let g=e[s];if(i){i=!1;continue}if(g==="\\"&&o){i=!0;continue}if(o){if(o==="`"&&g==="$"&&s+1<e.length&&e[s+1]==="{"){let u=1;s+=2;while(s<e.length&&u>0){if(e[s]==="{")u++;else if(e[s]==="}")u--;if(u>0)r+=e[s],n.push(s),s++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(s)}return{text:r,map:n}}function fe(e){return q(e).text}var Y=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Z=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of Y)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),me=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,j=/(?<![\w$])new(?![\w$])/g,B=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Y.join(",")}}() are allowed`;function pe(e){let{text:r,map:n}=q(e),o=[];j.lastIndex=0;let i;while((i=j.exec(r))!==null){let g=i.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=me.exec(r.slice(g)),d=u?.[3],f=!u?null:d?`Intl_${d}`:u[2];if(!u||!f||!(f in Z))throw new b(`matched /${F.source}/; ${B}`,e);let m=g+u[0].length,h=n[g],E=n[m-1]+1;if(e.slice(h,E)!==r.slice(g,m))throw new b(`matched /${F.source}/; ${B}`,e);let x=h+3+u[1].length;o.push({start:x,end:x+u[2].length,key:f})}let s=e;for(let g=o.length-1;g>=0;g--){let u=o[g];s=`${s.slice(0,u.start)}${P}.${u.key}${s.slice(u.end)}`}return{source:s,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function gn(e){try{return D(e),null}catch(r){return r instanceof b?r.rule:r instanceof Error?r.message:String(r)}}function de(e,r){let n=/[$A-Z_a-z][$\w]*/g,o;while((o=n.exec(e))!==null){let i=o[0],s=e[o.index-1];if(ue.has(i))throw new b(`matched /\\b${i}\\b/; identifier ${i}`,r);if(s==="."&&H.has(i))throw new b(`matched /.${i}/; property ${i}`,r)}}function he(e){let r=/\[\s*(['"])(.*?)\1\s*\]/g,n;while((n=r.exec(e))!==null){let o=n[2];if(!H.has(o))continue;let i=e.slice(0,n.index).match(/\S(?=\s*$)/)?.[0],s=e.slice(n.index+n[0].length).match(/^\s*(\S)/)?.[1];if(!((i==="{"||i===",")&&s===":"))throw new b(`bracket key ${n[2]}`,e)}}function D(e){let r=e.trim(),n=fe(r);de(n,r),he(r);for(let o of G){if(o===F)continue;if(o.test(n))throw new b(`matched /${o.source}/`,r)}if(!X.allowBracketNotation&&ge.test(r))throw new b("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",r,`Bracket notation with strings not allowed: ${r}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return pe(r)}function As(e){return D(e),e.trim()}function Ps(e){let r={};r.Math=Math,r.JSON=JSON,r.Date=Date,r.String=String,r.Number=Number,r.Boolean=Boolean,r.Array=Array,r.parseInt=Number.parseInt,r.parseFloat=Number.parseFloat,r.isNaN=Number.isNaN,r.isFinite=Number.isFinite,r.encodeURIComponent=encodeURIComponent,r.decodeURIComponent=decodeURIComponent;for(let[n,o]of Object.entries(e)){if(n.startsWith("__")||G.some((i)=>i.test(n)))continue;if(o&&typeof o==="object"&&!Array.isArray(o))r[n]=T(o);else r[n]=o}return r}function T(e,r=0){if(r>=X.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>T(o,r+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let n={};for(let[o,i]of Object.entries(e)){if(o.startsWith("__")||o==="constructor"||o==="prototype")continue;if(i&&typeof i==="object")n[o]=T(i,r+1);else n[o]=i}return n}function c(e,r){try{let n=Ps(r),o=Object.keys(n),i=Object.values(n);return l(e,o)(...i)}catch{return}}function p(e){try{return As(e),!0}catch{return!1}}function I(e,r){try{let n=c(e,r);if(n&&typeof n==="object"&&!Array.isArray(n))return n;return{}}catch{return{}}}var Q=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),Ee=2000,C=new Map;function V(e,r){let n=`${e.join(",")}\x00${r}`,o=C.get(n);if(o)return o;let i=Function(...e,r);if(C.size>=Ee)C.clear();return C.set(n,i),i}function ke(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var xe=/^[A-Za-z_$][\w$]*$/;function Ze(e){return xe.test(e)&&!Q.has(e)}function l(e,r){let{source:n,usesSafeConstructors:o}=D(e),i=[];for(let f=0;f<r.length;f++){if(!Ze(r[f]))continue;if(r[f]===P)continue;i.push({key:r[f],index:f})}i.sort((f,m)=>f.key.localeCompare(m.key));let s=i.map((f)=>f.key),g=i.map((f)=>f.index),u=`
29
+ 'use strict';
30
+ try {
31
+ return ${n};
32
+ }
33
+ catch (e) {
34
+ if (e instanceof TypeError) {
35
+ return undefined;
36
+ }
37
+ throw e;
38
+ }
39
+ `;return be(o?(f)=>{let m=V([P,...s,...f],u);return(...h)=>m(Z,...h)}:(f)=>V([...s,...f],u),s,r,i,g)}function be(e,r,n,o,i){let s=e([]),g=o.every((d,f)=>d.index===f);if(r.length===n.length&&g)return W(s,r,e);return W((...d)=>{let f=Array(i.length);for(let m=0;m<i.length;m++)f[m]=d[i[m]];return s(...f)},r,e,(d)=>{s=e(d)})}function W(e,r,n,o){let s=/^(\w+) is not defined$/,g=e,u=[],d=new Set(r);return(...f)=>{for(let m=0;m<=8;m++)try{return g(...f)}catch(h){let E=h instanceof Error?h.message:"",x=s.exec(E);if(!(h instanceof ReferenceError)||!x)return;let y=x[1];if(d.has(y)||Q.has(y))return;if(d.add(y),u.push(y),o)o(u);else g=n(u)}return}}function or(e){let r=e.trim(),n=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let o of n)if(o.test(r))return!1;return!0}
40
+ export{t,J,fn,ir,a,re,Rs,_,At,gn,As,Ps,c,p,I,ke,Ze,l,or};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{zu,vo,Hu,wo,Cc,$c,Tt,ln,Vu,Ec,Tc,f}from"./chunk-b98be3yp.js";export{Tt as buildCss,Ec as extractClassNames,$c as fingerprintConfig,Tc as generateCss,Vu as getCachedCSS,zu as getCssServeAsset,f as injectCss,vo as loadCssEngine,wo as loadCssEngineConfig,ln as rebuildCss,Hu as resetCssCache,Cc as resolveUserCssConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ln,Xa,_u,Ka,Ru,Ga,jn,h,vt,be,Ja,Yr,Ya,Au,q,Za,Pu,b,Iu}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{Za as applyFilters,Ru as clearCustomFilters,Ja as clientLoopScopes,Ln as defaultFilters,h as escapeHtml,vt as escapeHtmlValue,b as evaluateExpression,Ga as findMustacheEnd,Ka as getAllFilters,Ya as interpolateScriptAttributes,Yr as interpolateScriptExpressions,Au as interpolateScriptsInTemplate,q as processExpressions,Xa as registerFilter,_u as registerFilters,jn as replaceInterpolations,Pu as resetRejectedExpressionWarnings,Iu as unescapeHtml,be as usesSignalsInScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ay6zjq8v.js";function F(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
2
+ function r(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
3
3
  (function() {
4
4
  'use strict';
5
5
 
@@ -283,6 +283,6 @@ else {
283
283
  // Expose for manual initialization
284
284
  window.XElement = XElement;
285
285
  })();
286
- </script>`}function G(k){return/\bx-data(?:\s|=)/.test(k)}function H(k){let z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,A=k.match(z)||[],j=A.length>0?k.replace(z,""):k;if(!G(j))return j;let B=A[0]?.trim()||F(),q=j.lastIndexOf("</body>");if(q!==-1)return j.slice(0,q)+B+`
287
- `+j.slice(q);return j+`
288
- `+B}export{H as processXElementDirectives,G as hasXElementDirectives,F as generateXElementRuntime};
286
+ </script>`}function l(t){return/\bx-data(?:\s|=)/.test(t)}function c(t){let i=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,s=t.match(i)||[],e=s.length>0?t.replace(i,""):t;if(!l(e))return e;let a=s[0]?.trim()||r(),n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+a+`
287
+ `+e.slice(n);return e+`
288
+ `+a}export{r as generateXElementRuntime,l as hasXElementDirectives,c as processXElementDirectives};