@stacksjs/stx 0.2.846 → 0.2.849

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 (237) hide show
  1. package/dist/app-shell.d.ts +2 -1
  2. package/dist/app-shell.js +3 -3
  3. package/dist/{chunk-cpdfxy8g.js → chunk-056rsqc6.js} +12 -12
  4. package/dist/{chunk-wzpd3htt.js → chunk-09412heg.js} +7 -7
  5. package/dist/chunk-0d4zhbjz.js +2 -0
  6. package/dist/{chunk-ng8nkbp2.js → chunk-0ey7kc6t.js} +2 -2
  7. package/dist/chunk-0g05v7m1.js +2 -0
  8. package/dist/{chunk-z26fg4p0.js → chunk-0wms5teg.js} +2 -2
  9. package/dist/{chunk-nsc93haq.js → chunk-0zgxxhvs.js} +6 -6
  10. package/dist/chunk-11snc6n0.js +2 -0
  11. package/dist/{chunk-82vf29ty.js → chunk-12r22pf0.js} +2 -2
  12. package/dist/{chunk-j1n2xb48.js → chunk-14cvwsy1.js} +2 -2
  13. package/dist/{chunk-0e4y6h1h.js → chunk-1k12cc65.js} +14 -14
  14. package/dist/chunk-1menbxwb.js +2 -0
  15. package/dist/chunk-1p968nww.js +2 -0
  16. package/dist/chunk-1pf4y2yr.js +2 -0
  17. package/dist/{chunk-6pgq75h9.js → chunk-25m74mh1.js} +5 -5
  18. package/dist/{chunk-xq9w5g23.js → chunk-2j3gttzf.js} +1 -1
  19. package/dist/chunk-2sxmmjt1.js +2 -0
  20. package/dist/{chunk-h76wsqr4.js → chunk-2ts9pb6s.js} +2 -2
  21. package/dist/{chunk-caw0wzns.js → chunk-2xf323h9.js} +3 -3
  22. package/dist/chunk-34afrhts.js +2 -0
  23. package/dist/chunk-37bzsnr7.js +2 -0
  24. package/dist/chunk-3m5v3ynh.js +4 -0
  25. package/dist/chunk-3m6n90sk.js +2 -0
  26. package/dist/{chunk-zx2xwrp3.js → chunk-3qyz80d6.js} +6 -6
  27. package/dist/{chunk-an6vb4ng.js → chunk-46t924aw.js} +2 -2
  28. package/dist/{chunk-9hfk5wf1.js → chunk-4fc8zs15.js} +5 -5
  29. package/dist/chunk-4q4mtrc5.js +2 -0
  30. package/dist/{chunk-xskygt2v.js → chunk-54p27ney.js} +5 -5
  31. package/dist/chunk-5bm8hmwd.js +2 -0
  32. package/dist/chunk-5r2z29n8.js +2 -0
  33. package/dist/{chunk-wbx27kdd.js → chunk-5wr1qqz3.js} +2 -2
  34. package/dist/{chunk-wvsnp294.js → chunk-63sqdcr6.js} +9 -9
  35. package/dist/chunk-660preb9.js +2 -0
  36. package/dist/chunk-6hd83cj4.js +2 -0
  37. package/dist/{chunk-gs33xdk7.js → chunk-6xcmeev9.js} +5 -5
  38. package/dist/chunk-740njbwc.js +2 -0
  39. package/dist/chunk-77fs8281.js +2 -0
  40. package/dist/chunk-7c73t536.js +2 -0
  41. package/dist/chunk-7ycmnsh5.js +2 -0
  42. package/dist/{chunk-r3v1zaj0.js → chunk-81ysx0tc.js} +2 -2
  43. package/dist/{chunk-hp8ny2zb.js → chunk-83dxfhkw.js} +5 -5
  44. package/dist/chunk-84gg2atb.js +2 -0
  45. package/dist/chunk-86z8zrn9.js +3 -0
  46. package/dist/{chunk-5903tzcw.js → chunk-88a7qaw8.js} +3 -3
  47. package/dist/{chunk-1qp5808r.js → chunk-8bxws458.js} +3 -3
  48. package/dist/{chunk-j3zy3mrn.js → chunk-8vkywnpx.js} +9 -9
  49. package/dist/{chunk-zkn55966.js → chunk-90mm5bf8.js} +6 -6
  50. package/dist/{chunk-8az9e5b9.js → chunk-93c08def.js} +5 -5
  51. package/dist/chunk-9c6yvh3p.js +2 -0
  52. package/dist/chunk-9f0pv6sz.js +2 -0
  53. package/dist/chunk-9fxeqf0e.js +2 -0
  54. package/dist/{chunk-4041q9sd.js → chunk-9mbyhepc.js} +5 -5
  55. package/dist/{chunk-vxayh4az.js → chunk-9qxx2teq.js} +6 -6
  56. package/dist/{chunk-p8ry1q7c.js → chunk-9sjtph54.js} +3 -3
  57. package/dist/chunk-atsjexk0.js +2 -0
  58. package/dist/{chunk-x3pxxx7j.js → chunk-b147ejha.js} +3 -3
  59. package/dist/{chunk-1w5hte9z.js → chunk-b3n1m4m5.js} +2 -2
  60. package/dist/chunk-bcefawtc.js +2 -0
  61. package/dist/chunk-bkqqa8aw.js +2 -0
  62. package/dist/chunk-bmds786f.js +2 -0
  63. package/dist/{chunk-ph57nv7v.js → chunk-bsw6hd14.js} +2 -2
  64. package/dist/{chunk-s2a51j0k.js → chunk-bttvkzxh.js} +6 -6
  65. package/dist/chunk-c0azgkss.js +2 -0
  66. package/dist/{chunk-v8y01jbr.js → chunk-c541s99z.js} +4 -4
  67. package/dist/{chunk-50tnhq5f.js → chunk-c7qej674.js} +30 -30
  68. package/dist/chunk-cbz7jtzf.js +2 -0
  69. package/dist/{chunk-bsr6kf34.js → chunk-ct54e34a.js} +1 -1
  70. package/dist/{chunk-84myqca7.js → chunk-cww1zk8y.js} +2 -2
  71. package/dist/{chunk-d1pat213.js → chunk-dv9q56r7.js} +2 -2
  72. package/dist/chunk-e1n286mv.js +2 -0
  73. package/dist/{chunk-t3e95q80.js → chunk-eg2p1cyw.js} +14 -14
  74. package/dist/{chunk-7rcc2tzz.js → chunk-emf6ee94.js} +3 -3
  75. package/dist/chunk-evdskc25.js +2 -0
  76. package/dist/chunk-f18rxz70.js +2 -0
  77. package/dist/{chunk-wd632rge.js → chunk-f2zgh4xr.js} +7 -7
  78. package/dist/chunk-f8akfzzn.js +2 -0
  79. package/dist/chunk-f8wmxwa3.js +2 -0
  80. package/dist/{chunk-neh3kewg.js → chunk-fa3ygt8c.js} +4 -4
  81. package/dist/{chunk-n475s55q.js → chunk-fez9828r.js} +2 -2
  82. package/dist/chunk-fseqwysr.js +2 -0
  83. package/dist/{chunk-ds1vj0dw.js → chunk-fx8jjasv.js} +4 -4
  84. package/dist/{chunk-x1n01gc1.js → chunk-ga650crj.js} +5 -5
  85. package/dist/{chunk-rg2gfyy0.js → chunk-gpkxphqz.js} +2 -2
  86. package/dist/chunk-h8zb6cek.js +2 -0
  87. package/dist/chunk-hc4ydhw0.js +2 -0
  88. package/dist/{chunk-30g5kqy0.js → chunk-he9dzchk.js} +1 -1
  89. package/dist/{chunk-4y6hes3h.js → chunk-hpwtjb4a.js} +2 -2
  90. package/dist/chunk-j08r18x1.js +2 -0
  91. package/dist/chunk-j539dz72.js +2 -0
  92. package/dist/{chunk-s6qzmwp3.js → chunk-jaf44web.js} +1 -1
  93. package/dist/{chunk-vyggv4k0.js → chunk-jcwtw3hd.js} +2 -2
  94. package/dist/{chunk-81nmqdht.js → chunk-jh36gqcq.js} +2 -2
  95. package/dist/{chunk-m8cpabd2.js → chunk-jm0qsr3s.js} +3 -3
  96. package/dist/{chunk-4v6mbvqv.js → chunk-jmshgw0t.js} +5 -5
  97. package/dist/chunk-jqngvqby.js +2 -0
  98. package/dist/{chunk-vh8wn94m.js → chunk-jtccqpwa.js} +2 -2
  99. package/dist/chunk-k33kgf8a.js +2 -0
  100. package/dist/{chunk-7qwfbafg.js → chunk-k44qj40k.js} +2 -2
  101. package/dist/{chunk-444sbdm8.js → chunk-k7e3e149.js} +36 -36
  102. package/dist/chunk-ke76eaat.js +33 -0
  103. package/dist/chunk-kz7ha54c.js +2 -0
  104. package/dist/chunk-m7cbkrz6.js +2 -0
  105. package/dist/{chunk-qttjrja7.js → chunk-ma9yq04p.js} +2 -2
  106. package/dist/chunk-md8dj6tb.js +2 -0
  107. package/dist/{chunk-krdfnsz6.js → chunk-mnncq81c.js} +5 -5
  108. package/dist/chunk-na1v2jcy.js +2 -0
  109. package/dist/{chunk-jf0a5ew8.js → chunk-na1x46xm.js} +3 -3
  110. package/dist/{chunk-sxsjxme0.js → chunk-nws4zm4k.js} +4 -4
  111. package/dist/chunk-p2fkggw4.js +3 -0
  112. package/dist/chunk-pqqyjvq9.js +2 -0
  113. package/dist/chunk-q18508s2.js +2 -0
  114. package/dist/chunk-qay7pgnq.js +2 -0
  115. package/dist/chunk-qczgdzjk.js +2 -0
  116. package/dist/{chunk-rgy9c7d8.js → chunk-qpz9jrvw.js} +3 -3
  117. package/dist/chunk-r40g6785.js +2 -0
  118. package/dist/chunk-r6085mp4.js +2 -0
  119. package/dist/{chunk-prrf0j54.js → chunk-r96ahk8s.js} +5 -5
  120. package/dist/chunk-rke4q3jk.js +2 -0
  121. package/dist/{chunk-mzyx6y1a.js → chunk-rqjskxpw.js} +32 -32
  122. package/dist/chunk-rrnvbwac.js +2 -0
  123. package/dist/{chunk-c78dsx3f.js → chunk-rtsshvpt.js} +10 -10
  124. package/dist/{chunk-66e0d2t7.js → chunk-rwc322gq.js} +2 -2
  125. package/dist/{chunk-r1984y6y.js → chunk-shnw9geh.js} +4 -4
  126. package/dist/{chunk-dspmqeg0.js → chunk-t4dkcf28.js} +114 -25
  127. package/dist/{chunk-2a792g5e.js → chunk-t5q31st4.js} +2 -2
  128. package/dist/{chunk-4jmkvzns.js → chunk-tb5h85ag.js} +2 -2
  129. package/dist/{chunk-098mrr5f.js → chunk-tbcvarvy.js} +2 -2
  130. package/dist/chunk-te1wksa0.js +2 -0
  131. package/dist/{chunk-6x6xthsv.js → chunk-tj533808.js} +2 -2
  132. package/dist/{chunk-jx14j83s.js → chunk-tm5t3hh3.js} +3 -3
  133. package/dist/{chunk-serwcna2.js → chunk-trgbdydw.js} +2 -2
  134. package/dist/chunk-v11hvvxc.js +2 -0
  135. package/dist/{chunk-fnfq6fkk.js → chunk-v929r67j.js} +1 -1
  136. package/dist/chunk-vasvns9e.js +2 -0
  137. package/dist/chunk-vdb3p2v3.js +2 -0
  138. package/dist/chunk-vm2y05sr.js +2 -0
  139. package/dist/{chunk-zyt8k9n0.js → chunk-wdwx2aa6.js} +2 -2
  140. package/dist/{chunk-6g7wrn48.js → chunk-wp14sf2j.js} +2 -2
  141. package/dist/{chunk-xhytkzg7.js → chunk-wzyc9da7.js} +2 -2
  142. package/dist/chunk-x2wn6mpd.js +2 -0
  143. package/dist/chunk-x45mp78q.js +2 -0
  144. package/dist/chunk-xa2qfe51.js +3 -0
  145. package/dist/{chunk-zjqvbcwa.js → chunk-xppm4cs4.js} +2 -2
  146. package/dist/{chunk-tzqnf28n.js → chunk-xr9rf0e6.js} +3 -3
  147. package/dist/chunk-xsmyhp5f.js +2 -0
  148. package/dist/{chunk-xj5j18nf.js → chunk-y1cneng3.js} +2 -2
  149. package/dist/{chunk-rn7710jg.js → chunk-y6wbbmp3.js} +3 -3
  150. package/dist/{chunk-evww725k.js → chunk-ynnd6nnt.js} +63 -63
  151. package/dist/{chunk-d4jhyxp6.js → chunk-yqjmqndq.js} +6 -6
  152. package/dist/{chunk-hff8z61n.js → chunk-yrmppd8r.js} +1 -1
  153. package/dist/{chunk-9d9sartn.js → chunk-z57xq46m.js} +1 -1
  154. package/dist/chunk-zecffe6a.js +2 -0
  155. package/dist/{chunk-ea5w92vs.js → chunk-zfb2wnha.js} +3 -3
  156. package/dist/cli.js +20 -20
  157. package/dist/craft-entry.js +2 -2
  158. package/dist/craft.js +2 -2
  159. package/dist/native/floating-actions.d.ts +43 -0
  160. package/dist/native/floating-actions.js +50 -0
  161. package/dist/native/index.d.ts +1 -0
  162. package/dist/native/index.js +1 -0
  163. package/dist/native/primitives/FloatingActions.stx +42 -0
  164. package/dist/native/runtime/browser-screen.js +3 -8
  165. package/dist/page-head.d.ts +15 -0
  166. package/dist/page-head.js +35 -10
  167. package/dist/pwa.js +3 -3
  168. package/dist/ssg.js +6 -6
  169. package/dist/template-compiler.js +2 -2
  170. package/package.json +5 -5
  171. package/dist/chunk-07hvjvj1.js +0 -2
  172. package/dist/chunk-13sp1247.js +0 -2
  173. package/dist/chunk-1kdtapc1.js +0 -2
  174. package/dist/chunk-263gby2p.js +0 -2
  175. package/dist/chunk-33ggd5at.js +0 -2
  176. package/dist/chunk-3q19w77r.js +0 -2
  177. package/dist/chunk-40x0vwza.js +0 -2
  178. package/dist/chunk-4cmda04d.js +0 -2
  179. package/dist/chunk-5xt4tjpm.js +0 -2
  180. package/dist/chunk-6289h3tr.js +0 -2
  181. package/dist/chunk-6q7ke5p0.js +0 -2
  182. package/dist/chunk-6ya0860g.js +0 -2
  183. package/dist/chunk-8k7rfy77.js +0 -3
  184. package/dist/chunk-9enwmg0z.js +0 -2
  185. package/dist/chunk-a7z6j9ga.js +0 -2
  186. package/dist/chunk-ab6dw6f4.js +0 -2
  187. package/dist/chunk-adnntqk3.js +0 -2
  188. package/dist/chunk-bhzbcmm7.js +0 -2
  189. package/dist/chunk-cfez1qbm.js +0 -2
  190. package/dist/chunk-cgyddqxw.js +0 -2
  191. package/dist/chunk-cng4fhpt.js +0 -2
  192. package/dist/chunk-ctq1qy1g.js +0 -2
  193. package/dist/chunk-cyghcps7.js +0 -2
  194. package/dist/chunk-e26aqarz.js +0 -2
  195. package/dist/chunk-e7816ep3.js +0 -2
  196. package/dist/chunk-en8hnq2q.js +0 -2
  197. package/dist/chunk-enz6fsdx.js +0 -2
  198. package/dist/chunk-eydqn4gz.js +0 -2
  199. package/dist/chunk-fk7gs41v.js +0 -2
  200. package/dist/chunk-fx04tq90.js +0 -2
  201. package/dist/chunk-fzba0b0n.js +0 -2
  202. package/dist/chunk-g7tj2tnz.js +0 -2
  203. package/dist/chunk-ga0293gz.js +0 -2
  204. package/dist/chunk-gab3h25h.js +0 -2
  205. package/dist/chunk-hczqyk7c.js +0 -2
  206. package/dist/chunk-hs6fg0k9.js +0 -2
  207. package/dist/chunk-hsg4ggt0.js +0 -2
  208. package/dist/chunk-k3pfadjb.js +0 -2
  209. package/dist/chunk-kmnre1tq.js +0 -2
  210. package/dist/chunk-mgtp037k.js +0 -3
  211. package/dist/chunk-mp42d9v5.js +0 -2
  212. package/dist/chunk-mtmgrccj.js +0 -2
  213. package/dist/chunk-n20tsy6a.js +0 -2
  214. package/dist/chunk-nhn69eva.js +0 -4
  215. package/dist/chunk-pdt1phnh.js +0 -2
  216. package/dist/chunk-q87wwwra.js +0 -2
  217. package/dist/chunk-r1mvd96m.js +0 -2
  218. package/dist/chunk-rrj3gv46.js +0 -3
  219. package/dist/chunk-s321pb85.js +0 -2
  220. package/dist/chunk-st75663x.js +0 -2
  221. package/dist/chunk-stss2b88.js +0 -2
  222. package/dist/chunk-svxkcdhh.js +0 -2
  223. package/dist/chunk-t6gm8z7x.js +0 -2
  224. package/dist/chunk-tkssavxx.js +0 -2
  225. package/dist/chunk-tw6y23ew.js +0 -2
  226. package/dist/chunk-vm34qp5k.js +0 -2
  227. package/dist/chunk-vtg2tqzt.js +0 -2
  228. package/dist/chunk-wddaxpep.js +0 -2
  229. package/dist/chunk-x6bt567m.js +0 -2
  230. package/dist/chunk-xdzs2mxv.js +0 -32
  231. package/dist/chunk-xf4d9gam.js +0 -2
  232. package/dist/chunk-xf5db38j.js +0 -2
  233. package/dist/chunk-y5t7ec69.js +0 -2
  234. package/dist/chunk-yk90sqqv.js +0 -2
  235. package/dist/chunk-z231es22.js +0 -2
  236. package/dist/chunk-zphekzv8.js +0 -2
  237. package/dist/chunk-zsft5466.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{hs,Ff,Uo,zf}from"./chunk-88a7qaw8.js";import"./chunk-cww1zk8y.js";import"./chunk-63sqdcr6.js";import"./chunk-0zgxxhvs.js";import"./chunk-he9dzchk.js";import"./chunk-rtsshvpt.js";import"./chunk-xr9rf0e6.js";import"./chunk-jtccqpwa.js";import"./chunk-nws4zm4k.js";import"./chunk-09412heg.js";import"./chunk-t4dkcf28.js";import{It}from"./chunk-ynnd6nnt.js";import"./chunk-gpkxphqz.js";import"./chunk-46t924aw.js";import"./chunk-eg2p1cyw.js";import"./chunk-xppm4cs4.js";import"./chunk-0wms5teg.js";export{zf as declareBareLoopHead,It as parseLoopBinding,Ff as processLoops,Uo as processLoopsAsync,hs as reportDeferredLoopWarnings};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,l}from"./chunk-t3e95q80.js";import{r,vn,h}from"./chunk-evww725k.js";import{nt}from"./chunk-dspmqeg0.js";import{Ts,$s}from"./chunk-wzpd3htt.js";import{Ec,ti,Cs,Es}from"./chunk-sxsjxme0.js";import{kc,_c}from"./chunk-tzqnf28n.js";import{St}from"./chunk-b1q40vq4.js";import{dn,Ic,br,wr}from"./chunk-8k7rfy77.js";import{g}from"./chunk-0dve54ne.js";import{so}from"./chunk-zyt8k9n0.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Bt}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,n={}){let{duration:i,delay:o,ease:s,direction:c,custom:d}={...B,...n};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{t,l}from"./chunk-eg2p1cyw.js";import{r,xn,h}from"./chunk-ynnd6nnt.js";import{nt}from"./chunk-t4dkcf28.js";import{$s,Rs}from"./chunk-09412heg.js";import{Tc,ni,Es,Ts}from"./chunk-nws4zm4k.js";import{_c,Cc}from"./chunk-xr9rf0e6.js";import{St}from"./chunk-b1q40vq4.js";import{pn,Oc,wr,vr}from"./chunk-p2fkggw4.js";import{g}from"./chunk-0dve54ne.js";import{oo}from"./chunk-wdwx2aa6.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Bt}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,n={}){let{duration:i,delay:o,ease:s,direction:c,custom:d}={...B,...n};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${c==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -234,7 +234,7 @@ else {
234
234
  </script>
235
235
  `}var Pe={name:"transition",handler:(e,n,i,o)=>{if(n.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${e}`;let s=n[0],c=n.length>1?Number.parseInt(n[1],10)||B.duration:B.duration,d=n.length>2?n[2]||B.ease:B.ease,p=n.length>3?Number.parseInt(n[3],10)||B.delay:B.delay,u=n.length>4?n[4]||B.direction:B.direction,m=`stx-transition-${Math.random().toString(36).substr(2,9)}`,y=it(s,{duration:c,delay:p,ease:d,direction:u}),f="stx-transition",v="";if(s==="fade")v="stx-fade";else if(s==="slide")v="stx-slide";else if(s==="scale")v="stx-scale";else if(s==="flip")v="stx-flip";else if(s==="rotate")v="stx-rotate";return`<div id="${m}" class="${f} ${v} ${u==="out"?"stx-out":""}"
236
236
  style="--stx-transition-duration: ${c}ms; --stx-transition-ease: ${d}; --stx-transition-delay: ${p}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},ke={name:"scrollAnimate",handler:(e,n,i,o)=>{if(n.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let s=n[0],c=n.length>1?Number.parseInt(n[1],10)||300:300,d=n.length>2?n[2]||"ease":"ease",p=n.length>3?Number.parseFloat(n[3])||0.2:0.2,u=n.length>4?Number.parseInt(n[4],10)||0:0,m=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,y=`--stx-transition-duration: ${c}ms; --stx-transition-ease: ${d}; --stx-transition-delay: ${u}ms; will-change: opacity, transform;`,f="stx-transition stx-observe stx-out";if(s==="fade")f+=" stx-fade";else if(s==="slide-up"||s==="slide")f+=" stx-from-bottom";else if(s==="slide-down")f+=" stx-from-top";else if(s==="slide-left")f+=" stx-from-right";else if(s==="slide-right")f+=" stx-from-left";else if(s==="scale")f+=" stx-scale";else if(s.includes("-"))f+=` stx-${s}`;else f+=` stx-${s}`;return`<div id="${m}" class="${f}" style="${y}" data-threshold="${p}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Ae={name:"animationGroup",handler:(e,n,i,o)=>{if(n.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let s=n[0],c=n.slice(1).map((m)=>m.startsWith("#")||m.startsWith(".")?m:`#${m}`),d=i.staggerDelay||50,p=i.sequence||!0,u=dt(s,c,{staggerDelay:d,sequence:p});return`${e}
237
- ${u}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},_e={name:"motion",handler:(e,n,i,o)=>{let s=n.length>0?n[0].toLowerCase()==="true":!0,c=at();return`<div data-animate="${s?"auto":"true"}">${e}</div>${c}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function yc(e,n,i,o){let s=e;if(o.animation?.enabled===!1)return s;let c=i.includes("test")&&i.includes("animation");if(!ot(s)&&!c)return s;if(!s.includes('<style id="stx-animation-base">')){let p=ct();s=s.replace("</head>",`${p}
237
+ ${u}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},_e={name:"motion",handler:(e,n,i,o)=>{let s=n.length>0?n[0].toLowerCase()==="true":!0,c=at();return`<div data-animate="${s?"auto":"true"}">${e}</div>${c}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function bc(e,n,i,o){let s=e;if(o.animation?.enabled===!1)return s;let c=i.includes("test")&&i.includes("animation");if(!ot(s)&&!c)return s;if(!s.includes('<style id="stx-animation-base">')){let p=ct();s=s.replace("</head>",`${p}
238
238
  </head>`)}if(s.includes("stx-observe")){if(!s.includes("Intersection Observer for scroll animations")){let u=lt(),m=s.lastIndexOf("</body>");if(m!==-1)s=s.slice(0,m)+u+`
239
239
  `+s.slice(m)}}return s}async function ut(e,n,i,o){let s=n[0]?.replace(/['"]/g,"")||"main",c=nt();if(s!=="main")c=c.replace("container:'main'",`container:'${s}'`);return`<script data-stx-router>${c}</script>`}var Re={name:"stxRouter",handler:ut,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var pt={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Oe(e){let n=e.heatmap;if(!n?.enabled)return"";let i={...pt,...n};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
@@ -619,7 +619,7 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function bc(e,n){let i=Oe(n);if(!i)return e;let o=e.lastIndexOf("</body>");if(o!==-1)return e.slice(0,o)+i+e.slice(o);return e+i}var Ee={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,n,i,o)=>{let s=i.__stx_config||{};if(n.length>0){let c=mt(n.join(" "));s.heatmap={...s.heatmap,...c,enabled:!0}}return Oe(s)}};function mt(e){let n={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let o of i){let[s,c]=o.split("="),d=c?.replace(/["']/g,"");switch(s){case"endpoint":n.endpoint=d;break;case"samplingRate":n.samplingRate=Number.parseInt(d,10);break;case"batchSize":n.batchSize=Number.parseInt(d,10);break;case"trackMouse":n.trackMouse=d==="true";break;case"trackClicks":n.trackClicks=d==="true";break;case"trackScroll":n.trackScroll=d==="true";break;case"honorDnt":n.honorDnt=d==="true";break;case"debugOverlay":n.debugOverlay=d==="true";break}}return n}function J(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ie(e){let n=e.trim().toLowerCase();return!n.startsWith("javascript:")&&!n.startsWith("vbscript:")&&!n.startsWith("data:text/html")}function gr(e){let n=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(n);if(!i)return{data:{},content:e.trim()};let o=i[1],s=e.slice(i[0].length),c={};for(let d of o.split(`
622
+ `}function wc(e,n){let i=Oe(n);if(!i)return e;let o=e.lastIndexOf("</body>");if(o!==-1)return e.slice(0,o)+i+e.slice(o);return e+i}var Ee={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,n,i,o)=>{let s=i.__stx_config||{};if(n.length>0){let c=mt(n.join(" "));s.heatmap={...s.heatmap,...c,enabled:!0}}return Oe(s)}};function mt(e){let n={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let o of i){let[s,c]=o.split("="),d=c?.replace(/["']/g,"");switch(s){case"endpoint":n.endpoint=d;break;case"samplingRate":n.samplingRate=Number.parseInt(d,10);break;case"batchSize":n.batchSize=Number.parseInt(d,10);break;case"trackMouse":n.trackMouse=d==="true";break;case"trackClicks":n.trackClicks=d==="true";break;case"trackScroll":n.trackScroll=d==="true";break;case"honorDnt":n.honorDnt=d==="true";break;case"debugOverlay":n.debugOverlay=d==="true";break}}return n}function J(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ie(e){let n=e.trim().toLowerCase();return!n.startsWith("javascript:")&&!n.startsWith("vbscript:")&&!n.startsWith("data:text/html")}function mr(e){let n=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(n);if(!i)return{data:{},content:e.trim()};let o=i[1],s=e.slice(i[0].length),c={};for(let d of o.split(`
623
623
  `)){let p=d.trim();if(!p||p.startsWith("#"))continue;let u=p.indexOf(":");if(u===-1)continue;let m=p.slice(0,u).trim(),y=p.slice(u+1).trim();if(typeof y==="string"){if(y.startsWith('"')&&y.endsWith('"')||y.startsWith("'")&&y.endsWith("'"))y=y.slice(1,-1);else if(y.startsWith("[")&&y.endsWith("]"))try{y=JSON.parse(y)}catch{}else if(y==="true")y=!0;else if(y==="false")y=!1;else if(/^-?\d+(?:\.\d+)?$/.test(y))y=Number(y)}c[m]=y}return{data:c,content:s.trim()}}function et(e,n={}){let{gfm:i=!0,breaks:o=!1}=n,s=e,c=[];if(s=s.replace(/```(\w*)\n([\s\S]*?)```/g,(y,f,v)=>{let b=c.length,w=f?` class="language-${J(f)}"`:"";return c.push(`<pre><code${w}>${J(v.trim())}</code></pre>`),`\x00CODEBLOCK${b}\x00`}),s=s.replace(/`([^`]*)`/g,(y,f)=>`<code>${J(f)}</code>`),s=s.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),s=s.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),s=s.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),s=s.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),s=s.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),s=s.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),s=s.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),s=s.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),s=s.replace(/__(.+?)__/g,"<strong>$1</strong>"),s=s.replace(/\*(.+?)\*/g,"<em>$1</em>"),s=s.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),i)s=s.replace(/~~(.+?)~~/g,"<del>$1</del>");if(s=s.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(y,f,v)=>`<img src="${Ie(v)?J(v):""}" alt="${J(f)}" />`),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(y,f,v)=>`<a href="${Ie(v)?J(v):""}">${f}</a>`),s=s.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),s=s.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),s=s.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),s=s.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),s=s.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),s=s.replace(/<\/ul>\n<ul>/g,""),s=s.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),s=s.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),s=s.replace(/<\/ol>\n<ol>/g,""),s=s.replace(/<li data-ul>/g,"<li>"),s=s.replace(/<li data-ol>/g,"<li>"),i)s=s.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(y,f,v)=>{let w=`<tr>${f.split("|").map((C)=>C.trim()).filter(Boolean).map((C)=>`<th>${J(C)}</th>`).join("")}</tr>`,k=v.trim().split(`
625
625
  `).map((C)=>`<tr>${C.split("|").map((P)=>P.trim()).filter(Boolean).map((P)=>`<td>${J(P)}</td>`).join("")}</tr>`).join(`
@@ -637,7 +637,7 @@ ${k}
637
637
  `:`
638
638
  `)}</p>`);if(s=p.join(`
639
639
  `),o)s=s.replace(/\n/g,`<br />
640
- `);for(let y=0;y<c.length;y++)s=s.replace(`\x00CODEBLOCK${y}\x00`,c[y]);return s=s.replace(/<p>\s*<\/p>/g,""),s.trim()}async function wc(e,n,i=""){let o=e,s=[],c=/@markdown(?:\([^)]*\))?/g,d;while((d=c.exec(e))!==null){let p=d.index,u=d[0].match(/@markdown\(([^)]*)\)/),m=u?u[1]:"",y=p+d[0].length,f=1,v=y,b=-1;while(f>0&&v<e.length){let C=e.indexOf("@markdown",v),A=e.indexOf("@endmarkdown",v);if(A===-1)break;if(C!==-1&&C<A&&C!==p){let P=e[C+9];if(P==="("||P===`
640
+ `);for(let y=0;y<c.length;y++)s=s.replace(`\x00CODEBLOCK${y}\x00`,c[y]);return s=s.replace(/<p>\s*<\/p>/g,""),s.trim()}async function vc(e,n,i=""){let o=e,s=[],c=/@markdown(?:\([^)]*\))?/g,d;while((d=c.exec(e))!==null){let p=d.index,u=d[0].match(/@markdown\(([^)]*)\)/),m=u?u[1]:"",y=p+d[0].length,f=1,v=y,b=-1;while(f>0&&v<e.length){let C=e.indexOf("@markdown",v),A=e.indexOf("@endmarkdown",v);if(A===-1)break;if(C!==-1&&C<A&&C!==p){let P=e[C+9];if(P==="("||P===`
641
641
  `||P==="\r"||P===" "||P===void 0)f++;v=C+9}else{if(f--,f===0){b=A;break}v=A+12}}if(b===-1)continue;let w=e.slice(y,b),k=e.slice(p,b+12);s.push({fullMatch:k,options:m,content:w,index:p}),c.lastIndex=b+12}for(let{fullMatch:p,options:u,content:m,index:y}of s)try{let f={};if(u)u.split(",").forEach((w)=>{let k=w.trim();if(k)f[k]=!0});let v={gfm:f.gfm??!0,breaks:f.breaks??!1},b=et(m.trim(),v);o=o.split(p).join(b)}catch(f){let v=f instanceof Error?f.message:String(f),b=h("Markdown Directive",`Error processing markdown: ${v}`,i,e,y,p);o=o.split(p).join(b)}return o}async function Te(e,n,i,o){let s={gfm:!0,breaks:!1};return n.forEach((c)=>{let d=c.trim().replace(/['"]/g,"");if(d==="breaks")s.breaks=!0;if(d==="no-gfm")s.gfm=!1}),et(e.trim(),s)}var Z=[320,480,640,768,1024,1280,1536,1920,2560],gt=[1,1.5,2,3],te=["avif","webp","jpeg"],ft={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function me(e,n=Z,i={},o){return n.sort((s,c)=>s-c).map((s)=>`${re(e,{...i,w:s,fm:o})} ${s}w`).join(", ")}function Me(e,n,i=gt,o={},s){return i.sort((c,d)=>c-d).map((c)=>{let d=Math.round(n*c);return`${re(e,{...o,w:d,dpr:c,fm:s})} ${c}x`}).join(", ")}function ge(e,n="100vw"){if(!e||Object.keys(e).length===0)return n;let o=Object.entries(e).map(([s,c])=>{let d=/^\d+$/.test(s)?`${s}px`:s;return{bp:d,size:c,numericBp:Number.parseInt(d)||0}}).sort((s,c)=>s.numericBp-c.numericBp).map(({bp:s,size:c})=>`(max-width: ${s}) ${c}`);return o.push(n),o.join(", ")}function re(e,n={}){let i=Object.entries(n).filter(([,c])=>c!==void 0&&c!==null).map(([c,d])=>{if(Array.isArray(d))return[c,d.join(",")];return[c,String(d)]});if(i.length===0)return e;let o=i.map(([c,d])=>`${c}=${encodeURIComponent(d)}`).join("&"),s=e.includes("?")?"&":"?";return`${e}${s}${o}`}function fe(e){return ft[e]||"application/octet-stream"}var ht={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},ye=`
642
642
  .stx-img-placeholder {
643
643
  position: relative;
@@ -684,7 +684,7 @@ ${k}
684
684
  #${e}.stx-img-loaded img {
685
685
  opacity: 1;
686
686
  }
687
- `.trim()}var he=new Map;async function Ne(e,n={}){let i=`${e}:${JSON.stringify(n)}`;if(he.has(i))return he.get(i);let o=await vt(e,n);return he.set(i,o),o}async function wt(){try{return await import("./chunk-r1mvd96m.js")}catch(e){if(!Ve)console.warn("[stx-media] Image processor not available, some features disabled:",e),Ve=!0;return null}}var Ve=!1,ve=80,le="async",ce="lazy",ze=!1;async function oe(e,n={}){let i=n,o=e;if(o.process&&!o.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Pt(o,i)}if(i.processedResult?.processed)return we(e,i.processedResult,n);if(i.responsiveVariants)return Fe(e,i.responsiveVariants,n);let{src:s,alt:c,width:d,height:p,sizes:u,widths:m=Z,dpr:y,formats:f=te,quality:v=ve,params:b={},placeholder:w="none",placeholderOptions:k={},lazy:C=!0,priority:A=!1,loading:P=A?"eager":ce,decoding:E=le,fetchpriority:I,objectFit:D,objectPosition:S,crossorigin:x,referrerpolicy:T}=e,{class:V,style:M,id:z}=e,_=e.data||{},{isDev:L=!1,baseUrl:G=""}=n;if(L&&!n.optimize)return Dt(e);let W,R,H=z||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(w!=="none"&&!A)try{W=await Ne(s,{strategy:w,...k}),R=je(H,W,k)}catch{}let ie=y!==void 0&&d!==void 0,X;if(ie)X=Ct(e,H,W,n);else X=await $t(e,H,W,n);let ee;if(A){let De=f.includes("webp")?"webp":f[0],rt=me(s,m,{...b,q:v},De),st=typeof u==="object"?ge(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${rt}" imagesizes="${st}" />`}let ae=[];if(!ze&&w!=="none")ae.push(ye),ze=!0;if(R)ae.push(R);let tt=C?We(H):void 0;return{html:X,preloadLink:ee,css:ae.length>0?ae.join(`
687
+ `.trim()}var he=new Map;async function Ne(e,n={}){let i=`${e}:${JSON.stringify(n)}`;if(he.has(i))return he.get(i);let o=await vt(e,n);return he.set(i,o),o}async function wt(){try{return await import("./chunk-1pf4y2yr.js")}catch(e){if(!Ve)console.warn("[stx-media] Image processor not available, some features disabled:",e),Ve=!0;return null}}var Ve=!1,ve=80,le="async",ce="lazy",ze=!1;async function oe(e,n={}){let i=n,o=e;if(o.process&&!o.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Pt(o,i)}if(i.processedResult?.processed)return we(e,i.processedResult,n);if(i.responsiveVariants)return Fe(e,i.responsiveVariants,n);let{src:s,alt:c,width:d,height:p,sizes:u,widths:m=Z,dpr:y,formats:f=te,quality:v=ve,params:b={},placeholder:w="none",placeholderOptions:k={},lazy:C=!0,priority:A=!1,loading:P=A?"eager":ce,decoding:E=le,fetchpriority:I,objectFit:D,objectPosition:S,crossorigin:x,referrerpolicy:T}=e,{class:V,style:M,id:z}=e,_=e.data||{},{isDev:L=!1,baseUrl:G=""}=n;if(L&&!n.optimize)return Dt(e);let W,R,H=z||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(w!=="none"&&!A)try{W=await Ne(s,{strategy:w,...k}),R=je(H,W,k)}catch{}let ie=y!==void 0&&d!==void 0,X;if(ie)X=Ct(e,H,W,n);else X=await $t(e,H,W,n);let ee;if(A){let De=f.includes("webp")?"webp":f[0],rt=me(s,m,{...b,q:v},De),st=typeof u==="object"?ge(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${rt}" imagesizes="${st}" />`}let ae=[];if(!ze&&w!=="none")ae.push(ye),ze=!0;if(R)ae.push(R);let tt=C?We(H):void 0;return{html:X,preloadLink:ee,css:ae.length>0?ae.join(`
688
688
  `):void 0,script:tt}}async function $t(e,n,i,o){let{src:s,alt:c,width:d,height:p,sizes:u,widths:m=Z,formats:y=te,quality:f=ve,params:v={},lazy:b=!0,priority:w=!1,loading:k=w?"eager":ce,decoding:C=le,fetchpriority:A,objectFit:P,objectPosition:E,crossorigin:I,referrerpolicy:D}=e,{class:S,style:x}=e,T=e.data||{},V=typeof u==="object"?ge(u):u||"100vw",M=[];for(let L of y){let G=me(s,m,{...v,q:f},L),W=fe(L);if(b&&!w)M.push(` <source type="${W}" data-srcset="${G}" data-sizes="${V}" />`);else M.push(` <source type="${W}" srcset="${G}" sizes="${V}" />`)}let z=be({src:re(s,{...v,q:f}),alt:c,width:d,height:p,loading:w?void 0:k,decoding:C,fetchpriority:w?"high":A,objectFit:P,objectPosition:E,crossorigin:I,referrerpolicy:D,className:Le(S,i),style:xe(x,P,E,i),lazy:b&&!w,data:T}),_;if(i){let L=`background-image: url('${i.dataURL}'); background-size: cover; background-position: center;`;_=`<div id="${n}" class="stx-img-placeholder" style="${L}">
689
689
  <picture>
690
690
  ${M.join(`
@@ -748,7 +748,7 @@ ${D.join(`
748
748
  `):void 0,script:G}}async function Fe(e,n,i){let o={src:n.src,processed:!0,variants:[],placeholder:n.placeholder?.dataURL,originalWidth:n.placeholder?.width,originalHeight:n.placeholder?.height};for(let[s,c]of Object.entries(n.byFormat))if(c)o.variants.push(...c);return we(e,o,i)}function kt(){return St({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,n,i,o)=>{let{src:s,alt:c,options:d}=At(e,n,i);if(!s)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let p={src:s,alt:c||"",widths:d.widths||Z,formats:d.formats||te,quality:d.quality,sizes:d.sizes,dpr:d.dpr,params:d.params,placeholder:d.placeholder,placeholderOptions:d.placeholderOptions,lazy:d.lazy!==!1,priority:d.priority||!1,loading:d.loading,decoding:d.decoding,fetchpriority:d.fetchpriority,objectFit:d.objectFit,objectPosition:d.objectPosition,class:d.class,style:d.style,id:d.id,width:d.width,height:d.height},u=i.__isDev||!1,m=await oe(p,{isDev:u}),y=m.html;if(m.preloadLink)y=m.preloadLink+`
749
749
  `+y;if(m.css)y+=`
750
750
  <style>${m.css}</style>`;if(m.script)y+=`
751
- <script>${m.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function At(e,n,i){if(n.src)return{src:String(n.src),alt:String(n.alt||""),options:n.options||{}};let o=e.trim();if(o.startsWith("@img(")||o.startsWith("("))o=o.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=_t(o),c=$e(s[0],i)||"",d=$e(s[1],i)||"",p={};if(s[2]){let u=$e(s[2],i);if(typeof u==="object"&&u!==null)p=u;else if(typeof s[2]==="string")try{p=JSON.parse(s[2])}catch{}}return{src:c,alt:d,options:p}}function _t(e){let n=[],i="",o=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function $e(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var qe=kt();import{existsSync as Rt}from"fs";import ne from"path";function ks(){let e=[ne.join(import.meta.dir,"primitives"),ne.join(import.meta.dir,"..","primitives"),ne.join(import.meta.dir,"native","primitives"),ne.join(import.meta.dir,"..","native","primitives")];for(let n of e)if(Rt(ne.join(n,"View.stx")))return n;return e[0]}async function Ue(){try{return await import("./chunk-ctq1qy1g.js")}catch(e){if(!He)console.warn("[stx-media] Video processor not available, some features disabled:",e),He=!0;return null}}var He=!1,Be=!0,Je="metadata",Ot="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function de(e,n={}){let i=n,o=e;if(o.process&&!o.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return jt(o,i)}if(i.processedResult?.processed)return Ge(e,i.processedResult,n);let s;if(o.generatePoster&&o.src&&!e.poster)s=await Nt(o,i);let{src:c,sources:d=[],poster:p,posterPlaceholder:u,controls:m=Be,autoplay:y=!1,muted:f=!1,loop:v=!1,preload:b=Je,playsinline:w=!0,lazy:k=!0,player:C="native",type:A,width:P,height:E,crossorigin:I,disablePictureInPicture:D=!1,disableRemotePlayback:S=!1}=e,x=s||p,{class:T,style:V}=e,M=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(C==="ts-video")return It(e,n);if(A&&A!=="video")return Et(c||"",A,e);let z=d.length>0?d:c?[{src:c,type:Ke(c)}]:[],_=[`id="${M}"`];if(m)_.push("controls");if(y)_.push("autoplay");if(f)_.push("muted");if(v)_.push("loop");if(w)_.push("playsinline");if(D)_.push("disablepictureinpicture");if(S)_.push("disableremoteplayback");if(I)_.push(`crossorigin="${I}"`);if(k){if(_.push(`data-preload="${b}"`),_.push('preload="none"'),x)_.push(`data-poster="${j(x)}"`);_.push("data-stx-lazy")}else if(_.push(`preload="${b}"`),x)_.push(`poster="${j(x)}"`);if(P)_.push(`width="${P}"`);if(E)_.push(`height="${E}"`);if(T)_.push(`class="${j(T)}"`);if(V)_.push(`style="${j(V)}"`);let L=z.map((R)=>` <source ${k?`data-src="${j(R.src)}"`:`src="${j(R.src)}"`} type="${R.type}"${R.media?` media="${R.media}"`:""} />`).join(`
751
+ <script>${m.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function At(e,n,i){if(n.src)return{src:String(n.src),alt:String(n.alt||""),options:n.options||{}};let o=e.trim();if(o.startsWith("@img(")||o.startsWith("("))o=o.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=_t(o),c=$e(s[0],i)||"",d=$e(s[1],i)||"",p={};if(s[2]){let u=$e(s[2],i);if(typeof u==="object"&&u!==null)p=u;else if(typeof s[2]==="string")try{p=JSON.parse(s[2])}catch{}}return{src:c,alt:d,options:p}}function _t(e){let n=[],i="",o=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function $e(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var qe=kt();import{existsSync as Rt}from"fs";import ne from"path";function _s(){let e=[ne.join(import.meta.dir,"primitives"),ne.join(import.meta.dir,"..","primitives"),ne.join(import.meta.dir,"native","primitives"),ne.join(import.meta.dir,"..","native","primitives")];for(let n of e)if(Rt(ne.join(n,"View.stx")))return n;return e[0]}async function Ue(){try{return await import("./chunk-q18508s2.js")}catch(e){if(!He)console.warn("[stx-media] Video processor not available, some features disabled:",e),He=!0;return null}}var He=!1,Be=!0,Je="metadata",Ot="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function de(e,n={}){let i=n,o=e;if(o.process&&!o.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return jt(o,i)}if(i.processedResult?.processed)return Ge(e,i.processedResult,n);let s;if(o.generatePoster&&o.src&&!e.poster)s=await Nt(o,i);let{src:c,sources:d=[],poster:p,posterPlaceholder:u,controls:m=Be,autoplay:y=!1,muted:f=!1,loop:v=!1,preload:b=Je,playsinline:w=!0,lazy:k=!0,player:C="native",type:A,width:P,height:E,crossorigin:I,disablePictureInPicture:D=!1,disableRemotePlayback:S=!1}=e,x=s||p,{class:T,style:V}=e,M=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(C==="ts-video")return It(e,n);if(A&&A!=="video")return Et(c||"",A,e);let z=d.length>0?d:c?[{src:c,type:Ke(c)}]:[],_=[`id="${M}"`];if(m)_.push("controls");if(y)_.push("autoplay");if(f)_.push("muted");if(v)_.push("loop");if(w)_.push("playsinline");if(D)_.push("disablepictureinpicture");if(S)_.push("disableremoteplayback");if(I)_.push(`crossorigin="${I}"`);if(k){if(_.push(`data-preload="${b}"`),_.push('preload="none"'),x)_.push(`data-poster="${j(x)}"`);_.push("data-stx-lazy")}else if(_.push(`preload="${b}"`),x)_.push(`poster="${j(x)}"`);if(P)_.push(`width="${P}"`);if(E)_.push(`height="${E}"`);if(T)_.push(`class="${j(T)}"`);if(V)_.push(`style="${j(V)}"`);let L=z.map((R)=>` <source ${k?`data-src="${j(R.src)}"`:`src="${j(R.src)}"`} type="${R.type}"${R.media?` media="${R.media}"`:""} />`).join(`
752
752
  `),G=`<video ${_.join(" ")}>
753
753
  ${L}
754
754
  Your browser does not support the video tag.
@@ -1007,7 +1007,7 @@ ${z}
1007
1007
  }
1008
1008
  `.trim();return{html:z,script:_,css:L}}function Ye(){return St({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,n,i,o)=>{let{src:s,options:c}=Vt(e,n,i);if(!s)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let d={src:s,poster:c.poster,controls:c.controls!==!1,autoplay:c.autoplay||!1,muted:c.muted||!1,loop:c.loop||!1,preload:c.preload||"metadata",playsinline:c.playsinline!==!1,lazy:c.lazy!==!1,player:c.player||"native",type:c.type,width:c.width,height:c.height,class:c.class,style:c.style,id:c.id,crossorigin:c.crossorigin,disablePictureInPicture:c.disablePictureInPicture,disableRemotePlayback:c.disableRemotePlayback,title:c.title,quality:c.quality,platform:c.platform,process:c.process,generatePoster:c.generatePoster,streaming:c.streaming,transcode:c.transcode,spriteSheet:c.spriteSheet,waveform:c.waveform},u={isDev:i.__isDev||!1,tsVideosConfig:i.__tsVideosConfig},m=await de(d,u),y=m.html;if(m.css)y+=`
1009
1009
  <style>${m.css}</style>`;if(m.script)y+=`
1010
- <script>${m.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vt(e,n,i){if(n.src)return{src:String(n.src),options:n.options||{}};let o=e.trim();if(o.startsWith("@video(")||o.startsWith("("))o=o.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=zt(o),c=Xe(s[0],i)||"",d={};if(s[1]){let p=Xe(s[1],i);if(typeof p==="object"&&p!==null)d=p;else if(typeof s[1]==="string")try{d=JSON.parse(s[1])}catch{}}return{src:c,options:d}}function zt(e){let n=[],i="",o=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function Xe(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Se=Ye();import Lt from"fs";import q from"path";async function _s(e,n){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],o=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let s of i)try{let c=await Wt(s,e,n);if(c)o.push(c)}catch(c){if(console.error(`Error building web component ${s.name}:`,c),e.debug)throw c}}return o}async function Wt(e,n,i){let{name:o,file:s,tag:c,extends:d}=e;if(!o||!s||!c)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(s)&&await r(s))p=s;else if(n.componentsDir){let k=q.join(n.componentsDir,s);if(await r(k))p=k}if(!p)p=await vn(s,process.cwd(),n,i);if(!p)return console.error(`Web component source file not found: ${s}`),null;let u=await Bun.file(p).text();i.add(p);let y=(e.outputFormat||"js")==="ts",f=y?qt({name:o,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Ft({name:o,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=n.webComponents?.outputDir||"dist/web-components";await Lt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",w=q.join(v,`${c}.${b}`);if(await Bun.write(w,f),n.debug)console.log(`Built web component ${o} -> ${w}`);return w}function Ft(e){let{name:n,tag:i,baseElement:o="HTMLElement",source:s,shadowDOM:c,template:d,styleSource:p,attributes:u=[]}=e,m=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!c)m=m.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),m=m.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),m=m.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),m=m.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
1010
+ <script>${m.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vt(e,n,i){if(n.src)return{src:String(n.src),options:n.options||{}};let o=e.trim();if(o.startsWith("@video(")||o.startsWith("("))o=o.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=zt(o),c=Xe(s[0],i)||"",d={};if(s[1]){let p=Xe(s[1],i);if(typeof p==="object"&&p!==null)d=p;else if(typeof s[1]==="string")try{d=JSON.parse(s[1])}catch{}}return{src:c,options:d}}function zt(e){let n=[],i="",o=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function Xe(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Se=Ye();import Lt from"fs";import q from"path";async function Cs(e,n){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],o=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let s of i)try{let c=await Wt(s,e,n);if(c)o.push(c)}catch(c){if(console.error(`Error building web component ${s.name}:`,c),e.debug)throw c}}return o}async function Wt(e,n,i){let{name:o,file:s,tag:c,extends:d}=e;if(!o||!s||!c)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(s)&&await r(s))p=s;else if(n.componentsDir){let k=q.join(n.componentsDir,s);if(await r(k))p=k}if(!p)p=await xn(s,process.cwd(),n,i);if(!p)return console.error(`Web component source file not found: ${s}`),null;let u=await Bun.file(p).text();i.add(p);let y=(e.outputFormat||"js")==="ts",f=y?qt({name:o,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Ft({name:o,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=n.webComponents?.outputDir||"dist/web-components";await Lt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",w=q.join(v,`${c}.${b}`);if(await Bun.write(w,f),n.debug)console.log(`Built web component ${o} -> ${w}`);return w}function Ft(e){let{name:n,tag:i,baseElement:o="HTMLElement",source:s,shadowDOM:c,template:d,styleSource:p,attributes:u=[]}=e,m=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!c)m=m.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),m=m.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),m=m.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),m=m.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
1011
1011
  * ${n} Web Component
1012
1012
  * Auto-generated from stx component
1013
1013
  */
@@ -1307,6 +1307,6 @@ ${y}
1307
1307
  customElements.define('${n}', ${d});
1308
1308
  `}async function Ze(e,n,i,o){if(n.length<1)return l("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let s=n[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${s}.stx`),q.join(q.dirname(o),`${s}.stx`)]:[q.join(q.dirname(o),d,`${s}.stx`),q.join(process.cwd(),d,`${s}.stx`),q.join(q.dirname(o),`${s}.stx`)],u=null;for(let f of p)if(await r(f)){u=await Bun.file(f).text();break}if(!u)return l("WebComponent",`Component file not found: ${s}.stx`,t.FILE_NOT_FOUND);let m=Ht(u,s);return`<script type="module">
1309
1309
  ${Ut(m)}
1310
- </script>`}var F={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:dn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},kc,_c,Ts,$s,Pe,Ae,_e,ke,Re,Ee,qe,Se,...so],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,n,i){let o=n||"pages";if(e)return{root:e,pagesDir:o};let s=i||process.cwd(),c=N.join(s,"resources","views"),d=N.join(s,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var Qe=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,n){let i=n.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),s=i.replace(/\\/g,"/");return o===s||o.startsWith(`${s}/`)}function qf(e,n){let i=!e.root,o=Jt(e.root,e.pagesDir,n);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let s=`${n}::${o.root}`;if(!Qe.has(s))Qe.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let s={};for(let c of pe){let d=e[c];if(typeof d==="string"&&d)s[c]=d}Ce.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let c of pe){let d=e[c];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Kt(d,s))continue;e[c]=N.join(s,d)}}for(let s of pe){let c=e[s];if(typeof c!=="string"||!c||N.isAbsolute(c))continue;e[s]=N.resolve(n,c)}return e}function Gt(e,n){let i=Ce.get(e);for(let o of pe){let s=e[o];if(typeof s!=="string"||!s)continue;let c=N.isAbsolute(s)?s:N.join(n,s);if(Q.existsSync(c))continue;let d=i?.[o]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(Ic(e.stateDir),e.stateDir=br(),e.cachePath=wr(e.cachePath),e.build)e.build.cacheDir=wr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=wr(e.media.cache.directory);if(e.story)e.story.outDir=wr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function Qo(e,n=Bt){try{return await n(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let n=e?N.resolve(e):process.cwd(),i=ue.get(n);if(i&&i.signature!==Cs(i.graph)){let c=Y.get(n);if(Y.delete(n),ue.delete(n),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-13sp1247.js"),{partialsCache:p}=await import("./chunk-fx04tq90.js");if(d(),p.clear(),c&&i.configSignature===Es(i.graph)){let u=c.then(async(m)=>{let y={...i.graph};await ti(y,n),ue.set(n,{graph:y,signature:Cs(y),configSignature:Es(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(n,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(n);if(o)return o;let s=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(N.join(n,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(N.join(n,"config",`ui${v}`))),u;if(d&&p){let v=await Qo({name:"ui",cwd:N.join(n,"config"),defaultConfig:F,errorPolicy:"throw",verbose:!1});u=(await Qo({name:"stx",alias:"ui",cwd:n,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Qo({name:"stx",alias:"ui",cwd:n,defaultConfig:F,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await Ec(n,F);u=v.config,ue.set(n,{graph:v.graph,signature:Cs(v.graph),configSignature:Es(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-cyghcps7.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-40x0vwza.js");await b(n,u.runtimeConfig)}Yt(u),Xt(u),qf(u,n),Gt(u,n);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[n]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-mp42d9v5.js"),b=[],w=[],k=new Set(u.componentPackages??["@stacksjs/components"]),C=[];for(let A of f){let P=typeof A==="string"?A:A[0],E=typeof A==="string"?{}:A[1]||{};try{let I,D;try{let x=g.resolve(P,{paths:[n]});I=await import(x),D=N.dirname(x)}catch{let x=N.resolve(n,P);I=await import(x),D=N.dirname(x)}let S=I.default||I;if(!v.has(S.name))await v.register(S,u);if(S.components){let x=Array.isArray(S.components)?S.components:[S.components],T=k.has(S.name)||k.has(P)||k.has(P.replace(/\/stx-plugin$/,""));for(let V of x){let M=N.resolve(D,V);if(b.push(M),T)w.push(M)}}if(S.pages){let x=N.resolve(D,S.pages),T=E.path||"/";C.push({dir:x,prefix:T})}if(S.setup){let x={addDirective:(T)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(T)},addRoute:(T,V)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[T]=V},addMiddleware:(T)=>{u.middleware=u.middleware||[],u.middleware.push(T)},pluginDir:D,config:u};await S.setup(E,x)}process.stderr.write(`[stx] Plugin loaded: ${S.name||P}
1311
- `)}catch(I){console.warn(`[stx] Failed to load plugin ${P}:`,I.message)}}u._pluginComponentDirs=b,u._componentPackageDirs=w,u._pluginPageDirs=C}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:ks(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return u})();if(Y.set(n,s),s.catch(()=>{if(Y.get(n)===s)Y.delete(n)}),!e)se=s,s.then((c)=>{K=c}).catch(()=>{});return s}var O=new Proxy(F,{get(e,n){if(K&&n in K)return K[n];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[n]}});function Xh(e){return e}function Gh(e){let n=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")n.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")n.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")n.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")n.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)n.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)n.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))n.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))n.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)n.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)n.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))n.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))n.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))n.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))n.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))n.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))n.push({path:`middleware[${s}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)n.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))n.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))n.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,c)=>{if(!s.pattern||typeof s.pattern!=="string")n.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(s.strategy))n.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))n.push({path:`pwa.routes[${c}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(s.maxEntries!==void 0&&(typeof s.maxEntries!=="number"||s.maxEntries<1))n.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((s)=>typeof s!=="number"||s<16||s>1024).length>0)n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!o.includes(c)).length>0)n.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:n.length===0,errors:n,warnings:i}}
1312
- export{yc,bc,gr,et,wc,ks,_s,F,qf,Qo,a,O,Xh,Gh};
1310
+ </script>`}var F={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:pn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},_c,Cc,$s,Rs,Pe,Ae,_e,ke,Re,Ee,qe,Se,...oo],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,n,i){let o=n||"pages";if(e)return{root:e,pagesDir:o};let s=i||process.cwd(),c=N.join(s,"resources","views"),d=N.join(s,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var Qe=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,n){let i=n.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),s=i.replace(/\\/g,"/");return o===s||o.startsWith(`${s}/`)}function Kf(e,n){let i=!e.root,o=Jt(e.root,e.pagesDir,n);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let s=`${n}::${o.root}`;if(!Qe.has(s))Qe.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let s={};for(let c of pe){let d=e[c];if(typeof d==="string"&&d)s[c]=d}Ce.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let c of pe){let d=e[c];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Kt(d,s))continue;e[c]=N.join(s,d)}}for(let s of pe){let c=e[s];if(typeof c!=="string"||!c||N.isAbsolute(c))continue;e[s]=N.resolve(n,c)}return e}function Gt(e,n){let i=Ce.get(e);for(let o of pe){let s=e[o];if(typeof s!=="string"||!s)continue;let c=N.isAbsolute(s)?s:N.join(n,s);if(Q.existsSync(c))continue;let d=i?.[o]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(Oc(e.stateDir),e.stateDir=wr(),e.cachePath=vr(e.cachePath),e.build)e.build.cacheDir=vr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=vr(e.media.cache.directory);if(e.story)e.story.outDir=vr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function ei(e,n=Bt){try{return await n(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let n=e?N.resolve(e):process.cwd(),i=ue.get(n);if(i&&i.signature!==Es(i.graph)){let c=Y.get(n);if(Y.delete(n),ue.delete(n),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-x2wn6mpd.js"),{partialsCache:p}=await import("./chunk-te1wksa0.js");if(d(),p.clear(),c&&i.configSignature===Ts(i.graph)){let u=c.then(async(m)=>{let y={...i.graph};await ni(y,n),ue.set(n,{graph:y,signature:Es(y),configSignature:Ts(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(n,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(n);if(o)return o;let s=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(N.join(n,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(N.join(n,"config",`ui${v}`))),u;if(d&&p){let v=await ei({name:"ui",cwd:N.join(n,"config"),defaultConfig:F,errorPolicy:"throw",verbose:!1});u=(await ei({name:"stx",alias:"ui",cwd:n,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await ei({name:"stx",alias:"ui",cwd:n,defaultConfig:F,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await Tc(n,F);u=v.config,ue.set(n,{graph:v.graph,signature:Es(v.graph),configSignature:Ts(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-9c6yvh3p.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-84gg2atb.js");await b(n,u.runtimeConfig)}Yt(u),Xt(u),Kf(u,n),Gt(u,n);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[n]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-c0azgkss.js"),b=[],w=[],k=new Set(u.componentPackages??["@stacksjs/components"]),C=[];for(let A of f){let P=typeof A==="string"?A:A[0],E=typeof A==="string"?{}:A[1]||{};try{let I,D;try{let x=g.resolve(P,{paths:[n]});I=await import(x),D=N.dirname(x)}catch{let x=N.resolve(n,P);I=await import(x),D=N.dirname(x)}let S=I.default||I;if(!v.has(S.name))await v.register(S,u);if(S.components){let x=Array.isArray(S.components)?S.components:[S.components],T=k.has(S.name)||k.has(P)||k.has(P.replace(/\/stx-plugin$/,""));for(let V of x){let M=N.resolve(D,V);if(b.push(M),T)w.push(M)}}if(S.pages){let x=N.resolve(D,S.pages),T=E.path||"/";C.push({dir:x,prefix:T})}if(S.setup){let x={addDirective:(T)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(T)},addRoute:(T,V)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[T]=V},addMiddleware:(T)=>{u.middleware=u.middleware||[],u.middleware.push(T)},pluginDir:D,config:u};await S.setup(E,x)}process.stderr.write(`[stx] Plugin loaded: ${S.name||P}
1311
+ `)}catch(I){console.warn(`[stx] Failed to load plugin ${P}:`,I.message)}}u._pluginComponentDirs=b,u._componentPackageDirs=w,u._pluginPageDirs=C}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:_s(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return u})();if(Y.set(n,s),s.catch(()=>{if(Y.get(n)===s)Y.delete(n)}),!e)se=s,s.then((c)=>{K=c}).catch(()=>{});return s}var O=new Proxy(F,{get(e,n){if(K&&n in K)return K[n];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[n]}});function Gh(e){return e}function Jh(e){let n=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")n.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")n.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")n.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")n.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)n.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)n.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))n.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))n.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)n.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)n.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))n.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))n.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))n.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))n.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))n.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))n.push({path:`middleware[${s}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)n.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))n.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))n.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,c)=>{if(!s.pattern||typeof s.pattern!=="string")n.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(s.strategy))n.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))n.push({path:`pwa.routes[${c}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(s.maxEntries!==void 0&&(typeof s.maxEntries!=="number"||s.maxEntries<1))n.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((s)=>typeof s!=="number"||s<16||s>1024).length>0)n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!o.includes(c)).length>0)n.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:n.length===0,errors:n,warnings:i}}
1312
+ export{bc,wc,mr,et,vc,_s,Cs,F,Kf,ei,a,O,Gh,Jh};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{q,De}from"./chunk-evww725k.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function en(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=De(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
- export{en};
2
+ import{q,De}from"./chunk-ynnd6nnt.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function tn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=De(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
+ export{tn};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{bl,wl}from"./chunk-z26fg4p0.js";import{f,P,ot,d}from"./chunk-t3e95q80.js";import{U,vr,Ms,Ls,li,ui,js,fn,De,fe,J,kr,_r,ie,Y,N,st,Cr,fi,$r,ze,r,p,W,Sn}from"./chunk-evww725k.js";import{n}from"./chunk-mgtp037k.js";import{oe}from"./chunk-84myqca7.js";import{cr}from"./chunk-j1n2xb48.js";import{s}from"./chunk-m8cpabd2.js";import{g}from"./chunk-0dve54ne.js";import{createHash as St}from"crypto";import Q from"fs";import Z from"path";import je from"fs";function Ce(e,i,t){let o=Buffer.alloc(t),a=je.readSync(e,o,0,t,i);return o.subarray(0,a)}function Me(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Le(e){let i;try{i=je.openSync(e,"r");let t=Ce(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(Me(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)je.closeSync(i)}}import Jt from"fs";import Fe from"os";import{fileURLToPath as pt}from"url";var Ae=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var ke=0,ht=[];async function Qt(){if(ke<Yt()){ke++;return}await new Promise((e)=>ht.push(e)),ke++}function en(){ke--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&Jt.existsSync(pt(t)))return pt(t)}catch{}return cr(tn,e)}var mt=!1;function ue(e){if(!mt)mt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ae}function Re(e){return e instanceof Error?e.message:String(e)}async function Ue(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Re(a)}`)}if(typeof t!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=nn();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(y){a(ue(`could not start ${o}: ${Re(y)}`));return}let u=!1,m=!1,v=(y)=>{if(m)return;m=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Re(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Re(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var rn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),sn=[320,640,960,1280,1920],ye="/_stx/images",on=`stx:${ye}:alpha-1`,an=`stx:${ye}:opaque-1`,cn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function ln(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function yt(){if(Pe!==void 0)return Pe;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=cn.map((i)=>{let t;try{t=e?ln(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function un(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function dn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=St("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function xt(e,i=`stx:${ye}`){let t=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Q.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function Ct(e,i=e){let t=await Q.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await Ct(e,c));continue}if(!a.isFile()||!rn.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function wt(e,i){return e.map((t)=>({key:un(t.relativePath),input:t.absolutePath,name:dn(t.relativePath),...gn(t.absolutePath)?{options:{storage:i}}:{}}))}function gn(e){return Le(e)==="possible"}function pn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function mn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let m=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await Q.promises.readFile(m?.path??u.fallback.path)));if(pn(v.data))t.add(l)}catch{t.add(l)}}));return t}function hn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let m;try{return m=Q.openSync(u.path,"r"),!Me(Ce(m,0,32))}catch{return!0}finally{if(m!==void 0)Q.closeSync(m)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function yn(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function We(e){return Z.join(e,"undecodable.json")}function bn(e){try{let i=Q.readFileSync(We(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function vn(e,i){try{Q.mkdirSync(Z.dirname(We(e)),{recursive:!0}),Q.writeFileSync(We(e),JSON.stringify(i))}catch{}}function $t(e){try{let i=Q.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Rt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Fo(e){let i=Rt(e);return i?be().catalog.get(i):void 0}function zo(e){let i=Rt(e);return i?be().transparent.has(i):!1}function Ho(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Lh(e){let i=Fo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:Ho(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:zo(e)?void 0:i.placeholder?.dataUrl}}function ps(){let e=be();e.catalog=new Map,e.transparent=new Set}function xn(e){let i=be();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function jh(e,i,t={}){if(!e||!Q.existsSync(e))return ps(),{count:0,fingerprint:""};if(t.offThread){let b=await Ue("delivery",{publicDir:e,outputDir:i});if(b!==Ae)return xn(b.state),b.result}let o=await Ct(e);if(o.length===0)return ps(),{count:0,fingerprint:""};let a=bn(i),c=o.filter((b)=>{let w=a[b.relativePath];if(!w)return!0;let A=$t(b.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return ps(),{count:0,fingerprint:""};let l=xt(Z.join(i,"_stx","images"),`${on}:${yt()}`),u={outDir:Z.join(i,"_stx","images"),storage:xt(Z.join(i,"_stx","images"),`${an}:${yt()}`),baseUrl:ye,widths:sn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:m}=await import("ts-images/delivery"),v=c,y;try{y=await m({...u,entries:wt(c,l)})}catch(b){if(v=await yn(c),v.length===c.length)throw b;let w=new Set(v.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=$t(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)vn(i,a);if(v.length===0)return ps(),{count:0,fingerprint:""};y=await m({...u,entries:wt(v,l)})}let h=await mn(y.entries),C=hn(y.entries,h),x=be();x.catalog=new Map(Object.entries(y.entries)),x.transparent=h;let S=h.size===0&&C.length===0?y.fingerprint:St("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:S}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=li(e,o);if(a!==void 0)return a;for(let c of ui(e,i,t,o))if(await r(c))return c;return null}}var de=new kt;var re="\x00stx-boolean-attribute";function He(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var wn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function qe(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||wn.has(i)}function se(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(p(c));continue}if(a===re){t.push(p(c));continue}t.push(`${p(c)}="${Sn(c,He(String(a)))}"`)}return t}function ae(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(p(c));continue}if(typeof a==="object")continue;t.push(`${p(c)}="${Sn(c,He(String(a)))}"`)}return t}function $n(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Xe={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=$n(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,m=[];if(o.reactive)m.push(`:href="${n(o.value)}"`);else m.push(`href="${n(kr(o.value,"navigable"))}"`);if(a)m.push(`class="${n(a)}"`);if(m.push("data-stx-link"),m.push(`data-stx-active-class="${n(c)}"`),m.push(`data-stx-exact-active-class="${n(l)}"`),u)m.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)m.push(`data-stx-active-match="${n(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return m.push(...se(e,y)),m.push(...ae(e,y)),`<a ${m.join(" ")}>${i}</a>`}};var Cn=new Map;function Ve(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Cn.get(i)}var Rn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function V(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ie(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Ge(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Rn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ke(e,i,t,o){return i.map((a)=>`${ve(e,a,void 0,t,o)} ${a}w`).join(", ")}function kn(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${ve(e,l,void 0,o,a)} ${c}x`}).join(", ")}function ve(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function An(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Pn(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Je={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=V(e,"src")||"",a=Fo(o),c=V(e,"alt")||"",l=V(e,"width")||(a?String(a.source.width):void 0),u=V(e,"height")||(a?String(a.source.height):void 0),m=V(e,"sizes"),v=V(e,"srcset"),y=V(e,"densities"),h=V(e,"format"),C=zo(o)||Ve(o)?.transparent===!0,x=V(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=V(e,"placeholderColor")||"#e5e7eb",b=V(e,"provider"),w=V(e,"class")||V(e,"className")||"",A=V(e,"style")||"",k=V(e,"objectFit")||V(e,"fit"),R=V(e,"objectPosition")||V(e,"position"),T=V(e,"quality"),G=Ie(e,"lazy",!0),M=Ie(e,"preload",!1),F=Ie(e,"priority",!1),H=V(e,"loading"),E=V(e,"decoding")||"async",O=!!a||Ie(e,"picture",!1)||!!h,B=l?Number.parseInt(l):void 0,q=u?Number.parseInt(u):void 0,L=v||"",X="";if(a)L=a.sources[a.fallback.format]||"",X=m?Ge(m):"100vw";else if(!L&&m&&b&&b!=="local"&&b!=="static")L=Ke(o,Ze,b,h),X=Ge(m);else if(!L&&y){let I=y.split(/\s+/).map((_)=>Number.parseFloat(_.replace("x","")));L=kn(o,I,B,b,h)}else if(m)X=Ge(m);let z=[];if(A)z.push(A);if(k)z.push(`object-fit:${k}`);if(R)z.push(`object-position:${R}`);if(B&&q)z.push(`aspect-ratio:${B}/${q}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let I=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ve(o);if(I&&x==="color")z.push(`background-color:${I.color}`),D.push("backgroundColor");else if(I)z.push(`background-color:${I.color}`),z.push(`background-image:url(${I.dataUrl})`),z.push("background-size:cover"),z.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let _=Pn(B||16,q||9,S);z.push(`background-image:url(${_})`),z.push("background-size:cover"),z.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")z.push(`background-image:url(${n(x)})`),z.push("background-size:cover"),z.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||ve(o,B,q,b,h),K=[];if(K.push(`src="${n(kr($e,"fetched"))}"`),K.push(`alt="${n(c)}"`),l)K.push(`width="${n(l)}"`);if(u)K.push(`height="${n(u)}"`);let le=H||(F||M?"eager":G?"lazy":"");if(le)K.push(`loading="${n(le)}"`);if(F)K.push('fetchpriority="high"');if(K.push(`decoding="${n(E)}"`),w)K.push(`class="${n(w)}"`);if(z.length>0)K.push(`style="${n(z.join(";"))}"`);if(L)K.push(`srcset="${n(kr(L,"fetched"))}"`);if(X)K.push(`sizes="${n(X)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let I=typeof e.static.onload==="string"?e.static.onload:"",_=An(D)+(I?`;${I}`:"");K.push(`onload="${n(_)}"`),te.add("onload")}K.push(...se(e,te)),K.push(...ae(e,te));let Te=`<img ${K.join(" ")} />`,j="";if(M){let _=h==="webp"?"image/webp":h==="avif"?"image/avif":"";j=`<link rel="preload" as="image" href="${n($e)}"${_?` type="${_}"`:""}${L?` imagesrcset="${n(L)}"`:""}${X?` imagesizes="${n(X)}"`:""} />
3
- `}if(O){let I=[];if(a)for(let _ of Ho(a))I.push(`<source type="image/${_.format}" srcset="${n(_.srcset)}"${X?` sizes="${n(X)}"`:""} />`);if(!a&&(h==="avif"||h==="auto")){let _=ve(o,B,q,b,"avif"),ee=L?Ke(o,Ze,b,"avif"):`${_}`;I.push(`<source type="image/avif" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}if(!a&&(h==="webp"||h==="auto")){let _=ve(o,B,q,b,"webp"),ee=L?Ke(o,Ze,b,"webp"):`${_}`;I.push(`<source type="image/webp" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}return`${j}<picture>
2
+ import{wl,vl}from"./chunk-0wms5teg.js";import{f,P,ot,d}from"./chunk-eg2p1cyw.js";import{U,xr,Ls,js,ui,di,Bs,gn,De,fe,J,_r,Cr,ie,Y,N,st,Er,gi,Rr,ze,r,p,W,kn}from"./chunk-ynnd6nnt.js";import{n}from"./chunk-xa2qfe51.js";import{oe}from"./chunk-cww1zk8y.js";import{lr}from"./chunk-14cvwsy1.js";import{s}from"./chunk-jm0qsr3s.js";import{g}from"./chunk-0dve54ne.js";import{createHash as St}from"crypto";import Q from"fs";import Z from"path";import je from"fs";function Ce(e,i,t){let o=Buffer.alloc(t),a=je.readSync(e,o,0,t,i);return o.subarray(0,a)}function Me(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Le(e){let i;try{i=je.openSync(e,"r");let t=Ce(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(Me(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)je.closeSync(i)}}import Jt from"fs";import Fe from"os";import{fileURLToPath as pt}from"url";var Ae=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var ke=0,ht=[];async function Qt(){if(ke<Yt()){ke++;return}await new Promise((e)=>ht.push(e)),ke++}function en(){ke--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&Jt.existsSync(pt(t)))return pt(t)}catch{}return lr(tn,e)}var mt=!1;function ue(e){if(!mt)mt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ae}function Re(e){return e instanceof Error?e.message:String(e)}async function Ue(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Re(a)}`)}if(typeof t!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=nn();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(y){a(ue(`could not start ${o}: ${Re(y)}`));return}let u=!1,m=!1,v=(y)=>{if(m)return;m=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Re(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Re(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var rn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),sn=[320,640,960,1280,1920],ye="/_stx/images",on=`stx:${ye}:alpha-1`,an=`stx:${ye}:opaque-1`,cn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function ln(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function yt(){if(Pe!==void 0)return Pe;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=cn.map((i)=>{let t;try{t=e?ln(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function un(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function fn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=St("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function xt(e,i=`stx:${ye}`){let t=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Q.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function Ct(e,i=e){let t=await Q.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await Ct(e,c));continue}if(!a.isFile()||!rn.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function wt(e,i){return e.map((t)=>({key:un(t.relativePath),input:t.absolutePath,name:fn(t.relativePath),...dn(t.absolutePath)?{options:{storage:i}}:{}}))}function dn(e){return Le(e)==="possible"}function pn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function mn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let m=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await Q.promises.readFile(m?.path??u.fallback.path)));if(pn(v.data))t.add(l)}catch{t.add(l)}}));return t}function hn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let m;try{return m=Q.openSync(u.path,"r"),!Me(Ce(m,0,32))}catch{return!0}finally{if(m!==void 0)Q.closeSync(m)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function yn(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function We(e){return Z.join(e,"undecodable.json")}function bn(e){try{let i=Q.readFileSync(We(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function vn(e,i){try{Q.mkdirSync(Z.dirname(We(e)),{recursive:!0}),Q.writeFileSync(We(e),JSON.stringify(i))}catch{}}function $t(e){try{let i=Q.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Rt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function zo(e){let i=Rt(e);return i?be().catalog.get(i):void 0}function Ho(e){let i=Rt(e);return i?be().transparent.has(i):!1}function Vo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function jh(e){let i=zo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:Vo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Ho(e)?void 0:i.placeholder?.dataUrl}}function gs(){let e=be();e.catalog=new Map,e.transparent=new Set}function xn(e){let i=be();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Bh(e,i,t={}){if(!e||!Q.existsSync(e))return gs(),{count:0,fingerprint:""};if(t.offThread){let b=await Ue("delivery",{publicDir:e,outputDir:i});if(b!==Ae)return xn(b.state),b.result}let o=await Ct(e);if(o.length===0)return gs(),{count:0,fingerprint:""};let a=bn(i),c=o.filter((b)=>{let w=a[b.relativePath];if(!w)return!0;let A=$t(b.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return gs(),{count:0,fingerprint:""};let l=xt(Z.join(i,"_stx","images"),`${on}:${yt()}`),u={outDir:Z.join(i,"_stx","images"),storage:xt(Z.join(i,"_stx","images"),`${an}:${yt()}`),baseUrl:ye,widths:sn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:m}=await import("ts-images/delivery"),v=c,y;try{y=await m({...u,entries:wt(c,l)})}catch(b){if(v=await yn(c),v.length===c.length)throw b;let w=new Set(v.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=$t(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)vn(i,a);if(v.length===0)return gs(),{count:0,fingerprint:""};y=await m({...u,entries:wt(v,l)})}let h=await mn(y.entries),C=hn(y.entries,h),x=be();x.catalog=new Map(Object.entries(y.entries)),x.transparent=h;let S=h.size===0&&C.length===0?y.fingerprint:St("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:S}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=ui(e,o);if(a!==void 0)return a;for(let c of di(e,i,t,o))if(await r(c))return c;return null}}var de=new kt;var re="\x00stx-boolean-attribute";function He(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var wn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function qe(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||wn.has(i)}function se(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(p(c));continue}if(a===re){t.push(p(c));continue}t.push(`${p(c)}="${kn(c,He(String(a)))}"`)}return t}function ae(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(p(c));continue}if(typeof a==="object")continue;t.push(`${p(c)}="${kn(c,He(String(a)))}"`)}return t}function $n(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Xe={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=$n(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,m=[];if(o.reactive)m.push(`:href="${n(o.value)}"`);else m.push(`href="${n(_r(o.value,"navigable"))}"`);if(a)m.push(`class="${n(a)}"`);if(m.push("data-stx-link"),m.push(`data-stx-active-class="${n(c)}"`),m.push(`data-stx-exact-active-class="${n(l)}"`),u)m.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)m.push(`data-stx-active-match="${n(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return m.push(...se(e,y)),m.push(...ae(e,y)),`<a ${m.join(" ")}>${i}</a>`}};var Sn=new Map;function Ve(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Sn.get(i)}var Cn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function V(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ie(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Ge(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Cn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ke(e,i,t,o){return i.map((a)=>`${ve(e,a,void 0,t,o)} ${a}w`).join(", ")}function Rn(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${ve(e,l,void 0,o,a)} ${c}x`}).join(", ")}function ve(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function An(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Pn(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Je={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=V(e,"src")||"",a=zo(o),c=V(e,"alt")||"",l=V(e,"width")||(a?String(a.source.width):void 0),u=V(e,"height")||(a?String(a.source.height):void 0),m=V(e,"sizes"),v=V(e,"srcset"),y=V(e,"densities"),h=V(e,"format"),C=Ho(o)||Ve(o)?.transparent===!0,x=V(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=V(e,"placeholderColor")||"#e5e7eb",b=V(e,"provider"),w=V(e,"class")||V(e,"className")||"",A=V(e,"style")||"",k=V(e,"objectFit")||V(e,"fit"),R=V(e,"objectPosition")||V(e,"position"),T=V(e,"quality"),G=Ie(e,"lazy",!0),M=Ie(e,"preload",!1),F=Ie(e,"priority",!1),H=V(e,"loading"),E=V(e,"decoding")||"async",O=!!a||Ie(e,"picture",!1)||!!h,B=l?Number.parseInt(l):void 0,q=u?Number.parseInt(u):void 0,L=v||"",X="";if(a)L=a.sources[a.fallback.format]||"",X=m?Ge(m):"100vw";else if(!L&&m&&b&&b!=="local"&&b!=="static")L=Ke(o,Ze,b,h),X=Ge(m);else if(!L&&y){let I=y.split(/\s+/).map((_)=>Number.parseFloat(_.replace("x","")));L=Rn(o,I,B,b,h)}else if(m)X=Ge(m);let z=[];if(A)z.push(A);if(k)z.push(`object-fit:${k}`);if(R)z.push(`object-position:${R}`);if(B&&q)z.push(`aspect-ratio:${B}/${q}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let I=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ve(o);if(I&&x==="color")z.push(`background-color:${I.color}`),D.push("backgroundColor");else if(I)z.push(`background-color:${I.color}`),z.push(`background-image:url(${I.dataUrl})`),z.push("background-size:cover"),z.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let _=Pn(B||16,q||9,S);z.push(`background-image:url(${_})`),z.push("background-size:cover"),z.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")z.push(`background-image:url(${n(x)})`),z.push("background-size:cover"),z.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||ve(o,B,q,b,h),K=[];if(K.push(`src="${n(_r($e,"fetched"))}"`),K.push(`alt="${n(c)}"`),l)K.push(`width="${n(l)}"`);if(u)K.push(`height="${n(u)}"`);let le=H||(F||M?"eager":G?"lazy":"");if(le)K.push(`loading="${n(le)}"`);if(F)K.push('fetchpriority="high"');if(K.push(`decoding="${n(E)}"`),w)K.push(`class="${n(w)}"`);if(z.length>0)K.push(`style="${n(z.join(";"))}"`);if(L)K.push(`srcset="${n(_r(L,"fetched"))}"`);if(X)K.push(`sizes="${n(X)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let I=typeof e.static.onload==="string"?e.static.onload:"",_=An(D)+(I?`;${I}`:"");K.push(`onload="${n(_)}"`),te.add("onload")}K.push(...se(e,te)),K.push(...ae(e,te));let Te=`<img ${K.join(" ")} />`,j="";if(M){let _=h==="webp"?"image/webp":h==="avif"?"image/avif":"";j=`<link rel="preload" as="image" href="${n($e)}"${_?` type="${_}"`:""}${L?` imagesrcset="${n(L)}"`:""}${X?` imagesizes="${n(X)}"`:""} />
3
+ `}if(O){let I=[];if(a)for(let _ of Vo(a))I.push(`<source type="image/${_.format}" srcset="${n(_.srcset)}"${X?` sizes="${n(X)}"`:""} />`);if(!a&&(h==="avif"||h==="auto")){let _=ve(o,B,q,b,"avif"),ee=L?Ke(o,Ze,b,"avif"):`${_}`;I.push(`<source type="image/avif" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}if(!a&&(h==="webp"||h==="auto")){let _=ve(o,B,q,b,"webp"),ee=L?Ke(o,Ze,b,"webp"):`${_}`;I.push(`<source type="image/webp" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}return`${j}<picture>
4
4
  ${I.join(`
5
5
  `)}
6
6
  ${Te}
@@ -38,5 +38,5 @@ ${Te}
38
38
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
39
39
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
40
40
  </style>`}};import{existsSync as En,readFileSync as Nn}from"fs";var Ne=new Map,Nt=new Set;function On(e){if(Nt.has(e))return;Nt.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Bn(e){let i=process.cwd();for(let t of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(En(t))return t;for(let t of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return g.resolve(t)}catch{}return null}function Tn(e){if(Ne.has(e))return Ne.get(e);let i=Bn(e);if(!i)return On(e),null;try{let t=JSON.parse(Nn(i,"utf8"));return Ne.set(e,t),t}catch{return null}}function Dn(e,i,t,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${t/2} ${o/2})`);if(i.hFlip)a.push(`translate(${t} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function jn(e,i){let t=i,o=e.icons[t],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let m=e.aliases?.[t];if(!m)return null;if(m.hFlip)a.hFlip=!a.hFlip;if(m.vFlip)a.vFlip=!a.vFlip;if(m.rotate)a.rotate=((a.rotate+m.rotate)%4+4)%4;t=m.parent,o=e.icons[t]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Dn(o.body,a,c,l),width:c,height:l}}function me(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var it={name:"Icon",aliases:["icon","stx-icon"],render(e,i,t){let o=me(e,"name")??me(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let w=o.split(":");a=w[0],c=w[1]}let l=n(me(e,"size")||"24"),u=n(me(e,"color")||"currentColor"),m=n(me(e,"class")||""),v=n(me(e,"style")||""),y=Ne.get(a)??Tn(a);if(!y)return`<!-- Icon: collection "${a}" not loaded -->`;let h=jn(y,c);if(!h)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${h.width} ${h.height}`,x=h.body;if(u!=="currentColor")x=x.replace(/currentColor/g,u);let S=m?` class="${m}"`:"",b=v?` style="${v}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${S}${b}>${x}</svg>`}};function Ot(e,...i){for(let t of i){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let o=e.static[t];if(typeof o==="string")return o}return}function Bt(e,i){let t=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${i}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(t);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var at={name:"Suspense",aliases:["suspense"],render(e,i,t){let o=Bt(i,"fallback"),a=o.rest,c=Bt(a,"error"),l=c.rest,u=o.region??Ot(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',m=c.region??Ot(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${m}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function Oe(e,...i){for(let t of i){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let o=e.static[t];if(typeof o==="string")return o}return}var ct={name:"TransitionGroup",aliases:["transition-group"],render(e,i,t){let o=(Oe(e,"name")||"v").replace(/["'<>]/g,""),a=(Oe(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=Oe(e,"class"),l=Oe(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Tt(e=de){e.registerBuiltin(Xe),e.registerBuiltin(Je),e.registerBuiltin(Ye),e.registerBuiltin(et),e.registerBuiltin(tt),e.registerBuiltin(nt),e.registerBuiltin(rt),e.registerBuiltin(it),e.registerBuiltin(at),e.registerBuiltin(ct)}var Dt=new Map;function Mn(e){let i=Dt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),Dt.set(e.source,i);return i}var jt=new WeakMap;function Mt(e){let i=jt.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),jt.set(e,i);let t=i;return(o)=>!/[a-z]/.test(o)&&t.has(o.toLowerCase())}function Ln(e,i){let t="";for(let o=i;o<e.length;o++){let a=e[o];if(t){if(a==="\\")o++;else if(a===t)t=""}else if(a==='"'||a==="'")t=a;else if(a===">")return o}return e.length}function Lt(e,i,t){let o=[],a=0,c=typeof t==="function"?t:t?(l)=>t.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=Mn(i);u.lastIndex=l+1;let m=u.exec(e);if(!m){a=l+1;continue}let v=m[1];if(c&&c(v)){let w=l+1+v.length;while(w<e.length&&e[w]!==">")w++;a=w+1;continue}let y=l+1+v.length,h=null,C=y,x=-1,S=!1;while(y<e.length){let w=e[y];if(h){if(w==="\\"&&y+1<e.length){y+=2;continue}if(w===h)h=null;y++;continue}if(w==='"'||w==="'"){h=w,y++;continue}if(w==="/"&&y+1<e.length&&e[y+1]===">"){x=y+2,S=!0;break}if(w===">"){x=y+1;break}y++}if(x===-1){a=l+1;continue}let b=e.slice(C,S?x-2:x-1).trim();if(S)o.push({fullMatch:e.slice(l,x),tagName:v,attributes:b,content:"",startIndex:l,endIndex:x,isSelfClosing:!0}),a=x;else{let w=`<${v}`,A=`</${v}>`,k=1,R=x,T=-1;while(k>0&&R<e.length){let F=e.indexOf(w,R),H=e.indexOf(A,R);if(H===-1)break;if(F!==-1&&F<H){let E=e[F+w.length];if(E===" "||E===">"||E==="/"||E===`
41
- `||E==="\t"){let O=Ln(e,F+w.length);if(e[O-1]!=="/")k++;R=O+1}else R=F+w.length}else{if(k--,k===0){T=H;break}R=H+A.length}}if(T===-1){a=x;continue}let G=e.slice(x,T),M=T+A.length;o.push({fullMatch:e.slice(l,M),tagName:v,attributes:b,content:G,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function lt(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function zt(e,i){try{let t=Buffer.from(e,"base64").toString("utf8");return JSON.parse(t)}catch{}try{let t=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(t)}catch(t){if(i?.debug)console.error("Error decoding __stx_ prop:",t);return e}}function Be(e,i){let t=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")t++;else if(c==="}"){if(t--,t===0)return e.slice(i,a+1)}a++}return e.slice(i)}function Ft(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Be(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Ut(e){let i=[],t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o&&e[t]!==l){if(e[t]==="\\"&&t+1<o)t++,c+=e[t];else c+=e[t];t++}if(t<o)t++}else if(e[t]==="{")c=Be(e,t),t+=c.length;else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Fn=new Set([":for","x-for","v-for","@for"]),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wn(e){return ut(e).map((i)=>[i.start,i.end])}function ut(e){let i=[],t=new Map;for(let o of fn(e)){let a=o.name.toLowerCase();if(o.closing){let v=t.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Ut(o.attributes).find((v)=>Fn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,m=u!==null?{start:o.start,end:o.end,names:Y(u),tag:a}:null;if(m)i.push(m);if(!o.selfClosing&&!Un.has(a)){let v=t.get(a);if(!v)v=[],t.set(a,v);v.push(m)}}return i}function Wt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Wt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function pc(e,i){if(!/:[\w-]+=/.test(e))return e;let t=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Wn(e));let l=new Set([...st(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(h){return a.some(([C,x])=>h>=C&&h<x)}let m=[],v=new Map,y=256;for(let h of fn(t)){if(h.closing||u(h.start))continue;let C=h.attributes.trimEnd();if(!C||!C.includes(":"))continue;let x=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),S=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,b,w=C,A=!1;while((b=S.exec(C))!==null){if(_r(C,b.index,!0)?.kind==="attribute")continue;let k=b[1],R=b[2];if(bl(k))continue;if(N(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let T=Object.keys(i),G=Object.values(i),M=R.match(/^([a-zA-Z_$][\w$]*)/);if(M&&!T.includes(M[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(M[1]))continue;let F=JSON.stringify([T,R]),H=v.get(F);if(!H){if(H=Function(...T,`return (${R})`),v.size>=y)v.clear();v.set(F,H)}let E=H(...G);if(k==="class"){let O=W(Wt(E));if(O){let B=w.match(/\sclass="([^"]*)"/);if(B)w=w.replace(B[0],()=>` class="${B[1]} ${O}"`);else w=w.replace(b[0],()=>` class="${O}"`)}else w=w.replace(b[0],"");A=!0;continue}if(zn.has(k)){if(E)w=w.replace(b[0],` ${k}`);else w=w.replace(b[0],"");A=!0;continue}if(E===null||E===void 0||E===!1)w=w.replace(b[0],"");else{let O=x&&typeof E==="object"?JSON.stringify(E):String(E),B=Sn(k,O);w=w.replace(b[0],()=>` ${k}="${B}"`)}A=!0}catch(T){if(T instanceof ie)throw T;continue}}if(A){let k=h.selfClosing?" /":"",T=`<${h.name}${w}${k}>`;m.push({start:h.start,end:h.end,replacement:T})}}if(m.length>0){let h=Array(m.length*2+1),C=0;for(let x=0;x<m.length;x++){let{start:S,end:b,replacement:w}=m[x];h[x*2]=t.slice(C,S),h[x*2+1]=w,C=b}h[m.length*2]=t.slice(C),t=h.join("")}return t}import Ht from"fs";import qt from"path";var Xt=!1;function Hn(e,i,t,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(h)=>{if(l.size===0)return!1;let C=s(h),x=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&l.has(x))return!0;for(let S of l){let b=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${b}\\s*\\(`).test(C))return!0}return!1},m=new Set(wl),v=(h)=>{if(!h.includes("-")||h.startsWith("@")||h.startsWith(":")||h.startsWith("x-")||h.startsWith("__"))return h;if(h.startsWith("aria-")||h.startsWith("data-"))return h;return h.replace(/-([a-z0-9])/g,(C,x)=>x.toUpperCase())},y=(h,C)=>{let x=v(h);if(c.static[x]=C,x!==h)c.staticNames[x]=h};for(let[h,C]of Object.entries(e)){let x=h.startsWith("x-")&&!m.has(h)&&!h.startsWith("x-bind:")&&!h.startsWith("x-on:")?`:${h.slice(2)}`:h;if(x.startsWith("@")){c.events[x]=C;continue}if(x.startsWith("__stx_")){let S=v(x.slice(6));c.serverDynamic[S]=zt(C,t);continue}if(x.startsWith(":")){let S=v(x.slice(1)),b=C===re?S:C;if(S==="if"||S==="for"||S==="show"){c.clientReactive[S]=b;continue}if(o){c.clientReactive[S]=b;continue}if(N(b,a)){c.clientReactive[S]=b;continue}if(u(b)){c.clientReactive[S]=b;continue}try{if(!f(b)){if(t.debug)console.error(`Unsafe expression in :${S} binding: ${b}`);c.clientReactive[S]=b;continue}let w=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(ot(b).some((M)=>!A.has(M)&&!w.includes(M)&&(!(M in globalThis)||k.has(M)))){c.clientReactive[S]=b;continue}let G=d(b,w)(...Object.values(i));if(c.serverDynamic[S]=G,S!==x.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[S]=x.slice(1)}catch{c.clientReactive[S]=b}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let S=Xn(C,a);if(S!==null){c.clientReactive[v(x)]=S;continue}let b=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(b)try{let w=b[1];if(f(w)){let k=d(w,Object.keys(i))(...Object.values(i));y(x,k!=null?String(k):"")}else{if(t.debug)console.error(`Unsafe expression in ${x}: ${w}`);y(x,C)}}catch(w){if(t.debug)console.error(`Error evaluating expression for ${x}:`,w);y(x,C)}else{let w=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=A.exec(C))!==null)try{let R=k[1];if(!f(R)){if(t.debug)console.error(`Unsafe expression in ${x}: ${R}`);continue}let G=d(R,Object.keys(i))(...Object.values(i));w=w.replace(k[0],String(G??""))}catch(R){if(t.debug)console.error(`Error evaluating expression in ${x}:`,R)}y(x,w)}continue}y(x,C===re?"true":lt(C))}return c}var ft=new Set;function Bh(){ft.clear()}function qn(e,i){let t=`${i}\x00${e}`;if(ft.has(t))return;ft.add(t),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Xn(e,i){if(i.size===0)return null;let t=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(t)];if(!o.some((u)=>N(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(m)=>`\\${m}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var Vn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Zn(e,i,t){if(!e.includes("@"))return e;if(!Vn.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return oe(e,i,t)}catch{return e}}function he(e){let i={},t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o){let u=e[t];if(u==="\\"&&t+1<o){t++,c+=e[t],t++;continue}if(u===l){t++;break}c+=u,t++}}else if(e[t]==="{"){c=Be(e,t),t+=c.length;let l=Ft(c);if(l!==null){i[`:${a}`]=l;continue}}else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i[a]=c}else i[a]=re}return i}function Vt(e){return Object.entries(e).map(([i,t])=>t===re?i:`${i}="${Gn(t)}"`).join(" ")}function Gn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kn(e){let i=new Set,t=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=t.exec(e))!==null){let a=o[1];if(de.isBuiltin(a))i.add(a)}return[...i].sort()}async function jf(e,i,t,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=qt.dirname(t),u=[],m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let h of e.matchAll(m)){let[C,x,S]=h,b=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=S,A,k=[];while((A=b.exec(S))!==null){let[R,T,G,M]=A,F=null,H=null;if(M.startsWith(".")||M.startsWith("/")){let B=qt.resolve(l,M);if(B.endsWith(".stx"))H=B;else{let q=`${B}.stx`;try{if(Ht.statSync(q).isFile())H=q}catch{try{if(Ht.statSync(B).isDirectory())F=B}catch{}}}}else F=Ms(M,l);if(!F&&!H)continue;let E=!1,O=(B,q)=>{c.set(B,q),c.set(B.toLowerCase(),q);let L=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(L,q),a.add(q)};if(G&&H)O(G,H),E=!0;else if(T){let B=T.slice(1,-1).split(",").map((L)=>L.trim()).filter(Boolean).map((L)=>{let X=L.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X)return{source:X[1],local:X[2]};return{source:L,local:L}}),q=F?vr(F):null;for(let{source:L,local:X}of B){let z=null;if(H)z=H;else if(q)z=q.get(L)??q.get(L.toLowerCase())??q.get(L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(z)O(X,z),E=!0}}if(E)k.push({start:A.index,end:A.index+R.length})}if(k.length===0)continue;for(let R=k.length-1;R>=0;R--)w=w.slice(0,k[R].start)+w.slice(k[R].end);u.push({start:h.index,end:h.index+C.length,value:`<script${x}>${w}</script>`})}if(u.length===0)return e;let v=[],y=0;for(let h of u)v.push(e.slice(y,h.start),h.value),y=h.end;return v.push(e.slice(y)),v.join("")}async function Jn(e,i,t,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,m;while((m=u.exec(c))!==null){let[v,y]=m,h=y.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of h){let x=C.split("/"),b=x[x.length-1].replace(/\.stx$/,""),w=b.includes("-")?b.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):b.charAt(0).toUpperCase()+b.slice(1),A=null,k=Ls(C,t,o);for(let R of k)try{if(await Bun.file(R).exists()){A=R;break}}catch{}if(A){l.set(w,A),l.set(b,A),l.set(b.toLowerCase(),A);let R=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,A),a.add(A),o.debug)console.log(`Imported component: ${w} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function Yn(e,i,t,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,m=/@component\s*\(/g,v;while((v=m.exec(c))!==null){let y=v.index,h=y+v[0].length-1,C=1,x=h+1;while(x<c.length&&C>0){if(c[x]==="(")C++;else if(c[x]===")"){if(C--,C===0)break}x++}if(C!==0)break;let S=c.substring(h+1,x),b=x+1,w=S.match(/^\s*['"]([^'"]+)['"]/);if(!w){m.lastIndex=b;continue}let A=w[1],k,R=S.slice(w[0].length),T=R.match(/^\s*,\s*/);if(T)k=R.slice(T[0].length).trim();let G={};if(k)try{G=P(k,i)}catch(B){let q=B instanceof Error?B.message:String(B);c=c.replace(c.substring(y,b),`[Error parsing component props: ${q}]`);continue}let M="",F=b,E=c.substring(b).match(/^([\s\S]*?)@endcomponent/);if(E)M=E[1].trim(),F=b+E[0].length;let O=await ze(A,G,M,l,i,t,o,u,a);c=c.substring(0,y)+O+c.substring(F),m.lastIndex=0}return c}async function Qn(e,i,t,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,m=nr(c);if(m.size>0){let b=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...b,...m])]}let v=J(c);c=v.output;let y=st(i);return c=await S(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await S(c,/[A-Z][a-zA-Z0-9]*/,!0,Mt(Cr)),c=await S(c,/[a-z][a-z0-9]*/,!1,Cr),c=v.restore(c),c;async function S(b,w,A,k){if(!b)return b;let R=b,T=Lt(R,w,k),G=ut(R),M=new Map;for(let E=T.length-1;E>=0;E--){let O=T[E],B=A?U(O.tagName):O.tagName,q=he(Zn(O.attributes,i,t)),L=G.filter(({start:I,end:_})=>O.startIndex>=I&&O.startIndex<_);if(L.some((I)=>I.tag==="template"))qn(O.tagName,t);let X=L.length>0,z=new Set(y);for(let I of L)for(let _ of I.names)z.add(_);let D=Hn(q,i,o,X,z);if(typeof D.clientReactive.for==="string")for(let I of Y(D.clientReactive.for))z.add(I);let ce=de.getBuiltin(O.tagName),$e=ce?await $r(O.tagName,l,i,t,o):!1,K=O.tagName==="Image"&&js([...Object.keys(D.static),...Object.keys(D.serverDynamic),...Object.keys(D.clientReactive)],Object.keys(D.events),{...D.static,...D.serverDynamic})&&(o._pluginComponentDirs??[]).some((I)=>vr(I).has("Image"));if(ce&&!$e&&!K){let I={context:i,filePath:t,options:o,dependencies:a},_=ce.render(D,O.content,I);if(Object.keys(D.events).length>0){let ee=Vt(D.events);_=_.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ee}`)}if(Object.keys(D.clientReactive).length>0)_=Zt(_,D.clientReactive);M.set(E,_);continue}if(!A&&O.tagName.includes("-")&&!await $r(B,l,i,t,o))continue;let le={};for(let[I,_]of Object.entries(D.static))le[I]=_;for(let[I,_]of Object.entries(D.serverDynamic))le[I]=_;let te={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(D.clientReactive),events:Object.keys(D.events)},j=await ze(B,le,v.restore(O.content),l,i,t,o,u,a,[...z],te,O.tagName);if(j=er(j,D,te.declaredProps,te.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let I=te.reactiveProps.filter((ne)=>!te.consumedProps.has(ne)&&!["if","for","show","key","ref"].includes(ne)).map(U),_=dt(j,!0);if(I.length&&_){if(!Object.hasOwn(he(j.slice(_.insertPos,_.tagEnd)),"data-stx-native-host-root"))j=j.slice(0,_.insertPos)+' data-stx-native-host-root="true"'+j.slice(_.insertPos);let ne=we(j);j=j.slice(0,ne.insertPos)+` data-stx-native-forward="${I.join(" ")}"`+j.slice(ne.insertPos)}let ee=dt(j,!0);if(ee){let ne=he(j.slice(ee.insertPos,ee.tagEnd)),Se=we(j),Kt=he(j.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(ne,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))j=j.slice(0,Se.insertPos)+" data-stx-native-host-owner"+j.slice(Se.insertPos)}}if(Object.keys(D.events).length>0){let I=we(j);if(I){let _=Vt(D.events),ee=Object.keys(D.events).map((ne)=>ne.replace(/^@/,"").split(".")[0]).join(" ");j=j.substring(0,I.insertPos)+` data-stx-parent-events="${ee}" ${_}`+j.substring(I.insertPos)}}if(Object.keys(D.clientReactive).length>0)j=Zt(j,D.clientReactive);M.set(E,j)}if(M.size===0)return R;let F="",H=0;for(let E=0;E<T.length;E++){let O=M.get(E);if(O===void 0)continue;F+=R.slice(H,T[E].startIndex),F+=O,H=T[E].endIndex}return F+=R.slice(H),F}}function Zt(e,i){let t=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([y])=>!t.has(y)),c=a.filter(([y])=>!o.has(y)).map(([y])=>U(y)).join(" "),l=e,u=a.length>0?we(l):null;if(u){let y=a.map(([C,x])=>`:${U(C)}="${x.replace(/"/g,"&quot;")}"`).join(" "),h=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${h} ${y}`+l.substring(u.insertPos)}let m=i.if;if(m)l=`<template :if="${m.replace(/"/g,"&quot;")}">${l}</template>`;let v=i.for;if(v){let y=i.key,h=y?` :key="${y.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${v.replace(/"/g,"&quot;")}"${h}>${l}</template>`}return l}function er(e,i,t=new Set,o=new Set,a=!1){let c=dt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let S=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,b=S.test(l)?l.replace(S,(w,A,k,R,T)=>`${A}class="${n(`${lt(k??R??T)} ${u}`)}"`):` class="${n(u)}"${l}`;e=e.slice(0,c.insertPos)+b+e.slice(c.tagEnd),c.tagEnd+=b.length-l.length,l=b}let m=a||/\bdata-native(?:\s|=)/i.test(l),v=m?o:t,y=new Set(Object.keys(he(l))),h=new Set(["class","className"]);for(let S of Object.keys(i.static)){let b=i.staticNames[S]??S;if(y.has(b)||v.has(S)||!m&&!qe(b))h.add(S)}for(let S of Object.keys(i.serverDynamic)){let b=i.serverDynamicNames?.[S]??S;if(y.has(b)||v.has(S)||!m&&!qe(b))h.add(S)}let C=[];if(m){for(let[S,b]of Object.entries(i.static)){if(h.has(S)||b!==!0&&b!==re)continue;h.add(S),C.push(`${n(i.staticNames?.[S]??S)}="true"`)}for(let[S,b]of Object.entries(i.serverDynamic)){if(h.has(S)||b!==!0)continue;h.add(S),C.push(`${n(i.serverDynamicNames?.[S]??S)}="true"`)}}let x=[...se(i,h),...ae(i,h),...C];if(m){for(let[S,b]of Object.entries(i.serverDynamic)){if(h.has(S)||b!==!1)continue;let w=i.serverDynamicNames?.[S]??S;x.push(`${n(w)}="false"`)}for(let[S,b]of Object.entries(i.serverDynamic)){if(h.has(S)||b===null||typeof b!=="object")continue;let w=JSON.stringify(b);if(w!==void 0){let A=i.serverDynamicNames?.[S]??S;x.push(`${n(A)}="${n(w)}"`)}}}if(x.length===0)return e;return`${e.slice(0,c.insertPos)} ${x.join(" ")}${e.slice(c.insertPos)}`}function we(e){let i=Gt(e,0);if(i)return i;let t=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(t)return{insertPos:t.index+1+t[1].length,tagEnd:gt(e,t.index+1+t[1].length)};return null}function dt(e,i=!1){let t=we(e);if(!t)return null;let o=e.slice(t.insertPos,t.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?Gt(e,t.tagEnd+1):t;return a&&i?tr(e,a)??a:a}function tr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let t=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let y=e.indexOf("-->",o+4);if(y<0)return null;o=e.indexOf("<",y+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),m=o+l[0].length,v=gt(e,m);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let y=new RegExp(`</${u}\\s*>`,"gi");if(y.lastIndex=v+1,!y.exec(e))return null;o=e.indexOf("<",y.lastIndex);continue}else{let y=he(e.slice(m,v)),h=a>0&&(Object.hasOwn(y,"data-stx-component-wrapper")||Object.hasOwn(y,"data-stx-native-host-owner"));if(c===void 0&&!h&&Object.hasOwn(y,"data-stx-native-host-root"))return{insertPos:m,tagEnd:v};if(!t.has(u)&&e[v-1]!=="/"){if(a++,c===void 0&&h)c=a}else if(a===0)return null}o=e.indexOf("<",v+1)}return null}function Gt(e,i){let t=i;while(t<e.length){let o=e.slice(t),a=o.match(/^\s+/);if(a){t+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",t+4);if(u===-1)return null;t=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,m=e.toLowerCase().indexOf(u,t+c[0].length);if(m===-1)return null;t=m+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:t+1+l[1].length,tagEnd:gt(e,t+1+l[1].length)}}return null}function gt(e,i){let t="";for(let o=i;o<e.length;o++){let a=e[o];if(t){if(a==="\\")o++;else if(a===t)t=""}else if(a==='"'||a==="'")t=a;else if(a===">")return o}return e.length}function nr(e){let i=new Set;for(let t of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=t[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of fi(t[2]))i.add(a);for(let a of t[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function gs(e,i,t,o,a){if(!Xt)Tt(de),Xt=!0;let c=await jf(e,i,t,o,a);c=await Jn(c,i,t,o,a),c=await Yn(c,i,t,o,a);let l=[];for(let u=0;u<3;u++){let m=l.length,v=fe(c,De,(h,C)=>`\x00STX_COMPONENT_COMMENT_${m+C}\x00`,`STX_COMPONENT_COMMENT:${m}`);l.push(...v.tokens);let y=c;if(c=await Qn(v.output,i,t,o,a),c===y)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,m)=>l[Number(m)]??"");if(o.debug){let u=Kn(c);if(u.length>0)console.warn(`[stx] ${t}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
- export{Fo,zo,Ho,Lh,ps,jh,pc,Bh,jf,gs};
41
+ `||E==="\t"){let O=Ln(e,F+w.length);if(e[O-1]!=="/")k++;R=O+1}else R=F+w.length}else{if(k--,k===0){T=H;break}R=H+A.length}}if(T===-1){a=x;continue}let G=e.slice(x,T),M=T+A.length;o.push({fullMatch:e.slice(l,M),tagName:v,attributes:b,content:G,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function lt(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function zt(e,i){try{let t=Buffer.from(e,"base64").toString("utf8");return JSON.parse(t)}catch{}try{let t=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(t)}catch(t){if(i?.debug)console.error("Error decoding __stx_ prop:",t);return e}}function Be(e,i){let t=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")t++;else if(c==="}"){if(t--,t===0)return e.slice(i,a+1)}a++}return e.slice(i)}function Ft(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Be(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Ut(e){let i=[],t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o&&e[t]!==l){if(e[t]==="\\"&&t+1<o)t++,c+=e[t];else c+=e[t];t++}if(t<o)t++}else if(e[t]==="{")c=Be(e,t),t+=c.length;else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Fn=new Set([":for","x-for","v-for","@for"]),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wn(e){return ut(e).map((i)=>[i.start,i.end])}function ut(e){let i=[],t=new Map;for(let o of gn(e)){let a=o.name.toLowerCase();if(o.closing){let v=t.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Ut(o.attributes).find((v)=>Fn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,m=u!==null?{start:o.start,end:o.end,names:Y(u),tag:a}:null;if(m)i.push(m);if(!o.selfClosing&&!Un.has(a)){let v=t.get(a);if(!v)v=[],t.set(a,v);v.push(m)}}return i}function Wt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Wt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function fc(e,i){if(!/:[\w-]+=/.test(e))return e;let t=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Wn(e));let l=new Set([...st(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(h){return a.some(([C,x])=>h>=C&&h<x)}let m=[],v=new Map,y=256;for(let h of gn(t)){if(h.closing||u(h.start))continue;let C=h.attributes.trimEnd();if(!C||!C.includes(":"))continue;let x=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),S=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,b,w=C,A=!1;while((b=S.exec(C))!==null){if(Cr(C,b.index,!0)?.kind==="attribute")continue;let k=b[1],R=b[2];if(wl(k))continue;if(N(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let T=Object.keys(i),G=Object.values(i),M=R.match(/^([a-zA-Z_$][\w$]*)/);if(M&&!T.includes(M[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(M[1]))continue;let F=JSON.stringify([T,R]),H=v.get(F);if(!H){if(H=Function(...T,`return (${R})`),v.size>=y)v.clear();v.set(F,H)}let E=H(...G);if(k==="class"){let O=W(Wt(E));if(O){let B=w.match(/\sclass="([^"]*)"/);if(B)w=w.replace(B[0],()=>` class="${B[1]} ${O}"`);else w=w.replace(b[0],()=>` class="${O}"`)}else w=w.replace(b[0],"");A=!0;continue}if(zn.has(k)){if(E)w=w.replace(b[0],` ${k}`);else w=w.replace(b[0],"");A=!0;continue}if(E===null||E===void 0||E===!1)w=w.replace(b[0],"");else{let O=x&&typeof E==="object"?JSON.stringify(E):String(E),B=kn(k,O);w=w.replace(b[0],()=>` ${k}="${B}"`)}A=!0}catch(T){if(T instanceof ie)throw T;continue}}if(A){let k=h.selfClosing?" /":"",T=`<${h.name}${w}${k}>`;m.push({start:h.start,end:h.end,replacement:T})}}if(m.length>0){let h=Array(m.length*2+1),C=0;for(let x=0;x<m.length;x++){let{start:S,end:b,replacement:w}=m[x];h[x*2]=t.slice(C,S),h[x*2+1]=w,C=b}h[m.length*2]=t.slice(C),t=h.join("")}return t}import Ht from"fs";import qt from"path";var Xt=!1;function Hn(e,i,t,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(h)=>{if(l.size===0)return!1;let C=s(h),x=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&l.has(x))return!0;for(let S of l){let b=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${b}\\s*\\(`).test(C))return!0}return!1},m=new Set(vl),v=(h)=>{if(!h.includes("-")||h.startsWith("@")||h.startsWith(":")||h.startsWith("x-")||h.startsWith("__"))return h;if(h.startsWith("aria-")||h.startsWith("data-"))return h;return h.replace(/-([a-z0-9])/g,(C,x)=>x.toUpperCase())},y=(h,C)=>{let x=v(h);if(c.static[x]=C,x!==h)c.staticNames[x]=h};for(let[h,C]of Object.entries(e)){let x=h.startsWith("x-")&&!m.has(h)&&!h.startsWith("x-bind:")&&!h.startsWith("x-on:")?`:${h.slice(2)}`:h;if(x.startsWith("@")){c.events[x]=C;continue}if(x.startsWith("__stx_")){let S=v(x.slice(6));c.serverDynamic[S]=zt(C,t);continue}if(x.startsWith(":")){let S=v(x.slice(1)),b=C===re?S:C;if(S==="if"||S==="for"||S==="show"){c.clientReactive[S]=b;continue}if(o){c.clientReactive[S]=b;continue}if(N(b,a)){c.clientReactive[S]=b;continue}if(u(b)){c.clientReactive[S]=b;continue}try{if(!f(b)){if(t.debug)console.error(`Unsafe expression in :${S} binding: ${b}`);c.clientReactive[S]=b;continue}let w=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(ot(b).some((M)=>!A.has(M)&&!w.includes(M)&&(!(M in globalThis)||k.has(M)))){c.clientReactive[S]=b;continue}let G=d(b,w)(...Object.values(i));if(c.serverDynamic[S]=G,S!==x.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[S]=x.slice(1)}catch{c.clientReactive[S]=b}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let S=Xn(C,a);if(S!==null){c.clientReactive[v(x)]=S;continue}let b=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(b)try{let w=b[1];if(f(w)){let k=d(w,Object.keys(i))(...Object.values(i));y(x,k!=null?String(k):"")}else{if(t.debug)console.error(`Unsafe expression in ${x}: ${w}`);y(x,C)}}catch(w){if(t.debug)console.error(`Error evaluating expression for ${x}:`,w);y(x,C)}else{let w=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=A.exec(C))!==null)try{let R=k[1];if(!f(R)){if(t.debug)console.error(`Unsafe expression in ${x}: ${R}`);continue}let G=d(R,Object.keys(i))(...Object.values(i));w=w.replace(k[0],String(G??""))}catch(R){if(t.debug)console.error(`Error evaluating expression in ${x}:`,R)}y(x,w)}continue}y(x,C===re?"true":lt(C))}return c}var ft=new Set;function Fh(){ft.clear()}function qn(e,i){let t=`${i}\x00${e}`;if(ft.has(t))return;ft.add(t),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Xn(e,i){if(i.size===0)return null;let t=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(t)];if(!o.some((u)=>N(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(m)=>`\\${m}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var Vn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Zn(e,i,t){if(!e.includes("@"))return e;if(!Vn.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return oe(e,i,t)}catch{return e}}function he(e){let i={},t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o){let u=e[t];if(u==="\\"&&t+1<o){t++,c+=e[t],t++;continue}if(u===l){t++;break}c+=u,t++}}else if(e[t]==="{"){c=Be(e,t),t+=c.length;let l=Ft(c);if(l!==null){i[`:${a}`]=l;continue}}else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i[a]=c}else i[a]=re}return i}function Vt(e){return Object.entries(e).map(([i,t])=>t===re?i:`${i}="${Gn(t)}"`).join(" ")}function Gn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kn(e){let i=new Set,t=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=t.exec(e))!==null){let a=o[1];if(de.isBuiltin(a))i.add(a)}return[...i].sort()}async function Bf(e,i,t,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=qt.dirname(t),u=[],m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let h of e.matchAll(m)){let[C,x,S]=h,b=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=S,A,k=[];while((A=b.exec(S))!==null){let[R,T,G,M]=A,F=null,H=null;if(M.startsWith(".")||M.startsWith("/")){let B=qt.resolve(l,M);if(B.endsWith(".stx"))H=B;else{let q=`${B}.stx`;try{if(Ht.statSync(q).isFile())H=q}catch{try{if(Ht.statSync(B).isDirectory())F=B}catch{}}}}else F=Ls(M,l);if(!F&&!H)continue;let E=!1,O=(B,q)=>{c.set(B,q),c.set(B.toLowerCase(),q);let L=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(L,q),a.add(q)};if(G&&H)O(G,H),E=!0;else if(T){let B=T.slice(1,-1).split(",").map((L)=>L.trim()).filter(Boolean).map((L)=>{let X=L.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X)return{source:X[1],local:X[2]};return{source:L,local:L}}),q=F?xr(F):null;for(let{source:L,local:X}of B){let z=null;if(H)z=H;else if(q)z=q.get(L)??q.get(L.toLowerCase())??q.get(L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(z)O(X,z),E=!0}}if(E)k.push({start:A.index,end:A.index+R.length})}if(k.length===0)continue;for(let R=k.length-1;R>=0;R--)w=w.slice(0,k[R].start)+w.slice(k[R].end);u.push({start:h.index,end:h.index+C.length,value:`<script${x}>${w}</script>`})}if(u.length===0)return e;let v=[],y=0;for(let h of u)v.push(e.slice(y,h.start),h.value),y=h.end;return v.push(e.slice(y)),v.join("")}async function Jn(e,i,t,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,m;while((m=u.exec(c))!==null){let[v,y]=m,h=y.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of h){let x=C.split("/"),b=x[x.length-1].replace(/\.stx$/,""),w=b.includes("-")?b.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):b.charAt(0).toUpperCase()+b.slice(1),A=null,k=js(C,t,o);for(let R of k)try{if(await Bun.file(R).exists()){A=R;break}}catch{}if(A){l.set(w,A),l.set(b,A),l.set(b.toLowerCase(),A);let R=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,A),a.add(A),o.debug)console.log(`Imported component: ${w} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function Yn(e,i,t,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,m=/@component\s*\(/g,v;while((v=m.exec(c))!==null){let y=v.index,h=y+v[0].length-1,C=1,x=h+1;while(x<c.length&&C>0){if(c[x]==="(")C++;else if(c[x]===")"){if(C--,C===0)break}x++}if(C!==0)break;let S=c.substring(h+1,x),b=x+1,w=S.match(/^\s*['"]([^'"]+)['"]/);if(!w){m.lastIndex=b;continue}let A=w[1],k,R=S.slice(w[0].length),T=R.match(/^\s*,\s*/);if(T)k=R.slice(T[0].length).trim();let G={};if(k)try{G=P(k,i)}catch(B){let q=B instanceof Error?B.message:String(B);c=c.replace(c.substring(y,b),`[Error parsing component props: ${q}]`);continue}let M="",F=b,E=c.substring(b).match(/^([\s\S]*?)@endcomponent/);if(E)M=E[1].trim(),F=b+E[0].length;let O=await ze(A,G,M,l,i,t,o,u,a);c=c.substring(0,y)+O+c.substring(F),m.lastIndex=0}return c}async function Qn(e,i,t,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,m=nr(c);if(m.size>0){let b=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...b,...m])]}let v=J(c);c=v.output;let y=st(i);return c=await S(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await S(c,/[A-Z][a-zA-Z0-9]*/,!0,Mt(Er)),c=await S(c,/[a-z][a-z0-9]*/,!1,Er),c=v.restore(c),c;async function S(b,w,A,k){if(!b)return b;let R=b,T=Lt(R,w,k),G=ut(R),M=new Map;for(let E=T.length-1;E>=0;E--){let O=T[E],B=A?U(O.tagName):O.tagName,q=he(Zn(O.attributes,i,t)),L=G.filter(({start:I,end:_})=>O.startIndex>=I&&O.startIndex<_);if(L.some((I)=>I.tag==="template"))qn(O.tagName,t);let X=L.length>0,z=new Set(y);for(let I of L)for(let _ of I.names)z.add(_);let D=Hn(q,i,o,X,z);if(typeof D.clientReactive.for==="string")for(let I of Y(D.clientReactive.for))z.add(I);let ce=de.getBuiltin(O.tagName),$e=ce?await Rr(O.tagName,l,i,t,o):!1,K=O.tagName==="Image"&&Bs([...Object.keys(D.static),...Object.keys(D.serverDynamic),...Object.keys(D.clientReactive)],Object.keys(D.events),{...D.static,...D.serverDynamic})&&(o._pluginComponentDirs??[]).some((I)=>xr(I).has("Image"));if(ce&&!$e&&!K){let I={context:i,filePath:t,options:o,dependencies:a},_=ce.render(D,O.content,I);if(Object.keys(D.events).length>0){let ee=Vt(D.events);_=_.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ee}`)}if(Object.keys(D.clientReactive).length>0)_=Zt(_,D.clientReactive);M.set(E,_);continue}if(!A&&O.tagName.includes("-")&&!await Rr(B,l,i,t,o))continue;let le={};for(let[I,_]of Object.entries(D.static))le[I]=_;for(let[I,_]of Object.entries(D.serverDynamic))le[I]=_;let te={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(D.clientReactive),events:Object.keys(D.events)},j=await ze(B,le,v.restore(O.content),l,i,t,o,u,a,[...z],te,O.tagName);if(j=er(j,D,te.declaredProps,te.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let I=te.reactiveProps.filter((ne)=>!te.consumedProps.has(ne)&&!["if","for","show","key","ref"].includes(ne)).map(U),_=dt(j,!0);if(I.length&&_){if(!Object.hasOwn(he(j.slice(_.insertPos,_.tagEnd)),"data-stx-native-host-root"))j=j.slice(0,_.insertPos)+' data-stx-native-host-root="true"'+j.slice(_.insertPos);let ne=we(j);j=j.slice(0,ne.insertPos)+` data-stx-native-forward="${I.join(" ")}"`+j.slice(ne.insertPos)}let ee=dt(j,!0);if(ee){let ne=he(j.slice(ee.insertPos,ee.tagEnd)),Se=we(j),Kt=he(j.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(ne,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))j=j.slice(0,Se.insertPos)+" data-stx-native-host-owner"+j.slice(Se.insertPos)}}if(Object.keys(D.events).length>0){let I=we(j);if(I){let _=Vt(D.events),ee=Object.keys(D.events).map((ne)=>ne.replace(/^@/,"").split(".")[0]).join(" ");j=j.substring(0,I.insertPos)+` data-stx-parent-events="${ee}" ${_}`+j.substring(I.insertPos)}}if(Object.keys(D.clientReactive).length>0)j=Zt(j,D.clientReactive);M.set(E,j)}if(M.size===0)return R;let F="",H=0;for(let E=0;E<T.length;E++){let O=M.get(E);if(O===void 0)continue;F+=R.slice(H,T[E].startIndex),F+=O,H=T[E].endIndex}return F+=R.slice(H),F}}function Zt(e,i){let t=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([y])=>!t.has(y)),c=a.filter(([y])=>!o.has(y)).map(([y])=>U(y)).join(" "),l=e,u=a.length>0?we(l):null;if(u){let y=a.map(([C,x])=>`:${U(C)}="${x.replace(/"/g,"&quot;")}"`).join(" "),h=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${h} ${y}`+l.substring(u.insertPos)}let m=i.if;if(m)l=`<template :if="${m.replace(/"/g,"&quot;")}">${l}</template>`;let v=i.for;if(v){let y=i.key,h=y?` :key="${y.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${v.replace(/"/g,"&quot;")}"${h}>${l}</template>`}return l}function er(e,i,t=new Set,o=new Set,a=!1){let c=dt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let S=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,b=S.test(l)?l.replace(S,(w,A,k,R,T)=>`${A}class="${n(`${lt(k??R??T)} ${u}`)}"`):` class="${n(u)}"${l}`;e=e.slice(0,c.insertPos)+b+e.slice(c.tagEnd),c.tagEnd+=b.length-l.length,l=b}let m=a||/\bdata-native(?:\s|=)/i.test(l),v=m?o:t,y=new Set(Object.keys(he(l))),h=new Set(["class","className"]);for(let S of Object.keys(i.static)){let b=i.staticNames[S]??S;if(y.has(b)||v.has(S)||!m&&!qe(b))h.add(S)}for(let S of Object.keys(i.serverDynamic)){let b=i.serverDynamicNames?.[S]??S;if(y.has(b)||v.has(S)||!m&&!qe(b))h.add(S)}let C=[];if(m){for(let[S,b]of Object.entries(i.static)){if(h.has(S)||b!==!0&&b!==re)continue;h.add(S),C.push(`${n(i.staticNames?.[S]??S)}="true"`)}for(let[S,b]of Object.entries(i.serverDynamic)){if(h.has(S)||b!==!0)continue;h.add(S),C.push(`${n(i.serverDynamicNames?.[S]??S)}="true"`)}}let x=[...se(i,h),...ae(i,h),...C];if(m){for(let[S,b]of Object.entries(i.serverDynamic)){if(h.has(S)||b!==!1)continue;let w=i.serverDynamicNames?.[S]??S;x.push(`${n(w)}="false"`)}for(let[S,b]of Object.entries(i.serverDynamic)){if(h.has(S)||b===null||typeof b!=="object")continue;let w=JSON.stringify(b);if(w!==void 0){let A=i.serverDynamicNames?.[S]??S;x.push(`${n(A)}="${n(w)}"`)}}}if(x.length===0)return e;return`${e.slice(0,c.insertPos)} ${x.join(" ")}${e.slice(c.insertPos)}`}function we(e){let i=Gt(e,0);if(i)return i;let t=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(t)return{insertPos:t.index+1+t[1].length,tagEnd:gt(e,t.index+1+t[1].length)};return null}function dt(e,i=!1){let t=we(e);if(!t)return null;let o=e.slice(t.insertPos,t.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?Gt(e,t.tagEnd+1):t;return a&&i?tr(e,a)??a:a}function tr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let t=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let y=e.indexOf("-->",o+4);if(y<0)return null;o=e.indexOf("<",y+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),m=o+l[0].length,v=gt(e,m);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let y=new RegExp(`</${u}\\s*>`,"gi");if(y.lastIndex=v+1,!y.exec(e))return null;o=e.indexOf("<",y.lastIndex);continue}else{let y=he(e.slice(m,v)),h=a>0&&(Object.hasOwn(y,"data-stx-component-wrapper")||Object.hasOwn(y,"data-stx-native-host-owner"));if(c===void 0&&!h&&Object.hasOwn(y,"data-stx-native-host-root"))return{insertPos:m,tagEnd:v};if(!t.has(u)&&e[v-1]!=="/"){if(a++,c===void 0&&h)c=a}else if(a===0)return null}o=e.indexOf("<",v+1)}return null}function Gt(e,i){let t=i;while(t<e.length){let o=e.slice(t),a=o.match(/^\s+/);if(a){t+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",t+4);if(u===-1)return null;t=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,m=e.toLowerCase().indexOf(u,t+c[0].length);if(m===-1)return null;t=m+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:t+1+l[1].length,tagEnd:gt(e,t+1+l[1].length)}}return null}function gt(e,i){let t="";for(let o=i;o<e.length;o++){let a=e[o];if(t){if(a==="\\")o++;else if(a===t)t=""}else if(a==='"'||a==="'")t=a;else if(a===">")return o}return e.length}function nr(e){let i=new Set;for(let t of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=t[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of gi(t[2]))i.add(a);for(let a of t[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function ms(e,i,t,o,a){if(!Xt)Tt(de),Xt=!0;let c=await Bf(e,i,t,o,a);c=await Jn(c,i,t,o,a),c=await Yn(c,i,t,o,a);let l=[];for(let u=0;u<3;u++){let m=l.length,v=fe(c,De,(h,C)=>`\x00STX_COMPONENT_COMMENT_${m+C}\x00`,`STX_COMPONENT_COMMENT:${m}`);l.push(...v.tokens);let y=c;if(c=await Qn(v.output,i,t,o,a),c===y)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,m)=>l[Number(m)]??"");if(o.debug){let u=Kn(c);if(u.length>0)console.warn(`[stx] ${t}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
+ export{zo,Ho,Vo,jh,gs,Bh,fc,Fh,Bf,ms};